flat assembler
Message board for the users of flat assembler.

Index > Windows > HOW DO YOU GET SYSTEM INFO?

Author
Thread Post new topic Reply to topic
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon 01 May 2005, 18:36
I was wondering how you would get information about the computer, for instance, how much ram is on the computer, how big the hard drive is, how much space on the hard drive is used..etc. any thing that can show info about the computer.. if someone can post an example or some code (in fasm) it would be greatly appreciated..thanks!
Post 01 May 2005, 18:36
View user's profile Send private message Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend 03 May 2005, 11:59
1. OS info
Call GetVersionEx and you have everything in OSVERSIONINFO structure

2. Memory info
Call GlobalMemoryStatus and you have everything in MEMORYSTATUS structure

3. Drive info
  • GetDriveType Arrow what kind of drive is it (eg. hard drive, cd-rom, network drive, etc.)
  • GetDiskFreeSpace Arrow eveyrthing about free space on current drive
  • GetVolumeInformation Arrow another info about drive (eg. serial number, etc.)
  • GetLogicalDriveStrings Arrow returns all present drives' numbers (eg. c:\<null>d:\<null<null>)
Post 03 May 2005, 11:59
View user's profile Send private message Visit poster's website Reply with quote
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon 03 May 2005, 22:01
how would you go about using that?
Post 03 May 2005, 22:01
View user's profile Send private message Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 03 May 2005, 22:53
SystemParametersInfo and GetSystemMetrics are cool funcs too Wink
Post 03 May 2005, 22:53
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: US
coconut 03 May 2005, 23:01
pretty easy. define your variable for structure

Code:
osver OSVERSIONINFOEX
    


then you do your

Code:
invoke    GetVersionEx,osver
    


now the osver structure is filled with different data about os version. you could do something like

Code:
cmp    dword [osver.dwPlatformId],VER_PLATFORM_WIN32_NT
je       winnt_platform
;if jump youre on nt platform, if no jump youre on win 9x/me platform
    


then you compare major/minor version info to get exact os version. this article here shows you the exact version numbers for different windows: http://www.codeguru.com/Cpp/misc/misc/system/article.php/c8973/

see msdn for exact details on the OSVERSIONINFOEX structure: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/osversioninfo_str.asp

the other APIs listed by Reverend work similarly
Post 03 May 2005, 23:01
View user's profile Send private message Reply with quote
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon 04 May 2005, 00:06
i tried the "osver OSVERSIONINFOEX" but it didnt work, is there some othe rway i have to define it other than that?
Post 04 May 2005, 00:06
View user's profile Send private message Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend 04 May 2005, 19:20
Redragon wrote:
i tried the "osver OSVERSIONINFOEX" but it didnt work, is there some othe rway i have to define it other than that?

Have you included kernel32.inc from equates directory? The structure itself is defined there, and the compiler must first process this include file
Post 04 May 2005, 19:20
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.