summaryrefslogtreecommitdiff
path: root/include/LibreOfficeKit/LibreOfficeKitInit.h
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2016-01-19 10:58:07 +0100
committerOliver Specht <oliver.specht@cib.de>2016-01-19 14:39:24 +0000
commit442a022cf7baefbd5519ea55c7978cf839e1f44d (patch)
treeb847bc44a14988bb4f6252e8bfa9e4cf22e67bdd /include/LibreOfficeKit/LibreOfficeKitInit.h
parent802564e036db1ee3df8b19593b7f9f1be0deec54 (diff)
Make LibreOffice kit usable on windows
Uses Ascii variants of LoadLibrary,Get/SetEnvironmentVariable_A_ and adds a freeError function includes windows.h instead of pre/postwin.h Change-Id: I88b7e3ed3818078efec5688e207da47dc4049b98 Reviewed-on: https://gerrit.libreoffice.org/21600 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Diffstat (limited to 'include/LibreOfficeKit/LibreOfficeKitInit.h')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitInit.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 880f11e2391e..23e5772a2e79 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -76,8 +76,7 @@ extern "C"
#else
- #include "prewin.h"
- #include "postwin.h"
+ #include <windows.h>
#define TARGET_LIB "sofficeapp" ".dll"
#define TARGET_MERGED_LIB "mergedlo" ".dll"
#define SEPARATOR '\\'
@@ -85,7 +84,7 @@ extern "C"
void *lok_loadlib(const char *pFN)
{
- return (void *) LoadLibrary(pFN);
+ return (void *) LoadLibraryA(pFN);
}
char *lok_dlerror(void)
@@ -111,11 +110,11 @@ extern "C"
return;
char* sEnvPath = NULL;
- DWORD cChars = GetEnvironmentVariable("PATH", sEnvPath, 0);
+ DWORD cChars = GetEnvironmentVariableA("PATH", sEnvPath, 0);
if (cChars > 0)
{
sEnvPath = new char[cChars];
- cChars = GetEnvironmentVariable("PATH", sEnvPath, cChars);
+ cChars = GetEnvironmentVariableA("PATH", sEnvPath, cChars);
//If PATH is not set then it is no error
if (cChars == 0 && GetLastError() != ERROR_ENVVAR_NOT_FOUND)
{
@@ -125,17 +124,18 @@ extern "C"
}
//prepare the new PATH. Add the Ure/bin directory at the front.
//note also adding ';'
- char * sNewPath = new char[strlen(sEnvPath) + strlen(pPath) + strlen(UNOPATH) + 2];
+ char * sNewPath = new char[strlen(sEnvPath) + strlen(pPath) * 2 + strlen(UNOPATH) + 4];
sNewPath[0] = L'\0';
- strcat(sNewPath, pPath);
- strcat(sNewPath, UNOPATH);
+ strcat(sNewPath, pPath); // program to PATH
+ strcat(sNewPath, ";");
+ strcat(sNewPath, UNOPATH); // UNO to PATH
if (strlen(sEnvPath))
{
strcat(sNewPath, ";");
strcat(sNewPath, sEnvPath);
}
- SetEnvironmentVariable("PATH", sNewPath);
+ SetEnvironmentVariableA("PATH", sNewPath);
delete[] sEnvPath;
delete[] sNewPath;