Subversion Repositories recyclebinunit

Rev

Rev 100 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 100 Rev 101
1
unit RecBinUnitLowLvl;
1
unit RecBinUnitLowLvl;
2
 
2
 
3
interface
3
interface
4
 
4
 
5
uses
5
uses
6
  Windows;
6
  Windows;
7
 
7
 
8
type
8
type
9
  PRbInfoHeader = ^TRbInfoHeader;
9
  PRbInfoHeader = ^TRbInfoHeader;
10
  TRbInfoHeader = packed record
10
  TRbInfoHeader = packed record
11
    format: DWORD;         // Version of the info file
11
    format: DWORD;         // Version of the info file
12
                           // Win95 (without IE4):   00 00 00 00
12
                           // Win95 (without IE4):   00 00 00 00
13
                           // Win NT4:               02 00 00 00   (Win96/Cairo?)
13
                           // Win NT4:               02 00 00 00   (Win96/Cairo?)
14
                           // Win95 (with IE4), 98:  04 00 00 00
14
                           // Win95 (with IE4), 98:  04 00 00 00
15
                           // Win Me, 2000, XP:      05 00 00 00   (NT4+IE4, NT5?)
15
                           // Win Me, 2000, XP:      05 00 00 00   (NT4+IE4, NT5?)
16
    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
16
    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
17
    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
17
    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
18
    recordLength: DWORD;   // 0x181  =  ANSI records
18
    recordLength: DWORD;   // 0x118  =  ANSI records
19
                           // 0x320  =  Unicode records
19
                           // 0x320  =  Unicode records
20
    totalSize: DWORD;      // sum of all "originalSize" values;
20
    totalSize: DWORD;      // sum of all "originalSize" values;
21
                           // 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
21
                           // 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
22
  end;
22
  end;
23
 
23
 
24
type
24
type
25
  // Windows 95:      INFO file with TRbInfoRecordA; Folder deletion NOT possible
25
  // Windows 95:      INFO file with TRbInfoRecordA; Folder deletion NOT possible
26
  // Windows 95 +IE4: INFO2 file with TRbInfoRecordA; Folder deletion possible
26
  // Windows 95 +IE4: INFO2 file with TRbInfoRecordA; Folder deletion possible
27
  PRbInfoRecordA = ^TRbInfoRecordA;
27
  PRbInfoRecordA = ^TRbInfoRecordA;
28
  TRbInfoRecordA = packed record
28
  TRbInfoRecordA = packed record
29
    sourceAnsi: array[0..MAX_PATH-1] of AnsiChar; // 260 characters (including NUL terminator)
29
    sourceAnsi: array[0..MAX_PATH-1] of AnsiChar; // 260 characters (including NUL terminator)
30
    recordNumber: DWORD;
30
    recordNumber: DWORD;
31
    sourceDrive: DWORD; // 0=A, 1=B, 2=C, ..., Z=25, @=26 (@ is the "Network home drive" of the Win95 time)
31
    sourceDrive: DWORD; // 0=A, 1=B, 2=C, ..., Z=25, @=26 (@ is the "Network home drive" of the Win95 time)
32
    deletionTime: FILETIME;
32
    deletionTime: FILETIME;
33
    originalSize: DWORD; // Size occupied on disk. Not the actual file size.
33
    originalSize: DWORD; // Size occupied on disk. Not the actual file size.
34
                         // INFO2, for folders: The whole folder size with contents
34
                         // INFO2, for folders: The whole folder size with contents
35
  end;
35
  end;
36
 
36
 
37
type
37
type
38
  // Windows NT4:   INFO file with TRbInfoRecordW; Folder deletion possible
38
  // Windows NT4:   INFO file with TRbInfoRecordW; Folder deletion possible
39
  // Windows 2000+: INFO2 file with TRbInfoRecordW; Folder deletion possible
39
  // Windows 2000+: INFO2 file with TRbInfoRecordW; Folder deletion possible
40
  PRbInfoRecordW = ^TRbInfoRecordW;
40
  PRbInfoRecordW = ^TRbInfoRecordW;
41
  TRbInfoRecordW = packed record
41
  TRbInfoRecordW = packed record
42
    sourceAnsi: array[0..MAX_PATH-1] of AnsiChar; // 260 characters (including NUL terminator)
42
    sourceAnsi: array[0..MAX_PATH-1] of AnsiChar; // 260 characters (including NUL terminator)
43
    recordNumber: DWORD;
43
    recordNumber: DWORD;
44
    sourceDrive: DWORD; // 0=A, 1=B, 2=C, ..., Z=25, @=26 (@ is the "Network home drive" of the Win95 times)
44
    sourceDrive: DWORD; // 0=A, 1=B, 2=C, ..., Z=25, @=26 (@ is the "Network home drive" of the Win95 times)
