![]() |
LdrLoadDll in nt native api |
Post Reply
|
Page 123> |
| Author | |
zahra34
Newbie
Joined: 25 August 2009 Location: teh Online Status: Offline Posts: 32 |
Quote Reply
Topic: LdrLoadDll in nt native apiPosted: 25 August 2009 at 3:38pm |
|
Hi all
I'm writting a program in kernel mode using ddk.for this purpose I use NT-Native functions . I want to load some kernel mode dlls there and use of "LdrLoadDLL" function . I don't know how should I pass those dlls path address in the first input argument of this function? I get error to load some kernel mode dll (Error such as "File not found" or "access violation" where it succeeds in loading only "ntdll.dll"!) and also I don't know how should be the dll's "path" format in first argument of function? is there any example about this function?
I extremely hope you could help me!!!! Thanks in Advance. |
|
![]() |
|
BanMe
Groupie
Joined: 18 August 2006 Location: United States Online Status: Offline Posts: 55 |
Quote Reply
Posted: 25 August 2009 at 4:35pm |
|
UNC Native PATH name.. ;)
example in UNICODE
L"\\??\\C:\\Windows\\System32\\somemod.dll"
regards BanMe
ps..thats a funky link finding method you use...oh sad sad developer..of this website.. Edited by BanMe - 25 August 2009 at 4:37pm |
|
![]() |
|
zahra34
Newbie
Joined: 25 August 2009 Location: teh Online Status: Offline Posts: 32 |
Quote Reply
Posted: 25 August 2009 at 6:41pm |
|
thanx BanMe
I think it is not as simple as that you declared.I examine a path like above you said and even more things but it does not answer. I need more professional example :)
|
|
![]() |
|
ntunldr
Senior Member
Joined: 05 July 2009 Online Status: Offline Posts: 103 |
Quote Reply
Posted: 26 August 2009 at 4:37am |
|
Then google it :)
Working with Sections will help you instead of using Ldr user mode functions in kernel mode (you of course can try but this is perversion), or maybe mods here have a special professional opinion that gives them right to kick my previous post? ^_^ Rhetorical question no need to answer. Of course if you doing this
If not, then simple example to LdrLoadDll will be easy to find even here. Open file, create section from it, map file and work with it. As an professional example you can search for ProcessHunter v1.1 source. It includes primitive loader. |
|
|
|
![]() |
|
wj32
Senior Member
Joined: 16 January 2009 Location: Australia Online Status: Offline Posts: 607 |
Quote Reply
Posted: 26 August 2009 at 5:59am |
|
How do you even call LdrLoadDll from kernel-mode? Kernel modules have to be loaded through the driver mechanism. If you just want to load and relocate a module, I'm not sure if mapping a section as an image will relocate it...
|
|
|
MCTS: Windows Internals
Process Hacker, a free and open source process viewer. |
|
![]() |
|
zahra34
Newbie
Joined: 25 August 2009 Location: teh Online Status: Offline Posts: 32 |
Quote Reply
Posted: 26 August 2009 at 6:25am |
|
thanks ntunldr for your answer, I will search and try this way
I use it in NtStartupProcess,is it possible? I want a handle of dll that then I can pass it to LdrGetProcedureAddress and use some functions of that dll.I'm not sure that is it possible or it is a wrong way maybe!
|
|
![]() |
|
zahra34
Newbie
Joined: 25 August 2009 Location: teh Online Status: Offline Posts: 32 |
Quote Reply
Posted: 26 August 2009 at 6:33am |
|
sorry,I mean NtProcessStartup ;)
|
|
![]() |
|
ntunldr
Senior Member
Joined: 05 July 2009 Online Status: Offline Posts: 103 |
Quote Reply
Posted: 26 August 2009 at 7:21am |
|
Of course they must be rellocated. Instead of coding such perversions as using r3 code in r0 you maybe shred some light, what exactly do you want to do? For what purpose you want to use these functions and what exactly? What are you trying to accomplish now is deadend way leading to blue screens.
|
|
|
|
![]() |
|
zahra34
Newbie
Joined: 25 August 2009 Location: teh Online Status: Offline Posts: 32 |
Quote Reply
Posted: 26 August 2009 at 8:27am |
|
I have a project to load dll of a device so that I can use functions within it(dll such as card reader). no, it does not lead to blue screens that you mean, I get an error code(c0000005 (STATUS_ACCESS_VIOLATION))first I think maybe I should use kernel mode dll, I just examine hal.dll as an example but it just returns the error which I said, instead returning success, my code runs before blue welcome screen. |
|
![]() |
|
wj32
Senior Member
Joined: 16 January 2009 Location: Australia Online Status: Offline Posts: 607 |
Quote Reply
Posted: 26 August 2009 at 10:01am |
|
You can't use user-mode code in kernel-mode. That's a rule.
|
|
|
MCTS: Windows Internals
Process Hacker, a free and open source process viewer. |
|
![]() |
|
Post Reply
|
Page 123> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |