使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 4905e2e7537d507f218e8e9595485e09d9f3a2b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
// is Copyrighted 2000 - 2011 by Artpol Software - Tadeusz Dracz
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// For the licensing details refer to the License.txt file.
//
// Web Site: http://www.artpol-software.com
////////////////////////////////////////////////////////////////////////////////
// Check the site http://www.artpol-software.com for the updated version of the library.
//   
//    The following information files are distributed along with this library:
//        License.txt        - licensing information
//        Appnote.txt        - details on the zip format
//                            ( also available at ftp://ftp.pkware.com/appnote.zip)
//
 
 
 
/**
* \file ZipArchive.h
*    Includes the CZipArchive class.
*
*/
 
#if !defined(ZIPARCHIVE_ZIPARCHIVE_DOT_H)
#define ZIPARCHIVE_ZIPARCHIVE_DOT_H
 
#if (_MSC_VER > 1000) && (defined ZIP_HAS_DLL)
    #pragma warning (push)
    #pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients of class
    #pragma warning( disable : 4275 ) // non dll-interface class used as base for dll-interface
#endif
 
#include "_features.h"
#include "ZipException.h"
#include "ZipAutoBuffer.h"
#include "ZipCentralDir.h"    
#include "ZipStorage.h"
#include "ZipPathComponent.h"
#include "ZipString.h"
#include "ZipExport.h"
#include "ZipCryptograph.h"
#include "FileFilter.h"
#include "DirEnumerator.h"
#include "ZipCompressor.h"
#include "ZipCallbackProvider.h"
#include "BitFlag.h"
 
#define ZIP_DEFAULT_CODE_PAGE UINT(-1)
 
/**
    The structure used as a parameter in CZipArchive::AddNewFile(CZipAddNewFileInfo& ).
    Use one of the provided constructors and then adjust the member variables as needed.
 
    \see
        <a href="kb">0610231446|simple</a>
*/
struct ZIP_API CZipAddNewFileInfo
{
    /**
        Initializes a new instance of the CZipAddNewFileInfo class.
        
        \param lpszFilePath
            Sets #m_szFilePath.
        
        \param bFullPath
            Sets #m_bFullPath.
     */
    CZipAddNewFileInfo(LPCTSTR lpszFilePath, bool bFullPath = true)
    {
        Defaults();
        m_szFilePath = lpszFilePath;
        m_bFullPath = bFullPath;
    }
 
    /**
        Initializes a new instance of the CZipAddNewFileInfo class.
        
        \param lpszFilePath
            Sets #m_szFilePath.
        
        \param lpszFileNameInZip
            Sets #m_szFileNameInZip.
     */
    CZipAddNewFileInfo(LPCTSTR lpszFilePath, LPCTSTR lpszFileNameInZip)
    {
        Defaults();
        m_szFilePath = lpszFilePath;
        m_szFileNameInZip = lpszFileNameInZip;
    }
 
    /**
        Initializes a new instance of the CZipAddNewFileInfo class.
        
        \param pFile
            Sets #m_pFile.
        
        \param lpszFileNameInZip
            Sets #m_szFileNameInZip.
     */
    CZipAddNewFileInfo(CZipAbstractFile* pFile, LPCTSTR lpszFileNameInZip)
    {
        Defaults();
        m_pFile = pFile;
        m_szFileNameInZip = lpszFileNameInZip;
    }
 
    /**            
        Initialize this field to set the source data for compression to be taken from 
        the \c CZipAbstractFile object (such as \c CZipMemFile) instead of from a physical file.
        
         \note 
          - You have to leave #m_szFilePath empty if you set #m_pFile to not \c NULL.
          - The time of a file in zip will be set to the current time, and the attributes to the default
          file attributes (depending on the system).
          - You cannot add directories this way.
    */
    CZipAbstractFile* m_pFile;
 
    /**
        The full path to the file to be added. If it is empty, you need to initialize #m_pFile.
        If #m_bFullPath is \c true and the path contains a drive letter, the drive letter is removed unless
        CZipArchive::m_bRemoveDriveLetter is set to \c false.
    */
    CZipString m_szFilePath;        
 
    /**
        The file name that will be stored in the archive. If the file is a directory,
        there will be a path separator automatically appended. The CZipArchive::SetRootPath
        method has no effect on this parameter.
    */
    CZipString m_szFileNameInZip;
    
    /**
        It has only the meaning when CZipAddNewFileInfo::m_szFileNameInZip is not specified and 
        CZipAddNewFileInfo::m_szFilePath is not empty. 
 
        - If set to \c true, instructs to store the full path of the file inside the archive,
        even if CZipArchive::m_szRootPath is set.
        - If set to \c false only a filename without a path is stored in the archive. 
        In this case, if CZipArchive::m_szRootPath is set previously with 
        CZipArchive::SetRootPath, and if the beginning of #m_szFilePath equals 
        CZipArchive::m_szRootPath, then the filename is set to the not matched part 
        of #m_szFilePath (you could say to #m_szFilePath minus CZipArchive::m_szRootPath).
    */
    bool m_bFullPath;
 
    /**
        The level of compression. You can use values from \c 0 to \c 9 and \c -1 (meaning the default compression)
        or one of the CZipCompressor::CompressionLevel values.
    */
    int m_iComprLevel;                
 
    /**
        The smartness level of the file adding process. It can be one or more of the CZipArchive::Smartness
        values (you can use the logical \c OR).
    */
    ZipArchiveLib::CBitFlag m_iSmartLevel;
 
    /**
        The index of an existing file in the archive to be replaced by the file being added.
        See <a href="kb">0610231944|replace</a> for more information.
        The meaning of its values is as follows:
 
        - >= 0 : the index of the file to be replaced.
        - \c ZIP_FILE_INDEX_UNSPECIFIED : do not replace any file and add the new file at 
        the end of the archive (default). Use this value in segmented archives.
 
        \note
            - If you use an invalid index, the action will fail. 
            - If you specify the last file in the archive to be replaced, it'll be removed 
            and the usual action will be taken.
 
        \see CZipArchive::SetAdvanced
        \see CZipArchive::WillBeDuplicated
    */
    ZIP_INDEX_TYPE m_uReplaceIndex;        
 
    /**
        The size of the buffer used while file operations.
    */
    unsigned long m_nBufSize;        
 
    /**
        Sets the default values for #m_iSmartLevel, #m_uReplaceIndex, #m_nBufSize and #m_iComprLevel.
        Examine the source code for the current values.
    */
    void Defaults();
};
 
 
 
/// <summary>
/// Represents a zip archive file.    
/// </summary>
class ZIP_API CZipArchive  
{    
public:
    static const char m_gszCopyright[];
    static const char m_gszVersion[];
        
    CZipArchive();
 
    virtual ~CZipArchive();
    
    /** 
        Sets a password for the file to be opened or created.
        Use this method before opening or adding a file, but after opening the archive.
        For security reasons, the password is cleared during opening and closing of the archive.
        For the encryption to work,    encryption method must be set to other value than CZipCryptograph::encNone.
 
        \param    lpszPassword
            The password. Set it to \c NULL or an empty string to clear the password.
 
        \param codePage
            The code page to use.
 
        \return
            \c false if the password cannot be changed at this time; \c true otherwise.
 
        \see
            <a href="kb">0610201627</a>
        \see
            <a href="kb">0610051525|unicodeStrings</a>
        \see 
            GetPassword
        \see
            SetEncryptionMethod
        \see 
            WillEncryptNextFile
    */
    bool SetPassword(LPCTSTR lpszPassword = NULL, UINT codePage = ZIP_DEFAULT_CODE_PAGE);    
 
    /**
        Returns the current archive password or an empty string if there is no password set. 
        \return
            The current password.
        \see
            SetPassword
    */
    CZipString GetPassword()const ;
 
    /**
        Returns the value indicating whether the next file will be encrypted. To encrypt a file, 
        a password must be set with the #SetPassword method and an encryption method must be set 
        to a value different from CZipCryptograph::encNone.
        \return
            \c true, if the next file added to the archive will be encrypted; \c false otherwise.
        \see
            <a href="kb">0610201627</a>
        \see
            SetEncryptionMethod
        \see
            GetEncryptionMethod
        \see
            SetPassword
        \see
            GetPassword
    */    
    bool WillEncryptNextFile() const
    {
        return m_pszPassword.GetSize() != 0 && m_iEncryptionMethod != CZipCryptograph::encNone;
    }
 
    /**
        Sets the encryption method when encrypting files.
        You can encrypt different files using different methods.
        You need to set the password with the #SetPassword method for the encryption to work.
        It is necessary to set the encryption method only when compressing. When decompressing, 
        the encryption method will be detected automatically.
        
        \param iEncryptionMethod
            One of the CZipCryptograph::EncryptionMethod values.
        
        \return
            \c false if selected encryption method is not supported or a 
            file is opened for compression; \c true otherwise.
 
        \see
            <a href="kb">0610201627</a>
        \see
            SetPassword
        \see
            CZipCryptograph::EncryptionMethod
        \see
            GetEncryptionMethod    
        \see 
            WillEncryptNextFile
     */
    bool SetEncryptionMethod(int iEncryptionMethod = CZipCryptograph::encStandard);
 
    /**    
        Returns the current encryption method.
 
        \return
            One of CZipCryptograph::EncryptionMethod values.
 
        \see
            SetEncryptionMethod        
        \see 
            WillEncryptNextFile
     */
    int GetEncryptionMethod() const
    {
        return m_iEncryptionMethod;
    }
 
    /**
        Encrypts an existing file with a given index using the current encryption method.
 
        \param uIndex
            The index of the file to encrypt.
 
        \return 
            \c false, if the file could not be encrypted; \c true otherwise.
 
        \note
            - The method will not encrypt a file, if it already is encrypted.
            - Calls the CZipActionCallback::cbEncryptPrepare, CZipActionCallback::cbMultiEncrypt, 
            CZipActionCallback::cbEncryptMoveData and CZipActionCallback::cbEncrypt callbacks.
 
        \see
            <a href="kb">0610201627|existing</a>
        \see
            SetEncryptionMethod
        \see
            SetPassword
        \see 
            WillEncryptNextFile
        \see
            EncryptFiles
        \see
            EncryptAllFiles        
            
    */
    bool EncryptFile(ZIP_INDEX_TYPE uIndex)
    {
        CZipIndexesArray aIndexes;
        aIndexes.Add(uIndex);
        return EncryptFilesInternal(&aIndexes);
    }
    
    /**
        Encrypts existing files with given indexes using the current encryption method.
 
        \param aIndexes
            The indexes of files to encrypt.
 
        \return 
            \c false, if the files could not be encrypted; \c true otherwise.
 
        \note
            - The method will not encrypt files that are already encrypted.
            - Calls the CZipActionCallback::cbEncryptPrepare, CZipActionCallback::cbMultiEncrypt, 
            CZipActionCallback::cbEncryptMoveData and CZipActionCallback::cbEncrypt callbacks.
 
        \see
            <a href="kb">0610201627|existing</a>
        \see
            SetEncryptionMethod
        \see
            SetPassword
        \see 
            WillEncryptNextFile
        \see
            EncryptFile
        \see
            EncryptAllFiles        
            
    */
    bool EncryptFiles(CZipIndexesArray &aIndexes)
    {
        return EncryptFilesInternal(&aIndexes);
    }
 
    /**
        Encrypts all existing files in the archive using the current encryption method.
 
        \return 
            \c false, if the files could not be encrypted; \c true otherwise.
 
        \note
            - The method will not encrypt files that are already encrypted.
            - Calls the CZipActionCallback::cbEncryptPrepare, CZipActionCallback::cbMultiEncrypt, 
            CZipActionCallback::cbEncryptMoveData and CZipActionCallback::cbEncrypt callbacks.
 
        \see
            <a href="kb">0610201627|existing</a>
        \see
            SetEncryptionMethod
        \see
            SetPassword
        \see 
            WillEncryptNextFile
        \see
            EncryptFile
        \see
            EncryptFiles        
            
    */
    bool EncryptAllFiles()
    {
        return EncryptFilesInternal(NULL);
    }
 
    /**
        Sets the compression method used when compressing file. If affects the files that are  
        added to the archive after calling this method.
 
        \param uCompressionMethod
            The compression method to use. Valid values are CZipCompressor::methodStore, CZipCompressor::methodDeflate and CZipCompressor::methodBzip2.
 
        \return
            \c true, if the compression method is supported by the ZipArchive Library and was successfully set;
            \c false otherwise.
 
        \note
            The compression method used for extraction is automatically determined from the information 
            written in the archive.
 
        \see
            <a href="kb">0610231446|methods</a>
        \see
            CZipCompressor::IsCompressionSupported
        \see 
            GetCompressionMethod
        \see
            GetCurrentCompressor
 
    */
    bool SetCompressionMethod(WORD uCompressionMethod = CZipCompressor::methodDeflate);
 
    /**
        Returns the current compression method used when adding files to the archive.
 
        \return
            The current compression method. Is one of the CZipCompressor::CompressionMethod values.
 
        \see
            SetCompressionMethod
    */
    WORD GetCompressionMethod() const
    {
        return m_uCompressionMethod;
    }
 
    /**
        Sets the compression options for an appropriate compressor. The library automatically detects to
        which compressor the options apply by examining the return value from the CZipCompressor::COptions::GetType() method.
        If a file is currently opened for compression or decompression, the options will have no effect on the current file
        processing. A sample that illustrates setting options can be found at <a href="kb">0610231446|options</a>.
 
        \param pOptions 
            The options to set. The \c NULL value has no effect.
            The object is no longer needed and can be safely released after this method returns.
 
        \see
            <a href="kb">0610231446|options</a>
        \see
            GetCurrentCompressor
        \see
            CZipCompressor::GetOptions
        \see
            SetAdvanced
    */
    void SetCompressionOptions(CZipCompressor::COptions* pOptions)
    {
        if (m_iFileOpened)
        {
            ZIPTRACE("%s(%i) : The options will have no effect on the current file processing.\n");
        }
        m_compressorsOptions.Set(pOptions);
    }
 
    /**
        Sets the internal buffer sizes. No buffer size can be set smaller than 1024.
        Use this method before opening the archive. The optimal size for 
        the write buffer for a segmented archive is the size of the volume.
 
        \param iWriteBuffer
            The write buffer size. See also CZipStorage::m_iWriteBufferSize.
 
        \param iGeneralBuffer
            A helper buffer used in moving data, deleting, getting (#GetFromArchive)
            files, renaming and replacing. This buffer is not used for
            compression and decompression. For these purposes, use the CZipCompressor::COptions::m_iBufferSize option.
 
        \param iSearchBuffer
            A buffer used in searching for the central directory. See also CZipStorage::m_iLocateBufferSize.
            
        \see
            GetAdvanced
        \see
            SetCompressionOptions
    */
    void SetAdvanced(int iWriteBuffer = 65536, int iGeneralBuffer = 65536, int iSearchBuffer = 32768);
 
    
    /**
        Retrieves buffer sizes as set with the SetAdvanced() method.
    
        \param piWriteBuffer
                
        \param piGeneralBuffer
    
        \param piSearchBuffer
 
        \see
            SetAdvanced
     */
    void GetAdvanced(int* piWriteBuffer = NULL, int* piGeneralBuffer = NULL, int* piSearchBuffer= NULL)
    {
        if (piWriteBuffer)
            *piWriteBuffer =     m_storage.m_iWriteBufferSize;
        if (piGeneralBuffer)
            *piGeneralBuffer = m_iBufferSize;
        if (piSearchBuffer)
            *piSearchBuffer = m_storage.m_iLocateBufferSize;
    }
 
 
    /**
        Registers the callback object to receive specified notifications.        
 
        \param pCallback
            The callback object to receive notifications.
            Set it to \c NULL to stop receiving the selected notifications.
 
        \param iWhich
            The callback type to register for (or unregister from). It can be one or more of the CZipActionCallback::CallbackType values.
 
        \see
            <a href="kb">0610231200</a>
        \see
            CZipActionCallback
        \see
            CZipActionCallback::CallbackType
        \see
            GetCallback
        
     */
    void SetCallback(CZipActionCallback* pCallback = NULL, int iWhich = CZipActionCallback::cbAll)
    {
        m_callbacks.Set(pCallback, iWhich);
    }
 
    /**
        Returns the callback object registered for the given notification.
 
        \param iWhich
            The callback type. It can be one or more of the CZipActionCallback::CallbackType values.
        \return
            The callback object set previously with #SetCallback.
        \see
            <a href="kb">0610231200</a>
        \see
            SetCallback
        \see
            CZipActionCallback
        \see
            CZipActionCallback::CallbackType
    */
    CZipActionCallback* GetCallback(CZipActionCallback::CallbackType iWhich)
    {
        return m_callbacks.Get(iWhich);
    }
 
    /**
        The type of the callback object used during changing volumes in a segmented archive.
 
        \see
            CZipArchive::SetSegmCallback
    */
    enum SegmCallbackType
    {
        scSpan    = 0x01,                ///< The callback object will be set for operations on spanned archives only.
        scSplit    = 0x02,                ///< The callback object will be set for operations on split and binary split archives only.
        scAll    = scSpan | scSplit    ///< The callback object will be set for operations on spanned and split archives.
    };
 
    /**
        Sets the callback object used during operations on a segmented archive to change volumes in spanned and split archives.
        Set it before opening the archive. If you open a spanned archive and don't set the callback object, 
        the exception CZipException::noCallback will be thrown. Setting the callback object is not required for 
        a split archive.
 
        Callback object's method CZipSegmCallback::Callback is called when the next volume is processed in a segmented archive.
        Calling CZipArchive methods from inside this method may result in an unexpected behavior.
 
        \param pCallback
            The address of the callback object. Set it to \c NULL to clear the callback.
 
        \param callbackType
            The type of the callback to set. It can be one of the #SegmCallbackType values.
 
        \see
            <a href="kb">0610051553</a>
        \see
            CZipSegmCallback
    */
    void SetSegmCallback(CZipSegmCallback* pCallback = NULL, int callbackType = scSpan);
 
    /**
        Sets the current split names handler.
 
        \param names
            The handler to set.
 
        \note 
            Set it each time before an archive is opened.
 
        \see
            <a href="kb">0610051553|splitNames</a>
        \see 
            SetSplitNamesHandler(CZipSplitNamesHandler*, bool)
        \see
            CZipSplitNamesHandler
    */
    bool SetSplitNamesHandler(CZipSplitNamesHandler& names)
    {
        return SetSplitNamesHandler(&names, false);
    }
 
    /**
        Sets the current split names handler.
 
        \param pNames
            The names to set.
 
        \param bAutoDelete
            If \c true, the handler will be automatically deleted when it is no longer needed; \c false otherwise.
 
        \note 
            Set it each time before an archive is opened.
 
        \see
            <a href="kb">0610051553|splitNames</a>
        \see 
            SetSplitNamesHandler(CZipSplitNamesHandler&)
        \see
            CZipSplitNamesHandler
    */
    bool SetSplitNamesHandler(CZipSplitNamesHandler* pNames, bool bAutoDelete = true)
    {
        return m_storage.SetSplitNamesHandler(pNames, bAutoDelete);
    }
 
    
    /**
        The archive open modes used in the CZipArchive::Open(LPCTSTR, int, ZIP_SIZE_TYPE)
        and CZipArchive::Open(CZipAbstractFile&, int, bool) methods.
    */
    enum OpenMode
    {
        zipOpen                = 0x0001,                ///< Opens an existing archive.
        zipOpenReadOnly        = zipOpen | 0x0002,        ///< Opens an existing archive as a read only file. This mode is intended to use in a self extract code, when opening an archive on a storage without the write access (e.g. CD-ROMS) or when sharing the central directory (see OpenFrom()). If you try to modify the archive in this mode, an exception will be thrown.
        zipCreate            = 0x0004,                ///< Creates a new archive.
        zipCreateAppend        = zipCreate | 0x0008,    ///< Creates a new archive, but allows appending the archive to an existing file (which can be for example a self-extracting stub).
 
        zipModeSplit        = 0x0100, // For the internal use only.
        zipModeBinSplit        = 0x0200, // For the internal use only.
        zipModeSpan            = 0x0400, // For the internal use only.
        zipModeSegmented    = zipModeSplit | zipModeBinSplit | zipModeSpan, // For the internal use only.
 
        zipCreateSplit        = zipCreate | zipModeSplit, ///< Creates a split archive.
        zipCreateBinSplit    = zipCreate | zipModeBinSplit, ///< Creates a binary split archive.
        zipCreateSpan        = zipCreate | zipModeSpan, ///< Creates a span archive.
 
        zipOpenSplit        = zipOpenReadOnly | zipModeSplit, ///< Opens an existing split archive. Use when opening split archives on removable devices or under Linux/Mac OS X.
        zipOpenBinSplit    = zipOpenReadOnly | zipModeBinSplit ///< Opens an existing binary split archive.
        
    };
 
    /**
        Opens or creates a zip archive.    
 
        \param    szPathName
            The path to the archive.
 
        \param    iMode
            It can be one of the #OpenMode values.
 
        \param    uVolumeSize
            The volume size in a split archive (relevant only for #zipCreateSplit and #zipCreateBinSplit modes).
            The size of the volume may be from 1 to 4,294,967,295.
            The bigger this value is - the faster is creation and extraction of segmented archives,
            because there are no volume changes.
 
        \return
            \c true, if the archive was opened successfully; \c false, if the archive was already opened before.
        
        \note
            When opening a segmented archive, open the last volume.
        
        \see
            <a href="kb">0610231446</a>
        \see
            <a href="kb">0610241003</a>
        \see
            <a href="kb">0610051553</a>
        \see
            Open(CZipAbstractFile&, int, bool);
    */
    bool Open(LPCTSTR szPathName, int iMode = zipOpen, ZIP_SIZE_TYPE uVolumeSize = 0);
 
 
    /**
        Opens or creates an archive in memory. The \c CZipAbstractFile object is not closed
        after closing the archive, so that it is possible to work with it afterwards.
 
        \param    af
            \c CZipAbstractFile object to store the archive data.
 
        \param    iMode
            The open mode. The following values are valid:  #zipOpen, #zipOpenReadOnly, #zipCreate, #zipCreateAppend.
            If you use #zipCreate, the contents of the memory file are cleared. Use #zipCreateAppend, if you want to 
            append the archive at the end of the data contained in the memory file.
        \param bAutoClose
            If \c true, the file will be closed when no longer used; \c false otherwise. Use \c false value (default)
            when operating on memory files.
 
        \return
            \c true, if the archive was opened successfully; \c false, if the archive was already opened before or an 
            invalid open mode was specified.
 
        
        \see
            <a href="kb">0610231924</a>
        \see
            Open(LPCTSTR, int, ZIP_SIZE_TYPE);        
    */    
    bool Open(CZipAbstractFile& af, int iMode = zipOpen, bool bAutoClose = false);
 
    /**
        Opens the archive from the already opened archive. Both archives will share the same central directory.
        The \a zip archive must be opened in read-only mode (unless \a allowNonReadOnly is set to \c true) 
        and the newly opened archive will open as read-only as well.
 
        \param zip
            The archive that provides the reference to the central directory. It must be a read-only archive.
            If the archive has no physical representation, the storage file of that archive
            has to return \c false from the <code>CZipAbstractFile::HasFilePath()</code> method. 
            Alternatively, \a pArchiveFile can be used. When \a pArchiveFile is used, the \a zip archive cannot be segmented.
 
        \param pArchiveFile
            When used, the current CZipArchive instance will use this file as the storage. This file must be opened in advance and the 
            library will not attempt to close it at any time.
 
        \param bAllowNonReadOnly
            When set to \c true, the method will allow opening from a non-read only archive. However it is up to the user to ensure 
            that the modifications to the \a zip archive won't corrupt the state of the CZipArchive object opened from it. Such a situation 
            can happen when the \a zip archive is being modified and the current archive is reading at the same time.
 
        \return 
            \c true, if the new archive was successfully opened; \c false otherwise.
 
        \note
            If you use this method in a multithreaded environment, 
            make sure that \c _ZIP_USE_LOCKING is defined in the \e _features.h file. Also make sure, that \a zip stays open until 
            this method returns.
        
        \see 
            <a href="kb">0610241003|thread</a>
        \see 
            zipOpenReadOnly
 
    */
    bool OpenFrom(CZipArchive& zip, CZipAbstractFile* pArchiveFile = NULL, bool bAllowNonReadOnly = false);
 
    /**
        Sets the path fragment to be removed from the beginning of the full path when adding or extracting a file.
 
        Use it, if you don't want to use the full path (by setting the \a bFullPath parameter in #AddNewFile or #ExtractFile to \c true)
        and you don't want to remove the whole path either (be setting the same parameter to \c false), but you want to remove only a specific beginning.
        Use it after opening the archive and before calling the #AddNewFile or #ExtractFile methods.
 
        \param    szPath
            The string that you want to be removed from the beginning of the path of the file
            in the archive. Set it to \c NULL to stop removing the path beginning.
 
        \note
            Set the case-sensitivity with the #SetCaseSensitivity method.
 
        \see
            AddNewFile 
        \see
            ExtractFile
        \see
            GetRootPath
 
    */
    void SetRootPath(LPCTSTR szPath = NULL);
 
 
    /**
        Returns the value set previously with the SetRootPath() method.
 
        \return
            The current value of the #m_szRootPath field.
 
        \see
            SetRootPath
     */
    CZipString GetRootPath()const 
    {
        return m_szRootPath;
    }
 
    /**
        The levels of smartness of the ZipArchive Library while adding files with the CZipArchive::AddNewFile methods.
        \note If you use #zipsmCheckForEff, you should use 
        #zipsmNotCompSmall as well, because the small file will be surely larger 
        after compression, so that you can add it not compressed straight away. The compression level 
        is always ignored for a directory and set to 0.
    */
    enum Smartness
    {
        zipsmLazy            = 0x0000,        ///< All the smartness options are turned off.
        zipsmCPassDir        = 0x0001,        ///< Clears the password for directories.
        zipsmCPFile0        = 0x0002,        ///< Clears the password for files of 0 size.
 
        /**
            Does not compress files smaller than 5 bytes - they are always stored larger than uncompressed.
        */
        zipsmNotCompSmall    = 0x0004,
 
        /**
            If the compressed file is larger than uncompressed after compression, removes the file and stores it
            without the compression. In a segmented archive, a temporary file is used for that: 
            if the file compression is efficient, the data is not compressed again, but moved from
            the temporary file to the archive. You can use the #SetTempPath method to set the path where the 
            file will be created or you can let the library figure it out (see #SetTempPath).
            If the library could not find enough free space for the temporary file, 
            the compression is performed the usual way.
        */
        zipsmCheckForEff    = 0x0008,
 
        /**
            When combined with #zipsmCheckForEff or #zipsmCheckForEffInMem, it creates the temporary file
            in memory. This flag is effective also when replacing files 
            (see the note at CZipAddNewFileInfo::m_uReplaceIndex).
        */
        zipsmMemoryFlag        = 0x0010,
 
        /**
            The same as #zipsmCheckForEff, but the temporary file is created in memory instead.
            It has the meaning only in a segmented archive. Not segmented archives don't need a temporary file.
        */
        zipsmCheckForEffInMem = zipsmMemoryFlag | zipsmCheckForEff,
        zipsmSmartPass    = zipsmCPassDir | zipsmCPFile0,            ///< The password policy (a combination of #zipsmCPassDir and #zipsmCPFile0).
        zipsmSmartAdd = zipsmNotCompSmall | zipsmCheckForEff,    ///< Smart adding (a combination of #zipsmNotCompSmall and #zipsmCheckForEff).
        zipsmSafeSmart = zipsmSmartPass | zipsmNotCompSmall,    ///< Safe smart (all smartness levels but checking for the compression efficiency).
        zipsmSmartest = zipsmSmartPass | zipsmSmartAdd,            ///< Smartness at its best.
 
        /**
            Ignores empty directories when using directory filter with the #AddNewFiles method.
 
            \see
                <a href="kb">0610231446|filterDirs</a>
        */
        zipsmIgnoreDirectories = 0x0020,
 
        zipsmInternal01        = 0xf000   // For the internal use only.
    };
 
    
    /**
        Adds a new file to the opened archive.
 
        \param info
            See CZipAddNewFileInfo for more information.
 
        \return    
            If \c false then the file was not added (in this case, you can still try to add other files); \c true otherwise.
        
        \note 
            - If you abort the operation from a callback object, while adding a file in a not segmented archive, the added data will be removed from the archive.
            - When an exception is thrown, you may need to call #CloseNewFile with \a bAfterException set to \c true, to continue working with the archive.
        
        \see
            <a href="kb">0610231446</a>
        \see
            <a href="kb">0610231200</a>
        \see
            <a href="kb">0610231924</a>
        \see
            AddNewFile(LPCTSTR, LPCTSTR, int, int, unsigned long)
        \see 
            AddNewFile(LPCTSTR, int, bool, int, unsigned long)
        \see 
            AddNewFile(CZipAbstractFile&, LPCTSTR, int, int, unsigned long)
        \see
            AddNewFiles(LPCTSTR, ZipArchiveLib::CFileFilter&, bool, int, bool, int, unsigned long)
        \see
            AddNewFiles(LPCTSTR, LPCTSTR, bool, int, bool, int, unsigned long)
        \see
            SetCallback
    */
    bool AddNewFile(CZipAddNewFileInfo& info);
 
 
    /**
        Adds a new file to the opened archive.
        See the #AddNewFile(CZipAddNewFileInfo& ) method.
        The parameters are equivalent to CZipAddNewFileInfo member variables.
    
    */
    bool AddNewFile(LPCTSTR lpszFilePath, int iComprLevel = -1, bool bFullPath = true,
        int iSmartLevel = zipsmSafeSmart, unsigned long nBufSize = 65536);
 
 
    /**
        Adds a new file to the opened archive.
        See the #AddNewFile(CZipAddNewFileInfo& ) method.
        The parameters are equivalent to CZipAddNewFileInfo member variables.
    */
    bool AddNewFile(LPCTSTR lpszFilePath,
                             LPCTSTR lpszFileNameInZip,
                             int iComprLevel = -1,                             
                             int iSmartLevel = zipsmSafeSmart,
                             unsigned long nBufSize = 65536);
 
    /**
        Adds a new file to the opened archive.
        See the #AddNewFile(CZipAddNewFileInfo& ) method.
        The parameters are equivalent to CZipAddNewFileInfo member variables.
    */
    bool AddNewFile(CZipAbstractFile& af,
                             LPCTSTR lpszFileNameInZip,
                             int iComprLevel = -1,                             
                             int iSmartLevel = zipsmSafeSmart,
                             unsigned long nBufSize = 65536);
 
 
    /**
        Adds new files to the opened archive from the specified directory using a filter.
 
        \param lpszPath
            The root directory containing the files to add.
 
        \param filter
            A filter that determines which files should be added.
 
        \param bRecursive
            \c true, if the files from the subfolders of \a lpszPath should also be added; \c false otherwise.
 
        \param iComprLevel
            The level of compression. You can use values from 0 to 9 and -1 (meaning the default compression)
            or one of the CZipCompressor::CompressionLevel values.
 
        \param bSkipInitialPath
            \c true, if the \a lpszPath directory should be removed from paths stored in the archive;
            \c false otherwise.
 
        \param iSmartLevel
            The smartness level of the file adding process. It can be one or more of the #Smartness values.
 
        \param nBufSize
            The size of the buffer used during file operations.
 
        \return    
            If \c false then some files were probably not added (in this case, you can still try to add other files); \c true otherwise.
 
        
        \see
            <a href="kb">0610231446|filters</a>
        \see
            ZipArchiveLib::CFileFilter
        \see 
            ZipArchiveLib::CNameFileFilter
        \see 
            ZipArchiveLib::CGroupFileFilter
        \see
            AddNewFiles(LPCTSTR, LPCTSTR, bool, int, bool, int, unsigned long)
        \see 
            AddNewFile(CZipAddNewFileInfo&)
        \see
            AddNewFile(LPCTSTR, LPCTSTR, int, int, unsigned long)
        \see 
            AddNewFile(LPCTSTR, int, bool, int, unsigned long)
        \see 
            AddNewFile(CZipAbstractFile&, LPCTSTR, int, int, unsigned long)
 
    */
    bool AddNewFiles(LPCTSTR lpszPath,
                        ZipArchiveLib::CFileFilter& filter,
                        bool bRecursive = true,
                        int iComprLevel = -1,
                        bool bSkipInitialPath = true,
                        int iSmartLevel = zipsmSafeSmart,
                        unsigned long nBufSize = 65536);
 
    /**
        Adds new files to the opened archive from the specified directory using a filename mask.
 
        \param lpszPath
            The root directory containing the files to add.
 
        \param lpszFileMask
            The filename mask to filter the files. Only files that has a filename matching this mask will
            be added to the archive. This method internally uses ZipArchiveLib::CNameFileFilter.
 
        \param bRecursive
            \c true, if the files from the subfolders of \a lpszPath should also be added; \c false otherwise.
 
        \param iComprLevel
            The level of compression. You can use values from 0 to 9 and -1 (meaning the default compression)
            or one of the CZipCompressor::CompressionLevel values.
 
        \param bSkipInitialPath
            \c true, if the \a lpszPath directory should be removed from paths stored in the archive;
            \c false otherwise.
 
        \param iSmartLevel
            The smartness level of the file adding process. It can be one or more of the #Smartness values.
 
        \param nBufSize
            The size of the buffer used during file operations.
 
        \return    
            If \c false then some files were probably not added (in this case, you can still try to add other files); \c true otherwise.
 
        
        \see
            <a href="kb">0610242025|wildcards</a>
        \see
            AddNewFiles(LPCTSTR, ZipArchiveLib::CFileFilter&, bool, int, bool, int, unsigned long)
        \see 
            AddNewFile(CZipAddNewFileInfo&)
        \see
            AddNewFile(LPCTSTR, LPCTSTR, int, int, unsigned long)
        \see 
            AddNewFile(LPCTSTR, int, bool, int, unsigned long)
        \see 
            AddNewFile(CZipAbstractFile&, LPCTSTR, int, int, unsigned long)
    */
    bool AddNewFiles(LPCTSTR lpszPath, 
                        LPCTSTR lpszFileMask = _T("*.*"), 
                        bool bRecursive = true, 
                        int iComprLevel = -1, 
                        bool bSkipInitialPath = true, 
                        int iSmartLevel = zipsmSafeSmart, 
                        unsigned long nBufSize = 65536)
    {
        ZipArchiveLib::CNameFileFilter filter(lpszFileMask);
        return AddNewFiles(lpszPath, filter, bRecursive, iComprLevel, 
            bSkipInitialPath, iSmartLevel, nBufSize);
    }
 
    /** 
        Returns the index of the recently added file (if any).
 
        \return
            The index of the recently added file or \c ZIP_FILE_INDEX_UNSPECIFIED if the index is unknown.
    */
    ZIP_INDEX_TYPE GetLastIndexAdded() const
    {
        return m_centralDir.GetLastIndexAdded();
    }
 
    /**
        Adds a new file to the opened archive. The archive cannot be 
        an existing (at the moment of opening the archive) segmented archive,
        because modifying such an archive is not possible with this version.
        \param    header
            The structure that provides additional information about the added file and serves as a template for
            the properties of the new file. The following values can be set:
            \li Use CZipFileHeader::SetFileName to set the filename (it may include a path). It will be stored inside the archive
                to represent this file.
            \li Use CZipFileHeader::SetTime to set the modification time.
                If \a lpszFilePath is not \c NULL it is overwritten and updated automatically.
            \li Use CZipFileHeader::SetSystemAttr to set the attributes of the file.
                If \a lpszFilePath is not \c NULL this field is overwritten and updated automatically.            
            \li You can set CZipFileHeader::m_uLocalComprSize to the value of a predicted compressed size. 
                Set it when using the Zip64 functionality and not using 
                encryption or segmentation - you may set it to the size of the file that you want to compress.
                This is for prediction if the Zip64 extensions are needed, but you should not worry too much about setting 
                this value, The ZipArchive Library will fix the headers if necessary - it just may save some processing.
            \li Use CZipFileHeader::SetComment to set the file comment.
            \li Modify CZipFileHeader::m_aLocalExtraData to include local extra fields.
            \li Modify CZipFileHeader::m_aCentralExtraData to include central extra fields.
        
        Other values are updated automatically.
        If the method returns \c true, \link #SetSystemCompatibility 
        system compatibility \endlink for this object is set to the correct value.
        Additionally if \a lpszFilePath was not \c NULL, the attributes and 
        the time fields are filled with information retrieved from 
        the file pointed by \a lpszFilePath.
 
        \param    iLevel
            The level of compression. You can use values from 0 to 9 and -1 (meaning the default compression)
            or one of the CZipCompressor::CompressionLevel values. 
            The level value has no effect, if the compression method set with the #SetCompressionMethod is CZipCompressor::methodStore.
 
        \param    lpszFilePath
            The path to the file to retrieve the date stamp and attributes from.
            These values are stored inside the archive.
 
        \return
            \c false in the following cases:
        \li The \a lpszFilePath is not \c NULL and the file attributes and data was not correctly retrieved.
        \li A file is already opened for extraction or compression.
        \li The archive is an existing segmented archive.
        \li The maximum file count inside the archive has already been reached
        (65,535 for a standard archive and \c 0xFFFFFFFFFFFFFFFF for an archive in the Zip64 format).
 
        \c true otherwise.
 
        
        \see
            <a href="kb">0610231446|advanced</a>
        \see
            <a href="kb">0610242300</a>
        \see 
            WriteNewFile
        \see 
            CloseNewFile
    */
    bool OpenNewFile(CZipFileHeader& header, int iLevel = CZipCompressor::levelDefault, LPCTSTR lpszFilePath = NULL)
    {
        return OpenNewFile(header, iLevel, lpszFilePath, ZIP_FILE_INDEX_UNSPECIFIED);
    }
 
    /**
        Compresses the contents of the buffer and writes it to a new file.
 
        \param    pBuf
            The buffer containing the data to be compressed and written.
 
        \param    uSize
            The number of bytes to be written from \a pBuf.
 
        \return
            \c false, if the new file hasn't been opened yet; \c true otherwise.
 
        
        \see
            <a href="kb">0610231446|advanced</a>
        \see
            OpenNewFile
        \see
            CloseNewFile
    */
    bool WriteNewFile(const void *pBuf, DWORD uSize);
 
    /**
        Closes the new file in the archive.
        \return
            \c false, if there is no new file opened; \c true otherwise.
 
        \param bAfterException 
            If \c true, the new file will be closed without writing anything. Set it to \c true
            after an exception was thrown. Use it also this way if an exception other than 
            CZipException::abortedSafely was thrown from one of the #AddNewFile methods.
 
        
        \see
            <a href="kb">0610231446|advanced</a>
        \see
            OpenNewFile
        \see 
            WriteNewFile
    */
    bool CloseNewFile(bool bAfterException = false);
 
    /**
        Acquires a file with the given index from another archive. 
        The compressed data of the file from another archive is copied to the current archive 
        without decompression.
 
        \param zip 
            The opened archive to get the file from.
 
        \param    uIndex
            A zero-based index of the file to get from the \a zip archive.
 
        \param lpszNewFileName
            The new filename to replace the old one from the \a zip archive. It can be \c NULL to leave the filename the same.
 
        \param uReplaceIndex
            The same as CZipAddNewFileInfo::m_uReplaceIndex. It can be \c ZIP_FILE_INDEX_UNSPECIFIED.
            
        \param bKeepSystComp
            If \c false, then the system compatibility of the file from the \a zip archive
            is converted to the current archive system compatibility, if they differ. Otherwise
            the source system compatibility is copied.
 
        \return
            \c false, if the operation could not be performed (either of archives is closed, 
        a file inside either of archives is opened, \a zip archive is segmented or the current
        archive is an existing segmented archive.
 
        \note 
            - This method will encrypt data, if an encryption method and a password are set and the file is not already encrypted.
            - When an exception is thrown, you may need to call #CloseNewFile with 
            \a bAfterException set to \c true, to continue working with the archive.
            - It is safe to abort the action (by returning \c false from the CZipActionCallback::Callback) 
            in a not segmented archive and when no replacing is taking place. The file that is not 
            entirely added is removed from the archive then.
        
        \see
            <a href="kb">0610231446|get</a>
        \see
            <a href="kb">0610231200</a>
        \see
            GetFromArchive(CZipArchive&, CZipIndexesArray&, bool)
        \see
            GetFromArchive(CZipArchive&, CZipStringArray&, bool)        
        \see
            SetCallback
        \see
            SetAdvanced 
        \see 
            SetEncryptionMethod
        \see 
            SetPassword
    */
    bool GetFromArchive(CZipArchive& zip, ZIP_INDEX_TYPE uIndex, LPCTSTR lpszNewFileName = NULL, ZIP_INDEX_TYPE uReplaceIndex = ZIP_FILE_INDEX_UNSPECIFIED, bool bKeepSystComp = false)
    {                
        InitBuffer();
        bool bRet;
        try
        {
            bRet = GetFromArchive(zip, uIndex, lpszNewFileName, uReplaceIndex, bKeepSystComp, GetCallback(CZipActionCallback::cbGet));
        }
        catch(...)
        {
            ReleaseBuffer();
            throw;
        }
        ReleaseBuffer();
        if (bRet)
            Finalize(true);
 
        return bRet;
    }
 
