#REG_MULTI_SZ ?

Everything else that doesn't fall into one of the other PB categories.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

#REG_MULTI_SZ ?

Post by SFSxOI »

Anyone got something (in PB already) for reading #REG_MULTI_SZ values in the registry? I had something but it was on another drive that failed a while back and haven't needed it in a while, and now i'm missing it.

I just found out something else too, the search here on the web site kinda sucks. I wanted to search for #REG_MULTI_SZ, what I got was:

"Search found 1392 matches: +REG +MULTI

ignored: SZ"


Then I did +REG +MULTI +SZ and got:

"Search found 1392 matches: +REG +MULTI

ignored: +SZ"

tried some others too, basically the search on this web site is useless for searches like this as its too 'confined' and will not allow a lot of things.

EDIT: Never mind, I found a snippet in another project that allowed me to recreate something for getting #REG_MULTI_SZ
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
User avatar
STARGÅTE
Addict
Addict
Posts: 2315
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: #REG_MULTI_SZ ?

Post by STARGÅTE »

here my code:

Code: Select all


Structure Registry_CharacterArray
	c.c[0]
EndStructure

Procedure.i GetRegistryArray(HKey.i, SubKey.s, Name.s, Array String.s(1))
	Protected *Key, Type.i, *Buffer.Registry_CharacterArray, Length.i, Index.i, LastIndex.i = -1
	If RegOpenKeyEx_(HKey, SubKey, #Null, #KEY_READ, @*Key) = #ERROR_SUCCESS
		If RegQueryValueEx_(*Key, Name, #Null, @Type, #Null, @Length) = #ERROR_SUCCESS
				*Buffer = AllocateMemory(Length)
				RegQueryValueEx_(*Key, Name, #Null, @Type, *Buffer, @Length)
				Length / SizeOf(Character) - 2
				For Index = 0 To Length
					If *Buffer\c[Index] = #Null : LastIndex + 1 : EndIf
				Next
				Length = 0
				Dim String(LastIndex)
				For Index = 0 To LastIndex
					String(Index) = PeekS(@*Buffer\c[Length])
					Length + Len(String(Index))+1
				Next
				FreeMemory(*Buffer)
		EndIf
		RegCloseKey_(*Key)
	EndIf
	ProcedureReturn LastIndex
EndProcedure
Array String.s(1) gives all Strings

EDIT: Bugfix for unicode
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: #REG_MULTI_SZ ?

Post by SFSxOI »

Thanks for your reply STARGÅTE :)
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
Post Reply