VC++生成序列号和注册机总结
生活随笔
收集整理的這篇文章主要介紹了
VC++生成序列号和注册机总结
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
VC++生成序列號和簡單注冊機實例
在成品軟件中,軟件注冊是必需的,在VC++中,如何實現程序注冊功能呢?今天發一下VC++生成程序序
列號和注冊機程序的代碼,或許是個參考
一、生成程序序列號的具體實現:
HCURSOR CJiemishuoDlg::OnQueryDragIcon()
{
? ? return (HCURSOR) m_hIcon;
}
void CJiemishuoDlg::OnButton1()
{
? ? DWORD num;
? ? UpdateData(1);
? ? num=m_jms;
? ? num^=0x1999aa98;
? ? if(num==m_gkh)
? ? ? ? MessageBox("ok"); ? //提示解密正確
? ? CFile ff;
? ? if(!ff.Open("play.exe",CFile::modeWrite))
? ? ? ? return;
? ? CString str;
? ? str.Format("%10d",m_jms);
? ? MessageBox(str);
? ? ff.Seek(-10,CFile::end);
? ? ff.Write(str,10);//添加到play.exe尾部
? ? ff.Close();
}
void CJiemishuoDlg::OnButton2()
{
? ? //功能:得到解密匙.
? ? UpdateData(1);
? ? long aa=m_gkh^0x1999aa98;
? ? m_jms=aa;
? ? UpdateData(0);
}
void CJiemishuoDlg::OnAdd()
{
? ? DWORD num;
? ? UpdateData(1);
? ? num=m_jms;
? ? num^=0x1999aa98;
? ? if(num==m_gkh)
? ? ? ? MessageBox("ok"); ? //提示解密匙正確
? ? CFile ff;
? ? if(!ff.Open("play.exe",CFile::modeWrite))
? ? ? ? return;
? ? CString str;
? ? str.Format("%10d",m_jms);
? ? MessageBox(str);
? ? ff.SeekToEnd();
? ? ff.Write(str,10);//改寫解密匙
? ? ff.Close();
}
二、簡單注冊機的實現:
void CZhuCeJiDlg::OnJieMi()
{
? ? //在你要加密的文件play.exe末部改寫解密匙.
? ? long num;
? ? UpdateData(1);
? ? num=m_jms;
? ? num^=0x1999aa98;
? ? if(num==m_gkh)
? ? ? ? MessageBox("ok");//提示解密匙正確?
? ? CFile ff;
? ? if(!ff.Open("play.exe",CFile::modeWrite))
? ? ? ? return;
? ? CString str;
? ? str.Format("%10d",m_jms);
? ? MessageBox(str);
? ? ff.Seek(-10,CFile::end);
? ? ff.Write(str,10); ? //改寫解密匙
? ? ff.Close();
}
http://www.codefans.net/articles/1437.shtml
========
http://www.newxing.com/Code/VC/zfcl/1386.html
VC 根據序列號生成注冊碼示例
========
http://blog.csdn.net/A8572785/article/details/7644342
加密解密-TraceMe—注冊機
寫了個TraceMe的注冊機
unsigned char Table[8] = {0xC, 0xA, 0x13, 0x9,0xC,0xB,0xA,0x8}; ?
?unsigned long GenRegCode(CHAR * name, int len) ?
{ ?
? ? CString temp; ?
? ? int i, j; ?
? ? unsigned long ID =0; ?
? ? for(i=3,j=0; i<len; i++,j++) ?
? ? { ?
? ? ? ? if(j>7) ?
? ? ? ? ? ? j=0; ?
? ? ? ? ID+=name[i]*Table[j]; ?
? ? } ?
? ? return ID; ?
} ?
void CTraceMeDlg::OnRegist() ??
{ ?
? ? // TODO: Add your control notification handler code here ?
? ? CString str1; ?
? ? CString test; ?
? ? unsigned long str2; ?
? ? char* buf; ?
? ? GetDlgItemText(IDC_Name,str1); ?
? ? buf = (LPSTR)(LPCTSTR)str1; ?
? ? str2 = GenRegCode(buf,strlen(str1)); ?
? ? test.Format("%ld",str2); ?
? ? SetDlgItemText(IDC_ID, test); ?
}
http://download.csdn.net/download/dancer8th/1862601 《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀
在成品軟件中,軟件注冊是必需的,在VC++中,如何實現程序注冊功能呢?今天發一下VC++生成程序序
列號和注冊機程序的代碼,或許是個參考
一、生成程序序列號的具體實現:
HCURSOR CJiemishuoDlg::OnQueryDragIcon()
{
? ? return (HCURSOR) m_hIcon;
}
void CJiemishuoDlg::OnButton1()
{
? ? DWORD num;
? ? UpdateData(1);
? ? num=m_jms;
? ? num^=0x1999aa98;
? ? if(num==m_gkh)
? ? ? ? MessageBox("ok"); ? //提示解密正確
? ? CFile ff;
? ? if(!ff.Open("play.exe",CFile::modeWrite))
? ? ? ? return;
? ? CString str;
? ? str.Format("%10d",m_jms);
? ? MessageBox(str);
? ? ff.Seek(-10,CFile::end);
? ? ff.Write(str,10);//添加到play.exe尾部
? ? ff.Close();
}
void CJiemishuoDlg::OnButton2()
{
? ? //功能:得到解密匙.
? ? UpdateData(1);
? ? long aa=m_gkh^0x1999aa98;
? ? m_jms=aa;
? ? UpdateData(0);
}
void CJiemishuoDlg::OnAdd()
{
? ? DWORD num;
? ? UpdateData(1);
? ? num=m_jms;
? ? num^=0x1999aa98;
? ? if(num==m_gkh)
? ? ? ? MessageBox("ok"); ? //提示解密匙正確
? ? CFile ff;
? ? if(!ff.Open("play.exe",CFile::modeWrite))
? ? ? ? return;
? ? CString str;
? ? str.Format("%10d",m_jms);
? ? MessageBox(str);
? ? ff.SeekToEnd();
? ? ff.Write(str,10);//改寫解密匙
? ? ff.Close();
}
二、簡單注冊機的實現:
void CZhuCeJiDlg::OnJieMi()
{
? ? //在你要加密的文件play.exe末部改寫解密匙.
? ? long num;
? ? UpdateData(1);
? ? num=m_jms;
? ? num^=0x1999aa98;
? ? if(num==m_gkh)
? ? ? ? MessageBox("ok");//提示解密匙正確?
? ? CFile ff;
? ? if(!ff.Open("play.exe",CFile::modeWrite))
? ? ? ? return;
? ? CString str;
? ? str.Format("%10d",m_jms);
? ? MessageBox(str);
? ? ff.Seek(-10,CFile::end);
? ? ff.Write(str,10); ? //改寫解密匙
? ? ff.Close();
}
http://www.codefans.net/articles/1437.shtml
========
http://www.newxing.com/Code/VC/zfcl/1386.html
VC 根據序列號生成注冊碼示例
========
http://blog.csdn.net/A8572785/article/details/7644342
加密解密-TraceMe—注冊機
寫了個TraceMe的注冊機
unsigned char Table[8] = {0xC, 0xA, 0x13, 0x9,0xC,0xB,0xA,0x8}; ?
?unsigned long GenRegCode(CHAR * name, int len) ?
{ ?
? ? CString temp; ?
? ? int i, j; ?
? ? unsigned long ID =0; ?
? ? for(i=3,j=0; i<len; i++,j++) ?
? ? { ?
? ? ? ? if(j>7) ?
? ? ? ? ? ? j=0; ?
? ? ? ? ID+=name[i]*Table[j]; ?
? ? } ?
? ? return ID; ?
} ?
void CTraceMeDlg::OnRegist() ??
{ ?
? ? // TODO: Add your control notification handler code here ?
? ? CString str1; ?
? ? CString test; ?
? ? unsigned long str2; ?
? ? char* buf; ?
? ? GetDlgItemText(IDC_Name,str1); ?
? ? buf = (LPSTR)(LPCTSTR)str1; ?
? ? str2 = GenRegCode(buf,strlen(str1)); ?
? ? test.Format("%ld",str2); ?
? ? SetDlgItemText(IDC_ID, test); ?
}
========
程序初始化時調用
BOOL CMySoftApp::InitInstance()
{
AfxEnableControlContainer();
if(!IsRegisterOK())
return FALSE;
......
http://download.csdn.net/download/dancer8th/1862601 《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀
總結
以上是生活随笔為你收集整理的VC++生成序列号和注册机总结的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 电力GIS
- 下一篇: s3c2440移植MQTT