Altough I personally find your text processing extremely difficult to understand, it produces perfectly valid
XML output. At least on
some random WIM xml file I found on the interwebs.
I bet your error hails from your 'pre' parameter. When you call
WIMGetImageInformation
, you're storing the buffer size of the returned
XML data. When later writing your modified data by
WIMSetImageInformation
, you're passing the exact same size. This cannot be right.
According to MSDN, you'll have to pass the size (in Bytes) of your new
xml block. I'm not sure if the trailing '\0' for termination is counted or not.