1
0
Fork 0

DBG: added some extra try to get the path from handle (use devicepath when failed)

This commit is contained in:
Mr. eXoDia 2014-07-07 20:03:05 +02:00
parent cf404b9273
commit e038d690da
3 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,4 @@
#include "_global.h" #include "_global.h"
#include "DeviceNameResolver\DeviceNameResolver.h"
#include <new> #include <new>
HINSTANCE hInst; HINSTANCE hInst;

View File

@ -19,6 +19,7 @@
#include <tlhelp32.h> #include <tlhelp32.h>
#include "..\x64_dbg_bridge\bridgemain.h" #include "..\x64_dbg_bridge\bridgemain.h"
#include "jansson\jansson.h" #include "jansson\jansson.h"
#include "DeviceNameResolver\DeviceNameResolver.h"
#ifdef __GNUC__ #ifdef __GNUC__
#include "dbghelp\dbghelp.h" #include "dbghelp\dbghelp.h"

View File

@ -565,7 +565,10 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
void* base=CreateProcessInfo->lpBaseOfImage; void* base=CreateProcessInfo->lpBaseOfImage;
char DebugFileName[deflen]=""; char DebugFileName[deflen]="";
if(!GetFileNameFromHandle(CreateProcessInfo->hFile, DebugFileName)) if(!GetFileNameFromHandle(CreateProcessInfo->hFile, DebugFileName))
{
if(!DevicePathFromFileHandleA(CreateProcessInfo->hFile, DebugFileName, deflen))
strcpy(DebugFileName, "??? (GetFileNameFromHandle failed!)"); strcpy(DebugFileName, "??? (GetFileNameFromHandle failed!)");
}
dprintf("Process Started: "fhex" %s\n", base, DebugFileName); dprintf("Process Started: "fhex" %s\n", base, DebugFileName);
//init program database //init program database
@ -750,8 +753,10 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
void* base=LoadDll->lpBaseOfDll; void* base=LoadDll->lpBaseOfDll;
char DLLDebugFileName[deflen]=""; char DLLDebugFileName[deflen]="";
if(!GetFileNameFromHandle(LoadDll->hFile, DLLDebugFileName)) if(!GetFileNameFromHandle(LoadDll->hFile, DLLDebugFileName))
{
if(!DevicePathFromFileHandleA(LoadDll->hFile, DLLDebugFileName, deflen))
strcpy(DLLDebugFileName, "??? (GetFileNameFromHandle failed!)"); strcpy(DLLDebugFileName, "??? (GetFileNameFromHandle failed!)");
}
SymLoadModuleEx(fdProcessInfo->hProcess, LoadDll->hFile, DLLDebugFileName, 0, (DWORD64)base, 0, 0, 0); SymLoadModuleEx(fdProcessInfo->hProcess, LoadDll->hFile, DLLDebugFileName, 0, (DWORD64)base, 0, 0, 0);
IMAGEHLP_MODULE64 modInfo; IMAGEHLP_MODULE64 modInfo;
memset(&modInfo, 0, sizeof(modInfo)); memset(&modInfo, 0, sizeof(modInfo));