@@ -163,24 +163,21 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
163
163
164
164
#ifdef MS_WIN32
165
165
{
166
- HINSTANCE hDLL ;
166
+ HINSTANCE hDLL = NULL ;
167
167
char pathbuf [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 , sizeof pathbuf );
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
+ LPTSTR dummy ;
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 );
184
181
if (hDLL == NULL ){
185
182
char errBuf [256 ];
186
183
unsigned int errorCode ;
0 commit comments