0

I am using wix/burn to create a bootstrapper to some MSI files. I created markup with an xml payload:

<BootstrapperApplicationRef ...>
    <Payload Id="myXML" Compressed="yes" SourceFile="c:\my.xml" />
</BootstrapperApplicationRef>

Question: How do I pass this payload's path to an MsiPackage?

<MsiPackage ...>
    <MsiProperty Name="XMLFILE" Value="[what do I use?]" />
</MsiPackage>

I'm also interested in editing the file before passing it to the msi. For that I'm using bafunctions.dll. But I don't know how to get the payload's path for bafunctions.dll either (c++ code). I tryed GetModuleFileName() but that gives me the original bundle path, like c:\users\alex\desktop\bundle.exe, not the temp folder where everything is unzipped.

Alex
  • 583
  • 5
  • 18

1 Answers1

0

I actually found a way to do it:

in the bafunction.dll, we can use GetModuleFileName() to get the path of the actual loaded dll, not the exe:

//define this in your compilation unit (cpp)
EXTERN_C IMAGE_DOS_HEADER __ImageBase;

Then write a function to get the dll path:

WCHAR   DllPath[MAX_PATH] = {0};
GetModuleFileNameW((HINSTANCE)&__ImageBase, DllPath, _countof(DllPath));

That will give you the full path to bafunctions.dll, but other payloads are in the same folder. So it's just a matter of parsing this string.

After you get the path you can create a burn variable of your own that can be referenced in the xml markup as well.

hr = m_pEngine->SetVariableString(L"MyXmlPath", myxmlpath.c_str());
BalExitOnFailure(hr, "Failed to set variable MyXmlPath.");
Alex
  • 583
  • 5
  • 18