Solved

Server Register Problem

Posted on 1998-10-15
1
753 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now