flat assembler
Message board for the users of flat assembler.
Index
> Windows > CPUSpeed |
Author |
|
viki 03 Jan 2006, 13:47
Hello.
I wrote small application for measure a CPU frequency. Code: format PE GUI 4.0 entry start include 'win32a.inc' ID_DIALOG = 10 ID_FREQ1 = 101 ID_MSG = 201 section '.data' data readable writeable CPUSpeed dd 123 bf db '%6lu MHz',0 output rb 20 section '.code' code readable executable start: invoke GetModuleHandle,0 invoke DialogBoxParam,eax,ID_DIALOG,HWND_DESKTOP,DialogProc,0 or eax,eax jz exit exit: invoke ExitProcess,0 proc DialogProc hwnddlg,msg,wparam,lparam push ebx esi edi cmp [msg],WM_INITDIALOG je wminitdialog cmp [msg],WM_COMMAND je wmcommand cmp [msg],WM_CLOSE je wmclose xor eax,eax jmp finish wminitdialog: jmp processed wmcommand: cmp [wparam],BN_CLICKED shl 16 + IDCANCEL je wmclose cmp [wparam],BN_CLICKED shl 16 + IDOK jne processed ;obsBuga ok invoke SleepEx, 100, 0 rdtsc push edx push eax invoke SleepEx, 1000, 0 rdtsc pop ecx sub eax, ecx pop ecx sbb edx, ecx mov ecx, 1000000 div ecx mov [CPUSpeed], eax invoke wsprintf,output,bf,[CPUSpeed] invoke SetDlgItemText,[hwnddlg],ID_FREQ1,output jmp processed wmclose: invoke EndDialog,[hwnddlg],0 processed: mov eax,1 finish: pop edi esi ebx ret endp section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' ; library user,'USER32.DLL' import kernel,\ GetModuleHandle,'GetModuleHandleA',\ ExitProcess,'ExitProcess',\ UpdateWindow,'UpdateWindow',\ SleepEx,'SleepEx' import user,\ DialogBoxParam,'DialogBoxParamA',\ SetDlgItemText,'SetDlgItemTextA',\ wsprintf,'wsprintfA',\ EndDialog,'EndDialog' section '.rsrc' resource data readable directory RT_DIALOG,dialogs resource dialogs,ID_DIALOG,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration dialog demonstration,'CPU Frequency meter',0,0,250,50,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME dialogitem 'STATIC','Frequency:',-1 ,5 ,10,35,10,WS_VISIBLE dialogitem 'STATIC',' ',ID_FREQ1,45,10,55,10,WS_VISIBLE;+WS_BORDER dialogitem 'BUTTON','Find',IDOK,195,10,50,14,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON dialogitem 'BUTTON','Exit',IDCANCEL,195,25,50,14,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON enddialog On win98 and winXP it seens working but on winNT and win2000 it display a correct speed but then there is a error message like this. Any ideas?
|
||||||||||||||||||||
03 Jan 2006, 13:47 |
|
comrade 03 Jan 2006, 20:59
Run it inside a debugger, like OllyDbg, and see where the crash occurs.
|
|||
03 Jan 2006, 20:59 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.