Use the WIN_ERROR_HANDLING configuration variable to determine how hardware errors are handled.
When this variable is set to "1" (the default), certain errors are handled directly by 32-bit Windows, and do not automatically return a file error code. For these errors, a dialog box is displayed that describes the error and offers Cancel and Retry buttons. The user may correct the error and click Retry. If the user clicks Cancel, then your program receives the file error that it would have normally received.
If you set WIN_ERROR_HANDLING to "0", then the dialog box is not shown and your program receives the error directly.