warum sollte das nicht gehen?
habs als lowbob mit der eindeutigen hdd seriennummer gemacht.
funktion ist iwo ausm inet.
Code:
Func _GetDriveInfo($sDrive)
$sDrive = StringRegExpReplace($sDrive, '(?i)(.*)([a-z]{1}:)(.*)', '$2')
Local $sDriveType = DriveGetType($sDrive)
If $sDriveType <> 'Fixed' And $sDriveType <> 'Removable' Then SetError(1, 0, 1)
If Not FileExists($sDrive) Then Return SetError(1, 0, 1)
Local $wbemFlagReturnImmediately = 0x10
Local $wbemFlagForwardOnly = 0x20
Local $colItems = ''
Local $aPartition, $aPhysicalDrive, $aOut[14][2]
$objWMIService = ObjGet('winmgmts:\\localhost\root\CIMV2')
If Not IsObj($objWMIService) Then Return SetError(2, 0, 2)
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_LogicalDiskToPartition', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
If StringInStr($objItem.Dependent, '"' & $sDrive & '"') Then
$aPartition = StringRegExp($objItem.Antecedent, 'DeviceID="(.*)"', 3)
EndIf
Next
Endif
If Not IsArray($aPartition) Then Return SetError(3, 0, 3)
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_DiskDriveToDiskPartition', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
If StringInStr($objItem.Dependent, '"' & $aPartition[0] & '"') Then
$aPhysicalDrive = StringRegExp($objItem.Antecedent, 'DeviceID="(.*)"', 3)
EndIf
Next
Endif
If Not IsArray($aPhysicalDrive) Then Return SetError(4, 0, 4)
$aPhysicalDrive[0] = StringReplace($aPhysicalDrive[0], '\\', '\')
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_DiskDrive', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
If StringInStr($objItem.DeviceID, $aPhysicalDrive[0]) Then
$aOut[0][0] = 'Volume-Label'
$aOut[0][1] = DriveGetLabel($sDrive)
$aOut[1][0] = 'Serial-Nr. (Volume)'
$aOut[1][1] = DriveGetSerial($sDrive)
$aOut[2][0] = 'Model'
$aOut[2][1] = $objItem.Model
$aOut[3][0] = 'Serial-Nr. (Drive)'
$aOut[3][1] = StringMid($objItem.PNPDeviceID, StringInStr($objItem.PNPDeviceID, '\', 0, -1) + 1)
$aOut[3][1] = StringReplace($aOut[3][1], '&0', '')
$aOut[4][0] = 'Interface'
$aOut[4][1] = $objItem.InterfaceType
$aOut[5][0] = 'Size (Bytes)'
$aOut[5][1] = $objItem.Size
$aOut[6][0] = 'Media Type'
$aOut[6][1] = StringRegExpReplace($objItem.MediaType, '[^[:print:]]', ' ')
$aOut[7][0] = 'Total Cylinders'
$aOut[7][1] = $objItem.TotalCylinders
$aOut[8][0] = 'Total Heads'
$aOut[8][1] = $objItem.TotalHeads
$aOut[9][0] = 'Total Tracks'
$aOut[9][1] = $objItem.TotalTracks
$aOut[10][0] = 'Total Sectors'
$aOut[10][1] = $objItem.TotalSectors
$aOut[11][0] = 'Tracks Per Cylinder'
$aOut[11][1] = $objItem.TracksPerCylinder
$aOut[12][0] = 'Sectors Per Track'
$aOut[12][1] = $objItem.SectorsPerTrack
$aOut[13][0] = 'Bytes Per Sector'
$aOut[13][1] = $objItem.BytesPerSector
EndIf
Next
Endif
$objWMIService = ''
Return $aOut[3][1]
EndFunc
aufruf:
Code:
Global $idnr = "5&34DAC8C4.1.0" ; beispiel, klar wa?
If _GetDriveInfo('c:') <> $idnr And _GetDriveInfo($sDrive) <> "eigene id damit das ding noch auf eigenem rechner läuft----5&692E352&1.1.0" Then
MsgBox(16, "", "wrong id!")
Exit
EndIf
ähnliche funktionen gibts für mac, cpu sn und nen haufen anderen käse auch.
aber da das jeder depp mit olly oder deobfuscator umgehen kann völlig nutzlos :)