DWORD xxx_init (DWORD dwcontext,
Lpcvoid lpvbuscontext );
Dwcontext: pointer to the Registry, indicating the path of the streaming activity key.
Lpvbuscontext: Used as the fourth parameter of activedevice to pass the pointer of process ing.
Returned value: If this function is successfully executed, a device context handle is returned. Otherwise, 0 is returned. This handle will be transferred to the xxx_open, xxx_powerdown, xxx_powerup, and xxx_deinit functions.
Note: This function is called when the driver is loaded by the system.
Bool xxx_deinit (DWORD hdevicecontext );
Hdevicecontext: The device context handle created and returned by xxx_init.
Returned value: if the call is successful, true is returned. If the call fails, false is returned.
Note: This function is called when the driver is uninstalled by the system.
DWORD xxx_open (DWORD hdevicecontext,
DWORD accesscode,
DWORD merge mode );
Hdevicecontext: The device context handle created and returned by xxx_init.
Accesscode: indicates the access permission of the device. The access permission is a combination of read and write permissions passed in by creatfile.
File Sharing Mode: indicates the file sharing mode of the device. The sharing mode is a combination of the Sharing permissions passed in by creatfile.
Returned value: If this function is successfully executed, a device context handle that identifies the enabled device is returned. Otherwise, 0 is returned. This handle is sent to xxx_read, xxx_write, xxx_seek, and xxx_iocontrol.
Note: This function is called when an application calls the creatfile () function.
Bool xxx_close (DWORD hopencontext );
Hopencontext: The device context handle created and returned by xxx_open.
Returned value: if the call is successful, true is returned. If the call fails, false is returned.
Note: This function is called when the application calls the closehandle () function.
DWORD xxx_read (DWORD hopencontext,
Lpvoid pbuffer,
DWORD count );
Hopencontext: The device context handle created and returned by xxx_open.
Pbuffer: pointer to the data buffer read by the device.
Count: the number of bytes that the application wants to read from the device to the buffer zone.
Returned value: "0" indicates that the end of the file has been reached, and "-1" indicates that an error has been returned. If execution is successful, the actual number of bytes is returned.
Note: This function is called when an application calls the readfile () function.
DWORD xxx_write (DWORD hopencontext,
Lpvoid pbuffer,
DWORD count );
Hopencontext: The device context handle created and returned by xxx_open.
Pbuffer: pointer to the data buffer to be written to the device.
Count: the number of bytes that the application wants to write to the device buffer.
Returned value: "-1" indicates an error. If execution is successful, the actual number of bytes written is returned.
Note: This function is called when an application calls the writefile () function.
DWORD xxx_iocontrol (DWORD hopencontext,
DWORD dwcode,
Pbyte pbufin,
DWORD dwlenin,
Pbyte pbufout,
DWORD dwlenout,
Pdword pdwactualout );
Hopencontext: The device context handle created and returned by xxx_open.
Dwcode: indicates the control operation code of I/O. These encodings are generally customized and generally included in header files.
Pbufin: pointer to the input buffer.
Dwlenin: number of bytes to be written.
Pbufout: output buffer pointer.
Dwlenout: Number of output bytes.
Pdwactualout: number of bytes actually output.
Return Value: if the call is successful, true is returned. Otherwise, false is returned ..
Note: This function is called when the application calls the deviceiocontrol () function.
Void xxx_powerdown (DWORD hdevicecontext );
Hdevicecontext: The device context handle created and returned by xxx_init.
Note: When the system stops supplying power to the device or calls the deviceiocontrol () function, this function is called when the I/O command is ioctl_power_xxx.
Void xxx_powerup (DWORD hdevicecontext );
Hdevicecontext: The device context handle created and returned by xxx_init.
Note: This function is called when the system restores power to the device, or when the deviceiocontrol () function is called, the I/O command word is ioctl_power_xxx.
DWORD xxx_seek (DWORD dwopen, long ldelta, word wtype );