title: Convert VARIANT to bytes and vise versa?
body: <p>I need to be able to save a <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms221627%28v=vs.85%29.aspx" rel="nofollow">VARIANT</a> (used for COM Automation) in the System Registry and then later read it back from there.</p>
  
  <p>I thought the easiest way to go was to convert it to byte-array and then save it (and reverse the process the other way around.) The issue is that I don't want to begin implementing all possibilities for all the data types that VARIANT may contain (including objects and arrays.)</p>
  
  <p>So I was curious if there's a way to do this? (I.e. serialize a VARIANT.)</p>