reigningshells

DllMain Template to Execute Code in a .cpl File

Mar 6th, 2021
1,081
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // dllmain.cpp : Defines the entry point for the DLL application.
  2. #include "pch.h"
  3. #include <Windows.h>
  4.  
  5. extern "C" __declspec(dllexport) LONG CplApplet()
  6. {
  7.     MessageBoxA(NULL, "Replace this message box with something more interesting...", "Control Panel", 0);
  8.     return 1;
  9. }
  10.  
  11. BOOL APIENTRY DllMain( HMODULE hModule,
  12.                        DWORD  ul_reason_for_call,
  13.                        LPVOID lpReserved
  14.                      )
  15. {
  16.     switch (ul_reason_for_call)
  17.     {
  18.         case DLL_PROCESS_ATTACH:
  19.         {
  20.             CplApplet();
  21.         }
  22.         case DLL_THREAD_ATTACH:
  23.         case DLL_THREAD_DETACH:
  24.         case DLL_PROCESS_DETACH:
  25.             break;
  26.     }
  27.     return TRUE;
  28. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×