Ruhelos

window with dropfile

Mar 24th, 2015
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. format PE GUI 4.0
  2. entry start
  3.  
  4. include 'win32a.inc'
  5.  
  6. section '.data' data readable writeable
  7.  
  8. class db 'FASMWIN32',0
  9. title db 'WINDOW',0
  10. classb db 'BUTTON',0
  11. classe db 'EDIT',0
  12. classs db 'STATIC',0
  13. textb1 db 'COPY',0
  14. textb2 db 'CLEAR',0
  15. textg db 'FRAME',0
  16. texts db 'TEXT',0
  17. textc db 'CLEAR ALL',0
  18. errtxt db 'ERROR',0
  19. hwnd dd ?
  20. hwnde dd ?
  21. hwnds dd ?
  22. hwndc dd ?
  23. text rb 100
  24.  
  25. wc WNDCLASS 0,WindowProc,0,0,0,0,0,COLOR_BTNFACE+1,0,class
  26.  
  27. msg MSG
  28.  
  29. form db 'FILES CAUGHT: %d',0
  30.  
  31. section '.code' code readable executable
  32.  
  33. start:
  34.  
  35. invoke CreateWindowEx,WS_EX_ACCEPTFILES,class,title, WS_VISIBLE+WS_SYSMENU,128,128,256,192,0,0,[wc.hInstance],0
  36.  
  37. invoke GetModuleHandle,0
  38. mov [wc.hInstance],eax
  39. invoke LoadIcon,0,IDI_APPLICATION
  40. mov [wc.hIcon],eax
  41. invoke LoadCursor,0,IDC_ARROW
  42. mov [wc.hCursor],eax
  43. invoke RegisterClass,wc
  44. cmp eax,0
  45. je error
  46.  
  47. invoke CreateWindowEx,0,class,title,WS_VISIBLE+ WS_SYSMENU,128,128,256,192,0,0,[wc.hInstance],0
  48. cmp eax,0
  49. je error
  50. mov [hwnd],eax
  51. msg_loop:
  52. invoke GetMessage,msg,0,0,0
  53. cmp eax,0
  54. je end_loop
  55. invoke IsDialogMessage,[hwnd],msg
  56. cmp eax,0
  57. jne msg_loop
  58. invoke TranslateMessage,msg
  59. invoke DispatchMessage,msg
  60. jmp msg_loop
  61.  
  62. error:
  63. invoke MessageBox,0,errtxt,0,MB_ICONERROR+MB_OK
  64.  
  65. end_loop:
  66. invoke ExitProcess,[msg.wParam]
  67.  
  68. proc WindowProc hwnd,wmsg,wparam,lparam
  69. push ebx esi edi
  70. cmp [wmsg],WM_CREATE
  71. je .wmcreate
  72. cmp [wmsg],WM_COMMAND
  73. je .wmcommand
  74. cmp [wmsg],WM_DESTROY
  75. je .wmdestroy
  76. cmp [wmsg],WM_DROPFILES
  77. je .drop
  78. .defwndproc:
  79. invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
  80. jmp .finish
  81. .wmcreate:
  82. invoke CreateWindowEx,0,classb,textg,WS_VISIBLE+ WS_CHILD+ BS_GROUPBOX,5,5,240,150,[hwnd],1000,[wc.hInstance],0
  83. invoke CreateWindowEx,0,classb,textb1,WS_VISIBLE+WS_CHILD+ BS_PUSHBUTTON+WS_TABSTOP,20,100,100,40,[hwnd],1001,[wc.hInstance],0
  84. invoke CreateWindowEx,0,classb,textb2,WS_VISIBLE+WS_CHILD+ BS_PUSHBUTTON+WS_TABSTOP,130,100,100,40,[hwnd],1002,[wc.hInstance],0
  85. invoke CreateWindowEx,0,classe,texts,WS_VISIBLE+WS_CHILD+WS_BORDER+ WS_TABSTOP+ES_AUTOHSCROLL,10,25,230,20,[hwnd],1003,[wc.hInstance],0
  86. mov [hwnde],eax
  87. invoke CreateWindowEx,0,classe,0,WS_VISIBLE+WS_CHILD+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL+ES_READONLY,10,50,230,20,[hwnd],1004,[wc.hInstance],0
  88. mov [hwnds],eax
  89. invoke CreateWindowEx,0,classb,textc,WS_VISIBLE+WS_CHILD+ BS_AUTOCHECKBOX+WS_TABSTOP,130,75,110,20,[hwnd],1005,[wc.hInstance],0
  90. mov [hwndc],eax
  91. invoke CreateWindowEx,0,classs,textg,WS_VISIBLE+ WS_CHILD,190,145,43,15,[hwnd],1006,[wc.hInstance],0
  92. invoke SetFocus,[hwnde]
  93. jmp .finish
  94. .wmcommand:
  95. cmp [wparam],1001
  96. je .but1
  97. cmp [wparam],1002
  98. je .but2
  99. jmp .finish
  100. .but1:
  101. invoke SendMessage,[hwnde],WM_GETTEXT,100,text
  102. invoke SendMessage,[hwnds],WM_SETTEXT,0,text
  103. jmp .finish
  104. .but2:
  105. invoke SendMessage,[hwnds],WM_SETTEXT,0,0
  106. invoke SendMessage,[hwndc],BM_GETCHECK,0,0
  107. cmp eax,BST_CHECKED
  108. jne .finish
  109. invoke SendMessage,[hwnde],WM_SETTEXT,0,0
  110. invoke SendMessage,[hwndc],BM_SETCHECK,BST_UNCHECKED,0
  111. jmp .finish
  112. .wmdestroy:
  113. invoke PostQuitMessage,0
  114. mov eax,0
  115. .drop:
  116. invoke DragQueryFile,[wparam],-1,text,100
  117. invoke wsprintf,text,form,eax
  118. invoke SendMessage,[hwnds],WM_SETTEXT,0,text
  119. invoke DragQueryFile,[wparam],0,text,100
  120. invoke SendMessage,[hwnde],WM_SETTEXT,0,text
  121. jmp .finish
  122. .finish:
  123. pop edi esi ebx
  124. ret
  125. endp
  126.  
  127. section '.idata' import data readable writeable
  128.  
  129. library kernel32,'KERNEL32.DLL',\
  130. shell32,'SHELL32.DLL',\
  131. user32,'USER32.DLL'
  132.  
  133. include 'api\kernel32.inc'
  134. include 'api\shell32.inc'
  135. include 'api\user32.inc'
Advertisement
Add Comment
Please, Sign In to add comment