ZeroAdd(http://www.pediy.com/tools/PEtools.htm)用来增加PE文件的区块很方便,但它不支持文件拖放,不爽。
经过修改使ZeroAdd实现了拖放操作PE文件的功能。

要使窗口支持拖放功能须在窗口创建后,先调用下面的函数:
VOID DragAcceptFiles(

    HWND hWnd,  // handle to the registering window
    BOOL fAccept  // acceptance option
   );
   
hWnd为窗口的句柄
fAccept为TRUE时表示允许拖放,FALSE表示禁止拖放


当窗口收到WM_DROPFILES消息时,通过DragQueryFileA可以得到拖放的文件名。
完了调用DragFinish结束拖放。

具体实现:
因为要用到的三个函数DragAcceptFiles,DragQueryFileA,DragFinish原程序中没有,所以先用IID King加入此三个API函数。此三个函数都在shell32.dll中。
IID King给程序增加了一个1kB的SECTION.我们增加的程序可以写在空白的地方。文件偏移8200h(VA:40b100)往后的地方都没有用到,我们的程序就写在这里。
修改WM_INITDIALOG的默认处理:
.text:0040101F                 push    ebp
.text:00401020                 mov     ebp, esp
.text:00401022                 cmp     [ebp+uMsg], 110h=WM_INITDIALOG
.text:00401029                 jnz     short fwd_401030
.text:0040102B                 jmp     InitDlg=40b100  ;修改此行跳转

InitDlg:
40b100:
  push  1
  push  d,[ebp][8]
  api call  DragAcceptFiles
  ;sinvoke DragAcceptFiles/[ebp+8]/1
   va jmp  40148c
   

.text:00401045                 cmp     [ebp+uMsg], WM_COMMAND
.text:0040104C                 jnz     Other_Msg=40b110  ;修改此行跳转
.text:00401052                 mov     eax, [ebp+wParam]
.text:00401055                 cmp     ax, 2
.text:00401059                 jnz     short loc_4010B3
.text:0040105B                 shr     eax, 10h
.text:0040105E                 or      ax, ax


Other_Msg:
40b110:
  cmp  d,[ebp+0ch],233h  ;233hWM_DROPFILES
  va jnz  401483h
  push  200h
  push  40337ch
  push  0
  push  d,[ebp+10h]
  api call  DragQueryFileA
  
  push  40337ch
  push  3
  push  d,[ebp+8]
  api call  SetDlgItemTextA
  push  d,[ebp+10h]
  api call  DragFinish
  
  ;sinvoke  DragQueryFileA,wParam,0,addr buffer,512
  ;sinvoke  SetDlgItemText,hWnd,IDCT_EDIT,addr buffer
  ;sinvoke  DragFinish,wParam
  va jmp  40148ch

推荐使用MyHiew修改,先在40b100处输入InitDlg和Other_Msg的代码,然后分别修改0040102B和0040104C处的跳转。
已修改过的ZeroAdd可通过如下地址下载:
http://www.pcpages.com/pisces/pediy/patched_zeroadd.zip