Не совсем ясен вопрос. Например, вот нативное (строго говоря наполовину :) ) приложение. Инклуды из KmdKit.
.386
.model flat, stdcall
option casemap:none
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
; I N C L U D E F I L E S
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\w2k\ntdll.inc
include \masm32\include\w2k\ntddk.inc
include \masm32\include\w2k\w2kundoc.inc
include \masm32\include\w2k\ntstatus.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\w2k\ntdll.lib
include \masm32\Macros\Strings.mac
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
; R E A D O N L Y D A T A
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
.const
CTA0 " ( %08X )\n", g_szBase, 4
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
; C O D E
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
.code
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
; malloc
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
malloc proc dwBytes:DWORD
option PROLOGUE:NONE
option EPILOGUE:NONE
invoke GetProcessHeap
invoke HeapAlloc, eax, 0, [esp+4]
ret sizeof DWORD
option PROLOGUE:PROLOGUEDEF
option EPILOGUE:EPILOGUEDEF
malloc endp
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
; delete
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
free proc lpMem:PVOID
option PROLOGUE:NONE
option EPILOGUE:NONE
invoke GetProcessHeap
invoke HeapFree, eax, 0, [esp+4]
ret sizeof DWORD
option PROLOGUE:PROLOGUEDEF
option EPILOGUE:EPILOGUEDEF
free endp
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
; start
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
start proc uses esi edi ebx
;local p:DWORD
local cb:DWORD
local psmi:PSYSTEM_MODULE_INFORMATION
local dwNumModules:DWORD
local pBuffer:LPSTR
local buffer[256+100]:CHAR
invoke ZwQuerySystemInformation, SystemModuleInformation, addr cb, 0, addr cb
invoke malloc, cb
.if eax != NULL
mov psmi, eax
invoke ZwQuerySystemInformation, SystemModuleInformation, psmi, cb, addr cb
.if eax == STATUS_SUCCESS
mov esi, psmi
push dword ptr [esi]
pop dwNumModules
mov eax, dwNumModules
add eax, 16 ; ~ sizeof g_szBase + 8
shl eax, 8 ; * sizeof SYSTEM_MODULE_INFORMATION.ImageName (256)
add eax, dwNumModules ; + (one char)*dwNumModules more for sure ;-)
mov cb, eax
invoke malloc, cb
.if eax != NULL
mov pBuffer, eax
invoke memset, pBuffer, 0, cb
add esi, sizeof DWORD
assume esi:ptr SYSTEM_MODULE_INFORMATION
xor ebx, ebx
.while ebx < dwNumModules
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::
lea edi, [esi].ImageName
xor ecx, ecx
mov cx, [esi].ModuleNameOffset
add edi, ecx
; Compare case insensitive and only module name (without extension)
invoke _strnicmp, edi, $CTA0("ntoskrnl", szNtoskrnl, 4), sizeof szNtoskrnl - 1
.if eax == 0
; Found!
invoke DbgPrint, $CTA0("%s base: %08X size: %08X\n", 4), edi, \
[esi].Base, [esi]._Size
.endif
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::
lea eax, [esi].ImageName
xor ecx, ecx
mov cx, [esi].ModuleNameOffset
add eax, ecx
invoke _snprintf, addr buffer, sizeof buffer, $CTA0("%s ( %08X )\n"), \
eax, [esi].Base
invoke lstrcat, pBuffer, addr buffer
add esi, sizeof SYSTEM_MODULE_INFORMATION
inc ebx
.endw
assume esi:nothing
invoke MessageBox, NULL, pBuffer, NULL, 0
invoke free, pBuffer
.endif
.endif
invoke free, psmi
.endif
invoke ExitProcess, 0
ret
start endp
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
;
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::
end start