TIP: Click on subject to list as thread! ANSI
echo: win32
to: ALL
from: `Todd Osborne`
date: 1997-11-21 00:00:00
subject: CreateProcessAsUser() problem

From: "Todd Osborne" 
Subject: CreateProcessAsUser() problem
Date: 1997/11/21
Message-ID: #1/1
Organization: Little and Associates
Newsgroups: fido.win32


I am having a problem calling CreateProcessAsUser(). It is returning an
error that say "Client does not have valid rights....". My program is a DLL
that is running in the context of Microsoft Internet Information Server,
which is a service. I have created an account call ACAD_WORKSTATION and
granted ALL rights to it for testing, even all the advanced rights. This is
all on NT 4.0 Workstation.
I am trying to launch AutoCAD, which is a full blown GUI application. I want
it to be created in a non-visible windowstation so that users cannot see it.
Here is the code that I have so far. The call to Logon() user works fine,
but CreateProcessAsUser() fails with the error message. Any help is greatly
appreciated as are reponses in email to todd.osborne@poboxes.com, as I
sometimes have problems getting to usenet. Thanks.
    // We need to logon the AutoCAD workstation account
    HANDLE hToken;
    if ( LogonUser("ACAD_WORKSTATION", NULL, "password",
LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &hToken) )
    {
     SetLastError(0);
     for ( DWORD i = 0; i < dwCount; i++ )
     {
      STARTUPINFO   si;
      PROCESS_INFORMATION pi;
      // Initialize structs
      memset(&si, 0, sizeof(si));
      si.cb =   sizeof(si);
      si.lpDesktop = "";
    // lpszBuffer is a valid full path to AutoCAD (ACAD.EXE)
    if ( CreateProcessAsUser( hToken,  // Logged On User Token
             NULL,  // Application Name
             lpszBuffer, // Command Line
             NULL,  // Process Security Attributes
             NULL,  // Thread  Security Attributes
             FALSE,  // Inherit Handles
             CREATE_DEFAULT_ERROR_MODE | NORMAL_PRIORITY_CLASS,
             NULL,  // Enviroment
             NULL,  // Current Directory
             &si,  // Startup Info
             &pi)  // Process Info
       )
      {
       ODS("AutoCAD Started");
       nNumberStarted++;
      }
      else
      {
       CAFM_SharedODSLastError(lpszBuffer, NULL);
       break;
      }
     }
     // We can free the token now that process may have been started
     CloseHandle(hToken);
    }

SOURCE: echoes via archive.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.