tags:

views:

21

answers:

1

In the .rgs file, there are some registry info, and I want to know how does the info in .rgs file added into regetry?

I have a project AAA and it will generate the file AAA.DLL, and there is a file xxx.rgs which contains the registry info, and the AAA.DLL is built, then it will be deployed to another machine B, so I don't know how the registy info can be added on machine B, do I need register AAA.dll using regsvr32 command?

A: 

Usually your code calls CComModule::UpdateRegistryFromResource() which in turn passes control to a special mechanism implemented in ATL which does the job - parses the resource that was produced by embedding the .rgs file into the module and edits the registry. ATL comes with sources so you can just read how it is done.

sharptooth
Also it lloks like using ATL is the only intended way to use .rgs files: http://stackoverflow.com/questions/1594283/is-there-a-document-on-rgs-files-syntax
sharptooth
I have a project AAA and it will generate the file AAA.DLL, and there is a file xxx.rgs which contains the registry info, and the AAA.DLL is built, then it will be installed in another machine B, so I am wondering how the registy info added in machine B, do I need register AAA.dll using regsvr32 command?
Carlos_Liu
@Carlos_Liu: Your DLL project will usually have an .rc file that will contain a reference to that .rgs file. When the DLL is compiled the .rgs file contents is emdebbed as a resource. Later you call regsvr32, it loads the DLL, runs `DllRegisterServer()` which in turn calls `CComModule::UpdateRegistryFromResource()`, which loads the .rgs file contents from the resources of that DLL, parses it and modifies the registry.
sharptooth
so on machine B, I need to register it by using regsvr32.exe command, right? Is there any other ways to register that DLL?
Carlos_Liu
regsvr32 is the standard way of registering in-proc COM servers, you hould stick to it unless you have real reasons against it. Do you have real reasons against it?
sharptooth