diff --git a/Everything-SDK/dll/Everything32.dll b/Everything-SDK/dll/Everything32.dll new file mode 100644 index 0000000..2fff80e Binary files /dev/null and b/Everything-SDK/dll/Everything32.dll differ diff --git a/Everything-SDK/dll/Everything64.dll b/Everything-SDK/dll/Everything64.dll new file mode 100644 index 0000000..1988411 Binary files /dev/null and b/Everything-SDK/dll/Everything64.dll differ diff --git a/Everything-SDK/example/CSharp/Form1.Designer.cs b/Everything-SDK/example/CSharp/Form1.Designer.cs new file mode 100644 index 0000000..8a4bdfb --- /dev/null +++ b/Everything-SDK/example/CSharp/Form1.Designer.cs @@ -0,0 +1,83 @@ +namespace WindowsApplication1 +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(250, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(84, 20); + this.button1.TabIndex = 0; + this.button1.Text = "Search"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.Location = new System.Drawing.Point(12, 38); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(762, 498); + this.listBox1.TabIndex = 2; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(12, 12); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(232, 20); + this.textBox1.TabIndex = 3; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(786, 553); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.TextBox textBox1; + } +} + diff --git a/Everything-SDK/example/CSharp/Form1.cs b/Everything-SDK/example/CSharp/Form1.cs new file mode 100644 index 0000000..b9f1fb9 --- /dev/null +++ b/Everything-SDK/example/CSharp/Form1.cs @@ -0,0 +1,260 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Runtime.InteropServices; + +namespace WindowsApplication1 +{ + public partial class Form1 : Form + { + const int EVERYTHING_OK = 0; + const int EVERYTHING_ERROR_MEMORY = 1; + const int EVERYTHING_ERROR_IPC = 2; + const int EVERYTHING_ERROR_REGISTERCLASSEX = 3; + const int EVERYTHING_ERROR_CREATEWINDOW = 4; + const int EVERYTHING_ERROR_CREATETHREAD = 5; + const int EVERYTHING_ERROR_INVALIDINDEX = 6; + const int EVERYTHING_ERROR_INVALIDCALL = 7; + + const int EVERYTHING_REQUEST_FILE_NAME = 0x00000001; + const int EVERYTHING_REQUEST_PATH = 0x00000002; + const int EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME = 0x00000004; + const int EVERYTHING_REQUEST_EXTENSION = 0x00000008; + const int EVERYTHING_REQUEST_SIZE = 0x00000010; + const int EVERYTHING_REQUEST_DATE_CREATED = 0x00000020; + const int EVERYTHING_REQUEST_DATE_MODIFIED = 0x00000040; + const int EVERYTHING_REQUEST_DATE_ACCESSED = 0x00000080; + const int EVERYTHING_REQUEST_ATTRIBUTES = 0x00000100; + const int EVERYTHING_REQUEST_FILE_LIST_FILE_NAME = 0x00000200; + const int EVERYTHING_REQUEST_RUN_COUNT = 0x00000400; + const int EVERYTHING_REQUEST_DATE_RUN = 0x00000800; + const int EVERYTHING_REQUEST_DATE_RECENTLY_CHANGED = 0x00001000; + const int EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME = 0x00002000; + const int EVERYTHING_REQUEST_HIGHLIGHTED_PATH = 0x00004000; + const int EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME = 0x00008000; + + const int EVERYTHING_SORT_NAME_ASCENDING = 1; + const int EVERYTHING_SORT_NAME_DESCENDING = 2; + const int EVERYTHING_SORT_PATH_ASCENDING = 3; + const int EVERYTHING_SORT_PATH_DESCENDING = 4; + const int EVERYTHING_SORT_SIZE_ASCENDING = 5; + const int EVERYTHING_SORT_SIZE_DESCENDING = 6; + const int EVERYTHING_SORT_EXTENSION_ASCENDING = 7; + const int EVERYTHING_SORT_EXTENSION_DESCENDING = 8; + const int EVERYTHING_SORT_TYPE_NAME_ASCENDING = 9; + const int EVERYTHING_SORT_TYPE_NAME_DESCENDING = 10; + const int EVERYTHING_SORT_DATE_CREATED_ASCENDING = 11; + const int EVERYTHING_SORT_DATE_CREATED_DESCENDING = 12; + const int EVERYTHING_SORT_DATE_MODIFIED_ASCENDING = 13; + const int EVERYTHING_SORT_DATE_MODIFIED_DESCENDING = 14; + const int EVERYTHING_SORT_ATTRIBUTES_ASCENDING = 15; + const int EVERYTHING_SORT_ATTRIBUTES_DESCENDING = 16; + const int EVERYTHING_SORT_FILE_LIST_FILENAME_ASCENDING = 17; + const int EVERYTHING_SORT_FILE_LIST_FILENAME_DESCENDING = 18; + const int EVERYTHING_SORT_RUN_COUNT_ASCENDING = 19; + const int EVERYTHING_SORT_RUN_COUNT_DESCENDING = 20; + const int EVERYTHING_SORT_DATE_RECENTLY_CHANGED_ASCENDING = 21; + const int EVERYTHING_SORT_DATE_RECENTLY_CHANGED_DESCENDING = 22; + const int EVERYTHING_SORT_DATE_ACCESSED_ASCENDING = 23; + const int EVERYTHING_SORT_DATE_ACCESSED_DESCENDING= 24; + const int EVERYTHING_SORT_DATE_RUN_ASCENDING = 25; + const int EVERYTHING_SORT_DATE_RUN_DESCENDING = 26; + + const int EVERYTHING_TARGET_MACHINE_X86 = 1; + const int EVERYTHING_TARGET_MACHINE_X64 = 2; + const int EVERYTHING_TARGET_MACHINE_ARM = 3; + + [DllImport("Everything32.dll", CharSet = CharSet.Unicode)] + public static extern UInt32 Everything_SetSearchW(string lpSearchString); + [DllImport("Everything32.dll")] + public static extern void Everything_SetMatchPath(bool bEnable); + [DllImport("Everything32.dll")] + public static extern void Everything_SetMatchCase(bool bEnable); + [DllImport("Everything32.dll")] + public static extern void Everything_SetMatchWholeWord(bool bEnable); + [DllImport("Everything32.dll")] + public static extern void Everything_SetRegex(bool bEnable); + [DllImport("Everything32.dll")] + public static extern void Everything_SetMax(UInt32 dwMax); + [DllImport("Everything32.dll")] + public static extern void Everything_SetOffset(UInt32 dwOffset); + + [DllImport("Everything32.dll")] + public static extern bool Everything_GetMatchPath(); + [DllImport("Everything32.dll")] + public static extern bool Everything_GetMatchCase(); + [DllImport("Everything32.dll")] + public static extern bool Everything_GetMatchWholeWord(); + [DllImport("Everything32.dll")] + public static extern bool Everything_GetRegex(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetMax(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetOffset(); + [DllImport("Everything32.dll")] + public static extern IntPtr Everything_GetSearchW(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetLastError(); + + [DllImport("Everything32.dll")] + public static extern bool Everything_QueryW(bool bWait); + + [DllImport("Everything32.dll")] + public static extern void Everything_SortResultsByPath(); + + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetNumFileResults(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetNumFolderResults(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetNumResults(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetTotFileResults(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetTotFolderResults(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetTotResults(); + [DllImport("Everything32.dll")] + public static extern bool Everything_IsVolumeResult(UInt32 nIndex); + [DllImport("Everything32.dll")] + public static extern bool Everything_IsFolderResult(UInt32 nIndex); + [DllImport("Everything32.dll")] + public static extern bool Everything_IsFileResult(UInt32 nIndex); + [DllImport("Everything32.dll", CharSet = CharSet.Unicode)] + public static extern void Everything_GetResultFullPathName(UInt32 nIndex, StringBuilder lpString, UInt32 nMaxCount); + [DllImport("Everything32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultPath(UInt32 nIndex); + [DllImport("Everything32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultFileName(UInt32 nIndex); + + [DllImport("Everything32.dll")] + public static extern void Everything_Reset(); + [DllImport("Everything32.dll")] + public static extern void Everything_CleanUp(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetMajorVersion(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetMinorVersion(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetRevision(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetBuildNumber(); + [DllImport("Everything32.dll")] + public static extern bool Everything_Exit(); + [DllImport("Everything32.dll")] + public static extern bool Everything_IsDBLoaded(); + [DllImport("Everything32.dll")] + public static extern bool Everything_IsAdmin(); + [DllImport("Everything32.dll")] + public static extern bool Everything_IsAppData(); + [DllImport("Everything32.dll")] + public static extern bool Everything_RebuildDB(); + [DllImport("Everything32.dll")] + public static extern bool Everything_UpdateAllFolderIndexes(); + [DllImport("Everything32.dll")] + public static extern bool Everything_SaveDB(); + [DllImport("Everything32.dll")] + public static extern bool Everything_SaveRunHistory(); + [DllImport("Everything32.dll")] + public static extern bool Everything_DeleteRunHistory(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetTargetMachine(); + + // Everything 1.4 + [DllImport("Everything32.dll")] + public static extern void Everything_SetSort(UInt32 dwSortType); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetSort(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetResultListSort(); + [DllImport("Everything32.dll")] + public static extern void Everything_SetRequestFlags(UInt32 dwRequestFlags); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetRequestFlags(); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetResultListRequestFlags(); + [DllImport("Everything32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultExtension(UInt32 nIndex); + [DllImport("Everything32.dll")] + public static extern bool Everything_GetResultSize(UInt32 nIndex, out long lpFileSize); + [DllImport("Everything32.dll")] + public static extern bool Everything_GetResultDateCreated(UInt32 nIndex, out long lpFileTime); + [DllImport("Everything32.dll")] + public static extern bool Everything_GetResultDateModified(UInt32 nIndex, out long lpFileTime); + [DllImport("Everything32.dll")] + public static extern bool Everything_GetResultDateAccessed(UInt32 nIndex, out long lpFileTime); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetResultAttributes(UInt32 nIndex); + [DllImport("Everything32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultFileListFileName(UInt32 nIndex); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetResultRunCount(UInt32 nIndex); + [DllImport("Everything32.dll")] + public static extern bool Everything_GetResultDateRun(UInt32 nIndex, out long lpFileTime); + [DllImport("Everything32.dll")] + public static extern bool Everything_GetResultDateRecentlyChanged(UInt32 nIndex, out long lpFileTime); + [DllImport("Everything32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultHighlightedFileName(UInt32 nIndex); + [DllImport("Everything32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultHighlightedPath(UInt32 nIndex); + [DllImport("Everything32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultHighlightedFullPathAndFileName(UInt32 nIndex); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_GetRunCountFromFileName(string lpFileName); + [DllImport("Everything32.dll")] + public static extern bool Everything_SetRunCountFromFileName(string lpFileName, UInt32 dwRunCount); + [DllImport("Everything32.dll")] + public static extern UInt32 Everything_IncRunCountFromFileName(string lpFileName); + + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + UInt32 i; + + // set the search + Everything_SetSearchW(textBox1.Text); + + // use our own custom scrollbar... + // Everything_SetMax(listBox1.ClientRectangle.Height / listBox1.ItemHeight); + // Everything_SetOffset(VerticalScrollBarPosition...); + + // request name and size + Everything_SetRequestFlags(EVERYTHING_REQUEST_FILE_NAME | EVERYTHING_REQUEST_PATH | EVERYTHING_REQUEST_DATE_MODIFIED | EVERYTHING_REQUEST_SIZE); + + Everything_SetSort(13); + + // execute the query + Everything_QueryW(true); + + // sort by path + // Everything_SortResultsByPath(); + + // clear the old list of results + listBox1.Items.Clear(); + + // set the window title + Text = textBox1.Text + " - " + Everything_GetNumResults() + " Results"; + + // loop through the results, adding each result to the listbox. + for (i = 0; i < Everything_GetNumResults(); i++) + { + long date_modified; + long size; + + Everything_GetResultDateModified(i, out date_modified); + Everything_GetResultSize(i, out size); + + // add it to the list box + listBox1.Items.Insert((int)i, "Size: " + size.ToString() + " Date Modified: " + DateTime.FromFileTime(date_modified).Year + "/" + DateTime.FromFileTime(date_modified).Month + "/" + DateTime.FromFileTime(date_modified).Day + " " + DateTime.FromFileTime(date_modified).Hour + ":" + DateTime.FromFileTime(date_modified).Minute.ToString("D2") + " Filename: " + Marshal.PtrToStringUni(Everything_GetResultFileName(i))); + } + } + } +} \ No newline at end of file diff --git a/Everything-SDK/example/CSharp/Form1.resx b/Everything-SDK/example/CSharp/Form1.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/Everything-SDK/example/CSharp/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Everything-SDK/example/CSharp/Program.cs b/Everything-SDK/example/CSharp/Program.cs new file mode 100644 index 0000000..28a5e17 --- /dev/null +++ b/Everything-SDK/example/CSharp/Program.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace WindowsApplication1 +{ + + static class Program + { + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + Application.Run(new Form1()); + } + } +} \ No newline at end of file diff --git a/Everything-SDK/example/CSharp/Properties/AssemblyInfo.cs b/Everything-SDK/example/CSharp/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2542af8 --- /dev/null +++ b/Everything-SDK/example/CSharp/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WindowsApplication1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsApplication1")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("00417877-82e2-4176-8724-bbe7870ee348")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Everything-SDK/example/CSharp/Properties/Resources.Designer.cs b/Everything-SDK/example/CSharp/Properties/Resources.Designer.cs new file mode 100644 index 0000000..0b78595 --- /dev/null +++ b/Everything-SDK/example/CSharp/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsApplication1.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsApplication1.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Everything-SDK/example/CSharp/Properties/Resources.resx b/Everything-SDK/example/CSharp/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Everything-SDK/example/CSharp/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Everything-SDK/example/CSharp/Properties/Settings.Designer.cs b/Everything-SDK/example/CSharp/Properties/Settings.Designer.cs new file mode 100644 index 0000000..d021597 --- /dev/null +++ b/Everything-SDK/example/CSharp/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsApplication1.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Everything-SDK/example/CSharp/Properties/Settings.settings b/Everything-SDK/example/CSharp/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Everything-SDK/example/CSharp/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Everything-SDK/example/CSharp/WindowsApplication1.csproj b/Everything-SDK/example/CSharp/WindowsApplication1.csproj new file mode 100644 index 0000000..b2219ea --- /dev/null +++ b/Everything-SDK/example/CSharp/WindowsApplication1.csproj @@ -0,0 +1,94 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1} + WinExe + Properties + WindowsApplication1 + WindowsApplication1 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + + + + + + + + + + + + Form + + + Form1.cs + + + + + Designer + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + \ No newline at end of file diff --git a/Everything-SDK/example/CSharp/WindowsApplication1.sln b/Everything-SDK/example/CSharp/WindowsApplication1.sln new file mode 100644 index 0000000..3fab4be --- /dev/null +++ b/Everything-SDK/example/CSharp/WindowsApplication1.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsApplication1", "WindowsApplication1.csproj", "{FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Debug|x86.ActiveCfg = Debug|x86 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Debug|x86.Build.0 = Debug|x86 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Release|Any CPU.Build.0 = Release|Any CPU + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Release|x86.ActiveCfg = Release|x86 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Everything-SDK/example/CSharp/WindowsApplication1.suo b/Everything-SDK/example/CSharp/WindowsApplication1.suo new file mode 100644 index 0000000..079f001 Binary files /dev/null and b/Everything-SDK/example/CSharp/WindowsApplication1.suo differ diff --git a/Everything-SDK/example/CSharp/obj/WindowsApplication1.csproj.FileListAbsolute.txt b/Everything-SDK/example/CSharp/obj/WindowsApplication1.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..05d51e0 --- /dev/null +++ b/Everything-SDK/example/CSharp/obj/WindowsApplication1.csproj.FileListAbsolute.txt @@ -0,0 +1,10 @@ +D:\dev\everything\sdk\example\CSharp\bin\x86\Debug\WindowsApplication1.exe +D:\dev\everything\sdk\example\CSharp\bin\x86\Debug\WindowsApplication1.pdb +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\ResolveAssemblyReference.cache +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.Form1.resources +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.Properties.Resources.resources +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.csproj.GenerateResource.Cache +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.exe +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.pdb +C:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.exe +C:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.pdb diff --git a/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.Form1.resources b/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.Form1.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.Form1.resources differ diff --git a/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.Properties.Resources.resources b/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.Properties.Resources.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.Properties.Resources.resources differ diff --git a/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.csproj.GenerateResource.Cache b/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.csproj.GenerateResource.Cache new file mode 100644 index 0000000..66d8163 Binary files /dev/null and b/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.csproj.GenerateResource.Cache differ diff --git a/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.exe b/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.exe new file mode 100644 index 0000000..1d78cb3 Binary files /dev/null and b/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.exe differ diff --git a/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.pdb b/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.pdb new file mode 100644 index 0000000..3d2a3bc Binary files /dev/null and b/Everything-SDK/example/CSharp/obj/x86/Debug/WindowsApplication1.pdb differ diff --git a/Everything-SDK/example/CSharpx64/Form1.Designer.cs b/Everything-SDK/example/CSharpx64/Form1.Designer.cs new file mode 100644 index 0000000..5798bd0 --- /dev/null +++ b/Everything-SDK/example/CSharpx64/Form1.Designer.cs @@ -0,0 +1,83 @@ +namespace WindowsApplication1 +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(250, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(84, 20); + this.button1.TabIndex = 0; + this.button1.Text = "Search"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.Location = new System.Drawing.Point(12, 38); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(322, 199); + this.listBox1.TabIndex = 2; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(12, 12); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(232, 20); + this.textBox1.TabIndex = 3; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(349, 251); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.TextBox textBox1; + } +} + diff --git a/Everything-SDK/example/CSharpx64/Form1.cs b/Everything-SDK/example/CSharpx64/Form1.cs new file mode 100644 index 0000000..0e7a7a9 --- /dev/null +++ b/Everything-SDK/example/CSharpx64/Form1.cs @@ -0,0 +1,228 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Runtime.InteropServices; + +namespace WindowsApplication1 +{ + public partial class Form1 : Form + { + const int EVERYTHING_OK = 0; + const int EVERYTHING_ERROR_MEMORY = 1; + const int EVERYTHING_ERROR_IPC = 2; + const int EVERYTHING_ERROR_REGISTERCLASSEX = 3; + const int EVERYTHING_ERROR_CREATEWINDOW = 4; + const int EVERYTHING_ERROR_CREATETHREAD = 5; + const int EVERYTHING_ERROR_INVALIDINDEX = 6; + const int EVERYTHING_ERROR_INVALIDCALL = 7; + + const int EVERYTHING_REQUEST_FILE_NAME = 0x00000001; + const int EVERYTHING_REQUEST_PATH = 0x00000002; + const int EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME = 0x00000004; + const int EVERYTHING_REQUEST_EXTENSION = 0x00000008; + const int EVERYTHING_REQUEST_SIZE = 0x00000010; + const int EVERYTHING_REQUEST_DATE_CREATED = 0x00000020; + const int EVERYTHING_REQUEST_DATE_MODIFIED = 0x00000040; + const int EVERYTHING_REQUEST_DATE_ACCESSED = 0x00000080; + const int EVERYTHING_REQUEST_ATTRIBUTES = 0x00000100; + const int EVERYTHING_REQUEST_FILE_LIST_FILE_NAME = 0x00000200; + const int EVERYTHING_REQUEST_RUN_COUNT = 0x00000400; + const int EVERYTHING_REQUEST_DATE_RUN = 0x00000800; + const int EVERYTHING_REQUEST_DATE_RECENTLY_CHANGED = 0x00001000; + const int EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME = 0x00002000; + const int EVERYTHING_REQUEST_HIGHLIGHTED_PATH = 0x00004000; + const int EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME = 0x00008000; + + const int EVERYTHING_SORT_NAME_ASCENDING = 1; + const int EVERYTHING_SORT_NAME_DESCENDING = 2; + const int EVERYTHING_SORT_PATH_ASCENDING = 3; + const int EVERYTHING_SORT_PATH_DESCENDING = 4; + const int EVERYTHING_SORT_SIZE_ASCENDING = 5; + const int EVERYTHING_SORT_SIZE_DESCENDING = 6; + const int EVERYTHING_SORT_EXTENSION_ASCENDING = 7; + const int EVERYTHING_SORT_EXTENSION_DESCENDING = 8; + const int EVERYTHING_SORT_TYPE_NAME_ASCENDING = 9; + const int EVERYTHING_SORT_TYPE_NAME_DESCENDING = 10; + const int EVERYTHING_SORT_DATE_CREATED_ASCENDING = 11; + const int EVERYTHING_SORT_DATE_CREATED_DESCENDING = 12; + const int EVERYTHING_SORT_DATE_MODIFIED_ASCENDING = 13; + const int EVERYTHING_SORT_DATE_MODIFIED_DESCENDING = 14; + const int EVERYTHING_SORT_ATTRIBUTES_ASCENDING = 15; + const int EVERYTHING_SORT_ATTRIBUTES_DESCENDING = 16; + const int EVERYTHING_SORT_FILE_LIST_FILENAME_ASCENDING = 17; + const int EVERYTHING_SORT_FILE_LIST_FILENAME_DESCENDING = 18; + const int EVERYTHING_SORT_RUN_COUNT_ASCENDING = 19; + const int EVERYTHING_SORT_RUN_COUNT_DESCENDING = 20; + const int EVERYTHING_SORT_DATE_RECENTLY_CHANGED_ASCENDING = 21; + const int EVERYTHING_SORT_DATE_RECENTLY_CHANGED_DESCENDING = 22; + const int EVERYTHING_SORT_DATE_ACCESSED_ASCENDING = 23; + const int EVERYTHING_SORT_DATE_ACCESSED_DESCENDING = 24; + const int EVERYTHING_SORT_DATE_RUN_ASCENDING = 25; + const int EVERYTHING_SORT_DATE_RUN_DESCENDING = 26; + + const int EVERYTHING_TARGET_MACHINE_X86 = 1; + const int EVERYTHING_TARGET_MACHINE_X64 = 2; + const int EVERYTHING_TARGET_MACHINE_ARM = 3; + + [DllImport("Everything64.dll", CharSet = CharSet.Unicode)] + public static extern UInt32 Everything_SetSearchW(string lpSearchString); + [DllImport("Everything64.dll")] + public static extern void Everything_SetMatchPath(bool bEnable); + [DllImport("Everything64.dll")] + public static extern void Everything_SetMatchCase(bool bEnable); + [DllImport("Everything64.dll")] + public static extern void Everything_SetMatchWholeWord(bool bEnable); + [DllImport("Everything64.dll")] + public static extern void Everything_SetRegex(bool bEnable); + [DllImport("Everything64.dll")] + public static extern void Everything_SetMax(UInt32 dwMax); + [DllImport("Everything64.dll")] + public static extern void Everything_SetOffset(UInt32 dwOffset); + + [DllImport("Everything64.dll")] + public static extern bool Everything_GetMatchPath(); + [DllImport("Everything64.dll")] + public static extern bool Everything_GetMatchCase(); + [DllImport("Everything64.dll")] + public static extern bool Everything_GetMatchWholeWord(); + [DllImport("Everything64.dll")] + public static extern bool Everything_GetRegex(); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetMax(); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetOffset(); + [DllImport("Everything64.dll")] + public static extern IntPtr Everything_GetSearchW(); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetLastError(); + + [DllImport("Everything64.dll")] + public static extern bool Everything_QueryW(bool bWait); + + [DllImport("Everything64.dll")] + public static extern void Everything_SortResultsByPath(); + + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetNumFileResults(); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetNumFolderResults(); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetNumResults(); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetTotFileResults(); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetTotFolderResults(); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetTotResults(); + [DllImport("Everything64.dll")] + public static extern bool Everything_IsVolumeResult(UInt32 nIndex); + [DllImport("Everything64.dll")] + public static extern bool Everything_IsFolderResult(UInt32 nIndex); + [DllImport("Everything64.dll")] + public static extern bool Everything_IsFileResult(UInt32 nIndex); + [DllImport("Everything64.dll", CharSet = CharSet.Unicode)] + public static extern void Everything_GetResultFullPathName(UInt32 nIndex, StringBuilder lpString, UInt32 nMaxCount); + [DllImport("Everything64.dll")] + public static extern void Everything_Reset(); + + [DllImport("Everything64.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultFileName(UInt32 nIndex); + + // Everything 1.4 + [DllImport("Everything64.dll")] + public static extern void Everything_SetSort(UInt32 dwSortType); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetSort(); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetResultListSort(); + [DllImport("Everything64.dll")] + public static extern void Everything_SetRequestFlags(UInt32 dwRequestFlags); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetRequestFlags(); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetResultListRequestFlags(); + [DllImport("Everything64.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultExtension(UInt32 nIndex); + [DllImport("Everything64.dll")] + public static extern bool Everything_GetResultSize(UInt32 nIndex, out long lpFileSize); + [DllImport("Everything64.dll")] + public static extern bool Everything_GetResultDateCreated(UInt32 nIndex, out long lpFileTime); + [DllImport("Everything64.dll")] + public static extern bool Everything_GetResultDateModified(UInt32 nIndex, out long lpFileTime); + [DllImport("Everything64.dll")] + public static extern bool Everything_GetResultDateAccessed(UInt32 nIndex, out long lpFileTime); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetResultAttributes(UInt32 nIndex); + [DllImport("Everything64.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultFileListFileName(UInt32 nIndex); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetResultRunCount(UInt32 nIndex); + [DllImport("Everything64.dll")] + public static extern bool Everything_GetResultDateRun(UInt32 nIndex, out long lpFileTime); + [DllImport("Everything64.dll")] + public static extern bool Everything_GetResultDateRecentlyChanged(UInt32 nIndex, out long lpFileTime); + [DllImport("Everything64.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultHighlightedFileName(UInt32 nIndex); + [DllImport("Everything64.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultHighlightedPath(UInt32 nIndex); + [DllImport("Everything64.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr Everything_GetResultHighlightedFullPathAndFileName(UInt32 nIndex); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_GetRunCountFromFileName(string lpFileName); + [DllImport("Everything64.dll")] + public static extern bool Everything_SetRunCountFromFileName(string lpFileName, UInt32 dwRunCount); + [DllImport("Everything64.dll")] + public static extern UInt32 Everything_IncRunCountFromFileName(string lpFileName); + + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + UInt32 i; + + // set the search + Everything_SetSearchW(textBox1.Text); + + // use our own custom scrollbar... + // Everything_SetMax(listBox1.ClientRectangle.Height / listBox1.ItemHeight); + // Everything_SetOffset(VerticalScrollBarPosition...); + + // request name and size + Everything_SetRequestFlags(EVERYTHING_REQUEST_FILE_NAME | EVERYTHING_REQUEST_PATH | EVERYTHING_REQUEST_DATE_MODIFIED | EVERYTHING_REQUEST_SIZE); + + Everything_SetSort(13); + + // execute the query + Everything_QueryW(true); + + // sort by path + // Everything_SortResultsByPath(); + + // clear the old list of results + listBox1.Items.Clear(); + + // set the window title + Text = textBox1.Text + " - " + Everything_GetNumResults() + " Results"; + + // loop through the results, adding each result to the listbox. + for (i = 0; i < Everything_GetNumResults(); i++) + { + long date_modified; + long size; + + Everything_GetResultDateModified(i, out date_modified); + Everything_GetResultSize(i, out size); + + // add it to the list box + listBox1.Items.Insert((int)i, "Size: " + size.ToString() + " Date Modified: " + DateTime.FromFileTime(date_modified).Year + "/" + DateTime.FromFileTime(date_modified).Month + "/" + DateTime.FromFileTime(date_modified).Day + " " + DateTime.FromFileTime(date_modified).Hour + ":" + DateTime.FromFileTime(date_modified).Minute.ToString("D2") + " Filename: " + Marshal.PtrToStringUni(Everything_GetResultFileName(i))); + } + } + } +} \ No newline at end of file diff --git a/Everything-SDK/example/CSharpx64/Form1.resx b/Everything-SDK/example/CSharpx64/Form1.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/Everything-SDK/example/CSharpx64/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Everything-SDK/example/CSharpx64/Program.cs b/Everything-SDK/example/CSharpx64/Program.cs new file mode 100644 index 0000000..28a5e17 --- /dev/null +++ b/Everything-SDK/example/CSharpx64/Program.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace WindowsApplication1 +{ + + static class Program + { + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + Application.Run(new Form1()); + } + } +} \ No newline at end of file diff --git a/Everything-SDK/example/CSharpx64/Properties/AssemblyInfo.cs b/Everything-SDK/example/CSharpx64/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2542af8 --- /dev/null +++ b/Everything-SDK/example/CSharpx64/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WindowsApplication1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsApplication1")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("00417877-82e2-4176-8724-bbe7870ee348")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Everything-SDK/example/CSharpx64/Properties/Resources.Designer.cs b/Everything-SDK/example/CSharpx64/Properties/Resources.Designer.cs new file mode 100644 index 0000000..0b78595 --- /dev/null +++ b/Everything-SDK/example/CSharpx64/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsApplication1.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsApplication1.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Everything-SDK/example/CSharpx64/Properties/Resources.resx b/Everything-SDK/example/CSharpx64/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Everything-SDK/example/CSharpx64/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Everything-SDK/example/CSharpx64/Properties/Settings.Designer.cs b/Everything-SDK/example/CSharpx64/Properties/Settings.Designer.cs new file mode 100644 index 0000000..d021597 --- /dev/null +++ b/Everything-SDK/example/CSharpx64/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsApplication1.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Everything-SDK/example/CSharpx64/Properties/Settings.settings b/Everything-SDK/example/CSharpx64/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Everything-SDK/example/CSharpx64/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Everything-SDK/example/CSharpx64/WindowsApplication1.csproj b/Everything-SDK/example/CSharpx64/WindowsApplication1.csproj new file mode 100644 index 0000000..bc13428 --- /dev/null +++ b/Everything-SDK/example/CSharpx64/WindowsApplication1.csproj @@ -0,0 +1,110 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1} + WinExe + Properties + WindowsApplication1 + WindowsApplication1 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + + + + + + + + + + + + Form + + + Form1.cs + + + + + Designer + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + \ No newline at end of file diff --git a/Everything-SDK/example/CSharpx64/WindowsApplication1.sln b/Everything-SDK/example/CSharpx64/WindowsApplication1.sln new file mode 100644 index 0000000..bd0b1b2 --- /dev/null +++ b/Everything-SDK/example/CSharpx64/WindowsApplication1.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsApplication1", "WindowsApplication1.csproj", "{FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Debug|x64.ActiveCfg = Debug|x64 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Debug|x64.Build.0 = Debug|x64 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Debug|x86.ActiveCfg = Debug|x86 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Debug|x86.Build.0 = Debug|x86 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Release|Any CPU.Build.0 = Release|Any CPU + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Release|x64.ActiveCfg = Release|x64 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Release|x64.Build.0 = Release|x64 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Release|x86.ActiveCfg = Release|x86 + {FAB4597B-1FE6-4D40-8CD9-49BA8664C3B1}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Everything-SDK/example/CSharpx64/WindowsApplication1.suo b/Everything-SDK/example/CSharpx64/WindowsApplication1.suo new file mode 100644 index 0000000..b34188d Binary files /dev/null and b/Everything-SDK/example/CSharpx64/WindowsApplication1.suo differ diff --git a/Everything-SDK/example/CSharpx64/obj/WindowsApplication1.csproj.FileListAbsolute.txt b/Everything-SDK/example/CSharpx64/obj/WindowsApplication1.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..0a69907 --- /dev/null +++ b/Everything-SDK/example/CSharpx64/obj/WindowsApplication1.csproj.FileListAbsolute.txt @@ -0,0 +1,20 @@ +D:\dev\everything\sdk\example\CSharp\bin\x86\Debug\WindowsApplication1.exe +D:\dev\everything\sdk\example\CSharp\bin\x86\Debug\WindowsApplication1.pdb +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\ResolveAssemblyReference.cache +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.Form1.resources +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.Properties.Resources.resources +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.csproj.GenerateResource.Cache +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.exe +D:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.pdb +C:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.exe +C:\dev\everything\sdk\example\CSharp\obj\x86\Debug\WindowsApplication1.pdb +C:\dev\everything\sdk\example\CSharpx64\obj\x86\Debug\WindowsApplication1.exe +C:\dev\everything\sdk\example\CSharpx64\obj\x86\Debug\WindowsApplication1.pdb +C:\dev\everything\sdk\example\CSharpx64\bin\x64\Debug\WindowsApplication1.exe +C:\dev\everything\sdk\example\CSharpx64\bin\x64\Debug\WindowsApplication1.pdb +C:\dev\everything\sdk\example\CSharpx64\obj\x64\Debug\ResolveAssemblyReference.cache +C:\dev\everything\sdk\example\CSharpx64\obj\x64\Debug\WindowsApplication1.Form1.resources +C:\dev\everything\sdk\example\CSharpx64\obj\x64\Debug\WindowsApplication1.Properties.Resources.resources +C:\dev\everything\sdk\example\CSharpx64\obj\x64\Debug\WindowsApplication1.csproj.GenerateResource.Cache +C:\dev\everything\sdk\example\CSharpx64\obj\x64\Debug\WindowsApplication1.exe +C:\dev\everything\sdk\example\CSharpx64\obj\x64\Debug\WindowsApplication1.pdb diff --git a/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.Form1.resources b/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.Form1.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.Form1.resources differ diff --git a/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.Properties.Resources.resources b/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.Properties.Resources.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.Properties.Resources.resources differ diff --git a/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.csproj.GenerateResource.Cache b/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.csproj.GenerateResource.Cache new file mode 100644 index 0000000..66d8163 Binary files /dev/null and b/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.csproj.GenerateResource.Cache differ diff --git a/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.exe b/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.exe new file mode 100644 index 0000000..60c924c Binary files /dev/null and b/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.exe differ diff --git a/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.pdb b/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.pdb new file mode 100644 index 0000000..9afe2eb Binary files /dev/null and b/Everything-SDK/example/CSharpx64/obj/x64/Debug/WindowsApplication1.pdb differ diff --git a/Everything-SDK/example/CSharpx64/obj/x86/Debug/WindowsApplication1.Form1.resources b/Everything-SDK/example/CSharpx64/obj/x86/Debug/WindowsApplication1.Form1.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/Everything-SDK/example/CSharpx64/obj/x86/Debug/WindowsApplication1.Form1.resources differ diff --git a/Everything-SDK/example/CSharpx64/obj/x86/Debug/WindowsApplication1.Properties.Resources.resources b/Everything-SDK/example/CSharpx64/obj/x86/Debug/WindowsApplication1.Properties.Resources.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/Everything-SDK/example/CSharpx64/obj/x86/Debug/WindowsApplication1.Properties.Resources.resources differ diff --git a/Everything-SDK/example/CSharpx64/obj/x86/Debug/WindowsApplication1.csproj.GenerateResource.Cache b/Everything-SDK/example/CSharpx64/obj/x86/Debug/WindowsApplication1.csproj.GenerateResource.Cache new file mode 100644 index 0000000..66d8163 Binary files /dev/null and b/Everything-SDK/example/CSharpx64/obj/x86/Debug/WindowsApplication1.csproj.GenerateResource.Cache differ diff --git a/Everything-SDK/example/Everything C# CLI Example by dipique.URL b/Everything-SDK/example/Everything C# CLI Example by dipique.URL new file mode 100644 index 0000000..1dc7c89 --- /dev/null +++ b/Everything-SDK/example/Everything C# CLI Example by dipique.URL @@ -0,0 +1,5 @@ +[InternetShortcut] +URL=https://github.com/dipique/everythingio +IDList= +HotKey=0 +IconIndex=0 diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1.sln b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1.sln new file mode 100644 index 0000000..0b82b7a --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WindowsApplication1", "WindowsApplication1\WindowsApplication1.vbproj", "{0D15552C-AEB4-4B1A-8CCD-1E533557EDA1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0D15552C-AEB4-4B1A-8CCD-1E533557EDA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D15552C-AEB4-4B1A-8CCD-1E533557EDA1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D15552C-AEB4-4B1A-8CCD-1E533557EDA1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D15552C-AEB4-4B1A-8CCD-1E533557EDA1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/Form1.Designer.vb b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/Form1.Designer.vb new file mode 100644 index 0000000..3ce430f --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/Form1.Designer.vb @@ -0,0 +1,72 @@ + _ +Partial Class Form1 + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button + Me.TextBox1 = New System.Windows.Forms.TextBox + Me.ListBox1 = New System.Windows.Forms.ListBox + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(524, 98) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(100, 24) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Button1" + Me.Button1.UseVisualStyleBackColor = True + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(50, 102) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(468, 20) + Me.TextBox1.TabIndex = 1 + ' + 'ListBox1 + ' + Me.ListBox1.FormattingEnabled = True + Me.ListBox1.Location = New System.Drawing.Point(50, 155) + Me.ListBox1.Name = "ListBox1" + Me.ListBox1.Size = New System.Drawing.Size(574, 394) + Me.ListBox1.TabIndex = 2 + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(822, 796) + Me.Controls.Add(Me.ListBox1) + Me.Controls.Add(Me.TextBox1) + Me.Controls.Add(Me.Button1) + Me.Name = "Form1" + Me.Text = "Form1" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents ListBox1 As System.Windows.Forms.ListBox + +End Class diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/Form1.resx b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/Form1.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/Form1.vb b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/Form1.vb new file mode 100644 index 0000000..1254750 --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/Form1.vb @@ -0,0 +1,74 @@ +' Add an Imports statement at the top of the class, structure, or +' module that uses the DllImport attribute. + +Public Class Form1 + + Public Declare Unicode Function Everything_SetSearchW Lib "d:\dev\everything\sdk\dll\Everything32.dll" (ByVal search As String) As UInt32 + Public Declare Unicode Function Everything_SetRequestFlags Lib "d:\dev\everything\sdk\dll\Everything32.dll" (ByVal dwRequestFlags As UInt32) As UInt32 + Public Declare Unicode Function Everything_QueryW Lib "d:\dev\everything\sdk\dll\Everything32.dll" (ByVal bWait As Integer) As Integer + Public Declare Unicode Function Everything_GetNumResults Lib "d:\dev\everything\sdk\dll\Everything32.dll" () As UInt32 + Public Declare Unicode Function Everything_GetResultFileNameW Lib "d:\dev\everything\sdk\dll\Everything32.dll" (ByVal index As UInt32) As IntPtr + Public Declare Unicode Function Everything_GetLastError Lib "d:\dev\everything\sdk\dll\Everything32.dll" () As UInt32 + Public Declare Unicode Function Everything_GetResultFullPathNameW Lib "d:\dev\everything\sdk\dll\Everything32.dll" (ByVal index As UInt32, ByVal buf As System.Text.StringBuilder, ByVal size As UInt32) As UInt32 + Public Declare Unicode Function Everything_GetResultSize Lib "d:\dev\everything\sdk\dll\Everything32.dll" (ByVal index As UInt32, ByRef size As UInt64) As Integer + Public Declare Unicode Function Everything_GetResultDateModified Lib "d:\dev\everything\sdk\dll\Everything32.dll" (ByVal index As UInt32, ByRef ft As UInt64) As Integer + + Public Const EVERYTHING_REQUEST_FILE_NAME = &H1 + Public Const EVERYTHING_REQUEST_PATH = &H00000002 + Public Const EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME = &H00000004 + Public Const EVERYTHING_REQUEST_EXTENSION = &H00000008 + Public Const EVERYTHING_REQUEST_SIZE = &H00000010 + Public Const EVERYTHING_REQUEST_DATE_CREATED = &H00000020 + Public Const EVERYTHING_REQUEST_DATE_MODIFIED = &H00000040 + Public Const EVERYTHING_REQUEST_DATE_ACCESSED = &H00000080 + Public Const EVERYTHING_REQUEST_ATTRIBUTES = &H00000100 + Public Const EVERYTHING_REQUEST_FILE_LIST_FILE_NAME = &H00000200 + Public Const EVERYTHING_REQUEST_RUN_COUNT = &H00000400 + Public Const EVERYTHING_REQUEST_DATE_RUN = &H00000800 + Public Const EVERYTHING_REQUEST_DATE_RECENTLY_CHANGED = &H00001000 + Public Const EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME = &H00002000 + Public Const EVERYTHING_REQUEST_HIGHLIGHTED_PATH = &H00004000 + Public Const EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME = &H00008000 + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + + Everything_SetSearchW(TextBox1.Text) + Everything_SetRequestFlags(EVERYTHING_REQUEST_FILE_NAME Or EVERYTHING_REQUEST_PATH Or EVERYTHING_REQUEST_SIZE Or EVERYTHING_REQUEST_DATE_MODIFIED) + Everything_QueryW(1) + + Dim NumResults As UInt32 + Dim i As UInt32 + Dim filename As New System.Text.StringBuilder(260) + Dim size As UInt64 + Dim ftdm As UInt64 + Dim DateModified As System.DateTime + + NumResults = Everything_GetNumResults() + + ListBox1.Items.Clear() + + If NumResults > 0 Then + For i = 0 To NumResults - 1 + + Everything_GetResultFullPathNameW(i, filename, filename.Capacity) + Everything_GetResultSize(i, size) + Everything_GetResultDateModified(i, ftdm) + + ' Everything uses &HFFFFFFFFFFFFFFFFUL for unknown dates + ' System.DateTime.FromFileTime does not like this value + ' so set the DateModified to Nothing when Everything returns &HFFFFFFFFFFFFFFFFUL + If ftdm = &HFFFFFFFFFFFFFFFFUL Then + DateModified = Nothing + Else + DateModified = System.DateTime.FromFileTime(ftdm) + + End If + + ' ListBox1.Items.Insert(i, filename.ToString() & " size:" & size & " date:" & DateModified.ToString()) + ListBox1.Items.Insert(i, System.Runtime.InteropServices.Marshal.PtrToStringUni(Everything_GetResultFileNameW(i)) & " Size:" & size & " Date Modified:" & DateModified.ToString()) + Next + End If + + End Sub + +End Class diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Application.Designer.vb b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Application.Designer.vb new file mode 100644 index 0000000..bd9a7b2 --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Application.Designer.vb @@ -0,0 +1,38 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.5485 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + 'NOTE: This file is auto-generated; do not modify it directly. To make changes, + ' or if you encounter build errors in this file, go to the Project Designer + ' (go to Project Properties or double-click the My Project node in + ' Solution Explorer), and make changes on the Application tab. + ' + Partial Friend Class MyApplication + + _ + Public Sub New() + MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) + Me.IsSingleInstance = false + Me.EnableVisualStyles = true + Me.SaveMySettingsOnExit = true + Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses + End Sub + + _ + Protected Overrides Sub OnCreateMainForm() + Me.MainForm = Global.WindowsApplication1.Form1 + End Sub + End Class +End Namespace diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Application.myapp b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Application.myapp new file mode 100644 index 0000000..0f12f32 --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + true + Form1 + false + 0 + true + 0 + true + \ No newline at end of file diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/AssemblyInfo.vb b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..7e4fe9b --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Resources.Designer.vb b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Resources.Designer.vb new file mode 100644 index 0000000..219539d --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.5485 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("WindowsApplication1.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Resources.resx b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Settings.Designer.vb b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Settings.Designer.vb new file mode 100644 index 0000000..e721471 --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.5485 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.WindowsApplication1.My.MySettings + Get + Return Global.WindowsApplication1.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Settings.settings b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Settings.settings new file mode 100644 index 0000000..85b890b --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/WindowsApplication1.vbproj b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/WindowsApplication1.vbproj new file mode 100644 index 0000000..5fef255 --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/WindowsApplication1.vbproj @@ -0,0 +1,107 @@ + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {0D15552C-AEB4-4B1A-8CCD-1E533557EDA1} + WinExe + WindowsApplication1.My.MyApplication + WindowsApplication1 + WindowsApplication1 + WindowsForms + + + true + full + true + true + bin\Debug\ + WindowsApplication1.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + x86 + + + pdbonly + false + true + true + bin\Release\ + WindowsApplication1.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + + + + + + + + + + + + + + + + + + + + Form + + + Form1.vb + Form + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + Designer + Form1.vb + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + \ No newline at end of file diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/WindowsApplication1.vbproj.user b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/WindowsApplication1.vbproj.user new file mode 100644 index 0000000..c8dfea1 --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/WindowsApplication1.vbproj.user @@ -0,0 +1,16 @@ + + + publish\ + + + + + + + + + 0 + en-US + false + + \ No newline at end of file diff --git a/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/obj/WindowsApplication1.vbproj.FileListAbsolute.txt b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/obj/WindowsApplication1.vbproj.FileListAbsolute.txt new file mode 100644 index 0000000..49f8c8e --- /dev/null +++ b/Everything-SDK/example/Visual Basic/WindowsApplication1/WindowsApplication1/obj/WindowsApplication1.vbproj.FileListAbsolute.txt @@ -0,0 +1,30 @@ +C:\Users\Administrator\Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\ResolveAssemblyReference.cache +C:\Users\Administrator\Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.Resources.resources +C:\Users\Administrator\Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.vbproj.GenerateResource.Cache +C:\Users\Administrator\Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.exe +C:\Users\Administrator\Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.pdb +C:\Users\Administrator\Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.xml +C:\Users\Administrator\Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.exe +C:\Users\Administrator\Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.xml +C:\Users\Administrator\Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.pdb +C:\Users\Administrator\Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.Form1.resources +C:\Private\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.exe +C:\Private\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.xml +C:\Private\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.pdb +C:\Private\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\ResolveAssemblyReference.cache +C:\Private\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.Form1.resources +C:\Private\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.Resources.resources +C:\Private\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.vbproj.GenerateResource.Cache +C:\Private\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.exe +C:\Private\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.pdb +C:\Private\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.xml +C:\dev\everything\sdk\example\Visual Basic\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.exe +C:\dev\everything\sdk\example\Visual Basic\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.xml +C:\dev\everything\sdk\example\Visual Basic\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.pdb +C:\dev\everything\sdk\example\Visual Basic\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.exe +C:\dev\everything\sdk\example\Visual Basic\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.pdb +C:\dev\everything\sdk\example\Visual Basic\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.xml +C:\dev\everything\sdk\example\Visual Basic\WindowsApplication1\WindowsApplication1\obj\Debug\ResolveAssemblyReference.cache +C:\dev\everything\sdk\example\Visual Basic\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.Form1.resources +C:\dev\everything\sdk\example\Visual Basic\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.Resources.resources +C:\dev\everything\sdk\example\Visual Basic\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.vbproj.GenerateResource.Cache diff --git a/Everything-SDK/example/dll.test.c b/Everything-SDK/example/dll.test.c new file mode 100644 index 0000000..965dd7c Binary files /dev/null and b/Everything-SDK/example/dll.test.c differ diff --git a/Everything-SDK/example/dll.test.cpp b/Everything-SDK/example/dll.test.cpp new file mode 100644 index 0000000..4ee78b6 Binary files /dev/null and b/Everything-SDK/example/dll.test.cpp differ diff --git a/Everything-SDK/include/Everything.h b/Everything-SDK/include/Everything.h new file mode 100644 index 0000000..f883676 --- /dev/null +++ b/Everything-SDK/include/Everything.h @@ -0,0 +1,253 @@ + +// +// Copyright (C) 2016 David Carpenter +// +// Permission is hereby granted, free of charge, +// to any person obtaining a copy of this software +// and associated documentation files (the "Software"), +// to deal in the Software without restriction, +// including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#ifndef _EVERYTHING_DLL_ +#define _EVERYTHING_DLL_ + +#ifndef _INC_WINDOWS +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// if not defined, version is 1. +#define EVERYTHING_SDK_VERSION 2 + +#define EVERYTHING_OK 0 // no error detected +#define EVERYTHING_ERROR_MEMORY 1 // out of memory. +#define EVERYTHING_ERROR_IPC 2 // Everything search client is not running +#define EVERYTHING_ERROR_REGISTERCLASSEX 3 // unable to register window class. +#define EVERYTHING_ERROR_CREATEWINDOW 4 // unable to create listening window +#define EVERYTHING_ERROR_CREATETHREAD 5 // unable to create listening thread +#define EVERYTHING_ERROR_INVALIDINDEX 6 // invalid index +#define EVERYTHING_ERROR_INVALIDCALL 7 // invalid call +#define EVERYTHING_ERROR_INVALIDREQUEST 8 // invalid request data, request data first. +#define EVERYTHING_ERROR_INVALIDPARAMETER 9 // bad parameter. + +#define EVERYTHING_SORT_NAME_ASCENDING 1 +#define EVERYTHING_SORT_NAME_DESCENDING 2 +#define EVERYTHING_SORT_PATH_ASCENDING 3 +#define EVERYTHING_SORT_PATH_DESCENDING 4 +#define EVERYTHING_SORT_SIZE_ASCENDING 5 +#define EVERYTHING_SORT_SIZE_DESCENDING 6 +#define EVERYTHING_SORT_EXTENSION_ASCENDING 7 +#define EVERYTHING_SORT_EXTENSION_DESCENDING 8 +#define EVERYTHING_SORT_TYPE_NAME_ASCENDING 9 +#define EVERYTHING_SORT_TYPE_NAME_DESCENDING 10 +#define EVERYTHING_SORT_DATE_CREATED_ASCENDING 11 +#define EVERYTHING_SORT_DATE_CREATED_DESCENDING 12 +#define EVERYTHING_SORT_DATE_MODIFIED_ASCENDING 13 +#define EVERYTHING_SORT_DATE_MODIFIED_DESCENDING 14 +#define EVERYTHING_SORT_ATTRIBUTES_ASCENDING 15 +#define EVERYTHING_SORT_ATTRIBUTES_DESCENDING 16 +#define EVERYTHING_SORT_FILE_LIST_FILENAME_ASCENDING 17 +#define EVERYTHING_SORT_FILE_LIST_FILENAME_DESCENDING 18 +#define EVERYTHING_SORT_RUN_COUNT_ASCENDING 19 +#define EVERYTHING_SORT_RUN_COUNT_DESCENDING 20 +#define EVERYTHING_SORT_DATE_RECENTLY_CHANGED_ASCENDING 21 +#define EVERYTHING_SORT_DATE_RECENTLY_CHANGED_DESCENDING 22 +#define EVERYTHING_SORT_DATE_ACCESSED_ASCENDING 23 +#define EVERYTHING_SORT_DATE_ACCESSED_DESCENDING 24 +#define EVERYTHING_SORT_DATE_RUN_ASCENDING 25 +#define EVERYTHING_SORT_DATE_RUN_DESCENDING 26 + +#define EVERYTHING_REQUEST_FILE_NAME 0x00000001 +#define EVERYTHING_REQUEST_PATH 0x00000002 +#define EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME 0x00000004 +#define EVERYTHING_REQUEST_EXTENSION 0x00000008 +#define EVERYTHING_REQUEST_SIZE 0x00000010 +#define EVERYTHING_REQUEST_DATE_CREATED 0x00000020 +#define EVERYTHING_REQUEST_DATE_MODIFIED 0x00000040 +#define EVERYTHING_REQUEST_DATE_ACCESSED 0x00000080 +#define EVERYTHING_REQUEST_ATTRIBUTES 0x00000100 +#define EVERYTHING_REQUEST_FILE_LIST_FILE_NAME 0x00000200 +#define EVERYTHING_REQUEST_RUN_COUNT 0x00000400 +#define EVERYTHING_REQUEST_DATE_RUN 0x00000800 +#define EVERYTHING_REQUEST_DATE_RECENTLY_CHANGED 0x00001000 +#define EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME 0x00002000 +#define EVERYTHING_REQUEST_HIGHLIGHTED_PATH 0x00004000 +#define EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME 0x00008000 + +#define EVERYTHING_TARGET_MACHINE_X86 1 +#define EVERYTHING_TARGET_MACHINE_X64 2 +#define EVERYTHING_TARGET_MACHINE_ARM 3 + +#ifndef EVERYTHINGAPI +#define EVERYTHINGAPI __stdcall +#endif + +#ifndef EVERYTHINGUSERAPI +#define EVERYTHINGUSERAPI __declspec(dllimport) +#endif + +// write search state +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetSearchW(LPCWSTR lpString); +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetSearchA(LPCSTR lpString); +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetMatchPath(BOOL bEnable); +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetMatchCase(BOOL bEnable); +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetMatchWholeWord(BOOL bEnable); +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetRegex(BOOL bEnable); +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetMax(DWORD dwMax); +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetOffset(DWORD dwOffset); +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetReplyWindow(HWND hWnd); +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetReplyID(DWORD dwId); +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetSort(DWORD dwSort); // Everything 1.4.1 +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetRequestFlags(DWORD dwRequestFlags); // Everything 1.4.1 + +// read search state +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_GetMatchPath(void); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_GetMatchCase(void); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_GetMatchWholeWord(void); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_GetRegex(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetMax(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetOffset(void); +EVERYTHINGUSERAPI LPCSTR EVERYTHINGAPI Everything_GetSearchA(void); +EVERYTHINGUSERAPI LPCWSTR EVERYTHINGAPI Everything_GetSearchW(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetLastError(void); +EVERYTHINGUSERAPI HWND EVERYTHINGAPI Everything_GetReplyWindow(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetReplyID(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetSort(void); // Everything 1.4.1 +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetRequestFlags(void); // Everything 1.4.1 + +// execute query +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_QueryA(BOOL bWait); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_QueryW(BOOL bWait); + +// query reply +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsQueryReply(UINT message,WPARAM wParam,LPARAM lParam,DWORD dwId); + +// write result state +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SortResultsByPath(void); + +// read result state +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetNumFileResults(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetNumFolderResults(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetNumResults(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetTotFileResults(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetTotFolderResults(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetTotResults(void); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsVolumeResult(DWORD dwIndex); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsFolderResult(DWORD dwIndex); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsFileResult(DWORD dwIndex); +EVERYTHINGUSERAPI LPCWSTR EVERYTHINGAPI Everything_GetResultFileNameW(DWORD dwIndex); +EVERYTHINGUSERAPI LPCSTR EVERYTHINGAPI Everything_GetResultFileNameA(DWORD dwIndex); +EVERYTHINGUSERAPI LPCWSTR EVERYTHINGAPI Everything_GetResultPathW(DWORD dwIndex); +EVERYTHINGUSERAPI LPCSTR EVERYTHINGAPI Everything_GetResultPathA(DWORD dwIndex); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetResultFullPathNameA(DWORD dwIndex,LPSTR buf,DWORD bufsize); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetResultFullPathNameW(DWORD dwIndex,LPWSTR wbuf,DWORD wbuf_size_in_wchars); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetResultListSort(void); // Everything 1.4.1 +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetResultListRequestFlags(void); // Everything 1.4.1 +EVERYTHINGUSERAPI LPCWSTR EVERYTHINGAPI Everything_GetResultExtensionW(DWORD dwIndex); // Everything 1.4.1 +EVERYTHINGUSERAPI LPCSTR EVERYTHINGAPI Everything_GetResultExtensionA(DWORD dwIndex); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_GetResultSize(DWORD dwIndex,LARGE_INTEGER *lpSize); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_GetResultDateCreated(DWORD dwIndex,FILETIME *lpDateCreated); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_GetResultDateModified(DWORD dwIndex,FILETIME *lpDateModified); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_GetResultDateAccessed(DWORD dwIndex,FILETIME *lpDateAccessed); // Everything 1.4.1 +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetResultAttributes(DWORD dwIndex); // Everything 1.4.1 +EVERYTHINGUSERAPI LPCWSTR EVERYTHINGAPI Everything_GetResultFileListFileNameW(DWORD dwIndex); // Everything 1.4.1 +EVERYTHINGUSERAPI LPCSTR EVERYTHINGAPI Everything_GetResultFileListFileNameA(DWORD dwIndex); // Everything 1.4.1 +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetResultRunCount(DWORD dwIndex); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_GetResultDateRun(DWORD dwIndex,FILETIME *lpDateRun); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_GetResultDateRecentlyChanged(DWORD dwIndex,FILETIME *lpDateRecentlyChanged); +EVERYTHINGUSERAPI LPCWSTR EVERYTHINGAPI Everything_GetResultHighlightedFileNameW(DWORD dwIndex); // Everything 1.4.1 +EVERYTHINGUSERAPI LPCSTR EVERYTHINGAPI Everything_GetResultHighlightedFileNameA(DWORD dwIndex); // Everything 1.4.1 +EVERYTHINGUSERAPI LPCWSTR EVERYTHINGAPI Everything_GetResultHighlightedPathW(DWORD dwIndex); // Everything 1.4.1 +EVERYTHINGUSERAPI LPCSTR EVERYTHINGAPI Everything_GetResultHighlightedPathA(DWORD dwIndex); // Everything 1.4.1 +EVERYTHINGUSERAPI LPCWSTR EVERYTHINGAPI Everything_GetResultHighlightedFullPathAndFileNameW(DWORD dwIndex); // Everything 1.4.1 +EVERYTHINGUSERAPI LPCSTR EVERYTHINGAPI Everything_GetResultHighlightedFullPathAndFileNameA(DWORD dwIndex); // Everything 1.4.1 + +// reset state and free any allocated memory +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_Reset(void); +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_CleanUp(void); + +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetMajorVersion(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetMinorVersion(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetRevision(void); +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetBuildNumber(void); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_Exit(void); +UINT EVERYTHINGAPI Everything_MSIExitAndStopService(void *msihandle); +UINT EVERYTHINGAPI Everything_MSIStartService(void *msihandle); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsDBLoaded(void); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsAdmin(void); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsAppData(void); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_RebuildDB(void); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_UpdateAllFolderIndexes(void); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_SaveDB(void); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_SaveRunHistory(void); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_DeleteRunHistory(void); // Everything 1.4.1 +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetTargetMachine(void); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsFastSort(DWORD sortType); // Everything 1.4.1.859 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsFileInfoIndexed(DWORD fileInfoType); // Everything 1.4.1.859 + +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetRunCountFromFileNameW(LPCWSTR lpFileName); // Everything 1.4.1 +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetRunCountFromFileNameA(LPCSTR lpFileName); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_SetRunCountFromFileNameW(LPCWSTR lpFileName,DWORD dwRunCount); // Everything 1.4.1 +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_SetRunCountFromFileNameA(LPCSTR lpFileName,DWORD dwRunCount); // Everything 1.4.1 +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_IncRunCountFromFileNameW(LPCWSTR lpFileName); // Everything 1.4.1 +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_IncRunCountFromFileNameA(LPCSTR lpFileName); // Everything 1.4.1 + +#ifdef UNICODE +#define Everything_SetSearch Everything_SetSearchW +#define Everything_GetSearch Everything_GetSearchW +#define Everything_Query Everything_QueryW +#define Everything_Query2 Everything_Query2W +#define Everything_GetResultFileName Everything_GetResultFileNameW +#define Everything_GetResultPath Everything_GetResultPathW +#define Everything_GetResultFullPathName Everything_GetResultFullPathNameW +#define Everything_GetResultExtension Everything_GetResultExtensionW +#define Everything_GetResultFileListFileName Everything_GetResultFileListFileNameW +#define Everything_GetResultHighlightedFileName Everything_GetResultHighlightedFileNameW +#define Everything_GetResultHighlightedPath Everything_GetResultHighlightedPathW +#define Everything_GetResultHighlightedFullPathAndFileName Everything_GetResultHighlightedFullPathAndFileNameW +#define Everything_GetRunCountFromFileName Everything_GetRunCountFromFileNameW +#define Everything_SetRunCountFromFileName Everything_SetRunCountFromFileNameW +#define Everything_IncRunCountFromFileName Everything_IncRunCountFromFileNameW +#else +#define Everything_SetSearch Everything_SetSearchA +#define Everything_GetSearch Everything_GetSearchA +#define Everything_Query Everything_QueryA +#define Everything_Query2 Everything_Query2A +#define Everything_GetResultFileName Everything_GetResultFileNameA +#define Everything_GetResultPath Everything_GetResultPathA +#define Everything_GetResultFullPathName Everything_GetResultFullPathNameA +#define Everything_GetResultExtension Everything_GetResultExtensionA +#define Everything_GetResultFileListFileName Everything_GetResultFileListFileNameA +#define Everything_GetResultHighlightedFileName Everything_GetResultHighlightedFileNameA +#define Everything_GetResultHighlightedPath Everything_GetResultHighlightedPathA +#define Everything_GetResultHighlightedFullPathAndFileName Everything_GetResultHighlightedFullPathAndFileNameA +#define Everything_GetRunCountFromFileName Everything_GetRunCountFromFileNameA +#define Everything_SetRunCountFromFileName Everything_SetRunCountFromFileNameA +#define Everything_IncRunCountFromFileName Everything_IncRunCountFromFileNameA +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Everything-SDK/ipc/everything_ipc.h b/Everything-SDK/ipc/everything_ipc.h new file mode 100644 index 0000000..3d62e84 --- /dev/null +++ b/Everything-SDK/ipc/everything_ipc.h @@ -0,0 +1,903 @@ + +// Everything IPC + +#ifndef _EVERYTHING_IPC_H_ +#define _EVERYTHING_IPC_H_ + +// C +#ifdef __cplusplus +extern "C" { +#endif + +#define EVERYTHING_WM_IPC (WM_USER) + +#define EVERYTHING_IPC_TARGET_MACHINE_X86 1 +#define EVERYTHING_IPC_TARGET_MACHINE_X64 2 +#define EVERYTHING_IPC_TARGET_MACHINE_ARM 3 +#define EVERYTHING_IPC_TARGET_MACHINE_ARM64 4 + +// built in filters +#define EVERYTHING_IPC_FILTER_EVERYTHING 0 +#define EVERYTHING_IPC_FILTER_AUDIO 1 +#define EVERYTHING_IPC_FILTER_COMPRESSED 2 +#define EVERYTHING_IPC_FILTER_DOCUMENT 3 +#define EVERYTHING_IPC_FILTER_EXECUTABLE 4 +#define EVERYTHING_IPC_FILTER_FOLDER 5 +#define EVERYTHING_IPC_FILTER_PICTURE 6 +#define EVERYTHING_IPC_FILTER_VIDEO 7 +#define EVERYTHING_IPC_FILTER_CUSTOM 8 + +// EVERYTHING_WM_IPC (send to the Everything taskbar notification window) +// the Everything taskbar notification window is always created when Everything is running. (even when the taskbar notification icon is hidden) +// HWND everything_taskbar_notification_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0); +// SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_*,lParam) + +// version format: major.minor.revision.build +// example: 1.4.1.877 +#define EVERYTHING_IPC_GET_MAJOR_VERSION 0 // int major_version = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_GET_MAJOR_VERSION,0); +#define EVERYTHING_IPC_GET_MINOR_VERSION 1 // int minor_version = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_GET_MINOR_VERSION,0); +#define EVERYTHING_IPC_GET_REVISION 2 // int revision = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_GET_REVISION,0); +#define EVERYTHING_IPC_GET_BUILD_NUMBER 3 // int build = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_GET_BUILD,0); +#define EVERYTHING_IPC_EXIT 4 // returns 1 if the program closes. +#define EVERYTHING_IPC_GET_TARGET_MACHINE 5 // int target_machine = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_GET_TARGET_MACHINE,0); returns 0 if not supported. returns a EVERYTHING_IPC_TARGET_MACHINE_* value. requires Everything 1.4.1 + +// uninstall options +#define EVERYTHING_IPC_DELETE_START_MENU_SHORTCUTS 100 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_DELETE_START_MENU_SHORTCUTS,0); +#define EVERYTHING_IPC_DELETE_QUICK_LAUNCH_SHORTCUT 101 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_DELETE_QUICK_LAUNCH_SHORTCUT,0); +#define EVERYTHING_IPC_DELETE_DESKTOP_SHORTCUT 102 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_DELETE_DESKTOP_SHORTCUT,0); +#define EVERYTHING_IPC_DELETE_FOLDER_CONTEXT_MENU 103 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_DELETE_FOLDER_CONTEXT_MENU,0); +#define EVERYTHING_IPC_DELETE_RUN_ON_SYSTEM_STARTUP 104 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_DELETE_RUN_ON_SYSTEM_STARTUP,0); +#define EVERYTHING_IPC_DELETE_URL_PROTOCOL 105 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_DELETE_URL_PROTOCOL,0); + +// install options +#define EVERYTHING_IPC_CREATE_START_MENU_SHORTCUTS 200 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_CREATE_START_MENU_SHORTCUTS,0); +#define EVERYTHING_IPC_CREATE_QUICK_LAUNCH_SHORTCUT 201 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_CREATE_QUICK_LAUNCH_SHORTCUT,0); +#define EVERYTHING_IPC_CREATE_DESKTOP_SHORTCUT 202 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_CREATE_DESKTOP_SHORTCUT,0); +#define EVERYTHING_IPC_CREATE_FOLDER_CONTEXT_MENU 203 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_CREATE_FOLDER_CONTEXT_MENU,0); +#define EVERYTHING_IPC_CREATE_RUN_ON_SYSTEM_STARTUP 204 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_CREATE_RUN_ON_SYSTEM_STARTUP,0); +#define EVERYTHING_IPC_CREATE_URL_PROTOCOL 205 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_CREATE_URL_PROTOCOL,0); + +// get option status; 0 = no, 1 = yes, 2 = indeterminate (partially installed) +#define EVERYTHING_IPC_IS_START_MENU_SHORTCUTS 300 // int ret = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_START_MENU_SHORTCUTS,0); +#define EVERYTHING_IPC_IS_QUICK_LAUNCH_SHORTCUT 301 // int ret = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_QUICK_LAUNCH_SHORTCUT,0); +#define EVERYTHING_IPC_IS_DESKTOP_SHORTCUT 302 // int ret = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_DESKTOP_SHORTCUT,0); +#define EVERYTHING_IPC_IS_FOLDER_CONTEXT_MENU 303 // int ret = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_FOLDER_CONTEXT_MENU,0); +#define EVERYTHING_IPC_IS_RUN_ON_SYSTEM_STARTUP 304 // int ret = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_RUN_ON_SYSTEM_STARTUP,0); +#define EVERYTHING_IPC_IS_URL_PROTOCOL 305 // int ret = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_URL_PROTOCOL,0); +#define EVERYTHING_IPC_IS_SERVICE 306 // int ret = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_SERVICE,0); + +// indexing +#define EVERYTHING_IPC_IS_NTFS_DRIVE_INDEXED 400 // int is_indexed = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_NTFS_DRIVE_INDEXED,drive_index); drive_index: 0-25 = 0=A:, 1=B:, 2=C:... + +// requires Everything 1.4: +#define EVERYTHING_IPC_IS_DB_LOADED 401 // int is_db_loaded = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_DB_LOADED,0); +#define EVERYTHING_IPC_IS_DB_BUSY 402 // int is_db_busy = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_DB_BUSY,0); // db is busy, issueing another action will cancel the current one (if possible). +#define EVERYTHING_IPC_IS_ADMIN 403 // int is_admin = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_ADMIN,0); +#define EVERYTHING_IPC_IS_APPDATA 404 // int is_appdata = (int)SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_APPDATA,0); +#define EVERYTHING_IPC_REBUILD_DB 405 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_REBUILD,0); // forces all indexes to be rescanned. +#define EVERYTHING_IPC_UPDATE_ALL_FOLDER_INDEXES 406 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_UPDATE_ALL_FOLDER_INDEXES,0); // rescan all folder indexes. +#define EVERYTHING_IPC_SAVE_DB 407 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_SAVE_DB,0); // save the db to disk. +#define EVERYTHING_IPC_SAVE_RUN_HISTORY 408 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_SAVE_RUN_HISTORY,0); // save run history to disk. +#define EVERYTHING_IPC_DELETE_RUN_HISTORY 409 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_DELETE_RUN_HISTORY,0); // deletes all run history from memory and disk. +#define EVERYTHING_IPC_IS_FAST_SORT 410 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_FAST_SORT,EVERYTHING_IPC_SORT_*); // is the sort information indexed? +#define EVERYTHING_IPC_IS_FILE_INFO_INDEXED 411 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_FILE_INFO_INDEXED,EVERYTHING_IPC_FILE_INFO_*); // is the file/folder info indexed? + +// Everything 1.5 +#define EVERYTHING_IPC_QUEUE_REBUILD_DB 412 // SendMessage(everything_taskbar_notification_hwnd,EVERYTHING_WM_IPC,EVERYTHING_IPC_QUEUE_REBUILD_DB,0); // forces all indexes to be rescanned when the db is ready. + +// send the following to an existing Everything search window (requires Everything 1.4.1) +// SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_*,0); +#define EVERYTHING_IPC_IS_MATCH_CASE 500 // int is_match_case = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_MATCH_CASE,0); +#define EVERYTHING_IPC_IS_MATCH_WHOLE_WORD 501 // int is_match_whole_words = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_MATCH_WHOLE_WORD,0); +#define EVERYTHING_IPC_IS_MATCH_PATH 502 // int is_match_path = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_MATCH_PATH,0); +#define EVERYTHING_IPC_IS_MATCH_DIACRITICS 503 // int is_match_diacritics = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_MATCH_DIACRITICS,0); +#define EVERYTHING_IPC_IS_REGEX 504 // int is_regex = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_REGEX,0); +#define EVERYTHING_IPC_IS_FILTERS 505 // int is_filters = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_FILTERS,0); +#define EVERYTHING_IPC_IS_PREVIEW 506 // int is_preview = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_PREVIEW,0); +#define EVERYTHING_IPC_IS_STATUS_BAR 507 // int is_status_bar = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_STATUS_BAR,0); +#define EVERYTHING_IPC_IS_DETAILS 508 // int is_details = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_DETAILS,0); +#define EVERYTHING_IPC_GET_THUMBNAIL_SIZE 509 // int thumbnail_size = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_GET_THUMBNAIL_SIZE,0); 0 = details +#define EVERYTHING_IPC_GET_SORT 510 // int sort = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_GET_SORT,0); sort can be one of EVERYTHING_IPC_SORT_* types. +#define EVERYTHING_IPC_GET_ON_TOP 511 // int on_top = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_GET_ON_TOP,0); 0=never, 1=always, 2=while searching. +#define EVERYTHING_IPC_GET_FILTER 512 // int filter = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_GET_FILTER,0); filter can be one of EVERYTHING_IPC_FILTER_* types. +#define EVERYTHING_IPC_GET_FILTER_INDEX 513 // int filter_index = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_GET_FILTER_INDEX,0); + +// Everything 1.5 +#define EVERYTHING_IPC_IS_MATCH_PREFIX 514 // int is_match_prefix = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_MATCH_PREFIX,0); +#define EVERYTHING_IPC_IS_MATCH_SUFFIX 515 // int is_match_suffix = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_MATCH_SUFFIX,0); +#define EVERYTHING_IPC_IS_IGNORE_PUNCTUATION 516 // int is_ignore_punctuation = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_IGNORE_PUNCTUATION,0); +#define EVERYTHING_IPC_IS_IGNORE_WHITESPACE 517 // int is_ignore_whitespace = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_IGNORE_WHITESPACE,0); +#define EVERYTHING_IPC_IS_SEARCH_AS_YOU_TYPE 518 // int is_search_as_you_type = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_IS_SEARCH_AS_YOU_TYPE,0); + +// command IDs to send to an Everything search window. +// SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),WM_COMMAND,MAKEWPARAM(EVERYTHING_IPC_ID_*,0),0); + +// main menus + +#define EVERYTHING_IPC_ID_FILE_MENU 10001 +#define EVERYTHING_IPC_ID_EDIT_MENU 10002 +#define EVERYTHING_IPC_ID_SEARCH_MENU 10003 +#define EVERYTHING_IPC_ID_TOOLS_MENU 10004 +#define EVERYTHING_IPC_ID_HELP_MENU 10005 +#define EVERYTHING_IPC_ID_TOOLBAR 10006 +#define EVERYTHING_IPC_ID_SEARCH_EDIT 10007 +#define EVERYTHING_IPC_ID_FILTER 10008 +#define EVERYTHING_IPC_ID_RESULTS_HEADER 10009 +#define EVERYTHING_IPC_ID_STATUS 10010 +#define EVERYTHING_IPC_ID_VIEW_ZOOM_MENU 10012 +#define EVERYTHING_IPC_ID_VIEW_MENU 10013 +#define EVERYTHING_IPC_ID_VIEW_WINDOW_SIZE_MENU 10019 +#define EVERYTHING_IPC_ID_RESULT_LIST 10020 +#define EVERYTHING_IPC_ID_BOOKMARKS_MENU 10021 +#define EVERYTHING_IPC_ID_VIEW_SORT_BY_MENU 10022 +#define EVERYTHING_IPC_ID_VIEW_GOTO_MENU 10024 +#define EVERYTHING_IPC_ID_VIEW_ONTOP_MENU 10025 +#define EVERYTHING_IPC_ID_PREVIEW 10026 + +// TRAY +#define EVERYTHING_IPC_ID_TRAY_NEW_SEARCH_WINDOW 40001 +#define EVERYTHING_IPC_ID_TRAY_CONNECT_TO_ETP_SERVER 40004 +#define EVERYTHING_IPC_ID_TRAY_OPTIONS 40005 +#define EVERYTHING_IPC_ID_TRAY_EXIT 40006 +#define EVERYTHING_IPC_ID_TRAY_SHOW_SEARCH_WINDOW 40007 +#define EVERYTHING_IPC_ID_TRAY_TOGGLE_SEARCH_WINDOW 40008 + +// FILE +#define EVERYTHING_IPC_ID_FILE_NEW_WINDOW 40010 +#define EVERYTHING_IPC_ID_FILE_CLOSE 40011 +#define EVERYTHING_IPC_ID_FILE_EXPORT 40012 +#define EVERYTHING_IPC_ID_FILE_EXIT 40013 +#define EVERYTHING_IPC_ID_FILE_OPEN_FILELIST 40014 +#define EVERYTHING_IPC_ID_FILE_CLOSE_FILELIST 40015 + +// EDIT +#define EVERYTHING_IPC_ID_EDIT_CUT 40020 +#define EVERYTHING_IPC_ID_EDIT_COPY 40021 +#define EVERYTHING_IPC_ID_EDIT_PASTE 40022 +#define EVERYTHING_IPC_ID_EDIT_SELECT_ALL 40023 +#define EVERYTHING_IPC_ID_EDIT_INVERT_SELECTION 40029 + +// VIEW +#define EVERYTHING_IPC_ID_VIEW_ZOOM_IN 40030 +#define EVERYTHING_IPC_ID_VIEW_ZOOM_OUT 40031 +#define EVERYTHING_IPC_ID_VIEW_ZOOM_RESET 40032 +#define EVERYTHING_IPC_ID_VIEW_TOGGLE_FULLSCREEN 40034 +#define EVERYTHING_IPC_ID_VIEW_AUTO_FIT 40044 +#define EVERYTHING_IPC_ID_VIEW_AUTO_SIZE_1 40045 +#define EVERYTHING_IPC_ID_VIEW_AUTO_SIZE_2 40046 +#define EVERYTHING_IPC_ID_VIEW_AUTO_SIZE_3 40047 +#define EVERYTHING_IPC_ID_VIEW_REFRESH 40036 +#define EVERYTHING_IPC_ID_VIEW_FILTERS 40035 +#define EVERYTHING_IPC_ID_VIEW_SORT_BY_ASCENDING 40037 +#define EVERYTHING_IPC_ID_VIEW_SORT_BY_DESCENDING 40038 +#define EVERYTHING_IPC_ID_VIEW_STATUS_BAR 40039 +#define EVERYTHING_IPC_ID_VIEW_GOTO_BACK 40040 +#define EVERYTHING_IPC_ID_VIEW_GOTO_FORWARD 40041 +#define EVERYTHING_IPC_ID_VIEW_ONTOP_NEVER 40042 +#define EVERYTHING_IPC_ID_VIEW_ONTOP_ALWAYS 40043 +#define EVERYTHING_IPC_ID_VIEW_ONTOP_WHILE_SEARCHING 40048 +#define EVERYTHING_IPC_ID_VIEW_GOTO_HOME 40049 +#define EVERYTHING_IPC_ID_VIEW_TOGGLE_LTR_RTL 40050 +#define EVERYTHING_IPC_ID_VIEW_DETAILS 40051 +#define EVERYTHING_IPC_ID_VIEW_MEDIUM_ICONS 40052 +#define EVERYTHING_IPC_ID_VIEW_LARGE_ICONS 40053 +#define EVERYTHING_IPC_ID_VIEW_EXTRA_LARGE_ICONS 40054 +#define EVERYTHING_IPC_ID_VIEW_PREVIEW 40055 +#define EVERYTHING_IPC_ID_VIEW_GOTO_SHOW_ALL_HISTORY 40056 +#define EVERYTHING_IPC_ID_VIEW_INCREASE_THUMBNAIL_SIZE 40057 +#define EVERYTHING_IPC_ID_VIEW_DECREASE_THUMBNAIL_SIZE 40058 +#define EVERYTHING_IPC_ID_VIEW_SHOW_FILTERS 40096 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_VIEW_HIDE_FILTERS 40097 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_VIEW_SHOW_PREVIEW 40098 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_VIEW_HIDE_PREVIEW 40099 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_VIEW_SHOW_STATUS_BAR 40100 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_VIEW_HIDE_STATUS_BAR 40101 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_VIEW_DETAILS_NO_TOGGLE 40102 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_VIEW_MEDIUM_ICONS_NO_TOGGLE 40103 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_VIEW_LARGE_ICONS_NO_TOGGLE 40104 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_VIEW_EXTRA_LARGE_ICONS_NO_TOGGLE 40105 // Everything 1.4.1 + +// SEARCH +#define EVERYTHING_IPC_ID_SEARCH_TOGGLE_MATCH_CASE 40060 +#define EVERYTHING_IPC_ID_SEARCH_TOGGLE_MATCH_WHOLE_WORD 40061 +#define EVERYTHING_IPC_ID_SEARCH_TOGGLE_MATCH_PATH 40062 +#define EVERYTHING_IPC_ID_SEARCH_TOGGLE_REGEX 40063 +#define EVERYTHING_IPC_ID_SEARCH_TOGGLE_MATCH_DIACRITICS 40066 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_ADD 40067 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_ORGANIZE 40068 +#define EVERYTHING_IPC_ID_SEARCH_ADVANCED_SEARCH 40069 +#define EVERYTHING_IPC_ID_SEARCH_ENABLE_MATCH_CASE 40106 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_ENABLE_MATCH_WHOLE_WORD 40107 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_ENABLE_MATCH_PATH 40108 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_ENABLE_REGEX 40109 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_ENABLE_MATCH_DIACRITICS 40110 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_DISABLE_MATCH_CASE 40111 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_DISABLE_MATCH_WHOLE_WORD 40112 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_DISABLE_MATCH_PATH 40113 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_DISABLE_REGEX 40114 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_DISABLE_MATCH_DIACRITICS 40115 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_EVERYTHING 40116 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_AUDIO 40117 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_COMPRESSED 40118 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_DOCUMENT 40119 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_EXECUTABLE 40120 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_FOLDER 40121 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_PICTURE 40122 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_VIDEO 40123 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_AUDIO_NO_TOGGLE 40124 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_COMPRESSED_NO_TOGGLE 40125 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_DOCUMENT_NO_TOGGLE 40126 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_EXECUTABLE_NO_TOGGLE 40127 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_FOLDER_NO_TOGGLE 40128 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_PICTURE_NO_TOGGLE 40129 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_SEARCH_FILTER_VIDEO_NO_TOGGLE 40130 // Everything 1.4.1 + +// TOOLS +#define EVERYTHING_IPC_ID_TOOLS_CONNECT_TO_ETP_SERVER 40072 +#define EVERYTHING_IPC_ID_TOOLS_DISCONNECT_FROM_ETP_SERVER 40073 +#define EVERYTHING_IPC_ID_TOOLS_OPTIONS 40074 +#define EVERYTHING_IPC_ID_TOOLS_CONSOLE 40075 +#define EVERYTHING_IPC_ID_TOOLS_EDITOR 40076 + +// HELP +#define EVERYTHING_IPC_ID_HELP_VIEW_HELP_TOPICS 40080 +#define EVERYTHING_IPC_ID_HELP_OPEN_EVERYTHING_WEBSITE 40081 +#define EVERYTHING_IPC_ID_HELP_CHECK_FOR_UPDATES 40082 +#define EVERYTHING_IPC_ID_HELP_ABOUT_EVERYTHING 40083 +#define EVERYTHING_IPC_ID_HELP_SEARCH_SYNTAX 40084 +#define EVERYTHING_IPC_ID_HELP_COMMAND_LINE_OPTIONS 40085 +#define EVERYTHING_IPC_ID_HELP_REGEX_SYNTAX 40086 +#define EVERYTHING_IPC_ID_HELP_DONATE 40087 + +// bookmarks +#define EVERYTHING_IPC_ID_BOOKMARK_ADD 40090 +#define EVERYTHING_IPC_ID_BOOKMARK_ORGANIZE 40091 +#define EVERYTHING_IPC_ID_BOOKMARK_START 44000 +#define EVERYTHING_IPC_ID_BOOKMARK_END 45000 // exclusive + +#define EVERYTHING_IPC_ID_FILTER_START 45000 +#define EVERYTHING_IPC_ID_FILTER_END 46000 // exclusive + +#define EVERYTHING_IPC_ID_VIEW_GOTO_START 46000 +#define EVERYTHING_IPC_ID_VIEW_GOTO_END 47000 // exclusive + +// files +#define EVERYTHING_IPC_ID_FILE_OPEN 41000 +#define EVERYTHING_IPC_ID_FILE_OPEN_NEW 41048 +#define EVERYTHING_IPC_ID_FILE_OPEN_WITH 41049 +#define EVERYTHING_IPC_ID_FILE_EDIT 41050 +#define EVERYTHING_IPC_ID_FILE_PLAY 41051 +#define EVERYTHING_IPC_ID_FILE_PRINT 41052 +#define EVERYTHING_IPC_ID_FILE_PREVIEW 41053 +#define EVERYTHING_IPC_ID_FILE_PRINT_TO 41054 +#define EVERYTHING_IPC_ID_FILE_RUN_AS 41055 +#define EVERYTHING_IPC_ID_FILE_OPEN_WITH_DEFAULT_VERB 41056 +#define EVERYTHING_IPC_ID_FILE_OPEN_AND_CLOSE 41057 +#define EVERYTHING_IPC_ID_FILE_EXPLORE_PATH 41002 +#define EVERYTHING_IPC_ID_FILE_OPEN_PATH 41003 +#define EVERYTHING_IPC_ID_FILE_DELETE 41004 +#define EVERYTHING_IPC_ID_FILE_PERMANENTLY_DELETE 41005 +#define EVERYTHING_IPC_ID_FILE_RENAME 41006 +#define EVERYTHING_IPC_ID_FILE_COPY_FULL_PATH_AND_NAME 41007 +#define EVERYTHING_IPC_ID_FILE_COPY_PATH 41008 +#define EVERYTHING_IPC_ID_FILE_PROPERTIES 41009 +#define EVERYTHING_IPC_ID_FILE_READ_EXTENDED_INFORMATION 41064 +#define EVERYTHING_IPC_ID_FILE_CREATE_SHORTCUT 41065 +#define EVERYTHING_IPC_ID_FILE_SET_RUN_COUNT 41068 +#define EVERYTHING_IPC_ID_FILE_COPY_NAME 41011 +#define EVERYTHING_IPC_ID_FILE_OPEN_AND_DO_NOT_CLOSE 41076 + +// result list +#define EVERYTHING_IPC_ID_RESULT_LIST_EXPLORE 41001 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS 41010 +#define EVERYTHING_IPC_ID_RESULT_LIST_AUTOFIT_COLUMNS 41012 +#define EVERYTHING_IPC_ID_RESULT_LIST_DOWN 41018 +#define EVERYTHING_IPC_ID_RESULT_LIST_UP 41019 +#define EVERYTHING_IPC_ID_RESULT_LIST_PAGE_UP 41020 +#define EVERYTHING_IPC_ID_RESULT_LIST_PAGE_DOWN 41021 +#define EVERYTHING_IPC_ID_RESULT_LIST_START 41022 +#define EVERYTHING_IPC_ID_RESULT_LIST_END 41023 +#define EVERYTHING_IPC_ID_RESULT_LIST_DOWN_EXTEND 41024 +#define EVERYTHING_IPC_ID_RESULT_LIST_UP_EXTEND 41025 +#define EVERYTHING_IPC_ID_RESULT_LIST_PAGE_UP_EXTEND 41026 +#define EVERYTHING_IPC_ID_RESULT_LIST_PAGE_DOWN_EXTEND 41027 +#define EVERYTHING_IPC_ID_RESULT_LIST_START_EXTEND 41028 +#define EVERYTHING_IPC_ID_RESULT_LIST_END_EXTEND 41029 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_DOWN 41030 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_UP 41031 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_PAGE_UP 41032 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_PAGE_DOWN 41033 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_START 41034 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_END 41035 +#define EVERYTHING_IPC_ID_RESULT_LIST_SCROLL_LEFT 41036 +#define EVERYTHING_IPC_ID_RESULT_LIST_SCROLL_RIGHT 41037 +#define EVERYTHING_IPC_ID_RESULT_LIST_SCROLL_PAGE_LEFT 41038 +#define EVERYTHING_IPC_ID_RESULT_LIST_SCROLL_PAGE_RIGHT 41039 +#define EVERYTHING_IPC_ID_RESULT_LIST_SELECT_FOCUS 41040 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_FOCUS_SELECTION 41041 +#define EVERYTHING_IPC_ID_RESULT_LIST_CONTEXT_MENU 41046 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_DOWN_EXTEND 41058 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_UP_EXTEND 41059 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_PAGE_UP_EXTEND 41060 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_PAGE_DOWN_EXTEND 41061 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_START_EXTEND 41062 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_END_EXTEND 41063 +#define EVERYTHING_IPC_ID_RESULT_LIST_AUTOFIT 41066 +#define EVERYTHING_IPC_ID_RESULT_LIST_COPY_CSV 41067 +#define EVERYTHING_IPC_ID_RESULT_LIST_LEFT_EXTEND 41070 +#define EVERYTHING_IPC_ID_RESULT_LIST_RIGHT_EXTEND 41071 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_LEFT_EXTEND 41072 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_RIGHT_EXTEND 41073 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_MOST_RUN 41074 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_LAST_RUN 41075 +#define EVERYTHING_IPC_ID_RESULT_LIST_LEFT 41079 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_RESULT_LIST_RIGHT 41080 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_LEFT 41081 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_RESULT_LIST_FOCUS_RIGHT 41082 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_RESULT_LIST_SCROLL_LEFT_SCROLL_ONLY 41083 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_RESULT_LIST_SCROLL_RIGHT_SCROLL_ONLY 41084 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_RESULT_LIST_SCROLL_PAGE_LEFT_SCROLL_ONLY 41085 // Everything 1.4.1 +#define EVERYTHING_IPC_ID_RESULT_LIST_SCROLL_PAGE_RIGHT_SCROLL_ONLY 41086 // Everything 1.4.1 + +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_NAME 41300 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_PATH 41301 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_SIZE 41302 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_EXTENSION 41303 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_TYPE 41304 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_DATE_MODIFIED 41305 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_DATE_CREATED 41306 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_ATTRIBUTES 41307 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_FILE_LIST_FILENAME 41308 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_RUN_COUNT 41309 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_DATE_RECENTLY_CHANGED 41310 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_DATE_ACCESSED 41311 +#define EVERYTHING_IPC_ID_RESULT_LIST_SORT_BY_DATE_RUN 41312 + +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_NAME_COLUMN 41400 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_PATH_COLUMN 41401 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_SIZE_COLUMN 41402 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_EXTENSION_COLUMN 41403 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_TYPE_COLUMN 41404 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_DATE_MODIFIED_COLUMN 41405 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_DATE_CREATED_COLUMN 41406 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_ATTRIBUTES_COLUMN 41407 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_FILE_LIST_FILENAME_COLUMN 41408 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_RUN_COUNT_COLUMN 41409 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_DATE_RECENTLY_CHANGED_COLUMN 41410 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_DATE_ACCESSED_COLUMN 41411 +#define EVERYTHING_IPC_ID_RESULT_LIST_TOGGLE_DATE_RUN_COLUMN 41412 + +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_NAME_COLUMN_TO_FIT 41600 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_PATH_COLUMN_TO_FIT 41601 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_SIZE_COLUMN_TO_FIT 41602 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_EXTENSION_COLUMN_TO_FIT 41603 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_TYPE_COLUMN_TO_FIT 41604 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_DATE_MODIFIED_COLUMN_TO_FIT 41605 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_DATE_CREATED_COLUMN_TO_FIT 41606 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_ATTRIBUTES_COLUMN_TO_FIT 41607 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_FILE_LIST_FILENAME_COLUMN_TO_FIT 41608 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_RUN_COUNT_COLUMN_TO_FIT 41609 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_DATE_RECENTLY_CHANGED_COLUMN_TO_FIT 41610 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_DATE_ACCESSED_COLUMN_TO_FIT 41611 +#define EVERYTHING_IPC_ID_RESULT_LIST_SIZE_DATE_RUN_COLUMN_TO_FIT 41612 + +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB01 41500 +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB02 41501 +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB03 41502 +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB04 41503 +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB05 41504 +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB06 41505 +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB07 41506 +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB08 41507 +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB09 41508 +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB10 41509 +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB11 41510 +#define EVERYTHING_IPC_ID_FILE_CUSTOM_VERB12 41511 + +// search +#define EVERYTHING_IPC_ID_SEARCH_EDIT_FOCUS 42000 +#define EVERYTHING_IPC_ID_SEARCH_EDIT_WORD_DELETE_TO_START 42019 +#define EVERYTHING_IPC_ID_SEARCH_EDIT_AUTO_COMPLETE 42020 +#define EVERYTHING_IPC_ID_SEARCH_EDIT_SHOW_SEARCH_HISTORY 42021 +#define EVERYTHING_IPC_ID_SEARCH_EDIT_SHOW_ALL_SEARCH_HISTORY 42022 + +#define EVERYTHING_IPC_ID_TRAY_EDITOR 41700 +#define EVERYTHING_IPC_ID_TRAY_OPEN_FILELIST 41701 + +#define EVERYTHING_IPC_ID_INDEX_UPDATE_ALL_FOLDERS_NOW 41800 +#define EVERYTHING_IPC_ID_INDEX_FORCE_REBUILD 41801 + +// find the everything IPC window +#define EVERYTHING_IPC_WNDCLASSW L"EVERYTHING_TASKBAR_NOTIFICATION" +#define EVERYTHING_IPC_WNDCLASSA "EVERYTHING_TASKBAR_NOTIFICATION" + +// an Everything search window +#define EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASSW L"EVERYTHING" +#define EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASSA "EVERYTHING" + +// this global window message is sent to all top level windows when everything starts. +#define EVERYTHING_IPC_CREATEDW L"EVERYTHING_IPC_CREATED" +#define EVERYTHING_IPC_CREATEDA "EVERYTHING_IPC_CREATED" + +// search flags for querys +#define EVERYTHING_IPC_MATCHCASE 0x00000001 // match case +#define EVERYTHING_IPC_MATCHWHOLEWORD 0x00000002 // match whole word +#define EVERYTHING_IPC_MATCHPATH 0x00000004 // include paths in search +#define EVERYTHING_IPC_REGEX 0x00000008 // enable regex +#define EVERYTHING_IPC_MATCHACCENTS 0x00000010 // match diacritic marks +#define EVERYTHING_IPC_MATCHDIACRITICS 0x00000010 // match diacritic marks +#define EVERYTHING_IPC_MATCHPREFIX 0x00000020 // match prefix (Everything 1.5) +#define EVERYTHING_IPC_MATCHSUFFIX 0x00000040 // match suffix (Everything 1.5) +#define EVERYTHING_IPC_IGNOREPUNCTUATION 0x00000080 // ignore punctuation (Everything 1.5) +#define EVERYTHING_IPC_IGNOREWHITESPACE 0x00000100 // ignore white-space (Everything 1.5) + +// item flags +#define EVERYTHING_IPC_FOLDER 0x00000001 // The item is a folder. (it's a file if not set) +#define EVERYTHING_IPC_DRIVE 0x00000002 // the file or folder is a drive/root. +#define EVERYTHING_IPC_ROOT 0x00000002 // the file or folder is a root. + +typedef struct EVERYTHING_IPC_COMMAND_LINE +{ + DWORD show_command; // MUST be one of the SW_* ShowWindow() commands + + // null terminated variable sized command line text in UTF-8. + BYTE command_line_text[1]; + +}EVERYTHING_IPC_COMMAND_LINE; + +// the WM_COPYDATA message for a query. +#define EVERYTHING_IPC_COPYDATA_COMMAND_LINE_UTF8 0 // Send a EVERYTHING_IPC_COMMAND_LINE structure. +#define EVERYTHING_IPC_COPYDATAQUERYA 1 +#define EVERYTHING_IPC_COPYDATAQUERYW 2 + +// all results +#define EVERYTHING_IPC_ALLRESULTS 0xFFFFFFFF // all results + +// macro to get the filename of an item +#define EVERYTHING_IPC_ITEMFILENAMEA(list,item) (CHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMA *)(item))->filename_offset) +#define EVERYTHING_IPC_ITEMFILENAMEW(list,item) (WCHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMW *)(item))->filename_offset) + +// macro to get the path of an item +#define EVERYTHING_IPC_ITEMPATHA(list,item) (CHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMA *)(item))->path_offset) +#define EVERYTHING_IPC_ITEMPATHW(list,item) (WCHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMW *)(item))->path_offset) + +#pragma pack (push,1) + +// +// Varible sized query struct sent to everything. +// +// sent in the form of a WM_COPYDATA message with EVERYTHING_IPC_COPYDATAQUERY as the +// dwData member in the COPYDATASTRUCT struct. +// set the lpData member of the COPYDATASTRUCT struct to point to your EVERYTHING_IPC_QUERY struct. +// set the cbData member of the COPYDATASTRUCT struct to the size of the +// EVERYTHING_IPC_QUERY struct minus the size of a TCHAR plus the length of the search string in bytes plus +// one TCHAR for the null terminator. +// +// NOTE: to determine the size of this structure use +// ASCII: sizeof(EVERYTHING_IPC_QUERYA) - sizeof(CHAR) + strlen(search_string)*sizeof(CHAR) + sizeof(CHAR) +// UNICODE: sizeof(EVERYTHING_IPC_QUERYW) - sizeof(WCHAR) + wcslen(search_string)*sizeof(WCHAR) + sizeof(WCHAR) +// +// NOTE: Everything will only do one query per window. +// Sending another query when a query has not completed +// will cancel the old query and start the new one. +// +// Everything will send the results to the reply_hwnd in the form of a +// WM_COPYDATA message with the dwData value you specify. +// +// Everything will return TRUE if successful. +// returns FALSE if not supported. +// +// If you query with EVERYTHING_IPC_COPYDATAQUERYW, the results sent from Everything will be Unicode. +// + +typedef struct EVERYTHING_IPC_QUERYW +{ + // the window that will receive the new results. + // only 32bits are required to store a window handle. (even on x64) + DWORD reply_hwnd; + + // the value to set the dwData member in the COPYDATASTRUCT struct + // sent by Everything when the query is complete. + DWORD reply_copydata_message; + + // search flags (see EVERYTHING_IPC_MATCHCASE | EVERYTHING_IPC_MATCHWHOLEWORD | EVERYTHING_IPC_MATCHPATH) + DWORD search_flags; + + // only return results after 'offset' results (0 to return from the first result) + // useful for scrollable lists + DWORD offset; + + // the number of results to return + // zero to return no results + // EVERYTHING_IPC_ALLRESULTS to return ALL results + DWORD max_results; + + // null terminated string. variable lengthed search string buffer. + WCHAR search_string[1]; + +}EVERYTHING_IPC_QUERYW; + +// ASCII version +typedef struct EVERYTHING_IPC_QUERYA +{ + // the window that will receive the new results. + // only 32bits are required to store a window handle. (even on x64) + DWORD reply_hwnd; + + // the value to set the dwData member in the COPYDATASTRUCT struct + // sent by Everything when the query is complete. + DWORD reply_copydata_message; + + // search flags (see EVERYTHING_IPC_MATCHCASE | EVERYTHING_IPC_MATCHWHOLEWORD | EVERYTHING_IPC_MATCHPATH) + DWORD search_flags; + + // only return results after 'offset' results (0 to return from the first result) + // useful for scrollable lists + DWORD offset; + + // the number of results to return + // zero to return no results + // EVERYTHING_IPC_ALLRESULTS to return ALL results + DWORD max_results; + + // null terminated string. variable lengthed search string buffer. + CHAR search_string[1]; + +}EVERYTHING_IPC_QUERYA; + +// +// Varible sized result list struct received from Everything. +// +// Sent in the form of a WM_COPYDATA message to the hwnd specifed in the +// EVERYTHING_IPC_QUERY struct. +// the dwData member of the COPYDATASTRUCT struct will match the sent +// reply_copydata_message member in the EVERYTHING_IPC_QUERY struct. +// +// make a copy of the data before returning. +// +// return TRUE if you processed the WM_COPYDATA message. +// + +typedef struct EVERYTHING_IPC_ITEMW +{ + // item flags + DWORD flags; + + // The offset of the filename from the beginning of the list structure. + // (wchar_t *)((char *)everything_list + everythinglist->name_offset) + DWORD filename_offset; + + // The offset of the filename from the beginning of the list structure. + // (wchar_t *)((char *)everything_list + everythinglist->path_offset) + DWORD path_offset; + +}EVERYTHING_IPC_ITEMW; + +typedef struct EVERYTHING_IPC_ITEMA +{ + // item flags + DWORD flags; + + // The offset of the filename from the beginning of the list structure. + // (char *)((char *)everything_list + everythinglist->name_offset) + DWORD filename_offset; + + // The offset of the filename from the beginning of the list structure. + // (char *)((char *)everything_list + everythinglist->path_offset) + DWORD path_offset; + +}EVERYTHING_IPC_ITEMA; + +typedef struct EVERYTHING_IPC_LISTW +{ + // the total number of folders found. + DWORD totfolders; + + // the total number of files found. + DWORD totfiles; + + // totfolders + totfiles + DWORD totitems; + + // the number of folders available. + DWORD numfolders; + + // the number of files available. + DWORD numfiles; + + // the number of items available. + DWORD numitems; + + // index offset of the first result in the item list. + DWORD offset; + + // variable lengthed item list. + // use numitems to determine the actual number of items available. + EVERYTHING_IPC_ITEMW items[1]; + +}EVERYTHING_IPC_LISTW; + +typedef struct EVERYTHING_IPC_LISTA +{ + // the total number of folders found. + DWORD totfolders; + + // the total number of files found. + DWORD totfiles; + + // totfolders + totfiles + DWORD totitems; + + // the number of folders available. + DWORD numfolders; + + // the number of files available. + DWORD numfiles; + + // the number of items available. + DWORD numitems; + + // index offset of the first result in the item list. + DWORD offset; + + // variable lengthed item list. + // use numitems to determine the actual number of items available. + EVERYTHING_IPC_ITEMA items[1]; + +}EVERYTHING_IPC_LISTA; + +#pragma pack (pop) + +#ifdef UNICODE +#define EVERYTHING_IPC_COPYDATAQUERY EVERYTHING_IPC_COPYDATAQUERYW +#define EVERYTHING_IPC_ITEMFILENAME EVERYTHING_IPC_ITEMFILENAMEW +#define EVERYTHING_IPC_ITEMPATH EVERYTHING_IPC_ITEMPATHW +#define EVERYTHING_IPC_QUERY EVERYTHING_IPC_QUERYW +#define EVERYTHING_IPC_ITEM EVERYTHING_IPC_ITEMW +#define EVERYTHING_IPC_LIST EVERYTHING_IPC_LISTW +#define EVERYTHING_IPC_WNDCLASS EVERYTHING_IPC_WNDCLASSW +#define EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASSW +#define EVERYTHING_IPC_CREATED EVERYTHING_IPC_CREATEDW +#else +#define EVERYTHING_IPC_COPYDATAQUERY EVERYTHING_IPC_COPYDATAQUERYA +#define EVERYTHING_IPC_ITEMFILENAME EVERYTHING_IPC_ITEMFILENAMEA +#define EVERYTHING_IPC_ITEMPATH EVERYTHING_IPC_ITEMPATHA +#define EVERYTHING_IPC_QUERY EVERYTHING_IPC_QUERYA +#define EVERYTHING_IPC_ITEM EVERYTHING_IPC_ITEMA +#define EVERYTHING_IPC_LIST EVERYTHING_IPC_LISTA +#define EVERYTHING_IPC_WNDCLASS EVERYTHING_IPC_WNDCLASSA +#define EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASSA +#define EVERYTHING_IPC_CREATED EVERYTHING_IPC_CREATEDA +#endif + +// the WM_COPYDATA message for a query. +// requires Everything 1.4.1 +#define EVERYTHING_IPC_COPYDATA_QUERY2A 17 +#define EVERYTHING_IPC_COPYDATA_QUERY2W 18 + +#define EVERYTHING_IPC_SORT_NAME_ASCENDING 1 +#define EVERYTHING_IPC_SORT_NAME_DESCENDING 2 +#define EVERYTHING_IPC_SORT_PATH_ASCENDING 3 +#define EVERYTHING_IPC_SORT_PATH_DESCENDING 4 +#define EVERYTHING_IPC_SORT_SIZE_ASCENDING 5 +#define EVERYTHING_IPC_SORT_SIZE_DESCENDING 6 +#define EVERYTHING_IPC_SORT_EXTENSION_ASCENDING 7 +#define EVERYTHING_IPC_SORT_EXTENSION_DESCENDING 8 +#define EVERYTHING_IPC_SORT_TYPE_NAME_ASCENDING 9 +#define EVERYTHING_IPC_SORT_TYPE_NAME_DESCENDING 10 +#define EVERYTHING_IPC_SORT_DATE_CREATED_ASCENDING 11 +#define EVERYTHING_IPC_SORT_DATE_CREATED_DESCENDING 12 +#define EVERYTHING_IPC_SORT_DATE_MODIFIED_ASCENDING 13 +#define EVERYTHING_IPC_SORT_DATE_MODIFIED_DESCENDING 14 +#define EVERYTHING_IPC_SORT_ATTRIBUTES_ASCENDING 15 +#define EVERYTHING_IPC_SORT_ATTRIBUTES_DESCENDING 16 +#define EVERYTHING_IPC_SORT_FILE_LIST_FILENAME_ASCENDING 17 +#define EVERYTHING_IPC_SORT_FILE_LIST_FILENAME_DESCENDING 18 +#define EVERYTHING_IPC_SORT_RUN_COUNT_ASCENDING 19 +#define EVERYTHING_IPC_SORT_RUN_COUNT_DESCENDING 20 +#define EVERYTHING_IPC_SORT_DATE_RECENTLY_CHANGED_ASCENDING 21 +#define EVERYTHING_IPC_SORT_DATE_RECENTLY_CHANGED_DESCENDING 22 +#define EVERYTHING_IPC_SORT_DATE_ACCESSED_ASCENDING 23 +#define EVERYTHING_IPC_SORT_DATE_ACCESSED_DESCENDING 24 +#define EVERYTHING_IPC_SORT_DATE_RUN_ASCENDING 25 +#define EVERYTHING_IPC_SORT_DATE_RUN_DESCENDING 26 + +#define EVERYTHING_IPC_QUERY2_REQUEST_NAME 0x00000001 +#define EVERYTHING_IPC_QUERY2_REQUEST_PATH 0x00000002 +#define EVERYTHING_IPC_QUERY2_REQUEST_FULL_PATH_AND_NAME 0x00000004 +#define EVERYTHING_IPC_QUERY2_REQUEST_EXTENSION 0x00000008 +#define EVERYTHING_IPC_QUERY2_REQUEST_SIZE 0x00000010 +#define EVERYTHING_IPC_QUERY2_REQUEST_DATE_CREATED 0x00000020 +#define EVERYTHING_IPC_QUERY2_REQUEST_DATE_MODIFIED 0x00000040 +#define EVERYTHING_IPC_QUERY2_REQUEST_DATE_ACCESSED 0x00000080 +#define EVERYTHING_IPC_QUERY2_REQUEST_ATTRIBUTES 0x00000100 +#define EVERYTHING_IPC_QUERY2_REQUEST_FILE_LIST_FILE_NAME 0x00000200 +#define EVERYTHING_IPC_QUERY2_REQUEST_RUN_COUNT 0x00000400 +#define EVERYTHING_IPC_QUERY2_REQUEST_DATE_RUN 0x00000800 +#define EVERYTHING_IPC_QUERY2_REQUEST_DATE_RECENTLY_CHANGED 0x00001000 +#define EVERYTHING_IPC_QUERY2_REQUEST_HIGHLIGHTED_NAME 0x00002000 +#define EVERYTHING_IPC_QUERY2_REQUEST_HIGHLIGHTED_PATH 0x00004000 +#define EVERYTHING_IPC_QUERY2_REQUEST_HIGHLIGHTED_FULL_PATH_AND_NAME 0x00008000 + +#define EVERYTHING_IPC_FILE_INFO_FILE_SIZE 1 +#define EVERYTHING_IPC_FILE_INFO_FOLDER_SIZE 2 +#define EVERYTHING_IPC_FILE_INFO_DATE_CREATED 3 +#define EVERYTHING_IPC_FILE_INFO_DATE_MODIFIED 4 +#define EVERYTHING_IPC_FILE_INFO_DATE_ACCESSED 5 +#define EVERYTHING_IPC_FILE_INFO_ATTRIBUTES 6 + +#pragma pack (push,1) + +// +// Varible sized query struct sent to everything. +// +// sent in the form of a WM_COPYDATA message with EVERYTHING_IPC_COPYDATA_QUERY2 as the +// dwData member in the COPYDATASTRUCT struct. +// set the lpData member of the COPYDATASTRUCT struct to point to your EVERYTHING_IPC_QUERY struct. +// set the cbData member of the COPYDATASTRUCT struct to the size of the +// EVERYTHING_IPC_QUERY struct minus the size of a TCHAR plus the length of the search string in bytes plus +// one TCHAR for the null terminator. +// +// NOTE: Everything will only do one query per window. +// Sending another query when a query has not completed +// will cancel the old query and start the new one. +// +// Everything will send the results to the reply_hwnd in the form of a +// WM_COPYDATA message with the dwData value you specify. +// +// Everything will return TRUE if successful. +// returns FALSE if not supported. +// +// If you query with EVERYTHING_IPC_COPYDATA_QUERYW, the results sent from Everything will be Unicode. +// + +// ASCII version +typedef struct EVERYTHING_IPC_QUERY2 +{ + // the window that will receive the new results. + // only 32bits are required to store a window handle. (even on x64) + DWORD reply_hwnd; + + // the value to set the dwData member in the COPYDATASTRUCT struct + // sent by Everything when the query is complete. + DWORD reply_copydata_message; + + // search flags (see EVERYTHING_IPC_MATCHCASE | EVERYTHING_IPC_MATCHWHOLEWORD | EVERYTHING_IPC_MATCHPATH) + DWORD search_flags; + + // only return results after 'offset' results (0 to return from the first result) + // useful for scrollable lists + DWORD offset; + + // the number of results to return + // zero to return no results + // EVERYTHING_IPC_ALLRESULTS to return ALL results + DWORD max_results; + + // request types. + // one or more of EVERYTHING_IPC_QUERY2_REQUEST_* types. + DWORD request_flags; + + // sort type, set to one of EVERYTHING_IPC_SORT_* types. + // set to EVERYTHING_IPC_SORT_NAME_ASCENDING for the best performance (there will never be a performance hit when sorting by name ascending). + // Other sorts will also be instant if the corresponding fast sort is enabled from Tools -> Options -> Indexes. + DWORD sort_type; + + // followed by null terminated search. + // TCHAR search_string[1]; + +}EVERYTHING_IPC_QUERY2; + +typedef struct EVERYTHING_IPC_ITEM2 +{ + // item flags one of (EVERYTHING_IPC_FOLDER|EVERYTHING_IPC_DRIVE|EVERYTHING_IPC_ROOT) + DWORD flags; + + // offset from the start of the EVERYTHING_IPC_LIST2 struct to the data content + DWORD data_offset; + + // data found at data_offset + // if EVERYTHING_IPC_QUERY2_REQUEST_NAME was set in request_flags, DWORD name_length in characters (excluding the null terminator); followed by null terminated text. + // if EVERYTHING_IPC_QUERY2_REQUEST_PATH was set in request_flags, DWORD name_length in characters (excluding the null terminator); followed by null terminated text. + // if EVERYTHING_IPC_QUERY2_REQUEST_FULL_PATH_AND_NAME was set in request_flags, DWORD name_length (excluding the null terminator); followed by null terminated text. + // if EVERYTHING_IPC_QUERY2_REQUEST_SIZE was set in request_flags, LARGE_INTERGER size; + // if EVERYTHING_IPC_QUERY2_REQUEST_EXTENSION was set in request_flags, DWORD name_length in characters (excluding the null terminator); followed by null terminated text; + // if EVERYTHING_IPC_QUERY2_REQUEST_TYPE_NAME was set in request_flags, DWORD name_length in characters (excluding the null terminator); followed by null terminated text; + // if EVERYTHING_IPC_QUERY2_REQUEST_DATE_CREATED was set in request_flags, FILETIME date; + // if EVERYTHING_IPC_QUERY2_REQUEST_DATE_MODIFIED was set in request_flags, FILETIME date; + // if EVERYTHING_IPC_QUERY2_REQUEST_DATE_ACCESSED was set in request_flags, FILETIME date; + // if EVERYTHING_IPC_QUERY2_REQUEST_ATTRIBUTES was set in request_flags, DWORD attributes; + // if EVERYTHING_IPC_QUERY2_REQUEST_FILELIST_FILENAME was set in request_flags, DWORD name_length in characters (excluding the null terminator); followed by null terminated text; + // if EVERYTHING_IPC_QUERY2_REQUEST_RUN_COUNT was set in request_flags, DWORD run_count; + // if EVERYTHING_IPC_QUERY2_REQUEST_DATE_RUN was set in request_flags, FILETIME date; + // if EVERYTHING_IPC_QUERY2_REQUEST_DATE_RECENTLY_CHANGED was set in request_flags, FILETIME date; + // if EVERYTHING_IPC_QUERY2_REQUEST_HIGHLIGHTED_NAME was set in request_flags, DWORD name_length in characters (excluding the null terminator); followed by null terminated text; ** = *, *text* = highlighted text + // if EVERYTHING_IPC_QUERY2_REQUEST_HIGHLIGHTED_PATH was set in request_flags, DWORD name_length in characters (excluding the null terminator); followed by null terminated text; ** = *, *text* = highlighted text + // if EVERYTHING_IPC_QUERY2_REQUEST_HIGHLIGHTED_FULL_PATH_AND_NAME was set in request_flags, DWORD name_length in characters (excluding the null terminator); followed by null terminated text; ** = *, *text* = highlighted text + +}EVERYTHING_IPC_ITEM2; + +typedef struct EVERYTHING_IPC_LIST2 +{ + // number of items found. + DWORD totitems; + + // the number of items available. + DWORD numitems; + + // index offset of the first result in the item list. + DWORD offset; + + // valid request types. + DWORD request_flags; + + // this sort type. + // one of EVERYTHING_IPC_SORT_* types. + // maybe different to requested sort type. + DWORD sort_type; + + // items follow. + // EVERYTHING_IPC_ITEM2 items[numitems] + + // item data follows. + +}EVERYTHING_IPC_LIST2; + +#pragma pack (pop) + +// Get the Run Count for a file, by filename. +// COPYDATASTRUCT cds; +// cds.dwData = EVERYTHING_IPC_COPYDATA_GET_RUN_COUNTA; +// cds.lpData = TEXT("C:\\folder\\file.txt"); +// cds.cbData = size in bytes of cds.lpData including null terminator. +// SendMessage(everything_taskbar_notification_hwnd,WM_COPYDATA,(WPARAM)(HWND)notify_hwnd,(LPARAM)(COPYDATASTRUCT *)&cds); + +#define EVERYTHING_IPC_COPYDATA_GET_RUN_COUNTA 19 +#define EVERYTHING_IPC_COPYDATA_GET_RUN_COUNTW 20 + +#pragma pack (push,1) + +typedef struct EVERYTHING_IPC_RUN_HISTORY +{ + DWORD run_count; + + // null terminated ansi/wchar filename follows. + // TCHAR filename[]; + +}EVERYTHING_IPC_RUN_HISTORY; + +#pragma pack (pop) + +// Set the Run Count by one for a file, by filename. +// COPYDATASTRUCT cds; +// cds.dwData = EVERYTHING_IPC_COPYDATA_GET_RUN_COUNTA; +// cds.lpData = (EVERYTHING_IPC_RUN_HISTORY *)run_history; +// cds.cbData = size in bytes of cds.lpData including null terminator. +// SendMessage(everything_taskbar_notification_hwnd,WM_COPYDATA,(WPARAM)(HWND)notify_hwnd,(LPARAM)(COPYDATASTRUCT *)&cds); + +#define EVERYTHING_IPC_COPYDATA_SET_RUN_COUNTA 21 +#define EVERYTHING_IPC_COPYDATA_SET_RUN_COUNTW 22 + +// Increment the Run Count by one for a file, by filename. +// COPYDATASTRUCT cds; +// cds.dwData = EVERYTHING_IPC_COPYDATA_GET_RUN_COUNTA; +// cds.lpData = TEXT("C:\\folder\\file.txt"); +// cds.cbData = size in bytes of cds.lpData including null terminator. +// SendMessage(everything_taskbar_notification_hwnd,WM_COPYDATA,(WPARAM)(HWND)notify_hwnd,(LPARAM)(COPYDATASTRUCT *)&cds); + +#define EVERYTHING_IPC_COPYDATA_INC_RUN_COUNTA 23 +#define EVERYTHING_IPC_COPYDATA_INC_RUN_COUNTW 24 + +#ifdef UNICODE +#define EVERYTHING_IPC_COPYDATA_QUERY2 EVERYTHING_IPC_COPYDATA_QUERY2W +#else +#define EVERYTHING_IPC_COPYDATA_QUERY2 EVERYTHING_IPC_COPYDATA_QUERY2A +#endif + +// end extern C +#ifdef __cplusplus +} +#endif + +#endif // _EVERYTHING_H_ + diff --git a/Everything-SDK/src/Everything.c b/Everything-SDK/src/Everything.c new file mode 100644 index 0000000..fdb1b03 --- /dev/null +++ b/Everything-SDK/src/Everything.c @@ -0,0 +1,3299 @@ + +// +// Copyright (C) 2022 David Carpenter +// +// Permission is hereby granted, free of charge, +// to any person obtaining a copy of this software +// and associated documentation files (the "Software"), +// to deal in the Software without restriction, +// including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +// Notes: +// this project builds the dll (visual studio will also build the lib for us) +// we declare all exported calls to __stdcall, so theres no need to set the default calling standard. + +// disable warnings +#pragma warning(disable : 4996) // deprecation + +#define EVERYTHINGUSERAPI __declspec(dllexport) + +// include +#include "../include/Everything.h" +#include "../ipc/Everything_IPC.h" + +// return copydata code +#define _EVERYTHING_COPYDATA_QUERYREPLY 0 + +#define _EVERYTHING_MSGFLT_ALLOW 1 + +typedef struct _EVERYTHING_tagCHANGEFILTERSTRUCT +{ + DWORD cbSize; + DWORD ExtStatus; +}_EVERYTHING_CHANGEFILTERSTRUCT, *_EVERYTHING_PCHANGEFILTERSTRUCT; + +static void *_Everything_Alloc(DWORD size); +static void _Everything_Free(void *ptr); +static void _Everything_Initialize(void); +static void _Everything_Lock(void); +static void _Everything_Unlock(void); +static DWORD _Everything_StringLengthA(LPCSTR start); +static DWORD _Everything_StringLengthW(LPCWSTR start); +static BOOL EVERYTHINGAPI _Everything_Query(void); +static BOOL _Everything_ShouldUseVersion2(void); +static BOOL _Everything_SendIPCQuery(void); +static BOOL _Everything_SendIPCQuery2(HWND everything_hwnd); +static void _Everything_FreeLists(void); +static BOOL _Everything_IsValidResultIndex(DWORD dwIndex); +static void *_Everything_GetRequestData(DWORD dwIndex,DWORD dwRequestType); +static BOOL _Everything_IsSchemeNameW(LPCWSTR s); +static BOOL _Everything_IsSchemeNameA(LPCSTR s); +static void _Everything_ChangeWindowMessageFilter(HWND hwnd); +static BOOL _Everything_GetResultRequestData(DWORD dwIndex,DWORD dwRequestType,void *data,int size); +static LPCWSTR _Everything_GetResultRequestStringW(DWORD dwIndex,DWORD dwRequestType); +static LPCSTR _Everything_GetResultRequestStringA(DWORD dwIndex,DWORD dwRequestType); +static BOOL _Everything_SendAPIBoolCommand(int command,LPARAM lParam); +static DWORD _Everything_SendAPIDwordCommand(int command,LPARAM lParam); +static LRESULT _Everything_SendCopyData(int command,const void *data,int size); +static LRESULT WINAPI _Everything_window_proc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam); +static DWORD _Everything_GetNumResults(void); + +// internal state +static BOOL _Everything_MatchPath = FALSE; +static BOOL _Everything_MatchCase = FALSE; +static BOOL _Everything_MatchWholeWord = FALSE; +static BOOL _Everything_Regex = FALSE; +static DWORD _Everything_LastError = FALSE; +static DWORD _Everything_Max = EVERYTHING_IPC_ALLRESULTS; +static DWORD _Everything_Offset = 0; +static DWORD _Everything_Sort = EVERYTHING_SORT_NAME_ASCENDING; +static DWORD _Everything_RequestFlags = EVERYTHING_REQUEST_PATH | EVERYTHING_REQUEST_FILE_NAME; +static BOOL _Everything_IsUnicodeQuery = FALSE; +static DWORD _Everything_QueryVersion = 0; +static BOOL _Everything_IsUnicodeSearch = FALSE; +static void *_Everything_Search = NULL; // wchar or char +static EVERYTHING_IPC_LIST2 *_Everything_List2 = NULL; +static void *_Everything_List = NULL; // EVERYTHING_IPC_LISTW or EVERYTHING_IPC_LISTA +static volatile BOOL _Everything_Initialized = FALSE; +static volatile LONG _Everything_InterlockedCount = 0; +static CRITICAL_SECTION _Everything_cs; +static HWND _Everything_ReplyWindow = 0; +static DWORD _Everything_ReplyID = 0; +static BOOL (WINAPI *_Everything_pChangeWindowMessageFilterEx)(HWND hWnd,UINT message,DWORD action,_EVERYTHING_PCHANGEFILTERSTRUCT pChangeFilterStruct) = 0; +static HANDLE _Everything_user32_hdll = NULL; +static BOOL _Everything_GotChangeWindowMessageFilterEx = FALSE; + +static void _Everything_Initialize(void) +{ + if (!_Everything_Initialized) + { + if (InterlockedIncrement(&_Everything_InterlockedCount) == 1) + { + // do the initialization.. + InitializeCriticalSection(&_Everything_cs); + + _Everything_Initialized = 1; + } + else + { + // wait for initialization by other thread. + while (!_Everything_Initialized) Sleep(0); + } + } +} + +static void _Everything_Lock(void) +{ + _Everything_Initialize(); + + EnterCriticalSection(&_Everything_cs); +} + +static void _Everything_Unlock(void) +{ + LeaveCriticalSection(&_Everything_cs); +} + +// avoid other libs +static DWORD _Everything_StringLengthA(LPCSTR start) +{ + register LPCSTR s; + + s = start; + + while(*s) + { + s++; + } + + return (DWORD)(s-start); +} + +static DWORD _Everything_StringLengthW(LPCWSTR start) +{ + register LPCWSTR s; + + s = start; + + while(*s) + { + s++; + } + + return (DWORD)(s-start); +} + +void EVERYTHINGAPI Everything_SetSearchW(LPCWSTR lpString) +{ + DWORD len; + + _Everything_Lock(); + + if (_Everything_Search) + { + _Everything_Free(_Everything_Search); + } + + len = _Everything_StringLengthW(lpString) + 1; + + _Everything_Search = _Everything_Alloc(len*sizeof(WCHAR)); + if (_Everything_Search) + { + CopyMemory(_Everything_Search,lpString,len*sizeof(WCHAR)); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + + _Everything_IsUnicodeSearch = 1; + + _Everything_Unlock(); +} + +void EVERYTHINGAPI Everything_SetSearchA(LPCSTR lpString) +{ + DWORD size; + + _Everything_Lock(); + + if (_Everything_Search) + { + _Everything_Free(_Everything_Search); + } + + size = _Everything_StringLengthA(lpString) + 1; + + _Everything_Search = _Everything_Alloc(size); + if (_Everything_Search) + { + CopyMemory(_Everything_Search,lpString,size); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + + _Everything_IsUnicodeSearch = 0; + + _Everything_Unlock(); +} + +LPCSTR EVERYTHINGAPI Everything_GetSearchA(void) +{ + LPCSTR ret; + + _Everything_Lock(); + + if (_Everything_Search) + { + if (_Everything_IsUnicodeSearch) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = NULL; + } + else + { + ret = (LPCSTR)_Everything_Search; + } + } + else + { + ret = ""; + } + + _Everything_Unlock(); + + return ret; +} + +LPCWSTR EVERYTHINGAPI Everything_GetSearchW(void) +{ + LPCWSTR ret; + + _Everything_Lock(); + + if (_Everything_Search) + { + if (!_Everything_IsUnicodeSearch) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = NULL; + } + else + { + ret = (LPCWSTR)_Everything_Search; + } + } + else + { + ret = L""; + } + + _Everything_Unlock(); + + return ret; +} + +void EVERYTHINGAPI Everything_SetMatchPath(BOOL bEnable) +{ + _Everything_Lock(); + + _Everything_MatchPath = bEnable; + + _Everything_Unlock(); +} + +void EVERYTHINGAPI Everything_SetMatchCase(BOOL bEnable) +{ + _Everything_Lock(); + + _Everything_MatchCase = bEnable; + + _Everything_Unlock(); +} + +void EVERYTHINGAPI Everything_SetMatchWholeWord(BOOL bEnable) +{ + _Everything_Lock(); + + _Everything_MatchWholeWord = bEnable; + + _Everything_Unlock(); +} + +void EVERYTHINGAPI Everything_SetRegex(BOOL bEnable) +{ + _Everything_Lock(); + + _Everything_Regex = bEnable; + + _Everything_Unlock(); +} + +void EVERYTHINGAPI Everything_SetMax(DWORD dwMax) +{ + _Everything_Lock(); + + _Everything_Max = dwMax; + + _Everything_Unlock(); +} + +void EVERYTHINGAPI Everything_SetOffset(DWORD dwOffset) +{ + _Everything_Lock(); + + _Everything_Offset = dwOffset; + + _Everything_Unlock(); +} + +void EVERYTHINGAPI Everything_SetSort(DWORD dwSort) +{ + _Everything_Lock(); + + _Everything_Sort = dwSort; + + _Everything_Unlock(); +} + +EVERYTHINGUSERAPI void EVERYTHINGAPI Everything_SetRequestFlags(DWORD dwRequestFlags) +{ + _Everything_Lock(); + + _Everything_RequestFlags = dwRequestFlags; + + _Everything_Unlock(); +} + +void EVERYTHINGAPI Everything_SetReplyWindow(HWND hWnd) +{ + _Everything_Lock(); + + _Everything_ReplyWindow = hWnd; + + _Everything_Unlock(); +} + +void EVERYTHINGAPI Everything_SetReplyID(DWORD dwId) +{ + _Everything_Lock(); + + _Everything_ReplyID = dwId; + + _Everything_Unlock(); +} + +BOOL EVERYTHINGAPI Everything_GetMatchPath(void) +{ + BOOL ret; + + _Everything_Lock(); + + ret = _Everything_MatchPath; + + _Everything_Unlock(); + + return ret; +} + +BOOL EVERYTHINGAPI Everything_GetMatchCase(void) +{ + BOOL ret; + + _Everything_Lock(); + + ret = _Everything_MatchCase; + + _Everything_Unlock(); + + return ret; +} + +BOOL EVERYTHINGAPI Everything_GetMatchWholeWord(void) +{ + BOOL ret; + + _Everything_Lock(); + + ret = _Everything_MatchWholeWord; + + _Everything_Unlock(); + + return ret; +} + +BOOL EVERYTHINGAPI Everything_GetRegex(void) +{ + BOOL ret; + + _Everything_Lock(); + + ret = _Everything_Regex; + + _Everything_Unlock(); + + return ret; +} + +DWORD EVERYTHINGAPI Everything_GetMax(void) +{ + DWORD ret; + + _Everything_Lock(); + + ret = _Everything_Max; + + _Everything_Unlock(); + + return ret; +} + +DWORD EVERYTHINGAPI Everything_GetOffset(void) +{ + DWORD ret; + + _Everything_Lock(); + + ret = _Everything_Offset; + + _Everything_Unlock(); + + return ret; +} + +DWORD EVERYTHINGAPI Everything_GetSort(void) +{ + DWORD ret; + + _Everything_Lock(); + + ret = _Everything_Sort; + + _Everything_Unlock(); + + return ret; +} + +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetRequestFlags(void) +{ + DWORD ret; + + _Everything_Lock(); + + ret = _Everything_RequestFlags; + + _Everything_Unlock(); + + return ret; +} + +HWND EVERYTHINGAPI Everything_GetReplyWindow(void) +{ + HWND ret; + + _Everything_Lock(); + + ret = _Everything_ReplyWindow; + + _Everything_Unlock(); + + return ret; +} + +DWORD EVERYTHINGAPI Everything_GetReplyID(void) +{ + DWORD ret; + + _Everything_Lock(); + + ret = _Everything_ReplyID; + + _Everything_Unlock(); + + return ret; +} + +// custom window proc +static LRESULT WINAPI _Everything_window_proc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +{ + switch(msg) + { + case WM_COPYDATA: + { + COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lParam; + + switch(cds->dwData) + { + case _EVERYTHING_COPYDATA_QUERYREPLY: + + if (_Everything_QueryVersion == 2) + { + _Everything_FreeLists(); + + _Everything_List2 = _Everything_Alloc(cds->cbData); + + if (_Everything_List2) + { + CopyMemory(_Everything_List2,cds->lpData,cds->cbData); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + + PostQuitMessage(0); + + return TRUE; + } + else + if (_Everything_QueryVersion == 1) + { + _Everything_FreeLists(); + + _Everything_List = _Everything_Alloc(cds->cbData); + + if (_Everything_List) + { + CopyMemory(_Everything_List,cds->lpData,cds->cbData); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + + PostQuitMessage(0); + + return TRUE; + } + + break; + } + + break; + } + } + + return DefWindowProc(hwnd,msg,wParam,lParam); +} + +// get the search length +static DWORD _Everything_GetSearchLengthW(void) +{ + if (_Everything_Search) + { + if (_Everything_IsUnicodeSearch) + { + return _Everything_StringLengthW((LPCWSTR )_Everything_Search); + } + else + { + return MultiByteToWideChar(CP_ACP,0,(LPCSTR )_Everything_Search,-1,0,0); + } + } + + return 0; +} + +// get the search length +static DWORD _Everything_GetSearchLengthA(void) +{ + if (_Everything_Search) + { + if (_Everything_IsUnicodeSearch) + { + return WideCharToMultiByte(CP_ACP,0,(LPCWSTR )_Everything_Search,-1,0,0,0,0); + } + else + { + return _Everything_StringLengthA((LPCSTR )_Everything_Search); + } + } + + return 0; +} + +// get the search +static void _Everything_GetSearchTextW(LPWSTR wbuf) +{ + DWORD wlen; + + if (_Everything_Search) + { + wlen = _Everything_GetSearchLengthW(); + + if (_Everything_IsUnicodeSearch) + { + CopyMemory(wbuf,_Everything_Search,(wlen+1) * sizeof(WCHAR)); + + return; + } + else + { + MultiByteToWideChar(CP_ACP,0,(LPCSTR )_Everything_Search,-1,wbuf,wlen+1); + + return; + } + } + + *wbuf = 0; +} + +// get the search +static void _Everything_GetSearchTextA(LPSTR buf) +{ + DWORD len; + + if (_Everything_Search) + { + len = _Everything_GetSearchLengthA(); + + if (_Everything_IsUnicodeSearch) + { + WideCharToMultiByte(CP_ACP,0,(LPCWSTR )_Everything_Search,-1,buf,len+1,0,0); + + return; + } + else + { + CopyMemory(buf,_Everything_Search,len+1); + + return; + } + } + + *buf = 0; +} + +static DWORD EVERYTHINGAPI _Everything_query_thread_proc(void *param) +{ + HWND everything_hwnd; + + everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0); + if (everything_hwnd) + { + WNDCLASSEX wcex; + HWND hwnd; + MSG msg; + int ret; + + ZeroMemory(&wcex,sizeof(WNDCLASSEX)); + wcex.cbSize = sizeof(WNDCLASSEX); + + if (!GetClassInfoEx(GetModuleHandle(0),TEXT("EVERYTHING_DLL"),&wcex)) + { + ZeroMemory(&wcex,sizeof(WNDCLASSEX)); + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.hInstance = GetModuleHandle(0); + wcex.lpfnWndProc = _Everything_window_proc; + wcex.lpszClassName = TEXT("EVERYTHING_DLL"); + + if (!RegisterClassEx(&wcex)) + { + _Everything_LastError = EVERYTHING_ERROR_REGISTERCLASSEX; + + return 0; + } + } + +//FIXME: this should be static so we keep file info cached. + + hwnd = CreateWindow( + TEXT("EVERYTHING_DLL"), + TEXT(""), + 0, + 0,0,0,0, + 0,0,GetModuleHandle(0),0); + + if (hwnd) + { + _Everything_ChangeWindowMessageFilter(hwnd); + + _Everything_ReplyWindow = hwnd; + _Everything_ReplyID = _EVERYTHING_COPYDATA_QUERYREPLY; + + if (_Everything_SendIPCQuery()) + { + // message pump +loop: + + WaitMessage(); + + // update windows + while(PeekMessage(&msg,NULL,0,0,0)) + { + ret = (DWORD)GetMessage(&msg,0,0,0); + if (ret == -1) goto exit; + if (!ret) goto exit; + + // let windows handle it. + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + goto loop; + } + +exit: + + // get result from window. + DestroyWindow(hwnd); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_CREATEWINDOW; + } + } + else + { + // the everything window was not found. + // we can optionally RegisterWindowMessage("EVERYTHING_IPC_CREATED") and + // wait for Everything to post this message to all top level windows when its up and running. + _Everything_LastError = EVERYTHING_ERROR_IPC; + } + + return 0; +} + +static BOOL EVERYTHINGAPI _Everything_Query(void) +{ + HANDLE hthread; + DWORD thread_id; + + // reset the error flag. + _Everything_LastError = 0; + + hthread = CreateThread(0,0,_Everything_query_thread_proc,0,0,&thread_id); + + if (hthread) + { + WaitForSingleObject(hthread,INFINITE); + + CloseHandle(hthread); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_CREATETHREAD; + } + + return (_Everything_LastError == 0)?TRUE:FALSE; +} + +static BOOL _Everything_SendIPCQuery2(HWND everything_hwnd) +{ + BOOL ret; + DWORD size; + EVERYTHING_IPC_QUERY2 *query; + + // try version 2. + + if (_Everything_IsUnicodeQuery) + { + // unicode + size = sizeof(EVERYTHING_IPC_QUERY2) + ((_Everything_GetSearchLengthW() + 1) * sizeof(WCHAR)); + } + else + { + // ansi + size = sizeof(EVERYTHING_IPC_QUERY2) + ((_Everything_GetSearchLengthA() + 1) * sizeof(char)); + } + + // alloc + query = _Everything_Alloc(size); + + if (query) + { + COPYDATASTRUCT cds; + + query->max_results = _Everything_Max; + query->offset = _Everything_Offset; + query->reply_copydata_message = _Everything_ReplyID; + query->search_flags = (_Everything_Regex?EVERYTHING_IPC_REGEX:0) | (_Everything_MatchCase?EVERYTHING_IPC_MATCHCASE:0) | (_Everything_MatchWholeWord?EVERYTHING_IPC_MATCHWHOLEWORD:0) | (_Everything_MatchPath?EVERYTHING_IPC_MATCHPATH:0); + query->reply_hwnd = (DWORD)(DWORD_PTR)_Everything_ReplyWindow; + query->sort_type = (DWORD)_Everything_Sort; + query->request_flags = (DWORD)_Everything_RequestFlags; + + if (_Everything_IsUnicodeQuery) + { + _Everything_GetSearchTextW((LPWSTR)(query + 1)); + } + else + { + _Everything_GetSearchTextA((LPSTR)(query + 1)); + } + + cds.cbData = size; + cds.dwData = _Everything_IsUnicodeQuery ? EVERYTHING_IPC_COPYDATA_QUERY2W : EVERYTHING_IPC_COPYDATA_QUERY2A; + cds.lpData = query; + + if (SendMessage(everything_hwnd,WM_COPYDATA,(WPARAM)_Everything_ReplyWindow,(LPARAM)&cds)) + { + // successful. + ret = TRUE; + } + else + { + // no ipc + _Everything_LastError = EVERYTHING_ERROR_IPC; + + ret = FALSE; + } + + // get result from window. + _Everything_Free(query); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + + ret = FALSE; + } + + return ret; +} + +static BOOL _Everything_ShouldUseVersion2(void) +{ + if (_Everything_RequestFlags != (EVERYTHING_REQUEST_PATH | EVERYTHING_REQUEST_FILE_NAME)) + { + return TRUE; + } + + if (_Everything_Sort != EVERYTHING_SORT_NAME_ASCENDING) + { + return TRUE; + } + + // just use version 1 + return FALSE; +} + +static BOOL _Everything_SendIPCQuery(void) +{ + HWND everything_hwnd; + BOOL ret; + + // find the everything ipc window. + everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0); + if (everything_hwnd) + { + _Everything_QueryVersion = 2; + + // try version 2 first (if we specified some non-version 1 request flags or sort) + if ((_Everything_ShouldUseVersion2()) && (_Everything_SendIPCQuery2(everything_hwnd))) + { + // successful. + ret = TRUE; + } + else + { + DWORD len; + DWORD size; + void *query; + + // try version 1. + + if (_Everything_IsUnicodeQuery) + { + // unicode + len = _Everything_GetSearchLengthW(); + + size = sizeof(EVERYTHING_IPC_QUERYW) - sizeof(WCHAR) + len*sizeof(WCHAR) + sizeof(WCHAR); + } + else + { + // ansi + len = _Everything_GetSearchLengthA(); + + size = sizeof(EVERYTHING_IPC_QUERYA) - sizeof(char) + (len*sizeof(char)) + sizeof(char); + } + + // alloc + query = _Everything_Alloc(size); + + if (query) + { + COPYDATASTRUCT cds; + + if (_Everything_IsUnicodeQuery) + { + ((EVERYTHING_IPC_QUERYW *)query)->max_results = _Everything_Max; + ((EVERYTHING_IPC_QUERYW *)query)->offset = _Everything_Offset; + ((EVERYTHING_IPC_QUERYW *)query)->reply_copydata_message = _Everything_ReplyID; + ((EVERYTHING_IPC_QUERYW *)query)->search_flags = (_Everything_Regex?EVERYTHING_IPC_REGEX:0) | (_Everything_MatchCase?EVERYTHING_IPC_MATCHCASE:0) | (_Everything_MatchWholeWord?EVERYTHING_IPC_MATCHWHOLEWORD:0) | (_Everything_MatchPath?EVERYTHING_IPC_MATCHPATH:0); + ((EVERYTHING_IPC_QUERYW *)query)->reply_hwnd = (DWORD)(DWORD_PTR)_Everything_ReplyWindow; + + _Everything_GetSearchTextW(((EVERYTHING_IPC_QUERYW *)query)->search_string); + } + else + { + ((EVERYTHING_IPC_QUERYA *)query)->max_results = _Everything_Max; + ((EVERYTHING_IPC_QUERYA *)query)->offset = _Everything_Offset; + ((EVERYTHING_IPC_QUERYA *)query)->reply_copydata_message = _Everything_ReplyID; + ((EVERYTHING_IPC_QUERYA *)query)->search_flags = (_Everything_Regex?EVERYTHING_IPC_REGEX:0) | (_Everything_MatchCase?EVERYTHING_IPC_MATCHCASE:0) | (_Everything_MatchWholeWord?EVERYTHING_IPC_MATCHWHOLEWORD:0) | (_Everything_MatchPath?EVERYTHING_IPC_MATCHPATH:0); + ((EVERYTHING_IPC_QUERYA *)query)->reply_hwnd = (DWORD)(DWORD_PTR)_Everything_ReplyWindow; + + _Everything_GetSearchTextA(((EVERYTHING_IPC_QUERYA *)query)->search_string); + } + + cds.cbData = size; + cds.dwData = _Everything_IsUnicodeQuery ? EVERYTHING_IPC_COPYDATAQUERYW : EVERYTHING_IPC_COPYDATAQUERYA; + cds.lpData = query; + + _Everything_QueryVersion = 1; + + if (SendMessage(everything_hwnd,WM_COPYDATA,(WPARAM)_Everything_ReplyWindow,(LPARAM)&cds)) + { + // successful. + ret = TRUE; + } + else + { + // no ipc + _Everything_LastError = EVERYTHING_ERROR_IPC; + + ret = FALSE; + } + + // get result from window. + _Everything_Free(query); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + + ret = FALSE; + } + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_IPC; + + ret = FALSE; + } + + return ret; +} + +BOOL EVERYTHINGAPI Everything_QueryA(BOOL bWait) +{ + BOOL ret; + + _Everything_Lock(); + + _Everything_IsUnicodeQuery = FALSE; + + if (bWait) + { + ret = _Everything_Query(); + } + else + { + ret = _Everything_SendIPCQuery(); + } + + _Everything_Unlock(); + + return ret; +} + +BOOL EVERYTHINGAPI Everything_QueryW(BOOL bWait) +{ + BOOL ret; + + _Everything_Lock(); + + _Everything_IsUnicodeQuery = TRUE; + + if (bWait) + { + ret = _Everything_Query(); + } + else + { + ret = _Everything_SendIPCQuery(); + } + + _Everything_Unlock(); + + return ret; +} + +static int __cdecl _Everything_CompareA(const void *a,const void *b) +{ + int i; + + i = stricmp(EVERYTHING_IPC_ITEMPATHA(_Everything_List,a),EVERYTHING_IPC_ITEMPATHA(_Everything_List,b)); + + if (!i) + { + return stricmp(EVERYTHING_IPC_ITEMFILENAMEA(_Everything_List,a),EVERYTHING_IPC_ITEMFILENAMEA(_Everything_List,b)); + } + else + if (i > 0) + { + return 1; + } + else + { + return -1; + } +} + +static int __cdecl _Everything_CompareW(const void *a,const void *b) +{ + int i; + + i = wcsicmp(EVERYTHING_IPC_ITEMPATHW(_Everything_List,a),EVERYTHING_IPC_ITEMPATHW(_Everything_List,b)); + + if (!i) + { + return wcsicmp(EVERYTHING_IPC_ITEMFILENAMEW(_Everything_List,a),EVERYTHING_IPC_ITEMFILENAMEW(_Everything_List,b)); + } + else + if (i > 0) + { + return 1; + } + else + { + return -1; + } +} + +void EVERYTHINGAPI Everything_SortResultsByPath(void) +{ + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsUnicodeQuery) + { + qsort(((EVERYTHING_IPC_LISTW *)_Everything_List)->items,((EVERYTHING_IPC_LISTW *)_Everything_List)->numitems,sizeof(EVERYTHING_IPC_ITEMW),_Everything_CompareW); + } + else + { + qsort(((EVERYTHING_IPC_LISTA *)_Everything_List)->items,((EVERYTHING_IPC_LISTA *)_Everything_List)->numitems,sizeof(EVERYTHING_IPC_ITEMA),_Everything_CompareA); + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + } + +//FIXME://TODO: sort list2 + + _Everything_Unlock(); +} + +DWORD EVERYTHINGAPI Everything_GetLastError(void) +{ + DWORD ret; + + _Everything_Lock(); + + ret = _Everything_LastError; + + _Everything_Unlock(); + + return ret; +} + +DWORD EVERYTHINGAPI Everything_GetNumFileResults(void) +{ + DWORD ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsUnicodeQuery) + { + ret = ((EVERYTHING_IPC_LISTW *)_Everything_List)->numfiles; + } + else + { + ret = ((EVERYTHING_IPC_LISTA *)_Everything_List)->numfiles; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = 0; + } + + _Everything_Unlock(); + + return ret; +} + +DWORD EVERYTHINGAPI Everything_GetNumFolderResults(void) +{ + DWORD ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsUnicodeQuery) + { + ret = ((EVERYTHING_IPC_LISTW *)_Everything_List)->numfolders; + } + else + { + ret = ((EVERYTHING_IPC_LISTA *)_Everything_List)->numfolders; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = 0; + } + + _Everything_Unlock(); + + return ret; +} + +static DWORD _Everything_GetNumResults(void) +{ + DWORD ret; + + if (_Everything_List) + { + if (_Everything_IsUnicodeQuery) + { + ret = ((EVERYTHING_IPC_LISTW *)_Everything_List)->numitems; + } + else + { + ret = ((EVERYTHING_IPC_LISTA *)_Everything_List)->numitems; + } + } + else + if (_Everything_List2) + { + ret = _Everything_List2->numitems; + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = 0; + } + + return ret; +} + +DWORD EVERYTHINGAPI Everything_GetNumResults(void) +{ + DWORD ret; + + _Everything_Lock(); + + ret = _Everything_GetNumResults(); + + _Everything_Unlock(); + + return ret; +} + +DWORD EVERYTHINGAPI Everything_GetTotFileResults(void) +{ + DWORD ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsUnicodeQuery) + { + ret = ((EVERYTHING_IPC_LISTW *)_Everything_List)->totfiles; + } + else + { + ret = ((EVERYTHING_IPC_LISTA *)_Everything_List)->totfiles; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = 0; + } + + _Everything_Unlock(); + + return ret; +} + +DWORD EVERYTHINGAPI Everything_GetTotFolderResults(void) +{ + DWORD ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsUnicodeQuery) + { + ret = ((EVERYTHING_IPC_LISTW *)_Everything_List)->totfolders; + } + else + { + ret = ((EVERYTHING_IPC_LISTA *)_Everything_List)->totfolders; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = 0; + } + + _Everything_Unlock(); + + return ret; +} + +DWORD EVERYTHINGAPI Everything_GetTotResults(void) +{ + DWORD ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsUnicodeQuery) + { + ret = ((EVERYTHING_IPC_LISTW *)_Everything_List)->totitems; + } + else + { + ret = ((EVERYTHING_IPC_LISTA *)_Everything_List)->totitems; + } + } + else + if (_Everything_List2) + { + ret = _Everything_List2->totitems; + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = 0; + } + + _Everything_Unlock(); + + return ret; +} + +BOOL EVERYTHINGAPI Everything_IsVolumeResult(DWORD dwIndex) +{ + BOOL ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + if (_Everything_IsUnicodeQuery) + { + ret = (((EVERYTHING_IPC_LISTW *)_Everything_List)->items[dwIndex].flags & EVERYTHING_IPC_DRIVE) ? TRUE : FALSE; + } + else + { + ret = (((EVERYTHING_IPC_LISTA *)_Everything_List)->items[dwIndex].flags & EVERYTHING_IPC_DRIVE) ? TRUE : FALSE; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + } + } + else + if (_Everything_List2) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + ret = (((EVERYTHING_IPC_ITEM2 *)(_Everything_List2 + 1))[dwIndex].flags & EVERYTHING_IPC_DRIVE) ? TRUE : FALSE; + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = FALSE; + } + + _Everything_Unlock(); + + return ret; +} + +BOOL EVERYTHINGAPI Everything_IsFolderResult(DWORD dwIndex) +{ + BOOL ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + if (_Everything_IsUnicodeQuery) + { + ret = ((EVERYTHING_IPC_LISTW *)_Everything_List)->items[dwIndex].flags & (EVERYTHING_IPC_FOLDER) ? TRUE : FALSE; + } + else + { + ret = ((EVERYTHING_IPC_LISTA *)_Everything_List)->items[dwIndex].flags & (EVERYTHING_IPC_FOLDER) ? TRUE : FALSE; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + } + } + else + if (_Everything_List2) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + ret = (((EVERYTHING_IPC_ITEM2 *)(_Everything_List2 + 1))[dwIndex].flags & (EVERYTHING_IPC_FOLDER)) ? TRUE : FALSE; + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = FALSE; + } + + _Everything_Unlock(); + + return ret; +} + +BOOL EVERYTHINGAPI Everything_IsFileResult(DWORD dwIndex) +{ + BOOL ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + if (_Everything_IsUnicodeQuery) + { + ret = (((EVERYTHING_IPC_LISTW *)_Everything_List)->items[dwIndex].flags & (EVERYTHING_IPC_FOLDER)) ? FALSE : TRUE; + } + else + { + ret = (((EVERYTHING_IPC_LISTA *)_Everything_List)->items[dwIndex].flags & (EVERYTHING_IPC_FOLDER)) ? FALSE : TRUE; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + } + } + else + if (_Everything_List2) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + ret = (((EVERYTHING_IPC_ITEM2 *)(_Everything_List2 + 1))[dwIndex].flags & (EVERYTHING_IPC_FOLDER)) ? FALSE : TRUE; + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = FALSE; + } + + _Everything_Unlock(); + + return ret; +} + +LPCWSTR EVERYTHINGAPI Everything_GetResultFileNameW(DWORD dwIndex) +{ + LPCWSTR ret; + + _Everything_Lock(); + + if ((_Everything_List) && (_Everything_IsUnicodeQuery)) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + ret = EVERYTHING_IPC_ITEMFILENAMEW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[dwIndex]); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + } + } + else + if ((_Everything_List2) && (_Everything_IsUnicodeQuery)) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + ret = _Everything_GetRequestData(dwIndex,EVERYTHING_REQUEST_FILE_NAME); + + if (ret) + { + // skip length in characters. + ret = (LPCWSTR)(((char *)ret) + sizeof(DWORD)); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDREQUEST; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = NULL; + } + + _Everything_Unlock(); + + return ret; +} + +LPCSTR EVERYTHINGAPI Everything_GetResultFileNameA(DWORD dwIndex) +{ + LPCSTR ret; + + _Everything_Lock(); + + if ((_Everything_List) && (!_Everything_IsUnicodeQuery)) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + ret = EVERYTHING_IPC_ITEMFILENAMEA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[dwIndex]); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + } + } + else + if ((_Everything_List2) && (!_Everything_IsUnicodeQuery)) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + ret = _Everything_GetRequestData(dwIndex,EVERYTHING_REQUEST_FILE_NAME); + + if (ret) + { + // skip length in characters. + ret = (LPCSTR)(((char *)ret) + sizeof(DWORD)); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDREQUEST; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = NULL; + } + + _Everything_Unlock(); + + return ret; +} + +LPCWSTR EVERYTHINGAPI Everything_GetResultPathW(DWORD dwIndex) +{ + LPCWSTR ret; + + _Everything_Lock(); + + if ((_Everything_List) && (_Everything_IsUnicodeQuery)) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + ret = EVERYTHING_IPC_ITEMPATHW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[dwIndex]); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + } + } + else + if ((_Everything_List2) && (_Everything_IsUnicodeQuery)) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + ret = _Everything_GetRequestData(dwIndex,EVERYTHING_REQUEST_PATH); + + if (ret) + { + // skip length in characters. + ret = (LPCWSTR)(((char *)ret) + sizeof(DWORD)); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDREQUEST; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = NULL; + } + + _Everything_Unlock(); + + return ret; +} + +LPCSTR EVERYTHINGAPI Everything_GetResultPathA(DWORD dwIndex) +{ + LPCSTR ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + ret = EVERYTHING_IPC_ITEMPATHA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[dwIndex]); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + } + } + else + if ((_Everything_List2) && (!_Everything_IsUnicodeQuery)) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + ret = _Everything_GetRequestData(dwIndex,EVERYTHING_REQUEST_PATH); + + if (ret) + { + // skip length in characters. + ret = (LPCSTR)(((char *)ret) + sizeof(DWORD)); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDREQUEST; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = NULL; + } + + _Everything_Unlock(); + + return ret; +} + +// max is in chars +static DWORD _Everything_CopyW(LPWSTR buf,DWORD bufmax,DWORD catlen,LPCWSTR s) +{ + DWORD wlen; + + if (buf) + { + buf += catlen; + bufmax -= catlen; + } + + wlen = _Everything_StringLengthW(s); + if (!wlen) + { + if (buf) + { + buf[wlen] = 0; + } + + return catlen; + } + + // terminate + if (wlen > bufmax-1) wlen = bufmax-1; + + if (buf) + { + CopyMemory(buf,s,wlen*sizeof(WCHAR)); + + buf[wlen] = 0; + } + + return wlen + catlen; +} + +static DWORD _Everything_CopyA(LPSTR buf,DWORD max,DWORD catlen,LPCSTR s) +{ + DWORD len; + + if (buf) + { + buf += catlen; + max -= catlen; + } + + len = _Everything_StringLengthA(s); + if (!len) + { + if (buf) + { + buf[len] = 0; + } + + return catlen; + } + + // terminate + if (len > max-1) len = max-1; + + if (buf) + { + CopyMemory(buf,s,len*sizeof(char)); + + buf[len] = 0; + } + + return len + catlen; + +} + +// max is in chars +static DWORD _Everything_CopyWFromA(LPWSTR buf,DWORD bufmax,DWORD catlen,LPCSTR s) +{ + DWORD wlen; + + if (buf) + { + buf += catlen; + bufmax -= catlen; + } + + wlen = MultiByteToWideChar(CP_ACP,0,s,_Everything_StringLengthA(s),0,0); + if (!wlen) + { + if (buf) + { + buf[wlen] = 0; + } + + return catlen; + } + + // terminate + if (wlen > bufmax-1) wlen = bufmax-1; + + if (buf) + { + MultiByteToWideChar(CP_ACP,0,s,_Everything_StringLengthA(s),buf,wlen); + + buf[wlen] = 0; + } + + return wlen + catlen; +} + +static DWORD _Everything_CopyAFromW(LPSTR buf,DWORD max,DWORD catlen,LPCWSTR s) +{ + DWORD len; + + if (buf) + { + buf += catlen; + max -= catlen; + } + + len = WideCharToMultiByte(CP_ACP,0,s,_Everything_StringLengthW(s),0,0,0,0); + if (!len) + { + if (buf) + { + buf[len] = 0; + } + + return catlen; + } + + // terminate + if (len > max-1) len = max-1; + + if (buf) + { + WideCharToMultiByte(CP_ACP,0,s,_Everything_StringLengthW(s),buf,len,0,0); + + buf[len] = 0; + } + + return len + catlen; + +} + +DWORD EVERYTHINGAPI Everything_GetResultFullPathNameW(DWORD dwIndex,LPWSTR wbuf,DWORD wbuf_size_in_wchars) +{ + DWORD len; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,0,EVERYTHING_IPC_ITEMPATHW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[dwIndex])); + + if (len) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,len,_Everything_IsSchemeNameW(EVERYTHING_IPC_ITEMPATHW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[dwIndex])) ? L"/" : L"\\"); + } + } + else + { + len = _Everything_CopyWFromA(wbuf,wbuf_size_in_wchars,0,EVERYTHING_IPC_ITEMPATHA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[dwIndex])); + + if (len) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,len,_Everything_IsSchemeNameA(EVERYTHING_IPC_ITEMPATHA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[dwIndex])) ? L"/" : L"\\"); + } + } + + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,len,EVERYTHING_IPC_ITEMFILENAMEW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[dwIndex])); + } + else + { + len = _Everything_CopyWFromA(wbuf,wbuf_size_in_wchars,len,EVERYTHING_IPC_ITEMFILENAMEA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[dwIndex])); + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,0,L""); + } + } + else + if (_Everything_List2) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + const void *full_path_and_name; + + full_path_and_name = _Everything_GetRequestData(dwIndex,EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME); + + if (full_path_and_name) + { + // skip number of characters. + full_path_and_name = (void *)(((char *)full_path_and_name) + sizeof(DWORD)); + + // we got the full path and name already. + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,0,full_path_and_name); + } + else + { + len = _Everything_CopyWFromA(wbuf,wbuf_size_in_wchars,0,full_path_and_name); + } + } + else + { + const void *path; + + path = _Everything_GetRequestData(dwIndex,EVERYTHING_REQUEST_PATH); + + if (path) + { + const void *name; + + // skip number of characters. + path = (void *)(((char *)path) + sizeof(DWORD)); + + name = _Everything_GetRequestData(dwIndex,EVERYTHING_REQUEST_FILE_NAME); + + if (name) + { + // skip number of characters. + name = (void *)(((char *)name) + sizeof(DWORD)); + + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,0,path); + + if (len) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,len,_Everything_IsSchemeNameW(path) ? L"/" : L"\\"); + } + } + else + { + len = _Everything_CopyWFromA(wbuf,wbuf_size_in_wchars,0,path); + + if (len) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,len,_Everything_IsSchemeNameA(path) ? L"/" : L"\\"); + } + } + + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,len,name); + } + else + { + len = _Everything_CopyWFromA(wbuf,wbuf_size_in_wchars,len,name); + } + } + else + { + // name data not available. + _Everything_LastError = EVERYTHING_ERROR_INVALIDREQUEST; + + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,0,L""); + } + } + else + { + // path data not available. + _Everything_LastError = EVERYTHING_ERROR_INVALIDREQUEST; + + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,0,L""); + } + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,0,L""); + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,0,L""); + } + + _Everything_Unlock(); + + return len; +} + +DWORD EVERYTHINGAPI Everything_GetResultFullPathNameA(DWORD dwIndex,LPSTR buf,DWORD bufsize) +{ + DWORD len; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyAFromW(buf,bufsize,0,EVERYTHING_IPC_ITEMPATHW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[dwIndex])); + } + else + { + len = _Everything_CopyA(buf,bufsize,0,EVERYTHING_IPC_ITEMPATHA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[dwIndex])); + } + + if (len) + { + len = _Everything_CopyA(buf,bufsize,len,_Everything_IsSchemeNameA(buf) ? "/" : "\\"); + } + + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyAFromW(buf,bufsize,len,EVERYTHING_IPC_ITEMFILENAMEW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[dwIndex])); + } + else + { + len = _Everything_CopyA(buf,bufsize,len,EVERYTHING_IPC_ITEMFILENAMEA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[dwIndex])); + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + len = _Everything_CopyA(buf,bufsize,0,""); + } + } + else + if (_Everything_List2) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + const void *full_path_and_name; + + full_path_and_name = _Everything_GetRequestData(dwIndex,EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME); + + if (full_path_and_name) + { + // skip number of characters. + full_path_and_name = (void *)(((char *)full_path_and_name) + sizeof(DWORD)); + + // we got the full path and name already. + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyAFromW(buf,bufsize,0,full_path_and_name); + } + else + { + len = _Everything_CopyA(buf,bufsize,0,full_path_and_name); + } + } + else + { + const void *path; + + path = _Everything_GetRequestData(dwIndex,EVERYTHING_REQUEST_PATH); + + if (path) + { + const void *name; + + // skip number of characters. + path = (void *)(((char *)path) + sizeof(DWORD)); + + name = _Everything_GetRequestData(dwIndex,EVERYTHING_REQUEST_FILE_NAME); + + if (name) + { + // skip number of characters. + name = (void *)(((char *)name) + sizeof(DWORD)); + + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyAFromW(buf,bufsize,0,path); + } + else + { + len = _Everything_CopyA(buf,bufsize,0,path); + } + + if (len) + { + len = _Everything_CopyA(buf,bufsize,len,_Everything_IsSchemeNameA(buf) ? "/" : "\\"); + } + + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyAFromW(buf,bufsize,len,name); + } + else + { + len = _Everything_CopyA(buf,bufsize,len,name); + } + } + else + { + // name data not available. + _Everything_LastError = EVERYTHING_ERROR_INVALIDREQUEST; + + len = _Everything_CopyA(buf,bufsize,0,""); + } + } + else + { + // path data not available. + _Everything_LastError = EVERYTHING_ERROR_INVALIDREQUEST; + + len = _Everything_CopyA(buf,bufsize,0,""); + } + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + len = _Everything_CopyA(buf,bufsize,0,""); + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + len = _Everything_CopyA(buf,bufsize,0,""); + } + + _Everything_Unlock(); + + return len; +} + +BOOL EVERYTHINGAPI Everything_IsQueryReply(UINT message,WPARAM wParam,LPARAM lParam,DWORD dwId) +{ + if (message == WM_COPYDATA) + { + COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lParam; + + if (cds) + { + if ((cds->dwData == _Everything_ReplyID) && (cds->dwData == dwId)) + { + if (_Everything_QueryVersion == 2) + { + _Everything_FreeLists(); + + _Everything_List2 = _Everything_Alloc(cds->cbData); + + if (_Everything_List2) + { + _Everything_LastError = 0; + + CopyMemory(_Everything_List2,cds->lpData,cds->cbData); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + + return TRUE; + } + else + if (_Everything_QueryVersion == 1) + { + if (_Everything_IsUnicodeQuery) + { + _Everything_FreeLists(); + + // TODO: check the size is valid. + _Everything_List = _Everything_Alloc(cds->cbData); + + if (_Everything_List) + { + _Everything_LastError = 0; + + CopyMemory(_Everything_List,cds->lpData,cds->cbData); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + + return TRUE; + } + else + { + _Everything_FreeLists(); + + // TODO: check the size is valid. + _Everything_List = _Everything_Alloc(cds->cbData); + + if (_Everything_List) + { + _Everything_LastError = 0; + + CopyMemory(_Everything_List,cds->lpData,cds->cbData); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + + return TRUE; + } + } + } + } + } + + return FALSE; +} + +void EVERYTHINGAPI Everything_Reset(void) +{ + _Everything_Lock(); + + if (_Everything_Search) + { + _Everything_Free(_Everything_Search); + + _Everything_Search = 0; + } + + _Everything_FreeLists(); + + // reset state + _Everything_MatchPath = FALSE; + _Everything_MatchCase = FALSE; + _Everything_MatchWholeWord = FALSE; + _Everything_Regex = FALSE; + _Everything_LastError = FALSE; + _Everything_Max = EVERYTHING_IPC_ALLRESULTS; + _Everything_Offset = 0; + _Everything_Sort = EVERYTHING_SORT_NAME_ASCENDING; + _Everything_RequestFlags = EVERYTHING_REQUEST_PATH | EVERYTHING_REQUEST_FILE_NAME; + _Everything_IsUnicodeQuery = FALSE; + _Everything_IsUnicodeSearch = FALSE; + + _Everything_Unlock(); +} + +void EVERYTHINGAPI Everything_CleanUp(void) +{ + Everything_Reset(); + DeleteCriticalSection(&_Everything_cs); + _Everything_Initialized = 0; + _Everything_InterlockedCount = 0; +} + +static void *_Everything_Alloc(DWORD size) +{ + return HeapAlloc(GetProcessHeap(),0,size); +} + +static void _Everything_Free(void *ptr) +{ + HeapFree(GetProcessHeap(),0,ptr); +} + +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetResultListSort(void) +{ + DWORD dwSort; + + _Everything_Lock(); + + dwSort = EVERYTHING_SORT_NAME_ASCENDING; + + if (_Everything_List2) + { + dwSort = _Everything_List2->sort_type; + } + + _Everything_Unlock(); + + return dwSort; +} + +EVERYTHINGUSERAPI DWORD EVERYTHINGAPI Everything_GetResultListRequestFlags(void) +{ + DWORD dwRequestFlags; + + _Everything_Lock(); + + dwRequestFlags = EVERYTHING_REQUEST_PATH | EVERYTHING_REQUEST_FILE_NAME; + + if (_Everything_List2) + { + dwRequestFlags = _Everything_List2->request_flags; + } + + _Everything_Unlock(); + + return dwRequestFlags; +} + +static void _Everything_FreeLists(void) +{ + if (_Everything_List) + { + _Everything_Free(_Everything_List); + + _Everything_List = 0; + } + + if (_Everything_List2) + { + _Everything_Free(_Everything_List2); + + _Everything_List2 = 0; + } +} + +static BOOL _Everything_IsValidResultIndex(DWORD dwIndex) +{ + if (dwIndex < 0) + { + return FALSE; + } + + if (dwIndex >= _Everything_GetNumResults()) + { + return FALSE; + } + + return TRUE; +} + +// assumes _Everything_List2 and dwIndex are valid. +static void *_Everything_GetRequestData(DWORD dwIndex,DWORD dwRequestType) +{ + char *p; + EVERYTHING_IPC_ITEM2 *items; + + items = (EVERYTHING_IPC_ITEM2 *)(_Everything_List2 + 1); + + p = ((char *)_Everything_List2) + items[dwIndex].data_offset; + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_FILE_NAME) + { + DWORD len; + + if (dwRequestType == EVERYTHING_REQUEST_FILE_NAME) + { + return p; + } + + len = *(DWORD *)p; + p += sizeof(DWORD); + + if (_Everything_IsUnicodeQuery) + { + p += (len + 1) * sizeof(WCHAR); + } + else + { + p += (len + 1) * sizeof(CHAR); + } + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_PATH) + { + DWORD len; + + if (dwRequestType == EVERYTHING_REQUEST_PATH) + { + return p; + } + + len = *(DWORD *)p; + p += sizeof(DWORD); + + if (_Everything_IsUnicodeQuery) + { + p += (len + 1) * sizeof(WCHAR); + } + else + { + p += (len + 1) * sizeof(CHAR); + } + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME) + { + DWORD len; + + if (dwRequestType == EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME) + { + return p; + } + + len = *(DWORD *)p; + p += sizeof(DWORD); + + if (_Everything_IsUnicodeQuery) + { + p += (len + 1) * sizeof(WCHAR); + } + else + { + p += (len + 1) * sizeof(CHAR); + } + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_EXTENSION) + { + DWORD len; + + if (dwRequestType == EVERYTHING_REQUEST_EXTENSION) + { + return p; + } + + len = *(DWORD *)p; + p += sizeof(DWORD); + + if (_Everything_IsUnicodeQuery) + { + p += (len + 1) * sizeof(WCHAR); + } + else + { + p += (len + 1) * sizeof(CHAR); + } + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_SIZE) + { + if (dwRequestType == EVERYTHING_REQUEST_SIZE) + { + return p; + } + + p += sizeof(LARGE_INTEGER); + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_DATE_CREATED) + { + if (dwRequestType == EVERYTHING_REQUEST_DATE_CREATED) + { + return p; + } + + p += sizeof(FILETIME); + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_DATE_MODIFIED) + { + if (dwRequestType == EVERYTHING_REQUEST_DATE_MODIFIED) + { + return p; + } + + p += sizeof(FILETIME); + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_DATE_ACCESSED) + { + if (dwRequestType == EVERYTHING_REQUEST_DATE_ACCESSED) + { + return p; + } + + p += sizeof(FILETIME); + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_ATTRIBUTES) + { + if (dwRequestType == EVERYTHING_REQUEST_ATTRIBUTES) + { + return p; + } + + p += sizeof(DWORD); + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_FILE_LIST_FILE_NAME) + { + DWORD len; + + if (dwRequestType == EVERYTHING_REQUEST_FILE_LIST_FILE_NAME) + { + return p; + } + + len = *(DWORD *)p; + p += sizeof(DWORD); + + if (_Everything_IsUnicodeQuery) + { + p += (len + 1) * sizeof(WCHAR); + } + else + { + p += (len + 1) * sizeof(CHAR); + } + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_RUN_COUNT) + { + if (dwRequestType == EVERYTHING_REQUEST_RUN_COUNT) + { + return p; + } + + p += sizeof(DWORD); + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_DATE_RUN) + { + if (dwRequestType == EVERYTHING_REQUEST_DATE_RUN) + { + return p; + } + + p += sizeof(FILETIME); + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_DATE_RECENTLY_CHANGED) + { + if (dwRequestType == EVERYTHING_REQUEST_DATE_RECENTLY_CHANGED) + { + return p; + } + + p += sizeof(FILETIME); + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME) + { + DWORD len; + + if (dwRequestType == EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME) + { + return p; + } + + len = *(DWORD *)p; + p += sizeof(DWORD); + + if (_Everything_IsUnicodeQuery) + { + p += (len + 1) * sizeof(WCHAR); + } + else + { + p += (len + 1) * sizeof(CHAR); + } + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_HIGHLIGHTED_PATH) + { + DWORD len; + + if (dwRequestType == EVERYTHING_REQUEST_HIGHLIGHTED_PATH) + { + return p; + } + + len = *(DWORD *)p; + p += sizeof(DWORD); + + if (_Everything_IsUnicodeQuery) + { + p += (len + 1) * sizeof(WCHAR); + } + else + { + p += (len + 1) * sizeof(CHAR); + } + } + + if (_Everything_List2->request_flags & EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME) + { + DWORD len; + + if (dwRequestType == EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME) + { + return p; + } + + len = *(DWORD *)p; + p += sizeof(DWORD); + + if (_Everything_IsUnicodeQuery) + { + p += (len + 1) * sizeof(WCHAR); + } + else + { + p += (len + 1) * sizeof(CHAR); + } + } + + return NULL; +} + +static BOOL _Everything_IsSchemeNameW(LPCWSTR s) +{ + LPCWSTR p; + + p = s; + + while(*p) + { + if (*p == ':') + { + p++; + + if ((p[0] == '/') && (p[1] == '/')) + { + return TRUE; + } + + break; + } + + p++; + } + + return FALSE; +} + +static BOOL _Everything_IsSchemeNameA(LPCSTR s) +{ + LPCSTR p; + + p = s; + + while(*p) + { + if (*p == ':') + { + p++; + + if ((p[0] == '/') && (p[1] == '/')) + { + return TRUE; + } + + break; + } + + p++; + } + + return FALSE; +} + +static void _Everything_ChangeWindowMessageFilter(HWND hwnd) +{ + if (!_Everything_GotChangeWindowMessageFilterEx) + { + // allow the everything window to send a reply. + _Everything_user32_hdll = LoadLibraryW(L"user32.dll"); + + if (_Everything_user32_hdll) + { + _Everything_pChangeWindowMessageFilterEx = (BOOL (WINAPI *)(HWND hWnd,UINT message,DWORD action,_EVERYTHING_PCHANGEFILTERSTRUCT pChangeFilterStruct))GetProcAddress(_Everything_user32_hdll,"ChangeWindowMessageFilterEx"); + } + + _Everything_GotChangeWindowMessageFilterEx = 1; + } + + if (_Everything_GotChangeWindowMessageFilterEx) + { + if (_Everything_pChangeWindowMessageFilterEx) + { + _Everything_pChangeWindowMessageFilterEx(hwnd,WM_COPYDATA,_EVERYTHING_MSGFLT_ALLOW,0); + } + } +} + +static LPCWSTR _Everything_GetResultRequestStringW(DWORD dwIndex,DWORD dwRequestType) +{ + LPCWSTR str; + + _Everything_Lock(); + + if ((_Everything_List2) && (_Everything_IsUnicodeQuery)) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + str = _Everything_GetRequestData(dwIndex,dwRequestType); + if (str) + { + // skip length in characters. + str = (LPCWSTR)(((char *)str) + sizeof(DWORD)); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDREQUEST; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + str = NULL; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + str = NULL; + } + + _Everything_Unlock(); + + return str; +} + +static LPCSTR _Everything_GetResultRequestStringA(DWORD dwIndex,DWORD dwRequestType) +{ + LPCSTR str; + + _Everything_Lock(); + + if ((_Everything_List2) && (!_Everything_IsUnicodeQuery)) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + str = _Everything_GetRequestData(dwIndex,dwRequestType); + if (str) + { + // skip length in characters. + str = (LPCSTR)(((char *)str) + sizeof(DWORD)); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDREQUEST; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + str = NULL; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + str = NULL; + } + + _Everything_Unlock(); + + return str; +} + +static BOOL _Everything_GetResultRequestData(DWORD dwIndex,DWORD dwRequestType,void *data,int size) +{ + BOOL ret; + + _Everything_Lock(); + + if (_Everything_List2) + { + if (_Everything_IsValidResultIndex(dwIndex)) + { + void *request_data; + + request_data = _Everything_GetRequestData(dwIndex,dwRequestType); + if (request_data) + { + CopyMemory(data,request_data,size); + + ret = TRUE; + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDREQUEST; + + ret = FALSE; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = FALSE; + } + + _Everything_Unlock(); + + return ret; +} + +LPCWSTR EVERYTHINGAPI Everything_GetResultExtensionW(DWORD dwIndex) +{ + return _Everything_GetResultRequestStringW(dwIndex,EVERYTHING_REQUEST_EXTENSION); +} + +LPCSTR EVERYTHINGAPI Everything_GetResultExtensionA(DWORD dwIndex) +{ + return _Everything_GetResultRequestStringA(dwIndex,EVERYTHING_REQUEST_EXTENSION); +} + +BOOL EVERYTHINGAPI Everything_GetResultSize(DWORD dwIndex,LARGE_INTEGER *lpSize) +{ + return _Everything_GetResultRequestData(dwIndex,EVERYTHING_REQUEST_SIZE,lpSize,sizeof(LARGE_INTEGER)); +} + +BOOL EVERYTHINGAPI Everything_GetResultDateCreated(DWORD dwIndex,FILETIME *lpDateCreated) +{ + return _Everything_GetResultRequestData(dwIndex,EVERYTHING_REQUEST_DATE_CREATED,lpDateCreated,sizeof(FILETIME)); +} + +BOOL EVERYTHINGAPI Everything_GetResultDateModified(DWORD dwIndex,FILETIME *lpDateModified) +{ + return _Everything_GetResultRequestData(dwIndex,EVERYTHING_REQUEST_DATE_MODIFIED,lpDateModified,sizeof(FILETIME)); +} + +BOOL EVERYTHINGAPI Everything_GetResultDateAccessed(DWORD dwIndex,FILETIME *lpDateAccessed) +{ + return _Everything_GetResultRequestData(dwIndex,EVERYTHING_REQUEST_DATE_ACCESSED,lpDateAccessed,sizeof(FILETIME)); +} + +DWORD EVERYTHINGAPI Everything_GetResultAttributes(DWORD dwIndex) +{ + DWORD dwAttributes; + + if (_Everything_GetResultRequestData(dwIndex,EVERYTHING_REQUEST_ATTRIBUTES,&dwAttributes,sizeof(DWORD))) + { + return dwAttributes; + } + + return INVALID_FILE_ATTRIBUTES; +} + +LPCWSTR EVERYTHINGAPI Everything_GetResultFileListFileNameW(DWORD dwIndex) +{ + return _Everything_GetResultRequestStringW(dwIndex,EVERYTHING_REQUEST_FILE_LIST_FILE_NAME); +} + +LPCSTR EVERYTHINGAPI Everything_GetResultFileListFileNameA(DWORD dwIndex) +{ + return _Everything_GetResultRequestStringA(dwIndex,EVERYTHING_REQUEST_FILE_LIST_FILE_NAME); +} + +DWORD EVERYTHINGAPI Everything_GetResultRunCount(DWORD dwIndex) +{ + DWORD dwRunCount; + + if (_Everything_GetResultRequestData(dwIndex,EVERYTHING_REQUEST_RUN_COUNT,&dwRunCount,sizeof(DWORD))) + { + return dwRunCount; + } + + return 0; +} + +BOOL EVERYTHINGAPI Everything_GetResultDateRun(DWORD dwIndex,FILETIME *lpDateRun) +{ + return _Everything_GetResultRequestData(dwIndex,EVERYTHING_REQUEST_DATE_RUN,lpDateRun,sizeof(FILETIME)); +} + +BOOL EVERYTHINGAPI Everything_GetResultDateRecentlyChanged(DWORD dwIndex,FILETIME *lpDateRecentlyChanged) +{ + return _Everything_GetResultRequestData(dwIndex,EVERYTHING_REQUEST_DATE_RECENTLY_CHANGED,lpDateRecentlyChanged,sizeof(FILETIME)); +} + +LPCWSTR EVERYTHINGAPI Everything_GetResultHighlightedFileNameW(DWORD dwIndex) +{ + return _Everything_GetResultRequestStringW(dwIndex,EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME); +} + +LPCSTR EVERYTHINGAPI Everything_GetResultHighlightedFileNameA(DWORD dwIndex) +{ + return _Everything_GetResultRequestStringA(dwIndex,EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME); +} + +LPCWSTR EVERYTHINGAPI Everything_GetResultHighlightedPathW(DWORD dwIndex) +{ + return _Everything_GetResultRequestStringW(dwIndex,EVERYTHING_REQUEST_HIGHLIGHTED_PATH); +} + +LPCSTR EVERYTHINGAPI Everything_GetResultHighlightedPathA(DWORD dwIndex) +{ + return _Everything_GetResultRequestStringA(dwIndex,EVERYTHING_REQUEST_HIGHLIGHTED_PATH); +} + +LPCWSTR EVERYTHINGAPI Everything_GetResultHighlightedFullPathAndFileNameW(DWORD dwIndex) +{ + return _Everything_GetResultRequestStringW(dwIndex,EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME); +} + +LPCSTR EVERYTHINGAPI Everything_GetResultHighlightedFullPathAndFileNameA(DWORD dwIndex) +{ + return _Everything_GetResultRequestStringA(dwIndex,EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME); +} + +static BOOL _Everything_SendAPIBoolCommand(int command,LPARAM lParam) +{ + HWND everything_hwnd; + + everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0); + if (everything_hwnd) + { + _Everything_LastError = 0; + + // use SendMessageTimeout and check the message was sent successfully.. + if (SendMessage(everything_hwnd,EVERYTHING_WM_IPC,command,lParam)) + { + return TRUE; + } + else + { + return FALSE; + } + } + else + { + // the everything window was not found. + // we can optionally RegisterWindowMessage("EVERYTHING_IPC_CREATED") and + // wait for Everything to post this message to all top level windows when its up and running. + _Everything_LastError = EVERYTHING_ERROR_IPC; + + return FALSE; + } +} + +static DWORD _Everything_SendAPIDwordCommand(int command,LPARAM lParam) +{ + HWND everything_hwnd; + + everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0); + if (everything_hwnd) + { + _Everything_LastError = 0; + + // use SendMessageTimeout and check the message was sent successfully.. + return (DWORD)SendMessage(everything_hwnd,EVERYTHING_WM_IPC,command,lParam); + } + else + { + // the everything window was not found. + // we can optionally RegisterWindowMessage("EVERYTHING_IPC_CREATED") and + // wait for Everything to post this message to all top level windows when its up and running. + _Everything_LastError = EVERYTHING_ERROR_IPC; + + return 0; + } +} + +BOOL EVERYTHINGAPI Everything_IsDBLoaded(void) +{ + return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_IS_DB_LOADED,0); +} + +BOOL EVERYTHINGAPI Everything_IsAdmin(void) +{ + return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_IS_ADMIN,0); +} + +BOOL EVERYTHINGAPI Everything_IsAppData(void) +{ + return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_IS_APPDATA,0); +} + +BOOL EVERYTHINGAPI Everything_RebuildDB(void) +{ + return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_REBUILD_DB,0); +} + +BOOL EVERYTHINGAPI Everything_UpdateAllFolderIndexes(void) +{ + return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_UPDATE_ALL_FOLDER_INDEXES,0); +} + +BOOL EVERYTHINGAPI Everything_SaveDB(void) +{ + return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_SAVE_DB,0); +} + +BOOL EVERYTHINGAPI Everything_SaveRunHistory(void) +{ + return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_SAVE_RUN_HISTORY,0); +} + +BOOL EVERYTHINGAPI Everything_DeleteRunHistory(void) +{ + return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_DELETE_RUN_HISTORY,0); +} + +DWORD EVERYTHINGAPI Everything_GetMajorVersion(void) +{ + return _Everything_SendAPIDwordCommand(EVERYTHING_IPC_GET_MAJOR_VERSION,0); +} + +DWORD EVERYTHINGAPI Everything_GetMinorVersion(void) +{ + return _Everything_SendAPIDwordCommand(EVERYTHING_IPC_GET_MINOR_VERSION,0); +} + +DWORD EVERYTHINGAPI Everything_GetRevision(void) +{ + return _Everything_SendAPIDwordCommand(EVERYTHING_IPC_GET_REVISION,0); +} + +DWORD EVERYTHINGAPI Everything_GetBuildNumber(void) +{ + return _Everything_SendAPIDwordCommand(EVERYTHING_IPC_GET_BUILD_NUMBER,0); +} + +DWORD EVERYTHINGAPI Everything_GetTargetMachine(void) +{ + return _Everything_SendAPIDwordCommand(EVERYTHING_IPC_GET_TARGET_MACHINE,0); +} + +BOOL EVERYTHINGAPI Everything_Exit(void) +{ + return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_EXIT,0); +} + +// can be called as admin or standard user. +// will self elevate if needed. +// +// internal use only. +// TODO: no longer used, remove. +UINT EVERYTHINGAPI Everything_MSIExitAndStopService(void *msihandle) +{ + // close Everything client + { + HWND everything_hwnd; + + everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0); + if (everything_hwnd) + { + DWORD dwProcessId; + HANDLE process_handle; + + process_handle = 0; + + // wait for Everything to exit. + if (GetWindowThreadProcessId(everything_hwnd,&dwProcessId)) + { + process_handle = OpenProcess(SYNCHRONIZE,FALSE,dwProcessId); + } + + SendMessage(everything_hwnd,WM_CLOSE,0,0); + + if (process_handle) + { + WaitForSingleObject(process_handle,60000); + + CloseHandle(process_handle); + } + } + } + + // stop Everything Service. + { + HANDLE scm_handle; + + // failed? check status.. + scm_handle = OpenSCManager(0,0,SC_MANAGER_ENUMERATE_SERVICE); + + if (scm_handle) + { + SC_HANDLE service_handle; + + service_handle = OpenService(scm_handle,L"Everything",SERVICE_QUERY_CONFIG|SERVICE_QUERY_STATUS); + + if (service_handle) + { + QUERY_SERVICE_CONFIG *service_config; + DWORD bytes_needed; + + service_config = _Everything_Alloc(8192); + if (service_config) + { + if (QueryServiceConfig(service_handle,service_config,8192,&bytes_needed)) + { + if (_Everything_StringLengthW(service_config->lpBinaryPathName) < MAX_PATH) + { + wchar_t filename_wbuf[MAX_PATH]; + const wchar_t *p; + wchar_t *d; + + p = service_config->lpBinaryPathName; + d = filename_wbuf; + + if (*p == '"') + { + p++; + + while(*p) + { + if (*p == '"') + { + break; + } + + *d++ = *p; + p++; + } + } + else + { + while(*p) + { + if (*p == ' ') + { + break; + } + + *d++ = *p; + p++; + } + } + + *d = 0; + + if (*filename_wbuf) + { + SERVICE_STATUS_PROCESS status_process; + HANDLE process_handle; + + process_handle = 0; + + if (QueryServiceStatusEx(service_handle,SC_STATUS_PROCESS_INFO,(BYTE *)&status_process,sizeof(SERVICE_STATUS_PROCESS),&bytes_needed)) + { + if (status_process.dwProcessId) + { + // wait for Everything to exit. + process_handle = OpenProcess(SYNCHRONIZE,FALSE,status_process.dwProcessId); + } + } + +// MessageBox(0,L"EXEC OK",L"EverythingSDK",MB_OK) ; + + // stop service. + if (GetFileAttributes(filename_wbuf) != INVALID_FILE_ATTRIBUTES) + { + SHELLEXECUTEINFO sei; + + ZeroMemory(&sei,sizeof(SHELLEXECUTEINFO)); + + sei.cbSize = sizeof(SHELLEXECUTEINFO); + sei.lpFile = filename_wbuf; + sei.lpParameters = L"-stop-service"; + sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI; + + if (ShellExecuteEx(&sei)) + { + WaitForSingleObject(sei.hProcess,60000); + + CloseHandle(sei.hProcess); + } + } + + if (process_handle) + { + WaitForSingleObject(process_handle,60000); + +// MessageBox(0,L"WAIT OK",L"EverythingSDK",MB_OK) ; + + CloseHandle(process_handle); + } + } + } + } + + _Everything_Free(service_config); + } + + CloseServiceHandle(service_handle); + } + + CloseServiceHandle(scm_handle); + } + } + + return 0; +} + +// MUST be called as an admin +// internal use only. +// TODO: no longer used, remove. +UINT EVERYTHINGAPI Everything_MSIStartService(void *msihandle) +{ + HANDLE scm_handle; + + scm_handle = OpenSCManager(0,0,SC_MANAGER_ENUMERATE_SERVICE); + + if (scm_handle) + { + SC_HANDLE service_handle; + + service_handle = OpenService(scm_handle,L"Everything",SERVICE_START); + + if (service_handle) + { + StartService(service_handle,0,NULL); + + CloseServiceHandle(service_handle); + } + + CloseServiceHandle(scm_handle); + } + + return 0; +} + +BOOL EVERYTHINGAPI Everything_IsFastSort(DWORD sortType) +{ + return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_IS_FAST_SORT,(LPARAM)sortType); +} + +BOOL EVERYTHINGAPI Everything_IsFileInfoIndexed(DWORD fileInfoType) +{ + return _Everything_SendAPIBoolCommand(EVERYTHING_IPC_IS_FILE_INFO_INDEXED,(LPARAM)fileInfoType); +} + +static LRESULT _Everything_SendCopyData(int command,const void *data,int size) +{ + HWND everything_hwnd; + + everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0); + if (everything_hwnd) + { + COPYDATASTRUCT cds; + + cds.cbData = size; + cds.dwData = command; + cds.lpData = (void *)data; + + return SendMessage(everything_hwnd,WM_COPYDATA,0,(LPARAM)&cds); + } + else + { + // the everything window was not found. + // we can optionally RegisterWindowMessage("EVERYTHING_IPC_CREATED") and + // wait for Everything to post this message to all top level windows when its up and running. + _Everything_LastError = EVERYTHING_ERROR_IPC; + + return FALSE; + } +} + +DWORD EVERYTHINGAPI Everything_GetRunCountFromFileNameW(LPCWSTR lpFileName) +{ + return (DWORD)_Everything_SendCopyData(EVERYTHING_IPC_COPYDATA_GET_RUN_COUNTW,lpFileName,(_Everything_StringLengthW(lpFileName) + 1) * sizeof(WCHAR)); +} + +DWORD EVERYTHINGAPI Everything_GetRunCountFromFileNameA(LPCSTR lpFileName) +{ + return (DWORD)_Everything_SendCopyData(EVERYTHING_IPC_COPYDATA_GET_RUN_COUNTA,lpFileName,_Everything_StringLengthA(lpFileName) + 1); +} + +BOOL EVERYTHINGAPI Everything_SetRunCountFromFileNameW(LPCWSTR lpFileName,DWORD dwRunCount) +{ + EVERYTHING_IPC_RUN_HISTORY *run_history; + DWORD len; + BOOL ret; + + len = _Everything_StringLengthW(lpFileName); + + run_history = _Everything_Alloc(sizeof(EVERYTHING_IPC_RUN_HISTORY) + ((len + 1) * sizeof(WCHAR))); + + if (run_history) + { + run_history->run_count = dwRunCount; + CopyMemory(run_history + 1,lpFileName,((len + 1) * sizeof(WCHAR))); + + if (_Everything_SendCopyData(EVERYTHING_IPC_COPYDATA_SET_RUN_COUNTW,run_history,sizeof(EVERYTHING_IPC_RUN_HISTORY) + ((len + 1) * sizeof(WCHAR)))) + { + ret = TRUE; + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = FALSE; + } + + _Everything_Free(run_history); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + + ret = FALSE; + } + + return ret; +} + +BOOL EVERYTHINGAPI Everything_SetRunCountFromFileNameA(LPCSTR lpFileName,DWORD dwRunCount) +{ + EVERYTHING_IPC_RUN_HISTORY *run_history; + DWORD len; + BOOL ret; + + len = _Everything_StringLengthA(lpFileName); + + run_history = _Everything_Alloc(sizeof(EVERYTHING_IPC_RUN_HISTORY) + (len + 1)); + + if (run_history) + { + run_history->run_count = dwRunCount; + CopyMemory(run_history + 1,lpFileName,(len + 1)); + + if (_Everything_SendCopyData(EVERYTHING_IPC_COPYDATA_SET_RUN_COUNTA,run_history,sizeof(EVERYTHING_IPC_RUN_HISTORY) + (len + 1))) + { + ret = TRUE; + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = FALSE; + } + + _Everything_Free(run_history); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + + ret = FALSE; + } + + return ret; +} + +DWORD EVERYTHINGAPI Everything_IncRunCountFromFileNameW(LPCWSTR lpFileName) +{ + return (DWORD)_Everything_SendCopyData(EVERYTHING_IPC_COPYDATA_INC_RUN_COUNTW,lpFileName,(_Everything_StringLengthW(lpFileName) + 1) * sizeof(WCHAR)); +} + +DWORD EVERYTHINGAPI Everything_IncRunCountFromFileNameA(LPCSTR lpFileName) +{ + return (DWORD)_Everything_SendCopyData(EVERYTHING_IPC_COPYDATA_INC_RUN_COUNTA,lpFileName,_Everything_StringLengthA(lpFileName) + 1); +} diff --git a/Everything-SDK/src/Everything32.def b/Everything-SDK/src/Everything32.def new file mode 100644 index 0000000..393dd32 --- /dev/null +++ b/Everything-SDK/src/Everything32.def @@ -0,0 +1,102 @@ +LIBRARY Everything32 + +EXPORTS + + Everything_GetLastError + + Everything_SetSearchA + Everything_SetSearchW + Everything_SetMatchPath + Everything_SetMatchCase + Everything_SetMatchWholeWord + Everything_SetRegex + Everything_SetMax + Everything_SetOffset + Everything_SetReplyID + Everything_SetReplyWindow + + Everything_GetSearchA + Everything_GetSearchW + Everything_GetMatchPath + Everything_GetMatchCase + Everything_GetMatchWholeWord + Everything_GetRegex + Everything_GetMax + Everything_GetOffset + Everything_GetReplyID + Everything_GetReplyWindow + + Everything_QueryA + Everything_QueryW + + Everything_IsQueryReply + + Everything_SortResultsByPath + + Everything_GetNumFileResults + Everything_GetNumFolderResults + Everything_GetNumResults + Everything_GetTotFileResults + Everything_GetTotFolderResults + Everything_GetTotResults + + Everything_IsVolumeResult + Everything_IsFolderResult + Everything_IsFileResult + + Everything_GetResultFileNameA + Everything_GetResultFileNameW + Everything_GetResultPathA + Everything_GetResultPathW + Everything_GetResultFullPathNameA + Everything_GetResultFullPathNameW + + Everything_Reset + Everything_CleanUp + + Everything_SetSort + Everything_SetRequestFlags + Everything_GetSort + Everything_GetRequestFlags + Everything_GetResultListSort + Everything_GetResultListRequestFlags + Everything_GetResultExtensionW + Everything_GetResultExtensionA + Everything_GetResultSize + Everything_GetResultDateCreated + Everything_GetResultDateModified + Everything_GetResultDateAccessed + Everything_GetResultAttributes + Everything_GetResultFileListFileNameW + Everything_GetResultFileListFileNameA + Everything_GetResultRunCount + Everything_GetResultDateRun + Everything_GetResultDateRecentlyChanged + Everything_GetResultHighlightedFileNameW + Everything_GetResultHighlightedFileNameA + Everything_GetResultHighlightedPathW + Everything_GetResultHighlightedPathA + Everything_GetResultHighlightedFullPathAndFileNameW + Everything_GetResultHighlightedFullPathAndFileNameA + Everything_GetMajorVersion + Everything_GetMinorVersion + Everything_GetRevision + Everything_GetBuildNumber + Everything_Exit + Everything_IsDBLoaded + Everything_IsAdmin + Everything_IsAppData + Everything_RebuildDB + Everything_UpdateAllFolderIndexes + Everything_SaveDB + Everything_SaveRunHistory + Everything_DeleteRunHistory + Everything_GetTargetMachine + Everything_IsFastSort + Everything_IsFileInfoIndexed + Everything_GetRunCountFromFileNameW + Everything_GetRunCountFromFileNameA + Everything_SetRunCountFromFileNameW + Everything_SetRunCountFromFileNameA + Everything_IncRunCountFromFileNameW + Everything_IncRunCountFromFileNameA diff --git a/Everything-SDK/src/Everything64.def b/Everything-SDK/src/Everything64.def new file mode 100644 index 0000000..36d9f76 --- /dev/null +++ b/Everything-SDK/src/Everything64.def @@ -0,0 +1,103 @@ +LIBRARY Everything64 + +EXPORTS + + Everything_GetLastError + + Everything_SetSearchA + Everything_SetSearchW + Everything_SetMatchPath + Everything_SetMatchCase + Everything_SetMatchWholeWord + Everything_SetRegex + Everything_SetMax + Everything_SetOffset + Everything_SetReplyID + Everything_SetReplyWindow + + Everything_GetSearchA + Everything_GetSearchW + Everything_GetMatchPath + Everything_GetMatchCase + Everything_GetMatchWholeWord + Everything_GetRegex + Everything_GetMax + Everything_GetOffset + Everything_GetReplyID + Everything_GetReplyWindow + + Everything_QueryA + Everything_QueryW + + Everything_IsQueryReply + + Everything_SortResultsByPath + + Everything_GetNumFileResults + Everything_GetNumFolderResults + Everything_GetNumResults + Everything_GetTotFileResults + Everything_GetTotFolderResults + Everything_GetTotResults + + Everything_IsVolumeResult + Everything_IsFolderResult + Everything_IsFileResult + + Everything_GetResultFileNameA + Everything_GetResultFileNameW + Everything_GetResultPathA + Everything_GetResultPathW + Everything_GetResultFullPathNameA + Everything_GetResultFullPathNameW + + Everything_Reset + Everything_CleanUp + + Everything_SetSort + Everything_SetRequestFlags + Everything_GetSort + Everything_GetRequestFlags + Everything_GetResultListSort + Everything_GetResultListRequestFlags + Everything_GetResultExtensionW + Everything_GetResultExtensionA + Everything_GetResultSize + Everything_GetResultDateCreated + Everything_GetResultDateModified + Everything_GetResultDateAccessed + Everything_GetResultAttributes + Everything_GetResultFileListFileNameW + Everything_GetResultFileListFileNameA + Everything_GetResultRunCount + Everything_GetResultDateRun + Everything_GetResultDateRecentlyChanged + Everything_GetResultHighlightedFileNameW + Everything_GetResultHighlightedFileNameA + Everything_GetResultHighlightedPathW + Everything_GetResultHighlightedPathA + Everything_GetResultHighlightedFullPathAndFileNameW + Everything_GetResultHighlightedFullPathAndFileNameA + Everything_GetMajorVersion + Everything_GetMinorVersion + Everything_GetRevision + Everything_GetBuildNumber + Everything_Exit + Everything_IsDBLoaded + Everything_IsAdmin + Everything_IsAppData + Everything_RebuildDB + Everything_UpdateAllFolderIndexes + Everything_SaveDB + Everything_SaveRunHistory + Everything_DeleteRunHistory + Everything_GetTargetMachine + Everything_IsFastSort + Everything_IsFileInfoIndexed + Everything_GetRunCountFromFileNameW + Everything_GetRunCountFromFileNameA + Everything_SetRunCountFromFileNameW + Everything_SetRunCountFromFileNameA + Everything_IncRunCountFromFileNameW + Everything_IncRunCountFromFileNameA + \ No newline at end of file diff --git a/Everything-SDK/vs/sdk.dll.test.c.vcproj b/Everything-SDK/vs/sdk.dll.test.c.vcproj new file mode 100644 index 0000000..caa9e1f --- /dev/null +++ b/Everything-SDK/vs/sdk.dll.test.c.vcproj @@ -0,0 +1,793 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Everything-SDK/vs/sdk.dll.test.cpp.vcproj b/Everything-SDK/vs/sdk.dll.test.cpp.vcproj new file mode 100644 index 0000000..5c12043 --- /dev/null +++ b/Everything-SDK/vs/sdk.dll.test.cpp.vcproj @@ -0,0 +1,792 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Everything-SDK/vs/sdk.dll.vcproj b/Everything-SDK/vs/sdk.dll.vcproj new file mode 100644 index 0000000..6798109 --- /dev/null +++ b/Everything-SDK/vs/sdk.dll.vcproj @@ -0,0 +1,760 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 254f9b8..a48737d 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,17 @@ AutoBackups is a Python application designed to automate the backup of Simatic S ## Features - Monitors specified directories for Simatic S7 files (*.s7p) and other user-defined directories. -- Automatically compresses and backs up projects on a defined schedule (daily by default). +- Automatically compresses and backs up projects on a configurable schedule (daily, hourly, 3-hour, 7-hour intervals, startup, or manual). - Supports manual backup triggers. - Skips projects with files in use and retries after one hour. -- Maintains a hash of file timestamps to avoid unnecessary backups. -- User-friendly web interface built with Flask and React for configuration and status monitoring. +- Maintains a two-stage hash system: first checking *.s7p files, then all files to avoid unnecessary backups. +- User-friendly web interface built with Flask for configuration and status monitoring. +- Comprehensive logging system with timestamped log files. ## Project Structure ``` -autobackups + +├── .logs/ # Application logs with startup timestamps ├── src │ ├── app.py # Main entry point of the Flask application │ ├── models @@ -29,7 +31,8 @@ autobackups │ └── js # JavaScript files for client-side functionality ├── templates │ └── index.html # Main HTML template for the web interface -├── config.json # Configuration settings for the application +├── config.json # Global configuration settings for the application +├── projects.json # Per-project configuration, schedules, and hash storage ├── requirements.txt # Python dependencies └── README.md # Project documentation ``` diff --git a/SPECIFICATION.md b/SPECIFICATION.md new file mode 100644 index 0000000..74cb315 --- /dev/null +++ b/SPECIFICATION.md @@ -0,0 +1,245 @@ +# AutoBackups - Especificación Técnica Detallada + +## Resumen Ejecutivo +AutoBackups es una aplicación Python que automatiza el backup de proyectos Simatic S7 y directorios definidos por el usuario, utilizando la API de Everything para búsqueda eficiente de archivos y un sistema de hash inteligente para evitar backups innecesarios. + +## Arquitectura del Sistema + +### 1. Componentes Principales + +#### 1.1 Motor de Búsqueda (Everything API) +- **Librería**: `python-everything` o integración directa con Everything SDK +- **Función**: Localizar archivos *.s7p en directorios de observación +- **Ventaja**: Aprovecha el índice existente de Everything para búsquedas instantáneas + +#### 1.2 Sistema de Hash en Dos Etapas +**Etapa 1**: Hash rápido de archivos *.s7p +- Solo verifica timestamps de archivos .s7p +- Si no hay cambios → no se procede con backup +- Si hay cambios → procede a Etapa 2 + +**Etapa 2**: Hash completo del proyecto +- Calcula hash de todos los archivos del directorio del proyecto +- Compara con último hash almacenado +- Solo hace backup si hay diferencias + +#### 1.3 Scheduler Flexible +- **daily**: Una vez al día a hora configurada +- **hourly**: Cada hora +- **3-hour**: Cada 3 horas +- **7-hour**: Cada 7 horas +- **startup**: Al iniciar la aplicación +- **manual**: Solo bajo demanda del usuario + +### 2. Estructura de Datos + +#### 2.1 config.json (Configuración Global) +```json +{ + "observation_directories": [ + { + "path": "C:\\Projects\\Siemens", + "type": "siemens_s7", + "enabled": true + }, + { + "path": "D:\\Engineering\\Projects", + "type": "siemens_s7", + "enabled": true + }, + { + "path": "C:\\Important\\Docs", + "type": "manual", + "enabled": true + } + ], + "backup_destination": "D:\\Backups\\AutoBackups", + "default_schedule": "daily", + "default_schedule_time": "02:00", + "retry_delay_hours": 1, + "web_interface": { + "host": "127.0.0.1", + "port": 5000 + }, + "logging": { + "level": "INFO", + "max_log_files": 30 + } +} +``` + +#### 2.2 projects.json (Estado de Proyectos) +```json +{ + "projects": [ + { + "id": "project_001", + "name": "PLC_MainLine", + "path": "C:\\Projects\\Siemens\\PLC_MainLine", + "type": "siemens_s7", + "s7p_file": "C:\\Projects\\Siemens\\PLC_MainLine\\PLC_MainLine.s7p", + "schedule": "daily", + "schedule_time": "02:00", + "enabled": true, + "last_backup": "2025-09-01T02:15:30", + "last_s7p_hash": "abc123def456", + "last_full_hash": "def789ghi012", + "last_s7p_timestamp": "2025-08-31T14:30:00", + "status": "ready", + "retry_count": 0, + "next_retry": null, + "error_message": null + } + ] +} +``` + +### 3. Flujo de Operación + +#### 3.1 Inicio de Aplicación +1. Cargar configuración desde `config.json` +2. Cargar estado de proyectos desde `projects.json` +3. Inicializar logger con timestamp de inicio +4. Escanear directorios de observación usando Everything API +5. Actualizar lista de proyectos detectados +6. Iniciar scheduler +7. Iniciar interfaz web Flask + +#### 3.2 Proceso de Backup +1. **Verificación de Acceso**: Intentar abrir archivos en modo lectura +2. **Hash Etapa 1**: Verificar timestamp del archivo .s7p +3. **Hash Etapa 2**: Si Etapa 1 detecta cambios, verificar hash completo +4. **Compresión**: Crear archivo ZIP con estructura de directorios preservada +5. **Almacenamiento**: Guardar en `backup_destination/YYYY-MM-DD_HH-MM-SS/` +6. **Actualización**: Actualizar hashes y timestamps en `projects.json` + +#### 3.3 Gestión de Errores +- **Archivos en uso**: Marcar proyecto para reintento en 1 hora +- **Errores de permisos**: Log de error y notificación en interfaz +- **Errores de espacio**: Verificar espacio disponible antes de backup + +### 4. Interfaz Web + +#### 4.1 Dashboard Principal +- **Lista de Proyectos**: Tabla con estado, último backup, próximo backup +- **Controles Globales**: Backup manual global, pausar/reanudar scheduler +- **Estadísticas**: Total de proyectos, backups exitosos, errores + +#### 4.2 Configuración de Proyectos +- **Habilitación/Deshabilitación**: Toggle por proyecto +- **Configuración de Schedule**: Dropdown con opciones de frecuencia +- **Backup Manual**: Botón de backup inmediato por proyecto + +#### 4.3 Logs y Monitoreo +- **Log Viewer**: Mostrar logs recientes con filtros por nivel +- **Estado del Sistema**: Información de Everything API, espacio en disco + +### 5. Estructura de Backup + +#### 5.1 Nomenclatura de Archivos +``` +backup_destination/ +├── 2025-09-01_02-15-30/ +│ ├── Projects_Siemens_PLC_MainLine.zip +│ └── Important_Docs_Documentation.zip +└── 2025-09-02_02-15-45/ + └── Projects_Siemens_PLC_SecondaryLine.zip +``` + +#### 5.2 Contenido del ZIP +``` +PLC_MainLine.zip +└── Projects/ + └── Siemens/ + └── PLC_MainLine/ + ├── PLC_MainLine.s7p + ├── subfolder1/ + └── subfolder2/ +``` + +### 6. Tecnologías y Librerías + +#### 6.1 Python Core +- **Python**: 3.12 +- **Framework Web**: Flask +- **Scheduler**: APScheduler +- **Compresión**: zipfile (biblioteca estándar) + +#### 6.2 Librerías Específicas +- **Everything API**: `python-everything` o implementación custom +- **Hashing**: hashlib (biblioteca estándar) +- **Config**: json (biblioteca estándar) +- **Logging**: logging (biblioteca estándar) +- **File Access Check**: Implementación custom con try/except + +#### 6.3 Frontend +- **HTML/CSS/JavaScript**: Vanilla (sin React por simplicidad) +- **AJAX**: Para comunicación con Flask API +- **Bootstrap**: Para estilizado responsivo + +### 7. Consideraciones de Seguridad + +#### 7.1 Acceso a Archivos +- Verificación de permisos antes de backup +- Manejo seguro de rutas para evitar path traversal +- Logs de todos los accesos a archivos + +#### 7.2 Interfaz Web +- Solo acceso local (127.0.0.1) +- No autenticación requerida (uso local únicamente) +- Validación de inputs en formularios + +### 8. Logging y Monitoreo + +#### 8.1 Estructura de Logs +``` +.logs/ +├── autobackups_2025-09-01_08-30-15.log +├── autobackups_2025-09-02_08-30-22.log +└── ... +``` + +#### 8.2 Niveles de Log +- **INFO**: Inicio/fin de backups, descubrimiento de proyectos +- **WARNING**: Archivos en uso, reintentos +- **ERROR**: Fallos de backup, errores de configuración +- **DEBUG**: Detalles de hashes, operaciones de archivos + +### 9. Instalación y Despliegue + +#### 9.1 Entorno Miniconda +```bash +conda create --name autobackups python=3.12 +conda activate autobackups +pip install -r requirements.txt +``` + +#### 9.2 Ejecución +- **Desarrollo**: `python src/app.py` +- **Producción**: `pythonw.exe src/app.py` (sin consola) +- **Como servicio**: Futuro enhancement con `python-windows-service` + +### 10. Roadmap de Desarrollo + +#### Fase 1: Core Backend +- [ ] Integración con Everything API +- [ ] Sistema de hash en dos etapas +- [ ] Motor de backup básico +- [ ] Scheduler con APScheduler + +#### Fase 2: Interfaz Web +- [ ] Dashboard básico con Flask +- [ ] API REST para operaciones CRUD +- [ ] Frontend con HTML/JS/Bootstrap + +#### Fase 3: Características Avanzadas +- [ ] Logs web viewer +- [ ] Configuración avanzada de directorios +- [ ] Estadísticas y reportes + +#### Fase 4: Optimizaciones +- [ ] Ejecución como servicio Windows +- [ ] Notificaciones por email +- [ ] Backup incremental + +Este documento será la base para el desarrollo del proyecto AutoBackups. diff --git a/TECHNICAL_QUESTIONS.md b/TECHNICAL_QUESTIONS.md new file mode 100644 index 0000000..4ba2094 --- /dev/null +++ b/TECHNICAL_QUESTIONS.md @@ -0,0 +1,111 @@ +# AutoBackups - Decisiones Técnicas Finalizadas + +## Decisiones Técnicas Confirmadas + +### 1. Everything API - Integración ✅ +**Decisión**: Everything SDK está instalado bajo `Everything-SDK\dll\Everything64.dll` +**Implementación**: Usar PyEverything (Wrapper) sin fallback +**Ruta DLL**: `Everything-SDK\dll\Everything64.dll` + +### 2. Estructura de Backup - Clarificación de Rutas ✅ +**Decisión**: Estructura específica con formato de fecha personalizado +**Ejemplo**: +- Directorio base: `C:\Projects\Siemens` +- Proyecto: `C:\Projects\Siemens\LineA\Project1\project.s7p` +- Backup: `backup_destination/LineA/Project1/2025-09-01/14-30-15_projects.zip` +**Formato**: YYYY-MM-DD para fechas, HH-MM-SS formato 24 horas + +### 3. Configuración de Schedules - Granularidad ✅ +**Decisión**: Ambos niveles (global con override por proyecto) +**Implementación**: +- Configuración global por defecto +- Override individual por proyecto +- Interfaz web para modificar ambos niveles + +### 4. Hash de Archivos - Algoritmo y Almacenamiento ✅ +**Decisión**: Hash de timestamps + tamaño (NO contenido) +**Algoritmo**: MD5 para velocidad +**Incluye**: timestamp + tamaño de archivo +**Prioridad**: Velocidad sobre seguridad criptográfica + +### 5. Detección de Archivos en Uso - Método ✅ +**Decisión**: Detección por intento de compresión +**Método Primario**: Intentar comprimir y detectar errores de exclusividad +**Método Rápido**: Verificar archivo .s7p antes de comprimir proyecto completo +**Manejo de Errores**: Marcar como problema de exclusividad si falla + +### 6. Manejo de Proyectos Grandes - Performance ✅ +**Decisión**: Sin límites de tamaño, tiempo o archivos +**Implementación**: Sin throttling, procesar cualquier tamaño de proyecto +**Prioridad**: Baja prioridad de sistema para no interferir + +### 7. Configuración de Directorios - Recursividad ✅ +**Decisión**: Búsqueda recursiva con optimización para .s7p +**Implementación**: +- Búsqueda recursiva en toda la jerarquía +- Optimización: evitar último nivel para archivos .s7p +- Razón: archivos .s7p no pueden estar en el último nivel del árbol + +### 8. Backup Incremental vs Completo ✅ +**Decisión**: Siempre backup completo +**Implementación**: Todo el proyecto cada vez +**Razón**: Simplicidad y asegurar integridad completa + +### 9. Web Interface - Características Específicas ✅ +**Must-have**: +- Lista de proyectos con estado ✅ +- Trigger manual de backup ✅ +- Ver logs básicos ✅ +- Configurar schedules por proyecto ✅ +- **Modificar configuración general (config.json) ✅** + +**Nice-to-have**: +- Ver progreso de backup en tiempo real +- Estadísticas históricas +- Configurar nuevos directorios + +### 10. Error Handling - Estrategias de Recuperación ✅ +**Espacio Insuficiente**: +- Área de status en página web mostrando espacio libre +- Límite mínimo: 100MB libres para ejecutar backups +- Sin backups si espacio < 100MB + +**Otros Errores**: +- Marcar para reintento en 1 hora +- Log de errores para diagnóstico + +### 11. Startup Behavior - Inicialización ✅ +**Decisión**: Aplicación de background con timers específicos +**Comportamiento**: +- Escaneos programados: cada 1 hora +- Backups mínimo: cada 10 minutos +- Aplicación siempre en background +- Baja prioridad de sistema + +### 12. Multi-threading - Concurrencia ✅ +**Decisión**: Ejecución secuencial (uno por vez) +**Implementación**: +- Backups secuenciales para economizar recursos +- Baja prioridad de sistema +- Orientado a operación en background sin interferir + +## Especificación Técnica Finalizada ✅ + +### Resumen de Decisiones Clave: +1. **Everything SDK**: PyEverything wrapper con DLL local +2. **Estructura de Backup**: `backup_destination/ProjectPath/YYYY-MM-DD/HH-MM-SS_projects.zip` +3. **Hash**: MD5 de (timestamp + tamaño) para velocidad +4. **Detección de Uso**: Por intento de compresión + verificación .s7p +5. **Performance**: Sin límites, baja prioridad, secuencial +6. **Búsqueda**: Recursiva evitando último nivel para .s7p +7. **Backups**: Siempre completos +8. **Interfaz**: Flask con configuración de config.json +9. **Espacio**: Mínimo 100MB libres, status visible +10. **Background**: Escaneos 1h, backups min 10min +11. **Concurrencia**: Secuencial, baja prioridad + +### Próximos Pasos: +1. ✅ Finalizar diseño técnico basado en decisiones +2. ⏳ Actualizar `requirements.txt` con PyEverything +3. ⏳ Comenzar implementación por fases +4. ⏳ Crear estructura básica del proyecto diff --git a/autobackups/SPECIFICATION.md b/autobackups/SPECIFICATION.md new file mode 100644 index 0000000..c3e7a33 --- /dev/null +++ b/autobackups/SPECIFICATION.md @@ -0,0 +1,258 @@ +# AutoBackups - Especificación Técnica Detallada + +## Resumen Ejecutivo +AutoBackups es una aplicación Python que automatiza el backup de proyectos Simatic S7 y directorios definidos por el usuario, utilizando la API de Everything para búsqueda eficiente de archivos y un sistema de hash inteligente para evitar backups innecesarios. + +## Arquitectura del Sistema + +### 1. Componentes Principales + +#### 1.1 Motor de Búsqueda (Everything API) +- **Librería**: PyEverything wrapper +- **DLL Local**: `Everything-SDK\dll\Everything64.dll` +- **Función**: Localizar archivos *.s7p en directorios de observación +- **Optimización**: Evitar último nivel del árbol para archivos .s7p +- **Ventaja**: Aprovecha el índice existente de Everything para búsquedas instantáneas + +#### 1.2 Sistema de Hash en Dos Etapas +**Etapa 1**: Hash rápido de archivos *.s7p +- Solo verifica MD5 de (timestamp + tamaño) de archivos .s7p +- Si no hay cambios → no se procede con backup +- Si hay cambios → procede a Etapa 2 + +**Etapa 2**: Hash completo del proyecto +- Calcula MD5 de (timestamp + tamaño) de todos los archivos del directorio +- Compara con último hash almacenado +- Solo hace backup si hay diferencias + +#### 1.3 Scheduler de Background +- **daily**: Una vez al día a hora configurada +- **hourly**: Cada hora +- **3-hour**: Cada 3 horas +- **7-hour**: Cada 7 horas +- **startup**: Al iniciar la aplicación +- **manual**: Solo bajo demanda del usuario +- **Escaneos**: Automáticos cada 1 hora +- **Backups**: Mínimo cada 10 minutos +- **Prioridad**: Baja prioridad de sistema + +### 2. Estructura de Datos + +#### 2.1 config.json (Configuración Global) +```json +{ + "observation_directories": [ + { + "path": "C:\\Projects\\Siemens", + "type": "siemens_s7", + "enabled": true + }, + { + "path": "D:\\Engineering\\Projects", + "type": "siemens_s7", + "enabled": true + }, + { + "path": "C:\\Important\\Docs", + "type": "manual", + "enabled": true + } + ], + "backup_destination": "D:\\Backups\\AutoBackups", + "default_schedule": "daily", + "default_schedule_time": "02:00", + "retry_delay_hours": 1, + "web_interface": { + "host": "127.0.0.1", + "port": 5000 + }, + "logging": { + "level": "INFO", + "max_log_files": 30 + } +} +``` + +#### 2.2 projects.json (Estado de Proyectos) +```json +{ + "projects": [ + { + "id": "project_001", + "name": "PLC_MainLine", + "path": "C:\\Projects\\Siemens\\PLC_MainLine", + "type": "siemens_s7", + "s7p_file": "C:\\Projects\\Siemens\\PLC_MainLine\\PLC_MainLine.s7p", + "schedule": "daily", + "schedule_time": "02:00", + "enabled": true, + "last_backup": "2025-09-01T02:15:30", + "last_s7p_hash": "abc123def456", + "last_full_hash": "def789ghi012", + "last_s7p_timestamp": "2025-08-31T14:30:00", + "status": "ready", + "retry_count": 0, + "next_retry": null, + "error_message": null + } + ] +} +``` + +### 3. Flujo de Operación + +#### 3.1 Inicio de Aplicación +1. Cargar configuración desde `config.json` +2. Cargar estado de proyectos desde `projects.json` +3. Inicializar logger con timestamp de inicio +4. Escanear directorios de observación usando Everything API +5. Actualizar lista de proyectos detectados +6. Iniciar scheduler +7. Iniciar interfaz web Flask + +#### 4.2 Proceso de Backup +1. **Verificación de Espacio**: Verificar mínimo 100MB libres +2. **Verificación de Acceso .s7p**: Intentar comprimir solo archivo .s7p +3. **Hash Etapa 1**: Verificar MD5 de (timestamp + tamaño) del archivo .s7p +4. **Hash Etapa 2**: Si Etapa 1 detecta cambios, verificar hash completo +5. **Compresión**: Crear archivo ZIP con estructura específica preservada +6. **Almacenamiento**: Guardar en `backup_destination/ProjectPath/YYYY-MM-DD/HH-MM-SS_projects.zip` +7. **Actualización**: Actualizar hashes y timestamps en `projects.json` + +#### 3.3 Gestión de Errores +- **Archivos en uso**: Marcar proyecto para reintento en 1 hora +- **Errores de permisos**: Log de error y notificación en interfaz +- **Errores de espacio**: Verificar espacio disponible antes de backup + +### 4. Interfaz Web + +#### 4.1 Dashboard Principal +- **Lista de Proyectos**: Tabla con estado, último backup, próximo backup +- **Controles Globales**: Backup manual global, pausar/reanudar scheduler +- **Estadísticas**: Total de proyectos, backups exitosos, errores + +#### 4.2 Configuración de Proyectos +- **Habilitación/Deshabilitación**: Toggle por proyecto +- **Configuración de Schedule**: Dropdown con opciones de frecuencia +- **Backup Manual**: Botón de backup inmediato por proyecto + +#### 4.3 Logs y Monitoreo +- **Log Viewer**: Mostrar logs recientes con filtros por nivel +- **Estado del Sistema**: Información de Everything API, espacio en disco + +### 5. Estructura de Backup + +#### 5.1 Nomenclatura de Archivos (Estructura Específica) +``` +backup_destination/ +├── LineA/ +│ └── Project1/ +│ ├── 2025-09-01/ +│ │ ├── 02-15-30_projects.zip +│ │ └── 14-30-15_projects.zip +│ └── 2025-09-02/ +│ └── 02-15-45_projects.zip +└── LineB/ + └── Project2/ + └── 2025-09-01/ + └── 08-20-10_projects.zip +``` + +#### 5.2 Contenido del ZIP +``` +02-15-30_projects.zip +└── LineA/ + └── Project1/ + ├── project.s7p + ├── subfolder1/ + └── subfolder2/ +``` + +### 6. Tecnologías y Librerías + +#### 6.1 Python Core +- **Python**: 3.12 +- **Framework Web**: Flask +- **Scheduler**: APScheduler +- **Compresión**: zipfile (biblioteca estándar) + +#### 6.2 Librerías Específicas +- **Everything API**: PyEverything wrapper con DLL local +- **Hashing**: hashlib MD5 para (timestamp + tamaño) +- **Config**: json (biblioteca estándar) +- **Logging**: logging (biblioteca estándar) +- **File Access Check**: Intento de compresión + verificación .s7p +- **Process Priority**: pywin32 para baja prioridad +- **Disk Space**: psutil para monitoreo de espacio libre + +#### 6.3 Frontend +- **HTML/CSS/JavaScript**: Vanilla (sin React por simplicidad) +- **AJAX**: Para comunicación con Flask API +- **Bootstrap**: Para estilizado responsivo + +### 7. Consideraciones de Seguridad + +#### 7.1 Acceso a Archivos +- Verificación de permisos antes de backup +- Manejo seguro de rutas para evitar path traversal +- Logs de todos los accesos a archivos + +#### 7.2 Interfaz Web +- Solo acceso local (127.0.0.1) +- No autenticación requerida (uso local únicamente) +- Validación de inputs en formularios + +### 8. Logging y Monitoreo + +#### 8.1 Estructura de Logs +``` +.logs/ +├── autobackups_2025-09-01_08-30-15.log +├── autobackups_2025-09-02_08-30-22.log +└── ... +``` + +#### 8.2 Niveles de Log +- **INFO**: Inicio/fin de backups, descubrimiento de proyectos +- **WARNING**: Archivos en uso, reintentos +- **ERROR**: Fallos de backup, errores de configuración +- **DEBUG**: Detalles de hashes, operaciones de archivos + +### 9. Instalación y Despliegue + +#### 9.1 Entorno Miniconda +```bash +conda create --name autobackups python=3.12 +conda activate autobackups +pip install -r requirements.txt +``` + +#### 9.2 Ejecución +- **Desarrollo**: `python src/app.py` +- **Producción**: `pythonw.exe src/app.py` (sin consola) +- **Como servicio**: Futuro enhancement con `python-windows-service` + +### 10. Roadmap de Desarrollo + +#### Fase 1: Core Backend +- [ ] Integración con Everything API +- [ ] Sistema de hash en dos etapas +- [ ] Motor de backup básico +- [ ] Scheduler con APScheduler + +#### Fase 2: Interfaz Web +- [ ] Dashboard básico con Flask +- [ ] API REST para operaciones CRUD +- [ ] Frontend con HTML/JS/Bootstrap + +#### Fase 3: Características Avanzadas +- [ ] Logs web viewer +- [ ] Configuración avanzada de directorios +- [ ] Estadísticas y reportes + +#### Fase 4: Optimizaciones +- [ ] Ejecución como servicio Windows +- [ ] Notificaciones por email +- [ ] Backup incremental + +Este documento será la base para el desarrollo del proyecto AutoBackups. diff --git a/autobackups/config.json b/autobackups/config.json new file mode 100644 index 0000000..97748ef --- /dev/null +++ b/autobackups/config.json @@ -0,0 +1,60 @@ +{ + "observation_directories": [ + { + "path": "C:\\Projects\\Siemens", + "type": "siemens_s7", + "enabled": true, + "description": "Directorio principal de proyectos Siemens" + }, + { + "path": "D:\\Engineering\\Projects", + "type": "siemens_s7", + "enabled": true, + "description": "Proyectos de ingeniería adicionales" + }, + { + "path": "C:\\Important\\Documentation", + "type": "manual", + "enabled": true, + "description": "Documentación importante para backup manual" + } + ], + "backup_destination": "D:\\Backups\\AutoBackups", + "global_settings": { + "default_schedule": "daily", + "default_schedule_time": "02:00", + "retry_delay_hours": 1, + "backup_timeout_minutes": 0, + "min_free_space_mb": 100, + "scan_interval_minutes": 60, + "min_backup_interval_minutes": 10 + }, + "everything_api": { + "dll_path": "Everything-SDK\\dll\\Everything64.dll", + "enabled": true, + "search_depth": -1, + "skip_last_level_for_s7p": true + }, + "web_interface": { + "host": "127.0.0.1", + "port": 5000, + "debug": false + }, + "logging": { + "level": "INFO", + "max_log_files": 30, + "log_rotation_days": 30 + }, + "backup_options": { + "compression_level": 6, + "include_subdirectories": true, + "preserve_directory_structure": true, + "hash_algorithm": "md5", + "hash_includes": ["timestamp", "size"], + "backup_type": "complete", + "process_priority": "low", + "sequential_execution": true, + "filename_format": "HH-MM-SS_projects.zip", + "date_format": "YYYY-MM-DD" + } +} diff --git a/autobackups/projects.json b/autobackups/projects.json new file mode 100644 index 0000000..3c68e69 --- /dev/null +++ b/autobackups/projects.json @@ -0,0 +1,62 @@ +{ + "metadata": { + "version": "1.0", + "last_updated": "2025-09-01T08:30:15Z", + "total_projects": 0 + }, + "projects": [ + { + "id": "example_project_001", + "name": "PLC_MainLine_Example", + "path": "C:\\Projects\\Siemens\\LineA\\Project1", + "type": "siemens_s7", + "s7p_file": "C:\\Projects\\Siemens\\LineA\\Project1\\project.s7p", + "observation_directory": "C:\\Projects\\Siemens", + "relative_path": "LineA\\Project1", + "backup_path": "LineA\\Project1", + "schedule_config": { + "schedule": "daily", + "schedule_time": "02:00", + "enabled": true, + "next_scheduled_backup": "2025-09-02T02:00:00Z" + }, + "backup_history": { + "last_backup_date": "2025-09-01T02:15:30Z", + "last_backup_file": "D:\\Backups\\AutoBackups\\LineA\\Project1\\2025-09-01\\02-15-30_projects.zip", + "backup_count": 5, + "last_successful_backup": "2025-09-01T02:15:30Z" + }, + "hash_info": { + "last_s7p_hash": "abc123def456789", + "last_full_hash": "def789ghi012345", + "last_s7p_timestamp": "2025-08-31T14:30:00Z", + "last_s7p_size": 2048576, + "last_scan_timestamp": "2025-09-01T02:10:00Z", + "file_count": 1247, + "total_size_bytes": 125847296 + }, + "status": { + "current_status": "ready", + "last_error": null, + "retry_count": 0, + "next_retry": null, + "files_in_use": false, + "exclusivity_check_passed": true, + "last_status_update": "2025-09-01T02:15:35Z" + }, + "discovery_info": { + "discovered_date": "2025-09-01T08:30:15Z", + "discovery_method": "everything_api", + "auto_discovered": true + } + } + ], + "statistics": { + "total_backups_created": 15, + "total_backup_size_mb": 2450.5, + "average_backup_time_seconds": 45.2, + "last_global_scan": "2025-09-01T08:30:15Z", + "projects_with_errors": 0, + "projects_pending_retry": 0 + } +} diff --git a/autobackups/requirements.txt b/autobackups/requirements.txt new file mode 100644 index 0000000..c0139b7 --- /dev/null +++ b/autobackups/requirements.txt @@ -0,0 +1,32 @@ +# Core Framework +Flask==2.3.3 +Werkzeug==2.3.7 + +# Scheduling +APScheduler==3.10.4 + +# Everything API Integration +PyEverything==1.0.1 # Wrapper para Everything SDK + +# File Operations and Utilities +pathlib2==2.3.7.post1 # Enhanced pathlib for Python 3.12 +psutil==5.9.5 # System utilities (disk space monitoring) +filelock==3.12.4 # File locking for concurrent access + +# Web Interface +Jinja2==3.1.2 # Template engine for Flask + +# Configuration and Data +jsonschema==4.19.1 # JSON schema validation + +# Logging +colorlog==6.7.0 # Colored logging output + +# Windows-specific dependencies +pywin32==306; sys_platform == "win32" # Windows API access for low priority + +# Development and Testing (opcional, remove for production) +pytest==7.4.2 +pytest-flask==1.2.0 +black==23.9.1 # Code formatting +flake8==6.1.0 # Code linting diff --git a/config.json b/config.json index 57cffcd..26bcbd7 100644 --- a/config.json +++ b/config.json @@ -1,15 +1,51 @@ { - "directories_to_monitor": [ - "C:\\path\\to\\first\\directory", - "C:\\path\\to\\second\\directory" + "observation_directories": [ + { + "path": "C:\\Projects\\Siemens", + "type": "siemens_s7", + "enabled": true, + "description": "Directorio principal de proyectos Siemens" + }, + { + "path": "D:\\Engineering\\Projects", + "type": "siemens_s7", + "enabled": true, + "description": "Proyectos de ingeniería adicionales" + }, + { + "path": "C:\\Important\\Documentation", + "type": "manual", + "enabled": true, + "description": "Documentación importante para backup manual" + } ], - "backup_destination": "C:\\path\\to\\backup\\destination", - "default_backup_schedule": { - "frequency": "daily", - "time": "02:00" + "backup_destination": "D:\\Backups\\AutoBackups", + "global_settings": { + "default_schedule": "daily", + "default_schedule_time": "02:00", + "retry_delay_hours": 1, + "max_concurrent_backups": 2, + "backup_timeout_minutes": 60 }, - "manual_backup_directories": [], - "hashing_enabled": true, - "retry_interval": 3600, - "max_concurrent_backups": 1 -} \ No newline at end of file + "everything_api": { + "enabled": true, + "fallback_to_filesystem_search": true, + "search_depth": -1 + }, + "web_interface": { + "host": "127.0.0.1", + "port": 5000, + "debug": false + }, + "logging": { + "level": "INFO", + "max_log_files": 30, + "log_rotation_days": 30 + }, + "backup_options": { + "compression_level": 6, + "include_subdirectories": true, + "preserve_directory_structure": true, + "hash_algorithm": "md5" + } +} diff --git a/projects.json b/projects.json new file mode 100644 index 0000000..8820777 --- /dev/null +++ b/projects.json @@ -0,0 +1,58 @@ +{ + "metadata": { + "version": "1.0", + "last_updated": "2025-09-01T08:30:15Z", + "total_projects": 0 + }, + "projects": [ + { + "id": "example_project_001", + "name": "PLC_MainLine_Example", + "path": "C:\\Projects\\Siemens\\PLC_MainLine", + "type": "siemens_s7", + "s7p_file": "C:\\Projects\\Siemens\\PLC_MainLine\\PLC_MainLine.s7p", + "observation_directory": "C:\\Projects\\Siemens", + "relative_path": "PLC_MainLine", + "schedule_config": { + "schedule": "daily", + "schedule_time": "02:00", + "enabled": true, + "next_scheduled_backup": "2025-09-02T02:00:00Z" + }, + "backup_history": { + "last_backup_date": "2025-09-01T02:15:30Z", + "last_backup_file": "D:\\Backups\\AutoBackups\\2025-09-01_02-15-30\\Projects_Siemens_PLC_MainLine.zip", + "backup_count": 5, + "last_successful_backup": "2025-09-01T02:15:30Z" + }, + "hash_info": { + "last_s7p_hash": "abc123def456789", + "last_full_hash": "def789ghi012345", + "last_s7p_timestamp": "2025-08-31T14:30:00Z", + "last_scan_timestamp": "2025-09-01T02:10:00Z", + "file_count": 1247 + }, + "status": { + "current_status": "ready", + "last_error": null, + "retry_count": 0, + "next_retry": null, + "files_in_use": false, + "last_status_update": "2025-09-01T02:15:35Z" + }, + "discovery_info": { + "discovered_date": "2025-09-01T08:30:15Z", + "discovery_method": "everything_api", + "auto_discovered": true + } + } + ], + "statistics": { + "total_backups_created": 15, + "total_backup_size_mb": 2450.5, + "average_backup_time_seconds": 45.2, + "last_global_scan": "2025-09-01T08:30:15Z", + "projects_with_errors": 0, + "projects_pending_retry": 0 + } +} diff --git a/requirements.txt b/requirements.txt index ed8b71e..7c45843 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,32 @@ -Flask -Flask-Cors -Flask-RESTful -requests -watchdog -pyzipper -hashlib -pyeverthing \ No newline at end of file +# Core Framework +Flask==2.3.3 +Werkzeug==2.3.7 + +# Scheduling +APScheduler==3.10.4 + +# Everything API Integration (si está disponible) +# python-everything==1.0.1 # Descomenta si existe la librería + +# File Operations and Utilities +pathlib2==2.3.7.post1 # Enhanced pathlib for Python 3.12 +psutil==5.9.5 # System and process utilities +filelock==3.12.4 # File locking for concurrent access + +# Web Interface +Jinja2==3.1.2 # Template engine for Flask + +# Configuration and Data +jsonschema==4.19.1 # JSON schema validation + +# Logging +colorlog==6.7.0 # Colored logging output + +# Development and Testing (opcional, remove for production) +pytest==7.4.2 +pytest-flask==1.2.0 +black==23.9.1 # Code formatting +flake8==6.1.0 # Code linting + +# Windows-specific dependencies +pywin32==306; sys_platform == "win32" # Windows API access