본문 바로가기
VisualStudio.C++.C#/코딩팁,함수활용,단편

COM. Component Object Model. PC 레지스트리에 등록/제거. regsvr32 명령어.

by i.got.it 2016. 7. 30.


 

COM (Component Object Model)

 

주요특징.


 COM 은 인스턴스 생성가능한 object임.

 - C++ 클래스와 기능적으로 동일하나, C++클래스는 소스코드로 존재 COM은 바이너리임.


 COM 은 구조체의 포인터.

 - COM을 활용한 코딩이라 함은 COM 인스턴스(=object, 개체)  생성하면서 구조체의 포인터를 얻고, 포인터를 통해 구조체 멤버에 접근하는것.


 COM 구현형태 :  DLL 혹은 EXE로 형태로 구현된다.

 - OCX확장자로 끝나는 파일 있는데 확장자 이름만 다를뿐 실제 DLL 임.


 서버클라이언트 개념에서 COM 은 서버, COM 을 활용하는 측은 클라이언트. 


COM 의 3가지 타입.  


In-Process COM : 클라이언트 프로그램과 동일 프로세스 내부에서 작동하는것. 이 특징은 일반 DLL 과 완전히 동일한것. 


Out-Process COM : 클라이언트 프로그램 프로세스에 있지 않고, 동일 시스템(컴퓨터)에서 COM 이 별개의 프로세스가 실행되어 서버 기능하는것.  


DCOM : 클라이언트 프로그램이 있는 시스템(컴퓨터) 외부에 있는 COM . DCOM네트워크 프로토톨로 통신함. 

 

 



 

COM의 레지스트리 등록/제거.  regsvr32 

 

COM 을 레지스트리에 등록하는 이유.

 - COM의 CLSID와 COM파일(DLL 혹은 exe 확장자)의 경로 대응정보 저장해두기 위함.

 활용 : COM 활용한 코드에서 COM 인스턴스 생성하기위하여 CoCreateInstacne 함수 호출시 인자로 CLSID전달하면 CLSID에 해당하는 COM 파일이 있는 경로 찾는 처리가 레지스트리 검색하여 처리됨.

 

COM  레지스트리 등록/제거. 

- 관리자 권한으로 커맨드 창 실행하여, COM 파일이 있는 경로에서 아래 구문 실행한다. 


확장자 dll 인 COM인 경우. 


레지스트리에 등록하는 구문. : regsvr32 mycom.dll, 

레지스트리에 기등록된 dll 을 제거하는 구문 : regsvr32 /u mycom.dll


위 실행구문에 의하여 실제 COM 내부적으로 실행되는것 : dll 형식의 COM 의 필수멤버함수인 DLLRegisterServer , DLLUnregisterServer  함수호출됨.



확장자 exe인 COM 인 경우


등록: mycom.exe -regserver,  제거: mycom.exe -UnregServer

 

 


 



 

등록하지 않고 사용하는 COM 

 
보통 COM 은 상기 설명처럼 PC의 레지스트리에 등록하여 사용하나, 레지스트리에 등록하지 않고 대신 개발과정중 매니페스트 파일(xml 형식임 )에서 개체 활성화를 실행시키는 방식도 있다. 

MS제공 설명

등록이 필요 없는 COM interop는 Windows 레지스트리를 사용하여 어셈블리 정보를 저장하지 않고 구성 요소를 활성화합니다.Registration-free COM interop activates a component without using the Windows registry to store assembly information. 배포 중 컴퓨터에 구성 요소를 등록하는 대신 바인딩 및 활성화 정보를 포함하는 Win32 스타일의 매니페스트 파일을 디자인 타임에 만듭니다.Instead of registering a component on a computer during deployment, you create Win32-style manifest files at design time that contain information about binding and activation. 레지스트리 키 대신 이러한 매니페스트 파일에서 개체 활성화를 지시합니다.These manifest files, rather than registry keys, direct the activation of an object.

배포 중에 등록하는 대신 어셈블리에 대해 등록이 필요 없는 활성화를 사용하면 다음 두 가지 이점이 있습니다.Using registration-free activation for your assemblies instead of registering them during deployment offers two advantages:

  • 컴퓨터에 둘 이상의 버전을 설치할 때 활성화되는 DLL 버전을 제어할 수 있습니다.You can control which DLL version is activated when more than one version is installed on a computer.

  • 최종 사용자는 XCOPY 또는 FTP를 사용하여 해당 컴퓨터의 적절한 디렉터리에 응용 프로그램을 복사할 수 있습니다.End users can use XCOPY or FTP to copy your application to an appropriate directory on their computer. 그런 다음 해당 디렉터리에서 응용 프로그램을 실행할 수 있습니다.The application can then be run from that directory.

이 섹션에서는 등록이 필요 없는 COM interop에 필요한 두 가지 매니페스트 유형인 응용 프로그램 및 구성 요소 매니페스트를 설명합니다.This section describes the two types of manifests needed for registration-free COM interop: application and component manifests. 이러한 매니페스트는 XML 파일입니다.These manifests are XML files. 응용 프로그램 개발자가 만드는 응용 프로그램 매니페스트에는 어셈블리와 어셈블리 종속성을 설명하는 메타데이터가 포함됩니다.An application manifest, which is created by an application developer, contains metadata that describes assemblies and assembly dependencies. 구성 요소 개발자가 만드는 구성 요소 매니페스트에는 그러지 않은 경우 Windows 레지스트리에 있는 정보가 포함됩니다.A component manifest, created by a component developer, contains information otherwise located in the Windows registry.


등록이 필요 없는 COM Interop에 대한 요구 사항

  1. 등록이 필요 없는 COM interop에 대한 지원은 라이브러리 어셈블리 형식, 특히 어셈블리가 관리되지 않는지(COM Side-by-side) 또는 관리되는지(.NET 기반)에 따라 약간씩 다릅니다.Support for registration-free COM interop varies slightly depending on the type of library assembly; specifically, whether the assembly is unmanaged (COM side-by-side) or managed (.NET-based). 다음 표에서는 각 어셈블리의 형식에 대한 운영 체제 및 .NET Framework 버전 요구 사항을 보여 줍니다.The following table shows the operating system and .NET Framework version requirements for each assembly type.

    어셈블리 형식Assembly type운영 체제Operating system.NET Framework 버전.NET Framework version
    동시 Side-by-sideCOM side-by-sideMicrosoft Windows XPMicrosoft Windows XP필요하지 않음.Not required.
    .NET 기반.NET-basedWindows XP SP2Windows XP with SP2.NET Framework 버전 1.1 이상NET Framework version 1.1 or later.

    Windows Server 2003 제품군은 .NET 기반 어셈블리에 대해서도 등록이 필요 없는 COM interop를 지원합니다.The Windows Server 2003 family also supports registration-free COM interop for .NET-based assemblies.

    .NET 기반 클래스가 COM의 등록이 필요 없는 활성화와 호환되려면 클래스에 기본 생성자가 있어야 하고 public이어야 합니다.For a .NET-based class to be compatible with registry-free activation from COM, the class must have a default constructor and must be public.

등록이 필요 없는 활성화를 위한 COM 구성 요소 구성

  1. COM 구성 요소가 등록이 필요 없는 활성화에 참여하려면 Side-by-side 어셈블리로 배포되어야 합니다.For a COM component to participate in registration-free activation, it must be deployed as a side-by-side assembly. Side-by-side 어셈블리는 관리되지 않는 어셈블리입니다.Side-by-side assemblies are unmanaged assemblies. 자세한 내용은 Using Side-by-side Assemblies(Side-by-Side 어셈블리 사용)를 참조하세요.For more information, see Using Side-by-side Assemblies.

    COM Side-by-side-어셈블리를 사용하려면 .NET 기반 응용 프로그램 개발자가 바인딩 및 활성화 정보를 포함하는 응용 프로그램 매니페스트를 제공해야 합니다.To use COM side-by-side assemblies, a .NET-based application developer must provide an application manifest, which contains the binding and activation information. 관리되지 않는 Side-by-side 어셈블리에 대한 지원은 Windows XP 운영 체제에 기본 제공됩니다.Support for unmanaged side-by-side assemblies is built into the Windows XP operating system. 운영 체제에서 지원하는 COM 런타임은 활성화되는 구성 요소가 레지스트리에 없는 경우 응용 프로그램 매니페스트에서 활성화 정보를 검색합니다.The COM runtime, supported by the operating system, scans an application manifest for activation information when the component being activated is not in the registry.

    Windows XP에 설치된 COM 구성 요소의 경우 등록이 필요 없는 활성화는 선택 사항입니다.Registration-free activation is optional for COM components installed on Windows XP. Side-by-Side 어셈블리를 응용 프로그램에 추가하는 방법에 대한 자세한 내용은 Using Side-by-side Assemblies(Side-by-Side 어셈블리 사용)를 참조하세요.


 
 


 



///856.

댓글



 

비트코인




암호화폐       외환/나스닥/골드       암호화폐/외환/나스닥/골드 암호화폐/외환/나스닥/골드   암호화폐/외환/나스닥/골드
     
현물 |선물 인버스 |선물 USDT       전략매니저(카피트레이딩)     롤오버 이자 없는 스왑프리계좌
( 스왑프리 암호화폐도 거래 가능 )    
MT4, MT5 , cTrader 모두 지원     FTMO 계좌 매매운용. MT4,MT5