Archive: Interface UserInfo with another installer


Interface UserInfo with another installer
Hello evrybody,

I have some programming questions about the NSIS plugin UserInfo. I am trying to interface this DLL with Installer VISE so that when the installer initialises, the type of user (Admin,User,Power User, e.t.c.) can be determined. Does anyone know who wrote UserInfo plugin and how I can contact him? Thanks in advance!


I wrote it. Take a look at Source\exehead\exec.c line 909 (case EW_REGISTERDLL: ) to see how it's called. The source code to the plug-in itself is available in Contrib\UserInfo.


this should get you started: http://www.elists.org/pipermail/delp...er/022392.html

edit: hah, the browser window was open for more than an hour, forgot to click submit, guess this is useless now...


kichik,

I didn't quite understand the part "Take a look at Source\exehead\exec.c line 909 (case EW_REGISTERDLL to see how it's called". Sorry! Where can I find it? Also, I am aware about the source code of UserInfo, I studied it. The problem is this: The help file of Installer VISE says the following about interfacing an external DLL:

To build an external code dll follow these steps.

An external code .dll file is a Windows dynamic library with at least one procedure exported. That procedure must look like this:

extern "C" LONG CALLBACK ViseEntry(LONG lParam1, LPCSTR lpParam2, DWORD dwReserved)

This is the entry procedure that will be called by the setup program. (See "Creating External Code for Installer VISE Installers" below for more details.)

Your external code file must be 32-bit. You can copy the skeleton project in the ExtCodes folder and use it as a starting point. This example code displays a simple message box to the user.

Creating External Code for Installer VISE Installers

In order to interface with an Installer VISE installer, your external code must have a main entry point as follows:

extern "C" LONG CALLBACK ViseEntry(LONG lParam1, LPCSTR lpParam2, DWORD dwReserved)

If you need access to information returned by calling the external code (beyond simple success or failure), your code source must also include the following class definition:

class CViseEntryData

{

public:

HWND m_hwndMain; // Main window handle
HWND m_hwndProgress; // Progress dialog window handle
BOOL m_bUninstall; // Uninstaller flag
LPCSTR m_lpszUninstallLogFile; // Uninstall log file path
LPCSTR m_lpszTempDir; // Installer VISE’s temp directory path
HINSTANCE m_hinst; // Instance handle of the VISE dll
char m_szInstallerName[_MAX_PATH]; // Name of the installer
// eSellerate shopping cart data
LONG m_nShoppingCartCount; // Number of items in the shopping cart

LPCSTR m_lpShoppingCartSKU[64]; // Array to list SKU IDs corresponding to
// items in the shopping cart
LPCSTR m_lpShoppingCartID[64]; // Array to list Product IDs corresponding
// to items in the shopping cart
// eSellerate serial number data
LONG m_nSerialNumberCount; // Number of serial numbers issued
LPCSTR m_lpSerialNumberID[64]; // Array to list Product IDs corresponding
// to listed serial numbers
LPCSTR m_lpSerialNumber[64]; // Array to list serial numbers

LPCSTR m_lpSerialNumberKey[64]; // Array to list Name-based Keys
// corresponding to listed serial numbers
// eSellerate file location data
LONG m_nFileLocationCount; // Number of files downloaded
LPCSTR m_lpFileLocationID[64]; // Array to list Product IDs corresponding
// to downloaded files

LPCSTR m_lpFileLocation[64]; // Array to list locations of downloaded
// files

};

In order to correctly format the information defined in the CViseEntryData class, your external code must include the following line:

CViseEntryData* pViseEntryData = (CViseEntryData*)dwReserved;

You may then access the CViseEntryData class information in your external code using the following convention:

pViseEntryData->m_lpszTempDir;


Now, how can I use the above code in UserInfo? Which function should I call in the "extern "C" LONG CALLBACK ViseEntry(LONG lParam1, LPCSTR lpParam2, DWORD dwReserved)" function?

Thanks in advance!


The file Source\exehead\exec.c can be found in the folder where you've installed NSIS.

I suggest you copy the code in GetAccountType from UserInfo.c into your ViseEntry and adjust it to fit. Calling GetAccountType from ViseEntry is a mess not worth getting into.