keyongtech


  keyongtech > vc.* > vc.atl > 09/2005

 #1  
09-15-05, 10:08 PM
Ranjit
Hello Group,

i have two questions that i need advise on:

1)
This is the scenario am working on :

I wrote a simple in-process COM server (dll) using the ATL Wizard. I
then intend to register the in-proc server with the default host
surrogate (dllhost.exe) and have it run as a remote server capable of
being invoked from a remote client.

I understand that the CLSID key of my component in the server registry
needs to have an AppID (with the same CLSID value), and also an entry
under the AppID key describing that the process needs to run inside of
a surrogate.

The first time, i wrote, compiled and registered my component by
building my project. I then ran DCOMCnfg which i understood would
insert an AppID attribute and value and also insert a key under the
AppID directory that would let the SCM know that this component has to
be hosted inside a surrogate process.

All that was fine. The moment i recompile my project after making any
changes, for some reason the AppID attribute under the CLSID directory
disappears, although its entry in the AppID directory remains. So when
i run the server, since the SCM does not find the AppID attribute under
the {CLSID} key, it assumes the request is a local one.

I saw the presence of a .rgs file, and tried to write in some code to
enter the AppID attribute under {CLSID} but that would'nt work
either..Heres a snippet of the .rgs script that i have

HKCR
{
Adder.AdderDCOM.1 = s 'AdderDCOM Class'
{
CLSID = s '{E3DA862F-E61C-4CE1-A327-71561C8B95D0}'
}
Adder.AdderDCOM = s 'AdderDCOM Class'
{
CLSID = s '{E3DA862F-E61C-4CE1-A327-71561C8B95D0}'
CurVer = s 'Adder.AdderDCOM.1'
}
NoRemove CLSID
{
ForceRemove {E3DA862F-E61C-4CE1-A327-71561C8B95D0} = s 'AdderDCOM
Class'
{
ProgID = s 'Adder.AdderDCOM.1'
VersionIndependentProgID = s 'Adder.AdderDCOM'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
'TypeLib' = s '{D5724461-C14B-4D7C-B27A-B3D0D8BE912F}'
}
}
}

Could i do something to this script that would add the AppID attribute
during registration? I tried "val AppID = s '{CLSID}'"
does'nt work.

2) Does the group have any recommendations on a free network
monitor/packet sniffer that i could use to debug my DCOM code. Am
interested in looking at the marshalled parameters that are streamed
over the network.

Thanks a lot for any help,
Regards,
Ranjit
 #2  
09-16-05, 02:54 PM
Headache
Don't know what you're trying to do! The AppID key normally appears
immediately under HKEY_CLASSES_ROOT eg. an entry from my machine is the
key:

HKEY_CLASSES_ROOT\AppID\{00020C01-0000-0000-C000-000000000046}

The key has a default value of 'Sound Recorder' so presumably my rgs
file would look something like

HKCR
{
APPID = s'{E3DA862F-E61C-4CE1-A327-71561C8B95D0}'

if anything ie. APPID is not a registry value but a registry key. If
you create your COM server as a service this registering of the APPID
will be produced in your boiler plate code so perhaps that is the best
place to do it - in a In-process COM DLL it would be in
'DllRegisterServer':

inline HRESULT CServiceModule::RegisterServer(BOOL bRegTypeLib, BOOL
bService)
{
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
return hr;

// Adjust the AppID for Local Server or Service
CRegKey keyAppID;
LONG lRes = keyAppID.Open(HKEY_CLASSES_ROOT, _T("AppID"),
KEY_WRITE);
if (lRes != ERROR_SUCCESS)
return lRes;

CRegKey key;
lRes = key.Open(keyAppID,
_T("{34231E4F-0982-4B4F-82A6-CB65342EAA8B}"), KEY_WRITE);
if (lRes != ERROR_SUCCESS)
return lRes;

A very good packet sniffer is 'Ethereal' do a search for it.
Similar Threads
Lost DUA script setting in registry

We have many XPe servers deployed and use DUA to keep our software up to date on them. We specify the script to run via DUA registry setting. When we run a script...

Script to change registry setting in 100 servers

I need to change a regisrty setting in 100 servers and the setting is different for each servers. I have an excel file that has the info and I need to have a script...

XP: Changing a registry setting via script

Hi there, My work computer is automatically configured when I log onto the LAN at work and that's fair enough. But the screen saver is set to 5 minutes which is very...

Execute a registry key into a remote user's registry via a login script

My script works and goes through the process of executing the .reg file, either silently or normally, and executes the .reg file fine, but DOES NOT ADD it to the...

"The specified file is not a registry script. You can import only registry files

Has anyone found a cause/solution to the following error message? "The specified file is not a registry script. You can import only registry files" I'm seeing this on a...


All times are GMT. The time now is 05:16 AM. | Privacy Policy