"Tim Schwartz" <[EMAIL PROTECTED]> wrote:
+int net_service(char *operation, char *service_name)
Please add 'static' since it isn't used outside of this .c file.
+{ + SC_HANDLE SCManager, serviceHandle; + int result = 0; + unsigned int *buffer_size = NULL; + char *service_display_name = NULL;
...
+ GetServiceDisplayName(SCManager, service_name, NULL, buffer_size); + if(!buffer_size)
How buffer_size is supposed to become not NULL here? Also please follow parameter types used by win32 APIs (in this case GetServiceDisplayName).
+ if(!strcasecmp(operation, "start")) + { + printf("The %s service is starting.\n", service_display_name); + result = StartService(serviceHandle,0,NULL); + CloseServiceHandle(serviceHandle); + if(!result) printf("The %s service failed to start.\n", service_display_name); + else printf("The %s service was started successfully.\n", service_display_name); + + HeapFree(GetProcessHeap(), 0, service_display_name); + return result; + }
SCManager is still leaked. And The patch is wrapped again. -- Dmitry.