Subversion Repositories recyclebinunit

Rev

Rev 100 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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