Hi !

Fisrt of all I would like to confess, that I'm the beeginer with the
assembler. I think that asm is very interesting, and I would
like to teach it. Also I have read some tutorials, but
it is much interesting to write own examples.

OK, here is the first problem:

this seems to work fine, but:

.586
.model flat, stdcall
option casemap :none ; case sensitive

include \masm32\include\windows.inc

include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
include \masm32\include\version.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\version.lib


.data
szfilename db "pdh.dll",0
szRoot db "\",0
fMtStrinG db "%lu",13,10
Error db "error", 13,10
Error2 db "error2", 13,10
Error1 db "error1", 13,10
.data?
lpdwHandle dd ?
Filesize dd ?
VersionBuffer db 30 dup (?)
VersionMemPtr dd ?
FileInfo dd ?
;FileInfo VS_FIXEDFILEINFO <0,0,0,0,0,0,0,0,0,0,0,0,0>
outputBuffer db 20 dup (?)
sizeBuffer db ?
MajorVer1 DWORD ?
MajorVer2 DWORD ?
MinorVer1 DWORD ?
MinorVer2 DWORD ?


.code

start:

INVOKE GetFileVersionInfoSize,addr szfilename,addr lpdwHandle
mov Filesize,eax
INVOKE GetFileVersionInfo,addr szfilename,0,Filesize,addr VersionBuffer
INVOKE VerQueryValue,addr VersionBuffer,addr szRoot,addr FileInfo,addr outputBuffer

mov edi,FileInfo
assume edi:ptr VS_FIXEDFILEINFO

invoke wsprintf,ADDR sizeBuffer,addr fMtStrinG, .dwProductVersionLS
;invoke StdOut, addr .dwFileVersionLS
invoke StdOut, addr sizeBuffer

assume edi:nothing
.endif
.endif
end start

------------------------------------------------------------------------------------
I can not get any useful data.. I don't now how to access to members of VS_FIXEDFILEINFO
when is used ptr e.g. I don't know if it is correct in my example ?
assume edi:ptr VS_FIXEDFILEINFO \
???
???

I try to format string with "fMtStrinG", but no change....

What's wrong ? Must I have any struct tables declared ?

Thank you for any help....

Primoz.
Posted on 2002-06-19 02:03:22 by primozz
Your strings need to be NULL terminated at the moment your using carriage return/linefeed...

szstring db "xyx",0

Also using stdout so you must be compiling to a console program right?

Accessing pointer variables I usually use...

mov (nodestruct PTR).filepos ,eax

It's clear from a glance what I'm doing, I never use assume...I don't need to repeat what they say when we start assuming things!;)
Posted on 2002-06-19 02:32:50 by MArtial_Code
You've also allotted only one byte (character) for your destination string sizeBuffer. You will overwrite any data you've previously stored in MajorVer1, MajorVer2, MinorVer1, and MinorVer2
Posted on 2002-06-19 13:40:24 by tenkey