Storing settings of COM-server

Hi there!

I wrote an inprocess-server with ATL. This server is added as a component on a
transaction-server. Remote clients can easily create an instance of this
server and use it.

My problem: The server needs some settings. These settings should be stored on the machine where the transaction-server runs. If I access the registry from the inprocess-server (with CRegKey) I always access the registry of the client-machine!
How can I access the registry of the transaction-server-machine? Is the
registry the right place to store such information?

Greetings
Gottfried
joker1Asked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
Storing the settings in the registry is a good idea - however, if you want to store the settings on the server machine, you'll have to use 'RegConnectRegistry()' first, e.g.:

    CRegKey     cRegKey;
    HKEY        hRemoteHKLM;
    HKEY        hKey;
    LONG        lnResult;

    if  (   ERROR_SUCCESS   !=  (   lnResult    =   RegConnectRegistry  (   "\\\\myserver",
                                                                            HKEY_LOCAL_MACHINE,
                                                                            &hRemoteHKLM
                                                                        )
                                )
        )
        {
            //  error
        }


    cRegKey.Attach  (   hRemoteHKLM);


Feel free to ask if you need more information!
0
 
joker1Author Commented:
I don't know why, but the problem doesn't exist anymore.
If I query settings from the registry I access the right machine. I think I shouldn't work for a long time :-)

However, thanks for your answer.

0
All Courses

From novice to tech pro — start learning today.