static void win32_add_one_solib (const char *name, CORE_ADDR load_addr) { char buf[MAX_PATH + 1]; char buf2[MAX_PATH + 1]; #ifdef _WIN32_WCE WIN32_FIND_DATA w32_fd; WCHAR wname[MAX_PATH + 1]; mbstowcs (wname, name, MAX_PATH); HANDLE h = FindFirstFile (wname, &w32_fd); #else WIN32_FIND_DATAA w32_fd; HANDLE h = FindFirstFileA (name, &w32_fd); #endif /* The symbols in a dll are offset by 0x1000, which is the offset from 0 of the first byte in an image - because of the file header and the section alignment. */ load_addr += 0x1000; if (h == INVALID_HANDLE_VALUE) strcpy (buf, name); else { FindClose (h); strcpy (buf, name); #ifndef _WIN32_WCE { char cwd[MAX_PATH + 1]; char *p; if (GetCurrentDirectoryA (MAX_PATH + 1, cwd)) { p = strrchr (buf, '\\'); if (p) p[1] = '\0'; SetCurrentDirectoryA (buf); GetFullPathNameA (w32_fd.cFileName, MAX_PATH, buf, &p); SetCurrentDirectoryA (cwd); } } #endif } #ifndef _WIN32_WCE if (strcasecmp (buf, "ntdll.dll") == 0) { GetSystemDirectoryA (buf, sizeof (buf)); strcat (buf, "\\ntdll.dll"); } #endif #ifdef __CYGWIN__ cygwin_conv_path (CCP_WIN_A_TO_POSIX, buf, buf2, sizeof (buf2)); #else strcpy (buf2, buf); #endif loaded_dll (buf2, load_addr); }
static void win32_add_one_solib (const char *name, CORE_ADDR load_addr) { char buf[MAX_PATH + 1]; char buf2[MAX_PATH + 1]; #ifdef _WIN32_WCE WIN32_FIND_DATA w32_fd; WCHAR wname[MAX_PATH + 1]; mbstowcs (wname, name, MAX_PATH); HANDLE h = FindFirstFile (wname, &w32_fd); #else WIN32_FIND_DATAA w32_fd; HANDLE h = FindFirstFileA (name, &w32_fd); #endif if (h == INVALID_HANDLE_VALUE) strcpy (buf, name); else { FindClose (h); strcpy (buf, name); #ifndef _WIN32_WCE { char cwd[MAX_PATH + 1]; char *p; if (GetCurrentDirectoryA (MAX_PATH + 1, cwd)) { p = strrchr (buf, '\\'); if (p) p[1] = '\0'; SetCurrentDirectoryA (buf); GetFullPathNameA (w32_fd.cFileName, MAX_PATH, buf, &p); SetCurrentDirectoryA (cwd); } } #endif } #ifndef _WIN32_WCE if (strcasecmp (buf, "ntdll.dll") == 0) { GetSystemDirectoryA (buf, sizeof (buf)); strcat (buf, "\\ntdll.dll"); } #endif #ifdef __CYGWIN__ cygwin_conv_to_posix_path (buf, buf2); #else strcpy (buf2, buf); #endif loaded_dll (buf2, load_addr); }