Visual FoxPro and Windows XP SP2 (by John Koziol)

There have been some questions in the VFP community about what issues there are with Visual FoxPro applications under Windows XP SP2. At this time, we're still testing but we do know some basic information.  Basically, the vast majority of applications will be unaffected.  I'll be adding to this thread if other issues crop up.

First off, you should read  and then to get a grasp of what SP2 does.

Here's what we know so far..... 

There's a switch in SP2 called the NX (No Execute) switch.  It is set for the system as a whole but can be set per process. When on, it limits access to areas of memory allocated as data by throwing an access violation.

Two types of uses of VFP are affected when this switch is on:

1.  Calling a COM server via early binding.

2.  Implementing an interface that will be called via early binding.

Now, this switch is only supported on the AMD K8 64-bit processor at this time; NX cannot be switched on for Intel processors. Therefore, there should be no effect on VFP EXEs and DLLs on Intel machines.

I'll update this blog with code samples and any other pertinent information as it becomes known.  For now, I'd summarize with the phrase “don't worry - be happy“






Comments (12)

  1. Fabio Vazquez says:

    Hi John,

    Great post! This is the kind of blog posting I like the most: information from experts you don’t find anywhere else. Congratulations!

  2. John Koziol says:

    Thanks, Fabio! I’ll be posting some "no-no" code samples shortly…but the gist is, most VFP apps will be unaffected.

    If you are utilizing Web Services, there are some ICF issues but they’re generic and not specific to VFP – please read the links I posted.

  3. Ted Roche says:

    Welcome to the blogosphere, John!

    As for the NX switch, what are the implications for clients deploying AMD 64-bit systems? Is this Athlon65, Opteron64, or both? I have clients specing a dual-proc AMD box for ISAPI-based n-tier server, likely with COM+ and ADO data access. Web Services are a possibility, too. Sound like this could affect them! Thanks for the heads=up.

    P.S. What’s an ICF?

  4. Cindy Winegarden says:

    ICF = Internet Connection Firewall

  5. John Koziol says:

    Hi Ted,

    I dunno – this could affect them but I have to admit to being lazy and not researching what these AMD chips are. As aforementioned, you can always set the NX switch off for specific processes if it becomes an issue – please read the documents I linked to. IMHO, it’s not that big of a deal if you plan ahead and I think – personally – it’s much ado about nothing.

  6. John Koziol says:

    OK, here’s the right way and the wrong way to create a COM object in VFP under NX. Note that most of this code is simply creating a DLL to instance.

    BTW, here’s a link to a paper by Calvin that adds more information to this discussion…



    *:* Simple DLL call with earlybinding and late binding


    *:* John Koziol and Calvin Hsia




    *:* Create a simple VFP DLL


    IF FILE("testnx.dll")

    DECLARE integer DllUnregisterServer IN testnx.dll




    SET TEXTMERGE TO testnx.prg



    PROCEDURE MyEval(cExpr)

    RETURN &cExpr




    BUILD PROJECT testnx FROM testnx

    BUILD DLL testnx FROM testnx


    *:* Here’s a good way to create the COM object –

    *:* no early binding. NX compatible.




    RELEASE ox,oy


    *:* Here’s early binding, NOT NX compatible




    RELEASE ox,oy



  7. I have a foxpro application that runs in Windows 98 but it does not execute in Windows 2000 or XP. The error message is a "divide by zero" – Can some one help? – I know that I can buy the virtual pc, but wanted to know if there is a fix there.

Skip to main content