Changeset 46805 in vbox for trunk/src/VBox/GuestHost/OpenGL/util
- Timestamp:
- Jun 26, 2013 2:24:02 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86742
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/util/dll.c
r46660 r46805 167 167 char *dll_err; 168 168 #if defined(WINDOWS) 169 char szPath[MAX_PATH]; 169 WCHAR szwPath[MAX_PATH]; 170 UINT cwcPath = 0; 170 171 171 172 (void) resolveGlobal; … … 174 175 if (PathIsRelative(dllname)) 175 176 { 176 size_t c bName = strlen(dllname) + 1;177 size_t cName = strlen(dllname) + 1; 177 178 # ifdef IN_GUEST 178 UINT cchPath = GetSystemDirectoryA(szPath, sizeof(szPath)); 179 cwcPath = GetSystemDirectoryW(szwPath, RT_ELEMENTS(szwPath)); 180 if (!cwcPath || cwcPath >= MAX_PATH) 181 { 182 DWORD winEr = GetLastError(); 183 crError("GetSystemDirectoryW failed err %d", winEr); 184 SetLastError(winEr); 185 return NULL; 186 } 179 187 # else 180 UINT cchPath = GetModuleFileNameA(NULL, szPath, sizeof(szPath)); 181 if (cchPath != 0 && cchPath <= sizeof(szPath)) 188 WCHAR * pszwSlashFile; 189 cwcPath = GetModuleFileNameW(NULL, szwPath, RT_ELEMENTS(szwPath)); 190 if (!cwcPath || cwcPath >= MAX_PATH) 182 191 { 183 char * pszSlashFile = strrchr(szPath, '\\'); 184 if (pszSlashFile) 185 { 186 cchPath = pszSlashFile - szPath; 187 } 192 DWORD winEr = GetLastError(); 193 crError("GetModuleFileNameW failed err %d", winEr); 194 SetLastError(winEr); 195 return NULL; 188 196 } 197 198 pszwSlashFile = wcsrchr(szwPath, L'\\'); 199 if (!pszwSlashFile) 200 { 201 crError("failed to match file name"); 202 SetLastError(ERROR_PATH_NOT_FOUND); 203 return NULL; 204 } 205 206 cwcPath = pszwSlashFile - szwPath; 189 207 # endif 190 208 191 if (c chPath + 1 + cbName > sizeof(szPath))209 if (cwcPath + 1 + cName > MAX_PATH) 192 210 { 193 211 crError("invalid path specified"); … … 195 213 return NULL; 196 214 } 197 szPath[cchPath] = '\\'; 198 memcpy(&szPath[cchPath + 1], dllname, cbName); 199 200 dllname = szPath; 215 szwPath[cwcPath] = '\\'; 216 ++cwcPath; 217 } 218 219 if (!MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, dllname, -1, &szwPath[cwcPath], MAX_PATH - cwcPath)) 220 { 221 DWORD winEr = GetLastError(); 222 crError("MultiByteToWideChar failed err %d", winEr); 223 SetLastError(winEr); 224 return NULL; 201 225 } 202 226 # endif // CR_NO_GL_SYSTEM_PATH … … 207 231 208 232 #if defined(WINDOWS) 209 dll->hinstLib = LoadLibrary ( dllname);233 dll->hinstLib = LoadLibraryW( szwPath ); 210 234 if (!dll->hinstLib) 211 235 {
Note:
See TracChangeset
for help on using the changeset viewer.