Closed hfiref0x closed 4 years ago
That's interesting, I've never run into this issue. What path did you use? Did it have any special characters?
Check the latest version, please. I've replaced string_converter
with MultiByteToWideChar
.
What path did you use? Did it have any special characters?
c:\Install>pdbex * c:\install\7601.pdb -o c:\install\extract.h
Check the latest version
The latest release 0.18 produce zero size output file. Double checked - msdia140, symsrv from Library/x64 present in program directory.
Unfortunately I cannot compile anymore because 2017 does not understand new C++ features.
contains': is not a member of 'std::map'
Got VS2019, compiled source and seems this problem resolved. I'm able to produce output from above test pdb. It seems the last release I tried failed because directory where pdbex.exe was located contained x64 version of msdia140, symsrv dlls while application from this github release section is x86.
There is a logical bug in code related to loading of msdia140. If this dll not exist or has wrong architecture (like in my case) the above code will produce incorrect result, later this will crash pdbex as invalid memory (NULL) will be dereferenced.
LoadDiaViaCoCreateInstance->CoCreateInstance return error 80040154 next SymbolModuleBase::LoadDiaViaLoadLibrary returns FALSE despite return value declared as HRESULT.
Your code treat LoadDiaViaLoadLibrary result as HRESULT, macro FAILED check if it is < 0, and it is not because Result = FALSE. Thus check successfully passed and program continue it execution until first attemt to use m_DataSource (which is NULL).
This must return HRESULT instead of FALSE.
https://github.com/wbenny/pdbex/blob/000374f6348145c3afa4e17cff9fcd175f39463e/Source/PDB.cpp#L74-L78
https://github.com/wbenny/pdbex/blob/000374f6348145c3afa4e17cff9fcd175f39463e/Source/PDB.cpp#L83-L87
https://github.com/wbenny/pdbex/blob/000374f6348145c3afa4e17cff9fcd175f39463e/Source/PDB.cpp#L92-L95
I would additionally add more diagnostic messages in case if required dlls are missing of having diffrent machine type (Result = HRESULT_FROM_WIN32(ERROR_BAD_EXE_FORMAT) : %1 is not a valid Win32 application. ).
Actually it doesn't work for me at all. I know about #2 however even giving to pdbex compiled version these dlls (confirmed pdbex loaded that msdia140 dll not system msdia) does not solve this problem here. The root of this problem is a unicode conversion of file path in routine
https://github.com/wbenny/pdbex/blob/3fe750269959d4de71582335a9a28e26b3f5fed1/Source/PDB.cpp#L127-L128
this conversion produce trash on output thus "file not found" error will be printed as result always. Not quite sure what is wrong with this fancy C++ stuff, but I would instead use MultiByteToWideChar (and I fixed that for myself) as loadDataFromPdb expect LPCOLESTR which is WCHAR*.