Can I detect video RAM size in Windows?
Thanks, Mike
Posted on 2002-02-12 10:00:13 by Mike
I don't know why this question was posted in recruitment?

It was asked before in the Game Forum, and I believe the
answer was: Not without DX CAPS, iirc.
Posted on 2002-02-12 10:06:48 by bitRAKE
u can get the RAM Size from the Registry:
(i know this is an asm forum, but i allready got the source in C++, it should be ec to translate it in asm by ur own)

1. read where ur Video Adapter information is stored
char devicekey ;
LONG result;
HKEY hKey;
DWORD dwMemory;
DWORD dataSize;

result = ::RegOpenKeyEx (HKEY_LOCAL_MACHINE,
"Hardware\\Devicemap\\Video", 0, KEY_QUERY_VALUE, &hKey);

// Check if the function has succeeded.

if (result == ERROR_SUCCESS)
{
dataSize = sizeof (devicekey);

// get the registry path of the first adapter
result = ::RegQueryValueEx (hKey, _T("\\Device\\Video0"), NULL, NULL,
(LPBYTE)&devicekey, &dataSize);
}

RegCloseKey (hKey);

// MFC CString
strRegKey.Format("%s", devicekey);

// delete first 18 chars, we dont need them
strRegKey.Delete(0, 18);

2. open the adapter key
result = ::RegOpenKeyEx (HKEY_LOCAL_MACHINE,
strRegKey, 0, KEY_QUERY_VALUE, &hKey);

if (result == ERROR_SUCCESS)
{
dataSize = sizeof (dwMemory);

result = ::RegQueryValueEx (hKey, _T("HardwareInformation.MemorySize"), NULL, NULL,
(LPBYTE)&dwMemory, &dataSize);

// the Memory size is in bytes, divide by 1024 to get KB or MB
dwMemory = ((dwMemory/1024)/1024);
}

RegCloseKey (hKey);


i hope this helps u
_hC_
Posted on 2002-02-13 05:29:28 by _hC_
I don't believe this works in all circumstances :)

In my case (just quickly went to regedit) I don't that information at that location.

Sliver

ps. But it may be worthwhile to check if you don't have any other way of doing it
Posted on 2002-02-13 09:01:13 by Sliver
r u using Win9x/Me?

i have testet it on WinNt 4.0, Win2K and XP with ATI cards and a Geforce3 and it worked (old and new cards)

maybe it doesn't work on Win9x/Me? unfortunately i dont have any non NT system where i could test it

i would like to know if it only works on NT Systems. someone using Win9x/Me and could test it?

thx
_hC_
Posted on 2002-02-13 13:08:29 by _hC_
Afternoon, _hC_.

WinME -> no video key at that location.

Cheers,
Scronty
Posted on 2002-02-13 15:32:31 by Scronty
Windows 98 Second edition...

Sliver
Posted on 2002-02-13 23:48:19 by Sliver
it seems it only works for NT Systems

the Registry Keys on NT r the ones that show up in the Display Settings -> Adapter Information

cant remember how the Adapter Information on Win9x/ME look like, but if they also show the Memory Size of ur Adapter, the information should also be found in the Registry, but at an other location

_hC_
Posted on 2002-02-14 06:19:47 by _hC_
Thanks to all. I work in Windows 98 Second Edition and I have found size of VRAM in registry section HKEY_LOCAL_MACHINESystem\CurrentControlSet\Services\Class\Display\0000\INFO\
There is a parameter named VideoMemory, it consists VRAM size as DWORD.

See attached file, it works on my machine.

Regards, Mike
Posted on 2002-02-14 06:48:17 by Mike
ohhh, someone was faster than me :)

found an old Win98 PC at my Company -> same result as Mike

some additinal Info u may be interested in:

...\0000\ Key: "DriverDesc" -> Driver Name

...\0000\INFO\ Key: "ChipType"

under MODES r all supported Resolutions and Color Depths listed

ex:
...\0000\MODES\8\800*600\

information is not stored in Keys, only Keynames ur used, so just enumerate all subkeynames under MODES

_hC_
Posted on 2002-02-14 07:08:27 by _hC_