Checking .exe name

Newbie Spellweaver
Joined
Aug 22, 2010
Messages
34
Reaction score
56
This code will be useful for you protected your dll for leechers.

The code will check if the .dll was loaded in a .exe with the name of GunZ.exe, you can change the name if you want.

In your hooks function paste this :

Code:
char szModule[ 256 ];
	GetModuleFileName( GetModuleHandle( NULL ), szModule, 256 );

	string mPath = string( szModule );

	if( _stricmp( (char*)mPath.substr( mPath.find_last_of( '\\' ) + 1 ).c_str(), "GunZ.exe" ) ){
		MessageBoxTimeoutA( NULL, "Invalid runnable name.", "YouR GunZ", MB_ICONHAND, NULL, 3000 );

		((ULONG(__stdcall*)( HANDLE, ULONG ))GetProcAddress( LoadLibrary( "ntdll.dll" ), "ZwTerminateProcess" ))( GetCurrentProcess(), 0 );

		return;
	}

You will need to include the iostream, string library, and declara the name space std.

Code:
#include <iostream>
#include <string>

using namespace std;

If you get a error in function MessageBoxTimeoutA, in the top of your source type this :

Code:
WINUSERAPI
int
WINAPI
MessageBoxTimeoutA(
    __in_opt HWND hWnd,
    __in_opt LPCSTR lpText,
    __in_opt LPCSTR lpCaption,
    __in UINT uType,
	__in WORD wlanguageid,
	__in DWORD dwMilisseconds);

If you got some error, please post here i will help ...
... and I'm sorry by my bad english.

Credits :
Me
 
MD5 check is the best way to prevent the dll of being used into another client.
MD5 check Gunz.exe and voila!
 
Ain't there are files encrypter somewhere like PE comptact, themidia, enigma etc, they are made for that's.
 
Back