Okay this will find the hidden process when it's hidden with End7 method.
It's a quick hack off some old hook stuff, but it works.
It don't show all the process but it show hidden one's with End7 method.
ill' try to make a better one that show all the process and modules, but need to dig out some sources first.. hmm.. :roll:
Code: Select all
EnableExplicit
Prototype.l PFNCreateToolhelp32Snapshot(dwFlags.l, th32ProcessID.l)
Prototype.b PFNProcess32First(hSnapshot.l, *lppe.PROCESSENTRY32)
Prototype.b PFNProcess32Next(hSnapshot.l, *lppe.PROCESSENTRY32)
Prototype.l PTHREAD_START_ROUTINE(lpThreadParameter.l)
Prototype.l PFNENUMPROCESSMODULES(hProcess.l, *lphModule.l, cb.l, lpcbNeeded.l)
Prototype.l PFNGETMODULEFILENAMEEXA(hProcess.l, hModule.l, lpFilename.l, nSize.l)
Procedure GetPidByName(name.s)
Protected hDLL.l, process_name.s
Protected PEntry.PROCESSENTRY32, hTool32.l
Protected pCreateToolhelp32Snapshot.PFNCreateToolhelp32Snapshot
Protected pProcess32First.PFNProcess32First
Protected pProcess32Next.PFNProcess32Next
Protected pid.l
hDLL = OpenLibrary(#PB_Any,"kernel32.dll")
If hDLL
pCreateToolhelp32Snapshot = GetFunction(hDLL,"CreateToolhelp32Snapshot")
pProcess32First = GetFunction(hDLL,"Process32First")
pProcess32Next = GetFunction(hDLL,"Process32Next")
Else
ProcedureReturn 0
EndIf
PEntry\dwSize = SizeOf(PROCESSENTRY32)
hTool32 = pCreateToolhelp32Snapshot(#TH32CS_SNAPPROCESS, 0)
pProcess32First(hTool32, @PEntry)
process_name = Space(#MAX_PATH)
CopyMemory(@PEntry\szExeFile,@process_name,#MAX_PATH)
If UCase(process_name) = UCase(name)
ProcedureReturn PEntry\th32ProcessID
EndIf
While pProcess32Next(hTool32, @PEntry) > 0
process_name = Space(#MAX_PATH)
CopyMemory(@PEntry\szExeFile,@process_name,#MAX_PATH)
If UCase(process_name) = UCase(name)
ProcedureReturn PEntry\th32ProcessID
EndIf
Wend
CloseLibrary(hDLL)
ProcedureReturn 0
EndProcedure
; We will require this function To get a module handle of our
; original module
Procedure EnumModules()
Protected Dim hMods.l(1024)
Protected cbNeeded.l, i.l, hProcess.l, m_hModPSAPI.l, loopcnt.l
Protected m_pfnEnumProcessModules.PFNENUMPROCESSMODULES,m_pfnGetModuleFileNameExA.PFNGETMODULEFILENAMEEXA
Protected szModName.s,pid.l,szLibFile.s,Hidden.l
For pid = 0 To 4096 Step 4
hProcess = OpenProcess_(#PROCESS_ALL_ACCESS, #False, pid)
If hProcess ;= #Null
m_hModPSAPI = OpenLibrary(#PB_Any,"PSAPI.DLL")
If m_hModPSAPI
m_pfnEnumProcessModules = GetFunction(m_hModPSAPI, "EnumProcessModules")
m_pfnGetModuleFileNameExA = GetFunction(m_hModPSAPI, "GetModuleFileNameExA")
; 1024 * 4 = SizeOf(hMods)
If m_pfnEnumProcessModules(hProcess, hMods(), 1024*4, @cbNeeded) > 0
loopcnt = (cbNeeded / SizeOf(Long)) - 1 ; HMODULE = Long ? or a pointer ?
For i = 0 To loopcnt
szModName = Space(#MAX_PATH)
; Get the full path To the module's file.
If m_pfnGetModuleFileNameExA( hProcess, hMods(i), @szModName, Len(szModName)) > 0
If UCase(GetExtensionPart(szModName))="EXE"
If GetPidByName(GetFilePart(szModName))
; ** NORMAL PROCESS
;==================
Debug "======="
Debug szModName
Debug " pid " +Str(pid)
Debug"module count "+Str(loopcnt)
Debug "Normal Process!"
Debug "======="
Debug " "
Else
; ** HIDDEN PROCESS
;==================
Debug "* * * * * * * * * * * * * * * * * * * * * * * * * *"
Debug " "
Debug "HIDDEN PROCESS!"
Debug " "
Debug szModName
Debug " pid " +Str(pid)
Debug"module count "+Str(loopcnt)
Debug " "
Debug "** This Process! is Hidden **"
Debug " "
Debug "* * * * * * * * * * * * * * * * * * * * * * * * * *"
Debug " "
EndIf
EndIf
If szModName = szLibFile
CloseLibrary(m_hModPSAPI)
EndIf
EndIf
Next i
Else
; Hmm Dont' know what this is ?
; Debug "------"
; Debug "unknown Process" + " pid " +Str(pid)
;
; Debug "------"
; Debug " "
EndIf
Else
PrintN("Error loading PSAPI.DLL")
ProcedureReturn 0
EndIf
EndIf
If hProcess <> #Null
CloseHandle_(hProcess)
EndIf
Next
ProcedureReturn 0
EndProcedure
EnumModules()
Best Henrik