Return to site

Error Control Coding

broken image


-->

Error Control Coding In Digital Communication Ppt

Sends a control code to a service.

To specify additional information when stopping a service, use theControlServiceEx function.

The second part is devoted to the practical applications of error-control coding in various fields. It explains how to design cost-effective error-control coding systems. Many examples of actual error-control coding systems are described and evaluated. ERROR CONTROL CODING. Mention is the properties of cyclic codes. Linearity property. The sum of any two code word is also a valid code word. Cyclic property. Every cyclic shift of a valid code vector produces another valid code vector. Define hamming distance. Conceptually the encoding and the decoding techniques are the same for LDPC for the two applications. The difference may be in the code rate which is k/n with k is the message length and n is the. Cyclic Block Codes Definition: oAn (n, k) linear code C is called a cyclic code if every cyclic shift of a code vector in C is also a code vector oCodewords can be represented as polynomials of degree n. For a cyclic code all codewords are multiple of some polynomial g(X) modulo Xn+1 such that g(X) divides Xn+1. G(X) is called the generator.

Bch code tutorial

Syntax

Projects

Parameters

hService

A handle to the service. This handle is returned by theOpenService orCreateService function. Theaccess rights required for this handledepend on the dwControl code requested.

dwControl

This parameter can be one of the following control codes.

Control codeMeaning
SERVICE_CONTROL_CONTINUE
0x00000003
Notifies a paused service that it should resume. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_INTERROGATE
0x00000004
Notifies a service that it should report its current status information to the service control manager. The hService handle must have the SERVICE_INTERROGATE access right.

Note that this control is not generally useful as the SCM is aware of the current state of the service.

SERVICE_CONTROL_NETBINDADD
0x00000007
Notifies a network service that there is a new component for binding. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDDISABLE
0x0000000A
Notifies a network service that one of its bindings has been disabled. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDENABLE
0x00000009
Notifies a network service that a disabled binding has been enabled. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDREMOVE
0x00000008
Notifies a network service that a component for binding has been removed. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_PARAMCHANGE
0x00000006
Notifies a service that its startup parameters have changed. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_PAUSE
0x00000002
Notifies a service that it should pause. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_STOP
0x00000001
Notifies a service that it should stop. The hService handle must have the SERVICE_STOP access right.

After sending the stop request to a service, you should not send other controls to the service.

This value can also be a user-defined control code, as described in the following table.

Control codeMeaning
Range 128 to 255
The service defines the action associated with the control code. The hService handle must have the SERVICE_USER_DEFINED_CONTROL access right.

lpServiceStatus

A pointer to a SERVICE_STATUS structure thatreceives the latest service status information. The information returned reflects the most recent status thatthe service reported to the service control manager.

The service control manager fills in the structure only whenGetLastError returns one of the following errorcodes: NO_ERROR, ERROR_INVALID_SERVICE_CONTROL,ERROR_SERVICE_CANNOT_ACCEPT_CTRL, orERROR_SERVICE_NOT_ACTIVE. Otherwise, the structure is not filled in.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, callGetLastError.

The following error codes can be set by the service control manager. Other error codes can be set by theregistry functions that are called by the service control manager.

Return codeDescription
ERROR_ACCESS_DENIED
The handle does not have the required access right.
ERROR_DEPENDENT_SERVICES_RUNNING
The service cannot be stopped because other running services are dependent on it.
ERROR_INVALID_HANDLE
The specified handle was not obtained using CreateService or OpenService, or the handle is no longer valid.
ERROR_INVALID_PARAMETER
The requested control code is undefined.
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 process for the service was started, but it did not call StartServiceCtrlDispatcher, or the thread that called StartServiceCtrlDispatcher may be blocked in a control handler function.
ERROR_SHUTDOWN_IN_PROGRESS
The system is shutting down.

Remarks

The ControlService function asks the ServiceControl Manager (SCM) to send the requested control code to the service. The SCM sends the code if the servicehas specified that it will accept the code, and is in a state in which a control code can be sent to it.

The SCM processes service control notifications in a serial fashion—it will wait for oneservice to complete processing a service control notification before sending the next one. Because of this, a callto ControlService will block for 30 seconds if anyservice is busy handling a control code. If the busy service still has not returned from its handler function whenthe timeout expires, ControlService fails withERROR_SERVICE_REQUEST_TIMEOUT.

