Skip to content

Commit

Permalink
Merge pull request #120 from tklengyel/modlist
Browse files Browse the repository at this point in the history
Don't return true in drakvuf_get_module_list if modulelist is 0
  • Loading branch information
tklengyel committed Apr 19, 2016
2 parents f4b04de + 9dd6ca1 commit 4899ada
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/libdrakvuf/win-processes.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,22 +278,28 @@ bool drakvuf_is_eprocess( drakvuf_t drakvuf, addr_t dtb, addr_t eprocess_addr )
bool drakvuf_get_module_list(drakvuf_t drakvuf, addr_t eprocess_base, addr_t *module_list) {

vmi_instance_t vmi = drakvuf->vmi;
vmi_pid_t pid;
addr_t peb, ldr, modlist;
addr_t peb=0, ldr=0, modlist=0;

access_context_t ctx = {.translate_mechanism = VMI_TM_PROCESS_DTB};

if(!eprocess_base)
return false;

if(VMI_FAILURE == vmi_read_32_va(vmi, eprocess_base + offsets[EPROCESS_PID], 0, (uint32_t*)&pid))
if(VMI_FAILURE == vmi_read_addr_va(vmi, eprocess_base + offsets[EPROCESS_PDBASE], 0, &ctx.dtb))
return false;

if(VMI_FAILURE == vmi_read_addr_va(vmi, eprocess_base + offsets[EPROCESS_PEB], 0, &peb))
return false;

if(VMI_FAILURE == vmi_read_addr_va(vmi, peb + offsets[PEB_LDR], pid, &ldr))
ctx.addr = peb + offsets[PEB_LDR];
if(VMI_FAILURE == vmi_read_addr(vmi, &ctx, &ldr))
return false;

ctx.addr = ldr + offsets[PEB_LDR_DATA_INLOADORDERMODULELIST];
if(VMI_FAILURE == vmi_read_addr(vmi, &ctx, &modlist))
return false;

if(VMI_FAILURE == vmi_read_addr_va(vmi, ldr + offsets[PEB_LDR_DATA_INLOADORDERMODULELIST], pid, &modlist))
if(!modlist)
return false;

*module_list = modlist;
Expand Down

0 comments on commit 4899ada

Please sign in to comment.