add getfirefox and shutdown code
Modified: trunk/reactos/base/applications/applications.rbuild
Added: trunk/reactos/base/applications/getfirefox/
Added: trunk/reactos/base/applications/getfirefox/De.rc
Added: trunk/reactos/base/applications/getfirefox/En.rc
Added: trunk/reactos/base/applications/getfirefox/Fr.rc
Added: trunk/reactos/base/applications/getfirefox/Hu.rc
Added: trunk/reactos/base/applications/getfirefox/firefox.ico
Added: trunk/reactos/base/applications/getfirefox/getfirefox.c
Added: trunk/reactos/base/applications/getfirefox/getfirefox.rbuild
Added: trunk/reactos/base/applications/getfirefox/getfirefox.rc
Added: trunk/reactos/base/applications/getfirefox/precomp.h
Added: trunk/reactos/base/applications/getfirefox/resource.h
Added: trunk/reactos/base/applications/shutdown/
Added: trunk/reactos/base/applications/shutdown/shutdown.c
Added: trunk/reactos/base/applications/shutdown/shutdown.rbuild

Modified: trunk/reactos/base/applications/applications.rbuild
--- trunk/reactos/base/applications/applications.rbuild	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/applications.rbuild	2006-02-04 12:55:04 UTC (rev 87)
@@ -5,12 +5,18 @@
   <directory name="games">
     <xi:include href="games/games.rbuild" />
   </directory>
-  <directory name="network">
-    <xi:include href="network/network.rbuild" />
+  <directory name="getfirefox">
+    <xi:include href="getfirefox/getfirefox.rbuild" />
   </directory>
   <directory name="ibrowser">
     <xi:include href="ibrowser/ibrowser.rbuild" />
   </directory>
+  <directory name="network">
+    <xi:include href="network/network.rbuild" />
+  </directory>
+  <directory name="shutdown">
+    <xi:include href="shutdown/shutdown.rbuild" />
+  </directory>
   <directory name="winefile">
     <xi:include href="winefile/winefile.rbuild" />
   </directory>

