WTF Windows?

If you call the API function to lookup the name of a service it expects a buffer and the size of the buffer.
If the supplied size is smaller than the service name it returns the number of characters (excluding the null-terminator) of the service name.
You can allocate a buffer for the service name and call the function again to receive the service name.

Except now Windows wants to know the size of the buffer including null terminators.

That took me a moment to figure out.

Add Comment