CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old August 3rd, 2005, 11:04 AM
    Archimedes Archimedes is offline
    Junior Member
     
    Join Date: Aug 2001
    Posts: 13
    Archimedes is on a distinguished road (10+)
    Exclamation Service Controller Permissions

    I need some help understanding and implementing Service Controller Permissions. The problem I have is, I have a service running, and want to connect to it remotely with a service controller. I can get browse permission for it - i.e. can tell whether or not its running - but do not get control permission. I read MSDN about ServiceControllerPermission class, but it left me more confused. I am not sure how to use it (if I need to) in conjunction with the ServiceController. I created a new ServiceControllerPermission object and used Assert which didn't fail, but I still dont get control!? Incidentally I have Administrative access on both the home and target machine, we're on a domain of which I am a Domain Administrator, and of course it all works fine when I try to control the service on my own machine. There was a lot about Assembly signing, etc., is this a problem of the calling program, the service.... ?

    Code:
    ServiceControllerPermission *SPE = new ServiceControllerPermission( ServiceControllerPermissionAccess::Control, ComputerName, "EMPIWinService" );
        
        try
        {
            SPE->Assert();
            ServiceController *empiController = new ServiceController("EMPIWinService", ComputerName);
            
            if (!(empiController->get_CanStop()) && (empiController->Status == (ServiceControllerStatus::Stopped)) )
            {
    ...
                empiController->Start();  <-- throws exception here
    ...
    Any help is appreciated
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 06:43 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009