To stop and start a service requires a security descriptor that allows you to do so. The default securitydescriptor allows the LocalSystem account, and membersof the Administrators and Power Users groups to stop and start services. To change the security descriptor of aservice, seeModifying the DACL for a Service.

The QueryServiceStatusEx function returns aSERVICE_STATUS_PROCESS structurewhose dwCurrentState and dwControlsAccepted members indicatethe current state and controls accepted by a running service. All running services accept theSERVICE_CONTROL_INTERROGATE control code by default. Drivers do not accept control codesother than SERVICE_CONTROL_STOP andSERVICE_CONTROL_INTERROGATE. Each service specifies the other control codes that itaccepts when it calls the SetServiceStatus functionto report its status. A service should always accept these codes when it is running, no matter what it isdoing.

The following table shows the action of the SCM in each of the possible service states.

Service stateStopOther controls
STOPPED(c)(c)
STOP_PENDING(b)(b)
START_PENDING(a)(b)
RUNNING(a)(a)
CONTINUE_PENDING(a)(a)
PAUSE_PENDING(a)(a)
PAUSED(a)(a)

Examples

For an example, see Stopping a Service.

Requirements

Minimum supported clientWindows XP [desktop apps only]
Minimum supported serverWindows Server 2003 [desktop apps only]
Target PlatformWindows
Headerwinsvc.h (include Windows.h)
LibraryAdvApi32.lib
DLLAdvApi32.dll

See also

Error control coding 2nd edition
-->

Sends a control code to a service.

To specify additional information when stopping a service, use theControlServiceEx function.

Syntax

Parameters

hService

A handle to the service. This handle is returned by theOpenService orCreateService function. Theaccess rights required for this handledepend on the dwControl code requested.

dwControl

This parameter can be one of the following control codes.

Control codeMeaning
SERVICE_CONTROL_CONTINUE
0x00000003
Notifies a paused service that it should resume. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_INTERROGATE
0x00000004
Notifies a service that it should report its current status information to the service control manager. The hService handle must have the SERVICE_INTERROGATE access right.

Note that this control is not generally useful as the SCM is aware of the current state of the service.

SERVICE_CONTROL_NETBINDADD
0x00000007
Notifies a network service that there is a new component for binding. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDDISABLE
0x0000000A
Notifies a network service that one of its bindings has been disabled. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDENABLE
0x00000009
Notifies a network service that a disabled binding has been enabled. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDREMOVE
0x00000008
Notifies a network service that a component for binding has been removed. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_PARAMCHANGE
0x00000006
Notifies a service that its startup parameters have changed. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_PAUSE
0x00000002
Notifies a service that it should pause. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_STOP
0x00000001
Notifies a service that it should stop. The hService handle must have the SERVICE_STOP access right.

After sending the stop request to a service, you should not send other controls to the service.

This value can also be a user-defined control code, as described in the following table.

Error

Syntax

Parameters

hService

A handle to the service. This handle is returned by theOpenService orCreateService function. Theaccess rights required for this handledepend on the dwControl code requested.

dwControl

This parameter can be one of the following control codes.

Control codeMeaning
SERVICE_CONTROL_CONTINUE
0x00000003
Notifies a paused service that it should resume. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_INTERROGATE
0x00000004
Notifies a service that it should report its current status information to the service control manager. The hService handle must have the SERVICE_INTERROGATE access right.

Note that this control is not generally useful as the SCM is aware of the current state of the service.

SERVICE_CONTROL_NETBINDADD
0x00000007
Notifies a network service that there is a new component for binding. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDDISABLE
0x0000000A
Notifies a network service that one of its bindings has been disabled. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDENABLE
0x00000009
Notifies a network service that a disabled binding has been enabled. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDREMOVE
0x00000008
Notifies a network service that a component for binding has been removed. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_PARAMCHANGE
0x00000006
Notifies a service that its startup parameters have changed. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_PAUSE
0x00000002
Notifies a service that it should pause. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_STOP
0x00000001
Notifies a service that it should stop. The hService handle must have the SERVICE_STOP access right.

After sending the stop request to a service, you should not send other controls to the service.

