以下是我根据 CCDebuger 提供的注册机模板提取出的使用iPicture的核心代码:
.386
.model flat, stdcall
option casemap :none ; case sensitive
include windows.inc
include masm32.inc
include user32.inc
include kernel32.inc
include comctl32.inc
include comdlg32.inc
include gdi32.inc
include shell32.inc
include oleaut32.inc
include ole32.inc
includelib masm32.lib
includelib user32.lib
includelib kernel32.lib
includelib comctl32.lib
includelib comdlg32.lib
includelib gdi32.lib
includelib shell32.lib
includelib oleaut32.lib
includelib ole32.lib
include patch.inc
include BmpFrom.inc
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
.data
dlgname db "M",0
ScrollSpeed dd 10 ; Timeout (in milliseconds) for scroller update
rectLogo RECT <0,0,270,78>
LogBrush LOGBRUSH <>
.data?
hInstance dd ?
hDC dd ?
hLogoBmp dd ?
hDCLogo dd ?
hOldLogo dd ?
.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke InitCommonControls
invoke CoInitialize,NULL
invoke DialogBoxParam,hInstance,ADDR dlgname,0,ADDR WndProc,0 ; load the main window
invoke CoUninitialize ; all done with COM
invoke ExitProcess,eax
WndProc proc hWnd:HWND,uMsg:DWORD,wParam:DWORD,lParam:DWORD
.if uMsg == WM_INITDIALOG
invoke BmpFromResource,hInstance,50 ; Load logo bitmap into memory
mov hLogoBmp,eax ; Save it's handle
; Setup up our text scroller
; invoke SetTimer,hWnd,1,ScrollSpeed,0
invoke GetDC,hWnd
mov hDC,eax
invoke CreateCompatibleDC,hDC
mov hDCLogo,eax
invoke SelectObject,hDCLogo,hLogoBmp
mov hOldLogo,eax
.elseif uMsg == WM_LBUTTONDOWN
; .elseif uMsg == WM_TIMER
invoke BitBlt,hDC,0,0,rectLogo.right,rectLogo.bottom,hDCLogo,0,0,SRCCOPY
.elseif uMsg == WM_DESTROY
invoke DeleteObject,hLogoBmp
invoke DeleteDC,hDCLogo
invoke ReleaseDC,hWnd,hDC
.elseif uMsg == WM_CLOSE
invoke EndDialog,hWnd,0 ; end the program
.endif
xor eax,eax
ret
WndProc endp
end start
资源文件:
#include "/masm32/include/resource.h"
M DIALOGEX 0,0,174,40
FONT 8,"Arial"
STYLE 0x00CA0802
EXSTYLE 0x00000000
BEGIN
END
50 IMAGE DISCARDABLE "logo.jpg"
60 ICON DISCARDABLE "icon.ico"
我的问题是:BitBlt那一行放在初始化段(uMsg == WM_INITDIALOG)为什么不起作用?必须放在另一个消息处理段里面(如uMsg == WM_LBUTTONDOWN、uMsg == WM_TIMER等)就可以起作用?
其余所需文件在附件中:
[课程]FART 脱壳王!加量不加价!FART作者讲授!