UnfitElf
February 20th, 2007, 11:42 PM
Hi people,
I currently have code that lists all the current processes running on the system.
I am needing to get the IMAGE_DOS_HEADER, IMAGE_OPTIONAL_HEADER, and IMAGE_IMPORT_DESCRIPTOR infomation from one of the processes.
I can easily get the process handle (OpenProcess()) from the process id (i am obtaining to process id via CreateToolhelp32Snapshot() Process32First() etc.)
What is the difference between HMOD and a HANDLE?
The code i would use is as follows, where hMod is a module handle
IMAGE_DOS_HEADER * ImageDosHeader = (IMAGE_DOS_HEADER *)hMod;
IMAGE_OPTIONAL_HEADER * ImageOptionalHeader = (IMAGE_OPTIONAL_HEADER *)((BYTE *)hMod + ImageDosHeader->e_lfanew + 24);
IMAGE_IMPORT_DESCRIPTOR * ImageImportDescriptor = (IMAGE_IMPORT_DESCRIPTOR *)((BYTE *)hMod + ImageOptionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
Can anyone shead some light?
I currently have code that lists all the current processes running on the system.
I am needing to get the IMAGE_DOS_HEADER, IMAGE_OPTIONAL_HEADER, and IMAGE_IMPORT_DESCRIPTOR infomation from one of the processes.
I can easily get the process handle (OpenProcess()) from the process id (i am obtaining to process id via CreateToolhelp32Snapshot() Process32First() etc.)
What is the difference between HMOD and a HANDLE?
The code i would use is as follows, where hMod is a module handle
IMAGE_DOS_HEADER * ImageDosHeader = (IMAGE_DOS_HEADER *)hMod;
IMAGE_OPTIONAL_HEADER * ImageOptionalHeader = (IMAGE_OPTIONAL_HEADER *)((BYTE *)hMod + ImageDosHeader->e_lfanew + 24);
IMAGE_IMPORT_DESCRIPTOR * ImageImportDescriptor = (IMAGE_IMPORT_DESCRIPTOR *)((BYTE *)hMod + ImageOptionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
Can anyone shead some light?