If a PE file contains resources with names that are quoted, PE Analyzer displays the following error message:
╔════════════════════════════════ PE analyzer ═════════════════════════════════╗
║ Error writing to file ║
║ C:\Users\rohitab\AppData\Local\Temp\FARE431.tmp\"OPENCL_C_H".bin ║
║ [0x087B]: The filename, directory name, or volume label syntax is incorrect. ║
╟──────────────────────────────────────────────────────────────────────────────╢
║ { Retry } [ Cancel ] ║
╚══════════════════════════════════════════════════════════════════════════════╝
As you can see from the filename displayed above, PE Analyzer is trying to create a file with the name C:\Users\rohitab\AppData\Local\Temp\FARE431.tmp\"OPENCL_C_H".bin
, which contains quotes. Due to this, the operation fails and the resource cannot be viewed.
The same resource can be viewed using ArcLite. In ArcLite, the resource name is displayed without quotes, e.g., OPENCL_C_H
. In PE Analyzer, the resource name and filename are displayed with quotes, e.g., "OPENCL_C_H"
and "OPENCL_C_H".bin
.
If you look at the source code for the function CHandler::AddResNameToString in PeHandler.cpp
in the 7-Zip source code, you'll see that 7-Zip is removing the quotes.
void CHandler::AddResNameToString(UString &s, UInt32 id) const
{
if ((id & kFlag) != 0)
{
UString name;
if (ReadString(id & kMask, name) == S_OK)
{
const wchar_t *str = L"[]";
if (name.Len() > 1 && name[0] == '"' && name.Back() == '"')
{
if (name.Len() != 2)
{
name.DeleteBack();
str = name.Ptr(1);
}
}
else if (!name.IsEmpty())
str = name;
s += str;
return;
}
}
s.Add_UInt32(id);
}
Due to file size restrictions, I could not attach the file to this ticket. But, you can download the file sample-pe.zip. Once you have the file, open it in PE Analyzer, then navigate to Resource\PCM
and try to view the file "OPENCL_C_H"
. Please note that the download link will expire in a few days.
Anonymous
3.10.12
The issue is resolved. Thank you.