dllmain

来源:互联网 发布:淘宝客服电话人工按几 编辑:程序博客网 时间:2024/05/23 07:25

// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "stdafx.h"
#include "stdio.h"
#include <fstream>
using namespace std;
#define  __DEBUG

#ifdef __DEBUG

#define DEBUG(format,...) printf("File: "__FILE__", Line: %05d: "format"\n", __LINE__, ##__VA_ARGS__) 

#else

#define DEBUG(info)

#endif

extern HINSTANCE hdll_lib;
BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
      )
{
 switch (ul_reason_for_call)
 {
 case DLL_PROCESS_ATTACH:
 case DLL_THREAD_ATTACH:
 case DLL_THREAD_DETACH:
 case DLL_PROCESS_DETACH:
  break;
 }
 hdll_lib=(HINSTANCE)hModule; //保存自身DLL句柄
 DEBUG("KHook.dll handle:%d!\r\n",hdll_lib);
 //ofstream file("C:\\hook.txt",ios::app|ios::out);
 //file << "khool加载";
 return TRUE;
}

原创粉丝点击