ReactOS Package Manager (marked in audit list as [OK])
Requested by crashfourit
Added: trunk/rosapps/
Added: trunk/rosapps/packmgr/
Added: trunk/rosapps/packmgr/cmd-line/
Added: trunk/rosapps/packmgr/cmd-line/main.c
Added: trunk/rosapps/packmgr/cmd-line/main.h
Added: trunk/rosapps/packmgr/cmd-line/ros-get.rc
Added: trunk/rosapps/packmgr/cmd-line/rosget.rbuild
Added: trunk/rosapps/packmgr/directory.rbuild
Added: trunk/rosapps/packmgr/gui/
Added: trunk/rosapps/packmgr/gui/cz.rc
Added: trunk/rosapps/packmgr/gui/de.rc
Added: trunk/rosapps/packmgr/gui/en.rc
Added: trunk/rosapps/packmgr/gui/es.rc
Added: trunk/rosapps/packmgr/gui/generic.rc
Added: trunk/rosapps/packmgr/gui/help.txt
Added: trunk/rosapps/packmgr/gui/main.c
Added: trunk/rosapps/packmgr/gui/main.h
Added: trunk/rosapps/packmgr/gui/packmgr.rbuild
Added: trunk/rosapps/packmgr/gui/packmgr.rc
Added: trunk/rosapps/packmgr/gui/res/
Added: trunk/rosapps/packmgr/gui/res/blank.ico
Added: trunk/rosapps/packmgr/gui/res/development.ico
Added: trunk/rosapps/packmgr/gui/res/games.ico
Added: trunk/rosapps/packmgr/gui/res/graphics.ico
Added: trunk/rosapps/packmgr/gui/res/inet.ico
Added: trunk/rosapps/packmgr/gui/res/install.ico
Added: trunk/rosapps/packmgr/gui/res/installed.ico
Added: trunk/rosapps/packmgr/gui/res/installsource.ico
Added: trunk/rosapps/packmgr/gui/res/multimedia.ico
Added: trunk/rosapps/packmgr/gui/res/office.ico
Added: trunk/rosapps/packmgr/gui/res/others.ico
Added: trunk/rosapps/packmgr/gui/res/packetmanager.ico
Added: trunk/rosapps/packmgr/gui/res/toolbar.bmp
Added: trunk/rosapps/packmgr/gui/res/tools.ico
Added: trunk/rosapps/packmgr/gui/res/uninstall.ico
Added: trunk/rosapps/packmgr/gui/res/update.ico
Added: trunk/rosapps/packmgr/gui/resource.h
Added: trunk/rosapps/packmgr/lib/
Added: trunk/rosapps/packmgr/lib/cz.rc
Added: trunk/rosapps/packmgr/lib/de.rc
Added: trunk/rosapps/packmgr/lib/download.cpp
Added: trunk/rosapps/packmgr/lib/en.rc
Added: trunk/rosapps/packmgr/lib/error.h
Added: trunk/rosapps/packmgr/lib/es.rc
Added: trunk/rosapps/packmgr/lib/expat.h
Added: trunk/rosapps/packmgr/lib/functions.cpp
Added: trunk/rosapps/packmgr/lib/log.cpp
Added: trunk/rosapps/packmgr/lib/log.h
Added: trunk/rosapps/packmgr/lib/main.cpp
Added: trunk/rosapps/packmgr/lib/options.cpp
Added: trunk/rosapps/packmgr/lib/options.xml
Added: trunk/rosapps/packmgr/lib/package.cpp
Added: trunk/rosapps/packmgr/lib/package.def
Added: trunk/rosapps/packmgr/lib/package.h
Added: trunk/rosapps/packmgr/lib/package.hpp
Added: trunk/rosapps/packmgr/lib/package.rbuild
Added: trunk/rosapps/packmgr/lib/package.rc
Added: trunk/rosapps/packmgr/lib/script.cpp
Added: trunk/rosapps/packmgr/lib/script.h
Added: trunk/rosapps/packmgr/lib/tree.cpp
Added: trunk/rosapps/packmgr/tree/
Added: trunk/rosapps/packmgr/tree/7zip.inst.rps
Added: trunk/rosapps/packmgr/tree/7zip.xml
Added: trunk/rosapps/packmgr/tree/abiword.inst.rps
Added: trunk/rosapps/packmgr/tree/abiword.xml
Added: trunk/rosapps/packmgr/tree/firefox.inst.rps
Added: trunk/rosapps/packmgr/tree/firefox.xml
Added: trunk/rosapps/packmgr/tree/irfanview.inst.rps
Added: trunk/rosapps/packmgr/tree/irfanview.xml
Added: trunk/rosapps/packmgr/tree/mplayer.inst.rps
Added: trunk/rosapps/packmgr/tree/mplayer.xml
Added: trunk/rosapps/packmgr/tree/openoffice.inst.rps
Added: trunk/rosapps/packmgr/tree/openoffice.xml
Added: trunk/rosapps/packmgr/tree/putty.inst.rps
Added: trunk/rosapps/packmgr/tree/putty.xml
Added: trunk/rosapps/packmgr/tree/rosbe.inst.rps
Added: trunk/rosapps/packmgr/tree/rosbe.xml
Added: trunk/rosapps/packmgr/tree/tiny.inst.rps
Added: trunk/rosapps/packmgr/tree/tiny.xml
Added: trunk/rosapps/packmgr/tree/tree.xml
Added: trunk/rosapps/packmgr/tree/tree_bare.xml
Added: trunk/rosapps/packmgr/tree/tree_withsubs.xml
Added: trunk/rosapps/packmgr/tree/tuxpaint.inst.rps
Added: trunk/rosapps/packmgr/tree/tuxpaint.xml

Added: trunk/rosapps/packmgr/cmd-line/main.c
--- trunk/rosapps/packmgr/cmd-line/main.c	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/cmd-line/main.c	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,211 @@
+////////////////////////////////////////////////////////
+//
+// main.cpp
+// 
+// Implementation of a Commandlne Interface
+// for the ReactOs Package Manager
+//
+// Maarten Bosma, 09.01.2004
+// maarten.paul@bosma.de
+//
+////////////////////////////////////////////////////////////////////
+
+#include "main.h"
+#include <stdio.h>
+
+
+int main (int argc, char **argv) 
+{
+	wprintf(L"ReactOs PackageManager %d.%d.%d Commandline Interface \n\n", PACKMGR_VERSION_MAJOR, PACKMGR_VERSION_MINOR, PACKMGR_VERSION_PATCH_LEVEL);
+	Argv = argv; Argc = argc;
+
+	if(argc<2)
+		return Help();
+
+	// install a package
+	if (!strcmp(argv[1], "install")) 
+		Install();
+
+	// install a package from source
+	else if (!strcmp(argv[1], "src-inst"))
+	{
+		wprintf(L"Sorry but I can't do that yet. \n");
+	}
+
+	// update a package
+	else if (!strcmp(argv[1], "update"))
+	{
+		wprintf(L"Sorry but I can't do that yet. \n");
+	}
+
+	// update everything
+	else if (!strcmp(argv[1], "dist-upgrade"))
+	{
+		wprintf(L"Sorry but I can't do that yet. \n");
+	}
+
+	// remove a package
+	else if (!strcmp(argv[1], "remove"))
+	{
+		wprintf(L"Sorry but I can't do that yet. \n");
+	}
+
+	// search for a package
+	else if (!strcmp(argv[1], "show"))
+	{
+		Show();
+	}
+
+	// search for a package
+	else if (!strcmp(argv[1], "search"))
+	{
+		wprintf(L"Sorry but I can't do that yet. \n");
+	}
+
+	else
+		Help();
+
+	//
+	wprintf(L"\n");
+	
+
+	return 0;
+}
+
+int Help (void)
+{
+	wprintf(L"Usage: ros-get [command] \n\n");
+
+	wprintf(L"Possible commands: \n");
+	wprintf(L"  install [package name] \t Installs a package \n\n");
+	wprintf(L"  show [package name] \t\t Shows you detailed information about a package \n");
+
+	wprintf(L"Currently unimplemented commands: \n");
+	wprintf(L"  src-install [package name] \t Installs a package from source code \n");
+	wprintf(L"  update [package name] \t Updates a package \n");
+	wprintf(L"  dist-update [package name] \t Updates a package \n");
+	wprintf(L"  remove [package name] \t Uninstalls a package \n\n");
+
+	wprintf(L"  search [search agrument] \t Finds a package \n");
+	wprintf(L"  list \t\t\t\t Lists all installed programs \n");
+
+	return 0;
+}
+
+int Ask (const WCHAR* question)
+{
+	// ask the user
+	wprintf(L"%s [y/n] ", question);
+	char answer = getchar();
+
+	// clear keybuffer
+	while(getchar()!='\n');
+	wprintf(L"\n");
+
+	// prozess answer
+	if (answer == 'y')
+		return 1;
+
+	else if (answer == 'n')
+		return 0;
+
+	return Ask(question);
+}
+	
+int SetStatus (int status1, int status2, WCHAR* text)
+{
+	WCHAR errbuf[2000];
+	if(text)
+		wprintf(L"%s\n", text);
+
+	// If the Status is 1000 things are done
+	if(status1==1000)
+	{
+		wprintf(L"%s\n", PML_TransError(status2, errbuf, sizeof(errbuf)/sizeof(WCHAR)));
+		done = TRUE;
+	}
+
+	return 0;
+}
+
+int Install (void)
+{
+	pTree tree;
+	int i, error;
+	WCHAR errbuf[2000];
+
+	// load the tree
+	error = PML_LoadTree (&tree, "tree.xml", NULL);
+	if(error)
+	{
+
+		wprintf(PML_TransError(error, errbuf, sizeof(errbuf)/sizeof(WCHAR)));
+		return 0;
+	}
+		
+	// look up the item
+	for (i=2; i<Argc; i++)
+	{
+		int id = PML_FindItem(tree, Argv[i]);
+
+		if(id)
+		{
+			PML_LoadPackage(tree, id, NULL);
+			PML_SetAction(tree, id, 1, NULL, Ask);
+		}
+
+		else 
+			printf("Could not find the Package \"%s\"\n", Argv[i]);
+	}
+
+	// do it
+	error = PML_DoIt (tree, SetStatus, Ask);
+	if(error)
+	{
+
+		wprintf(PML_TransError(error, errbuf, sizeof(errbuf)/sizeof(WCHAR)));
+		PML_CloseTree (tree);
+		return 0;
+	}
+
+	// wait
+	while (!done)
+		Sleep(1000);
+
+	// clean up
+	PML_CloseTree (tree);
+
+	return 0;
+}
+
+int Show (void)
+{
+	pTree tree;
+	int i, error;
+	WCHAR errbuf[2000];
+
+	// load the tree
+	error = PML_LoadTree (&tree, "tree_bare.xml", NULL);
+	if(error)
+	{
+		wprintf(PML_TransError(error, errbuf, sizeof(errbuf)/sizeof(WCHAR)));
+		return 0;
+	}
+
+	// look up the item
+	for (i=2; i<Argc; i++)
+	{
+		int id = PML_FindItem(tree, Argv[i]);
+
+		if(id)
+			printf(PML_GetDescription(tree, id));
+
+		else 
+			printf("Could not find the Package \"%s\"\n", Argv[i]);
+	}
+
+	// clean up
+	PML_CloseTree (tree);
+
+	return 0;
+}

