QuotedwControlsAccepted
Specifies the control codes that the service will accept and process. A user interface process can control a service by specifying a control command in the ControlService function. By default, all services accept the SERVICE_CONTROL_INTERROGATE value. Any or all of the following flags can be specified to enable the other control codes.
Value Meaning
SERVICE_ACCEPT_STOP equ =1h
The service can be stopped. This enables the SERVICE_CONTROL_STOP value.
SERVICE_ACCEPT_PAUSE_CONTINUE equ=2h
The service can be paused and continued. This enables the SERVICE_CONTROL_PAUSE and SERVICE_CONTROL_CONTINUE values.
SERVICE_ACCEPT_SHUTDOWN equ=4h
The service is notified when system shutdown occurs. This enables the system to send a SERVICE_CONTROL_SHUTDOWN value to the service. The ControlService function cannot send this control code.
dwControlsAccepted=0, what's the value meaning?
Hi,
six_LFrom
windows.incQuote
SERVICE_CONTROL_STOP equ 1h
SERVICE_CONTROL_PAUSE equ 2h
SERVICE_CONTROL_CONTINUE equ 3h
SERVICE_CONTROL_INTERROGATE equ 4h
SERVICE_CONTROL_SHUTDOWN equ 5h
From
Win32 Programmer's ReferenceQuoteErrors
The following error codes may be set by the service control manager. Other error codes may be set by the registry functions that are called by the service control manager.
Value Meaning
ERROR_ACCESS_DENIED
The specified handle was not opened with the necessary access.
ERROR_DEPENDENT_SERVICES_RUNNING
The service cannot be stopped because other running services are dependent on it.
ERROR_INVALID_SERVICE_CONTROL
The requested control code is not valid, or it is unacceptable to the service.
ERROR_SERVICE_CANNOT_ACCEPT_CTRL
The requested control code cannot be sent to the service because the state of the service is SERVICE_STOPPED, SERVICE_START_PENDING, or SERVICE_STOP_PENDING.
ERROR_SERVICE_NOT_ACTIVE
The service has not been started.
ERROR_SERVICE_REQUEST_TIMEOUT
The service did not respond to the start request in a timely fashion.
So seeing there's no value for
0, (I am guessing you asked because that's the default value when first made the control service thingy.) I guess it would be either undefined, like undeclared variables, only it is the status of the service that is not set and not the value itself. So, if
0 is sent as the value in
ControlService,
ERROR_INVALID_SERVICE_CONTROL will be the error.
I doubted that helped much but good luck! :U
Christopher
hey,Boucly
frist all, thanks you for the quick answer.
here is the msdn's explanation.
QuoteSERVICE_STATUS
Contains status information for a service. The ControlService, EnumDependentServices, EnumServicesStatus, and QueryServiceStatus functions use this structure. A service uses this structure in the SetServiceStatus function to report its current status to the service control manager.
typedef struct _SERVICE_STATUS {
DWORD dwServiceType;
DWORD dwCurrentState;
DWORD dwControlsAccepted;
DWORD dwWin32ExitCode;
DWORD dwServiceSpecificExitCode;
DWORD dwCheckPoint;
DWORD dwWaitHint;
} SERVICE_STATUS,
*LPSERVICE_STATUS;
Members
dwServiceType
Type of service. This member can be one of the following values.
Value Meaning
SERVICE_FILE_SYSTEM_DRIVER
0x00000002 The service is a file system driver.
SERVICE_KERNEL_DRIVER
0x00000001 The service is a device driver.
SERVICE_WIN32_OWN_PROCESS
0x00000010 The service runs in its own process.
SERVICE_WIN32_SHARE_PROCESS
0x00000020 The service shares a process with other services.
If the service type is either SERVICE_WIN32_OWN_PROCESS or SERVICE_WIN32_SHARE_PROCESS, and the service is running in the context of the LocalSystem account, the following type may also be specified.
Value Meaning
SERVICE_INTERACTIVE_PROCESS
0x00000100 The service can interact with the desktop.
For more information, see Interactive Services.
dwCurrentState
Current state of the service. This member can be one of the following values.
Value Meaning
SERVICE_CONTINUE_PENDING
0x00000005 The service continue is pending.
SERVICE_PAUSE_PENDING
0x00000006 The service pause is pending.
SERVICE_PAUSED
0x00000007 The service is paused.
SERVICE_RUNNING
0x00000004 The service is running.
SERVICE_START_PENDING
0x00000002 The service is starting.
SERVICE_STOP_PENDING
0x00000003 The service is stopping.
SERVICE_STOPPED
0x00000001 The service is not running.
dwControlsAccepted
Control codes the service accepts and processes in its handler function (see Handler and HandlerEx). A user interface process can control a service by specifying a control command in the ControlService or ControlServiceEx function. By default, all services accept the SERVICE_CONTROL_INTERROGATE value.
The following are the control codes.
Control code Meaning
SERVICE_ACCEPT_NETBINDCHANGE
0x00000010 The service is a network component that can accept changes in its binding without being stopped and restarted.
This control code allows the service to receive SERVICE_CONTROL_NETBINDADD, SERVICE_CONTROL_NETBINDREMOVE, SERVICE_CONTROL_NETBINDENABLE, and SERVICE_CONTROL_NETBINDDISABLE notifications.
Windows NT: This value is not supported.
SERVICE_ACCEPT_PARAMCHANGE
0x00000008 The service can reread its startup parameters without being stopped and restarted.
This control code allows the service to receive SERVICE_CONTROL_PARAMCHANGE notifications.
Windows NT: This value is not supported.
SERVICE_ACCEPT_PAUSE_CONTINUE
0x00000002 The service can be paused and continued.
This control code allows the service to receive SERVICE_CONTROL_PAUSE and SERVICE_CONTROL_CONTINUE notifications.
SERVICE_ACCEPT_PRESHUTDOWN
0x00000100 The service can perform preshutdown tasks.
This control code enables the service to receive SERVICE_CONTROL_PRESHUTDOWN notifications. Note that ControlService and ControlServiceEx cannot send this notification; only the system can send it.
Windows Server 2003 and Windows XP/2000: This value is not supported.
SERVICE_ACCEPT_SHUTDOWN
0x00000004 The service is notified when system shutdown occurs.
This control code allows the service to receive SERVICE_CONTROL_SHUTDOWN notifications. Note that ControlService and ControlServiceEx cannot send this notification; only the system can send it.
SERVICE_ACCEPT_STOP
0x00000001 The service can be stopped.
This control code allows the service to receive SERVICE_CONTROL_STOP notifications.
This value can also contain the following extended control codes, which are supported only by HandlerEx. (Note that these control codes cannot be sent by ControlService or ControlServiceEx.)
Control code Meaning
SERVICE_ACCEPT_HARDWAREPROFILECHANGE
0x00000020 The service is notified when the computer's hardware profile has changed. This enables the system to send SERVICE_CONTROL_HARDWAREPROFILECHANGE notifications to the service.
Windows NT: This value is not supported.
SERVICE_ACCEPT_POWEREVENT
0x00000040 The service is notified when the computer's power status has changed. This enables the system to send SERVICE_CONTROL_POWEREVENT notifications to the service.
Windows NT: This value is not supported.
SERVICE_ACCEPT_SESSIONCHANGE
0x00000080 The service is notified when the computer's session status has changed. This enables the system to send SERVICE_CONTROL_SESSIONCHANGE notifications to the service.
Windows 2000/NT: This value is not supported.
dwWin32ExitCode
Error code the service uses to report an error that occurs when it is starting or stopping. To return an error code specific to the service, the service must set this value to ERROR_SERVICE_SPECIFIC_ERROR to indicate that the dwServiceSpecificExitCode member contains the error code. The service should set this value to NO_ERROR when it is running and on normal termination.
dwServiceSpecificExitCode
Service-specific error code that the service returns when an error occurs while the service is starting or stopping. This value is ignored unless the dwWin32ExitCode member is set to ERROR_SERVICE_SPECIFIC_ERROR.
dwCheckPoint
Check-point value the service increments periodically to report its progress during a lengthy start, stop, pause, or continue operation. For example, the service should increment this value as it completes each step of its initialization when it is starting up. The user interface program that invoked the operation on the service uses this value to track the progress of the service during a lengthy operation. This value is not valid and should be zero when the service does not have a start, stop, pause, or continue operation pending.
dwWaitHint
Estimated time required for a pending start, stop, pause, or continue operation, in milliseconds. Before the specified amount of time has elapsed, the service should make its next call to the SetServiceStatus function with either an incremented dwCheckPoint value or a change in dwCurrentState. If the amount of time specified by dwWaitHint passes, and dwCheckPoint has not been incremented or dwCurrentState has not changed, the service control manager or service control program can assume that an error has occurred.
i tested. actually, the value of some ServiceStatus.dwControlsAccepted is zero.
another question:
how am i use the RegisterServiceProcess API?
six_LFrom
http://armbrustconsulting.com/forums/viewtopic.php?t=77 (http://armbrustconsulting.com/forums/viewtopic.php?t=77)
QuoteRegisterServiceProcess API exists only in Win9X based OSes
The closest API function in XP that I found was
RegisterServiceCtrlHandler. What are you trying to do anyway?
http://www.we11er.co.uk/programming/RegisterServiceProcess.html (http://www.we11er.co.uk/programming/RegisterServiceProcess.html)
From
http://support.microsoft.com/default.aspx?scid=kb;en-us;125714Quote
RegisterServiceProcess
DWORD RegisterServiceProcess(
DWORD dwProcessId, // process identifier
DWORD dwServiceType // type of service
);
Parameters:
• dwProcessId: Specifies the identifier of the process to register as a service process or NULL to register the current process. An application receives the process ID when it uses CreateProcess() to start the application.
• dwServiceType: One of the following values:
Define Value Meaning
RSP_SIMPLE_SERVICE 0x00000001 Registers the process as a
simple service process.
RSP_UNREGISTER_SERVICE 0x00000000 Unregisters the process as a
service process
Return Value:
The return value is 1 if successful or 0 if an error occurs.
APPLIES TO
• Microsoft Win32 Application Programming Interface (API), when used with:
Microsoft Windows 95
Christopher
hey,Boucly
thanks you for the usable MSG. :U
QuoteWhat are you trying to do anyway?
i'll do a simple tool about the services manager.
six_L,
Quote from: six_L on October 16, 2006, 03:24:45 AM
thanks you for the usable MSG. :U
Actually, it is just something on the top of the Google page when I search for RegisterServiceProcess, and then I just copy and paste.
Anyhow, Services Manager (Could be very useful :thumbu) ... hmmm... How does Service Process differ from normal processes? Are they like network processes or processes that control hardwares or something?
:U,
Boucly