Commit 2801fe63 authored by Mark Hammond's avatar Mark Hammond

Always pass a full path name to LoadLibraryEx(). Fixes some Windows 9x...

Always pass a full path name to LoadLibraryEx().  Fixes some Windows 9x problems.  As discussed on python-dev
parent 2f6895e9
...@@ -163,24 +163,21 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, ...@@ -163,24 +163,21 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
#ifdef MS_WIN32 #ifdef MS_WIN32
{ {
HINSTANCE hDLL; HINSTANCE hDLL = NULL;
char pathbuf[260]; char pathbuf[260];
if (strchr(pathname, '\\') == NULL && LPTSTR dummy;
strchr(pathname, '/') == NULL) /* We use LoadLibraryEx so Windows looks for dependent DLLs
{ in directory of pathname first. However, Windows95
/* Prefix bare filename with ".\" */ can sometimes not work correctly unless the absolute
char *p = pathbuf; path is used. If GetFullPathName() fails, the LoadLibrary
*p = '\0'; will certainly fail too, so use its error code */
_getcwd(pathbuf, sizeof pathbuf); if (GetFullPathName(pathname,
if (*p != '\0' && p[1] == ':') sizeof(pathbuf),
p += 2; pathbuf,
sprintf(p, ".\\%-.255s", pathname); &dummy))
pathname = pathbuf; /* XXX This call doesn't exist in Windows CE */
} hDLL = LoadLibraryEx(pathname, NULL,
/* Look for dependent DLLs in directory of pathname first */ LOAD_WITH_ALTERED_SEARCH_PATH);
/* XXX This call doesn't exist in Windows CE */
hDLL = LoadLibraryEx(pathname, NULL,
LOAD_WITH_ALTERED_SEARCH_PATH);
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