flat assembler
Message board for the users of flat assembler.
Index
> Windows > Why doesn't process terminate? Goto page Previous 1, 2 |
Author |
|
itsnobody 01 Apr 2008, 03:13
bitRAKE wrote:
Thanks There still might be some better solution somewhere |
|||
01 Apr 2008, 03:13 |
|
bitRAKE 01 Apr 2008, 04:42
Lessthan 1k without compression is pretty good.
(yeah, I was board and this is more fun than TV.) Code: hInstance = $100000 format PE GUI 4.0 at hInstance ; Reserve, Commit stack $1000, $1000 heap $10000, $10000 section '.bitRAKE' code import readable executable writeable dd 0,0,0, RVA kernel_name, RVA kernel_table dd 0,0,0, RVA user_name, RVA user_table dd 0,0,0, RVA atl_name, RVA atl_table dd 0,0,0, 0, 0 kernel_table: __ExitProcess dd RVA _ExitProcess dd 0 user_table: __CallWindowProc dd RVA _CallWindowProc __CreateWindowExA dd RVA _CreateWindowExA __DispatchMessageA dd RVA _DispatchMessageA __GetMessageA dd RVA _GetMessageA __SendMessageA dd RVA _SendMessageA __GetSystemMetrics dd RVA _GetSystemMetrics __MessageBoxA dd RVA _MessageBoxA __SetWindowLong dd RVA _SetWindowLong dd 0 atl_table: __AtlAxWinInit dd RVA _AtlAxWinInit dd 0 ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ include "WIN32AX.INC" DestroyProc: label .uMsg dword at esp+8 cmp [.uMsg],WM_DESTROY pop eax je @F db $68 ; push imm32 .old: dd hInstance push eax jmp [__CallWindowProc] _Failed db "Failed",0 Fail: lea eax,[_Failed-(_AtlAxWinInit+2)+ebx] push MB_ICONEXCLAMATION push ebx push eax ; push _Failed push ebp call [MessageBoxA] @@: push 0 call [__ExitProcess] _AtlAxWinInit: db 0,0,"AtlAxWinInit",0 ;label ExitProcess dword at ebx+__ExitProcess -(_AtlAxWinInit+2) ;label CallWindowProc dword at ebx+__CallWindowProc -(_AtlAxWinInit+2) label CreateWindowExA dword at ebx+__CreateWindowExA -(_AtlAxWinInit+2) label DispatchMessageA dword at ebx+__DispatchMessageA-(_AtlAxWinInit+2) label GetMessageA dword at ebx+__GetMessageA -(_AtlAxWinInit+2) label SendMessageA dword at ebx+__SendMessageA -(_AtlAxWinInit+2) label GetSystemMetrics dword at ebx+__GetSystemMetrics-(_AtlAxWinInit+2) label MessageBoxA dword at ebx+__MessageBoxA -(_AtlAxWinInit+2) label SetWindowLong dword at ebx+__SetWindowLong -(_AtlAxWinInit+2) label AtlAxWinInit dword at ebx+__AtlAxWinInit -(_AtlAxWinInit+2) entry $ mov ebx,_AtlAxWinInit+2 xchg eax,ebp ;xor ebp,ebp call [AtlAxWinInit] xchg eax,ecx jecxz Fail push ebp ; CreateWindowExA.lParam ; CreateWindowExA.hInstance push dword [ebx+DestroyProc.old-(_AtlAxWinInit+2)] push ebp ; CreateWindowExA.hMenu push ebp ; CreateWindowExA.hParent push SM_CYSCREEN call [GetSystemMetrics] push eax ; CreateWindowExA.Height push ebp ; SM_CXSCREEN call [GetSystemMetrics] push eax ; CreateWindowExA.Width mov [ebx+8],ebp lea eax,[_url-(_AtlAxWinInit+2)+ebx] lea esi,[ebx+DestroyProc-(_AtlAxWinInit+2)] push ebp ; CreateWindowExA.Y push ebp ; CreateWindowExA.X push WS_VISIBLE or WS_POPUP or WS_HSCROLL or WS_VSCROLL push eax ; _url ; CreateWindowExA.Title push ebx ; CreateWindowExA.Class push WS_EX_ACCEPTFILES or WS_EX_OVERLAPPEDWINDOW call [CreateWindowExA] push esi push GWL_WNDPROC push eax xchg eax,esi call [SetWindowLong] ; seems dangerous to set this after the fact mov [ebx+DestroyProc.old-(_AtlAxWinInit+2)],eax ; reuse EBX for MSG structure .get: push ebp push ebp push ebp push ebx call [GetMessageA] xchg eax,ecx jecxz @B push ebx push ebp push $37F ; WM_FORWARDMSG push esi call [SendMessageA] test eax,eax jne .get push ebx call [DispatchMessageA] jmp .get ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ _url db "http://board.flatassembler.net",0 ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ kernel_name db 'KERNEL32',0 user_name db 'USER32',0 atl_name db "ATL",0 _ExitProcess db 0,0,'ExitProcess',0 _CreateWindowExA db 0,0,'CreateWindowExA',0 _DispatchMessageA db 0,0,'DispatchMessageA',0 _GetMessageA db 0,0,'GetMessageA',0 _SendMessageA db 0,0,'SendMessageA',0 _GetSystemMetrics db 0,0,'GetSystemMetrics',0 _MessageBoxA db 0,0,'MessageBoxA',0 _SetWindowLong db 0,0,'SetWindowLongA',0 _CallWindowProc db 0,0,'CallWindowProcA',0 The accellerator keys don't work (need to send WM_FORWARDMSG to have ATL process messages). Edit: I've fixed the message processing to support accellerators. Quite a bit more work to keep it under 1k - still more bytes to spare. Enjoy. Edit, again: shaved off some more bytes, made code more concise... _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup Last edited by bitRAKE on 11 Apr 2008, 20:33; edited 1 time in total |
|||
01 Apr 2008, 04:42 |
|
bitRAKE 01 Apr 2008, 17:00
ShowHTMLDialog works with some Flash files, for example:
Haven't found a way to embed the Flash file in the resource section, yet. Figure it's something silly like needing full path name.
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||||||||||
01 Apr 2008, 17:00 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.