summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-23 17:15:06 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-23 17:15:06 (GMT)
commitb2302ba9771d3c2795ae6c78d881b0c4715e2f63 (patch)
treeeeb644781fcfb031d1e3c676029dea6987de3b88 /Python
parent082c9b0267e45cdff9bb8d30a4332f63bd14c58e (diff)
downloadcpython-b2302ba9771d3c2795ae6c78d881b0c4715e2f63.zip
cpython-b2302ba9771d3c2795ae6c78d881b0c4715e2f63.tar.gz
cpython-b2302ba9771d3c2795ae6c78d881b0c4715e2f63.tar.bz2
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.
Diffstat (limited to 'Python')
-rw-r--r--Python/dynload_win.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index 751790d..7c71d9c 100644
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -171,11 +171,16 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
HINSTANCE hDLL = NULL;
char pathbuf[260];
LPTSTR dummy;
+ unsigned int old_mode;
/* We use LoadLibraryEx so Windows looks for dependent DLLs
in directory of pathname first. However, Windows95
can sometimes not work correctly unless the absolute
path is used. If GetFullPathName() fails, the LoadLibrary
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,
sizeof(pathbuf),
pathbuf,
@@ -183,6 +188,10 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
/* XXX This call doesn't exist in Windows CE */
hDLL = LoadLibraryEx(pathname, NULL,
LOAD_WITH_ALTERED_SEARCH_PATH);
+
+ /* restore old error mode settings */
+ SetErrorMode(old_mode);
+
if (hDLL==NULL){
char errBuf[256];
unsigned int errorCode;