mirror of
https://github.com/ip7z/7zip.git
synced 2025-12-06 07:12:00 +01:00
22.01
This commit is contained in:
parent
a3e1d22737
commit
93be7d4abf
|
|
@ -1,7 +1,7 @@
|
||||||
#define MY_VER_MAJOR 22
|
#define MY_VER_MAJOR 22
|
||||||
#define MY_VER_MINOR 00
|
#define MY_VER_MINOR 01
|
||||||
#define MY_VER_BUILD 0
|
#define MY_VER_BUILD 0
|
||||||
#define MY_VERSION_NUMBERS "22.00"
|
#define MY_VERSION_NUMBERS "22.01"
|
||||||
#define MY_VERSION MY_VERSION_NUMBERS
|
#define MY_VERSION MY_VERSION_NUMBERS
|
||||||
|
|
||||||
#ifdef MY_CPU_NAME
|
#ifdef MY_CPU_NAME
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#define MY_VERSION_CPU MY_VERSION
|
#define MY_VERSION_CPU MY_VERSION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MY_DATE "2022-06-15"
|
#define MY_DATE "2022-07-15"
|
||||||
#undef MY_COPYRIGHT
|
#undef MY_COPYRIGHT
|
||||||
#undef MY_VERSION_COPYRIGHT_DATE
|
#undef MY_VERSION_COPYRIGHT_DATE
|
||||||
#define MY_AUTHOR_NAME "Igor Pavlov"
|
#define MY_AUTHOR_NAME "Igor Pavlov"
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,32 @@ CFLAGS_BASE = $(MY_ARCH_2) -O2 $(CFLAGS_BASE_LIST) -Wall -Werror -Wextra $(CFLAG
|
||||||
-DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
|
-DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
|
||||||
|
|
||||||
|
|
||||||
LDFLAGS_STATIC = -DNDEBUG
|
|
||||||
# -static
|
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef SystemDrive
|
||||||
IS_MINGW = 1
|
IS_MINGW = 1
|
||||||
|
else
|
||||||
|
ifdef SYSTEMDRIVE
|
||||||
|
# ifdef OS
|
||||||
|
IS_MINGW = 1
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef IS_MINGW
|
||||||
|
LDFLAGS_STATIC_2 = -static
|
||||||
|
else
|
||||||
|
ifndef DEF_FILE
|
||||||
|
ifndef IS_NOT_STANDALONE
|
||||||
|
ifndef MY_DYNAMIC_LINK
|
||||||
|
ifneq ($(CC), clang)
|
||||||
|
LDFLAGS_STATIC_2 =
|
||||||
|
# -static
|
||||||
|
# -static-libstdc++ -static-libgcc
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
LDFLAGS_STATIC = -DNDEBUG $(LDFLAGS_STATIC_2)
|
||||||
|
|
||||||
ifdef DEF_FILE
|
ifdef DEF_FILE
|
||||||
|
|
||||||
|
|
@ -62,15 +82,22 @@ endif
|
||||||
|
|
||||||
ifdef IS_MINGW
|
ifdef IS_MINGW
|
||||||
|
|
||||||
|
ifdef MSYSTEM
|
||||||
|
RM = rm -f
|
||||||
|
MY_MKDIR=mkdir -p
|
||||||
|
DEL_OBJ_EXE = -$(RM) $(PROGPATH) $(PROGPATH_STATIC) $(OBJS)
|
||||||
|
else
|
||||||
RM = del
|
RM = del
|
||||||
MY_MKDIR=mkdir
|
MY_MKDIR=mkdir
|
||||||
LIB2 = -loleaut32 -luuid -ladvapi32 -lUser32
|
DEL_OBJ_EXE = -$(RM) $(O)\*.o $(O)\$(PROG).exe $(O)\$(PROG).dll
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
LIB2 = -lOle32 -loleaut32 -luuid -ladvapi32 -lUser32
|
||||||
|
|
||||||
CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE
|
CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE
|
||||||
# -Wno-delete-non-virtual-dtor
|
# -Wno-delete-non-virtual-dtor
|
||||||
|
|
||||||
DEL_OBJ_EXE = -$(RM) $(O)\*.o $(O)\$(PROG).exe $(O)\$(PROG).dll
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
@ -306,7 +333,10 @@ $O/7zMain.o: ../../../C/Util/7z/7zMain.c
|
||||||
$(CC) $(CFLAGS) $<
|
$(CC) $(CFLAGS) $<
|
||||||
$O/LzmaUtil.o: ../../../C/Util/Lzma/LzmaUtil.c
|
$O/LzmaUtil.o: ../../../C/Util/Lzma/LzmaUtil.c
|
||||||
$(CC) $(CFLAGS) $<
|
$(CC) $(CFLAGS) $<
|
||||||
|
$O/7zipInstall.o: ../../../C/Util/7zipInstall/7zipInstall.c
|
||||||
|
$(CC) $(CFLAGS) $<
|
||||||
|
$O/7zipUninstall.o: ../../../C/Util/7zipUninstall/7zipUninstall.c
|
||||||
|
$(CC) $(CFLAGS) $<
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
||||||
17
C/CpuArch.h
17
C/CpuArch.h
|
|
@ -1,5 +1,5 @@
|
||||||
/* CpuArch.h -- CPU specific code
|
/* CpuArch.h -- CPU specific code
|
||||||
2021-07-13 : Igor Pavlov : Public domain */
|
2022-07-15 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#ifndef __CPU_ARCH_H
|
#ifndef __CPU_ARCH_H
|
||||||
#define __CPU_ARCH_H
|
#define __CPU_ARCH_H
|
||||||
|
|
@ -123,12 +123,15 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(__sparc64__)
|
#if defined(__riscv) \
|
||||||
#define MY_CPU_NAME "sparc64"
|
|| defined(__riscv__)
|
||||||
#define MY_CPU_64BIT
|
#if __riscv_xlen == 32
|
||||||
#elif defined(__sparc__)
|
#define MY_CPU_NAME "riscv32"
|
||||||
#define MY_CPU_NAME "sparc"
|
#elif __riscv_xlen == 64
|
||||||
/* #define MY_CPU_32BIT */
|
#define MY_CPU_NAME "riscv64"
|
||||||
|
#else
|
||||||
|
#define MY_CPU_NAME "riscv"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* DllSecur.c -- DLL loading security
|
/* DllSecur.c -- DLL loading security
|
||||||
2021-12-25 : Igor Pavlov : Public domain */
|
2022-07-15 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#include "Precomp.h"
|
#include "Precomp.h"
|
||||||
|
|
||||||
|
|
@ -11,6 +11,10 @@
|
||||||
|
|
||||||
#ifndef UNDER_CE
|
#ifndef UNDER_CE
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ >= 8)
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef BOOL (WINAPI *Func_SetDefaultDllDirectories)(DWORD DirectoryFlags);
|
typedef BOOL (WINAPI *Func_SetDefaultDllDirectories)(DWORD DirectoryFlags);
|
||||||
|
|
||||||
#define MY_LOAD_LIBRARY_SEARCH_USER_DIRS 0x400
|
#define MY_LOAD_LIBRARY_SEARCH_USER_DIRS 0x400
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* LzmaEnc.c -- LZMA Encoder
|
/* LzmaEnc.c -- LZMA Encoder
|
||||||
2021-11-18: Igor Pavlov : Public domain */
|
2022-07-15: Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#include "Precomp.h"
|
#include "Precomp.h"
|
||||||
|
|
||||||
|
|
@ -2970,6 +2970,7 @@ const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// (desiredPackSize == 0) is not allowed
|
||||||
SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
|
SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
|
||||||
Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
|
Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
|
||||||
{
|
{
|
||||||
|
|
@ -2990,13 +2991,9 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
|
||||||
if (reInit)
|
if (reInit)
|
||||||
LzmaEnc_Init(p);
|
LzmaEnc_Init(p);
|
||||||
LzmaEnc_InitPrices(p);
|
LzmaEnc_InitPrices(p);
|
||||||
|
|
||||||
nowPos64 = p->nowPos64;
|
|
||||||
RangeEnc_Init(&p->rc);
|
RangeEnc_Init(&p->rc);
|
||||||
p->rc.outStream = &outStream.vt;
|
p->rc.outStream = &outStream.vt;
|
||||||
|
nowPos64 = p->nowPos64;
|
||||||
if (desiredPackSize == 0)
|
|
||||||
return SZ_ERROR_OUTPUT_EOF;
|
|
||||||
|
|
||||||
res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
|
res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* 7zipInstall.c - 7-Zip Installer
|
/* 7zipInstall.c - 7-Zip Installer
|
||||||
2021-09-02 : Igor Pavlov : Public domain */
|
2022-07-15 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#include "Precomp.h"
|
#include "Precomp.h"
|
||||||
|
|
||||||
|
|
@ -22,6 +22,10 @@
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ >= 8)
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LLL_(quote) L##quote
|
#define LLL_(quote) L##quote
|
||||||
#define LLL(quote) LLL_(quote)
|
#define LLL(quote) LLL_(quote)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* 7zipUninstall.c - 7-Zip Uninstaller
|
/* 7zipUninstall.c - 7-Zip Uninstaller
|
||||||
2021-11-24 : Igor Pavlov : Public domain */
|
2022-07-15 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#include "Precomp.h"
|
#include "Precomp.h"
|
||||||
|
|
||||||
|
|
@ -17,6 +17,10 @@
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ >= 8)
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LLL_(quote) L##quote
|
#define LLL_(quote) L##quote
|
||||||
#define LLL(quote) LLL_(quote)
|
#define LLL(quote) LLL_(quote)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,11 @@ CFLAGS_BASE = -O2 $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) \
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef SystemDrive
|
||||||
IS_MINGW = 1
|
IS_MINGW = 1
|
||||||
|
else
|
||||||
|
ifdef SYSTEMDRIVE
|
||||||
|
# ifdef OS
|
||||||
|
IS_MINGW = 1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef IS_MINGW
|
ifdef IS_MINGW
|
||||||
|
|
@ -97,20 +102,30 @@ PROGPATH_STATIC = $(O)/$(PROG)s$(SHARED_EXT)
|
||||||
|
|
||||||
ifdef IS_MINGW
|
ifdef IS_MINGW
|
||||||
|
|
||||||
|
ifdef MSYSTEM
|
||||||
|
RM = rm -f
|
||||||
|
MY_MKDIR=mkdir -p
|
||||||
|
DEL_OBJ_EXE = -$(RM) $(PROGPATH) $(PROGPATH_STATIC) $(OBJS)
|
||||||
|
LIB_HTMLHELP=-lhtmlhelp
|
||||||
|
else
|
||||||
RM = del
|
RM = del
|
||||||
MY_MKDIR=mkdir
|
MY_MKDIR=mkdir
|
||||||
LIB2_GUI = -lOle32 -lGdi32 -lComctl32 -lComdlg32
|
DEL_OBJ_EXE = -$(RM) $(O)\*.o $(O)\$(PROG).exe $(O)\$(PROG).dll
|
||||||
|
endif
|
||||||
|
|
||||||
|
LIB2_GUI = -lOle32 -lGdi32 -lComctl32 -lComdlg32 $(LIB_HTMLHELP)
|
||||||
LIB2 = -loleaut32 -luuid -ladvapi32 -lUser32 $(LIB2_GUI)
|
LIB2 = -loleaut32 -luuid -ladvapi32 -lUser32 $(LIB2_GUI)
|
||||||
|
|
||||||
CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE
|
CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE
|
||||||
# -Wno-delete-non-virtual-dtor
|
# -Wno-delete-non-virtual-dtor
|
||||||
|
|
||||||
DEL_OBJ_EXE = -$(RM) $(O)\*.o $(O)\$(PROG).exe $(O)\$(PROG).dll
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
RM = rm -f
|
RM = rm -f
|
||||||
MY_MKDIR=mkdir -p
|
MY_MKDIR=mkdir -p
|
||||||
|
DEL_OBJ_EXE = -$(RM) $(PROGPATH) $(PROGPATH_STATIC) $(OBJS)
|
||||||
|
|
||||||
# CFLAGS_BASE := $(CFLAGS_BASE) -D_7ZIP_ST
|
# CFLAGS_BASE := $(CFLAGS_BASE) -D_7ZIP_ST
|
||||||
# CXXFLAGS_EXTRA = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
|
# CXXFLAGS_EXTRA = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
|
||||||
|
|
||||||
|
|
@ -119,9 +134,6 @@ MY_MKDIR=mkdir -p
|
||||||
LIB2 = -lpthread -ldl
|
LIB2 = -lpthread -ldl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DEL_OBJ_EXE = -$(RM) $(PROGPATH) $(PROGPATH_STATIC) $(OBJS)
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -130,9 +142,19 @@ CFLAGS = $(MY_ARCH_2) $(LOCAL_FLAGS) $(CFLAGS_BASE2) $(CFLAGS_BASE) $(CC_SHARED)
|
||||||
|
|
||||||
|
|
||||||
ifdef IS_MINGW
|
ifdef IS_MINGW
|
||||||
AFLAGS_ABI = -coff -DABI_CDECL
|
|
||||||
AFLAGS = -nologo $(AFLAGS_ABI) -Fo$(O)/$(basename $(<F)).o
|
ifdef IS_X64
|
||||||
|
AFLAGS_ABI = -win64
|
||||||
else
|
else
|
||||||
|
AFLAGS_ABI = -coff -DABI_CDECL
|
||||||
|
# -DABI_CDECL
|
||||||
|
# -DABI_LINUX
|
||||||
|
# -DABI_CDECL
|
||||||
|
endif
|
||||||
|
AFLAGS = -nologo $(AFLAGS_ABI) -Fo$(O)/$(basename $(<F)).o
|
||||||
|
|
||||||
|
else # IS_MINGW
|
||||||
|
|
||||||
ifdef IS_X64
|
ifdef IS_X64
|
||||||
AFLAGS_ABI = -elf64 -DABI_LINUX
|
AFLAGS_ABI = -elf64 -DABI_LINUX
|
||||||
else
|
else
|
||||||
|
|
@ -142,7 +164,10 @@ AFLAGS_ABI = -elf -DABI_LINUX -DABI_CDECL
|
||||||
# -DABI_CDECL
|
# -DABI_CDECL
|
||||||
endif
|
endif
|
||||||
AFLAGS = -nologo $(AFLAGS_ABI) -Fo$(O)/
|
AFLAGS = -nologo $(AFLAGS_ABI) -Fo$(O)/
|
||||||
endif
|
|
||||||
|
endif # IS_MINGW
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ifdef USE_ASM
|
ifdef USE_ASM
|
||||||
CONSOLE_ASM_FLAGS=-D_7ZIP_ASM
|
CONSOLE_ASM_FLAGS=-D_7ZIP_ASM
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
#include "Common/ItemNameUtils.h"
|
#include "Common/ItemNameUtils.h"
|
||||||
|
|
||||||
|
#include "HfsHandler.h"
|
||||||
|
|
||||||
// if APFS_SHOW_ALT_STREAMS is defined, the handler will show attribute files.
|
// if APFS_SHOW_ALT_STREAMS is defined, the handler will show attribute files.
|
||||||
#define APFS_SHOW_ALT_STREAMS
|
#define APFS_SHOW_ALT_STREAMS
|
||||||
|
|
||||||
|
|
@ -934,11 +936,12 @@ struct CItem
|
||||||
unsigned RefIndex;
|
unsigned RefIndex;
|
||||||
// unsigned iNode_Index;
|
// unsigned iNode_Index;
|
||||||
|
|
||||||
CItem():
|
void Clear()
|
||||||
ParentItemIndex(VI_MINUS1),
|
{
|
||||||
RefIndex(VI_MINUS1)
|
Name.Empty();
|
||||||
// iNode_Index(VI_MINUS1)
|
ParentItemIndex = VI_MINUS1;
|
||||||
{}
|
RefIndex = VI_MINUS1;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -956,9 +959,9 @@ struct CItem
|
||||||
#define UNIFIED_ID_SPACE_MARK 0x0800000000000000
|
#define UNIFIED_ID_SPACE_MARK 0x0800000000000000
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
INODE_IS_APFS_PRIVATE = 0x00000001,
|
INODE_IS_APFS_PRIVATE = 0x00000001,
|
||||||
INODE_MAINTAIN_DIR_STATS = 0x00000002,
|
INODE_MAINTAIN_DIR_STATS = 0x00000002,
|
||||||
INODE_DIR_STATS_ORIGIN = 0x00000004,
|
INODE_DIR_STATS_ORIGIN = 0x00000004,
|
||||||
|
|
@ -973,11 +976,15 @@ INODE_WAS_EVER_CLONED = 0x00000400,
|
||||||
INODE_ACTIVE_FILE_TRIMMED = 0x00000800,
|
INODE_ACTIVE_FILE_TRIMMED = 0x00000800,
|
||||||
INODE_PINNED_TO_MAIN = 0x00001000,
|
INODE_PINNED_TO_MAIN = 0x00001000,
|
||||||
INODE_PINNED_TO_TIER2 = 0x00002000,
|
INODE_PINNED_TO_TIER2 = 0x00002000,
|
||||||
|
*/
|
||||||
INODE_HAS_RSRC_FORK = 0x00004000,
|
INODE_HAS_RSRC_FORK = 0x00004000,
|
||||||
|
/*
|
||||||
INODE_NO_RSRC_FORK = 0x00008000,
|
INODE_NO_RSRC_FORK = 0x00008000,
|
||||||
INODE_ALLOCATION_SPILLEDOVER = 0x00010000,
|
INODE_ALLOCATION_SPILLEDOVER = 0x00010000,
|
||||||
INODE_FAST_PROMOTE = 0x00020000,
|
INODE_FAST_PROMOTE = 0x00020000,
|
||||||
|
*/
|
||||||
INODE_HAS_UNCOMPRESSED_SIZE = 0x00040000,
|
INODE_HAS_UNCOMPRESSED_SIZE = 0x00040000,
|
||||||
|
/*
|
||||||
INODE_IS_PURGEABLE = 0x00080000,
|
INODE_IS_PURGEABLE = 0x00080000,
|
||||||
INODE_WANTS_TO_BE_PURGEABLE = 0x00100000,
|
INODE_WANTS_TO_BE_PURGEABLE = 0x00100000,
|
||||||
INODE_IS_SYNC_ROOT = 0x00200000,
|
INODE_IS_SYNC_ROOT = 0x00200000,
|
||||||
|
|
@ -993,10 +1000,12 @@ INODE_CLONED_INTERNAL_FLAGS = \
|
||||||
| INODE_NO_RSRC_FORK \
|
| INODE_NO_RSRC_FORK \
|
||||||
| INODE_HAS_FINDER_INFO \
|
| INODE_HAS_FINDER_INFO \
|
||||||
| INODE_SNAPSHOT_COW_EXEMPTION),
|
| INODE_SNAPSHOT_COW_EXEMPTION),
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
j_inode_flags;
|
j_inode_flags;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
#define APFS_VALID_INTERNAL_INODE_FLAGS \
|
#define APFS_VALID_INTERNAL_INODE_FLAGS \
|
||||||
( INODE_IS_APFS_PRIVATE \
|
( INODE_IS_APFS_PRIVATE \
|
||||||
| INODE_MAINTAIN_DIR_STATS \
|
| INODE_MAINTAIN_DIR_STATS \
|
||||||
|
|
@ -1192,10 +1201,11 @@ struct CAttr
|
||||||
{
|
{
|
||||||
AString Name;
|
AString Name;
|
||||||
UInt32 flags;
|
UInt32 flags;
|
||||||
|
bool dstream_defined;
|
||||||
|
bool NeedShow;
|
||||||
CByteBuffer Data;
|
CByteBuffer Data;
|
||||||
|
|
||||||
j_dstream dstream;
|
j_dstream dstream;
|
||||||
bool dstream_defined;
|
|
||||||
UInt64 Id;
|
UInt64 Id;
|
||||||
|
|
||||||
bool Is_dstream_OK_for_SymLink() const
|
bool Is_dstream_OK_for_SymLink() const
|
||||||
|
|
@ -1203,9 +1213,20 @@ struct CAttr
|
||||||
return dstream_defined && dstream.size <= (1 << 12) && dstream.size != 0;
|
return dstream_defined && dstream.size <= (1 << 12) && dstream.size != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAttr():
|
UInt64 GetSize() const
|
||||||
dstream_defined(false)
|
{
|
||||||
{}
|
if (dstream_defined) // dstream has more priority
|
||||||
|
return dstream.size;
|
||||||
|
return Data.Size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
dstream_defined = false;
|
||||||
|
NeedShow = true;
|
||||||
|
Data.Free();
|
||||||
|
Name.Empty();
|
||||||
|
}
|
||||||
|
|
||||||
bool Is_STREAM() const { return (flags & XATTR_DATA_STREAM) != 0; }
|
bool Is_STREAM() const { return (flags & XATTR_DATA_STREAM) != 0; }
|
||||||
bool Is_EMBEDDED() const { return (flags & XATTR_DATA_EMBEDDED) != 0; }
|
bool Is_EMBEDDED() const { return (flags & XATTR_DATA_EMBEDDED) != 0; }
|
||||||
|
|
@ -1245,16 +1266,22 @@ struct CNode
|
||||||
MY__gid_t group;
|
MY__gid_t group;
|
||||||
MY__mode_t mode;
|
MY__mode_t mode;
|
||||||
UInt16 pad1;
|
UInt16 pad1;
|
||||||
// UInt64 uncompressed_size;
|
UInt64 uncompressed_size;
|
||||||
|
|
||||||
j_dstream dstream;
|
j_dstream dstream;
|
||||||
AString PrimaryName;
|
AString PrimaryName;
|
||||||
|
|
||||||
bool dstream_defined;
|
bool dstream_defined;
|
||||||
bool refcnt_defined;
|
bool refcnt_defined;
|
||||||
|
|
||||||
UInt32 refcnt; // j_dstream_id_val_t
|
UInt32 refcnt; // j_dstream_id_val_t
|
||||||
CRecordVector<CExtent> Extents;
|
CRecordVector<CExtent> Extents;
|
||||||
CObjectVector<CAttr> Attrs;
|
CObjectVector<CAttr> Attrs;
|
||||||
unsigned SymLinkIndex; // index in Attrs
|
unsigned SymLinkIndex; // index in Attrs
|
||||||
|
unsigned DecmpfsIndex; // index in Attrs
|
||||||
|
unsigned ResourceIndex; // index in Attrs
|
||||||
|
|
||||||
|
NHfs::CCompressHeader CompressHeader;
|
||||||
|
|
||||||
CNode():
|
CNode():
|
||||||
ItemIndex(VI_MINUS1),
|
ItemIndex(VI_MINUS1),
|
||||||
|
|
@ -1262,11 +1289,16 @@ struct CNode
|
||||||
// NumItems(0),
|
// NumItems(0),
|
||||||
dstream_defined(false),
|
dstream_defined(false),
|
||||||
refcnt_defined(false),
|
refcnt_defined(false),
|
||||||
SymLinkIndex(VI_MINUS1)
|
SymLinkIndex(VI_MINUS1),
|
||||||
|
DecmpfsIndex(VI_MINUS1),
|
||||||
|
ResourceIndex(VI_MINUS1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool IsDir() const { return MY_LIN_S_ISDIR(mode); }
|
bool IsDir() const { return MY_LIN_S_ISDIR(mode); }
|
||||||
bool IsSymLink() const { return MY_LIN_S_ISLNK(mode); }
|
bool IsSymLink() const { return MY_LIN_S_ISLNK(mode); }
|
||||||
|
|
||||||
|
bool Has_UNCOMPRESSED_SIZE() const { return (internal_flags & INODE_HAS_UNCOMPRESSED_SIZE) != 0; }
|
||||||
|
|
||||||
unsigned Get_Type_From_mode() const { return mode >> 12; }
|
unsigned Get_Type_From_mode() const { return mode >> 12; }
|
||||||
|
|
||||||
bool GetSize(unsigned attrIndex, UInt64 &size) const
|
bool GetSize(unsigned attrIndex, UInt64 &size) const
|
||||||
|
|
@ -1278,6 +1310,12 @@ struct CNode
|
||||||
size = dstream.size;
|
size = dstream.size;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
size = 0;
|
||||||
|
if (Has_UNCOMPRESSED_SIZE())
|
||||||
|
{
|
||||||
|
size = uncompressed_size;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!IsSymLink())
|
if (!IsSymLink())
|
||||||
return false;
|
return false;
|
||||||
attrIndex = SymLinkIndex;
|
attrIndex = SymLinkIndex;
|
||||||
|
|
@ -1301,9 +1339,23 @@ struct CNode
|
||||||
size = dstream.alloced_size;
|
size = dstream.alloced_size;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!IsSymLink())
|
size = 0;
|
||||||
return false;
|
|
||||||
|
if (IsSymLink())
|
||||||
attrIndex = SymLinkIndex;
|
attrIndex = SymLinkIndex;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!CompressHeader.IsCorrect ||
|
||||||
|
!CompressHeader.IsSupported)
|
||||||
|
return false;
|
||||||
|
const CAttr &attr = Attrs[DecmpfsIndex];
|
||||||
|
if (!CompressHeader.IsMethod_Resource())
|
||||||
|
{
|
||||||
|
size = attr.Data.Size() - CompressHeader.DataPos;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
attrIndex = ResourceIndex;
|
||||||
|
}
|
||||||
if (IsViNotDef(attrIndex))
|
if (IsViNotDef(attrIndex))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1339,17 +1391,17 @@ void CNode::Parse(const Byte *p)
|
||||||
G64 (0x28, access_time);
|
G64 (0x28, access_time);
|
||||||
G64 (0x30, internal_flags);
|
G64 (0x30, internal_flags);
|
||||||
{
|
{
|
||||||
G32(0x38, nchildren);
|
G32 (0x38, nchildren);
|
||||||
// G32(0x38, nlink);
|
// G32 (0x38, nlink);
|
||||||
}
|
}
|
||||||
// G32(0x3c, default_protection_class);
|
// G32 (0x3c, default_protection_class);
|
||||||
G32(0x40, write_generation_counter);
|
G32 (0x40, write_generation_counter);
|
||||||
G32(0x44, bsd_flags);
|
G32 (0x44, bsd_flags);
|
||||||
G32(0x48, owner);
|
G32 (0x48, owner);
|
||||||
G32(0x4c, group);
|
G32 (0x4c, group);
|
||||||
G16(0x50, mode);
|
G16 (0x50, mode);
|
||||||
// G16(0x52, pad1);
|
// G16 (0x52, pad1);
|
||||||
// G64 (0x54, uncompressed_size);
|
G64 (0x54, uncompressed_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1364,6 +1416,7 @@ struct CRef
|
||||||
bool IsAltStream() const { return IsViDef(AttrIndex); }
|
bool IsAltStream() const { return IsViDef(AttrIndex); }
|
||||||
unsigned GetAttrIndex() const { return AttrIndex; };
|
unsigned GetAttrIndex() const { return AttrIndex; };
|
||||||
#else
|
#else
|
||||||
|
// bool IsAltStream() const { return false; }
|
||||||
unsigned GetAttrIndex() const { return VI_MINUS1; };
|
unsigned GetAttrIndex() const { return VI_MINUS1; };
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
@ -1667,6 +1720,7 @@ struct CDatabase
|
||||||
UInt64 ProgressVal_NumFilesTotal;
|
UInt64 ProgressVal_NumFilesTotal;
|
||||||
CObjectVector<CByteBuffer> Buffers;
|
CObjectVector<CByteBuffer> Buffers;
|
||||||
|
|
||||||
|
UInt32 MethodsMask;
|
||||||
UInt64 GetSize(const UInt32 index) const;
|
UInt64 GetSize(const UInt32 index) const;
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
|
|
@ -1679,6 +1733,8 @@ struct CDatabase
|
||||||
ProgressVal_Prev = 0;
|
ProgressVal_Prev = 0;
|
||||||
ProgressVal_NumFilesTotal = 0;
|
ProgressVal_NumFilesTotal = 0;
|
||||||
|
|
||||||
|
MethodsMask = 0;
|
||||||
|
|
||||||
Vols.Clear();
|
Vols.Clear();
|
||||||
Refs2.Clear();
|
Refs2.Clear();
|
||||||
Buffers.Clear();
|
Buffers.Clear();
|
||||||
|
|
@ -1691,6 +1747,12 @@ struct CDatabase
|
||||||
HRESULT OpenVolume(const CObjectMap &omap, const oid_t fs_oid);
|
HRESULT OpenVolume(const CObjectMap &omap, const oid_t fs_oid);
|
||||||
HRESULT Open2();
|
HRESULT Open2();
|
||||||
|
|
||||||
|
HRESULT GetAttrStream(IInStream *apfsInStream, const CVol &vol,
|
||||||
|
const CAttr &attr, ISequentialInStream **stream);
|
||||||
|
|
||||||
|
HRESULT GetAttrStream_dstream(IInStream *apfsInStream, const CVol &vol,
|
||||||
|
const CAttr &attr, ISequentialInStream **stream);
|
||||||
|
|
||||||
HRESULT GetStream2(
|
HRESULT GetStream2(
|
||||||
IInStream *apfsInStream,
|
IInStream *apfsInStream,
|
||||||
const CRecordVector<CExtent> *extents, UInt64 rem,
|
const CRecordVector<CExtent> *extents, UInt64 rem,
|
||||||
|
|
@ -2070,7 +2132,7 @@ HRESULT CDatabase::OpenVolume(const CObjectMap &omap, const oid_t fs_oid)
|
||||||
RINOK(ReadMap(ov.paddr, map, 0));
|
RINOK(ReadMap(ov.paddr, map, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NeedReadSymLink = false;
|
bool needParseAttr = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
const bool isHashed = apfs.IsHashedName();
|
const bool isHashed = apfs.IsHashedName();
|
||||||
|
|
@ -2094,6 +2156,9 @@ HRESULT CDatabase::OpenVolume(const CObjectMap &omap, const oid_t fs_oid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CAttr attr;
|
||||||
|
CItem item;
|
||||||
|
|
||||||
FOR_VECTOR (i, map.Pairs)
|
FOR_VECTOR (i, map.Pairs)
|
||||||
{
|
{
|
||||||
if (OpenCallback && (i & 0xffff) == 1)
|
if (OpenCallback && (i & 0xffff) == 1)
|
||||||
|
|
@ -2232,7 +2297,7 @@ HRESULT CDatabase::OpenVolume(const CObjectMap &omap, const oid_t fs_oid)
|
||||||
if (nameOffset + len != pair.Key.Size())
|
if (nameOffset + len != pair.Key.Size())
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
CAttr attr;
|
attr.Clear();
|
||||||
attr.Name.SetFrom_CalcLen((const char *)p + nameOffset, len);
|
attr.Name.SetFrom_CalcLen((const char *)p + nameOffset, len);
|
||||||
if (attr.Name.Len() != len - 1)
|
if (attr.Name.Len() != len - 1)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
@ -2287,15 +2352,25 @@ HRESULT CDatabase::OpenVolume(const CObjectMap &omap, const oid_t fs_oid)
|
||||||
// UnsupportedFeature = true;
|
// UnsupportedFeature = true;
|
||||||
// continue;
|
// continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CNode &inode = vol.Nodes.Back();
|
CNode &inode = vol.Nodes.Back();
|
||||||
|
|
||||||
if (attr.Name.IsEqualTo("com.apple.fs.symlink"))
|
if (attr.Name.IsEqualTo("com.apple.fs.symlink"))
|
||||||
{
|
{
|
||||||
inode.SymLinkIndex = inode.Attrs.Size();
|
inode.SymLinkIndex = inode.Attrs.Size();
|
||||||
if (attr.Is_dstream_OK_for_SymLink())
|
if (attr.Is_dstream_OK_for_SymLink())
|
||||||
NeedReadSymLink = true;
|
needParseAttr = true;
|
||||||
|
}
|
||||||
|
else if (attr.Name.IsEqualTo("com.apple.decmpfs"))
|
||||||
|
{
|
||||||
|
inode.DecmpfsIndex = inode.Attrs.Size();
|
||||||
|
// if (attr.dstream_defined)
|
||||||
|
needParseAttr = true;
|
||||||
|
}
|
||||||
|
else if (attr.Name.IsEqualTo("com.apple.ResourceFork"))
|
||||||
|
{
|
||||||
|
inode.ResourceIndex = inode.Attrs.Size();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
vol.NumAltStreams++;
|
|
||||||
inode.Attrs.Add(attr);
|
inode.Attrs.Add(attr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -2431,7 +2506,10 @@ HRESULT CDatabase::OpenVolume(const CObjectMap &omap, const oid_t fs_oid)
|
||||||
}
|
}
|
||||||
if (nameOffset + len != pair.Key.Size())
|
if (nameOffset + len != pair.Key.Size())
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
CItem item;
|
|
||||||
|
// CItem item;
|
||||||
|
item.Clear();
|
||||||
|
|
||||||
item.ParentId = id;
|
item.ParentId = id;
|
||||||
item.Name.SetFrom_CalcLen((const char *)p + nameOffset, len);
|
item.Name.SetFrom_CalcLen((const char *)p + nameOffset, len);
|
||||||
if (item.Name.Len() != len - 1)
|
if (item.Name.Len() != len - 1)
|
||||||
|
|
@ -2471,35 +2549,82 @@ HRESULT CDatabase::OpenVolume(const CObjectMap &omap, const oid_t fs_oid)
|
||||||
ProgressVal_NumFilesTotal += vol.Items.Size();
|
ProgressVal_NumFilesTotal += vol.Items.Size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NeedReadSymLink)
|
|
||||||
|
if (needParseAttr)
|
||||||
{
|
{
|
||||||
/* we read external streams for SymLinks to CAttr.Data
|
/* we read external streams for attributes
|
||||||
So we can get SymLink for GetProperty(kpidSymLink) later */
|
So we can get SymLink for GetProperty(kpidSymLink) later */
|
||||||
FOR_VECTOR (i, vol.Nodes)
|
FOR_VECTOR (i, vol.Nodes)
|
||||||
{
|
{
|
||||||
CNode &node = vol.Nodes[i];
|
CNode &node = vol.Nodes[i];
|
||||||
if (IsViNotDef(node.SymLinkIndex))
|
|
||||||
|
FOR_VECTOR (a, node.Attrs)
|
||||||
|
{
|
||||||
|
CAttr &attr = node.Attrs[a];
|
||||||
|
if (attr.Data.Size() != 0 || !attr.dstream_defined)
|
||||||
continue;
|
continue;
|
||||||
CAttr &attr = node.Attrs[(unsigned)node.SymLinkIndex];
|
if (a == node.SymLinkIndex)
|
||||||
// FOR_VECTOR (k, node.Attrs) { CAttr &attr = node.Attrs[(unsigned)k]; // for debug
|
{
|
||||||
if (attr.Data.Size() != 0
|
if (!attr.Is_dstream_OK_for_SymLink())
|
||||||
|| !attr.Is_dstream_OK_for_SymLink())
|
|
||||||
continue;
|
continue;
|
||||||
const UInt32 size = (UInt32)attr.dstream.size;
|
}
|
||||||
const int idIndex = vol.SmallNodeIDs.FindInSorted(attr.Id);
|
else
|
||||||
if (idIndex == -1)
|
{
|
||||||
|
if (a != node.DecmpfsIndex
|
||||||
|
// && a != node.ResourceIndex
|
||||||
|
)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// we don't expect big streams here
|
||||||
|
// largest dstream for Decmpfs attribute is (2Kib+17)
|
||||||
|
if (attr.dstream.size > ((UInt32)1 << 16))
|
||||||
continue;
|
continue;
|
||||||
CMyComPtr<ISequentialInStream> inStream;
|
CMyComPtr<ISequentialInStream> inStream;
|
||||||
const HRESULT res = GetStream2(
|
const HRESULT res = GetAttrStream_dstream(OpenInStream, vol, attr, &inStream);
|
||||||
OpenInStream,
|
|
||||||
&vol.SmallNodes[(unsigned)idIndex].Extents,
|
|
||||||
size, &inStream);
|
|
||||||
if (res == S_OK && inStream)
|
if (res == S_OK && inStream)
|
||||||
{
|
{
|
||||||
CByteBuffer buf2;
|
CByteBuffer buf2;
|
||||||
|
const size_t size = (size_t)attr.dstream.size;
|
||||||
buf2.Alloc(size);
|
buf2.Alloc(size);
|
||||||
if (ReadStream_FAIL(inStream, buf2, size) == S_OK)
|
if (ReadStream_FAIL(inStream, buf2, size) == S_OK)
|
||||||
attr.Data = buf2;
|
attr.Data = buf2;
|
||||||
|
|
||||||
|
ProgressVal_Cur += size;
|
||||||
|
if (OpenCallback)
|
||||||
|
if (ProgressVal_Cur - ProgressVal_Prev >= (1 << 22))
|
||||||
|
{
|
||||||
|
|
||||||
|
RINOK(OpenCallback->SetCompleted(
|
||||||
|
&ProgressVal_NumFilesTotal,
|
||||||
|
&ProgressVal_Cur));
|
||||||
|
ProgressVal_Prev = ProgressVal_Cur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.Has_UNCOMPRESSED_SIZE())
|
||||||
|
if (IsViDef(node.DecmpfsIndex))
|
||||||
|
{
|
||||||
|
CAttr &attr = node.Attrs[node.DecmpfsIndex];
|
||||||
|
node.CompressHeader.Parse(attr.Data, attr.Data.Size());
|
||||||
|
|
||||||
|
if (node.CompressHeader.IsCorrect)
|
||||||
|
if (node.CompressHeader.Method < sizeof(MethodsMask) * 8)
|
||||||
|
MethodsMask |= ((UInt32)1 << node.CompressHeader.Method);
|
||||||
|
|
||||||
|
if (node.CompressHeader.IsCorrect
|
||||||
|
&& node.CompressHeader.IsSupported
|
||||||
|
&& node.CompressHeader.UnpackSize == node.uncompressed_size)
|
||||||
|
{
|
||||||
|
attr.NeedShow = false;
|
||||||
|
if (node.CompressHeader.IsMethod_Resource()
|
||||||
|
&& IsViDef(node.ResourceIndex))
|
||||||
|
node.Attrs[node.ResourceIndex].NeedShow = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vol.UnsupportedFeature = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2521,9 +2646,10 @@ HRESULT CDatabase::OpenVolume(const CObjectMap &omap, const oid_t fs_oid)
|
||||||
HRESULT CVol::FillRefs()
|
HRESULT CVol::FillRefs()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
Refs.Reserve(Items.Size());
|
||||||
// we fill Refs[*]
|
// we fill Refs[*]
|
||||||
// we
|
// we
|
||||||
// and set Nodes[*].ItemIndex for Nodes that are dictories;
|
// and set Nodes[*].ItemIndex for Nodes that are directories;
|
||||||
FOR_VECTOR (i, Items)
|
FOR_VECTOR (i, Items)
|
||||||
{
|
{
|
||||||
CItem &item = Items[i];
|
CItem &item = Items[i];
|
||||||
|
|
@ -2593,12 +2719,17 @@ HRESULT CVol::FillRefs()
|
||||||
ref.ParentRefIndex = item.RefIndex;
|
ref.ParentRefIndex = item.RefIndex;
|
||||||
for (unsigned k = 0; k < numAttrs; k++)
|
for (unsigned k = 0; k < numAttrs; k++)
|
||||||
{
|
{
|
||||||
|
// comment it for debug
|
||||||
|
const CAttr &attr = inode.Attrs[k];
|
||||||
|
if (!attr.NeedShow)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (k == inode.SymLinkIndex)
|
if (k == inode.SymLinkIndex)
|
||||||
continue;
|
continue;
|
||||||
ref.AttrIndex = k;
|
ref.AttrIndex = k;
|
||||||
|
NumAltStreams++;
|
||||||
Refs.Add(ref);
|
Refs.Add(ref);
|
||||||
/*
|
/*
|
||||||
const CAttr &attr = inode.Attrs[k];
|
|
||||||
if (attr.dstream_defined)
|
if (attr.dstream_defined)
|
||||||
{
|
{
|
||||||
const int idIndex = SmallNodeIDs.FindInSorted(attr.Id);
|
const int idIndex = SmallNodeIDs.FindInSorted(attr.Id);
|
||||||
|
|
@ -2780,6 +2911,7 @@ enum
|
||||||
kpidAddTime,
|
kpidAddTime,
|
||||||
kpidGeneration,
|
kpidGeneration,
|
||||||
kpidBsdFlags
|
kpidBsdFlags
|
||||||
|
// kpidUncompressedSize
|
||||||
};
|
};
|
||||||
|
|
||||||
static const CStatProp kProps[] =
|
static const CStatProp kProps[] =
|
||||||
|
|
@ -2793,11 +2925,13 @@ static const CStatProp kProps[] =
|
||||||
{ NULL, kpidATime, VT_FILETIME },
|
{ NULL, kpidATime, VT_FILETIME },
|
||||||
{ NULL, kpidChangeTime, VT_FILETIME },
|
{ NULL, kpidChangeTime, VT_FILETIME },
|
||||||
{ "Added Time", kpidAddTime, VT_FILETIME },
|
{ "Added Time", kpidAddTime, VT_FILETIME },
|
||||||
|
{ NULL, kpidMethod, VT_BSTR },
|
||||||
{ NULL, kpidINode, VT_UI8 },
|
{ NULL, kpidINode, VT_UI8 },
|
||||||
{ NULL, kpidLinks, VT_UI4 },
|
{ NULL, kpidLinks, VT_UI4 },
|
||||||
{ NULL, kpidSymLink, VT_BSTR },
|
{ NULL, kpidSymLink, VT_BSTR },
|
||||||
{ NULL, kpidUserId, VT_UI4 },
|
{ NULL, kpidUserId, VT_UI4 },
|
||||||
{ NULL, kpidGroupId, VT_UI4 },
|
{ NULL, kpidGroupId, VT_UI4 },
|
||||||
|
{ NULL, kpidCharacts, VT_BSTR },
|
||||||
#ifdef APFS_SHOW_ALT_STREAMS
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
{ NULL, kpidIsAltStream, VT_BOOL },
|
{ NULL, kpidIsAltStream, VT_BOOL },
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -2807,12 +2941,14 @@ static const CStatProp kProps[] =
|
||||||
{ "Written Size", kpidBytesWritten, VT_UI8 },
|
{ "Written Size", kpidBytesWritten, VT_UI8 },
|
||||||
{ "Read Size", kpidBytesRead, VT_UI8 },
|
{ "Read Size", kpidBytesRead, VT_UI8 },
|
||||||
{ "BSD Flags", kpidBsdFlags, VT_UI4 }
|
{ "BSD Flags", kpidBsdFlags, VT_UI4 }
|
||||||
|
// , { "Uncompressed Size", kpidUncompressedSize, VT_UI8 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const Byte kArcProps[] =
|
static const Byte kArcProps[] =
|
||||||
{
|
{
|
||||||
kpidName,
|
kpidName,
|
||||||
|
kpidCharacts,
|
||||||
kpidId,
|
kpidId,
|
||||||
kpidClusterSize,
|
kpidClusterSize,
|
||||||
kpidCTime,
|
kpidCTime,
|
||||||
|
|
@ -2848,6 +2984,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
||||||
prop = (UInt64)sb.block_count << sb.block_size_Log;
|
prop = (UInt64)sb.block_count << sb.block_size_Log;
|
||||||
break;
|
break;
|
||||||
case kpidClusterSize: prop = (UInt32)(sb.block_size); break;
|
case kpidClusterSize: prop = (UInt32)(sb.block_size); break;
|
||||||
|
case kpidCharacts: NHfs::MethodsMaskToProp(MethodsMask, prop); break;
|
||||||
case kpidMTime:
|
case kpidMTime:
|
||||||
if (apfs)
|
if (apfs)
|
||||||
ApfsTimeToProp(apfs->modified_by[0].timestamp, prop);
|
ApfsTimeToProp(apfs->modified_by[0].timestamp, prop);
|
||||||
|
|
@ -2953,7 +3090,6 @@ STDMETHODIMP CHandler::GetParent(UInt32 index, UInt32 *parent, UInt32 *parentTyp
|
||||||
const CRef2 &ref2 = Refs2[index];
|
const CRef2 &ref2 = Refs2[index];
|
||||||
const CVol &vol = Vols[ref2.VolIndex];
|
const CVol &vol = Vols[ref2.VolIndex];
|
||||||
UInt32 parentIndex = (UInt32)(Int32)-1;
|
UInt32 parentIndex = (UInt32)(Int32)-1;
|
||||||
*parentType = NParentType::kDir;
|
|
||||||
|
|
||||||
if (IsViDef(ref2.RefIndex))
|
if (IsViDef(ref2.RefIndex))
|
||||||
{
|
{
|
||||||
|
|
@ -3017,6 +3153,7 @@ void CDatabase::GetItemPath(unsigned index, const CNode *inode, NWindows::NCOM::
|
||||||
{
|
{
|
||||||
const CRef &ref = vol.Refs[ref2.RefIndex];
|
const CRef &ref = vol.Refs[ref2.RefIndex];
|
||||||
unsigned cur = ref.ItemIndex;
|
unsigned cur = ref.ItemIndex;
|
||||||
|
UString s2;
|
||||||
if (IsViNotDef(cur))
|
if (IsViNotDef(cur))
|
||||||
{
|
{
|
||||||
if (inode)
|
if (inode)
|
||||||
|
|
@ -3032,14 +3169,13 @@ void CDatabase::GetItemPath(unsigned index, const CNode *inode, NWindows::NCOM::
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const CItem &item = vol.Items[(unsigned)cur];
|
const CItem &item = vol.Items[(unsigned)cur];
|
||||||
UString s2;
|
|
||||||
Utf8Name_to_InterName(item.Name, s2);
|
Utf8Name_to_InterName(item.Name, s2);
|
||||||
// s2 += "a\\b"; // for debug
|
// s2 += "a\\b"; // for debug
|
||||||
s.Insert(0, s2);
|
s.Insert(0, s2);
|
||||||
cur = item.ParentItemIndex;
|
cur = item.ParentItemIndex;
|
||||||
if (IsViNotDef(cur))
|
if (IsViNotDef(cur))
|
||||||
break;
|
break;
|
||||||
// ParentItemIndex was not set for sch items
|
// ParentItemIndex was not set for such items
|
||||||
// if (item.ParentId == ROOT_DIR_INO_NUM) break;
|
// if (item.ParentId == ROOT_DIR_INO_NUM) break;
|
||||||
s.InsertAtFront(WCHAR_PATH_SEPARATOR);
|
s.InsertAtFront(WCHAR_PATH_SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
@ -3049,7 +3185,6 @@ void CDatabase::GetItemPath(unsigned index, const CNode *inode, NWindows::NCOM::
|
||||||
if (IsViDef(ref.AttrIndex) && inode)
|
if (IsViDef(ref.AttrIndex) && inode)
|
||||||
{
|
{
|
||||||
s += ':';
|
s += ':';
|
||||||
UString s2;
|
|
||||||
Utf8Name_to_InterName(inode->Attrs[(unsigned)ref.AttrIndex].Name, s2);
|
Utf8Name_to_InterName(inode->Attrs[(unsigned)ref.AttrIndex].Name, s2);
|
||||||
// s2 += "a\\b"; // for debug
|
// s2 += "a\\b"; // for debug
|
||||||
s += s2;
|
s += s2;
|
||||||
|
|
@ -3110,11 +3245,10 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||||
break;
|
break;
|
||||||
case kpidPrimeName:
|
case kpidPrimeName:
|
||||||
{
|
{
|
||||||
if (inode
|
|
||||||
#ifdef APFS_SHOW_ALT_STREAMS
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
&& !ref.IsAltStream()
|
if (!ref.IsAltStream())
|
||||||
#endif
|
#endif
|
||||||
&& !inode->PrimaryName.IsEmpty())
|
if (inode && !inode->PrimaryName.IsEmpty())
|
||||||
{
|
{
|
||||||
UString s;
|
UString s;
|
||||||
ConvertUTF8ToUnicode(inode->PrimaryName, s);
|
ConvertUTF8ToUnicode(inode->PrimaryName, s);
|
||||||
|
|
@ -3155,6 +3289,9 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||||
}
|
}
|
||||||
|
|
||||||
case kpidSymLink:
|
case kpidSymLink:
|
||||||
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
|
if (!ref.IsAltStream())
|
||||||
|
#endif
|
||||||
if (inode)
|
if (inode)
|
||||||
{
|
{
|
||||||
if (inode->IsSymLink() && IsViDef(inode->SymLinkIndex))
|
if (inode->IsSymLink() && IsViDef(inode->SymLinkIndex))
|
||||||
|
|
@ -3178,8 +3315,9 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||||
case kpidSize:
|
case kpidSize:
|
||||||
if (inode)
|
if (inode)
|
||||||
{
|
{
|
||||||
UInt64 size;
|
UInt64 size = 0;
|
||||||
if (inode->GetSize(ref.GetAttrIndex(), size))
|
if (inode->GetSize(ref.GetAttrIndex(), size) ||
|
||||||
|
!inode->IsDir())
|
||||||
prop = size;
|
prop = size;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -3188,18 +3326,53 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||||
if (inode)
|
if (inode)
|
||||||
{
|
{
|
||||||
UInt64 size;
|
UInt64 size;
|
||||||
if (inode->GetPackSize(ref.GetAttrIndex(), size))
|
if (inode->GetPackSize(ref.GetAttrIndex(), size) ||
|
||||||
|
!inode->IsDir())
|
||||||
prop = size;
|
prop = size;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kpidMethod:
|
||||||
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
|
if (!ref.IsAltStream())
|
||||||
|
#endif
|
||||||
|
if (inode)
|
||||||
|
{
|
||||||
|
if (inode->CompressHeader.IsCorrect)
|
||||||
|
inode->CompressHeader.MethodToProp(prop);
|
||||||
|
else if (IsViDef(inode->DecmpfsIndex))
|
||||||
|
prop = "decmpfs";
|
||||||
|
else if (!inode->IsDir() && !inode->dstream_defined)
|
||||||
|
{
|
||||||
|
if (inode->IsSymLink())
|
||||||
|
{
|
||||||
|
if (IsViDef(inode->SymLinkIndex))
|
||||||
|
prop = "symlink";
|
||||||
|
}
|
||||||
|
// else prop = "no_dstream";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/*
|
||||||
|
case kpidUncompressedSize:
|
||||||
|
if (inode && inode->Has_UNCOMPRESSED_SIZE())
|
||||||
|
prop = inode->uncompressed_size;
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
|
||||||
case kpidIsDir:
|
case kpidIsDir:
|
||||||
{
|
{
|
||||||
bool isDir = false;
|
bool isDir = false;
|
||||||
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
|
if (!ref.IsAltStream())
|
||||||
|
#endif
|
||||||
|
{
|
||||||
if (inode)
|
if (inode)
|
||||||
isDir = inode->IsDir();
|
isDir = inode->IsDir();
|
||||||
else if (item)
|
else if (item)
|
||||||
isDir = item->Val.IsFlags_Dir();
|
isDir = item->Val.IsFlags_Dir();
|
||||||
|
}
|
||||||
prop = isDir;
|
prop = isDir;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -3251,6 +3424,9 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case kpidCharacts:
|
case kpidCharacts:
|
||||||
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
|
if (!ref.IsAltStream())
|
||||||
|
#endif
|
||||||
if (inode)
|
if (inode)
|
||||||
{
|
{
|
||||||
FLAGS_TO_PROP(g_INODE_Flags, (UInt32)inode->internal_flags, prop);
|
FLAGS_TO_PROP(g_INODE_Flags, (UInt32)inode->internal_flags, prop);
|
||||||
|
|
@ -3258,6 +3434,9 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kpidBsdFlags:
|
case kpidBsdFlags:
|
||||||
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
|
if (!ref.IsAltStream())
|
||||||
|
#endif
|
||||||
if (inode)
|
if (inode)
|
||||||
{
|
{
|
||||||
FLAGS_TO_PROP(g_INODE_BSD_Flags, inode->bsd_flags, prop);
|
FLAGS_TO_PROP(g_INODE_BSD_Flags, inode->bsd_flags, prop);
|
||||||
|
|
@ -3265,6 +3444,9 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kpidGeneration:
|
case kpidGeneration:
|
||||||
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
|
// if (!ref.IsAltStream())
|
||||||
|
#endif
|
||||||
if (inode)
|
if (inode)
|
||||||
prop = inode->write_generation_counter;
|
prop = inode->write_generation_counter;
|
||||||
break;
|
break;
|
||||||
|
|
@ -3280,6 +3462,9 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kpidLinks:
|
case kpidLinks:
|
||||||
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
|
if (!ref.IsAltStream())
|
||||||
|
#endif
|
||||||
if (inode && !inode->IsDir())
|
if (inode && !inode->IsDir())
|
||||||
prop = (UInt32)inode->nlink;
|
prop = (UInt32)inode->nlink;
|
||||||
break;
|
break;
|
||||||
|
|
@ -3287,13 +3472,16 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||||
case kpidINode:
|
case kpidINode:
|
||||||
#ifdef APFS_SHOW_ALT_STREAMS
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
// here we can disable iNode for alt stream.
|
// here we can disable iNode for alt stream.
|
||||||
// if (!ref.IsAltStream())
|
if (!ref.IsAltStream())
|
||||||
#endif
|
#endif
|
||||||
if (IsViDef(ref.NodeIndex))
|
if (IsViDef(ref.NodeIndex))
|
||||||
prop = (UInt32)vol.NodeIDs[ref.NodeIndex];
|
prop = (UInt32)vol.NodeIDs[ref.NodeIndex];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kpidParentINode:
|
case kpidParentINode:
|
||||||
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
|
if (!ref.IsAltStream())
|
||||||
|
#endif
|
||||||
if (inode)
|
if (inode)
|
||||||
prop = (UInt32)inode->parent_id;
|
prop = (UInt32)inode->parent_id;
|
||||||
break;
|
break;
|
||||||
|
|
@ -3351,6 +3539,8 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||||
NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
|
NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
|
||||||
CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
|
CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
|
||||||
|
|
||||||
|
NHfs::CDecoder decoder;
|
||||||
|
|
||||||
for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize)
|
for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize)
|
||||||
{
|
{
|
||||||
lps->InSize = currentTotalSize;
|
lps->InSize = currentTotalSize;
|
||||||
|
|
@ -3399,6 +3589,57 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||||
RINOK(extractCallback->PrepareOperation(askMode));
|
RINOK(extractCallback->PrepareOperation(askMode));
|
||||||
int opRes = NExtract::NOperationResult::kDataError;
|
int opRes = NExtract::NOperationResult::kDataError;
|
||||||
|
|
||||||
|
if (IsViDef(ref.NodeIndex))
|
||||||
|
{
|
||||||
|
const CNode &inode = vol.Nodes[ref.NodeIndex];
|
||||||
|
if (
|
||||||
|
#ifdef APFS_SHOW_ALT_STREAMS
|
||||||
|
!ref.IsAltStream() &&
|
||||||
|
#endif
|
||||||
|
!inode.dstream_defined
|
||||||
|
&& inode.Extents.IsEmpty()
|
||||||
|
&& inode.Has_UNCOMPRESSED_SIZE()
|
||||||
|
&& inode.uncompressed_size == inode.CompressHeader.UnpackSize)
|
||||||
|
{
|
||||||
|
if (inode.CompressHeader.IsSupported)
|
||||||
|
{
|
||||||
|
CMyComPtr<ISequentialInStream> inStreamFork;
|
||||||
|
UInt64 forkSize = 0;
|
||||||
|
const CByteBuffer *decmpfs_Data = NULL;
|
||||||
|
|
||||||
|
if (inode.CompressHeader.IsMethod_Resource())
|
||||||
|
{
|
||||||
|
if (IsViDef(inode.ResourceIndex))
|
||||||
|
{
|
||||||
|
const CAttr &attr = inode.Attrs[inode.ResourceIndex];
|
||||||
|
forkSize = attr.GetSize();
|
||||||
|
GetAttrStream(_stream, vol, attr, &inStreamFork);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const CAttr &attr = inode.Attrs[inode.DecmpfsIndex];
|
||||||
|
decmpfs_Data = &attr.Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inStreamFork || decmpfs_Data)
|
||||||
|
{
|
||||||
|
const HRESULT hres = decoder.Extract(
|
||||||
|
inStreamFork, realOutStream,
|
||||||
|
forkSize,
|
||||||
|
inode.CompressHeader,
|
||||||
|
decmpfs_Data,
|
||||||
|
currentTotalSize, extractCallback,
|
||||||
|
opRes);
|
||||||
|
if (hres != S_FALSE && hres != S_OK)
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
opRes = NExtract::NOperationResult::kUnsupportedMethod;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CMyComPtr<ISequentialInStream> inStream;
|
CMyComPtr<ISequentialInStream> inStream;
|
||||||
if (GetStream(index, &inStream) == S_OK && inStream)
|
if (GetStream(index, &inStream) == S_OK && inStream)
|
||||||
{
|
{
|
||||||
|
|
@ -3409,6 +3650,8 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||||
else if (copyCoderSpec->TotalSize < currentItemSize)
|
else if (copyCoderSpec->TotalSize < currentItemSize)
|
||||||
opRes = NExtract::NOperationResult::kUnexpectedEnd;
|
opRes = NExtract::NOperationResult::kUnexpectedEnd;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
realOutStream.Release();
|
realOutStream.Release();
|
||||||
RINOK(extractCallback->SetOperationResult(opRes));
|
RINOK(extractCallback->SetOperationResult(opRes));
|
||||||
|
|
@ -3478,7 +3721,14 @@ STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
|
||||||
if (inode.IsDir())
|
if (inode.IsDir())
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
if (inode.dstream_defined)
|
if (inode.dstream_defined)
|
||||||
|
{
|
||||||
rem = inode.dstream.size;
|
rem = inode.dstream.size;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// return S_FALSE; // check it !!! How zero size files are stored with dstream_defined?
|
||||||
|
}
|
||||||
|
|
||||||
extents = &inode.Extents;
|
extents = &inode.Extents;
|
||||||
}
|
}
|
||||||
return GetStream2(_stream, extents, rem, stream);
|
return GetStream2(_stream, extents, rem, stream);
|
||||||
|
|
@ -3486,6 +3736,35 @@ STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT CDatabase::GetAttrStream(IInStream *apfsInStream, const CVol &vol,
|
||||||
|
const CAttr &attr, ISequentialInStream **stream)
|
||||||
|
{
|
||||||
|
*stream = NULL;
|
||||||
|
if (!attr.dstream_defined)
|
||||||
|
{
|
||||||
|
CBufInStream *streamSpec = new CBufInStream;
|
||||||
|
CMyComPtr<ISequentialInStream> streamTemp = streamSpec;
|
||||||
|
streamSpec->Init(attr.Data, attr.Data.Size(), (IInArchive *)this);
|
||||||
|
*stream = streamTemp.Detach();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
return GetAttrStream_dstream(apfsInStream, vol, attr, stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT CDatabase::GetAttrStream_dstream( IInStream *apfsInStream, const CVol &vol,
|
||||||
|
const CAttr &attr, ISequentialInStream **stream)
|
||||||
|
{
|
||||||
|
const int idIndex = vol.SmallNodeIDs.FindInSorted(attr.Id);
|
||||||
|
if (idIndex == -1)
|
||||||
|
return S_FALSE;
|
||||||
|
return GetStream2(apfsInStream,
|
||||||
|
&vol.SmallNodes[(unsigned)idIndex].Extents,
|
||||||
|
attr.dstream.size,
|
||||||
|
stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT CDatabase::GetStream2(
|
HRESULT CDatabase::GetStream2(
|
||||||
IInStream *apfsInStream,
|
IInStream *apfsInStream,
|
||||||
const CRecordVector<CExtent> *extents, UInt64 rem,
|
const CRecordVector<CExtent> *extents, UInt64 rem,
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ struct CLzxInfo
|
||||||
CLzxInfo():
|
CLzxInfo():
|
||||||
Version(0),
|
Version(0),
|
||||||
ResetIntervalBits(0),
|
ResetIntervalBits(0),
|
||||||
|
WindowSizeBits(0),
|
||||||
CacheSize(0)
|
CacheSize(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1063,6 +1063,8 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||||
subName.DeleteFrom(pos1);
|
subName.DeleteFrom(pos1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
subName = item.Name; // new apfs dmg can be without braces
|
||||||
subName.Trim();
|
subName.Trim();
|
||||||
if (!subName.IsEmpty())
|
if (!subName.IsEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
85
CPP/7zip/Archive/HfsHandler.h
Normal file
85
CPP/7zip/Archive/HfsHandler.h
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
// HfsHandler.h
|
||||||
|
|
||||||
|
#ifndef __HFS_HANDLER_H
|
||||||
|
#define __HFS_HANDLER_H
|
||||||
|
|
||||||
|
#include "../../Windows/PropVariant.h"
|
||||||
|
|
||||||
|
#include "../Compress/LzfseDecoder.h"
|
||||||
|
#include "../Compress/ZlibDecoder.h"
|
||||||
|
|
||||||
|
namespace NArchive {
|
||||||
|
namespace NHfs {
|
||||||
|
|
||||||
|
static const UInt32 k_decmpfs_HeaderSize = 16;
|
||||||
|
|
||||||
|
struct CCompressHeader
|
||||||
|
{
|
||||||
|
UInt64 UnpackSize;
|
||||||
|
UInt32 Method;
|
||||||
|
Byte DataPos;
|
||||||
|
bool IsCorrect;
|
||||||
|
bool IsSupported;
|
||||||
|
bool IsResource;
|
||||||
|
|
||||||
|
bool IsMethod_Compressed_Inline() const { return DataPos == k_decmpfs_HeaderSize; }
|
||||||
|
bool IsMethod_Uncompressed_Inline() const { return DataPos == k_decmpfs_HeaderSize + 1; }
|
||||||
|
bool IsMethod_Resource() const { return IsResource; }
|
||||||
|
|
||||||
|
void Parse(const Byte *p, size_t size);
|
||||||
|
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
UnpackSize = 0;
|
||||||
|
Method = 0;
|
||||||
|
DataPos = 0;
|
||||||
|
IsCorrect = false;
|
||||||
|
IsSupported = false;
|
||||||
|
IsResource = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCompressHeader() { Clear(); }
|
||||||
|
|
||||||
|
void MethodToProp(NWindows::NCOM::CPropVariant &prop) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
void MethodsMaskToProp(UInt32 methodsMask, NWindows::NCOM::CPropVariant &prop);
|
||||||
|
|
||||||
|
|
||||||
|
class CDecoder
|
||||||
|
{
|
||||||
|
NCompress::NZlib::CDecoder *_zlibDecoderSpec;
|
||||||
|
CMyComPtr<ICompressCoder> _zlibDecoder;
|
||||||
|
|
||||||
|
NCompress::NLzfse::CDecoder *_lzfseDecoderSpec;
|
||||||
|
CMyComPtr<ICompressCoder> _lzfseDecoder;
|
||||||
|
|
||||||
|
CByteBuffer _tableBuf;
|
||||||
|
CByteBuffer _buf;
|
||||||
|
|
||||||
|
HRESULT ExtractResourceFork_ZLIB(
|
||||||
|
ISequentialInStream *inStream, ISequentialOutStream *realOutStream,
|
||||||
|
UInt64 forkSize, UInt64 unpackSize,
|
||||||
|
UInt64 progressStart, IArchiveExtractCallback *extractCallback);
|
||||||
|
|
||||||
|
HRESULT ExtractResourceFork_LZFSE(
|
||||||
|
ISequentialInStream *inStream, ISequentialOutStream *realOutStream,
|
||||||
|
UInt64 forkSize, UInt64 unpackSize,
|
||||||
|
UInt64 progressStart, IArchiveExtractCallback *extractCallback);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
HRESULT Extract(
|
||||||
|
ISequentialInStream *inStreamFork, ISequentialOutStream *realOutStream,
|
||||||
|
UInt64 forkSize,
|
||||||
|
const CCompressHeader &compressHeader,
|
||||||
|
const CByteBuffer *data,
|
||||||
|
UInt64 progressStart, IArchiveExtractCallback *extractCallback,
|
||||||
|
int &opRes);
|
||||||
|
|
||||||
|
CDecoder();
|
||||||
|
};
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -48,14 +48,22 @@ static const Byte kProps[] =
|
||||||
kpidPackSize,
|
kpidPackSize,
|
||||||
kpidMTime,
|
kpidMTime,
|
||||||
kpidATime,
|
kpidATime,
|
||||||
kpidChangeTime
|
kpidCTime,
|
||||||
|
kpidChangeTime,
|
||||||
|
// kpidUserId,
|
||||||
|
// kpidGroupId,
|
||||||
|
// kpidPosixAttrib,
|
||||||
|
kpidLinks
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Byte kArcProps[] =
|
static const Byte kArcProps[] =
|
||||||
{
|
{
|
||||||
kpidComment,
|
kpidUnpackVer,
|
||||||
kpidClusterSize,
|
kpidClusterSize,
|
||||||
kpidCTime
|
kpidSectorSize,
|
||||||
|
kpidCTime,
|
||||||
|
kpidMTime,
|
||||||
|
kpidComment
|
||||||
};
|
};
|
||||||
|
|
||||||
IMP_IInArchive_Props
|
IMP_IInArchive_Props
|
||||||
|
|
@ -69,6 +77,18 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
||||||
{
|
{
|
||||||
case kpidPhySize: prop = _archive.PhySize; break;
|
case kpidPhySize: prop = _archive.PhySize; break;
|
||||||
|
|
||||||
|
case kpidUnpackVer:
|
||||||
|
{
|
||||||
|
if (_archive.LogVols.Size() == 1)
|
||||||
|
{
|
||||||
|
UString s;
|
||||||
|
const CLogVol &vol = _archive.LogVols[0];
|
||||||
|
vol.DomainId.AddUdfVersionTo(s);
|
||||||
|
if (!s.IsEmpty())
|
||||||
|
prop = s;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case kpidComment:
|
case kpidComment:
|
||||||
{
|
{
|
||||||
UString comment = _archive.GetComment();
|
UString comment = _archive.GetComment();
|
||||||
|
|
@ -90,12 +110,21 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kpidSectorSize: prop = ((UInt32)1 << _archive.SecLogSize); break;
|
||||||
|
|
||||||
case kpidCTime:
|
case kpidCTime:
|
||||||
if (_archive.LogVols.Size() == 1)
|
if (_archive.LogVols.Size() == 1)
|
||||||
{
|
{
|
||||||
const CLogVol &vol = _archive.LogVols[0];
|
const CLogVol &vol = _archive.LogVols[0];
|
||||||
if (vol.FileSets.Size() >= 1)
|
if (vol.FileSets.Size() >= 1)
|
||||||
UdfTimeToFileTime(vol.FileSets[0].RecodringTime, prop);
|
UdfTimeToFileTime(vol.FileSets[0].RecordingTime, prop);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kpidMTime:
|
||||||
|
if (_archive.PrimeVols.Size() == 1)
|
||||||
|
{
|
||||||
|
const CPrimeVol &pv = _archive.PrimeVols[0];
|
||||||
|
UdfTimeToFileTime(pv.RecordingTime, prop);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -160,6 +189,7 @@ STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 *, IArchiveOpenCallb
|
||||||
{
|
{
|
||||||
const CLogVol &vol = _archive.LogVols[volIndex];
|
const CLogVol &vol = _archive.LogVols[volIndex];
|
||||||
bool showFileSetName = (vol.FileSets.Size() > 1);
|
bool showFileSetName = (vol.FileSets.Size() > 1);
|
||||||
|
// showFileSetName = true; // for debug
|
||||||
FOR_VECTOR (fsIndex, vol.FileSets)
|
FOR_VECTOR (fsIndex, vol.FileSets)
|
||||||
{
|
{
|
||||||
const CFileSet &fs = vol.FileSets[fsIndex];
|
const CFileSet &fs = vol.FileSets[fsIndex];
|
||||||
|
|
@ -212,7 +242,15 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||||
case kpidPackSize: if (!item.IsDir()) prop = (UInt64)item.NumLogBlockRecorded * vol.BlockSize; break;
|
case kpidPackSize: if (!item.IsDir()) prop = (UInt64)item.NumLogBlockRecorded * vol.BlockSize; break;
|
||||||
case kpidMTime: UdfTimeToFileTime(item.MTime, prop); break;
|
case kpidMTime: UdfTimeToFileTime(item.MTime, prop); break;
|
||||||
case kpidATime: UdfTimeToFileTime(item.ATime, prop); break;
|
case kpidATime: UdfTimeToFileTime(item.ATime, prop); break;
|
||||||
|
case kpidCTime:
|
||||||
|
if (item.IsExtended)
|
||||||
|
UdfTimeToFileTime(item.CreateTime, prop);
|
||||||
|
break;
|
||||||
case kpidChangeTime: UdfTimeToFileTime(item.AttribTime, prop); break;
|
case kpidChangeTime: UdfTimeToFileTime(item.AttribTime, prop); break;
|
||||||
|
// case kpidUserId: prop = item.Uid; break;
|
||||||
|
// case kpidGroupId: prop = item.Gid; break;
|
||||||
|
// case kpidPosixAttrib: prop = (UInt32)item.Permissions; break;
|
||||||
|
case kpidLinks: prop = (UInt32)item.FileLinkCount; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prop.Detach(value);
|
prop.Detach(value);
|
||||||
|
|
@ -255,7 +293,7 @@ STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
|
||||||
if (size < len)
|
if (size < len)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
int partitionIndex = vol.PartitionMaps[extent.PartitionRef].PartitionIndex;
|
const unsigned partitionIndex = vol.PartitionMaps[extent.PartitionRef].PartitionIndex;
|
||||||
UInt32 logBlockNumber = extent.Pos;
|
UInt32 logBlockNumber = extent.Pos;
|
||||||
const CPartition &partition = _archive.Partitions[partitionIndex];
|
const CPartition &partition = _archive.Partitions[partitionIndex];
|
||||||
UInt64 offset = ((UInt64)partition.Pos << _archive.SecLogSize) +
|
UInt64 offset = ((UInt64)partition.Pos << _archive.SecLogSize) +
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,9 @@ class CHandler:
|
||||||
public IInArchiveGetStream,
|
public IInArchiveGetStream,
|
||||||
public CMyUnknownImp
|
public CMyUnknownImp
|
||||||
{
|
{
|
||||||
|
CRecordVector<CRef2> _refs2;
|
||||||
CMyComPtr<IInStream> _inStream;
|
CMyComPtr<IInStream> _inStream;
|
||||||
CInArchive _archive;
|
CInArchive _archive;
|
||||||
CRecordVector<CRef2> _refs2;
|
|
||||||
public:
|
public:
|
||||||
MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
|
MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
|
||||||
INTERFACE_IInArchive(;)
|
INTERFACE_IInArchive(;)
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -17,16 +17,15 @@ namespace NUdf {
|
||||||
// ---------- ECMA Part 1 ----------
|
// ---------- ECMA Part 1 ----------
|
||||||
|
|
||||||
// ECMA 1/7.2.12
|
// ECMA 1/7.2.12
|
||||||
|
// UDF 2.1.3
|
||||||
|
|
||||||
/*
|
|
||||||
struct CDString32
|
struct CDString32
|
||||||
{
|
{
|
||||||
Byte Data[32];
|
Byte Data[32];
|
||||||
|
|
||||||
void Parse(const Byte *buf);
|
void Parse(const Byte *buf) { memcpy(Data, buf, sizeof(Data)); }
|
||||||
// UString GetString() const;
|
UString GetString() const;
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
|
|
||||||
struct CDString128
|
struct CDString128
|
||||||
{
|
{
|
||||||
|
|
@ -46,6 +45,7 @@ struct CDString
|
||||||
|
|
||||||
|
|
||||||
// ECMA 1/7.3
|
// ECMA 1/7.3
|
||||||
|
// UDF 2.1.4 timestamp
|
||||||
|
|
||||||
struct CTime
|
struct CTime
|
||||||
{
|
{
|
||||||
|
|
@ -65,9 +65,9 @@ struct CTime
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ECMA 1/7.4
|
// ECMA 1/7.4 regid
|
||||||
|
// UDF 2.1.5 EntityID
|
||||||
|
|
||||||
/*
|
|
||||||
struct CRegId
|
struct CRegId
|
||||||
{
|
{
|
||||||
Byte Flags;
|
Byte Flags;
|
||||||
|
|
@ -75,44 +75,97 @@ struct CRegId
|
||||||
char Suffix[8];
|
char Suffix[8];
|
||||||
|
|
||||||
void Parse(const Byte *buf);
|
void Parse(const Byte *buf);
|
||||||
|
void AddCommentTo(UString &s) const;
|
||||||
|
void AddUdfVersionTo(UString &s) const;
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// ---------- ECMA Part 3: Volume Structure ----------
|
// ---------- ECMA Part 3: Volume Structure ----------
|
||||||
|
|
||||||
|
// ECMA 3/7.1
|
||||||
|
|
||||||
|
struct CExtent
|
||||||
|
{
|
||||||
|
UInt32 Len;
|
||||||
|
UInt32 Pos; // logical sector number
|
||||||
|
|
||||||
|
void Parse(const Byte *p);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ECMA 3/10.1
|
||||||
|
// UDF 2.2.2 PrimaryVolumeDescriptor
|
||||||
|
|
||||||
|
struct CPrimeVol
|
||||||
|
{
|
||||||
|
// UInt32 VolumeDescriptorSequenceNumber;
|
||||||
|
UInt32 PrimaryVolumeDescriptorNumber;
|
||||||
|
CDString32 VolumeId;
|
||||||
|
UInt16 VolumeSequenceNumber;
|
||||||
|
UInt16 MaximumVolumeSequenceNumber;
|
||||||
|
// UInt16 InterchangeLevel;
|
||||||
|
// UInt16 MaximumInterchangeLevel;
|
||||||
|
// UInt32 CharacterSetList;
|
||||||
|
// UInt32 MaximumCharacterSetList;
|
||||||
|
CDString128 VolumeSetId;
|
||||||
|
// charspec DescriptorCharacterSet; // (1/7.2.1)
|
||||||
|
// charspec ExplanatoryCharacterSet; // (1/7.2.1)
|
||||||
|
// CExtent VolumeAbstract;
|
||||||
|
// CExtent VolumeCopyrightNotice;
|
||||||
|
CRegId ApplicationId;
|
||||||
|
CTime RecordingTime;
|
||||||
|
CRegId ImplId;
|
||||||
|
// bytes ImplementationUse
|
||||||
|
// UInt32 PredecessorVolumeDescriptorSequenceLocation;
|
||||||
|
// UInt16 Flags;
|
||||||
|
|
||||||
|
void Parse(const Byte *p);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// ECMA 3/10.5
|
// ECMA 3/10.5
|
||||||
|
// UDF 2.2.14 PartitionDescriptor
|
||||||
|
|
||||||
struct CPartition
|
struct CPartition
|
||||||
{
|
{
|
||||||
// UInt16 Flags;
|
|
||||||
UInt16 Number;
|
|
||||||
// CRegId ContentsId;
|
|
||||||
// Byte ContentsUse[128];
|
|
||||||
// UInt32 AccessType;
|
|
||||||
|
|
||||||
UInt32 Pos;
|
UInt32 Pos;
|
||||||
UInt32 Len;
|
UInt32 Len;
|
||||||
|
|
||||||
// CRegId ImplId;
|
UInt16 Flags;
|
||||||
|
UInt16 Number;
|
||||||
|
CRegId ContentsId;
|
||||||
|
// Byte ContentsUse[128];
|
||||||
|
UInt32 AccessType;
|
||||||
|
|
||||||
|
CRegId ImplId;
|
||||||
// Byte ImplUse[128];
|
// Byte ImplUse[128];
|
||||||
|
|
||||||
int VolIndex;
|
// int VolIndex;
|
||||||
CMap32 Map;
|
CMap32 Map;
|
||||||
|
|
||||||
CPartition(): VolIndex(-1) {}
|
bool IsMetadata;
|
||||||
|
|
||||||
|
CPartition():
|
||||||
|
// VolIndex(-1),
|
||||||
|
IsMetadata(false) {}
|
||||||
|
|
||||||
// bool IsNsr() const { return (strncmp(ContentsId.Id, "+NSR0", 5) == 0); }
|
// bool IsNsr() const { return (strncmp(ContentsId.Id, "+NSR0", 5) == 0); }
|
||||||
// bool IsAllocated() const { return ((Flags & 1) != 0); }
|
// bool IsAllocated() const { return ((Flags & 1) != 0); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ECMA 4/7.1 lb_addr
|
||||||
|
|
||||||
struct CLogBlockAddr
|
struct CLogBlockAddr
|
||||||
{
|
{
|
||||||
UInt32 Pos;
|
UInt32 Pos;
|
||||||
UInt16 PartitionRef;
|
UInt16 PartitionRef;
|
||||||
|
|
||||||
void Parse(const Byte *buf);
|
void Parse(const Byte *p);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum EShortAllocDescType
|
enum EShortAllocDescType
|
||||||
{
|
{
|
||||||
SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated = 0,
|
SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated = 0,
|
||||||
|
|
@ -121,16 +174,18 @@ enum EShortAllocDescType
|
||||||
SHORT_ALLOC_DESC_TYPE_NextExtent = 3
|
SHORT_ALLOC_DESC_TYPE_NextExtent = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ECMA 4/14.14.1 short_ad
|
||||||
|
|
||||||
struct CShortAllocDesc
|
struct CShortAllocDesc
|
||||||
{
|
{
|
||||||
UInt32 Len;
|
UInt32 Len;
|
||||||
UInt32 Pos;
|
UInt32 Pos;
|
||||||
|
|
||||||
// 4/14.14.1
|
|
||||||
// UInt32 GetLen() const { return Len & 0x3FFFFFFF; }
|
// UInt32 GetLen() const { return Len & 0x3FFFFFFF; }
|
||||||
// UInt32 GetType() const { return Len >> 30; }
|
// UInt32 GetType() const { return Len >> 30; }
|
||||||
// bool IsRecAndAlloc() const { return GetType() == SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated; }
|
// bool IsRecAndAlloc() const { return GetType() == SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated; }
|
||||||
void Parse(const Byte *buf);
|
void Parse(const Byte *p);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -138,10 +193,13 @@ struct CADImpUse
|
||||||
{
|
{
|
||||||
UInt16 Flags;
|
UInt16 Flags;
|
||||||
UInt32 UdfUniqueId;
|
UInt32 UdfUniqueId;
|
||||||
void Parse(const Byte *buf);
|
void Parse(const Byte *p);
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// ECMA 4/14.14.2 long_ad
|
||||||
|
// UDF 2.3.10.1
|
||||||
|
|
||||||
struct CLongAllocDesc
|
struct CLongAllocDesc
|
||||||
{
|
{
|
||||||
UInt32 Len;
|
UInt32 Len;
|
||||||
|
|
@ -153,29 +211,48 @@ struct CLongAllocDesc
|
||||||
UInt32 GetLen() const { return Len & 0x3FFFFFFF; }
|
UInt32 GetLen() const { return Len & 0x3FFFFFFF; }
|
||||||
UInt32 GetType() const { return Len >> 30; }
|
UInt32 GetType() const { return Len >> 30; }
|
||||||
bool IsRecAndAlloc() const { return GetType() == SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated; }
|
bool IsRecAndAlloc() const { return GetType() == SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated; }
|
||||||
void Parse(const Byte *buf);
|
void Parse(const Byte *p);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ECMA 3/10.7 Partition maps
|
||||||
|
// UDF 2.2.8-2.2.10 Partition Maps
|
||||||
|
|
||||||
struct CPartitionMap
|
struct CPartitionMap
|
||||||
{
|
{
|
||||||
|
unsigned PartitionIndex;
|
||||||
|
|
||||||
Byte Type;
|
Byte Type;
|
||||||
// Byte Len;
|
// Byte Len;
|
||||||
|
|
||||||
// Type - 1
|
// ECMA 10.7.2
|
||||||
// UInt16 VolSeqNumber;
|
UInt16 VolumeSequenceNumber;
|
||||||
UInt16 PartitionNumber;
|
UInt16 PartitionNumber;
|
||||||
|
|
||||||
// Byte Data[256];
|
CRegId PartitionTypeId;
|
||||||
|
|
||||||
int PartitionIndex;
|
// UDF 2.2.10 Metadata Partition Map
|
||||||
|
UInt32 MetadataFileLocation;
|
||||||
|
// UInt32 MetadataMirrorFileLocation;
|
||||||
|
// UInt32 MetadataBitmapFileLocation;
|
||||||
|
// UInt32 AllocationUnitSize; // (Blocks)
|
||||||
|
// UInt16 AlignmentUnitSize; // (Blocks)
|
||||||
|
// Byte Flags;
|
||||||
|
|
||||||
|
// Byte Data[256];
|
||||||
|
// CPartitionMap(): PartitionIndex(-1) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ECMA 4/14.6
|
|
||||||
|
// ECMA 4/14.6.6
|
||||||
|
|
||||||
enum EIcbFileType
|
enum EIcbFileType
|
||||||
{
|
{
|
||||||
ICB_FILE_TYPE_DIR = 4,
|
ICB_FILE_TYPE_DIR = 4,
|
||||||
ICB_FILE_TYPE_FILE = 5
|
ICB_FILE_TYPE_FILE = 5,
|
||||||
|
|
||||||
|
ICB_FILE_TYPE_METADATA = 250, // 2.2.13.1 Metadata File
|
||||||
|
ICB_FILE_TYPE_METADATA_MIRROR = 251
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EIcbDescriptorType
|
enum EIcbDescriptorType
|
||||||
|
|
@ -186,6 +263,9 @@ enum EIcbDescriptorType
|
||||||
ICB_DESC_TYPE_INLINE = 3
|
ICB_DESC_TYPE_INLINE = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ECMA 4/14.6
|
||||||
|
// UDF 3.3.2
|
||||||
|
|
||||||
struct CIcbTag
|
struct CIcbTag
|
||||||
{
|
{
|
||||||
// UInt32 PriorDirectNum;
|
// UInt32 PriorDirectNum;
|
||||||
|
|
@ -201,33 +281,35 @@ struct CIcbTag
|
||||||
void Parse(const Byte *p);
|
void Parse(const Byte *p);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ECMA 4/14.4.3
|
||||||
// const Byte FILEID_CHARACS_Existance = (1 << 0);
|
// const Byte FILEID_CHARACS_Existance = (1 << 0);
|
||||||
const Byte FILEID_CHARACS_Parent = (1 << 3);
|
const Byte FILEID_CHARACS_Parent = (1 << 3);
|
||||||
|
|
||||||
struct CFile
|
struct CFile
|
||||||
{
|
{
|
||||||
|
int ItemIndex;
|
||||||
// UInt16 FileVersion;
|
// UInt16 FileVersion;
|
||||||
// Byte FileCharacteristics;
|
// Byte FileCharacteristics;
|
||||||
// CByteBuffer ImplUse;
|
// CByteBuffer ImplUse;
|
||||||
CDString Id;
|
CDString Id;
|
||||||
|
|
||||||
int ItemIndex;
|
|
||||||
|
|
||||||
CFile(): /* FileVersion(0), FileCharacteristics(0), */ ItemIndex(-1) {}
|
CFile(): /* FileVersion(0), FileCharacteristics(0), */ ItemIndex(-1) {}
|
||||||
UString GetName() const { return Id.GetString(); }
|
UString GetName() const { return Id.GetString(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct CMyExtent
|
struct CMyExtent
|
||||||
{
|
{
|
||||||
UInt32 Pos;
|
UInt32 Pos;
|
||||||
UInt32 Len;
|
UInt32 Len;
|
||||||
unsigned PartitionRef;
|
unsigned PartitionRef; // index in CLogVol::PartitionMaps
|
||||||
|
|
||||||
UInt32 GetLen() const { return Len & 0x3FFFFFFF; }
|
UInt32 GetLen() const { return Len & 0x3FFFFFFF; }
|
||||||
UInt32 GetType() const { return Len >> 30; }
|
UInt32 GetType() const { return Len >> 30; }
|
||||||
bool IsRecAndAlloc() const { return GetType() == SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated; }
|
bool IsRecAndAlloc() const { return GetType() == SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct CItem
|
struct CItem
|
||||||
{
|
{
|
||||||
CIcbTag IcbTag;
|
CIcbTag IcbTag;
|
||||||
|
|
@ -235,26 +317,30 @@ struct CItem
|
||||||
// UInt32 Uid;
|
// UInt32 Uid;
|
||||||
// UInt32 Gid;
|
// UInt32 Gid;
|
||||||
// UInt32 Permissions;
|
// UInt32 Permissions;
|
||||||
// UInt16 FileLinkCount;
|
UInt16 FileLinkCount;
|
||||||
// Byte RecordFormat;
|
// Byte RecordFormat;
|
||||||
// Byte RecordDisplayAttr;
|
// Byte RecordDisplayAttr;
|
||||||
// UInt32 RecordLen;
|
// UInt32 RecordLen;
|
||||||
UInt64 Size;
|
UInt64 Size;
|
||||||
UInt64 NumLogBlockRecorded;
|
UInt64 NumLogBlockRecorded;
|
||||||
|
// UInt64 ObjectSize;
|
||||||
|
|
||||||
CTime ATime;
|
CTime ATime;
|
||||||
CTime MTime;
|
CTime MTime;
|
||||||
CTime AttribTime; // Attribute time : most recent date and time of the day of file creation or modification of the attributes of.
|
CTime AttribTime; // Attribute time : most recent date and time of the day of file creation or modification of the attributes of.
|
||||||
|
CTime CreateTime;
|
||||||
// UInt32 CheckPoint;
|
// UInt32 CheckPoint;
|
||||||
// CLongAllocDesc ExtendedAttrIcb;
|
// CLongAllocDesc ExtendedAttrIcb;
|
||||||
// CRegId ImplId;
|
// CRegId ImplId;
|
||||||
// UInt64 UniqueId;
|
// UInt64 UniqueId;
|
||||||
|
|
||||||
|
bool IsExtended;
|
||||||
bool IsInline;
|
bool IsInline;
|
||||||
CByteBuffer InlineData;
|
CByteBuffer InlineData;
|
||||||
CRecordVector<CMyExtent> Extents;
|
CRecordVector<CMyExtent> Extents;
|
||||||
CUIntVector SubFiles;
|
CUIntVector SubFiles;
|
||||||
|
|
||||||
void Parse(const Byte *buf);
|
void Parse(const Byte *p);
|
||||||
|
|
||||||
bool IsRecAndAlloc() const
|
bool IsRecAndAlloc() const
|
||||||
{
|
{
|
||||||
|
|
@ -279,53 +365,65 @@ struct CItem
|
||||||
bool IsDir() const { return IcbTag.IsDir(); }
|
bool IsDir() const { return IcbTag.IsDir(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct CRef
|
struct CRef
|
||||||
{
|
{
|
||||||
int Parent;
|
|
||||||
unsigned FileIndex;
|
unsigned FileIndex;
|
||||||
|
int Parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ECMA 4 / 14.1
|
// ECMA 4 / 14.1
|
||||||
struct CFileSet
|
struct CFileSet
|
||||||
{
|
{
|
||||||
CTime RecodringTime;
|
CRecordVector<CRef> Refs;
|
||||||
|
|
||||||
|
CTime RecordingTime;
|
||||||
// UInt16 InterchangeLevel;
|
// UInt16 InterchangeLevel;
|
||||||
// UInt16 MaxInterchangeLevel;
|
// UInt16 MaxInterchangeLevel;
|
||||||
// UInt32 FileSetNumber;
|
UInt32 FileSetNumber;
|
||||||
// UInt32 FileSetDescNumber;
|
UInt32 FileSetDescNumber;
|
||||||
// CDString32 Id;
|
CDString128 LogicalVolumeId;
|
||||||
// CDString32 CopyrightId;
|
CDString32 Id;
|
||||||
// CDString32 AbstractId;
|
CDString32 CopyrightId;
|
||||||
|
CDString32 AbstractId;
|
||||||
|
|
||||||
CLongAllocDesc RootDirICB;
|
CLongAllocDesc RootDirICB;
|
||||||
// CRegId DomainId;
|
CRegId DomainId;
|
||||||
// CLongAllocDesc SystemStreamDirICB;
|
// CLongAllocDesc SystemStreamDirICB;
|
||||||
|
|
||||||
CRecordVector<CRef> Refs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* 8.3 Volume descriptors
|
||||||
|
8.4
|
||||||
|
A Volume Descriptor Sequence:
|
||||||
|
shall contain one or more Primary Volume Descriptors.
|
||||||
|
*/
|
||||||
|
|
||||||
// ECMA 3/10.6
|
// ECMA 3/10.6
|
||||||
|
// UDF 2.2.4 LogicalVolumeDescriptor
|
||||||
|
|
||||||
struct CLogVol
|
struct CLogVol
|
||||||
{
|
{
|
||||||
CDString128 Id;
|
CObjectVector<CPartitionMap> PartitionMaps;
|
||||||
|
CObjectVector<CFileSet> FileSets;
|
||||||
|
|
||||||
UInt32 BlockSize;
|
UInt32 BlockSize;
|
||||||
// CRegId DomainId;
|
CDString128 Id;
|
||||||
|
CRegId DomainId;
|
||||||
|
|
||||||
// Byte ContentsUse[16];
|
// Byte ContentsUse[16];
|
||||||
CLongAllocDesc FileSetLocation; // UDF
|
CLongAllocDesc FileSetLocation; // UDF
|
||||||
|
|
||||||
// CRegId ImplId;
|
CRegId ImplId;
|
||||||
// Byte ImplUse[128];
|
// Byte ImplUse[128];
|
||||||
|
// CExtent IntegritySequenceExtent;
|
||||||
CObjectVector<CPartitionMap> PartitionMaps;
|
|
||||||
CObjectVector<CFileSet> FileSets;
|
|
||||||
|
|
||||||
UString GetName() const { return Id.GetString(); }
|
UString GetName() const { return Id.GetString(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct CProgressVirt
|
struct CProgressVirt
|
||||||
{
|
{
|
||||||
virtual HRESULT SetTotal(UInt64 numBytes) PURE;
|
virtual HRESULT SetTotal(UInt64 numBytes) PURE;
|
||||||
|
|
@ -335,33 +433,11 @@ struct CProgressVirt
|
||||||
|
|
||||||
class CInArchive
|
class CInArchive
|
||||||
{
|
{
|
||||||
IInStream *_stream;
|
|
||||||
CProgressVirt *_progress;
|
|
||||||
|
|
||||||
HRESULT Read(int volIndex, int partitionRef, UInt32 blockPos, UInt32 len, Byte *buf);
|
|
||||||
HRESULT Read(int volIndex, const CLongAllocDesc &lad, Byte *buf);
|
|
||||||
HRESULT ReadFromFile(int volIndex, const CItem &item, CByteBuffer &buf);
|
|
||||||
|
|
||||||
HRESULT ReadFileItem(int volIndex, int fsIndex, const CLongAllocDesc &lad, int numRecurseAllowed);
|
|
||||||
HRESULT ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &lad, int numRecurseAllowed);
|
|
||||||
|
|
||||||
HRESULT Open2();
|
|
||||||
HRESULT FillRefs(CFileSet &fs, unsigned fileIndex, int parent, int numRecurseAllowed);
|
|
||||||
|
|
||||||
UInt64 _processedProgressBytes;
|
|
||||||
|
|
||||||
UInt64 _fileNameLengthTotal;
|
|
||||||
unsigned _numRefs;
|
|
||||||
UInt32 _numExtents;
|
|
||||||
UInt64 _inlineExtentsSize;
|
|
||||||
bool CheckExtent(int volIndex, int partitionRef, UInt32 blockPos, UInt32 len) const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CObjectVector<CPartition> Partitions;
|
|
||||||
CObjectVector<CLogVol> LogVols;
|
CObjectVector<CLogVol> LogVols;
|
||||||
|
|
||||||
CObjectVector<CItem> Items;
|
CObjectVector<CItem> Items;
|
||||||
CObjectVector<CFile> Files;
|
CObjectVector<CFile> Files;
|
||||||
|
CObjectVector<CPartition> Partitions;
|
||||||
|
|
||||||
unsigned SecLogSize;
|
unsigned SecLogSize;
|
||||||
UInt64 PhySize;
|
UInt64 PhySize;
|
||||||
|
|
@ -372,19 +448,49 @@ public:
|
||||||
bool UnexpectedEnd;
|
bool UnexpectedEnd;
|
||||||
bool NoEndAnchor;
|
bool NoEndAnchor;
|
||||||
|
|
||||||
|
CObjectVector<CPrimeVol> PrimeVols;
|
||||||
|
|
||||||
|
HRESULT Open(IInStream *inStream, CProgressVirt *progress);
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
UString GetComment() const;
|
||||||
|
UString GetItemPath(unsigned volIndex, unsigned fsIndex, unsigned refIndex,
|
||||||
|
bool showVolName, bool showFsName) const;
|
||||||
|
|
||||||
|
bool CheckItemExtents(unsigned volIndex, const CItem &item) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
IInStream *_stream;
|
||||||
|
CProgressVirt *_progress;
|
||||||
|
|
||||||
|
HRESULT Read(unsigned volIndex, unsigned partitionRef, UInt32 blockPos, UInt32 len, Byte *buf);
|
||||||
|
HRESULT ReadLad(unsigned volIndex, const CLongAllocDesc &lad, Byte *buf);
|
||||||
|
HRESULT ReadFromFile(unsigned volIndex, const CItem &item, CByteBuffer &buf);
|
||||||
|
|
||||||
|
HRESULT ReadFileItem(unsigned volIndex, unsigned fsIndex, const CLongAllocDesc &lad, int numRecurseAllowed);
|
||||||
|
HRESULT ReadItem(unsigned volIndex, int fsIndex, const CLongAllocDesc &lad, int numRecurseAllowed);
|
||||||
|
|
||||||
|
HRESULT Open2();
|
||||||
|
HRESULT FillRefs(CFileSet &fs, unsigned fileIndex, int parent, int numRecurseAllowed);
|
||||||
|
|
||||||
|
UInt64 _processedProgressBytes;
|
||||||
|
|
||||||
|
UInt64 _fileNameLengthTotal;
|
||||||
|
unsigned _numRefs;
|
||||||
|
UInt32 _numExtents;
|
||||||
|
UInt64 _inlineExtentsSize;
|
||||||
|
bool CheckExtent(unsigned volIndex, unsigned partitionRef, UInt32 blockPos, UInt32 len) const;
|
||||||
|
|
||||||
void UpdatePhySize(UInt64 val)
|
void UpdatePhySize(UInt64 val)
|
||||||
{
|
{
|
||||||
if (PhySize < val)
|
if (PhySize < val)
|
||||||
PhySize = val;
|
PhySize = val;
|
||||||
}
|
}
|
||||||
HRESULT Open(IInStream *inStream, CProgressVirt *progress);
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
UString GetComment() const;
|
void UpdatePhySize(const CExtent &e)
|
||||||
UString GetItemPath(int volIndex, int fsIndex, int refIndex,
|
{
|
||||||
bool showVolName, bool showFsName) const;
|
UpdatePhySize(((UInt64)e.Pos << SecLogSize) + e.Len);
|
||||||
|
}
|
||||||
bool CheckItemExtents(int volIndex, const CItem &item) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
API_FUNC_IsArc IsArc_Udf(const Byte *p, size_t size);
|
API_FUNC_IsArc IsArc_Udf(const Byte *p, size_t size);
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,20 @@ LOCAL_FLAGS_ST =
|
||||||
MT_OBJS =
|
MT_OBJS =
|
||||||
|
|
||||||
|
|
||||||
|
ifdef SystemDrive
|
||||||
|
IS_MINGW = 1
|
||||||
|
else
|
||||||
|
ifdef SYSTEMDRIVE
|
||||||
|
# ifdef OS
|
||||||
|
IS_MINGW = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef ST_MODE
|
ifdef ST_MODE
|
||||||
|
|
||||||
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef IS_MINGW
|
||||||
MT_OBJS = \
|
MT_OBJS = \
|
||||||
$O/Threads.o \
|
$O/Threads.o \
|
||||||
|
|
||||||
|
|
@ -41,7 +50,7 @@ endif
|
||||||
|
|
||||||
LOCAL_FLAGS_SYS =
|
LOCAL_FLAGS_SYS =
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef IS_MINGW
|
||||||
|
|
||||||
LOCAL_FLAGS_SYS = \
|
LOCAL_FLAGS_SYS = \
|
||||||
-D_7ZIP_LARGE_PAGES \
|
-D_7ZIP_LARGE_PAGES \
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,15 @@ CONSOLE_VARIANT_FLAGS=-DPROG_VARIANT_Z
|
||||||
include ../Format7zF/Arc_gcc.mak
|
include ../Format7zF/Arc_gcc.mak
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef SystemDrive
|
||||||
|
IS_MINGW = 1
|
||||||
|
else
|
||||||
|
ifdef SYSTEMDRIVE
|
||||||
|
# ifdef OS
|
||||||
|
IS_MINGW = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef IS_MINGW
|
||||||
|
|
||||||
LOCAL_FLAGS_SYS = \
|
LOCAL_FLAGS_SYS = \
|
||||||
-D_7ZIP_LARGE_PAGES \
|
-D_7ZIP_LARGE_PAGES \
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,15 @@ CONSOLE_VARIANT_FLAGS=-DPROG_VARIANT_R
|
||||||
# USE_ASM = 1
|
# USE_ASM = 1
|
||||||
# ST_MODE = 1
|
# ST_MODE = 1
|
||||||
|
|
||||||
|
ifdef SystemDrive
|
||||||
|
IS_MINGW = 1
|
||||||
|
else
|
||||||
|
ifdef SYSTEMDRIVE
|
||||||
|
# ifdef OS
|
||||||
|
IS_MINGW = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
include ../../LzmaDec_gcc.mak
|
include ../../LzmaDec_gcc.mak
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -17,7 +26,7 @@ ifdef ST_MODE
|
||||||
|
|
||||||
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef IS_MINGW
|
||||||
MT_OBJS = \
|
MT_OBJS = \
|
||||||
$O/Threads.o \
|
$O/Threads.o \
|
||||||
|
|
||||||
|
|
@ -41,7 +50,7 @@ endif
|
||||||
|
|
||||||
LOCAL_FLAGS_SYS =
|
LOCAL_FLAGS_SYS =
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef IS_MINGW
|
||||||
|
|
||||||
LOCAL_FLAGS_SYS = \
|
LOCAL_FLAGS_SYS = \
|
||||||
-D_7ZIP_LARGE_PAGES \
|
-D_7ZIP_LARGE_PAGES \
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,20 @@ include ../../LzmaDec_gcc.mak
|
||||||
LOCAL_FLAGS_ST =
|
LOCAL_FLAGS_ST =
|
||||||
MT_OBJS =
|
MT_OBJS =
|
||||||
|
|
||||||
|
ifdef SystemDrive
|
||||||
|
IS_MINGW = 1
|
||||||
|
else
|
||||||
|
ifdef SYSTEMDRIVE
|
||||||
|
# ifdef OS
|
||||||
|
IS_MINGW = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef ST_MODE
|
ifdef ST_MODE
|
||||||
|
|
||||||
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef IS_MINGW
|
||||||
MT_OBJS = \
|
MT_OBJS = \
|
||||||
$O/Threads.o \
|
$O/Threads.o \
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2847,6 +2847,10 @@ SOURCE=..\..\Archive\HfsHandler.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\Archive\HfsHandler.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\Archive\IArchive.h
|
SOURCE=..\..\Archive\IArchive.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,16 @@ DEF_FILE = ../../Archive/Archive2.def
|
||||||
include Arc_gcc.mak
|
include Arc_gcc.mak
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef SystemDrive
|
||||||
|
IS_MINGW = 1
|
||||||
|
else
|
||||||
|
ifdef SYSTEMDRIVE
|
||||||
|
# ifdef OS
|
||||||
|
IS_MINGW = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifdef IS_MINGW
|
||||||
|
|
||||||
LOCAL_FLAGS_WIN = \
|
LOCAL_FLAGS_WIN = \
|
||||||
-D_7ZIP_LARGE_PAGES \
|
-D_7ZIP_LARGE_PAGES \
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,15 @@ LOCAL_FLAGS_ST =
|
||||||
MT_OBJS =
|
MT_OBJS =
|
||||||
|
|
||||||
|
|
||||||
|
ifdef SystemDrive
|
||||||
|
IS_MINGW = 1
|
||||||
|
else
|
||||||
|
ifdef SYSTEMDRIVE
|
||||||
|
# ifdef OS
|
||||||
|
IS_MINGW = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef ST_MODE
|
ifdef ST_MODE
|
||||||
|
|
||||||
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
||||||
|
|
@ -30,7 +39,7 @@ endif
|
||||||
|
|
||||||
LOCAL_FLAGS_SYS =
|
LOCAL_FLAGS_SYS =
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef IS_MINGW
|
||||||
|
|
||||||
SYS_OBJS = \
|
SYS_OBJS = \
|
||||||
$O/Registry.o \
|
$O/Registry.o \
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,20 @@ LOCAL_FLAGS_ST =
|
||||||
MT_OBJS =
|
MT_OBJS =
|
||||||
|
|
||||||
|
|
||||||
|
ifdef SystemDrive
|
||||||
|
IS_MINGW = 1
|
||||||
|
else
|
||||||
|
ifdef SYSTEMDRIVE
|
||||||
|
# ifdef OS
|
||||||
|
IS_MINGW = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef ST_MODE
|
ifdef ST_MODE
|
||||||
|
|
||||||
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef IS_MINGW
|
||||||
MT_OBJS = \
|
MT_OBJS = \
|
||||||
$O/Threads.o \
|
$O/Threads.o \
|
||||||
|
|
||||||
|
|
@ -35,7 +44,7 @@ endif
|
||||||
|
|
||||||
LOCAL_FLAGS_SYS =
|
LOCAL_FLAGS_SYS =
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef IS_MINGW
|
||||||
|
|
||||||
LOCAL_FLAGS_SYS = \
|
LOCAL_FLAGS_SYS = \
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,12 @@
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
// for major minor
|
// for major()/minor():
|
||||||
// BSD: <sys/types.h>
|
#if defined(__FreeBSD__) || defined(BSD)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#else
|
||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,11 +89,8 @@ HRESULT CDecoder::DecodeUncompressed(UInt32 unpackSize)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HRESULT CDecoder::DecodeLzvn(UInt32 unpackSize)
|
HRESULT CDecoder::DecodeLzvn(UInt32 unpackSize, UInt32 packSize)
|
||||||
{
|
{
|
||||||
UInt32 packSize;
|
|
||||||
RINOK(GetUInt32(packSize));
|
|
||||||
|
|
||||||
PRF(printf("\nLZVN %7u %7u", unpackSize, packSize));
|
PRF(printf("\nLZVN %7u %7u", unpackSize, packSize));
|
||||||
|
|
||||||
UInt32 D = 0;
|
UInt32 D = 0;
|
||||||
|
|
@ -854,6 +851,16 @@ STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStr
|
||||||
UInt64 prevOut = 0;
|
UInt64 prevOut = 0;
|
||||||
UInt64 prevIn = 0;
|
UInt64 prevIn = 0;
|
||||||
|
|
||||||
|
if (LzvnMode)
|
||||||
|
{
|
||||||
|
const UInt64 unpackSize = *outSize;
|
||||||
|
const UInt64 packSize = *inSize;
|
||||||
|
if (unpackSize > (UInt32)(Int32)-1
|
||||||
|
|| packSize > (UInt32)(Int32)-1)
|
||||||
|
return S_FALSE;
|
||||||
|
RINOK(DecodeLzvn((UInt32)unpackSize, (UInt32)packSize));
|
||||||
|
}
|
||||||
|
else
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const UInt64 pos = m_OutWindowStream.GetProcessedSize();
|
const UInt64 pos = m_OutWindowStream.GetProcessedSize();
|
||||||
|
|
@ -889,7 +896,12 @@ STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStr
|
||||||
if (v == kSignature_LZFSE_V1 || v == kSignature_LZFSE_V2)
|
if (v == kSignature_LZFSE_V1 || v == kSignature_LZFSE_V2)
|
||||||
res = DecodeLzfse(cur, (Byte)v);
|
res = DecodeLzfse(cur, (Byte)v);
|
||||||
else if (v == 0x6E) // 'n'
|
else if (v == 0x6E) // 'n'
|
||||||
res = DecodeLzvn(cur);
|
{
|
||||||
|
UInt32 packSize;
|
||||||
|
res = GetUInt32(packSize);
|
||||||
|
if (res == S_OK)
|
||||||
|
res = DecodeLzvn(cur, packSize);
|
||||||
|
}
|
||||||
else if (v == 0x2D) // '-'
|
else if (v == 0x2D) // '-'
|
||||||
res = DecodeUncompressed(cur);
|
res = DecodeUncompressed(cur);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -41,14 +41,23 @@ class CDecoder:
|
||||||
HRESULT GetUInt32(UInt32 &val);
|
HRESULT GetUInt32(UInt32 &val);
|
||||||
|
|
||||||
HRESULT DecodeUncompressed(UInt32 unpackSize);
|
HRESULT DecodeUncompressed(UInt32 unpackSize);
|
||||||
HRESULT DecodeLzvn(UInt32 unpackSize);
|
HRESULT DecodeLzvn(UInt32 unpackSize, UInt32 packSize);
|
||||||
HRESULT DecodeLzfse(UInt32 unpackSize, Byte version);
|
HRESULT DecodeLzfse(UInt32 unpackSize, Byte version);
|
||||||
|
|
||||||
STDMETHOD(CodeReal)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
|
STDMETHOD(CodeReal)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
|
||||||
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
|
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
|
||||||
public:
|
public:
|
||||||
|
bool LzvnMode;
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
|
|
||||||
|
CDecoder():
|
||||||
|
LzvnMode(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// sizes are checked in Code()
|
||||||
|
// UInt64 GetInputProcessedSize() const { return m_InStream.GetProcessedSize(); }
|
||||||
|
// UInt64 GetOutputProcessedSize() const { return m_OutWindowStream.GetProcessedSize(); }
|
||||||
|
|
||||||
STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, const UInt64 *inSize,
|
STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, const UInt64 *inSize,
|
||||||
const UInt64 *outSize, ICompressProgressInfo *progress);
|
const UInt64 *outSize, ICompressProgressInfo *progress);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,16 @@ IS_NOT_STANDALONE = 1
|
||||||
|
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef SystemDrive
|
||||||
|
IS_MINGW = 1
|
||||||
|
else
|
||||||
|
ifdef SYSTEMDRIVE
|
||||||
|
# ifdef OS
|
||||||
|
IS_MINGW = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifdef IS_MINGW
|
||||||
|
|
||||||
SYS_OBJS = \
|
SYS_OBJS = \
|
||||||
$O/resource.o \
|
$O/resource.o \
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ CDirItems::CDirItems():
|
||||||
, ReadSecure(false)
|
, ReadSecure(false)
|
||||||
#endif
|
#endif
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
, StoreOwnerName(true)
|
, StoreOwnerName(false)
|
||||||
#endif
|
#endif
|
||||||
, Callback(NULL)
|
, Callback(NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -1361,6 +1361,7 @@ HRESULT CDirItems::FillDeviceSizes()
|
||||||
// 200K/sec speed
|
// 200K/sec speed
|
||||||
u.Empty();
|
u.Empty();
|
||||||
const passwd *pw = getpwuid(OwnerNameMap.Numbers[i]);
|
const passwd *pw = getpwuid(OwnerNameMap.Numbers[i]);
|
||||||
|
// printf("\ngetpwuid=%s\n", pw->pw_name);
|
||||||
if (pw)
|
if (pw)
|
||||||
{
|
{
|
||||||
a = pw->pw_name;
|
a = pw->pw_name;
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,15 @@
|
||||||
// #include <grp.h>
|
// #include <grp.h>
|
||||||
// #include <pwd.h>
|
// #include <pwd.h>
|
||||||
|
|
||||||
// for major minor:
|
// for major()/minor():
|
||||||
// BSD: <sys/types.h>
|
#if defined(__FreeBSD__) || defined(BSD)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#else
|
||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _7ZIP_ST
|
#ifndef _7ZIP_ST
|
||||||
#include "../../../Windows/Synchronization.h"
|
#include "../../../Windows/Synchronization.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -345,6 +345,10 @@ SOURCE=..\..\..\Windows\Registry.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\Windows\SecurityUtils.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\Windows\Synchronization.h
|
SOURCE=..\..\..\Windows\Synchronization.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,20 @@ IS_NOT_STANDALONE = 1
|
||||||
LOCAL_FLAGS_ST =
|
LOCAL_FLAGS_ST =
|
||||||
MT_OBJS =
|
MT_OBJS =
|
||||||
|
|
||||||
|
ifdef SystemDrive
|
||||||
|
IS_MINGW = 1
|
||||||
|
else
|
||||||
|
ifdef SYSTEMDRIVE
|
||||||
|
# ifdef OS
|
||||||
|
IS_MINGW = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef ST_MODE
|
ifdef ST_MODE
|
||||||
|
|
||||||
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
LOCAL_FLAGS_ST = -D_7ZIP_ST
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef IS_MINGW
|
||||||
MT_OBJS = \
|
MT_OBJS = \
|
||||||
$O/Threads.o \
|
$O/Threads.o \
|
||||||
|
|
||||||
|
|
@ -31,7 +40,7 @@ endif
|
||||||
|
|
||||||
LOCAL_FLAGS_WIN=
|
LOCAL_FLAGS_WIN=
|
||||||
|
|
||||||
ifdef SystemDrive
|
ifdef IS_MINGW
|
||||||
|
|
||||||
LOCAL_FLAGS_WIN = \
|
LOCAL_FLAGS_WIN = \
|
||||||
-D_7ZIP_LARGE_PAGES \
|
-D_7ZIP_LARGE_PAGES \
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,4 @@ MY_VERSION_INFO_DLL("7-Zip Shell Extension", "7-zip")
|
||||||
1 24 MOVEABLE PURE "7-zip.dll.manifest"
|
1 24 MOVEABLE PURE "7-zip.dll.manifest"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IDI_ICON ICON "..\FileManager\FM.ico"
|
IDI_ICON ICON "../FileManager/FM.ico"
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,13 @@
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#include <winternl.h>
|
#include <winternl.h>
|
||||||
#else
|
#else
|
||||||
// mingw
|
#if defined(__GNUC__) && (__GNUC__ >= 10)
|
||||||
#include <ddk/winddk.h>
|
// new mingw:
|
||||||
|
#include <winternl.h>
|
||||||
|
#else
|
||||||
|
// old mingw:
|
||||||
|
#include <ddk/winddk.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../../../Common/ComTry.h"
|
#include "../../../Common/ComTry.h"
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,9 @@ using namespace NFind;
|
||||||
extern bool g_IsNT;
|
extern bool g_IsNT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MY_CAST_FUNC (void(*)())
|
||||||
|
// #define MY_CAST_FUNC
|
||||||
|
|
||||||
namespace NFsFolder {
|
namespace NFsFolder {
|
||||||
|
|
||||||
HRESULT CCopyStateIO::MyCopyFile(CFSTR inPath, CFSTR outPath, DWORD attrib)
|
HRESULT CCopyStateIO::MyCopyFile(CFSTR inPath, CFSTR outPath, DWORD attrib)
|
||||||
|
|
@ -245,7 +248,9 @@ void CCopyState::Prepare()
|
||||||
my_CopyFileExA = NULL;
|
my_CopyFileExA = NULL;
|
||||||
if (!g_IsNT)
|
if (!g_IsNT)
|
||||||
{
|
{
|
||||||
my_CopyFileExA = (Func_CopyFileExA)::GetProcAddress(::GetModuleHandleA("kernel32.dll"), "CopyFileExA");
|
my_CopyFileExA = (Func_CopyFileExA)
|
||||||
|
MY_CAST_FUNC
|
||||||
|
::GetProcAddress(::GetModuleHandleA("kernel32.dll"), "CopyFileExA");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,9 @@
|
||||||
|
|
||||||
#define MY_ADDREF_RELEASE_MT \
|
#define MY_ADDREF_RELEASE_MT \
|
||||||
STDMETHOD_(ULONG, AddRef)() { InterlockedIncrement((LONG *)&__m_RefCount); return __m_RefCount; } \
|
STDMETHOD_(ULONG, AddRef)() { InterlockedIncrement((LONG *)&__m_RefCount); return __m_RefCount; } \
|
||||||
STDMETHOD_(ULONG, Release)() { InterlockedDecrement((LONG *)&__m_RefCount); if (__m_RefCount != 0) \
|
STDMETHOD_(ULONG, Release)() { InterlockedDecrement((LONG *)&__m_RefCount); \
|
||||||
return __m_RefCount; delete this; return 0; }
|
if (__m_RefCount != 0) return __m_RefCount; \
|
||||||
|
delete this; return 0; }
|
||||||
|
|
||||||
#define MY_UNKNOWN_IMP_SPEC_MT2(i1, i) \
|
#define MY_UNKNOWN_IMP_SPEC_MT2(i1, i) \
|
||||||
MY_QUERYINTERFACE_BEGIN \
|
MY_QUERYINTERFACE_BEGIN \
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,9 @@ using namespace NWindows;
|
||||||
using namespace NFile;
|
using namespace NFile;
|
||||||
using namespace NName;
|
using namespace NName;
|
||||||
|
|
||||||
|
#define MY_CAST_FUNC (void(*)())
|
||||||
|
// #define MY_CAST_FUNC
|
||||||
|
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
extern bool g_IsNT;
|
extern bool g_IsNT;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -96,7 +99,7 @@ HRESULT CThreadFolderOperations::DoOperation(CPanel &panel, const UString &progr
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
typedef int (WINAPI * SHFileOperationWP)(LPSHFILEOPSTRUCTW lpFileOp);
|
typedef int (WINAPI * Func_SHFileOperationW)(LPSHFILEOPSTRUCTW lpFileOp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -192,9 +195,10 @@ void CPanel::DeleteItems(bool NON_CE_VAR(toRecycleBin))
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
/* res = */ ::SHFileOperationW(&fo);
|
/* res = */ ::SHFileOperationW(&fo);
|
||||||
#else
|
#else
|
||||||
SHFileOperationWP shFileOperationW = (SHFileOperationWP)
|
Func_SHFileOperationW shFileOperationW = (Func_SHFileOperationW)
|
||||||
|
MY_CAST_FUNC
|
||||||
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHFileOperationW");
|
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHFileOperationW");
|
||||||
if (shFileOperationW == 0)
|
if (!shFileOperationW)
|
||||||
return;
|
return;
|
||||||
/* res = */ shFileOperationW(&fo);
|
/* res = */ shFileOperationW(&fo);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@
|
||||||
|
|
||||||
#include <ShlObj.h>
|
#include <ShlObj.h>
|
||||||
|
|
||||||
|
#define MY_CAST_FUNC (void(*)())
|
||||||
|
// #define MY_CAST_FUNC
|
||||||
|
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
extern bool g_IsNT;
|
extern bool g_IsNT;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -39,14 +42,15 @@ int GetIconIndexForCSIDL(int csidl)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
typedef int (WINAPI * SHGetFileInfoWP)(LPCWSTR pszPath, DWORD attrib, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
|
typedef int (WINAPI * Func_SHGetFileInfoW)(LPCWSTR pszPath, DWORD attrib, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
|
||||||
|
|
||||||
static struct CSHGetFileInfoInit
|
static struct CSHGetFileInfoInit
|
||||||
{
|
{
|
||||||
SHGetFileInfoWP shGetFileInfoW;
|
Func_SHGetFileInfoW shGetFileInfoW;
|
||||||
CSHGetFileInfoInit()
|
CSHGetFileInfoInit()
|
||||||
{
|
{
|
||||||
shGetFileInfoW = (SHGetFileInfoWP)
|
shGetFileInfoW = (Func_SHGetFileInfoW)
|
||||||
|
MY_CAST_FUNC
|
||||||
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetFileInfoW");
|
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetFileInfoW");
|
||||||
}
|
}
|
||||||
} g_SHGetFileInfoInit;
|
} g_SHGetFileInfoInit;
|
||||||
|
|
|
||||||
|
|
@ -104,13 +104,16 @@ void CPairsStorage::Sort() { Pairs.Sort(ComparePairItems, 0); }
|
||||||
|
|
||||||
int CPairsStorage::FindID(const UString &id, int &insertPos) const
|
int CPairsStorage::FindID(const UString &id, int &insertPos) const
|
||||||
{
|
{
|
||||||
int left = 0, right = Pairs.Size();
|
unsigned left = 0, right = Pairs.Size();
|
||||||
while (left != right)
|
while (left != right)
|
||||||
{
|
{
|
||||||
int mid = (left + right) / 2;
|
const unsigned mid = (left + right) / 2;
|
||||||
int compResult = ComparePairIDs(id, Pairs[mid].ID);
|
const int compResult = ComparePairIDs(id, Pairs[mid].ID);
|
||||||
if (compResult == 0)
|
if (compResult == 0)
|
||||||
|
{
|
||||||
|
insertPos = mid; // to disable GCC warning
|
||||||
return mid;
|
return mid;
|
||||||
|
}
|
||||||
if (compResult < 0)
|
if (compResult < 0)
|
||||||
right = mid;
|
right = mid;
|
||||||
else
|
else
|
||||||
|
|
@ -129,7 +132,7 @@ int CPairsStorage::FindID(const UString &id) const
|
||||||
void CPairsStorage::AddPair(const CTextPair &pair)
|
void CPairsStorage::AddPair(const CTextPair &pair)
|
||||||
{
|
{
|
||||||
int insertPos;
|
int insertPos;
|
||||||
int pos = FindID(pair.ID, insertPos);
|
const int pos = FindID(pair.ID, insertPos);
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
Pairs[pos] = pair;
|
Pairs[pos] = pair;
|
||||||
else
|
else
|
||||||
|
|
@ -138,7 +141,7 @@ void CPairsStorage::AddPair(const CTextPair &pair)
|
||||||
|
|
||||||
void CPairsStorage::DeletePair(const UString &id)
|
void CPairsStorage::DeletePair(const UString &id)
|
||||||
{
|
{
|
||||||
int pos = FindID(id);
|
const int pos = FindID(id);
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
Pairs.Delete(pos);
|
Pairs.Delete(pos);
|
||||||
}
|
}
|
||||||
|
|
@ -146,7 +149,7 @@ void CPairsStorage::DeletePair(const UString &id)
|
||||||
bool CPairsStorage::GetValue(const UString &id, UString &value) const
|
bool CPairsStorage::GetValue(const UString &id, UString &value) const
|
||||||
{
|
{
|
||||||
value.Empty();
|
value.Empty();
|
||||||
int pos = FindID(id);
|
const int pos = FindID(id);
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
return false;
|
return false;
|
||||||
value = Pairs[pos].Value;
|
value = Pairs[pos].Value;
|
||||||
|
|
@ -155,7 +158,7 @@ bool CPairsStorage::GetValue(const UString &id, UString &value) const
|
||||||
|
|
||||||
UString CPairsStorage::GetValue(const UString &id) const
|
UString CPairsStorage::GetValue(const UString &id) const
|
||||||
{
|
{
|
||||||
int pos = FindID(id);
|
const int pos = FindID(id);
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
return UString();
|
return UString();
|
||||||
return Pairs[pos].Value;
|
return Pairs[pos].Value;
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,7 @@ static const CFormatInfo g_Formats[] =
|
||||||
"Tar",
|
"Tar",
|
||||||
(1 << 0),
|
(1 << 0),
|
||||||
METHODS_PAIR(g_TarMethods),
|
METHODS_PAIR(g_TarMethods),
|
||||||
|
0
|
||||||
// kFF_Time_Unix | kFF_Time_Win // | kFF_Time_1ns
|
// kFF_Time_Unix | kFF_Time_Win // | kFF_Time_1ns
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -596,7 +597,6 @@ void CCompressDialog::EnableMultiCombo(unsigned id)
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT ComboBox_AddStringAscii(NControl::CComboBox &cb, const char *s);
|
static LRESULT ComboBox_AddStringAscii(NControl::CComboBox &cb, const char *s);
|
||||||
static void FormatOptions_To_String(const NCompression::CFormatOptions &fo, AString &s);
|
|
||||||
|
|
||||||
static void Combine_Two_BoolPairs(const CBoolPair &b1, const CBoolPair &b2, CBool1 &res)
|
static void Combine_Two_BoolPairs(const CBoolPair &b1, const CBoolPair &b2, CBool1 &res)
|
||||||
{
|
{
|
||||||
|
|
@ -607,7 +607,7 @@ static void Combine_Two_BoolPairs(const CBoolPair &b1, const CBoolPair &b2, CBoo
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SET_GUI_BOOL(name) \
|
#define SET_GUI_BOOL(name) \
|
||||||
Combine_Two_BoolPairs(Info. ## name, m_RegistryInfo. ## name, name)
|
Combine_Two_BoolPairs(Info. name, m_RegistryInfo. name, name)
|
||||||
|
|
||||||
|
|
||||||
static void Set_Final_BoolPairs(
|
static void Set_Final_BoolPairs(
|
||||||
|
|
@ -630,7 +630,7 @@ static void Set_Final_BoolPairs(
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SET_FINAL_BOOL_PAIRS(name) \
|
#define SET_FINAL_BOOL_PAIRS(name) \
|
||||||
Set_Final_BoolPairs(name, Info. ## name, m_RegistryInfo. ## name)
|
Set_Final_BoolPairs(name, Info. name, m_RegistryInfo. name)
|
||||||
|
|
||||||
void CCompressDialog::FormatChanged(bool isChanged)
|
void CCompressDialog::FormatChanged(bool isChanged)
|
||||||
{
|
{
|
||||||
|
|
@ -2711,7 +2711,7 @@ void CCompressDialog::ShowOptionsString()
|
||||||
NCompression::CFormatOptions &fo = Get_FormatOptions();
|
NCompression::CFormatOptions &fo = Get_FormatOptions();
|
||||||
|
|
||||||
AString s;
|
AString s;
|
||||||
if (fo.TimePrec != -1)
|
if (fo.IsSet_TimePrec())
|
||||||
{
|
{
|
||||||
s.Add_OptSpaced("tp");
|
s.Add_OptSpaced("tp");
|
||||||
s.Add_UInt32(fo.TimePrec);
|
s.Add_UInt32(fo.TimePrec);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ typedef BOOL (WINAPI * Func_LookupPrivilegeValue)(LPCTSTR lpSystemName, LPCTSTR
|
||||||
typedef BOOL (WINAPI * Func_AdjustTokenPrivileges)(HANDLE TokenHandle, BOOL DisableAllPrivileges,
|
typedef BOOL (WINAPI * Func_AdjustTokenPrivileges)(HANDLE TokenHandle, BOOL DisableAllPrivileges,
|
||||||
PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength);
|
PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength);
|
||||||
}
|
}
|
||||||
#define GET_PROC_ADDR(fff, name) Func_ ## fff my_ ## fff = (Func_ ## fff)GetProcAddress(hModule, name)
|
#define GET_PROC_ADDR(fff, name) Func_ ## fff my_ ## fff = (Func_ ## fff) (void(*)()) GetProcAddress(hModule, name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool EnablePrivilege(LPCTSTR privilegeName, bool enable)
|
bool EnablePrivilege(LPCTSTR privilegeName, bool enable)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include "SecurityUtils.h"
|
#include "SecurityUtils.h"
|
||||||
|
|
||||||
|
#define MY_CAST_FUNC (void(*)())
|
||||||
|
// #define MY_CAST_FUNC
|
||||||
|
|
||||||
namespace NWindows {
|
namespace NWindows {
|
||||||
namespace NSecurity {
|
namespace NSecurity {
|
||||||
|
|
||||||
|
|
@ -50,8 +53,10 @@ static void MyLookupSids(CPolicy &policy, PSID ps)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
typedef BOOL (WINAPI * LookupAccountNameWP)(
|
typedef BOOL (WINAPI * Func_LookupAccountNameW)(
|
||||||
LPCWSTR lpSystemName,
|
LPCWSTR lpSystemName,
|
||||||
LPCWSTR lpAccountName,
|
LPCWSTR lpAccountName,
|
||||||
PSID Sid,
|
PSID Sid,
|
||||||
|
|
@ -62,13 +67,17 @@ typedef BOOL (WINAPI * LookupAccountNameWP)(
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static PSID GetSid(LPWSTR accountName)
|
static PSID GetSid(LPWSTR accountName)
|
||||||
{
|
{
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
HMODULE hModule = GetModuleHandle(TEXT("Advapi32.dll"));
|
HMODULE hModule = GetModuleHandle(TEXT("Advapi32.dll"));
|
||||||
if (hModule == NULL)
|
if (hModule == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
LookupAccountNameWP lookupAccountNameW = (LookupAccountNameWP)GetProcAddress(hModule, "LookupAccountNameW");
|
Func_LookupAccountNameW lookupAccountNameW = (Func_LookupAccountNameW)
|
||||||
|
MY_CAST_FUNC
|
||||||
|
GetProcAddress(hModule, "LookupAccountNameW");
|
||||||
if (lookupAccountNameW == NULL)
|
if (lookupAccountNameW == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,31 @@
|
||||||
|
|
||||||
#include "Defs.h"
|
#include "Defs.h"
|
||||||
|
|
||||||
|
#ifndef _UNICODE
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
typedef NTSTATUS (NTAPI *Func_LsaOpenPolicy)(PLSA_UNICODE_STRING SystemName,
|
||||||
|
PLSA_OBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK DesiredAccess, PLSA_HANDLE PolicyHandle);
|
||||||
|
typedef NTSTATUS (NTAPI *Func_LsaClose)(LSA_HANDLE ObjectHandle);
|
||||||
|
typedef NTSTATUS (NTAPI *Func_LsaAddAccountRights)(LSA_HANDLE PolicyHandle,
|
||||||
|
PSID AccountSid, PLSA_UNICODE_STRING UserRights, ULONG CountOfRights );
|
||||||
|
#define MY_STATUS_NOT_IMPLEMENTED ((NTSTATUS)0xC0000002L)
|
||||||
|
}
|
||||||
|
|
||||||
|
#define POLICY_FUNC_CALL(fff, str) \
|
||||||
|
if (hModule == NULL) return MY_STATUS_NOT_IMPLEMENTED; \
|
||||||
|
Func_ ## fff v = (Func_ ## fff) (void(*)()) GetProcAddress(hModule, str); \
|
||||||
|
if (!v) return MY_STATUS_NOT_IMPLEMENTED; \
|
||||||
|
const NTSTATUS res = v
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define POLICY_FUNC_CALL(fff, str) \
|
||||||
|
const NTSTATUS res = ::fff
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace NWindows {
|
namespace NWindows {
|
||||||
namespace NSecurity {
|
namespace NSecurity {
|
||||||
|
|
||||||
|
|
@ -53,14 +78,8 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef _UNICODE
|
|
||||||
typedef NTSTATUS (NTAPI *LsaOpenPolicyP)(PLSA_UNICODE_STRING SystemName,
|
|
||||||
PLSA_OBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK DesiredAccess, PLSA_HANDLE PolicyHandle);
|
|
||||||
typedef NTSTATUS (NTAPI *LsaCloseP)(LSA_HANDLE ObjectHandle);
|
|
||||||
typedef NTSTATUS (NTAPI *LsaAddAccountRightsP)(LSA_HANDLE PolicyHandle,
|
|
||||||
PSID AccountSid, PLSA_UNICODE_STRING UserRights, ULONG CountOfRights );
|
|
||||||
#define MY_STATUS_NOT_IMPLEMENTED ((NTSTATUS)0xC0000002L)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct CPolicy
|
struct CPolicy
|
||||||
{
|
{
|
||||||
|
|
@ -82,43 +101,17 @@ public:
|
||||||
NTSTATUS Open(PLSA_UNICODE_STRING systemName, PLSA_OBJECT_ATTRIBUTES objectAttributes,
|
NTSTATUS Open(PLSA_UNICODE_STRING systemName, PLSA_OBJECT_ATTRIBUTES objectAttributes,
|
||||||
ACCESS_MASK desiredAccess)
|
ACCESS_MASK desiredAccess)
|
||||||
{
|
{
|
||||||
#ifndef _UNICODE
|
|
||||||
if (hModule == NULL)
|
|
||||||
return MY_STATUS_NOT_IMPLEMENTED;
|
|
||||||
LsaOpenPolicyP lsaOpenPolicy = (LsaOpenPolicyP)GetProcAddress(hModule, "LsaOpenPolicy");
|
|
||||||
if (lsaOpenPolicy == NULL)
|
|
||||||
return MY_STATUS_NOT_IMPLEMENTED;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
return
|
POLICY_FUNC_CALL (LsaOpenPolicy, "LsaOpenPolicy")
|
||||||
#ifdef _UNICODE
|
|
||||||
::LsaOpenPolicy
|
|
||||||
#else
|
|
||||||
lsaOpenPolicy
|
|
||||||
#endif
|
|
||||||
(systemName, objectAttributes, desiredAccess, &_handle);
|
(systemName, objectAttributes, desiredAccess, &_handle);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS Close()
|
NTSTATUS Close()
|
||||||
{
|
{
|
||||||
if (_handle == NULL)
|
if (_handle == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
POLICY_FUNC_CALL (LsaClose, "LsaClose")
|
||||||
#ifndef _UNICODE
|
|
||||||
if (hModule == NULL)
|
|
||||||
return MY_STATUS_NOT_IMPLEMENTED;
|
|
||||||
LsaCloseP lsaClose = (LsaCloseP)GetProcAddress(hModule, "LsaClose");
|
|
||||||
if (lsaClose == NULL)
|
|
||||||
return MY_STATUS_NOT_IMPLEMENTED;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NTSTATUS res =
|
|
||||||
#ifdef _UNICODE
|
|
||||||
::LsaClose
|
|
||||||
#else
|
|
||||||
lsaClose
|
|
||||||
#endif
|
|
||||||
(_handle);
|
(_handle);
|
||||||
_handle = NULL;
|
_handle = NULL;
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -137,21 +130,9 @@ public:
|
||||||
|
|
||||||
NTSTATUS AddAccountRights(PSID accountSid, PLSA_UNICODE_STRING userRights, ULONG countOfRights)
|
NTSTATUS AddAccountRights(PSID accountSid, PLSA_UNICODE_STRING userRights, ULONG countOfRights)
|
||||||
{
|
{
|
||||||
#ifndef _UNICODE
|
POLICY_FUNC_CALL (LsaAddAccountRights, "LsaAddAccountRights")
|
||||||
if (hModule == NULL)
|
|
||||||
return MY_STATUS_NOT_IMPLEMENTED;
|
|
||||||
LsaAddAccountRightsP lsaAddAccountRights = (LsaAddAccountRightsP)GetProcAddress(hModule, "LsaAddAccountRights");
|
|
||||||
if (lsaAddAccountRights == NULL)
|
|
||||||
return MY_STATUS_NOT_IMPLEMENTED;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return
|
|
||||||
#ifdef _UNICODE
|
|
||||||
::LsaAddAccountRights
|
|
||||||
#else
|
|
||||||
lsaAddAccountRights
|
|
||||||
#endif
|
|
||||||
(_handle, accountSid, userRights, countOfRights);
|
(_handle, accountSid, userRights, countOfRights);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
NTSTATUS AddAccountRights(PSID accountSid, PLSA_UNICODE_STRING userRights)
|
NTSTATUS AddAccountRights(PSID accountSid, PLSA_UNICODE_STRING userRights)
|
||||||
{ return AddAccountRights(accountSid, userRights, 1); }
|
{ return AddAccountRights(accountSid, userRights, 1); }
|
||||||
|
|
|
||||||
|
|
@ -258,14 +258,21 @@ bool BrowseForFolder(HWND owner, LPCTSTR title,
|
||||||
|
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
|
|
||||||
typedef BOOL (WINAPI * SHGetPathFromIDListWP)(LPCITEMIDLIST pidl, LPWSTR pszPath);
|
extern "C" {
|
||||||
|
typedef BOOL (WINAPI * Func_SHGetPathFromIDListW)(LPCITEMIDLIST pidl, LPWSTR pszPath);
|
||||||
|
typedef LPITEMIDLIST (WINAPI * Func_SHBrowseForFolderW)(LPBROWSEINFOW lpbi);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define MY_CAST_FUNC (void(*)())
|
||||||
|
// #define MY_CAST_FUNC
|
||||||
|
|
||||||
bool GetPathFromIDList(LPCITEMIDLIST itemIDList, UString &path)
|
bool GetPathFromIDList(LPCITEMIDLIST itemIDList, UString &path)
|
||||||
{
|
{
|
||||||
path.Empty();
|
path.Empty();
|
||||||
SHGetPathFromIDListWP shGetPathFromIDListW = (SHGetPathFromIDListWP)
|
Func_SHGetPathFromIDListW shGetPathFromIDListW = (Func_SHGetPathFromIDListW)
|
||||||
|
MY_CAST_FUNC
|
||||||
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetPathFromIDListW");
|
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetPathFromIDListW");
|
||||||
if (shGetPathFromIDListW == 0)
|
if (!shGetPathFromIDListW)
|
||||||
return false;
|
return false;
|
||||||
const unsigned len = MAX_PATH * 2;
|
const unsigned len = MAX_PATH * 2;
|
||||||
bool result = BOOLToBool(shGetPathFromIDListW(itemIDList, path.GetBuf(len)));
|
bool result = BOOLToBool(shGetPathFromIDListW(itemIDList, path.GetBuf(len)));
|
||||||
|
|
@ -273,14 +280,14 @@ bool GetPathFromIDList(LPCITEMIDLIST itemIDList, UString &path)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef LPITEMIDLIST (WINAPI * SHBrowseForFolderWP)(LPBROWSEINFOW lpbi);
|
|
||||||
|
|
||||||
static bool BrowseForFolder(LPBROWSEINFOW browseInfo, UString &resultPath)
|
static bool BrowseForFolder(LPBROWSEINFOW browseInfo, UString &resultPath)
|
||||||
{
|
{
|
||||||
NWindows::NCOM::CComInitializer comInitializer;
|
NWindows::NCOM::CComInitializer comInitializer;
|
||||||
SHBrowseForFolderWP shBrowseForFolderW = (SHBrowseForFolderWP)
|
Func_SHBrowseForFolderW shBrowseForFolderW = (Func_SHBrowseForFolderW)
|
||||||
|
MY_CAST_FUNC
|
||||||
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHBrowseForFolderW");
|
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHBrowseForFolderW");
|
||||||
if (shBrowseForFolderW == 0)
|
if (!shBrowseForFolderW)
|
||||||
return false;
|
return false;
|
||||||
LPITEMIDLIST itemIDList = shBrowseForFolderW(browseInfo);
|
LPITEMIDLIST itemIDList = shBrowseForFolderW(browseInfo);
|
||||||
if (itemIDList == NULL)
|
if (itemIDList == NULL)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<?define VerMajor = "22" ?>
|
<?define VerMajor = "22" ?>
|
||||||
<?define VerMinor = "00" ?>
|
<?define VerMinor = "01" ?>
|
||||||
<?define VerBuild = "00" ?>
|
<?define VerBuild = "00" ?>
|
||||||
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
|
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
|
||||||
<?define MmHex = "$(var.VerMajor)$(var.VerMinor)" ?>
|
<?define MmHex = "$(var.VerMajor)$(var.VerMinor)" ?>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
7-Zip 21.07 Sources
|
7-Zip 22.01 Sources
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
7-Zip is a file archiver for Windows.
|
7-Zip is a file archiver for Windows.
|
||||||
|
|
||||||
7-Zip Copyright (C) 1999-2021 Igor Pavlov.
|
7-Zip Copyright (C) 1999-2022 Igor Pavlov.
|
||||||
|
|
||||||
|
|
||||||
License Info
|
License Info
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue