Lhaz
読み取り中…
検索中…
一致する文字列を見つけられません
sfx.h
[詳解]
1/*************************************************************************/
6#pragma once
7
8#include <windows.h>
9#include "mybuf.h"
10#include "mystr.h"
11#include "../src/lhazsfx.h"
12
13class MYFILE;
14
15#define MULTIBYTE_FIRST_P SJC_FIRST_P
16#define MULTIBYTE_SECOND_P SJC_SECOND_P
17#define is_directory(statp) (((statp)->st_mode & S_IFMT) == S_IFDIR)
18#define is_regularfile(statp) (((statp)->st_mode & S_IFMT) == S_IFREG)
19#define METHOD_TYPE_STRAGE 5
20#define BUFFERSIZE 2048
21#define LZHEADER_STRAGE 4096
22#define LZHUFF0_METHOD_NUM 0
23#define LZHUFF1_METHOD_NUM 1
24#define LZHUFF2_METHOD_NUM 2
25#define LZHUFF3_METHOD_NUM 3
26#define LZHUFF4_METHOD_NUM 4
27#define LZHUFF5_METHOD_NUM 5
28#define LZHUFF6_METHOD_NUM 6
29#define LZHUFF7_METHOD_NUM 7
30#define LARC_METHOD_NUM 8
31#define LARC5_METHOD_NUM 9
32#define LARC4_METHOD_NUM 10
33#define LZHDIRS_METHOD_NUM 11
34#define EXTEND_GENERIC 0
35#define EXTEND_MSDOS 'M'
36#define EXTEND_HUMAN 'H'
37
38typedef struct LzHeader {
39 unsigned char header_size;
44 unsigned char attribute;
45 unsigned char header_level;
46 MYSTR name;
47 unsigned short crc;
48 bool has_crc;
49 unsigned char extend_type;
50 unsigned char minor_version;
51 /* extend_type == EXTEND_UNIX and convert from other type. */
54
55/*************************************************************************/
59class SFX {
60
61public:
62 SFX(HINSTANCE hInstance);
63 ‾SFX(void);
64 int Run(void);
65
66private:
67 enum {
68 SFX_START = WM_APP,
73 };
74 //
75 enum {
78 };
79 //
80 enum TYPE { LZH, ZIP, CAB, TGZ, TAR, GZIP, TBZ, BZ2, RAR
81#ifdef FEATURE_7ZIP
82 ,SZIP
83#endif // FEATURE_7ZIP
84 };
85 //
93 //
94 enum {
99 };
100 enum {
116 LZH_EXT_HEAD_RESRV = 0xFF
117 };
118 //
119 static const int SKIP_SIZE;
120 static const TCHAR ClassName[];
121 static const TCHAR SFXTITLE[];
122 static const char* Methods[];
123 static const TCHAR LHAZOPEN[];
124 static const TCHAR LHAZEXT[];
125 static const TCHAR LHAZVIEW[];
126 static const TCHAR LHAZARC[];
127 static const TCHAR LHAZ[];
128 //
129 static bool Initialized;
130 static HINSTANCE Instance;
131 //
132 MYFILE* Afp;
135 MYSTR DestDir;
136 bool Error;
137 bool Force;
139 char* GetPtr;
140 HWND Hwnd;
141 bool Option;
143 bool Skip;
146 //
147 static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
148 static INT_PTR CALLBACK DialogCancel(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
149 static INT_PTR CALLBACK DialogMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
150 static INT_PTR CALLBACK DialogOverWrite(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
151 //
152 void Adjust_info(TCHAR* name, LzHeader* hdr);
153 int CalcSum(char* p, int len);
154 bool ChangeDir(const TCHAR* dir);
155 long CopyFile(MYFILE* f2, long size, bool calc_crc);
156 void CreateShortCutSub(int);
157 void CreateShortCut(void);
158 HWND CreateWindowExDpi(DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
159 unsigned short DecodeLzhuf(MYFILE* outfp, long original_size, long packed_size, TCHAR* name, int method);
160 void DispName(const MYSTR& name);
161 void Exec(void);
162 bool Extract(void);
163 bool ExtractOne(LzHeader* hdr);
164 time_t GenericToUnixStamp(long t);
165 inline unsigned char GetByte(void) { return ((unsigned char)(*GetPtr++ & 0xFF)); };
166 bool GetHeader(LzHeader* hdr);
167 inline long GetLongword(void);
168 bool GetParam(void);
169 int GetTotalSize(void);
170 long GetTZ(void);
171 inline unsigned short GetWord(void);
172 bool Init(HINSTANCE hInstance);
173 INQ_RET Inquire_extract(const MYSTR& name);
174 inline void SetupGet(char* p) { GetPtr = p; };
175 static void (_cdecl Thread)(void*);
176 void UpdateShell(bool mkdir, TCHAR* p);
177
178};
Definition lhazsfx.h:10
Main Class
Definition lhaz.h:47
LZH-SFX class
Definition sfx.h:59
bool ExtractOne(LzHeader *hdr)
ExtractOne
Definition Sfx.cpp:637
bool Skip
Definition sfx.h:143
INQ_RET Inquire_extract(const MYSTR &name)
Inquire_extract
Definition Sfx.cpp:977
HWND StaticWnd
Definition sfx.h:144
static void(_cdecl Thread)(void *)
bool Option
Definition sfx.h:141
int Run(void)
Run
Definition Sfx.cpp:281
bool Error
Definition sfx.h:136
void Exec(void)
Exec
Definition Sfx.cpp:610
@ I_HEADER_CHECKSUM
Definition sfx.h:95
@ I_HEADER_LEVEL
Definition sfx.h:96
@ I_PACKED_SIZE
Definition sfx.h:98
@ I_METHOD
Definition sfx.h:97
static const int SKIP_SIZE
Definition sfx.h:119
MYBUF ZoneIdentifier
Definition sfx.h:145
MYSTR DestDir
Definition sfx.h:135
bool Extract(void)
Extract
Definition Sfx.cpp:622
unsigned short DecodeLzhuf(MYFILE *outfp, long original_size, long packed_size, TCHAR *name, int method)
DecodeLzhuf
Definition Sfx.cpp:480
static const TCHAR LHAZOPEN[]
Definition sfx.h:123
bool GetHeader(LzHeader *hdr)
GetHeader
Definition Sfx.cpp:735
HWND CreateWindowExDpi(DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
CreateWindowExDpi
Definition Sfx.cpp:199
long GetLongword(void)
GetLongword
Definition Sfx.cpp:899
HWND Hwnd
Definition sfx.h:140
static const TCHAR LHAZEXT[]
Definition sfx.h:124
static const TCHAR LHAZVIEW[]
Definition sfx.h:125
void SetupGet(char *p)
Definition sfx.h:174
time_t GenericToUnixStamp(long t)
GenericToUnixStamp
Definition Sfx.cpp:691
MYSTR gOverWriteMes
Definition sfx.h:138
long CopyFile(MYFILE *f2, long size, bool calc_crc)
CopyFile
Definition Sfx.cpp:392
long GetTZ(void)
GetTZ
Definition Sfx.cpp:955
static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
WndProc
Definition Sfx.cpp:294
static bool Initialized
Definition sfx.h:129
‾SFX(void)
Destructor
Definition Sfx.cpp:213
@ SFX_STOP
Definition sfx.h:72
@ SFX_PRGRS
Definition sfx.h:70
@ SFX_START
Definition sfx.h:68
@ SFX_DISP
Definition sfx.h:69
@ SFX_FINISH
Definition sfx.h:71
void CreateShortCut(void)
CreateShortCut
Definition Sfx.cpp:419
void DispName(const MYSTR &name)
DispName
Definition Sfx.cpp:596
void Adjust_info(TCHAR *name, LzHeader *hdr)
Adjust_info
Definition Sfx.cpp:351
unsigned short GetWord(void)
GetWord
Definition Sfx.cpp:966
char * GetPtr
Definition sfx.h:139
static const TCHAR LHAZARC[]
Definition sfx.h:126
unsigned char GetByte(void)
Definition sfx.h:165
MYFILE * Afp
Definition sfx.h:132
@ LZH_EXT_HEAD_CRC
Definition sfx.h:101
@ LZH_EXT_HEAD_GID
Definition sfx.h:112
@ LZH_EXT_HEAD_RESRV
Definition sfx.h:116
@ LZH_EXT_HEAD_ATRB
Definition sfx.h:105
@ LZH_EXT_HEAD_USER
Definition sfx.h:114
@ LZH_EXT_HEAD_MODT
Definition sfx.h:115
@ LZH_EXT_HEAD_GROUP
Definition sfx.h:113
@ LZH_EXT_HEAD_COMNT
Definition sfx.h:104
@ LZH_EXT_HEAD_UNI_PATH
Definition sfx.h:109
@ LZH_EXT_HEAD_UNI_FNAME
Definition sfx.h:108
@ LZH_EXT_HEAD_FNAME
Definition sfx.h:102
@ LZH_EXT_HEAD_PATH
Definition sfx.h:103
@ LZH_EXT_HEAD_SIZE
Definition sfx.h:107
@ LZH_EXT_HEAD_PERMS
Definition sfx.h:111
@ LZH_EXT_HEAD_CP
Definition sfx.h:110
@ LZH_EXT_HEAD_TIME
Definition sfx.h:106
MYSTR DecodeName
Definition sfx.h:134
static INT_PTR CALLBACK DialogMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
DialogMain
Definition Sfx.cpp:512
static const TCHAR SFXTITLE[]
Definition sfx.h:121
static HINSTANCE Instance
Definition sfx.h:130
int CalcSum(char *p, int len)
CalcSum
Definition Sfx.cpp:361
@ LHAZWND_HEIGHT
Definition sfx.h:77
@ LHAZWND_WIDTH
Definition sfx.h:76
void UpdateShell(bool mkdir, TCHAR *p)
UpdateShell
Definition Sfx.cpp:1074
HWND CancelButtonWnd
Definition sfx.h:133
bool Force
Definition sfx.h:137
static INT_PTR CALLBACK DialogOverWrite(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition Sfx.cpp:1026
bool ChangeDir(const TCHAR *dir)
ChangeDir
Definition Sfx.cpp:371
bool Init(HINSTANCE hInstance)
Init
Definition Sfx.cpp:221
bool GetParam(void)
GetParam
Definition Sfx.cpp:912
void CreateShortCutSub(int)
CreateShortCutSub
Definition Sfx.cpp:434
TYPE
Definition sfx.h:80
@ CAB
Definition sfx.h:80
@ TAR
Definition sfx.h:80
@ BZ2
Definition sfx.h:80
@ TBZ
Definition sfx.h:80
@ LZH
Definition sfx.h:80
@ TGZ
Definition sfx.h:80
@ ZIP
Definition sfx.h:80
@ GZIP
Definition sfx.h:80
@ RAR
Definition sfx.h:80
static INT_PTR CALLBACK DialogCancel(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static const char * Methods[]
Definition sfx.h:35
INQ_RET
Definition sfx.h:86
@ INQ_CANCEL
Definition sfx.h:91
@ INQ_SKIP
Definition sfx.h:89
@ INQ_OK
Definition sfx.h:87
@ INQ_SKIP_ALL
Definition sfx.h:90
@ INQ_NO
Definition sfx.h:88
static const TCHAR ClassName[]
Definition sfx.h:120
LHAZSFX Param
Definition sfx.h:142
int GetTotalSize(void)
GetTotalSize
Definition Sfx.cpp:922
#define METHOD_TYPE_STRAGE
Definition sfx.h:19
Definition sfx.h:38
bool has_crc
Definition sfx.h:48
long original_size
Definition sfx.h:42
unsigned char extend_type
Definition sfx.h:49
unsigned char header_size
Definition sfx.h:39
unsigned char header_level
Definition sfx.h:45
char method[METHOD_TYPE_STRAGE]
Definition sfx.h:40
unsigned char minor_version
Definition sfx.h:50
MYSTR name
Definition sfx.h:46
time_t unix_last_modified_stamp
Definition sfx.h:52
unsigned short crc
Definition sfx.h:47
long packed_size
Definition sfx.h:41
long last_modified_stamp
Definition sfx.h:43
unsigned char attribute
Definition sfx.h:44