Added: trunk/reactos/base/applications/getfirefox/De.rc
--- trunk/reactos/base/applications/getfirefox/De.rc	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/getfirefox/De.rc	2006-02-04 12:55:04 UTC (rev 87)
@@ -0,0 +1,44 @@
+/*
+ * PROJECT:     ReactOS utilities
+ * LICENSE:     GPL - See COPYING in the top level directory
+ * FILE:        apps/utils/getfirefox/En.rc
+ * PURPOSE:     English resources
+ * COPYRIGHT:   Copyright 2004 Mike McCormack for CodeWeavers
+ *              Copyright 2005 Ge van Geldorp (gvg@reactos.org)
+ */
+/*
+ * Based on Wine dlls/shdocvw/En.rc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT
+
+IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE  0, 0, 220, 76
+STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Lade Firefox herunter"
+FONT 8, "MS Shell Dlg"
+{
+ CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12
+ LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER
+ CHECKBOX "Entferne ""Get Firefox"" nach Fertigstellung aus dem Startmen³", IDC_REMOVE,
+           10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP
+}
+
+STRINGTABLE
+BEGIN
+ IDS_START_MENU_NAME "Get Firefox"
+END

Added: trunk/reactos/base/applications/getfirefox/En.rc
--- trunk/reactos/base/applications/getfirefox/En.rc	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/getfirefox/En.rc	2006-02-04 12:55:04 UTC (rev 87)
@@ -0,0 +1,44 @@
+/*
+ * PROJECT:     ReactOS utilities
+ * LICENSE:     GPL - See COPYING in the top level directory
+ * FILE:        apps/utils/getfirefox/En.rc
+ * PURPOSE:     English resources
+ * COPYRIGHT:   Copyright 2004 Mike McCormack for CodeWeavers
+ *              Copyright 2005 Ge van Geldorp (gvg@reactos.org)
+ */
+/*
+ * Based on Wine dlls/shdocvw/En.rc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
+
+IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE  0, 0, 220, 76
+STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Downloading Firefox"
+FONT 8, "MS Shell Dlg"
+{
+ CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12
+ LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER
+ CHECKBOX "Remove ""Get Firefox"" from Start Menu when done", IDC_REMOVE,
+           10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP
+}
+
+STRINGTABLE
+BEGIN
+ IDS_START_MENU_NAME "Get Firefox"
+END

Added: trunk/reactos/base/applications/getfirefox/Fr.rc
--- trunk/reactos/base/applications/getfirefox/Fr.rc	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/getfirefox/Fr.rc	2006-02-04 12:55:04 UTC (rev 87)
@@ -0,0 +1,45 @@
+/*
+ * PROJECT:     ReactOS utilities
+ * LICENSE:     GPL - See COPYING in the top level directory
+ * FILE:        apps/utils/getfirefox/En.rc
+ * PURPOSE:     French resources
+ * COPYRIGHT:   Copyright 2004 Mike McCormack for CodeWeavers
+ *              Copyright 2005 Ge van Geldorp (gvg@reactos.org)
+ *		    Copyright 2005 G. Maton (mustang9@gmail.com) - French translation
+ */
+/*
+ * Based on Wine dlls/shdocvw/En.rc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+
+IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE  0, 0, 220, 76
+STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "TÚlÚchargement de Firefox"
+FONT 8, "MS Shell Dlg"
+{
+ CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12
+ LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER
+ CHECKBOX "Supprimer ""Obtenir Firefox"" du Menu dÚmarrer une fois terminÚ", IDC_REMOVE,
+           10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Annuler", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP
+}
+
+STRINGTABLE
+BEGIN
+ IDS_START_MENU_NAME "Obtenir Firefox"
+END

Added: trunk/reactos/base/applications/getfirefox/Hu.rc
--- trunk/reactos/base/applications/getfirefox/Hu.rc	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/getfirefox/Hu.rc	2006-02-04 12:55:04 UTC (rev 87)
@@ -0,0 +1,45 @@
+/*
+ * PROJECT:     ReactOS utilities
+ * LICENSE:     GPL - See COPYING in the top level directory
+ * FILE:        apps/utils/getfirefox/En.rc
+ * PURPOSE:     English resources
+ * COPYRIGHT:   Copyright 2004 Mike McCormack for CodeWeavers
+ *              Copyright 2005 Ge van Geldorp (gvg@reactos.org)
+ *		Copyright 2005 Robert Horvath (talley@cubeclub.hu) - Hungarian translation
+ */
+/*
+ * Based on Wine dlls/shdocvw/En.rc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+LANGUAGE LANG_HUNGARIAN, SUBLANG_NEUTRAL
+
+IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE  0, 0, 220, 76
+STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "A Firefox let÷ltÚse"
+FONT 8, "MS Shell Dlg"
+{
+ CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12
+ LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER
+ CHECKBOX "A ""Szerezd meg a Firefoxot"" elvßtolÝtßsa a Start Men³b§l befejezÚs utßn", IDC_REMOVE,
+           10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "MÚgse", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP
+}
+
+STRINGTABLE
+BEGIN
+ IDS_START_MENU_NAME "Szerezd meg Firefoxot"
+END

Added: trunk/reactos/base/applications/getfirefox/firefox.ico
(Binary files differ)
Property changes on: trunk/reactos/base/applications/getfirefox/firefox.ico
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/reactos/base/applications/getfirefox/getfirefox.c
--- trunk/reactos/base/applications/getfirefox/getfirefox.c	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/getfirefox/getfirefox.c	2006-02-04 12:55:04 UTC (rev 87)
@@ -0,0 +1,383 @@
+/*
+ * PROJECT:     ReactOS utilities
+ * LICENSE:     GPL - See COPYING in the top level directory
+ * FILE:        apps/utils/getfirefox/getfirefox.c
+ * PURPOSE:     Main program
+ * COPYRIGHT:   Copyright 2001 John R. Sheets (for CodeWeavers)
+ *              Copyright 2004 Mike McCormack (for CodeWeavers)
+ *              Copyright 2005 Ge van Geldorp (gvg@reactos.org)
+ */
+/*
+ * Based on Wine dlls/shdocvw/shdocvw_main.c
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include <precomp.h>
+
+#define NDEBUG
+#include <debug.h>
+
+#define DOWNLOAD_URL L"http://links.reactos.org/getfirefox"
+
+typedef struct _IBindStatusCallbackImpl
+  {
+    const IBindStatusCallbackVtbl *vtbl;
+    LONG ref;
+    HWND hDialog;
+    BOOL *pbCancelled;
+  } IBindStatusCallbackImpl;
+
+static HRESULT WINAPI
+dlQueryInterface(IBindStatusCallback* This, REFIID riid, void** ppvObject)
+{
+  if (NULL == ppvObject)
+    {
+      return E_POINTER;
+    }
+    
+  if (IsEqualIID(riid, &IID_IUnknown) ||
+      IsEqualIID(riid, &IID_IBindStatusCallback))
+    {
+      IBindStatusCallback_AddRef( This );
+      *ppvObject = This;
+      return S_OK;
+    }
+
+  return E_NOINTERFACE;
+}
+
+static ULONG WINAPI
+dlAddRef(IBindStatusCallback* iface)
+{
+  IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
+    
+  return InterlockedIncrement(&This->ref);
+}
+
+static ULONG WINAPI
+dlRelease(IBindStatusCallback* iface)
+{
+  IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
+  DWORD ref = InterlockedDecrement(&This->ref);
+    
+  if( !ref )
+    {
+      DestroyWindow( This->hDialog );
+      HeapFree(GetProcessHeap(), 0, This);
+    }
+    
+  return ref;
+}
+
+static HRESULT WINAPI
+dlOnStartBinding(IBindStatusCallback* iface, DWORD dwReserved, IBinding* pib)
+{
+  DPRINT1("OnStartBinding not implemented\n");
+
+  return S_OK;
+}
+
+static HRESULT WINAPI
+dlGetPriority(IBindStatusCallback* iface, LONG* pnPriority)
+{
+  DPRINT1("GetPriority not implemented\n");
+
+  return S_OK;
+}
+
+static HRESULT WINAPI
+dlOnLowResource( IBindStatusCallback* iface, DWORD reserved)
+{
+  DPRINT1("OnLowResource not implemented\n");
+
+  return S_OK;
+}
+
+static HRESULT WINAPI
+dlOnProgress(IBindStatusCallback* iface, ULONG ulProgress,
+             ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
+{
+  IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
+  HWND Item;
+  LONG r;
+  WCHAR OldText[100];
+
+  Item = GetDlgItem(This->hDialog, IDC_PROGRESS);
+  if (NULL != Item && 0 != ulProgressMax)
+    {
+      SendMessageW(Item, PBM_SETPOS, (ulProgress * 100) / ulProgressMax, 0);
+    }
+
+  Item = GetDlgItem(This->hDialog, IDC_STATUS);
+  if (NULL != Item)
+    {
+      SendMessageW(Item, WM_GETTEXT, sizeof(OldText) / sizeof(OldText[0]),
+                   (LPARAM) OldText);
+      if (sizeof(OldText) / sizeof(OldText[0]) - 1 <= wcslen(OldText) ||
+          0 != wcscmp(OldText, szStatusText))
+        {
+          SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) szStatusText);
+        }
+    }
+
+  SetLastError(0);
+  r = GetWindowLongPtrW(This->hDialog, GWLP_USERDATA);
+  if (0 != r || 0 != GetLastError())
+    {
+      *This->pbCancelled = TRUE;
+      DPRINT("Cancelled\n");
+      return E_ABORT;
+    }
+
+  return S_OK;
+}
+
+static HRESULT WINAPI
+dlOnStopBinding(IBindStatusCallback* iface, HRESULT hresult, LPCWSTR szError)
+{
+  DPRINT1("OnStopBinding not implemented\n");
+
+  return S_OK;
+}
+
+static HRESULT WINAPI
+dlGetBindInfo(IBindStatusCallback* iface, DWORD* grfBINDF, BINDINFO* pbindinfo)
+{
+  DPRINT1("GetBindInfo not implemented\n");
+
+  return S_OK;
+}
+
+static HRESULT WINAPI
+dlOnDataAvailable(IBindStatusCallback* iface, DWORD grfBSCF,
+                  DWORD dwSize, FORMATETC* pformatetc, STGMEDIUM* pstgmed)
+{
+  DPRINT1("OnDataAvailable implemented\n");
+
+  return S_OK;
+}
+
+static HRESULT WINAPI
+dlOnObjectAvailable(IBindStatusCallback* iface, REFIID riid, IUnknown* punk)
+{
+  DPRINT1("OnObjectAvailable implemented\n");
+
+  return S_OK;
+}
+
+static const IBindStatusCallbackVtbl dlVtbl =
+{
+    dlQueryInterface,
+    dlAddRef,
+    dlRelease,
+    dlOnStartBinding,
+    dlGetPriority,
+    dlOnLowResource,
+    dlOnProgress,
+    dlOnStopBinding,
+    dlGetBindInfo,
+    dlOnDataAvailable,
+    dlOnObjectAvailable
+};
+
+static IBindStatusCallback*
+CreateDl(HWND Dlg, BOOL *pbCancelled)
+{
+  IBindStatusCallbackImpl *This;
+
+  This = HeapAlloc(GetProcessHeap(), 0, sizeof(IBindStatusCallbackImpl));
+  This->vtbl = &dlVtbl;
+  This->ref = 1;
+  This->hDialog = Dlg;
+  This->pbCancelled = pbCancelled;
+
+  return (IBindStatusCallback*) This;
+}
+
+static BOOL
+GetShortcutName(LPWSTR ShortcutName)
+{
+  if (! SHGetSpecialFolderPathW(0, ShortcutName, CSIDL_PROGRAMS, FALSE))
+    {
+      return FALSE;
+    }
+  if (NULL == PathAddBackslashW(ShortcutName))
+    {
+      return FALSE;
+    }
+  if (0 == LoadStringW(GetModuleHandle(NULL), IDS_START_MENU_NAME,
+                       ShortcutName + wcslen(ShortcutName),
+                       MAX_PATH - wcslen(ShortcutName)))
+    {
+      return FALSE;
+    }
+  if (MAX_PATH - 5 < wcslen(ShortcutName))
+    {
+      return FALSE;
+    }
+  wcscat(ShortcutName, L".lnk");
+
+  return TRUE;
+}
+
+static DWORD WINAPI
+ThreadFunc(LPVOID Context)
+{
+  static const WCHAR szUrl[] = DOWNLOAD_URL;
+  IBindStatusCallback *dl;
+  WCHAR path[MAX_PATH], ShortcutName[MAX_PATH];
+  LPWSTR p;
+  STARTUPINFOW si;
+  PROCESS_INFORMATION pi;
+  HWND Dlg = (HWND) Context;
+  DWORD r;
+  BOOL bCancelled = FALSE;
+  BOOL bTempfile = FALSE;
+
+  /* built the path for the download */
+  p = wcsrchr(szUrl, L'/');
+  if (NULL == p)
+    {
+      goto end;
+    }
+  if (! GetTempPathW(MAX_PATH, path))
+    {
+      goto end;
+    }
+  wcscat(path, p + 1);
+
+  /* download it */
+  bTempfile = TRUE;
+  dl = CreateDl(Context, &bCancelled);
+  r = URLDownloadToFileW(NULL, szUrl, path, 0, dl);
+  if (NULL != dl)
+    {
+      IBindStatusCallback_Release(dl);
+    }
+  if (S_OK != r || bCancelled )
+    {
+      goto end;
+    }
+  ShowWindow(Dlg, SW_HIDE);
+
+  /* run it */
+  memset(&si, 0, sizeof(si));
+  si.cb = sizeof(si);
+  r = CreateProcessW(path, NULL, NULL, NULL, 0, 0, NULL, NULL, &si, &pi);
+  if (0 == r)
+    {
+      goto end;
+    }
+  CloseHandle(pi.hThread);
+  WaitForSingleObject(pi.hProcess, INFINITE);
+  CloseHandle(pi.hProcess);
+
+  if (BST_CHECKED == SendMessageW(GetDlgItem(Dlg, IDC_REMOVE), BM_GETCHECK,
+                                  0, 0) &&
+      GetShortcutName(ShortcutName))
+    {
+      DeleteFileW(ShortcutName);
+    }
+
+end:
+  if (bTempfile)
+    {
+      DeleteFileW(path);
+    }
+  EndDialog(Dlg, 0);
+  return 0;
+}
+
+static INT_PTR CALLBACK
+dlProc(HWND Dlg, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+  HANDLE Thread;
+  DWORD ThreadId;
+  HWND Item;
+  HICON Icon;
+  WCHAR ShortcutName[MAX_PATH];
+
+  switch (Msg)
+    {
+    case WM_INITDIALOG:
+      Icon = LoadIconW((HINSTANCE) GetWindowLongPtr(Dlg, GWLP_HINSTANCE),
+                       MAKEINTRESOURCEW(IDI_ICON_MAIN));
+      if (NULL != Icon)
+        {
+          SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM) Icon);
+          SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM) Icon);
+        }
+      SetWindowLongPtrW(Dlg, GWLP_USERDATA, 0);
+      Item = GetDlgItem(Dlg, IDC_PROGRESS);
+      if (NULL != Item)
+        {
+          SendMessageW(Item, PBM_SETRANGE, 0, MAKELPARAM(0,100));
+          SendMessageW(Item, PBM_SETPOS, 0, 0);
+        }
+      Item = GetDlgItem(Dlg, IDC_REMOVE);
+      if (NULL != Item)
+        {
+          if (GetShortcutName(ShortcutName) &&
+              INVALID_FILE_ATTRIBUTES != GetFileAttributesW(ShortcutName))
+            {
+              SendMessageW(Item, BM_SETCHECK, BST_CHECKED, 0);
+            }
+          else
+            {
+              SendMessageW(Item, BM_SETCHECK, BST_UNCHECKED, 0);
+              ShowWindow(Item, SW_HIDE);
+            }
+        }
+      Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId);
+      if (NULL == Thread)
+        {
+          return FALSE;
+        }
+      CloseHandle(Thread);
+      return TRUE;
+
+    case WM_COMMAND:
+      if (wParam == IDCANCEL)
+        {
+          SetWindowLongPtrW(Dlg, GWLP_USERDATA, 1);
+          PostMessage(Dlg, WM_CLOSE, 0, 0);
+        }
+      return FALSE;
+
+    case WM_CLOSE:
+        EndDialog(Dlg, 0);
+        return TRUE;
+
+	default:
+      return FALSE;
+    }
+}
+
+
+/***********************************************************************
+ *              Main program
+ */
+int
+main(int argc, char *argv[])
+{
+  InitCommonControls();
+
+  DialogBoxW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_GETFIREFOX), 0,
+             dlProc);
+
+  return 0;
+}

