Source code of Windows XP (NT5)
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.

100 lines
3.6 KiB

  1. /*---------------------------------------------------------------------------
  2. File: LSAUtils.h
  3. Comments: Utility functions to change the domain affiliation of a computer.
  4. (c) Copyright 1999, Mission Critical Software, Inc., All Rights Reserved
  5. Proprietary and confidential to Mission Critical Software, Inc.
  6. REVISION LOG ENTRY
  7. Revision By: Christy Boles
  8. Revised on 02/15/99 11:23:57
  9. ---------------------------------------------------------------------------
  10. */
  11. #include "ntsecapi.h"
  12. #ifndef STATUS_SUCCESS
  13. #define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
  14. #define STATUS_OBJECT_NAME_NOT_FOUND ((NTSTATUS)0xC0000034L)
  15. #define STATUS_OBJECT_NAME_COLLISION ((NTSTATUS)0xC0000035L)
  16. #define STATUS_INVALID_SID ((NTSTATUS)0xC0000078L)
  17. #endif
  18. BOOL
  19. GetDomainDCName(
  20. LPWSTR Domain, // in - domain name
  21. LPWSTR * pPrimaryDC // out- PDC name
  22. );
  23. BOOL
  24. EstablishNullSession(
  25. LPCWSTR Server, // in - server name
  26. BOOL bEstablish // in - TRUE=connect,FALSE=disconnect
  27. );
  28. void
  29. InitLsaString(
  30. PLSA_UNICODE_STRING LsaString, // in - pointer to LSA string to initialize
  31. LPWSTR String // in - value to initialize string to
  32. );
  33. NTSTATUS
  34. OpenPolicy(
  35. LPWSTR ComputerName, // in - computer name
  36. DWORD DesiredAccess, // in - required access
  37. PLSA_HANDLE PolicyHandle // out- policy handle
  38. );
  39. BOOL
  40. GetDomainSid(
  41. LPWSTR DomainName, // in - domain name to acquire Sid of
  42. PSID * pDomainSid // out- points to allocated Sid on success
  43. );
  44. NTSTATUS
  45. SetWorkstationTrustedDomainInfo(
  46. LSA_HANDLE PolicyHandle, // in - policy handle
  47. PSID DomainSid, // in - Sid of domain to manipulate
  48. LPWSTR TrustedDomainName, // in - trusted domain name to add/update
  49. LPWSTR Password, // in - new trust password for trusted domain
  50. LPWSTR errOut // out- error text, if failure
  51. );
  52. NTSTATUS
  53. SetPrimaryDomain(
  54. LSA_HANDLE PolicyHandle, // in - policy handle
  55. PSID DomainSid, // in - SID for new primary domain
  56. LPWSTR TrustedDomainName // in - name of new primary domain
  57. );
  58. void
  59. QueryWorkstationTrustedDomainInfo(
  60. LSA_HANDLE PolicyHandle, // in - policy handle
  61. PSID DomainSid, // in - SID for new primary domain
  62. BOOL bNoChange // in - flag, no change mode
  63. );
  64. BOOL
  65. EstablishSession(
  66. LPCWSTR Server, // in - server name
  67. LPWSTR Domain, // in - domain for Username account
  68. LPWSTR Username, // in - username to connnect as
  69. LPWSTR Password, // in - password for Username account
  70. BOOL bEstablish // in - TRUE=connect, FALSE=disconnect
  71. );
  72. BOOL
  73. EstablishShare(
  74. LPCWSTR Server, // in - server name
  75. LPWSTR Share, // in - share name to connect to
  76. LPWSTR Domain, // in - domain for credentials
  77. LPWSTR UserName, // in - username to connect as
  78. LPWSTR Password, // in - password for credentials
  79. BOOL bEstablish // in - TRUE=connect, FALSE=disconnect
  80. );