DBG: added DeviceNameResolver (this hopefully fixes some 'error starting process (invalid pe?)' errors)
DBG: fixed MinGW compile bugs DBG: fixed TitanEngine for MinGW DBG: some more header files in the project
This commit is contained in:
parent
920fedc9ad
commit
29fd03d687
|
@ -0,0 +1,16 @@
|
|||
#ifndef _DEVICENAMERESOLVER_H
|
||||
#define _DEVICENAMERESOLVER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
__declspec(dllexport) bool DevicePathToPathW(const wchar_t* szDevicePath, wchar_t* szPath, size_t nSize);
|
||||
__declspec(dllexport) bool DevicePathToPathA(const char* szDevicePath, char* szPath, size_t nSize);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _DEVICENAMERESOLVER_H
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,5 @@
|
|||
#include "_global.h"
|
||||
#include "DeviceNameResolver\DeviceNameResolver.h"
|
||||
#include <new>
|
||||
|
||||
HINSTANCE hInst;
|
||||
|
@ -116,44 +117,6 @@ bool DirExists(const char* dir)
|
|||
return (attrib==FILE_ATTRIBUTE_DIRECTORY);
|
||||
}
|
||||
|
||||
bool DevicePathToPath(const char* devicepath, char* path, size_t path_size)
|
||||
{
|
||||
if(!devicepath or !path)
|
||||
return false;
|
||||
char curDrive[3]=" :";
|
||||
char curDevice[MAX_PATH]="";
|
||||
for(char drive='C'; drive<='Z'; drive++)
|
||||
{
|
||||
*curDrive=drive;
|
||||
if(!QueryDosDeviceA(curDrive, curDevice, MAX_PATH))
|
||||
continue;
|
||||
size_t curDevice_len=strlen(curDevice);
|
||||
if(!_strnicmp(devicepath, curDevice, curDevice_len)) //we match the device
|
||||
{
|
||||
if(strlen(devicepath)-curDevice_len>=path_size)
|
||||
return false;
|
||||
sprintf(path, "%s%s", curDrive, devicepath+curDevice_len);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PathToDevicePath(const char* path, char* devicepath, size_t devicepath_size)
|
||||
{
|
||||
if(!path or path[1]!=':' or !devicepath)
|
||||
return false;
|
||||
char curDrive[3]=" :";
|
||||
char curDevice[MAX_PATH]="";
|
||||
*curDrive=*path;
|
||||
if(!QueryDosDeviceA(curDrive, curDevice, MAX_PATH))
|
||||
return false;
|
||||
if(strlen(path)-2+strlen(curDevice)>=devicepath_size)
|
||||
return false;
|
||||
sprintf(devicepath, "%s%s", curDevice, path+2);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetFileNameFromHandle(HANDLE hFile, char* szFileName)
|
||||
{
|
||||
if(!GetFileSize(hFile, 0))
|
||||
|
@ -170,7 +133,7 @@ bool GetFileNameFromHandle(HANDLE hFile, char* szFileName)
|
|||
char szMappedName[MAX_PATH]="";
|
||||
if(GetMappedFileNameA(GetCurrentProcess(), pFileMap, szMappedName, MAX_PATH))
|
||||
{
|
||||
if(!DevicePathToPath(szMappedName, szFileName, MAX_PATH))
|
||||
if(!DevicePathToPathA(szMappedName, szFileName, MAX_PATH))
|
||||
return false;
|
||||
UnmapViewOfFile(pFileMap);
|
||||
CloseHandle(hFileMap);
|
||||
|
|
|
@ -106,8 +106,6 @@ void formathex(char* string);
|
|||
void formatdec(char* string);
|
||||
bool FileExists(const char* file);
|
||||
bool DirExists(const char* dir);
|
||||
bool DevicePathToPath(const char* devicepath, char* path, size_t path_size);
|
||||
bool PathToDevicePath(const char* path, char* devicepath, size_t devicepath_size);
|
||||
bool GetFileNameFromHandle(HANDLE hFile, char* szFileName);
|
||||
bool settingboolget(const char* section, const char* name);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "disasm_fast.h"
|
||||
|
||||
#include "BeaEngine\BeaEngine.h"
|
||||
#include "DeviceNameResolver\DeviceNameResolver.h"
|
||||
|
||||
static PROCESS_INFORMATION g_pi= {0,0,0,0};
|
||||
static char szFileName[MAX_PATH]="";
|
||||
|
@ -473,7 +474,7 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
|
|||
if(!GetMappedFileNameA(fdProcessInfo->hProcess, base, DebugFileName, deflen))
|
||||
strcpy(DebugFileName, "??? (GetMappedFileName failed)");
|
||||
else
|
||||
DevicePathToPath(DebugFileName, DebugFileName, deflen);
|
||||
DevicePathToPathA(DebugFileName, DebugFileName, deflen);
|
||||
dprintf("Process Started: "fhex" %s\n", base, DebugFileName);
|
||||
|
||||
//init program database
|
||||
|
@ -655,7 +656,7 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
|
|||
if(!GetMappedFileNameA(fdProcessInfo->hProcess, base, DLLDebugFileName, deflen))
|
||||
strcpy(DLLDebugFileName, "??? (GetMappedFileName failed)");
|
||||
else
|
||||
DevicePathToPath(DLLDebugFileName, DLLDebugFileName, deflen);
|
||||
DevicePathToPathA(DLLDebugFileName, DLLDebugFileName, deflen);
|
||||
dprintf("DLL Loaded: "fhex" %s\n", base, DLLDebugFileName);
|
||||
|
||||
SymLoadModuleEx(fdProcessInfo->hProcess, LoadDll->hFile, DLLDebugFileName, 0, (DWORD64)base, 0, 0, 0);
|
||||
|
|
|
@ -42,9 +42,9 @@ void symenum(uint base, CBSYMBOLENUM cbSymbolEnum, void* user)
|
|||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
static BOOL CALLBACK EnumModules(PCTSTR ModuleName, DWORD64 BaseOfDll, PVOID UserContext)
|
||||
static BOOL CALLBACK EnumModules(LPCTSTR ModuleName, DWORD64 BaseOfDll, PVOID UserContext)
|
||||
#else
|
||||
static BOOL CALLBACK EnumModules(PCTSTR ModuleName, ULONG BaseOfDll, PVOID UserContext)
|
||||
static BOOL CALLBACK EnumModules(LPCTSTR ModuleName, ULONG BaseOfDll, PVOID UserContext)
|
||||
#endif //_WIN64
|
||||
{
|
||||
SYMBOLMODULEINFO curModule;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
//Thanks to: https://github.com/zer0fl4g/Nanomite
|
||||
|
||||
typedef LONG NTSTATUS;
|
||||
|
||||
typedef struct _UNICODE_STRING
|
||||
{
|
||||
USHORT Length;
|
||||
|
|
|
@ -1039,7 +1039,7 @@ bool valapifromstring(const char* name, uint* value, int* value_size, bool print
|
|||
for(unsigned int i=0; i<cbNeeded/sizeof(HMODULE); i++)
|
||||
{
|
||||
char szModuleName[MAX_PATH]="";
|
||||
if(GetModuleFileNameExA(fdProcessInfo->hProcess, hMods[i], szModuleName, _countof(szModuleName)))
|
||||
if(GetModuleFileNameExA(fdProcessInfo->hProcess, hMods[i], szModuleName, sizeof(szModuleName)))
|
||||
{
|
||||
char* szBaseName=strchr(szModuleName, '\\');
|
||||
if(szBaseName)
|
||||
|
|
|
@ -30,6 +30,8 @@ static void varsetvalue(VAR* var, VAR_VALUE* value)
|
|||
var->value.u.data->clear();
|
||||
delete var->value.u.data;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
memcpy(&var->value, value, sizeof(VAR_VALUE));
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
<Add library=".\sqlite\libsqlite32.a" />
|
||||
<Add library=".\BeaEngine\libBeaEngine.a" />
|
||||
<Add library=".\XEDParse\XEDParse_x86.a" />
|
||||
<Add library=".\DeviceNameResolver\DeviceNameResolver_x86.a" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="x64">
|
||||
|
@ -51,6 +52,7 @@
|
|||
<Add library=".\sqlite\libsqlite64.a" />
|
||||
<Add library=".\BeaEngine\libBeaEngine_64.a" />
|
||||
<Add library=".\XEDParse\XEDParse_x64.a" />
|
||||
<Add library=".\DeviceNameResolver\DeviceNameResolver_x64.a" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
|
|
|
@ -44,12 +44,19 @@
|
|||
<ClInclude Include="addrinfo.h" />
|
||||
<ClInclude Include="argument.h" />
|
||||
<ClInclude Include="assemble.h" />
|
||||
<ClInclude Include="BeaEngine\basic_types.h" />
|
||||
<ClInclude Include="BeaEngine\BeaEngine.h" />
|
||||
<ClInclude Include="BeaEngine\export.h" />
|
||||
<ClInclude Include="BeaEngine\macros.h" />
|
||||
<ClInclude Include="breakpoint.h" />
|
||||
<ClInclude Include="command.h" />
|
||||
<ClInclude Include="console.h" />
|
||||
<ClInclude Include="data.h" />
|
||||
<ClInclude Include="dbg.h" />
|
||||
<ClInclude Include="dbghelp\dbghelp.h" />
|
||||
<ClInclude Include="dbg\dbg.h" />
|
||||
<ClInclude Include="debugger.h" />
|
||||
<ClInclude Include="DeviceNameResolver\DeviceNameResolver.h" />
|
||||
<ClInclude Include="disasm_fast.h" />
|
||||
<ClInclude Include="disasm_helper.h" />
|
||||
<ClInclude Include="instruction.h" />
|
||||
|
@ -60,14 +67,17 @@
|
|||
<ClInclude Include="reference.h" />
|
||||
<ClInclude Include="simplescript.h" />
|
||||
<ClInclude Include="sqlhelper.h" />
|
||||
<ClInclude Include="sqlite\sqlite3.h" />
|
||||
<ClInclude Include="stackinfo.h" />
|
||||
<ClInclude Include="symbolinfo.h" />
|
||||
<ClInclude Include="thread.h" />
|
||||
<ClInclude Include="threading.h" />
|
||||
<ClInclude Include="TitanEngine\TitanEngine.h" />
|
||||
<ClInclude Include="undocumented.h" />
|
||||
<ClInclude Include="value.h" />
|
||||
<ClInclude Include="variable.h" />
|
||||
<ClInclude Include="x64_dbg.h" />
|
||||
<ClInclude Include="XEDParse\XEDParse.h" />
|
||||
<ClInclude Include="_exports.h" />
|
||||
<ClInclude Include="_global.h" />
|
||||
<ClInclude Include="_plugins.h" />
|
||||
|
@ -98,13 +108,13 @@
|
|||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\x32</OutDir>
|
||||
<OutDir>$(SolutionDir)bin\x32\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<TargetName>x32_dbg</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\x64</OutDir>
|
||||
<OutDir>$(SolutionDir)bin\x64\</OutDir>
|
||||
<TargetName>x64_dbg</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
@ -120,7 +130,7 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32_bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;sqlite\sqlite32.lib;BeaEngine\BeaEngine.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32_bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;sqlite\sqlite32.lib;BeaEngine\BeaEngine.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -135,7 +145,7 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64_bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;sqlite\sqlite64.lib;BeaEngine\BeaEngine_64.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64_bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;sqlite\sqlite64.lib;BeaEngine\BeaEngine_64.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -13,6 +13,27 @@
|
|||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\BeaEngine">
|
||||
<UniqueIdentifier>{6028af23-e8de-4db7-b1c7-bee2b5a4402b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\dbghelp">
|
||||
<UniqueIdentifier>{5623fb24-3b6d-49a6-a0d3-1cfcc46f87bd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\sqlite">
|
||||
<UniqueIdentifier>{fa9d17d3-a464-4693-b1d8-0d0c10a88bd1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\dbg">
|
||||
<UniqueIdentifier>{c7d6554c-6b4c-42b2-8d0a-7968cdfdba63}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\TitanEngine">
|
||||
<UniqueIdentifier>{23226861-3b20-42db-8dd6-c5d276ba7a83}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\XEDParse">
|
||||
<UniqueIdentifier>{6b85ff77-8866-4618-9d46-006d8c349f8f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\DeviceNameResolver">
|
||||
<UniqueIdentifier>{f4eb1487-15d6-4836-9d20-339d0f18c31f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="_exports.cpp">
|
||||
|
@ -194,5 +215,35 @@
|
|||
<ClInclude Include="reference.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BeaEngine\basic_types.h">
|
||||
<Filter>Header Files\BeaEngine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BeaEngine\BeaEngine.h">
|
||||
<Filter>Header Files\BeaEngine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BeaEngine\export.h">
|
||||
<Filter>Header Files\BeaEngine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BeaEngine\macros.h">
|
||||
<Filter>Header Files\BeaEngine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dbghelp\dbghelp.h">
|
||||
<Filter>Header Files\dbghelp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dbg\dbg.h">
|
||||
<Filter>Header Files\dbg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="XEDParse\XEDParse.h">
|
||||
<Filter>Header Files\XEDParse</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TitanEngine\TitanEngine.h">
|
||||
<Filter>Header Files\TitanEngine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sqlite\sqlite3.h">
|
||||
<Filter>Header Files\sqlite</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DeviceNameResolver\DeviceNameResolver.h">
|
||||
<Filter>Header Files\DeviceNameResolver</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue