![]() |
Get PEPROCESS by PID! |
Post Reply
|
Page <12 |
| Author | |
MP_ART
Senior Member
Joined: 08 March 2006 Location: Russian Federation Online Status: Offline Posts: 947 |
Quote Reply
Topic: Get PEPROCESS by PID!Posted: 12 August 2006 at 4:19am |
|
PVOID pid;
pid = (PVOID)IdOfYourProcess; status = PsLookupProcessByProcessId( pid, &process ); |
|
![]() |
|
Headium2006
Groupie
Joined: 25 July 2006 Location: China Online Status: Offline Posts: 79 |
Quote Reply
Posted: 12 August 2006 at 4:38am |
|
Ok, I'll try it! Thanks, MP_ART!
|
|
![]() |
|
Headium2006
Groupie
Joined: 25 July 2006 Location: China Online Status: Offline Posts: 79 |
Quote Reply
Posted: 12 August 2006 at 4:42am |
|
By the way, how are all these unpublished functions got?I mean in IFS Document, there is no info about those functions. How can U get them? I want to know about that for I think the way to get them must be very interesting! |
|
![]() |
|
EP_X0FF
Senior Member
Joined: 08 March 2006 Location: Russian Federation Online Status: Offline Posts: 4753 |
Quote Reply
Posted: 12 August 2006 at 4:47am |
Windows NT Kernel Reverse Engineering. |
|
|
Ring0 - the source of inspiration
|
|
![]() |
|
Headium2006
Groupie
Joined: 25 July 2006 Location: China Online Status: Offline Posts: 79 |
Quote Reply
Posted: 12 August 2006 at 12:45pm |
|
Hi, EP_XOFF! I tried hard but I still failed to call the function of PsLookupProcessByProcessId. But I have proven that I can easily get the name of parent process of certain process by traversing the ActiveProcessLinks. I wrote the code below to enumurate all the active process and I succeed. If I add some restriction condition, I can of course get the name of parent process. VOID TraverseProcessLinkList( IN PEPROCESS EProcess ){ pProc = EProcess; do { //Get name of the process pointed by pProc //Forward the pNext pointer DbgPrint("proces total count %d \n", nCount); But I don't konw whether getting the parent process's name in this way may lead to some unsafe status or not. Do I need to acquire a lock when accessing the active process linked-list? Waiting for your suggestion!Thanks!
|
|
![]() |
|
EP_X0FF
Senior Member
Joined: 08 March 2006 Location: Russian Federation Online Status: Offline Posts: 4753 |
Quote Reply
Posted: 12 August 2006 at 1:08pm |
|
Hello, Headium2006.
You should know that information about process name in EPRPOCESS struct is very limited by length, so I suggest you make KeAttachProcess, read information about process executable name from Process Environment Block, LDR entry, then of course make ObfDereferenceObject and KeDetachProcess. BTW, PsLookupProcessByProcessId is very easy and safe to use, so what is your problem? Why you cant use it? Maybe you dont have needed libs? |
|
|
Ring0 - the source of inspiration
|
|
![]() |
|
Headium2006
Groupie
Joined: 25 July 2006 Location: China Online Status: Offline Posts: 79 |
Quote Reply
Posted: 12 August 2006 at 9:44pm |
|
In fact, I did try to call the function PsLookupProcessByProcessId. But every time I call this function, it never returns a successful status. I mean my call to this function never succeeded in get the PEPROCESS. But I did pass through the compiling. No error occured duiring compiling. |
|
![]() |
|
EP_X0FF
Senior Member
Joined: 08 March 2006 Location: Russian Federation Online Status: Offline Posts: 4753 |
Quote Reply
Posted: 12 August 2006 at 10:39pm |
Show us how you calling that function. Full source code of place where used PsLookupProcessByProcessId including variable types. |
|
|
Ring0 - the source of inspiration
|
|
![]() |
|
Headium2006
Groupie
Joined: 25 July 2006 Location: China Online Status: Offline Posts: 79 |
Quote Reply
Posted: 13 August 2006 at 2:56am |
|
Hi, EP_XOFF! My code is below. The problem is that I can pass compiling, but every time I call PsLookupProcessByProcessId it never returns a successful status. //I declare PsLookupProcessByProcessId //Code where PsLookupProcessByProcessId is called //Display the MajorFunction code //Get the EPROCESS pointer of parent process //Relay the IRP packet I really do not konw why it can never work properly! |
|
![]() |
|
EP_X0FF
Senior Member
Joined: 08 March 2006 Location: Russian Federation Online Status: Offline Posts: 4753 |
Quote Reply
Posted: 13 August 2006 at 3:11am |
|
Perhaps you are sending a pointer instead of real process Id.
|
|
|
Ring0 - the source of inspiration
|
|
![]() |
|
Post Reply
|
Page <12 |
| 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 |