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.

58 lines
1.4 KiB

  1. #include "stdinc.h"
  2. ATL::_ATL_OBJMAP_ENTRY* GetObjectMap();
  3. const CLSID* GetTypeLibraryId();
  4. extern "C"
  5. BOOL WINAPI _DllMainCRTStartup(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved);
  6. extern "C"
  7. BOOL WINAPI SxApwDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
  8. {
  9. BOOL fSuccess = FALSE;
  10. if (!_DllMainCRTStartup(hInstance, dwReason, lpReserved))
  11. goto Exit;
  12. switch (dwReason)
  13. {
  14. default:
  15. break;
  16. case DLL_PROCESS_ATTACH:
  17. GetModule()->Init(GetObjectMap(), hInstance, GetTypeLibraryId());
  18. DisableThreadLibraryCalls(hInstance);
  19. break;
  20. case DLL_PROCESS_DETACH:
  21. GetModule()->Term();
  22. break;
  23. }
  24. fSuccess = TRUE;
  25. Exit:
  26. return fSuccess;
  27. }
  28. STDAPI DllCanUnloadNow(void)
  29. {
  30. return (GetModule()->GetLockCount()==0) ? S_OK : S_FALSE;
  31. }
  32. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  33. {
  34. const CLSID* pclsid = &rclsid;
  35. if (rclsid == GUID_NULL)
  36. { // this is a category bind to a .dll path, take the first clsid
  37. pclsid = GetObjectMap()->pclsid;
  38. }
  39. return GetModule()->GetClassObject(*pclsid, riid, ppv);
  40. }
  41. STDAPI DllRegisterServer(void)
  42. {
  43. // registers object, typelib and all interfaces in typelib
  44. //return GetModule()->RegisterServer(TRUE);
  45. return S_OK;
  46. }
  47. STDAPI DllUnregisterServer(void)
  48. {
  49. //return GetModule()->UnregisterServer(TRUE);
  50. return S_OK;
  51. }