Rolf Kalbermatter [mailto:r.kalbermatter@hccnet.nl]
- GetServiceDisplayName(SCManager, service_name, NULL, buffer_size);
- if(!buffer_size)
- {
Apart from GetServiceDisplayName() currently not being implemented in Wine,
this won't work!
*buffer_size won't be allocated by the function but has to be provided by
the caller and its
pointer shouldn't be NULL ever. It should and proabably will just return
with an error if it
is a NULL pointer.
I actually just tested this and no it does not return an error in that case but simply crashes on Windows XP SP2. As do apparantly many other service functions that take such a parameter.
service_display_name = HeapAlloc(GetProcessHeap(), 0,
strlen(service_name));
strcpy(service_display_name, service_name);
- }
- else
- {
service_display_name = HeapAlloc(GetProcessHeap(), 0,
*buffer_size);
MSDN says: When the function returns, lpcchBuffer contains the size of the
service's display
name, excluding the null-terminating character, so your buffer is in fact
one character to small.
MSDN is quite unclear here. On XP SP2 the function returns this size when the buffer was NULL or the input size was to small. Otherwise it seems to leave this parameter alone!
Seems we should start to add some tests for service functions too. This however would probably require a dummy service that can be installed for testing and removed afterwards. Are there any administrator right limitations to installing services in Wine?
Rolf Kalbermatter