コード例 #1
0
ファイル: hook.c プロジェクト: aosm/bind
static  void    hookListDone(void)
{
    HOOKPTR hp ;
    
    while ((hp = hookList.next) != &hookList) {
        hookListDelete(hp) ;
    }
}
コード例 #2
0
/*
 * hookProc - hookprocedure, used as WH_GETMESSAGE hook
 */
LRESULT CALLBACK
hookProc(int nCode, WPARAM wParam, LPARAM lParam) {
	MSG             *pMsg;
	HOOKPTR         pHook;
	struct  hostent *pHost;
	char            nbuff[256];
	char            hbuff[256];
    
	if (nCode < 0) {
		return (CallNextHookEx(hookHandle, nCode, wParam, lParam));
	} else if (nCode != HC_ACTION) {
		return (0);
	}
	if ((pMsg = (MSG *)lParam) == NULL) {
		return (0);
	}
	if ((pHook = hookListSearch(pMsg->hwnd, pMsg->message)) == NULL) {
		return (0);
	}
    
	/*
	 * Convert the Host Name
	 */
	pHost = (struct hostent *)pHook->pBuf;
	idnPrintf("AsyncComplete Resulting <%s>\n",
		  dumpName(pHost->h_name, hbuff, sizeof(hbuff)));
	if (idnConvRsp(pHook->ctx, pHost->h_name,
		       nbuff, sizeof(nbuff)) == TRUE) {
		idnPrintf("AsyncComplete Converted <%s>\n",
			  dumpName(nbuff, hbuff, sizeof(hbuff)));
		strcpy(pHost->h_name, nbuff);
	}

	/*
	 * Delete target
	 */
	hookListDelete(pHook);

	return (0);
}