Created
March 7, 2021 03:36
-
-
Save reigningshells/d69e3bc6387801d2da98a4851455deda to your computer and use it in GitHub Desktop.
DllMain template to execute code in a .cpl file which is just a renamed DLL that exports a function CplApplet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dllmain.cpp : Defines the entry point for the DLL application. | |
#include "pch.h" | |
#include <Windows.h> | |
extern "C" __declspec(dllexport) LONG CplApplet() | |
{ | |
MessageBoxA(NULL, "Replace this message box with something more interesting...", "Control Panel", 0); | |
return 1; | |
} | |
BOOL APIENTRY DllMain( HMODULE hModule, | |
DWORD ul_reason_for_call, | |
LPVOID lpReserved | |
) | |
{ | |
switch (ul_reason_for_call) | |
{ | |
case DLL_PROCESS_ATTACH: | |
{ | |
CplApplet(); | |
} | |
case DLL_THREAD_ATTACH: | |
case DLL_THREAD_DETACH: | |
case DLL_PROCESS_DETACH: | |
break; | |
} | |
return TRUE; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment