LdrLoadDll 状态失败
我正在尝试计算 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);
当我执行上述操作时,我没有得到句柄,也没有有效状态。请帮助我。
I'am trying to work-out the LdrLoadDll function and am having no luck with that..i also googled for some examples there is no much documentation or correct example about this.I know what it exactly does..Please check the code below.
//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);
When i execute the above am not getting the handle niether valid status.Please help me with this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我像下面这样初始化 Unicode 字符串时,它对我有用
It worked for me when I intialized the Unicode string like the following