Subversion Repositories recyclebinunit

Rev

Rev 100 | Rev 103 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 100 Rev 101
Line 7... Line 7...
7
 
7
 
8
- Windows 95 native:	`C:\RECYCLED\INFO` (with ANSI records, folder deletion is NOT possible, format `00 00 00 00`)
8
- Windows 95 native:	`C:\RECYCLED\INFO` (with ANSI records, folder deletion is NOT possible, format `00 00 00 00`)
9
- Windows 95+IE4, 98SE:	`C:\RECYCLED\INFO2` (with ANSI records, folder deletion is possible, format `04 00 00 00`)
9
- Windows 95+IE4, 98SE:	`C:\RECYCLED\INFO2` (with ANSI records, folder deletion is possible, format `04 00 00 00`)
10
- Windows Me:		`C:\RECYCLED\INFO2` (with ANSI records, folder deletion is possible, format `05 00 00 00`)
10
- Windows Me:		`C:\RECYCLED\INFO2` (with ANSI records, folder deletion is possible, format `05 00 00 00`)
11
- Windows Vista+:	`C:\$RECYCLE.BIN\$I...`
11
- Windows Vista+:	`C:\$RECYCLE.BIN\$I...`
-
 
12
- Windows 95 (Beta 58s)	`<WinDir>\DESKTOP\RECYCLE.BIN` (a normal folder with the deleted files. No index, no renamed files). In beta build 122, the recycle bin was removed and re-added in beta build 180 with the INFO-format we know from the RTM release.
12
 
13
 
13
### NTFS drives:
14
### NTFS drives:
14
 
15
 
15
- Windows NT4:		`C:\RECYCLER\<UserSID>\INFO` (with Unicode records, folder deletion is possible, format `02 00 00 00`)
16
- Windows NT4:		`C:\RECYCLER\<UserSID>\INFO` (with Unicode records, folder deletion is possible, format `02 00 00 00`)
16
- Windows 2000, XP:	`C:\RECYCLER\<UserSID>\INFO2` (with Unicode records, folder deletion is possible, format `05 00 00 00`)
17
- Windows 2000, XP:	`C:\RECYCLER\<UserSID>\INFO2` (with Unicode records, folder deletion is possible, format `05 00 00 00`)
Line 22... Line 23...
22
 
23
 
23
INFO2 is written by Win95 with Internet Explorer 4 shell extensions, Win98, WinMe (with ANSI records), Win2000, and WinXP (with Unicode records).
24
INFO2 is written by Win95 with Internet Explorer 4 shell extensions, Win98, WinMe (with ANSI records), Win2000, and WinXP (with Unicode records).
24
 
25
 
25
Since some Windows version combinations mix up ANSI records and Unicode records (e.g. Win95+IE4 and Win2000), these Windows versions break the recycle bin information file of each other.
26
Since some Windows version combinations mix up ANSI records and Unicode records (e.g. Win95+IE4 and Win2000), these Windows versions break the recycle bin information file of each other.
26
 
27
 
27
INFO and INFO2 is the index file containing all information about the deleted files. The data files are renamed to `Dxy.ext` (`x` replaced with the drive letter, `y` being a dynamic length integer, `ext` being replaced with the file name extension).
28
INFO and INFO2 is the index file containing all information about the deleted files. The data files are renamed to `Dxyyy.ext` (`x` replaced with the drive letter, `yyy` being a dynamic length integer, `ext` being replaced with the file name extension).
28
 
29
 
29
### Header
30
### Header
30
 
31
 
31
    type
-
 
32
      PRbInfoHeader = ^TRbInfoHeader;
-
 
33
      TRbInfoHeader = packed record
32
| offset (hex) | size (dec) |  type | description |
34
        format: DWORD;         // Version of the info file
33
|--------------|------------|-------|-------------|
35
                               // Win95 (without IE4):   00 00 00 00
-
 
36
                               // Win NT4:               02 00 00 00   (Win96/Cairo?)
-
 
37
                               // Win95 (with IE4), 98:  04 00 00 00
-
 
38
                               // Win Me, 2000, XP:      05 00 00 00   (NT4+IE4, NT5?)
34
| 0000         | 4          | DWORD | Version of the info file<br>`00 00 00 00` = Win95 (without IE4)<br>`02 00 00 00` = Win NT4 (Win96/Cairo?)<br>`04 00 00 00` = Win95 (with IE4), Win98<br>`05 00 00 00` = Win Me, 2000, WinXP (NT4+IE4, NT5?) | 
39
        totalEntries: DWORD;   // Only Win95 (without IE4) and Win NT4, other OS versions will use the registry instead and might write information on WM_ENDSESSION for compatibility reasons