Added: trunk/rosapps/packmgr/cmd-line/main.h
--- trunk/rosapps/packmgr/cmd-line/main.h	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/cmd-line/main.h	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,17 @@
+///////////////////////////////////////////////////
+//
+// main.h
+//				main.cpp's lumber room :)
+///////////////////////////////////////////////////
+
+#include <package.h>
+
+int Argc;
+char **Argv;
+BOOL done = FALSE;
+
+int Help (void);
+int Install (void);
+int Show (void);
+
+int SetStatus (int status1, int status2, WCHAR* text);

Added: trunk/rosapps/packmgr/cmd-line/ros-get.rc
--- trunk/rosapps/packmgr/cmd-line/ros-get.rc	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/cmd-line/ros-get.rc	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,8 @@
+
+#define REACTOS_STR_FILE_DESCRIPTION	"ReactOS Package Manager - Cmdline Interface\0"
+#define REACTOS_STR_INTERNAL_NAME	"ros-get\0"
+#define REACTOS_STR_ORIGINAL_FILENAME	"ros-get.exe\0"
+
+#include <reactos/version.rc>
+
+/* EOF */

Added: trunk/rosapps/packmgr/cmd-line/rosget.rbuild
--- trunk/rosapps/packmgr/cmd-line/rosget.rbuild	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/cmd-line/rosget.rbuild	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,12 @@
+<module name="rosget" type="win32cui" installbase="system32" installname="rosget.exe">
+	<include base="package">.</include>
+	<define name="__USE_W32API" />
+	<define name="UNICODE" />
+	<define name="_WIN32_IE">0x0501</define>
+	<define name="_WIN32_WINNT">0x0501</define>
+
+	<library>kernel32</library>
+	<library>package</library>
+	<file>main.c</file>
+	<file>ros-get.rc</file>
+</module>

Added: trunk/rosapps/packmgr/directory.rbuild
--- trunk/rosapps/packmgr/directory.rbuild	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/directory.rbuild	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,9 @@
+<directory name="cmd-line">
+	<xi:include href="cmd-line/rosget.rbuild" />
+</directory>
+<directory name="gui">
+	<xi:include href="gui/packmgr.rbuild" />
+</directory>
+<directory name="lib">
+	<xi:include href="lib/package.rbuild" />
+</directory>
\ No newline at end of file

Added: trunk/rosapps/packmgr/gui/cz.rc
--- trunk/rosapps/packmgr/gui/cz.rc	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/gui/cz.rc	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,43 @@
+
+LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
+
+/* Dialogs */
+IDD_OPTIONS DIALOG DISCARDABLE  0, 0, 180, 200
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "NastavenÝ"
+FONT 8, "MS Sans Serif"
+BEGIN
+    LTEXT	"ZatÝm zde nejsou ×ßdnÚ mo×nosti.", 0, 50, 95, 80, 8
+END
+
+IDD_DOIT DIALOG DISCARDABLE  0, 0, 180, 100
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "ProvßdÝm operace"
+FONT 8, "MS Sans Serif"
+BEGIN
+
+    CTEXT	    "{Status}", IDC_TSTATUS, 0, 10, 180, 8
+
+    CONTROL         "", IDC_STATUS1, "msctls_progress32", PBS_SMOOTH, 20, 25, 140, 15
+
+    CONTROL         "", IDC_STATUS2, "msctls_progress32", PBS_SMOOTH, 20, 45, 140, 15
+
+    PUSHBUTTON      "ZruÜit", IDC_CANCEL, 65, 70, 50, 14, WS_DISABLED
+END
+
+IDR_POPUP MENU DISCARDABLE
+BEGIN
+    POPUP "PopUp", MENUBARBREAK
+    BEGIN
+        MENUITEM "Äßdnß akce",                    1, GRAYED
+        MENUITEM "Instalovat (doporuÞeno)",       2, GRAYED
+        MENUITEM "Instalovat ze zdrojov²ch k¾d¨", 3, GRAYED
+        MENUITEM "Aktualizovat",                  4, GRAYED
+        MENUITEM "Odinstalovat",                  5, GRAYED
+        MENUITEM SEPARATOR
+        MENUITEM "NastavenÝ",                     8
+        MENUITEM SEPARATOR
+        MENUITEM "ProvÚst",                       6
+    END
+END
+

Added: trunk/rosapps/packmgr/gui/de.rc
--- trunk/rosapps/packmgr/gui/de.rc	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/gui/de.rc	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,43 @@
+
+LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
+
+/* Dialogs */
+IDD_OPTIONS DIALOG DISCARDABLE  0, 0, 180, 200
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Optionen"
+FONT 8, "MS Sans Serif"
+BEGIN
+    LTEXT	"Leider gibt es noch keine Optionen.", 0, 50, 95, 80, 8
+END
+
+IDD_DOIT DIALOG DISCARDABLE  0, 0, 180, 100
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Performing Operations"
+FONT 8, "MS Sans Serif"
+BEGIN    
+
+    CTEXT	    "{Status}", IDC_TSTATUS, 0, 10, 180, 8
+
+    CONTROL         "", IDC_STATUS1, "msctls_progress32", PBS_SMOOTH, 20, 25, 140, 15
+    
+    CONTROL         "", IDC_STATUS2, "msctls_progress32", PBS_SMOOTH, 20, 45, 140, 15
+
+    PUSHBUTTON      "Abort", IDC_CANCEL, 65, 70, 50, 14, WS_DISABLED
+END
+
+IDR_POPUP MENU DISCARDABLE 
+BEGIN
+    POPUP "PopUp", MENUBARBREAK	
+    BEGIN
+        MENUITEM "Keine Action",        	1, GRAYED 
+        MENUITEM "Intallieren (empfohlen)",     2, GRAYED
+        MENUITEM "Intallieren vom Quellcode",   3, GRAYED
+        MENUITEM "Aktualisieren",               4, GRAYED
+        MENUITEM "Deinstallieren",              5, GRAYED
+        MENUITEM SEPARATOR
+        MENUITEM "Optionen",                    8
+        MENUITEM SEPARATOR
+        MENUITEM "DoIt",                        6
+    END
+END
+

Added: trunk/rosapps/packmgr/gui/en.rc
--- trunk/rosapps/packmgr/gui/en.rc	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/gui/en.rc	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,43 @@
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+/* Dialogs */
+IDD_OPTIONS DIALOG DISCARDABLE  0, 0, 180, 200
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Options"
+FONT 8, "MS Sans Serif"
+BEGIN
+    LTEXT	"There are no options yet.", 0, 50, 95, 80, 8
+END
+
+IDD_DOIT DIALOG DISCARDABLE  0, 0, 180, 100
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Performing Operations"
+FONT 8, "MS Sans Serif"
+BEGIN    
+
+    CTEXT	    "{Status}", IDC_TSTATUS, 0, 10, 180, 8
+
+    CONTROL         "", IDC_STATUS1, "msctls_progress32", PBS_SMOOTH, 20, 25, 140, 15
+    
+    CONTROL         "", IDC_STATUS2, "msctls_progress32", PBS_SMOOTH, 20, 45, 140, 15
+
+    PUSHBUTTON      "Abort", IDC_CANCEL, 65, 70, 50, 14, WS_DISABLED
+END
+
+IDR_POPUP MENU DISCARDABLE 
+BEGIN
+    POPUP "PopUp", MENUBARBREAK	
+    BEGIN
+        MENUITEM "No Action",        	    	1, GRAYED 
+        MENUITEM "Install (recommended)",       2, GRAYED
+        MENUITEM "Install from Source",         3, GRAYED
+        MENUITEM "Update",                      4, GRAYED
+        MENUITEM "Uninstall",                   5, GRAYED
+        MENUITEM SEPARATOR
+        MENUITEM "Options",                     8
+        MENUITEM SEPARATOR
+        MENUITEM "DoIt",                        6
+    END
+END
+

Added: trunk/rosapps/packmgr/gui/es.rc
--- trunk/rosapps/packmgr/gui/es.rc	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/gui/es.rc	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,43 @@
+
+LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
+
+/* Dialogs */
+IDD_OPTIONS DIALOG DISCARDABLE  0, 0, 180, 200
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Opciones"
+FONT 8, "MS Sans Serif"
+BEGIN
+    LTEXT	"A·n no hay opciones disponibles.", 0, 50, 95, 80, 8
+END
+
+IDD_DOIT DIALOG DISCARDABLE  0, 0, 180, 100
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Realizando las operaciones"
+FONT 8, "MS Sans Serif"
+BEGIN    
+
+    CTEXT	    "{Status}", IDC_TSTATUS, 0, 10, 180, 8
+
+    CONTROL         "", IDC_STATUS1, "msctls_progress32", PBS_SMOOTH, 20, 25, 140, 15
+    
+    CONTROL         "", IDC_STATUS2, "msctls_progress32", PBS_SMOOTH, 20, 45, 140, 15
+
+    PUSHBUTTON      "Abort", IDC_CANCEL, 65, 70, 50, 14, WS_DISABLED
+END
+
+IDR_POPUP MENU DISCARDABLE 
+BEGIN
+    POPUP "PopUp", MENUBARBREAK	
+    BEGIN
+        MENUITEM "Ninguna acci¾n",        	    	1, GRAYED 
+        MENUITEM "Instalar (recomendado)",       2, GRAYED
+        MENUITEM "Instalar desde el c¾digo fuente",         3, GRAYED
+        MENUITEM "Actualizar",                      4, GRAYED
+        MENUITEM "Desinstalar",                    5, GRAYED
+        MENUITEM SEPARATOR
+        MENUITEM "Opciones",                     8
+        MENUITEM SEPARATOR
+        MENUITEM "íHazlo!",                        6
+    END
+END
+

Added: trunk/rosapps/packmgr/gui/generic.rc
--- trunk/rosapps/packmgr/gui/generic.rc	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/gui/generic.rc	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,34 @@
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+IDI_MAIN ICON DISCARDABLE "res/packetmanager.ico"
+IDB_TOOLBAR BITMAP DISCARDABLE "res/toolbar.bmp"
+
+/* TreeIcons - Categories */
+1 ICON DISCARDABLE "res/blank.ico"
+2 ICON DISCARDABLE "res/inet.ico"
+3 ICON DISCARDABLE "res/office.ico"
+4 ICON DISCARDABLE "res/graphics.ico"
+5 ICON DISCARDABLE "res/multimedia.ico"
+6 ICON DISCARDABLE "res/development.ico"
+7 ICON DISCARDABLE "res/games.ico"
+8 ICON DISCARDABLE "res/tools.ico"
+9 ICON DISCARDABLE "res/others.ico"
+10 ICON DISCARDABLE "res/installed.ico"
+
+/* TreeIcons - Actions */
+11 ICON DISCARDABLE "res/install.ico"
+12 ICON DISCARDABLE "res/installsource.ico"
+13 ICON DISCARDABLE "res/update.ico"
+14 ICON DISCARDABLE "res/uninstall.ico"
+
+/* HotKeys */
+
+IDR_HOTKEYS ACCELERATORS DISCARDABLE 
+BEGIN
+    "1",   2,   VIRTKEY, CONTROL
+    "2",   3,   VIRTKEY, CONTROL
+    "3",   4,   VIRTKEY, CONTROL
+    "4",   5,   VIRTKEY, CONTROL
+    "0",   1,   VIRTKEY, CONTROL
+END

Added: trunk/rosapps/packmgr/gui/help.txt
--- trunk/rosapps/packmgr/gui/help.txt	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/gui/help.txt	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,8 @@
+Welcome to ReactOS's Package Manager !
+
+WARNING: This is still pre-alfa software you can't do much with it yet.
+
+This is the online help. You can show it at any time by clicking on the the Questionmark Icon above.
+
+You can use this package manager like this: click on the 
+You can also use the Buttons [ctrl] + [0] to [4] to set the action.
\ No newline at end of file

Added: trunk/rosapps/packmgr/gui/main.c
--- trunk/rosapps/packmgr/gui/main.c	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/gui/main.c	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,453 @@
+////////////////////////////////////////////////////////
+//
+// main.cpp
+// 
+// Implementation of the Package Manager GUI
+//
+//
+// Maarten Bosma, 09.01.2004
+// maarten.paul@bosma.de
+//
+////////////////////////////////////////////////////////////////////
+
+#include "main.h"
+
+// This is the struct where the toolbar is defined
+const TBBUTTON Buttons [] =
+{
+	{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
+
+	{0, 1, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // No Action
+	{1, 2, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Install
+	{2, 3, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Install from source
+	{3, 4, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Update
+	{4, 5, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Unistall
+
+	{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
+	{5, 6, TBSTATE_ENABLED, TBSTYLE_BUTTON}, // DoIt (tm)
+	{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
+
+	{6, 7, TBSTATE_ENABLED, TBSTYLE_BUTTON}, // Help
+	{7, 8, TBSTATE_ENABLED, TBSTYLE_BUTTON}, // Options
+
+	{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
+};
+
+
+// Application's Entry Point
+int WINAPI WinMain (HINSTANCE hinst, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
+{
+	HWND       hwnd;
+	MSG        msg;
+	WNDCLASSEX wc = {0};
+	WCHAR errbuf[2000];
+
+	// Window creation
+	wc.cbSize        = sizeof(WNDCLASSEX); 
+	wc.lpszClassName = L"pgkmgr";
+	wc.style         = CS_HREDRAW | CS_VREDRAW;
+	wc.lpfnWndProc   = (WNDPROC)WndProc;
+	wc.hInstance     = hinst;
+	wc.hIcon		 = LoadIcon(hinst, MAKEINTRESOURCE(IDI_MAIN));
+	wc.hbrBackground = (HBRUSH)(COLOR_SCROLLBAR);
+
+	RegisterClassEx(&wc);
+
+	hwnd = CreateWindow(L"pgkmgr",
+                       L"ReactOS - Package Manager v0.3",
+                       WS_OVERLAPPEDWINDOW,
+                       CW_USEDEFAULT,  
+                       CW_USEDEFAULT,   
+                       500, 600, 
+                       NULL, NULL,
+                       hinst, 
+					   NULL);
+
+
+	// Toolbar creation
+	InitCommonControls();
+
+	hTBar = CreateToolbarEx(hwnd, WS_CHILD|WS_VISIBLE|TBSTYLE_FLAT, 0, 8, hinst, IDB_TOOLBAR, 
+										Buttons, sizeof(Buttons)/sizeof(TBBUTTON), TBSIZE, TBSIZE, TBSIZE, TBSIZE, sizeof(TBBUTTON));
+
+	// Show the windows
+	ShowWindow(hwnd, SW_SHOW);
+	UpdateWindow(hwnd);
+
+	// Load the tree
+	int error = PML_LoadTree(&tree, "tree_bare.xml", AddItem);
+	
+	if(error)
+	{
+		MessageBox(0,PML_TransError(error, errbuf, sizeof(errbuf)/sizeof(WCHAR)),0,0);
+		return 0;
+	}
+	
+	// Read the help
+	Help();
+
+	// Start getting messages
+	while(GetMessage(&msg,NULL,0,0))
+	{
+		if(!TranslateAccelerator(hwnd, hHotKeys, &msg))
+		{
+			TranslateMessage(&msg);
+			DispatchMessage(&msg);
+		}
+	}
+	
+	// Close our handle
+	PML_CloseTree (tree);
+
+	return 0;
+}
+
+// Add a item to our tree
+int AddItem (int id, const char* name, int parent, int icon)
+{ 
+	TV_INSERTSTRUCT tvins; 
+
+	tvins.item.lParam = (UINT)id;
+	tvins.item.mask = TVIF_TEXT|TVIF_PARAM;
+	tvins.item.pszText = (WCHAR*)name; //that is ok
+	tvins.item.cchTextMax = strlen(name); 
+	tvins.hInsertAfter = TVI_LAST;
+
+	if(icon)
+	{
+		tvins.item.iImage = icon;
+		tvins.item.iSelectedImage = icon;
+		tvins.item.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+	}
+
+	if (parent==0)
+		tvins.hParent = TVI_ROOT;
+	else
+		tvins.hParent = nodes[parent];
+
+	nodes[id] = (HTREEITEM)SendMessage(hTree, TVM_INSERTITEMA, 0, (LPARAM)&tvins);
+
+	return 0;
+} 
+
+// Load the Help from file and display it
+void Help (void)
+{
+	int i;
+	char buffer [2000];
+	FILE* file = fopen ("help.txt", "r");
+
+	if(!file)
+		return;
+
+	for(i=0; i<2000; i++)
+	{
+		buffer[i] = getc(file);
+		if(buffer[i]==EOF) break;
+	}
+	buffer[i] = 0;
+
+	SetText(buffer);
+}
+
+// Create our Controls
+void InitControls (HWND hwnd)
+{
+
+	HINSTANCE hinst = GetModuleHandle(NULL);
+	WCHAR errbuf[2000];
+
+	// Create the controls
+	hTree = CreateWindowEx(0, WC_TREEVIEW, L"TreeView", WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS, 
+							0, 0, 0, 0, hwnd, NULL, hinst, NULL);
+
+	hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"edit", PML_TransError(IDS_LOAD, errbuf, sizeof(errbuf)/sizeof(WCHAR)), WS_CHILD|WS_VISIBLE|ES_MULTILINE, 
+							0, 0, 100, 100, hwnd, NULL, hinst, NULL);
+	
+	hPopup = LoadMenu(hinst, MAKEINTRESOURCE(IDR_POPUP));
+
+	// Create Tree Icons
+	HIMAGELIST hIcon = ImageList_Create(16, 16, ILC_MASK|ILC_COLOR32, 1, 1);
+	SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)(HIMAGELIST)hIcon);
+		
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(1))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(11))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(12))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(13))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(14))); 
+
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(2))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(3))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(4))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(5))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(6))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(7))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(8))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(9))); 
+	ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(10))); 
+
+	// Setup Hotkeys
+	hHotKeys = LoadAccelerators (hinst, MAKEINTRESOURCE(IDR_HOTKEYS));
+}
+
+// Set the Icons
+int SetIcon (int id, int icon) 
+{
+    TVITEMEX item;
+	
+	item.hItem = nodes[id];
+	item.iImage = icon;
+	item.iSelectedImage = icon;
+	item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+
+	TreeView_SetItem(hTree, &item);
+
+    return 1;
+}
+
+// Set the Icons
+int Ask (const WCHAR* message) 
+{	
+	int ans = MessageBox (0,message,0,MB_YESNO);
+
+	if(ans == IDYES)
+		return 1;
+
+    return 0;
+}
+
+// En- or Disable a Button inside of the toolbar and the Context Menu
+int SetButton (DWORD id, BOOL state) 
+{
+	// Change the Toorbar Button
+    TBBUTTONINFO ti;
+
+    ti.cbSize = sizeof (ti);
+    ti.dwMask = TBIF_STATE;
+
+	if(state)
+		ti.fsState = TBSTATE_ENABLED;
+	else
+		ti.fsState = TBSTATE_INDETERMINATE;
+
+    SendMessage (hTBar, TB_SETBUTTONINFO, id, (LPARAM)&ti);
+
+	// Change the Context Menu item
+	MENUITEMINFO mi;
+
+    mi.cbSize = sizeof (mi);
+    mi.fMask = MIIM_STATE;
+
+	if(state)
+		mi.fState = MFS_ENABLED;
+
+	else
+		mi.fState = MFS_GRAYED;
+
+    SetMenuItemInfo(hPopup, id, FALSE, &mi);
+
+	return 0;
+}
+
+// Set the text of the text box
+int SetText (const char* text) 
+{
+	int i, j;
+	char buffer [2000];
+
+	if(!text)
+		return 1;
+
+	// the windows does not need "\n"
+	// for new lines but "\r\n"
+	for(i=0,j=0; text[i]; i++,j++)
+	{
+		buffer[j] = text[i];
+		if(buffer[j] == '\n')
+		{
+			buffer[j] = '\r';
+			buffer[++j] = '\n';
+		}
+	}
+	buffer[j] = 0;
+
+	SetWindowTextA(hEdit, buffer);
+
+    return 0;
+}
+
+// Windows Message Callback (this is where most things happen)
+LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+	switch (message)
+	{
+		// at the very beginning ...
+		case WM_CREATE:
+		{
+			InitControls(hwnd);
+		} 
+		break;
+
+		// calculate the size of the controls
+		case WM_SIZE:
+		{
+            RECT rcl;
+            SendMessage(hTBar, TB_AUTOSIZE, 0L, 0L);
+            GetWindowRect(hTBar, &rcl);
+
+			int win_top = rcl.bottom - rcl.top;
+			int win_hight = HIWORD(lParam) - win_top;
+
+            MoveWindow(hTree, 0, win_top, LOWORD(lParam), splitter_pos*win_hight/100, TRUE);
+            MoveWindow(hEdit, 0, (splitter_pos*win_hight/100)+win_top, LOWORD(lParam), win_hight, TRUE);
+		}
+	    break;
+
+		// for the treeview
+		case WM_NOTIFY:
+		{
+			if(((LPNMHDR)lParam)->code == TVN_SELCHANGED) 
+			{
+				selected = ((LPNMTREEVIEW)lParam)->itemNew.lParam; 
+				PML_LoadPackage (tree, selected, SetButton);
+				SetText(PML_GetDescription (tree, selected));
+			}
+
+			else if ((int)(((LPNMHDR)lParam)->code) == NM_RCLICK) // <= aarrggg LISP
+			{ 
+				// which item has been click on
+				HTREEITEM item = TreeView_GetDropHilight(hTree);
+
+				if(item != NULL)
+				{
+					// mark the one as seleacted
+					SendMessage (hTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)item);
+					TreeView_EnsureVisible (hTree, item);
+				}
+
+				// create the context menu
+				if(selected != 0)
+				{
+					POINT pt;
+					GetCursorPos (&pt);
+					TrackPopupMenu (GetSubMenu(hPopup, 0), 0, (UINT)pt.x, (UINT)pt.y, 0, hwnd, NULL);
+				}
+			}
+		}
+		break;
+
+		// for the toolbar
+		case WM_COMMAND:
+		{
+			// All Actions
+			if(LOWORD(wParam) <= 5 && LOWORD(wParam) >= 1)
+			{
+				if(selected)
+					if(PML_SetAction(tree, selected, LOWORD(wParam)-1, SetIcon, Ask) == ERR_OK)
+						break;
+
+				MessageBeep(MB_ICONHAND);
+			}
+
+			// DoIt
+			else if(LOWORD(wParam)==6)
+			{
+				if(PML_DoIt(tree, SetStatus, Ask) == ERR_OK)
+					DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DOIT), hwnd, StatusProc);
+				else
+					MessageBeep(MB_ICONHAND);
+			}
+
+			// Help
+			else if(LOWORD(wParam)==7)
+				Help();
+
+			// Options
+			else if(LOWORD(wParam)==8)
+				DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS), hwnd, OptionsProc);
+		}
+		break;
+
+		// prozess hotkeys
+		case WM_HOTKEY:
+		{
+			if(PML_SetAction(tree, selected, wParam, SetIcon, Ask) != ERR_OK)
+				MessageBeep(MB_ICONHAND);
+		}
+		break;
+
+		// ... at the very end
+		case WM_DESTROY:
+		{
+			PostQuitMessage(0);
+			return 0;
+		}
+	}
+
+	return DefWindowProc (hwnd, message, wParam, lParam);
+}
+
+// Warning: This function is called from another thread
+int SetStatus (int status1, int status2, WCHAR* text)
+{
+	WCHAR errbuf[2000];
+
+	// Set the Rage to 1000
+	SendMessage(GetDlgItem(hStatus, IDC_STATUS1), PBM_SETRANGE32, 0, 1000);
+	SendMessage(GetDlgItem(hStatus, IDC_STATUS2), PBM_SETRANGE32, 0, 1000);
+
+	// The prozessbars and the text filds
+	if(text)
+		SetDlgItemText(hStatus, IDC_TSTATUS, text);
+
+	if(status1!=-1)
+		SendMessage(GetDlgItem(hStatus, IDC_STATUS1), PBM_SETPOS, status1, 0);
+
+	if(status2!=-1)
+		SendMessage(GetDlgItem(hStatus, IDC_STATUS2), PBM_SETPOS, status2, 0);
+
+	// If the Status is 1000 everything is done
+	if(status1==1000)
+	{
+		EndDialog(hStatus, TRUE);
+		MessageBox(0,PML_TransError(status2, errbuf, sizeof(errbuf)/sizeof(WCHAR)),0,0);
+	}
+
+	return 0;
+}
+
+// Callback for the Status Dialog
+INT_PTR CALLBACK StatusProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    switch (msg)
+    {
+		case WM_INITDIALOG:
+		{
+			hStatus = hwnd;
+			
+		} break;
+
+		case WM_COMMAND: // can only be the about button
+		case WM_CLOSE: // the close-window-[x]
+		{
+			PML_Abort();
+			EndDialog(hwnd, TRUE);
+			return 0;
+		}
+    }
+
+    return 0;
+}
+
+// Callback for the Options Dialog
+INT_PTR CALLBACK OptionsProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    switch (msg)
+    {
+		case WM_CLOSE:
+			EndDialog(hwnd, TRUE);
+			return 0;
+    }
+
+    return 0;
+}

Added: trunk/rosapps/packmgr/gui/main.h
--- trunk/rosapps/packmgr/gui/main.h	2006-01-30 08:00:33 UTC (rev 43)
+++ trunk/rosapps/packmgr/gui/main.h	2006-01-30 18:44:22 UTC (rev 44)
@@ -0,0 +1,45 @@
+///////////////////////////////////////////////////
+//
+// main.h
+//				main.cpp's lumber room :)
+///////////////////////////////////////////////////
+
+#include <windows.h>
+#include <commctrl.h>
+#include <stdio.h>
[truncated at 1000 lines; 3555 more skipped]