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.

Re: CreateProcessWithLogonW by Sreeram

Sreeram
Wed Jul 30 07:13:01 CDT 2003

Hi

#define _WIN32_WINNT 0x0500

then give your header files. Try like this?

Sreeram




Des Norton wrote:
> 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.
>
>
>


Re: CreateProcessWithLogonW by Ravikiran

Ravikiran
Wed Jul 30 07:39:45 CDT 2003

Hello,
VC6 does not ship with headers for Windows 2000.
So you will not find the functions which are added
in Win2K or after.

You have 2 options:
1. Download Win2K SDK and use this for includes and lib path.
2. Use LogonUser and CreateProcessAsUser functions
Put together, they have the same affect as CreateProcessWithLogon

Best Regards,
ravi.

"Des Norton" <NOdesSPAM@NOgencentricSPAM.co.za> wrote in message
news:#S3oTxoVDHA.1480@tk2msftngp13.phx.gbl...
> 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.
>
>
>



Re: CreateProcessWithLogonW by Des

Des
Wed Jul 30 07:43:55 CDT 2003

Hi Sreeram

Thanks for the response.

> #define _WIN32_WINNT 0x0500
> then give your header files. Try like this?
I still get the same errors - See end of message.


However, if I do it like this, it works.
==============
#include <stdlib.h>
#include <windows.h>
#pragma comment ( lib, "C:\\Program Files\\Microsoft Visual Studio .NET
2003\\Vc7\\PlatformSDK\\Lib\\AdvAPI32.Lib")

#define LOGON_WITH_PROFILE 0x00000001
#define LOGON_NETCREDENTIALS_ONLY 0x00000002
#define LOGON_ZERO_PASSWORD_BUFFER 0x80000000

extern "C" WINADVAPI BOOL WINAPI CreateProcessWithLogonW(...);

==============

I am just worried that when I use this on a client's network it might fail.

Regards
Des Norton


===============================================
// ALL CASES
#include <stdlib.h>
#include <windows.h>
===================
// TRY #1 --> Still the same errors
#define _WIN32_WINNT 0x0500
#include <Winbase.h>

===================
// TRY #2 --> Still the same errors
#define _WIN32_WINNT 0x0500
#include "C:\\Program Files\\Microsoft Visual Studio .NET
2003\\Vc7\\PlatformSDK\\Include\\WinBase.h"
===================
// TRY #3 --> Still the same errors
#define _WIN32_WINNT 0x0500
#include <Winbase.h>
#pragma comment ( lib, "C:\\Program Files\\Microsoft Visual Studio .NET
2003\\Vc7\\PlatformSDK\\Lib\\AdvAPI32.Lib")
===================
// TRY #4 --> Still the same errors
#define _WIN32_WINNT 0x0500
#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")
===================



Re: CreateProcessWithLogonW by Sreeram

Sreeram
Wed Jul 30 07:59:21 CDT 2003

Hi Norton,

One more thing is there:

Tools / Options / Directories.

There you can see the included header file paths. In your case in
winbase.h is there in 2 paths. So the 2 paths will be there in the list
box in the directories tab. Also it is refering to the winbase.h where
the definition is not there.
This one -> C:\Program Files\Microsoft Visual Studio\VC98\Include

But it is there in this path -> C:\Program Files\Microsoft Visual Studio
.NET 2003\Vc7\PlatformSDK\Include

So it is better to move this path before this "C:\Program
Files\Microsoft Visual Studio\VC98\Include"

So that VC compiler will identify it correctly.

Sreeram

Des Norton wrote:
> Hi Sreeram
>
> Thanks for the response.
>
>
>>#define _WIN32_WINNT 0x0500
>>then give your header files. Try like this?
>
> I still get the same errors - See end of message.
>
>
> However, if I do it like this, it works.
> ==============
> #include <stdlib.h>
> #include <windows.h>
> #pragma comment ( lib, "C:\\Program Files\\Microsoft Visual Studio .NET
> 2003\\Vc7\\PlatformSDK\\Lib\\AdvAPI32.Lib")
>
> #define LOGON_WITH_PROFILE 0x00000001
> #define LOGON_NETCREDENTIALS_ONLY 0x00000002
> #define LOGON_ZERO_PASSWORD_BUFFER 0x80000000
>
> extern "C" WINADVAPI BOOL WINAPI CreateProcessWithLogonW(...);
>
> ==============
>
> I am just worried that when I use this on a client's network it might fail.
>
> Regards
> Des Norton
>
>
> ===============================================
> // ALL CASES
> #include <stdlib.h>
> #include <windows.h>
> ===================
> // TRY #1 --> Still the same errors
> #define _WIN32_WINNT 0x0500
> #include <Winbase.h>
>
> ===================
> // TRY #2 --> Still the same errors
> #define _WIN32_WINNT 0x0500
> #include "C:\\Program Files\\Microsoft Visual Studio .NET
> 2003\\Vc7\\PlatformSDK\\Include\\WinBase.h"
> ===================
> // TRY #3 --> Still the same errors
> #define _WIN32_WINNT 0x0500
> #include <Winbase.h>
> #pragma comment ( lib, "C:\\Program Files\\Microsoft Visual Studio .NET
> 2003\\Vc7\\PlatformSDK\\Lib\\AdvAPI32.Lib")
> ===================
> // TRY #4 --> Still the same errors
> #define _WIN32_WINNT 0x0500
> #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")
> ===================
>
>