Remote COM registering

Sample Image

Environment: Windows NT 4 SP3, Visual C++ 5 (and greater)

This sample show how we can register components on a remote machine. For this purpose I build to projects. First it's a COM used on remote machines to receive a component and register it. It can be also used to test if components can be instantiate at that location (so, if they have been succesfully registered). The second project is MFC based and help you to easely register and test components on remote machines.

ATL based component must be registered on remote machines to be used. To be usable it must be configured to run under an account that allow COM registering.

I don't think that any line code is necessarely to be presented because source code is quite simple and commented. Please, fell free to send-me comments. Anyway, here is the IDL source my IRemoteReg interface.

To register a component on a remote machine where you have been previously register RemoteReg server contained in alx.exe you must first instantiate this component on that machine ( from your local machine ). After that you shud call Reset to prepare registration and NewServer to specify server file name and type (.dll, .exe, service). You must send you component using chunks of data. The file will be reconstructed on remote machine in System32 directory. When you call Register this component consider that all data was sent and tries to register component on that machine.

If you want to test if a component was correctly registered on remote machine you can try to instantiate it on that machine in the same way we have been instaintate RemoteReg component.

interface IRemoteReg : IUnknown
{
 // Server type
 typedef enum 
 { 
  ServerType_Dll = 0, 
  ServerType_Exe, 
  ServerType_Service 
 } ServerType;

 const long dwMaxChunkSize = 1024;
		
 // Chunk structure used to transfer data
 typedef struct
 {
  long m_dwSize;
  byte m_pData[1024];
 } Chunk;
		
 [helpstring("Prepare this object for receiving an new server for registering")]
 HRESULT Reset();
 [helpstring("Begins registering of a new server")] 
 HRESULT NewServer([in] BSTR bstrServerName, [in] ServerType nType);
 [helpstring("Register server")] 
 HRESULT Register();
 [helpstring("Append a new chunk to build server on remote machine")] 
 HRESULT AppendChunk([in] Chunk* pChunk);
};

Downloads

Download demo project of my component (RemoteReg_comp.zip) - 52 Kb
Download demo project of my MFC based application (RemoteReg_demo.zip) - 11 Kb
Download source of my ATL based component (RemoteReg_atl_comp.zip) - 19 Kb
Download source of my MFC based application (RemoteReg_mfc_app.zip) - 26 Kb


Comments

  • Registering ActiveX DLLs

    Posted by Legacy on 01/01/2002 12:00am

    Originally posted by: Yami

    How can this be done in VB/VBScript to register ActiveX DLLs on Remote Server, Please Help if you can
    

    Reply
  • How to run DCOMTest on different machine?

    Posted by Legacy on 10/18/2001 12:00am

    Originally posted by: roc

    MSDN provides the "Simple Network OLE Sample", which include two exe files: sserver.exe and sclient.exe. They work well on the same machine. But, when I put them on differen machine, the sserver just says "waiting...", and the client reply CoCreateInstanceEx error. The servre machine is Win2K server, the client server is Win2K server or Win98. I have added the user account and password of the component on server machine using DCOMCNFG.EXE. Is it wrong?
    How to use DCOMCFNG.EXE to make them usable then? Please help me!

    Reply
  • Bad dsw

    Posted by Legacy on 04/10/2000 12:00am

    Originally posted by: Zohar

    You have forgot to include some files in your source code sample. There is a missing project.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Download the Information Governance Survey Benchmark Report to gain insights that can help you further establish business value in your Records and Information Management (RIM) program and across your entire organization. Discover how your peers in the industry are dealing with this evolving information lifecycle management environment and uncover key insights such as: 87% of organizations surveyed have a RIM program in place 8% measure compliance 64% cannot get employees to "let go" of information for …

  • The latest release of SugarCRM's flagship product gives users new tools to build extraordinary customer relationships. Read an in-depth analysis of SugarCRM's enhanced ability to help companies execute their customer-facing initiatives from Ovum, a leading technology research firm.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds