LockServiceDatabase (advapi32)
Last changed: cj_hand@hotmail.com-131.107.0.87

.
Summary
TODO - a short description

C# Signature:

[DllImport("advapi32.dll", SetLastError=true)]
public static extern IntPtr LockServiceDatabase(IntPtr hSCManager);

VB Signature:

Declare Function LockServiceDatabase Lib "advapi32.dll" (TODO) As TODO

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    [DllImport("advapi32.dll", SetLastError=true, CharSet = CharSet.Auto)]
    public static extern IntPtr LockServiceDatabase(IntPtr hSCManager);

     serviceControlManager = OpenSCManager(null, null, SC_MANAGER_ALL_ACCESS);
     if (IntPtr.Zero == serviceControlManager)
     {
        throw new Exception("Failed to open Service Control Manager");
     }

     serviceDbLock = LockServiceDatabase(serviceControlManager);
     if (IntPtr.Zero == serviceDbLock)
     {
        throw new Exception("Failed to lock the Service Control Manager");
     }

Alternative Managed API:

Do you know one? Please contribute it!

Documentation