我正在尝试解决 LdrLoadDll 函数,但我没有运气..我还搜索了一些示例,没有太多关于此的文档或正确示例。我知道它到底做了什么..请检查下面的代码.
//declaration function pointer for LdrLoadDll
typedef NTSTATUS (_stdcall*fp_LdrLoadDll)(
IN PWCHAR PathToFile OPTIONAL,
IN ULONG Flags OPTIONAL,
IN PUNICODE_STRING ModuleFileName,
OUT PHANDLE ModuleHandle );
//calling LdrLoadDll using getprocaddress
HANDLE handle;
HMODULE module = LoadLibrary(L"ntdll.dll");
fp_LdrLoadDll loadDll;
loadDll = (fp_LdrLoadDll)GetProcAddress(module,"LdrLoadDll");
if(loadDll == NULL)
{
MessageBox(0,L"Not able to load the function",L"LdrLoadDll",&handle);
}
UNICODE_STRING input;
input.Buffer = L"C:\\Desktop\\myDll.dll";
input.Length = wcslen(input.Buffer)*2;
input.MaximumLength = wcslen(input.Buffer) +2;
NTSTATUS status = loadDll(NULL,LOAD_WITH_ALTERED_SEARCH_PATH,&input,0);
当我执行上述操作时,没有得到有效状态的句柄。请帮助我。