Jump to content

Regwrite


Recommended Posts

I am using setup2go to manage the installation and dismounting of an AutoIT application. Setup2go allows you to record and write keys to registry as well as ini files as part of the installation. This allows you to control and manage a setup process like making the script run on the re-boot after installation of the package.

Sitting outside of the installing and dismounting process I want my configuration script each time it is launched by the installation process to write a permanent item into registry which increments that keys data field to record the number of times that the software has been installed/reinstalled on that local machine. I have no problems with writing that code, however given my limited knowledge of Registry can anyone suggest where I should create the key to recorded that data hklm\software\????\????\????

Assistance is always appreciated

Ant....

Link to comment
Share on other sites

I am using setup2go to manage the installation and dismounting of an AutoIT application. Setup2go allows you to record and write keys to registry as well as ini files as part of the installation. This allows you to control and manage a setup process like making the script run on the re-boot after installation of the package.

Sitting outside of the installing and dismounting process I want my configuration script each time it is launched by the installation process to write a permanent item into registry which increments that keys data field to record the number of times that the software has been installed/reinstalled on that local machine. I have no problems with writing that code, however given my limited knowledge of Registry can anyone suggest where I should create the key to recorded that data hklm\software\????\????\????

Assistance is always appreciated

Ant....

Hi,

hklm\software\????\????\????

isn't a bad place, you could use this for example:

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Test", "TestKey", "REG_SZ", "Hello this is a test")
oÝ÷ Úâ*.­Æ¬y«­¢+Ø(ÀÌØíÙ±ÕôII ÅÕ½Ðí!-e}1=

1}5

!%9ÀäÈíM=Q]IÀäÈíQÍÐÅÕ½Ðì°ÅÕ½ÐíQÍÑ-äÅÕ½Ðì¤(ÀÌØíÙ±ÕôÀÌØíÙ±Õ¬Ä)I]É¥Ñ ÅÕ½Ðí!-e}1=

1}5

!%9ÀäÈíM=Q]IÀäÈíQÍÐÅÕ½Ðì°ÅÕ½ÐíQÍÑ-äÅÕ½Ðì°ÅÕ½ÐíI}MhÅÕ½Ðì°ÀÌØíÙ±Õ¤

you could also use HKEY_CURRENT_USER in place of HKEY_LOCAL_MACINE which will allow you to count for each user, you could also combine these two!

Edited by Pakku
Link to comment
Share on other sites

Hi,

isn't a bad place, you could use this for example:

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Test", "TestKey", "REG_SZ", "Hello this is a test")
oÝ÷ Úâ*.­Æ¬y«­¢+Ø(ÀÌØíÙ±ÕôII ÅÕ½Ðí!-e}1=
1}5
!%9ÀäÈíM=Q]IÀäÈíQÍÐÅÕ½Ðì°ÅÕ½ÐíQÍÑ-äÅÕ½Ðì¤(ÀÌØíÙ±ÕôÀÌØíÙ±Õ¬Ä)I]É¥Ñ ÅÕ½Ðí!-e}1=
1}5
!%9ÀäÈíM=Q]IÀäÈíQÍÐÅÕ½Ðì°ÅÕ½ÐíQÍÑ-äÅÕ½Ðì°ÅÕ½ÐíI}MhÅÕ½Ðì°ÀÌØíÙ±Õ¤

you could also use HKEY_CURRENT_USER in place of HKEY_LOCAL_MACINE which will allow you to count for each user, you could also combine these two!

Arjan

Thanks for posting that Arjan! You just gave me a great idea about a problem I have been working on ( or stewing on in the back of my mind (a short walk)).

jh

Link to comment
Share on other sites

Thanks for that having a key called TEST might make it a bit obvious to an advanced user if you wanted to be a little bit more secure or secretative as to the intended use of the key. Is there any where in registry where software licence keys are usually written or in hklm can I call the key whatever I like without disturbing the general funcationality of the operating system? I like the way you have read incremented and written the data value. This is a bit of code that I have written which creates another encrypted licencing key .

CODE

#include<String.au3>

;Installation File

$sidate = (_StringEncrypt(1, @YEAR & "/" & @MON & "/" & @MDAY & " " & "00:00:00", "yourencryptioncode", 1))

IniWrite(@WindowsDir & "\yourfilename.log", "section1", "value1", $sidate) ;Date Installed

And the code that reads the licence

CODE
;

#include "Date.au3"

;Check Licence

$licence = (_StringEncrypt(0, IniRead(@WindowsDir & "yourfilename.log", "section1", "value2", "31"), "yourencryptionkey", 1))

$sStartDate = (_StringEncrypt(0, IniRead(@WindowsDir & "yourfilename.log", "section11", "value1", "2007/01/01 00:00:00"), "yourencryptionkey", 1))

$sEndDate = @YEAR & "/" & @MON & "/" & @MDAY & " " & "00:00:00"

$days = _DateDiff ( "d", $sStartDate, $sEndDate)

If ($licence - $days) < 6 and ($licence - $days)> -1 Then

$message = " Licence will EXPIRED IN " & ($licence - $days) & " DAYS"

DisplayMessage()

EndIf

If $days > $licence Then

$message = " Licence has EXPIRED"

DisplayMessage()

;your process

EndIf

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