:
11.09.17

14.08.17

26.06.17

17.06.17

09.06.17
?
17.05.17
-?
04.05.17
:
29.04.17
:
26.04.17

17.04.17

.2017
.......
  12345
6789101112
13141516171819
20212223242526
27282930   
!!!
!!!
.
.
, .

, , , : , Windows

! () . , Word, , , ( pic), , , .., .

Windows

: ..

.-923:

2001.

1. Windows.

2. Windows-

3.

4. Windows

5.

Windows , , C/C++, Pascal. ? , ! . . , , : , , : , , - ! , . , . , . Windows- ? :

;

. , , ;

;

, , , ;

, , , , . , , . , , . , . , .

1. Windows.

Windows :

(API), (GUI, Graphic User Interface). , . . , , ;

Windows , .

Windows- , . Windows-. Windows- , Windows. , , Windows-, .

Windows :

;

;

.

Windows- . , () Windows. . . . , . , , , . , Windows-, , .

Windows- .data . code. Windows- . Windows , . def. 2 . er , .

2. Windows-

; Win32

.386

locals ;

.model flat, STDCALL ; flat

;STDCALL - ( ),

;

include windowA.inc ;

; Win32

; Win32 (ASCII):

extrn GetModuleHandleA:PROC

extrn GetVersionExA:PROC

extrn GetCommandLineA:PROC

extrn GetEnvironmentStringsA:PROC

extrn GetEnvironmentStringsA:PROC

extrn GetStartupInfoA:PROC

extrn LoadIconA:PROC

extrn LoadCursorA:PROC

extrn GetStockObject:PROC

extrn RegisterClassExA:PROC

extrn CreateWindowExA:PROC

extrn ShowWindow:PROC

extrn UpdateWindow:PROC

extrn GetMessageA:PROC

extrn TranslateMessage:PROC

extrn DispatchMessageA:PROC

extrn ExitProcess:PROC

extrn PostQuitMessage:PROC

extrn DefWindowProcA:PROC

extrn PlaySoundA:PROC

extrn ReleaseDC:PROC

extrn TextOutA:PROC

extrn GetDC:PROC

extrn BeginPaint:PROC

extrn EndPaint:PROC

; ,

public WindowProc

.data

hwnd dd 0

hInst dd 0

hdc dd 0

;lpVersionInformation OSVERSIONINFO

wcl WNDCLASSEX

message MSG

ps PAINTSTRUCT

szClassName db ' Win32 ',0

szTitleName db ' Win32 '.0

MesWindow db '

?'

MesWindowLen= $-MesWindow

playFileCreate db 'create.wav',0

playFilePaint db 'paint.wav',0

playFileDestroy db 'destroy.wav',0

. code

start proc near

; :

;

; ,

:

; BOOL GetVersionEx(LPOSVERSIONINFO lpVersionInformation)

; push offset lpVersionInformation

; call GetVersionExA

; Windows

; LPTSTR GetCommandLine(VOID) -

; call GetCommandLineA :

; LPVOID GetEnvironmentStrings (VOID) -

;

; call GetEnvironmentStringsA ;

; VOIDGetStartupInfo(LPSTARTUPINFO lpStartupInfo) ;

; STARTUPINFO

; push offset lpStartupInfo

; call GetStartupInfoA

; HMODULE GetModuleHandleA (LPCTSTR lpModuleName)

push NULL ;0->GetModuleHandle

call GetModuleHandleA ; ,

mov hInst, eax ;no .

; hInst

;

WinMain:

; ATOM RegisterClassEx(CONST WNDCLASSEX *lpWndClassEx),

; *lpWndClassEx - WndClassEx

; WndClassEx

mov wcl.cbSize,typeWNDCLASSEX -.

: wcl.cbCIZE

mov wcl.style,CS_HREDRAW+CS_VREDRAW

mov wcl.pfnWndProg,offsetWindowProg ;

mov wcl.cbCisExtra,0

mov wcl.cbWndExtra,0

mov eax,hInst

mov ; hInstance wcl

mov wcl.hInstance, eax

; HICON LoadIcon (HINSTANCE hInstance, LPCTSTR lpIconName)

push IDI_APPLICATION ,-

push 0 ;NULL

LoadIconA

mov wcl.hIcon, eax ,- hIcon I

; wcl

; HCURSOR LoadCursorA (HINSTANCE hInstance, LPCTSTR M ;lpCursorName)

push IDC_ARROW ,- -

push 0

ll LoadCursorA

mov wcl.hCursor,eax ; hCursor

; wc1

; -

; HGDIOBJ GetStockObject(int fnObject)

push WHITE_BRUSH

GetStockObject

mov wcl.hbrBackground, eax

mov dword ptrwcl.lpszMenuName, 0 ;

mov dwordptrwcl.lpszClassName,offsetszC1assName;

; ࠠ

mov wcl.hIconSm, 0

; - RegisterClassExA (&wndclass)

push offset wcl

RegisterClassExA

test ax, ;

jz end_cyc1_msg ;

; :

; HWND CreateWindowExA(DWORDdwExStyle,

LPCTSTR1pClassName,

; LPCTSTR 1pW1ndowName, DWORD dwStyle, int x, int , int nWidth,

|;int nHeight,

; HWND hWndParent, HMENU hMenu, HANDLE hInstance, LPVOID

;lpParam)

push 0 ;lpParam

push hInst ;hInstance

push NULL ;menu

push NULL ;parent hwnd

push CW_USEDEFAULT ;

push CW_USEDEFAULT ;

push CW_USEDEFAULT ;

;

push CW_USEDEFAULT ;

push WS_OVERLAPPEDWINDOW ;

push offset szTitleName ;

push offset szClassName ;

push NULL

ll CreateWindowExA

mov hwnd,eax ;-

; :

; BOOL ShowWindow( HWND hWnd, int nCmdShow )

push SW_SHOWNORMAL

push hwnd

call ShowWindow

;

; BOOL UpdateWindow( HWND hWnd )

push hwnd

call UpdateWindow

; :

; BOOL GetMessageA( LPMSG lpMsg, HWND hWnd,

; UINTwMsgFilterMin,UINTwMsgFilterMax)

cycl_msg:

push 0

push 0

push NULL

push offset message

cal 1 GetMessageA

cmp , 0

je end_cycl_msg

;

; BOOL Trans1ateMessage( CONST MSG *lpMsg )

push offset message

call TranslateMessage

;

; LONG D1spatchMessage( CONST MSG *lpmsg )

push offset message

call DispatchMessageA

jmp cycl_msg

end_cycl_msg:

;

; VOID ExitProcess( UINT uExitCode )

push NULL

call ExitProcess

start endp

; - - - - - - - - - - - - --WindowProc-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

WindowProc proc

argP0nwnd:DWORD, PPmes:DWORD, @@wparam:DWORD, @@lparam:DWORD

uses ebx, edi, es1 ;

local @@hdc:DWORD

cmp @@mes, WM_DESTROY

je wmdestroy

cmp @@mes, WM_CREATE

je wmcreate

cmp @@mes, WM_PAINT

je wmpaint

jmp default

wmcreate:

;

; BOOL PlaySound(LPCSTR pszSound, HMODULE hmod, DWORD

;fdwSound )

push SND_SYNC+SND_FILENAME

push NULL

push offset playFileCreate

call PlaySoundA

mov eax, ; - 0

jmp exit_wndproc

wmpaint:

push SND_SYNC+SND_FILENAME

push NULL

push offset playFIilePaint

call P1aySoundA

; HDC BeginPaint(HWND nwnd,LPPAINTSTRUCT;LPpAINT)

push offset ps

push @@hwnd

call BeginPaint

mov @@hdc,eax

; BOOL TextOut( HDC hdc. int nXStart, int

:nYStart.

; LPCTSTR lpString, int cbString )

push MesWindowLen

push offset MesWindow

push 100

push 10

push @@hdc

call TextOutA

:ocoooecBOOLEndPaint( HWNDhWnd, CONSTPAINTSTRUCT*lpPai push offset ps

push @@hdc

call EndPaint

mov ,0; -0

jmp exit_wndproc

wmdestroy:

push SND_SYNC+SND_FILENAME

push NULL

push offset playFileDestroy

call PlaySoundA

; W_QUI

; VOID PostQuitMessage( int nExitCode )

push 0

call PostQuitMessage

mov eax, ; - 0

jmp exit_wndproc

default:

;

; LRESULTDefWindowProc( HWND hWnd, UINTMsg,

; WPARAMwParam,LPARAMlParam)

push @@lparam

push @@wparam

push @@mes

push @@nwnd

call DefWindowProcA

jmp exit_wndproc

;... ... ...

exit_wndproc:

ret

WindowProc endp

end start

3.

Windows Assembler , .

32- , Create Window.

Window.

1 . . WS_OVERLAPPED.

2 . . WS_POPUP.

3 . . . WS_CHILD.

, Windows .

:

.

; , , .

/ / . WND, , . , . HWND "" USER, , . , USER, .1.

- , . :

USER , . USER , hWndChild hWndNext- , "" USER.

Tab ( ), ( hWndNext) . , hWndChild hWndNext Z- . Z- ( ). ;

Z-, hWndNext .

:

..1 , USER.

, , , , ().

desktop-. Z-. , . Desktop- , , . (- .) "" Windows.

Desktop- .. ( ) WS_POPUP WS_CLIPCHILDREN. WS_DESKTOP. desktop- USER HWndDesktop. , desktop-, HWND, , HWndDesktop. HWndDesktop, API- GetDesktopWindow().

Windows

/. Windows . , , . /, . -, , .

- , , . , WS_POPUP TrackPopupMenu(), . WM_COMMAND, . , . / , , , , , .

WS_CHILD. WS_CHILD HWND WND , . , . , , .. . , ws_child-okhb hWndOwner , hWndParenfc, . Presentati

on Manager WS_CHILD WS_POPUP. hWndPa-rent, hWndOwner. , , . Presentation Manager hWndParent hWndOw-ner HWND.

, , , -. , , . - , , , . , , / HWND , .

, Windows . SDK , , /. Presentation Manager OS/2 , -. Windows .

CreateWindow() HWND , Windows? CreateWindow() . WS_CHILD, hWndParent . , WS_OVERLAPPED WS_POPUP, hWndParent HWND, . WS_OVERLAPPED WS_POPUP HWND desktop- (HWndDes

ktop).

3. Windows

p386; i 386

jumps;

; , ;

model flat,STDCALL; 32- ; STDCALL,

UNICODE = 0

include win32.inc;,

; some 32-bit constants and structures

L equ ; LARGE, , 32-, L

Define the external functions we will be linking to

;

extrn BeginPaint:PROC; Windows

extrn CreateWindowExA:PROC

extrn DefWindowProcA:PROC

extrn DispatchMessageA:PROC

extrn EndPaint:PROC

extrn ExitProcess:PROC

extrn GetMessageA:PROC

extrn GetModuleHandleA:PROC

extrn GetStockObject:PROC

extrn InvalidateRect:PROC

extrn LoadCursorA:PROC

extrn LoadIconA:PROC

extrn MessageBeep:PROC

extrn MessageBoxA:PROC

extrn PostQuitMessage:PROC

extrn RegisterClassA:PROC

extrn ShowWindow:PROC

extrn SetWindowPos:PROC

extrn TextOutA:PROC

extrn TranslateMessage:PROC

extrn UpdateWindow:PROC

extrn FindFirstFileA:PROC

.data; ,

newhwnd dd 0

lppaint PAINTSTRUCT

msg MSGSTRUCT

wc WNDCLASS

hInst dd 0

szTitleName db ' ',0

szTitleName1 db ' -923',0 ;' Win32 '.0

szClassName db 'ASMCLASS32',0 ;' Win32

Buffer db ' !',0

new1hwnd dd 0

MSG_L EQU 14

.code

start:

push L 0

call GetModuleHandleA ; get hmod (in eax)

mov [hInst], eax ; hInstance is same as HMODULE

; in the Win32 world

reg_class:

;

; initialize the WndClass structure ; WndClass

;

mov [wc.clsStyle], CS_HREDRAW + CS_VREDRAW + CS_GLOBALCLASS; ;

mov [wc.clsLpfnWndProc], offset WndProc;

mov [wc.clsCbClsExtra], 0

mov [wc.clsCbWndExtra], 0

mov eax, [hInst]

mov [wc.clsHInstance], eax ;

push L IDI_APPLICATION;

push L 0

call LoadIconA

mov [wc.clsHIcon], eax

push L IDC_ARROW

push L 0

call LoadCursorA

mov [wc.clsHCursor], eax

mov [wc.clsHbrBackground], COLOR_WINDOW + 1

mov dword ptr [wc.clsLpszMenuName], 0

mov dword ptr [wc.clsLpszClassName], offset szClassName

push offset wc

call RegisterClassA

push L 0 ; lpParam

push [hInst] ; hInstance

push L 0 ; menu

push L 0 ; parent hwnd

push L CW_USEDEFAULT ; height

push L CW_USEDEFAULT ; width

push L CW_USEDEFAULT ; y

push L CW_USEDEFAULT ; x

push L WS_OVERLAPPEDWINDOW ; Style

push offset szTitleName ; Title string

push offset szClassName ; Class name;

push L 0 ; extra style

call CreateWindowExA

mov [newhwnd], eax

push L SW_SHOWNORMAL

push [newhwnd]

call ShowWindow

push [newhwnd]

call UpdateWindow

push L 0 ; lpParam

push [hInst] ; hInstance

push L 0 ; menu

push L [newhwnd] ; parent hwnd

push L CW_USEDEFAULT ; height

push L CW_USEDEFAULT ; width

push L CW_USEDEFAULT ; y

push L CW_USEDEFAULT ; x

push L WS_OVERLAPPEDWINDOW ; Style

push offset szTitleName1 ; Title string

push offset szClassName ; Class name

push L 0 ; extra style

call CreateWindowExA

mov [new1hwnd], eax

push L SW_SHOWNORMAL

push [new1hwnd]

call ShowWindow

push [new1hwnd]

call UpdateWindow

msg_loop:

push L 0

push L 0

push L 0

push offset msg

call GetMessageA

cmp ax, 0

je end_loop

push offset msg

call TranslateMessage

push offset msg

call DispatchMessageA

jmp msg_loop

end_loop:

push [msg.msWPARAM]

call ExitProcess

; we never get to here

;

;-----------------------------------------------------------------------------

WndProc proc uses ebx edi esi, hwnd:DWORD, wmsg:DWORD,

wparam:DWORD, lparam:DWORD

;

; WARNING: Win32 requires that EBX, EDI, and ESI be preserved! We comply

; with this by listing those regs after the 'uses' statement in the 'proc'

; line. This allows the Assembler to save them for us.

;

LOCAL hDC:DWORD

cmp [wmsg], WM_DESTROY

je wmdestroy

cmp [wmsg], WM_SIZE

je wmsize

cmp [wmsg], WM_CREATE

je wmcreate

cmp [wmsg],WM_PAINT

je wmpaint

jmp defwndproc

wmcreate:

mov eax, 0

jmp finish

defwndproc:

push [lparam]

push [wparam]

push [wmsg]

push [hwnd]

call DefWindowProcA

jmp finish

wmdestroy:

push L 0

call PostQuitMessage

mov eax, 0

jmp finish

wmsize:

mov eax, 0

jmp finish

wmpaint:

push offset lppaint

push [hwnd]

call BeginPaint

mov [hDC],eax

push L 17

; push ecx

push offset Buffer

push L 5

push L 5

push [hDC]

call TextOutA

push offset lppaint

push [hwnd]

call EndPaint

mov eax,0

jmp finish

finish:

ret

WndProc endp

;-----------------------------------------------------------------------------

public WndProc

end start

1. Turbo Assembler / .. . : , 1995.

2. . Windows ( Win32 API Windows

NT 3.5 Windows 95) . . .: Π Channel Trading Ltd, 1995.

3. .. Assembler. DOS, Windows Unix. . : . 1999.


! () . , Word, , , ( pic), , , ..,
: 20.08.10 | [ + ]   [ - ]  
: 112
: 0
20.08.10
20.08.10
20.08.10
20.08.10
20.08.10
{dnmbottom}
70 000 , , , .