Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // dllmain.cpp : Defines the entry point for the DLL application.
- #include <Windows.h>
- #include<iostream>
- HMODULE myhModule;
- DWORD __stdcall EjectThread(LPVOID lpParameter) {
- Sleep(100);
- FreeLibraryAndExitThread(myhModule, 0);
- }
- DWORD WINAPI Menue() {
- AllocConsole();
- FILE* fp;
- freopen_s(&fp, "CONOUT$", "w", stdout); // output only
- std::cout << "test" << std::endl;
- while (1) {
- Sleep(100);
- if (GetAsyncKeyState(VK_NUMPAD0))
- break;
- }
- fclose(fp);
- FreeConsole();
- CreateThread(0, 0, EjectThread, 0, 0, 0);
- int i = 0;
- return 0;
- }
- BOOL APIENTRY DllMain( HMODULE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
- {
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- myhModule = hModule;
- CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Menue, NULL, 0, NULL);
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement