Got another question:

About Memory Management in EnumServicesStatusEx().

What's the best way to capture the amount of memory needed from the first call to EnumServicesStatusEx() (where the 5th and 6th arguments are NULL and 0 respectively)?

How should I allocate that memory to get around the if(GetLastError() == ERROR_MORE_DATA) scenario?

How can I safely and reliably free that allocated memory when I'm done parsing the Process struct and want to discard it?