    /**
        Acquires files with the given indexes from another archive. 
        The compressed data of the file from another archive is copied to the current archive 
        without decompression.
 
        \param zip 
            The opened archive to get the file from.
 
        \param    aIndexes
            An array of zero-based indexes of the files to acquire from the \a zip archive.
 
        \param bKeepSystComp
            If \c false, then the system compatibility of the file from the \a zip archive
            is converted to the current archive system compatibility, if they differ. Otherwise
            the source system compatibility is copied.
 
        \return
            \c false, if the operation could not be performed (either of archives is closed, 
        a file inside either of archives is opened, \a zip archive is segmented or the current
        archive is an existing segmented archive.
 
        \note 
            - This method will encrypt data, if an encryption method and a password are set and the file is not already encrypted.
            - When an exception is thrown, you may need to call #CloseNewFile with 
            \a bAfterException set to \c true, to continue working with the archive.
            - It is safe to abort the action (by returning \c false from the CZipActionCallback::Callback) 
            in a not segmented archive and when no replacing is taking place. The file that is not 
            entirely added is removed from the archive then.
        
        \see
            <a href="kb">0610231446|get</a>
        \see
            <a href="kb">0610231200</a>
        \see
            GetFromArchive(CZipArchive&, ZIP_INDEX_TYPE, LPCTSTR, ZIP_INDEX_TYPE, bool)
        \see
            GetFromArchive(CZipArchive&, CZipStringArray&, bool)        
        \see
            SetCallback
        \see
            SetAdvanced 
        \see 
            SetEncryptionMethod
        \see 
            SetPassword
    */
    bool GetFromArchive(CZipArchive& zip, CZipIndexesArray &aIndexes, bool bKeepSystComp = false);
    
    /**
        Acquires files with the given names from another archive. 
        The compressed data of the file from another archive is copied to the current archive 
        without decompression.
 
        \param zip 
            The opened archive to get the file from.
 
        \param    aNames
            An array of filenames to acquire from the \a zip archive.
 
        \param bKeepSystComp
            If \c false, then the system compatibility of the file from the \a zip archive
            is converted to the current archive system compatibility, if they differ. Otherwise
            the source system compatibility is copied.
 
        \return
            \c false, if the operation could not be performed (either of archives is closed, 
        a file inside either of archives is opened, \a zip archive is segmented or the current
        archive is an existing segmented archive.
 
        \note 
            - This method will encrypt data, if an encryption method and a password are set and the file is not already encrypted.
            - When an exception is thrown, you may need to call #CloseNewFile with 
            \a bAfterException set to \c true, to continue working with the archive.
            - It is safe to abort the action (by returning \c false from the CZipActionCallback::Callback) 
            in a not segmented archive and when no replacing is taking place. The file that is not 
            entirely added is removed from the archive then.
            - This method calls #GetIndexes on the \a zip archive.
        
        \see
            <a href="kb">0610231446|get</a>
        \see
            <a href="kb">0610231200</a>
        \see
            GetFromArchive(CZipArchive&, ZIP_INDEX_TYPE, LPCTSTR, ZIP_INDEX_TYPE, bool)
        \see
            GetFromArchive(CZipArchive&, CZipIndexesArray&, bool)        
        \see
            SetCallback
        \see
            SetAdvanced
        \see
            SetEncryptionMethod
        \see 
            SetPassword
    */
    
    bool GetFromArchive(CZipArchive& zip, CZipStringArray &aNames, bool bKeepSystComp = false)
    {
        CZipIndexesArray indexes;
        zip.GetIndexes(aNames, indexes);
        return GetFromArchive(zip, indexes, bKeepSystComp);
    }
 
    /**
        Returns indexes of the files with names stored in \a aNames and puts them into \a aIndexes.
        If a filename was not found, \c ZIP_FILE_INDEX_NOT_FOUND is inserted at the appropriate 
        position in \a aIndexes.
 
        \param    aNames
            An array of filenames inside the archive.
        \param aIndexes
            An array of indexes to be found.
 
        \note 
            Use the #SetCaseSensitivity method to set case-sensitivity.
 
        \see
            <a href="kb">0610242025|findfast</a>
        \see 
            EnableFindFast
    */
    void GetIndexes(const CZipStringArray &aNames, CZipIndexesArray& aIndexes);
 
    /**
        Extracts a file from the archive.
        The argument \a lpszNewName may point to a full path and is influenced by \a bFullPath.
        If \a lpszNewName contains a drive specification then the drive part is removed
        unless #m_bRemoveDriveLetter is set to \c false.
 
        \param    uIndex
            The index of the file to extract.
 
        \param    lpszPath
            The directory to extract the file to. May not be \c NULL.
 
        \param    bFullPath
            In this paragraph the source path means:
            \li The full filename stored in the archive, if \a lpszNewName is \c NULL
            \li \a lpszNewName, if it is not \c NULL
 
            The meaning of \a bFullPath is following:
            \li If it is \c true, then the method extracts using the full source path, even if #m_szRootPath is set.
            In this case the resulting file path is \a lpszPath plus the source path. 
            \li If it is \c false, then the destination file path is \a lpszPath plus 
            the filename only extracted from the source path.
            In this case, if #m_szRootPath is set (with #SetRootPath), then before adding the source path
            to \a lpszPath, from the source path is removed the part that matches #m_szRootPath
            (matching is performed starting from the beginning of both strings).
            
 
        \param    lpszNewName 
            The new name of the file after extraction. 
            If \c NULL, the original filename stored in the archive is used.
            May include a path information, but if \a bFullPath is \c false, 
            only the filename is extracted from this value.
 
        \param iOverwriteMode
            The mode used when overwriting a file during extraction. Can be one or more of <span class="linkapi">ZipPlatform::DeleteMode</span> values.
 
        \param pSeekPair
            If not NULL, the file will be extracted starting from the seek position described by this value.
 
        \param    nBufSize 
            The size of the buffer used while file operations.
 
        \return
            \c true if successful; \c false otherwise.
 
        \note 
            To extract files which filenames that match a specified pattern, use the #FindMatches method.
        
        \see
            <a href="kb">0610241003</a>
        \see
            <a href="kb">0610231200</a>
        \see
            <a href="kb">0711101739</a>
        \see 
            ExtractFile(ZIP_INDEX_TYPE, CZipAbstractFile&, bool, ZipPlatform::DeleteFileMode, CZipCompressor::COffsetsPair*, DWORD)
        \see
            FindMatches
        \see
            SetCallback
    */    
    bool ExtractFile(ZIP_INDEX_TYPE uIndex,
        LPCTSTR lpszPath,
        bool bFullPath = true,
        LPCTSTR lpszNewName = NULL,
        ZipPlatform::DeleteFileMode iOverwriteMode = ZipPlatform::dfmRegular,
        DWORD nBufSize = 65536);
    
    /**
        The same as #ExtractFile(ZIP_INDEX_TYPE, CZipAbstractFile&, bool, ZipPlatform::DeleteFileMode, CZipCompressor::COffsetsPair*, DWORD)
        but instead to a physical file, this method extracts data into a \c CZipMemFile object.
 
        \param    uIndex
            The index of the file to extract.
 
        \param af
            An abstract file to receive the decompressed data.
 
        \param bRewind
            If \c true, the memory file pointer is positioned at the beginning of the compressed data after compression.
            The rewind operation is performed even if extraction was aborted, but rewinding will not take 
            place, if other exception than CZipException::abortedAction or CZipException::abortedSafely was thrown in the meantime.
        \param pSeekPair
            If not NULL, the file will be extracted starting from the seek position described by this value.
        \param    nBufSize 
            The size of the buffer used while file operations.
 
        \note 
        - Writing of the decompressed data starts at the current position of the memory file. 
        Keep this in mind, when you pass a \c CZipMemFile object that already contains data 
        (or has a buffer attached) - its contents may be overwritten.
        - If you try to extract a directory, the method will return \c false.
 
        \see
            <a href="kb">0610231924</a>
        \see
            <a href="kb">0711101739</a>
        \see
            ExtractFile(ZIP_INDEX_TYPE, CZipAbstractFile&, bool, ZipPlatform::DeleteFileMode, CZipCompressor::COffsetsPair*, DWORD)
    */
    bool ExtractFile(ZIP_INDEX_TYPE uIndex,
        CZipAbstractFile& af,
        bool bRewind = true,
        DWORD nBufSize = 65536);
 
    /**
        Opens the file with the given index in the archive for extracting.
        Not successful opening of the file doesn't lock the whole archive, so 
        you can try to open another one (after catching an exception, if it was 
        thrown)
        \param    uIndex
            The index of the file to open.
 
        \return
            \c true, if successful; \c false otherwise. This method will also return \c false, if the compression method
            of the file is not supported by the ZipArchive Library.
 
        \throws CZipException
            with the CZipException::badPassword code, if the file is encrypted 
            and the password was not set.
 
        \see
            <a href="kb">0610241003|advanced</a>
        \see
            ReadFile
        \see
            CloseFile
    */
    bool OpenFile(ZIP_INDEX_TYPE uIndex);
 
    /**
        Reads data from the currently opened file and decompresses it to \a pBuf.
        \param    pBuf
            The buffer to receive the decompressed data.
 
        \param    uSize
            The size of \a pBuf.
 
        \return
            The number of bytes read.
 
        \see
            <a href="kb">0610241003|advanced</a>
        \see
            OpenFile
        \see
            CloseFile
    */
    DWORD ReadFile(void *pBuf, DWORD uSize);
 
 
    /**
        Closes the file opened for extraction in the archive and copy its date and 
        attributes to the file pointed by \a lpszFilePath.
 
        \param    lpszFilePath 
            The path of the file to have the date and attributes information updated.
            Make sure you have the read access to this file.
 
        \param bAfterException
            Set it to \c true, when you call this method after an exception was
            thrown, to allow further operations on the archive.
 
        \return
            One of the following values:
            -  \c 1 : The operation was successful.
            -  \c 0 : There is no file opened.
            -  \c -1 : Some bytes were left to uncompress - probably due to a bad password or a corrupted archive.
            -  \c -2 : Setting extracted file date and attributes was not successful.
 
        \see
            <a href="kb">0610241003|advanced</a>
        \see
            OpenFile
        \see
            ReadFile
        \see
            CloseFile(CZipFile&)
    */
    int CloseFile(LPCTSTR lpszFilePath = NULL, bool bAfterException = false);
 
    /**
        Closes \a file and then calls the CloseFile(LPCTSTR, bool) method using the path of \a file as an argument.        
        Don't call this method, if an exception was thrown before, call the #CloseFile(LPCTSTR, bool) method instead.
 
        \param    file
            A \c CZipFile object of the extracted file. It must be opened.
 
        \return    
            The same values as the #CloseFile(LPCTSTR, bool) method.
 
        \see
            <a href="kb">0610241003|advanced</a>
        \see
            OpenFile
        \see
            ReadFile
        \see
            CloseFile(LPCTSTR, bool)
    */
    int CloseFile(CZipFile &file);
 
    /**
        Tests the file with the given index for the integrity.
         The method throws exceptions but performs all the necessary cleanup
        before, so that the next file can be tested after catching the exception.
 
        \param    uIndex
            The index of the file to test.
 
        \param    uBufSize
            The size of the buffer used during extraction.
 
        \return
            \c false, if the incorrect action has been taken (when #OpenFile or #GetFileInfo returned \c false or \a uBufSize is 0); \c true otherwise.
        If the file didn't passed the test or there was a disk I/O error or the supplied password was incorrect, an exception is thrown.
 
        
        \see
            <a href="kb">0610241003</a>
        \see
            SetCallback        
    */
    bool TestFile(ZIP_INDEX_TYPE uIndex, DWORD uBufSize = 65536);
 
    /**
        Deletes the file with the given index from the archive.        
        If you plan to delete more than one file, use the #RemoveFiles(CZipIndexesArray&) or 
        #RemoveFiles(const CZipStringArray&) method. These methods are optimized for deleting multiple files.
 
        \param    uIndex
            A zero-based index of the file to delete.
 
        \param bRemoveData
            If \c true (default), removes the file data from the archive.
            If \c false, removes the file only from the central directory.
 
        \return
            \c false, if the file could not be removed; \c true otherwise.
 
        
        \see
            <a href="kb">0610231944|delete</a>
        \see    
            RemoveFiles(CZipIndexesArray&)
        \see
            RemoveFiles(const CZipStringArray&)
        \see
            SetCallback
        \see
            FindMatches
    */
    bool RemoveFile(ZIP_INDEX_TYPE uIndex, bool bRemoveData = true);
 
