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.

109 lines
2.1 KiB

  1. //
  2. // Cookie.cpp : Implementation of Cookie and related classes.
  3. // Cory West
  4. //
  5. #include "stdafx.h"
  6. #include "cookie.h"
  7. #include "atlimpl.cpp"
  8. DECLARE_INFOLEVEL(SchmMgmtSnapin)
  9. #include "macros.h"
  10. USE_HANDLE_MACROS("SCHMMGMT(cookie.cpp)")
  11. #include "stdcooki.cpp"
  12. #include ".\uuids.h"
  13. //
  14. // This is used by the nodetype utility routines in
  15. // stdutils.cpp, which matches the enum type node
  16. // types to their guids. This table must match the
  17. // layout of guids in uuids.h.
  18. //
  19. const struct NODETYPE_GUID_ARRAYSTRUCT g_NodetypeGuids[SCHMMGMT_NUMTYPES] =
  20. {
  21. //
  22. // The root node.
  23. //
  24. { // SCHMMGMT_SCHMMGMT
  25. structUuidNodetypeSchmMgmt,
  26. lstrUuidNodetypeSchmMgmt },
  27. //
  28. // Static node types.
  29. //
  30. { // SCHMMGMT_CLASSES
  31. structUuidNodetypeClasses,
  32. lstrUuidNodetypeClasses },
  33. { // SCHMGMT_ATTRIBUTES,
  34. structUuidNodetypeAttributes,
  35. lstrUuidNodetypeAttributes },
  36. //
  37. // Dynamic node types.
  38. //
  39. { // SCHMMGMT_CLASS
  40. structUuidNodetypeClass,
  41. lstrUuidNodetypeClass },
  42. { // SCHMMGMT_ATTRIBUTE
  43. structUuidNodetypeAttribute,
  44. lstrUuidNodetypeAttribute },
  45. };
  46. const struct NODETYPE_GUID_ARRAYSTRUCT* g_aNodetypeGuids = g_NodetypeGuids;
  47. const int g_cNumNodetypeGuids = SCHMMGMT_NUMTYPES;
  48. //
  49. // Cookie
  50. //
  51. HRESULT
  52. Cookie::CompareSimilarCookies(CCookie* pOtherCookie, int* pnResult)
  53. {
  54. ASSERT(pOtherCookie);
  55. ASSERT(pnResult);
  56. Cookie* pcookie = (dynamic_cast<Cookie*>(pOtherCookie));
  57. ASSERT(pcookie);
  58. if (pcookie)
  59. {
  60. //
  61. // Arbitrary ordering...
  62. //
  63. if ( m_objecttype != pcookie->m_objecttype )
  64. {
  65. *pnResult = ((int)m_objecttype) - ((int)pcookie->m_objecttype);
  66. return S_OK;
  67. }
  68. *pnResult = strSchemaObject.CompareNoCase(pcookie->strSchemaObject);
  69. return S_OK;
  70. }
  71. return E_FAIL;
  72. }
  73. CCookie*
  74. Cookie::QueryBaseCookie(
  75. int i ) {
  76. ASSERT( i == 0 );
  77. return (CCookie*)this;
  78. }
  79. int
  80. Cookie::QueryNumCookies() {
  81. return 1;
  82. }