Win32 - registry

BlitzMax Forums/BlitzMax Programming/Win32 - registry

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

Local qu$=Chr(34)
'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
Local res$ =DoProcess("reg.exe query "+qu$+"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"+qu+" /v path") 

Local pos:Int = res.find(":") -1
Local path$ = res[pos..]
Local newpath$ = path$ + ";C:\programmi\subversion\bin"
Print "Path: " + path
Print "New Path:" + newpath
Print
Print DoProcess("reg.exe add " + qu + "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" + qu + " /v path /t REG_EXPAND_SZ /d " + newpath+" /f") 
End
Function DoProcess$(cmd$ , hide:Int = HIDECONSOLE) 
		Local	process:TProcess
		Local	bytes:Byte[] , result$,temp_read$
		process = CreateProcess(cmd$ , hide) 
		If process
			While True
				Repeat
					temp_read  = process.pipe.ReadLine()
					result = result + temp_read
					If PeekEvent() WaitEvent() 
				Until process.pipe.bufferpos<=0
				If Not process.status() Exit				
				Delay 10
				If PeekEvent() WaitEvent() 
			Wend
		EndIf
		Return result
End Function


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.