Commit 7694da86 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Some enhancements by using Unicode flavors.

parent c0fa60f5
...@@ -132,7 +132,7 @@ static BOOL WINAPI tgt_process_minidump_write(HANDLE hProcess, void* addr, ...@@ -132,7 +132,7 @@ static BOOL WINAPI tgt_process_minidump_write(HANDLE hProcess, void* addr,
return FALSE; return FALSE;
} }
BOOL CALLBACK validate_file(PSTR name, void* user) BOOL CALLBACK validate_file(PCWSTR name, void* user)
{ {
return FALSE; /* get the first file we find !! */ return FALSE; /* get the first file we find !! */
} }
...@@ -149,7 +149,7 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data) ...@@ -149,7 +149,7 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data)
MINIDUMP_MODULE* mm; MINIDUMP_MODULE* mm;
MINIDUMP_STRING* mds; MINIDUMP_STRING* mds;
char exec_name[1024]; char exec_name[1024];
char name[1024]; WCHAR nameW[1024];
unsigned len; unsigned len;
/* fetch PID */ /* fetch PID */
...@@ -173,17 +173,16 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data) ...@@ -173,17 +173,16 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data)
mds = (MINIDUMP_STRING*)((char*)data->mapping + mm->ModuleNameRva); mds = (MINIDUMP_STRING*)((char*)data->mapping + mm->ModuleNameRva);
len = WideCharToMultiByte(CP_ACP, 0, mds->Buffer, len = WideCharToMultiByte(CP_ACP, 0, mds->Buffer,
mds->Length / sizeof(WCHAR), mds->Length / sizeof(WCHAR),
name, sizeof(name) - 1, NULL, NULL); exec_name, sizeof(exec_name) - 1, NULL, NULL);
name[len] = 0; exec_name[len] = 0;
for (ptr = name + len - 1; ptr >= name; ptr--) for (ptr = exec_name + len - 1; ptr >= exec_name; ptr--)
{ {
if (*ptr == '/' || *ptr == '\\') if (*ptr == '/' || *ptr == '\\')
{ {
strcpy(exec_name, ptr + 1); memmove(exec_name, ptr + 1, strlen(ptr + 1) + 1);
break; break;
} }
} }
if (ptr < name) strcpy(exec_name, name);
} }
} }
...@@ -294,22 +293,21 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data) ...@@ -294,22 +293,21 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data)
if (MiniDumpReadDumpStream(data->mapping, Wine_ElfModuleListStream, &dir, if (MiniDumpReadDumpStream(data->mapping, Wine_ElfModuleListStream, &dir,
&stream, &size)) &stream, &size))
{ {
char buffer[MAX_PATH]; WCHAR buffer[MAX_PATH];
mml = (MINIDUMP_MODULE_LIST*)stream; mml = (MINIDUMP_MODULE_LIST*)stream;
for (i = 0, mm = &mml->Modules[0]; i < mml->NumberOfModules; i++, mm++) for (i = 0, mm = &mml->Modules[0]; i < mml->NumberOfModules; i++, mm++)
{ {
mds = (MINIDUMP_STRING*)((char*)data->mapping + mm->ModuleNameRva); mds = (MINIDUMP_STRING*)((char*)data->mapping + mm->ModuleNameRva);
len = WideCharToMultiByte(CP_ACP, 0, mds->Buffer, memcpy(nameW, mds->Buffer, mds->Length);
mds->Length / sizeof(WCHAR), nameW[mds->Length / sizeof(WCHAR)] = 0;
name, sizeof(name) - 1, NULL, NULL); if (SymFindFileInPathW(hProc, NULL, nameW, (void*)(DWORD_PTR)mm->CheckSum,
name[len] = 0; 0, 0, SSRVOPT_DWORD, buffer, validate_file, NULL))
if (SymFindFileInPath(hProc, NULL, name, (void*)(DWORD_PTR)mm->CheckSum, SymLoadModuleExW(hProc, NULL, buffer, NULL, mm->BaseOfImage, mm->SizeOfImage,
0, 0, SSRVOPT_DWORD, buffer, validate_file, NULL)) NULL, 0);
SymLoadModule(hProc, NULL, buffer, NULL, mm->BaseOfImage, mm->SizeOfImage);
else else
SymLoadModuleEx(hProc, NULL, name, NULL, mm->BaseOfImage, mm->SizeOfImage, SymLoadModuleExW(hProc, NULL, nameW, NULL, mm->BaseOfImage, mm->SizeOfImage,
NULL, SLMFLAG_VIRTUAL); NULL, SLMFLAG_VIRTUAL);
} }
} }
if (MiniDumpReadDumpStream(data->mapping, ModuleListStream, &dir, &stream, &size)) if (MiniDumpReadDumpStream(data->mapping, ModuleListStream, &dir, &stream, &size))
...@@ -318,12 +316,10 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data) ...@@ -318,12 +316,10 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data)
for (i = 0, mm = &mml->Modules[0]; i < mml->NumberOfModules; i++, mm++) for (i = 0, mm = &mml->Modules[0]; i < mml->NumberOfModules; i++, mm++)
{ {
mds = (MINIDUMP_STRING*)((char*)data->mapping + mm->ModuleNameRva); mds = (MINIDUMP_STRING*)((char*)data->mapping + mm->ModuleNameRva);
len = WideCharToMultiByte(CP_ACP, 0, mds->Buffer, memcpy(nameW, mds->Buffer, mds->Length);
mds->Length / sizeof(WCHAR), nameW[mds->Length / sizeof(WCHAR)] = 0;
name, sizeof(name) - 1, NULL, NULL); SymLoadModuleExW(hProc, NULL, nameW, NULL, mm->BaseOfImage, mm->SizeOfImage,
name[len] = 0; NULL, 0);
SymLoadModule(hProc, NULL, name, NULL,
mm->BaseOfImage, mm->SizeOfImage);
} }
} }
if (MiniDumpReadDumpStream(data->mapping, ExceptionStream, &dir, &stream, &size)) if (MiniDumpReadDumpStream(data->mapping, ExceptionStream, &dir, &stream, &size))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment