1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-20 20:37:27 +01:00

Add Disable Windows Error Messages

This commit is contained in:
Artem 2017-04-26 21:41:19 +03:00 committed by Brent Cook
parent af76e64a2e
commit fe8920640d

View File

@ -174,6 +174,24 @@ Command customCommands[] =
*/
DWORD __declspec(dllexport) InitServerExtension(Remote *remote)
{
HANDLE KernelHandleM = GetModuleHandle("kernel32.dll");
if (KernelHandleM)
{
typedef DWORD(WINAPI * ThreadErrorMSG)(DWORD, DWORD *);
typedef DWORD(WINAPI * ErrorMSG)(DWORD);
ThreadErrorMSG SetThreadErrorModeReal;
ErrorMSG SetErrorModeReal;
SetErrorModeReal = (ErrorMSG)GetProcAddress(KernelHandleM, "SetErrorMode");
SetThreadErrorModeReal = (ThreadErrorMSG)GetProcAddress(KernelHandleM, "SetThreadErrorMode");
if (SetErrorModeReal)
{
SetErrorModeReal(SEM_FAILCRITICALERRORS);
}
if (SetThreadErrorModeReal)
{
SetThreadErrorModeReal(SEM_FAILCRITICALERRORS, NULL);
}
}
hMetSrv = remote->met_srv;
command_register_all(customCommands);