Replacement of the WinInet User Interface (Windows Embedded CE 6.0)
1/6/2010
The Resources and Resource Editors are used to make simple changes to the text strings in Windows Embedded CE dialog and message boxes and to create new dialog boxes.
However, there may be situations where you need to change not only the content of a system message, but the actions taken in response to a message. For example, instead of presenting a dialog box that requires a user to choose an action, you may want the system to take a predetermined action and provide a message to the user. The replaceable user interface component of WinInet enables you to write code that intercepts WinInet messages and handles them appropriately for a particular user scenario. You do this by modifying and recompiling the dynamic link library file, wininetui.lib. Source code for the wininetui library is located in the Public\IE\Oak\Wininetui folder. Source code for a sample custom user interface is located in %_WINCEROOT%\Public\IE\Oak folder.
Your custom error- and message-handling code is implemented through the IsDialogBoxHandled Callback Function (WinInet) and the IsMessageBoxHandled Callback Function. Before WinInet opens a message or dialog box, it calls the appropriate callback function with a handle to the parent window for the message or error. If the function returns ERROR_CALL_NOT_IMPLEMENTED, WinInet proceeds with its own message or dialog box.
To implement IsDialogBoxHandled for handling errors related to the security certificate
Determine the size of the buffer that will store the security flag that is returned by the InternetQueryOption function.
Declare a DWORD variable to hold the buffer size and initialize the DWORD variable to zero.
DWORD dwBufferLength=0;
Call InternetQueryOption and pass NULL for the address of the buffer.
InternetQueryOption (NULL,INTERNET_OPTION_SECURITY_FLAGS,NULL,&dwBufferLength);
Allocate memory for the buffer.
lpBuffer=new char[dwBufferLength];
Call InternetQueryOption again by passing INTERNET_OPTION_SECURITY_FLAGS in dwOption and receive the security flag in lpBuffer.
InternetQueryOption (NULL,INTERNET_OPTION_SECURITY_FLAGS,(LPVOID)lpBuffer,&dwBufferLength);
If the user wants to continue,
Call the InternetSetOption function and pass the security flag received in lpBuffer parameter of InternetQueryOption.
For example, if DLG_FLAGS_INVALID_CA is returned, then call InternetSetOption and pass DLG_FLAGS_IGNORE_INVALID_CA.DLG_FLAGS_IGNORE_INVALID_CA dwFlag; InternetSetOption(NULL, INTERNET_OPTION_SECURITY_FLAGS, (LPVOID)dwFlag, sizeof(dwFlag));
Return ERROR_SUCCESS.
Note
If the user wants to cancel, return ERROR_CANCELLED.
The following list shows the possible security flags returned by InternetQueryOption:
- DLG_FLAGS_INVALID_CA (0x01000000)
- DLG_FLAGS_SEC_CERT_CN_INVALID (0x02000000)
- DLG_FLAGS_SEC_CERT_DATE_INVALID (0x04000000)
- DLG_FLAGS_SEC_CERT_REV_FAILED (0x00800000)
The following list shows the values to pass in the dwFlag parameter of InternetSetOption
- INTERNET_FLAG_IGNORE_CERT_CN_INVALID
- INTERNET_FLAG_IGNORE_CERT_DATE_INVALID
- INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
- INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP
- SECURITY_FLAG_IGNORE_UNKNOWN_CA
- SECURITY_FLAG_IGNORE_REVOCATION
For more information about INTERNET_FLAG_IGNORE_XXX flags, see API Flags.
For more infomation about SECURITY_FLAG_IGNORE_XXX flags, see Option Flags.