Remote call to OpenSCManager fails.

Posted on 2005-04-25
Last Modified: 2013-12-03
Hello Experts.

I am trying to install service on remote NT4 machine and
connect to this service.

The program, xCmd, connects to NT4, authenticates as Administrator, drops
service into WinNT\System32 folder and tries to install it.
The piece of code which fails is:

   SC_HANDLE hSCM = ::OpenSCManager( lpszMachine, NULL, SC_MANAGER_ALL_ACCESS);
   if (hSCM == NULL) {
       StdOutput( " OpenSCManage failed ..." );
      return FALSE;

The exception handling code:
gives message: "This funciton is only valid in Win32 mode."

The full source code is here:

I've recompiled this code in VC6++ and connect to NT4 from Windows 98 using command:
xCmd.exe  \\NTMachine /user:Administrator /pwd:xxxxxxx cmd

Why code fails?

Thank you.

Question by:beaverton8770
    1 Comment
    LVL 86

    Accepted Solution

    >>connect to NT4 from Windows 98

    Win9x does not implement the SCM functions/APIs at all, neither locally nor remotely, that's what this approach is bound to fail.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
    zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    760 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

    13 Experts available now in Live!

    Get 1:1 Help Now