Commit 9d08045a authored by Sergey Guralnik's avatar Sergey Guralnik Committed by Alexandre Julliard

extrac32: Add /D switch support.

parent b4b45471
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(extrac32); WINE_DEFAULT_DEBUG_CHANNEL(extrac32);
static BOOL force_mode; static BOOL force_mode;
static BOOL show_content;
static void create_target_directory(LPWSTR Target) static void create_target_directory(LPWSTR Target)
{ {
...@@ -56,12 +57,37 @@ static UINT WINAPI ExtCabCallback(PVOID Context, UINT Notification, UINT_PTR Par ...@@ -56,12 +57,37 @@ static UINT WINAPI ExtCabCallback(PVOID Context, UINT Notification, UINT_PTR Par
{ {
case SPFILENOTIFY_FILEINCABINET: case SPFILENOTIFY_FILEINCABINET:
pInfo = (FILE_IN_CABINET_INFO_W*)Param1; pInfo = (FILE_IN_CABINET_INFO_W*)Param1;
lstrcpyW(pInfo->FullTargetName, (LPCWSTR)Context); if(show_content)
lstrcatW(pInfo->FullTargetName, pInfo->NameInCabinet); {
/* SetupIterateCabinet() doesn't create full path to target by itself, FILETIME ft;
so we should do it manually */ SYSTEMTIME st;
create_target_directory(pInfo->FullTargetName); CHAR date[12], time[12], buf[2 * MAX_PATH];
return FILEOP_DOIT; int count;
DWORD dummy;
/* DosDate and DosTime already represented at local time */
DosDateTimeToFileTime(pInfo->DosDate, pInfo->DosTime, &ft);
FileTimeToSystemTime(&ft, &st);
GetDateFormatA(0, 0, &st, "MM'-'dd'-'yyyy", date, sizeof date);
GetTimeFormatA(0, 0, &st, "HH':'mm':'ss", time, sizeof time);
count = wsprintfA(buf, "%s %s %c%c%c%c %15u %S\n", date, time,
pInfo->DosAttribs & FILE_ATTRIBUTE_ARCHIVE ? 'A' : '-',
pInfo->DosAttribs & FILE_ATTRIBUTE_HIDDEN ? 'H' : '-',
pInfo->DosAttribs & FILE_ATTRIBUTE_READONLY ? 'R' : '-',
pInfo->DosAttribs & FILE_ATTRIBUTE_SYSTEM ? 'S' : '-',
pInfo->FileSize, pInfo->NameInCabinet);
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buf, count, &dummy, NULL);
return FILEOP_SKIP;
}
else
{
lstrcpyW(pInfo->FullTargetName, (LPCWSTR)Context);
lstrcatW(pInfo->FullTargetName, pInfo->NameInCabinet);
/* SetupIterateCabinet() doesn't create full path to target by itself,
so we should do it manually */
create_target_directory(pInfo->FullTargetName);
return FILEOP_DOIT;
}
case SPFILENOTIFY_FILEEXTRACTED: case SPFILENOTIFY_FILEEXTRACTED:
pFilePaths = (FILEPATHS_W*)Param1; pFilePaths = (FILEPATHS_W*)Param1;
WINE_TRACE("Extracted %s\n", wine_dbgstr_w(pFilePaths->Target)); WINE_TRACE("Extracted %s\n", wine_dbgstr_w(pFilePaths->Target));
...@@ -281,14 +307,14 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho ...@@ -281,14 +307,14 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
/* Copy file */ /* Copy file */
copy_file(cabfile, path); copy_file(cabfile, path);
break; break;
case 'D':
/* Display CAB archive */
show_content = TRUE;
/* Fall through */
case 'E': case 'E':
/* Extract CAB archive */ /* Extract CAB archive */
extract(cabfile, path); extract(cabfile, path);
break; break;
case 'D':
/* Display CAB archive */
WINE_FIXME("/D not implemented\n");
break;
} }
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment