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

  • The explosion in mobile devices and applications has generated a great deal of interest in APIs. Today's businesses are under increased pressure to make it easy to build apps, supply tools to help developers work more quickly, and deploy operational analytics so they can track users, developers, application performance, and more. Apigee Edge provides comprehensive API delivery tools and both operational and business-level analytics in an integrated platform. It is available as on-premise software or through …

  • Live Event Date: September 17, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Another day, another end-of-support deadline. You've heard enough about the hazards of not migrating to Windows Server 2008 or 2012. What you may not know is that there's plenty in it for you and your business, like increased automation and performance, time-saving technical features, and a lower total cost of ownership. Check out this upcoming eSeminar and join Rich Holmes, Pomeroy's practice director of virtualization, as he discusses the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds