WinHugs installer, create log

Neil Mitchell <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.hugs
Message-ID <404396ef0510120419o17a6775rc6e469650ec55d1c__24185.3375373923$1129119411$gmane$org@mail.gmail.com>
Hi,

This patch creates a log of the actions of the installer, called
install.log. Currently only file creation actions are recorded. This
will be required to write an uinstaller.

Thanks

Neil

_______________________________________________
Cvs-hugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-hugs
create_log.patch (application/octet-stream, 2.9 KB)
Index: src/winhugs/installer/Installer.vcproj
===================================================================
RCS file: /cvs/hugs98/src/winhugs/installer/Installer.vcproj,v
retrieving revision 1.2
diff -u -r1.2 Installer.vcproj
--- src/winhugs/installer/Installer.vcproj	10 Oct 2005 23:11:14 -0000	1.2
+++ src/winhugs/installer/Installer.vcproj	12 Oct 2005 11:02:58 -0000
@@ -174,6 +174,12 @@
 				RelativePath="Installer.rc">
 			</File>
 			<File
+				RelativePath=".\InstallLog.cpp">
+			</File>
+			<File
+				RelativePath=".\InstallLog.h">
+			</File>
+			<File
 				RelativePath="Parameters.h">
 			</File>
 			<File
Index: src/winhugs/installer/StartCode.cpp
===================================================================
RCS file: /cvs/hugs98/src/winhugs/installer/StartCode.cpp,v
retrieving revision 1.2
diff -u -r1.2 StartCode.cpp
--- src/winhugs/installer/StartCode.cpp	12 Oct 2005 10:10:00 -0000	1.2
+++ src/winhugs/installer/StartCode.cpp	12 Oct 2005 11:19:05 -0000
@@ -1,10 +1,10 @@
 #include "header.h"
 #include "FileCode.h"
 #include "ShellCode.h"
+#include "InstallLog.h"
 #include <commctrl.h>
 #include <stdio.h>
 
 #define PLAY_NICELY
 #include "BlueZip\BlueHead.h"
 
@@ -207,6 +207,10 @@
 	SendDlgItemMessage(hDlg, prgBar, PBM_SETRANGE, 0, MAKELPARAM(0, TotalCompSize / PrgFactor));
 	int Done = 0;
 
+	// start creating the install log
+	strcpy(BufPos, "install.log");
+	StartInstallLog(InstallTo);
+	WriteInstallLog("NOTE\tUinstall Log for " ProgramName);
 
 	//now you have access to at least the file Str
 	//extract all the files
@@ -255,6 +259,10 @@
 				ErrDialog(hDlg, "Could not extract the file\n\n", InstallTo);
 				return false;
 			}
+			else
+			{
+				WriteInstallLog("FILE\t%s\t%i\t%lX", InstallTo, i->OriginalSize(), i->CRC());
+			}
 		}
 		SendDlgItemMessage(hDlg, prgBar, PBM_SETPOS, Done / PrgFactor, 0);
 	}
@@ -279,6 +287,9 @@
 			SendDlgItemMessage(hDlg, prgBar, PBM_SETPOS, Done / PrgFactor, 0);
 		}
 
+		// and delete the install log
+		StopInstallLog(true);
+
 		//now delete all the directories
 		DeleteFolders();
 
@@ -309,6 +320,8 @@
 	}
 	BufPos[-1] = '\\';
 
+	StopInstallLog(false);
+
 	//now InstallTo is the directory
 	strcpy(BufPos, PrimaryFile);
 	if (RunOnEnd)
@@ -359,6 +372,7 @@
 		//Rollback some variables that may have got modified
 		CancelInstall = false;
 		EnableWindow(GetDlgItem(hDlg, IDCANCEL), TRUE);
+		StopInstallLog(true);
 	}
 	return Res;
 }
Index: src/winhugs/installer/BlueZip/zList.h
===================================================================
RCS file: /cvs/hugs98/src/winhugs/installer/BlueZip/zList.h,v
retrieving revision 1.1
diff -u -r1.1 zList.h
--- src/winhugs/installer/BlueZip/zList.h	6 Oct 2005 11:18:43 -0000	1.1
+++ src/winhugs/installer/BlueZip/zList.h	12 Oct 2005 11:16:32 -0000
@@ -22,4 +22,5 @@
 
 	int OriginalSize(){return data.OrigSize;}
 	int CompressedSize(){return data.CompSize;}
+	long CRC(){return data.CRC;}
 };
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.