home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / secext.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  6.8 KB  |  285 lines

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1991-1999
  6. //
  7. // File:        secext.h
  8. //
  9. // Contents:    Security function prototypes for functions not part of
  10. //              the SSPI interface. This file should not be directly
  11. //              included - include security.h instead.
  12. //
  13. //
  14. // History:     22 Dec 92   RichardW    Created
  15. //
  16. //------------------------------------------------------------------------
  17.  
  18.  
  19.  
  20. #ifndef __SECEXT_H__
  21. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  22. #define __SECEXT_H__
  23. #if _MSC_VER > 1000
  24. #pragma once
  25. #endif
  26.  
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30.  
  31. //
  32. // This is the combined authentication identity structure that may be
  33. // used with the negotiate package, NTLM, Kerberos, or SCHANNEL
  34. //
  35.  
  36.  
  37. #ifndef SEC_WINNT_AUTH_IDENTITY_VERSION
  38. #define SEC_WINNT_AUTH_IDENTITY_VERSION 0x200
  39.  
  40. typedef struct _SEC_WINNT_AUTH_IDENTITY_EXW {
  41.     unsigned long Version;
  42.     unsigned long Length;
  43.     unsigned short SEC_FAR *User;
  44.     unsigned long UserLength;
  45.     unsigned short SEC_FAR *Domain;
  46.     unsigned long DomainLength;
  47.     unsigned short SEC_FAR *Password;
  48.     unsigned long PasswordLength;
  49.     unsigned long Flags;
  50.     unsigned short SEC_FAR * PackageList;
  51.     unsigned long PackageListLength;
  52. } SEC_WINNT_AUTH_IDENTITY_EXW, *PSEC_WINNT_AUTH_IDENTITY_EXW;
  53.  
  54.  
  55. typedef struct _SEC_WINNT_AUTH_IDENTITY_EXA {
  56.     unsigned long Version;
  57.     unsigned long Length;
  58.     unsigned char SEC_FAR *User;
  59.     unsigned long UserLength;
  60.     unsigned char SEC_FAR *Domain;
  61.     unsigned long DomainLength;
  62.     unsigned char SEC_FAR *Password;
  63.     unsigned long PasswordLength;
  64.     unsigned long Flags;
  65.     unsigned char SEC_FAR * PackageList;
  66.     unsigned long PackageListLength;
  67. } SEC_WINNT_AUTH_IDENTITY_EXA, *PSEC_WINNT_AUTH_IDENTITY_EXA;
  68.  
  69. #ifdef UNICODE
  70. #define SEC_WINNT_AUTH_IDENTITY_EX  SEC_WINNT_AUTH_IDENTITY_EXW
  71. #else 
  72. #define SEC_WINNT_AUTH_IDENTITY_EX  SEC_WINNT_AUTH_IDENTITY_EXA
  73. #endif 
  74.  
  75. #endif // SEC_WINNT_AUTH_IDENTITY_VERSION
  76.  
  77.  
  78. //
  79. // Common types used by negotiable security packages
  80. //
  81.  
  82. #define SEC_WINNT_AUTH_IDENTITY_MARSHALLED      0x4     // all data is in one buffer
  83. #define SEC_WINNT_AUTH_IDENTITY_ONLY            0x8     // these credentials are for identity only - no PAC needed
  84.  
  85.  
  86. //
  87. // Routines for manipulating packages
  88. //
  89.  
  90. typedef struct _SECURITY_PACKAGE_OPTIONS {
  91.     unsigned long   Size;
  92.     unsigned long   Type;
  93.     unsigned long   Flags;
  94.     unsigned long   SignatureSize;
  95.     void SEC_FAR *  Signature;
  96. } SECURITY_PACKAGE_OPTIONS, SEC_FAR * PSECURITY_PACKAGE_OPTIONS;
  97.  
  98. #define SECPKG_OPTIONS_TYPE_UNKNOWN 0
  99. #define SECPKG_OPTIONS_TYPE_LSA     1
  100. #define SECPKG_OPTIONS_TYPE_SSPI    2
  101.  
  102. #define SECPKG_OPTIONS_PERMANENT    0x00000001
  103.  
  104. SECURITY_STATUS
  105. SEC_ENTRY
  106. AddSecurityPackageA(
  107.     SEC_CHAR SEC_FAR *  pszPackageName,
  108.     SECURITY_PACKAGE_OPTIONS SEC_FAR * Options
  109.     );
  110.  
  111. SECURITY_STATUS
  112. SEC_ENTRY
  113. AddSecurityPackageW(
  114.     SEC_WCHAR SEC_FAR * pszPackageName,
  115.     SECURITY_PACKAGE_OPTIONS SEC_FAR * Options
  116.     );
  117.  
  118. #ifdef UNICODE
  119. #define AddSecurityPackage  AddSecurityPackageW
  120. #else
  121. #define AddSecurityPackage  AddSecurityPackageA
  122. #endif
  123.  
  124. SECURITY_STATUS
  125. SEC_ENTRY
  126. DeleteSecurityPackageA(
  127.     SEC_CHAR SEC_FAR *  pszPackageName );
  128.  
  129. SECURITY_STATUS
  130. SEC_ENTRY
  131. DeleteSecurityPackageW(
  132.     SEC_WCHAR SEC_FAR * pszPackageName );
  133.  
  134. #ifdef UNICODE
  135. #define DeleteSecurityPackage   DeleteSecurityPackageW
  136. #else
  137. #define DeleteSecurityPackage   DeleteSecurityPackageA
  138. #endif
  139.  
  140.  
  141. //
  142. // Extended Name APIs for ADS
  143. //
  144.  
  145.  
  146. typedef enum
  147. {
  148.     // Examples for the following formats assume a fictitous company
  149.     // which hooks into the global X.500 and DNS name spaces as follows.
  150.     //
  151.     // Enterprise root domain in DNS is
  152.     //
  153.     //      widget.com
  154.     //
  155.     // Enterprise root domain in X.500 (RFC 1779 format) is
  156.     //
  157.     //      O=Widget, C=US
  158.     //
  159.     // There exists the child domain
  160.     //
  161.     //      engineering.widget.com
  162.     //
  163.     // equivalent to
  164.     //
  165.     //      OU=Engineering, O=Widget, C=US
  166.     //
  167.     // There exists a container within the Engineering domain
  168.     //
  169.     //      OU=Software, OU=Engineering, O=Widget, C=US
  170.     //
  171.     // There exists the user
  172.     //
  173.     //      CN=John Doe, OU=Software, OU=Engineering, O=Widget, C=US
  174.     //
  175.     // And this user's downlevel (pre-ADS) user name is
  176.     //
  177.     //      Engineering\JohnDoe
  178.  
  179.     // unknown name type
  180.     NameUnknown = 0,
  181.  
  182.     // CN=John Doe, OU=Software, OU=Engineering, O=Widget, C=US
  183.     NameFullyQualifiedDN = 1,
  184.  
  185.     // Engineering\JohnDoe
  186.     NameSamCompatible = 2,
  187.  
  188.     // Probably "John Doe" but could be something else.  I.e. The
  189.     // display name is not necessarily the defining RDN.
  190.     NameDisplay = 3,
  191.  
  192.  
  193.     // String-ized GUID as returned by IIDFromString().
  194.     // eg: {4fa050f0-f561-11cf-bdd9-00aa003a77b6}
  195.     NameUniqueId = 6,
  196.  
  197.     // engineering.widget.com/software/John Doe
  198.     NameCanonical = 7,
  199.  
  200.     // johndoe@engineering.com
  201.     NameUserPrincipal = 8,
  202.  
  203.     // Same as NameCanonical except that rightmost '/' is
  204.     // replaced with '\n' - even in domain-only case.
  205.     // eg: engineering.widget.com/software\nJohn Doe
  206.     NameCanonicalEx = 9,
  207.  
  208.     // www/srv.engineering.com/engineering.com
  209.     NameServicePrincipal = 10
  210.  
  211. } EXTENDED_NAME_FORMAT, * PEXTENDED_NAME_FORMAT ;
  212.  
  213. BOOLEAN
  214. SEC_ENTRY
  215. GetUserNameExA(
  216.     EXTENDED_NAME_FORMAT  NameFormat,
  217.     LPSTR lpNameBuffer,
  218.     PULONG nSize
  219.     );
  220. BOOLEAN
  221. SEC_ENTRY
  222. GetUserNameExW(
  223.     EXTENDED_NAME_FORMAT NameFormat,
  224.     LPWSTR lpNameBuffer,
  225.     PULONG nSize
  226.     );
  227.  
  228. #ifdef UNICODE
  229. #define GetUserNameEx   GetUserNameExW
  230. #else
  231. #define GetUserNameEx   GetUserNameExA
  232. #endif
  233.  
  234. BOOLEAN
  235. SEC_ENTRY
  236. GetComputerObjectNameA(
  237.     EXTENDED_NAME_FORMAT  NameFormat,
  238.     LPSTR lpNameBuffer,
  239.     PULONG nSize
  240.     );
  241. BOOLEAN
  242. SEC_ENTRY
  243. GetComputerObjectNameW(
  244.     EXTENDED_NAME_FORMAT NameFormat,
  245.     LPWSTR lpNameBuffer,
  246.     PULONG nSize
  247.     );
  248.  
  249. #ifdef UNICODE
  250. #define GetComputerObjectName   GetComputerObjectNameW
  251. #else
  252. #define GetComputerObjectName   GetComputerObjectNameA
  253. #endif
  254.  
  255. BOOLEAN
  256. SEC_ENTRY
  257. TranslateNameA(
  258.     LPCSTR lpAccountName,
  259.     EXTENDED_NAME_FORMAT AccountNameFormat,
  260.     EXTENDED_NAME_FORMAT DesiredNameFormat,
  261.     LPSTR lpTranslatedName,
  262.     PULONG nSize
  263.     );
  264. BOOLEAN
  265. SEC_ENTRY
  266. TranslateNameW(
  267.     LPCWSTR lpAccountName,
  268.     EXTENDED_NAME_FORMAT AccountNameFormat,
  269.     EXTENDED_NAME_FORMAT DesiredNameFormat,
  270.     LPWSTR lpTranslatedName,
  271.     PULONG nSize
  272.     );
  273. #ifdef UNICODE
  274. #define TranslateName   TranslateNameW
  275. #else
  276. #define TranslateName   TranslateNameA
  277. #endif
  278.  
  279. #ifdef __cplusplus
  280. }
  281. #endif
  282.  
  283. #pragma option pop /*P_O_Pop*/
  284. #endif // __SECEXT_H__
  285.