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
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
Comment