난 비주얼 스튜디오에서 하나 개의 솔루션 파일을 가지고 있고, 내가 가진 그 두 개의 프로젝트 .dll 파일에 대한 하나는 .c 파일에 다른 하나 개의 프로젝트 :메모장에서 키 스트로크를 만드는 동안 예외가 발생하는 이유는 무엇입니까?
이가 .H 파일입니다
#include <windows.h>
#ifndef BHANNAN_TEST_CLASS_H_
#define BHANNAN_TEST_CLASS_H_
extern int __declspec (dllexport) Factorial(int n);
#endif
과 (의 DLL)가 .c 파일 : 지금 난 그냥 후킹의 메커니즘을 이해하기 위해, 메모장에서 키 입력을 후크 DLL을로드하는 데에서 시도 로더/테스터가
#include "hanan.h"
#include <stdio.h>
int Factorial(int n) {
printf("in DLL %d \n" ,n);
return 0;
}
.
이
로더의 코드입니다 : 내가 얻을#include <windows.h>
#include <stdio.h>
typedef int (*functor) (int);
functor funcptr =NULL;
int main() {
HWND windowHandle;
HINSTANCE hMod;
HOOKPROC lpfn;
DWORD threadId;
HHOOK hook;
HMODULE myDLL = LoadLibraryW(L"dll123.dll");
funcptr = (functor) GetProcAddress(myDLL,"Factorial");
/// printing issues:////////////////
printf("%d \n\r" , myDLL);
printf("%d" , funcptr(33));
//////////////////////////////////////
lpfn = (HOOKPROC) funcptr;
hMod = myDLL;
windowHandle = FindWindow(L"Notepad",NULL);
threadId = GetWindowThreadProcessId(windowHandle, NULL);
hook = SetWindowsHookEx(WH_KEYBOARD,lpfn,hMod,threadId);//(WH_CBT, HookCBTProc, hInst, threadId);
/// printing issues:
printf("%d %d %d %d\n" , hook, WH_KEYBOARD , lpfn , hMod);
printf("%d %d \n",threadId , windowHandle);
getchar();
return 0;
}
모든이 (가정 메모장이 실행되는)에는 널 (null)이없는,하지만 난 메모장의 모든 키 입력을 할 때 내가 얻을 의미하는 더 0을 인쇄하지 비주얼 스튜디오 2010과 윈도우를 사용하여 바로 예외,
7
추가 예외 속성 :
Exception Offset: 0006632c
Exception Code: c0000409
Exception Data: 00000000
,691,363 당신이 세트 후크 호출에 전달 (210)
(다른 두 PARAMS ??입니다)
int Factorial(int n)
그러나 실제 예외에 대해서는 언급하지 않았습니다. –@ p.campbell - 오류 메시지를 읽으면 재미있는 일이 일어납니다. –