    /**
        Deletes files from the archive.    
        Sorts \a aIndexes in the ascending order.
 
        \param    aIndexes
            An array of zero-based indexes of the files to delete.
 
        \return
            \c false, if files could not be removed; \c true otherwise.
 
        \note 
            To remove files which filenames match a specified pattern, use the #FindMatches method before to find the indexes.
 
        \see
            <a href="kb">0610231944|delete</a>
        \see
            RemoveFile
        \see
            RemoveFiles(const CZipStringArray& )
        \see
            SetCallback
        \see
            FindMatches
    */
    bool RemoveFiles(CZipIndexesArray& aIndexes);
 
 
    /**
        Delete files from the archive.
 
        \param    aNames
            An array of filenames to delete;     
        \return
            \c false, if files could not be removed; \c true otherwise.
 
        \note 
            - Use the #SetCaseSensitivity method to set case-sensitivity.        
            - This method uses Find Fast (see <a href="kb">0610242025|findfast</a> for more information).
 
        \see
            <a href="kb">0610231944|delete</a>
        \see    
            RemoveFile
        \see
            RemoveFiles(CZipIndexesArray&)
        \see
            SetCallback
        \see
            EnableFindFast
    */
    bool RemoveFiles(const CZipStringArray& aNames);
 
    /**
        Shifts data inside the archive to make an empty space at the beginning of the archive. 
        Into this empty space, you can copy for example a self-extracting stub. To perform shifting, 
        the archive must be opened and no file must be opened for compression or extraction. This method 
        will not work with segmented archives or archives, for which #GetBytesBeforeZip method returns value
        different from \c 0.
 
        \param uOffset
            The number of bytes to shift the archive data by.
 
        \return
            \c true, if data was shifted successfully; \c false otherwise.
            
        \note
            Calls the CZipActionCallback::cbMoveData callback.
 
        \see
            <a href="kb">0610242241|convert</a>
        \see
            PrependData(CZipAbstractFile&, LPCTSTR)
        \see
            PrependData(LPCTSTR, LPCTSTR)
    */
    bool ShiftData(ZIP_SIZE_TYPE uOffset);
 
    /**
        Inserts data contained in the file pointed by the \a lpszFilePath path before the archive data.
        You can use this method for example to convert the archive into a self-extracting archive (store 
        a self-extracting stub inside \a lpszFilePath file).
        To perform prepending, the archive must be opened and no file must be opened for compression or extraction. This method 
        will not work with segmented archives or archives, for which #GetBytesBeforeZip method returns value
        different from \c 0.
 
        \param lpszFilePath
            The path of the file to prepend to the archive.
 
        \param lpszNewExt
            If it is not \c NULL, then the extension of the archive is changed to this value after prepending data.
            Under Linux/Max OS X, this method sets executable permission for the owner after prepending. If renaming is performed,
            then the archive is closed before it. If this value is \c NULL, the no renaming is performed and the archive stays opened.
 
        \return
            \c true, if data from \a lpszFilePath file was prepended (and optionally renamed) successfully; \c false otherwise.
            
        \note
            Calls the CZipActionCallback::cbMoveData callback.
 
        \see
            <a href="kb">0610242241|convert</a>
        \see
            ShiftData
        \see
            PrependData(CZipAbstractFile&, LPCTSTR)
    */
    bool PrependData(LPCTSTR lpszFilePath, LPCTSTR lpszNewExt = 
#ifdef _ZIP_SYSTEM_WIN
        _T("exe")
#else
        _T("")
#endif
        );
 
    /**
        Inserts data contained in the \a file before the archive data. You can use this method for example to convert
        the archive into a self-extracting archive (store a self-extracting stub inside \a file).
        To perform prepending, the archive must be opened and no file must be opened for compression or extraction. This method 
        will not work with segmented archives or archives, for which #GetBytesBeforeZip method returns value
        different from \c 0.
 
        \param file
            The file containing data to insert before the archive data. The file should be opened.
 
        \param lpszNewExt
            If it is not \c NULL, then the extension of the archive is changed to this value after prepending data.
            Under Linux/Max OS X, this method sets executable permission for the owner after prepending. If renaming is performed,
            then the archive is closed before it. If this value is \c NULL, the no renaming is performed and the archive stays opened
 
        \return
            \c true, if data from \a file was prepended successfully; \c false otherwise.
            
        \note
            Calls the CZipActionCallback::cbMoveData callback.
 
        \see
            <a href="kb">0610242241|convert</a>
        \see
            ShiftData
        \see
            PrependData(LPCTSTR, LPCTSTR)
    */
    bool PrependData(CZipAbstractFile& file, LPCTSTR lpszNewExt = NULL);
 
    /**
        Sets the global comment in the archive.
 
        \param    lpszComment
            The comment to set.
 
        \param codePage
            The code page to use.
 
        \return
            \c false, if the archive is closed or it is an existing segmented archive or any file is opened in the archive for extraction or compression;
            \c true otherwise.
 
                \see
            <a href="kb">0610231944|comment</a>
        \see
            GetGlobalComment
    */
    bool SetGlobalComment(LPCTSTR lpszComment, UINT codePage = ZIP_DEFAULT_CODE_PAGE);
 
 
    /**
        Returns the global comment for the archive.
 
        \return
            The global comment or an empty string if the archive is closed.
 
        \see
            <a href="kb">0610231944|comment</a>
        \see
            SetGlobalComment
    */
    CZipString GetGlobalComment()const ;
 
    
    /**
        Returns the path of the currently opened archive segment.
        \return
            The current volume's path or an empty string, if the archive is closed.
 
        \see
            <a href="kb">0610051553</a>
    */
    CZipString GetArchivePath()const;
 
    /**
        Returns the archive volume number currently being processed. The first volume has the number 1.
 
        This method is useful while working with a segmented archive in creation to find out
        how many parts were already created. To find out how many parts are in an existing segmented archive,
        use the #GetCentralDirInfo method.
 
        \return
            A one-based number of the current volume or 0, if there is no current volume (the archive is closed).
 
        \see
            <a href="kb">0610051553</a>
    */
    ZIP_VOLUME_TYPE GetCurrentVolume() const ;
    
    /**
        Case-sensitivity values used as the \a iCaseSensitive argument in the FindFile() method.
        The purpose of #ffCaseSens and #ffNoCaseSens is to temporarily change the default
        case-sensitivity for a single search. This is the reason, why these values cause the Find Fast 
        array (which is a more permanent solution) to be built with the opposite meaning. In these cases
        the array is not rebuilt if it was built already.
    */
    enum FFCaseSens
    {
        /**
            Uses the default case-sensitivity as set with the #SetCaseSensitivity method.
            If the Find Fast array was built before with a different case-sensitivity,
            it is rebuilt again, if it hasn't been built so far, it is built now with the
            default case-sensitivity.
        */
        ffDefault,
 
        /**
            Performs a case-sensitive search. If the CZipArchive is non-case-sensitive,
            a less effective search is performed. It does not rebuild the Find Fast array,
            but if the array hasn't been built yet, it is built now as \b non-case-sensitive.
            You can use \c SetCaseSensitivity(true) and then #ffDefault to build it as case-sensitive.
        */
        ffCaseSens,
 
        /**
            Performs a non-case-sensitive search. If the CZipArchive is case-sensitive,
            a less effective search is performed. It does not rebuild the Find Fast array,
             but if the array hasn't been built yet, it is build now as \b case-sensitive.
            You can use \c SetCaseSensitivity(false) and then #ffDefault to build it as non-case-sensitive.
        */
        ffNoCaseSens
    };
 
    /**
        Finds a file in the archive.    
        This method enables the Find Fast feature, if it is not enabled already.
 
        \param    lpszFileName
            The name of the file to be found in the archive. If the file in the archive is stored with the 
            path information, you must specify it here or set \a bFileNameOnly to \c true.
            Use the same path separators as they are defined for your system as default
            (\e "\" for Windows and \e "/" for Linux and Mac OS X).
 
        \param iCaseSensitive
            It can be one of the #FFCaseSens values.
 
        \param bFileNameOnly
            If \c true, the method tries to find a filename without a path (a less effective search is performed).
            If you wish to find a directory name, do not end it with a path separator.
            The path separator is required, if you set \a bFileNameOnly to \c false.
 
        \note 
            Use the #SetCaseSensitivity method to set the global case-sensitivity.
 
        \return
            The index of the file, if the file was found; \c ZIP_FILE_INDEX_NOT_FOUND if the file was not found.
 
        \see
            <a href="kb">0610242025|findfast</a>        
        \see
            EnableFindFast
    */
    ZIP_INDEX_TYPE FindFile(LPCTSTR lpszFileName, int iCaseSensitive = ffDefault, bool bFileNameOnly = false);
 
    /**
        Returns the information about the file with the given index.
        The data is copied to \a fhInfo. This may not be 
        optimal for querying large number of file. To avoid copying data, see the 
        #GetFileInfo(ZIP_INDEX_TYPE) method.
 
        \param    fhInfo
            The object to receive data.
 
        \param    uIndex
            A zero-based index of the file to get the information about.
 
        \return
            \c true if successful; \c false otherwise.
        \see
            <a href="kb">0610242128|file</a>
        \see
            GetFileInfo(ZIP_INDEX_TYPE)
        \see
            GetFileInfo(ZIP_INDEX_TYPE) const
        \see
            operator[](ZIP_INDEX_TYPE)            
        \see
            operator[](ZIP_INDEX_TYPE) const
    */
    bool GetFileInfo(CZipFileHeader& fhInfo, ZIP_INDEX_TYPE uIndex) const;
 
    /**
        Returns the information about the file with the given index.
        This method provides a direct access to the file data. Apart from the situations 
        described in <a href="kb">0610242128|file</a>, you should avoid modifications of 
        the returned object.
 
        \param    uIndex
            A zero-based index of the file to get the information about.
 
        \return
            A CZipFileHeader object that directly points to a central directory entry in memory;
            \c NULL if the archive is closed or there is no such index in the archive.
 
        \see
            <a href="kb">0610242128|file</a>
        \see
            GetFileInfo(CZipFileHeader&, ZIP_INDEX_TYPE) const
        \see
            GetFileInfo(ZIP_INDEX_TYPE) const
        \see
            operator[](ZIP_INDEX_TYPE)    
        \see
            operator[](ZIP_INDEX_TYPE) const
 
    */
    CZipFileHeader* GetFileInfo(ZIP_INDEX_TYPE uIndex);
 
    /**
        Returns the information about the file with the given index.
        This method provides a direct access to the file data. This method does not allow
        modification of the returned object.
 
        \param    uIndex
            A zero-based index of the file to get the information about.
 
        \return
            A CZipFileHeader object that directly points to a central directory entry in memory;
            \c NULL if the archive is closed or there is no such index in the archive.
 
        \see
            <a href="kb">0610242128|file</a>
        \see
            GetFileInfo(CZipFileHeader&, ZIP_INDEX_TYPE) const
        \see
            GetFileInfo(ZIP_INDEX_TYPE)
        \see
            operator[](ZIP_INDEX_TYPE)    
        \see
            operator[](ZIP_INDEX_TYPE) const
 
    */
    const CZipFileHeader* GetFileInfo(ZIP_INDEX_TYPE uIndex) const;
 
    /**
        Returns the information about the file with the given index.
        This method provides a direct access to the file data. Apart from the situations 
        described in <a href="kb">0610242128|file</a>, you should avoid modifications of 
        the returned object.
        \param    uIndex
            A zero-based index of the file to get the information about.
 
        \return
            A CZipFileHeader object that directly points to a central directory entry in memory;
            \c NULL if the archive is closed or there is no such index in the archive.
 
        \see
            <a href="kb">0610242128|file</a>
        \see
            GetFileInfo(CZipFileHeader&, ZIP_INDEX_TYPE) const
        \see
            GetFileInfo(ZIP_INDEX_TYPE)
        \see
            GetFileInfo(ZIP_INDEX_TYPE) const
        \see
            operator[](ZIP_INDEX_TYPE) const        
 
    */
    CZipFileHeader* operator[](ZIP_INDEX_TYPE uIndex)
    {
        return GetFileInfo(uIndex);
    }
 
    /**
        Returns the information about the file with the given index.
        This method provides a direct access to the file data. This method does not allow
        modification of the returned object.
 
        \param    uIndex
            A zero-based index of the file to get the information about.
 
        \return
            A CZipFileHeader object that directly points to a central directory entry in memory;
            \c NULL if the archive is closed or there is no such index in the archive.
 
        \see
            <a href="kb">0610242128|file</a>
        \see
            GetFileInfo(CZipFileHeader&, ZIP_INDEX_TYPE) const
        \see
            GetFileInfo(ZIP_INDEX_TYPE)
        \see
            GetFileInfo(ZIP_INDEX_TYPE) const
        \see
            operator[](ZIP_INDEX_TYPE)
    */
    const CZipFileHeader* operator[](ZIP_INDEX_TYPE uIndex) const
    {
        return GetFileInfo(uIndex);
    }
 
 
    /**
        Returns the number of files in the archive.
 
        \param    bOnlyFiles
            If \c true, directories are not included in the total count; otherwise all entries are included.
 
        \return
            The number of files in the archive.
            
        \see
            <a href="kb">0610242128|file</a>
    */
    ZIP_INDEX_TYPE GetCount(bool bOnlyFiles)
    {
        if (IsClosed())
            return 0;
 
        ZIP_INDEX_TYPE iTotalCount = GetCount();
        if (bOnlyFiles)
        {
            ZIP_INDEX_TYPE iCount = 0;
            for (ZIP_INDEX_TYPE i = 0; i < iTotalCount; i++)
            {
                if (!m_centralDir[i]->IsDirectory())
                    iCount++;
            }
            return iCount;
        }
        else
            return iTotalCount;
    }
 
