RE: CreateService( ... , user@domain, password) : 0x54b error

From: Jacques Le*** (anonymous_at_discussions.microsoft.com)
Date: 05/10/04

  • Next message: Amit Rahul [MS]: "Re: Logon user"
    Date: Mon, 10 May 2004 00:51:05 -0700
    
    

         
         ----- Rhett Gong [MSFT] wrote: -----
         
         Hi Jacques,
         From your description, you can not create/remove the service when using the
         UPN name format.(user@DNS_domain_name) But you can do that in a few days
         ago.
         
    Yes. And I can also this morning !!!

         Before we go, could you post a code snippet on how you used create/remove
         the service? And please point out the place where the error occurs. Thanks.

    The Windows Service management part of my application uses Microsoft sample code
    found in old MSDN. The creation of the Service associated to my application is done using:

            _tprintf(TEXT("Installing %s Service as domain user %s ...\n"), szPath, adminUser);

            schService = CreateService(
                schSCManager, // SCManager database
                TEXT(MY_SERVICE_NAME), // name of service
                TEXT(MY_SERVICE_LABEL), // name to display
                SERVICE_ALL_ACCESS, // desired access
                SERVICE_WIN32_OWN_PROCESS, // service type
                MY_SERVICE_START_TYPE, // start type
                SERVICE_ERROR_NORMAL, // error control type
                szQuotedPath, // service's binary
                NULL, // no load ordering group
                NULL, // no tag identifier
                TEXT(MY_SERVICE_DEPENDENCIES), // dependencies
                adminUser, // LocalSystem account
                adminPwd); // no password

            free(adminUser);

            if ( schService )
            {
                SERVICE_DESCRIPTION scDescription;
                scDescription.lpDescription = MY_SERVICE_DESCRIPTION;

                _tprintf(TEXT("%s installed.\n"), TEXT(MY_SERVICE_NAME) );
                ChangeServiceConfig2(
                    schService,
                    SERVICE_CONFIG_DESCRIPTION,
                    (LPVOID) &scDescription
                );

                CloseServiceHandle(schService);
            }
            else
            {
                _tprintf(TEXT("CreateService failed - %s\n"), GetLastErrorText(szErr, 256));
            }

            CloseServiceHandle(schSCManager);

    where adminUser is either a UPN (user@domain) or a SAM Account name (DOMAIN\user).
    My problem was that I could not install the service with UPN but now it works (and I swear
    I did not modify anything over the week-end ;-).

    One of our customer also encountered the problem when installing the Service on the
    ADS domain controler itself (even though he logged in as a domain Administrator, meaning winlogon could
    resolve the UPN).

         Have a nice day!
         
         Rhett Gong [MSFT]
         Microsoft Online Partner Support
         
         This posting is provided "AS IS" with no warranties, and confers no rights.
         Please reply to newsgroups only. Thanks.
         
         


  • Next message: Amit Rahul [MS]: "Re: Logon user"
  • Quantcast