12

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?

herzbube
  • 13,158
  • 9
  • 45
  • 87
Carlos Liu
  • 2,348
  • 3
  • 37
  • 51

1 Answers1

13

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
  • 167,383
  • 100
  • 513
  • 979
  • 2
    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 Sep 28 '10 at 08:14
  • 2
    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 Sep 28 '10 at 08:29
  • 6
    @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 Sep 28 '10 at 08:46
  • 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 Sep 28 '10 at 08:55
  • 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 Sep 28 '10 at 09:09
  • 1
    You should be able to use Registration-free COM (a.k.a. side-by-side assemblies) to avoid using regsvr32. It's not very well documented though. – Jim Moores Jan 05 '17 at 21:05