¦b Win64 ¨t²Î¤¤ªº°ò¥»Æ[©À¡A»P Win32 ¨t²Î¤¤®t¤£¦h¡A¤j³¡¤ÀªºÆ[©À³£¤£¤Ó»Ýn«·s¾Ç²ß¡C²¦³º¦pªG°µ¤F¤j½סA¤w¼ô±x Windows §@·~¨t²Îªº¤HÌ¥²·|¸s°_©ê«è¡A³oµ´¤£¬O·L³n©Ò¼Ö¨£ªº¡C¨Ò¦p¡A°T®§¶Ç»¼»P³]³Æ¤º®e ( device context¡AÁY¼g¬° DC ) ³£¬Û¦ü¡A»¡¨ì³o¨à¡AÁo©úªº±z·í¥iª¾¡A¤p¤ì°¸¤Sn¬Ù²¤¤F¦³Ãö³o³¡¤Àªºì²z¡A±z¥i¥H Win32 ²Õ¦X»y¨¥ªº²Ä¤G³¹¡A¼Ð·Çµøµ¡¡A¾\Ū¡C³oùØ¡A¤p¤ì°¸·Q¡A¥un§âì©l½X¦C¥X¨Ó¡A¤jP´N§¹¤u¤F¡I
ÁöµM¦p¦¹¡A¦ý¬OÁÙ¬O¦³¤@ÂI¥²¶·ª`·N¡C¦b Win32 ùØ¡A¨t²Î©I¥sµøµ¡¨ç¦¡®É¡A·|§âµøµ¡¨ç¦¡©Ò»Ýªº¥|ӰѼƨ̦¸¦s¨ì°ïÅ|ùØ¡A¥ç§Y¦b¶i¤Jµøµ¡¨ç¦¡®É¡AhWnd¡BuMsg¡BwParam¡BlParam ¤§È¤w¦b°ïÅ|ùؤF¡F¦ý¬O¦b Win64 ¨t²ÎùØ¡A¨t²Î·|§âµøµ¡¨ç¦¡©Ò»Ýªº¥|ӰѼƨ̦¸¦s¨ì RCX¡BRDX¡BR8¡BR9 ¥|ӼȦs¾¹ùØ¡A¦Ó¤£¬O¦s¤J°ïÅ|¤¤¡Aµ{¦¡¥iµø»Ýn¡A¦Û¦æ¨M©w¬O§_n¦s¤J°ïÅ|ùØ¡C
³o¤@³¹ùØ¡A¤p¤ì°¸·|¦b Win64 ¨t²Î¤WÅã¥Ü¤@Ӽзǵøµ¡¡A¨Ã¦b¦¹µøµ¡ªº¤u§@°Ï¤WÅã¥Ü¤@Ó¦r¦ê¡A¦p¤U¹Ï¡G
OPTION CASEMAP:NONE INCLUDELIB KERNEL32.LIB INCLUDELIB USER32.LIb INCLUDELIB GDI32.LIB NULL EQU 0 IDC_ARROW EQU 32512 IDI_APPLICATION EQU 32512 CS_VREDRAW EQU 1 CS_HREDRAW EQU 2 COLOR_WINDOW EQU 5 CW_USEDEFAULT EQU 80000000H WM_CREATE EQU 1H WM_DESTROY EQU 2H WM_PAINT EQU 0fh WS_OVERLAPPED EQU 0H WS_CAPTION EQU 0C00000H WS_SYSMENU EQU 80000H WS_THICKFRAME EQU 40000H WS_MINIMIZEBOX EQU 20000H WS_MAXIMIZEBOX EQU 10000H WS_OVERLAPPEDWINDOW EQU WS_OVERLAPPED OR WS_CAPTION OR WS_SYSMENU OR \ WS_THICKFRAME OR WS_MINIMIZEBOX OR WS_MAXIMIZEBOX SW_SHOWNORMAL EQU 1 DT_SINGLELINE EQU 20h POINT STRUC x DWORD ? y DWORD ? POINT ENDS RECT STRUC left DWORD ? top DWORD ? right DWORD ? bottom DWORD ? RECT ENDS MSG STRUC hwnd QWORD ? message DWORD ? padding1 DWORD ? ;padding1 wParam QWORD ? lParam QWORD ? time DWORD ? pt POINT <> padding2 DWORD ? ;padding2 MSG ENDS WNDCLASSEX STRUC cbSize DWORD ? style DWORD ? lpfnWndProc QWORD ? cbClsExtra DWORD ? cbWndExtra DWORD ? hInstance QWORD ? hIcon QWORD ? hCursor QWORD ? hbrBackground QWORD ? lpszMenuName QWORD ? lpszClassName QWORD ? hIconSm QWORD ? WNDCLASSEX ENDS PAINTSTRUCT STRUC hDC QWORD ? fErase DWORD ? rcPaint RECT <> fRestore DWORD ? fIncUpdate DWORD ? rgbReserved BYTE 32 DUP (?) padding DWORD ? PAINTSTRUCT ENDS EXTRN GetModuleHandleA:PROC EXTRN LoadIconA:PROC EXTRN LoadCursorA:PROC EXTRN RegisterClassExA:PROC EXTRN ShowWindow:PROC EXTRN UpdateWindow:PROC EXTRN GetMessageA:PROC EXTRN TranslateMessage:PROC EXTRN DispatchMessageA:PROC EXTRN DefWindowProcA:PROC EXTRN CreateWindowExA:PROC EXTRN PostQuitMessage:PROC EXTRN BeginPaint:PROC EXTRN EndPaint:PROC EXTRN DrawTextA:PROC ;******************************************************************************* .DATA hInstance QWORD ? hWnd QWORD ? hIcon QWORD ? wcex WNDCLASSEX <> msg MSG <> szClassName BYTE "Win64Class",0 szWndTitleName BYTE "Win64 ¼Ð·Çµøµ¡",0 szHellowAsm BYTE "¶Ù¡I²Õ¦X»y¨¥±z¦n¡I",0 ;******************************************************************************* .CODE ;------------------------------------------------------------------------------- ;µøµ¡¨ç¦¡ WndProc PROC USES r15 LOCAL ps:PAINTSTRUCT,hDC:QWORD ;§â°Ñ¼Æ¦s¤J°ïÅ| mov [rbp+10h],rcx ;hWnd mov [rbp+18h],rdx ;uMsg mov [rbp+20h],r8 ;wParam mov [rbp+28h],r9 ;lParam ;³]¸m°ïÅ|®Ø mov r15,rsp sub rsp,8*5 and rsp,0fffffffffffffff0h ;Àˬd°T®§ cmp rdx,WM_PAINT je WM_Paint cmp rdx,WM_CREATE je WM_Create cmp rdx,WM_DESTROY je WM_Destroy ;¦]¬°rcx¡Brdx¡Br8¡Br9¨Ã¨S¦³§ïÅÜ¡A©Ò¥Hª½±µ©I¥s§Y¥i call DefWindowProcA jmp Exit1 ;³B²z°T®§ WM_Paint: lea rdx,ps call BeginPaint mov hDC,rax mov rcx,rax mov rdx,OFFSET szHellowAsm mov r8,-1 lea r9,ps.rcPaint mov QWORD PTR [rsp+20h],DT_SINGLELINE call DrawTextA mov rcx,[rbp+10h] lea rdx,ps call EndPaint jmp Exit1 WM_Destroy: xor rcx,rcx call PostQuitMessage jmp Exit WM_Create: jmp Exit Exit: xor rax,rax Exit1: mov rsp,r15 ret WndProc ENDP ;------------------------------------------------------------------------------- Start PROC sub rsp,68h xor rcx,rcx call GetModuleHandleA mov hInstance,rax ;³]©wwcexµ²ºc¡A¦¹µ²ºc¬O¥Î¨Óµù¥Uµøµ¡Ãþ§O mov rax,OFFSET WndProc mov rcx,hInstance mov wcex.cbSize,SIZEOF WNDCLASSEX mov wcex.style,CS_HREDRAW or CS_VREDRAW mov wcex.lpfnWndProc,rax mov wcex.cbClsExtra,NULL mov wcex.cbWndExtra,NULL mov wcex.hInstance,rcx mov wcex.hbrBackground,COLOR_WINDOW+1 mov wcex.lpszMenuName,NULL mov rax,OFFSET szClassName mov wcex.lpszClassName,rax mov rdx,IDI_APPLICATION call LoadIconA ;¨ú±o¨t²Î¹Ï¥Ü mov wcex.hIcon,rax mov wcex.hIconSm,rax mov hIcon,rax mov rcx,NULL mov rdx,IDC_ARROW call LoadCursorA ;¨ú±o¨t²Î´å¼Ð mov wcex.hCursor,rax mov rcx,OFFSET wcex call RegisterClassExA ;µù¥Uµøµ¡Ãþ§O ;¥Hµù¥Uªºµøµ¡Ãþ§O¡A«Ø¥ßµøµ¡ mov rax,hInstance mov QWORD PTR[rsp+58h],NULL ;lpParam mov [rsp+50h],rax ;hInstance mov QWORD PTR[rsp+48h],NULL ;hMenu mov QWORD PTR[rsp+40h],NULL ;hWndParent mov QWORD PTR[rsp+38h],100 ;nHeight mov QWORD PTR[rsp+30h],250 ;nWidth mov QWORD PTR[rsp+28h],CW_USEDEFAULT;y mov QWORD PTR[rsp+20h],CW_USEDEFAULT;x mov r9,WS_OVERLAPPEDWINDOW lea r8,szWndTitleName lea rdx,szClassName xor rcx,rcx call CreateWindowExA mov hWnd,rax mov rcx,hWnd mov rdx,SW_SHOWNORMAL call ShowWindow ;Åã¥Üµøµ¡ mov rcx,hWnd call UpdateWindow ;§ó·sµøµ¡ ;«Ø¥ß°T®§°j°é MsgLp: xor r9,r9 xor r8,r8 xor rdx,rdx mov rcx,OFFSET msg call GetMessageA ;¨ú±o°T®§ or rax,rax ;²×µ²°T®§°j°é jz Exit mov rcx,OFFSET msg call TranslateMessage mov rcx,OFFSET msg call DispatchMessageA jmp MsgLp ;¸õ¨ì°T®§°j°é°_©l¦ì§} ;µ²§ôµ{¦¡¡Aªð¦^§@·~¨t²Î Exit: add rsp,68h mov rax,msg.wParam ret Start ENDP ;******************************************************************************* END
²ÕĶ®É¡A¥Ñ¡y¶}©l¡z¡÷¡yªþÄÝÀ³¥Îµ{¦¡¡z¡÷¡y©R¥O´£¥Ü¦r¤¸¡z¡A°õ¦æ win64asm.bat ( ¨£²ÕĶÀô¹Ò )¡A«á¿é¤J¤U±«ü¥O¥[¥H²ÕĶ¡G
ml64 stdwnd.asm /link /entry:Start
§Y¥i±o StdWnd.exe¡C