Rev 86 | Rev 89 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 86 | Rev 88 | ||
---|---|---|---|
Line 96... | Line 96... | ||
96 | property DeletionTime: TDateTime read FDeletionTime; |
96 | property DeletionTime: TDateTime read FDeletionTime; |
97 | property OriginalSize: int64 read FOriginalSize; |
97 | property OriginalSize: int64 read FOriginalSize; |
98 | property IndexFile: string read FIndexFile; |
98 | property IndexFile: string read FIndexFile; |
99 | property RemovedEntry: boolean read FRemovedEntry; // the file is NOT in the recycle bin anymore! |
99 | property RemovedEntry: boolean read FRemovedEntry; // the file is NOT in the recycle bin anymore! |
100 | 100 | ||
101 | // Attention: There are not an official API calls. The delete and recover |
101 | // Attention: There are no official API calls. The delete and recover |
102 | // functions might fail and/or damage the shell cache. Handle with care! |
102 | // functions might fail and/or damage the shell cache. Handle with care! |
103 | function DeleteFile: boolean; virtual; abstract; |
103 | function DeleteFile: boolean; virtual; abstract; |
104 | function RecoverFile: boolean; virtual; abstract; |
104 | function RecoverFile: boolean; virtual; abstract; |
105 | function OpenFile: boolean; virtual; abstract; |
105 | function OpenFile: boolean; virtual; abstract; |
106 | end; |
106 | end; |
Line 367... | Line 367... | ||
367 | TGetVolumeNameForVolumeMountPoint = function(lpszVolumeMountPoint: LPCTSTR; lpszVolumeName: LPTSTR; cchBufferLength: DWORD): BOOL; stdcall; |
367 | TGetVolumeNameForVolumeMountPoint = function(lpszVolumeMountPoint: LPCTSTR; lpszVolumeName: LPTSTR; cchBufferLength: DWORD): BOOL; stdcall; |
368 | TSHEmptyRecycleBin = function(Wnd: HWND; pszRootPath: PChar; dwFlags: DWORD): HRESULT; stdcall; |
368 | TSHEmptyRecycleBin = function(Wnd: HWND; pszRootPath: PChar; dwFlags: DWORD): HRESULT; stdcall; |
369 | TSHGetSettings = procedure(var lpss: SHELLSTATE; dwMask: DWORD); stdcall; |
369 | TSHGetSettings = procedure(var lpss: SHELLSTATE; dwMask: DWORD); stdcall; |
370 | TSHGetSetSettings = procedure(var lpss: SHELLSTATE; dwMask: DWORD; bSet: BOOL); stdcall; |
370 | TSHGetSetSettings = procedure(var lpss: SHELLSTATE; dwMask: DWORD; bSet: BOOL); stdcall; |
371 | 371 | ||
- | 372 | procedure AnsiRemoveNulChars(var s: AnsiString); |
|
- | 373 | begin |
|
- | 374 | while (Length(s) > 0) and (s[Length(s)] = #0) do |
|
- | 375 | s := Copy(s, 1, Length(s)-1); |
|
- | 376 | end; |
|
- | 377 | ||
- | 378 | procedure UnicodeRemoveNulChars(var s: WideString); |
|
- | 379 | begin |
|
- | 380 | while (Length(s) > 0) and (s[Length(s)] = #0) do |
|
- | 381 | s := Copy(s, 1, Length(s)-1); |
|
- | 382 | end; |
|
- | 383 | ||
372 | function GetDriveGUID(driveLetter: Char; var guid: TGUID): DWORD; |
384 | function GetDriveGUID(driveLetter: Char; var guid: TGUID): DWORD; |
373 | var |
385 | var |
374 | Buffer: array[0..50] of AnsiChar; |
386 | Buffer: array[0..50] of AnsiChar; |
375 | x: string; |
387 | x: string; |
376 | PGetVolumeNameForVolumeMountPoint: TGetVolumeNameForVolumeMountPoint; |
388 | PGetVolumeNameForVolumeMountPoint: TGetVolumeNameForVolumeMountPoint; |
Line 1370... | Line 1382... | ||
1370 | FSourceAnsi := r.sourceAnsi; |
1382 | FSourceAnsi := r.sourceAnsi; |
1371 | FSourceUnicode := r.sourceAnsi; // Unicode does not exist in INFO(1) structure |
1383 | FSourceUnicode := r.sourceAnsi; // Unicode does not exist in INFO(1) structure |
1372 | FID := IntToStr(r.recordNumber); |
1384 | FID := IntToStr(r.recordNumber); |
1373 | FDeletionTime := FileTimeToDateTime(r.deletionTime); |
1385 | FDeletionTime := FileTimeToDateTime(r.deletionTime); |
1374 | FOriginalSize := r.originalSize; |
1386 | FOriginalSize := r.originalSize; |
- | 1387 | ||
- | 1388 | // Remove #0 at the end. There are some bugs where #0 is added to ANSI/Unicode read paths?! (probably in the ReadVista stuff) |
|
- | 1389 | // TODO: Instead of using this workaround, fix "SourceUnicode" and "SourceAnsi" in the first place! |
|
- | 1390 | AnsiRemoveNulChars(FSourceAnsi); |
|
- | 1391 | UnicodeRemoveNulChars(FSourceUnicode); |
|
1375 | end; |
1392 | end; |
1376 | 1393 | ||
1377 | function TRbInfoAItem.DeleteFile: boolean; |
1394 | function TRbInfoAItem.DeleteFile: boolean; |
1378 | var |
1395 | var |
1379 | r: string; |
1396 | r: string; |
Line 1431... | Line 1448... | ||
1431 | FSourceUnicode := r.sourceUnicode; |
1448 | FSourceUnicode := r.sourceUnicode; |
1432 | FID := IntToStr(r.recordNumber); |
1449 | FID := IntToStr(r.recordNumber); |
1433 | FSourceDrive := Chr(Ord('A') + r.sourceDrive); |
1450 | FSourceDrive := Chr(Ord('A') + r.sourceDrive); |
1434 | FDeletionTime := FileTimeToDateTime(r.deletionTime); |
1451 | FDeletionTime := FileTimeToDateTime(r.deletionTime); |
1435 | FOriginalSize := r.originalSize; |
1452 | FOriginalSize := r.originalSize; |
- | 1453 | ||
- | 1454 | // Remove #0 at the end. There are some bugs where #0 is added to ANSI/Unicode read paths?! (probably in the ReadVista stuff) |
|
- | 1455 | // TODO: Instead of using this workaround, fix "SourceUnicode" and "SourceAnsi" in the first place! |
|
- | 1456 | AnsiRemoveNulChars(FSourceAnsi); |
|
- | 1457 | UnicodeRemoveNulChars(FSourceUnicode); |
|
1436 | end; |
1458 | end; |
1437 | 1459 | ||
1438 | function TRbInfoWItem.DeleteFile: boolean; |
1460 | function TRbInfoWItem.DeleteFile: boolean; |
1439 | var |
1461 | var |
1440 | r: string; |
1462 | r: string; |
Line 1528... | Line 1550... | ||
1528 | end |
1550 | end |
1529 | else |
1551 | else |
1530 | begin |
1552 | begin |
1531 | raise Exception.CreateFmt('Invalid Vista index format version %d', [version]); |
1553 | raise Exception.CreateFmt('Invalid Vista index format version %d', [version]); |
1532 | end; |
1554 | end; |
- | 1555 | ||
- | 1556 | // Remove #0 at the end. There are some bugs where #0 is added to ANSI/Unicode read paths?! (probably in the ReadVista stuff) |
|
- | 1557 | // TODO: Instead of using this workaround, fix "SourceUnicode" and "SourceAnsi" in the first place! |
|
- | 1558 | AnsiRemoveNulChars(FSourceAnsi); |
|
- | 1559 | UnicodeRemoveNulChars(FSourceUnicode); |
|
1533 | end; |
1560 | end; |
1534 | 1561 | ||
1535 | function TRbVistaItem.DeleteFile: boolean; |
1562 | function TRbVistaItem.DeleteFile: boolean; |
1536 | var |
1563 | var |
1537 | r: string; |
1564 | r: string; |
Line 2388... | Line 2415... | ||
2388 | {$IFDEF UNICODE} |
2415 | {$IFDEF UNICODE} |
2389 | result := SourceUnicode; |
2416 | result := SourceUnicode; |
2390 | {$ELSE} |
2417 | {$ELSE} |
2391 | result := SourceAnsi; |
2418 | result := SourceAnsi; |
2392 | {$ENDIF} |
2419 | {$ENDIF} |
2393 | - | ||
2394 | // Remove #0 at the end. There are some bugs where #0 is added to ANSI/Unicode read paths?! (probably in the ReadVista stuff) |
- | |
2395 | // TODO: Instead of using this workaround, fix "SourceUnicode" and "SourceAnsi"! |
- | |
2396 | while (Length(result) > 0) and (result[Length(result)] = #0) do |
- | |
2397 | result := Copy(result, 1, Length(result)-1); |
- | |
2398 | end; |
2420 | end; |
2399 | 2421 | ||
2400 | end. |
2422 | end. |