The MASM Forum Archive 2004 to 2012

Project Support Forums => GoAsm Assembler and Tools => Topic started by: donkey on October 01, 2006, 05:55:38 AM

Title: Using VerifyVersionInfoA in GoAsm
Post by: donkey on October 01, 2006, 05:55:38 AM
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
Title: Re: Using VerifyVersionInfoA in GoAsm
Post by: OC on April 08, 2008, 11:09:23 PM
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]