Results 1 to 1 of 1
  1. #1
    nasty
    nasty is offline
    New member
    Join Date
    2012 May
    Posts
    6
    Thanks
    7
    Thanked 4 Times in 3 Posts
    Rep Power
    0

    USB pen drive unique serial generator

    This code id very useful to create a kind of USB protection (using a normal USB pen drive).
    Each Pen Driver generate a different unique ID.
    An example usage can be:
    -1st store oh HD the pen drive seriale
    -2nd compare the inserted pen drive serial with the one stored on HD .. when the serials are the same then 'do something'



    Code:
    Func _GetDeviceID($drive,$fullid=0)
        $objWMIService = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\.\root\cimv2")
        If Not IsObj($objWMIService) Then Return -1 ;Failed to Connect to WMI on Local Machine
    
        $colDevice = $objWMIService.ExecQuery("SELECT * from Win32_LogicalDiskToPartition")
        $var=""
        For $objItem in $colDevice
            If StringInStr($objItem.Dependent,$drive) Then
                $var=StringTrimLeft($objItem.Antecedent,stringInstr($objItem.Antecedent,"="))
            EndIf
        Next
        If Not $var Then Return -2 ;Failed to Find Drive Letter
    
        $colDevice = $objWMIService.ExecQuery("SELECT * from Win32_DiskDriveToDiskPartition")
        $diskpartition = $var
        $var=""
        For $objItem in $colDevice
            If StringInStr($objItem.Dependent,$diskpartition) Then
                $var=StringTrimLeft($objItem.Antecedent,stringInstr($objItem.Antecedent,"="))
            EndIf
        Next
        If Not $var Then Return -3 ;Failed to Find Physical Drive #
    
        $colDevice = $objWMIService.ExecQuery("SELECT * from Win32_DiskDrive")
        $physicaldrive = StringReplace(StringReplace($var,"\\","\"),'"',"")
        $var=""
        For $objItem in $colDevice
            If $objItem.DeviceID = $physicaldrive Then
                $var=$objItem.PNPDeviceID
            EndIf
        Next
        If Not $var Then Return -4 ;Failed to Find DeviceID
    
        If Not $fullid Then $var = StringTrimLeft($var,StringInstr($var,"\",0,-1)) ;Return Full DeviceID (Full is very dirty)
        Return $var
    EndFunc
    Ex. Usage:

    Code:
    $idCurrent = _GetDeviceID($drive)

Similar Threads

  1. [Release] BOT Cash Generator ACGBF 0.1b
    By themalikao in forum Aika Online
    Replies: 59
    Last Post: 2012-07-14, 12:16 AM
  2. WoW Name Generator
    By BmHeros in forum Trash Bin
    Replies: 0
    Last Post: 2012-01-12, 11:15 PM
  3. [Guide] Unique Features of Battle of the Immortals
    By Dwar in forum Battle of the Immortals
    Replies: 0
    Last Post: 2010-11-22, 01:58 AM
  4. [Guide] Aika Online Unique Prans
    By Dwar in forum Aika Guides, Tutorials
    Replies: 2
    Last Post: 2010-10-29, 04:45 AM
  5. [Guide] Serial Fishing.
    By MrSmith in forum Programming Tutorials
    Replies: 0
    Last Post: 2010-10-22, 01:12 PM
Visitors found this page by searching for:

autoit usb

autoit usb device id

autoit generate unique id

usb autoit

how to view pendrive unique code

http:www.progamercity.netautoit3777-autoit-usb-pen-drive-unique-serial-generator.html

autoit script to find pen drive

code generator au3

what is the unique code in pendrive

where is the id generation for pendrive

read an unique identification number of pendrive

autoit is drive usb

unique id autoit

how to read an unique identification number of pendrive

autoit usb drive

autoit drive get serial

pendrive unique codes

get flash drive serial number autoit

usb.au3

find usb with autoit

autoit script find usb drive letter

autoit usb drive serial

autoit get usb device id

autoit drive id

autoit unique usb identity

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •