PRB: General Protection Fault When Using FOXTOOLS.FLL

Last reviewed: April 29, 1996
Article ID: Q106704
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b

SYMPTOMS

A general protection (GP) fault occurs when you are using FOXTOOLS.FLL.

CAUSE

RegFn() or CallFn() is incorrectly declared. The argument type and return argument type must be the same; otherwise, a general protection (GP) fault may possibly occur.

RESOLUTION

Make the argument type and return argument type the same. For example, the following function is incorrectly declared:

   SET LIBRARY TO SYS(2004)+'FOXTOOLS.FLL'
   x=REGFN('GetDriveType','I','C')
   y=CALLFN(x,1)

To correct the problem, modify the function as follows:

   SET LIBRARY TO SYS(2004)+'FOXTOOLS.FLL'
   x=REGFN('GetDriveType','I','I')
   y=CALLFN(x,1)

MORE INFORMATION

FOXTOOLS.FLL is a library that is supplied with FoxPro for Windows. FOXTOOLS.FLL allows FoxPro programs to call any Windows DLL functions that meet the following requirements:

  1. Take the following arguments: integer, long, float, double, string/buffer. These can be passed by reference or by value.

  2. Return the following types: integer, long, float, double, string/buffer. These are returned by value only.

Two FLL functions are used provide this functionality:

   RegFn() - registers a function and the arguments it takes
   CallFn() - calls a registered function

RegFn() and CallFn() have the following syntax:

   RegFn(FunctionName, ArgTypes, ReturnType, DLLName) returns FnHandle

   CallFN(FnHandle, Arg1, Arg2, ....) returns a value

REFERENCES

Microsoft Windows Software Development Kit (SDK), "Programmer's Reference, Volume 2: Functions," pages 350-354, 785

FOXTOOLS.WRI located in the C:\FOXPROW\GOODIES\FOXTOOLS subdirectory

WINDOWS.H located in the C:\C700\INCLUDE subdirectory


Additional reference words: FoxWin 2.50 2.50a 2.50b FOXTOOLS GPF dynamic
link library API application programming interface
KBCategory: kbprg kbprb
KBSubcategory: FxprgFoxtools


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.

Last reviewed: April 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.