Archive: Recommended method to execute DLL


Recommended method to execute DLL
I am trying to create an install file to load several network printers with a single file. To actually install the printers uses "rundll.exe" as in this example:


rundll32 printui.dll,PrintUIEntry
/if /b "Ricoh Aficio 1515 (Systems)"
/f "\\ntserver\install\R1515_Win2K_XP\OEMSETUP.INF"
/q /r "NP01-C05" /m "RICOH Aficio 1515 PCL 6" /z /u


The problem is I cannot figure-out how to run these commands in the NSIS script. I have read info about "Exec", "ExecWait", "ExecShell", "ExecDLL", and "nsExec" and I can't seem to get any of them to work. I fear that it is because of all the switches used in the command.

Here is my latest failed attempt:

ExecWait "rundll32 printui.dll,PrintUIEntry
/if /b 'Ricoh Aficio 1515 (Systems)'
/f '$INSTDIR\Ricoh1515F_PCL6\Win2K_XP\OEMSETUP.INF'
/q /r 'NP01-C05' /m 'RICOH Aficio 1515 PCL 6' /z /u"


So, NSIS gurus what advice can you help give this newbie to get around this?

TIA,
Charles

How exactly doesn't it work? From the code you've posted above, it seems like you should get a syntax error because you've split the lines.


Sorry - it was late when I posted. The error I receive is coming from the DLL and it states "The arguments are invalid"

The arguments are not invalid -- they work from a batch. I broke the lines apart in the post for readability. In the script they are all on one line.

Thanks,
Charles


Maybe it doesn't like single quotes? Try using double quotes for the command line and single quotes for the NSIS string itself. If that doesn't work, attach the working example and the non-working example.


The quotes thing was keeping it from running. The command is running now (there is a delay between commands like it is doing something) but doesn't add the printers.

Here is the new command that does compile and appears to work but doesn't:
ExecWait 'rundll32 printui.dll,PrintUIEntry /if /b "Ricoh Aficio 1515 (Systems)" /f "$INSTDIR\Ricoh1515F_PCL6\Win2K_XP\OEMSETUP.INF" /q /r "NP01-M06" /m "RICOH Aficio 1515 PCL 6" /z /u'

Here is the command as run from a DOS batch file:
start /wait rundll32 printui.dll,PrintUIEntry /if /b "Ricoh Aficio 1515 (Systems)" /f "C:\Temp\JCH-INSTALL_PRINTERS\Ricoh1515F_PCL6\Win2K_XP\OEMSETUP.INF" /q /r "NP01-C05" /m "RICOH Aficio 1515 PCL 6" /z /u

I am able to get working what I need by adding the batch file to the install and using ExecWait to run it. However, it creates the DOS window and I have to make sure the $INSTDIR value is specified in my batch.

I appreciate your help!!

Thanks,
Charles


Maybe the working directory bothers it? Try setting it using SetOutPath.

To avoid the DOS window, you can use the nsExec plug-in which is bundled with NSIS.


SetOutPath did it -- it is working perfectly now. Thanks!!

Thanks,
Charles