Hi ,

I am trying to create process using CreateProcessWithLogonW() 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_INFORMATION pi={0};
STARTUPINFOW si={0};
SecureZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
dwFlags = CREATE_UNICODE_ENVIRONMENT;
if(!CreateProcessWithLogonW(L"administrator", L"UJMO6506-2KS-5",
L"Test0000", LOGON_WITH_PROFILE, NULL, argv[1], dwFlags, NULL, NULL,
&si, &pi))
printf("\nExecuted 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

Re: Using CreateProcessWithLogonW() without invoking UAC popup in Vista by Peter

Peter
Thu May 08 13:15:08 CDT 2008

On Thu, 08 May 2008 01:29:32 -0700, <ashu.nitc@gmail.com> wrote:

> I am trying to create process using CreateProcessWithLogonW() 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