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.

66 lines
1.3 KiB

  1. // Copyright (c) 1999-2001 Microsoft Corporation, All Rights Reserved
  2. // MainDll.cpp
  3. #include "precomp.h"
  4. #include <iostream.h>
  5. #include <objbase.h>
  6. #include "CUnknown.h"
  7. #include "factory.h"
  8. /*****************************************************************************/
  9. // Exported functions
  10. /*****************************************************************************/
  11. //
  12. // Can DLL unload now?
  13. //
  14. STDAPI DllCanUnloadNow()
  15. {
  16. return CFactory::CanUnloadNow() ;
  17. }
  18. //
  19. // Get class factory
  20. //
  21. STDAPI DllGetClassObject(const CLSID& clsid,
  22. const IID& iid,
  23. void** ppv)
  24. {
  25. return CFactory::GetClassObject(clsid, iid, ppv) ;
  26. }
  27. //
  28. // Server registration
  29. //
  30. STDAPI DllRegisterServer()
  31. {
  32. return CFactory::RegisterAll() ;
  33. }
  34. //
  35. // Server unregistration
  36. //
  37. STDAPI DllUnregisterServer()
  38. {
  39. return CFactory::UnregisterAll() ;
  40. }
  41. ///////////////////////////////////////////////////////////
  42. //
  43. // DLL module information
  44. //
  45. BOOL APIENTRY DllMain(HANDLE hModule,
  46. DWORD dwReason,
  47. void* lpReserved)
  48. {
  49. if (dwReason == DLL_PROCESS_ATTACH)
  50. {
  51. CFactory::s_hModule = static_cast<HMODULE>(hModule) ;
  52. DisableThreadLibraryCalls(CFactory::s_hModule); // 158024
  53. }
  54. return TRUE ;
  55. }