First of all thank you Anonymous Monk. You advise pointed me to the right direction. At the moment I'm able to get the output in a format of regedit.exe tool. There is only one problem: the tool writes the files as Unicode UTF-16LE with byte-order-marks (BOM). There is no problem to write a file in unicode and also the BOM sequence came up very fast:
open my $fh, '>:encoding(UTF-16LE)', 'wwe-perl.reg';
print {$fh} "\x{FEFF}";
print {$fh} "Windows Registry Editor Version 5.00\n\n";
say {$fh} "[HKLM\\SOFTWARE\\WWE]";
close $fh;
But I'm stuck with a problem I can't find a solution: every end of line has a byte sequence of "00 0D 00 0A" at regedit output and "00 0D 0A 00" at my script output. I don't know what is wrong and how to change this. With the current output I the file looks like a number of Chinese characters. Everything works fine if don't add "\n" to my output (the editor displays the string "Windows Registry Editor Version 5.00" and Unicode BOM as file format. Thank you for any help! |