home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Internet 2000 May / MICD_2000_05.iso / CBuilder5 / INSTALL / DATA1.CAB / Program_Built_Files / Include / sspi.h < prev    next >
C/C++ Source or Header  |  2000-02-01  |  57KB  |  1,852 lines

  1. //+---------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1992-1999.
  5. //
  6. //  File:       sspi.h
  7. //
  8. //  Contents:   Security Support Provider Interface
  9. //              Prototypes and structure definitions
  10. //
  11. //  Functions:  Security Support Provider API
  12. //
  13. //  History:    11-24-93   RichardW   Created
  14. //
  15. //----------------------------------------------------------------------------
  16.  
  17. // begin_ntifs
  18. #ifndef __SSPI_H__
  19. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  20. #define __SSPI_H__
  21. // end_ntifs
  22.  
  23. #if _MSC_VER > 1000
  24. #pragma once
  25. #endif
  26.  
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30.  
  31. //
  32. // Determine environment:
  33. //
  34.  
  35. #ifdef SECURITY_WIN32
  36. #define ISSP_LEVEL  32
  37. #define ISSP_MODE   1
  38. #endif // SECURITY_WIN32
  39.  
  40. #ifdef SECURITY_WIN16
  41. #define ISSP_LEVEL  16
  42. #define ISSP_MODE   1
  43. #endif // SECURITY_WIN16
  44.  
  45. #ifdef SECURITY_KERNEL
  46. #define ISSP_LEVEL  32          // ntifs
  47.  
  48. //
  49. // SECURITY_KERNEL trumps SECURITY_WIN32.  Undefine ISSP_MODE so that
  50. // we don't get redefine errors.
  51. //
  52. #ifdef ISSP_MODE
  53. #undef ISSP_MODE
  54. #endif
  55. #define ISSP_MODE   0           // ntifs
  56. #endif // SECURITY_KERNEL
  57.  
  58. #ifdef SECURITY_OS212
  59. #define ISSP_LEVEL  16
  60. #define ISSP_MODE   1
  61. #endif // SECURITY_OS212
  62.  
  63. #ifdef SECURITY_DOS
  64. #define ISSP_LEVEL  16
  65. #define ISSP_MODE   1
  66. #endif // SECURITY_DOS
  67.  
  68. #ifdef SECURITY_MAC
  69. #define ISSP_LEVEL  32
  70. #define ISSP_MODE   1
  71. #endif // SECURITY_MAC
  72.  
  73.  
  74. #ifndef ISSP_LEVEL
  75. #error  You must define one of SECURITY_WIN32, SECURITY_WIN16, SECURITY_KERNEL
  76. #error  SECURITY_DOS, SECURITY_MAC or SECURITY_OS212
  77. #endif // !ISSP_LEVEL
  78.  
  79.  
  80. //
  81. // Now, define platform specific mappings:
  82. //
  83.  
  84. #if ISSP_LEVEL == 16
  85.  
  86. typedef short SECURITY_STATUS;
  87. typedef unsigned short SEC_WCHAR;
  88. typedef char SEC_CHAR;
  89. #define SEC_TEXT(_x_) _x_
  90.  
  91. #ifdef SECURITY_WIN16
  92.  
  93. #define SEC_FAR __far
  94. #define SEC_ENTRY __pascal __far __export
  95.  
  96. #else // SECURITY_WIN16
  97.  
  98. #define SEC_FAR __far
  99. #define SEC_ENTRY __pascal __far __loadds
  100. #if _MSC_VER >= 1200
  101. #pragma warning(push)
  102. #endif
  103. #pragma warning(disable:4147)
  104.  
  105. #endif // SECURITY_WIN16
  106.  
  107. #elif defined(SECURITY_MAC)  // ISSP_LEVEL == 16
  108.  
  109. #define SEC_ENTRY
  110. #define SEC_TEXT(_X_) _X_
  111. #define SEC_FAR
  112.  
  113. typedef unsigned short SEC_WCHAR;
  114. typedef char SEC_CHAR;
  115. typedef long SECURITY_STATUS;
  116.  
  117. // No Unicode on the Mac
  118.  
  119. typedef SEC_CHAR SEC_FAR * SECURITY_PSTR;
  120. typedef SEC_CHAR SEC_FAR * SECURITY_PCSTR;
  121.  
  122. #else // ISSP_LEVEL == 16
  123.  
  124. //
  125. // For NT-2 and up, wtypes will define HRESULT to be long.
  126. //
  127.  
  128. // begin_ntifs
  129.  
  130. typedef WCHAR SEC_WCHAR;
  131. typedef CHAR SEC_CHAR;
  132.  
  133.  
  134. typedef LONG SECURITY_STATUS;
  135.  
  136. #define SEC_TEXT TEXT
  137. #define SEC_FAR
  138. #define SEC_ENTRY __stdcall
  139.  
  140. // end_ntifs
  141.  
  142. //
  143. // Decide what a string - 32 bits only since for 16 bits it is clear.
  144. //
  145.  
  146.  
  147. #ifdef UNICODE
  148. typedef SEC_WCHAR SEC_FAR * SECURITY_PSTR;
  149. typedef CONST SEC_WCHAR SEC_FAR * SECURITY_PCSTR;
  150. #else // UNICODE
  151. typedef SEC_CHAR SEC_FAR * SECURITY_PSTR;
  152. typedef CONST SEC_CHAR SEC_FAR * SECURITY_PCSTR;
  153. #endif // UNICODE
  154.  
  155.  
  156. #endif // ISSP_LEVEL == 16
  157.  
  158. //
  159. // Equivalent string for rpcrt:
  160. //
  161.  
  162. #define __SEC_FAR SEC_FAR
  163.  
  164.  
  165. //
  166. // Okay, security specific types:
  167. //
  168.  
  169.  
  170. #if ISSP_LEVEL == 16
  171.  
  172. typedef struct _SecHandle
  173. {
  174.     unsigned long dwLower;
  175.     unsigned long dwUpper;
  176. } SecHandle, SEC_FAR * PSecHandle;
  177.  
  178. #define SecInvalidateHandle( x )    \
  179.             ((PSecHandle) x)->dwLower = 0xFFFFFFFF ; \
  180.             ((PSecHandle) x)->dwUpper = 0xFFFFFFFF ;
  181.  
  182. #else
  183.  
  184. // begin_ntifs
  185.  
  186. #ifndef __SECHANDLE_DEFINED__
  187. typedef struct _SecHandle
  188. {
  189.     ULONG_PTR dwLower ;
  190.     ULONG_PTR dwUpper ;
  191. } SecHandle, * PSecHandle ;
  192.  
  193. #define __SECHANDLE_DEFINED__
  194. #endif // __SECHANDLE_DEFINED__
  195.  
  196. #define SecInvalidateHandle( x )    \
  197.             ((PSecHandle) x)->dwLower = (ULONG_PTR) -1 ; \
  198.             ((PSecHandle) x)->dwUpper = (ULONG_PTR) -1 ;
  199.  
  200. // end_ntifs
  201. #endif
  202.  
  203. // begin_ntifs
  204.  
  205. typedef SecHandle CredHandle;
  206. typedef PSecHandle PCredHandle;
  207.  
  208. typedef SecHandle CtxtHandle;
  209. typedef PSecHandle PCtxtHandle;
  210.  
  211. // end_ntifs
  212.  
  213. #if ISSP_LEVEL == 32
  214.  
  215.  
  216. #  ifdef WIN32_CHICAGO
  217.  
  218. typedef unsigned __int64 QWORD;
  219. typedef QWORD SECURITY_INTEGER, *PSECURITY_INTEGER;
  220. #define SEC_SUCCESS(Status) ((Status) >= 0)
  221.  
  222. #  elif defined(_NTDEF_) || defined(_WINNT_)
  223.  
  224. typedef LARGE_INTEGER _SECURITY_INTEGER, SECURITY_INTEGER, *PSECURITY_INTEGER; // ntifs
  225.  
  226. #  else // _NTDEF_ || _WINNT_
  227.  
  228. typedef struct _SECURITY_INTEGER
  229. {
  230.     unsigned long LowPart;
  231.     long HighPart;
  232. } SECURITY_INTEGER, *PSECURITY_INTEGER;
  233.  
  234. #  endif // _NTDEF_ || _WINNT_
  235.  
  236. #  ifndef SECURITY_MAC
  237.  
  238. typedef SECURITY_INTEGER TimeStamp;                 // ntifs
  239. typedef SECURITY_INTEGER SEC_FAR * PTimeStamp;      // ntifs
  240.  
  241. #  else // SECURITY_MAC
  242. typedef unsigned long TimeStamp;
  243. typedef unsigned long * PTimeStamp;
  244. #  endif // SECUIRT_MAC
  245.  
  246. #else // ISSP_LEVEL == 32
  247.  
  248. typedef unsigned long TimeStamp;
  249. typedef unsigned long SEC_FAR * PTimeStamp;
  250. #  ifdef WIN32_CHICAGO
  251. typedef TimeStamp LARGE_INTEGER;
  252. #endif // WIN32_CHICAGO
  253.  
  254. #endif // ISSP_LEVEL == 32
  255.  
  256.  
  257. //
  258. // If we are in 32 bit mode, define the SECURITY_STRING structure,
  259. // as a clone of the base UNICODE_STRING structure.  This is used
  260. // internally in security components, an as the string interface
  261. // for kernel components (e.g. FSPs)
  262. //
  263.  
  264. #if ISSP_LEVEL == 32
  265. #  ifndef _NTDEF_
  266. typedef struct _SECURITY_STRING {
  267.     unsigned short      Length;
  268.     unsigned short      MaximumLength;
  269. #    ifdef MIDL_PASS
  270.     [size_is(MaximumLength / 2), length_is(Length / 2)]
  271. #    endif // MIDL_PASS
  272.     unsigned short *    Buffer;
  273. } SECURITY_STRING, * PSECURITY_STRING;
  274. #  else // _NTDEF_
  275. typedef UNICODE_STRING SECURITY_STRING, *PSECURITY_STRING;  // ntifs
  276. #  endif // _NTDEF_
  277. #endif // ISSP_LEVEL == 32
  278.  
  279.  
  280. // begin_ntifs
  281.  
  282. //
  283. // SecPkgInfo structure
  284. //
  285. //  Provides general information about a security provider
  286. //
  287.  
  288. typedef struct _SecPkgInfoW
  289. {
  290.     unsigned long fCapabilities;        // Capability bitmask
  291.     unsigned short wVersion;            // Version of driver
  292.     unsigned short wRPCID;              // ID for RPC Runtime
  293.     unsigned long cbMaxToken;           // Size of authentication token (max)
  294. #ifdef MIDL_PASS
  295.     [string]
  296. #endif
  297.     SEC_WCHAR SEC_FAR * Name;           // Text name
  298.  
  299. #ifdef MIDL_PASS
  300.     [string]
  301. #endif
  302.     SEC_WCHAR SEC_FAR * Comment;        // Comment
  303. } SecPkgInfoW, SEC_FAR * PSecPkgInfoW;
  304.  
  305. // end_ntifs
  306.  
  307. typedef struct _SecPkgInfoA
  308. {
  309.     unsigned long fCapabilities;        // Capability bitmask
  310.     unsigned short wVersion;            // Version of driver
  311.     unsigned short wRPCID;              // ID for RPC Runtime
  312.     unsigned long cbMaxToken;           // Size of authentication token (max)
  313. #ifdef MIDL_PASS
  314.     [string]
  315. #endif
  316.     SEC_CHAR SEC_FAR * Name;            // Text name
  317.  
  318. #ifdef MIDL_PASS
  319.     [string]
  320. #endif
  321.     SEC_CHAR SEC_FAR * Comment;         // Comment
  322. } SecPkgInfoA, SEC_FAR * PSecPkgInfoA;
  323.  
  324. #ifdef UNICODE
  325. #  define SecPkgInfo SecPkgInfoW        // ntifs
  326. #  define PSecPkgInfo PSecPkgInfoW      // ntifs
  327. #else
  328. #  define SecPkgInfo SecPkgInfoA
  329. #  define PSecPkgInfo PSecPkgInfoA
  330. #endif // !UNICODE
  331.  
  332. // begin_ntifs
  333.  
  334. //
  335. //  Security Package Capabilities
  336. //
  337. #define SECPKG_FLAG_INTEGRITY       0x00000001  // Supports integrity on messages
  338. #define SECPKG_FLAG_PRIVACY         0x00000002  // Supports privacy (confidentiality)
  339. #define SECPKG_FLAG_TOKEN_ONLY      0x00000004  // Only security token needed
  340. #define SECPKG_FLAG_DATAGRAM        0x00000008  // Datagram RPC support
  341. #define SECPKG_FLAG_CONNECTION      0x00000010  // Connection oriented RPC support
  342. #define SECPKG_FLAG_MULTI_REQUIRED  0x00000020  // Full 3-leg required for re-auth.
  343. #define SECPKG_FLAG_CLIENT_ONLY     0x00000040  // Server side functionality not available
  344. #define SECPKG_FLAG_EXTENDED_ERROR  0x00000080  // Supports extended error msgs
  345. #define SECPKG_FLAG_IMPERSONATION   0x00000100  // Supports impersonation
  346. #define SECPKG_FLAG_ACCEPT_WIN32_NAME   0x00000200  // Accepts Win32 names
  347. #define SECPKG_FLAG_STREAM          0x00000400  // Supports stream semantics
  348. #define SECPKG_FLAG_NEGOTIABLE      0x00000800  // Can be used by the negotiate package
  349. #define SECPKG_FLAG_GSS_COMPATIBLE  0x00001000  // GSS Compatibility Available
  350. #define SECPKG_FLAG_LOGON           0x00002000  // Supports common LsaLogonUser
  351. #define SECPKG_FLAG_ASCII_BUFFERS   0x00004000  // Token Buffers are in ASCII
  352. #define SECPKG_FLAG_FRAGMENT        0x00008000  // Package can fragment to fit
  353. #define SECPKG_FLAG_MUTUAL_AUTH     0x00010000  // Package can perform mutual authentication
  354. #define SECPKG_FLAG_DELEGATION      0x00020000  // Package can delegate
  355.  
  356.  
  357. #define SECPKG_ID_NONE      0xFFFF
  358.  
  359.  
  360. //
  361. // SecBuffer
  362. //
  363. //  Generic memory descriptors for buffers passed in to the security
  364. //  API
  365. //
  366.  
  367. typedef struct _SecBuffer {
  368.     unsigned long cbBuffer;             // Size of the buffer, in bytes
  369.     unsigned long BufferType;           // Type of the buffer (below)
  370.     void SEC_FAR * pvBuffer;            // Pointer to the buffer
  371. } SecBuffer, SEC_FAR * PSecBuffer;
  372.  
  373. typedef struct _SecBufferDesc {
  374.     unsigned long ulVersion;            // Version number
  375.     unsigned long cBuffers;             // Number of buffers
  376. #ifdef MIDL_PASS
  377.     [size_is(cBuffers)]
  378. #endif
  379.     PSecBuffer pBuffers;                // Pointer to array of buffers
  380. } SecBufferDesc, SEC_FAR * PSecBufferDesc;
  381.  
  382. #define SECBUFFER_VERSION           0
  383.  
  384. #define SECBUFFER_EMPTY             0   // Undefined, replaced by provider
  385. #define SECBUFFER_DATA              1   // Packet data
  386. #define SECBUFFER_TOKEN             2   // Security token
  387. #define SECBUFFER_PKG_PARAMS        3   // Package specific parameters
  388. #define SECBUFFER_MISSING           4   // Missing Data indicator
  389. #define SECBUFFER_EXTRA             5   // Extra data
  390. #define SECBUFFER_STREAM_TRAILER    6   // Security Trailer
  391. #define SECBUFFER_STREAM_HEADER     7   // Security Header
  392. #define SECBUFFER_NEGOTIATION_INFO  8   // Hints from the negotiation pkg
  393. #define SECBUFFER_PADDING           9   // non-data padding
  394. #define SECBUFFER_STREAM            10  // whole encrypted message
  395.  
  396. #define SECBUFFER_ATTRMASK          0xF0000000
  397. #define SECBUFFER_READONLY          0x80000000  // Buffer is read-only
  398. #define SECBUFFER_RESERVED          0x40000000
  399.  
  400. typedef struct _SEC_NEGOTIATION_INFO {
  401.     unsigned long       Size;           // Size of this structure
  402.     unsigned long       NameLength;     // Length of name hint
  403.     SEC_WCHAR SEC_FAR * Name;           // Name hint
  404.     void SEC_FAR *      Reserved;       // Reserved
  405. } SEC_NEGOTIATION_INFO, SEC_FAR * PSEC_NEGOTIATION_INFO ;
  406.  
  407. //
  408. //  Data Representation Constant:
  409. //
  410. #define SECURITY_NATIVE_DREP        0x00000010
  411. #define SECURITY_NETWORK_DREP       0x00000000
  412.  
  413. //
  414. //  Credential Use Flags
  415. //
  416. #define SECPKG_CRED_INBOUND         0x00000001
  417. #define SECPKG_CRED_OUTBOUND        0x00000002
  418. #define SECPKG_CRED_BOTH            0x00000003
  419. #define SECPKG_CRED_DEFAULT         0x00000004
  420. #define SECPKG_CRED_RESERVED        0xF0000000
  421.  
  422. //
  423. //  InitializeSecurityContext Requirement and return flags:
  424. //
  425.  
  426. #define ISC_REQ_DELEGATE                0x00000001
  427. #define ISC_REQ_MUTUAL_AUTH             0x00000002
  428. #define ISC_REQ_REPLAY_DETECT           0x00000004
  429. #define ISC_REQ_SEQUENCE_DETECT         0x00000008
  430. #define ISC_REQ_CONFIDENTIALITY         0x00000010
  431. #define ISC_REQ_USE_SESSION_KEY         0x00000020
  432. #define ISC_REQ_PROMPT_FOR_CREDS        0x00000040
  433. #define ISC_REQ_USE_SUPPLIED_CREDS      0x00000080
  434. #define ISC_REQ_ALLOCATE_MEMORY         0x00000100
  435. #define ISC_REQ_USE_DCE_STYLE           0x00000200
  436. #define ISC_REQ_DATAGRAM                0x00000400
  437. #define ISC_REQ_CONNECTION              0x00000800
  438. #define ISC_REQ_CALL_LEVEL              0x00001000
  439. #define ISC_REQ_FRAGMENT_SUPPLIED       0x00002000
  440. #define ISC_REQ_EXTENDED_ERROR          0x00004000
  441. #define ISC_REQ_STREAM                  0x00008000
  442. #define ISC_REQ_INTEGRITY               0x00010000
  443. #define ISC_REQ_IDENTIFY                0x00020000
  444. #define ISC_REQ_NULL_SESSION            0x00040000
  445. #define ISC_REQ_MANUAL_CRED_VALIDATION  0x00080000
  446. #define ISC_REQ_RESERVED1               0x00100000
  447. #define ISC_REQ_FRAGMENT_TO_FIT         0x00200000
  448.  
  449. #define ISC_RET_DELEGATE                0x00000001
  450. #define ISC_RET_MUTUAL_AUTH             0x00000002
  451. #define ISC_RET_REPLAY_DETECT           0x00000004
  452. #define ISC_RET_SEQUENCE_DETECT         0x00000008
  453. #define ISC_RET_CONFIDENTIALITY         0x00000010
  454. #define ISC_RET_USE_SESSION_KEY         0x00000020
  455. #define ISC_RET_USED_COLLECTED_CREDS    0x00000040
  456. #define ISC_RET_USED_SUPPLIED_CREDS     0x00000080
  457. #define ISC_RET_ALLOCATED_MEMORY        0x00000100
  458. #define ISC_RET_USED_DCE_STYLE          0x00000200
  459. #define ISC_RET_DATAGRAM                0x00000400
  460. #define ISC_RET_CONNECTION              0x00000800
  461. #define ISC_RET_INTERMEDIATE_RETURN     0x00001000
  462. #define ISC_RET_CALL_LEVEL              0x00002000
  463. #define ISC_RET_EXTENDED_ERROR          0x00004000
  464. #define ISC_RET_STREAM                  0x00008000
  465. #define ISC_RET_INTEGRITY               0x00010000
  466. #define ISC_RET_IDENTIFY                0x00020000
  467. #define ISC_RET_NULL_SESSION            0x00040000
  468. #define ISC_RET_MANUAL_CRED_VALIDATION  0x00080000
  469. #define ISC_RET_RESERVED1               0x00100000
  470. #define ISC_RET_FRAGMENT_ONLY           0x00200000
  471.  
  472. #define ASC_REQ_DELEGATE                0x00000001
  473. #define ASC_REQ_MUTUAL_AUTH             0x00000002
  474. #define ASC_REQ_REPLAY_DETECT           0x00000004
  475. #define ASC_REQ_SEQUENCE_DETECT         0x00000008
  476. #define ASC_REQ_CONFIDENTIALITY         0x00000010
  477. #define ASC_REQ_USE_SESSION_KEY         0x00000020
  478. #define ASC_REQ_ALLOCATE_MEMORY         0x00000100
  479. #define ASC_REQ_USE_DCE_STYLE           0x00000200
  480. #define ASC_REQ_DATAGRAM                0x00000400
  481. #define ASC_REQ_CONNECTION              0x00000800
  482. #define ASC_REQ_CALL_LEVEL              0x00001000
  483. #define ASC_REQ_EXTENDED_ERROR          0x00008000
  484. #define ASC_REQ_STREAM                  0x00010000
  485. #define ASC_REQ_INTEGRITY               0x00020000
  486. #define ASC_REQ_LICENSING               0x00040000
  487. #define ASC_REQ_IDENTIFY                0x00080000
  488. #define ASC_REQ_ALLOW_NULL_SESSION      0x00100000
  489. #define ASC_REQ_ALLOW_NON_USER_LOGONS   0x00200000
  490. #define ASC_REQ_ALLOW_CONTEXT_REPLAY    0x00400000
  491. #define ASC_REQ_FRAGMENT_TO_FIT         0x00800000
  492. #define ASC_REQ_FRAGMENT_SUPPLIED       0x00002000
  493.  
  494. #define ASC_RET_DELEGATE                0x00000001
  495. #define ASC_RET_MUTUAL_AUTH             0x00000002
  496. #define ASC_RET_REPLAY_DETECT           0x00000004
  497. #define ASC_RET_SEQUENCE_DETECT         0x00000008
  498. #define ASC_RET_CONFIDENTIALITY         0x00000010
  499. #define ASC_RET_USE_SESSION_KEY         0x00000020
  500. #define ASC_RET_ALLOCATED_MEMORY        0x00000100
  501. #define ASC_RET_USED_DCE_STYLE          0x00000200
  502. #define ASC_RET_DATAGRAM                0x00000400
  503. #define ASC_RET_CONNECTION              0x00000800
  504. #define ASC_RET_CALL_LEVEL              0x00002000 // skipped 1000 to be like ISC_
  505. #define ASC_RET_THIRD_LEG_FAILED        0x00004000
  506. #define ASC_RET_EXTENDED_ERROR          0x00008000
  507. #define ASC_RET_STREAM                  0x00010000
  508. #define ASC_RET_INTEGRITY               0x00020000
  509. #define ASC_RET_LICENSING               0x00040000
  510. #define ASC_RET_IDENTIFY                0x00080000
  511. #define ASC_RET_NULL_SESSION            0x00100000
  512. #define ASC_RET_ALLOW_NON_USER_LOGONS   0x00200000
  513. #define ASC_RET_ALLOW_CONTEXT_REPLAY    0x00400000
  514. #define ASC_RET_FRAGMENT_ONLY           0x00800000
  515.  
  516. //
  517. //  Security Credentials Attributes:
  518. //
  519.  
  520. #define SECPKG_CRED_ATTR_NAMES 1
  521.  
  522. typedef struct _SecPkgCredentials_NamesW
  523. {
  524.     SEC_WCHAR SEC_FAR * sUserName;
  525. } SecPkgCredentials_NamesW, SEC_FAR * PSecPkgCredentials_NamesW;
  526.  
  527. // end_ntifs
  528.  
  529. typedef struct _SecPkgCredentials_NamesA
  530. {
  531.     SEC_CHAR SEC_FAR * sUserName;
  532. } SecPkgCredentials_NamesA, SEC_FAR * PSecPkgCredentials_NamesA;
  533.  
  534. #ifdef UNICODE
  535. #  define SecPkgCredentials_Names SecPkgCredentials_NamesW      // ntifs
  536. #  define PSecPkgCredentials_Names PSecPkgCredentials_NamesW    // ntifs
  537. #else
  538. #  define SecPkgCredentials_Names SecPkgCredentials_NamesA
  539. #  define PSecPkgCredentials_Names PSecPkgCredentials_NamesA
  540. #endif // !UNICODE
  541.  
  542. // begin_ntifs
  543.  
  544. //
  545. //  Security Context Attributes:
  546. //
  547.  
  548. #define SECPKG_ATTR_SIZES           0
  549. #define SECPKG_ATTR_NAMES           1
  550. #define SECPKG_ATTR_LIFESPAN        2
  551. #define SECPKG_ATTR_DCE_INFO        3
  552. #define SECPKG_ATTR_STREAM_SIZES    4
  553. #define SECPKG_ATTR_KEY_INFO        5
  554. #define SECPKG_ATTR_AUTHORITY       6
  555. #define SECPKG_ATTR_PROTO_INFO      7
  556. #define SECPKG_ATTR_PASSWORD_EXPIRY 8
  557. #define SECPKG_ATTR_SESSION_KEY     9
  558. #define SECPKG_ATTR_PACKAGE_INFO    10
  559. #define SECPKG_ATTR_USER_FLAGS      11
  560. #define SECPKG_ATTR_NEGOTIATION_INFO 12
  561. #define SECPKG_ATTR_NATIVE_NAMES    13
  562. #define SECPKG_ATTR_FLAGS           14
  563.  
  564. typedef struct _SecPkgContext_Sizes
  565. {
  566.     unsigned long cbMaxToken;
  567.     unsigned long cbMaxSignature;
  568.     unsigned long cbBlockSize;
  569.     unsigned long cbSecurityTrailer;
  570. } SecPkgContext_Sizes, SEC_FAR * PSecPkgContext_Sizes;
  571.  
  572. typedef struct _SecPkgContext_StreamSizes
  573. {
  574.     unsigned long   cbHeader;
  575.     unsigned long   cbTrailer;
  576.     unsigned long   cbMaximumMessage;
  577.     unsigned long   cBuffers;
  578.     unsigned long   cbBlockSize;
  579. } SecPkgContext_StreamSizes, * PSecPkgContext_StreamSizes;
  580.  
  581. typedef struct _SecPkgContext_NamesW
  582. {
  583.     SEC_WCHAR SEC_FAR * sUserName;
  584. } SecPkgContext_NamesW, SEC_FAR * PSecPkgContext_NamesW;
  585.  
  586. // end_ntifs
  587.  
  588. typedef struct _SecPkgContext_NamesA
  589. {
  590.     SEC_CHAR SEC_FAR * sUserName;
  591. } SecPkgContext_NamesA, SEC_FAR * PSecPkgContext_NamesA;
  592.  
  593. #ifdef UNICODE
  594. #  define SecPkgContext_Names SecPkgContext_NamesW          // ntifs
  595. #  define PSecPkgContext_Names PSecPkgContext_NamesW        // ntifs
  596. #else
  597. #  define SecPkgContext_Names SecPkgContext_NamesA
  598. #  define PSecPkgContext_Names PSecPkgContext_NamesA
  599. #endif // !UNICODE
  600.  
  601. // begin_ntifs
  602.  
  603. typedef struct _SecPkgContext_Lifespan
  604. {
  605.     TimeStamp tsStart;
  606.     TimeStamp tsExpiry;
  607. } SecPkgContext_Lifespan, SEC_FAR * PSecPkgContext_Lifespan;
  608.  
  609. typedef struct _SecPkgContext_DceInfo
  610. {
  611.     unsigned long AuthzSvc;
  612.     void SEC_FAR * pPac;
  613. } SecPkgContext_DceInfo, SEC_FAR * PSecPkgContext_DceInfo;
  614.  
  615. // end_ntifs
  616.  
  617. typedef struct _SecPkgContext_KeyInfoA
  618. {
  619.     SEC_CHAR SEC_FAR *  sSignatureAlgorithmName;
  620.     SEC_CHAR SEC_FAR *  sEncryptAlgorithmName;
  621.     unsigned long       KeySize;
  622.     unsigned long       SignatureAlgorithm;
  623.     unsigned long       EncryptAlgorithm;
  624. } SecPkgContext_KeyInfoA, SEC_FAR * PSecPkgContext_KeyInfoA;
  625.  
  626. // begin_ntifs
  627.  
  628. typedef struct _SecPkgContext_KeyInfoW
  629. {
  630.     SEC_WCHAR SEC_FAR * sSignatureAlgorithmName;
  631.     SEC_WCHAR SEC_FAR * sEncryptAlgorithmName;
  632.     unsigned long       KeySize;
  633.     unsigned long       SignatureAlgorithm;
  634.     unsigned long       EncryptAlgorithm;
  635. } SecPkgContext_KeyInfoW, SEC_FAR * PSecPkgContext_KeyInfoW;
  636.  
  637. // end_ntifs
  638.  
  639. #ifdef UNICODE
  640. #define SecPkgContext_KeyInfo   SecPkgContext_KeyInfoW      // ntifs
  641. #define PSecPkgContext_KeyInfo  PSecPkgContext_KeyInfoW     // ntifs
  642. #else
  643. #define SecPkgContext_KeyInfo   SecPkgContext_KeyInfoA
  644. #define PSecPkgContext_KeyInfo  PSecPkgContext_KeyInfoA
  645. #endif
  646.  
  647. typedef struct _SecPkgContext_AuthorityA
  648. {
  649.     SEC_CHAR SEC_FAR *  sAuthorityName;
  650. } SecPkgContext_AuthorityA, * PSecPkgContext_AuthorityA;
  651.  
  652. // begin_ntifs
  653.  
  654. typedef struct _SecPkgContext_AuthorityW
  655. {
  656.     SEC_WCHAR SEC_FAR * sAuthorityName;
  657. } SecPkgContext_AuthorityW, * PSecPkgContext_AuthorityW;
  658.  
  659. // end_ntifs
  660.  
  661. #ifdef UNICODE
  662. #define SecPkgContext_Authority SecPkgContext_AuthorityW        // ntifs
  663. #define PSecPkgContext_Authority    PSecPkgContext_AuthorityW   // ntifs
  664. #else
  665. #define SecPkgContext_Authority SecPkgContext_AuthorityA
  666. #define PSecPkgContext_Authority    PSecPkgContext_AuthorityA
  667. #endif
  668.  
  669. typedef struct _SecPkgContext_ProtoInfoA
  670. {
  671.     SEC_CHAR SEC_FAR *  sProtocolName;
  672.     unsigned long       majorVersion;
  673.     unsigned long       minorVersion;
  674. } SecPkgContext_ProtoInfoA, SEC_FAR * PSecPkgContext_ProtoInfoA;
  675.  
  676. // begin_ntifs
  677.  
  678. typedef struct _SecPkgContext_ProtoInfoW
  679. {
  680.     SEC_WCHAR SEC_FAR * sProtocolName;
  681.     unsigned long       majorVersion;
  682.     unsigned long       minorVersion;
  683. } SecPkgContext_ProtoInfoW, SEC_FAR * PSecPkgContext_ProtoInfoW;
  684.  
  685. // end_ntifs
  686.  
  687. #ifdef UNICODE
  688. #define SecPkgContext_ProtoInfo   SecPkgContext_ProtoInfoW      // ntifs
  689. #define PSecPkgContext_ProtoInfo  PSecPkgContext_ProtoInfoW     // ntifs
  690. #else
  691. #define SecPkgContext_ProtoInfo   SecPkgContext_ProtoInfoA
  692. #define PSecPkgContext_ProtoInfo  PSecPkgContext_ProtoInfoA
  693. #endif
  694.  
  695. // begin_ntifs
  696.  
  697. typedef struct _SecPkgContext_PasswordExpiry
  698. {
  699.     TimeStamp tsPasswordExpires;
  700. } SecPkgContext_PasswordExpiry, SEC_FAR * PSecPkgContext_PasswordExpiry;
  701.  
  702. typedef struct _SecPkgContext_SessionKey
  703. {
  704.     unsigned long SessionKeyLength;
  705.     unsigned char SEC_FAR * SessionKey;
  706. } SecPkgContext_SessionKey, *PSecPkgContext_SessionKey;
  707.  
  708.  
  709. typedef struct _SecPkgContext_PackageInfoW
  710. {
  711.     PSecPkgInfoW PackageInfo;
  712. } SecPkgContext_PackageInfoW, SEC_FAR * PSecPkgContext_PackageInfoW;
  713.  
  714. // end_ntifs
  715.  
  716. typedef struct _SecPkgContext_PackageInfoA
  717. {
  718.     PSecPkgInfoA PackageInfo;
  719. } SecPkgContext_PackageInfoA, SEC_FAR * PSecPkgContext_PackageInfoA;
  720.  
  721. // begin_ntifs
  722.  
  723. typedef struct _SecPkgContext_UserFlags
  724. {
  725.     unsigned long UserFlags;
  726. } SecPkgContext_UserFlags, SEC_FAR * PSecPkgContext_UserFlags;
  727.  
  728. typedef struct _SecPkgContext_Flags
  729. {
  730.     unsigned long Flags;
  731. } SecPkgContext_Flags, SEC_FAR * PSecPkgContext_Flags;
  732.  
  733. // end_ntifs
  734.  
  735. #ifdef UNICODE
  736. #define SecPkgContext_PackageInfo   SecPkgContext_PackageInfoW      // ntifs
  737. #define PSecPkgContext_PackageInfo  PSecPkgContext_PackageInfoW     // ntifs
  738. #else
  739. #define SecPkgContext_PackageInfo   SecPkgContext_PackageInfoA
  740. #define PSecPkgContext_PackageInfo  PSecPkgContext_PackageInfoA
  741. #endif
  742.  
  743. typedef struct _SecPkgContext_NegotiationInfoA
  744. {
  745.     PSecPkgInfoA    PackageInfo ;
  746.     unsigned long   NegotiationState ;
  747. } SecPkgContext_NegotiationInfoA, SEC_FAR * PSecPkgContext_NegotiationInfoA ;
  748.  
  749. typedef struct _SecPkgContext_NegotiationInfoW
  750. {
  751.     PSecPkgInfoW    PackageInfo ;
  752.     unsigned long   NegotiationState ;
  753. } SecPkgContext_NegotiationInfoW, SEC_FAR * PSecPkgContext_NegotiationInfoW ;
  754.  
  755. #ifdef UNICODE
  756. #define SecPkgContext_NegotiationInfo   SecPkgContext_NegotiationInfoW
  757. #define PSecPkgContext_NegotiationInfo  PSecPkgContext_NegotiationInfoW
  758. #else
  759. #define SecPkgContext_NegotiationInfo   SecPkgContext_NegotiationInfoA
  760. #define PSecPkgContext_NegotiationInfo  PSecPkgContext_NegotiationInfoA
  761. #endif
  762.  
  763. #define SECPKG_NEGOTIATION_COMPLETE     0
  764. #define SECPKG_NEGOTIATION_OPTIMISTIC   1
  765. #define SECPKG_NEGOTIATION_IN_PROGRESS  2
  766. #define SECPKG_NEGOTIATION_DIRECT       3
  767.  
  768.  
  769. typedef struct _SecPkgContext_NativeNamesW
  770. {
  771.     SEC_WCHAR SEC_FAR * sClientName;
  772.     SEC_WCHAR SEC_FAR * sServerName;
  773. } SecPkgContext_NativeNamesW, SEC_FAR * PSecPkgContext_NativeNamesW;
  774.  
  775. typedef struct _SecPkgContext_NativeNamesA
  776. {
  777.     SEC_CHAR SEC_FAR * sClientName;
  778.     SEC_CHAR SEC_FAR * sServerName;
  779. } SecPkgContext_NativeNamesA, SEC_FAR * PSecPkgContext_NativeNamesA;
  780.  
  781.  
  782. #ifdef UNICODE
  783. #  define SecPkgContext_NativeNames SecPkgContext_NativeNamesW          // ntifs
  784. #  define PSecPkgContext_NativeNames PSecPkgContext_NativeNamesW        // ntifs
  785. #else
  786. #  define SecPkgContext_NativeNames SecPkgContext_NativeNamesA
  787. #  define PSecPkgContext_NativeNames PSecPkgContext_NativeNamesA
  788. #endif // !UNICODE
  789.  
  790.  
  791. // begin_ntifs
  792.  
  793. typedef void
  794. (SEC_ENTRY SEC_FAR * SEC_GET_KEY_FN) (
  795.     void SEC_FAR * Arg,                 // Argument passed in
  796.     void SEC_FAR * Principal,           // Principal ID
  797.     unsigned long KeyVer,               // Key Version
  798.     void SEC_FAR * SEC_FAR * Key,       // Returned ptr to key
  799.     SECURITY_STATUS SEC_FAR * Status    // returned status
  800.     );
  801.  
  802. //
  803. // Flags for ExportSecurityContext
  804. //
  805.  
  806. #define SECPKG_CONTEXT_EXPORT_RESET_NEW         0x00000001      // New context is reset to initial state
  807. #define SECPKG_CONTEXT_EXPORT_DELETE_OLD        0x00000002      // Old context is deleted during export
  808.  
  809.  
  810. SECURITY_STATUS SEC_ENTRY
  811. AcquireCredentialsHandleW(
  812. #if ISSP_MODE == 0                      // For Kernel mode
  813.     PSECURITY_STRING pPrincipal,
  814.     PSECURITY_STRING pPackage,
  815. #else
  816.     SEC_WCHAR SEC_FAR * pszPrincipal,   // Name of principal
  817.     SEC_WCHAR SEC_FAR * pszPackage,     // Name of package
  818. #endif
  819.     unsigned long fCredentialUse,       // Flags indicating use
  820.     void SEC_FAR * pvLogonId,           // Pointer to logon ID
  821.     void SEC_FAR * pAuthData,           // Package specific data
  822.     SEC_GET_KEY_FN pGetKeyFn,           // Pointer to GetKey() func
  823.     void SEC_FAR * pvGetKeyArgument,    // Value to pass to GetKey()
  824.     PCredHandle phCredential,           // (out) Cred Handle
  825.     PTimeStamp ptsExpiry                // (out) Lifetime (optional)
  826.     );
  827.  
  828. typedef SECURITY_STATUS
  829. (SEC_ENTRY * ACQUIRE_CREDENTIALS_HANDLE_FN_W)(
  830. #if ISSP_MODE == 0
  831.     PSECURITY_STRING,
  832.     PSECURITY_STRING,
  833. #else
  834.     SEC_WCHAR SEC_FAR *,
  835.     SEC_WCHAR SEC_FAR *,
  836. #endif
  837.     unsigned long,
  838.     void SEC_FAR *,
  839.     void SEC_FAR *,
  840.     SEC_GET_KEY_FN,
  841.     void SEC_FAR *,
  842.     PCredHandle,
  843.     PTimeStamp);
  844.  
  845. // end_ntifs
  846.  
  847. SECURITY_STATUS SEC_ENTRY
  848. AcquireCredentialsHandleA(
  849.     SEC_CHAR SEC_FAR * pszPrincipal,    // Name of principal
  850.     SEC_CHAR SEC_FAR * pszPackage,      // Name of package
  851.     unsigned long fCredentialUse,       // Flags indicating use
  852.     void SEC_FAR * pvLogonId,           // Pointer to logon ID
  853.     void SEC_FAR * pAuthData,           // Package specific data
  854.     SEC_GET_KEY_FN pGetKeyFn,           // Pointer to GetKey() func
  855.     void SEC_FAR * pvGetKeyArgument,    // Value to pass to GetKey()
  856.     PCredHandle phCredential,           // (out) Cred Handle
  857.     PTimeStamp ptsExpiry                // (out) Lifetime (optional)
  858.     );
  859.  
  860. typedef SECURITY_STATUS
  861. (SEC_ENTRY * ACQUIRE_CREDENTIALS_HANDLE_FN_A)(
  862.     SEC_CHAR SEC_FAR *,
  863.     SEC_CHAR SEC_FAR *,
  864.     unsigned long,
  865.     void SEC_FAR *,
  866.     void SEC_FAR *,
  867.     SEC_GET_KEY_FN,
  868.     void SEC_FAR *,
  869.     PCredHandle,
  870.     PTimeStamp);
  871.  
  872. #ifdef UNICODE
  873. #  define AcquireCredentialsHandle AcquireCredentialsHandleW            // ntifs
  874. #  define ACQUIRE_CREDENTIALS_HANDLE_FN ACQUIRE_CREDENTIALS_HANDLE_FN_W // ntifs
  875. #else
  876. #  define AcquireCredentialsHandle AcquireCredentialsHandleA
  877. #  define ACQUIRE_CREDENTIALS_HANDLE_FN ACQUIRE_CREDENTIALS_HANDLE_FN_A
  878. #endif // !UNICODE
  879.  
  880. // begin_ntifs
  881.  
  882. SECURITY_STATUS SEC_ENTRY
  883. FreeCredentialsHandle(
  884.     PCredHandle phCredential            // Handle to free
  885.     );
  886.  
  887. typedef SECURITY_STATUS
  888. (SEC_ENTRY * FREE_CREDENTIALS_HANDLE_FN)(
  889.     PCredHandle );
  890.  
  891. SECURITY_STATUS SEC_ENTRY
  892. AddCredentialsW(
  893.     PCredHandle hCredentials,
  894. #if ISSP_MODE == 0                      // For Kernel mode
  895.     PSECURITY_STRING pPrincipal,
  896.     PSECURITY_STRING pPackage,
  897. #else
  898.     SEC_WCHAR SEC_FAR * pszPrincipal,   // Name of principal
  899.     SEC_WCHAR SEC_FAR * pszPackage,     // Name of package
  900. #endif
  901.     unsigned long fCredentialUse,       // Flags indicating use
  902.     void SEC_FAR * pAuthData,           // Package specific data
  903.     SEC_GET_KEY_FN pGetKeyFn,           // Pointer to GetKey() func
  904.     void SEC_FAR * pvGetKeyArgument,    // Value to pass to GetKey()
  905.     PTimeStamp ptsExpiry                // (out) Lifetime (optional)
  906.     );
  907.  
  908. typedef SECURITY_STATUS
  909. (SEC_ENTRY * ADD_CREDENTIALS_FN_W)(
  910.     PCredHandle,
  911. #if ISSP_MODE == 0
  912.     PSECURITY_STRING,
  913.     PSECURITY_STRING,
  914. #else
  915.     SEC_WCHAR SEC_FAR *,
  916.     SEC_WCHAR SEC_FAR *,
  917. #endif
  918.     unsigned long,
  919.     void SEC_FAR *,
  920.     SEC_GET_KEY_FN,
  921.     void SEC_FAR *,
  922.     PTimeStamp);
  923.  
  924. SECURITY_STATUS SEC_ENTRY
  925. AddCredentialsA(
  926.     PCredHandle hCredentials,
  927.     SEC_CHAR SEC_FAR * pszPrincipal,   // Name of principal
  928.     SEC_CHAR SEC_FAR * pszPackage,     // Name of package
  929.     unsigned long fCredentialUse,       // Flags indicating use
  930.     void SEC_FAR * pAuthData,           // Package specific data
  931.     SEC_GET_KEY_FN pGetKeyFn,           // Pointer to GetKey() func
  932.     void SEC_FAR * pvGetKeyArgument,    // Value to pass to GetKey()
  933.     PTimeStamp ptsExpiry                // (out) Lifetime (optional)
  934.     );
  935.  
  936. typedef SECURITY_STATUS
  937. (SEC_ENTRY * ADD_CREDENTIALS_FN_A)(
  938.     PCredHandle,
  939.     SEC_CHAR SEC_FAR *,
  940.     SEC_CHAR SEC_FAR *,
  941.     unsigned long,
  942.     void SEC_FAR *,
  943.     SEC_GET_KEY_FN,
  944.     void SEC_FAR *,
  945.     PTimeStamp);
  946.  
  947. #ifdef UNICODE
  948. #define AddCredentials  AddCredentialsW
  949. #define ADD_CREDENTIALS_FN  ADD_CREDENTIALS_FN_W
  950. #else
  951. #define AddCredentials  AddCredentialsA
  952. #define ADD_CREDENTIALS_FN ADD_CREDENTIALS_FN_A
  953. #endif
  954.  
  955. // end_ntifs
  956.  
  957. #ifdef WIN32_CHICAGO
  958. SECURITY_STATUS SEC_ENTRY
  959. SspiLogonUserW(
  960.     SEC_WCHAR SEC_FAR * pszPackage,     // Name of package
  961.     SEC_WCHAR SEC_FAR * pszUserName,     // Name of package
  962.     SEC_WCHAR SEC_FAR * pszDomainName,     // Name of package
  963.     SEC_WCHAR SEC_FAR * pszPassword      // Name of package
  964.     );
  965.  
  966. typedef SECURITY_STATUS
  967. (SEC_ENTRY * SSPI_LOGON_USER_FN_W)(
  968.     SEC_CHAR SEC_FAR *,
  969.     SEC_CHAR SEC_FAR *,
  970.     SEC_CHAR SEC_FAR *,
  971.     SEC_CHAR SEC_FAR *);
  972.  
  973. SECURITY_STATUS SEC_ENTRY
  974. SspiLogonUserA(
  975.     SEC_CHAR SEC_FAR * pszPackage,     // Name of package
  976.     SEC_CHAR SEC_FAR * pszUserName,     // Name of package
  977.     SEC_CHAR SEC_FAR * pszDomainName,     // Name of package
  978.     SEC_CHAR SEC_FAR * pszPassword      // Name of package
  979.     );
  980.  
  981. typedef SECURITY_STATUS
  982. (SEC_ENTRY * SSPI_LOGON_USER_FN_A)(
  983.     SEC_CHAR SEC_FAR *,
  984.     SEC_CHAR SEC_FAR *,
  985.     SEC_CHAR SEC_FAR *,
  986.     SEC_CHAR SEC_FAR *);
  987.  
  988. #ifdef UNICODE
  989. #define SspiLogonUser SspiLogonUserW            // ntifs
  990. #define SSPI_LOGON_USER_FN SSPI_LOGON_USER_FN_W
  991. #else
  992. #define SspiLogonUser SspiLogonUserA
  993. #define SSPI_LOGON_USER_FN SSPI_LOGON_USER_FN_A
  994. #endif // !UNICODE
  995. #endif // WIN32_CHICAGO
  996.  
  997.  
  998. // begin_ntifs
  999.  
  1000. ////////////////////////////////////////////////////////////////////////
  1001. ///
  1002. /// Context Management Functions
  1003. ///
  1004. ////////////////////////////////////////////////////////////////////////
  1005.  
  1006. SECURITY_STATUS SEC_ENTRY
  1007. InitializeSecurityContextW(
  1008.     PCredHandle phCredential,               // Cred to base context
  1009.     PCtxtHandle phContext,                  // Existing context (OPT)
  1010. #if ISSP_MODE == 0
  1011.     PSECURITY_STRING pTargetName,
  1012. #else
  1013.     SEC_WCHAR SEC_FAR * pszTargetName,      // Name of target
  1014. #endif
  1015.     unsigned long fContextReq,              // Context Requirements
  1016.     unsigned long Reserved1,                // Reserved, MBZ
  1017.     unsigned long TargetDataRep,            // Data rep of target
  1018.     PSecBufferDesc pInput,                  // Input Buffers
  1019.     unsigned long Reserved2,                // Reserved, MBZ
  1020.     PCtxtHandle phNewContext,               // (out) New Context handle
  1021.     PSecBufferDesc pOutput,                 // (inout) Output Buffers
  1022.     unsigned long SEC_FAR * pfContextAttr,  // (out) Context attrs
  1023.     PTimeStamp ptsExpiry                    // (out) Life span (OPT)
  1024.     );
  1025.  
  1026. typedef SECURITY_STATUS
  1027. (SEC_ENTRY * INITIALIZE_SECURITY_CONTEXT_FN_W)(
  1028.     PCredHandle,
  1029.     PCtxtHandle,
  1030. #if ISSP_MODE == 0
  1031.     PSECURITY_STRING,
  1032. #else
  1033.     SEC_WCHAR SEC_FAR *,
  1034. #endif
  1035.     unsigned long,
  1036.     unsigned long,
  1037.     unsigned long,
  1038.     PSecBufferDesc,
  1039.     unsigned long,
  1040.     PCtxtHandle,
  1041.     PSecBufferDesc,
  1042.     unsigned long SEC_FAR *,
  1043.     PTimeStamp);
  1044.  
  1045. // end_ntifs
  1046.  
  1047. SECURITY_STATUS SEC_ENTRY
  1048. InitializeSecurityContextA(
  1049.     PCredHandle phCredential,               // Cred to base context
  1050.     PCtxtHandle phContext,                  // Existing context (OPT)
  1051.     SEC_CHAR SEC_FAR * pszTargetName,       // Name of target
  1052.     unsigned long fContextReq,              // Context Requirements
  1053.     unsigned long Reserved1,                // Reserved, MBZ
  1054.     unsigned long TargetDataRep,            // Data rep of target
  1055.     PSecBufferDesc pInput,                  // Input Buffers
  1056.     unsigned long Reserved2,                // Reserved, MBZ
  1057.     PCtxtHandle phNewContext,               // (out) New Context handle
  1058.     PSecBufferDesc pOutput,                 // (inout) Output Buffers
  1059.     unsigned long SEC_FAR * pfContextAttr,  // (out) Context attrs
  1060.     PTimeStamp ptsExpiry                    // (out) Life span (OPT)
  1061.     );
  1062.  
  1063. typedef SECURITY_STATUS
  1064. (SEC_ENTRY * INITIALIZE_SECURITY_CONTEXT_FN_A)(
  1065.     PCredHandle,
  1066.     PCtxtHandle,
  1067.     SEC_CHAR SEC_FAR *,
  1068.     unsigned long,
  1069.     unsigned long,
  1070.     unsigned long,
  1071.     PSecBufferDesc,
  1072.     unsigned long,
  1073.     PCtxtHandle,
  1074.     PSecBufferDesc,
  1075.     unsigned long SEC_FAR *,
  1076.     PTimeStamp);
  1077.  
  1078. #ifdef UNICODE
  1079. #  define InitializeSecurityContext InitializeSecurityContextW              // ntifs
  1080. #  define INITIALIZE_SECURITY_CONTEXT_FN INITIALIZE_SECURITY_CONTEXT_FN_W   // ntifs
  1081. #else
  1082. #  define InitializeSecurityContext InitializeSecurityContextA
  1083. #  define INITIALIZE_SECURITY_CONTEXT_FN INITIALIZE_SECURITY_CONTEXT_FN_A
  1084. #endif // !UNICODE
  1085.  
  1086. // begin_ntifs
  1087.  
  1088. SECURITY_STATUS SEC_ENTRY
  1089. AcceptSecurityContext(
  1090.     PCredHandle phCredential,               // Cred to base context
  1091.     PCtxtHandle phContext,                  // Existing context (OPT)
  1092.     PSecBufferDesc pInput,                  // Input buffer
  1093.     unsigned long fContextReq,              // Context Requirements
  1094.     unsigned long TargetDataRep,            // Target Data Rep
  1095.     PCtxtHandle phNewContext,               // (out) New context handle
  1096.     PSecBufferDesc pOutput,                 // (inout) Output buffers
  1097.     unsigned long SEC_FAR * pfContextAttr,  // (out) Context attributes
  1098.     PTimeStamp ptsExpiry                    // (out) Life span (OPT)
  1099.     );
  1100.  
  1101. typedef SECURITY_STATUS
  1102. (SEC_ENTRY * ACCEPT_SECURITY_CONTEXT_FN)(
  1103.     PCredHandle,
  1104.     PCtxtHandle,
  1105.     PSecBufferDesc,
  1106.     unsigned long,
  1107.     unsigned long,
  1108.     PCtxtHandle,
  1109.     PSecBufferDesc,
  1110.     unsigned long SEC_FAR *,
  1111.     PTimeStamp);
  1112.  
  1113.  
  1114.  
  1115. SECURITY_STATUS SEC_ENTRY
  1116. CompleteAuthToken(
  1117.     PCtxtHandle phContext,              // Context to complete
  1118.     PSecBufferDesc pToken               // Token to complete
  1119.     );
  1120.  
  1121. typedef SECURITY_STATUS
  1122. (SEC_ENTRY * COMPLETE_AUTH_TOKEN_FN)(
  1123.     PCtxtHandle,
  1124.     PSecBufferDesc);
  1125.  
  1126.  
  1127. SECURITY_STATUS SEC_ENTRY
  1128. ImpersonateSecurityContext(
  1129.     PCtxtHandle phContext               // Context to impersonate
  1130.     );
  1131.  
  1132. typedef SECURITY_STATUS
  1133. (SEC_ENTRY * IMPERSONATE_SECURITY_CONTEXT_FN)(
  1134.     PCtxtHandle);
  1135.  
  1136.  
  1137.  
  1138. SECURITY_STATUS SEC_ENTRY
  1139. RevertSecurityContext(
  1140.     PCtxtHandle phContext               // Context from which to re
  1141.     );
  1142.  
  1143. typedef SECURITY_STATUS
  1144. (SEC_ENTRY * REVERT_SECURITY_CONTEXT_FN)(
  1145.     PCtxtHandle);
  1146.  
  1147.  
  1148. SECURITY_STATUS SEC_ENTRY
  1149. QuerySecurityContextToken(
  1150.     PCtxtHandle phContext,
  1151.     void SEC_FAR * SEC_FAR * Token
  1152.     );
  1153.  
  1154. typedef SECURITY_STATUS
  1155. (SEC_ENTRY * QUERY_SECURITY_CONTEXT_TOKEN_FN)(
  1156.     PCtxtHandle, void SEC_FAR * SEC_FAR *);
  1157.  
  1158.  
  1159.  
  1160. SECURITY_STATUS SEC_ENTRY
  1161. DeleteSecurityContext(
  1162.     PCtxtHandle phContext               // Context to delete
  1163.     );
  1164.  
  1165. typedef SECURITY_STATUS
  1166. (SEC_ENTRY * DELETE_SECURITY_CONTEXT_FN)(
  1167.     PCtxtHandle);
  1168.  
  1169.  
  1170.  
  1171. SECURITY_STATUS SEC_ENTRY
  1172. ApplyControlToken(
  1173.     PCtxtHandle phContext,              // Context to modify
  1174.     PSecBufferDesc pInput               // Input token to apply
  1175.     );
  1176.  
  1177. typedef SECURITY_STATUS
  1178. (SEC_ENTRY * APPLY_CONTROL_TOKEN_FN)(
  1179.     PCtxtHandle, PSecBufferDesc);
  1180.  
  1181.  
  1182.  
  1183. SECURITY_STATUS SEC_ENTRY
  1184. QueryContextAttributesW(
  1185.     PCtxtHandle phContext,              // Context to query
  1186.     unsigned long ulAttribute,          // Attribute to query
  1187.     void SEC_FAR * pBuffer              // Buffer for attributes
  1188.     );
  1189.  
  1190. typedef SECURITY_STATUS
  1191. (SEC_ENTRY * QUERY_CONTEXT_ATTRIBUTES_FN_W)(
  1192.     PCtxtHandle,
  1193.     unsigned long,
  1194.     void SEC_FAR *);
  1195.  
  1196. // end_ntifs
  1197.  
  1198. SECURITY_STATUS SEC_ENTRY
  1199. QueryContextAttributesA(
  1200.     PCtxtHandle phContext,              // Context to query
  1201.     unsigned long ulAttribute,          // Attribute to query
  1202.     void SEC_FAR * pBuffer              // Buffer for attributes
  1203.     );
  1204.  
  1205. typedef SECURITY_STATUS
  1206. (SEC_ENTRY * QUERY_CONTEXT_ATTRIBUTES_FN_A)(
  1207.     PCtxtHandle,
  1208.     unsigned long,
  1209.     void SEC_FAR *);
  1210.  
  1211. #ifdef UNICODE
  1212. #  define QueryContextAttributes QueryContextAttributesW            // ntifs
  1213. #  define QUERY_CONTEXT_ATTRIBUTES_FN QUERY_CONTEXT_ATTRIBUTES_FN_W // ntifs
  1214. #else
  1215. #  define QueryContextAttributes QueryContextAttributesA
  1216. #  define QUERY_CONTEXT_ATTRIBUTES_FN QUERY_CONTEXT_ATTRIBUTES_FN_A
  1217. #endif // !UNICODE
  1218.  
  1219. // begin_ntifs
  1220.  
  1221. SECURITY_STATUS SEC_ENTRY
  1222. QueryCredentialsAttributesW(
  1223.     PCredHandle phCredential,              // Credential to query
  1224.     unsigned long ulAttribute,          // Attribute to query
  1225.     void SEC_FAR * pBuffer              // Buffer for attributes
  1226.     );
  1227.  
  1228. typedef SECURITY_STATUS
  1229. (SEC_ENTRY * QUERY_CREDENTIALS_ATTRIBUTES_FN_W)(
  1230.     PCredHandle,
  1231.     unsigned long,
  1232.     void SEC_FAR *);
  1233.  
  1234. // end_ntifs
  1235.  
  1236. SECURITY_STATUS SEC_ENTRY
  1237. QueryCredentialsAttributesA(
  1238.     PCredHandle phCredential,              // Credential to query
  1239.     unsigned long ulAttribute,          // Attribute to query
  1240.     void SEC_FAR * pBuffer              // Buffer for attributes
  1241.     );
  1242.  
  1243. typedef SECURITY_STATUS
  1244. (SEC_ENTRY * QUERY_CREDENTIALS_ATTRIBUTES_FN_A)(
  1245.     PCredHandle,
  1246.     unsigned long,
  1247.     void SEC_FAR *);
  1248.  
  1249. #ifdef UNICODE
  1250. #  define QueryCredentialsAttributes QueryCredentialsAttributesW            // ntifs
  1251. #  define QUERY_CREDENTIALS_ATTRIBUTES_FN QUERY_CREDENTIALS_ATTRIBUTES_FN_W // ntifs
  1252. #else
  1253. #  define QueryCredentialsAttributes QueryCredentialsAttributesA
  1254. #  define QUERY_CREDENTIALS_ATTRIBUTES_FN QUERY_CREDENTIALS_ATTRIBUTES_FN_A
  1255. #endif // !UNICODE
  1256.  
  1257. // begin_ntifs
  1258.  
  1259. SECURITY_STATUS SEC_ENTRY
  1260. FreeContextBuffer(
  1261.     void SEC_FAR * pvContextBuffer      // buffer to free
  1262.     );
  1263.  
  1264. typedef SECURITY_STATUS
  1265. (SEC_ENTRY * FREE_CONTEXT_BUFFER_FN)(
  1266.     void SEC_FAR *);
  1267.  
  1268. // end_ntifs
  1269.  
  1270. // begin_ntifs
  1271. ///////////////////////////////////////////////////////////////////
  1272. ////
  1273. ////    Message Support API
  1274. ////
  1275. //////////////////////////////////////////////////////////////////
  1276.  
  1277. SECURITY_STATUS SEC_ENTRY
  1278. MakeSignature(
  1279.     PCtxtHandle phContext,              // Context to use
  1280.     unsigned long fQOP,                 // Quality of Protection
  1281.     PSecBufferDesc pMessage,            // Message to sign
  1282.     unsigned long MessageSeqNo          // Message Sequence Num.
  1283.     );
  1284.  
  1285. typedef SECURITY_STATUS
  1286. (SEC_ENTRY * MAKE_SIGNATURE_FN)(
  1287.     PCtxtHandle,
  1288.     unsigned long,
  1289.     PSecBufferDesc,
  1290.     unsigned long);
  1291.  
  1292.  
  1293.  
  1294. SECURITY_STATUS SEC_ENTRY
  1295. VerifySignature(
  1296.     PCtxtHandle phContext,              // Context to use
  1297.     PSecBufferDesc pMessage,            // Message to verify
  1298.     unsigned long MessageSeqNo,         // Sequence Num.
  1299.     unsigned long SEC_FAR * pfQOP       // QOP used
  1300.     );
  1301.  
  1302. typedef SECURITY_STATUS
  1303. (SEC_ENTRY * VERIFY_SIGNATURE_FN)(
  1304.     PCtxtHandle,
  1305.     PSecBufferDesc,
  1306.     unsigned long,
  1307.     unsigned long SEC_FAR *);
  1308.  
  1309.  
  1310. SECURITY_STATUS SEC_ENTRY
  1311. EncryptMessage( PCtxtHandle         phContext,
  1312.                 unsigned long       fQOP,
  1313.                 PSecBufferDesc      pMessage,
  1314.                 unsigned long       MessageSeqNo);
  1315.  
  1316. typedef SECURITY_STATUS
  1317. (SEC_ENTRY * ENCRYPT_MESSAGE_FN)(
  1318.     PCtxtHandle, unsigned long, PSecBufferDesc, unsigned long);
  1319.  
  1320.  
  1321. SECURITY_STATUS SEC_ENTRY
  1322. DecryptMessage( PCtxtHandle         phContext,
  1323.                 PSecBufferDesc      pMessage,
  1324.                 unsigned long       MessageSeqNo,
  1325.                 unsigned long *     pfQOP);
  1326.  
  1327.  
  1328. typedef SECURITY_STATUS
  1329. (SEC_ENTRY * DECRYPT_MESSAGE_FN)(
  1330.     PCtxtHandle, PSecBufferDesc, unsigned long,
  1331.     unsigned long SEC_FAR *);
  1332.  
  1333.  
  1334. // end_ntifs
  1335.  
  1336. // begin_ntifs
  1337. ///////////////////////////////////////////////////////////////////////////
  1338. ////
  1339. ////    Misc.
  1340. ////
  1341. ///////////////////////////////////////////////////////////////////////////
  1342.  
  1343.  
  1344. SECURITY_STATUS SEC_ENTRY
  1345. EnumerateSecurityPackagesW(
  1346.     unsigned long SEC_FAR * pcPackages,     // Receives num. packages
  1347.     PSecPkgInfoW SEC_FAR * ppPackageInfo    // Receives array of info
  1348.     );
  1349.  
  1350. typedef SECURITY_STATUS
  1351. (SEC_ENTRY * ENUMERATE_SECURITY_PACKAGES_FN_W)(
  1352.     unsigned long SEC_FAR *,
  1353.     PSecPkgInfoW SEC_FAR *);
  1354.  
  1355. // end_ntifs
  1356.  
  1357. SECURITY_STATUS SEC_ENTRY
  1358. EnumerateSecurityPackagesA(
  1359.     unsigned long SEC_FAR * pcPackages,     // Receives num. packages
  1360.     PSecPkgInfoA SEC_FAR * ppPackageInfo    // Receives array of info
  1361.     );
  1362.  
  1363. typedef SECURITY_STATUS
  1364. (SEC_ENTRY * ENUMERATE_SECURITY_PACKAGES_FN_A)(
  1365.     unsigned long SEC_FAR *,
  1366.     PSecPkgInfoA SEC_FAR *);
  1367.  
  1368. #ifdef UNICODE
  1369. #  define EnumerateSecurityPackages EnumerateSecurityPackagesW              // ntifs
  1370. #  define ENUMERATE_SECURITY_PACKAGES_FN ENUMERATE_SECURITY_PACKAGES_FN_W   // ntifs
  1371. #else
  1372. #  define EnumerateSecurityPackages EnumerateSecurityPackagesA
  1373. #  define ENUMERATE_SECURITY_PACKAGES_FN ENUMERATE_SECURITY_PACKAGES_FN_A
  1374. #endif // !UNICODE
  1375.  
  1376. // begin_ntifs
  1377.  
  1378. SECURITY_STATUS SEC_ENTRY
  1379. QuerySecurityPackageInfoW(
  1380. #if ISSP_MODE == 0
  1381.     PSECURITY_STRING pPackageName,
  1382. #else
  1383.     SEC_WCHAR SEC_FAR * pszPackageName,     // Name of package
  1384. #endif
  1385.     PSecPkgInfoW SEC_FAR *ppPackageInfo              // Receives package info
  1386.     );
  1387.  
  1388. typedef SECURITY_STATUS
  1389. (SEC_ENTRY * QUERY_SECURITY_PACKAGE_INFO_FN_W)(
  1390. #if ISSP_MODE == 0
  1391.     PSECURITY_STRING,
  1392. #else
  1393.     SEC_WCHAR SEC_FAR *,
  1394. #endif
  1395.     PSecPkgInfoW SEC_FAR *);
  1396.  
  1397. // end_ntifs
  1398.  
  1399. SECURITY_STATUS SEC_ENTRY
  1400. QuerySecurityPackageInfoA(
  1401.     SEC_CHAR SEC_FAR * pszPackageName,      // Name of package
  1402.     PSecPkgInfoA SEC_FAR *ppPackageInfo              // Receives package info
  1403.     );
  1404.  
  1405. typedef SECURITY_STATUS
  1406. (SEC_ENTRY * QUERY_SECURITY_PACKAGE_INFO_FN_A)(
  1407.     SEC_CHAR SEC_FAR *,
  1408.     PSecPkgInfoA SEC_FAR *);
  1409.  
  1410. #ifdef UNICODE
  1411. #  define QuerySecurityPackageInfo QuerySecurityPackageInfoW                // ntifs
  1412. #  define QUERY_SECURITY_PACKAGE_INFO_FN QUERY_SECURITY_PACKAGE_INFO_FN_W   // ntifs
  1413. #else
  1414. #  define QuerySecurityPackageInfo QuerySecurityPackageInfoA
  1415. #  define QUERY_SECURITY_PACKAGE_INFO_FN QUERY_SECURITY_PACKAGE_INFO_FN_A
  1416. #endif // !UNICODE
  1417.  
  1418.  
  1419. #if ISSP_MODE == 0
  1420.  
  1421. #define DeleteSecurityContextDefer  DeleteSecurityContext
  1422. #define FreeCredentialsHandleDefer  FreeCredentialsHandle
  1423.  
  1424. #if 0
  1425. //
  1426. // Deferred mode calls for rdr
  1427. //
  1428.  
  1429. SECURITY_STATUS SEC_ENTRY
  1430. DeleteSecurityContextDefer(
  1431.     PCtxtHandle     phContext);
  1432.  
  1433. SECURITY_STATUS SEC_ENTRY
  1434. FreeCredentialsHandleDefer(
  1435.     PCredHandle     phCreds);
  1436.  
  1437. #endif
  1438.  
  1439. #endif
  1440.  
  1441. typedef enum _SecDelegationType {
  1442.     SecFull,
  1443.     SecService,
  1444.     SecTree,
  1445.     SecDirectory,
  1446.     SecObject
  1447. } SecDelegationType, * PSecDelegationType;
  1448.  
  1449. SECURITY_STATUS SEC_ENTRY
  1450. DelegateSecurityContext(
  1451.     PCtxtHandle         phContext,          // IN Active context to delegate
  1452. #if ISSP_MODE == 0
  1453.     PSECURITY_STRING    pTarget,            // IN Target path
  1454. #else
  1455.     SEC_CHAR SEC_FAR *  pszTarget,
  1456. #endif
  1457.     SecDelegationType   DelegationType,     // IN Type of delegation
  1458.     PTimeStamp          pExpiry,            // IN OPTIONAL time limit
  1459.     PSecBuffer          pPackageParameters, // IN OPTIONAL package specific
  1460.     PSecBufferDesc      pOutput);           // OUT Token for applycontroltoken.
  1461.  
  1462.  
  1463. ///////////////////////////////////////////////////////////////////////////
  1464. ////
  1465. ////    Proxies
  1466. ////
  1467. ///////////////////////////////////////////////////////////////////////////
  1468.  
  1469.  
  1470. //
  1471. // Proxies are only available on NT platforms
  1472. //
  1473.  
  1474. // begin_ntifs
  1475.  
  1476. ///////////////////////////////////////////////////////////////////////////
  1477. ////
  1478. ////    Context export/import
  1479. ////
  1480. ///////////////////////////////////////////////////////////////////////////
  1481.  
  1482.  
  1483.  
  1484. SECURITY_STATUS SEC_ENTRY
  1485. ExportSecurityContext(
  1486.     PCtxtHandle          phContext,             // (in) context to export
  1487.     ULONG                fFlags,                // (in) option flags
  1488.     PSecBuffer           pPackedContext,        // (out) marshalled context
  1489.     void SEC_FAR * SEC_FAR * pToken                 // (out, optional) token handle for impersonation
  1490.     );
  1491.  
  1492. typedef SECURITY_STATUS
  1493. (SEC_ENTRY * EXPORT_SECURITY_CONTEXT_FN)(
  1494.     PCtxtHandle,
  1495.     ULONG,
  1496.     PSecBuffer,
  1497.     void SEC_FAR * SEC_FAR *
  1498.     );
  1499.  
  1500. SECURITY_STATUS SEC_ENTRY
  1501. ImportSecurityContextW(
  1502. #if ISSP_MODE == 0
  1503.     PSECURITY_STRING     pszPackage,
  1504. #else
  1505.     SEC_WCHAR SEC_FAR * pszPackage,
  1506. #endif
  1507.     PSecBuffer           pPackedContext,        // (in) marshalled context
  1508.     void SEC_FAR *       Token,                 // (in, optional) handle to token for context
  1509.     PCtxtHandle          phContext              // (out) new context handle
  1510.     );
  1511.  
  1512. typedef SECURITY_STATUS
  1513. (SEC_ENTRY * IMPORT_SECURITY_CONTEXT_FN_W)(
  1514. #if ISSP_MODE == 0
  1515.     PSECURITY_STRING,
  1516. #else
  1517.     SEC_WCHAR SEC_FAR *,
  1518. #endif
  1519.     PSecBuffer,
  1520.     VOID SEC_FAR *,
  1521.     PCtxtHandle
  1522.     );
  1523.  
  1524. // end_ntifs
  1525. SECURITY_STATUS SEC_ENTRY
  1526. ImportSecurityContextA(
  1527.     SEC_CHAR SEC_FAR * pszPackage,
  1528.     PSecBuffer           pPackedContext,        // (in) marshalled context
  1529.     VOID SEC_FAR *       Token,                 // (in, optional) handle to token for context
  1530.     PCtxtHandle          phContext              // (out) new context handle
  1531.     );
  1532.  
  1533. typedef SECURITY_STATUS
  1534. (SEC_ENTRY * IMPORT_SECURITY_CONTEXT_FN_A)(
  1535.     SEC_CHAR SEC_FAR *,
  1536.     PSecBuffer,
  1537.     void SEC_FAR *,
  1538.     PCtxtHandle
  1539.     );
  1540.  
  1541. #ifdef UNICODE
  1542. #  define ImportSecurityContext ImportSecurityContextW              // ntifs
  1543. #  define IMPORT_SECURITY_CONTEXT_FN IMPORT_SECURITY_CONTEXT_FN_W   // ntifs
  1544. #else
  1545. #  define ImportSecurityContext ImportSecurityContextA
  1546. #  define IMPORT_SECURITY_CONTEXT_FN IMPORT_SECURITY_CONTEXT_FN_A
  1547. #endif // !UNICODE
  1548.  
  1549. // begin_ntifs
  1550.  
  1551. #if ISSP_MODE == 0
  1552. NTSTATUS
  1553. NTAPI
  1554. SecMakeSPN(
  1555.     IN PUNICODE_STRING ServiceClass,
  1556.     IN PUNICODE_STRING ServiceName,
  1557.     IN PUNICODE_STRING InstanceName OPTIONAL,
  1558.     IN USHORT InstancePort OPTIONAL,
  1559.     IN PUNICODE_STRING Referrer OPTIONAL,
  1560.     IN OUT PUNICODE_STRING Spn,
  1561.     OUT PULONG Length OPTIONAL,
  1562.     IN BOOLEAN Allocate
  1563.     );
  1564. #endif
  1565.  
  1566. // end_ntifs
  1567.  
  1568. ///////////////////////////////////////////////////////////////////////////////
  1569. ////
  1570. ////  Fast access for RPC:
  1571. ////
  1572. ///////////////////////////////////////////////////////////////////////////////
  1573.  
  1574. #define SECURITY_ENTRYPOINT_ANSIW "InitSecurityInterfaceW"
  1575. #define SECURITY_ENTRYPOINT_ANSIA "InitSecurityInterfaceA"
  1576. #define SECURITY_ENTRYPOINTW SEC_TEXT("InitSecurityInterfaceW")     // ntifs
  1577. #define SECURITY_ENTRYPOINTA SEC_TEXT("InitSecurityInterfaceA")
  1578. #define SECURITY_ENTRYPOINT16 "INITSECURITYINTERFACEA"
  1579.  
  1580. #ifdef SECURITY_WIN32
  1581. #  ifdef UNICODE
  1582. #    define SECURITY_ENTRYPOINT SECURITY_ENTRYPOINTW                // ntifs
  1583. #    define SECURITY_ENTRYPOINT_ANSI SECURITY_ENTRYPOINT_ANSIW
  1584. #  else // UNICODE
  1585. #    define SECURITY_ENTRYPOINT SECURITY_ENTRYPOINTA
  1586. #    define SECURITY_ENTRYPOINT_ANSI SECURITY_ENTRYPOINT_ANSIA
  1587. #  endif // UNICODE
  1588. #else // SECURITY_WIN32
  1589. #  define SECURITY_ENTRYPOINT SECURITY_ENTRYPOINT16
  1590. #  define SECURITY_ENTRYPOINT_ANSI SECURITY_ENTRYPOINT16
  1591. #endif // SECURITY_WIN32
  1592.  
  1593. // begin_ntifs
  1594.  
  1595. #define FreeCredentialHandle FreeCredentialsHandle
  1596.  
  1597. typedef struct _SECURITY_FUNCTION_TABLE_W {
  1598.     unsigned long                       dwVersion;
  1599.     ENUMERATE_SECURITY_PACKAGES_FN_W    EnumerateSecurityPackagesW;
  1600.     QUERY_CREDENTIALS_ATTRIBUTES_FN_W   QueryCredentialsAttributesW;
  1601.     ACQUIRE_CREDENTIALS_HANDLE_FN_W     AcquireCredentialsHandleW;
  1602.     FREE_CREDENTIALS_HANDLE_FN          FreeCredentialsHandle;
  1603. #ifndef WIN32_CHICAGO
  1604.     void SEC_FAR *                      Reserved2;
  1605. #else // WIN32_CHICAGO
  1606.     SSPI_LOGON_USER_FN                  SspiLogonUserW;
  1607. #endif // WIN32_CHICAGO
  1608.     INITIALIZE_SECURITY_CONTEXT_FN_W    InitializeSecurityContextW;
  1609.     ACCEPT_SECURITY_CONTEXT_FN          AcceptSecurityContext;
  1610.     COMPLETE_AUTH_TOKEN_FN              CompleteAuthToken;
  1611.     DELETE_SECURITY_CONTEXT_FN          DeleteSecurityContext;
  1612.     APPLY_CONTROL_TOKEN_FN              ApplyControlToken;
  1613.     QUERY_CONTEXT_ATTRIBUTES_FN_W       QueryContextAttributesW;
  1614.     IMPERSONATE_SECURITY_CONTEXT_FN     ImpersonateSecurityContext;
  1615.     REVERT_SECURITY_CONTEXT_FN          RevertSecurityContext;
  1616.     MAKE_SIGNATURE_FN                   MakeSignature;
  1617.     VERIFY_SIGNATURE_FN                 VerifySignature;
  1618.     FREE_CONTEXT_BUFFER_FN              FreeContextBuffer;
  1619.     QUERY_SECURITY_PACKAGE_INFO_FN_W    QuerySecurityPackageInfoW;
  1620.     void SEC_FAR *                      Reserved3;
  1621.     void SEC_FAR *                      Reserved4;
  1622.     EXPORT_SECURITY_CONTEXT_FN          ExportSecurityContext;
  1623.     IMPORT_SECURITY_CONTEXT_FN_W        ImportSecurityContextW;
  1624.     ADD_CREDENTIALS_FN_W                AddCredentialsW ;
  1625.     void SEC_FAR *                      Reserved8;
  1626.     QUERY_SECURITY_CONTEXT_TOKEN_FN     QuerySecurityContextToken;
  1627.     ENCRYPT_MESSAGE_FN                  EncryptMessage;
  1628.     DECRYPT_MESSAGE_FN                  DecryptMessage;
  1629. } SecurityFunctionTableW, SEC_FAR * PSecurityFunctionTableW;
  1630.  
  1631. // end_ntifs
  1632.  
  1633. typedef struct _SECURITY_FUNCTION_TABLE_A {
  1634.     unsigned long                       dwVersion;
  1635.     ENUMERATE_SECURITY_PACKAGES_FN_A    EnumerateSecurityPackagesA;
  1636.     QUERY_CREDENTIALS_ATTRIBUTES_FN_A   QueryCredentialsAttributesA;
  1637.     ACQUIRE_CREDENTIALS_HANDLE_FN_A     AcquireCredentialsHandleA;
  1638.     FREE_CREDENTIALS_HANDLE_FN          FreeCredentialHandle;
  1639. #ifndef WIN32_CHICAGO
  1640.     void SEC_FAR *                      Reserved2;
  1641. #else // WIN32_CHICAGO
  1642.     SSPI_LOGON_USER_FN                       SspiLogonUserA;
  1643. #endif // WIN32_CHICAGO
  1644.     INITIALIZE_SECURITY_CONTEXT_FN_A    InitializeSecurityContextA;
  1645.     ACCEPT_SECURITY_CONTEXT_FN          AcceptSecurityContext;
  1646.     COMPLETE_AUTH_TOKEN_FN              CompleteAuthToken;
  1647.     DELETE_SECURITY_CONTEXT_FN          DeleteSecurityContext;
  1648.     APPLY_CONTROL_TOKEN_FN              ApplyControlToken;
  1649.     QUERY_CONTEXT_ATTRIBUTES_FN_A       QueryContextAttributesA;
  1650.     IMPERSONATE_SECURITY_CONTEXT_FN     ImpersonateSecurityContext;
  1651.     REVERT_SECURITY_CONTEXT_FN          RevertSecurityContext;
  1652.     MAKE_SIGNATURE_FN                   MakeSignature;
  1653.     VERIFY_SIGNATURE_FN                 VerifySignature;
  1654.     FREE_CONTEXT_BUFFER_FN              FreeContextBuffer;
  1655.     QUERY_SECURITY_PACKAGE_INFO_FN_A    QuerySecurityPackageInfoA;
  1656.     void SEC_FAR *                      Reserved3;
  1657.     void SEC_FAR *                      Reserved4;
  1658.     EXPORT_SECURITY_CONTEXT_FN          ExportSecurityContext;
  1659.     IMPORT_SECURITY_CONTEXT_FN_A        ImportSecurityContextA;
  1660.     ADD_CREDENTIALS_FN_A                AddCredentialsA ;
  1661.     void SEC_FAR *                      Reserved8;
  1662.     QUERY_SECURITY_CONTEXT_TOKEN_FN     QuerySecurityContextToken;
  1663.     ENCRYPT_MESSAGE_FN                  EncryptMessage;
  1664.     DECRYPT_MESSAGE_FN                  DecryptMessage;
  1665. } SecurityFunctionTableA, SEC_FAR * PSecurityFunctionTableA;
  1666.  
  1667. #ifdef UNICODE
  1668. #  define SecurityFunctionTable SecurityFunctionTableW      // ntifs
  1669. #  define PSecurityFunctionTable PSecurityFunctionTableW    // ntifs
  1670. #else
  1671. #  define SecurityFunctionTable SecurityFunctionTableA
  1672. #  define PSecurityFunctionTable PSecurityFunctionTableA
  1673. #endif // !UNICODE
  1674.  
  1675. #define SECURITY_
  1676.  
  1677. #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION     1   // ntifs
  1678.  
  1679.  
  1680. PSecurityFunctionTableA SEC_ENTRY
  1681. InitSecurityInterfaceA(
  1682.     void
  1683.     );
  1684.  
  1685. typedef PSecurityFunctionTableA
  1686. (SEC_ENTRY * INIT_SECURITY_INTERFACE_A)(void);
  1687.  
  1688. // begin_ntifs
  1689.  
  1690. PSecurityFunctionTableW SEC_ENTRY
  1691. InitSecurityInterfaceW(
  1692.     void
  1693.     );
  1694.  
  1695. typedef PSecurityFunctionTableW
  1696. (SEC_ENTRY * INIT_SECURITY_INTERFACE_W)(void);
  1697.  
  1698. // end_ntifs
  1699.  
  1700. #ifdef UNICODE
  1701. #  define InitSecurityInterface InitSecurityInterfaceW          // ntifs
  1702. #  define INIT_SECURITY_INTERFACE INIT_SECURITY_INTERFACE_W     // ntifs
  1703. #else
  1704. #  define InitSecurityInterface InitSecurityInterfaceA
  1705. #  define INIT_SECURITY_INTERFACE INIT_SECURITY_INTERFACE_A
  1706. #endif // !UNICODE
  1707.  
  1708.  
  1709. #ifdef SECURITY_WIN32
  1710.  
  1711. //
  1712. // SASL Profile Support
  1713. //
  1714.  
  1715.  
  1716. SECURITY_STATUS
  1717. SEC_ENTRY
  1718. SaslEnumerateProfilesA(
  1719.     OUT LPSTR * ProfileList,
  1720.     OUT ULONG * ProfileCount
  1721.     );
  1722.  
  1723. SECURITY_STATUS
  1724. SEC_ENTRY
  1725. SaslEnumerateProfilesW(
  1726.     OUT LPWSTR * ProfileList,
  1727.     OUT ULONG * ProfileCount
  1728.     );
  1729.  
  1730. #ifdef UNICODE
  1731. #define SaslEnumerateProfiles   SaslEnumerateProfilesW
  1732. #else
  1733. #define SaslEnumerateProfiles   SaslEnumerateProfilesA
  1734. #endif
  1735.  
  1736.  
  1737. SECURITY_STATUS
  1738. SEC_ENTRY
  1739. SaslGetProfilePackageA(
  1740.     IN LPSTR ProfileName,
  1741.     OUT PSecPkgInfoA * PackageInfo
  1742.     );
  1743.  
  1744.  
  1745. SECURITY_STATUS
  1746. SEC_ENTRY
  1747. SaslGetProfilePackageW(
  1748.     IN LPWSTR ProfileName,
  1749.     OUT PSecPkgInfoW * PackageInfo
  1750.     );
  1751.  
  1752. #ifdef UNICODE
  1753. #define SaslGetProfilePackage   SaslGetProfilePackageW
  1754. #else
  1755. #define SaslGetProfilePackage   SaslGetProfilePackageA
  1756. #endif
  1757.  
  1758. SECURITY_STATUS
  1759. SEC_ENTRY
  1760. SaslIdentifyPackageA(
  1761.     IN PSecBufferDesc pInput,
  1762.     OUT PSecPkgInfoA * PackageInfo
  1763.     );
  1764.  
  1765. SECURITY_STATUS
  1766. SEC_ENTRY
  1767. SaslIdentifyPackageW(
  1768.     IN PSecBufferDesc pInput,
  1769.     OUT PSecPkgInfoW * PackageInfo
  1770.     );
  1771.  
  1772. #ifdef UNICODE
  1773. #define SaslIdentifyPackage SaslIdentifyPackageW
  1774. #else
  1775. #define SaslIdentifyPackage SaslIdentifyPackageA
  1776. #endif
  1777.  
  1778. SECURITY_STATUS
  1779. SEC_ENTRY
  1780. SaslInitializeSecurityContextW(
  1781.     PCredHandle                 phCredential,       // Cred to base context
  1782.     PCtxtHandle                 phContext,          // Existing context (OPT)
  1783.     LPWSTR                      pszTargetName,      // Name of target
  1784.     unsigned long               fContextReq,        // Context Requirements
  1785.     unsigned long               Reserved1,          // Reserved, MBZ
  1786.     unsigned long               TargetDataRep,      // Data rep of target
  1787.     PSecBufferDesc              pInput,             // Input Buffers
  1788.     unsigned long               Reserved2,          // Reserved, MBZ
  1789.     PCtxtHandle                 phNewContext,       // (out) New Context handle
  1790.     PSecBufferDesc              pOutput,            // (inout) Output Buffers
  1791.     unsigned long SEC_FAR *     pfContextAttr,      // (out) Context attrs
  1792.     PTimeStamp                  ptsExpiry           // (out) Life span (OPT)
  1793.     );
  1794.  
  1795. SECURITY_STATUS
  1796. SEC_ENTRY
  1797. SaslInitializeSecurityContextA(
  1798.     PCredHandle                 phCredential,       // Cred to base context
  1799.     PCtxtHandle                 phContext,          // Existing context (OPT)
  1800.     LPSTR                       pszTargetName,      // Name of target
  1801.     unsigned long               fContextReq,        // Context Requirements
  1802.     unsigned long               Reserved1,          // Reserved, MBZ
  1803.     unsigned long               TargetDataRep,      // Data rep of target
  1804.     PSecBufferDesc              pInput,             // Input Buffers
  1805.     unsigned long               Reserved2,          // Reserved, MBZ
  1806.     PCtxtHandle                 phNewContext,       // (out) New Context handle
  1807.     PSecBufferDesc              pOutput,            // (inout) Output Buffers
  1808.     unsigned long SEC_FAR *     pfContextAttr,      // (out) Context attrs
  1809.     PTimeStamp                  ptsExpiry           // (out) Life span (OPT)
  1810.     );
  1811.  
  1812. #ifdef UNICODE
  1813. #define SaslInitializeSecurityContext   SaslInitializeSecurityContextW
  1814. #else
  1815. #define SaslInitializeSecurityContext   SaslInitializeSecurityContextA
  1816. #endif
  1817.  
  1818.  
  1819. SECURITY_STATUS
  1820. SEC_ENTRY
  1821. SaslAcceptSecurityContext(
  1822.     PCredHandle                 phCredential,       // Cred to base context
  1823.     PCtxtHandle                 phContext,          // Existing context (OPT)
  1824.     PSecBufferDesc              pInput,             // Input buffer
  1825.     unsigned long               fContextReq,        // Context Requirements
  1826.     unsigned long               TargetDataRep,      // Target Data Rep
  1827.     PCtxtHandle                 phNewContext,       // (out) New context handle
  1828.     PSecBufferDesc              pOutput,            // (inout) Output buffers
  1829.     unsigned long SEC_FAR *     pfContextAttr,      // (out) Context attributes
  1830.     PTimeStamp                  ptsExpiry           // (out) Life span (OPT)
  1831.     );
  1832.  
  1833.  
  1834. #endif
  1835.  
  1836. #ifdef SECURITY_DOS
  1837. #if _MSC_VER >= 1200
  1838. #pragma warning(pop)
  1839. #else
  1840. #pragma warning(default:4147)
  1841. #endif
  1842. #endif
  1843.  
  1844. #ifdef __cplusplus
  1845. }  // extern "C"
  1846. #endif
  1847.  
  1848. // begin_ntifs
  1849. #pragma option pop /*P_O_Pop*/
  1850. #endif // __SSPI_H__
  1851. // end_ntifs
  1852.