mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	Always pass a full path name to LoadLibraryEx(). Fixes some Windows 9x problems. As discussed on python-dev
This commit is contained in:
		
							parent
							
								
									b4bbcd76ea
								
							
						
					
					
						commit
						fb1f68ed7c
					
				
					 1 changed files with 14 additions and 17 deletions
				
			
		| 
						 | 
					@ -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;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue