|
-
Oct 6th, 2001, 11:45 AM
#1
Thread Starter
Lively Member
Detecting Memory
Does anyone know of a function that detects the amount of physical memory in a machine.
Cheers
Peter
P.S this is to run under windows
"Let's all join forces, rule with an iron hand...and prove to all the world, metal rules the land..."
-- Judas Priest
My email is [email protected]
-
Oct 6th, 2001, 04:52 PM
#2
Code:
#include <windows.h>
//return total memory NOT available memory
long memsize(){
MEMORYSTATUS size;
long i;
size.dwLength = sizeof(MEMORYSTATUS);
i=GlobalMemoryStatus(&size);
return size.dwTotalPhys;
}
-
Oct 10th, 2001, 07:25 PM
#3
Hyperactive Member
Do you know how to do it without using windows.h?(I dislike windows.h) You use interrupts. If you wanted to find the memory on a different platform, say DOS, you would need interrupts. I was just trying to find out how to do this, but at the moment, I can't find the actual Interrupt number you use. Here's the basic framework... :
#include <dos.h>
union REGS i, o;
/* These are basically arguments. Some interrupt numbers have
* several subfunction numbers... Usually, you only use AX or BX,
* but, for some functions, you may need the others. */
i.x.ax = ?;
i.x.bx = ?;
i.x.cx = ?;
i.x.dx = ?;
int86(intnuminhex, &i, &o);
var = o.x.ax;
/* Put the value of ax in var... This would be the amount of RAM if
* you found the interrupt number you need by searching on the
* net... */
There are some interrupt lists which have all of the interrupts out there...
Designer/Programmer of the Comtech Operating System(CTOS)
-
Oct 10th, 2001, 10:35 PM
#4
WarM -
You should find abdul's post about using asm, calling 'Interrupts'.
I have a different point of view from you two, but that's just fine.
-
Oct 11th, 2001, 07:04 AM
#5
Hyperactive Member
Why, am I that bad???
Is it about the int86(int,i,o) thing or is it about my sig?
Designer/Programmer of the Comtech Operating System(CTOS)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|