đã được khai báo ở đầu chương trình, tất nhiên bạn phải có file *.RGN được lưu path trong file resource như sau: RANGE RGN "file.rgn" file.rgn sẽ lưu trữ region của một picture bất kỳ bằ
Trang 1RsrcSize dd ?
RsrcPoint dd ?
đã được khai báo ở đầu chương trình, tất nhiên bạn phải có file *.RGN được lưu path trong file resource như sau:
RANGE RGN "file.rgn"
file.rgn sẽ lưu trữ region của một picture bất kỳ bằng RGNCreator,nếu không muốn tạo dialogue là hình dạng của một bitmap bạn có thể tạo region hình tròn hay hình nào bạn muốn
b) Tạo button bitmap:
Có thể sử dụng hàm SendMessage tuy nhiên MASM32 đã có sẵn mọi thứ để tạo button bạn cần 2 bitmap trong resource, một để hiển thị lúc button up và một lúc button down, dĩ nhiên nếu chỉ xài một thì cũng không sao
invoke BmpButton,hWin,vị trí cột,hàng,ID bitmap 1,ID bitmap 2,ID button
cho tất cả các thứ trên nên include các file sau:
include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\masm32.inc
include \MASM32\INCLUDE\gdi32.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
include \MASM32\INCLUDE\Comctl32.inc
include \MASM32\INCLUDE\comdlg32.inc
Và để keygen của bạn đẹp nên lập trình text chuyển động và đạc biệt là sử dung OpenGL
Hiện tại chỉ nghĩ được đến đây, vả lại lâu lắm không code keygen nên còn nhiều thiếu sót
Deux(REA)
Nguyên tắc hoạt động khá đơn giản là, trước tiên check xem có SI không, không thì nhảy tiếp, sau đó kiểm tra xem có Olly không, không thì nhảy tiếp, sau đó load vào memory music! Download project bằng RadASM tại:
http://nhandan.info/hacnho/tuts/music.zip
Code:
Code:
.386
.model flat,stdcall
option casemap:none
include lalala.inc
include mfmplayer.inc
Trang 2includelib mfmplayer.lib
.const
IDM_KEYGEN equ 500
.data
; Music
nMusicSize DWORD ?
pMusic LPVOID ?
strOllyDbg db "OLLYDBG.EXE",0h
valCurrentPiD dd 0
valParentPiD dd 0
hSnapShot dd 0
sice db "\\.\SICE",0
.data?
proces PROCESSENTRY32 <>
.code
start:
;Anti SI -
invoke CreateFileA, OFFSET sice, FALSE, FALSE, NULL, FALSE,OPEN_EXISTING, NULL
cmp EAX, -1
jz NOSICE
invoke ExitProcess,eax
NOSICE:
; -
;AntiOlly here:
; Create the snapshot
invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS,NULL mov hSnapShot,eax
;Get the ProcessId of the Current Process
invoke GetCurrentProcessId
mov valCurrentPiD,eax
Trang 3lea esi,offset proces
assume esi:ptr PROCESSENTRY32
mov [esi].dwSize,sizeof PROCESSENTRY32
;Begin the first Loop and find the current process
;using the valCurrentPiD
invoke Process32First,hSnapShot,addr proces
lea esi,offset proces
assume esi:ptr PROCESSENTRY32
mov ebx,valCurrentPiD
cmp ebx,[esi].th32ProcessID
jne nope1
nope1:
invoke Process32Next,hSnapShot,addr proces
lea esi,offset proces
assume esi:ptr PROCESSENTRY32
mov ebx,valCurrentPiD
cmp ebx,[esi].th32ProcessID
jne nope1
push [esi].th32ParentProcessID
pop valParentPiD
invoke CloseHandle,hSnapShot
; Create the snapshot again
invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS,NULL mov hSnapShot,eax
mov [esi].dwSize,sizeof PROCESSENTRY32
; Begin the second Loop and find the parent
; process using the valParentPiD
invoke Process32First,hSnapShot,addr proces
lea esi,offset proces
Trang 4assume esi:ptr PROCESSENTRY32
mov ebx,valParentPiD
cmp ebx,[esi].th32ProcessID
jne nope2
nope2:
invoke Process32Next,hSnapShot,addr proces
lea esi,offset proces
assume esi:ptr PROCESSENTRY32
mov ebx,valParentPiD
cmp ebx,[esi].th32ProcessID
jne nope2
; Extract filename of the Parent Process from the whole string
lea eax, [esi].szExeFile
push eax
invoke lstrlen,eax
sub eax,11
pop ebx
add ebx,eax
; Case Upper the string and compare it with "OLLYDBG.EXE" invoke CharUpper,ebx
invoke lstrcmp,ebx,addr strOllyDbg
.IF eax==0
invoke ExitProcess,eax
.ELSE
; Load the music
push esi
INVOKE FindResource, hInstance, IDM_KEYGEN, RT_RCDATA push eax
INVOKE SizeofResource, hInstance, eax
mov nMusicSize, eax
pop eax
INVOKE LoadResource, hInstance, eax
INVOKE LockResource, eax
mov esi, eax
Trang 5mov eax, nMusicSize
add eax, SIZEOF nMusicSize
INVOKE GlobalAlloc, GPTR, eax
mov pMusic, eax
mov ecx, nMusicSize
mov dword ptr [eax], ecx
add eax, SIZEOF nMusicSize
mov edi, eax
rep movsb
pop esi
; Start music
INVOKE mfmPlay, pMusic
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke GetCommandLine
invoke InitCommonControls
mov CommandLine,eax
invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
.ENDIF
invoke CloseHandle,hSnapShot
; -
invoke ExitProcess,eax
WinMain proc
hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWOR
D
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
mov wc.cbSize,sizeof WNDCLASSEX
mov wc.style,CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc,offset WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,DLGWINDOWEXTRA