📄 main3.asm
字号:
ExchangePoker proc _dwPokerA:DWORD,_dwPokerB:DWORD
;LOCAL @dbgbuf[255]:byte
pushad
; pushad
; szText sz@PokerB,"_dwPokerB=%x,_dwPokerA=%x"
; invoke wsprintfA,addr @dbgbuf,addr sz@PokerB,_dwPokerB,_dwPokerA
; invoke MessageBoxA,NULL,addr @dbgbuf,NULL,MB_OK
; popad
invoke GetPokerArray
mov esi,_dwPokerA
mov edi,_dwPokerB
mov eax,_dwPokerArray[esi*4]
mov ebx,_dwPokerArray[edi*4]
mov _dwPokerArray[edi*4],eax
mov _dwPokerArray[esi*4],ebx
mov eax,_dwPokerArray[esi*4+4]
mov ebx,_dwPokerArray[edi*4+4]
mov _dwPokerArray[edi*4+4],eax
mov _dwPokerArray[esi*4+4],ebx
invoke WriteToPokerArray
invoke InvalidateRect,hwndspider,NULL,TRUE
popad
ret
ExchangePoker endp
UpState proc _lpRect:DWORD ;function UpState proc
LOCAL @Col:DWORD
LOCAL @Row:DWORD
LOCAL @ReadyRow:DWORD
LOCAL @Address:DWORD
LOCAL @PokerA:DWORD
LOCAL @PokerB:DWORD
LOCAL @FirstReadyPoker:DWORD
LOCAL @dbgbuf[255]:byte
pushad
mov esi,_lpRect
assume esi:ptr MY_RECT
mov eax,[esi].re_col
mov @Col,eax
mov eax,[esi].re_row
mov @Row,eax
assume esi:nothing
mov eax,DownPos.re_pokernum
mov @PokerA,eax
mov eax,DownPos.re_state
.IF eax
invoke CheckCol,@Col
.IF eax
mov @Address,eax
invoke CheckRow, @Address,@Row,addr @PokerB
mov @ReadyRow,eax
.IF @ReadyRow == 0FFFFFFFFh ;;;;;;this row's poker is in the list
invoke ExchangePoker,@PokerA,@PokerB
.ELSE ;;;;;;this row's poker is not in the list
invoke ReadFirstReadyPoker
mov @FirstReadyPoker,eax
mov ecx,@ReadyRow
add eax,@Col
mov @PokerB,eax
LOOPAGAIN:
.IF @PokerB<68h
mov ebx,@ReadyRow
.IF ebx<@Row
inc ebx
mov @ReadyRow,ebx
mov eax,@PokerB
add eax,0Ah
mov @PokerB,eax
jmp LOOPAGAIN
.ELSE
;;;;;;;yse,the poker you want to find in @PokerB already!!!!
mov eax,@PokerB
lea eax,dword ptr [eax+eax*2]
mov @PokerB,eax
invoke ExchangePoker,@PokerA,@PokerB
.ENDIF
.ELSE
mov ebx,@ReadyRow
.IF ebx == ecx ;THE LIST ONE IS LAST
mov eax,ebx
inc eax
.IF eax==@Row
mov edi,@Row
sub edi,2
invoke CheckRow,@Address,edi,addr @PokerB
.ELSEIF ebx==@Row
mov edi,@Row
dec edi
invoke CheckRow,@Address,edi,addr @PokerB
.ENDIF
invoke ExchangePoker,@PokerA,@PokerB
.ELSE ;ebx!=ecx ebx must > ecx ;THE LIST ONE IS NOT LAST ONE
mov eax,ebx
add eax,2
.IF eax>@Row
mov eax,@PokerB
sub eax,0Ah
lea eax,dword ptr [eax+eax*2]
mov @PokerB,eax
invoke ExchangePoker,@PokerA,@PokerB
.ENDIF
.ENDIF
mov ebx,@ReadyRow
.ENDIF
.ENDIF
.ENDIF
.ENDIF
mov DownPos.re_state,0h ;resume the state of WM_LBUTTONUP
invoke InvalidateRect,hwnd,NULL,TRUE
popad
ret
UpState endp ;End Of function UpState endp
WatchDogThread proc _lpVoid:DWORD
invoke WaitForSingleObject,_hProcHandle,INFINITE
szText szQuitMsg,"蜘蛛已退出.."
invoke MessageBox,NULL,addr szQuitMsg,NULL,MB_OK
mov HasQuit,00000000h
invoke SendMessage,hwnd,WM_DESTROY,0,0
szText szQuit,"has return?"
invoke MessageBoxA,NULL,addr szQuit,NULL,MB_OK
invoke ExitThread,0
ret
WatchDogThread endp
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
LOCAL @stPos:POINT
LOCAL @hDC:DWORD
LOCAL @stPS:PAINTSTRUCT
LOCAL @stRec:MY_RECT
;LOCAL @SEHState:DWORD
.IF uMsg==WM_DESTROY ; if the user closes our window
invoke PostQuitMessage,NULL ; quit our application
.ELSEIF (uMsg==WM_PAINT) && HasQuit
; mov @SEHState,0h
;assume fs:nothing
;lea eax,@SEHState
;push eax ;myself var
;push ebp ;myself var
;push offset SafePlace_Paint ;safeplace
;push offset SEHandler ;seh handler
; push fs:[0] ;prev
;mov fs:[0],esp
invoke BeginPaint,hWnd,addr @stPS
mov @hDC,eax
invoke TraveList,@hDC
.IF eax == 0
invoke SendMessage,hWnd,WM_DESTROY,0,0
.ENDIF
invoke EndPaint,hWnd,addr @stPS
;SafePlace_Paint:
;pop fs:[0] ;save stack used for SEH
;.IF @SEHState == 0FFFFFFFFh
; invoke SendMessage,hWnd,WM_DESTROY,0,0
;.ENDIF
.ELSEIF uMsg==WM_CREATE
invoke CreateThread,NULL,0,offset WatchDogThread,0,0,NULL
mov _hThreadHandle,eax
invoke GetPokerArray
.ELSEIF (uMsg==WM_LBUTTONDOWN) && HasQuit
mov eax,lParam
and eax,0FFFFh
mov @stPos.x,eax
mov eax,lParam
shr eax,16
mov @stPos.y,eax
invoke CheckWidHei,addr @stPos,addr @stRec
.IF DownPos.re_state
invoke UpState,addr @stRec
.ELSE
invoke DownState,addr @stRec
.ENDIF
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam ; Default message processing
ret
.ENDIF
xor eax,eax
ret
WndProc endp
GetPokerArray proc uses esi
LOCAL @loc1:DWORD
LOCAL @Buffer:DWORD
mov esi,_lpModuleBase
add esi,GlobalData
add esi,4
invoke ReadProcessMemory,_hProcHandle,esi,addr @Buffer,sizeof DWORD,NULL
mov esi,@Buffer
add esi,0ch
invoke ReadProcessMemory,_hProcHandle,esi,addr @Buffer,sizeof DWORD,NULL
invoke ReadProcessMemory,_hProcHandle,@Buffer,offset _dwPokerArray,ArraySize,NULL
ret
GetPokerArray endp
SEHandler proc _lpExceptionRecord:DWORD,_lpSEH:DWORD,_lpContext:DWORD,_lpDispatcherContext:DWORD
pushad
mov esi,_lpExceptionRecord
mov edi,_lpContext
assume esi:ptr EXCEPTION_RECORD,edi:ptr CONTEXT
mov eax,_lpSEH
push [eax+8]
pop [edi].regEip
push [eax+0ch]
pop [edi].regEbp
push eax
pop [edi].regEsp
assume esi:nothing,edi:nothing
;szText szQuitMessage,"Spider.exe Game Has Already Quit Out"
;invoke MessageBoxA,NULL,addr szQuitMessage,NULL,MB_OK
popad
mov eax,ExceptionContinueExecution
ret
SEHandler endp
TraveList proc uses esi ebx _hDC:DWORD
LOCAL @Buffer:DWORD
LOCAL @Offset:DWORD
LOCAL @List:POKERLIST
LOCAL @PokerNum:DWORD
LOCAL @BitmapRes[256]:WORD ;for unicode
LOCAL @SizeToRead:DWORD
LOCAL @BitmapData:DWORD
LOCAL @Temp:DWORD
LOCAL @Row:DWORD
LOCAL @Col:DWORD
LOCAL @ListBaseAddr:DWORD
LOCAL @ReadyPoker:DWORD
LOCAL @FirstReadyPoker:DWORD
;LOCAL @DbgBuf[256]:BYTE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;SEH for dectecting the Spider Game has already quit
assume fs:nothing
push ebp
push offset SafePlace
push offset SEHandler
push fs:[0]
mov fs:[0],esp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
invoke ReadFirstReadyPoker
mov @FirstReadyPoker,eax
mov @Row,0
mov @Col,0
mov esi,_lpModuleBase
add esi,GlobalData
add esi,8
invoke ReadProcessMemory,_hProcHandle,esi,addr @Buffer,sizeof DWORD,NULL
mov esi,@Buffer
mov @ListBaseAddr,esi
again:
mov esi,@ListBaseAddr
mov ebx,@Col
lea esi,DWORD PTR [esi+sizeof DWORD *ebx]
;esi must not be null
invoke ReadProcessMemory,_hProcHandle,esi,addr @Buffer,sizeof DWORD,NULL
;but the value read from it may be null
invoke ReadProcessMemory,_hProcHandle,@Buffer,addr @Buffer,sizeof DWORD,NULL
mov eax,@Buffer
mov @Temp,eax
dec @Row ;only run once time
jmp BeginRead
inloop:
mov eax,@List.pl_Number
find:
lea eax,DWORD PTR [eax+eax*2]
.IF (DownPos.re_state) && (eax == DownPos.re_pokernum)
pushad
invoke lstrcpyW,addr @BitmapRes,offset CARDBACK
popad
.ELSE
mov ebx,_dwPokerArray[eax*4] ;poker flower
imul ebx,0dh
mov eax,_dwPokerArray[eax*4+4] ;poker number
lea eax,DWORD PTR [ebx+eax+1] ;get CARD%d
mov @PokerNum,eax
invoke wsprintfW,addr @BitmapRes,offset ACARD,@PokerNum
.ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
invoke _GetBitmap2,addr @BitmapRes,addr @SizeToRead,NULL,0
.IF eax==0
.IF @SizeToRead==0 ;first time to GetBitamp2
jmp fail ;must have happen some serious questions
.ELSE ;second time to _GetBitmap2
invoke VirtualAlloc,NULL,@SizeToRead,MEM_COMMIT,PAGE_READWRITE
.IF eax ;SUCESSFUL allocate memory
mov @BitmapData,eax ;@BitmapData load for the address of memory allocated using VirtualAlloc()
invoke _GetBitmap2,addr @BitmapRes,addr @SizeToRead,@BitmapData,@SizeToRead
.IF eax ==0
jmp fail
.ENDIF
mov esi,@BitmapData
mov esi,@BitmapData
assume esi:ptr BITMAPINFOHEADER
.IF [esi].biSize == sizeof BITMAPINFOHEADER
mov eax,[esi].biWidth
mov @Width,eax
mov eax,[esi].biHeight
mov @Height,eax
movzx ecx,WORD PTR [esi].biBitCount
add esi,sizeof BITMAPINFOHEADER
mov eax,sizeof RGBQUAD
.ELSEIF [esi].biSize == sizeof BITMAPCOREHEADER
assume esi:ptr BITMAPCOREHEADER
movzx eax,word ptr [esi].bcWidth
mov @Width,eax
movzx eax,word ptr [esi].bcHeight
mov @Height,eax
movzx ecx,word ptr [esi].bcBitCount
add esi,sizeof BITMAPCOREHEADER
mov eax,sizeof RGBTRIPLE
.ENDIF
shl eax,cl
add esi,eax
xor ecx,ecx
mov ebx,@Height
sub ebx,40h
imul ebx,@Row
mov ecx,ebx
xor edx,edx
mov ebx,@Width
imul ebx,@Col
mov edx,ebx
invoke SetDIBitsToDevice,_hDC,edx,ecx,@Width,@Height,0h,0h,0h,@Height,esi,@BitmapData,DIB_RGB_COLORS
invoke VirtualFree,@BitmapData,@SizeToRead,MEM_RELEASE
.ELSE ;failed to allocate memory
jmp fail
.ENDIF
.ENDIF
.ENDIF
.IF @Temp
mov eax,@List.pl_Next
mov @Temp,eax
BeginRead:
.IF @Temp
invoke ReadProcessMemory,_hProcHandle,@Temp,addr @List,sizeof POKERLIST,NULL
inc @Row
.ELSE
jmp outloop
.ENDIF
jmp inloop
.ELSE
add @ReadyPoker,0Ah
jmp compara
.ENDIF
outloop:
mov eax,@FirstReadyPoker
add eax,@Col
mov @ReadyPoker,eax
compara:
cmp @ReadyPoker,68h
jge anothercol
inc @Row
mov eax,@ReadyPoker
jmp find
anothercol:
mov @Row,0
inc @Col
cmp @Col,TotolCol
jl again
mov eax,1
ret
SafePlace:
pop fs:[0] ;save stack used for SEH
add esp,10h
fail:
xor eax,eax
ret
TraveList endp
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -