diff options
author | Internet Software Consortium, Inc <@isc.org> | 2007-09-07 14:13:49 -0600 |
---|---|---|
committer | LaMont Jones <lamont@debian.org> | 2007-09-07 14:13:49 -0600 |
commit | 145708f190bab1a282c04698db8f36f614ae7ac0 (patch) | |
tree | c56976d39ff8a40fff16ad71cd4620eabfe807e4 /bin/win32/BINDInstall | |
parent | 34691e625b8862a666f95b0ee39c10156ae6b9c6 (diff) | |
download | bind9-145708f190bab1a282c04698db8f36f614ae7ac0.tar.gz |
9.2.0b2
Diffstat (limited to 'bin/win32/BINDInstall')
-rw-r--r-- | bin/win32/BINDInstall/BINDInstall.cpp | 105 | ||||
-rw-r--r-- | bin/win32/BINDInstall/BINDInstall.dsp | 204 | ||||
-rw-r--r-- | bin/win32/BINDInstall/BINDInstall.dsw | 29 | ||||
-rw-r--r-- | bin/win32/BINDInstall/BINDInstall.h | 64 | ||||
-rw-r--r-- | bin/win32/BINDInstall/BINDInstall.mak | 279 | ||||
-rw-r--r-- | bin/win32/BINDInstall/BINDInstall.rc | 293 | ||||
-rw-r--r-- | bin/win32/BINDInstall/BINDInstallDlg.cpp | 1104 | ||||
-rw-r--r-- | bin/win32/BINDInstall/BINDInstallDlg.h | 117 | ||||
-rw-r--r-- | bin/win32/BINDInstall/DirBrowse.cpp | 103 | ||||
-rw-r--r-- | bin/win32/BINDInstall/DirBrowse.h | 71 | ||||
-rw-r--r-- | bin/win32/BINDInstall/StdAfx.cpp | 8 | ||||
-rw-r--r-- | bin/win32/BINDInstall/StdAfx.h | 26 | ||||
-rw-r--r-- | bin/win32/BINDInstall/VersionInfo.cpp | 286 | ||||
-rw-r--r-- | bin/win32/BINDInstall/VersionInfo.h | 62 | ||||
-rw-r--r-- | bin/win32/BINDInstall/res/BINDInstall.ico | bin | 0 -> 1078 bytes | |||
-rw-r--r-- | bin/win32/BINDInstall/res/BINDInstall.rc2 | 13 | ||||
-rw-r--r-- | bin/win32/BINDInstall/resource.h | 90 |
17 files changed, 2854 insertions, 0 deletions
diff --git a/bin/win32/BINDInstall/BINDInstall.cpp b/bin/win32/BINDInstall/BINDInstall.cpp new file mode 100644 index 00000000..2d75e0d3 --- /dev/null +++ b/bin/win32/BINDInstall/BINDInstall.cpp @@ -0,0 +1,105 @@ +/* + * Portions Copyright (C) 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: BINDInstall.cpp,v 1.3 2001/07/31 00:03:11 gson Exp $ */ + +/* + * Copyright (c) 1999-2000 by Nortel Networks Corporation + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND NORTEL NETWORKS DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NORTEL NETWORKS + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "stdafx.h" +#include "BINDInstall.h" +#include "BINDInstallDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CBINDInstallApp + +BEGIN_MESSAGE_MAP(CBINDInstallApp, CWinApp) + //{{AFX_MSG_MAP(CBINDInstallApp) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CBINDInstallApp construction + +CBINDInstallApp::CBINDInstallApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CBINDInstallApp object + +CBINDInstallApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CBINDInstallApp initialization + +BOOL CBINDInstallApp::InitInstance() +{ + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + CBINDInstallDlg dlg; + m_pMainWnd = &dlg; + int nResponse = dlg.DoModal(); + if (nResponse == IDOK) + { + // TODO: Place code here to handle when the dialog is + // dismissed with OK + } + else if (nResponse == IDCANCEL) + { + // TODO: Place code here to handle when the dialog is + // dismissed with Cancel + } + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} diff --git a/bin/win32/BINDInstall/BINDInstall.dsp b/bin/win32/BINDInstall/BINDInstall.dsp new file mode 100644 index 00000000..a9002a4c --- /dev/null +++ b/bin/win32/BINDInstall/BINDInstall.dsp @@ -0,0 +1,204 @@ +# Microsoft Developer Studio Project File - Name="BINDInstall" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=BINDInstall - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "BINDInstall.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "BINDInstall.mak" CFG="BINDInstall - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "BINDInstall - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "BINDInstall - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "BINDInstall - Win32 Release" + +# PROP BASE Use_MFC 5 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /I "..\..\..\include" /I "..\..\named\win32\include" /I "..\..\..\lib\isc\win32\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 version.lib /nologo /subsystem:windows /pdb:none /machine:I386 /out:"..\..\..\Build\Release\BINDInstall.exe" + +!ELSEIF "$(CFG)" == "BINDInstall - Win32 Debug" + +# PROP BASE Use_MFC 5 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\include" /I "..\..\..\include" /I "..\..\named\win32\include" /I "..\..\..\lib\isc\win32\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 version.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /out:"..\..\..\Build\Debug\BINDInstall.exe" + +!ENDIF + +# Begin Target + +# Name "BINDInstall - Win32 Release" +# Name "BINDInstall - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\BINDInstall.cpp +# End Source File +# Begin Source File + +SOURCE=.\BINDInstallDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\DirBrowse.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\VersionInfo.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\BINDInstall.h +# End Source File +# Begin Source File + +SOURCE=.\BINDInstallDlg.h +# End Source File +# Begin Source File + +SOURCE=.\DirBrowse.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\VersionInfo.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\BINDInstall.ico +# End Source File +# Begin Source File + +SOURCE=.\res\BINDInstall.rc2 +# End Source File +# Begin Source File + +SOURCE=.\res\check.ico +# End Source File +# Begin Source File + +SOURCE=.\res\clock1.ico +# End Source File +# Begin Source File + +SOURCE=.\res\clock2.ico +# End Source File +# Begin Source File + +SOURCE=.\res\clock3.ico +# End Source File +# Begin Source File + +SOURCE=.\res\clock4.ico +# End Source File +# Begin Source File + +SOURCE=.\res\clock5.ico +# End Source File +# Begin Source File + +SOURCE=.\res\clock6.ico +# End Source File +# Begin Source File + +SOURCE=.\res\clock7.ico +# End Source File +# Begin Source File + +SOURCE=.\res\clock8.ico +# End Source File +# Begin Source File + +SOURCE=.\res\icon1.ico +# End Source File +# Begin Source File + +SOURCE=.\res\x.ico +# End Source File +# End Group +# Begin Source File + +SOURCE=.\BINDInstall.rc +# End Source File +# End Target +# End Project diff --git a/bin/win32/BINDInstall/BINDInstall.dsw b/bin/win32/BINDInstall/BINDInstall.dsw new file mode 100644 index 00000000..d16a45cc --- /dev/null +++ b/bin/win32/BINDInstall/BINDInstall.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "BINDInstall"=.\BINDInstall.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/bin/win32/BINDInstall/BINDInstall.h b/bin/win32/BINDInstall/BINDInstall.h new file mode 100644 index 00000000..852d3af9 --- /dev/null +++ b/bin/win32/BINDInstall/BINDInstall.h @@ -0,0 +1,64 @@ +/* + * Portions Copyright (C) 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: BINDInstall.h,v 1.3 2001/07/31 00:03:12 gson Exp $ */ + +/* + * Copyright (c) 1999-2000 by Nortel Networks Corporation + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND NORTEL NETWORKS DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NORTEL NETWORKS + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifndef BINDINSTALL_H +#define BINDINSTALL_H + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + +class CBINDInstallApp : public CWinApp +{ +public: + CBINDInstallApp(); + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CBINDInstallApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + + //{{AFX_MSG(CBINDInstallApp) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +#endif diff --git a/bin/win32/BINDInstall/BINDInstall.mak b/bin/win32/BINDInstall/BINDInstall.mak new file mode 100644 index 00000000..2ea45586 --- /dev/null +++ b/bin/win32/BINDInstall/BINDInstall.mak @@ -0,0 +1,279 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on BINDInstall.dsp +!IF "$(CFG)" == "" +CFG=BINDInstall - Win32 Debug +!MESSAGE No configuration specified. Defaulting to BINDInstall - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "BINDInstall - Win32 Release" && "$(CFG)" != "BINDInstall - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "BINDInstall.mak" CFG="BINDInstall - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "BINDInstall - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "BINDInstall - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "BINDInstall - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "..\..\..\Build\Release\BINDInstall.exe" + + +CLEAN : + -@erase "$(INTDIR)\BINDInstall.obj" + -@erase "$(INTDIR)\BINDInstall.pch" + -@erase "$(INTDIR)\BINDInstall.res" + -@erase "$(INTDIR)\BINDInstallDlg.obj" + -@erase "$(INTDIR)\DirBrowse.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\VersionInfo.obj" + -@erase "..\..\..\Build\Release\BINDInstall.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\include" /I "..\..\..\include" /I "..\..\named\win32\include" /I "..\..\..\lib\isc\win32\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /Fp"$(INTDIR)\BINDInstall.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\BINDInstall.res" /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\BINDInstall.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=version.lib /nologo /subsystem:windows /pdb:none /machine:I386 /out:"..\..\..\Build\Release\BINDInstall.exe" +LINK32_OBJS= \ + "$(INTDIR)\BINDInstall.obj" \ + "$(INTDIR)\BINDInstallDlg.obj" \ + "$(INTDIR)\DirBrowse.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\VersionInfo.obj" \ + "$(INTDIR)\BINDInstall.res" + +"..\..\..\Build\Release\BINDInstall.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "BINDInstall - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +ALL : "..\..\..\Build\Debug\BINDInstall.exe" "$(OUTDIR)\BINDInstall.bsc" + + +CLEAN : + -@erase "$(INTDIR)\BINDInstall.obj" + -@erase "$(INTDIR)\BINDInstall.pch" + -@erase "$(INTDIR)\BINDInstall.res" + -@erase "$(INTDIR)\BINDInstall.sbr" + -@erase "$(INTDIR)\BINDInstallDlg.obj" + -@erase "$(INTDIR)\BINDInstallDlg.sbr" + -@erase "$(INTDIR)\DirBrowse.obj" + -@erase "$(INTDIR)\DirBrowse.sbr" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\StdAfx.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(INTDIR)\VersionInfo.obj" + -@erase "$(INTDIR)\VersionInfo.sbr" + -@erase "$(OUTDIR)\BINDInstall.bsc" + -@erase "..\..\..\Build\Debug\BINDInstall.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\include" /I "..\..\..\include" /I "..\..\named\win32\include" /I "..\..\..\lib\isc\win32\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\BINDInstall.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\BINDInstall.res" /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\BINDInstall.bsc" +BSC32_SBRS= \ + "$(INTDIR)\BINDInstall.sbr" \ + "$(INTDIR)\BINDInstallDlg.sbr" \ + "$(INTDIR)\DirBrowse.sbr" \ + "$(INTDIR)\StdAfx.sbr" \ + "$(INTDIR)\VersionInfo.sbr" + +"$(OUTDIR)\BINDInstall.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=version.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /out:"..\..\..\Build\Debug\BINDInstall.exe" +LINK32_OBJS= \ + "$(INTDIR)\BINDInstall.obj" \ + "$(INTDIR)\BINDInstallDlg.obj" \ + "$(INTDIR)\DirBrowse.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\VersionInfo.obj" \ + "$(INTDIR)\BINDInstall.res" + +"..\..\..\Build\Debug\BINDInstall.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("BINDInstall.dep") +!INCLUDE "BINDInstall.dep" +!ELSE +!MESSAGE Warning: cannot find "BINDInstall.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "BINDInstall - Win32 Release" || "$(CFG)" == "BINDInstall - Win32 Debug" +SOURCE=.\BINDInstall.cpp + +!IF "$(CFG)" == "BINDInstall - Win32 Release" + + +"$(INTDIR)\BINDInstall.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\BINDInstall.pch" + + +!ELSEIF "$(CFG)" == "BINDInstall - Win32 Debug" + + +"$(INTDIR)\BINDInstall.obj" "$(INTDIR)\BINDInstall.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\BINDInstall.pch" + + +!ENDIF + +SOURCE=.\BINDInstallDlg.cpp + +!IF "$(CFG)" == "BINDInstall - Win32 Release" + + +"$(INTDIR)\BINDInstallDlg.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\BINDInstall.pch" + + +!ELSEIF "$(CFG)" == "BINDInstall - Win32 Debug" + + +"$(INTDIR)\BINDInstallDlg.obj" "$(INTDIR)\BINDInstallDlg.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\BINDInstall.pch" + + +!ENDIF + +SOURCE=.\DirBrowse.cpp + +!IF "$(CFG)" == "BINDInstall - Win32 Release" + + +"$(INTDIR)\DirBrowse.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\BINDInstall.pch" + + +!ELSEIF "$(CFG)" == "BINDInstall - Win32 Debug" + + +"$(INTDIR)\DirBrowse.obj" "$(INTDIR)\DirBrowse.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\BINDInstall.pch" + + +!ENDIF + +SOURCE=.\StdAfx.cpp + +!IF "$(CFG)" == "BINDInstall - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /GX /O2 /I "..\include" /I "..\..\..\include" /I "..\..\named\win32\include" /I "..\..\..\lib\isc\win32\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /Fp"$(INTDIR)\BINDInstall.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\BINDInstall.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "BINDInstall - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\include" /I "..\..\..\include" /I "..\..\named\win32\include" /I "..\..\..\lib\isc\win32\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\BINDInstall.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\StdAfx.sbr" "$(INTDIR)\BINDInstall.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\VersionInfo.cpp + +!IF "$(CFG)" == "BINDInstall - Win32 Release" + + +"$(INTDIR)\VersionInfo.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\BINDInstall.pch" + + +!ELSEIF "$(CFG)" == "BINDInstall - Win32 Debug" + + +"$(INTDIR)\VersionInfo.obj" "$(INTDIR)\VersionInfo.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\BINDInstall.pch" + + +!ENDIF + +SOURCE=.\BINDInstall.rc + +"$(INTDIR)\BINDInstall.res" : $(SOURCE) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + + +!ENDIF + diff --git a/bin/win32/BINDInstall/BINDInstall.rc b/bin/win32/BINDInstall/BINDInstall.rc new file mode 100644 index 00000000..fe29c97d --- /dev/null +++ b/bin/win32/BINDInstall/BINDInstall.rc @@ -0,0 +1,293 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif //_WIN32\r\n" + "#include ""res\\BINDInstall.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\BINDInstall.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_BINDINSTALL_DIALOG DIALOGEX 0, 0, 210, 234 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "BIND 9 Installer" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Target Directory:",IDC_STATIC,7,69,54,8 + EDITTEXT IDC_TARGETDIR,7,82,196,14,ES_AUTOHSCROLL + GROUPBOX "Progress",IDC_STATIC,7,157,196,70 + RTEXT "",IDC_COPY_TAG,10,191,84,8 + LTEXT "",IDC_COPY_FILE,100,191,97,8 + RTEXT "",IDC_SERVICE_TAG,10,202,84,8 + LTEXT "",IDC_REG_SERVICE,100,203,97,8 + RTEXT "",IDC_MESSAGE_TAG,10,213,84,8 + DEFPUSHBUTTON "&Install",IDC_INSTALL,153,7,50,14 + LTEXT "",IDC_REG_MESSAGE,100,214,97,8 + RTEXT "",IDC_DIR_TAG,10,180,84,8 + PUSHBUTTON "E&xit",IDC_EXIT,153,39,50,14 + CONTROL "&Automatic Startup",IDC_AUTO_START,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,14,112,72,10 + GROUPBOX "Options",IDC_STATIC,7,102,196,49 + PUSHBUTTON "&Uninstall",IDC_UNINSTALL,153,23,50,14 + CTEXT "Version Unknown",IDC_VERSION,7,7,61,10,SS_CENTERIMAGE | + SS_SUNKEN + CONTROL "&Keep Config Files After Uninstall",IDC_KEEP_FILES, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,122,116,10 + PUSHBUTTON "Browse",IDC_BROWSE,7,22,50,14 + RTEXT "Current Operation:",IDC_CURRENT_TAG,36,166,58,8 + LTEXT "",IDC_CURRENT,100,166,97,8 + LTEXT "",IDC_CREATE_DIR,100,180,97,8 + CONTROL "&Start BIND Service After Install",IDC_START,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,14,132,113,10 +END + +IDD_BROWSE DIALOG DISCARDABLE 0, 0, 227, 117 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select Directory" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,170,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,170,24,50,14 + LISTBOX IDC_DIRLIST,7,28,155,82,LBS_SORT | LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_CURDIR,7,7,155,14,ES_AUTOHSCROLL + COMBOBOX IDC_DRIVES,170,98,50,74,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,5,0,0 + PRODUCTVERSION 1,5,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Internet Software Consortium\0" + VALUE "FileDescription", "ISC BIND Install Utility\0" + VALUE "FileVersion", "1.5.0\0" + VALUE "InternalName", "BINDInstall\0" + VALUE "LegalCopyright", "Copyright © 2000\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "BINDInstall.EXE\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "ISC BIND\0" + VALUE "ProductVersion", "9.2.0\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_BINDINSTALL_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 227 + END + + IDD_BROWSE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 220 + TOPMARGIN, 7 + BOTTOMMARGIN, 110 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_MAINFRAME "BIND 9 Installer" + IDS_CREATEDIR "Directory %s does not exist.\nDo you wish to create it?" + IDS_SUCCESS "BIND installation completed successfully" + IDS_FAIL "BIND installation failed" + IDS_DIREXIST "Directory %s exists.\n Install here anyway?" + IDS_INSTALL_DIR "Create Directories..." + IDS_INSTALL_FILE "Copy Files..." + IDS_INSTALL_SERVICE "Register Service..." + IDS_INSTALL_MESSAGE "Register Messages..." + IDS_UNINSTALL "Do you wish to uninstall BIND?" + IDS_UNINSTALL_DONE "BIND Uninstall Completed" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CREATE_KEY "Creating BIND registry key" + IDS_ADD_REMOVE "Setting up Add/Remove Programs entry" + IDS_CLEANUP "Cleaning up" + IDS_INSTALL_DONE "Finished Installing" + IDS_CREATE_DIR "Creating directory %s" + IDS_REMOVE_DIR "Removing directory %s" + IDS_COPY_FILE "Copying file %s" + IDS_DELETE_FILE "Deleting file %s" + IDS_OPEN_SCM "Opening Service Control Manager" + IDS_CREATE_SERVICE "Creating BIND service" + IDS_OPEN_SERVICE "Opening BIND service" + IDS_REMOVE_SERVICE "Removing BIND service" + IDS_REGISTER_MESSAGES "Registering BIND message source" + IDS_UNREGISTER_MESSAGES "Unregistering BIND message source" + IDS_STOP_SERVICE "Stopping BIND service" + IDS_START_SERVICE "Starting BIND service" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_UNINSTALL_DIR "Remove Directories..." + IDS_UNINSTALL_FILES "Delete Files..." + IDS_UNINSTALL_SERVICE "Unregister Service..." + IDS_UNINSTALL_MESSAGE "Unregister Messages..." + IDS_ERR_OPEN_SCM "Could not open Service Control Manager\n(%s)" + IDS_ERR_OPEN_SERVICE "Could not open BIND Service\n(%s)" + IDS_ERR_STOP_SERVICE "Could not stop BIND Service\n(%s)" + IDS_ERR_NONCRIT_FILE "An error occurred while copying non-critical file %s\n(%s)\nDo you wish to continue?" + IDS_ERR_COPY_FILE "An error occurred while copying file %s\n(%s)\nInstallation will be terminated" + IDS_ERR_CREATE_SERVICE "Error creating service\n(%s)" + IDS_ERR_REMOVE_SERVICE "Error removing service\n(%s)" + IDS_REBOOT "BINDInstall needs to restart Windows.\nDo you wish to restart now?" + IDS_BAD_PRIVILEGES "This user cannot acquire the privileges necessary to install BIND. Please ensure you are logged on as a member of the Administrators group." + IDS_ERR_CREATE_DIR "An error occurred while creating directory %s\n(%s)" + IDS_VERSION "Version %s" + IDS_ERR_CREATE_KEY "An error occured while creating registry keys\n(%s)" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ERR_SET_VALUE "An error occured while setting registry key values\n(%s)" + IDS_NO_VERSION "Version Unknown" + IDS_EXISTING_NEWER "%s\nThe existing version of this file is newer than the version being installed.\nDo you wish to overwrite the existing file?" + IDS_FILE_BAD "Could not retrieve version info for file %s. Do you wish to continue?\n(Continuing may overwrite a newer version of the file) " +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif //_WIN32 +#include "res\BINDInstall.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/bin/win32/BINDInstall/BINDInstallDlg.cpp b/bin/win32/BINDInstall/BINDInstallDlg.cpp new file mode 100644 index 00000000..3f86cf99 --- /dev/null +++ b/bin/win32/BINDInstall/BINDInstallDlg.cpp @@ -0,0 +1,1104 @@ +/* + * Portions Copyright (C) 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: BINDInstallDlg.cpp,v 1.6 2001/07/31 00:03:13 gson Exp $ */ + +/* + * Copyright (c) 1999-2000 by Nortel Networks Corporation + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND NORTEL NETWORKS DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NORTEL NETWORKS + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * Define this to make a standalone installer that will copy msvcrt.dll + * and/or msvcrtd.dll during the install + */ +// #define BINARIES_INSTALL + +/* + * msvcrt.dll is the release c-runtime library for MSVC. msvcrtd.dll is the debug + * c-runtime library for MSVC. If you have debug binaries you want to have DEBUG_BINARIES + * defined. If you have release binaries you want to have RELEASE_BINARIES defined. + * If you have both, then define them both. + * Of course, you need msvcrt[d].dll present to install it! + */ +#ifdef BINARIES_INSTALL +// # define DEBUG_BINARIES +// # define RELEASE_BINARIES +#endif + +#include "stdafx.h" +#include "BINDInstall.h" +#include "BINDInstallDlg.h" +#include "DirBrowse.h" +#include <winsvc.h> +#include <named/ntservice.h> +#include <isc/bind_registry.h> +#include <direct.h> +#include "versioninfo.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +typedef struct _exception +{ + _exception(UINT string, ...); + + CString resString; +} Exception; + +_exception::_exception(UINT string, ...) +{ + CString format; + va_list va; + + format.LoadString(string); + + va_start(va, string); + resString.FormatV(format, va); + va_end(va); +} + +typedef struct _filedata +{ + enum FileDestinations {TargetDir, BinDir, EtcDir, WinSystem}; + enum FileImportance {Trivial, Normal, Critical}; + + char *filename; + int destination; + int importance; + BOOL checkVer; + +} FileData; + +const FileData installFiles[] = +{ +#ifdef BINARIES_INSTALL +# ifdef DEBUG_BINARIES + {"msvcrtd.dll", FileData::WinSystem, FileData::Critical, TRUE}, +# endif +# ifdef RELEASE_BINARIES + {"msvcrt.dll", FileData::WinSystem, FileData::Critical, TRUE}, +# endif +#endif + {"bindevt.dll", FileData::WinSystem, FileData::Normal, FALSE}, + {"libisc.dll", FileData::WinSystem, FileData::Critical, FALSE}, + {"libisccfg.dll", FileData::WinSystem, FileData::Critical, FALSE}, + {"libisccc.dll", FileData::WinSystem, FileData::Critical, FALSE}, + {"libdns.dll", FileData::WinSystem, FileData::Critical, FALSE}, + {"liblwres.dll", FileData::WinSystem, FileData::Critical, FALSE}, + {"libeay32.dll", FileData::WinSystem, FileData::Critical, FALSE}, + {"named.exe", FileData::BinDir, FileData::Critical, FALSE}, + {"nsupdate.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"BINDInstall.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"rndc.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"dig.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"host.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"nslookup.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"rndc-confgen.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"dnssec-keygen.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"dnssec-makekeyset.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"dnssec-signkey.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"dnssec-signzone.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"named-checkconf.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"named-checkzone.exe", FileData::BinDir, FileData::Normal, FALSE}, + {"readme1st.txt", FileData::BinDir, FileData::Trivial, FALSE}, + {NULL, -1, -1} +}; + +///////////////////////////////////////////////////////////////////////////// +// CBINDInstallDlg dialog + +CBINDInstallDlg::CBINDInstallDlg(CWnd* pParent /*=NULL*/) + : CDialog(CBINDInstallDlg::IDD, pParent) +{ + char buf[MAX_PATH]; + + //{{AFX_DATA_INIT(CBINDInstallDlg) + m_targetDir = _T(""); + m_version = _T(""); + m_autoStart = FALSE; + m_keepFiles = FALSE; + m_current = _T(""); + m_startOnInstall = FALSE; + //}}AFX_DATA_INIT + // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + m_reboot = FALSE; + + GetSystemDirectory(buf, MAX_PATH); + m_winSysDir = buf; + m_defaultDir = buf; + m_defaultDir += "\\dns"; +} + +void CBINDInstallDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CBINDInstallDlg) + DDX_Text(pDX, IDC_TARGETDIR, m_targetDir); + DDX_Text(pDX, IDC_VERSION, m_version); + DDX_Check(pDX, IDC_AUTO_START, m_autoStart); + DDX_Check(pDX, IDC_KEEP_FILES, m_keepFiles); + DDX_Text(pDX, IDC_CURRENT, m_current); + DDX_Check(pDX, IDC_START, m_startOnInstall); + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CBINDInstallDlg, CDialog) + //{{AFX_MSG_MAP(CBINDInstallDlg) + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + ON_BN_CLICKED(IDC_BROWSE, OnBrowse) + ON_BN_CLICKED(IDC_INSTALL, OnInstall) + ON_BN_CLICKED(IDC_EXIT, OnExit) + ON_BN_CLICKED(IDC_UNINSTALL, OnUninstall) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CBINDInstallDlg message handlers + +BOOL CBINDInstallDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + HANDLE hToken; + TOKEN_PRIVILEGES tkp; + BOOL adjustedPrivileges = FALSE; + + if(OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) + { + LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); + tkp.PrivilegeCount = 1; + tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + + AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); + + if(GetLastError() == ERROR_SUCCESS) + { + adjustedPrivileges = TRUE; + } + } + + if(!adjustedPrivileges) + { + MsgBox(IDS_BAD_PRIVILEGES, MB_OK); + EndDialog(1); + } + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + char filename[MAX_PATH]; + char dirname[MAX_PATH]; + char *fptr = &filename[0]; + GetModuleFileName(NULL, filename, MAX_PATH); + char *dptr = strrchr(filename,'\\'); + int index = dptr - fptr; + strncpy(dirname, filename, index); + dirname[index] = '\0'; + CString Dirname(dirname); + m_currentDir = Dirname; + + + CVersionInfo bindInst(filename); + if(bindInst.IsValid()) + m_version.Format(IDS_VERSION, bindInst.GetFileVersionString()); + else + m_version.LoadString(IDS_NO_VERSION); + + DWORD dwBufLen = MAX_PATH; + char buf[MAX_PATH]; + HKEY hKey; + + m_startOnInstall = CheckBINDService(); + + /* See if we are installed already */ + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, BIND_SUBKEY, 0, KEY_READ, &hKey) == ERROR_SUCCESS) + { + memset(buf, 0, MAX_PATH); + // Get the install directory + if(RegQueryValueEx(hKey, "InstallDir", NULL, NULL, (LPBYTE)buf, &dwBufLen) == ERROR_SUCCESS) + if(strcmp(buf, "")) + m_defaultDir = buf; + + RegCloseKey(hKey); + } + m_targetDir = m_defaultDir; + + // Set checkbox defaults + m_autoStart = TRUE; + m_keepFiles = TRUE; + + UpdateData(FALSE); + + return(TRUE); // return(TRUE unless you set the focus to a control +} + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CBINDInstallDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialog::OnPaint(); + } +} + +// The system calls this to obtain the cursor to display while the user drags +// the minimized window. +HCURSOR CBINDInstallDlg::OnQueryDragIcon() +{ + return((HCURSOR)m_hIcon); +} + +void CBINDInstallDlg::OnBrowse() +{ + + CDirBrowse browse; + + if(browse.DoModal() == IDOK) + { + //m_targetDir = browse.m_selectedDir; + UpdateData(FALSE); + } +} + +/* + * User pressed the exit button + */ +void CBINDInstallDlg::OnExit() +{ + EndDialog(0); +} + +/* + * User pressed the uninstall button. Make it go. + */ +void CBINDInstallDlg::OnUninstall() +{ + UpdateData(); + + if(MsgBox(IDS_UNINSTALL, MB_YESNO) == IDYES) + { + if(CheckBINDService()) + StopBINDService(); + + HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if(!hSCManager) + { + MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); + return; + } + + HANDLE hService = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); + if(!hService && GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST) + { + MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); + return; + } + + SERVICE_STATUS ss; + QueryServiceStatus(hService, &ss); + if(ss.dwCurrentState == SERVICE_RUNNING) + { + BOOL rc = ControlService(hService, SERVICE_CONTROL_STOP, &ss); + if(rc == FALSE || ss.dwCurrentState != SERVICE_STOPPED) + { + MsgBox(IDS_ERR_STOP_SERVICE, GetErrMessage()); + return; + } + + } + CloseServiceHandle(hService); + CloseServiceHandle(hSCManager); + + // Directories + m_etcDir = m_targetDir + "\\etc"; + m_binDir = m_targetDir + "\\bin"; + + UninstallTags(); + UnregisterMessages(TRUE); + UnregisterService(TRUE); + DeleteFiles(TRUE); + if(m_keepFiles == FALSE) + RemoveDirs(TRUE); + else + GetDlgItem(IDC_CREATE_DIR)->SetWindowText("Not Removed"); + + + // Delete registry keys for named + RegDeleteKey(HKEY_LOCAL_MACHINE, BIND_SESSION_SUBKEY); + RegDeleteKey(HKEY_LOCAL_MACHINE, BIND_SUBKEY); + RegDeleteKey(HKEY_LOCAL_MACHINE, BIND_UNINSTALL_SUBKEY); + + ProgramGroup(FALSE); + + SetCurrent(IDS_UNINSTALL_DONE); + MsgBox(IDS_UNINSTALL_DONE); + } +} + +/* + * User pressed the install button. Make it go. + */ +void CBINDInstallDlg::OnInstall() +{ + BOOL success = FALSE; + + if(CheckBINDService()) + StopBINDService(); + + InstallTags(); + + UpdateData(); + + // Directories + m_etcDir = m_targetDir + "\\etc"; + m_binDir = m_targetDir + "\\bin"; + + if(m_defaultDir != m_targetDir) + { + if(GetFileAttributes(m_targetDir) != 0xFFFFFFFF) + { + int install = MsgBox(IDS_DIREXIST, MB_YESNO | MB_ICONQUESTION, m_targetDir); + if(install == IDNO) + return; + } + else + { + int createDir = MsgBox(IDS_CREATEDIR, MB_YESNO | MB_ICONQUESTION, m_targetDir); + if(createDir == IDNO) + return; + } + } + + ProgramGroup(); + + try + { + CreateDirs(); + CopyFiles(); + RegisterService(); + RegisterMessages(); + + HKEY hKey; + + /* Create a new key for named */ + SetCurrent(IDS_CREATE_KEY); + if(RegCreateKey(HKEY_LOCAL_MACHINE, BIND_SUBKEY, &hKey) == ERROR_SUCCESS) + { + // Get the install directory + RegSetValueEx(hKey, "InstallDir", 0, REG_SZ, (LPBYTE)(LPCTSTR)m_targetDir, m_targetDir.GetLength()); + RegCloseKey(hKey); + } + + + SetCurrent(IDS_ADD_REMOVE); + if(RegCreateKey(HKEY_LOCAL_MACHINE, BIND_UNINSTALL_SUBKEY, &hKey) == ERROR_SUCCESS) + { + char winDir[MAX_PATH]; + CString buf(BIND_DISPLAY_NAME); + GetWindowsDirectory(winDir, MAX_PATH); + + RegSetValueEx(hKey, "DisplayName", 0, REG_SZ, (LPBYTE)(LPCTSTR)buf, buf.GetLength()); + + buf.Format("%s\\BINDInstall.exe", winDir); + RegSetValueEx(hKey, "UninstallString", 0, REG_SZ, (LPBYTE)(LPCTSTR)buf, buf.GetLength()); + RegCloseKey(hKey); + } + + ProgramGroup(); + + if(m_startOnInstall && !m_reboot) + StartBINDService(); + } + catch(Exception e) + { + MessageBox(e.resString); + SetCurrent(IDS_CLEANUP); + FailedInstall(); + MsgBox(IDS_FAIL); + return; + } + catch(DWORD dw) + { + CString msg; + msg.Format("A fatal error occured\n(%s)", GetErrMessage(dw)); + MessageBox(msg); + SetCurrent(IDS_CLEANUP); + FailedInstall(); + MsgBox(IDS_FAIL); + return; + } + + SetCurrent(IDS_INSTALL_DONE); + MsgBox(IDS_SUCCESS); + if(m_reboot) + { + if(MsgBox(IDS_REBOOT, MB_YESNO) == IDYES) + { + InitiateSystemShutdown(NULL, NULL, 0, TRUE, TRUE); + } + } +} + +/* + * Methods to do the work + */ +void CBINDInstallDlg::CreateDirs() +{ + /* s'OK if the directories already exist */ + SetCurrent(IDS_CREATE_DIR, m_targetDir); + if(!CreateDirectory(m_targetDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) + throw(Exception(IDS_ERR_CREATE_DIR, m_targetDir, GetErrMessage())); + + SetCurrent(IDS_CREATE_DIR, m_etcDir); + if(!CreateDirectory(m_etcDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) + throw(Exception(IDS_ERR_CREATE_DIR, m_etcDir, GetErrMessage())); + + SetCurrent(IDS_CREATE_DIR, m_binDir); + if(!CreateDirectory(m_binDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) + throw(Exception(IDS_ERR_CREATE_DIR, m_binDir, GetErrMessage())); + + SetItemStatus(IDC_CREATE_DIR); +} + +void CBINDInstallDlg::RemoveDirs(BOOL uninstall) +{ + if(!m_keepFiles) + { + SetCurrent(IDS_REMOVE_DIR, m_binDir); + // Check for existence then remove if present + if(GetFileAttributes(m_binDir) != 0xFFFFFFFF) + RemoveDirectory(m_binDir); + + SetCurrent(IDS_REMOVE_DIR, m_etcDir); + if(GetFileAttributes(m_etcDir) != 0xFFFFFFFF) + RemoveDirectory(m_etcDir); + + SetCurrent(IDS_REMOVE_DIR, m_targetDir); + if(GetFileAttributes(m_targetDir) != 0xFFFFFFFF) + RemoveDirectory(m_targetDir); + } + + if(uninstall) + SetItemStatus(IDC_CREATE_DIR, TRUE); +} + +void CBINDInstallDlg::CopyFiles() +{ + CString destFile; + + for(int i = 0; installFiles[i].filename; i++) + { + SetCurrent(IDS_COPY_FILE, installFiles[i].filename); + + destFile = DestDir(installFiles[i].destination) + "\\" + installFiles[i].filename; + CString filespec = m_currentDir + "\\" + installFiles[i].filename; + CVersionInfo bindFile(destFile); /* This file doesn't have to exist */ + + CVersionInfo origFile(filespec); + if(!origFile.IsValid() && installFiles[i].checkVer) + { + if(MsgBox(IDS_FILE_BAD, MB_YESNO, installFiles[i].filename) == IDNO) + throw(Exception(IDS_ERR_COPY_FILE, installFiles[i].filename, GetErrMessage())); + } + + try + { +/* Ignore Version checking. We need to make sure that all files get copied regardless + of whether or not they are earlier or later versions since we cannot guarantee + that we have either backward or forward compatibility between versions. +*/ + bindFile.CopyFileNoVersion(origFile); + } + catch(...) + { + if(installFiles[i].importance != FileData::Trivial) + { + if(installFiles[i].importance == FileData::Critical || + MsgBox(IDS_ERR_NONCRIT_FILE, MB_YESNO, installFiles[i].filename, GetErrMessage()) == IDNO) + { + SetItemStatus(IDC_COPY_FILE, FALSE); + throw(Exception(IDS_ERR_COPY_FILE, installFiles[i].filename, GetErrMessage())); + } + } + } + } + + SetItemStatus(IDC_COPY_FILE); +} + +void CBINDInstallDlg::DeleteFiles(BOOL uninstall) +{ + CString destFile; + + for(int i = 0; installFiles[i].filename; i++) + { + if(installFiles[i].checkVer) + continue; + + destFile = DestDir(installFiles[i].destination) + "\\" + installFiles[i].filename; + + if(uninstall) + SetCurrent(IDS_DELETE_FILE, installFiles[i].filename); + + DeleteFile(destFile); + } + + if(!m_keepFiles) + { + WIN32_FIND_DATA findData; + CString file = m_etcDir + "\\*.*"; + BOOL rc; + HANDLE hFile; + + hFile = FindFirstFile(file, &findData); + rc = hFile != INVALID_HANDLE_VALUE; + + while(rc == TRUE) + { + if(strcmp(findData.cFileName, ".") && strcmp(findData.cFileName, "..")) + { + file = m_etcDir + "\\" + findData.cFileName; + SetCurrent(IDS_DELETE_FILE, file); + DeleteFile(file); + } + rc = FindNextFile(hFile, &findData); + } + FindClose(hFile); + } + + if(uninstall) + SetItemStatus(IDC_COPY_FILE, TRUE); +} + + +void CBINDInstallDlg::RegisterService() +{ + HANDLE hSCManager; + HANDLE hService; + + SetCurrent(IDS_OPEN_SCM); + hSCManager= OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if(!hSCManager) + throw(Exception(IDS_ERR_OPEN_SCM, GetErrMessage())); + + DWORD dwStart = SERVICE_DEMAND_START; + if(m_autoStart) + dwStart = SERVICE_AUTO_START; + + DWORD dwServiceType = SERVICE_WIN32_OWN_PROCESS; + + CString namedLoc; + namedLoc.Format("%s\\bin\\named.exe", m_targetDir); + + SetCurrent(IDS_CREATE_SERVICE); + hService = CreateService(hSCManager, BIND_SERVICE_NAME, BIND_DISPLAY_NAME, SERVICE_ALL_ACCESS, dwServiceType, dwStart, + SERVICE_ERROR_NORMAL, namedLoc, NULL, NULL, NULL, NULL, NULL); + + if(!hService && GetLastError() != ERROR_SERVICE_EXISTS) + throw(Exception(IDS_ERR_CREATE_SERVICE, GetErrMessage())); + + if(hSCManager) + CloseServiceHandle(hSCManager); + + if(hService) + CloseServiceHandle(hService); + + SetItemStatus(IDC_REG_SERVICE); +} + +void CBINDInstallDlg::UnregisterService(BOOL uninstall) +{ + BOOL rc = FALSE; + HANDLE hSCManager; + HANDLE hService; + + while(1) + { + SetCurrent(IDS_OPEN_SCM); + hSCManager= OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if(!hSCManager && uninstall == TRUE) + { + MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); + break; + } + + SetCurrent(IDS_OPEN_SERVICE); + hService = OpenService(hSCManager, BIND_SERVICE_NAME, STANDARD_RIGHTS_REQUIRED); + if(!hService && uninstall == TRUE) + { + if(GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST) + { + MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); + break; + } + } + else + { + SetCurrent(IDS_REMOVE_SERVICE); + if(!DeleteService(hService) && uninstall == TRUE) + { + DWORD err = GetLastError(); + if(err != ERROR_SERVICE_MARKED_FOR_DELETE && err != ERROR_SERVICE_DOES_NOT_EXIST) + { + MsgBox(IDS_ERR_REMOVE_SERVICE, GetErrMessage()); + break; + } + } + } + + rc = TRUE; + break; + } + + if(hSCManager) + CloseServiceHandle(hSCManager); + + if(hService) + CloseServiceHandle(hService); + + if(uninstall) + SetItemStatus(IDC_REG_SERVICE, rc); +} + +void CBINDInstallDlg::RegisterMessages() +{ + HKEY hKey; + DWORD dwData; + char pszMsgDLL[MAX_PATH], buf[MAX_PATH]; + + GetSystemDirectory(buf, MAX_PATH); + sprintf(pszMsgDLL, "%s\\%s", buf, "bindevt.dll"); + + SetCurrent(IDS_REGISTER_MESSAGES); + /* Create a new key for named */ + if(RegCreateKey(HKEY_LOCAL_MACHINE, BIND_MESSAGE_SUBKEY, &hKey) != ERROR_SUCCESS) + throw(Exception(IDS_ERR_CREATE_KEY, GetErrMessage())); + + /* Add the Event-ID message-file name to the subkey. */ + if(RegSetValueEx(hKey, "EventMessageFile", 0, REG_EXPAND_SZ, (LPBYTE)pszMsgDLL, strlen(pszMsgDLL) + 1) != ERROR_SUCCESS) + throw(Exception(IDS_ERR_SET_VALUE, GetErrMessage())); + + /* Set the supported types flags and addit to the subkey. */ + dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; + if(RegSetValueEx(hKey, "TypesSupported", 0, REG_DWORD, (LPBYTE)&dwData, sizeof(DWORD)) != ERROR_SUCCESS) + throw(Exception(IDS_ERR_SET_VALUE, GetErrMessage())); + + RegCloseKey(hKey); + + SetItemStatus(IDC_REG_MESSAGE); +} + +void CBINDInstallDlg::UnregisterMessages(BOOL uninstall) +{ + BOOL rc = FALSE; + HKEY hKey = NULL; + + while(1) + { + SetCurrent(IDS_UNREGISTER_MESSAGES); + /* Open key for Application Event Log */ + if(RegOpenKey(HKEY_LOCAL_MACHINE, EVENTLOG_APP_SUBKEY, &hKey) != ERROR_SUCCESS) + break; + + /* Remove named from the list of messages sources */ + if(RegDeleteKey(hKey, BIND_MESSAGE_NAME) != ERROR_SUCCESS) + break; + + rc = TRUE; + break; + } + + if(hKey) + RegCloseKey(hKey); + + if(uninstall) + SetItemStatus(IDC_REG_MESSAGE, rc); +} + +/* + * Install failed - clean up quietly + */ +void CBINDInstallDlg::FailedInstall() +{ + UnregisterMessages(FALSE); + UnregisterService(FALSE); + DeleteFiles(FALSE); + RemoveDirs(FALSE); +} + +/* + * Set the checklist tags for install + */ +void CBINDInstallDlg::InstallTags() +{ + CString tag; + + tag.LoadString(IDS_INSTALL_FILE); + GetDlgItem(IDC_COPY_TAG)->SetWindowText(tag); + GetDlgItem(IDC_COPY_FILE)->SetWindowText(""); + + tag.LoadString(IDS_INSTALL_DIR); + GetDlgItem(IDC_DIR_TAG)->SetWindowText(tag); + GetDlgItem(IDC_CREATE_DIR)->SetWindowText(""); + GetDlgItem(IDC_REG_SERVICE)->SetWindowText(""); + + tag.LoadString(IDS_INSTALL_SERVICE); + GetDlgItem(IDC_SERVICE_TAG)->SetWindowText(tag); + + tag.LoadString(IDS_INSTALL_MESSAGE); + GetDlgItem(IDC_MESSAGE_TAG)->SetWindowText(tag); + GetDlgItem(IDC_REG_MESSAGE)->SetWindowText(""); +} + +/* + * Set the checklist tags for uninstall + */ +void CBINDInstallDlg::UninstallTags() +{ + CString tag; + + tag.LoadString(IDS_UNINSTALL_FILES); + GetDlgItem(IDC_COPY_TAG)->SetWindowText(tag); + GetDlgItem(IDC_COPY_FILE)->SetWindowText(""); + + tag.LoadString(IDS_UNINSTALL_DIR); + GetDlgItem(IDC_DIR_TAG)->SetWindowText(tag); + GetDlgItem(IDC_CREATE_DIR)->SetWindowText(""); + + tag.LoadString(IDS_UNINSTALL_SERVICE); + GetDlgItem(IDC_SERVICE_TAG)->SetWindowText(tag); + GetDlgItem(IDC_REG_SERVICE)->SetWindowText(""); + + tag.LoadString(IDS_UNINSTALL_MESSAGE); + GetDlgItem(IDC_MESSAGE_TAG)->SetWindowText(tag); + GetDlgItem(IDC_REG_MESSAGE)->SetWindowText(""); +} + +void CBINDInstallDlg::SetItemStatus(UINT nID, BOOL bSuccess) +{ + GetDlgItem(nID)->SetWindowText(bSuccess == TRUE ? "Done" : "Failed"); +} + + +/* + * Set the text in the current operation field - use a string table string + */ +void CBINDInstallDlg::SetCurrent(int id, ...) +{ + CString format; + va_list va; + char buf[128]; + + format.LoadString(id); + memset(buf, 0, 128); + + va_start(va, id); + vsprintf(buf, format, va); + va_end(va); + + m_current.Format("%s", buf); + UpdateData(FALSE); +} + +/* + * Stop the BIND service + */ +void CBINDInstallDlg::StopBINDService() +{ + SERVICE_STATUS svcStatus; + + SetCurrent(IDS_STOP_SERVICE); + + HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if(!hSCManager) + { + MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); + } + + HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); + if(!hBINDSvc) + { + MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); + } + + BOOL rc = ControlService(hBINDSvc, SERVICE_CONTROL_STOP, &svcStatus); +} + +/* + * Start the BIND service + */ +void CBINDInstallDlg::StartBINDService() +{ + SetCurrent(IDS_START_SERVICE); + + HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if(!hSCManager) + { + MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); + } + + HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); + if(!hBINDSvc) + { + MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); + } + BOOL rc = StartService(hBINDSvc, 0, NULL); +} + +/* + * Check to see if the BIND service is running or not + */ +BOOL CBINDInstallDlg::CheckBINDService() +{ + SERVICE_STATUS svcStatus; + + HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if(hSCManager) + { + HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); + if(hBINDSvc) + { + BOOL rc = ControlService(hBINDSvc, SERVICE_CONTROL_INTERROGATE, &svcStatus); + if(!rc) + DWORD err = GetLastError(); + + return(svcStatus.dwCurrentState == SERVICE_RUNNING); + } + } + return(FALSE); +} + +/* + * Display message boxes with variable args, using string table strings for the format specifiers + */ +int CBINDInstallDlg::MsgBox(int id, ...) +{ + CString format; + va_list va; + char buf[BUFSIZ]; + + format.LoadString(id); + memset(buf, 0, BUFSIZ); + + va_start(va, id); + vsprintf(buf, format, va); + va_end(va); + + return(MessageBox(buf)); +} + +int CBINDInstallDlg::MsgBox(int id, UINT type, ...) +{ + CString format; + va_list va; + char buf[BUFSIZ]; + + format.LoadString(id); + memset(buf, 0, BUFSIZ); + + va_start(va, type); + vsprintf(buf, format, va); + va_end(va); + + return(MessageBox(buf, NULL, type)); +} + +/* + * Call GetLastError(), retrieve the message associated with the error + */ +CString CBINDInstallDlg::GetErrMessage(DWORD err) +{ + LPVOID msgBuf; + static char buf[BUFSIZ]; + + DWORD len = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, err == -1 ? GetLastError() : err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &msgBuf, 0, NULL ); + + + strcpy(buf, (LPTSTR)msgBuf); + LocalFree(msgBuf); + /* Strip off the period and the \n */ + buf[len - 3] = 0; + return(buf); +} + +void CBINDInstallDlg::ProgramGroup(BOOL create) +{ + TCHAR path[MAX_PATH], commonPath[MAX_PATH], fileloc[MAX_PATH], linkpath[MAX_PATH]; + HRESULT hres; + IShellLink *psl = NULL; + LPMALLOC pMalloc = NULL; + ITEMIDLIST *itemList = NULL; + + HRESULT hr = SHGetMalloc(&pMalloc); + if(hr != NOERROR) + { + MessageBox("Could not get a handle to Shell memory object"); + return; + } + + hr = SHGetSpecialFolderLocation(m_hWnd, CSIDL_COMMON_PROGRAMS, &itemList); + if(hr != NOERROR) + { + MessageBox("Could not get a handle to the Common Programs folder"); + if(itemList) + { + pMalloc->Free(itemList); + } + return; + } + + hr = SHGetPathFromIDList(itemList, commonPath); + pMalloc->Free(itemList); + + if(create) + { + sprintf(path, "%s\\ISC", commonPath); + CreateDirectory(path, NULL); + + sprintf(path, "%s\\ISC\\BIND", commonPath); + CreateDirectory(path, NULL); + + hres = CoInitialize(NULL); + + if (SUCCEEDED(hres)) + { + // Get a pointer to the IShellLink interface. + hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID *)&psl); + if (SUCCEEDED(hres)) + { + IPersistFile* ppf; + sprintf(linkpath, "%s\\BINDCtrl.lnk", path); + sprintf(fileloc, "%s\\BINDCtrl.exe", m_binDir); + + psl->SetPath(fileloc); + psl->SetDescription("BIND Control Panel"); + + hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf); + if (SUCCEEDED(hres)) + { + WCHAR wsz[MAX_PATH]; + + MultiByteToWideChar(CP_ACP, 0, linkpath, -1, wsz, MAX_PATH); + hres = ppf->Save(wsz, TRUE); + ppf->Release(); + } + + if(GetFileAttributes("readme.txt") != -1) + { + sprintf(fileloc, "%s\\Readme.txt", m_targetDir); + sprintf(linkpath, "%s\\Readme.lnk", path); + + psl->SetPath(fileloc); + psl->SetDescription("BIND Readme"); + + hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf); + if (SUCCEEDED(hres)) + { + WCHAR wsz[MAX_PATH]; + + MultiByteToWideChar(CP_ACP, 0, linkpath, -1, wsz, MAX_PATH); + hres = ppf->Save(wsz, TRUE); + ppf->Release(); + } + psl->Release(); + } + } + CoUninitialize(); + } + } + else + { + TCHAR filename[MAX_PATH]; + WIN32_FIND_DATA fd; + + sprintf(path, "%s\\ISC\\BIND", commonPath); + + sprintf(filename, "%s\\*.*", path); + HANDLE hFind = FindFirstFile(filename, &fd); + if(hFind != INVALID_HANDLE_VALUE) + { + do + { + if(strcmp(fd.cFileName, ".") && strcmp(fd.cFileName, "..")) + { + sprintf(filename, "%s\\%s", path, fd.cFileName); + DeleteFile(filename); + } + } while(FindNextFile(hFind, &fd)); + FindClose(hFind); + } + RemoveDirectory(path); + sprintf(path, "%s\\ISC", commonPath); + RemoveDirectory(path); + } +} + +CString CBINDInstallDlg::DestDir(int destination) +{ + switch(destination) + { + case FileData::TargetDir: + return m_targetDir; + case FileData::BinDir: + return m_binDir; + case FileData::EtcDir: + return m_etcDir; + case FileData::WinSystem: + return m_winSysDir; + } + return(""); +} diff --git a/bin/win32/BINDInstall/BINDInstallDlg.h b/bin/win32/BINDInstall/BINDInstallDlg.h new file mode 100644 index 00000000..d75de617 --- /dev/null +++ b/bin/win32/BINDInstall/BINDInstallDlg.h @@ -0,0 +1,117 @@ +/* + * Portions Copyright (C) 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: BINDInstallDlg.h,v 1.3 2001/07/31 00:03:14 gson Exp $ */ + +/* + * Copyright (c) 1999-2000 by Nortel Networks Corporation + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND NORTEL NETWORKS DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NORTEL NETWORKS + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifndef BINDINSTALLDLG_H +#define BINDINSTALLDLG_H + +class CBINDInstallDlg : public CDialog +{ +public: + CBINDInstallDlg(CWnd* pParent = NULL); // standard constructor + + //{{AFX_DATA(CBINDInstallDlg) + enum { IDD = IDD_BINDINSTALL_DIALOG }; + CString m_targetDir; + CString m_version; + BOOL m_autoStart; + BOOL m_keepFiles; + CString m_current; + BOOL m_startOnInstall; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CBINDInstallDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +protected: + void StartBINDService(); + void StopBINDService(); + + void InstallTags(); + void UninstallTags(); + + void CreateDirs(); + void RemoveDirs(BOOL uninstall); + + void CopyFiles(); + void DeleteFiles(BOOL uninstall); + + void RegisterService(); + void UnregisterService(BOOL uninstall); + + void RegisterMessages(); + void UnregisterMessages(BOOL uninstall); + + void FailedInstall(); + void SetItemStatus(UINT nID, BOOL bSuccess = TRUE); + +protected: + CString DestDir(int destination); + int MsgBox(int id, ...); + int MsgBox(int id, UINT type, ...); + CString GetErrMessage(DWORD err = -1); + BOOL CheckBINDService(); + void SetCurrent(int id, ...); + void ProgramGroup(BOOL create = TRUE); + + HICON m_hIcon; + CString m_defaultDir; + CString m_etcDir; + CString m_binDir; + CString m_winSysDir; + BOOL m_reboot; + CString m_currentDir; + + // Generated message map functions + //{{AFX_MSG(CBINDInstallDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnBrowse(); + afx_msg void OnChangeTargetdir(); + afx_msg void OnInstall(); + afx_msg void OnExit(); + afx_msg void OnUninstall(); + afx_msg void OnAutoStart(); + afx_msg void OnKeepFiles(); + afx_msg void OnStartOnInstall(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +#endif diff --git a/bin/win32/BINDInstall/DirBrowse.cpp b/bin/win32/BINDInstall/DirBrowse.cpp new file mode 100644 index 00000000..85a969bf --- /dev/null +++ b/bin/win32/BINDInstall/DirBrowse.cpp @@ -0,0 +1,103 @@ +/* + * Portions Copyright (C) 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: DirBrowse.cpp,v 1.3 2001/07/31 00:03:15 gson Exp $ */ + +/* + * Copyright (c) 1999-2000 by Nortel Networks Corporation + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND NORTEL NETWORKS DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NORTEL NETWORKS + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "stdafx.h" +#include "BINDInstall.h" +#include "DirBrowse.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CDirBrowse dialog + + +CDirBrowse::CDirBrowse(CString initialDir, CWnd* pParent /*=NULL*/) + : CDialog(CDirBrowse::IDD, pParent) +{ + //{{AFX_DATA_INIT(CDirBrowse) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + m_selectedDir = initialDir; +} + + +void CDirBrowse::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CDirBrowse) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CDirBrowse, CDialog) + //{{AFX_MSG_MAP(CDirBrowse) + ON_LBN_DBLCLK(IDC_DIRLIST, OnDblclkDirlist) + ON_LBN_SELCHANGE(IDC_DIRLIST, OnSelchangeDirlist) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDirBrowse message handlers + +BOOL CDirBrowse::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DlgDirList((LPTSTR)(LPCTSTR)m_selectedDir, IDC_DIRLIST, IDC_CURDIR, DDL_DIRECTORY); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CDirBrowse::OnDblclkDirlist() +{ + CListBox *lb = (CListBox *)GetDlgItem(IDC_DIRLIST); + CString curSel; + + lb->GetText(lb->GetCurSel(), curSel); + DlgDirList((LPTSTR)(LPCTSTR)curSel, IDC_DIRLIST, IDC_CURDIR, DDL_DIRECTORY); +} + +void CDirBrowse::OnSelchangeDirlist() +{ + // TODO: Add your control notification handler code here + +} diff --git a/bin/win32/BINDInstall/DirBrowse.h b/bin/win32/BINDInstall/DirBrowse.h new file mode 100644 index 00000000..606c9d52 --- /dev/null +++ b/bin/win32/BINDInstall/DirBrowse.h @@ -0,0 +1,71 @@ +/* + * Portions Copyright (C) 2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: DirBrowse.h,v 1.3 2001/07/31 00:03:16 gson Exp $ */ + +/* + * Copyright (c) 1999-2000 by Nortel Networks Corporation + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND NORTEL NETWORKS DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NORTEL NETWORKS + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifndef DIRBROWSE_H +#define DIRBROWSE_H + +class CDirBrowse : public CDialog +{ +// Construction +public: + CDirBrowse(CString initialDir = "\\", CWnd* pParent = NULL); // standard constructor + CString GetSelectedDir() {return(m_selectedDir);} + + //{{AFX_DATA(CDirBrowse) + enum { IDD = IDD_BROWSE }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CDirBrowse) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +protected: + // Generated message map functions + //{{AFX_MSG(CDirBrowse) + virtual BOOL OnInitDialog(); + afx_msg void OnDblclkDirlist(); + afx_msg void OnSelchangeDirlist(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +private: + CString m_selectedDir; +}; + +#endif diff --git a/bin/win32/BINDInstall/StdAfx.cpp b/bin/win32/BINDInstall/StdAfx.cpp new file mode 100644 index 00000000..a4195ca2 --- /dev/null +++ b/bin/win32/BINDInstall/StdAfx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// BINDInstall.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + + diff --git a/bin/win32/BINDInstall/StdAfx.h b/bin/win32/BINDInstall/StdAfx.h new file mode 100644 index 00000000..2607529c --- /dev/null +++ b/bin/win32/BINDInstall/StdAfx.h @@ -0,0 +1,26 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__61537819_39FC_11D3_A97A_00105A12BD65__INCLUDED_) +#define AFX_STDAFX_H__61537819_39FC_11D3_A97A_00105A12BD65__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include <afxwin.h> // MFC core and standard components +#include <afxext.h> // MFC extensions +#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include <afxcmn.h> // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__61537819_39FC_11D3_A97A_00105A12BD65__INCLUDED_) diff --git a/bin/win32/BINDInstall/VersionInfo.cpp b/bin/win32/BINDInstall/VersionInfo.cpp new file mode 100644 index 00000000..f5bab198 --- /dev/null +++ b/bin/win32/BINDInstall/VersionInfo.cpp @@ -0,0 +1,286 @@ +// VersionInfo.cpp: implementation of the CVersionInfo class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "bindinstall.h" +#include "VersionInfo.h" +#include <winver.h> + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CVersionInfo::CVersionInfo(CString filename) +{ + HANDLE hFile; + WIN32_FIND_DATA fd; + memset(&fd, 0, sizeof(WIN32_FIND_DATA)); + + m_status = ERROR_SUCCESS; + m_isValid = FALSE; + m_filename = filename; + + // See if the given file exists + hFile = FindFirstFile(filename, &fd); + if(hFile == INVALID_HANDLE_VALUE) + { + m_status = ERROR_FILE_NOT_FOUND; + m_versionInfo = NULL; + return; + } + FindClose(hFile); + + // Extract the file info + DWORD handle; + DWORD viSize = GetFileVersionInfoSize((LPTSTR)(LPCTSTR)filename, &handle); + m_versionInfo = NULL; + + if(viSize == 0) + { + m_status = GetLastError(); + } + else + { + m_versionInfo = new char[viSize]; + + // Get the block of version info from the file + if(!GetFileVersionInfo((LPTSTR)(LPCTSTR)filename, handle, viSize, m_versionInfo)) + { + if(m_versionInfo) + { + delete m_versionInfo; + m_versionInfo = NULL; + } + return; + } + + // Now extract the sub block we are interested in + UINT versionLen = 0; + LPVOID viBlob = NULL; + if(!VerQueryValue(m_versionInfo, "\\", &viBlob, &versionLen)) + { + if(m_versionInfo) + { + delete m_versionInfo; + m_versionInfo = NULL; + } + return; + } + + // And finally the version info is ours + m_fixedInfo = (VS_FIXEDFILEINFO *)viBlob; + + UINT blobLen = 0; + + // If we got here, all is good + } + m_isValid = TRUE; +} + +CVersionInfo::~CVersionInfo() +{ + m_fixedInfo = NULL; + if(m_versionInfo) + { + delete m_versionInfo; + m_versionInfo = NULL; + } +} + +CString CVersionInfo::GetFileVersionString() +{ + return(QueryStringValue("FileVersion")); +} + +CString CVersionInfo::GetProductVersionString() +{ + return(QueryStringValue("ProductVersion")); +} + +CString CVersionInfo::GetComments() +{ + return(QueryStringValue("Comments")); +} + +CString CVersionInfo::GetFileDescription() +{ + return(QueryStringValue("FileDescription")); +} + +CString CVersionInfo::GetInternalName() +{ + return(QueryStringValue("InternalName")); +} + +CString CVersionInfo::GetLegalCopyright() +{ + return(QueryStringValue("LegalCopyright")); +} + +CString CVersionInfo::GetLegalTrademarks() +{ + return(QueryStringValue("LegalTrademarks")); +} + +CString CVersionInfo::GetOriginalFileName() +{ + return(QueryStringValue("OriginalFilename")); +} + +CString CVersionInfo::GetProductName() +{ + return(QueryStringValue("ProductName")); +} + +CString CVersionInfo::GetSpecialBuildString() +{ + return(QueryStringValue("SpecialBuild")); +} + +CString CVersionInfo::GetPrivateBuildString() +{ + return(QueryStringValue("PrivateBuild")); +} + +CString CVersionInfo::GetCompanyName() +{ + return(QueryStringValue("CompanyName")); +} + +#ifdef NOTUSED +BOOL CVersionInfo::CopyFileCheckVersion(CVersionInfo &originalFile) +{ + _int64 myVer = GetFileVersion(); + _int64 origVer = originalFile.GetFileVersion(); + + if(origVer > myVer) + { + CString msg; + msg.Format(IDS_EXISTING_NEWER, m_filename); + DWORD query = AfxMessageBox(msg, MB_YESNO); + if(query == IDNO) + return(TRUE); + } + + return(CopyFileNoVersion(originalFile)); +} +#endif + +BOOL CVersionInfo::CopyFileNoVersion(CVersionInfo &originalFile) +{ + int x = 7; + return(CopyFile(originalFile.GetFilename(), m_filename, FALSE)); +} + + +_int64 CVersionInfo::GetFileVersion() +{ + _int64 ver = 0; + + if(m_versionInfo) + { + ver = m_fixedInfo->dwFileVersionMS; + ver <<= 32; + ver += m_fixedInfo->dwFileVersionLS; + } + return(ver); +} + +_int64 CVersionInfo::GetProductVersion() +{ + _int64 ver = 0; + + if(m_versionInfo) + { + ver = m_fixedInfo->dwProductVersionMS; + ver <<= 32; + ver += m_fixedInfo->dwProductVersionLS; + } + return(ver); +} + +_int64 CVersionInfo::GetFileDate() +{ + _int64 fDate = 0; + + if(m_versionInfo) + { + fDate = m_fixedInfo->dwFileDateMS; + fDate <<= 32; + fDate += m_fixedInfo->dwFileDateLS; + } + return(fDate); +} + +DWORD CVersionInfo::GetFileFlagMask() +{ + if(m_versionInfo) + { + return(m_fixedInfo->dwFileFlagsMask); + } + return(0); +} + +DWORD CVersionInfo::GetFileFlags() +{ + if(m_versionInfo) + { + return(m_fixedInfo->dwFileFlags); + } + return(0); +} + +DWORD CVersionInfo::GetFileOS() +{ + if(m_versionInfo) + { + return(m_fixedInfo->dwFileOS); + } + return(VOS_UNKNOWN); +} + +DWORD CVersionInfo::GetFileType() +{ + if(m_versionInfo) + { + return(m_fixedInfo->dwFileType); + } + return(VFT_UNKNOWN); +} + +DWORD CVersionInfo::GetFileSubType() +{ + if(m_versionInfo) + { + return(m_fixedInfo->dwFileSubtype); + } + return(VFT2_UNKNOWN); +} + +CString CVersionInfo::QueryStringValue(CString value) +{ + UINT blobLen = 0; + LPVOID viBlob = NULL; + + if(m_versionInfo) + { + char queryString[256]; + + // This code page value is for American English. If you change the resources to be other than that + // You probably should change this to match it. + DWORD codePage = 0x040904B0; + + sprintf(queryString, "\\StringFileInfo\\%08X\\%s", codePage, value); + + if(VerQueryValue(m_versionInfo, queryString, &viBlob, &blobLen)) + return((char *)viBlob); + } + return("Not Available"); +} diff --git a/bin/win32/BINDInstall/VersionInfo.h b/bin/win32/BINDInstall/VersionInfo.h new file mode 100644 index 00000000..ec215401 --- /dev/null +++ b/bin/win32/BINDInstall/VersionInfo.h @@ -0,0 +1,62 @@ +// VersionInfo.h: interface for the CVersionInfo class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_VERSIONINFO_H__F82E9FF3_5298_11D4_AB87_00C04F789BA0__INCLUDED_) +#define AFX_VERSIONINFO_H__F82E9FF3_5298_11D4_AB87_00C04F789BA0__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CVersionInfo +{ +public: + CVersionInfo(CString filename); + virtual ~CVersionInfo(); + BOOL IsValid() {return m_isValid;} + DWORD GetStatus() {return m_status;} + + BOOL CopyFileCheckVersion(CVersionInfo &originalFile); + BOOL CopyFileNoVersion(CVersionInfo &originalFile); + + const CString &GetFilename() {return m_filename;} + + // Extract the elements of the file's string info block + CString GetFileVersionString(); + CString GetProductVersionString(); + CString GetComments(); + CString GetFileDescription(); + CString GetInternalName(); + CString GetLegalCopyright(); + CString GetLegalTrademarks(); + CString GetOriginalFileName(); + CString GetProductName(); + CString GetSpecialBuildString(); + CString GetPrivateBuildString(); + CString GetCompanyName(); + + + // Extract the elements of the file's VS_FIXEDFILEINFO block + _int64 GetFileVersion(); + _int64 GetProductVersion(); + _int64 GetFileDate(); + + DWORD GetFileFlagMask(); + DWORD GetFileFlags(); + DWORD GetFileOS(); + DWORD GetFileType(); + DWORD GetFileSubType(); + +private: + CString m_filename; + BOOL m_isValid; + LPVOID m_versionInfo; + VS_FIXEDFILEINFO *m_fixedInfo; + DWORD m_codePage; + DWORD m_status; + + CString QueryStringValue(CString value); +}; + +#endif // !defined(AFX_VERSIONINFO_H__F82E9FF3_5298_11D4_AB87_00C04F789BA0__INCLUDED_) diff --git a/bin/win32/BINDInstall/res/BINDInstall.ico b/bin/win32/BINDInstall/res/BINDInstall.ico Binary files differnew file mode 100644 index 00000000..2cf25fe0 --- /dev/null +++ b/bin/win32/BINDInstall/res/BINDInstall.ico diff --git a/bin/win32/BINDInstall/res/BINDInstall.rc2 b/bin/win32/BINDInstall/res/BINDInstall.rc2 new file mode 100644 index 00000000..4fc93bb2 --- /dev/null +++ b/bin/win32/BINDInstall/res/BINDInstall.rc2 @@ -0,0 +1,13 @@ +// +// BINDINSTALL.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/bin/win32/BINDInstall/resource.h b/bin/win32/BINDInstall/resource.h new file mode 100644 index 00000000..02f6802d --- /dev/null +++ b/bin/win32/BINDInstall/resource.h @@ -0,0 +1,90 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by BINDInstall.rc +// +#define IDS_MAINFRAME 1 +#define IDS_CREATEDIR 2 +#define IDS_SUCCESS 3 +#define IDS_FAIL 4 +#define IDS_DIREXIST 5 +#define IDS_INSTALL_DIR 6 +#define IDS_INSTALL_FILE 7 +#define IDS_INSTALL_SERVICE 8 +#define IDS_INSTALL_MESSAGE 9 +#define IDS_UNINSTALL 14 +#define IDS_UNINSTALL_DONE 15 +#define IDS_CREATE_KEY 16 +#define IDS_ADD_REMOVE 17 +#define IDS_CLEANUP 18 +#define IDS_INSTALL_DONE 19 +#define IDS_CREATE_DIR 20 +#define IDS_REMOVE_DIR 21 +#define IDS_COPY_FILE 22 +#define IDS_DELETE_FILE 23 +#define IDS_OPEN_SCM 24 +#define IDS_CREATE_SERVICE 25 +#define IDS_OPEN_SERVICE 26 +#define IDS_REMOVE_SERVICE 27 +#define IDS_REGISTER_MESSAGES 28 +#define IDS_UNREGISTER_MESSAGES 29 +#define IDS_STOP_SERVICE 30 +#define IDS_START_SERVICE 31 +#define IDS_UNINSTALL_DIR 32 +#define IDS_UNINSTALL_FILES 33 +#define IDS_UNINSTALL_SERVICE 34 +#define IDS_UNINSTALL_MESSAGE 35 +#define IDS_ERR_OPEN_SCM 36 +#define IDS_ERR_OPEN_SERVICE 37 +#define IDS_ERR_STOP_SERVICE 38 +#define IDS_ERR_NONCRIT_FILE 39 +#define IDS_ERR_CRITICAL_FILE 40 +#define IDS_ERR_COPY_FILE 40 +#define IDS_ERR_CREATE_SERVICE 41 +#define IDS_ERR_REMOVE_SERVICE 42 +#define IDS_REBOOT 43 +#define IDS_BAD_PRIVILEGES 44 +#define IDS_ERR_CREATE_DIR 45 +#define IDS_VERSION 46 +#define IDS_ERR_CREATE_KEY 47 +#define IDS_ERR_SET_VALUE 48 +#define IDS_NO_VERSION 49 +#define IDS_EXISTING_NEWER 50 +#define IDS_FILE_BAD 51 +#define IDD_BINDINSTALL_DIALOG 102 +#define IDR_MAINFRAME 128 +#define IDD_BROWSE 129 +#define IDI_CHECK 130 +#define IDI_X 132 +#define IDC_TARGETDIR 1001 +#define IDC_BROWSE 1002 +#define IDC_DIRLIST 1004 +#define IDC_CURDIR 1005 +#define IDC_INSTALL 1006 +#define IDC_COPY_FILE 1007 +#define IDC_REG_SERVICE 1008 +#define IDC_REG_MESSAGE 1009 +#define IDC_CREATE_DIR 1010 +#define IDC_EXIT 1011 +#define IDC_DIR_TAG 1012 +#define IDC_COPY_TAG 1013 +#define IDC_SERVICE_TAG 1014 +#define IDC_MESSAGE_TAG 1015 +#define IDC_AUTO_START 1016 +#define IDC_UNINSTALL 1017 +#define IDC_VERSION 1018 +#define IDC_KEEP_FILES 1019 +#define IDC_CURRENT_TAG 1020 +#define IDC_DRIVES 1021 +#define IDC_CURRENT 1021 +#define IDC_START 1022 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 142 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1027 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif |