Microsoft KB Archive/106704

From BetaArchive Wiki

PRB: General Protection Fault When Using FOXTOOLS.FLL

ID: Q106704

2.50 2.50a 2.50b WINDOWS kbprg kbprb

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

Keywords          : FxprgFoxtools 
Version           : 2.50 2.50a 2.50b
Platform          : WINDOWS

Last Reviewed: April 30, 1996
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.