https://github.com/delphilite/everythingsdk
Everything Search Engine SDK for Delphi
https://github.com/delphilite/everythingsdk
delphi delphinuspackage everything everything-search file-search mft ntfs pascal sdk search usn voidtools
Last synced: about 2 months ago
JSON representation
Everything Search Engine SDK for Delphi
- Host: GitHub
- URL: https://github.com/delphilite/everythingsdk
- Owner: delphilite
- License: mpl-2.0
- Created: 2024-08-05T02:45:33.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-26T09:40:23.000Z (about 1 year ago)
- Last Synced: 2025-02-26T10:34:33.064Z (about 1 year ago)
- Topics: delphi, delphinuspackage, everything, everything-search, file-search, mft, ntfs, pascal, sdk, search, usn, voidtools
- Language: Pascal
- Homepage:
- Size: 241 KB
- Stars: 19
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EverythingSDK




EverythingSDK is a [Delphi](http://www.embarcadero.com/products/delphi) client library for [Voidtools' Everything](https://www.voidtools.com/) search engine. It supports both dynamic and static libraries from the native Everything SDK.
Everything is a powerful search engine that can index and search for files, folders, and other data on your Windows system. The official C++ SDK provides a way to access the Everything database and perform searches programmatically. This repository provides a Delphi translation of the C++ SDK, allowing Delphi developers to easily integrate Everything search functionality into their applications.
Everything service must be running on your machine.
## Features
- Complete translation of Everything's C++ SDK to Delphi.
- Easy integration with Delphi projects.
- Supports all major features of the original SDK.
- Supports using static libraries (Everything32.obj/Everything64.obj). By enabling the ET_STATICLINK directive (default).
- Supports using dynamic libraries (Everything32.dll/Everything64.dll).
- Supports using the Everything IPC (EverythingIPC.pas+EverythingImpl.pas). Reference EverythingImpl instead of EverythingSDK, without requiring any DLL or OBJ.
## Requirements
- Delphi XE2 or later.
- Everything 1.4.1 or later.
## Installation: Manual
To install the EverythingSDK binding, follow these steps:
1. Clone the repository:
```sh
git clone https://github.com/delphilite/EverythingSDK.git
```
2. Add the EverythingSDK\Source directory to the project or IDE's search path.
3. Make sure Everything is installed and running on your system.
## Installation: Delphinus-Support
EverythingSDK should now be listed in [Delphinus package manager](https://github.com/Memnarch/Delphinus/wiki/Installing-Delphinus).
Be sure to restart Delphi after installing via Delphinus otherwise the units may not be found in your test projects.
## Usage
Here's a simple example demonstrating how to use the EverythingSDK in a Delphi application:
```pas
uses
SysUtils, Windows, EverythingSDK; { or EverythingImpl instead of EverythingSDK }
function FileTimeToDateTime(const AFileTime: TFileTime): TDateTime;
var
LocalFileTime: TFileTime;
SystemTime: TSystemTime;
begin
FileTimeToLocalFileTime(AFileTime, LocalFileTime);
FileTimeToSystemTime(LocalFileTime, SystemTime);
Result := SystemTimeToDateTime(SystemTime);
end;
function FormatFileAttrib(AAttrib: DWORD): string;
begin
if AAttrib and faDirectory <> 0 then
Result := ' '
else begin
Result := '';
if AAttrib and faReadOnly <> 0 then
Result := Result + 'r'
else Result := Result + '-';
if AAttrib and faArchive <> 0 then
Result := Result + 'a'
else Result := Result + '-';
if AAttrib and faHidden <> 0 then
Result := Result + 'h'
else Result := Result + '-';
if AAttrib and faSysFile <> 0 then
Result := Result + 's'
else Result := Result + '-';
end;
end;
procedure Execute(const AFind: string);
var
C, F, I, R: DWORD;
dwAttributes: DWORD;
fileName: string;
fileAttrib, fileSize, fileTime: string;
ftModified: TFileTime;
nSize: Int64;
begin
Writeln('Find: ', AFind);
Everything_SetSearch(PChar(AFind));
F := EVERYTHING_REQUEST_FILE_NAME or EVERYTHING_REQUEST_PATH or EVERYTHING_REQUEST_DATE_MODIFIED or
EVERYTHING_REQUEST_SIZE or EVERYTHING_REQUEST_ATTRIBUTES;
Everything_SetRequestFlags(F);
Everything_SetSort(EVERYTHING_SORT_PATH_ASCENDING);
Writeln('Execute Query');
if not Everything_Query(True) then
begin
R := Everything_GetLastError;
raise Exception.Create(Everything_GetErrorMessage(R));
end;
Writeln('Result List Request Flags: ', Everything_GetResultListRequestFlags());
C := Everything_GetNumResults();
Writeln('Result List Count: ', C);
if C > 0 then
for I := 0 to C - 1 do
begin
SetLength(fileName, MAX_PATH);
R := Everything_GetResultFullPathName(I, PChar(fileName), MAX_PATH);
SetLength(fileName, R);
dwAttributes := Everything_GetResultAttributes(I);
fileAttrib := FormatFileAttrib(dwAttributes);
fileAttrib := Format('%6s', [fileAttrib]);
Everything_GetResultSize(I, nSize);
if dwAttributes and faDirectory <> 0 then
fileSize := '-1'
else fileSize := FormatFloat('#,#.#',nSize);
fileSize := Format('%16s', [fileSize]);
if Everything_GetResultDateModified(I, ftModified) then
fileTime := FormatDateTime('yyyy/mm/dd hh:nn:ss', FileTimeToDateTime(ftModified))
else fileTime := StringOfChar(' ', 19);
Writeln(fileTime, ' ', fileAttrib, ' ', fileSize, ' ', fileName);
end;
end;
begin
ReportMemoryLeaksOnShutdown := True;
try
WriteLn('Everything: ', Everything_GetVersion);
WriteLn('');
Execute('*.iso');
WriteLn('');
WriteLn('Done.');
except
on E: Exception do
WriteLn('Error: ', E.Message);
end;
ReadLn;
Everything_CleanUp;
end.
```
For more examples based on low-level API, refer to the test cases under the demos directory.
## Documentation
For more detailed information, refer to the [Everything SDK](https://www.voidtools.com/support/everything/sdk/).
## Contributing
Contributions are welcome! Please fork this repository and submit pull requests with your improvements.
## License
This project is licensed under the Mozilla Public License 2.0. See the [LICENSE](LICENSE) file for details.
## Acknowledgements
Special thanks to Voidtools for creating Everything and providing the original SDK.