http://blog.csdn.net/hgy413/article/details/7786530
The IAT of the original ntos can only be obtained through Image_directory_entry_iat (12), because the init mode is loaded after the ntos is loaded, so image_directory_entry_import corresponding area is released!
Hang on, Dad.
Can be used WinDbg very intuitive to see:
X86:x64: The other IAT traversal codes are as follows:
[CPP]View Plaincopy
- NTSTATUS enumiattable (ulong_ptr pbase)
- {
- Pimage_dos_header PDos = (pimage_dos_header) pbase;
- Pimage_nt_headers pNt = NULL;
- Pimage_import_descriptor pimport = NULL;
- Pimage_thunk_data pthunk = NULL;
- if (NULL = = PDos
- || Image_dos_signature! = pdos->e_magic)
- {
- return Status_invalid_image_format;
- }
- PNt = (pimage_nt_headers) ((Puchar) pbase+pdos->e_lfanew);
- if (image_nt_signature! = pnt->signature)
- {
- return Status_invalid_image_format;
- }
- Pimport = (pimage_import_descriptor) ((Puchar) pbase+pnt->optionalheader.datadirectory[image_directory_ Entry_import]. virtualaddress);
- //Enumerate print
- While (NULL!=pimport
- && Mmisaddressvalid (Pimport)
- &&pimport->name! = 0)
- {
- Pthunk = (Pimage_thunk_data) ((Puchar) pbase+pimport->firstthunk);
- While (NULL! = Pthunk
- && Mmisaddressvalid (Pthunk)
- && pthunk->u1. Function! = 0)
- {
- Kdprint ("[Enumiattable]-import module:%s-function:%p\r\n", (Puchar) Pbase+pimport->name, PTHUNK->U1 . Function));
- pthunk++;
- }
- pimport++;
- }
- return status_success;
- }
ring0-Traversal IAT (special case Ntos)