35
| 0004         | 4          | DWORD | Total entries. Only Win95 (without IE4) and Win NT4, other OS versions will use the registry instead and might write information on WM_ENDSESSION for compatibility reasons. | 
40
        nextPossibleID: DWORD; // Only Win95 (without IE4) and Win NT4, other OS versions will use the registry instead and might write information on WM_ENDSESSION for compatibility reasons
36
| 0008         | 4          | DWORD | Next possible ID. Only Win95 (without IE4) and Win NT4, other OS versions will use the registry instead and might write information on WM_ENDSESSION for compatibility reasons. | 
41
        recordLength: DWORD;   // 0x181  =  ANSI records
-
 
42
                               // 0x320  =  Unicode records
37
| 000C         | 4          | DWORD | Item record length<br>0x118 = ANSI records<br>0x320 = Unicode records | 
43
        totalSize: DWORD;      // sum of all "originalSize" values;
-
 
44
                               // Only Win95 (without IE4) and Win NT4, other OS versions will use the registry instead and might write information on WM_ENDSESSION for compatibility reasons
38
| 0010         | 4          | DWORD | Total size (sum of all original sizes of the files). Only Win95 (without IE4) and Win NT4, other OS versions will use the registry instead and might write information on WM_ENDSESSION for compatibility reasons. | 
45
      end;
-
 
46
 
39
 
47
### ANSI record (Win95, Win98, WinMe)
40
### ANSI record (Win95, Win98, WinMe)
48
 
41
 
49
When a file is deleted, the first byte of `sourceAnsi` will be filled with a zero byte,
42
When a file is deleted, the first byte of the original filename will be set to a zero byte,
50
making the zero-terminated string empty. This way, the record is marked as deleted
43
making the zero-terminated string empty. This way, the record is marked as deleted
51
and the INFO/INFO2 file does not need to be reorganized.
44
and the INFO/INFO2 file does not need to be reorganized.
52
 
45
 
53
    type
-
 
54
      // Windows 95:      INFO file with TRbInfoRecordA; Folder deletion NOT possible
46
Windows 95:      INFO file with ANSI record; Folder deletion NOT possible
55
      // Windows 95 +IE4: INFO2 file with TRbInfoRecordA; Folder deletion possible
47
Windows 95 +IE4: INFO2 file with ANSI record; Folder deletion possible
-
 
48
 
56
      PRbInfoRecordA = ^TRbInfoRecordA;
49
| offset (hex) | size (dec) |  type           | description |
57
      TRbInfoRecordA = packed record
50
|--------------|------------|-----------------|-------------|
58
        sourceAnsi: array[0..MAX_PATH-1] of AnsiChar; // 260 characters (including NUL terminator)
51
| 0000         | 260        | char[MAX_PATH]  | Original file name and path in ANSI characters. 260 characters (including NUL terminator). Empty string if file was deleted. | 
59
        recordNumber: DWORD;
52
| 0104         | 4          | DWORD           | Record number | 
60
        sourceDrive: DWORD; // 0=A, 1=B, 2=C, ..., Z=25, @=26 (@ is the "Network home drive" of the Win95 time)
53
| 0108         | 4          | DWORD           | Source drive; 0=A, 1=B, 2=C, ..., Z=25, @=26 (@ is the "Network home drive" of the Win95 times) | 
61
        deletionTime: FILETIME;
-
 
62
        originalSize: DWORD; // Size occupied on disk. Not the actual file size.
54
| 010C         | 8          | FILETIME        | Deletion time | 
63
                             // INFO2, for folders: The whole folder size with contents
55
| 0114         | 4          | DWORD           | Size occupied on disk. Not the actual file size.<br>INFO2, for folders: The whole folder size with contents | 
64
      end;
-
 
65
 
56
 
66
### Unicode record (WinNT4, Win2000, WinXP)
57
### Unicode record (WinNT4, Win2000, WinXP)
67
 
58
 
68
When a file is deleted, the first byte of `sourceAnsi` will be filled with a zero byte,
59
When a file is deleted, the first byte of the original filename will be set to a zero byte,
69
making the zero-terminated string empty. This way, the record is marked as deleted
60
making the zero-terminated string empty. This way, the record is marked as deleted
70
and the INFO/INFO2 file does not need to be reorganized.
61
and the INFO/INFO2 file does not need to be reorganized.
71
 
62
 
72
    type
-
 
73
      // Windows NT4:   INFO file with TRbInfoRecordW; Folder deletion possible
63
Windows NT4:   INFO file with Unicode record; Folder deletion possible
74
      // Windows 2000+: INFO2 file with TRbInfoRecordW; Folder deletion possible
