@@ -176,7 +176,7 @@ public static class Advapi32 {
176176 /// <param name="dwAccess">The access to the service control manager</param>
177177 /// <returns>If the function succeeds, the return value is a handle to the specified service control manager database. If the function fails, the return value is NULL</returns>
178178 [ DllImport ( "advapi32.dll" , EntryPoint = "OpenSCManagerW" , ExactSpelling = true , CharSet = CharSet . Unicode , SetLastError = true ) ]
179- internal static extern IntPtr OpenSCManager (
179+ public static extern IntPtr OpenSCManager (
180180 string machineName ,
181181 string databaseName ,
182182 ServiceAccessRights dwAccess ) ;
@@ -186,13 +186,13 @@ internal static extern IntPtr OpenSCManager(
186186 /// </summary>
187187 /// <param name="dwAccess">The access to the service control manager</param>
188188 /// <returns>If the function succeeds, the return value is a handle to the specified service control manager database. If the function fails, the return value is NULL</returns>
189- internal static IntPtr OpenSCManager ( ServiceAccessRights dwAccess ) => OpenSCManager ( null , null , dwAccess ) ;
189+ public static IntPtr OpenSCManager ( ServiceAccessRights dwAccess ) => OpenSCManager ( null , null , dwAccess ) ;
190190
191191 /// <summary>
192192 /// Service Security and Access Rights for the Service Control Manager
193193 /// </summary>
194194 [ Flags ]
195- internal enum ServiceAccessRights : uint {
195+ public enum ServiceAccessRights : uint {
196196 SC_MANAGER_ALL_ACCESS = 0xF003F
197197 }
198198
@@ -214,7 +214,7 @@ internal enum ServiceAccessRights : uint {
214214 /// <param name="lpPassword">The password to the account name specified by the <paramref name="lpServiceStartName"/> parameter</param>
215215 /// <returns>If the function succeeds, the return value is a handle to the service.</returns>
216216 [ DllImport ( "advapi32.dll" , SetLastError = true , CharSet = CharSet . Auto ) ]
217- internal static extern IntPtr CreateService (
217+ public static extern IntPtr CreateService (
218218 IntPtr hSCManager ,
219219 string lpServiceName ,
220220 string lpDisplayName ,
@@ -232,7 +232,7 @@ internal static extern IntPtr CreateService(
232232 /// <summary>
233233 /// The severity of the error, and action taken, if this service fails to start
234234 /// </summary>
235- internal enum ErrorControl : uint {
235+ public enum ErrorControl : uint {
236236
237237 /// <summary>
238238 /// The startup program ignores the error and continues the startup operation
@@ -260,7 +260,7 @@ internal enum ErrorControl : uint {
260260 /// <summary>
261261 /// System Error Codes returned by <see cref="Marshal.GetLastWin32Error"/>
262262 /// </summary>
263- internal struct SystemError {
263+ public struct SystemError {
264264 /// <summary>
265265 /// The operation completed successfully
266266 /// </summary>
@@ -271,11 +271,26 @@ internal struct SystemError {
271271 /// </summary>
272272 public const int ErrorFileNotFound = 0x02 ;
273273
274+ /// <summary>
275+ /// The system cannot find the path specified.
276+ /// </summary>
277+ public const int ErrorPathNotFound = 0x03 ;
278+
274279 /// <summary>
275280 /// Access is denied.
276281 /// </summary>
277282 public const int ErrorAccessDenied = 0x05 ;
278283
284+ /// <summary>
285+ /// The handle is invalid.
286+ /// </summary>
287+ public const int ErrorInvalidHandle = 0x06 ;
288+
289+ /// <summary>
290+ /// %1 is not a valid Win32 application.
291+ /// </summary>
292+ public const int ErrorBadExeFormat = 0xC1 ;
293+
279294 /// <summary>
280295 /// An instance of the service is already running.
281296 /// </summary>
@@ -320,13 +335,13 @@ internal struct SystemError {
320335 /// <param name="dwDesiredAccess">The access to the service.</param>
321336 /// <returns>If the function succeeds, the return value is a handle to the service. If the function fails, the return value is <see cref="IntPtr.Zero"/>.</returns>
322337 [ DllImport ( "advapi32.dll" , EntryPoint = "OpenServiceW" , SetLastError = true , CharSet = CharSet . Unicode ) ]
323- internal static extern IntPtr OpenService ( IntPtr hSCManager , string lpServiceName , ServiceRights dwDesiredAccess ) ;
338+ public static extern IntPtr OpenService ( IntPtr hSCManager , string lpServiceName , ServiceRights dwDesiredAccess ) ;
324339
325340 /// <summary>
326341 /// Specific access rights for a service
327342 /// </summary>
328343 [ Flags ]
329- internal enum ServiceRights : uint {
344+ public enum ServiceRights : uint {
330345
331346 /// <summary>
332347 /// Required to call the QueryServiceConfig and QueryServiceConfig2 functions to query the service configuration.
@@ -417,7 +432,7 @@ internal enum ServiceRights : uint {
417432 /// Contains status information for a service.
418433 /// </summary>
419434 [ StructLayout ( LayoutKind . Sequential , Pack = 1 ) ]
420- internal struct ServiceStatus {
435+ public struct ServiceStatus {
421436 public ServiceStatusServiceType dwServiceType ;
422437 public ServiceStatusCurrentState dwCurrentState ;
423438 public ServiceStatusControlsAccepted dwControlsAccepted ;
@@ -430,7 +445,7 @@ internal struct ServiceStatus {
430445 /// <summary>
431446 /// The type of service for <see cref="ServiceStatus"/>.
432447 /// </summary>
433- internal enum ServiceStatusServiceType : uint {
448+ public enum ServiceStatusServiceType : uint {
434449
435450 /// <summary>
436451 /// The service is a device driver.
@@ -466,7 +481,7 @@ internal enum ServiceStatusServiceType : uint {
466481 /// <summary>
467482 /// The current state of the service for <see cref="ServiceStatus"/>.
468483 /// </summary>
469- internal enum ServiceStatusCurrentState : uint {
484+ public enum ServiceStatusCurrentState : uint {
470485
471486 /// <summary>
472487 /// The service is not running.
@@ -508,7 +523,7 @@ internal enum ServiceStatusCurrentState : uint {
508523 /// The control codes the service accepts and processes in its handler function for <see cref="ServiceStatus"/>.
509524 /// </summary>
510525 [ Flags ]
511- internal enum ServiceStatusControlsAccepted : uint {
526+ public enum ServiceStatusControlsAccepted : uint {
512527
513528 /// <summary>
514529 /// The service can be stopped.
@@ -550,7 +565,7 @@ internal enum ServiceStatusControlsAccepted : uint {
550565 /// <returns><see langword="true"/> if the function succeeds</returns>
551566 [ DllImport ( "advapi32.dll" , SetLastError = true ) ]
552567 [ return : MarshalAs ( UnmanagedType . Bool ) ]
553- internal static extern bool CloseServiceHandle ( IntPtr hSCObject ) ;
568+ public static extern bool CloseServiceHandle ( IntPtr hSCObject ) ;
554569
555570 /// <summary>
556571 /// The OpenProcessToken function opens the access token associated with a process
0 commit comments