BOOL GetVolumeInformation( LPCTSTR lPRootPathName,
LPTSTR lpVolumeNameBuffer,
DWord nVolumeNameSize,
LPDWORD lpVolumeSerialNumber,
LPDWORD lpMaximumComponentLength,
LPDWORD lpFileSystemFlags,
LPTSTR lpFileSystemNameBuffer,
DWORD nFileSystemNameSize );
DWORD dwSerialNum;
GetVolumeInformation("A://",NULL,NULL,&dwSerialNum,NULL,NULL,NULL,NULL);……
if(file.Open("Logo.ini",CFile::modeReadWrite)==FALSE)
{
AfxMessageBox("請(qǐng)將正版鑰匙盤(pán)插入到軟驅(qū)!");
MakeKey();
}
else
{
file.Read(logo,20);
file.Close();
DWORD LogoNum=atol(logo);
GetVolumeInformation("C://",NULL,NULL,&dwIDESerial,NULL,NULL,NULL,NULL);
if(LogoNum!=dwIDESerial)
{
AfxMessageBox("請(qǐng)將正版鑰匙盤(pán)插入到軟驅(qū)!");
MakeKey();
}
else
m_bCanRun=true;
}
……
if(m_bCanRun==true)
{
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
m_pMainWnd->UpdateWindow();
}
else
PostQuitMessage(0);GetVolumeInformation("A://",NULL,NULL,&dwSerialNum,NULL,NULL,NULL,NULL);
if(dwSerialNum==SerialNum)//SerialNum就是我們預(yù)先獲取的作為正版標(biāo)識(shí)的序列號(hào)
{
GetVolumeInformation("C://",NULL,NULL,&dwIDESerial,NULL,NULL,NULL,NULL);
ltoa(dwIDESerial,logo,10);
while(logo[i]!=’/0’)
i++;
……
file.Open("Logo.ini",CFile::modeCreate CFile::modeReadWrite);
file.Write(logo,i);
file.Close();
AfxMessageBox("已通過(guò)認(rèn)證,下次使用時(shí)不必再插入鑰匙軟盤(pán)!");
m_bCanRun=true;
}
else
{
AfxMessageBox("請(qǐng)插入正版鑰匙軟盤(pán)再執(zhí)行本程序!");
m_bCanRun=false;
}新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注