N
Night12138
Guest
Hi,
I'm using GetLastError() and FormatMessage() to get the error infomation of program. Here is an MSDN example(docs.microsoft.com/zh-cn/windows/win32/debug/retrieving-the-last-error-code I'm sorry, I don't have permission to insert the link as hyperlink).
But a lot of the returned contains format string like "% 1% hs". For example:
573 (0x23D) ERROR_MISSING_SYSTEMFILE
{Missing System File} The required system file %hs is bad or missing.
34 (0x22) ERROR_WRONG_DISK
The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1.
An MSDN document(docs.microsoft.com/zh-cn/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d) explains this:
Note In the following descriptions, a percentage sign followed by one or more alphanumeric characters (for example, "%1" or "%hs") indicates a variable that will be replaced by text at the time the value is returned.
I think there should be some way to return the information with the wrong file name, or I misunderstood the usage of these two functions. But when I searched a lot of reports about these errors, their error messages contained the path or value of the error. It confuses me.
Continue reading...
I'm using GetLastError() and FormatMessage() to get the error infomation of program. Here is an MSDN example(docs.microsoft.com/zh-cn/windows/win32/debug/retrieving-the-last-error-code I'm sorry, I don't have permission to insert the link as hyperlink).
But a lot of the returned contains format string like "% 1% hs". For example:
573 (0x23D) ERROR_MISSING_SYSTEMFILE
{Missing System File} The required system file %hs is bad or missing.
34 (0x22) ERROR_WRONG_DISK
The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1.
An MSDN document(docs.microsoft.com/zh-cn/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d) explains this:
Note In the following descriptions, a percentage sign followed by one or more alphanumeric characters (for example, "%1" or "%hs") indicates a variable that will be replaced by text at the time the value is returned.
I think there should be some way to return the information with the wrong file name, or I misunderstood the usage of these two functions. But when I searched a lot of reports about these errors, their error messages contained the path or value of the error. It confuses me.
Continue reading...