Author: dreimer
Date: Sat Mar 6 17:18:09 2010
New Revision: 45955
URL:
http://svn.reactos.org/svn/reactos?rev=45955&view=rev
Log:
Add extrac32 from Wine 1.1.40
Added:
trunk/reactos/base/applications/extrac32/ (with props)
trunk/reactos/base/applications/extrac32/extrac32.c (with props)
trunk/reactos/base/applications/extrac32/extrac32.rbuild (with props)
Modified:
trunk/reactos/base/applications/applications.rbuild
Modified: trunk/reactos/base/applications/applications.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/applicat…
==============================================================================
--- trunk/reactos/base/applications/applications.rbuild [iso-8859-1] (original)
+++ trunk/reactos/base/applications/applications.rbuild [iso-8859-1] Sat Mar 6 17:18:09
2010
@@ -21,6 +21,9 @@
</directory>
<directory name="dxdiag">
<xi:include href="dxdiag/dxdiag.rbuild" />
+ </directory>
+ <directory name="extrac32">
+ <xi:include href="extrac32/extrac32.rbuild" />
</directory>
<directory name="fontview">
<xi:include href="fontview/fontview.rbuild" />
Propchange: trunk/reactos/base/applications/extrac32/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sat Mar 6 17:18:09 2010
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: trunk/reactos/base/applications/extrac32/
------------------------------------------------------------------------------
bugtraq:message = See issue #%BUGID% for more details.
Propchange: trunk/reactos/base/applications/extrac32/
------------------------------------------------------------------------------
bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/reactos/base/applications/extrac32/
------------------------------------------------------------------------------
tsvn:logminsize = 10
Added: trunk/reactos/base/applications/extrac32/extrac32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/extrac32…
==============================================================================
--- trunk/reactos/base/applications/extrac32/extrac32.c (added)
+++ trunk/reactos/base/applications/extrac32/extrac32.c [iso-8859-1] Sat Mar 6 17:18:09
2010
@@ -1,0 +1,179 @@
+/*
+ * Extract - Wine-compatible program for extract *.cab files.
+ *
+ * Copyright 2007 Etersoft (Lyutin Anatoly)
+ * Copyright 2009 Ilya Shpigor
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <windows.h>
+#include <shellapi.h>
+#include <setupapi.h>
+#include <shlwapi.h>
+
+#include "wine/unicode.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(extrac32);
+
+static BOOL force_mode;
+
+static UINT WINAPI ExtCabCallback(PVOID Context, UINT Notification, UINT_PTR Param1,
UINT_PTR Param2)
+{
+ FILE_IN_CABINET_INFO_W *pInfo;
+ FILEPATHS_W *pFilePaths;
+
+ switch(Notification)
+ {
+ case SPFILENOTIFY_FILEINCABINET:
+ pInfo = (FILE_IN_CABINET_INFO_W*)Param1;
+ lstrcpyW(pInfo->FullTargetName, (LPCWSTR)Context);
+ lstrcatW(pInfo->FullTargetName, pInfo->NameInCabinet);
+ return FILEOP_DOIT;
+ case SPFILENOTIFY_FILEEXTRACTED:
+ pFilePaths = (FILEPATHS_W*)Param1;
+ WINE_TRACE("Extracted %s\n",
wine_dbgstr_w(pFilePaths->Target));
+ return NO_ERROR;
+ }
+ return NO_ERROR;
+}
+
+static void extract(LPCWSTR cabfile, LPWSTR destdir)
+{
+ if (!SetupIterateCabinetW(cabfile, 0, ExtCabCallback, destdir))
+ WINE_ERR("Could not extract cab file %s\n", wine_dbgstr_w(cabfile));
+}
+
+static void copy_file(LPCWSTR source, LPCWSTR destination)
+{
+ WCHAR destfile[MAX_PATH];
+
+ /* append source filename if destination is a directory */
+ if (PathIsDirectoryW(destination))
+ {
+ PathCombineW(destfile, destination, PathFindFileNameW(source));
+ destination = destfile;
+ }
+
+ if (PathFileExistsW(destination) && !force_mode)
+ {
+ static const WCHAR overwriteMsg[] =
{'O','v','e','r','w','r','i','t','e','
','"','%','s','"','?',0};
+ static const WCHAR titleMsg[] =
{'E','x','t','r','a','c','t',0};
+ WCHAR msg[MAX_PATH+100];
+ snprintfW(msg, sizeof(msg)/sizeof(msg[0]), overwriteMsg, destination);
+ if (MessageBoxW(NULL, msg, titleMsg, MB_YESNO | MB_ICONWARNING) != IDYES)
+ return;
+ }
+
+ WINE_TRACE("copying %s to %s\n", wine_dbgstr_w(source),
wine_dbgstr_w(destination));
+ CopyFileW(source, destination, FALSE);
+}
+
+int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int show)
+{
+ LPWSTR *argv;
+ int argc;
+ int i;
+ WCHAR check, cmd = 0;
+ WCHAR path[MAX_PATH];
+ WCHAR backslash[] = {'\\',0};
+ LPCWSTR cabfile = NULL;
+
+ path[0] = 0;
+ argv = CommandLineToArgvW(cmdline, &argc);
+
+ if(!argv)
+ {
+ WINE_ERR("Bad command line arguments\n");
+ return 0;
+ }
+
+ /* Parse arguments */
+ for(i = 0; i < argc; i++)
+ {
+ /* Get cabfile */
+ if (argv[i][0] != '/')
+ {
+ if (!cabfile)
+ {
+ cabfile = argv[i];
+ continue;
+ } else
+ break;
+ }
+ /* Get parameters for commands */
+ check = toupperW( argv[i][1] );
+ switch(check)
+ {
+ case 'A':
+ WINE_FIXME("/A not implemented\n");
+ break;
+ case 'Y':
+ force_mode = TRUE;
+ break;
+ case 'L':
+ if ((i + 1) >= argc) return 0;
+ if (!GetFullPathNameW(argv[++i], MAX_PATH, path, NULL))
+ return 0;
+ break;
+ case 'C':
+ if (cmd) return 0;
+ cmd = check;
+ break;
+ case 'E':
+ case 'D':
+ if (cmd) return 0;
+ cmd = check;
+ break;
+ default:
+ return 0;
+ }
+ }
+
+ if (!cabfile)
+ return 0;
+
+ if (cmd == 'C')
+ {
+ if ((i + 1) != argc) return 0;
+ if (!GetFullPathNameW(argv[i], MAX_PATH, path, NULL))
+ return 0;
+ }
+
+ if (!path[0])
+ GetCurrentDirectoryW(MAX_PATH, path);
+
+ lstrcatW(path, backslash);
+
+ /* Execute the specified command */
+ switch(cmd)
+ {
+ case 'C':
+ /* Copy file */
+ copy_file(cabfile, path);
+ break;
+ case 'E':
+ /* Extract CAB archive */
+ extract(cabfile, path);
+ break;
+ case 0:
+ case 'D':
+ /* Display CAB archive */
+ WINE_FIXME("/D not implemented\n");
+ break;
+ }
+ return 0;
+}
Propchange: trunk/reactos/base/applications/extrac32/extrac32.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/base/applications/extrac32/extrac32.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/extrac32…
==============================================================================
--- trunk/reactos/base/applications/extrac32/extrac32.rbuild (added)
+++ trunk/reactos/base/applications/extrac32/extrac32.rbuild [iso-8859-1] Sat Mar 6
17:18:09 2010
@@ -1,0 +1,9 @@
+<module name="extrac32" type="win32gui"
installbase="system32" installname="extrac32.exe"
unicode="yes">
+ <include base="extrac32">.</include>
+ <library>wine</library>
+ <library>shell32</library>
+ <library>setupapi</library>
+ <library>shlwapi</library>
+ <library>user32</library>
+ <file>extrac32.c</file>
+</module>
Propchange: trunk/reactos/base/applications/extrac32/extrac32.rbuild
------------------------------------------------------------------------------
svn:eol-style = native