News:

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

Using VerifyVersionInfoA in GoAsm

Started by donkey, October 01, 2006, 05:55:38 AM

Previous topic - Next topic

donkey

I had a bit of trouble with this function in ASM, if anyone ever has to use it this seems to work OK. It is the way Microsoft recommends checking various OS version information.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/versetconditionmask.asp

Is_2K_or_better FRAME
uses edi,ebx
LOCAL osvi :OSVERSIONINFOEX
LOCAL dwlConditionMask :Q

mov D[dwlConditionMask],0
mov D[dwlConditionMask+4],0

// Initialize the OSVERSIONINFOEX structure.
invoke RtlZeroMemory, offset osvi, sizeof OSVERSIONINFOEX
mov D[osvi.dwOSVersionInfoSize], sizeof OSVERSIONINFOEX
mov D[osvi.dwMajorVersion],5
mov D[osvi.dwMinorVersion],0
mov D[osvi.wServicePackMajor],0

// These functions are only available in Windows 2000+ so load them programitically
// returns NULL (not available) if the functions are not found
// Initialize the condition mask.
invoke GetModuleHandle,"Kernel32.dll"
mov edi,eax
invoke GetProcAddress,edi,"VerSetConditionMask"
test eax,eax
jz >
mov ebx,eax

invoke ebx, 0, 0, VER_MINORVERSION, VER_GREATER_EQUAL
invoke ebx, eax, edx, VER_MAJORVERSION, VER_GREATER_EQUAL
invoke ebx, eax, edx, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL

mov [dwlConditionMask+4], edx
mov [dwlConditionMask], eax

// Perform the test
invoke GetProcAddress,edi,"VerifyVersionInfoA"
test eax,eax
jz >
invoke eax, offset osvi, VER_MINORVERSION | VER_MAJORVERSION | VER_SERVICEPACKMAJOR, [dwlConditionMask], [dwlConditionMask+4]
:
RET

ENDF
"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

OC

SetFileVer

This is some older code I've had laying around for quite some time, only verified for Win32 up to Win2003 and .NET 1.1. It's in C but should translate really nicely into asm. Just figured someone might be interested in a simple commandline VERSIONINFO resource editor. No need to edit resource files or recompile and link when all you want to do is change version info. Hope someone finds a use for it.

It was compiled with VC6.

It's a bit large to paste into the message. See the attachment.

OC



[attachment deleted by admin]