Win32 - registry

BlitzMax Forums/BlitzMax Programming/Win32 - registry

degac(Posted 2008) [#1]
Hi,
I've found this Registry Module source to access the Windows registry.
It works well, but I have a little problem when accessing some keys.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

If I try to access the key PATH (its type is REG_EXPAND_SZ - dont' ask me why is not a simple string...) I got a void string. And this is not a good thing.


Can someone explain me how to change the code to read the path (or the Reg_Expand_sz variables)?

My idea is read (with this key) the system path, modify it and then save-write it again to the registry.
Unless there's another way to change permanentely the path...I mean not manually - via software.

This is the last (and of course the most important - Murphy's law...) part of my program.

Thanks.


Kev(Posted 2008) [#2]
If i recall you need to access the environment registry keys using api SHGetValue(), i would also suggest a look at SHSetValue()

kev


Winni(Posted 2008) [#3]
From what Google tells me, the reason why this is a REG_EXPAND_SZ string probably is simple: It can use environment variables.

It is also null terminated, which might be another difference to REG_SZ.

You will probably also run into permission problems; only administrators are allowed to change that registry value (you can verify this with REGEDT32.EXE instead of REGEDIT.EXE).


degac(Posted 2008) [#4]
Thanks to all, but I think I've resolved pointing my attention on the REG.EXE program that comes with WindowXP (NT a Windows 2000 need to download).



Well, it works!

I need to check 'strange paths' with spaces but I think I found a workaround - until I figure out how to change/use the Registry library.