[Tutorial] Unload Module DLL C++

05/30/2013 17:59 JohnAndersn#1
Yo,
How,
Code:
Run VC++ 2008
Create Project -> Win32 -> Win32 Project -> Next -> App Type:DLL
->Empty Project -> Click Finish!
Add Main.h - Header Files
Add Nob.cpp - Sources Files
Debug it - > Thanks
Unload DLL Module

Main.h
Code:
#include <Windows.h>
Nob.cpp
Code:
#include "Main.h"
void UnDllModule(HMODULE DLL)
{
HMODULE UnDllM = GetModuleHandle(LPCWSTR("kernel32.dll"));
 void* HMODULE  = (void*)GetProcAddress(UnDllM,LPCSTR("ExitThread"));
      _asm
   {
	jmp [FreeLibrary]
   }
}
BOOL WINAPI DllMain(HINSTANCE module, DWORD dwReason, LPVOID lpvReserved)
{
	DisableThreadLibraryCalls(module);
  if(dwReason == DLL_PROCESS_ATTACH)
  {  
	  MessageBox(0,L"Unloaded!",L"Psapi",0);
	  HMODULE DLLX = GetModuleHandle(LPCWSTR("Psapi.dll"));
	   UnDllModule(DLLX);
  }   
return TRUE;
}
Unload your Dll use
Code:
UnDllModule(module);
05/30/2013 18:09 Raz9r#2
[Only registered and activated users can see links. Click Here To Register...] oder [Only registered and activated users can see links. Click Here To Register...] reichen vollkommen...
05/30/2013 18:22 JohnAndersn#3
Quote:
Originally Posted by Raz9r View Post
[Only registered and activated users can see links. Click Here To Register...] oder [Only registered and activated users can see links. Click Here To Register...] reichen vollkommen...
My Code is Better
05/30/2013 18:26 MrSm!th#4
Nope, it wouldn't even compile.