다음을 통해 공유


ServiceIoControl (Windows Embedded CE 6.0)

1/6/2010

This function sends a control code directly to a specified device driver causing the corresponding device to perform the specified operation. This function is deprecated. To obtain a handle to a service, call CreateFile. To control the service, call DeviceIoControl with the same parameters you would set for ServiceIoControl.

Syntax

BOOL ServiceIoControl(
  HANDLE hService,
  DWORD dwIoControlCode,
  LPVOID lpInBuf,
  DWORD nInBufSize,
  LPVOID lpOutBuf,
  DWORD nOutBufSize,
  LPDWORD lpBytesReturned,
  LPOVERLAPPED lpOverlapped
);

Parameters

  • hService
    [in] Handle to the service that is to perform the specified operation. The GetServiceHandle function should be called to obtain an unknown service handle.
  • dwIoControlCode
    [in] Specifies the control code for the operation. This value indicates the specific operation to be performed and the type of device on which the operation is to be performed. No values are defined for this parameter; however, the writer of a custom device driver may define IOCTL_XXX control codes per the CTL_CODE macro. These control codes can then be advertised and an application can use them along with DeviceIoControl to perform driver-specific functions.
  • lpInBuf
    [in] Pointer to a buffer that contains the data required to perform the operation. This parameter can be set to NULL if the dwIoControlCode parameter specifies an operation that does not require input data.
  • nInBufSize
    [in] Size, in bytes, of the buffer pointed to by lpInBuffer.
  • lpOutBuf
    [out] Pointer to a buffer that receives the operation's output data. This parameter can be set to NULL if the dwIoControlCode parameter specifies an operation that does not produce output data.
  • nOutBufSize
    [in] Size, in bytes, of the buffer pointed to by lpOutBuffer.
  • lpBytesReturned
    [out] Pointer to a variable that receives the size, in bytes, of the data stored into the buffer pointed to by lpOutBuffer. Even when an operation produces no output data and lpOutBuffer can be set to NULL, the ServiceIoControl function makes use of the variable pointed to by lpBytesReturned.
  • lpOverlapped
    [in] This parameter is ignored and set to NULL.

Return Value

A nonzero value indicates success. A value of zero indicates failure. To get extended error information, call GetLastError.

Remarks

ServiceIoControl is deprecated.

To obtain a handle to a service, call CreateFile. To control the service, call DeviceIoControl with the same parameters you would set for ServiceIoControl.

Requirements

Header service.h
Library coredll.lib
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

Services.exe Functions
ActivateService
RegisterService
GetServiceHandle
EnumServices

Other Resources

CreateFile
DeviceIoControl
Services.exe