if an element such as LegalNoticeText spans multiple lines then the output from the export looks like
MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\LegalNoticeText=7,line 1
line2
line3
in order to process it as an inifile the set of lines need to be converted to the format where , are used to separate lines (any commas in the text have to appear as ",")
here is my proposed patch:
mkr-services# diff .orig/policy.rb .
50,51c50,51
< # remove /r/n and remove the BOM
< inffile_content = file.read.force_encoding('utf-16le').encode('utf-8', universal_newline: true).delete("\xEF\xBB\xBF")
---
> # remove /r/n, the BOM, and make multiline strings into , sep single lines
> inffile_content = file.read.force_encoding('utf-16le').encode('utf-8', universal_newline: true).delete("\xEF\xBB\xBF").gsub(/(^MACHINE(?:(?!MACHINE).)*?7,(?:(?:(?!MACHINE)[^\n])*?\n)*?)\nMACHINE/m) { |m| m.gsub(/\n(?!MACHINE)/m, ',') }
if an element such as LegalNoticeText spans multiple lines then the output from the export looks like MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\LegalNoticeText=7,line 1 line2 line3 in order to process it as an inifile the set of lines need to be converted to the format where , are used to separate lines (any commas in the text have to appear as ",")
here is my proposed patch: