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 "Service" in [All]

ole32

.

FILETIME, which is defined in [System.Runtime.InteropServices] or [System.Runtime.InteropServices.ComTypes] in the .NET Framework 2.0.

.

FILETIME, which is defined in [System.Runtime.InteropServices] or [System.Runtime.InteropServices.ComTypes] in the .NET Framework 2.0.

.

[System.Runtime.InteropServices.DllImport("ole32.dll")]

.

   cAuthSvc As Integer, asAuthSvc() As SOLE_AUTHENTICATION_SERVICE, _

.

SOLE_AUTHENTICATION_SERVICE

.

[System.Runtime.InteropServices.DllImport("ole32.dll")]

.

   cAuthSvc As Integer, asAuthSvc() As SOLE_AUTHENTICATION_SERVICE, _

.

SOLE_AUTHENTICATION_SERVICE

.

Please look at http://msdn2.microsoft.com/en-us/library/aa302389.aspx#secnetch09_callingservicedcompaspnet, which shows how to call CoSetProxyBlanket in C#. As this is published on the MS Patterns and Practices web site I would assume this would be OK and is safe. This reference has code and discusses the issues about transition from .net object to COM IUnknown reference using the Marshal functions.

.

Please see http://msdn2.microsoft.com/en-us/library/aa302389.aspx#secnetch09_callingservicedcompaspnet

.

Marshal.FreeCoTaskMem http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.freecotaskmem.aspx

.

static extern int CoUnmarshalInterface(System.Runtime.InteropServices.ComTypes.IStream pStm, [In] ref Guid riid,

.

The managed definition for the IMoniker interface is available in System.Runtime.InteropServices.ComTypes

.

As of .NET 2.0, UCOMIMoniker is obsolete and has been replaced with System.Runtime.InteropServices.ComTypes.IMoniker. This extends to all interfaces of the System.Runtime.InteropServices namespace starting with "UCOM...". Each of them are replaced in the System.Runtime.InteropServices.ComTypes namespace, with same name, except for the "UCOM" at the beginning.

.

   out System.Runtime.InteropServices.ComTypes.IMoniker ppmk);

.

For .Net 2.0, use System.Runtime.InteropServices.ComTypes.IMoniker as the final parameter; frameworks 1.0 and 1.1 use System.Runtime.InteropServices.UCOMIMoniker.

.

As of .NET 2.0, UCOMIMoniker is obsolete and has been replaced with System.Runtime.InteropServices.ComTypes.IMoniker. This extends to all interfaces of the System.Runtime.InteropServices namespace starting with "UCOM...". Each of them are replaced in the System.Runtime.InteropServices.ComTypes namespace, with same name, except for the "UCOM" at the beginning.

.

   punk, out System.Runtime.InteropServices.ComTypes.IMoniker ppmk);

.

       [System.Runtime.InteropServices.DllImport("OLE32.DLL", EntryPoint = "CreateStreamOnHGlobal")] // Create a COM stream from a pointer in unmanaged memory

.

    extern public static int CreateStreamOnHGlobal(IntPtr ptr, bool delete, out System.Runtime.InteropServices.ComTypes.IStream pOutStm);

.

    [System.Runtime.InteropServices.DllImport("OLE32.DLL", EntryPoint = "GetHGlobalFromStream")]

.

       out System.Runtime.InteropServices.ComTypes.IRunningObjectTable pprot);

.

In .Net 2.0 use System.Runtime.InteropServices.ComTypes.IRunningObjectTabl as the second parameter. Frameworks 1.0 and 1.1 use a now deprecated type.

.

     System.Runtime.InteropServices.ComTypes.IRunningObjectTable objTbl;

. .

I find it better to turn off [PreserveSig] for methods that return an HRESULT and have a trailing out parameter, providing that the HRESULT does not have more that one success code (typically S_OK only). This results in a slightly cleaner syntax where the out parameter becomes the return value and a failing HRESULT results in an exception.

.

using System.Runtime.InteropServices;

. .

I find it better to turn off [PreserveSig] for methods that return an HRESULT and have a trailing out parameter, providing that the HRESULT does not have more that one success code (typically S_OK only). This results in a slightly cleaner syntax where the out parameter becomes the return value and a failing HRESULT results in an exception.

.

static extern int OleLoadFromStream(System.Runtime.InteropServices.ComTypes.IStream pStm,

.

static extern int OleLoadFromStream(System.Runtime.InteropServices.ComTypes.IStream pStm,

.

      [System.Runtime.InteropServices.DllImport("OLE32.DLL", EntryPoint = "CreateStreamOnHGlobal")]

.

    extern public static int CreateStreamOnHGlobal(IntPtr ptr, bool delete, out System.Runtime.InteropServices.ComTypes.IStream pOutStm);

.

        System.Runtime.InteropServices.ComTypes.STATSTG fileinfo;

.

    [System.Runtime.InteropServices.DllImport("OLE32.DLL", EntryPoint = "CreateStreamOnHGlobal")]

.

    extern public static int CreateStreamOnHGlobal(IntPtr ptr, bool delete, out System.Runtime.InteropServices.ComTypes.IStream pOutStm);

.

        System.Runtime.InteropServices.ComTypes.STATSTG fileinfo;

.

Public Shared Function OleSetClipboard(ByVal pDataObj As System.Runtime.InteropServices.ComTypes.IDataObject) As Int32

. .

I find it better to turn off [PreserveSig] for methods that return an HRESULT and have a trailing out parameter, providing that the HRESULT does not have more that one success code (typically S_OK only). This results in a slightly cleaner syntax where the out parameter becomes the return value and a failing HRESULT results in an exception.

gsapi

.

using System.Runtime.InteropServices;

Constants

.

    public static readonly Guid GUID_DEVCLASS_NETSERVICE = new Guid("{0x4d36e974, 0xe325, 0x11ce, {0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18}}");

.
Summary
28: NERR_
.

        /// <summary> 2114 - The Server service is not started. </summary>

.

        /// <summary> 2122 - The Peer service supports only two simultaneous users. </summary>

.

        /// <summary> 2137 - The Workstation service is in an inconsistent state. Restart the computer before restarting the Workstation service. </summary>

.

        /// <summary> 2138 - The Workstation service has not been started. </summary>

.

        /// <summary> 2180 - The service database is locked. </summary>

.

        public const int ServiceTableLocked = 2180;

.

        /// <summary> 2181 - The service table is full. </summary>

.

        public const int ServiceTableFull = 2181;

.

        /// <summary> 2182 - The requested service has already been started. </summary>

.

        public const int ServiceInstalled = 2182;

.

        /// <summary> 2183 - The service does not respond to control actions. </summary>

.

        public const int ServiceEntryLocked = 2183;

.

        /// <summary> 2184 - The service has not been started. </summary>

.

        public const int ServiceNotInstalled = 2184;

.

        /// <summary> 2185 - The service name is invalid. </summary>

.

        public const int BadServiceName = 2185;

.

        /// <summary> 2186 - The service is not responding to the control function. </summary>

.

        public const int ServiceCtlTimeout = 2186;

.

        /// <summary> 2187 - The service control is busy. </summary>

.

        public const int ServiceCtlBusy = 2187;

.

        /// <summary> 2188 - The configuration file contains an invalid service program name. </summary>

.

        public const int BadServiceProgName = 2188;

.

        /// <summary> 2189 - The service could not be controlled in its present state. </summary>

.

        public const int ServiceNotCtrl = 2189;

.

        /// <summary> 2190 - The service ended abnormally. </summary>

.

        public const int ServiceKillProc = 2190;

.

        /// <summary> 2191 - The requested pause or stop is not valid for this service. </summary>

.

        public const int ServiceCtlNotValid = 2191;

.

        /// <summary> 2192 - The service control dispatcher could not find the service name in the dispatch table. </summary>

.

        /// <summary> 2193 - The service control dispatcher pipe read failed. </summary>

.

        /// <summary> 2194 - A thread for the new service could not be created. </summary>

.

        public const int ServiceNotStarting = 2194;

.

        /// <summary> 2271 - The Messenger service is already started. </summary>

.

        /// <summary> 2272 - The Messenger service failed to start. </summary>

.

        /// <summary> 2281 - The message was sent, but the recipient has paused the Messenger service. </summary>

.

        /// <summary> 2284 - The Messenger service has not been started. </summary>

.

        /// <summary> 2451 - This operation is not permitted when the Netlogon service is running. </summary>

.

        /// <summary> 2455 - The Netlogon service has not been started. </summary>

.

        /// <summary> 2480 - The UPS driver could not be accessed by the UPS service. </summary>

.

        /// <summary> 2481 - The UPS service is not configured correctly. </summary>

.

        /// <summary> 2482 - The UPS service could not access the specified Comm Port. </summary>

.

        /// <summary> 2483 - The UPS indicated a line fail or low battery situation. Service not started. </summary>

.

        /// <summary> 2484 - The UPS service failed to perform a system shut down. </summary>

.

        /// <summary> 2517 - Remote boot service was stopped; check the error log for the cause of the problem. </summary>

.

        public const int RplBootServiceTerm = 2517;

.

        /// <summary> 2550 - The browser service was configured with MaintainServerList=No. </summary>

.

        /// <summary> 2610 - Service failed to start since none of the network adapters started with this service. </summary>

.

        /// <summary> 2611 - Service failed to start due to bad startup information in the registry. </summary>

.

        /// <summary> 2612 - Service failed to start because its database is absent or corrupt. </summary>

.

        /// <summary> 2613 - Service failed to start because RPLFILES share is absent. </summary>

.

        /// <summary> 2614 - Service failed to start because RPLUSER group is absent. </summary>

.

        /// <summary> 2615 - Cannot enumerate service records. </summary>

.

        /// <summary> 2626 - An internal service error has occurred. </summary>

.

        /// <summary> 2636 - Service failed to backup Remoteboot database. </summary>

.

        /// <summary> 2660 - The internal database maintained by the Dfs service is corrupt. </summary>

.

        public const int DfsDuplicateService = 2676;

.

        /// <summary> 2679 - The internal state of the Dfs Service has become inconsistent. </summary>

.

        /// <summary> 2680 - The Dfs Service has been installed on the specified server. </summary>

.

    public static PropertyKey PKEY_Device_Service = new PropertyKey(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 6);     // DEVPROP_TYPE_STRING

.

    public static PropertyKey PKEY_DeviceClass_DefaultService = new PropertyKey(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 11); // DEVPROP_TYPE_STRING

.

    public static PropertyKey PKEY_PNPX_ServiceAddress = new PropertyKey(0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00004000);   // VT_LPWSTR | VT_VECTOR

.

    public static PropertyKey PKEY_PNPX_ServiceId = new PropertyKey(0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00004001);   // VT_LPWSTR

.

    public static PropertyKey PKEY_PNPX_ServiceTypes = new PropertyKey(0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00004002);   // VT_LPWSTR | VT_VECTOR

.

    public static PropertyKey WPD_CLIENT_SECURITY_QUALITY_OF_SERVICE = new PropertyKey(0x204D9F0C, 0x2292, 0x4080, 0x9F, 0x42, 0x40, 0x66, 0x4E, 0x70, 0xF8, 0x59, 8);

.

    public static PropertyKey WPD_SERVICE_VERSION = new PropertyKey(0x7510698A, 0xCB54, 0x481C, 0xB8, 0xDB, 0x0D, 0x75, 0xC9, 0x3F, 0x1C, 0x06, 2);

.

    public static PropertyKey WPD_EVENT_PARAMETER_SERVICE_METHOD_CONTEXT = new PropertyKey(0x52807B8A, 0x4914, 0x4323, 0x9B, 0x9A, 0x74, 0xF6, 0x54, 0xB2, 0xB8, 0x46, 2);

.

    public static PropertyKey WPD_COMMAND_CLASS_EXTENSION_REGISTER_SERVICE_INTERFACES = new PropertyKey(0x7F0779B5, 0xFA2B, 0x4766, 0x9C, 0xB2, 0xF7, 0x3B, 0xA3, 0x0B, 0x67, 0x58, 2);

.

    public static PropertyKey WPD_COMMAND_CLASS_EXTENSION_UNREGISTER_SERVICE_INTERFACES = new PropertyKey(0x7F0779B5, 0xFA2B, 0x4766, 0x9C, 0xB2, 0xF7, 0x3B, 0xA3, 0x0B, 0x67, 0x58, 3);

.

    public static PropertyKey WPD_PROPERTY_CLASS_EXTENSION_SERVICE_OBJECT_ID = new PropertyKey(0x7F0779B5, 0xFA2B, 0x4766, 0x9C, 0xB2, 0xF7, 0x3B, 0xA3, 0x0B, 0x67, 0x58, 1001);

.

    public static PropertyKey WPD_PROPERTY_CLASS_EXTENSION_SERVICE_INTERFACES = new PropertyKey(0x7F0779B5, 0xFA2B, 0x4766, 0x9C, 0xB2, 0xF7, 0x3B, 0xA3, 0x0B, 0x67, 0x58, 1002);

.

    public static PropertyKey WPD_PROPERTY_CLASS_EXTENSION_SERVICE_REGISTRATION_RESULTS = new PropertyKey(0x7F0779B5, 0xFA2B, 0x4766, 0x9C, 0xB2, 0xF7, 0x3B, 0xA3, 0x0B, 0x67, 0x58, 1003);

.

    public static PropertyKey WPD_COMMAND_SERVICE_COMMON_GET_SERVICE_OBJECT_ID = new PropertyKey(0x322F071D, 0x36EF, 0x477F, 0xB4, 0xB5, 0x6F, 0x52, 0xD7, 0x34, 0xBA, 0xEE, 2);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_OBJECT_ID = new PropertyKey(0x322F071D, 0x36EF, 0x477F, 0xB4, 0xB5, 0x6F, 0x52, 0xD7, 0x34, 0xBA, 0xEE, 1001);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_METHODS = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 2);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_METHODS_BY_FORMAT = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 3);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_METHOD_ATTRIBUTES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 4);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_METHOD_PARAMETER_ATTRIBUTES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 5);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_FORMATS = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 6);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_ATTRIBUTES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 7);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_FORMAT_PROPERTIES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 8);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_PROPERTY_ATTRIBUTES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 9);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_EVENTS = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 10);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_EVENT_ATTRIBUTES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 11);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_EVENT_PARAMETER_ATTRIBUTES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 12);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_INHERITED_SERVICES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 13);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_RENDERING_PROFILES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 14);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_COMMANDS = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 15);

.

    public static PropertyKey WPD_COMMAND_SERVICE_CAPABILITIES_GET_COMMAND_OPTIONS = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 16);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_METHODS = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1001);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1002);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_METHOD = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1003);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_METHOD_ATTRIBUTES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1004);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1005);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER_ATTRIBUTES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1006);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_FORMATS = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1007);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT_ATTRIBUTES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1008);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_PROPERTY_KEYS = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1009);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_PROPERTY_ATTRIBUTES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1010);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_EVENTS = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1011);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_EVENT = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1012);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_EVENT_ATTRIBUTES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1013);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_INHERITANCE_TYPE = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1014);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_INHERITED_SERVICES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1015);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_RENDERING_PROFILES = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1016);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_COMMANDS = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1017);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_COMMAND = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1018);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_CAPABILITIES_COMMAND_OPTIONS = new PropertyKey(0x24457E74, 0x2E9F, 0x44F9, 0x8C, 0x57, 0x1D, 0x1B, 0xCB, 0x17, 0x0B, 0x89, 1019);

.

    public static PropertyKey WPD_COMMAND_SERVICE_METHODS_START_INVOKE = new PropertyKey(0x2D521CA8, 0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC, 2);

.

    public static PropertyKey WPD_COMMAND_SERVICE_METHODS_CANCEL_INVOKE = new PropertyKey(0x2D521CA8, 0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC, 3);

.

    public static PropertyKey WPD_COMMAND_SERVICE_METHODS_END_INVOKE = new PropertyKey(0x2D521CA8, 0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC, 4);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_METHOD = new PropertyKey(0x2D521CA8, 0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC, 1001);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_METHOD_PARAMETER_VALUES = new PropertyKey(0x2D521CA8, 0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC, 1002);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_METHOD_RESULT_VALUES = new PropertyKey(0x2D521CA8, 0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC, 1003);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_METHOD_CONTEXT = new PropertyKey(0x2D521CA8, 0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC, 1004);

.

    public static PropertyKey WPD_PROPERTY_SERVICE_METHOD_HRESULT = new PropertyKey(0x2D521CA8, 0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC, 1005);

.

    WebServices = 4,

30: ras
.
Summary
Constants used by RAS (Remote Access Services)
31: SCM
.

    Const SC_MANAGER_CREATE_SERVICE As Int32 = &H2

.

    Const SC_MANAGER_ENUMERATE_SERVICE As Int32 = &H4

.

                        SC_MANAGER_CREATE_SERVICE Or _

.

                        SC_MANAGER_ENUMERATE_SERVICE Or _

.

using System.Runtime.InteropServices;

.

private const int SERVICE_AUTO_START = 0x2;

.

private const int SERVICE_DEMAND_START = 0x3;

.

private const int SERVICE_DISABLED = 0x4;

.

private const int SERVICE_ERROR_NORMAL = 0x1;

.

private const int SERVICE_WIN32_OWN_PROCESS = 0x10;

.

private const int SERVICE_QUERY_CONFIG = 0x1;

.

private const int SERVICE_CHANGE_CONFIG = 0x2;

.

private const int SERVICE_QUERY_STATUS = 0x4;

.

private const int SERVICE_ENUMERATE_DEPENDENTS = 0x8;

.

private const int SERVICE_START = 0x10;

.

private const int SERVICE_STOP = 0x20;

.

private const int SERVICE_PAUSE_CONTINUE = 0x40;

.

private const int SERVICE_INTERROGATE = 0x80;

.

private const int SERVICE_USER_DEFINED_CONTROL = 0x100;

.

private const int SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED |

.

    SERVICE_QUERY_CONFIG |

.

    SERVICE_CHANGE_CONFIG |

.

    SERVICE_QUERY_STATUS |

.

    SERVICE_ENUMERATE_DEPENDENTS |

.

    SERVICE_START |

.

    SERVICE_STOP |

.

    SERVICE_PAUSE_CONTINUE |

.

    SERVICE_INTERROGATE |

.

    SERVICE_USER_DEFINED_CONTROL;

.

Const SERVICE_AUTO_START As Int32 = &H2

.

Const SERVICE_DEMAND_START As Int32 = &H3

.

Const SERVICE_DISABLED As Int32 = &H4

.

Const SERVICE_ERROR_NORMAL As Int32 = &H1

.

Const SERVICE_WIN32_OWN_PROCESS As Int32 = &H10

.

Const SERVICE_QUERY_CONFIG As Int32 = &H1

.

Const SERVICE_CHANGE_CONFIG As Int32 = &H2

.

Const SERVICE_QUERY_STATUS As Int32 = &H4

.

Const SERVICE_ENUMERATE_DEPENDENTS As Int32 = &H8

.

Const SERVICE_START As Int32 = &H10

.

Const SERVICE_STOP As Int32 = &H20

.

Const SERVICE_PAUSE_CONTINUE As Int32 = &H40

.

Const SERVICE_INTERROGATE As Int32 = &H80

.

Const SERVICE_USER_DEFINED_CONTROL As Int32 = &H100

.

Const SERVICE_ALL_ACCESS As Integer = STANDARD_RIGHTS_REQUIRED Or _

.

                    SERVICE_QUERY_CONFIG Or _

.

                    SERVICE_CHANGE_CONFIG Or _

.

                    SERVICE_QUERY_STATUS Or _

.

                    SERVICE_ENUMERATE_DEPENDENTS Or _

.

                    SERVICE_START Or _

.

                    SERVICE_STOP Or _

.

                    SERVICE_PAUSE_CONTINUE Or _

.

                    SERVICE_INTERROGATE Or _

.

                    SERVICE_USER_DEFINED_CONTROL

.

For use with the CreateService API call in ADVAPI32.DLL

.

using System.Runtime.InteropServices;

.

        /// A stop control has been sent to a service that other running services are dependent on.

.

        public const int ERROR_DEPENDENT_SERVICES_RUNNING = 1051;

.

        /// The requested control is not valid for this service.

.

        public const int ERROR_INVALID_SERVICE_CONTROL = 1052;

.

        /// The service did not respond to the start or control request in a timely fashion.

.

        public const int ERROR_SERVICE_REQUEST_TIMEOUT = 1053;

.

        /// A thread could not be created for the service.

.

        public const int ERROR_SERVICE_NO_THREAD = 1054;

.

        /// The service database is locked.

.

        public const int ERROR_SERVICE_DATABASE_LOCKED = 1055;

.

        /// An instance of the service is already running.

.

        public const int ERROR_SERVICE_ALREADY_RUNNING = 1056;

.

        public const int ERROR_INVALID_SERVICE_ACCOUNT = 1057;

.

        /// The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

.

        public const int ERROR_SERVICE_DISABLED = 1058;

.

        /// Circular service dependency was specified.

.

        /// The specified service does not exist as an installed service.

.

        public const int ERROR_SERVICE_DOES_NOT_EXIST = 1060;

.

        /// The service cannot accept control messages at this time.

.

        public const int ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061;

.

        /// The service has not been started.

.

        public const int ERROR_SERVICE_NOT_ACTIVE = 1062;

.

        /// The service process could not connect to the service controller.

.

        public const int ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063;

.

        /// An exception occurred in the service when handling the control request.

.

        public const int ERROR_EXCEPTION_IN_SERVICE = 1064;

.

        /// The service has returned a service-specific error code.

.

        public const int ERROR_SERVICE_SPECIFIC_ERROR = 1066;

.

        /// The dependency service or group failed to start.

.

        public const int ERROR_SERVICE_DEPENDENCY_FAIL = 1068;

.

        /// The service did not start due to a logon failure.

.

        public const int ERROR_SERVICE_LOGON_FAILED = 1069;

.

        /// After starting, the service hung in a start-pending state.

.

        public const int ERROR_SERVICE_START_HANG = 1070;

.

        /// The specified service database lock is invalid.

.

        public const int ERROR_INVALID_SERVICE_LOCK = 1071;

.

        /// The specified service has been marked for deletion.

.

        public const int ERROR_SERVICE_MARKED_FOR_DELETE = 1072;

.

        /// The specified service already exists.

.

        public const int ERROR_SERVICE_EXISTS = 1073;

.

        /// The dependency service does not exist or has been marked for deletion.

.

        public const int ERROR_SERVICE_DEPENDENCY_DELETED = 1075;

.

        /// No attempts to start the service have been made since the last boot.

.

        public const int ERROR_SERVICE_NEVER_STARTED = 1077;

.

        /// The name is already in use as either a service name or a service display name.

.

        public const int ERROR_DUPLICATE_SERVICE_NAME = 1078;

.

        /// The account specified for this service is different from the account specified for other services running in the same process.

.

        public const int ERROR_DIFFERENT_SERVICE_ACCOUNT = 1079;

.

        /// Failure actions can only be set for Win32 services, not for drivers.

.

        /// This service runs in the same process as the service control manager.

.

        /// Therefore, the service control manager cannot take action if this service's process terminates unexpectedly.

.

        /// No recovery program has been configured for this service.

.

        /// The executable program that this service is configured to run in does not implement the service.

.

        public const int ERROR_SERVICE_NOT_IN_EXE = 1083;

.

        /// This service cannot be started in Safe Mode

.

        public const int ERROR_NOT_SAFEBOOT_SERVICE = 1084;

.

        /// The tracking (workstation) service is not running.

.

        public const int ERROR_NO_TRACKING_SERVICE = 1172;

.

        /// The format of the specified service name is invalid.

.

        public const int ERROR_INVALID_SERVICENAME = 1213;

.

        /// No service is operating at the destination network endpoint on the remote system.

.

        /// The service is already registered.

.

        /// The specified service does not exist.

.

        public const int ERROR_SERVICE_NOT_FOUND = 1243;

.

        /// The specified service does not exist.

.

        /// There are currently no logon servers available to service the logon request.

.

        /// The service being accessed is licensed for a particular number of connections.

.

        /// No more connections can be made to the service at this time because there are already as many connections as the service can accept.

.

        /// Insufficient system resources exist to complete the requested service.

.

        /// Insufficient system resources exist to complete the requested service.

.

        /// Insufficient system resources exist to complete the requested service.

.

        /// Insufficient quota to complete the requested service.

.

        /// Insufficient quota to complete the requested service.

.

        /// No event log file could be opened, so the event logging service did not start.

.

        /// The Windows Installer Service could not be accessed. This can occur if you are running Windows in safe mode, or if the Windows Installer is not correctly installed. Contact your support personnel for assistance.

.

        public const int ERROR_INSTALL_SERVICE_FAILURE = 1601;

.

        /// This installation package cannot be installed by the Windows Installer service.  You must install a Windows service pack that contains a newer version of the Windows Installer service.

.

        /// There was an error starting the Windows Installer service user interface.  Contact your support personnel.

.

        /// The Windows Installer service failed to start.  Contact your support personnel.

.

        /// This patch package cannot be processed by the Windows Installer service.  You must install a Windows service pack that contains a newer version of the Windows Installer service.

.

        /// Only administrators have permission to add, remove, or configure server software during a Terminal services remote session. If you want to install or configure software on the server, contact your network administrator.

.

        /// The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program. Verify that the program to be upgraded exists on your computer an

.

        /// The authentication service is unknown.

.

        public const int RPC_S_UNKNOWN_AUTHN_SERVICE = 1747;

.

        /// The authorization service is unknown.

.

        public const int RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750;

.

        /// The name service is unavailable.

.

        public const int RPC_S_NAME_SERVICE_UNAVAILABLE = 1762;

.

        /// An attempt was made to logon, but the network logon service was not started.

.

        /// The requested operation is successful. Changes will not be effective until the service is restarted.

.

        /// The WMI data service is not available.

.

        /// The remote storage service was not able to recall the file.

.

        /// The remote storage service is not operational at this time.

.

        /// The remote storage service encountered a media error.

.

        /// One or more cluster resources depend on the network to provide service to clients. The client access capability cannot be removed from the network.

.

        /// The quorum disk could not be located by the cluster service.

.

        /// The membership engine requested shutdown of the cluster service on this node.

.

        /// The Task Scheduler service must be configured to run in the System account to function properly.  Individual tasks may be configured to run in other accounts.

.

        public const int SCHED_E_SERVICE_NOT_LOCALSYSTEM = 6200;

.

        /// A service with the same name already exists on the system.

.

        public const int ERROR_CTX_SERVICE_NAME_COLLISION = 7006;

.

        /// The file replication service API was called incorrectly.

.

        /// The file replication service cannot be started.

.

        public const int FRS_ERR_STARTING_SERVICE = 8002;

.

        /// The file replication service cannot be stopped.

.

        public const int FRS_ERR_STOPPING_SERVICE = 8003;

.

        /// The file replication service API terminated the request.

.

        /// The file replication service terminated the request.

.

        /// The file replication service cannot be contacted.

.

        public const int FRS_ERR_SERVICE_COMM = 8006;

.

        /// The file replication service cannot satisfy the request because the user has insufficient privileges.

.

        /// The file replication service cannot satisfy the request because authenticated RPC is not available.

.

        /// The file replication service cannot satisfy the request because the user has insufficient privileges on the domain controller.

.

        /// The file replication service cannot satisfy the request because authenticated RPC is not available on the domain controller.

.

        /// The file replication service cannot communicate with the file replication service on the domain controller.

.

        /// The file replication service on the domain controller cannot communicate with the file replication service on this computer.

.

        /// The file replication service cannot populate the system volume because of an internal error.

.

        /// The file replication service cannot populate the system volume because of an internal timeout.

.

        /// The file replication service cannot process the request. The system volume is busy with a previous request.

.

        /// The file replication service cannot stop replicating the system volume because of an internal error.

.

        /// The file replication service detected an invalid parameter.

.

        public const int FRS_ERR_INVALID_SERVICE_PARAMETER = 8017;

.

        /// An error occurred while installing the directory service. For more information, see the event log.

.

        /// The directory service evaluated group memberships locally.

.

        /// The specified directory service attribute or value does not exist.

.

        /// The attribute syntax specified to the directory service is invalid.

.

        /// The attribute type specified to the directory service is not defined.

.

        /// The specified directory service attribute or value already exists.

.

        /// The directory service is busy.

.

        /// The directory service is unavailable.

.

        /// The directory service was unable to allocate a relative identifier.

.

        /// The directory service has exhausted the pool of relative identifiers.

.

        /// The requested operation could not be performed because the directory service is not the master for that type of operation.

.

        /// The directory service was unable to initialize the subsystem that allocates relative identifiers.

.

        /// The directory service can perform the requested operation only on a leaf object.

.

        /// The directory service cannot perform the requested operation on the RDN attribute of an object.

.

        /// The directory service detected an attempt to modify the object class of an object.

.

        /// The requested policy information is only in the directory service.

.

        /// A directory service error has occurred.

.

        /// The directory service encountered an error parsing a name.

.

        /// The directory service cannot get the attribute type for a name.

.

        /// The operation could not be performed because the directory service is shutting down.

.

        /// The directory service request is invalid.

.

        /// The directory service encountered an internal failure.

.

        /// The directory service encountered an unknown failure.

.

        /// The directory service is missing mandatory configuration information, and is unable to determine the ownership of floating single-master operation roles.

.

        /// The directory service was unable to transfer ownership of one or more floating single-master operation roles to other servers.

.

        /// The directory service is too busy to complete the replication operation at this time.

.

        /// The requested operation is not supported by this version of the directory service.

.

        /// The requested operation requires a directory service, and none was available.

.

        /// The directory service failed to lock a tree in preparation for a tree deletion because the tree was in use.

.

        /// The directory service failed to identify the list of objects to delete while attempting a tree deletion.

.

        /// Error Status: 0x%2. Click OK to shut down the system and reboot into Directory Services Restore Mode. Check the event log for detailed information.

.

        /// While processing a change to the DNS Host Name for an object, the Service Principal Name values could not be kept in sync.

.

        /// Directory Service cannot start.

.

        /// Directory Services could not start.

.

        /// A Service Principal Name (SPN) could not be constructed because the provided hostname is not in the necessary format.

.

        /// Critical Directory Service System objects cannot be deleted during tree delete operations.  The tree delete may have been partially performed.

.

        /// Directory Services could not start because of the following error: %1.

.

        /// The DS cannot derive a service principal name (SPN) with which to mutually authenticate the target server because the corresponding server object in the local DS database has no serverReference attribute.

.

        /// The Directory Service failed to enter single user mode.

.

        /// The Directory Service cannot parse the script because of a syntax error.

.

        /// The Directory Service cannot process the script because of an error.

.

        /// The directory service cannot perform the requested operation because the servers

.

        /// The directory service binding must be renegotiated due to a change in the server

.

        /// The directory service failed to authorize the request.

.

        /// The Directory Service cannot process the script because it is invalid.

.

        /// The directory service is unavailable.

.

        /// DNS zone already exists in the directory service.

.

        /// DNS server not creating or reading the boot file for the directory service integrated DNS zone.

.

        /// WSAStartup cannot function at this time because the underlying system it uses to provide network services is currently unavailable.

.

        /// No more results can be returned by WSALookupServiceNext.

.

        /// A call to WSALookupServiceEnd was made while this call was still processing. The call has been canceled.

.

        /// The requested service provider is invalid.

.

        /// The requested service provider could not be loaded or initialized.

.

        /// No such service is known. The service cannot be found in the specified name space.

.

        public const int WSASERVICE_NOT_FOUND = 10108;

.

        /// No more results can be returned by WSALookupServiceNext.

.

        /// A call to WSALookupServiceEnd was made while this call was still processing. The call has been canceled.

.

        /// An invalid or unrecognized service type was found in the flowspec.

.

        public const int WSA_QOS_ESERVICETYPE = 11016;

.

        /// Failed to obtain Kerberos server credentials for ISAKMP/ERROR_IPSEC_IKE service.  Kerberos authentication will not function.  The most likely reason for this is lack of domain membership.  This is normal if your computer is a member of a workgroup.

.

        /// Failed to determine SSPI principal name for ISAKMP/ERROR_IPSEC_IKE service (QueryCredentialsAttributes).

.

        /// Unable to initialize RPC services

.

        /// The OLE service mutex already exists

.

        /// The OLE service file mapping already exists

.

        /// Unable to map view of file for OLE service

.

        /// Failure attempting to launch OLE service

.

        /// Use of Ole1 services requiring DDE windows is disabled

.

        /// The service providing this server could not be started.

.

        public const int CO_E_START_SERVICE_FAILURE = (int)(0x8000401C - 0x100000000);

.

        /// The Task Scheduler Service is not installed on this computer.

.

        public const int SCHED_E_SERVICE_NOT_INSTALLED = (int)(0x8004130C - 0x100000000);

.

        /// Task Scheduler security services are available only on Windows NT.

.

        public const int SCHED_E_NO_SECURITY_SERVICES = (int)(0x80041312 - 0x100000000);

.

        /// The Task Scheduler Service is not running.

.

        public const int SCHED_E_SERVICE_NOT_RUNNING = (int)(0x80041315 - 0x100000000);

.

        /// OLE service could not bind object

.

        /// RPC communication failed with OLE service

.

        /// OLE service could not communicate with the object server

.

        /// Object server is stopping when OLE service contacts it

.

        /// The security context could not be established due to a failure in the requested quality of service (e.g. mutual authentication or delegation).

.

        /// The KDC was unable to generate a referral for the service requested.

.

        /// Certificate service has been suspended for a database restore operation.

.

        /// A service installation section in this INF is invalid.

.

        public const int SPAPI_E_BAD_SERVICE_INSTALLSECT = (int)(0x800F0217 - 0x100000000);

.

        public const int SPAPI_E_NO_ASSOCIATED_SERVICE = (int)(0x800F0219 - 0x100000000);

.

        /// The Plug and Play service is not available on the remote machine.

.

        public const int SPAPI_E_NO_CONFIGMGR_SERVICES = (int)(0x800F0223 - 0x100000000);

.

        public const int SCARD_E_NO_SERVICE = (int)(0x8010001D - 0x100000000);

.

        public const int SCARD_E_SERVICE_STOPPED = (int)(0x8010001E - 0x100000000);

.

        /// The service is not installed

.

        public const int COMADMIN_E_SERVICENOTINSTALLED = (int)(0x80110436 - 0x100000000);

.

        public const int COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE = (int)(0x80110602 - 0x100000000);

.

        /// COM+ applications that run as NT service may not be pooled or recycled

.

        /// Applications running as NT services may not be recycled.

.

        public const int COMADMIN_E_CANTRECYCLESERVICEAPPS = (int)(0x80110811 - 0x100000000);

.

        /// Library applications may not be NT services.

.

        public const int COMADMIN_E_CANTMAKEINPROCSERVICE = (int)(0x80110814 - 0x100000000);

mapi32

.

Microsoft Important Note: MAPI32 is not supported in a managed environment, memory leaks may be seen. Use the current alternatives: System.Net.Mail or WebDav or Exhange 2007 webservice interface.

.

  <Runtime.InteropServices.DllImport("MAPI32.DLL", CharSet:=System.Runtime.InteropServices.CharSet.Ansi)> _

ws2_32

.

    /// Native ATM Services [value = 22].

.

   <System.Runtime.InteropServices.DllImport("ws2_32.dll", CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)>

39: send
.

    /// <summary>    Specifies that the data should not be subject to routing. A Windows Sockets service provider can choose to ignore this flag</summary>

40: SendTo
.

    /// <summary>    Specifies that the data should not be subject to routing. A Windows Sockets service provider can choose to ignore this flag</summary>

.

        TypeOfService = 3,

.

        /// IP type of service.

.

        /// configuration info for service provider

.

        /// If TRUE, the service provider implements the expedited data as specified in RFC-1222. Otherwise, the Berkeley Software Distribution

.

        /// be turned off. This option is not required to be implemented by service providers.

.

        /// When TRUE, UDP datagrams are sent with the checksum of zero. Required for service providers. If a service provider does not have a mechanism

.

static extern Int32 WSALookupServiceBegin(WSAQUERYSET lpqsRestrictions, Int32 dwControlFlags, ref Int32 lphLookup);

.

Declare Function WSALookupServiceBegin Lib "ws2_32.dll" (TODO) As TODO

.
Documentation
[WSALookupServiceBegin] on MSDN
.

static extern Int32 WSALookupServiceEnd(Int32 hLookup);

.

Declare Function WSALookupServiceEnd Lib "ws2_32.dll" (hLookup as Int32) As Int32

.
Documentation
[WSALookupServiceEnd] on MSDN
.

static extern Int32 WSALookupServiceNext(Int32 hLookup, Int32 dwControlFlags,ref Int32 lpdwBufferLength, IntPtr pqsResults);

.

Declare Function WSALookupServiceNext Lib "ws2_32.dll" (TODO) As TODO

.

        if (WSALookupServiceBegin(ref lpRestrictions, 4080, ref hLookup) != (int)SocketError.SocketError)

.

            nextresult = WSALookupServiceNext(hLookup, 4080, ref dwLength, pqs);

.

                System.Diagnostics.Debug.WriteLine(qs.szServiceInstanceName);

.

            WSALookupServiceEnd(hLookup);

.
Documentation
[WSALookupServiceNext] on MSDN
.

    public int dwServiceFlags1;

.

    public int dwServiceFlags2;

.

    public int dwServiceFlags3;

.

    public int dwServiceFlags4;

.
Summary
The WSASocket function creates a socket that is bound to a specific transport-service provider.
.

        /// Native ATM Services [value = 22].

.

        // configuration info for service provider  

oleaut32

.

Declare Unicode Function LoadTypeLib Lib "oleaut32.dll" (ByVal szFile As String, ByRef TPpTypeLib As System.Runtime.InteropServices.ComTypes.ITypeLib) As Integer

.

In VB.Net you can substitute [System.Runtime.InteropServices.ComTypes.ITypeLib2] or [System.Runtime.InteropServices.UCOMITypeLib] for [System.Runtime.InteropServices.ComTypes.ITypeLib], defined in mscorlib.dll.

.

Note that in v2.0 (Whidbey) of the .NET Framework, the System.Runtime.InteropServices.UCOMITypeLib interface has been deprecated in favor of System.Runtime.InteropServices.ComTypes.ITypeLib.

.

Declare Unicode Function RegisterTypeLib Lib "oleaut32.dll" (ByVal ptlib As System.Runtime.InteropServices.ComTypes.ITypeLib, ByVal szFullPath As String, ByVal szHelpDir As String) As Integer

.

For the ITypeLib parameter in C#, you can use [System.Runtime.InteropServices.UCOMITypeLib], already defined in mscorlib.dll. Note that in v2.0 (Whidbey) of the .NET Framework, this interface has been deprecated in favor of System.Runtime.InteropServices.ComTypes.ITypeLib.

.

In VB.Net you can substitute [System.Runtime.InteropServices.ComTypes.ITypeLib2] or [System.Runtime.InteropServices.UCOMITypeLib] for [System.Runtime.InteropServices.ComTypes.ITypeLib], defined in mscorlib.dll.

.

System.Runtime.InteropServices.Marshal.FreeBSTR

.

http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.marshal.freebstr.aspx

.

Declare Unicode Function UnRegisterTypeLib Lib "oleaut32.dll" (ByRef LibID As System.Guid, ByVal nVerMajor As Short, ByVal nVerMinor As Short, ByVal lCID As Integer, ByVal tSysKind As System.Runtime.InteropServices.ComTypes.SYSKIND) As Integer

.

In VB.Net you can substitute [System.Runtime.InteropServices.SYSKIND] for [System.Runtime.InteropServices.ComTypes.SYSKIND], defined in mscorlib.dll.

.

Note that in v2.0 (Whidbey) of the .NET Framework, the System.Runtime.InteropServices.SYSKIND interface has been deprecated in favor of System.Runtime.InteropServices.ComTypes.SYSKIND.

comdlg32

.

Imports System.Runtime.InteropServices

.

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1), System.Runtime.InteropServices.ComVisible(False)> _

.

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1), System.Runtime.InteropServices.ComVisible(False)> _

.

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1), System.Runtime.InteropServices.ComVisible(False)> _

.

Imports System.Runtime.InteropServices

.

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1), System.Runtime.InteropServices.ComVisible(False)> _

.

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1), System.Runtime.InteropServices.ComVisible(False)> _

.

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1), System.Runtime.InteropServices.ComVisible(False)> _

icmp

.

    using System.Runtime.InteropServices;

advapi32

.

        int lastError = System.Runtime.InteropServices.Marshal.GetLastWin32Error();

.

You will need to reference System.Runtime.InteropServices

