Sysinternals Homepage
Forum Home Forum Home > Windows Discussions > Development
  New Posts New Posts RSS Feed: LdrLoadDll in nt native api
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

LdrLoadDll in nt native api

 Post Reply Post Reply Page  <123
Author
Message
  Topic Search Topic Search  Topic Options Topic Options
BanMe View Drop Down
Groupie
Groupie
Avatar

Joined: 18 August 2006
Location: United States
Online Status: Offline
Posts: 55
  Quote BanMe Quote  Post ReplyReply Direct Link To This Post Topic: LdrLoadDll in nt native api
    Posted: 28 August 2009 at 8:52pm
if your dll is in the 'systems' search path there is no need to specify one ;) just rely on the system being able to locate it.. so code such as this

RtlInitUnicodeString(&Namedll, L"exampledll.dll");

status=LdrLoadDll(L"\\??\\C:\\WINDOWS\\system32", 0 , &Namedll, &mydll);
should work like this..

HMODULE mydll = 0;
RtlInitUnicodeString(&Namedll, L"exampledll.dll");

status=LdrLoadDll(0,0 , &Namedll, &mydll);
if this continues to fail, then you maybe just have to come up with a alternitive method of 'loading' it..if there is a problem with your Dll's DllMain or LibMain or w/e that could also be a problem.. try loading your dll into OllyDbg using the LoadDll feature present in version 1.10..if olly loads it properly then you can try the upper solution, otherwise you will have to recompile your dll.. ;)
 
regards BanMe 
Back to Top
sepehrst View Drop Down
Newbie
Newbie


Joined: 06 October 2007
Location: teh
Online Status: Offline
Posts: 1
  Quote sepehrst Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2009 at 5:21am
Hi
 
Does the dll your're trying to load, imports any dlls from user mod(win32 subsystem) land? (like kernel32, user32,...)
if so, then you will fail to load your dll.
To be able to load the dll in your native app, the dll must import ONLY ntdll.dll or other "native" dlls.
 
 
Back to Top
zahra34 View Drop Down
Newbie
Newbie


Joined: 25 August 2009
Location: teh
Online Status: Offline
Posts: 32
  Quote zahra34 Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2009 at 5:39am
hi
you are correct.maybe it has user mode dlls too that can not load them.I'm not sure.thanks for your reply
Back to Top
 Post Reply Post Reply Page  <123

Forum Jump Forum Permissions View Drop Down

Privacy Statement