identifier not found: CreateProcessWithLogonW

C

chris

Hi!

I'm trying to start a process with different credentials. But I cannot even
compile my code as the compiler (VC++.NET) says "error C3861:
'CreateProcessWithLogonW': identifier not found, even with
argument-dependent lookup".

I have included the following headers etc, which I belive should be
sufficient:
#include "stdafx.h"
#define UNICODE
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <stdio.h>
#include <userenv.h>
#include <winbase.h>

Any idea what might be wrong?

Regards,
chris
 
C

chris

Hi!


I have realized that winbase.h is not included corretly. Even though, I
don't know why.

As my code starts with #define _WIN32_WINNT 0x0500, the corresponding define
statements and CreateProcessWithLogonW should be processed. But in fact,
LOGON_WITH_PROFILE for example remains undefined after importing winbase.h.

Any ideas?

Regards,
Chris
 
M

Marcus Heege

Why do you include winbase at all? It is automatically included by
windows.h. I guess that's the problem.
 
W

William DePalo [MVP VC++]

chris said:
Hi!

I'm trying to start a process with different credentials. But I cannot
even compile my code as the compiler (VC++.NET) says "error C3861:
'CreateProcessWithLogonW': identifier not found, even with
argument-dependent lookup".

I have included the following headers etc, which I belive should be
sufficient:
#include "stdafx.h"
#define UNICODE
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <stdio.h>
#include <userenv.h>
#include <winbase.h>

Any idea what might be wrong?

What does stdafx.h look like? Does it include <windows.h> or an MFC header
that does? If so, and if you are using the precompiled header option, the
definition for _WIN32_WINNT comess too late to be seen.

Why not set the minimum version you target in stdafx.h?

Regards,
Will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top