mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 487174 - Modify nsXULStub to launch from GRE folder on WinCE r=bsmedberg
This commit is contained in:
parent
983ce3f149
commit
1c927ffb50
@ -45,6 +45,12 @@
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#ifdef WINCE
|
||||
#define MOZ_LOADLIBRARY_FLAGS 0
|
||||
#else
|
||||
#define MOZ_LOADLIBRARY_FLAGS LOAD_WITH_ALTERED_SEARCH_PATH
|
||||
#endif
|
||||
|
||||
struct DependentLib
|
||||
{
|
||||
HINSTANCE libHandle;
|
||||
@ -70,12 +76,16 @@ AppendDependentLib(HINSTANCE libHandle)
|
||||
static void
|
||||
ReadDependentCB(const char *aDependentLib)
|
||||
{
|
||||
wchar_t wideDependentLib[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, aDependentLib, -1, wideDependentLib, MAX_PATH);
|
||||
|
||||
HINSTANCE h =
|
||||
LoadLibraryExW(NS_ConvertUTF8toUTF16(aDependentLib).get(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||
if (!h)
|
||||
return;
|
||||
LoadLibraryExW(wideDependentLib, NULL, MOZ_LOADLIBRARY_FLAGS);
|
||||
|
||||
if (!h) {
|
||||
wprintf(L"Error loading %s\n", wideDependentLib);
|
||||
return;
|
||||
}
|
||||
AppendDependentLib(h);
|
||||
}
|
||||
|
||||
@ -160,7 +170,7 @@ XPCOMGlueLoad(const char *aXpcomFile)
|
||||
|
||||
_snwprintf(lastSlash, MAXPATHLEN - wcslen(xpcomDir), L"\\" LXUL_DLL);
|
||||
sXULLibrary =
|
||||
LoadLibraryExW(xpcomDir, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||
LoadLibraryExW(xpcomDir, NULL, MOZ_LOADLIBRARY_FLAGS);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (!sXULLibrary)
|
||||
@ -177,14 +187,13 @@ XPCOMGlueLoad(const char *aXpcomFile)
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
wprintf(L"Error loading xul.dll: %s\n", lpMsgBuf);
|
||||
wprintf(L"Error loading %s: %s\n", xpcomDir, lpMsgBuf);
|
||||
}
|
||||
#endif //DEBUG
|
||||
}
|
||||
}
|
||||
HINSTANCE h =
|
||||
LoadLibraryExW(xpcomFile, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||
|
||||
LoadLibraryExW(xpcomFile, NULL, MOZ_LOADLIBRARY_FLAGS);
|
||||
|
||||
if (!h)
|
||||
{
|
||||
@ -201,7 +210,7 @@ XPCOMGlueLoad(const char *aXpcomFile)
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
wprintf(L"Error loading xpcom.dll: %s\n", lpMsgBuf);
|
||||
wprintf(L"Error loading %s: %s\n", xpcomFile, lpMsgBuf);
|
||||
#endif
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -331,7 +331,6 @@ main(int argc, char **argv)
|
||||
DosSetExtLIBPATH(tmpPath, BEGIN_LIBPATH);
|
||||
#endif
|
||||
|
||||
#ifndef WINCE
|
||||
rv = XPCOMGlueStartup(greDir);
|
||||
if (NS_FAILED(rv)) {
|
||||
Output(PR_TRUE, "Couldn't load XPCOM.\n");
|
||||
@ -388,35 +387,6 @@ main(int argc, char **argv)
|
||||
NS_LogTerm();
|
||||
|
||||
XPCOMGlueShutdown();
|
||||
#else
|
||||
// LoadLibraryExW doesn't take the LOAD_WITH_ALTERED_SEARCH_PATH flag, caling
|
||||
// xulrunner.exe from the gre dir sets the library search path correctly.
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
ZeroMemory(&si, sizeof(si));
|
||||
ZeroMemory(&pi, sizeof(si));
|
||||
si.cb = sizeof(si);
|
||||
wchar_t xrPath[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, greDir, -1, xrPath, MAX_PATH);
|
||||
wchar_t* wLastSlash = wcsrchr(xrPath, PATH_SEPARATOR_CHAR);
|
||||
if (wLastSlash) {
|
||||
*wLastSlash = L'\0';
|
||||
}
|
||||
wcscat(xrPath, L"\\xulrunner.exe");
|
||||
|
||||
wchar_t wideIniPath[MAX_PATH+2];
|
||||
swprintf(wideIniPath, L"\"%S\"", iniPath);
|
||||
|
||||
CreateProcessW(xrPath, wideIniPath, NULL, NULL, FALSE, 0, NULL, NULL,
|
||||
&si, &pi);
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
DWORD retval = 0;
|
||||
if (!GetExitCodeProcess(pi.hProcess, &retval))
|
||||
printf("failed to get exit code, error = %d\n", retval = GetLastError());
|
||||
|
||||
// Close process and thread handles.
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(pi.hThread);
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user