CloseHandle(service_handle);\r
CloseServiceHandle(services);\r
\r
+ if (error == ERROR_IO_PENDING) {\r
+ /*\r
+ Older versions of Windows return immediately with ERROR_IO_PENDING\r
+ indicate that the operation is still in progress. Newer versions\r
+ will return it if there really is a delay. As far as we're\r
+ concerned the operation is a success. We don't claim to offer a\r
+ fully-feature service control method; it's just a quick 'n' dirty\r
+ interface.\r
+\r
+ In the future we may identify and handle this situation properly.\r
+ */\r
+ ret = 1;\r
+ error = ERROR_SUCCESS;\r
+ }\r
+\r
if (ret) {\r
_tprintf(_T("%s: %s"), canonical_name, error_string(error));\r
return 0;\r
CloseHandle(service_handle);\r
CloseServiceHandle(services);\r
\r
+ if (error == ERROR_IO_PENDING) {\r
+ ret = 1;\r
+ error = ERROR_SUCCESS;\r
+ }\r
+\r
if (ret) {\r
_tprintf(_T("%s: %s"), canonical_name, error_string(error));\r
return 0;\r