VirtualBox

Changeset 25959 in vbox


Ignore:
Timestamp:
Jan 21, 2010 2:02:36 PM (15 years ago)
Author:
vboxsync
Message:

VBoxService: Also set service description on new install, not only on update.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp

    r25796 r25959  
    135135
    136136    return SetServiceStatus(g_hWinServiceStatus, &ss);
     137}
     138
     139
     140int VBoxServiceWinSetDesc(SC_HANDLE hService)
     141{
     142    /* On W2K+ there's ChangeServiceConfig2() which lets us set some fields
     143       like a longer service description. */
     144#ifndef TARGET_NT4
     145    SERVICE_DESCRIPTION desc;
     146    /** @todo On Vista+ SERVICE_DESCRIPTION also supports localized strings! */
     147    desc. lpDescription = VBOXSERVICE_DESCRIPTION;
     148    if (FALSE == ChangeServiceConfig2(hService,
     149                                      SERVICE_CONFIG_DESCRIPTION, /* Service info level */ 
     150                                      &desc))
     151    {
     152        VBoxServiceError("Cannot set the service description! Error: %ld\n", GetLastError());
     153        return 1;
     154    }
     155#endif
     156    return VINF_SUCCESS;
    137157}
    138158
     
    192212                                         VBOXSERVICE_FRIENDLY_NAME))
    193213                {
    194                     /* On W2K+ there's ChangeServiceConfig2() which lets us set some fields
    195                        like a longer service description. */
    196                     #ifndef TARGET_NT4
    197                         SERVICE_DESCRIPTION desc;
    198                         /** @todo On Vista+ SERVICE_DESCRIPTION also supports localized strings! */
    199                         desc. lpDescription = VBOXSERVICE_DESCRIPTION;
    200                         if (FALSE == ChangeServiceConfig2(hService,
    201                                                              SERVICE_CONFIG_DESCRIPTION, /* Service info level */ 
    202                                                              &desc))
    203                         {
    204                             VBoxServiceError("Cannot set the service description! Error: %ld\n", GetLastError());
    205                         }
    206                     #endif
    207 
    208214                    VBoxServiceVerbose(1, "The service config has been successfully updated.\n");
    209215                }
     
    227233        VBoxServiceVerbose(0, "Service successfully installed!\n");
    228234    }
     235
     236    if (RT_SUCCESS(rc))
     237        rc = VBoxServiceWinSetDesc(hService);
    229238
    230239    CloseServiceHandle(hService);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette