Subversion Repositories recyclebinunit

Rev

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

Rev 99 Rev 100
Line 3... Line 3...
3
////////////////////////////////////////////////////////////////////////////////////
3
////////////////////////////////////////////////////////////////////////////////////
4
// RECYCLE-BIN-UNIT V2 BY DANIEL MARSCHALL, VIATHINKSOFT                          //
4
// RECYCLE-BIN-UNIT V2 BY DANIEL MARSCHALL, VIATHINKSOFT                          //
5
// E-MAIL: info@daniel-marschall.de                                               //
5
// E-MAIL: info@daniel-marschall.de                                               //
6
// Web:    www.daniel-marschall.de & www.viathinksoft.de                          //
6
// Web:    www.daniel-marschall.de & www.viathinksoft.de                          //
7
////////////////////////////////////////////////////////////////////////////////////
7
////////////////////////////////////////////////////////////////////////////////////
8
// Revision: 02 JUL 2022                                                          //
8
// Revision: 03 JUL 2022                                                          //
9
// This unit is freeware, but please link to my website if you are using it!      //
9
// This unit is freeware, but please link to my website if you are using it!      //
10
////////////////////////////////////////////////////////////////////////////////////
10
////////////////////////////////////////////////////////////////////////////////////
11
// Successfully tested with:                                                      //
11
// Successfully tested with:                                                      //
12
// Windows 95b (without IE4 Shell Extensions)                                     //
12
// Windows 95b (without IE4 Shell Extensions)                                     //
13
// Windows 95b (with IE4 Shell Extensions)                                        //
13
// Windows 95b (with IE4 Shell Extensions)                                        //
Line 53... Line 53...
53
 
53
 
54
uses
54
uses
55
  Windows, SysUtils, Classes, ContNrs, ShellAPI, Registry, Messages, Math;
55
  Windows, SysUtils, Classes, ContNrs, ShellAPI, Registry, Messages, Math;
56
 
56
 
57
const
57
const
58
  RECBINUNIT_VERSION = '2022-07-02';
58
  RECBINUNIT_VERSION = '2022-07-03';
59
 
59
 
60
  RECYCLER_CLSID: TGUID = '{645FF040-5081-101B-9F08-00AA002F954E}';
60
  RECYCLER_CLSID: TGUID = '{645FF040-5081-101B-9F08-00AA002F954E}';
61
  NULL_GUID:      TGUID = '{00000000-0000-0000-0000-000000000000}';
61
  NULL_GUID:      TGUID = '{00000000-0000-0000-0000-000000000000}';
62
 
62
 
63
type
63
type
Line 835... Line 835...
835
      else
835
      else
836
      begin
836
      begin
837
        vistaId := ''; // manual file that was not named $I..., so we cannot get $R... ID and therefore no physical file!
837
        vistaId := ''; // manual file that was not named $I..., so we cannot get $R... ID and therefore no physical file!
838
        try
838
        try
839
          testVistaItem := TRbVistaItem.Create(fs, AFile, vistaId);
839
          testVistaItem := TRbVistaItem.Create(fs, AFile, vistaId);
-
 
