Determine if a file is a directory inside a zip archive

I read zip files according to the specification and get information for each file from the central directory. From the headers I read:

#define VERSION_NEEDED_OFSSET 6

UINT16 versionNeeded = (UINT16)*(zipFile + VERSION_NEEDED_OFSSET);

So, I pinned some files as well as several directories, and when I got the directory information, I got versionNeeded = 0x000a

From the documentation I read:

The minimum supported version of the ZIP specification for file extraction, as shown above. This value is based on the specific format that the ZIP program MUST support in order to be able to extract the file. If multiple functions are applied to a file, the minimum version MUST be installed on the one that matters the most. New or change functions that affect the published format specification will be implemented using higher version numbers than the last published value to avoid conflict.

4.4.3.2. Current versions of the minimum features are listed below:

1.0 - Default value

1.1 - File is a volume label

2.0 - A file is a folder (directory)

zip, ? , .

+4
1

Ok. - , - 38,

:

4.4.15 : (4 ) - (. ", " ). MS-DOS, - MS-DOS. , .

UINT32 external_attributes = (UINT32)*(zipFile + 38);

MSDN.

, external_attributes :

if(external_attributes == 0x10) //FILE_ATTRIBUTE_DIRECTORY
0

Source: https://habr.com/ru/post/1653428/


All Articles