for some reason this code errors out in win2k only

.elseif uMsg == WM_TIMER ; timer message received?
invoke GetTickCount ;Get the total milliseconds since windows started
xor edx,edx
mov ecx,1000 ;mov 1000 into ecx
div ecx ;div eax/ecx or what gettickcount returns by 1000
xor edx,edx ;dump the remainder as we don't need it yet
mov ecx,60 ;mov 60 into ecx now
div ecx ;div new eax by new ecx(60)
mov ebx,edx ;save the remainder because it contains our seconds
xor edx,edx ;dump it again now because we need the register
div ecx ;div eax by ecx(60) again for hours, and the remainder (edx) contains the minutes
invoke wsprintf,addr timebuffer,addr szTime,eax,edx,ebx ;make it all in a pretty little buffer
invoke SendDlgItemMessage, hWin, 155, WM_SETTEXT,0,addr timebuffer ;display that shit

ive attached the whole program with source that im working on if anyone with win2k can figure out why this crashes with user32.dll
Posted on 2003-11-30 14:18:35 by illwill
I changed the line where you use SetTimer.

Now it works.
Posted on 2003-11-30 14:27:34 by Jurgen
awesome thnx for the quick reply i was racking my brain looking at the uptime procdure thinking it was wrong :alright:
Posted on 2003-11-30 14:31:27 by illwill
Do you preserve ebx?
Posted on 2003-11-30 15:38:20 by comrade

Do you preserve ebx?

I forgot to mention, i also added this to your procedure :

uses ebx
Posted on 2003-11-30 15:44:50 by Jurgen
well now it works for win2k but someone told me it crashes on win98
WINFO caused an invalid page fault in module USER32.DLL at 017f:bff53940.
Registers:EAX=00000000 CS=017f EIP=bff53940 EFLGS=00010a17
Posted on 2003-11-30 17:13:13 by illwill
I have 2k here, so i can't test it.
Maybe you should preserve ebx also in the WndProc, can someone confirm this ?
Posted on 2003-11-30 18:12:23 by Jurgen
Crashes in DispatchMessage at

77E189CE F643 2B C0 test byte ptr ds:,0C0

He needs to preserve ebx in Wndproc.
Posted on 2003-11-30 21:15:39 by roticv
new asm... also fixed the os procedure , it failed to determine winxp and win2k3 correctly
Posted on 2003-11-30 21:28:17 by illwill
This comes from MSDN (GetTickCount API explanation):

The elapsed time is stored as a DWORD value. Therefore, the time will wrap around to zero if the system is run continuously for 49.7 days.

If you need a higher resolution timer, use a multimedia timer or a high-resolution timer.

To obtain the time elapsed since the computer was started, retrieve the System Up Time counter in the performance data in the registry key HKEY_PERFORMANCE_DATA. The value returned is an 8-byte value. For more information, see Performance Monitoring.
Posted on 2003-12-02 15:22:30 by SamiP
they probably did that because Windows wont stay up longer than 2 weeks anyhow :grin:
Posted on 2003-12-02 16:41:45 by illwill
Nah, they did that because GetTickCount wasn't meant for accurate reporting of system uptime. And trust me, NT has no problem staying up for more than 49 days :)
Posted on 2003-12-03 03:51:56 by f0dder
Most of the time, we have NT or 2K servers at work which are up more than a year continuosly. And reason to reboot them is mandatory power outtage, not the failure of servers os. :grin:
Posted on 2003-12-03 14:04:00 by SamiP