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.

37 lines
1.1 KiB

  1. // RegObj.h : Declaration of the CRegObject
  2. /////////////////////////////////////////////////////////////////////////////
  3. // register
  4. class ATL_NO_VTABLE CDLLRegObject : public CRegObject, public CComObjectRoot,
  5. public CComCoClass<CDLLRegObject, &CLSID_Registrar>
  6. {
  7. public:
  8. CDLLRegObject() {}
  9. ~CDLLRegObject(){CRegObject::ClearReplacements();}
  10. BEGIN_COM_MAP(CDLLRegObject)
  11. COM_INTERFACE_ENTRY(IRegistrar)
  12. END_COM_MAP()
  13. DECLARE_NOT_AGGREGATABLE(CDLLRegObject)
  14. HRESULT FinalConstruct()
  15. {
  16. return CComObjectRoot::FinalConstruct();
  17. }
  18. void FinalRelease()
  19. {
  20. CComObjectRoot::FinalRelease();
  21. }
  22. //we can't use the component because that's what we're registering
  23. //we don't want to do the static registry because we'd have extra code
  24. static HRESULT WINAPI UpdateRegistry(BOOL bRegister)
  25. {
  26. CComObject<CDLLRegObject>* p;
  27. CComObject<CDLLRegObject>::CreateInstance(&p);
  28. CComPtr<IRegistrar> pR;
  29. p->QueryInterface(IID_IRegistrar, (void**)&pR);
  30. return AtlModuleUpdateRegistryFromResourceD(&_Module,
  31. (LPCOLESTR)MAKEINTRESOURCE(IDR_Registrar), bRegister, NULL, pR);
  32. }
  33. };