Subversion Repositories recyclebinunit

Compare Revisions

No changes between revisions

Regard whitespace Rev 81 → Rev 82

/trunk/Recycle Bin Data Analysis/Funktionell/Vista Example
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/trunk/Recycle Bin Data Analysis/Funktionell/Vista Example Version 1
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/Recycle Bin Data Analysis/Funktionell/Vista Example Version 2
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/Recycle Bin Unit v2/Changelog.txt
1,6 → 1,10
 
=== Changelog RecBinUnit v2 ===
 
2022-06-30
+ Added support for $Ixxx "Vista" format 2 files (added somewhere in a Windows 10 build)
The difference towards $Ixxx "Vista" format 1 files is that the filename is not limited to MAX_PATH anymore. (New limit 0xFFFFFFFD)
 
2016-11-01
+ Fixed memory leak in SID-Unit (thanks to Mikkao for finding this bug)
 
/trunk/Recycle Bin Unit v2/RecBinUnit2.pas
5,7 → 5,7
// E-MAIL: info@daniel-marschall.de //
// Web: www.daniel-marschall.de & www.viathinksoft.de //
////////////////////////////////////////////////////////////////////////////////////
// Revision: 01 NOV 2016 //
// Revision: 30 JUN 2022 //
// This unit is freeware, but please link to my website if you are using it! //
////////////////////////////////////////////////////////////////////////////////////
// Successfully tested with: //
18,7 → 18,8
// Windows 2003 Server EE SP1 //
// Windows Vista //
// Windows 7 //
// Windows 10 //
// Windows 10 (version 1 and version 2 format) //
// Windows 11 //
////////////////////////////////////////////////////////////////////////////////////
 
// Delphi 7 Compatibility: (TODO: compiler switches)
54,7 → 55,7
Windows, SysUtils, Classes, ContNrs, ShellAPI, Registry, Messages, Math;
 
const
RECBINUNIT_VERSION = '2016-07-17';
RECBINUNIT_VERSION = '2022-06-30';
 
RECYCLER_CLSID: TGUID = '{645FF040-5081-101B-9F08-00AA002F954E}';
NULL_GUID: TGUID = '{00000000-0000-0000-0000-000000000000}';
365,8 → 366,8
TSHQueryRecycleBin = function(pszRootPath: LPCTSTR; var pSHQueryRBInfo: TSHQueryRBInfo): HRESULT; stdcall;
TGetVolumeNameForVolumeMountPoint = function(lpszVolumeMountPoint: LPCTSTR; lpszVolumeName: LPTSTR; cchBufferLength: DWORD): BOOL; stdcall;
TSHEmptyRecycleBin = function(Wnd: HWND; pszRootPath: PChar; dwFlags: DWORD): HRESULT; stdcall;
TSHGetSettings = procedure(var lpss: SHELLSTATE; dwMask: DWORD) stdcall;
TSHGetSetSettings = procedure(var lpss: SHELLSTATE; dwMask: DWORD; bSet: BOOL) stdcall;
TSHGetSettings = procedure(var lpss: SHELLSTATE; dwMask: DWORD); stdcall;
TSHGetSetSettings = procedure(var lpss: SHELLSTATE; dwMask: DWORD; bSet: BOOL); stdcall;
 
function GetDriveGUID(driveLetter: Char; var guid: TGUID): DWORD;
var
695,12 → 696,9
try
fs.Seek(0, soFromBeginning);
 
if fs.Size = SizeOf(TRbVistaRecord) then
begin
if SameText(ExtractFileName(AFile), '$I'+id) then
begin
result := TRbVistaItem.Create(fs, AFile, id);
end;
end
else
begin
803,14 → 801,9
try
fs.Seek(0, soFromBeginning);
 
if fs.Size = SizeOf(TRbVistaRecord) then
if SameText(copy(ExtractFileName(AFile), 1, 2), '$I') then
begin
testID := ExtractFileName(AFile);
if SameText(copy(testID, 1, 2), '$I') then
testID := copy(testID, 3, Length(testID)-2)
else
testID := ''; // Just in case the user wants to read a single Vista file, but without the $I name
 
testID := copy(testID, 3, Length(testID)-2);
list.Add(TRbVistaItem.Create(fs, AFile, testID));
end
else
1500,17 → 1493,44
 
procedure TRbVistaItem.ReadFromStream(stream: TStream);
var
r: TRbVistaRecord;
r1: TRbVistaRecord1;
r2: TRbVistaRecord2Head;
r2SourceUnicode: array of WideChar;
version: DWORD;
begin
stream.ReadBuffer(r, SizeOf(r));
stream.ReadBuffer(version, SizeOf(version));
 
FSourceAnsi := AnsiString(r.sourceUnicode); // Invalid chars are automatically converted into '?'
FSourceUnicode := r.sourceUnicode;
if version = 1 then
begin
stream.Seek(0, soBeginning);
stream.ReadBuffer(r1, SizeOf(r1));
FSourceAnsi := AnsiString(r1.sourceUnicode); // Invalid chars are automatically converted into '?'
FSourceUnicode := WideString(r1.sourceUnicode);
FID := ''; // will be added manually (at the constructor)
FSourceDrive := AnsiChar(r.sourceUnicode[1]);
FDeletionTime := FileTimeToDateTime(r.deletionTime);
FOriginalSize := r.originalSize;
FSourceDrive := AnsiChar(r1.sourceUnicode[1]);
FDeletionTime := FileTimeToDateTime(r1.deletionTime);
FOriginalSize := r1.originalSize;
end
else if version = 2 then
begin
stream.Seek(0, soBeginning);
stream.ReadBuffer(r2, SizeOf(r2));
 
SetLength(r2SourceUnicode, 2*(r2.SourceCountChars-1));
stream.Read(r2SourceUnicode[0], 2*(r2.sourceCountChars-1));
 
FSourceAnsi := AnsiString(WideString(r2sourceUnicode)); // Invalid chars are automatically converted into '?'
FSourceUnicode := WideString(r2sourceUnicode);
FID := ''; // will be added manually (at the constructor)
FSourceDrive := AnsiChar(r2sourceUnicode[1]);
FDeletionTime := FileTimeToDateTime(r2.deletionTime);
FOriginalSize := r2.originalSize;
end
else
begin
raise Exception.CreateFmt('Invalid Vista index format version %d', [version]);
end;
end;
 
function TRbVistaItem.DeleteFile: boolean;
var
/trunk/Recycle Bin Unit v2/RecBinUnitLowLvl.pas
52,9 → 52,9
end;
 
type
PRbVistaRecord = ^TRbVistaRecord;
TRbVistaRecord = record
signature: int64; // Always 01 00 00 00 00 00 00 00 ?
PRbVistaRecord1 = ^TRbVistaRecord1;
TRbVistaRecord1 = record
version: int64; // Always 01 00 00 00 00 00 00 00
originalSize: int64;
deletionTime: FILETIME;
sourceUnicode: array[0..MAX_PATH-1] of WideChar;
61,6 → 61,16
end;
 
type
PRbVistaRecord2Head = ^TRbVistaRecord2Head;
TRbVistaRecord2Head = record
version: int64; // Always 02 00 00 00 00 00 00 00
originalSize: int64;
deletionTime: FILETIME;
sourceCountChars: DWORD; // including NUL
//sourceUnicode: array[0..sourceCountChars+1] of WideChar;
end;
 
type
// Windows 95 + Windows NT 4
// HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\BitBucket: PurgeInfo (Binary)
PRbWin95PurgeInfo = ^TRbWin95PurgeInfo;