Solved

Server Register Problem

Posted on 1998-10-15
1
755 Views
Last Modified: 2012-06-27
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;
}
0
Comment
Question by:zemanek
1 Comment
 

Accepted Solution

by:
tsollas earned 200 total points
ID: 1175235
This will sound silly, but UpdateRegistryFromResourceID() uses the ATL registrar which is a COM interface implemented in ATL.DLL.  The error you're getting indicates that that interface is probably not registered.  So, you'll want to check if ATL.DLL is installed and registered on the 95 machines that it failed on.  You should also check to make sure those 95 machines have DCOM95 installed as well.

You can do that, or statically link to the registrar code. Define DECLARE_REGISTRY_RESOURCEID in your object's declaration, and at the top of stdafx.h, add #define _ATL_STATIC_REGISTRY (this is from the VC/ATL docs).
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question