This value can also be a user-defined control code, as described in the following table.

Control codeMeaning
Range 128 to 255
The service defines the action associated with the control code. The hService handle must have the SERVICE_USER_DEFINED_CONTROL access right.

lpServiceStatus

A pointer to a SERVICE_STATUS structure thatreceives the latest service status information. The information returned reflects the most recent status thatthe service reported to the service control manager.

The service control manager fills in the structure only whenGetLastError returns one of the following errorcodes: NO_ERROR, ERROR_INVALID_SERVICE_CONTROL,ERROR_SERVICE_CANNOT_ACCEPT_CTRL, orERROR_SERVICE_NOT_ACTIVE. Otherwise, the structure is not filled in.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, callGetLastError.

The following error codes can be set by the service control manager. Other error codes can be set by theregistry functions that are called by the service control manager.

Return codeDescription
ERROR_ACCESS_DENIED
The handle does not have the required access right.
ERROR_DEPENDENT_SERVICES_RUNNING
The service cannot be stopped because other running services are dependent on it.
ERROR_INVALID_HANDLE
The specified handle was not obtained using CreateService or OpenService, or the handle is no longer valid.
ERROR_INVALID_PARAMETER
The requested control code is undefined.
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 process for the service was started, but it did not call StartServiceCtrlDispatcher, or the thread that called StartServiceCtrlDispatcher may be blocked in a control handler function.
ERROR_SHUTDOWN_IN_PROGRESS
The system is shutting down.

Remarks

The ControlService function asks the ServiceControl Manager (SCM) to send the requested control code to the service. The SCM sends the code if the servicehas specified that it will accept the code, and is in a state in which a control code can be sent to it.

The SCM processes service control notifications in a serial fashion—it will wait for oneservice to complete processing a service control notification before sending the next one. Because of this, a callto ControlService will block for 30 seconds if anyservice is busy handling a control code. If the busy service still has not returned from its handler function whenthe timeout expires, ControlService fails withERROR_SERVICE_REQUEST_TIMEOUT.

To stop and start a service requires a security descriptor that allows you to do so. The default securitydescriptor allows the LocalSystem account, and membersof the Administrators and Power Users groups to stop and start services. To change the security descriptor of aservice, seeModifying the DACL for a Service.

The QueryServiceStatusEx function returns aSERVICE_STATUS_PROCESS structurewhose dwCurrentState and dwControlsAccepted members indicatethe current state and controls accepted by a running service. All running services accept theSERVICE_CONTROL_INTERROGATE control code by default. Drivers do not accept control codesother than SERVICE_CONTROL_STOP andSERVICE_CONTROL_INTERROGATE. Each service specifies the other control codes that itaccepts when it calls the SetServiceStatus functionto report its status. A service should always accept these codes when it is running, no matter what it isdoing.

The following table shows the action of the SCM in each of the possible service states.

Service stateStopOther controls
STOPPED(c)(c)
STOP_PENDING(b)(b)
START_PENDING(a)(b)
RUNNING(a)(a)
CONTINUE_PENDING(a)(a)
PAUSE_PENDING(a)(a)
PAUSED(a)(a)

Examples

For an example, see Stopping a Service.

Requirements

Minimum supported clientWindows XP [desktop apps only]
Minimum supported serverWindows Server 2003 [desktop apps only]
Target PlatformWindows
Headerwinsvc.h (include Windows.h)
LibraryAdvApi32.lib
DLLAdvApi32.dll

See also

-->

Sends a control code to a service.

To specify additional information when stopping a service, use theControlServiceEx function.

Syntax

Parameters

hService

A handle to the service. This handle is returned by theOpenService orCreateService function. Theaccess rights required for this handledepend on the dwControl code requested.

dwControl

This parameter can be one of the following control codes.

Control codeMeaning
SERVICE_CONTROL_CONTINUE
0x00000003
Notifies a paused service that it should resume. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_INTERROGATE
0x00000004
Notifies a service that it should report its current status information to the service control manager. The hService handle must have the SERVICE_INTERROGATE access right.

Note that this control is not generally useful as the SCM is aware of the current state of the service.

