Hi NG
Can somebody please help with the VC++6 implemetation of
CreateProcessWithLogonW. The declaration in my copy of MSDN and the one on
the web are different. I would assume that the one on the web is the
updated one as my copy states that it is preliminary documentation.
According to online MSDN:
Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Unicode: Implemented only as Unicode.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Advapi32.lib.
I searched my drives for Advapi32.lib, winbase.h and windows.h, and found
the following:
Path: C:\Program Files\Microsoft Visual Studio\VC98\Lib
File: Advapi32.lib --> __imp__CreateProcessWithLogonW@40
Path: C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Lib
File: Advapi32.lib --> __imp__CreateProcessWithLogonW@44
// I ASSUME THE 2 DIFFERENT DECLARATIONS ARE DUE TO THE OLD AND NEW VERSIONS
OF THE CALL
Path: C:\Program Files\Microsoft Visual Studio\VC98\Include
File: Windows.h --> No declaration for CreateProcessWithLogonW
File: Winbase.h --> No declaration for CreateProcessWithLogonW
Path: C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include
File: Windows.h --> No declaration for CreateProcessWithLogonW
File: Winbase.h --> The declaration exists. See end of mail
I have tried the following, but all 4 cases give me the same errors:
Compiling...
SetupHelper.cpp
D:\Test\SetupHelper\C++\SetupHelper\SetupHelper.cpp(65) : error C2065:
'CreateProcessWithLogonW' : undeclared identifier
D:\Test\SetupHelper\C++\SetupHelper\SetupHelper.cpp(66) : error C2065:
'LOGON_WITH_PROFILE' : undeclared identifier
Error executing cl.exe.
==================
// ALL CASES
#include <stdlib.h>
#include <windows.h>
==================
// TRY #1
#include <Winbase.h>
==================
// TRY #2
#include "C:\\Program Files\\Microsoft Visual Studio .NET
2003\\Vc7\\PlatformSDK\\Include\\WinBase.h"
==================
// TRY #3
#include <Winbase.h>
#pragma comment ( lib, "C:\\Program Files\\Microsoft Visual Studio .NET
2003\\Vc7\\PlatformSDK\\Lib\\AdvAPI32.Lib")
==================
// TRY #4
#include "C:\\Program Files\\Microsoft Visual Studio .NET
2003\\Vc7\\PlatformSDK\\Include\\WinBase.h"
#pragma comment ( lib, "C:\\Program Files\\Microsoft Visual Studio .NET
2003\\Vc7\\PlatformSDK\\Lib\\AdvAPI32.Lib")
==================
Any help will be greatly appreciated.
Thanks
Des Norton
==========================================================
In File: Winbase.h
==========================================================
#if(_WIN32_WINNT >= 0x0500)
//
// LogonFlags
//
#define LOGON_WITH_PROFILE 0x00000001
#define LOGON_NETCREDENTIALS_ONLY 0x00000002
#define LOGON_ZERO_PASSWORD_BUFFER 0x80000000
WINADVAPI
BOOL
WINAPI
CreateProcessWithLogonW(
LPCWSTR lpUsername,
LPCWSTR lpDomain,
LPCWSTR lpPassword,
DWORD dwLogonFlags,
LPCWSTR lpApplicationName,
LPWSTR lpCommandLine,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCWSTR lpCurrentDirectory,
LPSTARTUPINFOW lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
);
==========================================================
==========================================================
AS PER MY COPY OF MSDN
CreateProcessWithLogonW
[This is preliminary documentation and subject to change.]
The CreateProcessWithLogonW function creates a new process and its primary
thread. The new process then runs the specified executable file in the
security context of the specified credentials (user, domain, and password).
The CreateProcessWithLogonW function is similar to the CreateProcessAsUser
function, except that the caller does not need to call the LogonUser
function to authenticate the user and get a token.
BOOL CreateProcessWithLogonW(
LPCWSTR lpUsername, // pointer to the user's name
LPCWSTR lpDomain, // pointer to the user's domain
LPCWSTR lpPassword, // pointer to the user's password
LPCWSTR lpApplicationName, // pointer to the name of the executable
module
LPWSTR lpCommandLine, // pointer to the command-line string
DWORD dwCreationFlags, // creation flags
LPVOID lpEnvironment, // pointer to the new environment block
LPCWSTR lpCurrentDirectory, // pointer to the current directory name
LPSTARTUPINFOW lpStartupInfo, // pointer to STARTUPINFO
LPPROCESS_INFORMATION lpProcessInformation // pointer to
PROCESS_INFORMATION
);
Windows NT: Requires version 5.0 or later.
Windows 95/98: Unsupported.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use advapi32.lib.