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

  • On-demand Event Event Date: October 29, 2014 It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this webcast, Gene Kim discusses these survey findings and shares woeful tales of artifact management gone wrong! Gene also shares examples of how high-performing DevOps …

  • On-demand Event Event Date: December 18, 2014 The Internet of Things (IoT) incorporates physical devices into business processes using predictive analytics. While it relies heavily on existing Internet technologies, it differs by including physical devices, specialized protocols, physical analytics, and a unique partner network. To capture the real business value of IoT, the industry must move beyond customized projects to general patterns and platforms. Check out this webcast and join industry experts as …

Most Popular Programming Stories

More for Developers

RSS Feeds