![]() ![]() Depending on the actual value in question, the exception is quite likely to be caused by writing to the non-existent buffer, and the function doesn't get a chance to return an error code. However EnumServicesStatus cannot know this, and will blindly do what you told it. You have told it there are 1024 bytes of allocated memory starting at the value in lpServices, but you have not actually allocated any such memory, nor even set lpServices to point to a known location. Afterward, if the function succeeds, that block will contain a bunch of data in the format of ENUM_SERVICE_STATUS structures.įrom the API's perspective, the crucial part you are missing is the allocation of that buffer. " That is documentation-speak telling you to allocate a block of memory and pass its address. Per MSDN's entry on EnumServicesStatus, it's "A pointer to a buffer that contains an array of ENUM_SERVICE_STATUS structures that receive. Function prototyping is one of the very useful features in C++ as it enables the compiler to perform more powerful checking. ![]() ![]() It also tells about the number and type of arguments of the function. The core problem here is likely due to how you prepare and pass the lpServices parameter. A function prototype is basically a declaration of the function that tells the program about the type of the value which is to be returned by the function.
0 Comments
Leave a Reply. |