Jump to content

CLSID Generator


maqleod
 Share

Recommended Posts

just in case you want a generator to make class ids for your file type associations:

;CLSID Generator
#include <GuiConstants.au3>
Local $array[8],$number

$parent = GUICreate("CLSID",250,80)

$input = GuiCtrlCreateInput("",10,10,225,20)

$button = GuiCtrlCreateButton("Generate",50,40,75,25)
$close = GuiCtrlCreateButton("Close",130,40,75,25)

Generate()

GUISetState()
Do
$msg = GUIGetMsg()

if $msg = $button then
GuiCtrlSetData($input,"")
Generate()
endif

if $msg = $close then
ExitLoop
endif

Until $msg = $GUI_EVENT_CLOSE
GUIDelete()

Func Generate()
;First 8 numbers are completely random, next for are based off the current day and month
For $i = 1 to 8
RandomHex()
$array[$i-1] = $number
Next
GuiCtrlSetData($input,$array[0] & $array[1] & $array[2] & $array[3] & $array[4] & $array[5] & $array[6] & $array[7] & "-" & @MDAY & @MON & "-")
;next 4 numbers are based off of the current PID of a system core process, random numbers are filled in when needed
$pid1 = ProcessExists("csrss.exe")
$pid1len = StringLen($pid1)
if $pid1len > 4 then
$newlen = $pid1len - 4
$newpid1 = StringTrimRight($pid1,$newlen)
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$newpid1 & "-",$default)
elseif $pid1len < 4 then
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$pid1,$default)
$newlen = 4 - $pid1len
For $i = 1 to $newlen
RandomHex()
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$number,$default)
Next
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,"-",$default)
elseif $pid1len = 4 then
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$pid1 & "-",$default)
endif
;next 4 numbers are based off of the current PID of a system core process, random numbers are filled in when needed
$pid2 = ProcessExists("smss.exe")
$pid2len = StringLen($pid2)
if $pid2len > 4 then
$newlen = $pid2len - 4
$newpid2 = StringTrimRight($pid2,$newlen)
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$newpid2 & "-",$default)
elseif $pid2len < 4 then
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$pid2,$default)
$newlen = 4 - $pid2len
For $i = 1 to $newlen
RandomHex()
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$number,$default)
Next
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,"-",$default)
elseif $pid2len = 4 then
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$pid2 & "-",$default)
endif
;last 12 numbers are based off of the serial of your hard drive, random numbers are filled in when needed
$drives = DriveGetDrive("Fixed")
$serial = DriveGetSerial($drives[1])
$seriallen = StringLen($serial)
if $seriallen > 12 then
$newlen = $seriallen - 12
$newstring = StringTrimRight($serial,$newlen)
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$newstring,$default)
elseif $seriallen < 12 then
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$serial,$default)
$addition = 12 - $seriallen
For $i = 1 to $addition
RandomHex()
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$number,$default)
Next
elseif $seriallen = 12 then
$default = GuiCtrlRead($input)
GuiCtrlSetData($input,$serial,$default)
endif
EndFunc

Func RandomHex()
$number = Random(1,16,1)
if $number = 10 then
$number = "A"
endif
if $number = 11 then
$number = "B"
endif
if $number = 12 then
$number = "C"
endif
if $number = 13 then
$number = "D"
endif
if $number = 14 then
$number = "E"
endif
if $number = 15 then
$number = "F"
endif
if $number = 16 then
$number = "G"
endif
EndFunc
[u]You can download my projects at:[/u] Pulsar Software
Link to comment
Share on other sites

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...