Below are snippets from my attempt to display in the cliet area bytes from the OSVERSIONINFO structure. Something is not right because no matter what value i add to esi to get different values from the structure, the output is always the same in the client area.....II'O. I'm not very good with pointers yet.

Any help appreciated.

data.
buffer dword 50 dup(0)

_________________________

.data?
osinfo OSVERSIONINFO <>

____________________________

code.

SETSTUFF proc uses ebx ecx esi

lea esi, osinfo
mov dword ptr , sizeof OSVERSIONINFO
invoke GetVersionEx,
add esi,somevalue ; here is where i add to esi so should get different stuff in eax
mov eax ,dword ptr
mov dword ptr ,eax

xor eax,eax
ret
SETSTUFF endp
_______________________________
.ELSEIF uMsg==WM_PAINT
invoke BeginPaint,hWnd,addr ps
mov hdc,eax
invoke GetClientRect,hWnd,addr rect
lea eax,
lea edx,
invoke DrawText, hdc, eax, 8, edx, DT_SINGLELINE
invoke EndPaint,hWnd,addr ps
Posted on 2003-01-01 21:59:09 by IwasTitan
;Use your structure referenced vars for more readable code. Like this ....

mov osinfo.dwOSVersionInfoSize, SIZEOF OSVERSIONINFO
invoke GetVersionEx, addr osinfo
.if eax == FALSE
;Error reporting here.
.endif

.if osinfo.dwPlatformId == VER_PLATFORM_WIN32_NT
.endif

Enjoy your work, P1
Posted on 2003-01-02 02:26:57 by Pone
On W2K & XP, you may get a Failed result because the structure is too small for the information available. You may need to adjust your program flow accordingly.

Just post here, if you need any other info or help.

Regards, P1
Posted on 2003-01-02 02:47:17 by Pone
Ok Pone i used your method for more readability but i get the same result:
The 4 byte string displayed in the client area is always the same not matter what i add to esi.
Running 98se 4.10.2222A
______________________________________________________
.code
SETSTUFF proc uses esi
mov osinfo.dwOSVersionInfoSize, SIZEOF OSVERSIONINFO
invoke GetVersionEx, addr osinfo
.if eax==0
invoke Beep,NULL,NULL ; no beep so no error
.endif
lea esi, osinfo
add esi, some value
mov eax ,dword ptr
mov dword ptr ,ea
xor eax,eax

ret

SETSTUFF endp
_________________________________________

.ELSEIF uMsg==WM_PAINT
invoke BeginPaint,hWnd,addr ps
mov hdc,eax
invoke GetClientRect,hWnd,addr rect
lea eax,
lea edx,
invoke DrawText, hdc, eax, 8, edx, DT_SINGLELINE
invoke EndPaint,hWnd,addr ps


_____________________________________________

I have also tried this with no result:

mov eax ,osinfo.dwPlatformId
mov dword ptr ,eax
.if eax ==VER_PLATFORM_WIN32_NT;VER_PLATFORM_WIN32s; VER_PLATFORM_WIN32_WINDOWS
invoke Beep,NULL,NULL
.endif

I also tried all other members such dwMajorVersion etc and then compared them to the values in "4.10.2222A" and i get nothing.

The only thing i can assume is that the structure is not getting filled in but GetVersionEx does not return zero so it should have been successful. This is really weird.
Posted on 2003-01-02 09:55:30 by IwasTitan
IwasTitan,

Please study the OSVERSIONINFO structure.
You must format most of the data, because it is binary.
BTW, there is only one string in the structure, that's szCSDVersion.

Your very active and participate well.

So here's my learning file on GetVersionEx. At the time I wrote it there was no OSVERSIONINFOEX in MASM32, so I made my own from the MSDN information. If you have an updated windows.inc just comment out my structure, because it will give an error otherwise.

It outputs current Memory, OS Version and System Directories into a messagebox.
I have tested it around and works well.

Enjoy your work, P1

PS: Hutch, If you want to include it in MASM32, go ahead.
baZik or whomever, If you want to include it the vBulletin FAQs, go ahead.
Posted on 2003-01-02 13:26:06 by Pone
Thanx pone.

I got it to work by having it respond to the WM_CREATE message. I figure my problem was that i was calling my procedure without sending it proper parameters like the window handle etc.

I havn,t done any seriouse programming in a while so i am forgetting stuff but its coming back now.

:alright:
Posted on 2003-01-02 15:13:21 by IwasTitan