64
Windows 2000+: INFO2 file with Unicode record; Folder deletion possible
-
 
65
 
75
      PRbInfoRecordW = ^TRbInfoRecordW;
66
| offset (hex) | size (dec) |  type           | description |
76
      TRbInfoRecordW = packed record
67
|--------------|------------|-----------------|-------------|
77
        sourceAnsi: array[0..MAX_PATH-1] of AnsiChar; // 260 characters (including NUL terminator)
68
| 0000         | 260        | char[MAX_PATH]  | Original file name and path in ANSI characters. 260 characters (including NUL terminator). Empty string if file was deleted. | 
78
        recordNumber: DWORD;
69
| 0104         | 4          | DWORD           | Record number | 
79
        sourceDrive: DWORD; // 0=A, 1=B, 2=C, ..., Z=25, @=26 (@ is the "Network home drive" of the Win95 time)
70
| 0108         | 4          | DWORD           | Source drive; 0=A, 1=B, 2=C, ..., Z=25, @=26 (@ is the "Network home drive" of the Win95 times) | 
80
        deletionTime: FILETIME;
71
| 010C         | 8          | FILETIME        | Deletion time | 
81
        originalSize: DWORD;
72
| 0114         | 4          | DWORD           | Original size |
82
        sourceUnicode: array[0..MAX_PATH-1] of WideChar; // 260 characters (including NUL terminator)
73
| 0118         | 520        | wchar[MAX_PATH] | Original file name and path in Unicode characters. 260 characters (including NUL terminator) | 
83
      end;
-
 
84
 
74
 
85
## $I... files of Windows Vista and above
75
## $I... files of Windows Vista and above
86
 
76
 
87
Beginning with Windows Vista, each deleted file gets its own information record. The information record ("index file") has the name `$Ixxxxxx.ext` while the data file is renamed to `$Rxxxxxx.ext` (`xxxxxx` replaced with a random `[0-9A-Z]` string and `ext` replaced with the file name extension).
77
Beginning with Windows Vista, each deleted file gets its own information record. The information record ("index file") has the name `$Ixxxxxx.ext` while the data file is renamed to `$Rxxxxxx.ext` (`xxxxxx` replaced with a random `[0-9A-Z]` string and `ext` replaced with the file name extension).
88
 
78
 
89
### Version 1 (Introduced in Windows Vista)
79
### Version 1 (Introduced in Windows Vista)
90
 
80
 
91
    type
-
 
92
      // Introduced in Windows Vista
81
| offset (hex) | size (dec) |  type           | description |
93
      PRbVistaRecord1 = ^TRbVistaRecord1;
82
|--------------|------------|-----------------|-------------|
94
      TRbVistaRecord1 = packed record
-
 
95
        version: int64; // Always 01 00 00 00 00 00 00 00
83
| 0000         | 8          | int64           | Version, always `01 00 00 00 00 00 00 00` |
96
        originalSize: int64;
84
| 0008         | 8          | uint64          | Original size | 
97
        deletionTime: FILETIME;
85
| 0010         | 8          | FILETIME        | Deletion time | 
98
        sourceUnicode: array[0..MAX_PATH-1] of WideChar;
86
| 0018         | 520        | wchar[MAX_PATH] | Original file name and path in Unicode characters. 260 characters (including NUL terminator) | 
99
      end;
-
 
100
 
87
 
101
### Version 2 (Introduced somewhere in a Windows 10 release)
88
### Version 2 (Introduced somewhere in a Windows 10 release)
102
 
89
 
103
    type
-
 
104
      // Introduced somewhere in a Win10 release
90
| offset (hex) | size (dec) |  type           | description |
105
      PRbVistaRecord2Head = ^TRbVistaRecord2Head;
91
|--------------|------------|-----------------|-------------|
106
      TRbVistaRecord2Head = packed record
-
 
107
        version: int64; // Always 02 00 00 00 00 00 00 00
92
| 0000         | 8          | int64           | Version, always `02 00 00 00 00 00 00 00` |
108
        originalSize: int64;
93
| 0008         | 8          | uint64          | Original size | 
109
        deletionTime: FILETIME;
94
| 0010         | 8          | FILETIME        | Deletion time | 
110
        (* sourceUnicode: BSTR; *)
-
 
111
        sourceCountChars: DWORD; // including NUL
95
| 0018         | 4          | DWORD           | Original file name and path: Count of Unicode characters, including NUL terminator | 
112
        //sourceUnicode: array[0..sourceCountChars-1] of WideChar;
96
| 001C         | 2*n        | wchar[]         | Original file name and path: Zero terminated Unicode string |
113
      end;
-