Added: trunk/reactos/base/applications/getfirefox/getfirefox.rbuild
--- trunk/reactos/base/applications/getfirefox/getfirefox.rbuild	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/getfirefox/getfirefox.rbuild	2006-02-04 12:55:04 UTC (rev 87)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<rbuild xmlns:xi="http://www.w3.org/2001/XInclude">
+  <group>
+	<module name="getfirefox" type="win32gui" installbase="system32" installname="getfirefox.exe">
+	    <include base="getfirefox">.</include>
+	    <define name="UNICODE" />
+	    <define name="_UNICODE" />
+	    <define name="__USE_W32API" />
+	    <define name="WINVER">0x0501</define>
+	    <define name="_WIN32_IE>0x0600</define>
+	    <library>comctl32</library>
+	    <library>ntdll</library>
+	    <library>shell32</library>
+	    <library>shlwapi</library>
+	    <library>urlmon</library>
+	    <library>uuid</library>
+	    <pch>precomp.h</pch>
+	    <file>getfirefox.c</file>
+	    <file>getfirefox.rc</file>
+	</module>
+  </group>
+</rbuild>

Added: trunk/reactos/base/applications/getfirefox/getfirefox.rc
--- trunk/reactos/base/applications/getfirefox/getfirefox.rc	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/getfirefox/getfirefox.rc	2006-02-04 12:55:04 UTC (rev 87)
@@ -0,0 +1,28 @@
+/*
+ * PROJECT:     ReactOS utilities
+ * LICENSE:     GPL - See COPYING in the top level directory
+ * FILE:        apps/utils/getfirefox/getfirefox.rc
+ * PURPOSE:     Language-independent resources
+ * COPYRIGHT:   Copyright 2005 Ge van Geldorp (gvg@reactos.org)
+ */
+
+#include <windows.h>
+#include "resource.h"
+
+#define REACTOS_STR_FILE_DESCRIPTION    "Firefox downloader\0"
+#define REACTOS_STR_INTERNAL_NAME       "getfirefox\0"
+#define REACTOS_STR_ORIGINAL_FILENAME   "getfirefox.exe\0"
+#include <reactos/version.rc>
+
+/*
+ * Note: this icon is the "default logo" referenced here:
+ * http://www.mozilla.org/foundation/trademarks/faq.html (under "What are the
+ * Mozilla Trademarks and Logos?"). Don't use the official Firefox logo as it
+ * is trademarked.
+ */
+1 ICON  "firefox.ico"
+
+#include "De.rc"
+#include "En.rc"
+#include "Fr.rc"
+#include "Hu.rc"

