.386
.model flat, stdcall  ;32 bit memory model
option casemap :none  ;case sensitive

include Anti-RDTSC.inc

.code

start:

	invoke GetModuleHandle,NULL
	mov		hInstance,eax

    invoke InitCommonControls
	invoke DialogBoxParam,hInstance,IDD_DIALOG1,NULL,addr DlgProc,NULL
	invoke ExitProcess,0

;########################################################################

DlgProc proc uses ebx edi esi,hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

	mov		eax,uMsg
	.if eax==WM_INITDIALOG
		nop ; \o/
	.elseif eax==WM_COMMAND
		mov eax,wParam
		.if eax==IDC_RDTSCCPL0
			.if f_running==FALSE
				invoke DriverCall,hWin
			.else
				invoke SendRequest,hWin
			.endif
		.elseif eax==IDC_STOP
			.if f_running==TRUE
				invoke StopDriver
				invoke MessageBox,NULL,$CTA0("Driver stopped"),addr szCaption,MB_ICONINFORMATION				
			.else
				invoke MessageBox,hWin,$CTA0("Should I say that the driver is already stopped dude ?"),addr szCaption,MB_ICONINFORMATION
			.endif
		.endif
	.elseif eax==WM_CLOSE
		invoke StopDriver
		invoke EndDialog,hWin,0
	.else
		mov		eax,FALSE
		ret
	.endif
	mov		eax,TRUE
	ret

DlgProc endp

end start
