문제

두 개의 COM 서버 DLL을 사용하는 COM 클라이언트 응용 프로그램을 만들었습니다. 이 응용 프로그램이 COM 등록없이 실행되기를 원합니다. 즉 : Winsxs / .manifests

클라이언트 응용 프로그램에서 내 COM 개체의 인스턴스를 만들려고 할 때 (... 거의 예상 ...) "클래스가 등록되지 않았습니다.

나는 이미 그런 종류의 구성을 성공했지만, 이것이 실패한 이유를 알아낼 수는 없습니다.


여기에 몇 가지 세부 사항이 있습니다.

  • 내가 가지고있는 모듈 :
    • 2 개의 COM 서버 (dll1.dll 및 dll2.dll) 에 의존하는 MFC 클라이언트
    • dll1.dll com 서버는 dll2.dll 에 의존합니다.
    • dll2.dll에는 COM 종속성이 없습니다

      가지고있는 COM 객체 :

      • dll1.dll (.idl 언어)

        -

        [
            object,
            uuid(262D00FB-3B9F-4A76-98FC-3051FDCAF0A6),
            dual,
            nonextensible,
            helpstring("IDialogManager Interface"),
            pointer_default(unique)
        ]
        interface IDialogManager : IDispatch{
        };
        [
                uuid(58562535-BCA5-4D04-BB92-78F90EDA201E),
                //...
        ]
        dispinterface _IDialogManagerEvents
        {
        };
        [
                uuid(D599D3F0-A4D1-44A7-87A9-16032CC613CA),
                //...
        ]
        coclass DialogManager
        {
                [default] interface IDialogManager;
                [default, source] dispinterface _IDialogManagerEvents;
        };
        
        .

        -

        • dll2.dll

          -

          [
              object,
              uuid(2A183A2E-A620-4E00-B657-C9D2E59201D4),
              nonextensible,
              helpstring("ICadWizardsManager Interface"),
              pointer_default(unique)
          ]
          interface ICadWizardsManager : IDispatch{
          };
          [
              object,
              uuid(FE97F3FB-8930-43BC-947D-64C90F45A071),
              nonextensible,
              helpstring("ICadWizard Interface"),
              pointer_default(unique)
          ]
          interface ICadWizard : IDispatch{
          };
          [
              uuid(5365D4E6-ADFB-4429-9DEA-C44CC94AA3EF),
          ]
          dispinterface _ICadWizardEvents
          {
          };
          [
              uuid(CAC2D0BF-AD5B-4CC8-A04D-53AB23A0CDF4),
          ]
          coclass CadWizard
          {
              [default] interface ICadWizard;
              [default, source] dispinterface _ICadWizardEvents;
          };
          [
              uuid(3164FAC4-6F5F-4E4D-9B09-DC4115850D78),
          ]
          dispinterface _ICadWizardsManagerEvents
          {
          };
          [
              uuid(707CB6C8-311E-45EC-9DCB-50477F588BAF),
          ]
          coclass CadWizardsManager
          {
              [default] interface ICadWizardsManager;
              [default, source] dispinterface _ICadWizardsManagerEvents;
          };
          
          .

          -

          • 클라이언트 호출

            -

            IDialogManagerPtr dialogManager;
            dialogManager.CreateInstance(CLSID_DialogManager); // <<< returns "Class not registered"
            
            .

            -

            • client.exe.2.manifest

              -

              <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
              <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
              
              <assemblyIdentity name="client" version="1.0.0.0" type="win32" processorArchitecture="x86"/>
              <file name="dll2.dll">
               <comClass
                   clsid="{707CB6C8-311E-45EC-9DCB-50477F588BAF}"
                   threadingModel="apartment">
               </comClass>
               <comClass
                   clsid="{CAC2D0BF-AD5B-4CC8-A04D-53AB23A0CDF4}"
                   threadingModel="apartment">
               </comClass>
              </file>
              
              <file name="dll1.dll">
               <comClass
                   clsid="{D599D3F0-A4D1-44A7-87A9-16032CC613CA}"
                   threadingModel="apartment">
               </comClass>
              </file>
              
              </assembly>
              
              .

              -


              SXS 활성화 컨텍스트 생성 중에는 오류가 없습니다. - Windows 로그에서 오류가 없음 (My Manifest 구문이 올바른 것을 의미합니다) - SxStrace에서 탐지 된 오류가 없었습니다 (로그는 "정보 : 활성화 컨텍스트 생성이 성공했습니다."메시지 및 오류 또는 sucpicious 메시지가 없습니다. 또한 내 매니페스트가 올바르게로드 된 것을 알 수 있습니다.

              모든 아이디어?

              SXSstrace를 사용하여 SXS를 더 깊게 디버깅하는 방법이 있습니까? 인스턴스에 대해 실제로 등록 된 COM 또는 CLR 클래스 목록을 가져 오는 것은 ???

              Advance님께 서 고맙습니다

도움이 되었습니까?

해결책

There are usually - at least - two manifests involved when building the activation context for registration free COM.

There is the EXE manifest, that specifies its dependent assemblies, including the assembly containing the COM components, and there is the assembly manifest, describing the dll's, window classes, and COM objects in the assembly.

This Blog contains information about what the .2 means. Basically, when the system looks for a manifest, it looks for modulename.exe[.resid].manifest - In the case that resid is 1, it is omitted.

So, you are using MFC, which means DevStudio, which means that your project should already be configured to produce a RT_MANIFEST resource automatically with the c-runtime and common control 6 settings in it.

Visual Studio 2005 supports this syntax to merge dependentAssembly elements with your applications manifest without having to try and merge XML directly:

#pragma comment(linker, \
    "\"/manifestdependency:type='Win32' "\
    "name='client' "\
    "version='1.0.0.0' "\
    "processorArchitecture='*' "\
    "language='*'\"")

So, if you add that to a cpp or header in your .exe, and then save your client.exe.2.manifest as "client.manifest", you should be all systems go.

다른 팁

The simple explanation is that the .manifest file isn't being used. Which is highly likely in this scenario, your .exe almost certainly already contains a manifest, embedded as a resource. Very common for a MFC app to enable visual styles. And for code compiled by the VS2005 or 2008 compilers which embeds a manifest to find the runtime DLLs.

To verify this, use File + Open + File and select the compiled .exe file. Look for the RT_MANIFEST node. If Windows finds such an embedded manifest it isn't going to continue looking for a file-based one. You need to merge your regfree COM entries into the embedded one. I wish I could give you a good MSDN Library link but the docs about manifests suck serious rock.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top