Solved

Server Register Problem

Posted on 1998-10-15
1
762 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

728 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