Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "OpenSCManager" in [All]

Constants

1: SCM
.

Constants for use with the OpenSCManager API call

advapi32

.

To open service you don't need to use Windows API (OpenSCManager() and OpenService()) use field of System.ServiceProcess.ServiceController class (ServiceController.ServiceHandle.DangerousGetHandle())

.

        scHandle = OpenSCManager(null, null, (uint)SCM_ACCESS.SC_MANAGER_ALL_ACCESS);

.

To open service you don't need to use Windows API (OpenSCManager() and OpenService()) use field of System.ServiceProcess.ServiceController class (ServiceController.ServiceHandle.DangerousGetHandle())

.

        scHandle = OpenSCManager(null, null, (uint)SCM_ACCESS.SC_MANAGER_ALL_ACCESS);

.

IntPtr con = Tools.OpenSCManager("\\\\compname", null, (uint)SCM_ACCESS.SC_MANAGER_ALL_ACCESS);

.

         serviceControlManagerHandle = Interop.OpenSCManager (

.

     [DllImport ("advapi32.dll", EntryPoint = "OpenSCManagerW", ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)]

.

     internal static extern IntPtr OpenSCManager (

.

Dim scHandle As IntPtr = OpenSCManager(Nothing, Nothing, SC_MANAGER_ALL_ACCESS)

.

        #region OpenSCManager

.

        [DllImport("advapi32.dll", EntryPoint="OpenSCManagerW", ExactSpelling=true, CharSet=CharSet.Unicode, SetLastError=true)]

.

        static extern IntPtr OpenSCManager( string machineName, string databaseName, SCM_ACCESS dwDesiredAccess );

.

                IntPtr schSCManager = OpenSCManager( null, null, SCM_ACCESS.SC_MANAGER_ALL_ACCESS);

.

SERVICE_STATES, SERVICE_TYPES, ENUM_SERVICE_STATUS, OpenSCManager, EnumServicesStatus, and OpenService

.

IntPtr handle = OpenSCManager( null, null, SCM_ACCESS.SC_MANAGER_ALL_ACCESS );

.

        handle = OpenSCManager(null, null, (int)ServiceControlManagerType.SC_MANAGER_ALL_ACCESS);

.

     serviceControlManager = OpenSCManager(null, null, SC_MANAGER_ALL_ACCESS);

.
Summary
The OpenSCManager function establishes a connection to the service control manager on the specified computer and opens the specified service control manager database.
.

    [DllImport("advapi32.dll", EntryPoint="OpenSCManagerW", ExactSpelling=true, CharSet=CharSet.Unicode, SetLastError=true)]

.

    public static extern IntPtr OpenSCManager(string machineName, string databaseName, uint dwAccess);

.

    Private Shared Function OpenSCManager(ByVal machineName As String, ByVal databaseName As String, ByVal desiredAccess As Int32) As IntPtr

.

    Declare Function OpenSCManager Lib "advapi32.dll" Alias "OpenSCManagerA" (ByVal lpMachineName As String, ByVal lpDatabaseName As String, ByVal dwDesiredAccess As Integer) As Integer

.

    Dim scHandle As IntPtr = OpenSCManager(Nothing, Nothing, SC_MANAGER_ALL_ACCESS )

.

    IntPtr handle = OpenSCManager( null, null, (uint)SCM_ACCESS.SC_MANAGER_ALL_ACCESS );

.
Documentation
[OpenSCManager] on MSDN
.

        IntPtr databaseHandle = OpenSCManager( null, null, SC_MANAGER_ALL_ACCESS );

.

            throw new System.Runtime.InteropServices.ExternalException( "Error OpenSCManager\n" );

.

    public static extern IntPtr OpenSCManager( String lpMachineName, String lpDatabaseName, UInt32 dwDesiredAccess );

.

        IntPtr databaseHandle = OpenSCManager( null, null, SC_MANAGER_ALL_ACCESS );

.

            throw new System.Runtime.InteropServices.ExternalException( "Error OpenSCManager\n" );

.

    public static extern IntPtr OpenSCManager( String lpMachineName, String lpDatabaseName, UInt32 dwDesiredAccess );

.

    Dim hSCManager As IntPtr = New IntPtr(OpenSCManager(Nothing, Nothing, SCMAccess.SC_MANAGER_ALL_ACCESS))

Enums

.

see OpenSCManager


 
Access PInvoke.net directly from VS: