Help needed :(
Apr. 3rd, 2008 04:45 pmDoes anyone know anything about .NET ?
I'm writing a .NET app (Managed C++) which manipulates registry keys. Which is fine.
You call GetValue on the subkey, passing in the name of the value you want to retrieve. The returned object is of type Sytem::Object, but you can cast it to an int or a string (depending on type) and all is well.
Except... what if your registry value is binary ? Then you can't cast it to an integer (it throws an exception, not unreasonably, presumably as it can't guarantee value is small enough to fit into an int). You are, in fact, left with a System::Object which is round, and smooth, and shiny and has absolutely no means of accessing the value contained therein.
At least, no means that I can determine. Just how do I persuade the binary value out of it ?
I'm writing a .NET app (Managed C++) which manipulates registry keys. Which is fine.
You call GetValue on the subkey, passing in the name of the value you want to retrieve. The returned object is of type Sytem::Object, but you can cast it to an int or a string (depending on type) and all is well.
Except... what if your registry value is binary ? Then you can't cast it to an integer (it throws an exception, not unreasonably, presumably as it can't guarantee value is small enough to fit into an int). You are, in fact, left with a System::Object which is round, and smooth, and shiny and has absolutely no means of accessing the value contained therein.
At least, no means that I can determine. Just how do I persuade the binary value out of it ?