.
586
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
include Resource.inc
include msvcrt.inc
includelib user32.lib
includelib kernel32.lib
includelib msvcrt.lib
WinMain proto :DWORD
.data
g_szUserName db
256
dup(
0
)
g_szErrorInfo db
"用户名个数小于4,请重新输入"
,
0
g_nBase dd
0
g_szFirst db
"CW-"
,
0
g_szFinal db
"-CRACKED"
,
0
g_szSecond db
256
dup (
0
)
g_szTmp db
"%d"
,
0
g_szResult db
256
dup (
0
)
.code
;对话过程函数
DlgProc proc hWnd:HWND,nMsg:UINT,wParam:WPARAM,lParam:LPARAM
.IF nMsg
=
=
WM_COMMAND
mov eax,wParam
.IF ax
=
=
IDB_GENERATE
;获取用户名编辑框中的文本
invoke GetDlgItemText,hWnd,IDE_NAME,offset g_szUserName,
255
.IF eax <
4
invoke MessageBox,NULL,offset g_szErrorInfo,NULL,MB_OK
mov eax,FALSE
ret
.ENDIF
;取用户名文本首字节
movzx eax,byte ptr [g_szUserName]
mov dword ptr [g_nBase],
29h
imul dword ptr [g_nBase]
mov dword ptr[g_nBase],eax
mov eax,dword ptr[g_nBase]
add dword ptr[g_nBase],eax
invoke crt_sprintf,offset g_szSecond,offset g_szTmp,dword ptr[g_nBase]
invoke crt_strcat,offset g_szResult,offset g_szFirst
invoke crt_strcat,offset g_szResult,offset g_szSecond
invoke crt_strcat,offset g_szResult,offset g_szFinal
;设置序列号
invoke SetDlgItemText,hWnd,IDE_SERIAL,offset g_szResult
;清空序列号
mov byte ptr [g_szResult],
0
.ELSEIF ax
=
=
IDB_CANCEL
invoke EndDialog,hWnd,
0
mov eax,FALSE
ret
.ENDIF
.ELSEIF nMsg
=
=
WM_CLOSE
invoke EndDialog,hWnd,
0
.ENDIF
mov eax,FALSE
ret
DlgProc endp
WinMain proc hInst:HINSTANCE
;创建模态对话框
invoke DialogBoxParam,hInst,IDD_DLG1,NULL,offset DlgProc,
0
ret
WinMain endp
;程序入口点
start:
invoke GetModuleHandle, NULL
invoke WinMain,eax
invoke ExitProcess,eax
end start