Module: wine Branch: master Commit: 9d08045ad1f8766aeee18c9c0d83647fff3515b7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9d08045ad1f8766aeee18c9c0d...
Author: Sergey Guralnik serhio@etersoft.ru Date: Mon Apr 22 10:43:17 2013 +0300
extrac32: Add /D switch support.
---
programs/extrac32/extrac32.c | 46 ++++++++++++++++++++++++++++++++--------- 1 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/programs/extrac32/extrac32.c b/programs/extrac32/extrac32.c index 2126c04..63205e8 100644 --- a/programs/extrac32/extrac32.c +++ b/programs/extrac32/extrac32.c @@ -31,6 +31,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(extrac32);
static BOOL force_mode; +static BOOL show_content;
static void create_target_directory(LPWSTR Target) { @@ -56,12 +57,37 @@ static UINT WINAPI ExtCabCallback(PVOID Context, UINT Notification, UINT_PTR Par { case SPFILENOTIFY_FILEINCABINET: pInfo = (FILE_IN_CABINET_INFO_W*)Param1; - 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; + if(show_content) + { + FILETIME ft; + SYSTEMTIME st; + CHAR date[12], time[12], buf[2 * MAX_PATH]; + 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: pFilePaths = (FILEPATHS_W*)Param1; 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 /* Copy file */ copy_file(cabfile, path); break; + case 'D': + /* Display CAB archive */ + show_content = TRUE; + /* Fall through */ case 'E': /* Extract CAB archive */ extract(cabfile, path); break; - case 'D': - /* Display CAB archive */ - WINE_FIXME("/D not implemented\n"); - break; } return 0; }