VBScript generates error 0x800A0006 (Overflow) on call of PCIScope functions.

Synopsis:

Our customer wrote: "I am experiencing problems running VbScripts. When performing read or write operations from PCI Memory space (App.Memory.ReadQWord etc).
The original version of read_mem.vbs script works fine, using the Address = &HC0000. However the problem occurs when changing the read address to the value greater or equal to &H80000000 (i.e. when Address bit 32 is set to '1').
When I'm running old PCIScope 3.00.004 under WindowsTM XP the overflow problem do not occurs."

Reason:

This problem is due to limitations of VBScript and (eventually) JScript.

Solution:

Use any other high-level language supporting an automation; e.g. C++ or C#.

Explanation:

The difference in behavior between PCIScope 3.00.004 and 4.00.xxx is due to the fact that PCIScope 3.00.004 registers an interface for x32 addressing only, while PCIScope 4.00.xxx registers an interface for x64 addressing.
As result: the Windows COM interface casts the address 0x80000000 (passed by the script) to the DWORD in case of PCIScope 3.00.004 and to the QWORD in case of PCIScope 4.00.xxx.

In VBScript the integer value should be in range -231 and +231. Any address or data value exceeding above limits will cause an error 0x800A0006 (Overflow).

In JScript the integer value should be in range -253 and +253. Any address or data value exceeding above limits will throw an exception.

As you can see: the JScript is more flexible as VBScript, however neither script language is appropriate to cover the entire x64 address range.