Q31009: Protected-Mode C Extensions Fail with "Protection Fault"
Article: Q31009 Product(s): See article Version(s): 1.00 | 1.00 Operating System(s): MS-DOS | OS/2 Keyword(s): ENDUSER | docerr | mspl13_basic Last Modified: 29-AUG-1988 Problem: I am writing C extensions for the protected mode of OS/2. All my extensions fail with a general-protection fault. The sample program on Page 85 of the "Microsoft Editor for MS OS/2 and MS-DOS: User's Guide" also fails. Response: Page 78 of the "Microsoft Editor for MS OS/2 and MS-DOS: User's Guide" incorrectly states that the second argument is a NULL pointer. The programs are crashing because the incorrect value is being passed to the FileNameToHandle routine. This routine requires a pointer to a null string, not a null pointer. For example, the following statement cfile=FileNameTohandle("",NULL); should read as follows: cfile=FileNameTohandle("","");
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.