    /**
        Returns the number of files in the archive.
 
        \return
            The number of files in the archive. 
            Note that depending on the ZipArchive compilation this may be an unsigned value or a signed value.
    */
    ZIP_INDEX_TYPE GetCount() const
    {
        return (ZIP_INDEX_TYPE) m_centralDir.GetCount();
    }
 
 
    /** 
        Calculates the actual size (in bytes) currently occupied by the archive.
 
        \return
            The sum of the sizes: the number of bytes already written to the file, the number of bytes in the write buffer and the whole size of the central directory.
            If the archive or a volume is closed, the return value is \c 0.
 
        \see
            <a href="kb">0610242128|archive</a>            
    */
    ZIP_SIZE_TYPE GetOccupiedSpace() const
    {
        if (IsClosed(true) || IsClosed(false))
        {
            ZIPTRACE("%s(%i) : ZipArchive or the current volume file is closed.\n");
            return 0;
        }
        return m_storage.GetOccupiedSpace() + m_centralDir.GetSize(true);
    }
 
    /**
        The values used in the CZipArchive::Close() method.
    */
    enum CloseAfterException
    {
        /**
            Normal closing. Use it, when no exception was thrown while processing the archive.
        */
        afNoException,
 
        /**
            Use when an exception was thrown.
            The #Close method doesn't write any data but performs necessary cleaning to reuse the 
            CZipArchive object for another archive processing.
        */
        afAfterException,
 
        /**    
            Use when an exception was thrown.
            The #Close method writes the central directory structure to the archive, 
            so that the archive should be usable.
        */
        afWriteDir
    };
 
    /**
        Closes the archive.
 
        \param    iAfterException
            One of the #CloseAfterException values.
 
        \param bUpdateTimeStamp
            If \c true, the method sets the modification date of the zip file to the date of the newest file in the archive.
            In a segmented archive, only the last segment file will have the time stamp updated.
            You can use this option even without performing any additional processing on the archive, just open and close the archive.
 
        \return
            The name of the last volume. It is useful when compressing split archives to know which file to use when opening the archive.
            The name is only returned when \a iAfterException is different from #afAfterException.
 
        \note
            Does not throw any exceptions, if \a iAfterException is set to the #afAfterException value.
 
        \see
            <a href="kb">0610222049</a>
        \see
            IsClosed
    */
    CString Close(int iAfterException = afNoException, bool bUpdateTimeStamp = false);
 
 
    /**
        Tests if the whole archive or the current volume is closed.
 
        \param    bArchive <BR>
            If \c true, test for the whole archive. If \c false, test for the current volume only.
 
        \return
            \c true if a file closed; \c false otherwise.
 
        \see
            Close
    */
    bool IsClosed(bool bArchive = true)const
    {
        return m_storage.IsClosed(bArchive);
    }
 
    /**
        Writes the central directory to the archive and flushes the internal buffers to the disk.
        After that the archive is finalized on the disk, but you can still modify it, if it is not a segmented archive.        
 
        \param bOnlyIfAuto
            If \c true, the archive will be finalized only when it is in the auto-finalize mode; \c false otherwise (default).
            This parameter is used mostly for internal purposes.
 
        \return
            \c true, if the archive was finalized; \c false otherwise.
 
        \note 
            - This method cannot be used on existing segmented archives - they are not modifiable.
            - If you have an archive with a huge central directory, calling this function frequently will degrade the performance.
            - This method will not execute, if there are any pending modifications (see #IsModified).
 
        \see
            <a href="kb">0610231446|finalize</a>        
        \see
            FlushBuffers
        \see
            SetAutoFinalize
        \see
            GetAutoFinalize
    */
    bool Finalize(bool bOnlyIfAuto = false);
 
    /**
        Writes internal buffers to the storage file and flushes the file buffers to the disk.
 
        \see
            <a href="kb">0610231446|finalize</a>
        \see
            Finalize
    */
    void FlushBuffers()
    {
        if (IsClosed())
        {
            ZIPTRACE("%s(%i) : ZipArchive should be opened first.\n");
            return;
        }
 
        m_storage.FlushBuffers();
    }
 
 
    /**
        Sets the CZipArchive object to call the Finalize() method after each operation that modifies the archive (apart from changing central extra fields).
        It is useful when you want to prevent the loss of data in case of the program crash - the zip file will then be finalized on the disk.
        Use it after opening the archive.
 
        \note 
        - You can set auto-finalize only for non-segmented archives.        
        - If you have an archive with a huge central directory, enabling auto-finalize will degrade the performance.
        - This method will have no effect, when there are any pending modifications (see #IsModified).
 
        \see
            <a href="kb">0610231446|finalize</a>
        \see
            Finalize    
        \see
            GetAutoFinalize
    */
    bool SetAutoFinalize(bool bAutoFinalize = true);
    
 
    /**
        Returns the current auto-finalize value.
 
        \return 
            The current auto-finalize value.
 
        \see
            <a href="kb">0610231446|finalize</a>
        \see
            SetAutoFinalize
        \see
            Finalize    
    */
    bool GetAutoFinalize()const {return m_bAutoFinalize;}
 
    /**
        Sets the system compatibility of the archive. Use it after opening the archive,
        but before adding a new file.
 
        \param iSystemComp
            The new system compatibility to use. It can be one of the ZipCompatibility::ZipPlatforms values.
 
        \return
            \c false, if the value \a iSystemComp is not supported 
            or it is not possible to set the value at this moment; \c true otherwise.
 
        \note
            If using the custom Unicode mode (see <a href="kb">0610051525|custom</a>) and the filename code page 
            is standard for the current system compatibility, the ZipArchive Library will change the filename 
            code page to be default for the new system compatibility.
 
        \see
            <a href="kb">0610231446|compatibility</a>
        \see
            GetSystemCompatibility
        \see
            CZipFileHeader::GetSystemCompatibility
        \see
            ZipCompatibility::ZipPlatforms
        \see
            ZipPlatform::GetSystemID
    */
    bool SetSystemCompatibility(int iSystemComp);
 
    /**
        Returns the system compatibility of the current archive.
 
        \return    
            One of the ZipCompatibility::ZipPlatforms values.
 
        \see
            <a href="kb">0610231446|compatibility</a>
        \see
            SetSystemCompatibility
        \see
            CZipFileHeader::SetSystemCompatibility
        \see
            ZipCompatibility::ZipPlatforms
        \see
            ZipPlatform::GetSystemID        
    */
    int GetSystemCompatibility() const {return m_iArchiveSystCompatib;}
 
    /**
        Returns the underlying archive storage object.
 
        \return
            The pointer to CZipStorage.
 
        \see
            CZipStorage
    */
    CZipStorage* GetStorage(){return &m_storage;}
 
#ifdef _ZIP_UNICODE_CUSTOM
        /**
        Sets the current settings that control storing of filenames and comments in the archive.
 
        \param settings
            The settings to set.
 
        \see
            <a href="kb">0610051525|custom</a>
        \see
            SetStringStoreSettings(UINT, bool, UINT)
        \see
            SetStringStoreSettings(UINT, bool)
        \see
            ResetStringStoreSettings
        \see
            GetStringStoreSettings        
    */
    void SetStringStoreSettings(const CZipStringStoreSettings& settings)
    {
        m_stringSettings = settings;
    }
 
    /**
        Sets the current settings that control storing of filenames and comments in the archive.
 
        \param uFileNameCodePage
            The code page for filenames.
    
        \param bStoreNameInExtraData
            If \c true, the encoded filenames are stored in central extra fields.
    
        \param uCommentCodePage
            The code page for comments.
 
        \see
            <a href="kb">0610051525|custom</a>
        \see
            SetStringStoreSettings(const CZipStringStoreSettings&)
        \see
            SetStringStoreSettings(UINT, bool)
        \see
            ResetStringStoreSettings
        \see
            GetStringStoreSettings        
    */
    void SetStringStoreSettings(UINT uFileNameCodePage, bool bStoreNameInExtraData, UINT uCommentCodePage)
    {
        m_stringSettings.Set(uFileNameCodePage, bStoreNameInExtraData, uCommentCodePage);
    }
 
    /**
        Sets the current settings that control storing of filenames and comments in the archive.
        The code page for comments stays the same when calling this method.
 
        \param uFileNameCodePage
            The code page for filenames.
    
        \param bStoreNameInExtraData
            If \c true, the encoded filenames are stored in central extra fields.
    
        \see
            <a href="kb">0610051525|custom</a>
        \see
            SetStringStoreSettings(const CZipStringStoreSettings&)
        \see
            SetStringStoreSettings(UINT, bool, UINT)
        \see
            ResetStringStoreSettings
        \see
            GetStringStoreSettings        
    */
    void SetStringStoreSettings(UINT uFileNameCodePage, bool bStoreNameInExtraData = false)
    {
        SetStringStoreSettings(uFileNameCodePage, bStoreNameInExtraData,  m_stringSettings.m_uCommentCodePage);
    }
    
    /**
        Sets the current settings that control storing of filenames and comments in the archive to their default values considering the 
        current system compatibility of the archive (see GetSystemCompatibility()).
 
        \see
            <a href="kb">0610051525|custom</a>
        \see
            SetStringStoreSettings(const CZipStringStoreSettings&)
        \see
            SetStringStoreSettings(UINT, bool, UINT)
        \see
            SetStringStoreSettings(UINT, bool)
        \see
            GetStringStoreSettings        
    */
    void ResetStringStoreSettings()
    {
        m_stringSettings.Reset(m_iArchiveSystCompatib);
    }
 
    /**
        Returns the current settings that control storing of filenames and comments in the archive.
    
        \return
            The current string store settings.
 
        \see
            <a href="kb">0610051525|custom</a>
        \see
            SetStringStoreSettings(const CZipStringStoreSettings&)
        \see
            SetStringStoreSettings(UINT, bool, UINT)
        \see
            SetStringStoreSettings(UINT, bool)
        \see
            ResetStringStoreSettings        
        \see
            CZipFileHeader::GetStringStoreSettings
     */
    CZipStringStoreSettings& GetStringStoreSettings()
    {
        return m_stringSettings;
    }
#endif
 
    /**
        The Unicode mode of the archive.
 
        \see
            <a href="kb">0610051525</a>
    */
    enum UnicodeMode
    {
        umNone        = 0x00, ///< No Unicode extensions are used.
#ifdef _ZIP_UNICODE_CUSTOM
        umCustom    = 0x04 ///< The custom Unicode support.
#endif
    };
 
    /**
        Sets the current Unicode mode.
 
        \param iMode
            The Unicode mode to set. It can be one or more of the #UnicodeMode values.
 
        \see
            <a href="kb">0610051525</a>
    */
    void SetUnicodeMode(int iMode){ m_centralDir.SetUnicodeMode(iMode); }
 
    /**
        Returns the current Unicode mode.
 
        \return
            The current Unicode mode. It can be one or more of the #UnicodeMode values.
 
        \see
            <a href="kb">0610051525</a>
    */
    int GetUnicodeMode() const { return m_centralDir.GetUnicodeMode(); }
 
    /**
        Enables or disables fast searching for files inside the archive using filenames.
 
        \see
            <a href="kb">0610242025|findfast</a>
        \see
            FindFile
        \see
            GetIndexes
        \see
            GetFindFastIndex
    */
    void EnableFindFast(bool bEnable = true);
 
 
    /**
        Allows to retrieve the order of sorted files after you enabled the Find Fast feature with the EnableFindFast() method.
       
       \param iFindFastIndex
            The index of the file in the sorted array.
 
       \return 
            The index of the file in the central directory. You can use the return value
            in other methods that require the file index (such as #GetFileInfo).
            This method returns \c -1, if you have not called 
            #EnableFindFast before or the archive is closed or the \a iFindFastIndex
            is out of range.
 
        \see
            <a href="kb">0610242025|findfast</a>        
        \see
            EnableFindFast
     */
    ZIP_INDEX_TYPE GetFindFastIndex(ZIP_INDEX_TYPE iFindFastIndex) const
    {
        if (IsClosed())
        {
            ZIPTRACE("CZipArchive::GetFindFastIndex: ZipArchive should be opened first.\n");
            return ZIP_FILE_INDEX_UNSPECIFIED;
        }
        
        return m_centralDir.GetFindFastIndex(iFindFastIndex);
    }
 
 
    /**
        Sets the temporary path used when compressing files and there is a need for a temporary archive.
        Temporary files are used when replacing or when compressing a segmented archive with the #zipsmCheckForEff flag.
        If the path is not set or it does not exists or there is not enough free space in it, 
        then the ZipArchive Library first tries the following folders
        in the given order for sufficient free space:
        \li system default temporary directory,
        \li the current directory.
 
        If all above fails, no temporary file is created and the compression is performed the usual way.
 
        \param lpszPath
            The path used for storing temporary files. Set it to \c NULL, to clear the temporary path and let the 
            ZipArchive Library figure it out (see above).
 
        \param bForce
            If \a lpszPath is not \c NULL and this parameter set to \c true
            the directory is created, if it doesn't exist. Otherwise the ZipArchive Library
            tries to figure out the location for temporary files by itself (see above).
 
        \see
            GetTempPath
        \see
            AddNewFile
        \see
            Smartness
    */
    void SetTempPath(LPCTSTR lpszPath = NULL, bool bForce = true);
 
    /**   
        Returns the current temporary path used when compressing files.
       
        \return
            The current temporary path.
 
        \see
            SetTempPath
     */
    CZipString GetTempPath()const 
    {
        return m_szTempPath;
    }
 
    /**
        The values used in the PredictFileNameInZip() method.
    */
    enum Predict
    {
    
        prDir,  ///< If \a lpszFilePath is a directory, appends a separator.
        prFile, ///< Treats \a lpszFilePath as a common file.
        prAuto  ///< Treats \a lpszFilePath as a directory only if it has a path separator appended.                
    };
 
    /**
       Predicts the filename as it would be stored in the archive, when given parameters would be used with 
       one of the AddNewFile() methods. The method takes into account the root path set with the #SetRootPath method. 
       You can use this method to eliminate duplicates before adding a list of files.
       
       \param lpszFilePath
            The file path, the same as CZipAddNewFileInfo::m_szFilePath.
       \param bFullPath
            The same as CZipAddNewFileInfo::m_bFullPath.
       \param iWhat
            One of the #Predict values to interpret \a lpszFilePath correctly.
       \return
            The filename as it would be stored in the archive.
     */
    CZipString PredictFileNameInZip(LPCTSTR lpszFilePath, bool bFullPath, int iWhat = prAuto)const ;
 
    /**
        Calculates the maximum number of bytes that the file represented by #CZipFileHeader would occupy in the current archive.
 
        You need to set the following members in the structure:
            \li File attributes (use CZipFileHeader::SetSystemAttr). It is for determining whether the file is a directory.
            You can use ZipPlatform::GetFileAttr.
            \li The filename as it would appear in the archive (use CZipFileHeader::SetFileName). You can use #PredictFileNameInZip.
            \li The compressed size of the file (use CZipFileHeader::m_uComprSize). You can use an uncompressed file size
            here for the maximum value estimate.
 
        Additionally you may set:
            - A file comment (use the CZipFileHeader::SetComment method).
            - Extra fields (use CZipFileHeader::m_aLocalExtraData and CZipFileHeader::m_aCentralExtraData).
 
        \param fh
            A template object pre-filled with data.
 
        \return
            The maximum number of bytes the file would occupy in the archive.
 
        \note
        - The method takes into account if the current archive is a segmented archive.
        - If the archive has a password set, the method assumes that the file would be stored encrypted in the archive (extra bytes may be added then depending on the encryption method).
        - This method calls CZipFileHeader::PrepareData
        - Zip64 only: The method takes into account the current file pointer position in the archive to determine the need for the Zip64 extensions 
            and updates CZipFileHeader::m_uVolumeStart and CZipFileHeader::m_uOffset.
        - The method does not take into account a situation when a file would be compressed, but mostly stored blocks would be emitted by the Huffman compression engine.
        In this case extra 5 bytes are added per a single stored block. You should remove the file and store it instead when it happens (see #zipsmCheckForEff).
 
        \see
            PredictMaximumFileSizeInArchive(LPCTSTR, bool)
    */
    ZIP_SIZE_TYPE PredictMaximumFileSizeInArchive(CZipFileHeader& fh);
 
     /**
        Calls the PredictMaximumFileSizeInArchive(CZipFileHeader&) method. 
        Before calling, fills the #CZipFileHeader structure with the filename as it 
        would appear in the archive and sets the proper file size (unless \a lpszFilePath is a directory).
 
        \param lpszFilePath
            The path to the file for which you want to predict the maximum size it would occupy.
 
        \param bFullPath 
            The same as CZipAddNewFileInfo::m_bFullPath.
 
        \return
            The maximum number of bytes the file would occupy in the archive.
 
        \see
            PredictMaximumFileSizeInArchive(CZipFileHeader&)
     */
    ZIP_SIZE_TYPE PredictMaximumFileSizeInArchive(LPCTSTR lpszFilePath, bool bFullPath);
    
 
    /**
        Checks if the filename of the given file will be duplicated in the archive, if added to the archive with the given parameters.
 
        \param lpszFilePath
            The file path. You normally use it in one of the #AddNewFile methods.
 
       \param bFullPath
            The same as CZipAddNewFileInfo::m_bFullPath.
 
        \param bFileNameOnly
            If \c true, the method assumes that the filename is duplicated if only the name part (no path)
            is the same (\a bFullPath is ignored), otherwise the whole filename with a path is taken into account.
 
        \param iWhat
            One of the #Predict values to interpret \a lpszFilePath correctly.
 
        \return
            The zero-based index of the file in the archive which filename would be duplicated, 
            or \c ZIP_FILE_INDEX_NOT_FOUND, if the filename would be unique.
    */
    ZIP_INDEX_TYPE WillBeDuplicated(LPCTSTR lpszFilePath, bool bFullPath, bool bFileNameOnly = false, int iWhat = prAuto);
 
    /**
       Predicts the full resulting filename with path after extraction. 
       The parameters (except for the first) are in the form you would pass
       to the #ExtractFile(ZIP_INDEX_TYPE, CZipAbstractFile&, bool, ZipPlatform::DeleteFileMode, CZipCompressor::COffsetsPair*, DWORD)
       The method takes into account the root path set with the #SetRootPath method.
 
       \param lpszFileNameInZip
            The filename of the file inside the archive (may be \c NULL if \a lpszNewName is not \c NULL).
 
       \param lpszPath
 
       \param bFullPath
 
       \param lpszNewName       
 
       \return
            The predicted resulting file path.
     */
    CZipString PredictExtractedFileName(LPCTSTR lpszFileNameInZip, LPCTSTR lpszPath, bool bFullPath, LPCTSTR lpszNewName = NULL)const ;
 
 
/**
        Removes the root path from \a zpc.
 
        \param    zpc
            The path to have the common beginning removed from.
 
        \see
            SetRootPath
*/
    CZipString TrimRootPath(CZipPathComponent& zpc) const ;
 
    /**
        Removes \a lpszBeginning from the beginning of \a szPath. Both argument are
        considered to be paths - they must match up to the path separator.
       
        \param lpszBeginning
            The beginning to remove.
 
        \param szPath
            The path to have the beginning removed.
 
        \param pCompareFunction 
            The compare function used (see #m_pZipCompare).
 
        \return
            \c true, if the path beginning was removed; \c false otherwise.
     */
    static bool RemovePathBeginning(LPCTSTR lpszBeginning, CZipString& szPath, ZIPSTRINGCOMPARE pCompareFunction);
 
    /**
        Sets the default archive case-sensitivity. The default CZipArchive case-sensitivity depends
        on the system and is set as follows:
            \li on Windows:    \c false
            \li on other platforms:    \c true
            
        Calling this method affects the following methods:
 
        - #FindFile
        - #GetIndexes
        - #FindMatches        
        - #EnableFindFast
        - #TrimRootPath
        - #RemoveFiles(const CZipStringArray&)
            
        \param bCaseSensitive
            The case-sensitivity to be used.
 
        \note
            Set it before using one of the mentioned methods or leave it as it was set by default.
    */
    void SetCaseSensitivity(bool bCaseSensitive) 
    {
        m_bCaseSensitive = bCaseSensitive;
        m_pZipCompare = GetCZipStrCompFunc(bCaseSensitive);
    }
 
    /*
        Returns the current case sensitivity.
        
        \return 
            \c true, if the archive is case-sensitive; \c false otherwise.
 
        \see
            SetCaseSensitivity
    */
    bool GetCaseSensitivity() const
    {
        return m_bCaseSensitive;
    }
 
    /**
        Returns the central directory information.
        \param info
            The object to retrieve information data.
 
        \see
            GetCentralDirSize
    */
    void GetCentralDirInfo(CZipCentralDir::CInfo& info)const;
    
 
    /**
        Returns the central directory size.
 
        \param bWhole
            If \c true, the return value includes the size of file headers.
 
        \return
            The size of the central directory.
 
        \see
            GetCentralDirInfo
    */
    ZIP_SIZE_TYPE GetCentralDirSize(bool bWhole = true) const
    {
        if (IsClosed())
        {
            ZIPTRACE("%s(%i) : ZipArchive is closed.\n");
            return 0;
        }
        return m_centralDir.GetSize(bWhole);
    }
 
    /**
        Returns the value indicating whether the archive can be modified.
        An archive is read-only when it is an existing segmented archive
        or it was opened with the #zipOpenReadOnly flag.
 
        \return
            \c true if the archive is read-only; \c false otherwise.
    */
    bool IsReadOnly(){return m_storage.IsReadOnly();} const
 
    /**
        Sets the number of extra bytes that are present before the actual archive in the archive file.
        The library usually tries to automatically calculate this value, but this may not be possible
        under some conditions.
        
        \param uCount
            The number of bytes before the actual archive.
                
        \see
            GetBytesBeforeZip
     */
    void SetBytesBeforeZip(ZIP_SIZE_TYPE uCount = 0)
    {
        if (!IsClosed())
        {
            ZIPTRACE("%s(%i) : Set it before opening the archive.\n");
            return;
        }
        m_storage.m_uBytesBeforeZip = uCount;
    }
 
    /**
        Returns the number of extra bytes that are present before the actual archive in the archive file.
 
        \return
            The number of bytes before the actual archive.
        \see
            SetBytesBeforeZip
     */
    ZIP_SIZE_TYPE GetBytesBeforeZip() const
    {
        return m_storage.m_uBytesBeforeZip;
    }
 
    /**
        The values describing various archive consistency checks that the library performs. 
        Instruct the library to skip selected checks using the #SetIgnoredConsistencyChecks method.
    */
    enum ConsistencyCheck
    {        
        checkNone,                            ///< If used in the #SetIgnoredConsistencyChecks method, examines all possible inconsistencies in an archive.
        checkCRC                = 0x0001,    ///< Verifies CRC after decompression. Use it when working with Java <sup><small>TM</small></sup> Archives (jar). The CRC check is performed using CRC written in a central header when closing a file after extraction.
        checkLocalMethod        = 0x0002,    ///< Verifies that the compression method written in a local header matches the compression method written in a central header.
        checkLocalSizes            = 0x0004,    ///< Verifies that sizes of compressed and uncompressed data written in a local header match their counterparts in a central header. The compressed size in the local header is always ignored, if it is \c 0.
        checkLocalCRC            = 0x0008,    ///< Verifies that the CRC written in a local header matches the CRC written in a central header. 
        checkLocalFlag            = 0x0010,    ///< Verifies that the general purpose flag value written in a local header matches its counterpart written in a central header. 
        checkLocalAll            = checkLocalMethod | checkLocalSizes | checkLocalCRC | checkLocalFlag, ///< Examines all possible inconsistencies between central and local headers. These verifications are performed when opening a file for extraction. 
        checkDataDescriptor        = 0x0100,    ///< Verifies that values written in extra data descriptor match values written in central header. This verification is performed when closing a file after extraction, but only if a file has a data descriptor (see CZipFileHeader::IsDataDescriptor()). Ignored by default (it is consistent with behavior of popular archivers).
        checkVolumeEntries        = 0x0200,    ///< Verifies that the number of volumes and entries are correctly reported.
        checkDecryptionVerifier = 0x0400,    ///< Verifies control bytes during CRC32 and AES decryption initialization.
        checkAll                = checkCRC | checkLocalAll | checkDataDescriptor | checkVolumeEntries | checkDecryptionVerifier, ///< Logical sum of all possible verifications.
        checkIgnoredByDefault    = checkDataDescriptor | checkVolumeEntries ///< Checks that are ignored by default by the ZipArchive Library
    };
 
    /**
        Flags for workarounding various problems in archives.
 
        \see
            SetSpecialFlags
    */
    enum SpecialFlags
    {
        sfNone,
        /**         
            Forces reading all headers from the central directory, even if the number of files reported by the archive is different. 
            By default, the ZipArchive Library reads only the number of headers declared by the archive. Call this method before opening an archive. 
 
            This method is useful when dealing with archives created with
            external software that puts more files inside an archive that it is permitted by the zip format. Such a situation
            can take place with archives created with e.g. BOMArchiveHelper (Mac OS X utility), when the number of files exceeds 65,535.
        */
        sfExhaustiveRead,
    };
 
    /**
        Sets the consistency checks to ignore while processing the archive. Allows opening archives which are not entirely 
        consistent, but nevertheless the compressed data is correct. The level is reset to #checkIgnoredByDefault when
        opening or creating an archive.
        \param iLevel
            The consistency check. It can be one or more of the #ConsistencyCheck values.
 
        \see
            ConsistencyCheck
        \see
            GetIgnoredConsistencyChecks
     */
    void SetIgnoredConsistencyChecks(int iLevel = checkIgnoredByDefault)
    {
        if (IsClosed())
        {
            ZIPTRACE("%s(%i) : Set it after opening the archive.\n");
            return;
        }
        m_centralDir.m_iIgnoredChecks = iLevel;
    }
    
    /**
        Returns the currently ignored consistency checks. It can be one or more of the #ConsistencyCheck values.
 
        \see 
            SetIgnoredConsistencyChecks
    */
    int GetIgnoredConsistencyChecks() const
    {
        return m_centralDir.m_iIgnoredChecks;
    }
 
    /**
        Sets special flags. It can be one or more of the #SpecialFlags values.
 
        \see
            GetSpecialFlags
    */
    void SetSpecialFlags(int iSpecialFlags)
    {
        if (!IsClosed())
        {
            ZIPTRACE("%s(%i) : Set it before opening the archive.\n");
            return;
        }
        m_centralDir.m_specialFlags = iSpecialFlags;
    }
 
    /**
        Returns the currently set special flags. It can be one or more of the #SpecialFlags values.
 
        \see
            SetSpecialFlags
    */
    int GetSpecialFlags() const
    {
        return m_centralDir.m_specialFlags;
    }
 
    /**
        Finds indexes of the files, which filenames match the specified pattern. The indexes are stored in the \a ar array.
        The indexes can be used then e.g. in deleting or extracting files.
       
       \param lpszPattern
            The pattern to match. The case-sensitivity of the pattern 
            is set to the global archive case-sensitivity (set with the #SetCaseSensitivity method).
 
       \param ar
            The array which will contain the resulting indexes. The contents of \a ar are not cleared, but the 
            indexes are appended to it.
 
       \param bFullPath
            \li If \c true, the method matches the filename with path (if present) of the file.
            If the file is a directory, end it with a path separator or use a pattern that will recognize it.
            \li If \c false, the method matches only the name of the file. If the file is a directory, 
            do not end it with a path separator.
 
        \see
            <a href="kb">0610242025|match</a>
        \see
            SetCaseSensitivity
        \see
            ZipArchiveLib::CWildcard
       
     */
    void FindMatches(LPCTSTR lpszPattern, CZipIndexesArray& ar, bool bFullPath = true);
    
