cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
srdaniel
Level 3

Custom Action parameter

I want to create a custom action that calls a function in a DLL or EXE and passes along as a parameter the directory the setup.exe was in when the user ran it. Is that possible? Not the temp folder the msi and other files get extracted to.

When I create a new custom action, Standard DLL, Stored in Binary Table, is there somewhere I can go to look at this Binary Table thing?

Do I have to add the DLL/EXE to the Binary Table myself or does it get added to the table when I browse for the DLL?

Daniel
Labels (1)
0 Kudos
(4) Replies
liberybell
Level 4

Three questions that may help us to help you:
1.- Is your action a immediate or deferred action?
2.- Are you coding the DLL?
3.- Is this a basic MSI project (I assuming so)

If working with a basic MSI project you must refer to the property SETUPEXEDIR that contains the path to the setup.exe.
if your action is deferred you must create a 'set property' action that pass the path contain on SETUPEXEDIR to your action in the 'CustomActionData' property. Read the help for 'Accessing or Setting Windows Installer Properties Through Deferred, Commit, and Rollback Custom Actions.'
0 Kudos
srdaniel
Level 3

1.- Is your action a immediate or deferred action?
Doesn't matter to me, I got one custom action working as deferred but I don't know how to access the directory the EXE is in.

2.- Are you coding the DLL?
Yes.

3.- Is this a basic MSI project (I assuming so)
Yes.
0 Kudos
liberybell
Level 4

If you are refering to the directory where the setup.exe is you can use the SETUPEXEDIR property.
0 Kudos
srdaniel
Level 3

SETUPEXEDIR sounds like what I'm looking for. In the function signature dialog I set the following right?

Type - STRING
Source - Constant
Value - [SETUPEXEDIR]


I'm getting an error: "The DLL being called encountered a problem"

The action I have setup as:
Return Processing - Synchronous(ignore exit code)
In-Script Execution - Immediate Execution
Execution Scheduling - Always execute
Install Exec Sequence - After InstallFiles

The log show it starting my custom action:

MSI (s) (00:A8) [09:18:09:387]: Doing action: SetDefaultINIPath
Action 9:18:09: SetDefaultINIPath.
Action start 9:18:09: SetDefaultINIPath.
MSI (s) (00:A8) [09:18:09:434]: Creating MSIHANDLE (12) of type 790542 for thread 3496
MSI (s) (00:74) [09:18:09:434]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIDB91.tmp, Entrypoint: DLL1
MSI (s) (00!08) [09:18:09:496]: Creating MSIHANDLE (13) of type 790541 for thread 3080
MSI (s) (00!08) [09:18:09:496]: Creating MSIHANDLE (14) of type 790540 for thread 3080
MSI (s) (00!08) [09:18:09:496]: Creating MSIHANDLE (15) of type 790531 for thread 3080
MSI (s) (00!08) [09:18:09:496]: Closing MSIHANDLE (15) of type 790531 for thread 3080
MSI (s) (00!08) [09:18:09:512]: Closing MSIHANDLE (14) of type 790540 for thread 3080
MSI (s) (00!08) [09:18:09:512]: Creating MSIHANDLE (16) of type 790540 for thread 3080
MSI (s) (00!08) [09:18:09:512]: Creating MSIHANDLE (17) of type 790531 for thread 3080
MSI (s) (00!08) [09:18:09:528]: Closing MSIHANDLE (17) of type 790531 for thread 3080
MSI (s) (00!08) [09:18:09:528]: Closing MSIHANDLE (16) of type 790540 for thread 3080
MSI (s) (00!08) [09:18:09:528]: Closing MSIHANDLE (13) of type 790541 for thread 3080
MSI (s) (00:74) [09:20:09:387]: Closing MSIHANDLE (12) of type 790542 for thread 3496
Action ended 9:20:09: SetDefaultINIPath. Return value 1.


Not sure how to tell what's wrong. My test program can call the DLL so I know the DLL is working. Any ideas on what I'm doing wrong?
0 Kudos