-
-
[原创]Winlicense 硬件号问题。剪贴板和文件
-
发表于: 2007-1-26 11:13 2503
-
inline void myCopyToClipboard(const char* szData)
{
// Remove the current Clipboard contents
if( !EmptyClipboard() )
{
return;
}
// ...
// Get the currently selected data
HANDLE hMem = ::GlobalAlloc(GHND | GMEM_SHARE, strlen(szData));
LPSTR lpStr=(LPSTR)::GlobalLock(hMem);
memcpy(lpStr, szData, strlen(szData));
::GlobalUnlock(hMem);
// For the appropriate data formats...
::SetClipboardData( CF_TEXT, hMem );
CloseClipboard();
}
inline BOOL GetLicenseInfo()
{
char Error[1024];
int Status=WLRegGetStatus(NULL);
if(Status==wlIsRegistered)
return TRUE;
switch (Status)
{
case wlIsTrial:
lstrcpy(Error,"系统没有注册");
break;
case wlInvalidLicense:
lstrcpy(Error,"许可错误");
break;
case wlInvalidHardwareLicense:
lstrcpy(Error,"不是给本机的许可");
break;
case wlNoMoreHwdChanges:
lstrcpy(Error,"硬件改动太多");
break;
case wlLicenseExpired:
lstrcpy(Error,"许可已经过期");
break;
case wlInvalidCountryLicense:
lstrcpy(Error,"国家语言不符合设定");
break;
case wlLicenseStolen:
lstrcpy(Error,"被禁用的许可");
break;
case wlWrongLicenseExp:
lstrcpy(Error,"许可证到期错误");
break;
case wlWrongLicenseHardware:
lstrcpy(Error,"许可证硬件错误");
break;
default:
lstrcpy(Error,"其他错误");
break;
}
char Buffer[128];
WLHardwareGetID(Buffer);
// CString String;
// String.LoadString(IDS_HARDWARE);
char String[1024]="ID(both in hardware.txt and clipboard):";
strcat(String,Buffer);
MessageBox(NULL,String,Error,MB_OK);
if ( !OpenClipboard(NULL) )
return FALSE;
myCopyToClipboard(Buffer);
FILE *file=fopen("HARDWARE.TXT","wb");
fwrite(Buffer,strlen(Buffer)+1,1,file);
fclose(file);
return FALSE;
}
{
// Remove the current Clipboard contents
if( !EmptyClipboard() )
{
return;
}
// ...
// Get the currently selected data
HANDLE hMem = ::GlobalAlloc(GHND | GMEM_SHARE, strlen(szData));
LPSTR lpStr=(LPSTR)::GlobalLock(hMem);
memcpy(lpStr, szData, strlen(szData));
::GlobalUnlock(hMem);
// For the appropriate data formats...
::SetClipboardData( CF_TEXT, hMem );
CloseClipboard();
}
inline BOOL GetLicenseInfo()
{
char Error[1024];
int Status=WLRegGetStatus(NULL);
if(Status==wlIsRegistered)
return TRUE;
switch (Status)
{
case wlIsTrial:
lstrcpy(Error,"系统没有注册");
break;
case wlInvalidLicense:
lstrcpy(Error,"许可错误");
break;
case wlInvalidHardwareLicense:
lstrcpy(Error,"不是给本机的许可");
break;
case wlNoMoreHwdChanges:
lstrcpy(Error,"硬件改动太多");
break;
case wlLicenseExpired:
lstrcpy(Error,"许可已经过期");
break;
case wlInvalidCountryLicense:
lstrcpy(Error,"国家语言不符合设定");
break;
case wlLicenseStolen:
lstrcpy(Error,"被禁用的许可");
break;
case wlWrongLicenseExp:
lstrcpy(Error,"许可证到期错误");
break;
case wlWrongLicenseHardware:
lstrcpy(Error,"许可证硬件错误");
break;
default:
lstrcpy(Error,"其他错误");
break;
}
char Buffer[128];
WLHardwareGetID(Buffer);
// CString String;
// String.LoadString(IDS_HARDWARE);
char String[1024]="ID(both in hardware.txt and clipboard):";
strcat(String,Buffer);
MessageBox(NULL,String,Error,MB_OK);
if ( !OpenClipboard(NULL) )
return FALSE;
myCopyToClipboard(Buffer);
FILE *file=fopen("HARDWARE.TXT","wb");
fwrite(Buffer,strlen(Buffer)+1,1,file);
fclose(file);
return FALSE;
}
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
赞赏
他的文章
看原图
赞赏
雪币:
留言: