The recommended guide for writing a setup program is the Setup API documentation in the Win32 SDK.
The Setup API documentation includes a sample setup program template and online Help that explains how to use the template. It also provides many functions you will need, including those that control basic user dialog boxes. You may need to create additional custom dialog boxes.
The Microsoft Exchange Server SDK provides a sample gateway setup program called GWSETUP. It is located in the directory \BKOFFICE\SAMPLES\EXCHANGE\GWSETUP.