On Thursday, 13 July 2017 at 01:15:46 UTC, FoxyBrown wrote:
ENUM_SERVICE_STATUS_PROCESS[5000] services;
auto res = SVC.EnumServicesStatusExA(schSCManager,
SC_ENUM_TYPE.SC_ENUM_PROCESS_INFO, servicesType,
SERVICE_STATE_ALL, cast(ubyte*)services.ptr,
5000*ENUM_SERVICE_STATUS_PROCESS.sizeof, &dwBytesNeeded,
&dwCount, &resume, cast(const(char)*)null);
You need to call EnumServicesStatusEx twice - the first time to
get the required size of the buffer. See the docs for the
lpServices parameter here
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682640(v=vs.85).aspx
Then allocate a buffer using the returned dwBytesNeeded and call
the function again with your buffer and its size.