Besides the tools, you can look at winerror.h in the platform SDK.
When you are reporting problems like this, it is absolutlely necessary to
give the contents of the variables, that is, what is in the string
“infFileName”. The correct _tprintf would have been
_tprintf(_T(“nFile name "%s"\nSetupInstallOemFile call failed, code
%u”), infFilename, err);
It is generally a bad idea to put GetLastError() in the context you did,
because it can be damaged by any intervening calls you might add later.
For example, in C++
if(!..API call here…)
{
DWORD err = ::GetLastError();
SomeVariableDeclarationHere;
_tprintf(…);
}
By the time you get to _tprintf, the constructor of the variable may have
destoryed the value of GetLastError. I make sure that the very first line
that is executed after a failing API is a call of GetLastError(). Note
that a declaration can be executable code. That way, the special-case
scenario you show, where GetLastError just happens to work, will not be
invalidated by more sophisticated error response code.
That way, when you get error code 2, we know what the actual file name
was, and can therefore offer suggestions.
You might also investigate the use of FormatMessage for reporting errors.
If you use MFC, you can use the example I give on
http://www.flounder.com/errorstring.htm
joe
I have written a C program to install/uninstall my driver.
The installation happens successfully.
During uninstall the function SetupUninstallOEMInf() fails.
The GetLastError() gives me a value of 2.
The code snippet is:
> TCHAR infFileName[MAX_PATH];
>
> if( ! SetupUninstallOEMInf( infFileName, SUOI_FORCEDELETE, NULL) )
> {
> //failure to delete the OEM File
> _tprintf( _T("\nSetupUninstallOEMFile call failed. Code %u"),
> GetLastError() );
> return;
> }
>
How to find what does this 2 indicates and how to resolve this issue?
Can I get any list of error codes?
Is there any way to get descriptive message?
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer