上次写的 EditPlus v2.12en 注册过程分析 ,补了一下注册机,添过去了不过感觉有点太长,打开网页有点慢了,想了想还是单独帖出来一份吧。
#include <stdio.h>
#include <windows.h>
WORD list[0x80*2];
char szUserName[256];
char szRegCode[] = "2800604434";/*add a char '4',2005.2.1*/
char *pszUserName = NULL;
int nUserNameLen;
void MakeCodeList() //sub_0047C9C0()
{
int i,j=0;
//BYTE *pList; //delete
DWORD ieax,iecx,iesi=0;
WORD temp;
//清零
for(i=0;i<0x80*2;i++)
list[i] = 0;
do{
ieax = 0x0C0C1; //ieax = 49345
iecx = 1;
do{
if ((iesi&iecx)!=0)
{
temp = (WORD)(ieax&0x0FFFF);
list[j] = list[j]^temp;
}
ieax*=2;
iecx*=2;
ieax = ieax^0x04003;
}while(iecx<0x100);
j++;
iesi++;
}while(j<0x80*2);
/* ////////////////// 显示List ///////////////
pList = (BYTE*)list;
for(i=0;i<0x80*4;i++)
{
if(i%8 == 0 && i!=0 && i%16 != 0)
printf("- ");
if(i%16 ==0 && i!=0)
printf("\n");
printf("%02X ",pList[i]);
}
/////////////////////////////////////////
*/
}
// sub_0047CA10(int n,char *pszUserName,int /*nUserNameLen*/)
int MakeRegCode1(int n,char *pszUserName,int /*nUserNameLen*/)
{
DWORD ieax,iebx,iedx,temp;
char *iecx;
iecx = pszUserName;
//ieax = nUserNameLen;
if(*iecx == '\0')
return 0;
ieax = n;
do{
//MOV EDX,EAX
iedx = ieax;
//XOR EBX,EBX
iebx = 0;
//MOV BL,[ECX]
temp = *iecx;
iebx = iebx & 0xFFFFFF00;
iebx = iebx ^ temp;
//AND EDX,000000FF
iedx = iedx & 0x000000FF;
//XOR EDX,EBX
iedx = iedx ^ iebx;
//XOR EBX,EBX
iebx = 0;
//MOV BL,AH
temp = ieax;
temp = temp>>8;
temp = temp & 0x000000FF;
iebx = iebx & 0xFFFFFF00;
iebx = iebx ^ temp;
//MOV AX,[EDX*2+00523410]
temp = list[iedx]; //因为我们的数组是WORD型,所以不用×2
ieax = ieax & 0xFFFF0000;
ieax = ieax ^ temp;
//XOR AX,BX
temp = iebx;
temp = temp & 0x0000FFFF;
ieax = ieax ^ temp;
iecx++;
}while(*iecx != '\0');
/* /////////////////del///////////////////////
printf("\nEAX=%08X\nEDX=%08X\n",ieax,iedx);
///////////////////////////////////////////
*/
return ieax;
}
void CheckUserName()
{
char *p = pszUserName;
//删除用户名前面的空格和制表符
while( (*p == '\x20') || (*p == '\x9'))
{
pszUserName = ++p;
}
while( *p != '\0')
{
p++;
}
//删除用户名后面的空格和制表符
while( (*(--p) == '\x20') || (*p == '\x9'))
{
*p = '\0';
}
nUserNameLen = (int)(p - pszUserName + 1);
}
int key5()
{
DWORD key5 = 1;
for(int i=0; i<nUserNameLen; i++)
{
key5 += (DWORD)pszUserName[i];
}
__asm
{
pushad
mov ecx,key5
lea ecx,[ecx*8+ecx+0ah]
mov eax,55555556h
imul ecx
mov eax,edx
shr eax,1Fh
lea ecx,[eax+edx+24h]
and ecx,8000000Fh
jns end
dec ecx
or ecx,-10h
inc ecx
end:
mov key5,ecx
popad
}
//printf("%X",key5);
return key5;
}
int main()
{
DWORD dwReg;
char szReg[10];
printf(" =====================================\n");
printf(" * Editplus v2.12 KeyGen *\n");
printf(" * by icytear *\n");
printf(" =====================================\n\n");
printf("Please input your name for register: ");
scanf("%s",szUserName);
pszUserName = szUserName;
CheckUserName();
MakeCodeList();//sub_0047C9C0();
//生成第三,四位注册码
dwReg = MakeRegCode1(0,pszUserName,nUserNameLen);
sprintf(szReg,"%X",dwReg);
szRegCode[2] = szReg[0];
szRegCode[3] = szReg[1];
//生成第五位注册码
dwReg = key5();
sprintf(szReg,"%1X",dwReg);
szRegCode[4] = szReg[0];
//生成第一,二位注册码
dwReg = MakeRegCode1(0,&szRegCode[2],sizeof(szRegCode)-1);
sprintf(szReg,"%X",dwReg);
szRegCode[0] = szReg[0];
szRegCode[1] = szReg[1];
printf("\nYour RegCode is: %s\n\n",szRegCode);
return 0;
}
相关链接:http://bbs.pediy.com/showthread.php?threadid=8783:
http://aiwxy.yeah.net
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课