Turn: Dynamic Loading and debugging of WINCE stream driver and quick development of WINCE stream driver with EVC

Source: Internet
Author: User

This kind of driver mainly presents streaming function interfaces, including XXX_Init, XXX_Deinit, XXX_Open, XXX_Close, XXX_Read, XXX_Write, XXX_Seek, XXX_IOControl, XXX_PowerUp, XXX_PowerDown, etc, note that the preceding interfaces must be output, and XXX must contain three characters. Otherwise, an error occurs. You can manually call the RegisterDevice () and DeregisterDevice () functions to load and uninstall the driver. Users can operate such devices as standard files. They can interact with the driver by calling corresponding file operations.

1. Compile the driver source file under EVC to generate the driver DLL.

Note: during compilation, pay attention to project setting. To add the driver's export file, add/def: "bsp_ir.def" to project options. This step is very important, otherwise, the driver cannot be called by the application. You can also use _ declspec (dllexport) to save the need to manually define which functions to export in the DEF file.

2. Use EVC to write a program that dynamically loads the driver, for example:

// Dynamically load the stream driver;

HANDLE m_hIR;
M_hIR = RegisterDevice (TEXT ("IRD"), 1, TEXT ("bsp_ir.dll"), 1); // the file name of your stream driver
If (m_hIR = NULL ){
: MessageBox (NULL, NULL, _ T ("load driver fail! "), MB_ OK );
}
Else
: MessageBox (NULL, NULL, _ T ("load driver sucess"), MB_ OK );

// Uninstall the stream driver;
: MessageBox (NULL, NULL, _ T ("unload driver"), MB_ OK );
DeregisterDevice (m_hIR );

3. Copy the generated DLL file to the windows directory of the Target Platform and use the application to dynamically load the driver.
I have not added the driver registration information in the registry or can access it using an application. It may not be necessary.

This article from the CSDN blog, reproduced please indicate the source: http://blog.csdn.net/wincemobile/archive/2009/05/06/4154981.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.