Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

200 lines
5.3 KiB

  1. /*++
  2. EVERYTHING.HXX
  3. Copyright (C) 1999 Microsoft Corporation, all rights reserved.
  4. DESCRIPTION: more headers than you can shake a stick at.
  5. Created, May 21, 1999 by DavidCHR.
  6. --*/
  7. extern "C"
  8. {
  9. #include <nt.h>
  10. #include <ntrtl.h>
  11. #include <nturtl.h>
  12. #include <ntseapi.h>
  13. #include <ntlsa.h>
  14. #include <stdio.h>
  15. #include <windef.h>
  16. #include <winbase.h>
  17. #include <winreg.h>
  18. #include <winuser.h>
  19. #include <string.h>
  20. #include <stdlib.h>
  21. #include <lmaccess.h>
  22. #include <lmapibuf.h>
  23. #include <lmerr.h>
  24. #include <rpc.h>
  25. #include <wincon.h>
  26. #include <kerberos.h>
  27. #include <kerbcon.h>
  28. #include <winldap.h>
  29. }
  30. /*------------------------------------------------------------
  31. Debugging.
  32. ------------------------------------------------------------*/
  33. // debug levels
  34. #define DEBUG_OPTIONS 0x1
  35. #define DEBUG_DOMAIN 0x2
  36. #define DEBUG_LAUNCH 0x4
  37. #define DEBUG_REGISTRY 0x8
  38. #if DBG // debugging.
  39. extern ULONG GlobalDebugFlags; /* instantiated in misccmds.cxx */
  40. /* Define a useful debugging macro that adds the file and line#
  41. information to it. */
  42. #define DEBUGPRINT( flags, list ) \
  43. { \
  44. if ( GlobalDebugFlags & (flags) ) { \
  45. printf( "%hs:%ld\t", \
  46. strrchr( __FILE__, '\\' ) +1, \
  47. __LINE__ ); \
  48. printf list; \
  49. } \
  50. }
  51. #else
  52. #define DEBUGPRINT( flags, list ) // nothing
  53. #endif
  54. typedef NTSTATUS (TestFunc)( LPWSTR * Parameter);
  55. typedef struct _Commands {
  56. LPWSTR Name;
  57. ULONG Parameter; // count
  58. TestFunc *Function;
  59. PSTR Arguments; // if null, omitted from help.
  60. ULONG flags; // one or more of:
  61. #define CAN_HAVE_FEWER_ARGUMENTS 0x1 /* fewer than "Parameter" arguments
  62. can be passed. Function's on it's
  63. own for parameter validation. */
  64. #define DO_COMMAND_IMMEDIATELY 0x4 /* Perform the command immediately
  65. when you hit it on the commandline.
  66. Otherwise, do the command at the
  67. end. */
  68. #define CAN_HAVE_MORE_ARGUMENTS 0x8 /* go until you hit an argument
  69. that starts with a forward slash
  70. or run out of them. */
  71. LPSTR ExtendedDescription;
  72. LPSTR ConfirmationText; // something like "Needs a reboot."
  73. } CommandPair, *PCommandPair;
  74. #define MAX_COMMANDS 8
  75. typedef struct _Action {
  76. ULONG CommandNumber;
  77. LPWSTR Parameter[MAX_COMMANDS ];
  78. } Action, *PAction;
  79. #ifndef EXTERN
  80. #define EXTERN extern
  81. #endif
  82. EXTERN LPWSTR ServerName;
  83. EXTERN WCHAR ServerBuffer[200];
  84. EXTERN LSA_HANDLE LsaHandle;
  85. extern ULONG cCommands;
  86. extern LPWSTR GlobalClientName; // goes with GlobalClientName
  87. extern LPWSTR GlobalDomainSetting; /* if nonnull, we're in a domain.
  88. This is instantiated in domain.cxx */
  89. extern PLDAP GlobalLdap; /* bound LDAP connection to the
  90. default DC. */
  91. #define KERB_KERBEROS_KEY TEXT("System\\CurrentControlSet\\Control\\Lsa\\Kerberos")
  92. #define KERB_DOMAINS_SUBKEY TEXT("Domains")
  93. #define KERB_DOMAINS_KEY KERB_KERBEROS_KEY TEXT("\\") KERB_DOMAINS_SUBKEY
  94. #define KERB_DOMAIN_KDC_NAMES_VALUE TEXT("KdcNames")
  95. #define KERB_DOMAIN_KPASSWD_NAMES_VALUE TEXT("KpasswdNames")
  96. #define KERB_DOMAIN_ALT_NAMES_VALUE TEXT("AlternateDomainNames")
  97. #define KERB_DOMAIN_REALM_FLAGS_VALUE TEXT("RealmFlags")
  98. BOOL
  99. ConnectedToDsa( VOID );
  100. DWORD
  101. OpenKerberosKey(
  102. OUT PHKEY KerbHandle
  103. ); // support.cxx
  104. NTSTATUS
  105. OpenLocalLsa( OUT PLSA_HANDLE phLsa );
  106. DWORD // support.cxx
  107. OpenSubKey( IN LPWSTR * Parameters,
  108. OUT PHKEY phKey );
  109. /* These are the flags that ReadOptionallyStarredPassword takes. */
  110. #define PROMPT_USING_POSSESSIVE_CASE 0x1
  111. #define PROMPT_FOR_PASSWORD_TWICE 0x2
  112. BOOL
  113. ReadOptionallyStarredPassword( IN LPWSTR InPassword,
  114. IN ULONG flags,
  115. IN LPWSTR Description,
  116. OUT LPWSTR *pPassword ); // support.cxx
  117. NTSTATUS
  118. CallAuthPackage( IN PVOID pvData,
  119. IN ULONG ulInputSize,
  120. OUT PVOID *ppvOutput,
  121. OUT PULONG pulOutputSize ); // support.cxx
  122. BOOL
  123. CheckUppercase( IN LPWSTR wszRealmName );
  124. class CMULTISTRING { // strings.cxx
  125. public:
  126. CMULTISTRING( VOID );
  127. ~CMULTISTRING( VOID );
  128. BOOL
  129. ReadFromRegistry( IN HKEY hKey,
  130. IN LPWSTR ValueName );
  131. BOOL
  132. WriteToRegistry( IN HKEY hKey,
  133. IN LPWSTR ValueName );
  134. BOOL
  135. AddString( IN LPWSTR String );
  136. BOOL
  137. RemoveString( IN LPWSTR String );
  138. /* these are public to facilitate reading them,
  139. but callers should not write these directly. */
  140. ULONG cEntries;
  141. ULONG TotalStringCount;
  142. LPWSTR *pEntries;
  143. };