Added: trunk/reactos/base/applications/getfirefox/precomp.h
--- trunk/reactos/base/applications/getfirefox/precomp.h	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/getfirefox/precomp.h	2006-02-04 12:55:04 UTC (rev 87)
@@ -0,0 +1,19 @@
+/*
+ * PROJECT:     ReactOS utilities
+ * LICENSE:     GPL - See COPYING in the top level directory
+ * FILE:        apps/utils/getfirefox/precomp.h
+ * PURPOSE:     Precompiled header file
+ * COPYRIGHT:   Copyright 2005 Ge van Geldorp (gvg@reactos.org)
+ */
+
+#define COBJMACROS
+#define NTOS_MODE_USER
+#define WIN32_NO_STATUS
+#include <windows.h>
+#include <ndk/ntndk.h>
+#include <commctrl.h>
+#include <shlobj.h>
+#include <shlwapi.h>
+#include <urlmon.h>
+
+#include "resource.h"

Added: trunk/reactos/base/applications/getfirefox/resource.h
--- trunk/reactos/base/applications/getfirefox/resource.h	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/getfirefox/resource.h	2006-02-04 12:55:04 UTC (rev 87)
@@ -0,0 +1,17 @@
+/*
+ * PROJECT:     ReactOS utilities
+ * LICENSE:     GPL - See COPYING in the top level directory
+ * FILE:        apps/utils/getfirefox/resource.h
+ * PURPOSE:     Resource constants
+ * COPYRIGHT:   Copyright 2005 Ge van Geldorp (gvg@reactos.org)
+ */
+
+#define IDI_ICON_MAIN 1
+
+#define IDD_GETFIREFOX 100
+
+#define IDC_PROGRESS 1000
+#define IDC_STATUS   1001
+#define IDC_REMOVE   1002
+
+#define IDS_START_MENU_NAME 1100

Added: trunk/reactos/base/applications/shutdown/shutdown.c
--- trunk/reactos/base/applications/shutdown/shutdown.c	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/shutdown/shutdown.c	2006-02-04 12:55:04 UTC (rev 87)
@@ -0,0 +1,170 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS shutdown/logoff utility
+ * FILE:            apps/utils/shutdown/shutdown.c
+ * PURPOSE:         Initiate logoff, shutdown or reboot of the system
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <windows.h>
+#include <tchar.h>
+
+static void
+PrintUsage(LPCTSTR Cmd)
+{
+  _ftprintf(stderr, _T("usage: %s [action] [flag]\n"), Cmd);
+  _ftprintf(stderr, _T(" action = \"logoff\", \"reboot\", \"shutdown\" or \"poweroff\"\n"));
+  _ftprintf(stderr, _T(" flag = \"force\"\n"));
+}
+
+int
+_tmain(int argc, TCHAR *argv[])
+{
+  static struct
+    {
+      TCHAR *Name;
+      UINT ExitType;
+      UINT ExitFlags;
+    }
+  Options[] =
+    {
+      { _T("logoff"), EWX_LOGOFF, 0 },
+      { _T("logout"), EWX_LOGOFF, 0 },
+      { _T("poweroff"), EWX_POWEROFF, 0 },
+      { _T("powerdown"), EWX_POWEROFF, 0 },
+      { _T("reboot"), EWX_REBOOT, 0 },
+      { _T("restart"), EWX_REBOOT, 0 },
+      { _T("shutdown"), EWX_SHUTDOWN, 0 },
+      { _T("force"), 0, EWX_FORCE },
+      { _T("forceifhung"), 0, EWX_FORCEIFHUNG },
+      { _T("ifhung"), 0, EWX_FORCEIFHUNG },
+      { _T("hung"), 0, EWX_FORCEIFHUNG },
+    };
+  UINT ExitType, ExitFlags;
+  HANDLE hToken;
+  TOKEN_PRIVILEGES npr;
+  TCHAR *Arg;
+  TCHAR BaseName[_MAX_FNAME];
+  unsigned i, j;
+  BOOL HaveType, Matched;
+
+  ExitType = 0;
+  ExitFlags = 0;
+  HaveType = FALSE;
+
+  _tsplitpath(argv[0], NULL, NULL, BaseName, NULL);
+
+  /* Process optional arguments */
+  for (i = 1; i < (unsigned) argc; i++)
+    {
+      /* Allow e.g. "/s" or "-l" for shutdown resp. logoff */
+      Arg = argv[i];
+      if (_T('/') == *Arg || _T('-') == *Arg)
+        {
+          Arg++;
+        }
+
+      /* Search known options */
+      Matched = FALSE;
+      for (j = 0; j < sizeof(Options) / sizeof(Options[0]) && ! Matched; j++)
+        {
+          /* Match if arg starts the same as the option name */
+          if (0 == _tcsnicmp(Options[j].Name, Arg, _tcslen(Arg)))
+            {
+              if (0 == Options[j].ExitFlags)
+                {
+                  /* Can have only 1 type */
+                  if (HaveType)
+                    {
+                      PrintUsage(BaseName);
+                      exit(1);
+                    }
+                  ExitType = Options[j].ExitType;
+                  HaveType = TRUE;
+                }
+              else
+                {
+                  /* Can have only 1 flag */
+                  if (0 != ExitFlags)
+                    {
+                      PrintUsage(BaseName);
+                      exit(1);
+                    }
+                  ExitFlags |= Options[j].ExitFlags;
+                }
+              Matched = TRUE;
+            }
+        }
+
+      /* Was the argument processed? */
+      if (! Matched)
+        {
+          PrintUsage(BaseName);
+          exit(1);
+        }
+    }
+
+  /* Check command name if user didn't explicitly specify action */
+  if (! HaveType)
+    {
+      for (j = 0; j < sizeof(Options) / sizeof(Options[0]); j++)
+        {
+          if (0 == _tcsicmp(Options[j].Name, BaseName) && 0 == Options[j].ExitFlags)
+            {
+              ExitType = Options[j].ExitType;
+              HaveType = TRUE;
+            }
+        }
+    }
+
+  /* Still not sure what to do? */
+  if (! HaveType)
+    {
+      PrintUsage(BaseName);
+      exit(1);
+    }
+
+  /* Everyone can logoff, for the other actions you need the appropriate privilege */
+  if (EWX_LOGOFF != ExitType)
+    {
+      /* enable shutdown privilege for current process */
+      if (! OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken))
+        {
+          _ftprintf(stderr, _T("OpenProcessToken failed with error %d\n"), (int) GetLastError());
+          exit(1);
+        }
+      npr.PrivilegeCount = 1;
+      npr.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+      if (! LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &npr.Privileges[0].Luid))
+        {
+          CloseHandle(hToken);
+          _ftprintf(stderr, _T("LookupPrivilegeValue failed with error %d\n"), (int) GetLastError());
+          exit(1);
+        }
+      if (! AdjustTokenPrivileges(hToken, FALSE, &npr, 0, 0, 0)
+          || ERROR_SUCCESS != GetLastError())
+        {
+          if (ERROR_NOT_ALL_ASSIGNED == GetLastError())
+            {
+              _ftprintf(stderr, _T("You are not authorized to shutdown the system\n"));
+            }
+          else
+            {
+              _ftprintf(stderr, _T("AdjustTokenPrivileges failed with error %d\n"), (int) GetLastError());
+            }
+          CloseHandle(hToken);
+          exit(1);
+        }
+      CloseHandle(hToken);
+    }
+
+  /* Finally do it */
+  if (! ExitWindowsEx(ExitType | ExitFlags, 0))
+    {
+      _ftprintf(stderr, _T("ExitWindowsEx failed with error %d\n"), (int) GetLastError());
+      exit(1);
+    }
+
+  return 0;
+}

Added: trunk/reactos/base/applications/shutdown/shutdown.rbuild
--- trunk/reactos/base/applications/shutdown/shutdown.rbuild	2006-02-04 12:39:36 UTC (rev 86)
+++ trunk/reactos/base/applications/shutdown/shutdown.rbuild	2006-02-04 12:55:04 UTC (rev 87)
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<rbuild xmlns:xi="http://www.w3.org/2001/XInclude">
+  <group>
+	<module name="shutdown" type="win32cui" installbase="system32" installname="shutdown.exe">
+	    <include base="shutdown">.</include>
+	    <define name="__USE_W32API" />
+	    <define name="WINVER">0x0501</define>
+	    <file>shutdown.c</file>
+	</module>
+  </group>
+</rbuild>