答案如下:
MASM32调试通过
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 主程序部分:Dialog.asm
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386
.model flat, stdcall
option casemap :none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Include 文件定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Equ 等值定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ICO_MAIN equ 1000h ;图标
DLG_MAIN equ 1
IDD_ABOUTBOX equ 2
IDC_STATIC1 equ 11
IDC_STATIC2 equ 12
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 数据段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data
InforMation db "请输入name",0
.data?
hInstance dd ?
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 代码段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_ProcABOUT proc uses ebx edi esi hWnd,wMsg,wParam,lParam
mov eax,wMsg
.if eax == WM_CLOSE
invoke EndDialog,hWnd,NULL
.elseif eax == WM_INITDIALOG
invoke LoadIcon,hInstance,ICO_MAIN
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
.elseif eax == WM_COMMAND
mov eax,wParam
.if ax == IDOK
invoke EndDialog,hWnd,NULL
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_ProcABOUT endp
_ProcDlgMain proc uses ebx edi esi hWnd,wMsg,wParam,lParam
local @szName[20]:byte
local @szSerial[40]:byte
local @szLength:dword
local @temp:word
invoke RtlZeroMemory,addr @szName,sizeof @szName
invoke RtlZeroMemory,addr @szSerial,sizeof @szSerial
mov eax,wMsg
.if eax == WM_CLOSE
invoke EndDialog,hWnd,NULL
.elseif eax == WM_INITDIALOG
invoke LoadIcon,hInstance,ICO_MAIN
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
.elseif eax == WM_COMMAND
mov eax,wParam
.if ax == IDCANCEL
invoke DialogBoxParam,hInstance,IDD_ABOUTBOX,NULL,offset _ProcABOUT,NULL
.endif
.if ax == IDOK
invoke GetDlgItemText,hWnd,IDC_STATIC1,addr @szName,sizeof @szName
mov @szLength,eax
mov @temp,4de1h
.if @szLength==0
invoke SetDlgItemText,hWnd,IDC_STATIC2,addr InforMation
.else
lea esi,@szSerial
xor ebx,ebx
mov cx,@temp
mov ax,cx
suanfa:shr ax,8
lea esi,@szName
mov dl,[esi+ebx]
xor al,dl
mov dl,al
and al,0fh
lea esi,@szSerial
.if al<0ah
add al,30h
.else
add al,37h
.endif
mov [esi+2*ebx+1],al
mov al,dl
shr al,4
.if al<0ah
add al,30h
.else
add al,37h
.endif
mov [esi+2*ebx],al
movzx ax,dl
add ax,cx
mov dx,0ce6dh
imul dx
add ax,058bfh
and ax,0ffffh
mov cx,ax
inc ebx
cmp ebx,@szLength
jl suanfa
invoke SetDlgItemText,hWnd,IDC_STATIC2,addr @szSerial
.endif
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_ProcDlgMain endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,DLG_MAIN,NULL,offset _ProcDlgMain,NULL
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 资源部分:Dialog.rc
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#include "resource.h"
#define ICO_MAIN 0x1000
#define DLG_MAIN 1
#define IDD_ABOUTBOX 2
#define IDC_STATIC1 11
#define IDC_STATIC2 12
ICO_MAIN ICON "DCG_KeyGen.ico"
IDD_ABOUTBOX DIALOG DISCARDABLE 193, 180, 234, 69
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "关于 DCG_2_2.exe_KeyGen"
FONT 9, "宋体"
BEGIN
ICON ICO_MAIN,-1,11,14,20,20
LTEXT "DCG_2_2.exe_KeyGen 2.0 版",IDC_STATIC,38,10,134,8,
SS_NOPREFIX
DEFPUSHBUTTON "确定",IDOK,177,7,50,14,WS_GROUP
LTEXT "by qwgboy2000",IDC_STATIC,39,23,144,12
LTEXT "http://www.dcg.org.cn",IDC_STATIC,39,36,153,13
LTEXT "dAyCrAckingGroup@tom.com",IDC_STATIC,39,50,153,13
END
DLG_MAIN DIALOG 193, 180, 240, 60
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "DCG_2_2.exe_KeyGen"
FONT 9, "宋体"
BEGIN
DEFPUSHBUTTON "确定",IDOK,180,7,50,19
PUSHBUTTON "关于",IDCANCEL,180,30,50,19
LTEXT "Name:",IDC_STATIC,7,7,30,19
LTEXT "Serial:",IDC_STATIC,7,30,30,19
EDITTEXT IDC_STATIC1,58,7,104,17,ES_AUTOHSCROLL
EDITTEXT IDC_STATIC2,57,29,104,17,ES_AUTOHSCROLL | ES_READONLY
END
;DCG_KeyGen.ico图标大家随便做一个就可以了
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 编译文件makefile
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
NAME = Dialog
OBJS = $(NAME).obj
RES = $(NAME).res
LINK_FLAG = /subsystem:windows
ML_FLAG = /c /coff
$(NAME).exe: $(OBJS) $(RES)
Link $(LINK_FLAG) $(OBJS) $(RES)
.asm.obj:
ml $(ML_FLAG) $<
.rc.res:
rc $<
clean:
del *.obj
del *.res
这是编译好的注册机文件
[此贴子已经被作者于2007-1-9 22:54:46编辑过]