    /**
        The mode of committing changes.
 
        \see
            <a href="kb">0610231944|commit</a>
    */
    enum CommitMode
    {
        cmManual, ///< Changes will be committed when the #CommitChanges method is called or when closing the archive.
        cmOnChange ///< Changes will be committed immediately after they occur.
    };
 
    /**
        Sets the commit mode.
 
        \param iCommitMode
            The mode to set. It can be one of the #CommitMode values.
 
        \see
            <a href="kb">0610231944|commit</a>
        \see 
            GetCommitMode
        \see
            CommitChanges
    */
    void SetCommitMode(int iCommitMode = cmOnChange) 
    {    
        m_iCommitMode = iCommitMode;
    }
 
    /**
        Returns the current commit mode.
 
        \return
            The current commit mode. It can be one of the #CommitMode values.
 
        \see
            <a href="kb">0610231944|commit</a>
        \see 
            SetCommitMode
        \see
            CommitChanges
    */
    int GetCommitMode() const {return m_iCommitMode;}
 
    /**
        Writes pending changes to the archive.
 
        \return
            \c true, if changes were written successfully; \c false, if the current state of the archive is invalid for this method to be called.
 
        \note
            This method is also called when closing the archive regardless of the current commit mode.
 
        
        \see
            <a href="kb">0610231944|commit</a> (Committing Modification Changes)
        \see 
            <a href="kb">0610231944|cache</a> (Controlling Windows System File Cache)
        \see 
            SetCommitMode
        \see 
            GetCommitMode
        \see
            IsModified
    */
    bool CommitChanges();
 
    /**
        Returns the value indicating whether there are any pending changes in the archive to be committed.
 
        \return
            \c true, if there are changes left to be committed; \c false otherwise.
 
        \see
            <a href="kb">0610231944|commit</a>
        \see
            CommitChanges
    */
    bool IsModified() const {return m_centralDir.IsAnyFileModified();}
    
    /**
        Removes the central directory from the archive. 
        You may then modify central extra fields and write the central directory back to the archive afterwards (use the #Close method).
 
        \return 
            \c true, if the central directory was successfully removed; \c false otherwise.
 
        \see
            <a href="kb">0610242300|central</a>
    */
    bool RemoveCentralDirectoryFromArchive();
 
    /**
        Reads the local header information of the file with the given index.
 
        \param uIndex
            The index of the file for which to update the local information.
 
        \return 
            \c true, if the information was successfully updated; \c false otherwise.
 
        
        \see
            <a href="kb">0610231944|time</a>
        \see
            OverwriteLocalHeader
    */
    bool ReadLocalHeader(ZIP_INDEX_TYPE uIndex);
 
    /**
        Writes the local header information of the file with the given index back to the archive.
 
        \param uIndex
            The index of the file for which to write the local information.
 
        \return 
            \c true, if the information was successfully written; \c false otherwise.
 
        
        \see
            <a href="kb">0610231944|time</a>
        \see
            ReadLocalHeader
    */
    bool OverwriteLocalHeader(ZIP_INDEX_TYPE uIndex);
 
    /**
        Retrieves the current compressor. The type of the compressor depends on the compression method 
        used for compressing or decompressing data.
 
        \see
            SetCompressionMethod
    */
    const CZipCompressor* GetCurrentCompressor() const
    {
        return m_pCompressor;
    }
 
    /**
        Returns the value indicating whether the archive can be modified.
 
        \param bAllowNewSegmented
            If \c true, new segmented archives can be modified; \c false otherwise.
 
        \param bNeedsClosed
            If \c true, the archive that has a file opened cannot be modified; \c false otherwise.
 
        \return
            \c true, if the archive can be modified; \c false otherwise.
    */
    bool CanModify(bool bAllowNewSegmented = false, bool bNeedsClosed = true)
    {
        if (IsClosed())
        {
            ZIPTRACE("%s(%i) : ZipArchive is closed.\n");
            return false;
        }
 
        if (m_storage.IsReadOnly())
        {
            return false;
        }
        
        if (m_storage.IsNewSegmented() && !bAllowNewSegmented)
        {
            return false;
        }
        
        if (bNeedsClosed && m_iFileOpened)
        {
            ZIPTRACE("%s(%i) : The file cannot be open during modifications.\n");
            return false;
        }
 
        return true;
    }
 
    bool IsPasswordSet() const
    {
        return m_pszPassword.GetSize() > 0;
    }
 
    
    /**
        Resets the current volume while extracting a span archive when an invalid disk was inserted.
 
        \return 
            \c true, if the method succeeded; \c false, if the current state of the archive is invalid for this method to be called.
 
        
        \see
            <a href="kb">0610051553|spanRecoverExtract</a>        
    */
    bool ResetCurrentVolume();
 
    /**
        Returns the value indicating whether the given file is a zip archive. 
        To execute quickly, this method does not read a whole central directory, 
        but also does not guarantee that the archive is not corrupted.
 
        \param lpszPathName
            The path of the file to examine.
 
        \return 
            \c true, if the archive is a zip archive; \c false otherwise.        
 
    */
    static bool IsZipArchive(LPCTSTR lpszPathName);
 
    /**
        Returns the value indicating whether the given file is a zip archive. 
        To execute quickly, this method does not read a whole central directory, 
        but also does not guarantee that the archive is not corrupted.
 
        \param af
            The archive file to examine.
 
        \param bAutoClose
            If \c true, the \a af file will be closed by this method; \c false otherwise.
 
        \return 
            \c true, if the archive is a zip archive; \c false otherwise.        
 
    */
    static bool IsZipArchive(CZipAbstractFile& af, bool bAutoClose = false);
 
    /**
        If \c true, the drive letter is removed from the filename stored inside the archive when adding
        a new file to the archive or extracting an existing one.
        It affects #AddNewFile, #ExtractFile, #PredictFileNameInZip, #PredictExtractedFileName,
        #WillBeDuplicated methods. The default value is \c true.
    */
    bool m_bRemoveDriveLetter;
    
protected:
    
    /**
        Reads the local header information of the file with the given index.
 
        \param uIndex
            The index of the file for which to update the local information.
 
    */
    void ReadLocalHeaderInternal(ZIP_INDEX_TYPE uIndex)
    {
        // update sizes of the local filename and the extra field - they may differ from the ones in the central directory
        GetFileInfo(uIndex)->ReadLocal(&m_centralDir);
    }
 
    /**
        See the description of #EncryptFiles.
 
        \param pIndexes
 
        \return 
            \c false, if the files could not be encrypted; \c true otherwise.
 
        
        \see
            EncryptFiles
    */
    bool EncryptFilesInternal(CZipIndexesArray* pIndexes);
 
 
    /**
        See the description of #OpenNewFile(CZipFileHeader&, int, LPCTSTR)
 
        \param header
        \param iLevel
        \param lpszFilePath
        \param uReplaceIndex
            For the internal use only.
        \see
            OpenNewFile(CZipFileHeader&, int, LPCTSTR)
    */
    bool OpenNewFile(CZipFileHeader & header, int iLevel, LPCTSTR lpszFilePath, ZIP_INDEX_TYPE uReplaceIndex);
    
    /**
        Holds currently set callback objects.
    */
    ZipArchiveLib::CZipCallbackProvider m_callbacks;
    
 
    /**
        Writes the central directory notifying a callback object if available.
    */
    void WriteCentralDirectory(bool bFlush = true);
 
    /**
        The value set with #SetCaseSensitivity.
    */
    bool m_bCaseSensitive;
    
 
    /**
        A pointer to a method used to compare strings. 
        Can point to \c Compare, \c CompareNoCase, \c Collate or \c CollateNoCase method.        
    */
    ZIPSTRINGCOMPARE m_pZipCompare;
 
 
    /**
        Physical layer of the archive.
        \see
            CZipStorage
    */
    CZipStorage m_storage;
 
    /**
        The central directory object.
        \see
            CZipCentralDir
    */
    CZipCentralDir m_centralDir;
 
    /**
        The open mode of the current file inside the archive.    
    */
    enum OpenFileType
    {
        extract = -1,    ///< A file is opened for extraction.
        nothing,        ///< There is no file inside the archive opened.
        compress        ///< A new file is opened for compression.
    };
    
    /**
        Takes one of the CZipArchive::OpenFileType enum values.
    */
    int m_iFileOpened;
 
    /**
        The value set with SetAutoFinalize().
    */
    bool m_bAutoFinalize;
 
    /**
        The value set with SetCommitMode().
    */
    int m_iCommitMode;
 
    /**
        The value set with SetRootPath().
    */
    CZipString m_szRootPath;
 
    /**
        The value set with SetTempPath().
    */
    CZipString m_szTempPath;
 
 
    /**
        Opens the archive in the given mode.
        Called by #Open(LPCTSTR, int, ZIP_SIZE_TYPE) and #Open(CZipAbstractFile&, int, bool).
        \param    iMode
            The mode.
            */
    void OpenInternal(int iMode);
 
    /**
        Initializes the archive during opening.
 
        \param iArchiveSystCompatib
            The system's compatibility of the archive.
 
        \param pSource
            If not \c NULL, then it specifies the central directory for sharing.
 
    */
    void InitOnOpen(int iArchiveSystCompatib, CZipCentralDir* pSource = NULL);
 
    /**
        The value set with #SetSystemCompatibility.
    */
    int m_iArchiveSystCompatib;
 
    /**
        The value set with #SetPassword.
    */
    CZipAutoBuffer m_pszPassword;
 
    /**
        Returns the file currently opened for compression or decompression.
        \return
            The currently opened file or \c NULL, if there is no file opened.
    */
    CZipFileHeader* CurrentFile();
 
    /**
        Releases the current cryptograph.
    */
    void ClearCryptograph()
    {
        if (m_pCryptograph)
        {
            delete m_pCryptograph;
            m_pCryptograph = NULL;
        }
    }
 
    /**
        Creates a new cryptograph. You can override this method and implement your own cryptograph.
 
        \param iEncryptionMethod
            The requested encryption method.
 
        \see
            CZipCryptograph::EncryptionMethod
    */
    virtual void CreateCryptograph(int iEncryptionMethod)
    {
        if (m_pCryptograph != NULL)
            if (m_pCryptograph->CanHandle(iEncryptionMethod))
                return;
 
        ClearCryptograph();
        m_pCryptograph = CZipCryptograph::CreateCryptograph(iEncryptionMethod);
    }
 
    /**
        The current cryptograph.
    */
    CZipCryptograph* m_pCryptograph;
 
    /**
        Releases the current compressor.
    */
    void ClearCompressor()
    {
        if (m_pCompressor)
        {
            delete m_pCompressor;
            m_pCompressor = NULL;
        }
    }
 
    /**
        Creates a new compressor. You can override this method and implement your own compressor.
 
        \param uMethod
            The requested data compression method.
 
        \see 
            CZipCompressor::CompressionMethod
    */
    virtual void CreateCompressor(WORD uMethod)
    {
        if (m_pCompressor == NULL || !m_pCompressor->CanProcess(uMethod))
        {
            ClearCompressor();
            m_pCompressor = CZipCompressor::CreateCompressor(uMethod, &m_storage);
        }
        m_pCompressor->UpdateOptions(m_compressorsOptions);
    }
 
    /**
        The current compressor.
    */
    CZipCompressor* m_pCompressor;
 
    /**
        The value set with #SetEncryptionMethod.
    */
    int m_iEncryptionMethod;
 
    /**
        The value set with #SetCompressionMethod.
    */
    WORD m_uCompressionMethod;
    
 
    /**
        A helper buffer used during various IO operations.
 
        \see 
            m_iBufferSize
        \see
            SetAdvanced
    */
    CZipAutoBuffer m_pBuffer;
 
    /**
        The size of the #m_pBuffer buffer. Set it before opening the archive.
        It is usually set with the #SetAdvanced method
        (specify this value as the second argument).
 
        \see
            SetAdvanced
    */
    DWORD m_iBufferSize;
 
#ifdef _ZIP_UNICODE_CUSTOM
    /**
        The value set with the SetStringStoreSettings() method.
    */
    CZipStringStoreSettings m_stringSettings;
#endif
    
private:
    CZipCompressor::COptionsMap m_compressorsOptions;
    void Initialize();
    void MakeSpaceForReplace(ZIP_INDEX_TYPE iReplaceIndex, ZIP_SIZE_TYPE uTotal, LPCTSTR lpszFileName);
 
    void MovePackedFiles(ZIP_SIZE_TYPE uStartOffset, ZIP_SIZE_TYPE uEndOffset, ZIP_SIZE_TYPE uMoveBy, CZipActionCallback* pCallback, bool bForward = false, bool bLastCall = true);
    
    bool RemoveLast(bool bRemoveAnyway = false);
 
    bool GetFromArchive(CZipArchive& zip, ZIP_INDEX_TYPE uIndex, LPCTSTR lpszNewFileName, ZIP_INDEX_TYPE iReplaceIndex, bool bKeepSystComp, CZipActionCallback* pCallback);
 
    bool UpdateReplaceIndex(ZIP_INDEX_TYPE& iReplaceIndex);
    
    void ThrowError(int err, LPCTSTR lpszFilePath = NULL) const;        
 
    void InitBuffer()
    {
        m_pBuffer.Allocate(m_iBufferSize);
    }
    void ReleaseBuffer()
    {
        m_pBuffer.Release();
    }
};
 
#if (_MSC_VER > 1000) && (defined ZIP_HAS_DLL)
    #pragma warning (pop)
#endif
 
#endif // !defined(ZIPARCHIVE_ZIPARCHIVE_DOT_H)