Skip to content

Commit

Permalink
[fix] mimikatz as DLL, new console is not mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
gentilkiwi committed Jul 14, 2021
1 parent fc7f5cc commit 571fc8c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions mimikatz/mimikatz.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,24 +260,23 @@ void CALLBACK mimikatz_dll(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int n
{
int argc = 0;
wchar_t ** argv;
if(AllocConsole())
{

AllocConsole();
#pragma warning(push)
#pragma warning(disable:4996)
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
freopen("CONIN$", "r", stdin);
#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

Expand Down

0 comments on commit 571fc8c

Please sign in to comment.