SERVICE_CONTROL_NETBINDADD
0x00000007
Notifies a network service that there is a new component for binding. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDDISABLE
0x0000000A
Notifies a network service that one of its bindings has been disabled. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDENABLE
0x00000009
Notifies a network service that a disabled binding has been enabled. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_NETBINDREMOVE
0x00000008
Notifies a network service that a component for binding has been removed. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead.
SERVICE_CONTROL_PARAMCHANGE
0x00000006
Notifies a service that its startup parameters have changed. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_PAUSE
0x00000002
Notifies a service that it should pause. The hService handle must have the SERVICE_PAUSE_CONTINUE access right.
SERVICE_CONTROL_STOP
0x00000001
Notifies a service that it should stop. The hService handle must have the SERVICE_STOP access right.

After sending the stop request to a service, you should not send other controls to the service.

This value can also be a user-defined control code, as described in the following table.

Control codeMeaning
Range 128 to 255
The service defines the action associated with the control code. The hService handle must have the SERVICE_USER_DEFINED_CONTROL access right.

lpServiceStatus

A pointer to a SERVICE_STATUS structure thatreceives the latest service status information. The information returned reflects the most recent status thatthe service reported to the service control manager.

The service control manager fills in the structure only whenGetLastError returns one of the following errorcodes: NO_ERROR, ERROR_INVALID_SERVICE_CONTROL,ERROR_SERVICE_CANNOT_ACCEPT_CTRL, orERROR_SERVICE_NOT_ACTIVE. Otherwise, the structure is not filled in.

Return value

Error Control Coding Pdf

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, callGetLastError.

The following error codes can be set by the service control manager. Other error codes can be set by theregistry functions that are called by the service control manager.

Return codeDescription
ERROR_ACCESS_DENIED
The handle does not have the required access right.
ERROR_DEPENDENT_SERVICES_RUNNING
The service cannot be stopped because other running services are dependent on it.
ERROR_INVALID_HANDLE
The specified handle was not obtained using CreateService or OpenService, or the handle is no longer valid.
ERROR_INVALID_PARAMETER
The requested control code is undefined.
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 process for the service was started, but it did not call StartServiceCtrlDispatcher, or the thread that called StartServiceCtrlDispatcher may be blocked in a control handler function.
ERROR_SHUTDOWN_IN_PROGRESS
The system is shutting down.

Remarks

The ControlService function asks the ServiceControl Manager (SCM) to send the requested control code to the service. The SCM sends the code if the servicehas specified that it will accept the code, and is in a state in which a control code can be sent to it.

The SCM processes service control notifications in a serial fashion—it will wait for oneservice to complete processing a service control notification before sending the next one. Because of this, a callto ControlService will block for 30 seconds if anyservice is busy handling a control code. If the busy service still has not returned from its handler function whenthe timeout expires, ControlService fails withERROR_SERVICE_REQUEST_TIMEOUT.

To stop and start a service requires a security descriptor that allows you to do so. The default securitydescriptor allows the LocalSystem account, and membersof the Administrators and Power Users groups to stop and start services. To change the security descriptor of aservice, seeModifying the DACL for a Service.

The QueryServiceStatusEx function returns aSERVICE_STATUS_PROCESS structurewhose dwCurrentState and dwControlsAccepted members indicatethe current state and controls accepted by a running service. All running services accept theSERVICE_CONTROL_INTERROGATE control code by default. Drivers do not accept control codesother than SERVICE_CONTROL_STOP andSERVICE_CONTROL_INTERROGATE. Each service specifies the other control codes that itaccepts when it calls the SetServiceStatus functionto report its status. A service should always accept these codes when it is running, no matter what it isdoing.

The following table shows the action of the SCM in each of the possible service states.

Service stateStopOther controls
STOPPED(c)(c)
STOP_PENDING(b)(b)
START_PENDING(a)(b)
RUNNING(a)(a)
CONTINUE_PENDING(a)(a)
PAUSE_PENDING(a)(a)
PAUSED(a)(a)

Examples

For an example, see Stopping a Service.

Requirements

Minimum supported clientWindows XP [desktop apps only]
Minimum supported serverWindows Server 2003 [desktop apps only]
Target PlatformWindows
Headerwinsvc.h (include Windows.h)
LibraryAdvApi32.lib
DLLAdvApi32.dll

See also





broken image