1. Robert - Ularge_Integers
Hi Robert,
Here is a simple question. Can EU handle Ularge_Integers? I would like to
write a wrapper for the GetDiskFreeSpace and GetDiskFreeSpaceEx functions
but the problem is that the GetDiskFreeSpaceEx function returns
Ularge_Integers which are 64bit in size... you need this function to get
the drive size for drives larger than 2.1 GB in size on Win9x OSR2 or
higher.
This is a primer for a wrapper which would give info on all the systems
hardware including OS version. So if anyone has source that they would like
to share along these lines I would greatly appreciate it.
TIA,
JKinsey
P.S. Sorry if you got this twice
2. Re: Robert - Ularge_Integers
- Posted by Robert Craig <rds at ATTCANADA.NET>
Feb 10, 1999
-
Last edited Feb 11, 1999
John Kinsey writes:
> Can EU handle Ularge_Integers? I would like to
> write a wrapper for the GetDiskFreeSpace and
> GetDiskFreeSpaceEx functions
> but the problem is that the GetDiskFreeSpaceEx function
> returns Ularge_Integers which are 64bit in size...
> you need this function to get the drive size for drives
> larger than 2.1 GB in size on Win9x OSR2 or higher.
Euphoria's integer type goes up to 31 bits.
Euphoria's atom type allows exact integer values up to the
mantissa size of IEEE double-precision floating-point.
I believe IEEE double-precision is something like:
52-bit mantissa
11-bit exponent
1-bit sign
------------
64-bit total
A number like 2.1 Gb won't fit in an integer,
but numbers a million times (i.e. 20-bits) greater should
fit in an atom with no loss of precision.
The 64-bit numbers "returned" by GetDiskFreeSpaceEx()
are returned via pointers to this structure, passed as arguments:
typedef struct _ULARGE_INTEGER {
DWORD LowPart;
DWORD HighPart;
} ULARGE_INTEGER;
You would have to allocate() 8 bytes for each number
and pass the addresses to GetDiskFreeSpaceEx().
After the call you could multiply the HighPart's by power(2,32)
and add them to the LowParts. (use peek4u())
The results should be stored in Euphoria atoms.
Regards,
Rob Craig
Rapid Deployment Software
http://members.aol.com/FilesEu/
3. Re: Robert - Ularge_Integers
- Posted by Daniel Berstein <daber at PAIR.COM>
Feb 10, 1999
-
Last edited Feb 11, 1999
At 06:52 p.m. 10-02-99 -0500, you wrote:
>Hi Robert,
>Here is a simple question. Can EU handle Ularge_Integers? I would like to
>write a wrapper for the GetDiskFreeSpace and GetDiskFreeSpaceEx functions
>but the problem is that the GetDiskFreeSpaceEx function returns
>Ularge_Integers which are 64bit in size... you need this function to get
>the drive size for drives larger than 2.1 GB in size on Win9x OSR2 or
>higher.
> This is a primer for a wrapper which would give info on all the systems
>hardware including OS version. So if anyone has source that they would like
>to share along these lines I would greatly appreciate it.
From Win SDK help:
The ULARGE_INTEGER structure is used to specify a 64-bit unsigned integer
value.
typedef union _ULARGE_INTEGER {
struct {
DWORD LowPart;
DWORD HighPart;
};
DWORDLONG QuadPart;
} ULARGE_INTEGER;
Members
LowPart
Specifies the low-order 32 bits.
HighPart
Specifies the high-order 32 bits.
QuadPart
Specifies a 64-bit unsigned integer.
Remarks
The ULARGE_INTEGER structure is actually a union. If your compiler has
built-in support for 64-bit integers, use the QuadPart member to store the
64-bit integer. Otherwise, use the LowPart and HighPart members to store
the 64-bit integer.
In other words:
Just allocate 64 bits (8 bytes) of memory for each PULARGE_INTEGER and then
peek() the lower and upper 32 bits (4 bytes = Euphoria integer) separetly.
Regards,
Daniel Berstein
daber at pair.com
4. Re: Robert - Ularge_Integers
Thanks Robert and Daniel,
This should help allot.
Thanks,
JKinsey
-----Original Message-----
From: Euphoria Programming for MS-DOS
[mailto:EUPHORIA at LISTSERV.MUOHIO.EDU]On Behalf Of Robert Craig
Sent: Wednesday, February 10, 1999 9:20 PM
To: EUPHORIA at LISTSERV.MUOHIO.EDU
Subject: Re: Robert - Ularge_Integers
John Kinsey writes:
> Can EU handle Ularge_Integers? I would like to
> write a wrapper for the GetDiskFreeSpace and
> GetDiskFreeSpaceEx functions
> but the problem is that the GetDiskFreeSpaceEx function
> returns Ularge_Integers which are 64bit in size...
> you need this function to get the drive size for drives
> larger than 2.1 GB in size on Win9x OSR2 or higher.
Euphoria's integer type goes up to 31 bits.
Euphoria's atom type allows exact integer values up to the
mantissa size of IEEE double-precision floating-point.
I believe IEEE double-precision is something like:
52-bit mantissa
11-bit exponent
1-bit sign
------------
64-bit total
A number like 2.1 Gb won't fit in an integer,
but numbers a million times (i.e. 20-bits) greater should
fit in an atom with no loss of precision.
The 64-bit numbers "returned" by GetDiskFreeSpaceEx()
are returned via pointers to this structure, passed as arguments:
typedef struct _ULARGE_INTEGER {
DWORD LowPart;
DWORD HighPart;
} ULARGE_INTEGER;
You would have to allocate() 8 bytes for each number
and pass the addresses to GetDiskFreeSpaceEx().
After the call you could multiply the HighPart's by power(2,32)
and add them to the LowParts. (use peek4u())
The results should be stored in Euphoria atoms.
Regards,
Rob Craig
Rapid Deployment Software
http://members.aol.com/FilesEu/