为加密软件,识别电脑唯一性的方式,哪种好?
据本人所知,识别电脑唯一性的方式,大概有如下几种:
1、通过硬盘出厂编号;
(缺点是:有的牌子的硬盘,比如三星,没有出厂编号,或读不到。还有,如何得到出厂编号,也是鄙人想求教各位的。)
2、网卡MAC地址;
(缺点是:可以做虚拟网卡,或者直接修改网卡MAC值。)
3、硬盘序列号(Valume Serial Number);
(这个,缺点就多了,一是格式化后该序列号就变了;二是可以用软件修改;三是可以克隆出相同的序列号。)
4、主板编号;
(缺点,也是有的牌子,其编号读不到,另外好象相同批次的主板,编号也相同。如何读到,也是我想求教的。)
5、BIOS编号;
(缺点,好象也是相同批次的产品,编号也相同。如何取得该编号,也是想求教的。)
6、CPU编号;
(缺点,也是有的牌子,比如AMD,没有编号,或者获取不到。如何取得该编号,也是想求教的。)
请各位谈看法,哪种方式好。或者谈谈如何得到这些编号。
[解决办法]
同感,严重关注!
[解决办法]
取得 网卡MAC+BIOS编号+CPU编号
然后进行加密,用CPU编号作为KEY,生成最终机器码
[解决办法]
看下面的对有用吗?
获得系统基本信息
(独孤求败二零零四年二月十二日整理于深圳市南山区)
当一个应用程序在工作时,会不可避免地和操作系统发生数据交换,虽然在PB中提供了Environment对象来获得系统的一些信息,然而这些信息往往是不够的,比如CPU、本机IP地址等,这些内容只有用Windows API来获得了。
1、建立一个工作空间(workspace),取名为:systeminfo。
2、建立一个应用(application),取名为:systeminfo。
3、创建用户对象u_sysinfo,并添加Microsoft Winsock OCX控件。
4、定义u_sysinfo的实例变量。
public:
string cpuid,cpuprovider
string filesystem,volumename
ulong VolumeSerialNumber,MaxComponentLength,FileSystemFlags
long dlength,dmemoryload,dtotalphys,davailphys,dtotalpagefile
long davailpagefile,dtotalvirtual,davailvirtual
ulong dwoemid,dwpagesize,lpminappaddress,lpmaxappaddress,dwactiveprocessormask
ulong dwnumberofprocessors,dwprocessortype,dwallocationgranularity,dwreserved
ulong sectorspercluster,bytespersector,numberoffreeclusters,totalnumberofclusters
ulong mbtotal,mbfree
5、定义u_sysinfo的局部外部函数
PUBLIC FUNCTION ulong GetComputerName(ref string lpBuffer,ref ulong nSize) LIBRARY "kernel32.dll"
ALIAS FOR "GetComputerNameA"
PUBLIC FUNCTION ulong GetDriveType(string nDrive) LIBRARY "kernel32.dll" ALIAS FOR "GetDriveTypeA"
FUNCTION ulong GetDiskFreeSpace(ref string lpRootPathName,ref ulong lpSectorsPerCluster,ref ulong
lpBytesPerSector,ref ulong lpNumberOfFreeClusters,ref ulong lpTtoalNumberOfClusters)
LIBRARY "kernel32.dll" ALIAS FOR "GetDiskFreeSpaceA"
PUBLIC FUNCTION ulong GetTickCount() LIBRARY "kernel32.dll"
PUBLIC Subroutine GetSystemInfo(ref ws_info lpSystemInfo) LIBRARY "kernel32.dll"
PUBLIC FUNCTION ulong waveOutGetNumDevs() LIBRARY "winmm.dll"
PUBLIC FUNCTION ulong WNetGetUser(ref string lpName,ref string lpUserName,ref ulong lpnLength)
LIBRARY "mpr" ALIAS FOR "WNetGetUserA"
PUBLIC FUNCTION ulong GetSystemMetrics(ulong nIndex) LIBRARY "user32.dll"
PUBLIC FUNCTION ulong GetWindowsDirectory(ref string lpBuffer,ulong nSize) LIBRARY "kernel32.dll"
ALIAS FOR "GetWindowsDirectoryA"
PUBLIC FUNCTION ulong GetSystemDirectory(ref string lpBuffer,ulong nSize) LIBRARY "kernel32.dll"
ALIAS FOR "GetSystemDirectoryA"
PUBLIC FUNCTION ulong GetTempPath(ulong nBufferLength,ref string lpBuffer) LIBRARY "kernel32.dll"
ALIAS FOR "GetTempPathA"
PUBLIC FUNCTION ulong GetKeyboardType(ulong nTypeFlag) LIBRARY "user32.dll"
PUBLIC FUNCTION ulong QueryPerformanceFrequency(ref double lpFrequency) LIBRARY "kernel32.dll"
PUBLIC FUNCTION ulong QueryPerformanceCounter(ref ulong lpPerformanceCount) LIBRARY "kernel32.dll"
//PUBLIC FUNCTION ulong EnumPrinterDrivers(ref string pName,ref string pEnvironment,ulong Level,ref
Byte pDriverInfo,ulong cdBuf,ref ulong pcbNeeded,ref ulong pcRetruned) LIBRARY
"winspool.drv" ALIAS FOR "EnumPrinterDriversA"
PUBLIC Subroutine GlobalMemoryStatus(ref ws_memory lpBuffer) LIBRARY "kernel32.dll"
//FUNCTIONon ulong GlobalReAlloc(ulong hMem,ulong dwBytes,ulong wFlags) LIBRARY "kernel32.dll"
PUBLIC FUNCTION ulong RegOpenKey(ulong hKey,ref string lpSubKey,ref ulong phkResult) LIBRARY
"advapi32.dll" ALIAS FOR "RegOpenKeyA"
PUBLIC FUNCTION ulong RegCloseKey(ulong hKey) LIBRARY "advapi32.dll"
PUBLIC FUNCTION ulong RegQueryValueEx(ulong hKey,ref string lpValueName,ulong lpReserved,ref ulong
lpType,ref long lpData,ref ulong lpcbData) LIBRARY "advapi32.dll" ALIAS FOR
"RegQueryValueExA"
//Function ulong EnumDisplaySettingsA(ulong xx,ulong modenum,ref DEVMODE
lpdevmode)Library"kernel32.dll"
//PUBLIC FUNCTION ulong DeviceCapabilities(ref string lpDeviceName,ref string lpPort,ulong
iIndex,ref string lpOutput,ref DEVMODE lpDevMode) LIBRARY "winspool.drv" ALIAS FOR
"DeviceCapabilitiesA"
PUBLIC FUNCTION ulong GetVolumeInformation(string lpRootPathName,ref string lpVolumeNameBuffer,
ulong nVolumeNameSize,ref ulong lpVolumeSerialNumber,ref ulong lpMaximumComponentLength,
ref ulong lpFileSystemFlags,ref string lpFileSystemNameBuffer,ulong nFileSystemNameSize)
LIBRARY "kernel32.dll" ALIAS FOR "GetVolumeInformationA"
FUNCTION long GetMACAddress(long lana,ref long addr[6]) Library "utils.dll"
FUNCTION long GetLanaID(ref long lana[254]) LIBRARY "utils.dll"
Function ulong GetMHZ()Library"mydll.dll"
6、用户对象级函数
1)、of_GetComputerName(),获得计算机的标识(即计算机名)。
ulong ll_comsize
ulong ll_flag
ll_comsize = 256
string ls_computerName
//获得计算机的名称
ll_flag = GetComputerName(ls_computerName,ll_comsize)
If ll_flag<> 1 then
return "Get Computer Failure"
else
return ls_computerName
End if
2)、of_GetCpuInfo(),获得CPU一些基本信息。
ws_cpuinfo lstr_cpu
string ls_temp
RegistryGet("HKEY_LOCAL_MACHINE\Hardware\Description\System\CentralProcessor\0","Identifier",RegString!,ls_temp)
lstr_cpu.cpuid = ls_temp
cpuid = ls_temp
RegistryGet("HKEY_LOCAL_MACHINE\Hardware\Description\System\CentralProcessor\0","VendorIdentifier",RegString!,ls_temp)
lstr_cpu.cpuprovider = ls_temp
cpuprovider = ls_temp
3)、of_GetCpuStatus(),获得CPU当前的使用频率,是从0%到100%之间的一个常数。
ulong ls_username,lpcbData,lpType
lpcbData = 4
lpType = 4
ulong phkResult
ls_username = 0
string lbSubkey
long lpData
lbSubkey = "PerfStats\StatData"
ls_username = RegOpenKey(16*16*16*16*16*16*16*8+6,lbSubKey,phkResult)//The first parameters is HKEY_DYN_DATA = &80000006(HANDLE)
string lpValueName
lpValueName = "KERNEL\CPUUsage"
ls_username = RegQueryValueEx(phkResult,lpValueName,0,lpType,lpData,lpcbData)
ls_username = RegCloseKey(phkResult)
return lpdata
4)、of_GetDiskVolume(),获得磁盘空间大小。
ulong ll_MBFree
ulong ll_MBTotal
ulong ll_sectorspercluster // Sectors/Cluster
ulong ll_bytespersector // Bytes/Sector
ulong ll_numberoffreeclusters // Number of Free Clusters
ulong ll_toalnumberofclusters // Total Number of Clusters
GetDiskFreeSpace(as_driver, ll_sectorspercluster, ll_bytespersector,ll_numberoffreeclusters,
ll_toalnumberofclusters)
sectorspercluster=ll_sectorspercluster
bytespersector=ll_bytespersector
numberoffreeclusters=ll_numberoffreeclusters
totalnumberofclusters=ll_toalnumberofclusters
mbfree = (ll_sectorspercluster * ll_bytespersector * (ll_numberoffreeclusters / 1024)) / 1024
mbtotal = (ll_sectorspercluster * ll_bytespersector * (ll_toalnumberofclusters / 1024)) / 1024
5)、of_GetDriverType(),获得各个磁盘的种类。
ulong ul_drivetype
string ls_drive
ul_drivetype = GetDriveType(a_drivename)
choose case ul_drivetype
case0
ls_Drive = "Unknown Driver"
Case 1
ls_Drive = "Drive Does Not exist"
Case 2
ls_Drive = "Floppy driver"
Case 3
ls_Drive = "HardDisk driver"
Case 4
ls_Drive = "Network driver"
Case 5
ls_Drive = "CD-ROM driver"
Case 6
ls_Drive = "RAM driver"
End choose
Return ls_drive
6)、of_GetIPAddress(),获得本机IP地址。
return ole_1.object.localip
7)、of_GetKeyBoardType(),获得用户键盘种类。
return GetKeyboardType(0)
8)、of_GetLongInID(),获得登陆的用户名称。
string ls_username,ls_cmpname
ulong ll_length,lul_runtime
ls_cmpname = ""
ls_username = space(64)
ll_length = 64
lul_runtime=WNetGetUser(ls_cmpName,ls_UserName,ll_Length)
If lul_runtime=0 then
return ls_UserName
else
return "Error"
End if
[解决办法]
关注中。。。。。。。。。。。。。
[解决办法]
dawugui,你好强大。顶你。
[解决办法]
搞一个序列号,每个用户唯一,不定期上网检查
发现序列号同时有多人在使用就停止这个序列号
[解决办法]
原来我也是通过计算机的硬件来获得。
目前准备使用加密狗了。