ReactOS Package Manager
More information:
http://reactos.com/wiki/index.php/ReactOS_Package_Manager
* Maarten Bosma (Dr. Fred)
* Klemens Friedl (frik85)
Added: trunk/rosapps/packmgr/
Added: trunk/rosapps/packmgr/gui/
Added: trunk/rosapps/packmgr/gui/en.rc
Added: trunk/rosapps/packmgr/gui/generic.rc
Added: trunk/rosapps/packmgr/gui/main.cpp
Added: trunk/rosapps/packmgr/gui/main.h
Added: trunk/rosapps/packmgr/gui/makefile
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/help.txt
Added: trunk/rosapps/packmgr/lib/
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/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/makefile
Added: trunk/rosapps/packmgr/lib/package.cpp
Added: trunk/rosapps/packmgr/lib/package.def
Added: trunk/rosapps/packmgr/lib/package.hpp
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/makefile
Added: trunk/rosapps/packmgr/tree/
Added: trunk/rosapps/packmgr/tree/abiword.inst.rps
Added: trunk/rosapps/packmgr/tree/abiword.xml
Added: trunk/rosapps/packmgr/tree/mozcontrol.xml
Added: trunk/rosapps/packmgr/tree/mozillacontrol.inst.rps
Added: trunk/rosapps/packmgr/tree/tree.xml
_____
Added: trunk/rosapps/packmgr/gui/en.rc
--- trunk/rosapps/packmgr/gui/en.rc 2005-04-03 15:47:15 UTC (rev
14480)
+++ trunk/rosapps/packmgr/gui/en.rc 2005-04-03 19:06:49 UTC (rev
14481)
@@ -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 "Unnstall", 5, GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "Options", 8
+ MENUITEM SEPARATOR
+ MENUITEM "DoIt", 6
+ END
+END
+
_____
Added: trunk/rosapps/packmgr/gui/generic.rc
--- trunk/rosapps/packmgr/gui/generic.rc 2005-04-03 15:47:15 UTC
(rev 14480)
+++ trunk/rosapps/packmgr/gui/generic.rc 2005-04-03 19:06:49 UTC
(rev 14481)
@@ -0,0 +1,24 @@
+
+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"
+
_____
Added: trunk/rosapps/packmgr/gui/main.cpp
--- trunk/rosapps/packmgr/gui/main.cpp 2005-04-03 15:47:15 UTC (rev
14480)
+++ trunk/rosapps/packmgr/gui/main.cpp 2005-04-03 19:06:49 UTC (rev
14481)
@@ -0,0 +1,401 @@
+////////////////////////////////////////////////////////
+//
+// main.cpp
+//
+// Implementation of the Package Manager GUI
+//
+//
+// Maarten Bosma, 09.01.2004
+// maarten.paul(a)bosma.de
+//
+////////////////////////////////////////////////////////////////////
+
+#include "main.h"
+
+
+// Application's Entry Point
+int WINAPI WinMain (HINSTANCE hinst, HINSTANCE hPrevInstance, PSTR
szCmdLine, int iCmdShow)
+{
+ HWND hwnd;
+ MSG msg;
+ WNDCLASSEX wc = {0};
+
+ // 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.xml", AddItem);
+
+ if(error)
+ {
+ MessageBox(0,PML_TransError(error),0,0);
+ return 0;
+ }
+
+ // Read the help
+ Help();
+
+ // Start getting messages
+ while(GetMessage(&msg,NULL,0,0))
+ {
+ 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)
+{
+ string source;
+
+ ifstream file("help.txt", ios_base::in);
+ getline(file, source, '\0');
+
+ SetText(source.c_str());
+}
+
+// Create our Controls
+void InitControls (HWND hwnd)
+{
+
+ HINSTANCE hinst = GetModuleHandle(NULL);
+
+ // Create the controls
+ hTree = CreateWindowEx(0, WC_TREEVIEW, L"TreeView",
WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTON
S,
+ 0, 0, 0, 0,
hwnd, NULL, hinst, NULL);
+
+ hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"edit",
PML_TransError(IDS_LOAD), 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_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
+ RegisterHotKey(hwnd, 1, MOD_CONTROL, VK_1);
+ RegisterHotKey(hwnd, 2, MOD_CONTROL, VK_2);
+ RegisterHotKey(hwnd, 3, MOD_CONTROL, VK_3);
+ RegisterHotKey(hwnd, 4, MOD_CONTROL, VK_4);
+ RegisterHotKey(hwnd, 0, MOD_CONTROL, VK_0);
+}
+
+// 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;
+}
+
+// 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 1;
+}
+
+// Set the text of the text box
+int SetText (const char* text)
+{
+ int i = 0;
+ string source = text;
+
+ // the windows does not need "\n"
+ // for new lines but "\r\n"
+ for(i=0; source[i]; i++)
+ if(source[i]=='\n' && source[i]!='\r')
+ source.insert (i++, "\r");
+
+ SetWindowTextA(hEdit, source.c_str());
+
+ 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);
+ }
+
+ else if ((int)(((LPNMHDR)lParam)->code) ==
NM_RCLICK) // <= ahhh 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) == ERR_OK)
+ break;
+
+ MessageBeep(MB_ICONHAND);
+ }
+
+ // DoIt
+ else if(LOWORD(wParam)==6)
+ {
+ if(PML_DoIt(tree, SetStatus) == 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);
+
+ else
+ MessageBox(0,0,0,0);
+ }
+ break;
+
+ // prozess hotkeys
+ case WM_HOTKEY:
+ {
+ if(PML_SetAction(tree, selected, wParam,
SetIcon) != 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)
+{
+ // 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 very thing is done
+ if(status1==1000)
+ {
+ EndDialog(hStatus, TRUE);
+ MessageBox(0,PML_TransError(status2),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 2005-04-03 15:47:15 UTC (rev
14480)
+++ trunk/rosapps/packmgr/gui/main.h 2005-04-03 19:06:49 UTC (rev
14481)
@@ -0,0 +1,62 @@
+///////////////////////////////////////////////////
+//
+// main.h
+// main.cpp's lumber room :)
+///////////////////////////////////////////////////
+
+#include <windows.h>
+#include <ntos/keyboard.h>
+#include <commctrl.h>
+#include <iostream>
+#include <fstream>
+
+#include <package.hpp>
+#include "resource.h"
+
+/* Some Variables */
+
+int selected, splitter_pos = 50;
+
+pTree tree;
+HMENU hPopup;
+HWND hTBar, hTree, hEdit, hStatus;
+HTREEITEM nodes [MAXNODES];
+
+/* Window Callbacks */
+
+LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK StatusProc (HWND hDlg, UINT message, WPARAM wParam,
LPARAM lParam);
+INT_PTR CALLBACK OptionsProc (HWND hDlg, UINT message, WPARAM wParam,
LPARAM lParam);
+
+/* Prototypes */
+
+void Help (void);
+
+int AddItem (int id, const char* name, int parent, int icon);
+int SetText (const char* text);
+int SetStatus (int status1, int status2, WCHAR* text);
+
+/* Toolbar Releated */
+
+#define TBSTYLE_FLAT 2048
+
+// This is the struct where the toolbar is defined
+TBBUTTON Buttons [] =
+{
+ {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, 0},
+
+ {0, 1, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON, 0L, 0}, // No
Action
+ {1, 2, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON, 0L, 0}, // Install
+ {2, 3, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON, 0L, 0}, // Install
from source
+ {3, 4, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON, 0L, 0}, // Update
+ {4, 5, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON, 0L, 0}, //
Unistall
+
+ {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, 0},
+ {5, 6, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0}, // DoIt (tm)
+ {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, 0},
+
+ {6, 7, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0}, // Help
+ {7, 8, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0}, // Options
+
+ {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, 0},
+};
_____
Added: trunk/rosapps/packmgr/gui/makefile
--- trunk/rosapps/packmgr/gui/makefile 2005-04-03 15:47:15 UTC (rev
14480)
+++ trunk/rosapps/packmgr/gui/makefile 2005-04-03 19:06:49 UTC (rev
14481)
@@ -0,0 +1,24 @@
+
+TARGET_NAME = packmgr
+TARGET_TYPE = program
+TARGET_APPTYPE = windows
+PATH_TO_TOP = ../../../reactos
+
+TARGET_SDKLIBS = kernel32.a user32.a package.a gdi32.a comctl32.a
shell32.a
+
+TARGET_GCCLIBS = stdc++ uuid
+
+TARGET_OBJECTS = main.o
+
+
+TARGET_CFLAGS = \
+ -D__USE_W32API -DWIN32 -D_ROS_ \
+ -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 \
+ -DUNICODE -Wall -I../lib
+
+TARGET_CPPFLAGS = $(TARGET_CFLAGS)
+TARGET_RCFLAGS = -D__USE_W32API -DNDEBUG -DWIN32 -D_ROS_ -D__WINDRES__
-DUNICODE
+
+include $(PATH_TO_TOP)/rules.mak
+include $(TOOLS_PATH)/helper.mk
+include $(TOOLS_PATH)/depend.mk
_____
Added: trunk/rosapps/packmgr/gui/packmgr.rc
--- trunk/rosapps/packmgr/gui/packmgr.rc 2005-04-03 15:47:15 UTC
(rev 14480)
+++ trunk/rosapps/packmgr/gui/packmgr.rc 2005-04-03 19:06:49 UTC
(rev 14481)
@@ -0,0 +1,18 @@
+
+#include <windows.h>
+#include "resource.h"
+
+#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Package Manager\0"
+#define REACTOS_STR_INTERNAL_NAME "packmgr\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "packmgr.exe\0"
+
+#include <reactos/version.rc>
+
+/* For all langs */
+#include "generic.rc"
+
+/* Language specific */
+
+#include "en.rc"
+
+/* EOF */
_____
Added: trunk/rosapps/packmgr/gui/res/blank.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/blank.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/development.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/development.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/games.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/games.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/graphics.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/graphics.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/inet.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/inet.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/install.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/install.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/installed.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/installed.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/installsource.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/installsource.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/multimedia.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/multimedia.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/office.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/office.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/others.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/others.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/packetmanager.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/packetmanager.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/toolbar.bmp
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/toolbar.bmp
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/tools.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/tools.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/uninstall.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/uninstall.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/res/update.ico
(Binary files differ)
Property changes on: trunk/rosapps/packmgr/gui/res/update.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/rosapps/packmgr/gui/resource.h
--- trunk/rosapps/packmgr/gui/resource.h 2005-04-03 15:47:15 UTC
(rev 14480)
+++ trunk/rosapps/packmgr/gui/resource.h 2005-04-03 19:06:49 UTC
(rev 14481)
@@ -0,0 +1,14 @@
+#include "../lib/error.h"
+
+#define IDI_MAIN 0
+
+#define TBSIZE 32
+#define IDB_TOOLBAR 0x102
+#define IDD_OPTIONS 0x103
+#define IDD_DOIT 0x104
+#define IDR_POPUP 0x105
+
+#define IDC_STATUS1 0x110
+#define IDC_STATUS2 0x111
+#define IDC_CANCEL 0x112
+#define IDC_TSTATUS 0x113
_____
Added: trunk/rosapps/packmgr/help.txt
--- trunk/rosapps/packmgr/help.txt 2005-04-03 15:47:15 UTC (rev
14480)
+++ trunk/rosapps/packmgr/help.txt 2005-04-03 19:06:49 UTC (rev
14481)
@@ -0,0 +1,9 @@
+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.
+
_____
Added: trunk/rosapps/packmgr/lib/download.cpp
--- trunk/rosapps/packmgr/lib/download.cpp 2005-04-03 15:47:15 UTC
(rev 14480)
+++ trunk/rosapps/packmgr/lib/download.cpp 2005-04-03 19:06:49 UTC
(rev 14481)
@@ -0,0 +1,117 @@
+////////////////////////////////////////////////////////
+//
+// download.cpp
+//
+// Stuff related to downloading
+//
+//
+// Maarten Bosma, 09.01.2004
+// maarten.paul(a)bosma.de
+//
+////////////////////////////////////////////////////////
+
+#include "package.hpp"
+#include "expat.h"
+#include "log.h"
+#include <wine/urlmon.h>
+
+// Server there all the files lie
+const char* tree_server =
"http://svn.reactos.com/viewcvs/*checkout*/trunk/rosapps/packmgr/tree/";
+
+HRESULT WINAPI URLDownloadToFileA(
+ LPUNKNOWN pCaller,
+ LPCSTR szURL,
+ LPCSTR szFileName,
+ DWORD dwReserved,
+ LPBINDSTATUSCALLBACK lpfnCB
+);
+
+
+// Download a file
+char* PML_Download (const char* name, const char* local_name =
"packmgr.txt", const char* server = tree_server, BOOL totemp = TRUE)
+{
+ char url [MAX_PATH];
+ static char path [MAX_PATH];
+
+ // get temp dir
+ if(totemp)
+ GetTempPathA (200, path);
+
+ // create the local file name
+ if(local_name)
+ strcat(path, local_name);
+ else
+ strcat(path, "tmp.tmp");
+
+ // get the url
+ if(server) strcpy(url, server);
+ strcat(url, name);
+
+ // make sure there is no old file
+ DeleteFileA (path);
+
+ // download the file
+ if(URLDownloadToFileA (NULL, url, path, 0, NULL) != S_OK)
+ {
+ Log("! ERROR: Unable to download ");
+ LogAdd(url);
+
+ return NULL;
+ }
+
+ return path;
+}
+
+// Download and prozess a xml file
+int PML_XmlDownload (const char* url, void* usrdata,
XML_StartElementHandler start,
+ XML_EndElementHandler
end, XML_CharacterDataHandler text)
+{
+ char buffer[255];
+ int done = 0;
+
+ // logging
+ Log("* prozess the xml file: ");
+ LogAdd(url);
+
+ // download the file
+ char* filename = PML_Download(url);
+
+ if(!filename)
+ {
+ Log("! ERROR: Could not download the xml file");
+ return ERR_DOWNL;
+ }
+
+ // open the file
+ FILE* file = fopen(filename, "r");
+ if(!file)
+ {
+ Log("! ERROR: Could not open the xml file");
+ return ERR_GENERIC;
+ }
+
+ // parse the xml file
+ XML_Parser parser = XML_ParserCreate(NULL);
+ XML_SetUserData (parser, usrdata);
+ XML_SetElementHandler(parser, start, end);
+ XML_SetCharacterDataHandler(parser, text);
+
+ while (!done)
+ {
+ size_t len = fread (buffer, 1, sizeof(buffer), file);
+ done = len < sizeof(buffer);
+
+ buffer[len] = 0;
+ if(!XML_Parse(parser, buffer, len, done))
+ {
+ Log("! ERROR: Could not parse the xml file");
+ return ERR_GENERIC;
+ }
+ }
+
+ XML_ParserFree(parser);
+ fclose(file);
+
+ return ERR_OK;
+}
+
_____
Added: trunk/rosapps/packmgr/lib/en.rc
--- trunk/rosapps/packmgr/lib/en.rc 2005-04-03 15:47:15 UTC (rev
14480)
+++ trunk/rosapps/packmgr/lib/en.rc 2005-04-03 19:06:49 UTC (rev
14481)
@@ -0,0 +1,19 @@
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+/* String Tables */
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_LOAD "Loading ..."
+ ERR_OK "Operation done."
+ ERR_PACK "Not all packages could be installed\n\nPlease have a
look at the log file for details."
+ ERR_GENERIC "An error occured. \nFor more information please
have a look at the log file."
+ ERR_DOWNL "A needed file could not be downloaded!\nFor more
information please have a look at the log file."
+ ERR_FILE "Error while Script Execution.\nFile could not be
opened."
+
+ ERR_SYNATX "Error while Script Execution.\nWrong Synatx."
+ ERR_CALL "Error while Script Execution.\nCould not find
function."
+ ERR_PARAMETER "Error while Script Execution.\nWrong Parameter(s)."
+END
+
+/* EOF */
_____
Added: trunk/rosapps/packmgr/lib/error.h
--- trunk/rosapps/packmgr/lib/error.h 2005-04-03 15:47:15 UTC (rev
14480)
+++ trunk/rosapps/packmgr/lib/error.h 2005-04-03 19:06:49 UTC (rev
14481)
@@ -0,0 +1,16 @@
+// error.h
+
+#define ERR_OK 0x000
+#define ERR_GENERIC 0x001
+#define ERR_DOWNL 0x002
+#define ERR_NOTODO 0x003 // without text yet
+#define ERR_PACK 0x004
+
+// Script
+#define ERR_SYNATX 0x011
+#define ERR_CALL 0x012
+#define ERR_PARAMETER 0x013
+#define ERR_FILE 0x014
+
+#define IDS_LOAD 0x254
+#define NOTFOUND -1
_____
Added: trunk/rosapps/packmgr/lib/expat.h
--- trunk/rosapps/packmgr/lib/expat.h 2005-04-03 15:47:15 UTC (rev
14480)
+++ trunk/rosapps/packmgr/lib/expat.h 2005-04-03 19:06:49 UTC (rev
14481)
@@ -0,0 +1,1081 @@
+/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
+ See the file COPYING for copying permission.
+*/
+
+#ifndef XmlParse_INCLUDED
+#define XmlParse_INCLUDED 1
+
+#ifdef __VMS
+/* 0 1 2 3 0 1 2
3
+ 1234567890123456789012345678901
1234567890123456789012345678901 */
+#define XML_SetProcessingInstructionHandler
XML_SetProcessingInstrHandler
+#define XML_SetUnparsedEntityDeclHandler
XML_SetUnparsedEntDeclHandler
+#define XML_SetStartNamespaceDeclHandler
XML_SetStartNamespcDeclHandler
+#define XML_SetExternalEntityRefHandlerArg
XML_SetExternalEntRefHandlerArg
+#endif
+
+#include <stdlib.h>
+
+#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) &&
!defined(__CYGWIN__)
+#define XML_USE_MSC_EXTENSIONS 1
+#endif
+
+/* Expat tries very hard to make the API boundary very specifically
+ defined. There are two macros defined to control this boundary;
+ each of these can be defined before including this header to
+ achieve some different behavior, but doing so it not recommended or
+ tested frequently.
+
+ XMLCALL - The calling convention to use for all calls across the
+ "library boundary." This will default to cdecl, and
+ try really hard to tell the compiler that's what we
+ want.
+
+ XMLIMPORT - Whatever magic is needed to note that a function is
+ to be imported from a dynamically loaded library
+ (.dll, .so, or .sl, depending on your platform).
+
+ The XMLCALL macro was added in Expat 1.95.7. The only one which is
+ expected to be directly useful in client code is XMLCALL.
+
+ Note that on at least some Unix versions, the Expat library must be
+ compiled with the cdecl calling convention as the default since
+ system headers may assume the cdecl convention.
+*/
+#ifndef XMLCALL
+#if defined(XML_USE_MSC_EXTENSIONS)
+#define XMLCALL __cdecl
+#elif defined(__GNUC__) && defined(__i386)
+//MF#define XMLCALL __attribute__((cdecl))
+#define XMLCALL//MF
+#else
+/* For any platform which uses this definition and supports more than
+ one calling convention, we need to extend this definition to
+ declare the convention used on that platform, if it's possible to
+ do so.
+
+ If this is the case for your platform, please file a bug report
+ with information on how to identify your platform via the C
+ pre-processor and how to specify the same calling convention as the
+ platform's malloc() implementation.
+*/
+#define XMLCALL
+#endif
+#endif /* not defined XMLCALL */
+
+
+#if !defined(XML_STATIC) && !defined(XMLIMPORT)
+#ifndef XML_BUILDING_EXPAT
+/* using Expat from an application */
+
+#ifdef XML_USE_MSC_EXTENSIONS
+#define XMLIMPORT __declspec(dllimport)
+#endif
+
+#endif
+#endif /* not defined XML_STATIC */
+
+/* If we didn't define it above, define it away: */
+#ifndef XMLIMPORT
+#define XMLIMPORT
+#endif
[truncated at 1000 lines; 2399 more skipped]