lstMain.FontName = "Courier New" lstMain.FontSize = 9 ' Get process handle from process ID hProcess = ProcHndFromProcID(lProcessID) If hProcess = 0 Then Stop lstMain.Clear ' Set tab stops for list box Tabstops(1) = 4 * 22 Tabstops(2) = Tabstops(1) + 4 * 10 Tabstops(3) = Tabstops(2) + 4 * 10 Tabstops(4) = Tabstops(3) + 4 * 12 SendMessage lstMain.hWnd, LB_SETTABSTOPS, 5, Tabstops(1) Do ' Get info on this region lret = VirtualQueryEx(hProcess, lCurRegion, meminfo, LenB(meminfo)) ' Is it free? bIsFree = (meminfo.State = MEM_FREE) ' Build item for list box sItem = Hex(lCurRegion) & " - " & Hex(lCurRegion + meminfo.RegionSize - 1) _ & vbTab & meminfo.RegionSize / 4096 & " pp" _ & vbTab & MemType(meminfo.State) If Not bIsFree Then sItem = sItem & vbTab & MemType(meminfo.Type) _ m302 1 & vbTab & AccessType(meminfo.Protect) End If ' Get module name. Skip 0, since this gives EXE name. If lCurRegion > 0 And Not bIsFree Then sName = String$(MAX_PATH + 1, 0) lret = GetModuleFileName(lCurRegion, sName, MAX_PATH) If lret <> 0 Then sItem = sItem & vbTab & Trim0 (sName) End If ' Display lstMain.AddItem sItem ' Next start of region lCurRegion = lCurRegion + meminfo.RegionSize If lCurRegion >= &H7FFEFFFF Then Exit Do Loop CloseHandle hProcess End Sub |