Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfb1f68e

Browse files
committed
Always pass a full path name to LoadLibraryEx(). Fixes some Windows 9x problems. As discussed on python-dev
1 parentb4bbcd7 commitfb1f68e

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

‎Python/dynload_win.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -163,24 +163,21 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
163163

164164
#ifdefMS_WIN32
165165
{
166-
HINSTANCEhDLL;
166+
HINSTANCEhDLL=NULL;
167167
charpathbuf[260];
168-
if (strchr(pathname,'\\')==NULL&&
169-
strchr(pathname,'/')==NULL)
170-
{
171-
/* Prefix bare filename with ".\" */
172-
char*p=pathbuf;
173-
*p='\0';
174-
_getcwd(pathbuf,sizeofpathbuf);
175-
if (*p!='\0'&&p[1]==':')
176-
p+=2;
177-
sprintf(p,".\\%-.255s",pathname);
178-
pathname=pathbuf;
179-
}
180-
/* Look for dependent DLLs in directory of pathname first */
181-
/* XXX This call doesn't exist in Windows CE */
182-
hDLL=LoadLibraryEx(pathname,NULL,
183-
LOAD_WITH_ALTERED_SEARCH_PATH);
168+
LPTSTRdummy;
169+
/* We use LoadLibraryEx so Windows looks for dependent DLLs
170+
in directory of pathname first. However, Windows95
171+
can sometimes not work correctly unless the absolute
172+
path is used. If GetFullPathName() fails, the LoadLibrary
173+
will certainly fail too, so use its error code */
174+
if (GetFullPathName(pathname,
175+
sizeof(pathbuf),
176+
pathbuf,
177+
&dummy))
178+
/* XXX This call doesn't exist in Windows CE */
179+
hDLL=LoadLibraryEx(pathname,NULL,
180+
LOAD_WITH_ALTERED_SEARCH_PATH);
184181
if (hDLL==NULL){
185182
charerrBuf[256];
186183
unsignedinterrorCode;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp