• 标 题:Tray Helper V 3.6算法分析 (26千字)
  • 作 者:lq7972
  • 时 间:2003-10-05 14:38:03
  • 链 接:http://bbs.pediy.com


Software:Tray Helper V 3.6
http://www.trayhelper.com 
功能众多的小软件
Tools:TRW 2000、Ida v4.5
Cracker:lq7972[bruceyu13@sina.com]
Notes:学习。过完了假,又是工作~

这个软件的注册有点意思,输入了用户名和假码后,那个“OK”按钮还是灰色的;我们可以猜测软件是在用户输入名称的同时计算注册码,那么就下断点“bpx GetWindowText”(这里有一个小技巧,就是先把用户名放进系统剪贴板,再Ctrl+V到输入框,准拦住)

转到程序领空:
0167:00426133 E87E410600       CALL     `MFC42!ord_00000942`
0167:00426138 8D86E4000000     LEA      EAX,[ESI+E4] ;用户名
0167:0042613E 50               PUSH     EAX
0167:0042613F 68F2030000       PUSH     DWORD 03F2
0167:00426144 57               PUSH     EDI
0167:00426145 E86C410600       CALL     `MFC42!ord_00000942`
0167:0042614A 8D86E8000000     LEA      EAX,[ESI+E8]
0167:00426150 50               PUSH     EAX
0167:00426151 68ED040000       PUSH     DWORD 04ED
0167:00426156 57               PUSH     EDI
0167:00426157 E85A410600       CALL     `MFC42!ord_00000942`
0167:0042615C 81C6EC000000     ADD      ESI,EC
0167:00426162 56               PUSH     ESI
0167:00426163 68EE040000       PUSH     DWORD 04EE
0167:00426168 57               PUSH     EDI
0167:00426169 E848410600       CALL     `MFC42!ord_00000942` ;这里是关键【跟进】
0167:0042616E 5F               POP      EDI
0167:0042616F 5E               POP      ESI
0167:00426170 C20400           RET      04

;F8【跟进】后按F10一直到:
.text:0042626E                 push    eax
.text:0042626F                 push    ecx
.text:00426270                 call    sub_4679DB ;在这里F8【跟进】

;【跟进】后按F10来到:
.text:00467A08                 xor     esiesi ;esi清零
.text:00467A0A                 push    4
.text:00467A0C                 push    eax
.text:00467A0D                 mov     [ebp-4], esi
.text:00467A10                 call    ??_L@YGXPAXIHP6EX0@Z1@Z  `eh vector constructor iterator'(void *,uint,int,void (*)(void *),uint)
.text:00467A15                 mov     eax, [ebp-14h] ;用户名
.text:00467A18                 mov     byte ptr [ebp-4], 1
.text:00467A1C                 cmp     dword ptr [eax-8], 5 ;  长度小于5吗?
.text:00467A20                 jl      loc_468022 ;不要跳走了
.text:00467A26                 mov     ebxds:_mbscmp
.text:00467A2C                 push    offset aTemporaryCode  "temporary code"
.text:00467A31                 push    eax
.text:00467A32                 call    ebx  _mbscmp
.text:00467A34                 pop     ecx
.text:00467A35                 test    eaxeax ;用户名
.text:00467A37                 pop     ecx
.text:00467A38                 jnz     loc_467C62 ;这里跳到下面计算注册码
;***********************************************************************
.text:00467C62 loc_467C62:                              CODE XREF: sub_4679DB+5Dj
.text:00467C62                 lea     eax, [ebp-44h]
.text:00467C65                 mov     [ebp-1Ch], esi ;[ebp-1Ch]=0
.text:00467C68                 mov     [ebp-18h], eax
;。。。。。。(略N行)
;-----------------------------------------------------------------------按F10一直到:
.text:00467C70 loc_467C70:                              CODE XREF: sub_4679DB+604j
.text:00467C70                 lea     ecx, [ebp-10h]
.text:00467C73                 call    ??0CString@@QAE@XZ  CString::CString(void)
.text:00467C78                 lea     ecx, [ebp+8]
.text:00467C7B                 mov     byte ptr [ebp-4], 5
.text:00467C7F                 call    ??0CString@@QAE@XZ  CString::CString(void)
.text:00467C84                 mov     eax, [ebp-14h] ;用户名
.text:00467C87                 push    2
.text:00467C89                 pop     ebx ;【ebx=2】这个值后面要用
.text:00467C8A                 mov     byte ptr [ebp-4], 6
.text:00467C8E                 mov     eax, [eax-8] ;用户名长度
.text:00467C91                 mov     ecxebx
.text:00467C93                 cdq
.text:00467C94                 idiv    ecx ;  除以2
.text:00467C96                 test    edxedx ;    余数
.text:00467C98                 jnz     short loc_467C9F ;      不为0,就。。。
.text:00467C9A                 push    dword ptr [ebp-1Ch]
.text:00467C9D                 jmp     short loc_467CA6
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++余数不等于0
 loc_467C9F:                              CODE XREF: sub_4679DB+2BDj
.text:00467C9F                 mov     eax, [ebp-1Ch] ;eax=0,见00467A08、00467C65
.text:00467CA2                 add     eax, 5 ;  第一位注册码=5
.text:00467CA5                 push    eax
.text:00467CA6 
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++余数等于0
;  第一位注册码=0
.text:00467CA6 loc_467CA6:                              CODE XREF: sub_4679DB+2C2j
.text:00467CA6                 lea     eax, [ebp-10h]
.text:00467CA9                 push    esi
.text:00467CAA                 push    eax
.text:00467CAB                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467CB0                 mov     eax, [ebp-14h] ;用户名
.text:00467CB3                 add     esp, 0Ch
.text:00467CB6                 movsx   eaxbyte ptr [eax] ;  第一位
.text:00467CB9                 push    0Ah
.text:00467CBB                 cdq
.text:00467CBC                 pop     ecx ;(ecx=0Ah)
.text:00467CBD                 idiv    ecx ;     除以0Ah
.text:00467CBF                 lea     eax, [ebp+8]
.text:00467CC2                 push    edx ;       余数4入栈,
.text:00467CC3                 push    esi ;   是为注册码第2位
.text:00467CC4                 push    eax
.text:00467CC5                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...) ;格式化为一个字符
.text:00467CCA                 add     esp, 0Ch
.text:00467CCD                 lea     eax, [ebp+8] ;注册码第2位,每次都存放在这里
.text:00467CD0                 lea     ecx, [ebp-10h] ;注册码第1位,(下面类推)
.text:00467CD3                 push    eax
.text:00467CD4                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &) ;把它们连接成注册码的第1、2位
.text:00467CD9                 mov     eax, [ebp-14h] ;用户名
.text:00467CDC                 push    4
.text:00467CDE                 pop     ecx ;ecx=4
.text:00467CDF                 movsx   eaxbyte ptr [eax+1] ;用户名第2位
.text:00467CE3                 cdq
.text:00467CE4                 idiv    ecx ;  除以ecx(=4)
.text:00467CE6                 lea     eax, [ebp+8]
.text:00467CE9                 add     edxebx ;    余数加ebx(=2),见00467C89
.text:00467CEB                 push    edx ;保存
.text:00467CEC                 push    esi
.text:00467CED                 push    eax
.text:00467CEE                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...) ;同上,格式化
.text:00467CF3                 add     esp, 0Ch
.text:00467CF6                 lea     eax, [ebp+8] ;注册码第3位
.text:00467CF9                 lea     ecx, [ebp-10h] ;注册码第2位
.text:00467CFC                 push    eax
.text:00467CFD                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &) ;同上,连接
.text:00467D02                 push    dword ptr [ebp-10h]  char *
.text:00467D05                 call    ds:atoi ;前三位转为整数,返回eax
.text:00467D0B                 lea     ecx, [ebp-10h]
.text:00467D0E                 mov     [ebp-24h], eax ;【注意】这里,下面要用;eax是注册码前3位(整数形式)
.text:00467D11                 mov     [esp+14Ch+var_14C], offset asc_4BC800  "-"   这是第四位
.text:00467D18                 call    ??YCString@@QAEABV0@PBD@Z  CString::operator+=(char const *) ;连接后形为“xxx-”
.text:00467D1D                 mov     eax, [ebp-14h] ;用户名
.text:00467D20                 push    7
.text:00467D22                 pop     ecx ;(ecx=7)
.text:00467D23                 movsx   eaxbyte ptr [eax+2] ;  第3位
.text:00467D27                 cdq
.text:00467D28                 idiv    ecx ;    除以ecx(=7)
.text:00467D2A                 lea     eax, [ebp+8]
.text:00467D2D                 mov     ediedx ;      余数递edi
.text:00467D2F                 inc     edi ;再加1就是注册码第5位
.text:00467D30                 push    edi
.text:00467D31                 push    esi
.text:00467D32                 push    eax
.text:00467D33                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467D38                 add     esp, 0Ch
.text:00467D3B                 lea     eax, [ebp+8]
.text:00467D3E                 lea     ecx, [ebp-10h]
.text:00467D41                 push    eax
.text:00467D42                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &)
.text:00467D47                 mov     eaxedi ;注册码第5位ASCII码
.text:00467D49                 push    6
.text:00467D4B                 imul    eax, 0Dh ;  乘以0Dh
.text:00467D4E                 add     eax, [ebp-24h] ;  加上[/];见00467D0E处
.text:00467D51                 pop     ecx ;(ecx=6)
.text:00467D52                 cdq
.text:00467D53                 idiv    ecx ;   除以ecx(=6)
.text:00467D55                 lea     eax, [ebp+8]
.text:00467D58                 add     edxebx ;     余数加上ebx(=2)
.text:00467D5A                 push    edx ;就是注册码第6位
.text:00467D5B                 push    esi
.text:00467D5C                 push    eax
.text:00467D5D                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467D62                 add     esp, 0Ch
.text:00467D65                 lea     eax, [ebp+8]
.text:00467D68                 lea     ecx, [ebp-10h]
.text:00467D6B                 push    eax
.text:00467D6C                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &)
.text:00467D71                 mov     eax, [ebp-14h] ;用户名
.text:00467D74                 movsx   eaxbyte ptr [eax+3] ;  第4位
.text:00467D78                 push    0Ah
.text:00467D7A                 cdq
.text:00467D7B                 pop     ecx ;(ecx=0Ah)
.text:00467D7C                 idiv    ecx ;     除以ecx(=0Ah)
.text:00467D7E                 lea     eax, [ebp+8]
.text:00467D81                 mov     ediedx ;       余数递edi
.text:00467D83                 push    edi ;注册码第7位
.text:00467D84                 push    esi
.text:00467D85                 push    eax
.text:00467D86                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467D8B                 add     esp, 0Ch
.text:00467D8E                 lea     eax, [ebp+8]
.text:00467D91                 lea     ecx, [ebp-10h]
.text:00467D94                 push    eax
.text:00467D95                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &)
.text:00467D9A                 push    5
.text:00467D9C                 inc     edi ;注册码第7位ASCII码加1
.text:00467D9D                 pop     eax ;(eax=5)
.text:00467D9E                 cdq
.text:00467D9F                 idiv    edi ;eax idiv edi
.text:00467DA1                 mov     edi, offset aD_4  "%d-"
.text:00467DA6                 lea     eax, [ebp+8]
.text:00467DA9                 push    edx ;注册码第8位
.text:00467DAA                 push    edi ;“-”,第9位
.text:00467DAB                 push    eax
.text:00467DAC                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...) ;格式化为“x-”
.text:00467DB1                 add     esp, 0Ch
.text:00467DB4                 lea     eax, [ebp+8]
.text:00467DB7                 lea     ecx, [ebp-10h]
.text:00467DBA                 push    eax
.text:00467DBB                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &) ;连接后注册码形如“xxx-yyyy-”
.text:00467DC0                 mov     eax, [ebp-14h] ;用户名
.text:00467DC3                 mov     ecxebx ;(ecx=ebx=2)
.text:00467DC5                 movsx   eaxbyte ptr [eax+4] ;  第5位
.text:00467DC9                 cdq
.text:00467DCA                 idiv    ecx ;    除以ecx(=2)
.text:00467DCC                 lea     eax, [ebp+8]
.text:00467DCF                 push    edx ;      余数为注册码第10位
.text:00467DD0                 push    esi
.text:00467DD1                 push    eax
.text:00467DD2                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467DD7                 add     esp, 0Ch
.text:00467DDA                 lea     eax, [ebp+8]
.text:00467DDD                 lea     ecx, [ebp-10h]
.text:00467DE0                 push    eax
.text:00467DE1                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &) ;连接后注册码形如“xxx-yyyy-z”
.text:00467DE6                 mov     eax, [ebp-14h] ;用户名
.text:00467DE9                 cmp     dword ptr [eax-8], 5 ;  的长度大于5?
.text:00467DED                 jg      short loc_467DF5 ;    是,跳~
.text:00467DEF                 movsx   eaxbyte ptr [eax+3] ;    否(等于),则取用户名第4位;【注意】:这里不可能小于5,见前00467A1C处
.text:00467DF3                 jmp     short loc_467DF9
.text:00467DF5  +++++++++++++++++++++++++++++++++++++++++++++++++++++++用户名长度大于5?.text:00467DF5 
.text:00467DF5 loc_467DF5:                              CODE XREF: sub_4679DB+412j
.text:00467DF5                 movsx   eaxbyte ptr [eax+5] ;   就取用户名第6位
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++
.text:00467DF9 
.text:00467DF9 loc_467DF9:                              CODE XREF: sub_4679DB+418j
.text:00467DF9                 push    4
.text:00467DFB                 cdq
.text:00467DFC                 pop     ecx ;(ecx=4)
.text:00467DFD                 idiv    ecx ;   再除以ecx(=4)
.text:00467DFF                 lea     eax, [ebp+8]
.text:00467E02                 add     edxebx ;     余数加ebx(=2)
.text:00467E04                 push    edx ;就是注册码第11位
.text:00467E05                 push    esi
.text:00467E06                 push    eax
.text:00467E07                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467E0C                 add     esp, 0Ch
.text:00467E0F                 lea     eax, [ebp+8]
.text:00467E12                 lea     ecx, [ebp-10h]
.text:00467E15                 push    eax
.text:00467E16                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &)
.text:00467E1B                 mov     eax, [ebp-14h] ;用户名
.text:00467E1E                 cmp     dword ptr [eax-8], 6 ;  长度大于6?
.text:00467E22                 jg      short loc_467E32 ;  是,跳~
.text:00467E24                 movsx   eaxbyte ptr [eax+1] ;  否,取用户名第2位
.text:00467E28                 push    7
.text:00467E2A                 cdq
.text:00467E2B                 pop     ecx
.text:00467E2C                 idiv    ecx ;  (否)除以ecx(=7)
.text:00467E2E                 add     edxebx ;  (否)余数再加ebx(=2)
.text:00467E30                 jmp     short loc_467E3E
.text:00467E32  +++++++++++++++++++++++++++++++++++++++++++++++++++++++用户名长度大于6
.text:00467E32 
.text:00467E32 loc_467E32:                              CODE XREF: sub_4679DB+447j
.text:00467E32                 movsx   eaxbyte ptr [eax+6] ;   取用户名第7位
.text:00467E36                 cdq
.text:00467E37                 mov     ecxebx
.text:00467E39                 idiv    ecx ;      除以ecx(=2)
.text:00467E3B                 add     edx, 6 ;      余数再加6
;++++++++++++++++++++++++++++++++++++++++++++++++++++++
.text:00467E3E 
.text:00467E3E loc_467E3E:                              CODE XREF: sub_4679DB+455j
.text:00467E3E                 push    edx ;上面结果就是注册码第12位
.text:00467E3F                 lea     eax, [ebp+8]
.text:00467E42                 push    esi
.text:00467E43                 push    eax
.text:00467E44                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467E49                 add     esp, 0Ch
.text:00467E4C                 lea     eax, [ebp+8]
.text:00467E4F                 lea     ecx, [ebp-10h]
.text:00467E52                 push    eax
.text:00467E53                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &)
.text:00467E58                 mov     eax, [ebp-14h] ;用户名
.text:00467E5B                 cmp     dword ptr [eax-8], 7 ;  长度大于7?
.text:00467E5F                 jg      short loc_467E6D ;  是,跳
.text:00467E61                 movsx   eaxbyte ptr [eax+2] ;  否,取用户名第3位
.text:00467E65                 push    3
.text:00467E67                 cdq
.text:00467E68                 pop     ecx
.text:00467E69                 idiv    ecx ;  (否)除以ecx(=3)
.text:00467E6B                 jmp     short loc_467E79
.text:00467E6D  +++++++++++++++++++++++++++++++++++++++++++++++++++++++用户名长度大于7
.text:00467E6D 
.text:00467E6D loc_467E6D:                              CODE XREF: sub_4679DB+484j
.text:00467E6D                 movsx   eaxbyte ptr [eax+7] ;  就取用户名第8位
.text:00467E71                 cdq
.text:00467E72                 mov     ecxebx
.text:00467E74                 idiv    ecx ;     除以ecx(=2)
.text:00467E76                 add     edx, 6 ;       余数加6
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++
.text:00467E79 
.text:00467E79 loc_467E79:                              CODE XREF: sub_4679DB+490j
.text:00467E79                 push    edx ;上面的结果就是注册码第13位
.text:00467E7A                 lea     eax, [ebp+8]
.text:00467E7D                 push    edi
.text:00467E7E                 push    eax
.text:00467E7F                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467E84                 add     esp, 0Ch
.text:00467E87                 lea     eax, [ebp+8]
.text:00467E8A                 lea     ecx, [ebp-10h]
.text:00467E8D                 push    eax
.text:00467E8E                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &) ;这里连接后注册码形如“xxx-yyyy-zzzz-”
.text:00467E93                 mov     eax, [ebp-14h] ;用户名
.text:00467E96                 cmp     dword ptr [eax-8], 8 ;  长度大于8?
.text:00467E9A                 jg      short loc_467EA8 ;  是,跳~
.text:00467E9C                 movsx   eaxbyte ptr [eax+4] ;  否,取用户名第5位
.text:00467EA0                 push    9
.text:00467EA2                 cdq
.text:00467EA3                 pop     ecx
.text:00467EA4                 idiv    ecx ;  (否)除以ecx(=9)
.text:00467EA6                 jmp     short loc_467EB4
.text:00467EA8  +++++++++++++++++++++++++++++++++++++++++++++++++++++++用户名长度大于8
.text:00467EA8 
.text:00467EA8 loc_467EA8:                              CODE XREF: sub_4679DB+4BFj
.text:00467EA8                 movsx   eaxbyte ptr [eax+8] ;  就取用户名第9位
.text:00467EAC                 push    6
.text:00467EAE                 cdq
.text:00467EAF                 pop     ecx
.text:00467EB0                 idiv    ecx ;   除以ecx(=6)
.text:00467EB2                 add     edxebx ;   余数加ebx(=2)
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.text:00467EB4 
.text:00467EB4 loc_467EB4:                              CODE XREF: sub_4679DB+4CBj
.text:00467EB4                 push    edx ;注册码第15位
.text:00467EB5                 lea     eax, [ebp+8]
.text:00467EB8                 push    esi
.text:00467EB9                 push    eax
.text:00467EBA                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467EBF                 add     esp, 0Ch
.text:00467EC2                 lea     eax, [ebp+8]
.text:00467EC5                 lea     ecx, [ebp-10h]
.text:00467EC8                 push    eax
.text:00467EC9                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &)
.text:00467ECE                 mov     eax, [ebp-14h] ;用户名
.text:00467ED1                 cmp     dword ptr [eax-8], 9 ;  长度大于9?
.text:00467ED5                 jg      short loc_467EE1 ;  是,跳~
.text:00467ED7                 movsx   eaxbyte ptr [eax] ;  否,取用户名第1位
.text:00467EDA                 cdq
.text:00467EDB                 mov     ecxebx
.text:00467EDD                 idiv    ecx ;   除以ecx(=2)
.text:00467EDF                 jmp     short loc_467EEC
.text:00467EE1 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++用户名长度大于9
.text:00467EE1 
.text:00467EE1 loc_467EE1:                              CODE XREF: sub_4679DB+4FAj
.text:00467EE1                 movsx   eaxbyte ptr [eax+9] ;   取用户名第10位
.text:00467EE5                 cdq
.text:00467EE6                 mov     ecxebx
.text:00467EE8                 idiv    ecx ;   除以ecx(=2)
.text:00467EEA                 add     edxebx ;   余数加上ebx(=2)
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.text:00467EEC 
.text:00467EEC loc_467EEC:                              CODE XREF: sub_4679DB+504j
.text:00467EEC                 push    edx ;注册码第16位
.text:00467EED                 lea     eax, [ebp+8]
.text:00467EF0                 push    esi
.text:00467EF1                 push    eax
.text:00467EF2                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467EF7                 add     esp, 0Ch
.text:00467EFA                 lea     eax, [ebp+8]
.text:00467EFD                 lea     ecx, [ebp-10h]
.text:00467F00                 push    eax
.text:00467F01                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &)
.text:00467F06                 mov     eax, [ebp-14h] ;用户名
.text:00467F09                 cmp     dword ptr [eax-8], 0Ah ;  长度大于10D?
.text:00467F0D                 jg      short loc_467F1B ;  是,跳~
.text:00467F0F                 movsx   eaxbyte ptr [eax+1] ;  否,取用户名第2位
.text:00467F13                 push    7
.text:00467F15                 cdq
.text:00467F16                 pop     ecx
.text:00467F17                 idiv    ecx ;   除以ecx(=7)
.text:00467F19                 jmp     short loc_467F27
.text:00467F1B  +++++++++++++++++++++++++++++++++++++++++++++++++++++++用户名长度大于10
.text:00467F1B 
.text:00467F1B loc_467F1B:                              CODE XREF: sub_4679DB+532j
.text:00467F1B                 movsx   eaxbyte ptr [eax+0Ah] ;   取用户名第11位
.text:00467F1F                 push    7
.text:00467F21                 cdq
.text:00467F22                 pop     ecx
.text:00467F23                 idiv    ecx ;   除以ecx(=7)
.text:00467F25                 add     edxebx ;   余数加上ebx(=2)
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.text:00467F27 
.text:00467F27 loc_467F27:                              CODE XREF: sub_4679DB+53Ej
.text:00467F27                 push    edx ;注册码第17位
.text:00467F28                 lea     eax, [ebp+8]
.text:00467F2B                 push    esi
.text:00467F2C                 push    eax
.text:00467F2D                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467F32                 add     esp, 0Ch
.text:00467F35                 lea     eax, [ebp+8]
.text:00467F38                 lea     ecx, [ebp-10h]
.text:00467F3B                 push    eax
.text:00467F3C                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &) ;到这里注册码形如“xxx-yyyy-zzzz-aaa
;还有最后一位没有计算出来
.text:00467F41                 lea     eax, [ebp-10h]
.text:00467F44                 lea     ecx, [ebp+8]
.text:00467F47                 push    eax
.text:00467F48                 call    ??4CString@@QAEABV0@ABV0@@Z  CString::operator=(CString const &)
.text:00467F4D                 push    offset ValueName
.text:00467F52                 push    offset asc_4BC800  "-"
.text:00467F57                 lea     ecx, [ebp+8]
.text:00467F5A                 call    MFC42_6877
.text:00467F5F                 lea     eax, [ebp-20h] ;上面计算好的注册码(17位)
.text:00467F62                 push    5
.text:00467F64                 push    eax
.text:00467F65                 lea     ecx, [ebp+8]
.text:00467F68                 call    ?Left@CString@@QBE?AV1@H@Z  CString::Left(int)
;从它的左边取出6位,然后去掉“-”
.text:00467F6D                 push    eax
.text:00467F6E                 lea     ecx, [ebp+8]
.text:00467F71                 mov     byte ptr [ebp-4], 7
.text:00467F75                 call    ??4CString@@QAEABV0@ABV0@@Z  CString::operator=(CString const &)
.text:00467F7A                 lea     ecx, [ebp-20h]
.text:00467F7D                 mov     byte ptr [ebp-4], 6
.text:00467F81                 call    ??1CString@@QAE@XZ  CString::~CString(void)
.text:00467F86                 push    dword ptr [ebp+8]  char *
.text:00467F89                 call    ds:atoi ;再转换成整数形式,返回eax
.text:00467F8F                 pop     ecx
.text:00467F90                 push    0Ah
.text:00467F92                 cdq
.text:00467F93                 pop     ecx
.text:00467F94                 idiv    ecx ;  最后除以ecx(=0Ah)
.text:00467F96                 lea     eax, [ebp+8]
.text:00467F99                 push    edx ;  余数就是注册码第18位
.text:00467F9A                 push    esi
.text:00467F9B                 push    eax
.text:00467F9C                 call    ?Format@CString@@QAAXPBDZZ  CString::Format(char const *,...)
.text:00467FA1                 add     esp, 0Ch
.text:00467FA4                 lea     eax, [ebp+8]
.text:00467FA7                 lea     ecx, [ebp-10h]
.text:00467FAA                 push    eax
.text:00467FAB                 call    ??YCString@@QAEABV0@ABV0@@Z  CString::operator+=(CString const &) ;得到完整的注册码
.text:00467FB0                 mov     ecx, [ebp-18h]
.text:00467FB3                 lea     eax, [ebp-10h]
.text:00467FB6                 push    eax

【总结】
注册算法还是比较简单的:通过反复从用户名、已计算的注册码中取值运算得到注册码,详细见上。

标 题:Tray Helper V 3.6注册机 (6千字)
发信人:lq7972
时 间:2003-10-05 14:49:08
详细信息:

Software:Tray Helper V 3.6
http://www.trayhelper.com 
功能众多的小软件
Tools:TRW 2000、Ida v4.5,MASM32 V8
Cracker:lq7972[bruceyu13@sina.com]
Notes:过完这个国庆假期,下半年的工作那个忙啊~忙啊
      如果这篇文字写得不好,请丢番茄--晚上我好凑个冷盘^_^
【注册机】
KeyGen.asm
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; The KeyGen by lq7972,with MASM32 V8
; E-mail:bruceyu13@sina.com
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386
.model flat,stdcall
option casemap:none

;Include文件定义
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
include gdi32.inc
includelib gdi32.lib
include comdlg32.inc
includelib comdlg32.lib
include masm32.inc
includelib masm32.lib

;Equ等值定义
;ICO_MAIN equ 1000H
DLG_MAIN equ 1
EditName equ 10
EditSN equ 11
;*************************************************************************************
.data?
szName db 11 dup (?)
szSN            db 20 dup (?)
Reg1 dd 3 dup (?)
Reg2 dd 4 dup (?)
Reg3 dd 4 dup (?)
Reg4 dd 4 dup (?)
Temp db 5 dup (?)

.data
hInstance dd 0
szErr db '用户名长度要大(等)于5!',0dh,0ah,'请重新输入。。。',0
szCaption db '错误!',0 
RegFmt db '%3s-%4s-%4s-%4s',0
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
;***************************************************************************************
_RegCodCalc proc
local @Len,@Temp
pushad
xor esi,esi
mov ebx,2
invoke lstrlen,addr szName
mov dword ptr @Len,eax
.if eax < 5
invoke MessageBox,NULL,offset szErr,offset szCaption,MB_OK
mov eax,FALSE
ret 
.endif
mov ecx,ebx
cdq
idiv ecx
test edx,edx
jnz @F
invoke dw2a,edx,addr [Reg1]
invoke dw2a,edx,addr [Temp]
jmp a10
@@:
mov eax,esi
add eax,5
mov edx,eax
invoke dw2a,edx,addr [Reg1]
invoke dw2a,edx,addr [Temp]
a10:
lea eax,offset szName
movsx eax,byte ptr [szName]
mov ecx,0Ah
cdq
idiv ecx 
invoke dw2a,edx,addr [Reg1+1]
invoke dw2a,edx,addr [Temp+1]
movsx eax,byte ptr [szName+1]
mov ecx,4
cdq
idiv ecx
add edx,ebx
invoke dw2a,edx,addr [Reg1+2]
invoke dw2a,edx,addr [Temp+2]

invoke htodw,addr Reg1
mov dword ptr @Temp,eax

movsx eax,byte ptr [szName+2]
mov ecx,7
cdq
idiv ecx
mov edi,edx
inc edi
mov edx,edi
invoke dw2a,edx,addr [Reg2]
invoke dw2a,edx,addr [Temp+3]

mov eax,edi
mov ecx,6
imul eax,0Dh
add eax,@Temp
cdq
idiv ecx
add edx,ebx
invoke dw2a,edx,addr [Reg2+1]
invoke dw2a,edx,addr [Temp+4]

mov eax,dword ptr Reg2

movsx eax,byte ptr [szName+3]
mov ecx,0Ah
cdq
idiv ecx
mov edi,edx
invoke dw2a,edx,addr [Reg2+2]
inc edi
mov eax,5
cdq
idiv edi
invoke dw2a,edx,addr [Reg2+3]

movsx eax,byte ptr [szName+4]
mov ecx,ebx
cdq
idiv ecx
invoke dw2a,edx,addr [Reg3]

.if @Len > 5
movsx eax,byte ptr [szName+5]
.else
movsx eax,byte ptr [szName+3]
.endif
mov ecx,4
cdq
idiv ecx
add edx,ebx
invoke dw2a,edx,addr [Reg3+1]

.if @Len > 6
movsx eax,byte ptr [szName+6]
cdq
mov ecx,ebx
idiv ecx
add edx,6
.else
movsx eax,byte ptr [szName+1]
mov ecx,7
cdq
idiv ecx
add edx,ebx
.endif
invoke dw2a,edx,addr [Reg3+2]

.if @Len > 7
movsx eax,byte ptr [szName+7]
cdq
mov ecx,ebx
idiv ecx
add edx,6
.else
movsx eax,byte ptr [szName+2]
cdq
mov ecx,3
idiv ecx
.endif
invoke dw2a,edx,addr [Reg3+3]

.if @Len > 8
movsx eax,byte ptr [szName+8]
cdq
mov ecx,6
idiv ecx
add edx,ebx
.else
movsx eax,byte ptr [szName+4]
cdq
mov ecx,9
idiv ecx
.endif
invoke dw2a,edx,addr [Reg4]

.if @Len > 9
movsx eax,byte ptr [szName+9]
cdq
mov ecx,ebx
idiv ecx
add edx,ebx
.else
movsx eax,byte ptr [szName]
cdq
mov ecx,ebx
idiv ecx
.endif
invoke dw2a,edx,addr [Reg4+1]

.if @Len > 0Ah
movsx eax,byte ptr [szName+0Ah]
cdq
mov ecx,7
idiv ecx
add edx,ebx
.else
movsx eax,byte ptr [szName+1]
cdq
mov ecx,7
idiv ecx
.endif
invoke dw2a,edx,addr [Reg4+2]

invoke atodw,addr Temp
mov ecx,0Ah
cdq
idiv ecx
invoke dw2a,edx,addr [Reg4+3]

invoke wsprintf,addr szSN,addr RegFmt,addr Reg1,addr Reg2,addr Reg3,addr Reg4
popad
ret
_RegCodCalc endp
;**************************************************************************************
_ProcDlgMain proc uses ebx edi esi ebp hWnd,wMsg,wParam,lParam
mov eax,wMsg
.if eax  ==  WM_CLOSE 
invoke  EndDialog,hWnd,NULL
.elseif eax  ==  WM_COMMAND 
mov eax,wParam 
.if eax  ==  IDOK
invoke RtlZeroMemory,offset szName,512
invoke  GetDlgItemText,hWnd,EditName,offset szName,11
.if eax !=  NULL
invoke _RegCodCalc
invoke SetDlgItemText,hWnd,EditSN,offset szSN
mov eax,FALSE
ret
                 .endif
.elseif eax  ==  IDCANCEL 
invoke  EndDialog,hWnd,NULL 
.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

KeyGen.rc
;/////////////////////////////////////////////////////////////////////////////////////
#include  

#define ICO_MAIN 0x1000
#define DLG_MAIN 1
#define EDITName 10
#define EDITSN 11

//ICO_MAIN ICON "01.ico"
DLG_MAIN DIALOG 100,150,250,60
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Tray Helper v3.6 注册机" 
FONT 9,"宋体" 

{
 CONTROL "Name:" ,-1,"Static",SS_LEFT,10,13,40,17
 CONTROL "Code:" ,-2,"Static",SS_CENTER,10,40,20,17
 CONTROL "" ,10,"Edit",ES_LEFT,30,13,150,10
 CONTROL "" ,11,"Edit",ES_LEFT,30,40,150,10
 DEFPUSHBUTTON "GENERATE",IDOK,200,11,40,15
 PUSHBUTTON "EXIT",IDCANCEL,200,36,41,14
}
;///////////////////////////////////////////////////////////////////////////////////

makefile
;//////////////////////////////////////////////////////////////////////////////////
NAME = KeyGen 
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