I .dll 인에 다음 코드가 있습니다GetProcAddress를 이름이 제대로 망가 경우에도 실패
namespace MyNamespace
{
extern "C" __declspec(dllexport) int __stdcall GetOptionID(unsigned long num)
{
return 0;
}
}
이는 비주얼 C++ 2010 컴파일, 그래서 나는 또한 GetOptionID
를 포함하는 .DEF 파일이됩니다. 내가 DUMPBIN/수출하여 함수를 내보낼 것을보고, [email protected]
로 난도질 할 수 있습니다
HINSTANCE hinst = LoadLibraryEx(file_name, NULL, DONT_RESOLVE_DLL_REFERENCES);
if(!hinst)
return FALSE;
FARPROC_IDI lp = (FARPROC_IDI) GetProcAddress(hinst, "[email protected]");
auto e = GetLastError();
를 통해 실행 : 별도의 실행 파일에
File Type: DLL
Section contains the following exports for MyLibrary.dll
00000000 characteristics
53D269CB time date stamp Fri Jul 25 15:29:31 2014
0.00 version
1 ordinal base
13 number of functions
13 number of names
ordinal hint RVA name
1 0 0006F030 CmdOne = [email protected]
2 1 0006F510 CmdUnimpl = [email protected]
3 2 0006EBB0 DefineThing = [email protected]
4 3 0006E0C0 GetOptionID = [email protected]
을, 나는 GetOptionID
의 존재를 확인하려고 시도 디버거에서이 코드는, 나는 것을 볼 수 있습니다
LoadLibraryEx
성공 - 내가 가진 유효한이 보이는hinst
GetProcAddress
실패 -lp
은0x00000000
GetLastError
내가 함수가 내 보낸 볼 수 있고, 내가 그 이름이 내가 찾고 엔트리 포인트를 일치 볼 수있는 127
를 반환합니다. GetProcAddress
은 어떻게 실패하고 있습니까?
dumpbin의 출력을 잘못 읽었습니다. 내 보낸 이름은 등호 왼쪽에있는 이름입니다. –