diff --git a/Plugins/Wox.Plugin.Everything/.gitattributes b/Plugins/Wox.Plugin.Everything/.gitattributes new file mode 100644 index 0000000000..1ff0c42304 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/Plugins/Wox.Plugin.Everything/.gitignore b/Plugins/Wox.Plugin.Everything/.gitignore new file mode 100644 index 0000000000..2f72fc4243 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/.gitignore @@ -0,0 +1,156 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets +!packages/*/build/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store diff --git a/Plugins/Wox.Plugin.Everything/ContextMenuStorage.cs b/Plugins/Wox.Plugin.Everything/ContextMenuStorage.cs new file mode 100644 index 0000000000..f778bd96ec --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/ContextMenuStorage.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Newtonsoft.Json; +using Wox.Infrastructure.Storage; +using System.IO; +using System.Reflection; + +namespace Wox.Plugin.Everything +{ + public class ContextMenuStorage : JsonStrorage + { + [JsonProperty] + public List ContextMenus = new List(); + + + [JsonProperty] + public int MaxSearchCount { get; set; } + + protected override string ConfigName + { + get { return "EverythingContextMenu"; } + } + + protected override string ConfigFolder + { + get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } + } + + protected override ContextMenuStorage LoadDefault() + { + ContextMenus = new List() + { + new ContextMenu() + { + Name = "Open Containing Folder", + Command = "explorer.exe", + Argument = " /select,\"{path}\"", + ImagePath ="Images\\folder.png" + } + }; + MaxSearchCount = 100; + Save(); + return this; + } + } + + public class ContextMenu + { + [JsonProperty] + public string Name { get; set; } + + [JsonProperty] + public string Command { get; set; } + + [JsonProperty] + public string Argument { get; set; } + + [JsonProperty] + public string ImagePath { get; set; } + } +} diff --git a/Plugins/Wox.Plugin.Everything/Everything/EverythingAPI.cs b/Plugins/Wox.Plugin.Everything/Everything/EverythingAPI.cs new file mode 100644 index 0000000000..158985e077 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Everything/EverythingAPI.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; +using Wox.Plugin.Everything.Everything.Exceptions; + +namespace Wox.Plugin.Everything.Everything +{ + public sealed class EverythingAPI + { + #region DllImport + [DllImport(EVERYTHING_DLL_NAME)] + private static extern int Everything_SetSearch(string lpSearchString); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern void Everything_SetMatchPath(bool bEnable); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern void Everything_SetMatchCase(bool bEnable); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern void Everything_SetMatchWholeWord(bool bEnable); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern void Everything_SetRegex(bool bEnable); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern void Everything_SetMax(int dwMax); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern void Everything_SetOffset(int dwOffset); + + [DllImport(EVERYTHING_DLL_NAME)] + private static extern bool Everything_GetMatchPath(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern bool Everything_GetMatchCase(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern bool Everything_GetMatchWholeWord(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern bool Everything_GetRegex(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern UInt32 Everything_GetMax(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern UInt32 Everything_GetOffset(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern string Everything_GetSearch(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern StateCode Everything_GetLastError(); + + [DllImport(EVERYTHING_DLL_NAME, EntryPoint = "Everything_QueryW")] + private static extern bool Everything_Query(bool bWait); + + [DllImport(EVERYTHING_DLL_NAME)] + private static extern void Everything_SortResultsByPath(); + + [DllImport(EVERYTHING_DLL_NAME)] + private static extern int Everything_GetNumFileResults(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern int Everything_GetNumFolderResults(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern int Everything_GetNumResults(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern int Everything_GetTotFileResults(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern int Everything_GetTotFolderResults(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern int Everything_GetTotResults(); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern bool Everything_IsVolumeResult(int nIndex); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern bool Everything_IsFolderResult(int nIndex); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern bool Everything_IsFileResult(int nIndex); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern void Everything_GetResultFullPathName(int nIndex, StringBuilder lpString, int nMaxCount); + [DllImport(EVERYTHING_DLL_NAME)] + private static extern void Everything_Reset(); + #endregion + + const string EVERYTHING_DLL_NAME = "Everything.dll"; + enum StateCode + { + OK, + MemoryError, + IPCError, + RegisterClassExError, + CreateWindowError, + CreateThreadError, + InvalidIndexError, + InvalidCallError + } + + /// + /// Gets or sets a value indicating whether [match path]. + /// + /// true if [match path]; otherwise, false. + public Boolean MatchPath + { + get + { + return Everything_GetMatchPath(); + } + set + { + Everything_SetMatchPath(value); + } + } + + /// + /// Gets or sets a value indicating whether [match case]. + /// + /// true if [match case]; otherwise, false. + public Boolean MatchCase + { + get + { + return Everything_GetMatchCase(); + } + set + { + Everything_SetMatchCase(value); + } + } + + /// + /// Gets or sets a value indicating whether [match whole word]. + /// + /// true if [match whole word]; otherwise, false. + public Boolean MatchWholeWord + { + get + { + return Everything_GetMatchWholeWord(); + } + set + { + Everything_SetMatchWholeWord(value); + } + } + + /// + /// Gets or sets a value indicating whether [enable regex]. + /// + /// true if [enable regex]; otherwise, false. + public Boolean EnableRegex + { + get + { + return Everything_GetRegex(); + } + set + { + Everything_SetRegex(value); + } + } + + /// + /// Resets this instance. + /// + public void Reset() + { + Everything_Reset(); + } + + private void no() + { + switch (Everything_GetLastError()) + { + case StateCode.CreateThreadError: + throw new CreateThreadException(); + case StateCode.CreateWindowError: + throw new CreateWindowException(); + case StateCode.InvalidCallError: + throw new InvalidCallException(); + case StateCode.InvalidIndexError: + throw new InvalidIndexException(); + case StateCode.IPCError: + throw new IPCErrorException(); + case StateCode.MemoryError: + throw new MemoryErrorException(); + case StateCode.RegisterClassExError: + throw new RegisterClassExException(); + } + } + + /// + /// Searches the specified key word. + /// + /// The key word. + /// The offset. + /// The max count. + /// + public IEnumerable Search(string keyWord, int offset = 0, int maxCount = 100) + { + if (string.IsNullOrEmpty(keyWord)) + throw new ArgumentNullException("keyWord"); + + if (offset < 0) + throw new ArgumentOutOfRangeException("offset"); + + if (maxCount < 0) + throw new ArgumentOutOfRangeException("maxCount"); + + if (keyWord.StartsWith("@")) + { + Everything_SetRegex(true); + keyWord = keyWord.Substring(1); + } + Everything_SetSearch(keyWord); + Everything_SetOffset(offset); + Everything_SetMax(maxCount); + + + if (!Everything_Query(true)) + { + switch (Everything_GetLastError()) + { + case StateCode.CreateThreadError: + throw new CreateThreadException(); + case StateCode.CreateWindowError: + throw new CreateWindowException(); + case StateCode.InvalidCallError: + throw new InvalidCallException(); + case StateCode.InvalidIndexError: + throw new InvalidIndexException(); + case StateCode.IPCError: + throw new IPCErrorException(); + case StateCode.MemoryError: + throw new MemoryErrorException(); + case StateCode.RegisterClassExError: + throw new RegisterClassExException(); + } + yield break; + } + + Everything_SortResultsByPath(); + + const int bufferSize = 4096; + StringBuilder buffer = new StringBuilder(bufferSize); + for (int idx = 0; idx < Everything_GetNumResults(); ++idx) + { + Everything_GetResultFullPathName(idx, buffer, bufferSize); + + var result = new SearchResult() { FullPath = buffer.ToString() }; + if (Everything_IsFolderResult(idx)) + result.Type = ResultType.Folder; + else if (Everything_IsFileResult(idx)) + result.Type = ResultType.File; + + yield return result; + } + } + } +} diff --git a/Plugins/Wox.Plugin.Everything/Everything/Exceptions/CreateThreadException.cs b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/CreateThreadException.cs new file mode 100644 index 0000000000..170acde189 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/CreateThreadException.cs @@ -0,0 +1,11 @@ +using System; + +namespace Wox.Plugin.Everything.Everything +{ + /// + /// + /// + public class CreateThreadException : ApplicationException + { + } +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Everything/Exceptions/CreateWindowException.cs b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/CreateWindowException.cs new file mode 100644 index 0000000000..54fc903f1c --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/CreateWindowException.cs @@ -0,0 +1,11 @@ +using System; + +namespace Wox.Plugin.Everything.Everything +{ + /// + /// + /// + public class CreateWindowException : ApplicationException + { + } +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Everything/Exceptions/IPCErrorException.cs b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/IPCErrorException.cs new file mode 100644 index 0000000000..92ea7fb726 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/IPCErrorException.cs @@ -0,0 +1,11 @@ +using System; + +namespace Wox.Plugin.Everything.Everything +{ + /// + /// + /// + public class IPCErrorException : ApplicationException + { + } +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Everything/Exceptions/InvalidCallException.cs b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/InvalidCallException.cs new file mode 100644 index 0000000000..b109f4d30c --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/InvalidCallException.cs @@ -0,0 +1,11 @@ +using System; + +namespace Wox.Plugin.Everything.Everything +{ + /// + /// + /// + public class InvalidCallException : ApplicationException + { + } +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Everything/Exceptions/InvalidIndexException.cs b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/InvalidIndexException.cs new file mode 100644 index 0000000000..a6e7bfa443 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/InvalidIndexException.cs @@ -0,0 +1,11 @@ +using System; + +namespace Wox.Plugin.Everything.Everything +{ + /// + /// + /// + public class InvalidIndexException : ApplicationException + { + } +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Everything/Exceptions/MemoryErrorException.cs b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/MemoryErrorException.cs new file mode 100644 index 0000000000..cd74e84872 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/MemoryErrorException.cs @@ -0,0 +1,11 @@ +using System; + +namespace Wox.Plugin.Everything.Everything.Exceptions +{ + /// + /// + /// + public class MemoryErrorException : ApplicationException + { + } +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Everything/Exceptions/RegisterClassExException.cs b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/RegisterClassExException.cs new file mode 100644 index 0000000000..e51b7e8aa1 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Everything/Exceptions/RegisterClassExException.cs @@ -0,0 +1,11 @@ +using System; + +namespace Wox.Plugin.Everything.Everything +{ + /// + /// + /// + public class RegisterClassExException : ApplicationException + { + } +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Everything/ResultType.cs b/Plugins/Wox.Plugin.Everything/Everything/ResultType.cs new file mode 100644 index 0000000000..bd9776a13e --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Everything/ResultType.cs @@ -0,0 +1,9 @@ +namespace Wox.Plugin.Everything.Everything +{ + public enum ResultType + { + Volume, + Folder, + File + } +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Everything/SearchResult.cs b/Plugins/Wox.Plugin.Everything/Everything/SearchResult.cs new file mode 100644 index 0000000000..2a9af23a21 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Everything/SearchResult.cs @@ -0,0 +1,8 @@ +namespace Wox.Plugin.Everything.Everything +{ + public class SearchResult + { + public string FullPath { get; set; } + public ResultType Type { get; set; } + } +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Images/error.png b/Plugins/Wox.Plugin.Everything/Images/error.png new file mode 100644 index 0000000000..901cd3b492 Binary files /dev/null and b/Plugins/Wox.Plugin.Everything/Images/error.png differ diff --git a/Plugins/Wox.Plugin.Everything/Images/file.png b/Plugins/Wox.Plugin.Everything/Images/file.png new file mode 100644 index 0000000000..2913d69623 Binary files /dev/null and b/Plugins/Wox.Plugin.Everything/Images/file.png differ diff --git a/Plugins/Wox.Plugin.Everything/Images/find.png b/Plugins/Wox.Plugin.Everything/Images/find.png new file mode 100644 index 0000000000..f4a7b2a000 Binary files /dev/null and b/Plugins/Wox.Plugin.Everything/Images/find.png differ diff --git a/Plugins/Wox.Plugin.Everything/Images/folder.png b/Plugins/Wox.Plugin.Everything/Images/folder.png new file mode 100644 index 0000000000..330cb2e4bf Binary files /dev/null and b/Plugins/Wox.Plugin.Everything/Images/folder.png differ diff --git a/Plugins/Wox.Plugin.Everything/Images/image.png b/Plugins/Wox.Plugin.Everything/Images/image.png new file mode 100644 index 0000000000..85c8a708d3 Binary files /dev/null and b/Plugins/Wox.Plugin.Everything/Images/image.png differ diff --git a/Plugins/Wox.Plugin.Everything/Images/warning.png b/Plugins/Wox.Plugin.Everything/Images/warning.png new file mode 100644 index 0000000000..b1b5f0acd3 Binary files /dev/null and b/Plugins/Wox.Plugin.Everything/Images/warning.png differ diff --git a/Plugins/Wox.Plugin.Everything/Main.cs b/Plugins/Wox.Plugin.Everything/Main.cs new file mode 100644 index 0000000000..3322f2541f --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Main.cs @@ -0,0 +1,182 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using Wox.Infrastructure; +using System.Reflection; +using Wox.Plugin.Everything.Everything; + +namespace Wox.Plugin.Everything +{ + public class Main : IPlugin + { + PluginInitContext context; + EverythingAPI api = new EverythingAPI(); + private static List imageExts = new List() { ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".ico" }; + private static List executableExts = new List() { ".exe" }; + + public List Query(Query query) + { + var results = new List(); + if (!string.IsNullOrEmpty(query.Search)) + { + var keyword = query.Search; + if (ContextMenuStorage.Instance.MaxSearchCount <= 0) + { + ContextMenuStorage.Instance.MaxSearchCount = 100; + ContextMenuStorage.Instance.Save(); + } + + try + { + var searchList = api.Search(keyword, maxCount: ContextMenuStorage.Instance.MaxSearchCount).ToList(); + var fuzzyMather = FuzzyMatcher.Create(keyword); + searchList.Sort( + (x, y) => + fuzzyMather.Evaluate(Path.GetFileName(y.FullPath)).Score - + fuzzyMather.Evaluate(Path.GetFileName(x.FullPath)).Score); + + foreach (var s in searchList) + { + var path = s.FullPath; + Result r = new Result(); + r.Title = Path.GetFileName(path); + r.SubTitle = path; + r.IcoPath = GetIconPath(s); + r.Action = (c) => + { + context.API.HideApp(); + context.API.ShellRun(path); + return true; + }; + r.ContextMenu = GetContextMenu(s); + results.Add(r); + } + } + catch (IPCErrorException) + { + StartEverything(); + results.Add(new Result() + { + Title = "Everything is not running, we already run it for you now. Try search again", + IcoPath = "Images\\warning.png" + }); + } + catch (Exception e) + { + results.Add(new Result() + { + Title = "Everything plugin has an error (enter to copy error message)", + SubTitle = e.Message, + Action = _ => + { + System.Windows.Clipboard.SetText(e.Message + "\r\n" + e.StackTrace); + context.API.ShowMsg("Copied", "Error message has copied to your clipboard", string.Empty); + return false; + }, + IcoPath = "Images\\error.png" + }); + } + } + + api.Reset(); + + return results; + } + + private string GetIconPath(SearchResult s) + { + var ext = Path.GetExtension(s.FullPath); + if (s.Type == ResultType.Folder) + { + return "Images\\folder.png"; + } + else if (!string.IsNullOrEmpty(ext)) + { + if (imageExts.Contains(ext.ToLower())) + { + return "Images\\image.png"; + } + else if (executableExts.Contains(ext.ToLower())) + { + return s.FullPath; + } + } + + return "Images\\file.png"; + } + + [System.Runtime.InteropServices.DllImport("kernel32.dll")] + private static extern int LoadLibrary(string name); + + private List GetContextMenu(SearchResult record) + { + List contextMenus = new List(); + + if (record.Type == ResultType.File) + { + foreach (ContextMenu contextMenu in ContextMenuStorage.Instance.ContextMenus) + { + contextMenus.Add(new Result() + { + Title = contextMenu.Name, + Action = _ => + { + string argument = contextMenu.Argument.Replace("{path}", record.FullPath); + try + { + System.Diagnostics.Process.Start(contextMenu.Command, argument); + } + catch + { + context.API.ShowMsg("Can't start " + record.FullPath, string.Empty, string.Empty); + return false; + } + return true; + }, + IcoPath = contextMenu.ImagePath + }); + } + } + + return contextMenus; + } + + public void Init(PluginInitContext context) + { + this.context = context; + + LoadLibrary(Path.Combine( + Path.Combine(context.CurrentPluginMetadata.PluginDirectory, (IntPtr.Size == 4) ? "x86" : "x64"), + "Everything.dll" + )); + + StartEverything(); + } + + private void StartEverything() + { + if (!CheckEverythingIsRunning()) + { + Process p = new Process(); + p.StartInfo.Verb = "runas"; + p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + p.StartInfo.FileName = GetEverythingPath(); + p.StartInfo.UseShellExecute = true; + p.Start(); + } + } + + private bool CheckEverythingIsRunning() + { + return Process.GetProcessesByName("Everything").Length > 0; + } + + private string GetEverythingPath() + { + string everythingFolder = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "PortableEverything"); + return Path.Combine(everythingFolder, "Everything.exe"); + } + } +} diff --git a/Plugins/Wox.Plugin.Everything/PortableEverything/Everything.exe b/Plugins/Wox.Plugin.Everything/PortableEverything/Everything.exe new file mode 100644 index 0000000000..db310db054 Binary files /dev/null and b/Plugins/Wox.Plugin.Everything/PortableEverything/Everything.exe differ diff --git a/Plugins/Wox.Plugin.Everything/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.Everything/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..a6ff8af12c --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("Wox.Plugin.Everything")] +[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Wox.Plugin.Everything")] +[assembly: AssemblyCopyright("The MIT License (MIT)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("97f6ccd0-e9dc-4aa2-b4ce-6b9f14ea20a7")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Plugins/Wox.Plugin.Everything/README.md b/Plugins/Wox.Plugin.Everything/README.md new file mode 100644 index 0000000000..bb64b31c7c --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/README.md @@ -0,0 +1,4 @@ +Wox.Plugin.Everything +===================== + +Wox plugin for Everything diff --git a/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj b/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj new file mode 100644 index 0000000000..31883d659f --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj @@ -0,0 +1,130 @@ + + + + + Debug + AnyCPU + {230AE83F-E92E-4E69-8355-426B305DA9C0} + Library + Properties + Wox.Plugin.Everything + Wox.Plugin.Everything + v3.5 + 512 + ..\Wox\ + true + + + true + full + false + ..\..\Output\Debug\Plugins\Wox.Plugin.Everything\ + DEBUG;TRACE + prompt + 4 + AnyCPU + + + pdbonly + true + ..\..\Output\Release\Plugins\Wox.Plugin.Everything\ + TRACE + prompt + 4 + + + + + + + packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + PreserveNewest + + + + + {4fd29318-a8ab-4d8f-aa47-60bc241b8da3} + Wox.Infrastructure + + + {8451ecdd-2ea4-4966-bb0a-7bbc40138e80} + Wox.Plugin + + + + + + + + + + + 这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 + + + + + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.sln b/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.sln new file mode 100644 index 0000000000..f4fdc6d15a --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.sln @@ -0,0 +1,29 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.Everything", "Wox.Plugin.Everything.csproj", "{230AE83F-E92E-4E69-8355-426B305DA9C0}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{9BEA8C30-8CC3-48FE-87FD-8D7E65898C1A}" + ProjectSection(SolutionItems) = preProject + .nuget\NuGet.Config = .nuget\NuGet.Config + .nuget\NuGet.exe = .nuget\NuGet.exe + .nuget\NuGet.targets = .nuget\NuGet.targets + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {230AE83F-E92E-4E69-8355-426B305DA9C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {230AE83F-E92E-4E69-8355-426B305DA9C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {230AE83F-E92E-4E69-8355-426B305DA9C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {230AE83F-E92E-4E69-8355-426B305DA9C0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Plugins/Wox.Plugin.Everything/nativesrc/Everything.c b/Plugins/Wox.Plugin.Everything/nativesrc/Everything.c new file mode 100644 index 0000000000..fa74002337 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/nativesrc/Everything.c @@ -0,0 +1,1801 @@ + +// disable warnings +#pragma warning(disable : 4996) // deprecation + +#define EVERYTHINGUSERAPI __declspec(dllexport) + +// include +#include "Everything.h" +#include "Everything_IPC.h" + +// return copydata code +#define _EVERYTHING_COPYDATA_QUERYCOMPLETEA 0 +#define _EVERYTHING_COPYDATA_QUERYCOMPLETEW 1 + +// 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 BOOL _Everything_IsUnicodeQuery = FALSE; +static BOOL _Everything_IsUnicodeSearch = FALSE; +static LPVOID _Everything_Search = NULL; // wchar or char +static LPVOID _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 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.. + 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 int _Everything_StringLengthA(LPCSTR start) +{ + register LPCSTR s; + + s = start; + + while(*s) + { + s++; + } + + return (int)(s-start); +} + +static int _Everything_StringLengthW(LPCWSTR start) +{ + register LPCWSTR s; + + s = start; + + while(*s) + { + s++; + } + + return (int)(s-start); +} + +VOID EVERYTHINGAPI Everything_SetSearchW(LPCWSTR lpString) +{ + int len; + + _Everything_Lock(); + + if (_Everything_Search) HeapFree(GetProcessHeap(),0,_Everything_Search); + + len = _Everything_StringLengthW(lpString) + 1; + + _Everything_Search = HeapAlloc(GetProcessHeap(),0,len*sizeof(wchar_t)); + if (_Everything_Search) + { + CopyMemory(_Everything_Search,lpString,len*sizeof(wchar_t)); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + + _Everything_IsUnicodeSearch = 1; + + _Everything_Unlock(); +} + +VOID EVERYTHINGAPI Everything_SetSearchA(LPCSTR lpString) +{ + int size; + + _Everything_Lock(); + + if (_Everything_Search) HeapFree(GetProcessHeap(),0,_Everything_Search); + + size = _Everything_StringLengthA(lpString) + 1; + + _Everything_Search = (LPWSTR )HeapAlloc(GetProcessHeap(),0,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_SetReplyWindow(HWND hWnd) +{ + _Everything_Lock(); + + _Everything_ReplyWindow = hWnd; + + _Everything_Unlock(); +} + +VOID EVERYTHINGAPI Everything_SetReplyID(DWORD nId) +{ + _Everything_Lock(); + + _Everything_ReplyID = nId; + + _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) +{ + BOOL ret; + + _Everything_Lock(); + + ret = _Everything_Max; + + _Everything_Unlock(); + + return ret; +} + +DWORD EVERYTHINGAPI Everything_GetOffset(VOID) +{ + BOOL ret; + + _Everything_Lock(); + + ret = _Everything_Offset; + + _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 EVERYTHINGAPI _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_QUERYCOMPLETEA: + + if (!_Everything_IsUnicodeQuery) + { + if (_Everything_List) HeapFree(GetProcessHeap(),0,_Everything_List); + + _Everything_List = (EVERYTHING_IPC_LISTW *)HeapAlloc(GetProcessHeap(),0,cds->cbData); + + if (_Everything_List) + { + CopyMemory(_Everything_List,cds->lpData,cds->cbData); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + + PostQuitMessage(0); + + return TRUE; + } + + break; + + case _EVERYTHING_COPYDATA_QUERYCOMPLETEW: + + if (_Everything_IsUnicodeQuery) + { + if (_Everything_List) HeapFree(GetProcessHeap(),0,_Everything_List); + + _Everything_List = (EVERYTHING_IPC_LISTW *)HeapAlloc(GetProcessHeap(),0,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 int _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 int _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 length +static VOID _Everything_GetSearchTextW(LPWSTR wbuf) +{ + int wlen; + + if (_Everything_Search) + { + wlen = _Everything_GetSearchLengthW(); + + if (_Everything_IsUnicodeSearch) + { + CopyMemory(wbuf,_Everything_Search,(wlen+1) * sizeof(wchar_t)); + + return; + } + else + { + MultiByteToWideChar(CP_ACP,0,(LPCSTR )_Everything_Search,-1,wbuf,wlen+1); + + return; + } + } + + *wbuf = 0; +} + +// get the search length +static VOID _Everything_GetSearchTextA(LPSTR buf) +{ + int len; + + if (_Everything_Search) + { + len = _Everything_GetSearchLengthW(); + + 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_thread_proc(VOID *param) +{ + HWND everything_hwnd; + COPYDATASTRUCT cds; + WNDCLASSEX wcex; + HWND hwnd; + MSG msg; + int ret; + int len; + int size; + union + { + EVERYTHING_IPC_QUERYA *queryA; + EVERYTHING_IPC_QUERYW *queryW; + VOID *query; + }q; + + ZeroMemory(&wcex,sizeof(wcex)); + wcex.cbSize = sizeof(wcex); + + if (!GetClassInfoEx(GetModuleHandle(0),TEXT("EVERYTHING_DLL"),&wcex)) + { + ZeroMemory(&wcex,sizeof(wcex)); + wcex.cbSize = sizeof(wcex); + wcex.hInstance = GetModuleHandle(0); + wcex.lpfnWndProc = _Everything_window_proc; + wcex.lpszClassName = TEXT("EVERYTHING_DLL"); + + if (!RegisterClassEx(&wcex)) + { + _Everything_LastError = EVERYTHING_ERROR_REGISTERCLASSEX; + + return 0; + } + } + + hwnd = CreateWindow( + TEXT("EVERYTHING_DLL"), + TEXT(""), + 0, + 0,0,0,0, + 0,0,GetModuleHandle(0),0); + + if (hwnd) + { + everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0); + if (everything_hwnd) + { + LPVOID a; + + if (param) + { + // unicode + len = _Everything_GetSearchLengthW(); + + size = sizeof(EVERYTHING_IPC_QUERYW) - sizeof(wchar_t) + len*sizeof(wchar_t) + sizeof(wchar_t); + } + else + { + // ansi + len = _Everything_GetSearchLengthA(); + + size = sizeof(EVERYTHING_IPC_QUERYA) - sizeof(char) + (len*sizeof(char)) + sizeof(char); + } + + // alloc + a = HeapAlloc(GetProcessHeap(),0,size); + q.query = (EVERYTHING_IPC_QUERYW *)a; + + if (q.query) + { + if (param) + { + q.queryW->max_results = _Everything_Max; + q.queryW->offset = _Everything_Offset; + q.queryW->reply_copydata_message = _EVERYTHING_COPYDATA_QUERYCOMPLETEW; + q.queryW->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); + q.queryW->reply_hwnd = (INT32) hwnd; + + _Everything_GetSearchTextW((LPWSTR) q.queryW->search_string); + } + else + { + q.queryA->max_results = _Everything_Max; + q.queryA->offset = _Everything_Offset; + q.queryA->reply_copydata_message = _EVERYTHING_COPYDATA_QUERYCOMPLETEA; + q.queryA->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); + q.queryA->reply_hwnd = (INT32)hwnd; + + _Everything_GetSearchTextA((LPSTR) q.queryA->search_string); + } + + cds.cbData = size; + cds.dwData = param?EVERYTHING_IPC_COPYDATAQUERYW:EVERYTHING_IPC_COPYDATAQUERYA; + cds.lpData = q.query; + + if (SendMessage(everything_hwnd,WM_COPYDATA,(WPARAM)hwnd,(LPARAM)&cds) == TRUE) + { + // message pump + loop: + + WaitMessage(); + + // update windows + while(PeekMessage(&msg,NULL,0,0,0)) + { + ret = (int)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_IPC; + } + + // get result from window. + HeapFree(GetProcessHeap(),0,q.query); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + } + 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; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_CREATEWINDOW; + } + + return 0; +} + +static BOOL EVERYTHINGAPI _Everything_Query(BOOL bUnicode) +{ + HANDLE hthread; + DWORD threadid; + VOID *param; + + // reset the error flag. + _Everything_LastError = 0; + + if (bUnicode) + { + param = (VOID *)1; + } + else + { + param = 0; + } + + _Everything_IsUnicodeQuery = bUnicode; + + hthread = CreateThread(0,0,_Everything_thread_proc,param,0,&threadid); + + if (hthread) + { + WaitForSingleObject(hthread,INFINITE); + + CloseHandle(hthread); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_CREATETHREAD; + } + + return (_Everything_LastError == 0)?TRUE:FALSE; +} + + +BOOL _Everything_SendIPCQuery(BOOL bUnicode) +{ + HWND everything_hwnd; + COPYDATASTRUCT cds; + int ret; + int len; + int size; + union + { + EVERYTHING_IPC_QUERYA *queryA; + EVERYTHING_IPC_QUERYW *queryW; + VOID *query; + }q; + + _Everything_IsUnicodeQuery = bUnicode; + + // find the everything ipc window. + everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0); + if (everything_hwnd) + { + if (bUnicode) + { + // unicode + len = _Everything_GetSearchLengthW(); + + size = sizeof(EVERYTHING_IPC_QUERYW) - sizeof(wchar_t) + len*sizeof(wchar_t) + sizeof(wchar_t); + } + else + { + // ansi + len = _Everything_GetSearchLengthA(); + + size = sizeof(EVERYTHING_IPC_QUERYA) - sizeof(char) + (len*sizeof(char)) + sizeof(char); + } + + // alloc + q.query = (EVERYTHING_IPC_QUERYW *)HeapAlloc(GetProcessHeap(),0,size); + + if (q.query) + { + if (bUnicode) + { + q.queryW->max_results = _Everything_Max; + q.queryW->offset = _Everything_Offset; + q.queryW->reply_copydata_message = _Everything_ReplyID; + q.queryW->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); + q.queryW->reply_hwnd = (INT32) _Everything_ReplyWindow; + + _Everything_GetSearchTextW((LPWSTR) q.queryW->search_string); + } + else + { + q.queryA->max_results = _Everything_Max; + q.queryA->offset = _Everything_Offset; + q.queryA->reply_copydata_message = _Everything_ReplyID; + q.queryA->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); + q.queryA->reply_hwnd = (INT32) _Everything_ReplyWindow; + + _Everything_GetSearchTextA((LPSTR) q.queryA->search_string); + } + + cds.cbData = size; + cds.dwData = bUnicode?EVERYTHING_IPC_COPYDATAQUERYW:EVERYTHING_IPC_COPYDATAQUERYA; + cds.lpData = q.query; + + if (SendMessage(everything_hwnd,WM_COPYDATA,(WPARAM)_Everything_ReplyWindow,(LPARAM)&cds)) + { + // sucessful. + ret = TRUE; + } + else + { + // no ipc + _Everything_LastError = EVERYTHING_ERROR_IPC; + + ret = FALSE; + } + + // get result from window. + HeapFree(GetProcessHeap(),0,q.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(); + + if (bWait) + { + ret = _Everything_Query(FALSE); + } + else + { + ret = _Everything_SendIPCQuery(FALSE); + } + + _Everything_Unlock(); + + return ret; +} + +BOOL EVERYTHINGAPI Everything_QueryW(BOOL bWait) +{ + BOOL ret; + + _Everything_Lock(); + + if (bWait) + { + ret = _Everything_Query(TRUE); + } + else + { + ret = _Everything_SendIPCQuery(TRUE); + } + + _Everything_Unlock(); + + return ret; +} + +static int _Everything_CompareA(const VOID *a,const VOID *b) +{ + int i; + + i = stricmp(EVERYTHING_IPC_ITEMPATH(_Everything_List,a),EVERYTHING_IPC_ITEMPATH(_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 _Everything_CompareW(const VOID *a,const VOID *b) +{ + int i; + + i = stricmp(EVERYTHING_IPC_ITEMPATH(_Everything_List,a),EVERYTHING_IPC_ITEMPATH(_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; + } + + _Everything_Unlock(); +} + +DWORD EVERYTHINGAPI Everything_GetLastError(VOID) +{ + DWORD ret; + + _Everything_Lock(); + + ret = _Everything_LastError; + + _Everything_Unlock(); + + return ret; +} + +int EVERYTHINGAPI Everything_GetNumFileResults(VOID) +{ + int 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; +} + +int EVERYTHINGAPI Everything_GetNumFolderResults(VOID) +{ + int 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; +} + +int EVERYTHINGAPI Everything_GetNumResults(VOID) +{ + int ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (_Everything_IsUnicodeQuery) + { + ret = ((EVERYTHING_IPC_LISTW *)_Everything_List)->numitems; + } + else + { + ret = ((EVERYTHING_IPC_LISTA *)_Everything_List)->numitems; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = 0; + } + + _Everything_Unlock(); + + return ret; +} + +int EVERYTHINGAPI Everything_GetTotFileResults(VOID) +{ + int 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; +} + +int EVERYTHINGAPI Everything_GetTotFolderResults(VOID) +{ + int 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; +} + +int EVERYTHINGAPI Everything_GetTotResults(VOID) +{ + int 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 + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = 0; + } + + _Everything_Unlock(); + + return ret; +} + +BOOL EVERYTHINGAPI Everything_IsVolumeResult(int nIndex) +{ + BOOL ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (nIndex < 0) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + + goto exit; + } + + if (nIndex >= Everything_GetNumResults()) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + + goto exit; + } + + if (_Everything_IsUnicodeQuery) + { + ret = ((EVERYTHING_IPC_LISTW *)_Everything_List)->items[nIndex].flags & EVERYTHING_IPC_DRIVE; + } + else + { + ret = ((EVERYTHING_IPC_LISTA *)_Everything_List)->items[nIndex].flags & EVERYTHING_IPC_DRIVE; + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = FALSE; + } + +exit: + + _Everything_Unlock(); + + return ret; +} + +BOOL EVERYTHINGAPI Everything_IsFolderResult(int nIndex) +{ + BOOL ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (nIndex < 0) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + + goto exit; + } + + if (nIndex >= Everything_GetNumResults()) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + + goto exit; + } + + if (_Everything_IsUnicodeQuery) + { + ret = ((EVERYTHING_IPC_LISTW *)_Everything_List)->items[nIndex].flags & (EVERYTHING_IPC_DRIVE|EVERYTHING_IPC_FOLDER); + } + else + { + ret = ((EVERYTHING_IPC_LISTA *)_Everything_List)->items[nIndex].flags & (EVERYTHING_IPC_DRIVE|EVERYTHING_IPC_FOLDER); + } + } + else + { + ret = FALSE; + } + +exit: + + _Everything_Unlock(); + + return ret; +} + +BOOL EVERYTHINGAPI Everything_IsFileResult(int nIndex) +{ + BOOL ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (nIndex < 0) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + + goto exit; + } + + if (nIndex >= Everything_GetNumResults()) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = FALSE; + + goto exit; + } + + if (_Everything_IsUnicodeQuery) + { + ret = !(((EVERYTHING_IPC_LISTW *)_Everything_List)->items[nIndex].flags & (EVERYTHING_IPC_DRIVE|EVERYTHING_IPC_FOLDER)); + } + else + { + ret = !(((EVERYTHING_IPC_LISTA *)_Everything_List)->items[nIndex].flags & (EVERYTHING_IPC_DRIVE|EVERYTHING_IPC_FOLDER)); + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = FALSE; + } + +exit: + + _Everything_Unlock(); + + return ret; +} + +LPCWSTR EVERYTHINGAPI Everything_GetResultFileNameW(int nIndex) +{ + LPCWSTR ret; + + _Everything_Lock(); + + if ((_Everything_List) && (_Everything_IsUnicodeQuery)) + { + if (nIndex < 0) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + + goto exit; + } + + if (nIndex >= (int)((EVERYTHING_IPC_LISTW *)_Everything_List)->numitems) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + + goto exit; + } + + ret = EVERYTHING_IPC_ITEMFILENAMEW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[nIndex]); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = NULL; + } + +exit: + + _Everything_Unlock(); + + return ret; +} + +LPCSTR EVERYTHINGAPI Everything_GetResultFileNameA(int nIndex) +{ + LPCSTR ret; + + _Everything_Lock(); + + if ((_Everything_List) && (!_Everything_IsUnicodeQuery)) + { + if (nIndex < 0) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + + goto exit; + } + + if (nIndex >= (int)((EVERYTHING_IPC_LISTA *)_Everything_List)->numitems) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + + goto exit; + } + + ret = EVERYTHING_IPC_ITEMFILENAMEA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[nIndex]); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = NULL; + } + +exit: + + _Everything_Unlock(); + + return ret; +} + +LPCWSTR EVERYTHINGAPI Everything_GetResultPathW(int nIndex) +{ + LPCWSTR ret; + + _Everything_Lock(); + + if ((_Everything_List) && (_Everything_IsUnicodeQuery)) + { + if (nIndex < 0) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + + goto exit; + } + + if (nIndex >= (int)((EVERYTHING_IPC_LISTW *)_Everything_List)->numitems) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + + goto exit; + } + + ret = EVERYTHING_IPC_ITEMPATHW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[nIndex]); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = NULL; + } + +exit: + + _Everything_Unlock(); + + return ret; +} + +LPCSTR EVERYTHINGAPI Everything_GetResultPathA(int nIndex) +{ + LPCSTR ret; + + _Everything_Lock(); + + if (_Everything_List) + { + if (nIndex < 0) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + + goto exit; + } + + if (nIndex >= (int)((EVERYTHING_IPC_LISTA *)_Everything_List)->numitems) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + ret = NULL; + + goto exit; + } + + ret = EVERYTHING_IPC_ITEMPATHA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[nIndex]); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + ret = NULL; + } + +exit: + + _Everything_Unlock(); + + return ret; +} + +// max is in chars +static int _Everything_CopyW(LPWSTR buf,int bufmax,int catlen,LPCWSTR s) +{ + int 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_t)); + + buf[wlen] = 0; + } + + return wlen + catlen; +} + +static int _Everything_CopyA(LPSTR buf,int max,int catlen,LPCSTR s) +{ + int 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 int _Everything_CopyWFromA(LPWSTR buf,int bufmax,int catlen,LPCSTR s) +{ + int 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 int _Everything_CopyAFromW(LPSTR buf,int max,int catlen,LPCWSTR s) +{ + int 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; + +} + +int EVERYTHINGUSERAPI Everything_GetResultFullPathNameW(int nIndex,LPWSTR wbuf,int wbuf_size_in_wchars) +{ + int len; + + _Everything_Lock(); + + if (_Everything_List) + { + if (nIndex < 0) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,0,L""); + + goto exit; + } + + if (nIndex >= (int)((EVERYTHING_IPC_LISTW *)_Everything_List)->numitems) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,0,L""); + + goto exit; + } + + len = 0; + + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,len,EVERYTHING_IPC_ITEMPATHW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[nIndex])); + } + else + { + len = _Everything_CopyWFromA(wbuf,wbuf_size_in_wchars,len,EVERYTHING_IPC_ITEMPATHA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[nIndex])); + } + + if (len) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,len,L"\\"); + } + + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,len,EVERYTHING_IPC_ITEMFILENAMEW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[nIndex])); + } + else + { + len = _Everything_CopyWFromA(wbuf,wbuf_size_in_wchars,len,EVERYTHING_IPC_ITEMFILENAMEA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[nIndex])); + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + len = _Everything_CopyW(wbuf,wbuf_size_in_wchars,0,L""); + } + +exit: + + _Everything_Unlock(); + + return len; +} + +int EVERYTHINGUSERAPI Everything_GetResultFullPathNameA(int nIndex,LPSTR buf,int bufsize) +{ + int len; + + _Everything_Lock(); + + if (_Everything_List) + { + if (nIndex < 0) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + len = _Everything_CopyA(buf,bufsize,0,""); + + goto exit; + } + + if (nIndex >= (int)((EVERYTHING_IPC_LISTW *)_Everything_List)->numitems) + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDINDEX; + + len = _Everything_CopyA(buf,bufsize,0,""); + + goto exit; + } + + len = 0; + + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyAFromW(buf,bufsize,len,EVERYTHING_IPC_ITEMPATHW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[nIndex])); + } + else + { + len = _Everything_CopyA(buf,bufsize,len,EVERYTHING_IPC_ITEMPATHA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[nIndex])); + } + + if (len) + { + len = _Everything_CopyA(buf,bufsize,len,"\\"); + } + + if (_Everything_IsUnicodeQuery) + { + len = _Everything_CopyAFromW(buf,bufsize,len,EVERYTHING_IPC_ITEMFILENAMEW(_Everything_List,&((EVERYTHING_IPC_LISTW *)_Everything_List)->items[nIndex])); + } + else + { + len = _Everything_CopyA(buf,bufsize,len,EVERYTHING_IPC_ITEMFILENAMEA(_Everything_List,&((EVERYTHING_IPC_LISTA *)_Everything_List)->items[nIndex])); + } + } + else + { + _Everything_LastError = EVERYTHING_ERROR_INVALIDCALL; + + len = _Everything_CopyA(buf,bufsize,0,""); + } + +exit: + + _Everything_Unlock(); + + return len; +} + +BOOL EVERYTHINGAPI Everything_IsQueryReply(UINT message,WPARAM wParam,LPARAM lParam,DWORD nId) +{ + if (message == WM_COPYDATA) + { + COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lParam; + + if (cds) + { + if (cds->dwData == _Everything_ReplyID) + { + if (_Everything_IsUnicodeQuery) + { + if (_Everything_List) HeapFree(GetProcessHeap(),0,_Everything_List); + + _Everything_List = (EVERYTHING_IPC_LISTW *)HeapAlloc(GetProcessHeap(),0,cds->cbData); + + if (_Everything_List) + { + CopyMemory(_Everything_List,cds->lpData,cds->cbData); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + + return TRUE; + } + else + { + if (_Everything_List) HeapFree(GetProcessHeap(),0,_Everything_List); + + _Everything_List = (EVERYTHING_IPC_LISTW *)HeapAlloc(GetProcessHeap(),0,cds->cbData); + + if (_Everything_List) + { + CopyMemory(_Everything_List,cds->lpData,cds->cbData); + } + else + { + _Everything_LastError = EVERYTHING_ERROR_MEMORY; + } + + return TRUE; + } + } + } + } + + return FALSE; +} + +VOID EVERYTHINGUSERAPI Everything_Reset(VOID) +{ + _Everything_Lock(); + + if (_Everything_Search) + { + HeapFree(GetProcessHeap(),0,_Everything_Search); + + _Everything_Search = 0; + } + + if (_Everything_List) + { + HeapFree(GetProcessHeap(),0,_Everything_List); + + _Everything_List = 0; + } + + // 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_IsUnicodeQuery = FALSE; + _Everything_IsUnicodeSearch = FALSE; + + _Everything_Unlock(); +} + +//VOID DestroyResultArray(VOID *) + +// testing +/* +int main(int argc,char **argv) +{ + char buf[MAX_PATH]; + wchar_t wbuf[MAX_PATH]; + + // set search +// Everything_SetSearchA("sonic"); + Everything_SetSearchW(L"sonic"); + +// Everything_QueryA(); + Everything_QueryW(TRUE); + +// Everything_GetResultFullPathNameA(0,buf,sizeof(buf)); + Everything_GetResultFullPathNameW(0,wbuf,sizeof(wbuf)/sizeof(wchar_t)); + +// MessageBoxA(0,buf,"result 1",MB_OK); + MessageBoxW(0,wbuf,L"result 1",MB_OK); + +// MessageBoxA(0,resultA.cFileName,"result 1",MB_OK); +// MessageBoxW(0,resultW.cFileName,L"result 1",MB_OK); +} +*/ \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/nativesrc/Everything.def b/Plugins/Wox.Plugin.Everything/nativesrc/Everything.def new file mode 100644 index 0000000000..389f868855 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/nativesrc/Everything.def @@ -0,0 +1,51 @@ +LIBRARY Everything + +EXPORTS + + Everything_GetLastError + + Everything_SetSearchA + Everything_SetSearchW + Everything_SetMatchPath + Everything_SetMatchCase + Everything_SetMatchWholeWord + Everything_SetRegex + Everything_SetMax + Everything_SetOffset + + Everything_GetSearchA + Everything_GetSearchW + Everything_GetMatchPath + Everything_GetMatchCase + Everything_GetMatchWholeWord + Everything_GetRegex + Everything_GetMax + Everything_GetOffset + + 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 + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/nativesrc/Everything.h b/Plugins/Wox.Plugin.Everything/nativesrc/Everything.h new file mode 100644 index 0000000000..1a1770ba57 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/nativesrc/Everything.h @@ -0,0 +1,95 @@ + +#ifndef _EVERYTHING_DLL_ +#define _EVERYTHING_DLL_ + +#ifndef _INC_WINDOWS +#include +#endif + +#define EVERYTHING_OK 0 +#define EVERYTHING_ERROR_MEMORY 1 +#define EVERYTHING_ERROR_IPC 2 +#define EVERYTHING_ERROR_REGISTERCLASSEX 3 +#define EVERYTHING_ERROR_CREATEWINDOW 4 +#define EVERYTHING_ERROR_CREATETHREAD 5 +#define EVERYTHING_ERROR_INVALIDINDEX 6 +#define EVERYTHING_ERROR_INVALIDCALL 7 + +#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 nId); + +// 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); + +// execute query +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_QueryA(BOOL bWait); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_QueryW(BOOL bWait); + +// query reply +BOOL EVERYTHINGAPI Everything_IsQueryReply(UINT message,WPARAM wParam,LPARAM lParam,DWORD nId); + +// write result state +EVERYTHINGUSERAPI VOID EVERYTHINGAPI Everything_SortResultsByPath(VOID); + +// read result state +EVERYTHINGUSERAPI int EVERYTHINGAPI Everything_GetNumFileResults(VOID); +EVERYTHINGUSERAPI int EVERYTHINGAPI Everything_GetNumFolderResults(VOID); +EVERYTHINGUSERAPI int EVERYTHINGAPI Everything_GetNumResults(VOID); +EVERYTHINGUSERAPI int EVERYTHINGAPI Everything_GetTotFileResults(VOID); +EVERYTHINGUSERAPI int EVERYTHINGAPI Everything_GetTotFolderResults(VOID); +EVERYTHINGUSERAPI int EVERYTHINGAPI Everything_GetTotResults(VOID); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsVolumeResult(int nIndex); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsFolderResult(int nIndex); +EVERYTHINGUSERAPI BOOL EVERYTHINGAPI Everything_IsFileResult(int nIndex); +EVERYTHINGUSERAPI LPCWSTR EVERYTHINGAPI Everything_GetResultFileNameW(int nIndex); +EVERYTHINGUSERAPI LPCSTR EVERYTHINGAPI Everything_GetResultFileNameA(int nIndex); +EVERYTHINGUSERAPI LPCWSTR EVERYTHINGAPI Everything_GetResultPathW(int nIndex); +EVERYTHINGUSERAPI LPCSTR EVERYTHINGAPI Everything_GetResultPathA(int nIndex); +EVERYTHINGUSERAPI int Everything_GetResultFullPathNameW(int nIndex,LPWSTR wbuf,int wbuf_size_in_wchars); +EVERYTHINGUSERAPI int Everything_GetResultFullPathNameA(int nIndex,LPSTR buf,int bufsize); +EVERYTHINGUSERAPI VOID Everything_Reset(VOID); + +#ifdef UNICODE +#define Everything_SetSearch Everything_SetSearchW +#define Everything_GetSearch Everything_GetSearchW +#define Everything_Query Everything_QueryW +#define Everything_GetResultFileName Everything_GetResultFileNameW +#define Everything_GetResultPath Everything_GetResultPathW +#else +#define Everything_SetSearch Everything_SetSearchA +#define Everything_GetSearch Everything_GetSearchA +#define Everything_Query Everything_QueryA +#define Everything_GetResultFileName Everything_GetResultFileNameA +#define Everything_GetResultPath Everything_GetResultPathA +#endif + + +#endif + diff --git a/Plugins/Wox.Plugin.Everything/nativesrc/Everything_IPC.h b/Plugins/Wox.Plugin.Everything/nativesrc/Everything_IPC.h new file mode 100644 index 0000000000..3c2af015e9 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/nativesrc/Everything_IPC.h @@ -0,0 +1,287 @@ + +// Everything IPC + +#ifndef _EVERYTHING_IPC_H_ +#define _EVERYTHING_IPC_H_ + +// C +#ifdef __cplusplus +extern "C" { +#endif + +// 1 byte packing for our varible sized structs +#pragma pack(push, 1) + +// WM_USER (send to the taskbar notification window) +// SendMessage(FindWindow(EVERYTHING_IPC_WNDCLASS,0),WM_USER,EVERYTHING_IPC_*,lParam) +// version format: major.minor.revision.build +// example: 1.1.4.309 +#define EVERYTHING_IPC_GET_MAJOR_VERSION 0 // int major_version = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_MAJOR_VERSION,0); +#define EVERYTHING_IPC_GET_MINOR_VERSION 1 // int minor_version = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_MINOR_VERSION,0); +#define EVERYTHING_IPC_GET_REVISION 2 // int revision = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_REVISION,0); +#define EVERYTHING_IPC_GET_BUILD_NUMBER 3 // int build = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_BUILD,0); + +// uninstall options +#define EVERYTHING_IPC_DELETE_START_MENU_SHORTCUTS 100 // SendMessage(hwnd,WM_USER,EVERYTHING_IPC_DELETE_START_MENU_SHORTCUTS,0); +#define EVERYTHING_IPC_DELETE_QUICK_LAUNCH_SHORTCUT 101 // SendMessage(hwnd,WM_USER,EVERYTHING_IPC_DELETE_QUICK_LAUNCH_SHORTCUT,0); +#define EVERYTHING_IPC_DELETE_DESKTOP_SHORTCUT 102 // SendMessage(hwnd,WM_USER,EVERYTHING_IPC_DELETE_DESKTOP_SHORTCUT,0); +#define EVERYTHING_IPC_DELETE_FOLDER_CONTEXT_MENU 103 // SendMessage(hwnd,WM_USER,EVERYTHING_IPC_DELETE_FOLDER_CONTEXT_MENU,0); +#define EVERYTHING_IPC_DELETE_RUN_ON_SYSTEM_STARTUP 104 // SendMessage(hwnd,WM_USER,EVERYTHING_IPC_DELETE_RUN_ON_SYSTEM_STARTUP,0); + +// install options +#define EVERYTHING_IPC_CREATE_START_MENU_SHORTCUTS 200 // SendMessage(hwnd,WM_USER,EVERYTHING_IPC_CREATE_START_MENU_SHORTCUTS,0); +#define EVERYTHING_IPC_CREATE_QUICK_LAUNCH_SHORTCUT 201 // SendMessage(hwnd,WM_USER,EVERYTHING_IPC_CREATE_QUICK_LAUNCH_SHORTCUT,0); +#define EVERYTHING_IPC_CREATE_DESKTOP_SHORTCUT 202 // SendMessage(hwnd,WM_USER,EVERYTHING_IPC_CREATE_DESKTOP_SHORTCUT,0); +#define EVERYTHING_IPC_CREATE_FOLDER_CONTEXT_MENU 203 // SendMessage(hwnd,WM_USER,EVERYTHING_IPC_CREATE_FOLDER_CONTEXT_MENU,0); +#define EVERYTHING_IPC_CREATE_RUN_ON_SYSTEM_STARTUP 204 // SendMessage(hwnd,WM_USER,EVERYTHING_IPC_CREATE_RUN_ON_SYSTEM_STARTUP,0); + +// get option status; 0 = no, 1 = yes, 2 = indeterminate (partially installed) +#define EVERYTHING_IPC_IS_START_MENU_SHORTCUTS 300 // int ret = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_IS_START_MENU_SHORTCUTS,0); +#define EVERYTHING_IPC_IS_QUICK_LAUNCH_SHORTCUT 301 // int ret = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_IS_QUICK_LAUNCH_SHORTCUT,0); +#define EVERYTHING_IPC_IS_DESKTOP_SHORTCUT 302 // int ret = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_IS_DESKTOP_SHORTCUT,0); +#define EVERYTHING_IPC_IS_FOLDER_CONTEXT_MENU 303 // int ret = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_IS_FOLDER_CONTEXT_MENU,0); +#define EVERYTHING_IPC_IS_RUN_ON_SYSTEM_STARTUP 304 // int ret = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_IS_RUN_ON_SYSTEM_STARTUP,0); + +// find the everything window +#define EVERYTHING_IPC_WNDCLASS TEXT("EVERYTHING_TASKBAR_NOTIFICATION") + +// find a everything search window +#define EVERYTHING_IPC_SEARCH_WNDCLASS TEXT("EVERYTHING") + +// this global window message is sent to all top level windows when everything starts. +#define EVERYTHING_IPC_CREATED TEXT("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 + +// item flags +#define EVERYTHING_IPC_FOLDER 0x00000001 // The item is a folder. (its a file if not set) +#define EVERYTHING_IPC_DRIVE 0x00000002 // The folder is a drive. Path will be an empty string. + // (will also have the folder bit set) + +// the WM_COPYDATA message for a query. +#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_ITEMW *)(item))->path_offset) +#define EVERYTHING_IPC_ITEMPATHW(list,item) (WCHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMW *)(item))->path_offset) + +// +// Varible sized query struct sent to everything. +// +// sent in the form of a WM_COPYDAYA 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 CHAR plus the length of the search string in bytes plus +// one CHAR 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) + unicode_length_in_wchars(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_COPYDAYA 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. + INT32 reply_hwnd; + + // the value to set the dwData member in the COPYDATASTRUCT struct + // sent by Everything when the query is complete. + INT32 reply_copydata_message; + + // search flags (see EVERYTHING_MATCHCASE | EVERYTHING_MATCHWHOLEWORD | EVERYTHING_MATCHPATH) + INT32 search_flags; + + // only return results after 'offset' results (0 to return the first result) + // useful for scrollable lists + INT32 offset; + + // the number of results to return + // zero to return no results + // EVERYTHING_IPC_ALLRESULTS to return ALL results + INT32 max_results; + + // null terminated string. arbitrary sized search_string buffer. + INT32 search_string[1]; + +}EVERYTHING_IPC_QUERYW; + +// ASCII version +typedef struct EVERYTHING_IPC_QUERYA +{ + // the window that will receive the new results. + INT32 reply_hwnd; + + // the value to set the dwData member in the COPYDATASTRUCT struct + // sent by Everything when the query is complete. + INT32 reply_copydata_message; + + // search flags (see EVERYTHING_MATCHCASE | EVERYTHING_MATCHWHOLEWORD | EVERYTHING_MATCHPATH) + INT32 search_flags; + + // only return results after 'offset' results (0 to return the first result) + // useful for scrollable lists + INT32 offset; + + // the number of results to return + // zero to return no results + // EVERYTHING_IPC_ALLRESULTS to return ALL results + INT32 max_results; + + // null terminated string. arbitrary sized search_string buffer. + INT32 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; + + // arbitrary sized 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; + + // arbitrary sized item list. + // use numitems to determine the actual number of items available. + EVERYTHING_IPC_ITEMA items[1]; + +}EVERYTHING_IPC_LISTA; + +#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 +#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 +#endif + + +// restore packing +#pragma pack(pop) + +// end extern C +#ifdef __cplusplus +} +#endif + +#endif // _EVERYTHING_H_ + diff --git a/Plugins/Wox.Plugin.Everything/nativesrc/dll.sln b/Plugins/Wox.Plugin.Everything/nativesrc/dll.sln new file mode 100644 index 0000000000..5f394cb794 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/nativesrc/dll.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dll", "dll.vcxproj", "{7C90030E-6EDB-445E-A61B-5540B7355C59}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7C90030E-6EDB-445E-A61B-5540B7355C59}.Debug|Win32.ActiveCfg = Debug|x64 + {7C90030E-6EDB-445E-A61B-5540B7355C59}.Debug|Win32.Build.0 = Debug|x64 + {7C90030E-6EDB-445E-A61B-5540B7355C59}.Debug|x64.ActiveCfg = Debug|x64 + {7C90030E-6EDB-445E-A61B-5540B7355C59}.Debug|x64.Build.0 = Debug|x64 + {7C90030E-6EDB-445E-A61B-5540B7355C59}.Release|Win32.ActiveCfg = Release|Win32 + {7C90030E-6EDB-445E-A61B-5540B7355C59}.Release|Win32.Build.0 = Release|Win32 + {7C90030E-6EDB-445E-A61B-5540B7355C59}.Release|x64.ActiveCfg = Release|x64 + {7C90030E-6EDB-445E-A61B-5540B7355C59}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Plugins/Wox.Plugin.Everything/nativesrc/dll.vcxproj b/Plugins/Wox.Plugin.Everything/nativesrc/dll.vcxproj new file mode 100644 index 0000000000..ebc74b25e3 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/nativesrc/dll.vcxproj @@ -0,0 +1,291 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {7C90030E-6EDB-445E-A61B-5540B7355C59} + dll + Win32Proj + + + + DynamicLibrary + false + MultiByte + v90 + + + DynamicLibrary + MultiByte + v90 + + + DynamicLibrary + false + MultiByte + v90 + + + DynamicLibrary + MultiByte + v90 + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + Debug\ + Debug\ + true + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + Release\ + Release\ + false + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + %(AdditionalIncludeDirectories) + BZ_NO_STDIO;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + + Level3 + EditAndContinue + + + $(OutDir)Everything.dll + + + true + true + Console + 0 + true + true + false + + + MachineX86 + + + %(AdditionalManifestFiles) + + + + + X64 + + + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + + Level3 + ProgramDatabase + CompileAsC + + + ComCtl32.lib;UxTheme.lib;Ws2_32.lib;shlwapi.lib;ole32.lib;htmlhelp.lib;%(AdditionalDependencies) + $(OutDir)Everything.dll + true + $(OutDir)dll.pdb + Console + false + + + MachineX64 + + + %(AdditionalManifestFiles) + + + + + + + + + MaxSpeed + AnySuitable + true + Speed + false + false + %(AdditionalIncludeDirectories) + BZ_NO_STDIO;%(PreprocessorDefinitions) + true + Sync + Default + MultiThreaded + true + Fast + + + Level3 + + + Cdecl + CompileAsC + + + + + + + true + + + NotSet + $(OutDir)Everything.dll + %(AdditionalManifestDependencies) + false + everything.def + false + true + Windows + 0 + true + true + + + false + + + MachineX86 + + + %(AdditionalManifestFiles) + false + false + + + + + + + + + X64 + + + MaxSpeed + AnySuitable + true + Speed + false + false + %(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Default + MultiThreaded + true + Fast + + + Level3 + + + CompileAsC + + + true + + + comctl32.lib;UxTheme.lib;Ws2_32.lib;HTMLHelp.lib;msimg32.lib;%(AdditionalDependencies) + NotSet + $(OutDir)Everything.dll + %(AdditionalManifestDependencies) + false + true + Windows + true + true + + + false + + + MachineX64 + + + %(AdditionalManifestFiles) + false + false + + + + + + + + + + + + + + + + diff --git a/Plugins/Wox.Plugin.Everything/nativesrc/dll.vcxproj.filters b/Plugins/Wox.Plugin.Everything/nativesrc/dll.vcxproj.filters new file mode 100644 index 0000000000..93496a8d7d --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/nativesrc/dll.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {072e536f-0b4e-4b52-bbf4-45486ca2a90b} + cpp;c;cxx;def;odl;idl;hpj;bat;asm + + + + + src + + + + + src + + + + + src + + + src + + + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/packages.config b/Plugins/Wox.Plugin.Everything/packages.config new file mode 100644 index 0000000000..7a13476a54 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/plugin.json b/Plugins/Wox.Plugin.Everything/plugin.json new file mode 100644 index 0000000000..0f7418f956 --- /dev/null +++ b/Plugins/Wox.Plugin.Everything/plugin.json @@ -0,0 +1,12 @@ +{ + "ID":"D2D2C23B084D411DB66FE0C79D6C2A6E", + "ActionKeyword":"f", + "Name":"Everything", + "Description":"Search Everything", + "Author":"qianlifeng,orzfly", + "Version":"1.1.0", + "Language":"csharp", + "Website":"http://www.getwox.com", + "IcoPath":"Images\\find.png", + "ExecuteFileName":"Wox.Plugin.Everything.dll" +} diff --git a/Plugins/Wox.Plugin.Everything/x86/Everything.dll b/Plugins/Wox.Plugin.Everything/x86/Everything.dll new file mode 100644 index 0000000000..c0c1fe792b Binary files /dev/null and b/Plugins/Wox.Plugin.Everything/x86/Everything.dll differ