Skip to content

Commit

Permalink
minor update: GetCurrentThreadSystemID & GetProcessIdsByIndex (#16)
Browse files Browse the repository at this point in the history
Implementation of additional APIs
  • Loading branch information
d-millar authored Feb 23, 2024
1 parent e58cad3 commit 50cac40
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pybag/dbgeng/idebugsystemobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def GetThreadIdByTeb(self):
raise exception.E_NOTIMPL_Error

def GetCurrentThreadSystemId(self):
raise exception.E_NOTIMPL_Error
sysid = c_ulong()
hr = self._sys.GetCurrentThreadSystemId(byref(sysid))
exception.check_err(hr)
return sysid.value

def GetThreadIdBySystemId(self):
raise exception.E_NOTIMPL_Error
Expand All @@ -107,8 +110,14 @@ def GetNumberProcesses(self):
exception.check_err(hr)
return number.value

def GetProcessIdsByIndex(self):
raise exception.E_NOTIMPL_Error
def GetProcessIdsByIndex(self, count=0):
if count == 0:
count = self.GetNumberProcesses()
ids = (c_ulong * count)()
sysids = (c_ulong * count)()
hr = self._sys.GetProcessIdsByIndex(0, count, ids, sysids)
exception.check_err(hr)
return (tuple(ids), tuple(sysids))

def GetCurrentProcessDataOffset(self):
offset = c_ulonglong()
Expand Down

0 comments on commit 50cac40

Please sign in to comment.