Ghidra is a software reverse engineering (SRE) framework
Use wmain to avoid ansi -> unicode conversion. Enable warning level 4 and fix all generated warnings. RAII the global vars. Enable multi core building so project builds in <1 second on multi core machines. Fix COM error checking, fix spaces -> tabs and other style issues. Add editor config file to enforce tabs.
Paul Moran4da3d65964d5
diff --git a/Ghidra/Features/PDB/src/pdb/.editorconfig b/Ghidra/Features/PDB/src/pdb/.editorconfignew file mode 100644index 0000000000..a156870444--- /dev/null+++ b/Ghidra/Features/PDB/src/pdb/.editorconfig@@ -0,0 +1,8 @@++[*.cpp]+indent_style = tab+indent_size = 4++[*.h]+indent_style = tab+indent_size = 4diff --git a/Ghidra/Features/PDB/src/pdb/cpp/err.cpp b/Ghidra/Features/PDB/src/pdb/cpp/err.cppindex bf22cc23bf..23273427d4 100644--- a/Ghidra/Features/PDB/src/pdb/cpp/err.cpp+++ b/Ghidra/Features/PDB/src/pdb/cpp/err.cpp@@ -30,7 +30,7 @@ void fatal( const char * msg )}void checkErr(HRESULT hResult) {- if (hResult == S_OK) {+ if (SUCCEEDED(hResult)) {return;}switch (hResult) {diff --git a/Ghidra/Features/PDB/src/pdb/cpp/find.cpp b/Ghidra/Features/PDB/src/pdb/cpp/find.cppindex abc0f8c352..45851e116e 100644--- a/Ghidra/Features/PDB/src/pdb/cpp/find.cpp+++ b/Ghidra/Features/PDB/src/pdb/cpp/find.cpp@@ -18,14 +18,14 @@#include <atlcomcli.h>#include <comutil.h>-std::wstring findMangledName(IDiaSymbol& pFunction) {+std::wstring findMangledName(PDBApiContext& ctx, IDiaSymbol& pFunction) {const DWORD rva = getRVA(pFunction);CComPtr<IDiaSymbol> pSymbol;- const HRESULT hr = pSession->findSymbolByRVA(rva, SymTagPublicSymbol, &pSymbol);- if (hr == S_OK) {- DWORD tag = getTag(*pSymbol);+ const HRESULT hr = ctx.Session().findSymbolByRVA(rva, SymTagPublicSymbol, &pSymbol);+ if (SUCCEEDED(hr)) {+ const DWORD tag = getTag(*pSymbol);if (tag == SymTagPublicSymbol) {//do not delete- DWORD address = getRVA(*pSymbol);+ const DWORD address = getRVA(*pSymbol);if (address == rva) {return getName(*pSymbol);}@@ -34,21 +34,24 @@ std::wstring findMangledName(IDiaSymbol& pFunction) {return getName(pFunction);}-void findNameInNamespace( const std::wstring& name, IDiaSymbol& pnamespace )+void findNameInNamespace(PDBApiContext& ctx, const std::wstring& name, IDiaSymbol& pnamespace ){- bstr_t szNamespace;- pnamespace.get_name( szNamespace.GetAddress() );+ bstr_t bstrNamespace;+ if (FAILED(pnamespace.get_name(bstrNamespace.GetAddress()))) {+ fatal("Namespace get_name failed");+ }- std::wstring fullName = name + +L"::" + std::wstring(szNamespace.GetBSTR(), szNamespace.length());+ const std::wstring strNamespace(bstrNamespace.GetBSTR(), bstrNamespace.length());+ const std::wstring fullName = strNamespace + L"::" + name;CComPtr<IDiaEnumSymbols> pEnum;- if ( FAILED( pGlobal->findChildren( SymTagNull, fullName.c_str(), nsCaseSensitive, &pEnum ) ) ) {+ if ( FAILED(ctx.Global().findChildren( SymTagNull, fullName.c_str(), nsCaseSensitive, &pEnum ) ) ) {fatal( "Namespace findChildren failed" );}long cnt = 0;if ( pEnum != NULL && SUCCEEDED( pEnum->get_Count(&cnt) ) && cnt > 0 ) { // Found a name.- printNameFromScope( name.c_str(), *pGlobal, *pEnum );+ printNameFromScope(ctx.Global(), *pEnum );}}@@ -60,7 +63,7 @@ void findNameInEnum( const std::wstring& name, IDiaSymbol& penumeration )}long cnt = 0;if ( pEnum != NULL && SUCCEEDED( pEnum->get_Count(&cnt) ) && cnt > 0 ) { // Found a name.- printNameFromScope( name, penumeration, *pEnum );+ printNameFromScope( penumeration, *pEnum );}}@@ -73,7 +76,7 @@ void findNameInClass( const std::wstring& name, IDiaSymbol& pclass )}long cnt = 0;if (pEnum != NULL && SUCCEEDED(pEnum->get_Count(&cnt)) && cnt > 0) { // Found a name.- printNameFromScope(name, pclass, *pEnum);+ printNameFromScope(pclass, *pEnum);}}@@ -121,7 +124,7 @@ void findNameInClass( const std::wstring& name, IDiaSymbol& pclass )}}-void findCppNameInScope( const std::wstring& name, IDiaSymbol& pScope )+void findCppNameInScope(PDBApiContext& ctx, const std::wstring& name, IDiaSymbol& pScope ){// while ( scope ) {// Scan the scope for a symbol.@@ -131,9 +134,9 @@ void findCppNameInScope( const std::wstring& name, IDiaSymbol& pScope )// scope = scope.parent;// }- wprintf( L"Finding name \"%ws\" in ", name.c_str() );+ printf( "Finding name \"%S\" in ", name.c_str() );printScopeName( pScope );- wprintf( L"\n" );+ printf( "\n" );DWORD celt;long cnt = 0;@@ -141,13 +144,13 @@ void findCppNameInScope( const std::wstring& name, IDiaSymbol& pScope )CComPtr<IDiaSymbol> pParent;CComPtr<IDiaSymbol> pscope;for ( pscope = &pScope; pscope != NULL; ) {- IDiaEnumSymbols * pEnum;+ CComPtr<IDiaEnumSymbols> pEnum;// Local data searchif ( FAILED( pscope->findChildren( SymTagNull, name.c_str(), nsCaseSensitive, &pEnum ) ) ) {fatal( "Local scope findChildren failed" );}if ( pEnum != NULL && SUCCEEDED( pEnum->get_Count(&cnt) ) && cnt > 0 ) { // Found a name.- printNameFromScope( name, *pscope, *pEnum );+ printNameFromScope( *pscope, *pEnum );}pEnum = 0;// Look into any namespaces.@@ -156,7 +159,7 @@ void findCppNameInScope( const std::wstring& name, IDiaSymbol& pScope )}if ( pEnum != NULL && SUCCEEDED( pEnum->get_Count(&cnt) ) && cnt > 0 ) { // Found a namespace.while ( SUCCEEDED( pEnum->Next( 1, &pSym, &celt ) ) && celt == 1 ) {- findNameInNamespace( name, *pSym );+ findNameInNamespace( ctx, name, *pSym );pSym = 0;}}diff --git a/Ghidra/Features/PDB/src/pdb/cpp/iterate.cpp b/Ghidra/Features/PDB/src/pdb/cpp/iterate.cppindex ada39d60b6..ba3799410b 100644--- a/Ghidra/Features/PDB/src/pdb/cpp/iterate.cpp+++ b/Ghidra/Features/PDB/src/pdb/cpp/iterate.cpp@@ -17,15 +17,15 @@#include "iterate.h"static void iterateEnumMembers(IDiaSymbol& pSymbol) {- DWORD celt;- IDiaEnumSymbols * pEnum;- IDiaSymbol * pMember;+ DWORD celt = 0;+ CComPtr<IDiaEnumSymbols> pEnum;+ CComPtr<IDiaSymbol> pMember;pSymbol.findChildren(SymTagNull, NULL, nsNone, &pEnum);if (pEnum == NULL) {return;}while (1) {- if (pEnum->Next( 1, &pMember, &celt ) < 0) {+ if (FAILED(pEnum->Next( 1, &pMember, &celt ))) {break;}if (celt != 1) {@@ -38,17 +38,17 @@ static void iterateEnumMembers(IDiaSymbol& pSymbol) {}}-void iterateEnums() {+void iterateEnums(PDBApiContext& ctx) {DWORD celt = 0;CComPtr<IDiaEnumSymbols> pEnum;CComPtr<IDiaSymbol> pSymbol;- pGlobal->findChildren(SymTagEnum, NULL, nsNone, &pEnum);+ ctx.Global().findChildren(SymTagEnum, NULL, nsNone, &pEnum);if (pEnum == NULL) {return;}printf("%S<enums>\n", indent(4).c_str());while ( 1 ) {- if (pEnum->Next( 1, &pSymbol, &celt ) < 0) {+ if (FAILED(pEnum->Next( 1, &pSymbol, &celt ))) {break;}if (celt != 1) {@@ -60,7 +60,7 @@ void iterateEnums() {continue;}- printf("%S<enum name=\"%ws\" type=\"%S\" length=\"0x%I64x\" >\n", indent(8).c_str(), getName(*pSymbol).c_str(), getTypeAsString(*pSymbol).c_str(), getLength(*pSymbol));+ printf("%S<enum name=\"%S\" type=\"%S\" length=\"0x%I64x\" >\n", indent(8).c_str(), getName(*pSymbol).c_str(), getTypeAsString(*pSymbol).c_str(), getLength(*pSymbol));iterateEnumMembers(*pSymbol);@@ -72,41 +72,41 @@ void iterateEnums() {static void iterateMembers(IDiaSymbol& pSymbol) {DWORD celt = 0;- CComPtr<IDiaEnumSymbols> pEnum;- CComPtr<IDiaSymbol> pMember;+ CComPtr<IDiaEnumSymbols> pEnum;+ CComPtr<IDiaSymbol> pMember;pSymbol.findChildren(SymTagNull, NULL, nsNone, &pEnum);if (pEnum == NULL) {return;}while (1) {- if (pEnum->Next( 1, &pMember, &celt ) < 0) {+ if (FAILED(pEnum->Next(1, &pMember, &celt))) {break;}if (celt != 1) {break;}- printf("%S<member name=\"%S\" datatype=\"%S\" offset=\"0x%x\" kind=\"%S\" length=\"0x%I64x\" />\n",- indent(12).c_str(),- getName(*pMember).c_str(),- getTypeAsString(*pMember).c_str(),- getOffset(*pMember),- getKindAsString(*pMember).c_str(),- getLength(*pMember));+ printf("%S<member name=\"%S\" datatype=\"%S\" offset=\"0x%x\" kind=\"%S\" length=\"0x%I64x\" />\n",+ indent(12).c_str(),+ getName(*pMember).c_str(),+ getTypeAsString(*pMember).c_str(),+ getOffset(*pMember),+ getKindAsString(*pMember).c_str(),+ getLength(*pMember));}}-void iterateDataTypes() {+void iterateDataTypes(PDBApiContext& ctx) {DWORD celt = 0;- CComPtr<IDiaEnumSymbols> pEnum;- CComPtr<IDiaSymbol> pSymbol;- pGlobal->findChildren(SymTagUDT, NULL, nsNone/*nsfCaseInsensitive|nsfUndecoratedName*/, &pEnum);+ CComPtr<IDiaEnumSymbols> pEnum;+ CComPtr<IDiaSymbol> pSymbol;+ ctx.Global().findChildren(SymTagUDT, NULL, nsNone/*nsfCaseInsensitive|nsfUndecoratedName*/, &pEnum);if (pEnum == NULL) {return;}printf("%S<datatypes>\n", indent(4).c_str());- while ( 1 ) {- if (pEnum->Next( 1, &pSymbol, &celt ) < 0) {+ while (1) {+ if (FAILED(pEnum->Next(1, &pSymbol, &celt))) {break;}if (celt != 1) {@@ -122,8 +122,8 @@ void iterateDataTypes() {continue;}- const ULONGLONG len = getLength(*pSymbol);- if ( len == 0 ) {+ const ULONGLONG len = getLength(*pSymbol);+ if (len == 0) {continue;}@@ -137,17 +137,17 @@ void iterateDataTypes() {printf("%S</datatypes>\n", indent(4).c_str());}-void iterateTypedefs() {+void iterateTypedefs(PDBApiContext& ctx) {DWORD celt = 0;CComPtr<IDiaEnumSymbols> pEnum;CComPtr<IDiaSymbol> pSymbol;- pGlobal->findChildren(SymTagTypedef, NULL, nsNone/*nsfCaseInsensitive|nsfUndecoratedName*/, &pEnum);+ ctx.Global().findChildren(SymTagTypedef, NULL, nsNone/*nsfCaseInsensitive|nsfUndecoratedName*/, &pEnum);if (pEnum == NULL) {return;}printf("%S<typedefs>\n", indent(4).c_str());while ( 1 ) {- if (pEnum->Next( 1, &pSymbol, &celt ) < 0) {+ if (FAILED(pEnum->Next( 1, &pSymbol, &celt ))) {break;}if (celt != 1) {@@ -166,17 +166,17 @@ void iterateTypedefs() {printf("%S</typedefs>\n", indent(4).c_str());}-void iterateClasses() {+void iterateClasses(PDBApiContext& ctx) {DWORD celt = 0;CComPtr<IDiaEnumSymbols> pEnum;CComPtr<IDiaSymbol> pSymbol;- pGlobal->findChildren(SymTagUDT, NULL, nsNone/*nsfCaseInsensitive|nsfUndecoratedName*/, &pEnum);+ ctx.Global().findChildren(SymTagUDT, NULL, nsNone/*nsfCaseInsensitive|nsfUndecoratedName*/, &pEnum);if (pEnum == NULL) {return;}printf("%S<classes>\n", indent(4).c_str());while ( 1 ) {- if (pEnum->Next( 1, &pSymbol, &celt ) < 0) {+ if (FAILED(pEnum->Next( 1, &pSymbol, &celt ))) {break;}if (celt != 1) {@@ -207,10 +207,10 @@ void iterateClasses() {printf("%S</classes>\n", indent(4).c_str());}-void dumpFunctionStackVariables( DWORD rva )+void dumpFunctionStackVariables( PDBApiContext& ctx, DWORD rva ){CComPtr<IDiaSymbol> pBlock;- if ( FAILED( pSession->findSymbolByRVA( rva, SymTagBlock, &pBlock ) ) ) {+ if ( FAILED(ctx.Session().findSymbolByRVA( rva, SymTagBlock, &pBlock ) ) ) {fatal( "Failed to find symbols by RVA" );}for ( ; pBlock != NULL; ) {@@ -270,25 +270,25 @@ void dumpFunctionStackVariables( DWORD rva )};}-void dumpFunctionLines( IDiaSymbol* pSymbol, IDiaSession* pSession )+void dumpFunctionLines( IDiaSymbol& pSymbol, IDiaSession& pSession ){ULONGLONG length = 0;DWORD isect = 0;DWORD offset = 0;- pSymbol->get_addressSection( &isect );- pSymbol->get_addressOffset( &offset );- pSymbol->get_length( &length );+ pSymbol.get_addressSection( &isect );+ pSymbol.get_addressOffset( &offset );+ pSymbol.get_length( &length );if ( isect == 0 || length <= 0 ) {return;}CComPtr<IDiaEnumLineNumbers> pLines;- if (pSession->findLinesByAddr( isect, offset, static_cast<DWORD>( length ), &pLines ) < 0) {+ if (FAILED(pSession.findLinesByAddr( isect, offset, static_cast<DWORD>( length ), &pLines ))) {return;}CComPtr<IDiaLineNumber> pLine;- DWORD celt;+ DWORD celt = 0;while ( 1 ) {- if (pLines->Next( 1, &pLine, &celt ) < 0) {+ if (FAILED(pLines->Next( 1, &pLine, &celt ))) {break;}if (celt != 1) {@@ -304,12 +304,12 @@ void dumpFunctionLines( IDiaSymbol* pSymbol, IDiaSession* pSession )bstr_t sourceFileName ;pSrc->get_fileName( sourceFileName.GetAddress() );- DWORD addr;+ DWORD addr = 0;pLine->get_relativeVirtualAddress( &addr );- DWORD start;+ DWORD start = 0;pLine->get_lineNumber( &start );- DWORD end;+ DWORD end = 0;pLine->get_lineNumberEnd( &end );printf("%S<line_number source_file=\"%S\" start=\"0x%x\" end=\"0x%x\" addr=\"0x%x\" /> \n",@@ -319,17 +319,17 @@ void dumpFunctionLines( IDiaSymbol* pSymbol, IDiaSession* pSession )}}-void iterateFunctions() {+void iterateFunctions(PDBApiContext& ctx) {DWORD celt = 0;CComPtr<IDiaEnumSymbols> pEnum;CComPtr<IDiaSymbol> pSymbol;- pGlobal->findChildren(SymTagFunction, NULL, nsNone, &pEnum);+ ctx.Global().findChildren(SymTagFunction, NULL, nsNone, &pEnum);if (pEnum == NULL) {return;}printf("%S<functions>\n", indent(4).c_str());while ( 1 ) {- if (pEnum->Next( 1, &pSymbol, &celt ) < 0) {+ if (FAILED(pEnum->Next( 1, &pSymbol, &celt ))) {break;}if (celt != 1) {@@ -343,10 +343,10 @@ void iterateFunctions() {const DWORD address = getRVA(*pSymbol);- printf("%S<function name=\"%S\" address=\"0x%x\" length=\"0x%I64x\">\n", indent(8).c_str(), findMangledName(*pSymbol).c_str(), address, getLength(*pSymbol));+ printf("%S<function name=\"%S\" address=\"0x%x\" length=\"0x%I64x\">\n", indent(8).c_str(), findMangledName(ctx, *pSymbol).c_str(), address, getLength(*pSymbol));- dumpFunctionStackVariables(address);- dumpFunctionLines(pSymbol, pSession);+ dumpFunctionStackVariables(ctx, address);+ dumpFunctionLines(*pSymbol, ctx.Session());printf("%S</function>\n", indent(8).c_str());@@ -360,7 +360,7 @@ void iterateSymbolTable(IDiaEnumSymbols * pSymbols) {CComPtr<IDiaSymbol> pSymbol;while ( 1 ) {- if (pSymbols->Next( 1, &pSymbol, &celt ) < 0) {+ if (FAILED(pSymbols->Next( 1, &pSymbol, &celt ))) {break;}if (celt != 1) {@@ -430,21 +430,21 @@ void iterateSegments(IDiaEnumSegments * pSegments) {* that is, a contiguous block of memory contributed* to the image by a compiland.*/-void iterateSections(IDiaEnumSectionContribs * pSecContribs) {+void iterateSections(PDBApiContext& ctx, IDiaEnumSectionContribs& pSecContribs) {DWORD celt = 0;CComPtr<IDiaSymbol> pSym ;CComPtr<IDiaSectionContrib> pSecContrib;while ( 1 ) {- if (pSecContribs->Next( 1, &pSecContrib, &celt ) < 0 ) {+ if (pSecContribs.Next( 1, &pSecContrib, &celt ) < 0 ) {break;}if (celt != 1) {break;}DWORD rva = 0;- if ( pSecContrib->get_relativeVirtualAddress( &rva ) == S_OK ) {- if ( pSession->findSymbolByRVA( rva, SymTagNull, &pSym ) != S_OK ) {+ if (SUCCEEDED(pSecContrib->get_relativeVirtualAddress( &rva ))) {+ if (FAILED(ctx.Session().findSymbolByRVA( rva, SymTagNull, &pSym )) ) {pSym = NULL;}}@@ -454,9 +454,9 @@ void iterateSections(IDiaEnumSectionContribs * pSecContribs) {pSecContrib->get_addressSection( &isect );pSecContrib->get_addressOffset( &offset );pSecContrib = NULL;- if ( pSession->findSymbolByAddr( isect, offset, SymTagNull, &pSym ) != S_OK ) {+ if (FAILED(ctx.Session().findSymbolByAddr( isect, offset, SymTagNull, &pSym )) ) {pSym = NULL;- }+ }}if (pSym == NULL) {printf("%S<section_contrib address=\"0x%x\" /> \n", indent(12).c_str(), rva);@@ -480,7 +480,7 @@ void iterateInjectedSource(IDiaEnumInjectedSources * pInjectedSrcs) {while ( 1 ) {const HRESULT hr = pInjectedSrcs->Next( 1, &pInjectedSrc, &celt );- if (hr < 0) {+ if (FAILED(hr)) {break;}if (celt != 1) {@@ -518,8 +518,8 @@ void iterateFrameData(IDiaEnumFrameData * pEnumFrameData) {CComPtr<IDiaFrameData> pFrameData;while ( 1 ) {- HRESULT hr = pEnumFrameData->Next( 1, &pFrameData, &celt );- if (hr < 0) {+ const HRESULT hr = pEnumFrameData->Next( 1, &pFrameData, &celt );+ if (FAILED(hr)) {break;}if (celt != 1) {@@ -529,22 +529,22 @@ void iterateFrameData(IDiaEnumFrameData * pEnumFrameData) {}}-int iterateTables(bool printAll) {+int iterateTables(PDBApiContext& ctx, bool printAll) {printf("%S<tables>\n", indent(4).c_str());HRESULT hr = S_OK;DWORD celt = 0;CComPtr<IDiaEnumTables> pTables;- hr = pSession->getEnumTables( &pTables );- if ( hr < 0) {+ hr = ctx.Session().getEnumTables( &pTables );+ if ( FAILED(hr) ) {return hr;}- IDiaTable * pTable;+ CComPtr<IDiaTable> pTable;while ( 1 ) {- if (pTables->Next( 1, &pTable, &celt ) < 0) {+ if (FAILED(pTables->Next( 1, &pTable, &celt ))) {break;}if (celt != 1) {@@ -573,7 +573,7 @@ int iterateTables(bool printAll) {}else if ( SUCCEEDED( pTable->QueryInterface(IID_PPV_ARGS(&pSecContribs) ) ) ) {if (printAll) {- iterateSections(pSecContribs);+ iterateSections(ctx, *pSecContribs);}}else if ( SUCCEEDED( pTable->QueryInterface(IID_PPV_ARGS(&pInjectedSrcs) ) ) ) {diff --git a/Ghidra/Features/PDB/src/pdb/cpp/main.cpp b/Ghidra/Features/PDB/src/pdb/cpp/main.cppindex 3b8215af29..5a9789fe22 100644--- a/Ghidra/Features/PDB/src/pdb/cpp/main.cpp+++ b/Ghidra/Features/PDB/src/pdb/cpp/main.cpp@@ -14,20 +14,20 @@* See the License for the specific language governing permissions and* limitations under the License.*/+#include "pdb.h"#include "iterate.h"#include <signal.h>--void segvHandler(int sig) {+void segvHandler(int /*sig*/) {exit(1); // Just die - prevents OS from popping-up a dialog}-int main(int argc, char ** argv) {+int wmain(int argc, wchar_t ** argv) {if ( (argc < 2) || (argc > 5) ) {printf("USAGE:\n");- printf("\tValidation: %s <input pdb file> <guid OR signature> <age> [-fulloutput]\n", argv[0]);- printf("\tNo Validation: %s <input pdb file> [-fulloutput]\n", argv[0]);+ printf("\tValidation: %S <input pdb file> <guid OR signature> <age> [-fulloutput]\n", argv[0]);+ printf("\tNo Validation: %S <input pdb file> [-fulloutput]\n", argv[0]);printf("\nThe -fulloutput parameter must be specified in order for 'Sections' information to be output in the XML file.\n");exit(-1);}@@ -40,25 +40,26 @@ int main(int argc, char ** argv) {// We do not use the "Sections" information during Ghidra processing.bool doPrintAll = false;+ std::unique_ptr<PDBApiContext> pbdApiContext;+if (argc <= 3) { // argc is either 2 or 3- if ( (argc == 3) && (strcmp(argv[2], "-fulloutput") == 0) ) {+ if ( (argc == 3) && (wcscmp(argv[2], L"-fulloutput") == 0) ) {doPrintAll = true;}- init(argv[1], NULL, NULL);+ pbdApiContext = std::make_unique<PDBApiContext>(std::wstring(argv[1]), L"", L"");} else { // argc is either 4 or 5- if ( (argc == 5) && (strcmp(argv[4], "-fulloutput") == 0) ) {+ if ( (argc == 5) && (wcscmp(argv[4], L"-fulloutput") == 0) ) {doPrintAll = true;}- init(argv[1], argv[2], argv[3]);+ pbdApiContext = std::make_unique<PDBApiContext>(std::wstring(argv[1]), std::wstring(argv[2]), std::wstring(argv[3]));}- iterateEnums();- iterateDataTypes();- iterateTypedefs();- iterateClasses();- iterateFunctions();- iterateTables(doPrintAll);+ iterateEnums(*pbdApiContext);+ iterateDataTypes(*pbdApiContext);+ iterateTypedefs(*pbdApiContext);+ iterateClasses(*pbdApiContext);+ iterateFunctions(*pbdApiContext);+ iterateTables(*pbdApiContext, doPrintAll);- dispose();return 0;}diff --git a/Ghidra/Features/PDB/src/pdb/cpp/pdb.cpp b/Ghidra/Features/PDB/src/pdb/cpp/pdb.cppindex 4b07a46923..85d8dc5623 100644--- a/Ghidra/Features/PDB/src/pdb/cpp/pdb.cpp+++ b/Ghidra/Features/PDB/src/pdb/cpp/pdb.cpp@@ -19,72 +19,64 @@#include "symbol.h"#include <stdlib.h>-IDiaSession * pSession;//Provides a query context for debug symbols-IDiaSymbol * pGlobal;-IDiaDataSource * pSource;+PDBApiContext::PDBApiContext(const std::wstring& szFilename, const std::wstring& szSignature, const std::wstring& szAge)+{+ if (FAILED(mCoInit.Result())) {+ fatal("Unable to initialize\n");+ }+ init(szFilename, szSignature, szAge);+}-wchar_t * szLookup = NULL;+PDBApiContext::~PDBApiContext()+{+ dispose();+}-void dispose() {- CoUninitialize();- pSource = 0;- pSession = 0;- pGlobal = 0;+void PDBApiContext::dispose() {printf("</pdb>\n");}-int init(const char * szFilename, const char * szSignature, const char * szAge) {-- if ( CoInitialize(NULL) < 0) {- fatal("Unable to initialize\n");- }+int PDBApiContext::init(const std::wstring& szFilename, const std::wstring& szSignature, const std::wstring& szAge) {HRESULT hr = CoCreateInstance(_uuidof( DiaSource ),NULL,CLSCTX_INPROC_SERVER,- _uuidof( IDiaDataSource ),- (void **) &pSource);- if (hr < 0) {+ IID_PPV_ARGS(&pSource));+ if (FAILED(hr)) {switch (hr) {case REGDB_E_CLASSNOTREG:fatal("Unable to locate the DIA SDK. It is required to load PDB files.\n" \"* See docs/README_PDB.html for DLL registration instructions.\n");break;default:- char msg[256];- sprintf_s(msg, 256, "Unspecified error occurred: 0x%lx\n", hr);+ char msg[256] = {};+ sprintf_s(msg, "Unspecified error occurred: 0x%lx\n", hr);fatal(msg);break;}}- size_t sz = strlen(szFilename) + 1;- wchar_t* wszFilename = new wchar_t[sz];- size_t outsz;- mbstowcs_s(&outsz, wszFilename, sz, szFilename, sz - 1);-- if (szSignature == NULL && szAge == NULL) {- hr = pSource->loadDataFromPdb( wszFilename );+ if (szSignature.empty() && szAge.empty()) {+ hr = pSource->loadDataFromPdb(szFilename.c_str() );}- else if (szSignature != NULL && szAge != NULL) {- GUID guid;- int isValidGUID = atog(&guid, szSignature);+ else if (!szSignature.empty() && !szAge.empty()) {+ GUID guid = {};+ const HRESULT guidConv = CLSIDFromString(szSignature.c_str(), &guid);- DWORD age = strtol(szAge, NULL, 16);+ const DWORD age = wcstol(szAge.c_str(), NULL, 16);- if (isValidGUID == 0) {// .NET or later PDB file- hr = pSource->loadAndValidateDataFromPdb( wszFilename, &guid, 0, age );+ if (SUCCEEDED(guidConv)) {// .NET or later PDB file+ hr = pSource->loadAndValidateDataFromPdb(szFilename.c_str(), &guid, 0, age );}else {- DWORD signature = strtol(szSignature, NULL, 16);- hr = pSource->loadAndValidateDataFromPdb( wszFilename, NULL, signature, age );+ const DWORD signature = wcstol(szSignature.c_str(), NULL, 16);+ hr = pSource->loadAndValidateDataFromPdb(szFilename.c_str(), NULL, signature, age );}}else {fatal("Invalid combination of GUID/Signature/Age parameters specified!");}checkErr(hr);- delete [] wszFilename;if (FAILED(pSource->openSession( &pSession ))) {fatal("Unable to open session\n");@@ -99,36 +91,27 @@ int init(const char * szFilename, const char * szSignature, const char * szAge)fatal("Unable to get global symbol index\n");}- std::wstring exename = getName(*pGlobal);-- GUID currGUID;- BSTR guidString;+ const std::wstring exename = getName(*pGlobal);+ // Include PDB GUID and age in XML output for compatibility checking+ GUID currGUID = {};DWORD currAge = 0;+ int maxGUIDStrLen = 64;+ std::wstring guidStr(maxGUIDStrLen, L'\0');- // Include PDB GUID and age in XML output for compatibility checking- if (pGlobal->get_guid( &currGUID ) == S_OK) {- int maxGUIDStrLen = 64;- wchar_t * guidStr = (wchar_t *)calloc(maxGUIDStrLen, sizeof(wchar_t));- if (guidStr == NULL) {- fatal("Unable to allocate GUID\n");- exit(-1);- }- if (StringFromGUID2(currGUID, guidStr, maxGUIDStrLen) <= 0) {+ if (SUCCEEDED(pGlobal->get_guid( &currGUID ))) {+ if (StringFromGUID2(currGUID, &guidStr[0], maxGUIDStrLen) <= 0) {fatal("Unable to convert GUID\n");}- guidString = guidStr;- if (pGlobal->get_age( &currAge ) == S_OK) {- // don't do anything?- } else {+ if (FAILED(pGlobal->get_age( &currAge ))) {fatal("Unable to get PDB age\n");}} else {fatal("Unable to get GUID\n");}- printf("<pdb file=\"%s\" exe=\"%ws\" guid=\"%ws\" age=\"%ld\">\n", szFilename, exename.c_str(), guidString, currAge);+ printf("<pdb file=\"%S\" exe=\"%S\" guid=\"%S\" age=\"%ld\">\n", szFilename.c_str(), exename.c_str(), guidStr.c_str(), currAge);return hr;}diff --git a/Ghidra/Features/PDB/src/pdb/cpp/print.cpp b/Ghidra/Features/PDB/src/pdb/cpp/print.cppindex 8546c5bf4e..a3e8bbd008 100644--- a/Ghidra/Features/PDB/src/pdb/cpp/print.cpp+++ b/Ghidra/Features/PDB/src/pdb/cpp/print.cpp@@ -155,9 +155,9 @@ std::wstring printType( IDiaSymbol * pType, const std::wstring& suffix ) {if (lenElem == 0) {//prevent divide by zero...lenElem = lenArray;}- size_t strLen = suffix.length() + 64 + 3; // length of suffix + wag_for_numeric_value + "[]\0"+ const size_t strLen = suffix.length() + 64 + 3; // length of suffix + wag_for_numeric_value + "[]\0"std::vector<wchar_t> str(strLen);- swprintf_s(str.data(), strLen, L"%ws[%I64d]", suffix.c_str(), lenArray / lenElem);+ swprintf_s(str.data(), strLen, L"%s[%I64d]", suffix.c_str(), lenArray / lenElem);return printType(pBaseType, str.data());}@@ -168,7 +168,7 @@ std::wstring printType( IDiaSymbol * pType, const std::wstring& suffix ) {if ( tag == SymTagCustomType ) {DWORD id = 0;DWORD rec = 0;- GUID guid = {};+ GUID guid = GUID_NULL;if (pType->get_guid(&guid) == S_OK) {const int maxGUIDStrLen = 64 + 1;std::vector<wchar_t> guidStr(maxGUIDStrLen);@@ -195,17 +195,15 @@ std::wstring printType( IDiaSymbol * pType, const std::wstring& suffix ) {}void printScopeName( IDiaSymbol& pscope ) {- printf("<scope name=\"%ws\" tag=\"%ws\" />\n", getName( pscope ).c_str(), getTagAsString( pscope ).c_str());+ printf("<scope name=\"%S\" tag=\"%S\" />\n", getName( pscope ).c_str(), getTagAsString( pscope ).c_str());}-void printNameFromScope( const std::wstring& /*name*/, IDiaSymbol& pscope, IDiaEnumSymbols& pEnum ) {+void printNameFromScope( IDiaSymbol& pscope, IDiaEnumSymbols& pEnum ) {CComPtr<IDiaSymbol> pSym;DWORD celt = 0;while ( SUCCEEDED( pEnum.Next( 1, &pSym, &celt ) ) && celt == 1 ) {- std::wstring name = getName( *pSym );- std::wstring tag = getTagAsString( *pSym );- wprintf( L"\t%ws %ws found in ", tag.c_str(), name.c_str() );+ wprintf( L"\t%s %s found in ", getTagAsString(*pSym).c_str(), getName(*pSym).c_str() );printScopeName( pscope );wprintf( L"\n" );pSym = 0;diff --git a/Ghidra/Features/PDB/src/pdb/cpp/symbol.cpp b/Ghidra/Features/PDB/src/pdb/cpp/symbol.cppindex 4cf94302a9..a4f047725f 100644--- a/Ghidra/Features/PDB/src/pdb/cpp/symbol.cpp+++ b/Ghidra/Features/PDB/src/pdb/cpp/symbol.cpp@@ -187,8 +187,8 @@ std::wstring getName(IDiaSymbol& pSymbol) {if (FAILED(pSymbol.get_symIndexId(&symIndexId))) {symIndexId = 0;}- const size_t length = 16; // length of: "<unnamed_NNNN>\0" + 1 extra- std::vector<wchar_t> str(16);+ const size_t length = 20; // length of: "<unnamed_NNNN>\0" + 1 extra+ std::vector<wchar_t> str(20);swprintf_s(str.data(), length, L"<unnamed_%04x>", symIndexId);return escapeXmlEntities(str.data());}@@ -311,19 +311,21 @@ std::wstring getTypeAsString(IDiaSymbol& pSymbol) {return typeStr;}-DWORD getBaseType(IDiaSymbol& pSymbol) {+static DWORD getBaseType(IDiaSymbol& pSymbol) {if (getTag(pSymbol) == SymTagBaseType) {- DWORD baseType;- pSymbol.get_baseType( &baseType );+ DWORD baseType = btNoType;+ if (FAILED(pSymbol.get_baseType(&baseType))) {+ return btNoType;+ }return baseType;}- return -1;+ return btNoType;}std::wstring getBaseTypeAsString(IDiaSymbol& pSymbol) {const ULONGLONG len = getLength(pSymbol);const DWORD bt = getBaseType(pSymbol);switch(bt) {- case 6 :+ case btInt:switch(len) {case 1: return L"char";case 2: return L"short";@@ -331,7 +333,7 @@ std::wstring getBaseTypeAsString(IDiaSymbol& pSymbol) {case 8: return L"__int64";}break;- case 7 :+ case btUInt:switch(len) {case 1: return L"uchar";case 2: return L"ushort";@@ -339,7 +341,7 @@ std::wstring getBaseTypeAsString(IDiaSymbol& pSymbol) {case 8: return L"__uint64";}break;- case 8 :+ case btFloat:switch(len) {case 4: return L"float";case 8: return L"double";diff --git a/Ghidra/Features/PDB/src/pdb/cpp/util.cpp b/Ghidra/Features/PDB/src/pdb/cpp/util.cppdeleted file mode 100644index d899aefff9..0000000000--- a/Ghidra/Features/PDB/src/pdb/cpp/util.cpp+++ /dev/null@@ -1,136 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-#include "util.h"--void zero_out(const char * str, size_t len) {- char * tmp = (char *)str;- for (int i = 0 ; i < len ; ++i) {- tmp[i] = '\0';- }-}--int find_char(const char * str, char c) {- int len = (int)strlen(str);- for (int i = 0 ; i < len ; ++i) {- if (str[i] == c) {- return i;- }- }- return -1;-}--/*- * Populates a GUID using the string.- * Returns 0 if the string represents a valid GUID.- * Returns -1 if the string does not represent a valid GUID- */-int atog(GUID * guid, const char * szGUID) {- char * tmp = (char *)szGUID;- size_t sz = 256;- char * buff = (char *) calloc(sz, sizeof(char));- if (buff == NULL) {- return -1;- }- /*****************************************/- int index = find_char(tmp, '-');- if (index == -1) {- return -1;- }- zero_out(buff, sz);- strncpy_s(buff, sz, tmp, index);-- //the value could be too large and cause overflow. eg, "9b8c55da"- if (strlen(buff) == 8 && buff[0] >= '8') {- char msn = 0;//most significant nibble- if (buff[0] >= '0' && buff[0] <= '9') {- msn = buff[0] - '0';- }- else if (buff[0] >= 'A' && buff[0] <= 'F') {- msn = buff[0] - 'A' + 10;- }- else if (buff[0] >= 'a' && buff[0] <= 'f') {- msn = buff[0] - 'a' + 10;- }- guid->Data1 = strtol(buff+1, NULL, 16);- guid->Data1 += (msn << 28);- }- else {- guid->Data1 = strtol(buff, NULL, 16);- }- /*****************************************/- tmp = tmp+index+1;- index = find_char(tmp, '-');- if (index == -1) {- return -1;- }- zero_out(buff, sz);- strncpy_s(buff, sz, tmp, index);- guid->Data2 = (unsigned short)strtol(buff, NULL, 16);- /*****************************************/- tmp = tmp+index+1;- index = find_char(tmp, '-');- if (index == -1) {- return -1;- }- zero_out(buff, sz);- strncpy_s(buff, sz, tmp, index);- guid->Data3 = (unsigned short)strtol(buff, NULL, 16);- /*****************************************/- tmp = tmp+index+1;- index = find_char(tmp, '-');- if (index == -1 || index >= sz) {- free(buff);- return -1;- }- zero_out(buff, sz);- strncpy_s(buff, sz, tmp, index);- int ivalue = strtol(buff, NULL, 16);- guid->Data4[0] = ivalue >> 8;- guid->Data4[1] = ivalue & 0xff;- /*****************************************/- tmp = tmp+index+1;- zero_out(buff, sz);- strncpy_s(buff, sz, tmp, 2);- guid->Data4[2] = (unsigned char)strtol(buff, NULL, 16);- /*****************************************/- tmp = tmp+2;- zero_out(buff, sz);- strncpy_s(buff, sz, tmp, 2);- guid->Data4[3] = (unsigned char)strtol(buff, NULL, 16);- /*****************************************/- tmp = tmp+2;- zero_out(buff, sz);- strncpy_s(buff, sz, tmp, 2);- guid->Data4[4] = (unsigned char)strtol(buff, NULL, 16);- /*****************************************/- tmp = tmp+2;- zero_out(buff, sz);- strncpy_s(buff, sz, tmp, 2);- guid->Data4[5] = (unsigned char)strtol(buff, NULL, 16);- /*****************************************/- tmp = tmp+2;- zero_out(buff, sz);- strncpy_s(buff, sz, tmp, 2);- guid->Data4[6] = (unsigned char)strtol(buff, NULL, 16);- /*****************************************/- tmp = tmp+2;- zero_out(buff, sz);- strncpy_s(buff, sz, tmp, 2);- guid->Data4[7] = (unsigned char)strtol(buff, NULL, 16);- /*****************************************/- free(buff);- return 0;-}diff --git a/Ghidra/Features/PDB/src/pdb/cpp/xml.cpp b/Ghidra/Features/PDB/src/pdb/cpp/xml.cppindex 33e455dc03..9dc6fed2be 100644--- a/Ghidra/Features/PDB/src/pdb/cpp/xml.cpp+++ b/Ghidra/Features/PDB/src/pdb/cpp/xml.cpp@@ -17,63 +17,63 @@#include <string>std::wstring indent(size_t nSpaces) {- return std::wstring(nSpaces, ' ');+ return std::wstring(nSpaces, ' ');}-std::wstring escapeXmlEntities(const std::wstring& bstr) {+std::wstring escapeXmlEntities(const std::wstring& str) {// Scan source str for problematic characters that need escaping.// Calculate how many characters we will need in new string.// The cases in this switch() statement need to match the cases in the following switch()// statement.- const size_t len = bstr.length();- size_t destLen = 0;- for (int i = 0; i < len; ++i) {- switch (bstr[i]) {- case '&':- destLen += 5; // length of: "&"- break;- case '<':- case '>':- destLen += 4; // length of: "<" or ">"- break;- case '\'':- case '"':- destLen += 6; // length of: "'" or """- break;- case 0x7F:- break;- default:- destLen++;- break;- }- }+ const size_t len = str.length();+ size_t destLen = 0;+ for (int i = 0; i < len; ++i) {+ switch (str[i]) {+ case '&':+ destLen += 5; // length of: "&"+ break;+ case '<':+ case '>':+ destLen += 4; // length of: "<" or ">"+ break;+ case '\'':+ case '"':+ destLen += 6; // length of: "'" or """+ break;+ case 0x7F:+ break;+ default:+ destLen++;+ break;+ }+ }- std::wstring escaped(destLen, '\0');+ std::wstring escaped(destLen, '\0');for (int i = 0 ; i < len ; ++i) {- switch (bstr[i]) {+ switch (str[i]) {case '&' :- escaped += L"&";+ escaped += L"&";break;case '<' :- escaped += L"<";+ escaped += L"<";break;case '>' :- escaped += L">";+ escaped += L">";break;case '\'' :- escaped += L"'";+ escaped += L"'";break;case '"' :- escaped += L""";+ escaped += L""";break;case 0x7F :break;default :- escaped += bstr[i];+ escaped += str[i];break;}}- return escaped;+ return escaped;}diff --git a/Ghidra/Features/PDB/src/pdb/headers/find.h b/Ghidra/Features/PDB/src/pdb/headers/find.hindex be95940fc1..1294d5226a 100644--- a/Ghidra/Features/PDB/src/pdb/headers/find.h+++ b/Ghidra/Features/PDB/src/pdb/headers/find.h@@ -32,8 +32,8 @@//This method locates the mangled//function name, which is stored in a SymTagPublicSymbol symbol.//-std::wstring findMangledName(IDiaSymbol& pFunction);-void findNameInNamespace( const std::wstring& name, IDiaSymbol& pnamespace );+std::wstring findMangledName(PDBApiContext& ctx, IDiaSymbol& pFunction);+void findNameInNamespace(PDBApiContext& ctx, const std::wstring& name, IDiaSymbol& pnamespace );void findNameInEnum( const std::wstring& name, IDiaSymbol& penumeration );void findNameInClass( const std::wstring& name, IDiaSymbol& pclass );void findCppNameInScope( const std::wstring& name, IDiaSymbol& pScope );diff --git a/Ghidra/Features/PDB/src/pdb/headers/iterate.h b/Ghidra/Features/PDB/src/pdb/headers/iterate.hindex b523548bdc..796dbd3e63 100644--- a/Ghidra/Features/PDB/src/pdb/headers/iterate.h+++ b/Ghidra/Features/PDB/src/pdb/headers/iterate.h@@ -23,11 +23,11 @@#include "xml.h"#include "find.h"-void iterateDataTypes();-void iterateEnums();-void iterateTypedefs();-void iterateClasses();-void iterateFunctions();-int iterateTables(bool printAll);+void iterateDataTypes(PDBApiContext& ctx);+void iterateEnums(PDBApiContext& ctx);+void iterateTypedefs(PDBApiContext& ctx);+void iterateClasses(PDBApiContext& ctx);+void iterateFunctions(PDBApiContext& ctx);+int iterateTables(PDBApiContext& ctx, bool printAll);#endifdiff --git a/Ghidra/Features/PDB/src/pdb/headers/pdb.h b/Ghidra/Features/PDB/src/pdb/headers/pdb.hindex 35ab083e50..73ac0ebab5 100644--- a/Ghidra/Features/PDB/src/pdb/headers/pdb.h+++ b/Ghidra/Features/PDB/src/pdb/headers/pdb.h@@ -17,19 +17,54 @@#ifndef __PDB__PDB__H__#define __PDB__PDB__H__+#include <string>#include <stdio.h>#include <assert.h>+#include <atlcomcli.h>#include "dia2.h"#include "diacreate.h"#include "cvconst.h"#include "err.h"-#include "util.h"-void dispose();-int init(const char * szFilename, const char * szSignature, const char * szAge);+class AutoCoInit+{+public:+ AutoCoInit()+ {+ hr = ::CoInitialize(NULL);+ }-extern IDiaSession * pSession;-extern IDiaSymbol * pGlobal;-extern IDiaDataSource * pSource;+ ~AutoCoInit()+ {+ if (SUCCEEDED(hr))+ {+ ::CoUninitialize();+ }+ }++ HRESULT Result() const { return hr; }++private:+ HRESULT hr = E_FAIL;+};++class PDBApiContext+{+public:+ PDBApiContext(const std::wstring& szFilename, const std::wstring& szSignature, const std::wstring& szAge);+ ~PDBApiContext();++ IDiaSession& Session() const { return *pSession; }+ IDiaSymbol& Global() const { return *pGlobal; }+private:+ void dispose();+ int init(const std::wstring& szFilename, const std::wstring& szSignature, const std::wstring& szAge);++private:+ AutoCoInit mCoInit;+ CComPtr<IDiaSession> pSession;//Provides a query context for debug symbols+ CComPtr<IDiaSymbol> pGlobal;+ CComPtr<IDiaDataSource> pSource;+};#endifdiff --git a/Ghidra/Features/PDB/src/pdb/headers/print.h b/Ghidra/Features/PDB/src/pdb/headers/print.hindex 5b68e25e82..311e4ca5b6 100644--- a/Ghidra/Features/PDB/src/pdb/headers/print.h+++ b/Ghidra/Features/PDB/src/pdb/headers/print.h@@ -29,6 +29,6 @@ std::wstring printType( IDiaSymbol* pType, const std::wstring& prefix );void printBound( IDiaSymbol& pBound );void printScopeName( IDiaSymbol& pscope );-void printNameFromScope( const std::wstring& name, IDiaSymbol& pscope, IDiaEnumSymbols& pEnum );+void printNameFromScope( IDiaSymbol& pscope, IDiaEnumSymbols& pEnum );#endifdiff --git a/Ghidra/Features/PDB/src/pdb/headers/symbol.h b/Ghidra/Features/PDB/src/pdb/headers/symbol.hindex f3be4aa862..5227a7311c 100644--- a/Ghidra/Features/PDB/src/pdb/headers/symbol.h+++ b/Ghidra/Features/PDB/src/pdb/headers/symbol.h@@ -35,7 +35,6 @@ DWORD getUdtKind(IDiaSymbol& pSymbol);LONG getOffset(IDiaSymbol& pSymbol);DWORD getIndex(IDiaSymbol& pSymbol);std::wstring getValue(IDiaSymbol& pSymbol);-DWORD getBaseType(IDiaSymbol& pSymbol);std::wstring getBaseTypeAsString(IDiaSymbol& pSymbol);CComPtr<IDiaSymbol> getType(IDiaSymbol& pSymbol);std::wstring getTypeAsString(IDiaSymbol& pSymbol);diff --git a/Ghidra/Features/PDB/src/pdb/headers/util.h b/Ghidra/Features/PDB/src/pdb/headers/util.hdeleted file mode 100644index 9b86c837b0..0000000000--- a/Ghidra/Features/PDB/src/pdb/headers/util.h+++ /dev/null@@ -1,25 +0,0 @@-/* ###- * IP: GHIDRA- * REVIEWED: YES- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-#ifndef __PDB__UTIL__H__-#define __PDB__UTIL__H__--#include <stdio.h>-#include "dia2.h"--int atog(GUID * guid, const char * szGUID);--#endifdiff --git a/Ghidra/Features/PDB/src/pdb/pdb.vcxproj b/Ghidra/Features/PDB/src/pdb/pdb.vcxprojindex 500065d27c..5e61ebab23 100644--- a/Ghidra/Features/PDB/src/pdb/pdb.vcxproj+++ b/Ghidra/Features/PDB/src/pdb/pdb.vcxproj@@ -47,7 +47,6 @@<IntDir>$(SolutionDir)..\..\build\tmp\pdb\$(Platform)\$(Configuration)\</IntDir></PropertyGroup><PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">- <LinkIncremental>true</LinkIncremental><IncludePath>headers;$(VSInstallDir)DIA SDK\include;$(IncludePath)</IncludePath><LibraryPath>$(VSInstallDir)DIA SDK\lib\amd64;$(LibraryPath)</LibraryPath><ReferencePath>$(VCInstallDir)lib\amd64</ReferencePath>@@ -60,9 +59,10 @@<ClCompile><PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions><RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>- <WarningLevel>Level3</WarningLevel>+ <WarningLevel>Level4</WarningLevel><DebugInformationFormat>ProgramDatabase</DebugInformationFormat><Optimization>Disabled</Optimization>+ <MultiProcessorCompilation>true</MultiProcessorCompilation></ClCompile><Link><GenerateDebugInformation>true</GenerateDebugInformation>@@ -89,10 +89,11 @@ if exist "%OS_DIR%\win64" (<ClCompile><PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WINVER=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions><RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>- <WarningLevel>Level3</WarningLevel>+ <WarningLevel>Level4</WarningLevel><DebugInformationFormat>ProgramDatabase</DebugInformationFormat><AdditionalOptions></AdditionalOptions>+ <MultiProcessorCompilation>true</MultiProcessorCompilation></ClCompile><Link><GenerateDebugInformation>false</GenerateDebugInformation>@@ -125,7 +126,6 @@ if exist "%OS_DIR%\win64" (<ClCompile Include="cpp\pdb.cpp" /><ClCompile Include="cpp\print.cpp" /><ClCompile Include="cpp\symbol.cpp" />- <ClCompile Include="cpp\util.cpp" /><ClCompile Include="cpp\xml.cpp" /></ItemGroup><ItemGroup>@@ -135,7 +135,6 @@ if exist "%OS_DIR%\win64" (<ClInclude Include="headers\pdb.h" /><ClInclude Include="headers\print.h" /><ClInclude Include="headers\symbol.h" />- <ClInclude Include="headers\util.h" /><ClInclude Include="headers\xml.h" /></ItemGroup><Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />