Click here to Skip to main content
15,884,702 members
Articles / Programming Languages / C++/CLI

Enhanced .NET Bootstrap Setup

Rate me:
Please Sign up or sign in to vote.
4.89/5 (61 votes)
24 Nov 20053 min read 726K   7.2K   134  
Modified Microsoft Setup program to install required IE6, MSI 2.0 and .NET.
// 
//   Copyright (c) Microsoft Corporation.  All rights reserved.
// 
/// ==========================================================================
// Name    :    main.h
// Purpose :    #ncludes, prototypes, globals, and const 
//              definitions for setup sample

// prototypes
DWORD   ExecCmd( LPCTSTR pszCmd );
DWORD   runExe( LPCTSTR pszCmd );
BOOL    FxInstallRequired();
HRESULT GetFileVersion( LPTSTR filename, VS_FIXEDFILEINFO *pvsf );
HRESULT LastError();
BOOL    InitiateReboot();
BOOL    Reboot(DWORD dwResult);
BOOL    HandleResult(DWORD dwResult);
BOOL    ValidateProductSuite (LPSTR lpszSuiteToValidate);
void    SetTSInInstallMode();
BOOL    IsTerminalServicesEnabled();
void    ShowBillboard(DWORD * pdwThreadId, HANDLE * phThread);
void    TeardownBillboard(DWORD dwThreadId, HANDLE hThread);
DWORD   WINAPI StaticThreadProc( LPVOID lpParameter );
BOOL    CALLBACK BillboardProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam);
size_t		getStringIndex(char *searchStr, char *searchFor);
void checkIE();
void checkMSI();
void checkMDAC();
void checkMSDE();
void checkDotNetServicePack();
void checkExtraProgram1();
BOOL checkMSDEService();
BOOL IsServiceAvailable( LPCTSTR service_name );
void InsertRegistryRun();
void RemoveRegistryRun();
BOOL SetWorkingDir();
void setBillBoardText(LPTSTR text);
INT_PTR CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);

//    Private message to tell the thread to destroy the window
const UINT  PWM_THREADDESTROYWND = WM_USER; 

// single instance data
//
const TCHAR g_tszBootstrapMutexName[] = _T( "NDP FxApp Install Bootstrapper" );

// dotnetfx.exe installer app name
// and command-line args
//
const TCHAR g_tszFxInstaller[] = _T("dotnetfx.exe");
const TCHAR g_tszFxInstallerCmdLine[] = _T("/q:a /c:\"install /l /q\"");

// msi 2.0 installer
const TCHAR g_tszMSINT[] = _T("%s\\InstMsiW.exe");
const TCHAR g_tszMSI98[] = _T("%s\\InstMsiA.exe");

//IE 6.01
const TCHAR g_tszIE6[] = _T("%s\\ie6setup.exe /Q:A");


// msi install cmd-line
//
const TCHAR g_tszMsiCmdLine[] = _T("%s\\Msiexec.exe /I %s REBOOT=ReallySuppress");

// MDAC
const TCHAR g_tszMDAC[] = _T("MDAC_TYP.EXE");
const TCHAR g_tszMDACCmdLine[] = _T("%s\\MDAC_TYP.EXE /Q:A /C:\"dasetup.exe /Q /N\"");

// MSDE
const TCHAR g_tszMSDE[] = _T("setup.exe");
const TCHAR g_tszMSDECmdLine[] = _T("%s\\setup.exe %s");

// reg key for fx policy info
// used to detect if fx is installed
// this key resides in HKEY_LOCAL_MACHINE
const TCHAR g_tszFxRegKey[] = _T("SOFTWARE\\Microsoft\\.NETFramework\\policy\\");

// reg key for IE
// used to detect if fx is installed
// this key resides in HKEY_LOCAL_MACHINE
//const TCHAR g_tszIERegKey[] = _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings");
const TCHAR g_tszIERegKey[] = _T("SOFTWARE\\Microsoft\\Internet Explorer");
const TCHAR g_tszIERegKeyValue[] = _T("Version");

const TCHAR g_tszMSIRegKey[] = _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer");
const TCHAR g_tszMSIRegKeyValue[] = _T("InstallerLocation");

//MDAC
const TCHAR g_tszMDACRegKey[] = _T("SOFTWARE\\Microsoft\\DataAccess");
const TCHAR g_tszMDACRegKeyValue[] = _T("FullInstallVer");

//MSDE
const TCHAR g_tszMSDERegKey[] = _T("SOFTWARE\\Microsoft\\Microsoft SQL Server");
const TCHAR g_tszMSDERegKeyValue[] = _T("InstalledInstances");

const TCHAR   g_tszTSChangeUserToInstall[] = _T("change user /INSTALL");
// ini-based application settings
//
const TCHAR    c_dotNetInstaller[] = _T("InstallBootstrap");
const TCHAR    c_Reg_Run[] = _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");

//FX Service Pack
const TCHAR g_tszFxServicePackRegKey[] = _T("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v1.1.4322");
const TCHAR g_tszFxServicePackRegKeyValue[] = _T("SP");

bool IENeedsInstalling = false;
bool MSINeedsInstalling = false;
bool DotNetINeedsInstalling = false;
bool MDACNeedsInstalling = false;
bool MSDENeedsInstalling = false;
bool FxServicePackNeedsInstalling = false;
bool ExtraProgramPath1NeedsInstalling = false;

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions