LOGON32_LOGON_NEW_CREDENTIALS - Undeclared Identifier Error

Posted on 2008-06-16
Medium Priority
Last Modified: 2012-05-05
Using VS 6.0, LOGON32_LOGON_NEW_CREDENTIALS won't compile correctly. Anyone have any suggestions? This is a win32 windows service.

Code Snippet::

LogonUser(userName.c_str(),domain.c_str(),password.c_str(), LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_WINNT50, &userToken_);

Need a quick turn around on this if someone can figure out why this won't compile....
Question by:rronec1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 86

Accepted Solution

jkr earned 2000 total points
ID: 21796289
Hm, in your other Q, you mentioned you're using VC6 - you will need a new Platform SDK if you are using the files that shipped with VC6, since this constant was introduced years after VC6 was published. Get that update at http://support.microsoft.com/default.aspx?pr=psdk ("Platform SDK")

Author Comment

ID: 21804476
I just updated the new platform SDK. I updated the tool-options -directories to update the include, lib and bin but the compiler still gives me the following:

error C2065: 'LOGON32_LOGON_NEW_CREDENTIALS' : undeclared identifier

Not sure if there is a specific dir in the new SDK install to point to.
LVL 86

Expert Comment

ID: 21804799
That's very strange. Here, the SDK shipping with VC++ (aka VS2005) has
// Logon Support APIs
#define LOGON32_LOGON_NETWORK           3
#define LOGON32_LOGON_BATCH             4
#define LOGON32_LOGON_SERVICE           5
#define LOGON32_LOGON_UNLOCK            7
#if(_WIN32_WINNT >= 0x0500)
#endif // (_WIN32_WINNT >= 0x0500)
#define LOGON32_PROVIDER_WINNT35    1
#if(_WIN32_WINNT >= 0x0400)
#define LOGON32_PROVIDER_WINNT40    2
#endif /* _WIN32_WINNT >= 0x0400 */
#if(_WIN32_WINNT >= 0x0500)
#define LOGON32_PROVIDER_WINNT50    3
#endif // (_WIN32_WINNT >= 0x0500)

Open in new window


Author Comment

ID: 21806292
I went ahead and defined it in the stdafx.h and it worked.

#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0500 // Required for LOGON32_LOGON_NEW_CREDENTIALS and LOGON32_PROVIDER_WINNT50 - W2k and above

Thanks for your assistance with this. You are very helpful and patience.

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question