Creating Custom Setup Code for Sample Gateway
| Nik Okuntseff |
MS Exchange Server Programming |
Creating Custom Setup Code for Sample Gateway
A useful exercise in writing gateway installation programs would be writing
your own setup code for Microsoft's sample gateway. Suppose you have installed
and then removed sample gateway from Exchange server with Microsoft's setup.exe
program. How difficult would it be to write your own setup code for their
gateway?
One interesting feature of their setup program is that gateway removal
does not remove Addr-Type object and administrator Extension object from
the directory. The uninstall process does not remove files from the system,
such as proxy generator DLL and a few others copied during setup. Gateway
bit also stays set. All this makes our task a little bit easier.
The following little fragment illustrates how a simple installation
program may be written in this "partially prepared" installation.
/*
* This main program illustrates sequence of operations for reinstalling
* sample gateway after it was removed.
*/
int main( void )
{
BOOL bResult = CopyFiles();
if ( !bResult )
throw ( -1 );
bResult = InstallGatewayAsService();
if ( !bResult )
throw ( -1 );
bResult = CreateMailGateway();
if ( !bResult )
throw ( -1 );
/*
bResult = InstallAddressType();
if ( !bResult )
throw ( -1 );
*/
return ( 0 );
}
All four functions referenced in the code are custom-written (you may
find them in Gw/Install/CompleteSetup sample in the main.cpp file). They accomplish
the following tasks:
-
CopyFiles prepares (creates) directory structure for sample gateway and
copies gateway executable file there.
-
InstallGatewayAsService communicates with the service control manager and
installs gateway as a Windows NT service. It also sets additional registry
data needed for this service to run.
-
CreateMailGateway creates Mail-Gateway object in MS Exchange directory.
-
InstallAddressType installs an Addr-Type object in MS Exchange directory.
It is commented out in my fragment because sample gateway uninstall program
does not remove this object from the directory. However, you may manually
delete it (Edit - Delete Raw Object menu) with Exchange Administrator,
and then use this function.
We may see that the above code does not care about Gateway bit, installation
of Extension object to Administrator program (custom property pages), and
a few other things that a complete setup program would normally do. However,
this example shows how we can start writing useful installation programs.
[ Contents |
Home
]
Send comments and suggestions to niko@wrconsulting.com
Copyright © 1997-1998 by Nik Okuntseff
|