Using CreateProcessWithLogonW() without invoking UAC popup in Vista

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ashu.nitc@gmail.com

    Using CreateProcessWithLogonW() without invoking UAC popup in Vista

    Hi ,

    I am trying to create process using CreateProcessWi thLogonW() API.
    This works fine on Win2000 and NT, but in Vista it gives a UAC popup
    before the process (say, notepad, calc, etc) kicks off.

    This is the sample program that I am compiling on .NET

    /* START OF PROGRAM */

    #define UNICODE
    #define _WIN32_WINNT 0x0500
    #include <userenv.h>
    #include <windows.h>

    void wmain(int argc, WCHAR *argv[])
    {
    DWORD dwFlags=0;
    PROCESS_INFORMA TION pi={0};
    STARTUPINFOW si={0};
    SecureZeroMemor y(&si, sizeof(STARTUPI NFO));
    si.cb = sizeof(STARTUPI NFO);
    dwFlags = CREATE_UNICODE_ ENVIRONMENT;
    if(!CreateProce ssWithLogonW(L" administrator", L"UJMO6506-2KS-5",
    L"Test0000", LOGON_WITH_PROF ILE, NULL, argv[1], dwFlags, NULL, NULL,
    &si, &pi))
    printf("\nExecu ted CreateProcess with error code=[%d]",
    GetLastError()) ;
    else
    printf("The pid of the process=[0x%x]", pi.dwProcessId) ;
    }

    /* argv[1] is the tool that I want to run (eg: notepad) */
    /* END OF PROGRAM */

    Could someone please suggest me how to use this API so that I do not
    get the vista UAC popup?
    Disabling the UAC on the OS is not an option for me.

    Many thanks in advance,
    Ashish
  • Peter Duniho

    #2
    Re: Using CreateProcessWi thLogonW() without invoking UAC popup in Vista

    On Thu, 08 May 2008 01:29:32 -0700, <ashu.nitc@gmai l.comwrote:
    I am trying to create process using CreateProcessWi thLogonW() API.
    This works fine on Win2000 and NT, but in Vista it gives a UAC popup
    before the process (say, notepad, calc, etc) kicks off.
    What does this have to do with C#?

    I don't think you can do what you want, but given that there's nothing
    about the code you posted that suggests C# or .NET, this is really the
    wrong newsgroup to ask.

    Pete

    Comment

    Working...