Advertisement
FlyFar

DoubleAgentDll/main.c

Jan 2nd, 2024
706
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.94 KB | Cybersecurity | 0 0
  1. /* Includes ******************************************************************/
  2. #include <Windows.h>
  3. #include "Status.h"
  4. #include "Process.h"
  5. #include "VerifierDll.h"
  6.  
  7. /* Function Declarations *****************************************************/
  8. /*
  9.  * The event handler for DLL attach events
  10.  */
  11. static BOOL main_DllMainProcessAttach(VOID);
  12. /*
  13.  * The event handler for DLL detach events
  14.  */
  15. static BOOL main_DllMainProcessDetach(VOID);
  16.  
  17. /* Function Definitions ******************************************************/
  18. BOOL WINAPI DllMain(IN HINSTANCE hInstDLL, IN SIZE_T nReason, IN PVOID pvReserved)
  19. {
  20.     UNREFERENCED_PARAMETER(hInstDLL);
  21.  
  22.     /* Process Attach */
  23.     if (VERIFIERDLL_DLL_PROCESS_VERIFIER == nReason)
  24.     {
  25.         return VERIFIERDLL_DllMainProcessVerifier(pvReserved);
  26.     }
  27.  
  28.     else if (DLL_PROCESS_ATTACH == nReason)
  29.     {
  30.         return main_DllMainProcessAttach();
  31.     }
  32.  
  33.     /* Process Detach */
  34.     else if (DLL_PROCESS_DETACH == nReason)
  35.     {
  36.         return main_DllMainProcessDetach();
  37.     }
  38.  
  39.     /* Thread Attach\Detach */
  40.     else
  41.     {
  42.         return TRUE;
  43.     }
  44. }
  45.  
  46. static BOOL main_DllMainProcessAttach(VOID)
  47. {
  48.     DOUBLEAGENT_STATUS eStatus = DOUBLEAGENT_STATUS_INVALID_VALUE;
  49.  
  50.     /*
  51.      **************************************************************************
  52.      Enter Your Code Here
  53.      **************************************************************************
  54.      */
  55.  
  56.      /* Sample Code - Launch cmd.exe */
  57.      //eStatus = PROCESS_Create(L"cmd.exe");
  58.      //if (FALSE == DOUBLEAGENT_SUCCESS(eStatus))
  59.      //{
  60.      // goto lbl_cleanup;
  61.      //}
  62.  
  63.      /* Succeeded */
  64.     DOUBLEAGENT_SET(eStatus, DOUBLEAGENT_STATUS_SUCCESS);
  65.  
  66.     //lbl_cleanup:
  67.     /* Returns status */
  68.     return FALSE != DOUBLEAGENT_SUCCESS(eStatus);
  69. }
  70.  
  71. static BOOL main_DllMainProcessDetach(VOID)
  72. {
  73.     DOUBLEAGENT_STATUS eStatus = DOUBLEAGENT_STATUS_INVALID_VALUE;
  74.  
  75.     /* Succeeded */
  76.     DOUBLEAGENT_SET(eStatus, DOUBLEAGENT_STATUS_SUCCESS);
  77.  
  78.     /* Returns status */
  79.     return FALSE != DOUBLEAGENT_SUCCESS(eStatus);
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement