[fix] mimikatz as DLL, new console is not mandatory

This commit is contained in:
Benjamin DELPY 2021-07-14 17:37:12 +02:00
parent fc7f5cc2a3
commit 571fc8cc99
1 changed files with 11 additions and 12 deletions

View File

@ -260,24 +260,23 @@ void CALLBACK mimikatz_dll(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int n
{ {
int argc = 0; int argc = 0;
wchar_t ** argv; wchar_t ** argv;
if(AllocConsole())
{ AllocConsole();
#pragma warning(push) #pragma warning(push)
#pragma warning(disable:4996) #pragma warning(disable:4996)
freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr); freopen("CONOUT$", "w", stderr);
freopen("CONIN$", "r", stdin); freopen("CONIN$", "r", stdin);
#pragma warning(pop) #pragma warning(pop)
if(lpszCmdLine && lstrlenW(lpszCmdLine)) if(lpszCmdLine && lstrlenW(lpszCmdLine))
{
if(argv = CommandLineToArgvW(lpszCmdLine, &argc))
{ {
if(argv = CommandLineToArgvW(lpszCmdLine, &argc)) wmain(argc, argv);
{ LocalFree(argv);
wmain(argc, argv);
LocalFree(argv);
}
} }
else wmain(0, NULL);
} }
else wmain(0, NULL);
} }
#endif #endif