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:
parent
af76e64a2e
commit
fe8920640d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user