User Tag List

Results 1 to 8 of 8

Thread: Safest and most universal way to write/read registry key value ?

  1. #1
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Safest and most universal way to write/read registry key value ?

    I've scoured the forums for info on Registry++ and Registry2. I just don't trust my limited knowledge on registry-related issues to start messing with them without first asking the forums what is best practice.

    What I'm looking to accomplish is writing a value to a registry, then later compare that registry to a different value. This needs to work on all builds of Windows, seeing as I'll have no idea what version of Windows the user is running.

    The value I'll be writing is the hard drive serial number, in order to later check if the program has been moved to a new computer (in which case the registry value and the current serial number will be different).

    Any guidance on how to do this safely is greatly appreciated.

  2. #2
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Paul_Boland's Avatar
    Join Date
    Jun 2006
    Location
    Waterford, Ireland.
    Posts
    2,739
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As a rule of thumb, I don't touch the Registry. Mess that up and you'll take down a whole system! So I am not here to answer your question. But I am going to pose one to you... How will what you're trying to do, work? I'm not asking you to tell your method here on the public forum, but be sure your method works.

    As an alternative to using the Registry, you could always using an INI file. If you don't set a path just just a name, "MyINIFile.ini", it will be written into the Windows folder and unless the user of the software knows what to look for they won't know it exists. You could check that for the serial number and if the program is moved to a different computer, it will return a different value because it won't have that Windows INI file. If you want more security you could encrypt the file using the Blow Fish object and decrypt it when reading it. Just another option instead of messing with the Windows Registry and potentially messing that up and taking a users whole system down!
    KnightTrek Productions
    http://www.knighttrek.com

  3. #3
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Ooh! I didn't know leaving the path blank for an ini drops files into the Windows folder! I'll likely rely on this. While it's slightly more obvious than dumping things into the registry, I'll more confident in doing so. Thanks for the response, Paul!! Does this work across all builds of Windows?

    Out of curiosity, I'd still like opinions on the original question. I've been play with .dll files and reg-key stuff lately so more knowledge is always welcomed!

    Edit: I tried not setting a path and the ini file didn't end up in the Windows root folder, it just didn't end up being created at all. Any suggestions?

  4. #4
    Clicker Fusion 2.5 DeveloperInstall Creator Pro

    Join Date
    Sep 2006
    Posts
    517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi ratty,
    If the following INI's property is checked: "Create in App Data folder", INI file will be created in App Data folder instead of Windows folder. Using App Data folder instead of Windows folder is a good thing but this property has some annoying side effect.

    So first uncheck "Create in App Data folder" property and add a "File object" in the same frame. Then in event editor, add an event (for example "Start of frame") which will load a specific INI file. For this INI file, use an expression and the File object to retrieve App Data folder as base path + something specific to your application. Now you should be able to read and store data from you INI file. I'm not sure if the INI file is created when nothing has to be written, the INI file may remain unexisting until you write some data in.

    ouly

  5. #5
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Safest and most universal way to write/read registry key value ?

    Thanks Ouly. I'll give that a shot. What sort of annoying side effects were you referring to?

  6. #6
    Clicker Fusion 2.5 DeveloperInstall Creator Pro

    Join Date
    Sep 2006
    Posts
    517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  7. #7
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Paul_Boland's Avatar
    Join Date
    Jun 2006
    Location
    Waterford, Ireland.
    Posts
    2,739
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ratty View Post
    Ooh! I didn't know leaving the path blank for an ini drops files into the Windows folder! I'll likely rely on this. While it's slightly more obvious than dumping things into the registry, I'll more confident in doing so. Thanks for the response, Paul!! Does this work across all builds of Windows?
    ...
    Edit: I tried not setting a path and the ini file didn't end up in the Windows root folder, it just didn't end up being created at all. Any suggestions?
    Yes, this works across all builds of Windows. I see Ouly replied to your query about it not work, I'll do a test on this myself later just to check it and will get back to you.
    KnightTrek Productions
    http://www.knighttrek.com

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Ryan's Avatar
    Join Date
    Nov 2008
    Location
    Australia
    Posts
    1,279
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Touching the registry is fine, you can't exactly take down the whole computer with it. Most fears about registry are unwarranted, it's basically a big ini file. As long as you use it but don't abuse it (adhere to standards about where to store your software values), you can't do any harm.

    You can also setup the install creator to remove registry values on uninstall, so your application doesn't leave any junk behind. I really like it. Get to know the registry, don't fear what you don't understand!

    I store serials in an ini and the registry and check for both. Some users may delete hard-drive files because they don't know what they are, but few users would delete the registry values. It just adds another level of safety so that the serial doesn't forget itself even if a file goes missing or a registry value gets deleted.

Similar Threads

  1. read/write an ini
    By arthurh in forum Android Export Module Version 2.0
    Replies: 9
    Last Post: 28th May 2013, 08:08 AM
  2. Write install directory in the registry
    By Boris in forum Install Creator and Patch Maker
    Replies: 7
    Last Post: 16th May 2012, 06:23 AM
  3. How to read/write to an HTM file from an applet
    By mobichan in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 18th November 2009, 11:41 PM
  4. how to write to registry?
    By mavzer_baba in forum Install Creator and Patch Maker
    Replies: 1
    Last Post: 20th May 2008, 11:34 AM

Posting Permissions

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