In actual work, a Windows service needs to be written to achieve distributed call charging control functions. Of course, this project is done by the occasion. After the development of the two weeks, the development is finally made! After multiple tests - repair - registration defects - after the test, everything is OK!
Haha ............ :)
I am happy, inadvertently discovered in the Windows service browser, how is my service PP (referring to service description) is empty! :( This thing is the key Dongdong, but also the company's image problem, let alone whether it is not good to look, is it? Haha. The following work is to browse the package company is genuine version of Microsoft MSDN, it is hard to find it. Method for modifying the intercourse. Let me talk about the sound "Goodbye", because the following code shows that the article will be ended, hehe.
Method: ChangeServiceConfig2 function, the specific implementation is as follows:
void ReconfigureService (LPSTR lpServiceName, LPSTR lpDesc) {SC_HANDLE schSCManager = :: OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS); if (! schSCManager = NULL) {// Need to acquire database lock before reconfiguring SC_LOCK sclLock = LockServiceDatabase (schSCManager).; if (! sclLock = NULL) {// Open a handle to the service SC_HANDLE schService = OpenService (schSCManager, // SCManager database lpServiceName, // name of service SERVICE_CHANGE_CONFIG);. // need CHANGE access if (! schService = NULL) {SERVICE_DESCRIPTION sdBuf; sdBuf.lpDescription = lpDesc; if (ChangeServiceConfig2 (schService, SERVICE_CONFIG_DESCRIPTION, & sdBuf)) {// MessageBox (NULL, "Change SUCCESS", "", MB_SERVICE_NOTIFICATION);} CloseServiceHandle (schService);} UnlockServiceDatabase (sclLock) } ClosESERVICEHANDLE (SC Hscmanager);}}