45
    deletionTime: FILETIME;
45
    deletionTime: FILETIME;
46
    originalSize: DWORD;
46
    originalSize: DWORD;
47
    sourceUnicode: array[0..MAX_PATH-1] of WideChar; // 260 characters (including NUL terminator)
47
    sourceUnicode: array[0..MAX_PATH-1] of WideChar; // 260 characters (including NUL terminator)
48
  end;
48
  end;
49
 
49
 
50
type
50
type
51
  // Introduced in Windows Vista
51
  // Introduced in Windows Vista
52
  PRbVistaRecord1 = ^TRbVistaRecord1;
52
  PRbVistaRecord1 = ^TRbVistaRecord1;
53
  TRbVistaRecord1 = packed record
53
  TRbVistaRecord1 = packed record
54
    version: int64; // Always 01 00 00 00 00 00 00 00
54
    version: int64; // Always 01 00 00 00 00 00 00 00
55
    originalSize: int64;
55
    originalSize: int64;
56
    deletionTime: FILETIME;
56
    deletionTime: FILETIME;
57
    sourceUnicode: array[0..MAX_PATH-1] of WideChar;
57
    sourceUnicode: array[0..MAX_PATH-1] of WideChar;
58
  end;
58
  end;
59
 
59
 
60
type
60
type
61
  // Introduced somewhere in a Win10 release
61
  // Introduced somewhere in a Win10 release
62
  PRbVistaRecord2Head = ^TRbVistaRecord2Head;
62
  PRbVistaRecord2Head = ^TRbVistaRecord2Head;
63
  TRbVistaRecord2Head = packed record
63
  TRbVistaRecord2Head = packed record
64
    version: int64; // Always 02 00 00 00 00 00 00 00
64
    version: int64; // Always 02 00 00 00 00 00 00 00
65
    originalSize: int64;
65
    originalSize: int64;
66
    deletionTime: FILETIME;
66
    deletionTime: FILETIME;
67
    (* sourceUnicode: BSTR; *)
-
 
68
    sourceCountChars: DWORD; // including NUL
67
    sourceCountChars: DWORD; // including NUL
69
    //sourceUnicode: array[0..sourceCountChars-1] of WideChar;
68
    //sourceUnicode: array[0..sourceCountChars-1] of WideChar;
70
  end;
69
  end;
71
 
70
 
72
type
71
type
73
  // Windows 95 (tested with 4.00.950 and Win95b) + Windows NT 4
72
  // Windows 95 (tested with 4.00.180 and above) + Windows NT 4
74
  // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\BitBucket: PurgeInfo (Binary)
73
  // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\BitBucket: PurgeInfo (Binary)
75
  // TODO: also explain this in FORMAT.md ?
74
  // TODO: also explain this in FORMAT.md ?
76
  PRbWin95PurgeInfo = ^TRbWin95PurgeInfo;
75
  PRbWin95PurgeInfo = ^TRbWin95PurgeInfo;
77
  TRbWin95PurgeInfo = packed record
76
  TRbWin95PurgeInfo = packed record
78
    cbSize: DWORD; // 0x48 = 72
77
    cbSize: DWORD; // 0x48 = 72
79
    bGlobalSettings: BOOL;
78
    bGlobalSettings: BOOL;
80
    percentDrive: array['A'..'Z'] of WORD; // 0x00..0x64 = 0%..100%
79
    percentDrive: array['A'..'Z'] of WORD; // 0x00..0x64 = 0%..100%
81
    percentHomedrive: WORD;
80
    percentHomedrive: WORD;
82
    percentGlobal: WORD;
81
    percentGlobal: WORD;
83
    NukeOnDeleteBits: DWORD; // Flags "Nuke on delete"
82
    NukeOnDeleteBits: DWORD; // Flags "Nuke on delete"
84
                             // Bit 0 (LSB): Drive A
83
                             // Bit 0 (LSB): Drive A
85
                             // Bit 1: Drive B
84
                             // Bit 1: Drive B
86
                             // ...
85
                             // ...
87
                             // Bit 25: Drive Z
86
                             // Bit 25: Drive Z
88
                             // Bit 26: "Network home drive"
87
                             // Bit 26: "Network home drive"
89
                             // Bit 27: Global
88
                             // Bit 27: Global
90
                             // Bit 28..31 (MSB) unused
89
                             // Bit 28..31 (MSB) unused
91
    dummy: DWORD; // "dummy to force a new size" ?! (TODO: was there a Windows version that had a smaller size (0x44), i.e. a different version of this record?)
90
    dummy: DWORD; // "dummy to force a new size" ?! But the 0x48 format was already in Win95 beta build 180, which is the first known build with this recycle bin implementation!
92
  end;
91
  end;
93
 
92
 
94
implementation
93
implementation
95
 
94
 
96
end.
95
end.
97
 
96