Flag: Tornado! Hurricane!

 Forums >>  Brainstorms - General  >>  Listing Open Handles of a Process

Topic created on: August 15, 2005 14:12 CDT by acidx .

Alright, i've been sitting hear to day looking at two programs one of which is written by microsoft the other by mark at sysinternals. The microsoft program is Open Handle(Oh) and the sysinternals programs is handle. Both of the programs list the open handles for a given process in two entirely different ways from what i can see. I would like to try and reimplement this without the use of a device driver therefore i've been trying to study Oh versus handle. Does anyone here have any insight into how I can accomplish this? I see in oh that they use a few of the 'undocumented' nt function NtOpenProcess, NtQueryInformationProcess, but before any of these calls i see a reference to \\WindowsSS . If you know anything regarding this please share your information. Thanks

  nohaven     August 15, 2005 21:56.32 CDT
Use NtQuerySystemInformation with the SystemHandleInformation (16) SYSTEM_INFORMATION_CLASS.  You'll need to pass in an array of SYSTEM_HANDLE_INFORMATION structures defined as:

typedef struct _SYSTEM_HANDLE_INFORMATION {
   ULONG ProcessId;
   UCHAR ObjectTypeNumber;
   UCHAR Flags;
   USHORT Handle;
   PVOID Object;
   ACCESS_MASK GrantedAccess;
} SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;

NtQuerySystemInformation is prototyped as:

NTSYSAPI
NTSTATUS
NTAPI
NtQuerySystemInformation(
   IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
   IN OUT PVOID SystemInformation,
   IN ULONG SystemInformationLength,
   OUT PULONG ReturnLength OPTIONAL
   );

Just filter based on the ProcessId that is associated with each returned handle information.

  acidx     August 18, 2005 12:55.49 CDT
Sorry it took so long, but thank you. First chance i've had since monday to check back.

  sa7ori     August 22, 2005 12:11.17 CDT
I am not much for product endorsement, but if you havent already, you should chigetty check out Gary Nebbett's Native API Reference. In my version Chapter 2 (example 1) "Objects, Object Directories, and Sym links" has the answer to your question, albeit a bit more verbose and OOPy than the more concise SYSTEM_HANDLE_INFORMATION method below.

Note: Registration is required to post to the forums.

There are 31,314 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
hi!
Jul/01
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit