RegSetValueEx and REG_MULTI_SZ
Im using RegSetValueEx to write to the registry. Everything works great, but i have a problem when writing to a REG_MULTI_SZ.
If you are familiar with how a REG_MULTI_SZ works, the value should be like this:
My question is: How can I seperate the values?
Now i get:
And this aint working.
value1 value2 value3
Please explain this to me or post some example code:D
Iw searched this forum and google, without getting any smarter.
I dont have my code here atm(im at work) but if its needed i can post it later.
Writing REG_MULTI_SZ values
I am trying to write an array of strings into the registry and I tried the method that MSDN advises.
My registry entry is "security code"
Ex. I had a hard-coded string for testing purposes "111\0222\0333\0444\0\0"
So technically the registry should have
But, I checked and the REG_MULTI_SZ type string entry it only has 111.
What am I doing wrong here?
Is there some special method that you used to get it working. You mention that the MSDN webpage helped you, I read the same thing and I can't think of anything I am missing.
Adding a string with multiple nulls
I figured that out, as I was using strlen, it was terminating the count upto the first null.
Now my main question is I have a CStringArray. Now I want each element of that array put in a C-style string that I can write to REG_MULTI_SZ value.
So for ex. if my CStringArray contains 111, 222, 333, 444, 555, I should ideally have the null terminated string as "111\0222\0333\0444\0555\0\0" to be able to write it in type REG_MULTI_SZ.
I cannot seem to be able to write multiple nulls into the same C Style string. Can anyone help?