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.

79 lines
1.9 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // Cracker.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // This file declares the class NameCracker.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 04/13/1998 Original version.
  16. // 08/10/1998 Remove NT4 support.
  17. // 08/21/1998 Removed initialization/shutdown routines.
  18. //
  19. ///////////////////////////////////////////////////////////////////////////////
  20. #ifndef _CRACKER_H_
  21. #define _CRACKER_H_
  22. #if _MSC_VER >= 1000
  23. #pragma once
  24. #endif
  25. #include <guard.h>
  26. #include <nocopy.h>
  27. #include <ntdsapi.h>
  28. // Forward declaration of helper class used by NameCracker.
  29. class DsHandle;
  30. ///////////////////////////////////////////////////////////////////////////////
  31. //
  32. // CLASS
  33. //
  34. // NameCracker
  35. //
  36. // DESCRIPTION
  37. //
  38. // This class wraps the DsCrackNames API. It adds functionality for
  39. // connection caching and transparent retry of failed queries.
  40. //
  41. ///////////////////////////////////////////////////////////////////////////////
  42. class NameCracker
  43. : Guardable, NonCopyable
  44. {
  45. public:
  46. NameCracker() throw ();
  47. ~NameCracker() throw ();
  48. // Non-connection oriented version of DsCrackNames.
  49. DWORD crackNames(
  50. DS_NAME_FLAGS flags,
  51. DS_NAME_FORMAT formatOffered,
  52. DS_NAME_FORMAT formatDesired,
  53. PCWSTR name,
  54. PDS_NAME_RESULTW *ppResult
  55. ) throw ();
  56. // Wrapper around the DsFreeNameResultW.
  57. void freeNameResult(DS_NAME_RESULTW *pResult) throw ()
  58. { DsFreeNameResultW(pResult); }
  59. protected:
  60. // Discards the cached GC handle. Used to shutdown a bad connection.
  61. void disable(DsHandle* h) throw ();
  62. // Get a handle to the Global Catalog.
  63. DWORD getGC(DsHandle** h) throw ();
  64. // Current connection to the Global Catalog.
  65. DsHandle* gc;
  66. };
  67. #endif // _CRACKER_H_