Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Uninstallshield, shared files & custom DLL problem

1 view
Skip to first unread message

Darlene Ruben

unread,
Jul 5, 2000, 3:00:00 AM7/5/00
to
I have a custom uninstall DLL that checks the reference count of a shared
DLL. If the DLL is to be removed along with the application (being the last
app to use it), my uninstall DLL will unregister the shared DLL (the
installed DLL contains ActiveX controls that must be unregistered).
Uninstallshield will run my custom DLL and when it completes the
UninstInitialize function (completing the regsvr32 task), the next process
would be to remove the shared DLL (normally Uninstallshield displays the
Shared file dialog to let the user decide whether to remove the file or
not). However, at this point Uninstallshield terminates and removes nothing
except the .isu file for the application. If I remove the DLL from the
Uninst.exe command line, the uninstall runs fine.

Any ideas on why a custom DLL and Uninstallshield -> shared files removal
would be incompatible?

Thanks in advance for all help


Darlene Ruben

unread,
Jul 6, 2000, 3:00:00 AM7/6/00
to
For those interested, many thanks to Friedrich Brunzema for providing the
following solution that works quite well:

HRESULT UnregisterMyInprocServer(LPCTSTR szFullPathToServer);

/* Name: A::UnregisterMyInprocServer @func
Description: Unregisters an Inproc Server (.DLL, .OCX) by calling
DLLUnregisterServer
This will not work with LocalServers (.EXE files)!
@parm LPTCSTR | szFullPathToServer | Full path to the server
@rdesc HRESULT - S_OK if peach, E_FAIL otherwise */

HRESULT UnregisterMyInprocServer(LPCTSTR szFullPathToServer)
{
HRESULT hRet; // return code HRESULT
HANDLE hDLL; // handle to loaded library

// this is the weird typedef I was talking about
typedef HRESULT (__stdcall * LPFNDLLFUNC1)(void);

// declare an instance variable of it
LPFNDLLFUNC1 MyDllUnregisterServer = NULL;

// sanity check #1, use #include "shlwapi.h" & use shlwapi.lib in the
linker
if (!PathFileExists(szFullPathToServer))
return E_FAIL;

// load the library
hDLL = LoadLibrary(szFullPathToServer);

// other sanity check
if (!hDLL)
return E_FAIL;

// Ok, find the address of the Unregister function
MyDllUnregisterServer = (LPFNDLLFUNC1)GetProcAddress((HINSTANCE)hDLL,
"DllUnregisterServer");

// This should have work if its a COM server (.OCX, .DLL)
if (!MyDllUnregisterServer)
return E_FAIL;

// Unregister!
hRet = MyDllUnregisterServer();

// and free the library, otherwise installshield uninstaller will
complain
FreeLibrary((HMODULE)hDLL);

return S_OK;
}

Just call UnregisterMyInprocServer(_T("c:\\...\\yourcomserver.dll")); and it
should unregister, as well as unmap the com server from the uninstaller
process memory.

----------------------------------------------------------------------------
--------------------------------------------------------


Darlene Ruben <dru...@xvault.com> wrote in message
news:39633...@208.30.171.38...

0 new messages