840
          if (Copy(testVistaItem.Source,2,2) <> ':\') and
840
          if Copy(testVistaItem.Source,2,2) <> ':\' then
841
             (Copy(testVistaItem.Source,2,2) <> '\\') then
841
            FreeAndNil(testVistaItem);
842
            FreeAndNil(testVistaItem);
842
        except
843
        except
843
          testVistaItem := nil;
844
          testVistaItem := nil;
844
        end;
845
        end;
845
      end;
846
      end;
Line 866... Line 867...
866
            if fs.Position + SizeOf(TRbInfoRecordW) <= fs.Size then
867
            if fs.Position + SizeOf(TRbInfoRecordW) <= fs.Size then
867
            begin
868
            begin
868
              // Try to read the Unicode record and check if it is valid
869
              // Try to read the Unicode record and check if it is valid
869
              // In case it is no Unicode record, then the Unicode part will be the
870
              // In case it is no Unicode record, then the Unicode part will be the
870
              // ANSI source name of the next record. In this case, we won't get
871
              // ANSI source name of the next record. In this case, we won't get
871
              // a ':' at the Unicode string.
872
              // a ':\' or '\\' at the Unicode string.
872
              bakPosition := fs.Position;
873
              bakPosition := fs.Position;
873
              wTest := TRbInfoWItem.Create(fs, AFile);
874
              wTest := TRbInfoWItem.Create(fs, AFile);
-
 
875
              if (Copy(wTest.SourceUnicode, 2, 2) = ':\') or
874
              if Copy(wTest.SourceUnicode, 2, 2) = ':\' then
876
                 (Copy(wTest.SourceUnicode, 2, 2) = '\\') then
875
              begin
877
              begin
876
                // Yes, it is a valid Unicode record.
878
                // Yes, it is a valid Unicode record.
877
                list.Add(wTest);
879
                list.Add(wTest);
878
              end
880
              end
879
              else
881
              else
Line 1401... Line 1403...
1401
  r: TRbInfoRecordA;
1403
  r: TRbInfoRecordA;
1402
  i: Integer;
1404
  i: Integer;
1403
begin
1405
begin
1404
  stream.ReadBuffer(r, SizeOf(r));
1406
  stream.ReadBuffer(r, SizeOf(r));
1405
 
1407
 
-
 
1408
  if r.sourceDrive = 26 then
-
 
1409
    FSourceDrive := '@' // @ is the "Network home drive" of the Win95 time
-
 
1410
  else
1406
  FSourceDrive := Chr(Ord('A') + r.sourceDrive);
1411
    FSourceDrive := Chr(Ord('A') + r.sourceDrive);
1407
 
1412
 
1408
  // Win95 with IE4 and Win2000+:
1413
  // Win95 with IE4 and Win2000+:
1409
  // Wenn ein Eintrag aus der INFO/INFO2 gelöscht wird, dann wird das erste Byte
1414
  // Wenn ein Eintrag aus der INFO/INFO2 gelöscht wird, dann wird das erste Byte
1410
  // von sourceAnsi auf Null gesetzt, damit die ganze INFO/INFO2 Datei nicht
1415
  // von sourceAnsi auf Null gesetzt, damit die ganze INFO/INFO2 Datei nicht
Line 1489... Line 1494...
1489
  end;
1494
  end;
1490
 
1495
 
1491
  FSourceAnsi := r.sourceAnsi;
1496
  FSourceAnsi := r.sourceAnsi;
1492
  FSourceUnicode := r.sourceUnicode;
1497
  FSourceUnicode := r.sourceUnicode;
1493
  FID := IntToStr(r.recordNumber);
1498
  FID := IntToStr(r.recordNumber);
-
 
1499
 
-
 
1500
  if r.sourceDrive = 26 then
-
 
1501
    FSourceDrive := '@' // @ is the "Network home drive" of the Win95 time
-
 
1502
  else
1494
  FSourceDrive := Chr(Ord('A') + r.sourceDrive);
1503
    FSourceDrive := Chr(Ord('A') + r.sourceDrive);
-
 
1504
 
1495
  FDeletionTime := FileTimeToDateTime(r.deletionTime);
1505
  FDeletionTime := FileTimeToDateTime(r.deletionTime);
1496
  FOriginalSize := r.originalSize;
1506
  FOriginalSize := r.originalSize;
1497
 
1507
 
1498
  // Remove #0 at the end. There are some bugs where #0 is added to ANSI/Unicode read paths?! (probably in the ReadVista stuff)
1508
  // Remove #0 at the end. There are some bugs where #0 is added to ANSI/Unicode read paths?! (probably in the ReadVista stuff)
1499
  // TODO: Instead of using this workaround, fix "SourceUnicode" and "SourceAnsi" in the first place!
1509
  // TODO: Instead of using this workaround, fix "SourceUnicode" and "SourceAnsi" in the first place!