remove product name from vdi contents

differentiate between "can't open .vdi" and "can't parse .vdi"
This commit is contained in:
Chris Danford
2005-11-08 22:14:59 +00:00
parent 924cd3261b
commit cc0d65e0db
3 changed files with 13 additions and 5 deletions
+12 -4
View File
@@ -80,6 +80,7 @@ struct VDDebugInfoContext
const unsigned long (*pSegments)[2];
int nSegments;
char sFilename[1024];
char szError[1024];
};
@@ -445,8 +446,12 @@ bool VDDebugInfoInitFromMemory(VDDebugInfoContext *pctx, const void *_src) {
pctx->pRVAHeap = NULL;
if (memcmp((char *)src, PRODUCT_NAME " symbolic debug information", 36))
static const char *header = "symbolic debug information";
if (memcmp((char *)src, header, strlen(header)))
{
strcpy( pctx->szError, "header doesn't match" );
return false;
}
// Extract fields
@@ -474,15 +479,18 @@ bool VDDebugInfoInitFromFile( VDDebugInfoContext *pctx )
if( pctx->Loaded() )
return true;
GetVDIPath( pctx->sFilename, sizeof(pctx->sFilename) );
pctx->pRawBlock = NULL;
pctx->pRVAHeap = NULL;
GetVDIPath( pctx->sFilename, ARRAYSIZE(pctx->sFilename) );
pctx->szError[0] = 0;
HANDLE h = CreateFile(pctx->sFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (INVALID_HANDLE_VALUE == h)
{
strcpy( pctx->szError, "CreateFile failed" );
return false;
}
do {
DWORD dwFileSize = GetFileSize(h, NULL);
@@ -751,7 +759,7 @@ static bool ReportCallStack( HWND hwnd, HANDLE hFile, const void **Backtrace )
VDDebugInfoInitFromFile( &g_debugInfo );
if( !g_debugInfo.Loaded() )
{
Report( hwnd, hFile, "Could not open debug resource file (%s).", g_debugInfo.sFilename );
Report( hwnd, hFile, "debug resource file '%s': %s.", g_debugInfo.sFilename, g_debugInfo.szError );
return false;
}
+1 -1
View File
@@ -267,7 +267,7 @@ int main(int argc, char **argv) {
// dump data
static const char header[64]="StepMania symbolic debug information\r\n\x1A";
static const char header[64]="symbolic debug information\r\n\x1A";
fwrite(header, 64, 1, fo);
Binary file not shown.