This function sends a control code directly to a specified device driver causing the corresponding device to perform the specified operation.
BOOL ServiceIoControl( HANDLE hService, DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize, LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped );
[in] Handle to the service that is to perform the specified operation. The GetServiceHandle function should be called to obtain an unknown service handle.
[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.
[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.
[in] Size, in bytes, of the buffer pointed to by lpInBuffer.
[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.
[in] Size, in bytes, of the buffer pointed to by lpOutBuffer.
[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.
[in] This parameter is ignored and set to NULL.
A nonzero value indicates success. A value of zero indicates failure. To get extended error information, call GetLastError.
ServiceIoControl can only be used for handles obtained through ActivateService, RegisterService, EnumServices, or GetServiceHandle. If a service is opened using CreateFile, DeviceIoControl must be used to pass IO control codes to the underlying service.
OS Versions: Windows CE .NET 4.0 and later.
Link Library: Coredll.lib.
Last updated on Saturday, April 10, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.