Link to home
Start Free TrialLog in
Avatar of zemanek
zemanek

asked on

Server Register Problem

In my DCOM server, during server's registration, I call
function: UpdateRegistryFromResource(IDR_ORVserver, TRUE).
There is no problem on my machine with Windows NT Workstation, but when I try register server on other machine
with Windows 95, function UpdateRegistryFromResource failed.
Return value is 2147746132. I try it also on other machines
with Windows 95 and result is: 1 success and 2 failed.
Where is the problem?

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

      // Remove any previous service since it may point to
      // the incorrect file
      Uninstall();

      // Add service entries
      hr = UpdateRegistryFromResource(IDR_ORVserver, TRUE);
      if (FAILED(hr))
            return hr;

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

      CRegKey key;
      lRes = key.Open(keyAppID, _T("{A8E3E5D4-F6BA-11D1-8F39-006097CA2FEA}"));
      if (lRes != ERROR_SUCCESS)
            return lRes;
      key.DeleteValue(_T("LocalService"));
      
      if (bService)
      {
            key.SetValue(_T("ORVserver"), _T("LocalService"));
            key.SetValue(_T("-Service"), _T("ServiceParameters"));
            // Create service
            Install();
      }

      // Add object entries
      hr = CComModule::RegisterServer(bRegTypeLib);

      CoUninitialize();

      return hr;
}
ASKER CERTIFIED SOLUTION
Avatar of tsollas
tsollas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial