Alternative Ways to Get Process HeapsteemCreated with Sketch.

in Computer Programming3 years ago (edited)

processheap.png

Dtube Video Link

#include <Windows.h>
#include <winternl.h>

inline PPEB NtCurrentPeb() { return NtCurrentTeb()->ProcessEnvironmentBlock; }

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{
    //Method 1
    HANDLE procHeap1 = GetProcessHeap();

    // Method 2
    PVOID procParamAddr = &(NtCurrentPeb()->ProcessParameters);
    HANDLE procHeap2= *(PVOID*)((PUCHAR)procParamAddr + sizeof(PVOID) * 2); 

    return 0; 
}

Please Vote this post if you like it.
Please Follow me if you like my posts.
If you have any questions about this post, ask in comments.
Follow me on :
DTube
Hive