This is a registry row that causes registry REPLACEMENT (as the string
list starts with "[~]" it should have appended):
<$Row
Registry="RegKey002"
Root="2"
Key="SYSTEM\CurrentControlSet\Control\Session
Manager"
Name="BootExecute"
Value="#%[~][INSTALLDIR]Some.exe"
Component_="PinPadStartupScript"
>
Has anyone got it to work or is the latest (and older) SDK doco wrong?
Thanks for any help,
Dennis
I've seen prepend/append in REG_MULTI_SZ working for sure.
If [~] is included in the value at all it changes the intent for the
registry item to be REG_MULTI_SZ. The value you show starts as #% which
indicates REG_EXPAND_SZ. I think the whole prepend/append applies only to
REG_MULTI_SZ or to the environment table (which although is in registry I'm
sure has specific code in Windows Installer engine to handle due to old 9X
support).
So I am guessing based on your results that if Windows Installer finds that
the Value starts with # (but not ##) then it ignores [~] behaviour for
prepend/append.
Which means changing
Value="#%[~][INSTALLDIR]Some.exe"
to
Value="[~][INSTALLDIR]Some.exe"
should work.
Sincerely,
Adrian Accinelli
Besides, in your example, [INSTALLDIR] is an MSI Public Property that
will be formatted before writing to the registry. Expandable is for
registry value data that contains environment variables and will be
expanded when the value is later read.
I hope I wasn't conveying that you could do the impossible. I think Dennis
was under the impression that the Windows Installer would allow you to
prepend/append a string into an existing REG_EXPAND_SZ value. E.g. Existing
value is "Blah". So by creating registry table entry like "#%[~]Something"
he thought the result would be "BlahSomething" -- all still in
REG_EXPAND_SZ. Maybe I'm wrong but that's my interpretation of the posting.
Also I like the idea of "Proof by UI" but I do not seriously think that you
can't rely on UI of any app to tell you a real answer. Case in point:
Regedit on XP doesn't provide "new QWORD value" menu item but Vista does.
But you can create them with direct API since 2000 (or I suppose by using
"new Binary value" but that's not my point). Sure in this case both you
and the UI you reference are correct but just I don't think it's acceptable
for a definitive answer. Still... something about "Proof by UI" appeals to
me :)
Sincerely,
Adrian Accinelli
(From Registry Table Topic )
"#% The value is interpreted and stored as an expandable string
(REG_EXPAND_SZ)."
but then it goes on to say:
"If the value contains the sequence tilde [~], then the value is
interpreted as a Null-delimited list of strings (REG_MULTI_SZ)."
Based on my understanding of the registry and experience with MSI,
the latter takes precedence over the former. Regardless it's a moot
point because [INSTALLDIR] isn't expandable anyways, it's formattable.
http://msdn2.microsoft.com/en-us/library/ms724884.aspx
REG_EXPAND_SZ : A null-terminated string that contains unexpanded
references to environment variables (for example, "%PATH%"). It will
be a Unicode or ANSI string depending on whether you use the Unicode
or ANSI functions. To expand the environment variable references, use
the ExpandEnvironmentStrings function.
REG_MULTI_SZ : A sequence of null-terminated strings, terminated by an
empty string (\0).
The following is an example:
String1\0String2\0String3\0LastString\0\0
The first \0 terminates the first string, the second to the last \0
terminates the last string, and the final \0 terminates the sequence.
Note that the final terminator must be factored into the length of the
string.
Right -- that's the exact wording I was looking at before I posted. I came
to the same conclusion as you but since I never tried it directly (come on
who needs that really?) so I gave the Dennis benefit of the doubt and posted
as if docs could be wrong but likely were not and maybe he just had a
typo...
>
> Based on my understanding of the registry and experience with MSI,
> the latter takes precedence over the former. Regardless it's a moot
> point because [INSTALLDIR] isn't expandable anyways, it's formattable.
Agreed... hehehe this is just for fun now --> Formatted still allows [\%] so
the INSTALLDIR could be craftily constructed to provide expanded status
(e.g. "[\%]ProgramFiles[\%]Whatever"). Of course it wouldn't be good for
use as a Directory table value in that form but fine for registry
REG_EXPAND_SZ purposes.
No more posts from me on this topic I promise!
Sincerely,
Adrian Accinelli
Hehehehe
I agree. Time to stop theorizing and get back to making money writing
installs for customers. :-)
Thanks guys, yes I was getting confused and the documenation certainly doesn't help,
in my case I did want REG_MULTI_SZ and taking out the "#%" did the trick.
But (from other posts), just because a registry value is of type REG_EXPAND_SZ doesn't
mean it need contain a value which REQUIRES expanding.
Bye,
Dennis
Dennis Bareis [Microsoft MVP] (dba...@KillSpam.gmail.com)
http://dennisbareis.com/
Freeware Windows Installer creation tool (+ "ORCA automation"):
http://makemsi.dennisbareis.com/