不同版本保存过期时间的注册表键的位置是不同的:
2.40: HKCR\Interface\{E9B0227F-437C-4F7A-86D9-2676B83F359F}\ProxyStubClsid32 = {M1-M2-M3-T1-T2}
3.20: HKCR\Interface\{B7348B5D-B65D-4BF5-AF63-A3135249ACA7}\ProxyStubClsid32 = {M1-M2-M3-T1-T2}
3.31: HKCR\Interface\{6F8793A7-3226-4B51-98C1-476A0D1A7AFC}\ProxyStubClsid32
3.40: HKCR\Interface\{48C6296A-4F4C-4238-A9E1-60E9A544A863}\ProxyStubClsid32
假设此时 Date 的值是 39598.999988425923 (0x37BA E7FFDF55E340)
T1 = 37BA
T2 = E7FFDF55E340
M1 = 37 * BA * E7 * FF = 23EAEB06
M2 = DF * 55 = 4A0B
M3 = E3 * 40 = 38C0
这样我们就可以把注册表中上述键值改为:{23EAEB06-4A0B-38C0-37BA-E7FFDF55E340}
//*/
EXTERN_C void GetIncrediBuildLicKey(DATE date, LPTSTR lpszKey, UINT cchMax)
{
BYTE * pByte = (BYTE *)&date;
BYTE * T1 = (BYTE *) (pByte);
BYTE * T2 = (BYTE *) (pByte + 2);
DWORD dwM1 = (DWORD) *pByte;
dwM1 *= (DWORD) *(pByte + 1);
dwM1 *= (DWORD) *(pByte + 2);
dwM1 *= (DWORD) *(pByte + 3);
WORD wM2 = (WORD) *(pByte + 4);
wM2 *= (WORD) *(pByte + 5);
WORD wM3 = (WORD) *(pByte + 6);
wM3 *= (WORD) *(pByte + 7);
TCHAR szOut[MAX_PATH] = { 0 };
wsprintf(szOut, _T("{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"),
dwM1,
wM2,
wM3,
*T1, *(T1+1),
*T2, *(T2+1), *(T2+2), *(T2+3), *(T2+4), *(T2+5)
);
lstrcpyn(lpszKey, szOut, cchMax);
}
以上代码调用方法:
void CCrackibDlg::OnButton1()
{
COleDateTime destTime = COleDateTime::GetCurrentTime();
COleDateTime dateTime(destTime.GetYear(), destTime.GetMonth()+1, destTime.GetDay()-1, 23, 59, 59);
DATE Date = (DATE)dateTime;
TCHAR szOut[MAX_PATH] = { 0 };
GetIncrediBuildLicKey((DATE)Date, szOut, MAX_PATH);
SetDlgItemText(IDC_EDIT1, szOut);
}
posted on 2009-08-11 22:59
free2000fly 阅读(2410)
评论(0) 编辑 收藏 引用