Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSPI header file - fatal error

I get some fatal error on my project, the error is coming from sspi.h, i have to define something but i am not what and why, please someone explain.

sspi.h(60): fatal error C1189: #error :   You must define one of SECURITY_WIN32, SECURITY_KERNEL, or SECURITY_MAC
like image 902
Cooker Avatar asked Jul 19 '12 13:07

Cooker


2 Answers

While the diagnostic is clear about having to define one of SECURITY_WIN32, SECURITY_KERNEL, or SECURITY_MAC, it doesn't help much in determining which one to use and why. To my knowledge, none of those are officially documented in the MSDN, so the only source of information are the actual header files.

  • SECURITY_MAC: This symbol only ever appears in <sspi.h>, a file with a copyright notice of 1992-1999. Presumably, this symbol was introduced to support compiling for "Classic" Mac OS, back when MFC was still planned to be a cross-platform framework targeting both Windows and Mac. The symbol doesn't appear to be of any practical use today.

  • SECURITY_KERNEL: The most enlightening comment here is from <NTSecPKG.h>, reading // Can't use the windows.h def'ns in kernel mode.. That appears to indicate that the SECURITY_KERNEL symbol needs to be defined, when accessing the security package from a module running in kernel mode.

  • SECURITY_WIN32: There are no comments on this symbol throughout the entire Windows SDK at all. It seems plausible, that this symbol should be used when accessing the security API from a user-mode application.

Assuming all of the above are correct, the following guideline can be used in determining the symbol to define:

  • Define SECURITY_WIN32 when compiling a user-mode application.
  • Define SECURITY_KERNEL when compiling a kernel-mode module.
  • Never define the obsolete SECURITY_MAC preprocessor symbol.
like image 121
IInspectable Avatar answered Sep 18 '22 12:09

IInspectable


Just add

#define SECURITY_WIN32 

before all includes

like image 24
Cooker Avatar answered Sep 21 '22 12:09

Cooker