Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
c35958c5
Kaydet (Commit)
c35958c5
authored
Agu 18, 2015
tarafından
Michael Meeks
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lok: namespace and re-work various types & helper functions.
Change-Id: I36e2a01822883251f9556fcde0e0a9830356ac98
üst
4a3484af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
23 deletions
+37
-23
LibreOfficeKitInit.h
include/LibreOfficeKit/LibreOfficeKitInit.h
+37
-23
No files found.
include/LibreOfficeKit/LibreOfficeKitInit.h
Dosyayı görüntüle @
c35958c5
...
...
@@ -40,7 +40,7 @@ extern "C"
#endif
#define SEPARATOR '/'
void
*
_dlopen
(
const
char
*
pFN
)
void
*
lok_loadlib
(
const
char
*
pFN
)
{
return
dlopen
(
pFN
,
RTLD_LAZY
#if defined __clang__ && defined __linux__ \
...
...
@@ -52,17 +52,17 @@ extern "C"
);
}
char
*
_dlerror
(
void
)
char
*
lok
_dlerror
(
void
)
{
return
dlerror
();
}
void
*
_dlsym
(
void
*
Hnd
,
const
char
*
pName
)
void
*
lok
_dlsym
(
void
*
Hnd
,
const
char
*
pName
)
{
return
dlsym
(
Hnd
,
pName
);
}
int
_dlclose
(
void
*
Hnd
)
int
lok
_dlclose
(
void
*
Hnd
)
{
return
dlclose
(
Hnd
);
}
...
...
@@ -80,24 +80,24 @@ extern "C"
#define SEPARATOR '\\'
#define UNOPATH "\\..\\URE\\bin"
void
*
_dlopen
(
const
char
*
pFN
)
void
*
lok_loadlib
(
const
char
*
pFN
)
{
return
(
void
*
)
LoadLibrary
(
pFN
);
}
char
*
_dlerror
(
void
)
char
*
lok
_dlerror
(
void
)
{
LPSTR
buf
=
NULL
;
FormatMessageA
(
FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FORMAT_MESSAGE_FROM_SYSTEM
,
NULL
,
GetLastError
(),
0
,
reinterpret_cast
<
LPSTR
>
(
&
buf
),
0
,
NULL
);
return
buf
;
}
void
*
_dlsym
(
void
*
Hnd
,
const
char
*
pName
)
void
*
lok
_dlsym
(
void
*
Hnd
,
const
char
*
pName
)
{
return
GetProcAddress
((
HINSTANCE
)
Hnd
,
pName
);
}
int
_dlclose
(
void
*
Hnd
)
int
lok
_dlclose
(
void
*
Hnd
)
{
return
FreeLibrary
((
HINSTANCE
)
Hnd
);
}
...
...
@@ -139,16 +139,12 @@ extern "C"
}
#endif
typedef
LibreOfficeKit
*
(
HookFunction
)(
const
char
*
install_path
);
typedef
LibreOfficeKit
*
(
HookFunction2
)(
const
char
*
install_path
,
const
char
*
user_profile_path
);
static
LibreOfficeKit
*
lok_init_2
(
const
char
*
install_path
,
const
char
*
user_profile_path
)
static
void
*
lok_dlopen
(
const
char
*
install_path
,
char
**
_imp_lib
)
{
char
*
imp_lib
;
void
*
dlhandle
;
HookFunction
*
pSym
;
HookFunction2
*
pSym2
;
*
_imp_lib
=
NULL
;
#if !(defined(__APPLE__) && defined(__arm__))
size_t
partial_length
;
...
...
@@ -172,7 +168,7 @@ static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_p
imp_lib
[
partial_length
++
]
=
SEPARATOR
;
strcpy
(
imp_lib
+
partial_length
,
TARGET_LIB
);
dlhandle
=
_dlopen
(
imp_lib
);
dlhandle
=
lok_loadlib
(
imp_lib
);
if
(
!
dlhandle
)
{
// If TARGET_LIB exists, and likely is a real library (not a
...
...
@@ -183,18 +179,18 @@ static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_p
if
(
stat
(
imp_lib
,
&
st
)
==
0
&&
st
.
st_size
>
100
)
{
fprintf
(
stderr
,
"failed to open library '%s': %s
\n
"
,
imp_lib
,
_dlerror
());
imp_lib
,
lok
_dlerror
());
free
(
imp_lib
);
return
NULL
;
}
strcpy
(
imp_lib
+
partial_length
,
TARGET_MERGED_LIB
);
dlhandle
=
_dlopen
(
imp_lib
);
dlhandle
=
lok_loadlib
(
imp_lib
);
if
(
!
dlhandle
)
{
fprintf
(
stderr
,
"failed to open library '%s': %s
\n
"
,
imp_lib
,
_dlerror
());
imp_lib
,
lok
_dlerror
());
free
(
imp_lib
);
return
NULL
;
}
...
...
@@ -203,23 +199,41 @@ static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_p
imp_lib
=
strdup
(
"the app executable"
);
dlhandle
=
RTLD_MAIN_ONLY
;
#endif
*
_imp_lib
=
imp_lib
;
return
dlhandle
;
}
typedef
LibreOfficeKit
*
(
LokHookFunction
)(
const
char
*
install_path
);
typedef
LibreOfficeKit
*
(
LokHookFunction2
)(
const
char
*
install_path
,
const
char
*
user_profile_path
);
typedef
int
(
LokHookPreInit
)
(
const
char
*
install_path
,
const
char
*
user_profile_path
);
static
LibreOfficeKit
*
lok_init_2
(
const
char
*
install_path
,
const
char
*
user_profile_path
)
{
char
*
imp_lib
;
void
*
dlhandle
;
LokHookFunction
*
pSym
;
LokHookFunction2
*
pSym2
;
dlhandle
=
lok_dlopen
(
install_path
,
&
imp_lib
);
pSym2
=
(
HookFunction2
*
)
_dlsym
(
dlhandle
,
"libreofficekit_hook_2"
);
pSym2
=
(
LokHookFunction2
*
)
lok_dlsym
(
dlhandle
,
"libreofficekit_hook_2"
);
if
(
!
pSym2
)
{
if
(
user_profile_path
!=
NULL
)
{
fprintf
(
stderr
,
"the LibreOffice version in '%s' does not support passing a user profile to the hook function
\n
"
,
imp_lib
);
_dlclose
(
dlhandle
);
lok
_dlclose
(
dlhandle
);
free
(
imp_lib
);
return
NULL
;
}
pSym
=
(
HookFunction
*
)
_dlsym
(
dlhandle
,
"libreofficekit_hook"
);
pSym
=
(
LokHookFunction
*
)
lok
_dlsym
(
dlhandle
,
"libreofficekit_hook"
);
if
(
!
pSym
)
{
fprintf
(
stderr
,
"failed to find hook in library '%s'
\n
"
,
imp_lib
);
_dlclose
(
dlhandle
);
lok
_dlclose
(
dlhandle
);
free
(
imp_lib
);
return
NULL
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment