mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Disabe SetDllDirectories on 32bit builds since it causes a crash
This commit is contained in:
parent
3b3b3292df
commit
0a05d2f578
@ -723,5 +723,27 @@ def main():
|
||||
sign_installers(env)
|
||||
|
||||
|
||||
def develop_launcher():
|
||||
import subprocess
|
||||
|
||||
def r(*a):
|
||||
subprocess.check_call(list(a))
|
||||
|
||||
r(
|
||||
'cl.EXE', '/c', '/EHsc', '/MT', '/W3', '/O1', '/nologo', '/D_UNICODE', '/DUNICODE', '/GS-',
|
||||
'/DMODULE="calibre.debug"', '/DBASENAME="calibre-debug"', '/DFUNCTION="main"',
|
||||
r'/TcC:\r\src\bypy\windows\main.c', r'/Fo..\launcher\calibre-debug.obj'
|
||||
)
|
||||
r(
|
||||
'link.EXE', '/MACHINE:X86', '/NODEFAULTLIB', '/ENTRY:start_here',
|
||||
r'/LIBPATH:..\launcher', '/SUBSYSTEM:CONSOLE',
|
||||
r'/LIBPATH:C:\r\sw32\sw\private\python/libs', '/RELEASE',
|
||||
'/MANIFEST:EMBED', r'/MANIFESTINPUT:..\launcher\calibre-debug.obj.manifest',
|
||||
'user32.lib', 'kernel32.lib', r'/OUT:calibre-debug.exe',
|
||||
'user32.lib', '/INCREMENTAL:NO', r'..\launcher\calibre-debug.exe.res',
|
||||
r'..\launcher\calibre-debug.obj', r'..\launcher\calibre-launcher.lib'
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -80,9 +80,13 @@ load_launcher_dll() {
|
||||
return;
|
||||
}
|
||||
wsprintf(dll_point, L"%s\0\0", L"app\\bin");
|
||||
#if _WIN64
|
||||
// Restrict the directories from which DLLs can be loaded
|
||||
// For some reason I cannot determine, using this in 32bit builds causes
|
||||
// a crash even if no dlls are loaded.
|
||||
SETDEFAULTDIRS SetDefaultDllDirectories = (SETDEFAULTDIRS)GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDefaultDllDirectories");
|
||||
if (SetDefaultDllDirectories) SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
|
||||
#endif
|
||||
if (SetDllDirectoryW(buf) == 0) {
|
||||
show_last_error(L"Failed to set DLL directory");
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user