Skip to content

Ghidra is a software reverse engineering (SRE) framework

GT-2718, Issue#30 corrected PDB DIA SDK error handling, VS post-build syntax and documentation

ghidra19edd697171f8
diff --git a/Ghidra/Features/PDB/src/global/docs/README_PDB.html b/Ghidra/Features/PDB/src/global/docs/README_PDB.html
index 7fff3b07c6..3b39a8ef11 100644
--- a/Ghidra/Features/PDB/src/global/docs/README_PDB.html
+++ b/Ghidra/Features/PDB/src/global/docs/README_PDB.html
@@ -75,9 +75,9 @@ of Visual Studio and DIA SDK.</li>
<p>First, check to see if you already have the <i>msdia140.dll</i> library installed on your system.
It is generally installed installed with Microsoft Visual Studio 2017 when C/C++ development support
-is included.
+is included (<DISTRO> may be Community, Professional, or other VS 2017 distribution package name).
<pre>
- C:\\Program Files (x86)\Microsoft Visual Studio\2017\DIA SDK\bin\amd64\msdia140.dll
+ C:\Program Files (x86)\Microsoft Visual Studio\2017\<DISTRO>\DIA SDK\bin\amd64\msdia140.dll
</pre>
<p>This file is commonly located here, although it may be installed in other locations as well. Any 64-bit
copy may be registered provided it is the correct version. There is no need to register more than
@@ -86,8 +86,8 @@ one.
<h3>Register 'msdia140.dll' in the Windows registry</h3>
<p>Please register 64-bit <i>msdia140.dll</i> even if you already had a copy of it on your computer
-since it is not registered by the Visual Studio installation process. You will need administrative rights/privileges in order to register the DLL in the Windows
-registry.
+since it is not registered by the Visual Studio installation process. You will need administrative
+rights/privileges in order to register the DLL in the Windows registry.
<blockquote>
<ol>
<li>Start a command prompt as an administrator:</li>
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbParserNEW.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbParserNEW.java
index 9a446da18d..6adbba1967 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbParserNEW.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbParserNEW.java
@@ -576,6 +576,9 @@ public class PdbParserNEW {
}
catch (Exception e) {
if (!isXML) {
+ if (hasErrors()) {
+ throw new PdbException(getErrorAndWarningMessages());
+ }
throw new PdbException("PDB Execution failure of " + PDB_EXE + ".\n" +
"This was likely caused by severe execution failure which can occur if executed\n" +
"on an unsupported platform. It may be neccessary to rebuild the PDB executable\n" +
diff --git a/Ghidra/Features/PDB/src/pdb/cpp/err.cpp b/Ghidra/Features/PDB/src/pdb/cpp/err.cpp
index 47bc2d14f1..bf22cc23bf 100644
--- a/Ghidra/Features/PDB/src/pdb/cpp/err.cpp
+++ b/Ghidra/Features/PDB/src/pdb/cpp/err.cpp
@@ -1,6 +1,5 @@
/* ###
* 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.
@@ -26,9 +25,7 @@ void warning( const char * msg )
void fatal( const char * msg )
{
- fprintf( stderr, "ERROR:\n" );
- fprintf( stderr, msg );
- fprintf( stderr, "\n" );
+ fprintf( stderr, "ERROR: %s\n", msg );
exit( -1 );
}
diff --git a/Ghidra/Features/PDB/src/pdb/cpp/pdb.cpp b/Ghidra/Features/PDB/src/pdb/cpp/pdb.cpp
index 4aedf4c8c6..b08daa7b14 100644
--- a/Ghidra/Features/PDB/src/pdb/cpp/pdb.cpp
+++ b/Ghidra/Features/PDB/src/pdb/cpp/pdb.cpp
@@ -46,9 +46,8 @@ int init(const char * szFilename, const char * szSignature, const char * szAge)
if (hr < 0) {
switch (hr) {
case REGDB_E_CLASSNOTREG:
- fatal("Unable to locate the DIA SDK. It is required to load PDB files.\n\n" \
- "* Open {Ghidra install root}/docs/README_PDB.html\n"
- " and follow the instructions therein.\n");
+ 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];
diff --git a/Ghidra/Features/PDB/src/pdb/pdb.vcxproj b/Ghidra/Features/PDB/src/pdb/pdb.vcxproj
index 002c8a5723..500065d27c 100644
--- a/Ghidra/Features/PDB/src/pdb/pdb.vcxproj
+++ b/Ghidra/Features/PDB/src/pdb/pdb.vcxproj
@@ -72,7 +72,7 @@
<PostBuildEvent>
<Command>
rem copy /y /v /b "$(VSInstallDir)DIA SDK\bin\amd64\msdia*.dll" "$(OutDir)"
-set OS_DIR="$(SolutionDir)..\..\os"
+set OS_DIR=$(SolutionDir)..\..\os
if exist "%OS_DIR%\win64" (
mkdir "%OS_DIR%"
mkdir "%OS_DIR%\win64"
@@ -104,7 +104,7 @@ if exist "%OS_DIR%\win64" (
<PostBuildEvent>
<Command>
rem copy /y /v /b "$(VSInstallDir)DIA SDK\bin\amd64\msdia*.dll" "$(OutDir)"
-set OS_DIR="$(SolutionDir)..\..\os"
+set OS_DIR=$(SolutionDir)..\..\os
if exist "%OS_DIR%\win64" (
mkdir "%OS_DIR%"
mkdir "%OS_DIR%\win64"