News:

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

Version Info from Resource

Started by georgek01, March 14, 2011, 05:51:05 AM

Previous topic - Next topic

georgek01

Hello!

I would like to get the version number for my application as it starts up. This is what I have so far but I doubt I'm doing it correctly...


GetVersionInfo proc

invoke FindResource,NULL,1,RT_VERSION
.if eax != NULL
invoke LoadResource,NULL,eax
.if eax != NULL

mov eax,(VS_FIXEDFILEINFO ptr [eax]).dwProductVersionMS

invoke wsprintf,addr buffer,addr szNum,eax
invoke MessageBox,hWin,addr buffer,addr AppName,0

.endif
.endif

xor eax,eax
Ret
GetVersionInfo EndP



M$ says:
QuoteLoad Resource returns a handle to the global memory block containing the data associated with the resource.

My question is, how do I access the various memebers of the VS_FIXEDFILEINFO? Is the handle to the global memory block in fact pointing to this structure?

Any assistance/suggestions will be appreciated!

What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

donkey

As long as the version information is standard, you use the following

LOCAL Verification:DWORD
LOCAL RootPath:DWORD
LOCAL pVersion:DWORD
LOCAL pVersionLen:DWORD
LOCAL pProdName:DWORD
LOCAL szMyProgram[MAX_PATH]:BYTE

invoke GetModuleFileName,NULL,addr szMyProgram,MAX_PATH

invoke GetFileVersionInfoSize,addr szMyProgram,OFFSET Verification
or eax,eax
jz FAILED
push eax
invoke GlobalAlloc,GPTR,eax
mov ebx,eax
pop eax
invoke GetFileVersionInfo,addr szMyProgram,NULL,eax,ebx
mov [RootPath],"\"
invoke VerQueryValue,ebx,addr RootPath,addr pVersion,addr pVersionLen
invoke VerQueryValue,ebx,addr ProductQuery,addr pProdName,addr pVersionLen

; pVersion points to the packed version information

invoke GlobalFree,ebx
xor eax,eax
ret
FAILED:
;some error message
ret
"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

georgek01

What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)