Jump to content

Extract The Unique Id Of A Pc


Recommended Posts

Maybe, @ComputerName

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Link to comment
Share on other sites

;UUID Generator
; Author gafrost

Const $ERROR_SUCCESS = 0
Const $RPC_S_OK = $ERROR_SUCCESS
Const $RPC_S_UUID_LOCAL_ONLY = 1824
Const $RPC_S_UUID_NO_ADDRESS = 1739

;~ typedef struct _GUID {
;~ unsigned long Data1;
;~ unsigned short Data2;
;~ unsigned short Data3;
;~ unsigned char Data4[8];
;~ } GUID, UUID;
;~ Data1
;~ Specifies the first 8 hexadecimal digits of the UUID.
;~ Data2
;~ Specifies the first group of 4 hexadecimal digits of the UUID.
;~ Data3
;~ Specifies the second group of 4 hexadecimal digits of the UUID.
;~ Data4
;~ Array of eight elements. The first two elements contain the third group of 4 hexadecimal digits of the UUID.
;~ The remaining six elements contain the final 12 hexadecimal digits of the UUID.

$_GUID = DllStructCreate("uint;ushort;ushort;ubyte[8]")
If @error Then Exit

;~ RPC_STATUS RPC_ENTRY UuidCreate(
;~ UUID __RPC_FAR* Uuid
;~ );

$ret = DllCall("Rpcrt4.dll", "ptr", "UuidCreate", "ptr", DllStructGetPtr($_GUID))
If Not @error Then
If $ret[0] = $ERROR_SUCCESS Then
  $uuid = Hex(DllStructGetData($_GUID, 1), 8) & "-" & _
    Hex(DllStructGetData($_GUID, 2), 4) & "-" & _
    Hex(DllStructGetData($_GUID, 3), 4) & "-" & _
    Hex(DllStructGetData($_GUID, 4, 1), 2) & Hex(DllStructGetData($_GUID, 4, 2), 2) & "-"
  For $x = 3 To 8
   $uuid = $uuid & Hex(DllStructGetData($_GUID, 4, $x), 2)
  Next
  MsgBox(0,"UUID", $uuid & @LF & @LF & "Note:" & @LF & _
   "In Windows NT 4.0, Windows Me/98, and Windows 95 DCOM release," & @LF & _
   "UuidCreate returns RPC_S_UUID_LOCAL_ONLY when the originating computer" & @LF & _
   "does not have an ethernet/token ring (IEEE 802.x) address." & @LF & _
   "In this case, the generated UUID is a valid identifier, and is" & @LF & _
   "guaranteed to be unique among all UUIDs generated on the computer." & @LF & @LF & _
   "However, the possibility exists that another computer without an" & @LF & _
   "ethernet/token ring address generated the identical UUID." & @LF & @LF & _
   "Therefore you should never use this UUID to identify an object" & @LF & _
   "that is not strictly local to your computer." & @LF & @LF & _
   "Computers with ethernet/token ring addresses generate UUIDs that" & @LF & _
   "are guaranteed to be globally unique.")
EndIf
EndIf
$_GUID = 0

8)

NEWHeader1.png

Link to comment
Share on other sites

;UUID Generator
; Author gafrost

Const $ERROR_SUCCESS = 0
Const $RPC_S_OK = $ERROR_SUCCESS
Const $RPC_S_UUID_LOCAL_ONLY = 1824
Const $RPC_S_UUID_NO_ADDRESS = 1739

;~ typedef struct _GUID {
;~ unsigned long Data1;
;~ unsigned short Data2;
;~ unsigned short Data3;
;~ unsigned char Data4[8];
;~ } GUID, UUID;
;~ Data1
;~ Specifies the first 8 hexadecimal digits of the UUID.
;~ Data2
;~ Specifies the first group of 4 hexadecimal digits of the UUID.
;~ Data3
;~ Specifies the second group of 4 hexadecimal digits of the UUID.
;~ Data4
;~ Array of eight elements. The first two elements contain the third group of 4 hexadecimal digits of the UUID.
;~ The remaining six elements contain the final 12 hexadecimal digits of the UUID.

$_GUID = DllStructCreate("uint;ushort;ushort;ubyte[8]")
If @error Then Exit

;~ RPC_STATUS RPC_ENTRY UuidCreate(
;~ UUID __RPC_FAR* Uuid
;~ );

$ret = DllCall("Rpcrt4.dll", "ptr", "UuidCreate", "ptr", DllStructGetPtr($_GUID))
If Not @error Then
If $ret[0] = $ERROR_SUCCESS Then
  $uuid = Hex(DllStructGetData($_GUID, 1), 8) & "-" & _
    Hex(DllStructGetData($_GUID, 2), 4) & "-" & _
    Hex(DllStructGetData($_GUID, 3), 4) & "-" & _
    Hex(DllStructGetData($_GUID, 4, 1), 2) & Hex(DllStructGetData($_GUID, 4, 2), 2) & "-"
  For $x = 3 To 8
   $uuid = $uuid & Hex(DllStructGetData($_GUID, 4, $x), 2)
  Next
  MsgBox(0,"UUID", $uuid & @LF & @LF & "Note:" & @LF & _
   "In Windows NT 4.0, Windows Me/98, and Windows 95 DCOM release," & @LF & _
   "UuidCreate returns RPC_S_UUID_LOCAL_ONLY when the originating computer" & @LF & _
   "does not have an ethernet/token ring (IEEE 802.x) address." & @LF & _
   "In this case, the generated UUID is a valid identifier, and is" & @LF & _
   "guaranteed to be unique among all UUIDs generated on the computer." & @LF & @LF & _
   "However, the possibility exists that another computer without an" & @LF & _
   "ethernet/token ring address generated the identical UUID." & @LF & @LF & _
   "Therefore you should never use this UUID to identify an object" & @LF & _
   "that is not strictly local to your computer." & @LF & @LF & _
   "Computers with ethernet/token ring addresses generate UUIDs that" & @LF & _
   "are guaranteed to be globally unique.")
EndIf
EndIf
$_GUID = 0

8)

Thanks, Valuater, can't I use the CPU ID, isn't it unique also?
Link to comment
Share on other sites

@Valuater (and others)

I tried the code (UUID Generator by Gafrost) and although it works, I don't understand what use this has. Each time I run it it provides a whole new string of numbers. I thought a Unique ID meant :

1) Something that is unique to that PC and also

2) Consistency ie. each time the code is run, the same numbers should be generated.

Earlier I thought that this code may be used in making demo or trial software so that it could be run on only a specfic PC. But now I am curious as to what use this code does since the numbers it generates seems to be changing all the time.

Edited: spelling

Edited by dash007
Link to comment
Share on other sites

Nobody able to shed some light on my above question? :(

I tried another coding using WMI ($objItem.UUID) and that returns constant values on my laptop, but a lot of FFFFF on my desktop PC. Can some kind soul shed some light on the above code as it does produce valid numbers except for the consistency bit :think:

If the above code is required to produce different numbers each time it is run, what is the use of such, I mean what use is there for such a function.

Link to comment
Share on other sites

Hi,

I don't understand why so many people try to generate an ID for a script that should work only on one pc.

You will always have to have access to the pc while creating the unique ID.

Why? For what reason, the script should only work on one specific pc?

The only reason I can imagine is, you sell your programs.

So long,

Mega

Nevermind, good luck finding what you are searching for.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

I don't understand why so many people try to generate an ID for a script that should work only on one pc.

You will always have to have access to the pc while creating the unique ID.

Why? For what reason, the script should only work on one specific pc?

The only reason I can imagine is, you sell your programs.

So long,

Mega

Nevermind, good luck finding what you are searching for.

I don't know about others, but I like to test some of the interesting scripts provided in the forum and in the process, I ask questions about something I don't understand. I don't have any programs to sell, but there was an earlier hot topic about getting a unique ID and my mind wandered in that direction. To me it sounds interesting how Microsoft uses some UniqueID from a PC and I got curious too, as to whether it was easy from an Autoit script to do the same. I also agree that there have been other topics mentioned about the UniqueID's. Other people may have had different reasons for wanting such a script. I got drawn to this thread (and decided to post) because when I tried Gafrost's code (provided by Valuater), it changed each time I ran it and hence my curiosity considering the "title" of this thread and the suitability of the code. I thought there was something I was overlooking in this and wanted advice on what use this code, if any, would provide. Thats all..... :think:

Link to comment
Share on other sites

I don't know about others, but I like to test some of the interesting scripts provided in the forum and in the process, I ask questions about something I don't understand. I don't have any programs to sell, but there was an earlier hot topic about getting a unique ID and my mind wandered in that direction. To me it sounds interesting how Microsoft uses some UniqueID from a PC and I got curious too, as to whether it was easy from an Autoit script to do the same. I also agree that there have been other topics mentioned about the UniqueID's. Other people may have had different reasons for wanting such a script. I got drawn to this thread (and decided to post) because when I tried Gafrost's code (provided by Valuater), it changed each time I ran it and hence my curiosity considering the "title" of this thread and the suitability of the code. I thought there was something I was overlooking in this and wanted advice on what use this code, if any, would provide. Thats all..... :think:

HI,

that was no criticism. :"> But I think if you just want to create a script for ... your friends it would be unique enough to compare the installDate of Windows in the OnAutoItStart function.

If your friends don't know that you check for that, I think they won't be able to cheat or run the programm on other PCs. :(

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...