News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

PC-WORKBENCH

Started by HATEM, December 28, 2004, 02:53:01 PM

Previous topic - Next topic

HATEM

Hi everyone,

I am designing a pc-workbench for my term project which has the following options:

1. Identify Hardware components
2. Processor
3. Hard drive
4. Memory
5. Mouse
6. Serial Port
7. Parallel Port
8. Print a Report About the Computer and Save it on a File

Until now I suceeded in getting processor information (family,speed,manifacturer,cache,serial number) and i got the mouse information (status,number of buttons).

If any one please can guide me about any other options I will be very thankfull.Also I will be very happy to tell you about any step i have reached.

I am really stucked in getting the memory size and information about the hard drive and getting the pc components and how to get the parellel and the serial ports.

I am waiting for your replays...

Regards

anon

What information are you trying to get from the serial ports ?
If you just want the current settings for baud rate, parity, stop bits, etc.
You can use CreateFile and GetCommState.

HATEM

What I need is the address of each parelell and serial port on the pc.

thank you for your replay.

regards

pbrennick

For Memory, GlobalMemoryStatus will store the amount of free space into a structure, read win32.hlp for more info on this and other needs.  This is very simple to do, have you tried?

Paul

HATEM

Thank you for your help. I just searched about the GlobalMemoryStatus but i really didnt understand.Please forgive me for my level of knowldge but I want to know how i can do it in assembly.

regards

donkey

Not much to it assuming that you are doing a Windows 32 bit application...

MEMORYSTATUS STRUCT
  dwLength          DD
  dwMemoryLoad      DD
  dwTotalPhys       DD
  dwAvailPhys       DD
  dwTotalPageFile   DD
  dwAvailPageFile   DD
  dwTotalVirtual    DD
  dwAvailVirtual    DD
MEMORYSTATUS ENDS

.DATA
MemStat MEMORYSTATUS <?>
.CODE
invoke GlobalMemoryStatus, offset MemStat
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

HATEM


Thank you for your help.I am using  MASM611P, I tried to use this code but I dont think that MASM support it.

Regards

00100b

Did you include Kernel32.inc and includelib kernel32.lib?

HATEM


Thank you for your help. No I didnt , How can i get them ?


Regards

donkey

They are included with the MASM32 package in the INCLUDE and LIB subfolders.

include c:\masm32\include\windows.inc
include c:\masm32\include\kernel32.inc
includelib c:\masm32\lib\kernel32.lib

You should not have to include the STRUCT definition if you are using Windows.inc.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

petezl

Hatem,
QuoteThank you for your help. I just searched about the GlobalMemoryStatus but i really didnt understand.Please forgive me for my level of knowldge but I want to know how i can do it in assembly.

Here is a commented rough demo showing how it works! Most api calls using structures are along similar lines...

Peter.


[attachment deleted by admin]
Cats and women do as they please
Dogs and men should realise it.

HATEM

I really apreciate your help. I dont think that I can understand your way. Today i seuceeded to find how many serial ports that the pc has and thier addresses. However I know how to get the parallel port address but i dunno how to get the number of parallel ports. I always refer to Art of Assembly when i program but maqny of the instructions are old for the PCs today  especially the one for memory size. I couldnt find how to get number of hard drives or the size of the hard drive.

Regards

donkey

For the drives you might check out WinExplorer that I posted in the GoAsm forum of this board, it has an internal function to build a list of drives and get their types. It is not exactly what you're looking for but will introduce you to the APIs necessary.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

MichaelW

For disk information you could start by searching MSDN for "Disk Management Reference", and "DeviceIoControl".
eschew obfuscation