-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfile-attributes.spf
149 lines (139 loc) · 6.05 KB
/
file-attributes.spf
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
\ Ôàéë: file-attributes.spf
\ Àâòîð: VoidVolker
\ Äàòà: 25/08/2013 09:40
\ Âåðñèÿ: 1.01
\ Îïèñàíèå: Óñòàíîâêà è ïðîâåðêà àáñîëþòíî âñåõ àòòðèáóòîâ ôàéëîâ
\ * Êîíñòàíòû àòòðèáóòîâ ôàéëîâ - ïåðâûå ïÿòü çàêîììåíòèðîâàííûõ óæå åñòü â ííêðîíå, ïîñëåäíÿÿ - íå èñïîëüçóåòñÿ
\ 0x20 CONSTANT FILE_ATTRIBUTE_ARCHIVE
0x800 CONSTANT FILE_ATTRIBUTE_COMPRESSED \ To set a file's compression state, use the DeviceIoControl function with the FSCTL_SET_COMPRESSION operation.
0x40 CONSTANT FILE_ATTRIBUTE_DEVICE
\ 0x10 CONSTANT FILE_ATTRIBUTE_DIRECTORY
0x4000 CONSTANT FILE_ATTRIBUTE_ENCRYPTED
\ 0x2 CONSTANT FILE_ATTRIBUTE_HIDDEN
0x8000 CONSTANT FILE_ATTRIBUTE_INTEGRITY_STREAM
0x80 CONSTANT FILE_ATTRIBUTE_NORMAL
0x2000 CONSTANT FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
0x20000 CONSTANT FILE_ATTRIBUTE_NO_SCRUB_DATA
0x1000 CONSTANT FILE_ATTRIBUTE_OFFLINE
\ 0x1 CONSTANT FILE_ATTRIBUTE_READONLY
0x400 CONSTANT FILE_ATTRIBUTE_REPARSE_POINT
0x200 CONSTANT FILE_ATTRIBUTE_SPARSE_FILE
\ 0x4 CONSTANT FILE_ATTRIBUTE_SYSTEM
0x100 CONSTANT FILE_ATTRIBUTE_TEMPORARY
\ 0x10000 CONSTANT FILE_ATTRIBUTE_VIRTUAL
WINAPI: DeviceIoControl KERNEL32.DLL
0x0009C040 CONSTANT FSCTL_SET_COMPRESSION
\ 0x0000 CONSTANT COMPRESSION_FORMAT_NONE
\ 0x0001 CONSTANT COMPRESSION_FORMAT_DEFAULT
\ 0x0002 CONSTANT COMPRESSION_FORMAT_LZNT1 \ Ò.ê. åäèíñòâåííûé âàðèàíò - ýòîò ôîðìàò ñæàòèÿ èñïîëüçóåòñÿ âñåãäà
\ * Óñòàíîâêà àòòðèáóòîâ
: SET-ARCHIVE \ ( a u -- )
S>ZTEMP FILE_ATTRIBUTE_ARCHIVE SWAP SetFileAttributesA DROP ;
: SET-COMPRESSED \ ( a u -- )
R/W OPEN-FILE IF DROP EXIT THEN \ Îòêðûâàåì ôàéë â ðåæèìå çàïèñè, èíà÷å - âûõîäèì
>R
1 PAD ! \ COMPRESSION_FORMAT_DEFAULT
PAD CELL+ OFF
\ FSCTL_SET_COMPRESSION
\ PAD 4 0 0 PAD CELL+ 0
0 PAD CELL+
0 0
4 PAD
FSCTL_SET_COMPRESSION R@
DeviceIoControl
R> CLOSE-FILE DROP
; \ S" C:\r.txt" SET-COMPRESSED
\ : SET-DEVICE \ ( a u -- )
\ S>ZTEMP FILE_ATTRIBUTE_DEVICE SWAP SetFileAttributesA DROP ;
\ : SET-DIRECTORY \ ( a u -- )
\ S>ZTEMP FILE_ATTRIBUTE_DIRECTORY SWAP SetFileAttributesA DROP ;
\ : SET-ENCRYPTED \ ( a u -- )
\ S>ZTEMP FILE_ATTRIBUTE_ENCRYPTED SWAP SetFileAttributesA DROP ;
: SET-HIDDEN \ ( a u -- )
S>ZTEMP FILE_ATTRIBUTE_HIDDEN SWAP SetFileAttributesA DROP ;
: SET-INTEGRITY-STREAM \ ( a u -- )
S>ZTEMP FILE_ATTRIBUTE_INTEGRITY_STREAM SWAP SetFileAttributesA DROP ;
: SET-NORMAL \ ( a u -- )
S>ZTEMP FILE_ATTRIBUTE_NORMAL SWAP SetFileAttributesA DROP ;
: SET-NOT-CONTENT-INDEXED \ ( a u -- )
S>ZTEMP FILE_ATTRIBUTE_NOT_CONTENT_INDEXED SWAP SetFileAttributesA DROP ;
: SET-NO-SCRUB-DATA \ ( a u -- )
S>ZTEMP FILE_ATTRIBUTE_NO_SCRUB_DATA SWAP SetFileAttributesA DROP ;
: SET-OFFLINE \ ( a u -- )
S>ZTEMP FILE_ATTRIBUTE_OFFLINE SWAP SetFileAttributesA DROP ;
: SET-READONLY \ ( a u -- )
S>ZTEMP FILE_ATTRIBUTE_READONLY SWAP SetFileAttributesA DROP ;
\ : SET-REPARSE-POINT \ ( a u -- )
\ S>ZTEMP FILE_ATTRIBUTE_REPARSE_POINT SWAP SetFileAttributesA DROP ;
\ : SET-SPARSE-FILE \ ( a u -- )
\ S>ZTEMP FILE_ATTRIBUTE_SPARSE_FILE SWAP SetFileAttributesA DROP ;
: SET-SYSTEM \ ( a u -- )
S>ZTEMP FILE_ATTRIBUTE_SYSTEM SWAP SetFileAttributesA DROP ;
: SET-TEMPORARY \ ( a u -- )
S>ZTEMP FILE_ATTRIBUTE_TEMPORARY SWAP SetFileAttributesA DROP ;
\ * Ïðîâåðêà àòòðèáóòîâ ôàéëà
: FILE-ARCHIVE? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_ARCHIVE AND 0<> ;
: FILE-COMPRESSED? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_COMPRESSED AND 0<> ;
: FILE-DEVICE? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_DEVICE AND 0<> ;
: FILE-DIRECTORY? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_DIRECTORY AND 0<> ;
: FILE-ENCRYPTED? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_ENCRYPTED AND 0<> ;
: FILE-HIDDEN? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_HIDDEN AND 0<> ;
: FILE-INTEGRITY-STREAM? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_INTEGRITY_STREAM AND 0<> ;
: FILE-NORMAL? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_NORMAL AND 0<> ;
: FILE-NOT-CONTENT-INDEXED? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_NOT_CONTENT_INDEXED AND 0<> ;
: FILE-NO-SCRUB-DATA? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_NO_SCRUB_DATA AND 0<> ;
: FILE-OFFLINE? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_OFFLINE AND 0<> ;
: FILE-READONLY? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_READONLY AND 0<> ;
: FILE-REPARSE-POINT? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_REPARSE_POINT AND 0<> ;
: FILE-SPARSE-FILE? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_SPARSE_FILE AND 0<> ;
: FILE-SYSTEM? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_SYSTEM AND 0<> ;
: FILE-TEMPORARY? \ ( a u -- ? )
S>ZTEMP GetFileAttributesA FILE_ATTRIBUTE_TEMPORARY AND 0<> ;
\ * Ïðîâåðêà àòòðèáóòîâ ôàéëà â öèêëà FOR-FILES
\ : IS-ARCHIVE? \ ( -- ? )
\ FILE_ATTRIBUTE_ARCHIVE FF-ATTRIB? ;
: IS-COMPRESSED? \ ( -- ? )
FILE_ATTRIBUTE_COMPRESSED FF-ATTRIB? ;
: IS-DEVICE? \ ( -- ? )
FILE_ATTRIBUTE_DEVICE FF-ATTRIB? ;
\ : IS-DIRECTORY? \ ( -- ? )
\ FILE_ATTRIBUTE_DIRECTORY FF-ATTRIB? ;
: IS-ENCRYPTED? \ ( -- ? )
FILE_ATTRIBUTE_ENCRYPTED FF-ATTRIB? ;
\ : IS-HIDDEN? \ ( -- ? )
\ FILE_ATTRIBUTE_HIDDEN FF-ATTRIB? ;
: IS-INTEGRITY-STREAM? \ ( -- ? )
FILE_ATTRIBUTE_INTEGRITY_STREAM FF-ATTRIB? ;
: IS-NORMAL? \ ( -- ? )
FILE_ATTRIBUTE_NORMAL FF-ATTRIB? ;
: IS-NOT-CONTENT-INDEXED? \ ( -- ? )
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED FF-ATTRIB? ;
: IS-NO-SCRUB-DATA? \ ( -- ? )
FILE_ATTRIBUTE_NO_SCRUB_DATA FF-ATTRIB? ;
: IS-OFFLINE? \ ( -- ? )
FILE_ATTRIBUTE_OFFLINE FF-ATTRIB? ;
\ : IS-READONLY? \ ( -- ? )
\ FILE_ATTRIBUTE_READONLY FF-ATTRIB? ;
: IS-REPARSE-POINT? \ ( -- ? )
FILE_ATTRIBUTE_REPARSE_POINT FF-ATTRIB? ;
: IS-SPARSE-FILE? \ ( -- ? )
FILE_ATTRIBUTE_SPARSE_FILE FF-ATTRIB? ;
\ : IS-SYSTEM? \ ( -- ? )
\ FILE_ATTRIBUTE_SYSTEM FF-ATTRIB? ;
: IS-TEMPORARY? \ ( -- ? )
FILE_ATTRIBUTE_TEMPORARY FF-ATTRIB? ;