Friday, February 27, 2009

Using pageheap.exe

I used pageheap today and it actually did what they told me it would do. Awesome! Why does MS have so many awesome tools that they don't tell us about and are rather arcane to find documentation on. Oh well.
How you use it :

1. Install Debugging tools for Windows. Add it to your path. It'll make your life a WHOLE LOT easier.
2. Type gflags.exe /p /enable yourapp.exe /debug WinDbg.exe
3. Run your app.
4. When youre done make sure to disable it  gflags.exe /p /disable yourapp.exe
5. You can check to see what you have page heap enabled by just typing  gflags.exe /p


Sharad Agrawal said...

I followed the all the step you write.
Where it will create the report of heap-related corruption.

James Chan said...

It doesn't create a report, it'll just cause a crash. You'll still have to use a debugger to find out where it's crashing and why.

ImmortalMan said...

You said pageheap.exe but you tell how to use gflags.exe. What is the point?

James Chan said...

pageheap.exe is the process that actually validates and finds page heap corruptions.

But you have to use gflags.exe to tell windows that you want to use pageheap either for the entire system or the applications that you want it to validate.