Re: Whats the correct way to pass a D array type to a win32 api function wanting a buffer?

2017-07-13 Thread John Chapman via Digitalmars-d-learn
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,

Re: Whats the correct way to pass a D array type to a win32 api function wanting a buffer?

2017-07-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 13 July 2017 at 01:15:46 UTC, FoxyBrown wrote: auto EnumServices() I wouldn't use auto here. The reason you get mismatch types on return here since you don't return consistent types inside. ENUM_SERVICE_STATUS_PROCESS[5000] services; Are you sure you are getting the

Re: Whats the correct way to pass a D array type to a win32 api function wanting a buffer?

2017-07-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 13 July 2017 at 01:15:46 UTC, FoxyBrown wrote: Everything I do results in some problem, I've tried malloc but then converting the strings resulted in my program becoming corrupted. Heres the code: auto EnumServices() { auto schSCManager = OpenSCManager(null, null,

Whats the correct way to pass a D array type to a win32 api function wanting a buffer?

2017-07-12 Thread FoxyBrown via Digitalmars-d-learn
Everything I do results in some problem, I've tried malloc but then converting the strings resulted in my program becoming corrupted. Heres the code: auto EnumServices() { auto schSCManager = OpenSCManager(null, null, SC_MANAGER_ALL_ACCESS); if (NULL == schSCManager) {