Reply To: retrieving full process image path name in kernel mode

Home Forums Discussions General retrieving full process image path name in kernel mode Reply To: retrieving full process image path name in kernel mode

#5874
Vadim Smirnov
Keymaster

    Well, this topic was already discussed before (http://www.ntkernel.com/forum/viewtopic.php?t=52&highlight=sectionobject) but in Russian. There is a more reliable way to get full image name for the process, but it requires knowledge of some undocumented structures. Here is short translation of the main approach:

    1. Obtain EPROCESS pointer through IoGetCurrentProcess().
    2. For NT 4.0 and 5.0 take section handle from EPROCESS(SectionHandle) and using ObReferenceObjectByHandle() we obtain SectionObject; for NT 5.1 we can take SectionObject from EPROCESS directly.
    3. From SectionObject we obtain SegmentObject.
    4. From SegmentObject we obtain ControlArea.
    5. From ControlArea we obtain FilePointer (this is FileObject pointer).
    6. Using ObQueryNameString() we obtain full process name
    All operations should be performed on PASSIVE_LEVEL and in the context of the process we obtain full path for.