Get all Windows Errors
zeige mir alle verfügbaren Windowserrors auf diesem Computer an:
(das ist von Rechner zu Rechner unterschiedlich.)
- getallwinerrors.c
//zeige alle Fehler an / richard@borwinius.de
// ftp://ftp.oreilly.com/pub/examples/windows/winlog/CDROM/BOOK/CH06/LISTMSG/
#include <stdio.h>
#include <windows.h>
#include <lmerr.h>
void DisplayErrorText(DWORD dwLastError);
//-------------------------------------------------
// max 20000 Messages
int main(void)
{
int i;
for (i=0;i<20000;i++)
{
DisplayErrorText(i);
}
return 0;
}
//-------------------------------------------------
void DisplayErrorText(DWORD dwLastError)
{
HMODULE hModule = NULL; // default to system source
LPSTR MessageBuffer;
DWORD dwBufferLength;
DWORD dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_FROM_SYSTEM ;
//
// Call FormatMessage() to allow for message
// text to be acquired from the system
// or from the supplied module handle.
//
if(dwBufferLength = FormatMessageA(
dwFormatFlags,
NULL,//hModule, // module to get message from (NULL == system)
dwLastError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
(LPSTR) &MessageBuffer, 0, NULL ))
{
DWORD dwBytesWritten;
printf("%05d\t0x%x\t%s\n",dwLastError,dwLastError,MessageBuffer);
//
// Output message string on stderr.
//
//WriteFile( GetStdHandle(STD_ERROR_HANDLE),MessageBuffer, dwBufferLength, &dwBytesWritten, NULL );
//
// Free the buffer allocated by the system.
//
LocalFree(MessageBuffer);
}
//
// If we loaded a message source, unload it.
//
if(hModule != NULL)
FreeLibrary(hModule);
}