Commit ebb4f937 authored by Christian Heimes's avatar Christian Heimes

Applied #1069410

The "can't load dll" message box on Windows is suppressed while an extension is loaded by calling SetErrorMode in dynload_win.c. The error is still reported properly.
parent ce1b92a9
...@@ -12,6 +12,10 @@ What's New in Python 2.6 alpha 1? ...@@ -12,6 +12,10 @@ What's New in Python 2.6 alpha 1?
Core and builtins Core and builtins
----------------- -----------------
- Issue #1069410: The "can't load dll" message box on Windows is
suppressed while an extension is loaded by calling SetErrorMode in
dynload_win.c. The error is still reported properly.
- Bug #1915: Python compiles with --enable-unicode=no again. However - Bug #1915: Python compiles with --enable-unicode=no again. However
several extension methods and modules do not work without unicode several extension methods and modules do not work without unicode
support. support.
......
...@@ -171,11 +171,16 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, ...@@ -171,11 +171,16 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
HINSTANCE hDLL = NULL; HINSTANCE hDLL = NULL;
char pathbuf[260]; char pathbuf[260];
LPTSTR dummy; LPTSTR dummy;
unsigned int old_mode;
/* We use LoadLibraryEx so Windows looks for dependent DLLs /* We use LoadLibraryEx so Windows looks for dependent DLLs
in directory of pathname first. However, Windows95 in directory of pathname first. However, Windows95
can sometimes not work correctly unless the absolute can sometimes not work correctly unless the absolute
path is used. If GetFullPathName() fails, the LoadLibrary path is used. If GetFullPathName() fails, the LoadLibrary
will certainly fail too, so use its error code */ will certainly fail too, so use its error code */
/* Don't display a message box when Python can't load a DLL */
old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
if (GetFullPathName(pathname, if (GetFullPathName(pathname,
sizeof(pathbuf), sizeof(pathbuf),
pathbuf, pathbuf,
...@@ -183,6 +188,10 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, ...@@ -183,6 +188,10 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
/* XXX This call doesn't exist in Windows CE */ /* XXX This call doesn't exist in Windows CE */
hDLL = LoadLibraryEx(pathname, NULL, hDLL = LoadLibraryEx(pathname, NULL,
LOAD_WITH_ALTERED_SEARCH_PATH); LOAD_WITH_ALTERED_SEARCH_PATH);
/* restore old error mode settings */
SetErrorMode(old_mode);
if (hDLL==NULL){ if (hDLL==NULL){
char errBuf[256]; char errBuf[256];
unsigned int errorCode; unsigned int errorCode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment