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.

127 lines
2.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: libmain.cxx
  7. //
  8. // Contents: LibMain for nds.dll
  9. //
  10. // Functions: LibMain, DllGetClassObject
  11. //
  12. // History: 25-Oct-94 KrishnaG Created.
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "nds.hxx"
  16. #pragma hdrstop
  17. HRESULT
  18. InstantiateDerivedObject(
  19. IADs FAR * pADs,
  20. CCredentials& Credentials,
  21. REFIID riid,
  22. void ** ppObject
  23. )
  24. {
  25. BSTR bstrClassName = NULL;
  26. DWORD dwObjectId = 0;
  27. HRESULT hr = S_OK;
  28. *ppObject = NULL;
  29. hr = pADs->get_Class(&bstrClassName);
  30. BAIL_ON_FAILURE(hr);
  31. hr = IsValidFilter(
  32. bstrClassName,
  33. &dwObjectId,
  34. gpFilters,
  35. gdwMaxFilters
  36. );
  37. BAIL_ON_FAILURE(hr)
  38. switch (dwObjectId) {
  39. case NDS_USER_ID:
  40. hr = CNDSUser::CreateUser(
  41. pADs,
  42. Credentials,
  43. riid,
  44. ppObject
  45. );
  46. BAIL_ON_FAILURE(hr);
  47. break;
  48. case NDS_GROUP_ID:
  49. hr = CNDSGroup::CreateGroup(
  50. pADs,
  51. Credentials,
  52. riid,
  53. ppObject
  54. );
  55. BAIL_ON_FAILURE(hr);
  56. break;
  57. case NDS_LOCALITY_ID:
  58. hr = CNDSLocality::CreateLocality(
  59. pADs,
  60. riid,
  61. ppObject
  62. );
  63. BAIL_ON_FAILURE(hr);
  64. break;
  65. case NDS_O_ID:
  66. hr = CNDSOrganization::CreateOrganization(
  67. pADs,
  68. riid,
  69. ppObject
  70. );
  71. BAIL_ON_FAILURE(hr);
  72. break;
  73. case NDS_OU_ID:
  74. hr = CNDSOrganizationUnit::CreateOrganizationUnit(
  75. pADs,
  76. riid,
  77. ppObject
  78. );
  79. BAIL_ON_FAILURE(hr);
  80. break;
  81. case NDS_PRINTER_ID:
  82. hr = CNDSPrintQueue::CreatePrintQueue(
  83. pADs,
  84. riid,
  85. ppObject
  86. );
  87. BAIL_ON_FAILURE(hr);
  88. break;
  89. default:
  90. hr = E_FAIL;
  91. BAIL_ON_FAILURE(hr);
  92. }
  93. error:
  94. if (bstrClassName) {
  95. ADsFreeString(bstrClassName);
  96. }
  97. RRETURN(hr);
  98. }