.
Summary
Changes the optional configuration parameters of a service.
.

    public static extern bool ChangeServiceConfig2(

.

        IntPtr hService,

.

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

.

See SERVICE_FAILURE_ACTIONS structure as one possible value for lpInfo.

.

Most (but not all) functionality can be accessed using classes in the System.ServiceProcess namespace.

.

See http://blogs.msdn.com/anlynes/archive/2006/07/30/683192.aspx or https://code.msdn.microsoft.com/windowsdesktop/CSWindowsServiceRecoveryPro-2147e7ac#content for details on how to call ChangeServiceConfig2.

.

1    SERVICE_CONFIG_DESCRIPTION

.

2    SERVICE_CONFIG_FAILURE_ACTIONS

.

3    SERVICE_CONFIG_DELAYED_AUTO_START_INFO

.

4    SERVICE_CONFIG_FAILURE_ACTIONS_FLAG

.

5    SERVICE_CONFIG_SERVICE_SID_INFO

.

6    SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO

.

7    SERVICE_CONFIG_PRESHUTDOWN_INFO

.

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

.

    public MyServiceInstaller()

.

        serviceInstaller1.Committed += new InstallEventHandler(serviceInstaller1_Committed);

.

    void serviceInstaller1_Committed(object sender, InstallEventArgs e)

.

        string serviceName = "MyService";

.

            throw new Exception(String.Format("Error connecting to Service Control Manager. Error provided was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

        svcHandle = OpenService(scHandle, serviceName, (int)SERVICE_ACCESS.SERVICE_ALL_ACCESS);

.

            throw new Exception(String.Format("Error opening service for modifying. Error returned was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

            throw new Exception(String.Format("Unable to allocate memory for service action, error was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

        SERVICE_FAILURE_ACTIONS failureActions = new SERVICE_FAILURE_ACTIONS();

.

        if (!ChangeServiceConfig2(svcHandle, SERVICE_CONFIG_FAILURE_ACTIONS, lpInfo))

.

            throw new Exception(String.Format("Error setting service config, error was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

        EventLog.WriteEntry("MyService", "Service modification completed");

.

        EventLog.WriteEntry("MyService", ex.Message);

.

        CloseServiceHandle(svcHandle);

.

        CloseServiceHandle(scHandle);

.
Documentation
[ChangeServiceConfig2] on MSDN
.
Summary
Changes the optional configuration parameters of a service.
.

    public static extern bool ChangeServiceConfig2(

.

        IntPtr hService,

.

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

.

See SERVICE_FAILURE_ACTIONS structure as one possible value for lpInfo.

.

Most (but not all) functionality can be accessed using classes in the System.ServiceProcess namespace.

.

See http://blogs.msdn.com/anlynes/archive/2006/07/30/683192.aspx for details on how to call ChangeServiceConfig2.

.

1    SERVICE_CONFIG_DESCRIPTION

.

2    SERVICE_CONFIG_FAILURE_ACTIONS

.

3    SERVICE_CONFIG_DELAYED_AUTO_START_INFO

.

4    SERVICE_CONFIG_FAILURE_ACTIONS_FLAG

.

5    SERVICE_CONFIG_SERVICE_SID_INFO

.

6    SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO

.

7    SERVICE_CONFIG_PRESHUTDOWN_INFO

.

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

.

    public MyServiceInstaller()

.

        serviceInstaller1.Committed += new InstallEventHandler(serviceInstaller1_Committed);

.

    void serviceInstaller1_Committed(object sender, InstallEventArgs e)

.

        string serviceName = "MyService";

.

            throw new Exception(String.Format("Error connecting to Service Control Manager. Error provided was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

        svcHandle = OpenService(scHandle, serviceName, (int)SERVICE_ACCESS.SERVICE_ALL_ACCESS);

.

            throw new Exception(String.Format("Error opening service for modifying. Error returned was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

            throw new Exception(String.Format("Unable to allocate memory for service action, error was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

        SERVICE_FAILURE_ACTIONS failureActions = new SERVICE_FAILURE_ACTIONS();

.

        if (!ChangeServiceConfig2(svcHandle, SERVICE_CONFIG_FAILURE_ACTIONS, lpInfo))

.

            throw new Exception(String.Format("Error setting service config, error was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

        EventLog.WriteEntry("MyService", "Service modification completed");

.

        EventLog.WriteEntry("MyService", ex.Message);

.

        CloseServiceHandle(svcHandle);

.

        CloseServiceHandle(scHandle);

.
Documentation
[ChangeServiceConfig2] on MSDN
.
Summary
The CloseServiceHandle function closes a handle to a service control manager or service object.
.

public static extern bool CloseServiceHandle( IntPtr hSCObject );

.

    Private Shared Function CloseServiceHandle(ByVal serviceHandle As IntPtr) As Boolean

.

    Declare Function CloseServiceHandle Lib "advapi32.dll" (ByVal hSCObject As IntPtr) As Boolean

.

Handles returned from CreateService must be closed using this function, rather than the standard CloseHandle

.
Documentation
.
Summary
The ControlService function sends a control code to a service.
.

public static extern bool    ControlService(IntPtr hService, SERVICE_CONTROL dwControl, ref SERVICE_STATUS lpServiceStatus);

.

Public Function ControlService(ByVal hService As IntPtr, ByVal dwControl As SERVICE_CONTROL, ByRef lpServiceStatus As SERVICE_STATUS) As Boolean

.

Declare Function ControlService Lib "advapi32.dll" (ByVal hService As Long, ByVal lControlCode As Long, ByVal lpServiceStatus As SERVICE_STATUS) As Boolean

.

See SERVICE_STATUS definition

.

public enum SERVICE_CONTROL : uint

.

public enum SERVICE_STATE : uint

.

    SERVICE_STOPPED            = 0x00000001,

.

    SERVICE_START_PENDING          = 0x00000002,

.

    SERVICE_STOP_PENDING           = 0x00000003,

.

    SERVICE_RUNNING            = 0x00000004,

.

    SERVICE_CONTINUE_PENDING           = 0x00000005,

.

    SERVICE_PAUSE_PENDING          = 0x00000006,

.

    SERVICE_PAUSED             = 0x00000007

.

public enum SERVICE_ACCEPT : uint

.

See SERVICE_STATUS definition

.

Public Enum SERVICE_CONTROL As Integer

.

Public Enum SERVICE_STATE As Integer

.

    SERVICE_STOPPED = &H1

.

    SERVICE_START_PENDING = &H2

.

    SERVICE_STOP_PENDING = &H3

.

    SERVICE_RUNNING = &H4

.

    SERVICE_CONTINUE_PENDING = &H5

.

    SERVICE_PAUSE_PENDING = &H6

.

    SERVICE_PAUSED = &H7

.

Public Enum SERVICE_ACCEPT As Integer

.

IntPtr serv = Tools.OpenService(con, "ServiceTest", (uint)SERVICE_ACCESS.SERVICE_ALL_ACCESS);

.

SERVICE_STATUS stat = new SERVICE_STATUS();

.

bool res = Tools.ControlService(m_serv, SERVICE_CONTROL.STOP, ref stat);

.

Console.WriteLine("Stop service result: " + res);

.

// TODO: Code to halt execution until the service has finally stopped, to continue another task afterwards.

.

using System.Runtime.InteropServices;

.

using System.ServiceProcess;

.

namespace ServiceHelper

.

     /// Helper class for service control.

.

     public class ServiceControl : IDisposable

.

     private IntPtr serviceControlManagerHandle;

.

     private IntPtr serviceHandle;

.

     public ServiceControl (ServiceBase aServiceBase, uint aWaitHintMilliseconds, int aHeartbeatMilliseconds)

.

         SERVICE_STATUS serviceStatus;

.

         serviceControlManagerHandle = Interop.OpenSCManager (

.

         if (serviceControlManagerHandle == IntPtr.Zero)

.

         throw new Exception (aServiceBase.ServiceName);

.

         serviceHandle = Interop.OpenService (

.

         serviceControlManagerHandle,

.

         aServiceBase.ServiceName,

.

        (uint) SERVICE_ACCESS.SERVICE_ALL_ACCESS);

.

         if (serviceHandle == IntPtr.Zero)

.

         throw new Exception ("aServiceName");

.

         fieldInfo = typeof (System.ServiceProcess.ServiceBase).GetField ("statusHandle", bindingFlags);

.

         statusHandle = (IntPtr) (fieldInfo.GetValue (aServiceBase));

.

         serviceStatus = new SERVICE_STATUS ();

.

         Interop.QueryServiceStatus (serviceHandle, ref serviceStatus);

.

         serviceStatus.WaitHint = waitHintMilliseconds;

.

         Interop.SetServiceStatus (statusHandle, ref serviceStatus);

.

     private SERVICE_STATUS DoQueryServiceStatus ()

.

         SERVICE_STATUS serviceStatus = new SERVICE_STATUS();

.

         Interop.QueryServiceStatus (serviceHandle, ref serviceStatus);

.

         return serviceStatus;

.

                 SERVICE_STATUS serviceStatus = new SERVICE_STATUS ();

.

                 Interop.QueryServiceStatus (serviceHandle, ref serviceStatus);

.

                 serviceStatus.CheckPoint++;

.

                 Interop.SetServiceStatus (statusHandle, ref serviceStatus);

.

     private void DoControlService (SERVICE_CONTROL aServiceControl)

.

         SERVICE_STATUS serviceStatus = new SERVICE_STATUS();

.

         if (!Interop.ControlService(serviceHandle, aServiceControl, ref serviceStatus))

.

         throw new Exception (serviceStatus.ToString ());

.

         Interop.CloseServiceHandle (serviceHandle);

.

         Interop.CloseServiceHandle (serviceControlManagerHandle);

.

     public class TestService : ServiceBase

.

     ServiceControl serviceControl;

.

         ServiceBase.Run (new TestService());

.

     public TestService()

.

         serviceControl = new ServiceControl (this, 60000, 10000);

.

         serviceControl.StartHeartbeat ();

.

         serviceControl.StopHeartbeat ();

.

         this.ServiceName = "TestService";

.

         serviceControl = new ServiceControl (this, 60000, 10000);

.

         serviceControl.StartHeartbeat ();

.

         serviceControl.StopHeartbeat ();        

.

     internal static extern bool ControlService (

.

         IntPtr hService,

.

         SERVICE_CONTROL dwControl,

.

         ref SERVICE_STATUS lpServiceStatus);

.

     internal static extern IntPtr OpenService (IntPtr hSCManager, string lpServiceName, uint dwDesiredAccess);

.

     internal static extern bool CloseServiceHandle (IntPtr hSCObject);

.

     [DllImport ("advapi32.dll", EntryPoint = "QueryServiceStatus", CharSet = CharSet.Auto)]

.

     internal static extern bool QueryServiceStatus (IntPtr hService, ref SERVICE_STATUS dwServiceStatus);

.

     internal static extern bool SetServiceStatus (IntPtr hServiceStatus, ref SERVICE_STATUS lpServiceStatus);

.
Documentation
[ControlService] on MSDN

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: