Problem with REG_MULTI_SZ Strings
Posted: Thu Apr 29, 2021 8:22 am
I am having issues reading a REG_MULTI_SZ string from the registry. I need to test this string for certain values.
The issue seems to be if there is an empty string in the middle of the list of strings, all other strings after that get ignored. I am not in control of the contents of this string, I just need to test.
For example:
If I look for a value listed in the strings after the blank line, I never find them.
In my MSICode, I am searching the returned string as follows:
Set Variable PENDINGFILERENAMELIST to
Read Registry Key HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations into PENDINGFILERENAMELIST
if Variable PENDINGFILERENAMELIST not Equals
Comment: MessageBox: DEBUG, $PENDINGFILERENAMELIST$
Get String Position of "PNSVC12.EXE" in "$PENDINGFILERENAMELIST$" into variable NEEDSREBOOTFROMDRIVER (ignore case)
if Variable NEEDSREBOOTFROMDRIVER Equals 0
Get String Position of "PNSRV12.EXE" in "$PENDINGFILERENAMELIST$" into variable NEEDSREBOOTFROMDRIVER (ignore case)
end
end
How can I skip and/or remove the empty string? Is there a better way to search for the string? Can I remove the newlines somehow?
The issue seems to be if there is an empty string in the middle of the list of strings, all other strings after that get ignored. I am not in control of the contents of this string, I just need to test.
For example:
If I look for a value listed in the strings after the blank line, I never find them.
In my MSICode, I am searching the returned string as follows:
Set Variable PENDINGFILERENAMELIST to
Read Registry Key HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations into PENDINGFILERENAMELIST
if Variable PENDINGFILERENAMELIST not Equals
Comment: MessageBox: DEBUG, $PENDINGFILERENAMELIST$
Get String Position of "PNSVC12.EXE" in "$PENDINGFILERENAMELIST$" into variable NEEDSREBOOTFROMDRIVER (ignore case)
if Variable NEEDSREBOOTFROMDRIVER Equals 0
Get String Position of "PNSRV12.EXE" in "$PENDINGFILERENAMELIST$" into variable NEEDSREBOOTFROMDRIVER (ignore case)
end
end
How can I skip and/or remove the empty string? Is there a better way to search for the string? Can I remove the newlines somehow?