X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=board%2FMAI%2Fbios_emulator%2Fscitech%2Fsrc%2Fpm%2Fwin32%2Fntservc.c;h=59d9aa0c7c7bdfc9ba917e20bd3cca1bbe24f45d;hb=3ba4c2d68f6541db4677b4aea12071f56e6ff6e6;hp=a3324d33b84e1aa604129b485befa733e55d98a7;hpb=c7de829c796978e519984df2f1c8cfcf921a39a4;p=platform%2Fkernel%2Fu-boot.git diff --git a/board/MAI/bios_emulator/scitech/src/pm/win32/ntservc.c b/board/MAI/bios_emulator/scitech/src/pm/win32/ntservc.c index a3324d3..59d9aa0 100644 --- a/board/MAI/bios_emulator/scitech/src/pm/win32/ntservc.c +++ b/board/MAI/bios_emulator/scitech/src/pm/win32/ntservc.c @@ -64,63 +64,63 @@ ulong PMAPI PM_installService( char keyPath[MAX_PATH]; ulong status; - // Obtain a handle to the service control manager requesting all access + /* Obtain a handle to the service control manager requesting all access */ if ((scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == NULL) - return GetLastError(); + return GetLastError(); - // Find the path to the driver in system directory + /* Find the path to the driver in system directory */ GetSystemDirectory(szDriverPath, sizeof(szDriverPath)); strcat(szDriverPath, "\\drivers\\"); strcat(szDriverPath, szDriverName); - // Create the service with the Service Control Manager. + /* Create the service with the Service Control Manager. */ driverHandle = CreateService(scmHandle, - szServiceName, - szServiceName, - SERVICE_ALL_ACCESS, - dwServiceType, - SERVICE_BOOT_START, - SERVICE_ERROR_NORMAL, - szDriverPath, - szLoadGroup, - NULL, - NULL, - NULL, - NULL); - - // Check to see if the driver could actually be installed. + szServiceName, + szServiceName, + SERVICE_ALL_ACCESS, + dwServiceType, + SERVICE_BOOT_START, + SERVICE_ERROR_NORMAL, + szDriverPath, + szLoadGroup, + NULL, + NULL, + NULL, + NULL); + + /* Check to see if the driver could actually be installed. */ if (!driverHandle) { - status = GetLastError(); - CloseServiceHandle(scmHandle); - return status; - } + status = GetLastError(); + CloseServiceHandle(scmHandle); + return status; + } - // Get a handle to the key for driver so that it can be altered in the - // next step. + /* Get a handle to the key for driver so that it can be altered in the */ + /* next step. */ strcpy(keyPath, "SYSTEM\\CurrentControlSet\\Services\\"); strcat(keyPath, szServiceName); if ((status = RegOpenKeyEx(HKEY_LOCAL_MACHINE,keyPath,0,KEY_ALL_ACCESS,&key)) != ERROR_SUCCESS) { - // A problem has occured. Delete the service so that it is not installed. - status = GetLastError(); - DeleteService(driverHandle); - CloseServiceHandle(driverHandle); - CloseServiceHandle(scmHandle); - return status; - } - - // Delete the ImagePath value in the newly created key so that the - // system looks for the driver in the normal location. + /* A problem has occured. Delete the service so that it is not installed. */ + status = GetLastError(); + DeleteService(driverHandle); + CloseServiceHandle(driverHandle); + CloseServiceHandle(scmHandle); + return status; + } + + /* Delete the ImagePath value in the newly created key so that the */ + /* system looks for the driver in the normal location. */ if ((status = RegDeleteValue(key, "ImagePath")) != ERROR_SUCCESS) { - // A problem has occurred. Delete the service so that it is not - // installed and will not try to start. - RegCloseKey(key); - DeleteService(driverHandle); - CloseServiceHandle(driverHandle); - CloseServiceHandle(scmHandle); - return status; - } - - // Clean up and exit + /* A problem has occurred. Delete the service so that it is not */ + /* installed and will not try to start. */ + RegCloseKey(key); + DeleteService(driverHandle); + CloseServiceHandle(driverHandle); + CloseServiceHandle(scmHandle); + return status; + } + + /* Clean up and exit */ RegCloseKey(key); CloseServiceHandle(driverHandle); CloseServiceHandle(scmHandle); @@ -145,32 +145,32 @@ ulong PMAPI PM_startService( SERVICE_STATUS serviceStatus; ulong status; - // Obtain a handle to the service control manager requesting all access + /* Obtain a handle to the service control manager requesting all access */ if ((scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == NULL) - return GetLastError(); + return GetLastError(); - // Open the service with the Service Control Manager. + /* Open the service with the Service Control Manager. */ if ((driverHandle = OpenService(scmHandle,szServiceName,SERVICE_ALL_ACCESS)) == NULL) { - status = GetLastError(); - CloseServiceHandle(scmHandle); - return status; - } + status = GetLastError(); + CloseServiceHandle(scmHandle); + return status; + } - // Start the service + /* Start the service */ if (!StartService(driverHandle,0,NULL)) { - status = GetLastError(); - CloseServiceHandle(driverHandle); - CloseServiceHandle(scmHandle); - return status; - } - - // Query the service to make sure it is there - if (!QueryServiceStatus(driverHandle,&serviceStatus)) { - status = GetLastError(); - CloseServiceHandle(driverHandle); - CloseServiceHandle(scmHandle); - return status; - } + status = GetLastError(); + CloseServiceHandle(driverHandle); + CloseServiceHandle(scmHandle); + return status; + } + + /* Query the service to make sure it is there */ + if (!QueryServiceStatus(driverHandle,&serviceStatus)) { + status = GetLastError(); + CloseServiceHandle(driverHandle); + CloseServiceHandle(scmHandle); + return status; + } CloseServiceHandle(driverHandle); CloseServiceHandle(scmHandle); return ERROR_SUCCESS; @@ -194,24 +194,24 @@ ulong PMAPI PM_stopService( SERVICE_STATUS serviceStatus; ulong status; - // Obtain a handle to the service control manager requesting all access + /* Obtain a handle to the service control manager requesting all access */ if ((scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == NULL) - return GetLastError(); + return GetLastError(); - // Open the service with the Service Control Manager. + /* Open the service with the Service Control Manager. */ if ((driverHandle = OpenService(scmHandle,szServiceName,SERVICE_ALL_ACCESS)) == NULL) { - status = GetLastError(); - CloseServiceHandle(scmHandle); - return status; - } + status = GetLastError(); + CloseServiceHandle(scmHandle); + return status; + } - // Stop the service from running + /* Stop the service from running */ if (!ControlService(driverHandle, SERVICE_CONTROL_STOP, &serviceStatus)) { - status = GetLastError(); - CloseServiceHandle(driverHandle); - CloseServiceHandle(scmHandle); - return status; - } + status = GetLastError(); + CloseServiceHandle(driverHandle); + CloseServiceHandle(scmHandle); + return status; + } CloseServiceHandle(driverHandle); CloseServiceHandle(scmHandle); return ERROR_SUCCESS; @@ -234,26 +234,25 @@ ulong PMAPI PM_removeService( SC_HANDLE driverHandle; ulong status; - // Obtain a handle to the service control manager requesting all access + /* Obtain a handle to the service control manager requesting all access */ if ((scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) == NULL) - return GetLastError(); + return GetLastError(); - // Open the service with the Service Control Manager. + /* Open the service with the Service Control Manager. */ if ((driverHandle = OpenService(scmHandle,szServiceName,SERVICE_ALL_ACCESS)) == NULL) { - status = GetLastError(); - CloseServiceHandle(scmHandle); - return status; - } + status = GetLastError(); + CloseServiceHandle(scmHandle); + return status; + } - // Remove the service + /* Remove the service */ if (!DeleteService(driverHandle)) { - status = GetLastError(); - CloseServiceHandle(driverHandle); - CloseServiceHandle(scmHandle); - return status; - } + status = GetLastError(); + CloseServiceHandle(driverHandle); + CloseServiceHandle(scmHandle); + return status; + } CloseServiceHandle(driverHandle); CloseServiceHandle(scmHandle); return ERROR_SUCCESS; } -