WTF is going on! Corrupt value that is never assigned
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 13 14:39:31 PDT 2017
On 07/13/2017 08:22 PM, FoxyBrown wrote:
> res = EnumServicesStatusExW(schSCManager,
> SC_ENUM_TYPE.SC_ENUM_PROCESS_INFO, servicesType, SERVICE_STATE_ALL,
> cast(ubyte*)buf, 50000, &dwBytesNeeded, &dwCount, &resume,
> cast(const(char)*)null);
The cast to `char*` here looks odd. The 'W' suffix in the function name
indicates that it's the UTF-16 variant. It should be taking a `wchar*`,
not of a `char*`. This might hint at a wrong declaration which could
lead to memory corruption.
(The cast shouldn't be necessary anyway. `null` converts to all pointer
types.)
More information about the Digitalmars-d-learn
mailing list