The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: HATEM on December 28, 2004, 02:53:01 PM

Title: PC-WORKBENCH
Post by: HATEM on December 28, 2004, 02:53:01 PM
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
Title: Re: PC-WORKBENCH
Post by: anon on December 28, 2004, 03:19:01 PM
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.
Title: Re: PC-WORKBENCH
Post by: HATEM on December 28, 2004, 03:27:43 PM
What I need is the address of each parelell and serial port on the pc.

thank you for your replay.

regards
Title: Re: PC-WORKBENCH
Post by: pbrennick on December 28, 2004, 03:36:58 PM
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
Title: Re: PC-WORKBENCH
Post by: HATEM on December 28, 2004, 03:57:01 PM
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
Title: Re: PC-WORKBENCH
Post by: donkey on December 28, 2004, 04:38:46 PM
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
Title: Re: PC-WORKBENCH
Post by: HATEM on December 28, 2004, 05:00:03 PM

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

Regards
Title: Re: PC-WORKBENCH
Post by: 00100b on December 28, 2004, 05:09:12 PM
Did you include Kernel32.inc and includelib kernel32.lib?
Title: Re: PC-WORKBENCH
Post by: HATEM on December 28, 2004, 05:20:29 PM

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


Regards
Title: Re: PC-WORKBENCH
Post by: donkey on December 28, 2004, 05:30:12 PM
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.
Title: Re: PC-WORKBENCH
Post by: petezl on December 28, 2004, 10:22:59 PM
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]
Title: Re: PC-WORKBENCH
Post by: HATEM on December 29, 2004, 01:16:43 PM
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
Title: Re: PC-WORKBENCH
Post by: donkey on December 29, 2004, 01:32:21 PM
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.
Title: Re: PC-WORKBENCH
Post by: MichaelW on December 30, 2004, 06:27:06 AM
For disk information you could start by searching  MSDN (http://msdn.microsoft.com/default.aspx) for "Disk Management Reference", and "DeviceIoControl".