home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.sberbank.sumy.ua
/
2014.11.ftp.sberbank.sumy.ua.tar
/
ftp.sberbank.sumy.ua
/
incoming
/
1
/
KEMSQFT0.asm
< prev
next >
Wrap
Assembly Source File
|
2014-02-08
|
7KB
|
283 lines
.386
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\gdi32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
return MACRO arg
mov eax, arg
ret
ENDM
WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
GetCurrentTimeLoc PROTO
OutputDateToFileLoc PROTO :DWORD
.data
cEVK db "Evgeney Victorovich Kupin 27 April 1982",0
szClassName db "Evgeney_Victorovich_Kupin_27_April_1982",0
szDisplayName db "<>",0
cFormatOut db "%d %s %04d %s %d:%02d",0
cFormatFindFile db "T%07d%s",0
strTxt db ".txt",0
cWriteFileName db 256 dup(0)
cDateString db 256 dup(0)
cMonthString db "January",0,"February",0,"March",0,"April",0,"May",0,"June",0,\
"July",0,"August",0,"September",0,"October",0,"November",0,"December",0
cWeekString db "Sunday",0,"Monday",0,"Tuesday",0,"Wednesday",0,"Thursday",0,\
"Friday",0,"Saturday",0
CommandLine dd 0
hWnd dd 0
hInstance dd 0
hIcon dd ?
hinstLib dd ?
JpegFileToBitmapFile dd ?
Day dd 0
Month dd 0
Year dd 0
Week dd 0
Hour dd 0
Minute dd 0
number dd 0
hFindFile dd 0
sysTime SYSTEMTIME <0>
strFindFile WIN32_FIND_DATA <0>
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke GetCommandLine
mov CommandLine, eax
invoke WinMain, hInstance,NULL,CommandLine,SW_SHOWDEFAULT
invoke ExitProcess,eax
WinMain proc hInst :DWORD, hPrevInst :DWORD, CmdLine :DWORD, CmdShow :DWORD
LOCAL wc :WNDCLASSEX
LOCAL msg :MSG
mov wc.cbSize, sizeof WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW \
or CS_BYTEALIGNWINDOW
mov wc.lpfnWndProc, offset WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground, COLOR_WINDOW
mov wc.lpszMenuName, NULL
mov wc.lpszClassName, offset szClassName
push hIcon
pop wc.hIcon
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor, eax
push hIcon
pop wc.hIconSm
invoke RegisterClassEx, ADDR wc
invoke CreateWindowEx,WS_EX_LEFT,
ADDR szClassName,
ADDR szDisplayName,
WS_OVERLAPPEDWINDOW,
0,0,500,500,
NULL,NULL,
hInst,NULL
mov hWnd,eax
invoke ShowWindow,hWnd,SW_SHOWNORMAL
invoke UpdateWindow,hWnd
StartLoop:
invoke GetMessage,ADDR msg,NULL,0,0
cmp eax, 0
je ExitLoop
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
jmp StartLoop
ExitLoop:
return msg.wParam
WinMain endp
OutputDateToFileLoc proc cbLength:DWORD
LOCAL hTextFile :DWORD
LOCAL dwBytesWritten :DWORD
mov number,0
OutputDateToFileLoc_find_file:
invoke wsprintf, addr cWriteFileName, addr cFormatFindFile, number, addr strTxt
invoke FindFirstFile, addr cWriteFileName, addr strFindFile
mov hFindFile, eax
cmp eax, INVALID_HANDLE_VALUE
je OutputDateToFileLoc_exit
inc number
invoke FindClose, hFindFile
jmp OutputDateToFileLoc_find_file
OutputDateToFileLoc_exit:
invoke CreateFile, addr cWriteFileName, GENERIC_WRITE,\
0, NULL, CREATE_ALWAYS,\
FILE_ATTRIBUTE_NORMAL, NULL
mov hTextFile, eax
invoke WriteFile, hTextFile, addr cDateString, cbLength,\
addr dwBytesWritten, NULL
invoke CloseHandle, hTextFile
ret
OutputDateToFileLoc endp
GetCurrentTimeLoc proc
invoke GetLocalTime, addr sysTime
mov eax,0
mov ax, sysTime.wDay
mov Day, eax
xor ecx, ecx
mov cx, sysTime.wYear
mov Year, ecx
and eax, 0
mov ax, sysTime.wMonth
mov Month, eax
and eax, 0
mov ax, sysTime.wDayOfWeek
mov Week, eax
and eax, 0
mov ax, sysTime.wHour
mov Hour, eax
and eax, 0
mov ax, sysTime.wMinute
mov Minute, eax
push edi
cld
lea edi, cMonthString
mov al,0
xor ecx,ecx
GetCurrentTimeLoc_get_month:
repne scasb
mov ecx, 120
dec Month
jnz GetCurrentTimeLoc_get_month
mov Month, edi
pop edi
push edi
cld
lea edi, cWeekString
mov al,0
xor ecx,ecx
GetCurrentTimeLoc_get_week:
repne scasb
mov ecx, 120
dec Week
jns GetCurrentTimeLoc_get_week
mov Week, edi
pop edi
invoke wsprintf, addr cDateString, addr cFormatOut, Day, Month, Year, Week,\
Hour, Minute
ret
GetCurrentTimeLoc endp
WndProc proc hWin :DWORD, uMsg :DWORD, wParam :DWORD, lParam :DWORD
LOCAL Ps :PAINTSTRUCT
LOCAL hDC :DWORD
.if uMsg == WM_CREATE
push edi
push esi
cld
mov ecx, 39
lea esi, cEVK
lea edi, cDateString
rep movsb
pop esi
pop edi
return 0
.elseif uMsg == WM_TIMECHANGE
invoke InvalidateRect, hWin,0,TRUE
return 0
.elseif uMsg == WM_PAINT
invoke BeginPaint,hWin,ADDR Ps
mov hDC, eax
invoke GetCurrentTimeLoc
cld
push edi
lea edi, cDateString
and al, 0
mov ecx, 50
repne scasb
mov eax,49
sub eax, ecx
pop edi
push eax
invoke OutputDateToFileLoc, eax
pop eax
invoke TextOut, hDC, 10, 10, addr cDateString, eax
invoke EndPaint,hWin,ADDR Ps
return 0
.elseif uMsg == WM_DESTROY
invoke PostQuitMessage,NULL
return 0
.endif
invoke DefWindowProc,hWin,uMsg,wParam,lParam
ret
WndProc endp
end start