├── .gitattributes ├── .gitignore ├── GuiShell ├── About.xaml ├── About.xaml.cs ├── Config.cs ├── FileOperations.xaml ├── FileOperations.xaml.cs ├── Folders.xaml ├── Folders.xaml.cs ├── GuiShell.csproj ├── Preferences.xaml ├── Preferences.xaml.cs └── Properties │ └── launchSettings.json ├── Hijacker ├── Hijacker.vcxproj ├── Hijacker.vcxproj.filters ├── dllmain.cpp ├── framework.h ├── pch.cpp └── pch.h ├── IbDOpusExt.sln ├── LICENSE.txt ├── LoadTest ├── LoadTest.cpp ├── LoadTest.vcxproj └── LoadTest.vcxproj.filters ├── README.md ├── README.zh-Hans.md ├── Scripts └── IbDOpusExt.SizeCol.js ├── ViewerPlugin ├── DOpus.hpp ├── DOpus │ ├── plugin support.h │ ├── vfs plugins.h │ └── viewer plugins.h ├── DOpusExt.cpp ├── DOpusExt.hpp ├── DOpusPlugin.hpp ├── GuiShell.cpp ├── GuiShell.hpp ├── ViewerPlugin.rc ├── ViewerPlugin.vcxproj ├── ViewerPlugin.vcxproj.filters ├── dllmain.cpp ├── framework.h ├── helper.hpp ├── pch.cpp ├── pch.h ├── resource.h ├── resource1.h ├── sigmatch.cpp └── sigmatch.hpp ├── docs ├── README.md └── images │ └── SizeCol.png └── external ├── CMakeLists.txt └── vcpkg.bat /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | 3 | ## Ignore Visual Studio temporary files, build results, and 4 | ## files generated by popular Visual Studio add-ons. 5 | ## 6 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 7 | 8 | # User-specific files 9 | *.rsuser 10 | *.suo 11 | *.user 12 | *.userosscache 13 | *.sln.docstates 14 | 15 | # User-specific files (MonoDevelop/Xamarin Studio) 16 | *.userprefs 17 | 18 | # Build results 19 | [Dd]ebug/ 20 | [Dd]ebugPublic/ 21 | [Rr]elease/ 22 | [Rr]eleases/ 23 | x64/ 24 | x86/ 25 | [Aa][Rr][Mm]/ 26 | [Aa][Rr][Mm]64/ 27 | bld/ 28 | [Bb]in/ 29 | [Oo]bj/ 30 | [Ll]og/ 31 | 32 | # Visual Studio 2015/2017 cache/options directory 33 | .vs/ 34 | # Uncomment if you have tasks that create the project's static files in wwwroot 35 | #wwwroot/ 36 | 37 | # Visual Studio 2017 auto generated files 38 | Generated\ Files/ 39 | 40 | # MSTest test Results 41 | [Tt]est[Rr]esult*/ 42 | [Bb]uild[Ll]og.* 43 | 44 | # NUNIT 45 | *.VisualState.xml 46 | TestResult.xml 47 | 48 | # Build Results of an ATL Project 49 | [Dd]ebugPS/ 50 | [Rr]eleasePS/ 51 | dlldata.c 52 | 53 | # Benchmark Results 54 | BenchmarkDotNet.Artifacts/ 55 | 56 | # .NET Core 57 | project.lock.json 58 | project.fragment.lock.json 59 | artifacts/ 60 | 61 | # StyleCop 62 | StyleCopReport.xml 63 | 64 | # Files built by Visual Studio 65 | *_i.c 66 | *_p.c 67 | *_h.h 68 | *.ilk 69 | *.meta 70 | *.obj 71 | *.iobj 72 | *.pch 73 | *.pdb 74 | *.ipdb 75 | *.pgc 76 | *.pgd 77 | *.rsp 78 | *.sbr 79 | *.tlb 80 | *.tli 81 | *.tlh 82 | *.tmp 83 | *.tmp_proj 84 | *_wpftmp.csproj 85 | *.log 86 | *.vspscc 87 | *.vssscc 88 | .builds 89 | *.pidb 90 | *.svclog 91 | *.scc 92 | 93 | # Chutzpah Test files 94 | _Chutzpah* 95 | 96 | # Visual C++ cache files 97 | ipch/ 98 | *.aps 99 | *.ncb 100 | *.opendb 101 | *.opensdf 102 | *.sdf 103 | *.cachefile 104 | *.VC.db 105 | *.VC.VC.opendb 106 | 107 | # Visual Studio profiler 108 | *.psess 109 | *.vsp 110 | *.vspx 111 | *.sap 112 | 113 | # Visual Studio Trace Files 114 | *.e2e 115 | 116 | # TFS 2012 Local Workspace 117 | $tf/ 118 | 119 | # Guidance Automation Toolkit 120 | *.gpState 121 | 122 | # ReSharper is a .NET coding add-in 123 | _ReSharper*/ 124 | *.[Rr]e[Ss]harper 125 | *.DotSettings.user 126 | 127 | # JustCode is a .NET coding add-in 128 | .JustCode 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # The packages folder can be ignored because of Package Restore 188 | **/[Pp]ackages/* 189 | # except build/, which is used as an MSBuild target. 190 | !**/[Pp]ackages/build/ 191 | # Uncomment if necessary however generally it will be regenerated when needed 192 | #!**/[Pp]ackages/repositories.config 193 | # NuGet v3's project.json files produces more ignorable files 194 | *.nuget.props 195 | *.nuget.targets 196 | 197 | # Microsoft Azure Build Output 198 | csx/ 199 | *.build.csdef 200 | 201 | # Microsoft Azure Emulator 202 | ecf/ 203 | rcf/ 204 | 205 | # Windows Store app package directories and files 206 | AppPackages/ 207 | BundleArtifacts/ 208 | Package.StoreAssociation.xml 209 | _pkginfo.txt 210 | *.appx 211 | 212 | # Visual Studio cache files 213 | # files ending in .cache can be ignored 214 | *.[Cc]ache 215 | # but keep track of directories ending in .cache 216 | !?*.[Cc]ache/ 217 | 218 | # Others 219 | ClientBin/ 220 | ~$* 221 | *~ 222 | *.dbmdl 223 | *.dbproj.schemaview 224 | *.jfm 225 | *.pfx 226 | *.publishsettings 227 | orleans.codegen.cs 228 | 229 | # Including strong name files can present a security risk 230 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 231 | #*.snk 232 | 233 | # Since there are multiple workflows, uncomment next line to ignore bower_components 234 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 235 | #bower_components/ 236 | 237 | # RIA/Silverlight projects 238 | Generated_Code/ 239 | 240 | # Backup & report files from converting an old project file 241 | # to a newer Visual Studio version. Backup files are not needed, 242 | # because we have git ;-) 243 | _UpgradeReport_Files/ 244 | Backup*/ 245 | UpgradeLog*.XML 246 | UpgradeLog*.htm 247 | ServiceFabricBackup/ 248 | *.rptproj.bak 249 | 250 | # SQL Server files 251 | *.mdf 252 | *.ldf 253 | *.ndf 254 | 255 | # Business Intelligence projects 256 | *.rdl.data 257 | *.bim.layout 258 | *.bim_*.settings 259 | *.rptproj.rsuser 260 | *- Backup*.rdl 261 | 262 | # Microsoft Fakes 263 | FakesAssemblies/ 264 | 265 | # GhostDoc plugin setting file 266 | *.GhostDoc.xml 267 | 268 | # Node.js Tools for Visual Studio 269 | .ntvs_analysis.dat 270 | node_modules/ 271 | 272 | # Visual Studio 6 build log 273 | *.plg 274 | 275 | # Visual Studio 6 workspace options file 276 | *.opt 277 | 278 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 279 | *.vbw 280 | 281 | # Visual Studio LightSwitch build output 282 | **/*.HTMLClient/GeneratedArtifacts 283 | **/*.DesktopClient/GeneratedArtifacts 284 | **/*.DesktopClient/ModelManifest.xml 285 | **/*.Server/GeneratedArtifacts 286 | **/*.Server/ModelManifest.xml 287 | _Pvt_Extensions 288 | 289 | # Paket dependency manager 290 | .paket/paket.exe 291 | paket-files/ 292 | 293 | # FAKE - F# Make 294 | .fake/ 295 | 296 | # JetBrains Rider 297 | .idea/ 298 | *.sln.iml 299 | 300 | # CodeRush personal settings 301 | .cr/personal 302 | 303 | # Python Tools for Visual Studio (PTVS) 304 | __pycache__/ 305 | *.pyc 306 | 307 | # Cake - Uncomment if you are using it 308 | # tools/** 309 | # !tools/packages.config 310 | 311 | # Tabs Studio 312 | *.tss 313 | 314 | # Telerik's JustMock configuration file 315 | *.jmconfig 316 | 317 | # BizTalk build output 318 | *.btp.cs 319 | *.btm.cs 320 | *.odx.cs 321 | *.xsd.cs 322 | 323 | # OpenCover UI analysis results 324 | OpenCover/ 325 | 326 | # Azure Stream Analytics local run output 327 | ASALocalRun/ 328 | 329 | # MSBuild Binary and Structured Log 330 | *.binlog 331 | 332 | # NVidia Nsight GPU debugger configuration file 333 | *.nvuser 334 | 335 | # MFractors (Xamarin productivity tool) working folder 336 | .mfractor/ 337 | 338 | # Local History for Visual Studio 339 | .localhistory/ 340 | 341 | # BeatPulse healthcheck temp database 342 | healthchecksdb -------------------------------------------------------------------------------- /GuiShell/About.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /GuiShell/About.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuiShell 17 | { 18 | /// 19 | /// Interaction logic for About.xaml 20 | /// 21 | public partial class About : Page 22 | { 23 | public About() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GuiShell/Config.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Xml.Serialization; 8 | using System.IO; 9 | 10 | namespace GuiShell 11 | { 12 | public class ConfigData 13 | { 14 | public class FileOperationsData 15 | { 16 | public class LoggingData 17 | { 18 | [DefaultValue(10)] 19 | public byte MaxUndoNum = 10; 20 | } 21 | public LoggingData Logging = new LoggingData(); 22 | } 23 | public FileOperationsData FileOperations = new FileOperationsData(); 24 | 25 | public class FoldersData 26 | { 27 | public class FolderBehaviourData 28 | { 29 | } 30 | public FolderBehaviourData FolderBehaviour = new FolderBehaviourData(); 31 | } 32 | public FoldersData Folders = new FoldersData(); 33 | } 34 | 35 | public class Config 36 | { 37 | public static string Filename { set; get; } 38 | public static Action ApplyAction { set; get; } 39 | 40 | public static void SetUnhandledExceptionHandler() 41 | { 42 | AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs args) => 43 | { 44 | Exception e = (Exception)args.ExceptionObject; 45 | System.Windows.MessageBox.Show(e.ToString(), "Unhandled exception"); 46 | }; 47 | } 48 | 49 | public static ConfigData Read() 50 | { 51 | XmlSerializer serializer = new XmlSerializer(typeof(ConfigData)); 52 | serializer.UnknownNode += (object sender, System.Xml.Serialization.XmlNodeEventArgs e) => 53 | { 54 | System.Windows.MessageBox.Show($"UnknownNode: {e.NodeType} {e.Name} at line {e.LineNumber}", "IbDOpusExt"); 55 | }; 56 | 57 | ConfigData config; 58 | if (File.Exists(Filename)) 59 | { 60 | try 61 | { 62 | using (FileStream fs = new FileStream(Filename, FileMode.Open, FileAccess.Read)) 63 | { 64 | config = (ConfigData)serializer.Deserialize(fs) ?? new ConfigData(); 65 | } 66 | } 67 | catch (System.IO.IOException e) 68 | { 69 | System.Windows.MessageBox.Show(e.ToString(), "Exception"); 70 | config = new ConfigData(); 71 | } 72 | } 73 | else 74 | { 75 | config = new ConfigData(); 76 | } 77 | return config; 78 | } 79 | 80 | public static void Apply(ConfigData config) 81 | { 82 | ApplyAction(config); 83 | } 84 | 85 | public static void Write(ConfigData config) 86 | { 87 | XmlSerializer serializer = new XmlSerializer(typeof(ConfigData)); 88 | Directory.GetParent(Filename).Create(); 89 | try 90 | { 91 | using(FileStream fs = new FileStream(Filename, FileMode.Create, FileAccess.Write)) 92 | { 93 | serializer.Serialize(fs, config); 94 | } 95 | } 96 | catch(System.IO.IOException e) 97 | { 98 | System.Windows.MessageBox.Show(e.ToString(), "Exception"); 99 | } 100 | } 101 | } 102 | } -------------------------------------------------------------------------------- /GuiShell/FileOperations.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /GuiShell/FileOperations.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuiShell 17 | { 18 | /// 19 | /// Interaction logic for FileOperations.xaml 20 | /// 21 | public partial class FileOperations : Page 22 | { 23 | public FileOperations(ConfigData.FileOperationsData data) 24 | { 25 | InitializeComponent(); 26 | txtMaxUndoNum.Text = data.Logging.MaxUndoNum.ToString(); 27 | } 28 | 29 | public ConfigData.FileOperationsData Save() 30 | { 31 | var data = new ConfigData.FileOperationsData(); 32 | byte maxUndoNum; 33 | if (byte.TryParse(txtMaxUndoNum.Text, out maxUndoNum)) 34 | data.Logging.MaxUndoNum = maxUndoNum; 35 | return data; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /GuiShell/Folders.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | V:\Ib\GetFolderSize 17 | Get the folder size from voidtool's Everything. 18 | Require that Everything's "Index folder size" option (at Options\Indexes) is turned on. 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /GuiShell/Folders.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuiShell 17 | { 18 | /// 19 | /// Interaction logic for Folders.xaml 20 | /// 21 | public partial class Folders : Page 22 | { 23 | public Folders(ConfigData.FoldersData data) 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | public ConfigData.FoldersData Save() 29 | { 30 | var data = new ConfigData.FoldersData(); 31 | return data; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /GuiShell/GuiShell.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0-windows 5 | true 6 | 7 | 8 | 9 | none 10 | false 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /GuiShell/Preferences.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /GuiShell/Preferences.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using System.Windows.Threading; 16 | using System.Threading; 17 | 18 | namespace GuiShell 19 | { 20 | public class PreferenceShow 21 | { 22 | Preferences preferences; 23 | 24 | public bool Show() 25 | { 26 | if (preferences != null) 27 | { 28 | preferences.Dispatcher.BeginInvoke(DispatcherPriority.Render, (ThreadStart)delegate () 29 | { 30 | preferences.Activate(); 31 | }); 32 | return false; 33 | } 34 | 35 | Thread t = new Thread(() => 36 | { 37 | preferences = new Preferences(); 38 | preferences.ShowDialog(); 39 | preferences = null; 40 | }); 41 | t.SetApartmentState(ApartmentState.STA); 42 | t.Start(); 43 | return true; 44 | } 45 | } 46 | 47 | /// 48 | /// Interaction logic for Preferences.xaml 49 | /// 50 | public partial class Preferences : Window 51 | { 52 | ConfigData config; 53 | FileOperations fileOperations; 54 | Folders folders; 55 | About about; 56 | 57 | public Preferences() 58 | { 59 | InitializeComponent(); 60 | 61 | config = Config.Read(); 62 | fileOperations = new FileOperations(config.FileOperations); 63 | folders = new Folders(config.Folders); 64 | about = new About(); 65 | 66 | Frame.Navigate(fileOperations); 67 | } 68 | 69 | public Preferences(IntPtr parentWindow) : this() 70 | { 71 | var interop = new System.Windows.Interop.WindowInteropHelper(this); 72 | interop.EnsureHandle(); 73 | interop.Owner = parentWindow; 74 | } 75 | 76 | private void FileOperations_Selected(object sender, RoutedEventArgs e) 77 | { 78 | Frame.Navigate(fileOperations); 79 | } 80 | 81 | private void Folders_Selected(object sender, RoutedEventArgs e) 82 | { 83 | Frame.Navigate(folders); 84 | } 85 | 86 | private void About_Selected(object sender, RoutedEventArgs e) 87 | { 88 | Frame.Navigate(about); 89 | } 90 | 91 | void Apply() 92 | { 93 | config.FileOperations = fileOperations.Save(); 94 | config.Folders = folders.Save(); 95 | Config.Write(config); 96 | Config.Apply(config); 97 | } 98 | 99 | private void btnApply_Click(object sender, RoutedEventArgs e) 100 | { 101 | Apply(); 102 | } 103 | 104 | private void btnOk_Click(object sender, RoutedEventArgs e) 105 | { 106 | Apply(); 107 | Close(); 108 | } 109 | 110 | private void btnCancel_Click(object sender, RoutedEventArgs e) 111 | { 112 | Close(); 113 | } 114 | } 115 | } -------------------------------------------------------------------------------- /GuiShell/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "GuiShell": { 4 | "commandName": "Project", 5 | "nativeDebugging": true 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /Hijacker/Hijacker.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {f927a9da-afa4-434b-8b5a-82c41954a7f5} 25 | Hijacker 26 | 10.0 27 | 28 | 29 | 30 | DynamicLibrary 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | DynamicLibrary 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | DynamicLibrary 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | DynamicLibrary 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | version 76 | 77 | 78 | false 79 | version 80 | 81 | 82 | true 83 | version 84 | 85 | 86 | false 87 | version 88 | 89 | 90 | x64-windows-static-md 91 | 92 | 93 | x64-windows-static-md 94 | 95 | 96 | x64-windows-static-md 97 | 98 | 99 | x64-windows-static-md 100 | 101 | 102 | 103 | Level3 104 | true 105 | WIN32;_DEBUG;HIJACKER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 106 | true 107 | Use 108 | pch.h 109 | stdcpp17 110 | $(SolutionDir)external\build\_deps\ibdllhijack-src\include;$(SolutionDir)external\build\_deps\ibwincpp-src\include;%(AdditionalIncludeDirectories) 111 | 112 | 113 | Windows 114 | true 115 | false 116 | 117 | 118 | 119 | 120 | Level3 121 | true 122 | true 123 | true 124 | WIN32;NDEBUG;HIJACKER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 125 | true 126 | Use 127 | pch.h 128 | stdcpp17 129 | $(SolutionDir)external\build\_deps\ibdllhijack-src\include;$(SolutionDir)external\build\_deps\ibwincpp-src\include;%(AdditionalIncludeDirectories) 130 | 131 | 132 | Windows 133 | true 134 | true 135 | true 136 | false 137 | /PDBALTPATH:https://github.com/Chaoses-Ib/IbDOpusExt %(AdditionalOptions) 138 | 139 | 140 | 141 | 142 | Level3 143 | true 144 | _DEBUG;HIJACKER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 145 | true 146 | Use 147 | pch.h 148 | stdcpp17 149 | $(SolutionDir)external\build\_deps\ibdllhijack-src\include;$(SolutionDir)external\build\_deps\ibwincpp-src\include;%(AdditionalIncludeDirectories) 150 | 151 | 152 | Windows 153 | true 154 | false 155 | 156 | 157 | 158 | 159 | Level3 160 | true 161 | true 162 | true 163 | NDEBUG;HIJACKER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 164 | true 165 | Use 166 | pch.h 167 | stdcpp17 168 | $(SolutionDir)external\build\_deps\ibdllhijack-src\include;$(SolutionDir)external\build\_deps\ibwincpp-src\include;%(AdditionalIncludeDirectories) 169 | 170 | 171 | Windows 172 | true 173 | true 174 | true 175 | false 176 | /PDBALTPATH:https://github.com/Chaoses-Ib/IbDOpusExt %(AdditionalOptions) 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | Create 187 | Create 188 | Create 189 | Create 190 | 191 | 192 | 193 | 194 | {d04f5ff3-6d8b-3718-be85-2aac74820582} 195 | 196 | 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /Hijacker/Hijacker.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /Hijacker/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include 3 | #include 4 | 5 | template 6 | LONG IbDetourAttach(_Inout_ T* ppPointer, _In_ T pDetour) { 7 | DetourTransactionBegin(); 8 | DetourUpdateThread(GetCurrentThread()); 9 | DetourAttach((void**)ppPointer, pDetour); 10 | return DetourTransactionCommit(); 11 | } 12 | 13 | template 14 | LONG IbDetourDetach(_Inout_ T* ppPointer, _In_ T pDetour) { 15 | DetourTransactionBegin(); 16 | DetourUpdateThread(GetCurrentThread()); 17 | DetourDetach((void**)ppPointer, pDetour); 18 | return DetourTransactionCommit(); 19 | } 20 | 21 | decltype(&LoadLibraryW) LoadLibraryW_true = LoadLibraryW; 22 | _Ret_maybenull_ HMODULE WINAPI LoadLibraryW_detour(_In_ LPCWSTR lpLibFileName) 23 | { 24 | if constexpr (ib::debug_runtime) { 25 | ib::DebugOStream() << L"LoadLibraryW: " << lpLibFileName << std::endl; 26 | HMODULE result; 27 | if (lpLibFileName[0] != L'\0' && lpLibFileName[1] == L':') 28 | result = LoadLibraryExW(lpLibFileName, 0, LOAD_WITH_ALTERED_SEARCH_PATH); 29 | else 30 | result = LoadLibraryW_true(lpLibFileName); 31 | DWORD error = GetLastError(); 32 | ib::DebugOStream() << result << ", " << error << std::endl; 33 | } 34 | 35 | if (lpLibFileName[0] != L'\0' && lpLibFileName[1] == L':') 36 | return LoadLibraryExW(lpLibFileName, 0, LOAD_WITH_ALTERED_SEARCH_PATH); 37 | else 38 | return LoadLibraryW_true(lpLibFileName); 39 | } 40 | 41 | // See docs for details 42 | #include 43 | 44 | BOOL APIENTRY DllMain( HMODULE hModule, 45 | DWORD ul_reason_for_call, 46 | LPVOID lpReserved 47 | ) 48 | { 49 | if constexpr (ib::debug_runtime) { 50 | const wchar_t* reason_table[] = { L"DLL_PROCESS_DETACH", L"DLL_PROCESS_ATTACH", L"DLL_THREAD_ATTACH", L"DLL_THREAD_DETACH" }; 51 | ib::DebugOStream() << "DllMain: " << reason_table[ul_reason_for_call] << std::endl; 52 | } 53 | 54 | switch (ul_reason_for_call) 55 | { 56 | case DLL_PROCESS_ATTACH: 57 | IbDetourAttach(&LoadLibraryW_true, LoadLibraryW_detour); 58 | break; 59 | case DLL_THREAD_ATTACH: 60 | case DLL_THREAD_DETACH: 61 | case DLL_PROCESS_DETACH: 62 | break; 63 | } 64 | return TRUE; 65 | } -------------------------------------------------------------------------------- /Hijacker/framework.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 4 | // Windows Header Files 5 | #include 6 | -------------------------------------------------------------------------------- /Hijacker/pch.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp: source file corresponding to the pre-compiled header 2 | 3 | #include "pch.h" 4 | 5 | // When you are using pre-compiled headers, this source file is necessary for compilation to succeed. 6 | -------------------------------------------------------------------------------- /Hijacker/pch.h: -------------------------------------------------------------------------------- 1 | // pch.h: This is a precompiled header file. 2 | // Files listed below are compiled only once, improving build performance for future builds. 3 | // This also affects IntelliSense performance, including code completion and many code browsing features. 4 | // However, files listed here are ALL re-compiled if any one of them is updated between builds. 5 | // Do not add files here that you will be updating frequently as this negates the performance advantage. 6 | 7 | #ifndef PCH_H 8 | #define PCH_H 9 | 10 | // add headers that you want to pre-compile here 11 | #include "framework.h" 12 | 13 | #endif //PCH_H 14 | -------------------------------------------------------------------------------- /IbDOpusExt.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32319.34 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ViewerPlugin", "ViewerPlugin\ViewerPlugin.vcxproj", "{5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GuiShell", "GuiShell\GuiShell.csproj", "{75C69F05-44DD-4722-8664-10C0AFF2BFFE}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LoadTest", "LoadTest\LoadTest.vcxproj", "{D2309040-E57B-41CB-AAA4-C930FFB97032}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Hijacker", "Hijacker\Hijacker.vcxproj", "{F927A9DA-AFA4-434B-8B5A-82C41954A7F5}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IbWinCpp", "external\build\_deps\ibwincpp-build\IbWinCpp.vcxproj", "{D04F5FF3-6D8B-3718-BE85-2AAC74820582}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IbEverything", "external\build\_deps\ibeverything-build\IbEverything.vcxproj", "{3D68712A-BAF7-3103-8454-1FC988C101D1}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Any CPU = Debug|Any CPU 21 | Debug|x64 = Debug|x64 22 | Debug|x86 = Debug|x86 23 | MinSizeRel|Any CPU = MinSizeRel|Any CPU 24 | MinSizeRel|x64 = MinSizeRel|x64 25 | MinSizeRel|x86 = MinSizeRel|x86 26 | Release|Any CPU = Release|Any CPU 27 | Release|x64 = Release|x64 28 | Release|x86 = Release|x86 29 | RelWithDebInfo|Any CPU = RelWithDebInfo|Any CPU 30 | RelWithDebInfo|x64 = RelWithDebInfo|x64 31 | RelWithDebInfo|x86 = RelWithDebInfo|x86 32 | EndGlobalSection 33 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 34 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.Debug|Any CPU.ActiveCfg = Debug|Win32 35 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.Debug|x64.ActiveCfg = Debug|x64 36 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.Debug|x64.Build.0 = Debug|x64 37 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.Debug|x86.ActiveCfg = Debug|Win32 38 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.Debug|x86.Build.0 = Debug|Win32 39 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.MinSizeRel|Any CPU.ActiveCfg = Release|x64 40 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.MinSizeRel|Any CPU.Build.0 = Release|x64 41 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.MinSizeRel|Any CPU.Deploy.0 = Release|x64 42 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.MinSizeRel|x64.ActiveCfg = Release|x64 43 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.MinSizeRel|x64.Build.0 = Release|x64 44 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.MinSizeRel|x64.Deploy.0 = Release|x64 45 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.MinSizeRel|x86.ActiveCfg = Release|Win32 46 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.MinSizeRel|x86.Build.0 = Release|Win32 47 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.MinSizeRel|x86.Deploy.0 = Release|Win32 48 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.Release|Any CPU.ActiveCfg = Release|Win32 49 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.Release|x64.ActiveCfg = Release|x64 50 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.Release|x64.Build.0 = Release|x64 51 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.Release|x86.ActiveCfg = Release|Win32 52 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.Release|x86.Build.0 = Release|Win32 53 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.RelWithDebInfo|Any CPU.ActiveCfg = Release|x64 54 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.RelWithDebInfo|Any CPU.Build.0 = Release|x64 55 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.RelWithDebInfo|Any CPU.Deploy.0 = Release|x64 56 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.RelWithDebInfo|x64.ActiveCfg = Release|x64 57 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.RelWithDebInfo|x64.Build.0 = Release|x64 58 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.RelWithDebInfo|x64.Deploy.0 = Release|x64 59 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 60 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.RelWithDebInfo|x86.Build.0 = Release|Win32 61 | {5DDB17FB-F4A0-40D6-9663-86C4F37FCFF2}.RelWithDebInfo|x86.Deploy.0 = Release|Win32 62 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 63 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Debug|Any CPU.Build.0 = Debug|Any CPU 64 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Debug|x64.ActiveCfg = Debug|Any CPU 65 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Debug|x64.Build.0 = Debug|Any CPU 66 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Debug|x86.ActiveCfg = Debug|Any CPU 67 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Debug|x86.Build.0 = Debug|Any CPU 68 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU 69 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU 70 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.MinSizeRel|x64.ActiveCfg = Release|Any CPU 71 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.MinSizeRel|x64.Build.0 = Release|Any CPU 72 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.MinSizeRel|x86.ActiveCfg = Release|Any CPU 73 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.MinSizeRel|x86.Build.0 = Release|Any CPU 74 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Release|Any CPU.ActiveCfg = Release|Any CPU 75 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Release|Any CPU.Build.0 = Release|Any CPU 76 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Release|x64.ActiveCfg = Release|Any CPU 77 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Release|x64.Build.0 = Release|Any CPU 78 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Release|x86.ActiveCfg = Release|Any CPU 79 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.Release|x86.Build.0 = Release|Any CPU 80 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU 81 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU 82 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU 83 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.RelWithDebInfo|x64.Build.0 = Release|Any CPU 84 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU 85 | {75C69F05-44DD-4722-8664-10C0AFF2BFFE}.RelWithDebInfo|x86.Build.0 = Release|Any CPU 86 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.Debug|Any CPU.ActiveCfg = Debug|Win32 87 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.Debug|x64.ActiveCfg = Debug|x64 88 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.Debug|x64.Build.0 = Debug|x64 89 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.Debug|x86.ActiveCfg = Debug|Win32 90 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.Debug|x86.Build.0 = Debug|Win32 91 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.MinSizeRel|Any CPU.ActiveCfg = Release|x64 92 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.MinSizeRel|Any CPU.Build.0 = Release|x64 93 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.MinSizeRel|x64.ActiveCfg = Release|x64 94 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.MinSizeRel|x64.Build.0 = Release|x64 95 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.MinSizeRel|x86.ActiveCfg = Release|Win32 96 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.MinSizeRel|x86.Build.0 = Release|Win32 97 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.Release|Any CPU.ActiveCfg = Release|Win32 98 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.Release|x64.ActiveCfg = Release|x64 99 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.Release|x64.Build.0 = Release|x64 100 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.Release|x86.ActiveCfg = Release|Win32 101 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.Release|x86.Build.0 = Release|Win32 102 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.RelWithDebInfo|Any CPU.ActiveCfg = Release|x64 103 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.RelWithDebInfo|Any CPU.Build.0 = Release|x64 104 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.RelWithDebInfo|x64.ActiveCfg = Release|x64 105 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.RelWithDebInfo|x64.Build.0 = Release|x64 106 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 107 | {D2309040-E57B-41CB-AAA4-C930FFB97032}.RelWithDebInfo|x86.Build.0 = Release|Win32 108 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.Debug|Any CPU.ActiveCfg = Debug|Win32 109 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.Debug|x64.ActiveCfg = Debug|x64 110 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.Debug|x64.Build.0 = Debug|x64 111 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.Debug|x86.ActiveCfg = Debug|Win32 112 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.Debug|x86.Build.0 = Debug|Win32 113 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.MinSizeRel|Any CPU.ActiveCfg = Release|x64 114 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.MinSizeRel|Any CPU.Build.0 = Release|x64 115 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.MinSizeRel|x64.ActiveCfg = Release|x64 116 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.MinSizeRel|x64.Build.0 = Release|x64 117 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.MinSizeRel|x86.ActiveCfg = Release|Win32 118 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.MinSizeRel|x86.Build.0 = Release|Win32 119 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.Release|Any CPU.ActiveCfg = Release|Win32 120 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.Release|x64.ActiveCfg = Release|x64 121 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.Release|x64.Build.0 = Release|x64 122 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.Release|x86.ActiveCfg = Release|Win32 123 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.Release|x86.Build.0 = Release|Win32 124 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.RelWithDebInfo|Any CPU.ActiveCfg = Release|x64 125 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.RelWithDebInfo|Any CPU.Build.0 = Release|x64 126 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.RelWithDebInfo|x64.ActiveCfg = Release|x64 127 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.RelWithDebInfo|x64.Build.0 = Release|x64 128 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 129 | {F927A9DA-AFA4-434B-8B5A-82C41954A7F5}.RelWithDebInfo|x86.Build.0 = Release|Win32 130 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Debug|Any CPU.ActiveCfg = Debug|x64 131 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Debug|Any CPU.Build.0 = Debug|x64 132 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Debug|x64.ActiveCfg = Debug|x64 133 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Debug|x64.Build.0 = Debug|x64 134 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Debug|x86.ActiveCfg = Debug|x64 135 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Debug|x86.Build.0 = Debug|x64 136 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.MinSizeRel|Any CPU.ActiveCfg = MinSizeRel|x64 137 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.MinSizeRel|Any CPU.Build.0 = MinSizeRel|x64 138 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 139 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 140 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.MinSizeRel|x86.ActiveCfg = MinSizeRel|x64 141 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.MinSizeRel|x86.Build.0 = MinSizeRel|x64 142 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Release|Any CPU.ActiveCfg = Release|x64 143 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Release|Any CPU.Build.0 = Release|x64 144 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Release|x64.ActiveCfg = Release|x64 145 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Release|x64.Build.0 = Release|x64 146 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Release|x86.ActiveCfg = Release|x64 147 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.Release|x86.Build.0 = Release|x64 148 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.RelWithDebInfo|Any CPU.ActiveCfg = RelWithDebInfo|x64 149 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.RelWithDebInfo|Any CPU.Build.0 = RelWithDebInfo|x64 150 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 151 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 152 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64 153 | {D04F5FF3-6D8B-3718-BE85-2AAC74820582}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x64 154 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Debug|Any CPU.ActiveCfg = Debug|x64 155 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Debug|Any CPU.Build.0 = Debug|x64 156 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Debug|x64.ActiveCfg = Debug|x64 157 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Debug|x64.Build.0 = Debug|x64 158 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Debug|x86.ActiveCfg = Debug|x64 159 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Debug|x86.Build.0 = Debug|x64 160 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.MinSizeRel|Any CPU.ActiveCfg = MinSizeRel|x64 161 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.MinSizeRel|Any CPU.Build.0 = MinSizeRel|x64 162 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 163 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 164 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.MinSizeRel|x86.ActiveCfg = MinSizeRel|x64 165 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.MinSizeRel|x86.Build.0 = MinSizeRel|x64 166 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Release|Any CPU.ActiveCfg = Release|x64 167 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Release|Any CPU.Build.0 = Release|x64 168 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Release|x64.ActiveCfg = Release|x64 169 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Release|x64.Build.0 = Release|x64 170 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Release|x86.ActiveCfg = Release|x64 171 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.Release|x86.Build.0 = Release|x64 172 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.RelWithDebInfo|Any CPU.ActiveCfg = RelWithDebInfo|x64 173 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.RelWithDebInfo|Any CPU.Build.0 = RelWithDebInfo|x64 174 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 175 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 176 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64 177 | {3D68712A-BAF7-3103-8454-1FC988C101D1}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x64 178 | EndGlobalSection 179 | GlobalSection(SolutionProperties) = preSolution 180 | HideSolutionNode = FALSE 181 | EndGlobalSection 182 | GlobalSection(ExtensibilityGlobals) = postSolution 183 | SolutionGuid = {B4230A74-D43A-463A-B4C3-BD63E11655E2} 184 | EndGlobalSection 185 | EndGlobal 186 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Chaoses-Ib 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LoadTest/LoadTest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | int wmain(int argc, wchar_t* argv[]) 11 | { 12 | _setmode(_fileno(stdout), _O_WTEXT); 13 | 14 | if (argc < 2) { 15 | fmt::print(L"Argument please.\n"); 16 | system("pause"); 17 | return 0; 18 | } 19 | 20 | system("pause"); 21 | 22 | const wchar_t* filename = argv[1]; 23 | fmt::print(L"{}\n", filename); 24 | 25 | HMODULE h = LoadLibraryExW(filename, 0, LOAD_WITH_ALTERED_SEARCH_PATH); 26 | DWORD error = GetLastError(); 27 | fmt::print(L"{}, {}\n", (void*)h, error); 28 | 29 | if (h) { 30 | FARPROC p = GetProcAddress(h, "DVP_InitEx"); 31 | error = GetLastError(); 32 | fmt::print(L"DVP_InitEx: {}, {}\n", (void*)p, error); 33 | } 34 | 35 | system("pause"); 36 | } -------------------------------------------------------------------------------- /LoadTest/LoadTest.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {d2309040-e57b-41cb-aaa4-c930ffb97032} 25 | LoadTest 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | 76 | 77 | false 78 | 79 | 80 | true 81 | 82 | 83 | false 84 | 85 | 86 | x64-windows-static-md 87 | 88 | 89 | x64-windows-static-md 90 | 91 | 92 | x64-windows-static-md 93 | 94 | 95 | x64-windows-static-md 96 | 97 | 98 | 99 | Level3 100 | true 101 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 102 | true 103 | stdcpp17 104 | 105 | 106 | Console 107 | true 108 | 109 | 110 | 111 | 112 | Level3 113 | true 114 | true 115 | true 116 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 117 | true 118 | stdcpp17 119 | 120 | 121 | Console 122 | true 123 | true 124 | true 125 | 126 | 127 | 128 | 129 | Level3 130 | true 131 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 132 | true 133 | stdcpp17 134 | 135 | 136 | Console 137 | true 138 | 139 | 140 | 141 | 142 | Level3 143 | true 144 | true 145 | true 146 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 147 | true 148 | stdcpp17 149 | 150 | 151 | Console 152 | true 153 | true 154 | true 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | {5ddb17fb-f4a0-40d6-9663-86c4f37fcff2} 163 | 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /LoadTest/LoadTest.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IbDOpusExt 2 | Languages: [English](README.md), [简体中文](README.zh-Hans.md) 3 | An extension for [Directory Opus](https://www.gpsoft.com.au/). 4 | 5 | ## Features 6 | * File Display Modes 7 | * Thumbnails 8 | * `#Set MaxThumbSize` command 9 | Dynamically modify the max size of thumbnails. 10 | e.g. `#Set MaxThumbSize = 512` 11 | * File Operations 12 | * Logging 13 | * Configure maximum item number of undo log (v12.23 only) 14 | * Folders 15 | * Folder Behaviour 16 | * Size column via Everything 17 | Display folder sizes instantly with voidtool's [Everything](https://www.voidtools.com/): 18 | ![](docs/images/SizeCol.png) 19 | * Viewer 20 | * Plugins 21 | * Fix dependency loading bug for plugins 22 | * Zip & Other Archives 23 | * Archive and VFS Plugins 24 | * Fix dependency loading bug for plugins 25 | 26 | ## Requirements 27 | * Windows 10 or later 28 | * Directory Opus x64 29 | Tested on v12.29 and v12.23. 30 | * [.NET 6 Runtime](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-6.0.6-windows-x64-installer) 31 | * [VC++ 2022 x64 Runtime](https://aka.ms/vs/17/release/vc_redist.x64.exe) 32 | 33 | ## Installation 34 | 1. Download release package from [Releases](../../releases). 35 | 2. Extract the package and put the files into `C:\Program Files\GPSoftware\Directory Opus` . 36 | 3. Open DOpus, go Settings→Preferences→Viewer→Plugins, check IbDOpusExt, click the Apply button. -------------------------------------------------------------------------------- /README.zh-Hans.md: -------------------------------------------------------------------------------- 1 | # IbDOpusExt 2 | 语言: [English](README.md), [简体中文](README.zh-Hans.md) 3 | 一个 [Directory Opus](https://www.gpsoft.com.au/) 的扩展。 4 | 5 | ## 功能 6 | * 文件显示模式 7 | * 缩略图 8 | * `#Set MaxThumbSize` 命令 9 | 动态修改缩略图的最大尺寸。 10 | 例如:`#Set MaxThumbSize = 512` 11 | * 文件操作 12 | * 日志 13 | * 配置撤销记录的最大数量(仅 v12.23) 14 | * 文件夹 15 | * 文件夹行为 16 | * Everything 尺寸列 17 | 通过 voidtool 的 [Everything](https://www.voidtools.com/) 即时显示文件夹尺寸: 18 | ![](docs/images/SizeCol.png) 19 | * 查看器 20 | * 插件 21 | * 修复插件依赖加载问题 22 | * 压缩包 23 | * 压缩包和 VFS 插件 24 | * 修复插件依赖加载问题 25 | 26 | ## 安装要求 27 | * Windows 10 及以上 28 | * Directory Opus x64 29 | 已在 v12.29 和 v12.23 下测试。 30 | * [.NET 6 运行时](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-6.0.6-windows-x64-installer) 31 | * [VC++ 2022 x64 运行时](https://aka.ms/vs/17/release/vc_redist.x64.exe) 32 | 33 | ## 安装 34 | 1. 从 [Releases](../../releases) 下载压缩包。 35 | 2. 解压压缩包,把文件替换进 `C:\Program Files\GPSoftware\Directory Opus` 。 36 | 3. 打开 DOpus,进入 设置→配置→查看器→插件,勾选 IbDOpusExt,点击“应用”按钮。 -------------------------------------------------------------------------------- /Scripts/IbDOpusExt.SizeCol.js: -------------------------------------------------------------------------------- 1 | function OnInit(initData) 2 | { 3 | initData.name = "IbDOpusExt.SizeCol"; 4 | initData.copyright = "Chaoses Ib"; 5 | initData.version = "v0.5"; 6 | initData.url = "https://github.com/Chaoses-Ib/IbDOpusExt" 7 | initData.default_enable = true; 8 | } 9 | 10 | function OnAddColumns(addColData){ 11 | var col = addColData.AddColumn() 12 | col.name = "Size_ev" 13 | col.method = "OnSize_ev" 14 | col.label = DOpus.strings.Get("column_label") 15 | 16 | col.type = "size"; 17 | col.autogroup = true; 18 | col.autorefresh = 1; 19 | } 20 | 21 | function OnSize_ev(scriptColData){ 22 | if (scriptColData.item.got_size) 23 | scriptColData.value = scriptColData.item.size 24 | else 25 | scriptColData.value = DOpus.FSUtil.GetItem("V:\\Ib\\GetFolderSize\\" + scriptColData.item.realpath + "\\").size 26 | } 27 | 28 | ==SCRIPT RESOURCES 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ViewerPlugin/DOpus.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | #include 4 | #include "helper.hpp" 5 | #include 6 | #include 7 | #include 8 | #include "sigmatch.hpp" 9 | 10 | namespace DOpus { 11 | using eventpp::CallbackList; 12 | 13 | namespace Modules { 14 | class dopus : public ib::Module { 15 | public: 16 | dopus() : Module(ib::ModuleFactory::current_process()) {} 17 | }; 18 | } 19 | 20 | namespace Mem { 21 | inline void* alloc(size_t size) { 22 | /* 23 | if (size == 0) 24 | size = 1; 25 | */ 26 | return HeapAlloc(GetProcessHeap(), 0, size); 27 | //ignore errors 28 | } 29 | 30 | inline void free(void* block) { 31 | HeapFree(GetProcessHeap(), 0, block); 32 | //ignore errors 33 | } 34 | } 35 | /* 36 | class Mem { 37 | public: 38 | //operator new 39 | static inline void* (*Alloc)(size_t size); 40 | //_free_base 41 | static inline void (*Free)(void* block); 42 | Mem(Modules::dopus& dopus) { 43 | Alloc = dopus.base.offset(0xE41630); 44 | Free = dopus.base.offset(0xE89A64); 45 | } 46 | }; 47 | */ 48 | 49 | class Prefs { 50 | public: 51 | Addr base; 52 | Prefs(Modules::dopus& dopus) : base( *((void**)sigmatch_Prefs()) ) { } 53 | }; 54 | 55 | namespace Thumbnails { 56 | class MaxSize { 57 | uint32_t* Pref_MaxThumbSize; 58 | public: 59 | MaxSize(Prefs& prefs) { 60 | Pref_MaxThumbSize = prefs.base.offset(sigmatch_MaxThumbSize()); 61 | //DebugOutput(std::wstringstream() << (void*)prefs.base << L" " << Pref_MaxThumbSize); 62 | } 63 | //Will refresh the max range of trackbars, but won't refresh buttons. 64 | void Set(uint32_t size) { 65 | uint32_t oldsize = std::exchange(*Pref_MaxThumbSize, size); 66 | 67 | using ib::FindWindowEx_i; 68 | for (HWND lister : FindWindowEx_i(0, L"dopus.lister")) { 69 | for (HWND toolbar : FindWindowEx_i(lister, L"dopus.button.display")) { 70 | for (HWND trackbar : FindWindowEx_i(toolbar, L"dopus.trackbar")) { 71 | if (SendMessageW(trackbar, TBM_GETRANGEMIN, 0, 0) == 32 72 | && SendMessageW(trackbar, TBM_GETRANGEMAX, 0, 0) == oldsize) { 73 | SendMessageW(trackbar, TBM_SETRANGEMAX, TRUE, size); 74 | } 75 | } 76 | } 77 | } 78 | 79 | } 80 | uint32_t Get() { 81 | return *Pref_MaxThumbSize; 82 | } 83 | }; 84 | 85 | } 86 | 87 | namespace Command{ 88 | struct CommandNode 89 | { 90 | //node: { next/end, prior, 0, 0, command, ...1 } 91 | //end: { 0, prior, 0, num, 0, 0 } 92 | CommandNode* next; 93 | CommandNode* prior; 94 | uint64_t _2 = 0; 95 | union { 96 | uint64_t _3 = 0; 97 | uint64_t end_size; 98 | }; 99 | wchar* command; //may be null 100 | uint64_t _5 = 1; 101 | private: 102 | void size_assert() { 103 | static_assert(sizeof CommandNode == 48); 104 | } 105 | public: 106 | wstring_view view() { 107 | if (!command) 108 | return {}; 109 | return command; 110 | } 111 | }; 112 | 113 | //#TODO: std::list? 114 | struct CommandContainer { 115 | CommandNode* head; 116 | uint64_t _1 = 0; 117 | CommandNode* tail; 118 | uint64_t _3 = 0; 119 | size_t size; 120 | uint64_t _5 = 0; 121 | uint64_t _6 = 0; 122 | uint64_t _7 = 0; 123 | private: 124 | void size_assert() { 125 | static_assert(sizeof CommandContainer == 64); 126 | } 127 | public: 128 | //#TODO: iterator 129 | 130 | void set_size(size_t new_size) { 131 | size = new_size; 132 | tail->next->end_size = new_size; 133 | } 134 | 135 | //Return the new node. 136 | CommandNode* insert_after(CommandNode* pos, wstring_view command) { 137 | CommandNode* node = Addr(Mem::alloc(sizeof CommandNode)); 138 | node->next = pos->next, 139 | node->prior = pos, 140 | node->_2 = node->_3 = 0, 141 | node->command = Addr(Mem::alloc(sizeof wchar * (command.size() + 1))), 142 | node->_5 = 1; 143 | wcsncpy_s(node->command, command.size() + 1, command.data(), command.size() + 1); 144 | pos->next = pos->next->prior = node; 145 | if (pos == tail) 146 | tail = node; 147 | set_size(size + 1); 148 | return node; 149 | } 150 | 151 | void push_back(wstring_view command) { 152 | insert_after(tail, command); 153 | } 154 | }; 155 | 156 | class EventExecuteCommands { 157 | static inline uint64_t RunCommandB4_TrueDetour(__int64 a1, CommandContainer* commands, __int64 a3, __int64 a4, DWORD* a5) { 158 | before(commands); 159 | return RunCommandB4_True(a1, commands, a3, a4, a5); //commands are not executed when it returns 160 | } 161 | using RunCommandB4_True_t = decltype(RunCommandB4_TrueDetour); 162 | static inline RunCommandB4_True_t* RunCommandB4_True; 163 | public: 164 | static inline CallbackList before; 165 | EventExecuteCommands(Modules::dopus& dopus) { 166 | RunCommandB4_True = sigmatch_RunCommandB4_True(); 167 | IbDetourAttach(&RunCommandB4_True, RunCommandB4_TrueDetour); 168 | } 169 | ~EventExecuteCommands() { 170 | IbDetourDetach(&RunCommandB4_True, RunCommandB4_TrueDetour); 171 | } 172 | }; 173 | 174 | class EventShellExecute { 175 | static inline decltype(&ShellExecuteExW) ShellExecuteExW_real = ShellExecuteExW; 176 | static inline BOOL WINAPI ShellExecuteExW_detour(_Inout_ SHELLEXECUTEINFOW* pExecInfo) { 177 | /* 178 | # Type Name Pre-Call Value Post-Call Value 179 | DWORD cbSize 112 112 180 | ULONG fMask SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE 181 | HWND hwnd 0x00000000001d0480 0x00000000001d0480 182 | LPCTSTR lpVerb NULL NULL 183 | LPCTSTR lpFile 0x0000000004e23290 "#FolderSizeByEverything" 0x0000000004e23290 "#FolderSizeByEverything" 184 | LPCTSTR lpParameters NULL NULL 185 | LPCTSTR lpDirectory 0x0000000004b0a500 "C:\Windows\system32" 0x0000000004b0a500 "C:\Windows\system32" 186 | int nShow SW_SHOWNORMAL SW_SHOWNORMAL 187 | HINSTANCE hInstApp 0 SE_ERR_FNF 188 | void* lpIDList NULL NULL 189 | LPCTSTR lpClass NULL NULL 190 | HKEY hkeyClass NULL NULL 191 | DWORD dwHotKey 0 0 192 | union { hIcon = NULL, hMonitor = NULL } { hIcon = NULL, hMonitor = NULL } 193 | HANDLE hProcess NULL NULL 194 | */ 195 | int ignore = 0; 196 | before(pExecInfo, ignore); 197 | if (ignore) 198 | return ignore == 1; 199 | return ShellExecuteExW_real(pExecInfo); 200 | } 201 | public: 202 | static inline CallbackList before; 203 | 204 | EventShellExecute() { 205 | IbDetourAttach(&ShellExecuteExW_real, ShellExecuteExW_detour); 206 | } 207 | ~EventShellExecute() { 208 | IbDetourDetach(&ShellExecuteExW_real, ShellExecuteExW_detour); 209 | } 210 | }; 211 | 212 | /* 213 | class VFile { 214 | static inline HANDLE fake_handle = Addr(CreateFileW).align_up(4) + 1; 215 | 216 | static inline decltype(&CreateFileW) CreateFileW_real = CreateFileW; 217 | static inline HANDLE WINAPI CreateFileW_detour( 218 | _In_ LPCWSTR lpFileName, 219 | _In_ DWORD dwDesiredAccess, 220 | _In_ DWORD dwShareMode, 221 | _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, 222 | _In_ DWORD dwCreationDisposition, 223 | _In_ DWORD dwFlagsAndAttributes, 224 | _In_opt_ HANDLE hTemplateFile 225 | ) 226 | { 227 | if (wstring_view(lpFileName).rfind(LR"(V:\Ib\GetFolderSize\)", 0) == 0) { 228 | return fake_handle; 229 | } 230 | return CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); 231 | } 232 | public: 233 | VFile() { 234 | IbDetourAttach(&CreateFileW_real, CreateFileW_detour); 235 | } 236 | 237 | ~VFile() { 238 | IbDetourDetach(&CreateFileW_real, CreateFileW_detour); 239 | } 240 | }; 241 | */ 242 | } 243 | } -------------------------------------------------------------------------------- /ViewerPlugin/DOpus/vfs plugins.h: -------------------------------------------------------------------------------- 1 | /* 2 | Directory Opus 9 VFS Plugins 3 | Header File 4 | 5 | (c) Copyright 2007 GP Software 6 | All Rights Reserved 7 | */ 8 | 9 | #ifndef DOPUS_VFSPLUGINS 10 | #define DOPUS_VFSPLUGINS 11 | 12 | // Current version - define VFSPLUGINVERSION when including this file to use an older version 13 | // of the SDK 14 | // Version 1 of the SDK corresponds to Directory Opus 8 15 | // Version 2 corresponds to Directory Opus 9 16 | #ifndef VFSPLUGINVERSION 17 | #define VFSPLUGINVERSION 2 18 | #endif 19 | 20 | 21 | // Plugin information (VFS_Identify) 22 | typedef struct DOpusVFSPluginInfoW 23 | { 24 | UINT cbSize; // Structure size 25 | GUID idPlugin; // Unique identifier for this plugin 26 | DWORD dwVersionHigh; // Version (high) 27 | DWORD dwVersionLow; // Version (low) 28 | DWORD dwFlags; // Flags 29 | DWORD dwCapabilities; // Plugin capabilities 30 | LPWSTR lpszHandlePrefix; // File path prefix the plugin handles, eg "http://" 31 | LPWSTR lpszHandleExts; // File extensions the plugin handles, eg ".xxx;.yyy;.zzz" 32 | LPWSTR lpszName; // Plugin name 33 | LPWSTR lpszDescription; // Plugin description string, eg "Directory Opus RAR Handler" 34 | LPWSTR lpszCopyright; // Copyright string, eg "(c) 2001 GP Software" 35 | LPWSTR lpszURL; // Reference URL, eg "http://www.gpsoft.com.au" 36 | UINT cchHandlePrefixMax; // Max. length of buffer 37 | UINT cchHandleExtsMax; // Max. length of buffer 38 | UINT cchNameMax; // Max. length of buffer 39 | UINT cchDescriptionMax; // Max. length of buffer 40 | UINT cchCopyrightMax; // Max. length of buffer 41 | UINT cchURLMax; // Max. length of buffer 42 | #if ( VFSPLUGINVERSION >= 2 ) 43 | DWORD dwOpusVerMajor; // Opus major version 44 | DWORD dwOpusVerMinor; // Opus minor version 45 | DWORD dwInitFlags; // Initialisation flags 46 | HICON hIconSmall; // Small icon (Opus will call DestroyIcon on this) 47 | HICON hIconLarge; // Large icon (Opus will call DestroyIcon on this) 48 | #endif 49 | } VFSPLUGININFOW, * LPVFSPLUGININFOW; 50 | 51 | typedef struct DOpusVFSPluginInfoA 52 | { 53 | UINT cbSize; 54 | GUID idPlugin; 55 | DWORD dwVersionHigh; 56 | DWORD dwVersionLow; 57 | DWORD dwFlags; 58 | DWORD dwCapabilities; 59 | LPSTR lpszHandlePrefix; 60 | LPSTR lpszHandleExts; 61 | LPSTR lpszName; 62 | LPSTR lpszDescription; 63 | LPSTR lpszCopyright; 64 | LPSTR lpszURL; 65 | UINT cchHandlePrefixMax; 66 | UINT cchHandleExtsMax; 67 | UINT cchNameMax; 68 | UINT cchDescriptionMax; 69 | UINT cchCopyrightMax; 70 | UINT cchURLMax; 71 | #if ( VFSPLUGINVERSION >= 2 ) 72 | DWORD dwOpusVerMajor; 73 | DWORD dwOpusVerMinor; 74 | DWORD dwInitFlags; 75 | HICON hIconSmall; 76 | HICON hIconLarge; 77 | #endif 78 | } VFSPLUGININFOA, * LPVFSPLUGININFOA; 79 | 80 | #ifdef UNICODE 81 | #define VFSPLUGININFO VFSPLUGININFOW 82 | #define LPVFSPLUGININFO LPVFSPLUGININFOW 83 | #else 84 | #define VFSPLUGININFO VFSPLUGININFOA 85 | #define LPVFSPLUGININFO LPVFSPLUGININFOA 86 | #endif 87 | 88 | 89 | // VIEWERPLUGININFO initialisation flags 90 | #if ( VFSPLUGINVERSION >= 2 ) 91 | #define VFSINITF_FIRSTTIME (1<<0) // First time this plugin has been initialised 92 | #define VFSINITF_USB (1<<1) // Opus is running in USB mode 93 | #endif 94 | 95 | 96 | // Plugin flags 97 | #define VFSF_CANCONFIGURE (1<<0) 98 | #define VFSF_CANSHOWABOUT (1<<1) 99 | #define VFSF_MULTIPLEFORMATS (1<<2) 100 | #if ( VFSPLUGINVERSION >= 2 ) 101 | #define VFSF_NONREENTRANT (1<<3) 102 | #endif 103 | 104 | // Capabilities flags 105 | // Note that not all values in the 32-bit bitmask are used here, however 106 | // they are used internally by Opus and so must NOT be set. They may be 107 | // documented in a future version of this API. 108 | #define VFSCAPABILITY_MOVEBYRENAME (1<<0) 109 | #define VFSCAPABILITY_COPYINDEFINITESIZES (1<<5) 110 | #define VFSCAPABILITY_CANRESUMECOPIES (1<<6) 111 | #define VFSCAPABILITY_TRIGGERRESUME (1<<7) 112 | #define VFSCAPABILITY_POSTCOPYREREAD (1<<8) 113 | #define VFSCAPABILITY_CASESENSITIVE (1<<9) 114 | #define VFSCAPABILITY_RANDOMSEEK (1<<11) 115 | #define VFSCAPABILITY_FILEDESCRIPTIONS (1<<13) 116 | #define VFSCAPABILITY_ALLOWMUSICCOLUMNS (1<<14) 117 | #define VFSCAPABILITY_ALLOWIMAGECOLUMNS (1<<15) 118 | #define VFSCAPABILITY_ALLOWEXTRADATECOLUMNS (1<<16) 119 | #define VFSCAPABILITY_LETMEDOPARENTS (1<<17) 120 | #define VFSCAPABILITY_COMBINEDPROPERTIES (1<<19) 121 | #define VFSCAPABILITY_COMPARETIMENOSECONDS (1<<21) 122 | #define VFSCAPABILITY_GETBATCHFILEINFO (1<<23) 123 | #define VFSCAPABILITY_SLOW (1<<24) 124 | #define VFSCAPABILITY_MULTICREATEDIR (1<<26) 125 | #define VFSCAPABILITY_ALLOWFILEHASH (1<<28) 126 | #define VFSCAPABILITY_READONLY (1<<29) 127 | #define VFSCAPABILITY_CHECKAVAILONDIRCHANGE (1<<30) 128 | 129 | 130 | // Data structure passed to several functions 131 | typedef void * LPVFSFUNCDATA; 132 | 133 | 134 | // Values for vfsReadOp in DOpusVFSReadDirDataA 135 | enum vfsReadType 136 | { 137 | VFSREAD_CHANGEDIR, // Change directory only, don't read directory 138 | VFSREAD_NORMAL, // Read directory as normal 139 | VFSREAD_REFRESH, // Refresh current directory 140 | VFSREAD_PARENT, // Go to parent 141 | VFSREAD_ROOT, // Go to root 142 | VFSREAD_BACK, // Go back 143 | VFSREAD_FORWARD, // Go forward 144 | VFSREAD_PRINTDIR, // Print Directory function 145 | VFSREAD_FREEDIR, // Free any cached directory information 146 | VFSREAD_FREEDIRCLOSE, // Free any cached directory information, lister is closing 147 | }; 148 | 149 | 150 | // File data returned by VFS_ReadDirectory function (MUST be allocated using HeapAlloc() with supplied memory heap) 151 | typedef struct DOpusVFSFileDataHeader 152 | { 153 | UINT cbSize; // Size of this structure 154 | DOpusVFSFileDataHeader* lpNext; // Optional pointer to next file data structure 155 | int iNumItems; // Number of items in this structure 156 | UINT cbFileDataSize; // Size of each item data structure 157 | } VFSFILEDATAHEADER, * LPVFSFILEDATAHEADER; 158 | 159 | 160 | // VFSFILEDATA flags 161 | #define VFSFDF_INDEFINITESIZE (1<<0) // only used for VFS_GetFileInformation 162 | #define VFSFDF_BOLD (1<<1) // display file in bold 163 | #define VFSFDF_SELECTED (1<<2) // file is initially selected 164 | 165 | typedef struct DOpusVFSFileDataColumnA 166 | { 167 | int iColumnId; // Column ID number 168 | LPSTR lpszValue; // String for column (allocate using HeapAlloc()) 169 | } VFSFILEDATACOLUMNA, * LPVFSFILEDATACOLUMNA; 170 | 171 | typedef struct DOpusVFSFileDataColumnW 172 | { 173 | int iColumnId; 174 | LPWSTR lpszValue; 175 | } VFSFILEDATACOLUMNW, * LPVFSFILEDATACOLUMNW; 176 | 177 | #ifdef UNICODE 178 | #define VFSFILEDATACOLUMN VFSFILEDATACOLUMNW 179 | #define LPVFSFILEDATACOLUMN LPVFSFILEDATACOLUMNW 180 | #else 181 | #define VFSFILEDATACOLUMN VFSFILEDATACOLUMNA 182 | #define LPVFSFILEDATACOLUMN LPVFSFILEDATACOLUMNA 183 | #endif 184 | 185 | // Array of DOpusVFSFileData follows DOpusVFSFileDataHeader in memory 186 | typedef struct DOpusVFSFileDataA 187 | { 188 | WIN32_FIND_DATAA wfdData; // Basic file data 189 | DWORD dwFlags; // Custom flags 190 | LPSTR lpszComment; // File comment (allocate using HeapAlloc()) 191 | int iNumColumns; // Number of custom column values supplied 192 | LPVFSFILEDATACOLUMNA lpvfsColumnData; // Custom column values array (allocate using HeapAlloc()) 193 | } VFSFILEDATAA, * LPVFSFILEDATAA; 194 | 195 | typedef struct DOpusVFSFileDataW 196 | { 197 | WIN32_FIND_DATAW wfdData; 198 | DWORD dwFlags; 199 | LPWSTR lpszComment; 200 | int iNumColumns; 201 | LPVFSFILEDATACOLUMNW lpvfsColumnData; 202 | } VFSFILEDATAW, * LPVFSFILEDATAW; 203 | 204 | 205 | #ifdef UNICODE 206 | #define VFSFILEDATA VFSFILEDATAW 207 | #define LPVFSFILEDATA LPVFSFILEDATAW 208 | #else 209 | #define VFSFILEDATA VFSFILEDATAA 210 | #define LPVFSFILEDATA LPVFSFILEDATAA 211 | #endif 212 | 213 | 214 | // Data structure for VFS_ReadDirectory function 215 | typedef struct DOpusVFSReadDirDataA 216 | { 217 | UINT cbSize; // Structure size 218 | HWND hwndParent; // Parent window (for displaying error dialogs, etc) 219 | LPSTR lpszPath; // Path 220 | vfsReadType vfsReadOp; // Read operation 221 | HANDLE hAbortEvent; // Abort event (for read-dir only) 222 | HANDLE hMemHeap; // Memory heap to allocate file data on (use HeapAlloc()) 223 | LPVFSFILEDATAHEADER lpFileData; // File data pointer 224 | } VFSREADDIRDATAA, * LPVFSREADDIRDATAA; 225 | 226 | typedef struct DOpusVFSReadDirDataW 227 | { 228 | UINT cbSize; 229 | HWND hwndParent; 230 | LPWSTR lpszPath; 231 | vfsReadType vfsReadOp; 232 | HANDLE hAbortEvent; 233 | HANDLE hMemHeap; 234 | LPVFSFILEDATAHEADER lpFileData; 235 | } VFSREADDIRDATAW, * LPVFSREADDIRDATAW; 236 | 237 | #ifdef UNICODE 238 | #define VFSREADDIRDATA VFSREADDIRDATAW 239 | #define LPVFSREADDIRDATA LPVFSREADDIRDATAW 240 | #else 241 | #define VFSREADDIRDATA VFSREADDIRDATAA 242 | #define LPVFSREADDIRDATA LPVFSREADDIRDATAA 243 | #endif 244 | 245 | 246 | // VFSPROP_FUNCAVAILABILITY flags 247 | #define BM64(l) (((unsigned __int64)1)<<(l)) 248 | 249 | #define VFSFUNCAVAIL_COPY BM64(0) 250 | #define VFSFUNCAVAIL_MOVE BM64(1) 251 | #define VFSFUNCAVAIL_DELETE BM64(2) 252 | #define VFSFUNCAVAIL_GETSIZES BM64(3) 253 | #define VFSFUNCAVAIL_MAKEDIR BM64(4) 254 | #define VFSFUNCAVAIL_PRINT BM64(5) 255 | #define VFSFUNCAVAIL_PROPERTIES BM64(6) 256 | #define VFSFUNCAVAIL_RENAME BM64(7) 257 | #define VFSFUNCAVAIL_SETATTR BM64(8) 258 | #define VFSFUNCAVAIL_SHORTCUT BM64(9) 259 | #define VFSFUNCAVAIL_SELECTALL BM64(10) 260 | #define VFSFUNCAVAIL_SELECTNONE BM64(11) 261 | #define VFSFUNCAVAIL_SELECTINVERT BM64(12) 262 | #define VFSFUNCAVAIL_VIEWLARGEICONS BM64(13) 263 | #define VFSFUNCAVAIL_VIEWSMALLICONS BM64(14) 264 | #define VFSFUNCAVAIL_VIEWLIST BM64(15) 265 | #define VFSFUNCAVAIL_VIEWDETAILS BM64(16) 266 | #define VFSFUNCAVAIL_VIEWTHUMBNAIL BM64(17) 267 | #define VFSFUNCAVAIL_CLIPCOPY BM64(18) 268 | #define VFSFUNCAVAIL_CLIPCUT BM64(19) 269 | #define VFSFUNCAVAIL_CLIPPASTE BM64(20) 270 | #define VFSFUNCAVAIL_CLIPPASTESHORTCUT BM64(21) 271 | #define VFSFUNCAVAIL_UNDO BM64(22) 272 | #define VFSFUNCAVAIL_SHOW BM64(23) 273 | #define VFSFUNCAVAIL_DUPLICATE BM64(24) 274 | #define VFSFUNCAVAIL_SPLITJOIN BM64(25) 275 | #define VFSFUNCAVAIL_SELECTRESELECT BM64(26) 276 | #define VFSFUNCAVAIL_SELECTALLFILES BM64(27) 277 | #define VFSFUNCAVAIL_SELECTALLDIRS BM64(28) 278 | #define VFSFUNCAVAIL_PLAY BM64(29) 279 | #define VFSFUNCAVAIL_SETTIME BM64(30) 280 | #define VFSFUNCAVAIL_VIEWTILE BM64(31) 281 | #define VFSFUNCAVAIL_SETCOMMENT BM64(32) 282 | 283 | 284 | // Properties 285 | enum vfsProperty 286 | { 287 | VFSPROP_ISEXTRACTABLE, 288 | VFSPROP_USEFULLRENAME, 289 | VFSPROP_SHOWFULLPROGRESSBAR, 290 | VFSPROP_CANDELETETOTRASH, 291 | VFSPROP_CANDELETESECURE, 292 | VFSPROP_COPYBUFFERSIZE, 293 | VFSPROP_DRAGEFFECTS, 294 | VFSPROP_SHOWTHUMBNAILS, 295 | VFSPROP_SHOWFILEINFO, 296 | VFSPROP_ALLOWTOOLTIPGETSIZES, 297 | VFSPROP_CANSHOWSUBFOLDERS, 298 | VFSPROP_FUNCAVAILABILITY, 299 | VFSPROP_SUPPORTFILEHASH, 300 | VFSPROP_GETFOLDERICON, 301 | VFSPROP_SUPPORTPATHCOMPLETION, 302 | #if ( VFSPLUGINVERSION >= 2 ) 303 | VFSPROP_BATCHOPERATION, 304 | VFSPROP_GETVALIDACTIONS, 305 | VFSPROP_SHOWPICTURESDIRECTLY, 306 | #endif 307 | }; 308 | 309 | 310 | // Custom column flags 311 | #define VFSCCF_LEFTJUSTIFY 0 312 | #define VFSCCF_RIGHTJUSTIFY (1<<0) 313 | #define VFSCCF_CENTERJUSTIFY (1<<2) 314 | #define VFSCCF_NUMBER (1<<4) 315 | #define VFSCCF_PERCENT (1<<5) 316 | #define VFSCCF_SIZE (1<<6) 317 | 318 | // VFS_GetCustomColumns data 319 | typedef struct DOpusVFSCustomColumnA 320 | { 321 | UINT cbSize; 322 | DOpusVFSCustomColumnA* lpNext; 323 | LPSTR lpszLabel; 324 | LPSTR lpszKey; 325 | DWORD dwFlags; 326 | int iID; 327 | } VFSCUSTOMCOLUMNA, * LPVFSCUSTOMCOLUMNA; 328 | 329 | typedef struct DOpusVFSCustomColumnW 330 | { 331 | UINT cbSize; 332 | DOpusVFSCustomColumnW* lpNext; 333 | LPWSTR lpszLabel; 334 | LPWSTR lpszKey; 335 | DWORD dwFlags; 336 | int iID; 337 | } VFSCUSTOMCOLUMNW, * LPVFSCUSTOMCOLUMNW; 338 | 339 | #ifdef UNICODE 340 | #define VFSCUSTOMCOLUMN VFSCUSTOMCOLUMNW 341 | #define LPVFSCUSTOMCOLUMN LPVFSCUSTOMCOLUMNW 342 | #else 343 | #define VFSCUSTOMCOLUMN VFSCUSTOMCOLUMNA 344 | #define LPVFSCUSTOMCOLUMN LPVFSCUSTOMCOLUMNA 345 | #endif 346 | 347 | 348 | // Context verb flags 349 | #define DOPUSCVF_ISDIR (1<<3) 350 | 351 | // VFS_ContextVerb data 352 | typedef struct DOpusVFSContextVerbDataA 353 | { 354 | UINT cbSize; // Structure size 355 | HWND hwndParent; // Parent window 356 | LPSTR lpszVerb; // Verb, null=double-click 357 | LPSTR lpszPath; // Path 358 | LPSTR lpszNewPath; // New path for VFSCVRES_CHANGE result 359 | int cchNewPathMax; // Maximum size of new path 360 | UINT uMsg; // Double-click message 361 | WPARAM fwKeys; // Qualifier keys 362 | DWORD dwFlags; // Flags 363 | int iRotateAngle; // Thumbnail rotation angle (if any) 364 | } VFSCONTEXTVERBDATAA, * LPVFSCONTEXTVERBDATAA; 365 | 366 | typedef struct DOpusVFSContextVerbDataW 367 | { 368 | UINT cbSize; 369 | HWND hwndParent; 370 | LPWSTR lpszVerb; 371 | LPWSTR lpszPath; 372 | LPWSTR lpszNewPath; 373 | int cchNewPathMax; 374 | UINT uMsg; 375 | WPARAM fwKeys; 376 | DWORD dwFlags; 377 | int iRotateAngle; 378 | } VFSCONTEXTVERBDATAW, * LPVFSCONTEXTVERBDATAW; 379 | 380 | #ifdef UNICODE 381 | #define VFSCONTEXTVERBDATA VFSCONTEXTVERBDATAW 382 | #define LPVFSCONTEXTVERBDATA LPVFSCONTEXTVERBDATAW 383 | #else 384 | #define VFSCONTEXTVERBDATA VFSCONTEXTVERBDATAA 385 | #define LPVFSCONTEXTVERBDATA LPVFSCONTEXTVERBDATAA 386 | #endif 387 | 388 | // Return values from VFS_ContextVerb 389 | #define VFSCVRES_FAIL 0 390 | #define VFSCVRES_HANDLED 1 391 | #define VFSCVRES_DEFAULT 2 392 | #define VFSCVRES_EXTRACT 3 393 | #define VFSCVRES_CHANGE 4 394 | #define VFSCVRES_CHANGEDIR 5 395 | 396 | 397 | // VFS_GetContextMenu data 398 | typedef struct DOpusVFSContextMenuItemA 399 | { 400 | UINT cbSize; 401 | DWORD dwFlags; 402 | LPSTR lpszLabel; 403 | LPSTR lpszCommand; 404 | } VFSCONTEXTMENUITEMA, * LPVFSCONTEXTMENUITEMA; 405 | 406 | typedef struct DOpusVFSContextMenuItemW 407 | { 408 | UINT cbSize; 409 | DWORD dwFlags; 410 | LPWSTR lpszLabel; 411 | LPWSTR lpszCommand; 412 | } VFSCONTEXTMENUITEMW, * LPVFSCONTEXTMENUITEMW; 413 | 414 | #ifdef UNICODE 415 | #define VFSCONTEXTMENUITEM VFSCONTEXTMENUITEMW 416 | #define LPVFSCONTEXTMENUITEM LPVFSCONTEXTMENUITEMW 417 | #else 418 | #define VFSCONTEXTMENUITEM VFSCONTEXTMENUITEMA 419 | #define LPVFSCONTEXTMENUITEM LPVFSCONTEXTMENUITEMA 420 | #endif 421 | 422 | // VFSCONTEXTMENUITEM flags 423 | #define VFSCMF_CHECKED (1<<0) // Item appears checked 424 | #define VFSCMF_RADIOCHECK (1<<1) // Checkmark uses a radio button 425 | #define VFSCMF_DISABLED (1<<2) // Item is disabled 426 | #define VFSCMF_SEPARATOR (1<<3) // Item is a separator 427 | #define VFSCMF_BEGINSUBMENU (1<<4) // Item is a submenu 428 | #define VFSCMF_ENDSUBMENU (1<<5) // Item is the last in a submenu 429 | 430 | 431 | typedef struct DOpusVFSContextMenuDataA 432 | { 433 | UINT cbSize; 434 | BOOL fAllowContextMenu; 435 | BOOL fDefaultContextMenu; 436 | BOOL fCustomItemsBelow; 437 | LPVFSCONTEXTMENUITEMA lpCustomItems; 438 | int iNumCustomItems; 439 | BOOL fFreeCustomItems; 440 | } VFSCONTEXTMENUDATAA, * LPVFSCONTEXTMENUDATAA; 441 | 442 | typedef struct DOpusVFSContextMenuDataW 443 | { 444 | UINT cbSize; 445 | BOOL fAllowContextMenu; 446 | BOOL fDefaultContextMenu; 447 | BOOL fCustomItemsBelow; 448 | LPVFSCONTEXTMENUITEMW lpCustomItems; 449 | int iNumCustomItems; 450 | BOOL fFreeCustomItems; 451 | } VFSCONTEXTMENUDATAW, * LPVFSCONTEXTMENUDATAW; 452 | 453 | #ifdef UNICODE 454 | #define VFSCONTEXTMENUDATA VFSCONTEXTMENUDATAW 455 | #define LPVFSCONTEXTMENUDATA LPVFSCONTEXTMENUDATAW 456 | #else 457 | #define VFSCONTEXTMENUDATA VFSCONTEXTMENUDATAA 458 | #define LPVFSCONTEXTMENUDATA LPVFSCONTEXTMENUDATAA 459 | #endif 460 | 461 | // VFS_ExtractFiles data 462 | typedef struct DOpusVFSExtractFilesDataA 463 | { 464 | UINT cbSize; // Structure size 465 | HWND hwndParent; // Parent window (for dialogs, etc) 466 | LPSTR lpszDestPath; // Destination path for extraction 467 | LPSTR lpszFiles; // Files to extract, double-null terminated list 468 | DWORD dwFlags; // Flags 469 | } VFSEXTRACTFILESDATAA, * LPVFSEXTRACTFILESDATAA; 470 | 471 | typedef struct DOpusVFSExtractFilesDataW 472 | { 473 | UINT cbSize; 474 | HWND hwndParent; 475 | LPWSTR lpszDestPath; 476 | LPWSTR lpszFiles; 477 | DWORD dwFlags; 478 | } VFSEXTRACTFILESDATAW, * LPVFSEXTRACTFILESDATAW; 479 | 480 | #ifdef UNICODE 481 | #define VFSEXTRACTFILESDATA VFSEXTRACTFILESDATAW 482 | #define LPVFSEXTRACTFILESDATA LPVFSEXTRACTFILESDATAW 483 | #else 484 | #define VFSEXTRACTFILESDATA VFSEXTRACTFILESDATAA 485 | #define LPVFSEXTRACTFILESDATA LPVFSEXTRACTFILESDATAA 486 | #endif 487 | 488 | 489 | // VFS_CreateFile flags 490 | #define VFSCREATEF_MODEMASK 0xf 491 | #define VFSCREATEF_RESUME 0x01000 492 | #define VFSCREATEF_RECURSIVECOPY 0x02000 493 | #define VFSCREATEF_THUMBNAIL 0x04000 494 | #define VFSCREATEF_IGNOREIFSLOW 0x10000 495 | #define VFSCREATEF_BUFFERED 0x20000 496 | 497 | // VFS_CreateDirectory flags 498 | #define VFSCREATEDIRF_COPY (1<<0) 499 | #define VFSCREATEDIRF_MULTIPLE (1<<1) 500 | 501 | // VFS_DeleteFile flags 502 | #define VFSDELETEF_FORCE (1<<0) 503 | #define VFSDELETEF_RECYCLE (1<<1) 504 | #define VFSDELETEF_REPLACE (1<<2) 505 | #define VFSDELETEF_COPYFAILED (1<<3) 506 | #define VFSDELETEF_SOURCERESUME (1<<5) 507 | 508 | // VFS_SeekFile flags 509 | #define VFSSEEKF_RESUME (1<<0) 510 | 511 | 512 | #if ( VFSPLUGINVERSION >= 2 ) 513 | 514 | // VFS_BatchOperation data 515 | 516 | typedef struct DOpusVFSBatchDataA 517 | { 518 | UINT cbSize; // Structure size 519 | HWND hwndParent; // Parent window 520 | HANDLE hAbortEvent; // Abort event 521 | UINT uiOperation; // Operation code 522 | int iNumFiles; // Number of files involved 523 | LPSTR pszFiles; // Double-null terminated list file paths 524 | int* piResults; // Array to return individual file results (0 = success or error code) 525 | LPSTR pszDestPath; // Destination path 526 | DWORD dwFlags; // Flags 527 | LPVOID lpFuncData; // Used in several calls to exported Opus functions 528 | } VFSBATCHDATAA, * LPVFSBATCHDATAA; 529 | 530 | typedef struct DOpusVFSBatchDataW 531 | { 532 | UINT cbSize; // Structure size 533 | HWND hwndParent; // Parent window 534 | HANDLE hAbortEvent; // Abort event 535 | UINT uiOperation; // Operation code 536 | int iNumFiles; // Number of files involved 537 | LPWSTR pszFiles; // Double-null terminated list file paths 538 | int* piResults; // Array to return individual file results (0 = success or error code) 539 | LPTSTR pszDestPath; // Destination path 540 | DWORD dwFlags; // Flags 541 | LPVOID lpFuncData; // Used in several calls to exported Opus functions 542 | } VFSBATCHDATAW, * LPVFSBATCHDATAW; 543 | 544 | #ifdef UNICODE 545 | #define VFSBATCHDATA VFSBATCHDATAW 546 | #define LPVFSBATCHDATA LPVFSBATCHDATAW 547 | #else 548 | #define VFSBATCHDATA VFSBATCHDATAA 549 | #define LPVFSBATCHDATA LPVFSBATCHDATAA 550 | #endif 551 | 552 | #define VFSBATCHOP_ADD 1 // Add files to an archive 553 | #define VFSBATCHOP_EXTRACT 2 // Extract files from an archive 554 | #define VFSBATCHOP_DELETE 3 // Delete files from an archive 555 | 556 | #define VFSBATCHRES_DODEFAULT 0 // Do default operation 557 | #define VFSBATCHRES_SKIP 1 // Skip this file 558 | #define VFSBATCHRES_HANDLED 2 // File has been handled by the batch operation 559 | #define VFSBATCHRES_ABORT 3 // Abort the function 560 | #define VFSBATCHRES_COMPLETE 4 // Operation has been completed for all files 561 | #define VFSBATCHRES_CALLFOREACH (1<<12) // Call batch operation for each file 562 | 563 | // Batch operation flags 564 | #define BATCHF_COPY_PRESERVE_ATTR (1<<0) // Preserve file attributes 565 | #define BATCHF_COPY_PRESERVE_DATE (1<<1) // Preserve file dates 566 | #define BATCHF_COPY_PRESERVE_COMMENTS (1<<2) // Preserve comments 567 | #define BATCHF_COPY_PRESERVE_SECURITY (1<<3) // Preserve security info 568 | #define BATCHF_COPY_ASK_REPLACE (1<<4) // Ask to overwrite existing files 569 | #define BATCHF_COPY_ASK_REPLACE_RO (1<<5) // Ask to overwrite read only files 570 | #define BATCHF_COPY_RENAME (1<<6) // Copy/Move As 571 | #define BATCHF_DELETE_ASK (1<<7) // Ask to begin delete 572 | #define BATCHF_DELETE_ASK_FILES (1<<8) // Ask to delete files 573 | #define BATCHF_DELETE_ASK_FOLDERS (1<<9) // Ask to delete folders 574 | #define BATCHF_DELETE_UNPROTECT (1<<10) // Unprotect automatically 575 | #define BATCHF_DELETE_ALL (1<<11) // Delete all without prompting for each 576 | #define BATCHF_DELETE_QUIET (1<<12) // Don't prompt to begin 577 | #define BATCHF_DELETE_FORCE (1<<13) // Force deletion 578 | #define BATCHF_DELETE_SECURE (1<<14) // Secure delete 579 | #define BATCHF_FILTER (1<<15) // A filter is in force 580 | #define BATCHF_FILTER_FOLDERS (1<<16) // A filter is in force for folders 581 | #define BATCHF_PROGRESS_SUBFOLDERS (1<<17) // Progress bar knows about sub-folder contents 582 | #define BATCHF_COPY_DELETE_ORIGINAL (1<<18) // Operation is a 'Move' - delete original files 583 | 584 | 585 | // Data structure passed to VFS_Init 586 | typedef struct VFSInitData 587 | { 588 | UINT cbSize; // Size of this structure 589 | HWND hwndDOpusMsgWindow; // Plugin manager message window 590 | DWORD dwOpusVerMajor; // Opus major version 591 | DWORD dwOpusVerMinor; // Opus minor version 592 | LPWSTR pszLanguageName; // Current language in use 593 | } VFSINITDATA, * LPVFSINITDATA; 594 | 595 | 596 | // Structure passed to VFS_USBSafe function 597 | #ifndef DEF_OPUSUSBSAFEDATA 598 | #define DEF_OPUSUSBSAFEDATA 599 | 600 | typedef struct OpusUSBSafeData 601 | { 602 | UINT cbSize; // Size of this structure 603 | LPWSTR pszOtherExports; // Fill with double-null terminated list of additional files to export 604 | UINT cchOtherExports; // Size of provided buffer 605 | } OPUSUSBSAFEDATA, * LPOPUSUSBSAFEDATA; 606 | 607 | #endif 608 | 609 | #endif 610 | 611 | 612 | // Exported plugin DLL functions 613 | #define VFSFUNCNAME_IDENTIFYA "VFS_IdentifyA" 614 | #define VFSFUNCNAME_IDENTIFYW "VFS_IdentifyW" 615 | #define VFSFUNCNAME_QUERYPATHA "VFS_QueryPathA" 616 | #define VFSFUNCNAME_QUERYPATHW "VFS_QueryPathW" 617 | #define VFSFUNCNAME_GETCAPABILITIES "VFS_GetCapabilities" 618 | #define VFSFUNCNAME_GETCUSTOMCOLUMNSA "VFS_GetCustomColumnsA" 619 | #define VFSFUNCNAME_GETCUSTOMCOLUMNSW "VFS_GetCustomColumnsW" 620 | #define VFSFUNCNAME_GETPREFIXLISTA "VFS_GetPrefixListA" 621 | #define VFSFUNCNAME_GETPREFIXLISTW "VFS_GetPrefixListW" 622 | #define VFSFUNCNAME_CREATE "VFS_Create" 623 | #define VFSFUNCNAME_CLONE "VFS_Clone" 624 | #define VFSFUNCNAME_DESTROY "VFS_Destroy" 625 | #define VFSFUNCNAME_GETLASTERROR "VFS_GetLastError" 626 | #define VFSFUNCNAME_READDIRECTORYA "VFS_ReadDirectoryA" 627 | #define VFSFUNCNAME_READDIRECTORYW "VFS_ReadDirectoryW" 628 | #define VFSFUNCNAME_GETPATHDISPLAYNAMEA "VFS_GetPathDisplayNameA" 629 | #define VFSFUNCNAME_GETPATHDISPLAYNAMEW "VFS_GetPathDisplayNameW" 630 | #define VFSFUNCNAME_GETPATHPARENTROOTA "VFS_GetPathParentRootA" 631 | #define VFSFUNCNAME_GETPATHPARENTROOTW "VFS_GetPathParentRootW" 632 | #define VFSFUNCNAME_GETFILEINFORMATIONA "VFS_GetFileInformationA" 633 | #define VFSFUNCNAME_GETFILEINFORMATIONW "VFS_GetFileInformationW" 634 | #define VFSFUNCNAME_GETFILEDESCRIPTIONA "VFS_GetFileDescriptionA" 635 | #define VFSFUNCNAME_GETFILEDESCRIPTIONW "VFS_GetFileDescriptionW" 636 | #define VFSFUNCNAME_GETFILEICONA "VFS_GetFileIconA" 637 | #define VFSFUNCNAME_GETFILEICONW "VFS_GetFileIconW" 638 | #define VFSFUNCNAME_CREATEFILEA "VFS_CreateFileA" 639 | #define VFSFUNCNAME_CREATEFILEW "VFS_CreateFileW" 640 | #define VFSFUNCNAME_READFILE "VFS_ReadFile" 641 | #define VFSFUNCNAME_WRITEFILE "VFS_WriteFile" 642 | #define VFSFUNCNAME_SEEKFILE "VFS_SeekFile" 643 | #define VFSFUNCNAME_CLOSEFILE "VFS_CloseFile" 644 | #define VFSFUNCNAME_MOVEFILEA "VFS_MoveFileA" 645 | #define VFSFUNCNAME_MOVEFILEW "VFS_MoveFileW" 646 | #define VFSFUNCNAME_DELETEFILEA "VFS_DeleteFileA" 647 | #define VFSFUNCNAME_DELETEFILEW "VFS_DeleteFileW" 648 | #define VFSFUNCNAME_SETFILETIMEA "VFS_SetFileTimeA" 649 | #define VFSFUNCNAME_SETFILETIMEW "VFS_SetFileTimeW" 650 | #define VFSFUNCNAME_SETFILEATTRA "VFS_SetFileAttrA" 651 | #define VFSFUNCNAME_SETFILEATTRW "VFS_SetFileAttrW" 652 | #define VFSFUNCNAME_GETFILEATTRA "VFS_GetFileAttrA" 653 | #define VFSFUNCNAME_GETFILEATTRW "VFS_GetFileAttrW" 654 | #define VFSFUNCNAME_SETFILECOMMENTA "VFS_SetFileCommentA" 655 | #define VFSFUNCNAME_SETFILECOMMENTW "VFS_SetFileCommentW" 656 | #define VFSFUNCNAME_GETFILECOMMENTA "VFS_GetFileCommentA" 657 | #define VFSFUNCNAME_GETFILECOMMENTW "VFS_GetFileCommentW" 658 | #define VFSFUNCNAME_CREATEDIRECTORYA "VFS_CreateDirectoryA" 659 | #define VFSFUNCNAME_CREATEDIRECTORYW "VFS_CreateDirectoryW" 660 | #define VFSFUNCNAME_REMOVEDIRECTORYA "VFS_RemoveDirectoryA" 661 | #define VFSFUNCNAME_REMOVEDIRECTORYW "VFS_RemoveDirectoryW" 662 | #define VFSFUNCNAME_GETFILESIZEA "VFS_GetFileSizeA" 663 | #define VFSFUNCNAME_GETFILESIZEW "VFS_GetFileSizeW" 664 | #define VFSFUNCNAME_FINDFIRSTFILEA "VFS_FindFirstFileA" 665 | #define VFSFUNCNAME_FINDFIRSTFILEW "VFS_FindFirstFileW" 666 | #define VFSFUNCNAME_FINDNEXTFILEA "VFS_FindNextFileA" 667 | #define VFSFUNCNAME_FINDNEXTFILEW "VFS_FindNextFileW" 668 | #define VFSFUNCNAME_FINDCLOSE "VFS_FindClose" 669 | #define VFSFUNCNAME_PROPGETA "VFS_PropGetA" 670 | #define VFSFUNCNAME_PROPGETW "VFS_PropGetW" 671 | #define VFSFUNCNAME_CONTEXTVERBA "VFS_ContextVerbA" 672 | #define VFSFUNCNAME_CONTEXTVERBW "VFS_ContextVerbW" 673 | #define VFSFUNCNAME_EXTRACTFILESA "VFS_ExtractFilesA" 674 | #define VFSFUNCNAME_EXTRACTFILESW "VFS_ExtractFilesW" 675 | #define VFSFUNCNAME_PROPERTIESA "VFS_PropertiesA" 676 | #define VFSFUNCNAME_PROPERTIESW "VFS_PropertiesW" 677 | #define VFSFUNCNAME_GETCONTEXTMENUA "VFS_GetContextMenuA" 678 | #define VFSFUNCNAME_GETCONTEXTMENUW "VFS_GetContextMenuW" 679 | #define VFSFUNCNAME_GETDROPMENUA "VFS_GetDropMenuA" 680 | #define VFSFUNCNAME_GETDROPMENUW "VFS_GetDropMenuW" 681 | #define VFSFUNCNAME_GETFREEDISKSPACEA "VFS_GetFreeDiskSpaceA" 682 | #define VFSFUNCNAME_GETFREEDISKSPACEW "VFS_GetFreeDiskSpaceW" 683 | #define VFSFUNCNAME_CONFIGURE "VFS_Configure" 684 | #define VFSFUNCNAME_ABOUT "VFS_About" 685 | 686 | #if ( VFSPLUGINVERSION >= 2 ) 687 | #define VFSFUNCNAME_BATCHOPERATIONA "VFS_BatchOperationA" 688 | #define VFSFUNCNAME_BATCHOPERATIONW "VFS_BatchOperationW" 689 | #define VFSFUNCNAME_USBSAFE "VFS_USBSafe" 690 | #define VFSFUNCNAME_INIT "VFS_Init" 691 | #define VFSFUNCNAME_UNINIT "VFS_Uninit" 692 | #endif 693 | 694 | #ifdef UNICODE 695 | #define VFSFUNCNAME_IDENTIFY VFSFUNCNAME_IDENTIFYW 696 | #define VFSFUNCNAME_GETCUSTOMCOLUMNS VFSFUNCNAME_GETCUSTOMCOLUMNSW 697 | #define VFSFUNCNAME_QUERYPATH VFSFUNCNAME_QUERYPATHW 698 | #define VFSFUNCNAME_GETPREFIXLIST VFSFUNCNAME_GETPREFIXLISTW 699 | #define VFSFUNCNAME_READDIRECTORY VFSFUNCNAME_READDIRECTORYW 700 | #define VFSFUNCNAME_GETPATHDISPLAYNAME VFSFUNCNAME_GETPATHDISPLAYNAMEW 701 | #define VFSFUNCNAME_GETPATHPARENTROOT VFSFUNCNAME_GETPATHPARENTROOTW 702 | #define VFSFUNCNAME_GETFILEINFORMATION VFSFUNCNAME_GETFILEINFORMATIONW 703 | #define VFSFUNCNAME_GETFILEDESCRIPTION VFSFUNCNAME_GETFILEDESCRIPTIONW 704 | #define VFSFUNCNAME_GETFILEICON VFSFUNCNAME_GETFILEICONW 705 | #define VFSFUNCNAME_CREATEFILE VFSFUNCNAME_CREATEFILEW 706 | #define VFSFUNCNAME_MOVEFILE VFSFUNCNAME_MOVEFILEW 707 | #define VFSFUNCNAME_DELETEFILE VFSFUNCNAME_DELETEFILEW 708 | #define VFSFUNCNAME_SETFILETIME VFSFUNCNAME_SETFILETIMEW 709 | #define VFSFUNCNAME_SETFILEATTR VFSFUNCNAME_SETFILEATTRW 710 | #define VFSFUNCNAME_GETFILEATTR VFSFUNCNAME_GETFILEATTRW 711 | #define VFSFUNCNAME_GETFILECOMMENT VFSFUNCNAME_GETFILECOMMENTW 712 | #define VFSFUNCNAME_SETFILECOMMENT VFSFUNCNAME_SETFILECOMMENTW 713 | #define VFSFUNCNAME_CREATEDIRECTORY VFSFUNCNAME_CREATEDIRECTORYW 714 | #define VFSFUNCNAME_REMOVEDIRECTORY VFSFUNCNAME_REMOVEDIRECTORYW 715 | #define VFSFUNCNAME_GETFILESIZE VFSFUNCNAME_GETFILESIZEW 716 | #define VFSFUNCNAME_FINDFIRSTFILE VFSFUNCNAME_FINDFIRSTFILEW 717 | #define VFSFUNCNAME_FINDNEXTFILE VFSFUNCNAME_FINDNEXTFILEW 718 | #define VFSFUNCNAME_PROPGET VFSFUNCNAME_PROPGETW 719 | #define VFSFUNCNAME_CONTEXTVERB VFSFUNCNAME_CONTEXTVERBW 720 | #define VFSFUNCNAME_EXTRACTFILES VFSFUNCNAME_EXTRACTFILESW 721 | #define VFSFUNCNAME_PROPERTIES VFSFUNCNAME_PROPERTIESW 722 | #define VFSFUNCNAME_GETCONTEXTMENU VFSFUNCNAME_GETCONTEXTMENUW 723 | #define VFSFUNCNAME_GETDROPMENU VFSFUNCNAME_GETDROPMENUW 724 | #define VFSFUNCNAME_GETFREEDISKSPACE VFSFUNCNAME_GETFREEDISKSPACEW 725 | #if ( VFSPLUGINVERSION >= 2 ) 726 | #define VFSFUNCNAME_BATCHOPERATION VFSFUNCNAME_BATCHOPERATIONW 727 | #endif 728 | #else 729 | #define VFSFUNCNAME_IDENTIFY VFSFUNCNAME_IDENTIFYA 730 | #define VFSFUNCNAME_GETCUSTOMCOLUMNS VFSFUNCNAME_GETCUSTOMCOLUMNSA 731 | #define VFSFUNCNAME_QUERYPATH VFSFUNCNAME_QUERYPATHA 732 | #define VFSFUNCNAME_GETPREFIXLIST VFSFUNCNAME_GETPREFIXLISTA 733 | #define VFSFUNCNAME_READDIRECTORY VFSFUNCNAME_READDIRECTORYA 734 | #define VFSFUNCNAME_GETPATHDISPLAYNAME VFSFUNCNAME_GETPATHDISPLAYNAMEA 735 | #define VFSFUNCNAME_GETPATHPARENTROOT VFSFUNCNAME_GETPATHPARENTROOTA 736 | #define VFSFUNCNAME_GETFILEINFORMATION VFSFUNCNAME_GETFILEINFORMATIONA 737 | #define VFSFUNCNAME_GETFILEDESCRIPTION VFSFUNCNAME_GETFILEDESCRIPTIONA 738 | #define VFSFUNCNAME_GETFILEICON VFSFUNCNAME_GETFILEICONA 739 | #define VFSFUNCNAME_CREATEFILE VFSFUNCNAME_CREATEFILEA 740 | #define VFSFUNCNAME_MOVEFILE VFSFUNCNAME_MOVEFILEA 741 | #define VFSFUNCNAME_DELETEFILE VFSFUNCNAME_DELETEFILEA 742 | #define VFSFUNCNAME_SETFILETIME VFSFUNCNAME_SETFILETIMEA 743 | #define VFSFUNCNAME_SETFILEATTR VFSFUNCNAME_SETFILEATTRA 744 | #define VFSFUNCNAME_GETFILEATTR VFSFUNCNAME_GETFILEATTRA 745 | #define VFSFUNCNAME_SETFILECOMMENT VFSFUNCNAME_SETFILECOMMENTA 746 | #define VFSFUNCNAME_GETFILECOMMENT VFSFUNCNAME_GETFILECOMMENTA 747 | #define VFSFUNCNAME_CREATEDIRECTORY VFSFUNCNAME_CREATEDIRECTORYA 748 | #define VFSFUNCNAME_REMOVEDIRECTORY VFSFUNCNAME_REMOVEDIRECTORYA 749 | #define VFSFUNCNAME_GETFILESIZE VFSFUNCNAME_GETFILESIZEA 750 | #define VFSFUNCNAME_FINDFIRSTFILE VFSFUNCNAME_FINDFIRSTFILEA 751 | #define VFSFUNCNAME_FINDNEXTFILE VFSFUNCNAME_FINDNEXTFILEA 752 | #define VFSFUNCNAME_PROPGET VFSFUNCNAME_PROPGETA 753 | #define VFSFUNCNAME_CONTEXTVERB VFSFUNCNAME_CONTEXTVERBA 754 | #define VFSFUNCNAME_EXTRACTFILES VFSFUNCNAME_EXTRACTFILESA 755 | #define VFSFUNCNAME_PROPERTIES VFSFUNCNAME_PROPERTIESA 756 | #define VFSFUNCNAME_GETCONTEXTMENU VFSFUNCNAME_GETCONTEXTMENUA 757 | #define VFSFUNCNAME_GETDROPMENU VFSFUNCNAME_GETDROPMENUA 758 | #define VFSFUNCNAME_GETFREEDISKSPACE VFSFUNCNAME_GETFREEDISKSPACEA 759 | #if ( VFSPLUGINVERSION >= 2 ) 760 | #define VFSFUNCNAME_BATCHOPERATION VFSFUNCNAME_BATCHOPERATIONW 761 | #endif 762 | #endif 763 | 764 | 765 | // Function prototypes 766 | typedef HANDLE (*PFNVFSCREATE)(LPGUID pGUID,HWND hwndMsgWindow); 767 | typedef HANDLE (*PFNVFSCLONE)(HANDLE hVFSData); 768 | typedef void (*PFNVFSDESTROY)(HANDLE hVFSData); 769 | typedef DWORD (*PFNVFSGETCAPABILITIES)(HANDLE hVFSData); 770 | typedef long (*PFNVFSGETLASTERROR)(HANDLE hVFSData); 771 | typedef BOOL (*PFNVFSREADFILE)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,HANDLE hFile,LPVOID lpData,DWORD dwSize,LPDWORD lpdwReadSize); 772 | typedef BOOL (*PFNVFSWRITEFILE)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,HANDLE hFile,LPVOID lpData,DWORD dwSize,BOOL fFlush,LPDWORD lpdwWriteSize); 773 | typedef BOOL (*PFNVFSSEEKFILE)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,HANDLE hFile,__int64 iPos,DWORD dwMethod,DWORD dwFlags,unsigned __int64* piNewPos); 774 | typedef void (*PFNVFSCLOSEFILE)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,HANDLE hFile); 775 | typedef void (*PFNVFSFINDCLOSE)(HANDLE hVFSData,HANDLE hFind); 776 | typedef HWND (*PFNVFSCONFIGURE)(HWND hWndParent,HWND hWndNotify,DWORD dwNotifyData); 777 | typedef HWND (*PFNVFSABOUT)(HWND hWndParent); 778 | 779 | typedef BOOL (*PFNVFSIDENTIFYA)(LPVFSPLUGININFOA lpVFSInfo); 780 | typedef BOOL (*PFNVFSIDENTIFYW)(LPVFSPLUGININFOW lpVFSInfo); 781 | typedef LPVFSCUSTOMCOLUMNA (*PFNVFSGETCUSTOMCOLUMNSA)(HANDLE hVFSData); 782 | typedef LPVFSCUSTOMCOLUMNW (*PFNVFSGETCUSTOMCOLUMNSW)(HANDLE hVFSData); 783 | typedef BOOL (*PFNVFSQUERYPATHA)(LPSTR lpszPath,BOOL fPrefix,LPGUID pGUID); 784 | typedef BOOL (*PFNVFSQUERYPATHW)(LPWSTR lpszPath,BOOL fPrefix,LPGUID pGUID); 785 | typedef BOOL (*PFNVFSGETPREFIXLISTA)(LPSTR lpszPrefix,int cbPrefixMax); 786 | typedef BOOL (*PFNVFSGETPREFIXLISTW)(LPWSTR lpszPrefix,int cbPrefixMax); 787 | typedef int (*PFNVFSREADDIRECTORYA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPVFSREADDIRDATAA lpReadDirData); 788 | typedef int (*PFNVFSREADDIRECTORYW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPVFSREADDIRDATAW lpReadDirData); 789 | typedef BOOL (*PFNVFSGETPATHDISPLAYNAMEA)(HANDLE hVFSData,LPSTR lpszPath,LPSTR lpszDisplayName,int cbDisplayNameMax); 790 | typedef BOOL (*PFNVFSGETPATHDISPLAYNAMEW)(HANDLE hVFSData,LPWSTR lpszPath,LPWSTR lpszDisplayName,int cbDisplayNameMax); 791 | typedef BOOL (*PFNVFSGETPATHPARENTROOTA)(HANDLE hVFSData,LPSTR lpszPath,BOOL fRoot,LPSTR lpszNewPath,int cbNewPathMax); 792 | typedef BOOL (*PFNVFSGETPATHPARENTROOTW)(HANDLE hVFSData,LPWSTR lpszPath,BOOL fRoot,LPWSTR lpszNewPath,int cbNewPathMax); 793 | typedef LPVFSFILEDATAHEADER (*PFNVFSGETFILEINFORMATIONA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,HANDLE hHeap,DWORD dwFlags); 794 | typedef LPVFSFILEDATAHEADER (*PFNVFSGETFILEINFORMATIONW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,HANDLE hHeap,DWORD dwFlags); 795 | typedef int (*PFNVFSGETFILEDESCRIPTIONA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszFile,LPSTR lpszDescription,int cchDescriptionMax); 796 | typedef int (*PFNVFSGETFILEDESCRIPTIONW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszFile,LPWSTR lpszDescription,int cchDescriptionMax); 797 | typedef BOOL (*PFNVFSGETFILEICONA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszFile,LPINT lpiSysIconIndex,HICON* phLargeIcon,HICON* phSmallIcon,LPBOOL lpfDestroyIcons,LPSTR lspzCacheName,int cchCacheNameMax,LPINT lpiCacheIndex); 798 | typedef BOOL (*PFNVFSGETFILEICONW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszFile,LPINT lpiSysIconIndex,HICON* phLargeIcon,HICON* phSmallIcon,LPBOOL lpfDestroyIcons,LPWSTR lspzCacheName,int cchCacheNameMax,LPINT lpiCacheIndex); 799 | typedef HANDLE (*PFNVFSCREATEFILEA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszFile,DWORD dwMode,DWORD dwFlagsAndAttr,DWORD dwFlags,LPFILETIME lpFT); 800 | typedef HANDLE (*PFNVFSCREATEFILEW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszFile,DWORD dwMode,DWORD dwFlagsAndAttr,DWORD dwFlags,LPFILETIME lpFT); 801 | typedef BOOL (*PFNVFSMOVEFILEA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszOldPath,LPSTR lpszNewName); 802 | typedef BOOL (*PFNVFSMOVEFILEW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszOldPath,LPWSTR lpszNewName); 803 | typedef BOOL (*PFNVFSDELETEFILEA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,DWORD dwFlags,int iSecurePasses); 804 | typedef BOOL (*PFNVFSDELETEFILEW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,DWORD dwFlags,int iSecurePasses); 805 | typedef BOOL (*PFNVFSSETFILETIMEA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,HANDLE hFile,LPFILETIME lpCreateTime,LPFILETIME lpAccessTime,LPFILETIME lpModifyTime); 806 | typedef BOOL (*PFNVFSSETFILETIMEW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,HANDLE hFile,LPFILETIME lpCreateTime,LPFILETIME lpAccessTime,LPFILETIME lpModifyTime); 807 | typedef BOOL (*PFNVFSSETFILEATTRA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,DWORD dwAttr,BOOL fForDelete); 808 | typedef BOOL (*PFNVFSSETFILEATTRW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,DWORD dwAttr,BOOL fForDelete); 809 | typedef BOOL (*PFNVFSGETFILEATTRA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,LPDWORD ldpwAttr); 810 | typedef BOOL (*PFNVFSGETFILEATTRW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,LPDWORD ldpwAttr); 811 | typedef BOOL (*PFNVFSSETFILECOMMENTA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,LPSTR lpszComment); 812 | typedef BOOL (*PFNVFSSETFILECOMMENTW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,LPWSTR lpszComment); 813 | typedef BOOL (*PFNVFSGETFILECOMMENTA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,LPSTR lpszComment,int cchCommentMax); 814 | typedef BOOL (*PFNVFSGETFILECOMMENTW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,LPWSTR lpszComment,int cchCommentMax); 815 | typedef BOOL (*PFNVFSCREATEDIRECTORYA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,DWORD dwFlags); 816 | typedef BOOL (*PFNVFSCREATEDIRECTORYW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,DWORD dwFlags); 817 | typedef BOOL (*PFNVFSREMOVEDIRECTORYA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,DWORD dwFlags); 818 | typedef BOOL (*PFNVFSREMOVEDIRECTORYW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,DWORD dwFlags); 819 | typedef BOOL (*PFNVFSGETFILESIZEA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,HANDLE hFile,unsigned __int64* piFileSize); 820 | typedef BOOL (*PFNVFSGETFILESIZEW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,HANDLE hFile,unsigned __int64* piFileSize); 821 | typedef HANDLE (*PFNVFSFINDFIRSTFILEA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,LPWIN32_FIND_DATAA lpwfdData,HANDLE hAbortEvent); 822 | typedef HANDLE (*PFNVFSFINDFIRSTFILEW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,LPWIN32_FIND_DATAW lpwfdData,HANDLE hAbortEvent); 823 | typedef BOOL (*PFNVFSFINDNEXTFILEA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,HANDLE hFind,LPWIN32_FIND_DATAA lpwfdData); 824 | typedef BOOL (*PFNVFSFINDNEXTFILEW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,HANDLE hFind,LPWIN32_FIND_DATAW lpwfdData); 825 | typedef BOOL (*PFNVFSPROPGETA)(HANDLE hVFSData,vfsProperty propId,LPVOID lpPropData,LPVOID lpData1,LPVOID lpData2,LPVOID lpData3); 826 | typedef BOOL (*PFNVFSPROPGETW)(HANDLE hVFSData,vfsProperty propId,LPVOID lpPropData,LPVOID lpData1,LPVOID lpData2,LPVOID lpData3); 827 | typedef int (*PFNVFSCONTEXTVERBA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPVFSCONTEXTVERBDATAA lpVerbData); 828 | typedef int (*PFNVFSCONTEXTVERBW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPVFSCONTEXTVERBDATAW lpVerbData); 829 | typedef BOOL (*PFNVFSEXTRACTFILESA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPVFSEXTRACTFILESDATAA lpExtractData); 830 | typedef BOOL (*PFNVFSEXTRACTFILESW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPVFSEXTRACTFILESDATAW lpExtractData); 831 | typedef HWND (*PFNVFSPROPERTIESA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,HWND hwndParent,LPSTR lpszFiles); 832 | typedef HWND (*PFNVFSPROPERTIESW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,HWND hwndParent,LPWSTR lpszFiles); 833 | typedef BOOL (*PFNVFSGETFREEDISKSPACEA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,unsigned __int64* piFreeBytesAvailable,unsigned __int64* piTotalBytes,unsigned __int64* piTotalFreeBytes); 834 | typedef BOOL (*PFNVFSGETFREEDISKSPACEW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,unsigned __int64* piFreeBytesAvailable,unsigned __int64* piTotalBytes,unsigned __int64* piTotalFreeBytes); 835 | typedef BOOL (*PFNVFSGETCONTEXTMENUA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszFiles,LPVFSCONTEXTMENUDATAA lpMenuData); 836 | typedef BOOL (*PFNVFSGETCONTEXTMENUW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszFiles,LPVFSCONTEXTMENUDATAW lpMenuData); 837 | typedef BOOL (*PFNVFSGETDROPMENUA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszFiles,LPVFSCONTEXTMENUDATAA lpMenuData,DWORD dwEffects); 838 | typedef BOOL (*PFNVFSGETDROPMENUW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszFiles,LPVFSCONTEXTMENUDATAW lpMenuData,DWORD dwEffects); 839 | #if ( VFSPLUGINVERSION >= 2 ) 840 | typedef UINT (*PFNVFSBATCHOPERATIONA)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPSTR lpszPath,LPVFSBATCHDATAA lpBatchData); 841 | typedef UINT (*PFNVFSBATCHOPERATIONW)(HANDLE hVFSData,LPVFSFUNCDATA lpFuncData,LPWSTR lpszPath,LPVFSBATCHDATAW lpBatchData); 842 | typedef BOOL (*PFNVFSUSBSAFE)(LPOPUSUSBSAFEDATA pUSBSafeData); 843 | typedef BOOL (*PFNVFSINIT)(LPVFSINITDATA pInitData); 844 | typedef void (*PFNVFSUNINIT)(void); 845 | #endif 846 | 847 | #ifdef UNICODE 848 | #define PFNVFSIDENTIFY PFNVFSIDENTIFYW 849 | #define PFNVFSGETCUSTOMCOLUMNS PFNVFSGETCUSTOMCOLUMNSW 850 | #define PFNVFSQUERYPATH PFNVFSQUERYPATHW 851 | #define PFNVFSGETPREFIXLIST PFNVFSGETPREFIXLISTW 852 | #define PFNVFSREADDIRECTORY PFNVFSREADDIRECTORYW 853 | #define PFNVFSGETPATHDISPLAYNAME PFNVFSGETPATHDISPLAYNAMEW 854 | #define PFNVFSGETPATHPARENTROOT PFNVFSGETPATHPARENTROOTW 855 | #define PFNVFSGETFILEINFORMATION PFNVFSGETFILEINFORMATIONW 856 | #define PFNVFSGETFILEDESCRIPTION PFNVFSGETFILEDESCRIPTIONW 857 | #define PFNVFSGETFILEICON PFNVFSGETFILEICONW 858 | #define PFNVFSCREATEFILE PFNVFSCREATEFILEW 859 | #define PFNVFSMOVEFILE PFNVFSMOVEFILEW 860 | #define PFNVFSDELETEFILE PFNVFSDELETEFILEW 861 | #define PFNVFSSETFILETIME PFNVFSSETFILETIMEW 862 | #define PFNVFSSETFILEATTR PFNVFSSETFILEATTRW 863 | #define PFNVFSGETFILEATTR PFNVFSGETFILEATTRW 864 | #define PFNVFSSETFILECOMMENT PFNVFSSETFILECOMMENTW 865 | #define PFNVFSGETFILECOMMENT PFNVFSGETFILECOMMENTW 866 | #define PFNVFSCREATEDIRECTORY PFNVFSCREATEDIRECTORYW 867 | #define PFNVFSREMOVEDIRECTORY PFNVFSREMOVEDIRECTORYW 868 | #define PFNVFSGETFILESIZE PFNVFSGETFILESIZEW 869 | #define PFNVFSFINDFIRSTFILE PFNVFSFINDFIRSTFILEW 870 | #define PFNVFSFINDNEXTFILE PFNVFSFINDNEXTFILEW 871 | #define PFNVFSPROPGET PFNVFSPROPGETW 872 | #define PFNVFSCONTEXTVERB PFNVFSCONTEXTVERBW 873 | #define PFNVFSEXTRACTFILES PFNVFSEXTRACTFILESW 874 | #define PFNVFSPROPERTIES PFNVFSPROPERTIESW 875 | #define PFNVFSGETFREEDISKSPACE PFNVFSGETFREEDISKSPACEW 876 | #define PFNVFSGETCONTEXTMENU PFNVFSGETCONTEXTMENUW 877 | #define PFNVFSGETDROPMENU PFNVFSGETDROPMENUW 878 | #if ( VFSPLUGINVERSION >= 2 ) 879 | #define PVNVFSBATCHOPERATION PVNVFSBATCHOPERATIONW 880 | #endif 881 | #else 882 | #define PFNVFSIDENTIFY PFNVFSIDENTIFYA 883 | #define PFNVFSGETCUSTOMCOLUMNS PFNVFSGETCUSTOMCOLUMNSA 884 | #define PFNVFSQUERYPATH PFNVFSQUERYPATHA 885 | #define PFNVFSGETPREFIXLIST PFNVFSGETPREFIXLISTA 886 | #define PFNVFSREADDIRECTORY PFNVFSREADDIRECTORYA 887 | #define PFNVFSGETPATHDISPLAYNAME PFNVFSGETPATHDISPLAYNAMEA 888 | #define PFNVFSGETPATHPARENTROOT PFNVFSGETPATHPARENTROOTA 889 | #define PFNVFSGETFILEINFORMATION PFNVFSGETFILEINFORMATIONA 890 | #define PFNVFSGETFILEDESCRIPTION PFNVFSGETFILEDESCRIPTIONA 891 | #define PFNVFSGETFILEICON PFNVFSGETFILEICONA 892 | #define PFNVFSCREATEFILE PFNVFSCREATEFILEA 893 | #define PFNVFSMOVEFILE PFNVFSMOVEFILEA 894 | #define PFNVFSDELETEFILE PFNVFSDELETEFILEA 895 | #define PFNVFSSETFILETIME PFNVFSSETFILETIMEA 896 | #define PFNVFSSETFILEATTR PFNVFSSETFILEATTRA 897 | #define PFNVFSGETFILEATTR PFNVFSGETFILEATTRA 898 | #define PFNVFSSETFILECOMMENT PFNVFSSETFILECOMMENTA 899 | #define PFNVFSGETFILECOMMENT PFNVFSGETFILECOMMENTA 900 | #define PFNVFSCREATEDIRECTORY PFNVFSCREATEDIRECTORYA 901 | #define PFNVFSREMOVEDIRECTORY PFNVFSREMOVEDIRECTORYA 902 | #define PFNVFSGETFILESIZE PFNVFSGETFILESIZEA 903 | #define PFNVFSFINDFIRSTFILE PFNVFSFINDFIRSTFILEA 904 | #define PFNVFSFINDNEXTFILE PFNVFSFINDNEXTFILEA 905 | #define PFNVFSPROPGET PFNVFSPROPGETA 906 | #define PFNVFSCONTEXTVERB PFNVFSCONTEXTVERBA 907 | #define PFNVFSEXTRACTFILES PFNVFSEXTRACTFILESA 908 | #define PFNVFSPROPERTIES PFNVFSPROPERTIESA 909 | #define PFNVFSGETFREEDISKSPACE PFNVFSGETFREEDISKSPACEA 910 | #define PFNVFSGETCONTEXTMENU PFNVFSGETCONTEXTMENUA 911 | #define PFNVFSGETDROPMENU PFNVFSGETDROPMENUA 912 | #if ( VFSPLUGINVERSION >= 2 ) 913 | #define PVNVFSBATCHOPERATION PVNVFSBATCHOPERATIONA 914 | #endif 915 | #endif 916 | 917 | // Custom Directory Opus file errors 918 | #define VFSERR_COPY_INTO_ITSELF -2 919 | #define VFSERR_NOT_SUPPORTED -3 920 | #define VFSERR_MOVE_INTO_SAMEDIR -4 921 | #define VFSERR_DIR_ALREADY_EXISTS -5 922 | #define VFSERR_FILE_IS_DIR -6 923 | #define VFSERR_BADLINK -7 924 | #define VFSERR_NOTEXPORTFILE -8 925 | #define VFSERR_NORECYCLEBIN -9 926 | #define VFSERR_RECYCLETOOBIG -10 927 | #define VFSERR_NOPRINTHANDLER -11 928 | #define VFSERR_BADZIPFILE -12 929 | #define VFSERR_GENERALERRMSG -13 930 | #define VFSERR_WRITEPROTECTED -14 931 | #define VFSERR_WRITEPROTECTEDZIP -15 932 | #define VFSERR_ZIPISDIR -16 933 | #define VFSERR_CANTRENAMEFOLDERS -17 934 | #define VFSERR_SHARINGVIOLATION -18 935 | #define VFSERR_ALREADYINCOLL -19 936 | #define VFSERR_CANTCOPYTOCOLLROOT -20 937 | #define VFSERR_NOMOVETOCOLLECTION -21 938 | #define VFSERR_NOJOINTOCOLLECTION -22 939 | #define VFSERR_NODROPDATATOCOLLECTION -23 940 | #define VFSERR_NOCOLLINCOLL -24 941 | #define VFSERR_FEATURENOTENABLED -25 942 | #define VFSERR_UNKNOWNERROR -26 943 | #define VFSERR_CANTCOPYFILEOVERITSELF -27 944 | #define VFSERR_CANTCHANGEZIPCASE -28 945 | #if ( VFSPLUGINVERSION >= 2 ) 946 | #define VFSERR_NOT_EXTRACTABLE -29 947 | #endif 948 | 949 | 950 | // Reinitialise message for VFS_Configure function 951 | #define DVFSPLUGINMSG_REINITIALIZE (WM_APP + 0xfff) 952 | 953 | #endif 954 | 955 | -------------------------------------------------------------------------------- /ViewerPlugin/DOpus/viewer plugins.h: -------------------------------------------------------------------------------- 1 | /* 2 | Directory Opus 9 Viewer Plugins 3 | Header File 4 | 5 | (c) Copyright 2007 GP Software 6 | All Rights Reserved 7 | */ 8 | 9 | #ifndef DOPUS_VIEWERPLUGINS 10 | #define DOPUS_VIEWERPLUGINS 11 | 12 | // Current version - define VIEWERPLUGINVERSION when including this file to use an older version 13 | #ifndef VIEWERPLUGINVERSION 14 | #define VIEWERPLUGINVERSION 4 15 | #endif 16 | 17 | // Taken from winnt.h in case _WIN32_WINNT is not >= 0x0500 18 | #ifndef RTL_SIZEOF_THROUGH_FIELD 19 | #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field)) 20 | #define RTL_SIZEOF_THROUGH_FIELD(type, field) \ 21 | (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field)) 22 | #endif 23 | 24 | // VIEWERPLUGININFO flags 25 | #define DVPFIF_CanHandleStreams (1<<0) // Plugin can handle IStreams to identify and read files 26 | #define DVPFIF_CanHandleBytes (1<<1) // Plugin can identify files based on file header 27 | #define DVPFIF_CatchAll (1<<2) // 'Catch All' plugin wants to be called last 28 | #define DVPFIF_DefaultCatchAll (1<<3) // 'Default Catch All' plugin is last unless there's another 'catch all' 29 | #define DVPFIF_ExtensionsOnly (1<<4) // Plugin only wants to identify files based on file extension 30 | #define DVPFIF_ExtensionsOnlyIfSlow (1<<5) // Plugin looks only at file extensions if file is 'slow' 31 | #define DVPFIF_ExtensionsOnlyIfNoRndSeek (1<<6) // Plugin looks only at file extensions if file doesn't support random seeking 32 | #define DVPFIF_ExtensionsOnlyForThumbnails (1<<7) // Plugin looks only at file extensions if generating thumbnails 33 | #define DVPFIF_NoSlowFiles (1<<8) // Plugin doesn't handle 'slow' files 34 | #define DVPFIF_NeedRandomSeek (1<<9) // Plugin needs random seek capability 35 | #define DVPFIF_CanConfigure (1<<10) // Plugin has a configuration interface 36 | #define DVPFIF_CanShowAbout (1<<11) // Plugin has an About function 37 | #define DVPFIF_NoThumbnails (1<<12) // Plugin doesn't want to be called to generate thumbnails 38 | #define DVPFIF_NoProperties (1<<13) // Don't show 'Properties' item on default context menu 39 | #define DVPFIF_ZeroBytesOk (1<<14) // Zero byte files are ok (eg text files) 40 | #define DVPFIF_OverrideInternal (1<<15) // Plugin can override internal Opus image routines 41 | #if ( VIEWERPLUGINVERSION >= 3 ) 42 | #define DVPFIF_InitialDisable (1<<16) // Plugin is disabled by default 43 | #define DVPFIF_NoFileInformation (1<<17) // Is not to be called for file information (eg Description field) 44 | #define DVPFIF_ProvideFileInfo (1<<18) // Provides information without viewing 45 | #define DVPFIF_NoMultithreadThumbnails (1<<19) // Don't call simultaneously on multiple threads for thumbnails 46 | #define DVPFIF_FolderThumbnails (1<<20) // Can provide folder thumbnails 47 | #define DVPFIF_TrueThumbnailSize (1<<21) // Always provide true thumbnail size 48 | #endif 49 | #if ( VIEWERPLUGINVERSION >= 4 ) 50 | #define DVPFIF_UseVersionResource (1<<22) // Use the plugin's version resource for version information 51 | #define DVPFIF_CanShowHex (1<<23) // The plugin can be used as a hex viewer for any type of file 52 | #define DVPFIF_OnlyThumbnails (1<<24) // Plugin is only to be called for thumbnails 53 | #endif 54 | 55 | // Plugin major types 56 | enum DOpusViewerPluginFileType 57 | { 58 | DVPMajorType_Image, 59 | DVPMajorType_Sound, 60 | DVPMajorType_Text, 61 | DVPMajorType_Other, 62 | DVPMajorType_Movie, 63 | }; 64 | 65 | typedef struct DOpusViewerPluginInfoW 66 | { 67 | UINT cbSize; // Structure size 68 | DWORD dwFlags; // Flags 69 | DWORD dwVersionHigh; // Version (high) 70 | DWORD dwVersionLow; // Version (low) 71 | LPWSTR lpszHandleExts; // File extensions the plugin handles, eg ".xxx;.yyy;.zzz" 72 | LPWSTR lpszName; // Plugin primary file format name, eg "JPEG" 73 | LPWSTR lpszDescription; // Plugin description string, eg "Directory Opus JPEG Viewer" 74 | LPWSTR lpszCopyright; // Copyright string, eg "(c) 2001 GP Software" 75 | LPWSTR lpszURL; // Reference URL, eg "http://www.gpsoft.com.au" 76 | UINT cchHandleExtsMax; // Max. length of buffer 77 | UINT cchNameMax; // Max. length of buffer 78 | UINT cchDescriptionMax; // Max. length of buffer 79 | UINT cchCopyrightMax; // Max. length of buffer 80 | UINT cchURLMax; // Max. length of buffer 81 | DWORDLONG dwlMinFileSize; // Minimum size of file that we handle 82 | DWORDLONG dwlMaxFileSize; // Maximum size of file that we handle 83 | DWORDLONG dwlMinPreviewFileSize; // Minimum size of file that we handle in preview mode 84 | DWORDLONG dwlMaxPreviewFileSize; // Maximum size of file that we handle in preview mode 85 | UINT uiMajorFileType; // Primary type of file this plugin handles 86 | GUID idPlugin; // Unique identifier for this plugin 87 | #if ( VIEWERPLUGINVERSION >= 4 ) 88 | DWORD dwOpusVerMajor; // Opus major version 89 | DWORD dwOpusVerMinor; // Opus minor version 90 | DWORD dwInitFlags; // Initialisation flags 91 | HICON hIconSmall; // Small icon (Opus will call DestroyIcon on this) 92 | HICON hIconLarge; // Large icon (Opus will call DestroyIcon on this) 93 | #endif 94 | } VIEWERPLUGININFOW, * LPVIEWERPLUGININFOW; 95 | 96 | #define VIEWERPLUGININFOW_V1_SIZE (UINT)RTL_SIZEOF_THROUGH_FIELD(VIEWERPLUGININFOW,idPlugin) 97 | #define VIEWERPLUGININFOW_V4_SIZE (UINT)RTL_SIZEOF_THROUGH_FIELD(VIEWERPLUGININFOW,dwInitFlags) 98 | 99 | typedef struct DOpusViewerPluginInfoA 100 | { 101 | UINT cbSize; 102 | DWORD dwFlags; 103 | DWORD dwVersionHigh; 104 | DWORD dwVersionLow; 105 | LPSTR lpszHandleExts; 106 | LPSTR lpszName; 107 | LPSTR lpszDescription; 108 | LPSTR lpszCopyright; 109 | LPSTR lpszURL; 110 | UINT cchHandleExtsMax; 111 | UINT cchNameMax; 112 | UINT cchDescriptionMax; 113 | UINT cchCopyrightMax; 114 | UINT cchURLMax; 115 | DWORDLONG dwlMinFileSize; 116 | DWORDLONG dwlMaxFileSize; 117 | DWORDLONG dwlMinPreviewFileSize; 118 | DWORDLONG dwlMaxPreviewFileSize; 119 | UINT uiMajorFileType; 120 | GUID idPlugin; 121 | #if ( VIEWERPLUGINVERSION >= 4 ) 122 | DWORD dwOpusVerMajor; 123 | DWORD dwOpusVerMinor; 124 | DWORD dwInitFlags; 125 | HICON hIconSmall; 126 | HICON hIconLarge; 127 | #endif 128 | } VIEWERPLUGININFOA, * LPVIEWERPLUGININFOA; 129 | 130 | #define VIEWERPLUGININFOA_V1_SIZE (UINT)RTL_SIZEOF_THROUGH_FIELD(VIEWERPLUGININFOA,idPlugin) 131 | #define VIEWERPLUGININFOA_V4_SIZE (UINT)RTL_SIZEOF_THROUGH_FIELD(VIEWERPLUGININFOA,dwInitFlags) 132 | 133 | #ifdef UNICODE 134 | #define VIEWERPLUGININFO VIEWERPLUGININFOW 135 | #define LPVIEWERPLUGININFO LPVIEWERPLUGININFOW 136 | #define VIEWERPLUGININFO_V1_SIZE VIEWERPLUGININFOW_V1_SIZE 137 | #define VIEWERPLUGININFO_V4_SIZE VIEWERPLUGININFOW_V4_SIZE 138 | #else 139 | #define VIEWERPLUGININFO VIEWERPLUGININFOA 140 | #define LPVIEWERPLUGININFO LPVIEWERPLUGININFOA 141 | #define VIEWERPLUGININFO_V1_SIZE VIEWERPLUGININFOA_V1_SIZE 142 | #define VIEWERPLUGININFO_V4_SIZE VIEWERPLUGININFOA_V4_SIZE 143 | #endif 144 | 145 | // VIEWERPLUGININFO initialisation flags 146 | #if ( VIEWERPLUGINVERSION >= 4 ) 147 | #define VPINITF_FIRSTTIME (1<<0) // First time this plugin has been initialised 148 | #define VPINITF_USB (1<<1) // Opus is running in USB mode 149 | #endif 150 | 151 | 152 | // VIEWERPLUGINFILEINFO flags 153 | #define DVPFIF_CanReturnBitmap (1<<0) // We can return a bitmap for this file type 154 | #define DVPFIF_CanReturnViewer (1<<1) // We can create a viewer for this file type 155 | #define DVPFIF_CanReturnThumbnail (1<<2) // We can return a thumbnail for this filetype (in bitmap form) 156 | #define DVPFIF_CanShowProperties (1<<3) // We can show a Properties dialog for this file 157 | #if ( VIEWERPLUGINVERSION >= 3 ) 158 | #define DVPFIF_ResolutionInch (1<<4) // Resolution is given in DPI 159 | #define DVPFIF_ResolutionCM (1<<5) // Resolution is given in CM 160 | #define DVPFIF_WantFileInfo (1<<6) // Being called for file information 161 | #define DVPFIF_ReturnsText (1<<7) // All we return is text 162 | #define DVPFIF_HasAlphaChannel (1<<8) // Bitmap returned is 32 bits and has valid alpha channel 163 | #define DVPFIF_HasTransparentColor (1<<9) // Use transparent color to generate mask 164 | #define DVPFIF_HasTransparentPen (1<<10) // Use transparent pen to generate mask (upper 8 bits of crTransparentColor) 165 | #define DVPFIF_CanReturnFileInfo (1<<11) // Provides file information 166 | #define DVPFIF_NoThumbnailBorder (1<<12) // Don't display a border for this thumbnail 167 | #define DVPFIF_NoShowThumbnailIcon (1<<13) // Don't display filetype icon for this thumbnail 168 | #define DVPFIF_ShowThumbnailIcon (1<<14) // Force display of filetype icon for this thumbnail 169 | #define DVPFIF_FolderThumbnail (1<<15) // Being called for a folder thumbnail 170 | #define DVPFIF_RegenerateOnResize (1<<16) // Regenerate instead of scale for dynamic resizing 171 | #endif 172 | #if ( VIEWERPLUGINVERSION >= 4 ) 173 | #define DVPFIF_JPEGStream (1<<17) // Plugin has returned a JPEG stream allocated with LocalAlloc(LMEM_FIXED) 174 | #define DVPFIF_PNGStream (1<<18) // Plugin has returned a PNG stream allocated with LocalAlloc(LMEM_FIXED); 175 | #define DVPFIF_InFolderThumbnail (1<<19) // Being called for a thumbnail for a folder (on a file within the folder) 176 | #endif 177 | 178 | enum 179 | { 180 | DVPFITypeHint_None, 181 | DVPFITypeHint_PlainText, 182 | DVPFITypeHint_RichText, 183 | DVPFITypeHint_HTML, 184 | }; 185 | 186 | #if ( VIEWERPLUGINVERSION >= 4 ) 187 | enum 188 | { 189 | DVPColorSpace_Unknown, 190 | DVPColorSpace_Grayscale, 191 | DVPColorSpace_RGB, 192 | DVPColorSpace_YCBCR, 193 | DVPColorSpace_CMYK, 194 | DVPColorSpace_YCCK, 195 | }; 196 | #endif 197 | 198 | typedef struct DOpusViewerPluginFileInfoW 199 | { 200 | UINT cbSize; 201 | DWORD dwFlags; 202 | WORD wMajorType; 203 | WORD wMinorType; 204 | SIZE szImageSize; 205 | int iNumBits; 206 | LPWSTR lpszInfo; 207 | UINT cchInfoMax; 208 | DWORD dwPrivateData[8]; 209 | #if ( VIEWERPLUGINVERSION >= 2 ) 210 | SIZE szResolution; 211 | int iTypeHint; 212 | #endif 213 | #if ( VIEWERPLUGINVERSION >= 3 ) 214 | COLORREF crTransparentColor; 215 | WORD wThumbnailQuality; 216 | DWORDLONG dwlFileSize; 217 | #endif 218 | #if ( VIEWERPLUGINVERSION >= 4 ) 219 | int iColorSpace; 220 | #endif 221 | } VIEWERPLUGINFILEINFOW, * LPVIEWERPLUGINFILEINFOW; 222 | 223 | #define VIEWERPLUGINFILEINFOW_V1_SIZE (UINT)RTL_SIZEOF_THROUGH_FIELD(VIEWERPLUGINFILEINFOW,dwPrivateData[8]) 224 | #define VIEWERPLUGINFILEINFOW_V2_SIZE (UINT)RTL_SIZEOF_THROUGH_FIELD(VIEWERPLUGINFILEINFOW,iTypeHint) 225 | #define VIEWERPLUGINFILEINFOW_V3_SIZE (UINT)RTL_SIZEOF_THROUGH_FIELD(VIEWERPLUGINFILEINFOW,dwlFileSize) 226 | #define VIEWERPLUGINFILEINFOW_V4_SIZE sizeof(VIEWERPLUGINFILEINFOW) 227 | 228 | typedef struct DOpusViewerPluginFileInfoA 229 | { 230 | UINT cbSize; 231 | DWORD dwFlags; 232 | WORD wMajorType; 233 | WORD wMinorType; 234 | SIZE szImageSize; 235 | int iNumBits; 236 | LPSTR lpszInfo; 237 | UINT cchInfoMax; 238 | DWORD dwPrivateData[8]; 239 | #if ( VIEWERPLUGINVERSION >= 2 ) 240 | SIZE szResolution; 241 | int iTypeHint; 242 | #endif 243 | #if ( VIEWERPLUGINVERSION >= 3 ) 244 | COLORREF crTransparentColor; 245 | WORD wThumbnailQuality; 246 | DWORDLONG dwlFileSize; 247 | #endif 248 | #if ( VIEWERPLUGINVERSION >= 4 ) 249 | int iColorSpace; 250 | #endif 251 | } VIEWERPLUGINFILEINFOA, * LPVIEWERPLUGINFILEINFOA; 252 | 253 | #define VIEWERPLUGINFILEINFOA_V1_SIZE (UINT)RTL_SIZEOF_THROUGH_FIELD(VIEWERPLUGINFILEINFOA,dwPrivateData[8]) 254 | #define VIEWERPLUGINFILEINFOA_V2_SIZE (UINT)RTL_SIZEOF_THROUGH_FIELD(VIEWERPLUGINFILEINFOA,iTypeHint) 255 | #define VIEWERPLUGINFILEINFOA_V3_SIZE (UINT)RTL_SIZEOF_THROUGH_FIELD(VIEWERPLUGINFILEINFOA,dwlFileSize) 256 | #define VIEWERPLUGINFILEINFOA_V4_SIZE sizeof(VIEWERPLUGINFILEINFOA) 257 | 258 | #ifdef UNICODE 259 | #define VIEWERPLUGINFILEINFO VIEWERPLUGINFILEINFOW 260 | #define LPVIEWERPLUGINFILEINFO LPVIEWERPLUGINFILEINFOW 261 | #define VIEWERPLUGINFILEINFO_V1_SIZE VIEWERPLUGINFILEINFOW_V1_SIZE 262 | #define VIEWERPLUGINFILEINFO_V2_SIZE VIEWERPLUGINFILEINFOW_V2_SIZE 263 | #define VIEWERPLUGINFILEINFO_V3_SIZE VIEWERPLUGINFILEINFOW_V3_SIZE 264 | #define VIEWERPLUGINFILEINFO_V4_SIZE VIEWERPLUGINFILEINFOW_V4_SIZE 265 | #else 266 | #define VIEWERPLUGINFILEINFO VIEWERPLUGINFILEINFOA 267 | #define LPVIEWERPLUGINFILEINFO LPVIEWERPLUGINFILEINFOA 268 | #define VIEWERPLUGINFILEINFO_V1_SIZE VIEWERPLUGINFILEINFOA_V1_SIZE 269 | #define VIEWERPLUGINFILEINFO_V2_SIZE VIEWERPLUGINFILEINFOA_V2_SIZE 270 | #define VIEWERPLUGINFILEINFO_V3_SIZE VIEWERPLUGINFILEINFOA_V3_SIZE 271 | #define VIEWERPLUGINFILEINFO_V4_SIZE VIEWERPLUGINFILEINFOA_V4_SIZE 272 | #endif 273 | 274 | 275 | // Messages sent to a plugin viewer window 276 | enum DOpusViewerPluginMsg 277 | { 278 | DVPLUGINMSG_BASE = (WM_APP + 0xf00), 279 | 280 | DVPLUGINMSG_LOADA, // Load picture (lParam = LPSTR lpszName) 281 | DVPLUGINMSG_LOADW, // Load picture (lParam = LPWSTR lpszName) 282 | DVPLUGINMSG_LOADSTREAMA, // Load picture (wParam = LPSTR lspzName, lParam = LPSTREAM lpStream) 283 | DVPLUGINMSG_LOADSTREAMW, // Load picture (wParam = LPWSTR lspzName, lParam = LPSTREAM lpStream) 284 | DVPLUGINMSG_GETIMAGEINFOA, // Get info for loaded picture (lParam = LPVIEWERPLUGINFILEINFOA) 285 | DVPLUGINMSG_GETIMAGEINFOW, // Get info for loaded picture (lParam = LPVIEWERPLUGINFILEINFOW) 286 | DVPLUGINMSG_GETCAPABILITIES, // Get viewer capabilities 287 | DVPLUGINMSG_RESIZE, // Resize window (wParam = DWORD left,top lParam = DWORD width, height ) 288 | DVPLUGINMSG_SETROTATION, // Set initial rotation ( wParam = int rotate_angle ) 289 | DVPLUGINMSG_ROTATE, // Rotate image ( wParam = int rotate_amount, lParam = TRUE if window autosize is enabled ) 290 | DVPLUGINMSG_SETZOOM, // Set initial zoom ( wParam = int zoom_factor ) 291 | DVPLUGINMSG_ZOOM, // Zoom image (wParam = int zoom_factor ) 292 | DVPLUGINMSG_GETZOOMFACTOR, // Get current zoom factor 293 | DVPLUGINMSG_SELECTALL, // Select contents 294 | DVPLUGINMSG_TESTSELECTION, // Is there a selection? 295 | DVPLUGINMSG_COPYSELECTION, // Copy selection to clipboard 296 | DVPLUGINMSG_PRINT, // Print picture 297 | DVPLUGINMSG_PROPERTIES, // Show properties dialog ( wParam = HWND hWndParent ) 298 | DVPLUGINMSG_REDRAW, // Redraw (if wParam = TRUE it means the background colour has changed and is supplied in lParam ) 299 | DVPLUGINMSG_GETPICSIZE, // Return size of current image (wParam = LPINT lpiNumBits (optional), lParam = LPSIZE) 300 | DVPLUGINMSG_GETAUTOBGCOL, // Return 'automatic' background colour based on image 301 | DVPLUGINMSG_MOUSEWHEEL, // Mouse wheel message 302 | DVPLUGINMSG_ADDCONTEXTMENUA, // Add items to context menu ( wParam = LPDWORD numItems, result = LPDVPCONTEXTMENUITEMA array) 303 | DVPLUGINMSG_ADDCONTEXTMENUW, // Add items to context menu ( wParam = LPDWORD numItems, result = LPDVPCONTEXTMENUITEMW array) 304 | DVPLUGINMSG_SETABORTEVENT, // Provides an event that is set to abort the loading of a file ( lParam = HANDLE ) 305 | DVPLUGINMSG_GETORIGINALPICSIZE, // Return original size of current image (wParam = LPINT lpiNumBits (optional), lParam = LPSIZE) 306 | DVPLUGINMSG_CLEAR, // Plugin should clear its display and free the current picture 307 | DVPLUGINMSG_NOTIFY_LOADPROGRESS, // Posted from plugin back to owner to notify of load progress ( wParam = percent value complete ) 308 | DVPLUGINMSG_ISDLGMESSAGE, // Plugin should return true if ( lParam = LPMSG ) is a message for one of its dialogs and it has handled it 309 | DVPLUGINMSG_TRANSLATEACCEL, // Plugin should return true if ( lParam = LPMSG ) was handled by its accelerators 310 | DVPLUGINMSG_REINITIALIZE, // Plugin config has changed and viewer should reinitialize itself if necessary 311 | DVPLUGINMSG_SHOWHIDESCROLLBARS, // wParam = BOOL indicating whether scrollbars should be shown or hidden 312 | #if ( VIEWERPLUGINVERSION >= 3 ) 313 | DVPLUGINMSG_INLOADLOOP, // Viewer is currently loading a picture 314 | DVPLUGINMSG_SETIMAGEFRAME, // wParam = BOOL indicating whether image should be framed 315 | DVPLUGINMSG_SETDESKWALLPAPERA, // lParam = optional LPSTR parameters ("center"/"tile"/"stretch") 316 | DVPLUGINMSG_GETZOOMLIMITS, // Return value indicates max/min zoom limits (HIWORD(max), LOWORD(min)) 317 | DVPLUGINMSG_THUMBSCHANGED, // Thumbnails have changed, wParam = DWORD flags 318 | DVPLUGINMSG_GETBITMAP, // Return an HBITMAP representing your current image (will be freed by Directory Opus) 319 | DVPLUGINMSG_GAMMACHANGE, // Gamma correction value has changed 320 | DVPLUGINMSG_APPCOMMAND, // AppCommand message, return TRUE if handled 321 | DVPLUGINMSG_PREVENTFRAME, // Return TRUE to prevent framing of image 322 | DVPLUGINMSG_FULLSCREEN, // Full screen mode has been turned on or off (wParam indicates state, return TRUE to disallow change) 323 | DVPLUGINMSG_SHOWFILEINFO, // Show file information (wParam = BOOL on or off) 324 | DVPLUGINMSG_ISFILEINFOSHOWN, // Returns TRUE if file information is currently visible 325 | DVPLUGINMSG_SETDESKWALLPAPERW, // lParam = optional LPWSTR parameters ("center"/"tile"/"stretch") 326 | #endif 327 | #if ( VIEWERPLUGINVERSION >= 4 ) 328 | DVPLUGINMSG_PREVENTAUTOSIZE, // Return TRUE to prevent auto-sizing of viewer window 329 | DVPLUGINMSG_SHOWHEX, // if wParam = TRUE, lParam contains desired hex state. Return TRUE if in hex mode 330 | DVPLUGINMSG_ISALPHAHIDDEN, // lParam = BOOL*, set to TRUE if alpha channel is currently hidden. Return FALSE if no alpha channel 331 | DVPLUGINMSG_HIDEALPHA, // wParam = TRUE if alpha channel should be hidden 332 | #endif 333 | }; 334 | 335 | #ifdef UNICODE 336 | #define DVPLUGINMSG_LOAD DVPLUGINMSG_LOADW 337 | #define DVPLUGINMSG_LOADSTREAM DVPLUGINMSG_LOADSTREAMW 338 | #define DVPLUGINMSG_GETIMAGEINFO DVPLUGINMSG_GETIMAGEINFOW 339 | #define DVPLUGINMSG_ADDCONTEXTMENU DVPLUGINMSG_ADDCONTEXTMENUW 340 | #define DVPLUGINMSG_SETDESKWALLPAPER DVPLUGINMSG_SETDESKWALLPAPERW 341 | #else 342 | #define DVPLUGINMSG_LOAD DVPLUGINMSG_LOADA 343 | #define DVPLUGINMSG_LOADSTREAM DVPLUGINMSG_LOADSTREAMA 344 | #define DVPLUGINMSG_GETIMAGEINFO DVPLUGINMSG_GETIMAGEINFOA 345 | #define DVPLUGINMSG_ADDCONTEXTMENU DVPLUGINMSG_ADDCONTEXTMENUA 346 | #define DVPLUGINMSG_SETDESKWALLPAPER DVPLUGINMSG_SETDESKWALLPAPERA 347 | #endif 348 | 349 | 350 | // Notification messages sent from a plugin to its parent window 351 | #define DVPN_FIRST (0U-2000U) 352 | #define DVPN_LAST (0U-2020U) 353 | 354 | #define DVPN_GETBGCOL (DVPN_FIRST-0) // Get background color (return value is a COLORREF) 355 | #define DVPN_SIZECHANGE (DVPN_FIRST-1) // Image size has changed (DVPNMSIZECHANGE structure) 356 | #define DVPN_CLICK (DVPN_FIRST-2) // Mouse click (single left button click, DVPNMCLICK structure) 357 | #define DVPN_RESETZOOM (DVPN_FIRST-3) // Reset zoom factor (zoom factor has had to be changed, DVPNMRESETZOOM structure) 358 | #define DVPN_LBUTTONSCROLL (DVPN_FIRST-4) // Get 'left button scroll' flag (return value is BOOL indicating whether left button should be used for scrolling) 359 | #define DVPN_CLEARED (DVPN_FIRST-5) // Picture has been cleared (sent by plugin to tell parent that picture has been cleared from display) 360 | #define DVPN_FOCUSCHANGE (DVPN_FIRST-6) // Focus has changed (DVPNMFOCUSCHANGE structure) 361 | #define DVPN_CAPABILITIES (DVPN_FIRST-7) // Capabilities flags have changed (DVPNMCAPABILITIES structure) 362 | #define DVPN_STATUSTEXT (DVPN_FIRST-8) // Display status text (DVPNMSTATUSTEXT structure) 363 | #if ( VIEWERPLUGINVERSION >= 3 ) 364 | #define DVPN_LOADNEWFILE (DVPN_FIRST-9) // Load a new file (DVPNMLOADNEWFILE structre) 365 | #define DVPN_SETCURSOR (DVPN_FIRST-10) // Set cursor (DVPNMSETCURSOR structure) 366 | #define DVPN_MCLICK (DVPN_FIRST-11) // Middle button click, same as DVPN_CLICK 367 | #define DVPN_GETGAMMA (DVPN_FIRST-12) // Get gamma correction settings (DVPNMGAMMA structure) 368 | #define DVPN_BUTTONOPTS (DVPN_FIRST-13) // Get button options (DVPNMBUTTONOPTS structure) 369 | #define DVPN_GETCURSORS (DVPN_FIRST-14) // Get handles to standard Opus cursors (DVPNMGETCURSORS structure) 370 | #define DVPN_MOUSEWHEEL (DVPN_FIRST-15) // Mouse wheel message (DVPNMMOUSEWHEEL structure) 371 | #endif 372 | #if ( VIEWERPLUGINVERSION >= 4 ) 373 | #define DVPN_HEXSTATE (DVPN_FIRST-16) // Hex state changed (DVPNMHEXSTATE structure) 374 | #endif 375 | 376 | // Notification structure for DVPN_SIZECHANGE 377 | typedef struct tagDVPNMSIZECHANGE 378 | { 379 | NMHDR hdr; 380 | SIZE szSize; 381 | } DVPNMSIZECHANGE, * LPDVPNMSIZECHANGE; 382 | 383 | // Notification structure for DVPN_CLICK 384 | typedef struct tagDVPNMCLICK 385 | { 386 | NMHDR hdr; 387 | POINT pt; 388 | BOOL fMenu; 389 | } DVPNMCLICK, * LPDVPNMCLICK; 390 | 391 | // Notification structure for DVPN_RESETZOOM 392 | typedef struct tagDVPNMRESETZOOM 393 | { 394 | NMHDR hdr; 395 | int iZoom; 396 | } DVPNMRESETZOOM, * LPDVPNMRESETZOOM; 397 | 398 | // Notification structure for DVPN_FOCUSCHANGE 399 | typedef struct tagDVPNMFOCUSCHANGE 400 | { 401 | NMHDR hdr; 402 | BOOL fGotFocus; 403 | } DVPNMFOCUSCHANGE, * LPDVPNMFOCUSCHANGE; 404 | 405 | // Notification structure for DVPN_CAPABILITIES 406 | typedef struct tagDVPNMCAPABILITIES 407 | { 408 | NMHDR hdr; 409 | DWORD dwCapabilities; 410 | } DVPNMCAPABILITIES, * LPDVPNMCAPABILITIES; 411 | 412 | // Notification structure for DVPN_STATUSTEXT 413 | typedef struct tagDVPNMSTATUSTEXT 414 | { 415 | NMHDR hdr; 416 | LPTSTR lpszStatusText; 417 | BOOL fUnicode; 418 | } DVPNMSTATUSTEXT, * LPDVPNMSTATUSTEXT; 419 | 420 | // Notification structure for DVPN_LOADNEWFILE 421 | typedef struct tagDVPNMLOADNEWFILE 422 | { 423 | NMHDR hdr; 424 | LPTSTR lpszFilename; 425 | BOOL fUnicode; 426 | LPSTREAM lpStream; 427 | } DVPNMLOADNEWFILE, * LPDVPNMLOADNEWFILE; 428 | 429 | // Notification structure for DVPN_SETCURSOR 430 | typedef struct tagDVPNMSETCURSOR 431 | { 432 | NMHDR hdr; 433 | POINT pt; 434 | BOOL fMenu; 435 | BOOL fCanScroll; 436 | int iCursor; 437 | } DVPNMSETCURSOR, * LPDVPNMSETCURSOR; 438 | 439 | // Notification structure for DVPN_GETGAMMA 440 | typedef struct tagDVPNMGAMMA 441 | { 442 | NMHDR hdr; 443 | BOOL fEnable; 444 | double dbGamma; 445 | } DVPNMGAMMA, * LPDVPNMGAMMA; 446 | 447 | // Notification structure for DVPN_BUTTONOPTS 448 | typedef struct tagDVPNMBUTTONOPTS 449 | { 450 | NMHDR hdr; 451 | int iLeft; 452 | int iRight; 453 | int iMiddle; 454 | } DVPNMBUTTONOPTS, * LPDVPNMBUTTONOPTS; 455 | 456 | // Button options 457 | enum 458 | { 459 | BUTTONOPT_NONE, 460 | BUTTONOPT_SELECT, 461 | BUTTONOPT_ADVANCE, 462 | BUTTONOPT_SCROLL, 463 | BUTTONOPT_FULLSCREEN, 464 | BUTTONOPT_CLOSE, 465 | }; 466 | 467 | // Notification structure for DVPN_GETCURSORS 468 | typedef struct tagDVPNMGETCURSORS 469 | { 470 | NMHDR hdr; 471 | HCURSOR hCurHandOpen; 472 | HCURSOR hCurHandClosed; 473 | HCURSOR hCurCrosshair; 474 | } DVPNMGETCURSORS, * LPDVPNMGETCURSORS; 475 | 476 | // Zoom constants for DVPLUGINMSG_ZOOM 477 | #define ZOOM_ORIGINAL 0 478 | #define ZOOM_FITPAGE -1 479 | #define ZOOM_TILED -2 480 | 481 | // Cursor constants for DVPN_SETCURSOR 482 | #define VPCURSOR_NONE 0 483 | #define VPCURSOR_DRAG 1 484 | #define VPCURSOR_SELECT 2 485 | 486 | // Notification structure for DVPN_MOUSEWHEEL 487 | typedef struct tagDVPNMMOUSEWHEEL 488 | { 489 | NMHDR hdr; 490 | WPARAM wParam; 491 | LPARAM lParam; 492 | } DVPNMMOUSEWHEEL, * LPDVPNMMOUSEWHEEL; 493 | 494 | // Notification structure for DVPN_HEXSTATE 495 | #if ( VIEWERPLUGINVERSION >= 4 ) 496 | 497 | typedef struct tagDVPNMHEXSTATE 498 | { 499 | NMHDR hdr; 500 | BOOL fState; 501 | } DVNMHEXSTATE, * LPDVPNMHEXSTATE; 502 | 503 | #endif 504 | 505 | 506 | // Viewer capability flags returned by DVPLUGINMSG_GETCAPABILITIES 507 | #define VPCAPABILITY_RESIZE_FIT (1<<0) // Can resize to fit page 508 | #define VPCAPABILITY_RESIZE_ANY (1<<1) // Can resize to any percentage 509 | #define VPCAPABILITY_ROTATE_RIGHTANGLE (1<<2) // Can rotate in steps of 90 degrees 510 | #define VPCAPABILITY_ROTATE_ANY (1<<3) // Can rotate to any angle 511 | #define VPCAPABILITY_SELECTALL (1<<4) // Can 'select all' for clipboard copy 512 | #define VPCAPABILITY_COPYALL (1<<5) // Can 'copy all' to clipboard 513 | #define VPCAPABILITY_COPYSELECTION (1<<6) // Can 'copy selection' to clipboard 514 | #define VPCAPABILITY_PRINT (1<<7) // Can print 515 | #define VPCAPABILITY_WANTFOCUS (1<<8) // Viewer wants input focus 516 | #define VPCAPABILITY_SHOWPROPERTIES (1<<9) // Can show properties dialog 517 | #define VPCAPABILITY_WANTMOUSEWHEEL (1<<10) // Viewer wants to handle mouse wheel itself 518 | #define VPCAPABILITY_ADDCONTEXTMENU (1<<11) // Viewer can add context menu items 519 | #define VPCAPABILITY_HASDIALOGS (1<<12) // Viewer may have dialogs and wants DVPLUGINMSG_ISDLGMESSAGE messages 520 | #define VPCAPABILITY_HASACCELERATORS (1<<13) // Viewer may have accelerators and wants DVPLUGINMSG_TRANSLATEACCEL messages 521 | #if ( VIEWERPLUGINVERSION >= 3 ) 522 | #define VPCAPABILITY_CANSETWALLPAPER (1<<14) // Viewer can set desktop wallpaper 523 | #define VPCAPABILITY_CANTRACKFOCUS (1<<15) // Viewer can reliably track its focus state 524 | #define VPCAPABILITY_SUPPLYBITMAP (1<<16) // Viewer can return a bitmap of its current image 525 | #define VPCAPABILITY_GAMMA (1<<17) // Viewer supports gamma correction 526 | #define VPCAPABILITY_FILEINFO (1<<18) // Viewer can display file information 527 | #endif 528 | #if ( VIEWERPLUGINVERSION >= 4 ) 529 | #define VPCAPABILITY_RESIZE_TILE (1<<19) // Can display a tiled preview 530 | #define VPCAPABILITY_HIDEALPHA (1<<20) // Can hide (ignore) the alpha channel 531 | #define VPCAPABILITY_NOFULLSCREEN (1<<21) // Viewer does not support full screen mode 532 | #endif 533 | 534 | // Flags for DVPLUGINMSG_THUMBSCHANGED 535 | #define DVPTCF_REDRAW (1<<0) 536 | #define DVPTCF_FLUSHCACHE (1<<1) 537 | 538 | // Structure used to add items to the context menu 539 | typedef struct DVPContextMenuItemA 540 | { 541 | LPSTR lpszLabel; 542 | DWORD dwFlags; 543 | UINT uID; 544 | } DVPCONTEXTMENUITEMA, * LPDVPCONTEXTMENUITEMA; 545 | 546 | typedef struct DVPContextMenuItemW 547 | { 548 | LPWSTR lpszLabel; 549 | DWORD dwFlags; 550 | UINT uID; 551 | } DVPCONTEXTMENUITEMW, * LPDVPCONTEXTMENUITEMW; 552 | 553 | #ifdef UNICODE 554 | #define DVPCONTEXTMENUITEM DVPCONTEXTMENUITEMW 555 | #define LPDVPCONTEXTMENUITEM LPDVPCONTEXTMENUITEMW 556 | #else 557 | #define DVPCONTEXTMENUITEM DVPCONTEXTMENUITEMA 558 | #define LPDVPCONTEXTMENUITEM LPDVPCONTEXTMENUITEMA 559 | #endif 560 | 561 | // DVPCONTEXTMENUITEM flags 562 | #define DVPCMF_CHECKED (1<<0) // Item appears checked 563 | #define DVPCMF_RADIOCHECK (1<<1) // Checkmark uses a radio button 564 | #define DVPCMF_DISABLED (1<<2) // Item is disabled 565 | #define DVPCMF_SEPARATOR (1<<3) // Item is a separator 566 | #define DVPCMF_BEGINSUBMENU (1<<4) // Item is a submenu 567 | #define DVPCMF_ENDSUBMENU (1<<5) // Item is the last in a submenu 568 | 569 | 570 | // Structure passed to DVP_USBSafe function 571 | #ifndef DEF_OPUSUSBSAFEDATA 572 | #define DEF_OPUSUSBSAFEDATA 573 | 574 | typedef struct OpusUSBSafeData 575 | { 576 | UINT cbSize; 577 | LPWSTR pszOtherExports; 578 | UINT cchOtherExports; 579 | } OPUSUSBSAFEDATA, * LPOPUSUSBSAFEDATA; 580 | 581 | #endif 582 | 583 | 584 | // Exported plugin DLL functions 585 | #define DVPFUNCNAME_INIT "DVP_Init" 586 | #if ( VIEWERPLUGINVERSION >= 4 ) 587 | #define DVPFUNCNAME_INITEX "DVP_InitEx" 588 | #define DVPFUNCNAME_USBSAFE "DVP_USBSafe" 589 | #endif 590 | #define DVPFUNCNAME_UNINIT "DVP_Uninit" 591 | #define DVPFUNCNAME_IDENTIFYA "DVP_IdentifyA" 592 | #define DVPFUNCNAME_IDENTIFYW "DVP_IdentifyW" 593 | #define DVPFUNCNAME_IDENTIFYFILEA "DVP_IdentifyFileA" 594 | #define DVPFUNCNAME_IDENTIFYFILEW "DVP_IdentifyFileW" 595 | #define DVPFUNCNAME_IDENTIFYFILESTREAMA "DVP_IdentifyFileStreamA" 596 | #define DVPFUNCNAME_IDENTIFYFILESTREAMW "DVP_IdentifyFileStreamW" 597 | #define DVPFUNCNAME_IDENTIFYFILEBYTESA "DVP_IdentifyFileBytesA" 598 | #define DVPFUNCNAME_IDENTIFYFILEBYTESW "DVP_IdentifyFileBytesW" 599 | #define DVPFUNCNAME_LOADBITMAPA "DVP_LoadBitmapA" 600 | #define DVPFUNCNAME_LOADBITMAPW "DVP_LoadBitmapW" 601 | #define DVPFUNCNAME_LOADBITMAPSTREAMA "DVP_LoadBitmapStreamA" 602 | #define DVPFUNCNAME_LOADBITMAPSTREAMW "DVP_LoadBitmapStreamW" 603 | #define DVPFUNCNAME_LOADTEXTA "DVP_LoadTextA" 604 | #define DVPFUNCNAME_LOADTEXTW "DVP_LoadTextW" 605 | #define DVPFUNCNAME_SHOWPROPERTIESA "DVP_ShowPropertiesA" 606 | #define DVPFUNCNAME_SHOWPROPERTIESW "DVP_ShowPropertiesW" 607 | #define DVPFUNCNAME_SHOWPROPERTIESSTREAMA "DVP_ShowPropertiesStreamA" 608 | #define DVPFUNCNAME_SHOWPROPERTIESSTREAMW "DVP_ShowPropertiesStreamW" 609 | #define DVPFUNCNAME_CREATEVIEWER "DVP_CreateViewer" 610 | #define DVPFUNCNAME_CONFIGURE "DVP_Configure" 611 | #define DVPFUNCNAME_ABOUT "DVP_About" 612 | #define DVPFUNCNAME_GETFILEINFOFILEA "DVP_GetFileInfoFileA" 613 | #define DVPFUNCNAME_GETFILEINFOFILEW "DVP_GetFileInfoFileW" 614 | #define DVPFUNCNAME_GETFILEINFOFILESTREAMA "DVP_GetFileInfoFileStreamA" 615 | #define DVPFUNCNAME_GETFILEINFOFILESTREAMW "DVP_GetFileInfoFileStreamW" 616 | 617 | #ifdef UNICODE 618 | #define DVPFUNCNAME_IDENTIFY DVPFUNCNAME_IDENTIFYW 619 | #define DVPFUNCNAME_IDENTIFYFILE DVPFUNCNAME_IDENTIFYFILEW 620 | #define DVPFUNCNAME_IDENTIFYFILESTREAM DVPFUNCNAME_IDENTIFYFILESTREAMW 621 | #define DVPFUNCNAME_IDENTIFYFILEBYTES DVPFUNCNAME_IDENTIFYFILEBYTESW 622 | #define DVPFUNCNAME_LOADBITMAP DVPFUNCNAME_LOADBITMAPW 623 | #define DVPFUNCNAME_LOADBITMAPSTREAM DVPFUNCNAME_LOADBITMAPSTREAMW 624 | #define DVPFUNCNAME_LOADTEXT DVPFUNCNAME_LOADTEXTW 625 | #define DVPFUNCNAME_SHOWPROPERTIES DVPFUNCNAME_SHOWPROPERTIESW 626 | #define DVPFUNCNAME_SHOWPROPERTIESSTREAM DVPFUNCNAME_SHOWPROPERTIESSTREAMW 627 | #define DVPFUNCNAME_GETFILEINFOFILE DVPFUNCNAME_GETFILEINFOFILEW 628 | #define DVPFUNCNAME_GETFILEINFOFILESTREAM DVPFUNCNAME_GETFILEINFOFILESTREAMW 629 | #else 630 | #define DVPFUNCNAME_IDENTIFY DVPFUNCNAME_IDENTIFYA 631 | #define DVPFUNCNAME_IDENTIFYFILE DVPFUNCNAME_IDENTIFYFILEA 632 | #define DVPFUNCNAME_IDENTIFYFILESTREAM DVPFUNCNAME_IDENTIFYFILESTREAMA 633 | #define DVPFUNCNAME_IDENTIFYFILEBYTES DVPFUNCNAME_IDENTIFYFILEBYTESA 634 | #define DVPFUNCNAME_LOADBITMAP DVPFUNCNAME_LOADBITMAPA 635 | #define DVPFUNCNAME_LOADBITMAPSTREAM DVPFUNCNAME_LOADBITMAPSTREAMA 636 | #define DVPFUNCNAME_LOADTEXT DVPFUNCNAME_LOADTEXTA 637 | #define DVPFUNCNAME_SHOWPROPERTIES DVPFUNCNAME_SHOWPROPERTIESA 638 | #define DVPFUNCNAME_SHOWPROPERTIESSTREAM DVPFUNCNAME_SHOWPROPERTIESSTREAMA 639 | #define DVPFUNCNAME_GETFILEINFOFILE DVPFUNCNAME_GETFILEINFOFILEA 640 | #define DVPFUNCNAME_GETFILEINFOFILESTREAM DVPFUNCNAME_GETFILEINFOFILESTREAMA 641 | #endif 642 | 643 | // dwStreamFlags for the Stream functions 644 | #define DVPSF_Slow (1<<0) // Stream refers to 'slow' media 645 | #define DVPSF_NoRandomSeek (1<<1) // Stream does not support random seek (sequential only) 646 | 647 | // dwFlags for the CreateViewer function 648 | #define DVPCVF_Border (1<<1) // Create viewer window with a border 649 | #define DVPCVF_Preview (1<<2) // Viewer is being used for the Lister View Pane 650 | #define DVPCVF_ReturnTabs (1<<3) // Pass tab keypresses (via NM_KEYDOWN message) to parent window 651 | 652 | // Data structure for the DVP_LoadText function 653 | #define DVPCVF_FromStream (1<<0) 654 | 655 | 656 | enum 657 | { 658 | DVPText_Plain, 659 | DVPText_Rich, 660 | DVPText_HTML 661 | }; 662 | 663 | typedef struct DVPLoadTextDataA 664 | { 665 | UINT cbSize; 666 | DWORD dwFlags; 667 | HWND hWndParent; 668 | LPSTR lpszFile; 669 | LPSTREAM lpInStream; 670 | DWORD dwStreamFlags; 671 | LPSTREAM lpOutStream; 672 | int iOutTextType; 673 | CHAR tchPreferredViewer[40]; 674 | HANDLE hAbortEvent; 675 | } DVPLOADTEXTDATAA, * LPDVPLOADTEXTDATAA; 676 | 677 | typedef struct DVPLoadTextDataW 678 | { 679 | UINT cbSize; 680 | DWORD dwFlags; 681 | HWND hWndParent; 682 | LPWSTR lpszFile; 683 | LPSTREAM lpInStream; 684 | DWORD dwStreamFlags; 685 | LPSTREAM lpOutStream; 686 | int iOutTextType; 687 | WCHAR tchPreferredViewer[40]; 688 | HANDLE hAbortEvent; 689 | } DVPLOADTEXTDATAW, * LPDVPLOADTEXTDATAW; 690 | 691 | #ifdef UNICODE 692 | #define DVPLOADTEXTDATA DVPLOADTEXTDATAW 693 | #define LPDVPLOADTEXTDATA LPDVPLOADTEXTDATAW 694 | #else 695 | #define DVPLOADTEXTDATA DVPLOADTEXTDATAA 696 | #define LPDVPLOADTEXTDATA LPDVPLOADTEXTDATAA 697 | #endif 698 | 699 | // File Info stuff 700 | typedef struct DVPFileInfoHeader 701 | { 702 | UINT cbSize; 703 | UINT uiMajorType; 704 | DWORD dwFlags; 705 | } DVPFILEINFOHEADER, * LPDVPFILEINFOHEADER; 706 | 707 | typedef struct DVPFileInfoMusicA 708 | { 709 | DVPFILEINFOHEADER hdr; 710 | LPSTR lpszAlbum; 711 | UINT cchAlbumMax; 712 | LPSTR lpszArtist; 713 | UINT cchArtistMax; 714 | LPSTR lpszTitle; 715 | UINT cchTitleMax; 716 | LPSTR lpszGenre; 717 | UINT cchGenreMax; 718 | LPSTR lpszComment; 719 | UINT cchCommentMax; 720 | LPSTR lpszFormat; 721 | UINT cchFormatMax; 722 | LPSTR lpszEncoder; 723 | UINT cchEncoderMax; 724 | DWORD dwBitRate; 725 | DWORD dwSampleRate; 726 | DWORD dwDuration; 727 | int iTrackNum; 728 | int iYear; 729 | int iNumChannels; 730 | DWORD dwMusicFlags; 731 | LPSTR lpszCodec; 732 | UINT cchCodecMax; 733 | } DVPFILEINFOMUSICA, * LPDVPFILEINFOMUSICA; 734 | 735 | typedef struct DVPFileInfoMusicW 736 | { 737 | DVPFILEINFOHEADER hdr; 738 | LPWSTR lpszAlbum; 739 | UINT cchAlbumMax; 740 | LPWSTR lpszArtist; 741 | UINT cchArtistMax; 742 | LPWSTR lpszTitle; 743 | UINT cchTitleMax; 744 | LPWSTR lpszGenre; 745 | UINT cchGenreMax; 746 | LPWSTR lpszComment; 747 | UINT cchCommentMax; 748 | LPWSTR lpszFormat; 749 | UINT cchFormatMax; 750 | LPWSTR lpszEncoder; 751 | UINT cchEncoderMax; 752 | DWORD dwBitRate; 753 | DWORD dwSampleRate; 754 | DWORD dwDuration; 755 | int iTrackNum; 756 | int iYear; 757 | int iNumChannels; 758 | DWORD dwMusicFlags; 759 | LPWSTR lpszCodec; 760 | UINT cchCodecMax; 761 | } DVPFILEINFOMUSICW, * LPDVPFILEINFOMUSICW; 762 | 763 | #ifdef UNICODE 764 | #define DVPFILEINFOMUSIC DVPFILEINFOMUSICW 765 | #define LPDVPFILEINFOMUSIC LPDVPFILEINFOMUSICW 766 | #else 767 | #define DVPFILEINFOMUSIC DVPFILEINFOMUSICA 768 | #define LPDVPFILEINFOMUSIC LPDVPFILEINFOMUSICA 769 | #endif 770 | 771 | #define DVPMusicFlag_VBR (1<<0) 772 | #define DVPMusicFlag_VBRAccurate (1<<1) 773 | #define DVPMusicFlag_JointStereo (1<<2) 774 | 775 | typedef struct DVPFileInfoMovieA 776 | { 777 | DVPFILEINFOHEADER hdr; 778 | SIZE szVideoSize; 779 | int iNumBits; 780 | DWORD dwDuration; 781 | DWORD dwFrames; 782 | double flFrameRate; 783 | DWORD dwDataRate; 784 | POINT ptAspectRatio; 785 | DWORD dwAudioBitRate; 786 | DWORD dwAudioSampleRate; 787 | int iNumChannels; 788 | LPSTR lpszVideoCodec; 789 | UINT cchVideoCodecMax; 790 | LPSTR lpszAudioCodec; 791 | UINT cchAudioCodecMax; 792 | } DVPFILEINFOMOVIEA, * LPDVPFILEINFOMOVIEA; 793 | 794 | typedef struct DVPFileInfoMovieW 795 | { 796 | DVPFILEINFOHEADER hdr; 797 | SIZE szVideoSize; 798 | int iNumBits; 799 | DWORD dwDuration; 800 | DWORD dwFrames; 801 | double flFrameRate; 802 | DWORD dwDataRate; 803 | POINT ptAspectRatio; 804 | DWORD dwAudioBitRate; 805 | DWORD dwAudioSampleRate; 806 | int iNumChannels; 807 | LPWSTR lpszVideoCodec; 808 | UINT cchVideoCodecMax; 809 | LPWSTR lpszAudioCodec; 810 | UINT cchAudioCodecMax; 811 | } DVPFILEINFOMOVIEW, * LPDVPFILEINFOMOVIEW; 812 | 813 | #ifdef UNICODE 814 | #define DVPFILEINFOMOVIE DVPFILEINFOMOVIEW 815 | #define LPDVPFILEINFOMOVIE LPDVPFILEINFOMOVIEW 816 | #else 817 | #define DVPFILEINFOMOVIE DVPFILEINFOMOVIEA 818 | #define LPDVPFILEINFOMOVIE LPDVPFILEINFOMOVIEA 819 | #endif 820 | 821 | 822 | #if ( VIEWERPLUGINVERSION >= 4 ) 823 | 824 | // Data structure passed to DVP_InitEx 825 | typedef struct DVPInitExData 826 | { 827 | UINT cbSize; 828 | HWND hwndDOpusMsgWindow; 829 | DWORD dwOpusVerMajor; 830 | DWORD dwOpusVerMinor; 831 | LPWSTR pszLanguageName; 832 | } DVPINITEXDATA, * LPDVPINITEXDATA; 833 | 834 | #endif 835 | 836 | 837 | // Function prototypes 838 | typedef BOOL (*PFNDVPINIT)(void); 839 | #if ( VIEWERPLUGINVERSION >= 4 ) 840 | typedef BOOL (*PFNDVPINITEX)(LPDVPINITEXDATA pInitExData); 841 | typedef BOOL (*PFNDVPUSBSAFE)(LPOPUSUSBSAFEDATA pUSBSafeData); 842 | #endif 843 | typedef void (*PFNDVPUNINIT)(void); 844 | typedef BOOL (*PFNDVPIDENTIFYA)(LPVIEWERPLUGININFOA lpVPInfo); 845 | typedef BOOL (*PFNDVPIDENTIFYW)(LPVIEWERPLUGININFOW lpVPInfo); 846 | typedef BOOL (*PFNDVPIDENTIFYFILEA)(HWND hWnd,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,HANDLE hAbortEvent); 847 | typedef BOOL (*PFNDVPIDENTIFYFILEW)(HWND hWnd,LPWSTR lpszName,LPVIEWERPLUGINFILEINFOW lpVPFileInfo,HANDLE hAbortEvent); 848 | typedef BOOL (*PFNDVPIDENTIFYFILESTREAMA)(HWND hWnd,LPSTREAM lpStream,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,DWORD dwStreamFlags); 849 | typedef BOOL (*PFNDVPIDENTIFYFILESTREAMW)(HWND hWnd,LPSTREAM lpStream,LPWSTR lpszName,LPVIEWERPLUGINFILEINFOW lpVPFileInfo,DWORD dwStreamFlags); 850 | typedef BOOL (*PFNDVPIDENTIFYFILEBYTESA)(HWND hWnd,LPSTR lpszName,LPBYTE lpData,UINT uiDataSize,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,DWORD dwStreamFlags); 851 | typedef BOOL (*PFNDVPIDENTIFYFILEBYTESW)(HWND hWnd,LPWSTR lpszName,LPBYTE lpData,UINT uiDataSize,LPVIEWERPLUGINFILEINFOW lpVPFileInfo,DWORD dwStreamFlags); 852 | typedef HBITMAP (*PFNDVPLOADBITMAPA)(HWND hWnd,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,LPSIZE lpszDesiredSize,HANDLE hAbortEvent); 853 | typedef HBITMAP (*PFNDVPLOADBITMAPW)(HWND hWnd,LPWSTR lpszName,LPVIEWERPLUGINFILEINFOW lpVPFileInfo,LPSIZE lpszDesiredSize,HANDLE hAbortEvent); 854 | typedef HBITMAP (*PFNDVPLOADBITMAPSTREAMA)(HWND hWnd,LPSTREAM lpStream,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,LPSIZE lpszDesiredSize,DWORD dwStreamFlags); 855 | typedef HBITMAP (*PFNDVPLOADBITMAPSTREAMW)(HWND hWnd,LPSTREAM lpStream,LPWSTR lpszName,LPVIEWERPLUGINFILEINFOW lpVPFileInfo,LPSIZE lpszDesiredSize,DWORD dwStreamFlags); 856 | typedef BOOL (*PFNDVPLOADTEXTA)(LPDVPLOADTEXTDATAA lpLoadTextData); 857 | typedef BOOL (*PFNDVPLOADTEXTW)(LPDVPLOADTEXTDATAW lpLoadTextData); 858 | typedef HWND (*PFNDVPSHOWPROPERTIESA)(HWND hWndParent,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo); 859 | typedef HWND (*PFNDVPSHOWPROPERTIESW)(HWND hWndParent,LPWSTR lpszName,LPVIEWERPLUGINFILEINFOW lpVPFileInfo); 860 | typedef HWND (*PFNDVPSHOWPROPERTIESSTREAMA)(HWND hWndParent,LPSTREAM lpStream,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,DWORD dwStreamFlags); 861 | typedef HWND (*PFNDVPSHOWPROPERTIESSTREAMW)(HWND hWndParent,LPSTREAM lpStream,LPWSTR lpszName,LPVIEWERPLUGINFILEINFOW lpVPFileInfo,DWORD dwStreamFlags); 862 | typedef HWND (*PFNDVPCREATEVIEWER)(HWND hWndParent,LPRECT lpRc,DWORD dwFlags); 863 | typedef HWND (*PFNDVPCONFIGURE)(HWND hWndParent,HWND hWndNotify,DWORD dwNotifyData); 864 | typedef HWND (*PFNDVPABOUT)(HWND hWndParent); 865 | typedef BOOL (*PFNDVPGETFILEINFOFILEA)(HWND hWnd,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,LPDVPFILEINFOHEADER lpFIH,HANDLE hAbortEvent); 866 | typedef BOOL (*PFNDVPGETFILEINFOFILEW)(HWND hWnd,LPWSTR lpszName,LPVIEWERPLUGINFILEINFOW lpVPFileInfo,LPDVPFILEINFOHEADER lpFIH,HANDLE hAbortEvent); 867 | typedef BOOL (*PFNDVPGETFILEINFOFILESTREAMA)(HWND hWnd,LPSTREAM lpStream,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,LPDVPFILEINFOHEADER lpFIH,DWORD dwStreamFlags); 868 | typedef BOOL (*PFNDVPGETFILEINFOFILESTREAMW)(HWND hWnd,LPSTREAM lpStream,LPWSTR lpszName,LPVIEWERPLUGINFILEINFOW lpVPFileInfo,LPDVPFILEINFOHEADER lpFIH,DWORD dwStreamFlags); 869 | 870 | #ifdef UNICODE 871 | #define PFNDVPIDENTIFY PFNDVPIDENTIFYW 872 | #define PFNDVPIDENTIFYFILE PFNDVPIDENTIFYFILEW 873 | #define PFNDVPIDENTIFYFILESTREAM PFNDVPIDENTIFYFILESTREAMW 874 | #define PFNDVPIDENTIFYFILEBYTES PFNDVPIDENTIFYFILEBYTESW 875 | #define PFNDVPLOADBITMAP PFNDVPLOADBITMAPW 876 | #define PFNDVPLOADBITMAPSTREAM PFNDVPLOADBITMAPSTREAMW 877 | #define PFNDVPLOADTEXT PFNDVPLOADTEXTW 878 | #define PFNDVPSHOWPROPERTIES PFNDVPSHOWPROPERTIESW 879 | #define PFNDVPSHOWPROPERTIESSTREAM PFNDVPSHOWPROPERTIESSTREAMW 880 | #define PFNDVPGETFILEINFOFILE PFNDVPGETFILEINFOFILEW 881 | #define PFNDVPGETFILEINFOFILESTREAM PFNDVPGETFILEINFOFILESTREAMW 882 | #else 883 | #define PFNDVPIDENTIFY PFNDVPIDENTIFYA 884 | #define PFNDVPIDENTIFYFILE PFNDVPIDENTIFYFILEA 885 | #define PFNDVPIDENTIFYFILESTREAM PFNDVPIDENTIFYFILESTREAMA 886 | #define PFNDVPIDENTIFYFILEBYTES PFNDVPIDENTIFYFILEBYTESA 887 | #define PFNDVPLOADBITMAP PFNDVPLOADBITMAPA 888 | #define PFNDVPLOADBITMAPSTREAM PFNDVPLOADBITMAPSTREAMA 889 | #define PFNDVPLOADTEXT PFNDVPLOADTEXTA 890 | #define PFNDVPSHOWPROPERTIES PFNDVPSHOWPROPERTIESA 891 | #define PFNDVPSHOWPROPERTIESSTREAM PFNDVPSHOWPROPERTIESSTREAMA 892 | #define PFNDVPGETFILEINFOFILE PFNDVPGETFILEINFOFILEA 893 | #define PFNDVPGETFILEINFOFILESTREAM PFNDVPGETFILEINFOFILESTREAMA 894 | #endif 895 | 896 | 897 | #ifdef UNICODE 898 | #define DVP_Identify DVP_IdentifyW 899 | #define DVP_IdentifyFile DVP_IdentifyFileW 900 | #define DVP_IdentifyFileStream DVP_IdentifyFileStreamW 901 | #define DVP_IdentifyFileBytes DVP_IdentifyFileBytesW 902 | #define DVP_LoadBitmap DVP_LoadBitmapW 903 | #define DVP_LoadBitmapStream DVP_LoadBitmapStreamW 904 | #define DVP_LoadText DVP_LoadTextW 905 | #define DVP_ShowProperties DVP_ShowPropertiesW 906 | #define DVP_ShowPropertiesStream DVP_ShowPropertiesStreamW 907 | #define DVP_GetFileInfoFile DVP_GetFileInfoFileW 908 | #define DVP_GetFileInfoFileStream DVP_GetFileInfoFileStreamW 909 | #else 910 | #define DVP_Identify DVP_IdentifyA 911 | #define DVP_IdentifyFile DVP_IdentifyFileA 912 | #define DVP_IdentifyFileStream DVP_IdentifyFileStreamA 913 | #define DVP_IdentifyFileBytes DVP_IdentifyFileBytesA 914 | #define DVP_LoadBitmap DVP_LoadBitmapA 915 | #define DVP_LoadBitmapStream DVP_LoadBitmapStreamA 916 | #define DVP_LoadText DVP_LoadTextA 917 | #define DVP_ShowProperties DVP_ShowPropertiesA 918 | #define DVP_ShowPropertiesStream DVP_ShowPropertiesStreamA 919 | #define DVP_GetFileInfoFile DVP_GetFileInfoFileA 920 | #define DVP_GetFileInfoFileStream DVP_GetFileInfoFileStreamA 921 | #endif 922 | 923 | 924 | // Image frame size used by Opus 925 | #if ( VIEWERPLUGINVERSION >= 4 ) 926 | #define OPUSVIEWER_IMAGE_FRAME_SIZE 14 927 | #else 928 | #define OPUSVIEWER_IMAGE_FRAME_SIZE 8 929 | #endif 930 | 931 | #endif 932 | 933 | -------------------------------------------------------------------------------- /ViewerPlugin/DOpusExt.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "DOpusExt.hpp" 3 | 4 | namespace DOpusExt { 5 | decltype(&FindFirstFileW) VFileGetFolderSize::FindFirstFileW_real = FindFirstFileW; 6 | 7 | HANDLE __stdcall VFileGetFolderSize::FindFirstFileW_detour(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData) 8 | { 9 | wstring_view filename(lpFileName); 10 | if (filename.rfind(LR"(V:\Ib\GetFolderSize\)", 0) == 0) { 11 | auto ends_with = [](std::wstring_view str, std::wstring_view suffix) 12 | { 13 | return str.size() >= suffix.size() && !str.compare(str.size() - suffix.size(), suffix.size(), suffix); 14 | }; 15 | if (!ends_with(filename, LR"(\)")) { 16 | //reduce time: 18us -> 5us 17 | return INVALID_HANDLE_VALUE; 18 | } 19 | 20 | /* 21 | wstringstream ss; 22 | ss << filename[std::size(LR"(V:\Ib\GetFolderSize\)") - 1] << L':' << filename.substr(std::size(LR"(V:\Ib\GetFolderSize\)") - 1 + 1); 23 | wstring filename_arg = ss.str(); 24 | */ 25 | wstring filename_arg{ 26 | filename.substr( 27 | LR"(V:\Ib\GetFolderSize\)"sv.size(), 28 | filename.size() - LR"(V:\Ib\GetFolderSize\)"sv.size() - LR"(\)"sv.size() 29 | ) 30 | }; 31 | 32 | if constexpr (ib::debug_runtime) 33 | DebugOStream() << L"VFileGetFolderSize: " << lpFileName 34 | << L", " << filename_arg 35 | << L" (thread " << this_thread::get_id() << L")" << std::endl; 36 | 37 | WIN32_FIND_DATAW* find = Addr(lpFindFileData); 38 | find->dwFileAttributes = FILE_ATTRIBUTE_NORMAL; 39 | 40 | uint64_t size = 0; 41 | if (filename_arg.size() == 3) { //R"(C:\)" 42 | GetDiskFreeSpaceExW(filename_arg.c_str(), nullptr, ib::Addr(&size), nullptr); 43 | } 44 | else { 45 | using namespace Everythings; 46 | static EverythingMT ev; 47 | wstring parent(filename_arg); 48 | PathRemoveFileSpecW(parent.data()); //or PathCchRemoveFileSpec 49 | parent.resize(wcslen(parent.data())); 50 | 51 | thread_local wstring last_parent; //there may be multiple threads querying different folders at the same time 52 | thread_local QueryResults results; 53 | thread_local unordered_map result_map; 54 | 55 | if (parent != last_parent) { 56 | if constexpr (ib::debug_runtime) 57 | DebugOStream() << L"VFileGetFolderSize: " << (LR"(folder:infolder:")"s + ib::path_to_realpath(parent) + L'"') 58 | << L" (thread " << this_thread::get_id() << L")" << std::endl; 59 | 60 | result_map.clear(); 61 | std::future fut = ev.query_send( 62 | LR"(folder:infolder:")"s + ib::path_to_realpath(parent) + L'"', 63 | 0, 64 | Request::FileName | Request::Size 65 | ); 66 | std::future_status status = fut.wait_for(std::chrono::milliseconds(3000)); 67 | if (status == std::future_status::timeout) 68 | results.available_num = 0; 69 | else 70 | results = fut.get(); 71 | last_parent = parent; 72 | 73 | for (DWORD i = 0; i < results.available_num; i++) { 74 | result_map[results[i].get_str(Request::FileName)] = results[i].get_size(); 75 | } 76 | } 77 | 78 | if (results.available_num) { 79 | auto it = result_map.find(PathFindFileNameW(filename_arg.data())); 80 | if (it != result_map.end()) { 81 | size = it->second; 82 | 83 | if (!size) { 84 | wstring realpath = ib::path_to_realpath(filename_arg); 85 | if (realpath != filename_arg) { 86 | if constexpr (ib::debug_runtime) 87 | DebugOStream() << L"VFileGetFolderSize: " << (LR"(wfn:")"s + realpath + L'"') 88 | << L" (thread " << this_thread::get_id() << L")" << std::endl; 89 | 90 | std::future fut = ev.query_send( 91 | LR"(wfn:")"s + realpath + L'"', 92 | 0, 93 | Request::Size 94 | ); 95 | std::future_status status = fut.wait_for(std::chrono::milliseconds(3000)); 96 | 97 | QueryResults results; 98 | if (status == std::future_status::timeout) 99 | results.available_num = 0; 100 | else 101 | results = fut.get(); 102 | 103 | if (results.available_num) 104 | size = results[0].get_size(); 105 | else 106 | ; //ignore 107 | } 108 | } 109 | } 110 | else 111 | ; //ignore 112 | } 113 | } 114 | 115 | find->nFileSizeLow = (DWORD)size; 116 | find->nFileSizeHigh = (DWORD)(size >> 32); 117 | if constexpr (ib::debug_runtime) 118 | DebugOStream() << L"VFileGetFolderSize: " << size << std::endl; 119 | 120 | SetLastError(ERROR_SUCCESS); //can't be ERROR_ACCESS_DENIED 121 | return (HANDLE)1; //can't be 0 122 | } 123 | return FindFirstFileW_real(lpFileName, lpFindFileData); 124 | } 125 | 126 | VFileGetFolderSize::VFileGetFolderSize() { 127 | if constexpr (debug) 128 | DebugOStream() << "VFileGetFolderSize()\n"; 129 | 130 | //#TODO 131 | static bool init = false; 132 | if (!init) { 133 | IbDetourAttach(&FindFirstFileW_real, FindFirstFileW_detour); 134 | init = true; 135 | } 136 | 137 | //#TODO: transaction 138 | //IbDetourAttach(&FindFirstFileExW_real, FindFirstFileExW_detour); 139 | //IbDetourAttach(&FindNextFileW_Real, FindNextFileW_Detour); 140 | //IbDetourAttach(&FindClose_Real, FindClose_Detour); 141 | } 142 | 143 | VFileGetFolderSize::~VFileGetFolderSize() { 144 | if constexpr (debug) 145 | DebugOStream() << "~VFileGetFolderSize()\n"; 146 | //#TODO 147 | //IbDetourDetach(&FindFirstFileW_real, FindFirstFileW_detour); 148 | 149 | //IbDetourDetach(&FindFirstFileExW_real, FindFirstFileExW_detour); 150 | //IbDetourDetach(&FindNextFileW_Real, FindNextFileW_Detour); 151 | //IbDetourDetach(&FindClose_Real, FindClose_Detour); 152 | } 153 | 154 | /* 155 | HANDLE __stdcall VFileGetFolderSize::FindFirstFileExW_detour(LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags) 156 | { 157 | return FindFirstFileExW_real(lpFileName, fInfoLevelId, lpFindFileData, fSearchOp, lpSearchFilter, dwAdditionalFlags); 158 | } 159 | 160 | BOOL __stdcall VFileGetFolderSize::FindNextFileW_Detour(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData) 161 | { 162 | if (hFindFile == 0) { 163 | SetLastError(ERROR_NO_MORE_FILES); 164 | return FALSE; 165 | } 166 | return FindNextFileW_Real(hFindFile, lpFindFileData); 167 | } 168 | 169 | BOOL __stdcall VFileGetFolderSize::FindClose_Detour(HANDLE hFindFile) 170 | { 171 | if (hFindFile == 0) { 172 | return TRUE; 173 | } 174 | return FindClose_Real(hFindFile); 175 | } 176 | */ 177 | 178 | CommandExt::CommandExt( 179 | Command::EventExecuteCommands& event_execute_commands, 180 | Command::EventShellExecute& event_shell_execute, 181 | Thumbnails::MaxSize& thumb_max_size 182 | ) : event_execute_commands(event_execute_commands), event_shell_execute(event_shell_execute) 183 | { 184 | event_execute_commands_handle = event_execute_commands.before.append([&](Command::CommandContainer* cmds) { 185 | DebugOStream() << L"START ----------------" << cmds->size << L" (" << HeapSize(GetProcessHeap(), 0, cmds) << L")" 186 | << L" (thread " << this_thread::get_id() << L")" << std::endl; 187 | Command::CommandNode* node = cmds->head; 188 | do { 189 | wchar* cmd = node->command; 190 | if (!cmd) { 191 | //DebugOStream() << L" (" << HeapSize(GetProcessHeap(), 0, node) << L")") << std::endl; 192 | continue; 193 | } 194 | DebugOStream() << cmd << L" (" << HeapSize(GetProcessHeap(), 0, node) << L")" << std::endl; 195 | 196 | if (cmd[0] == L'#') { 197 | do { 198 | //Set MaxThumbSize 199 | static wregex reg(LR"(^ *Set +MaxThumbSize *= *(\d+))", regex_constants::icase); 200 | wcmatch match; 201 | if (regex_search(cmd + 1, match, reg) && match.size() > 1) { 202 | uint32_t size; 203 | wstringstream() << match.str(1) >> size; 204 | thumb_max_size.Set(size); 205 | wcsncpy_s(cmd, std::size(L"Go Refresh"), L"Go Refresh", std::size(L"Go Refresh")); //>=18 206 | break; 207 | } 208 | 209 | //cmd[0] = L'\0'; 210 | } while (false); 211 | 212 | if (cmd[0] != L'\0') 213 | DebugOStream() << L"-> " << cmd << std::endl; 214 | } 215 | } while (node = node->next); 216 | DebugOStream() << L"END ----------------" << std::endl; 217 | }); 218 | 219 | event_shell_execute_handle = event_shell_execute.before.append([&](SHELLEXECUTEINFOW* pExecInfo, int& ignore) { 220 | if (!pExecInfo->lpFile) 221 | return; 222 | DebugOStream() << L"ShellExecute: " << (pExecInfo->lpFile ? pExecInfo->lpFile : L"") << L" " << (pExecInfo->lpParameters ? pExecInfo->lpParameters : L"") << std::endl; 223 | 224 | wstring_view file = pExecInfo->lpFile ? wstring_view(pExecInfo->lpFile) : wstring_view(); 225 | wstring_view params = pExecInfo->lpParameters ? wstring_view(pExecInfo->lpParameters) : wstring_view(); 226 | if (file[0] == L'#') { 227 | file = file.substr(1); 228 | } 229 | }); 230 | } 231 | 232 | CommandExt::~CommandExt() 233 | { 234 | event_execute_commands.before.remove(event_execute_commands_handle); 235 | event_shell_execute.before.remove(event_shell_execute_handle); 236 | } 237 | 238 | MaxUndoNum::MaxUndoNum(Main& main, Modules::dopus& dopus) : dopus(dopus) { 239 | if (dvp_init_data.dwOpusVerMajor == 12 && dvp_init_data.dwOpusVerMinor == 23) { 240 | DebugOStream() << L"MaxUndoNum: " << main.config.FileOperations.Logging.MaxUndoNum << std::endl; 241 | 242 | mem::protect_changed(dopus.base.offset(0x8022C6 + 5), 1, mem::Protect::Write, [&main](Addr p) { 243 | *(Byte*)p = main.config.FileOperations.Logging.MaxUndoNum; 244 | }); 245 | } 246 | } 247 | 248 | MaxUndoNum::~MaxUndoNum() { 249 | if (dvp_init_data.dwOpusVerMajor == 12 && dvp_init_data.dwOpusVerMinor == 23) { 250 | mem::protect_changed(dopus.base.offset(0x8022C6 + 5), 1, mem::Protect::Write, [](Addr p) { 251 | *(Byte*)p = 10; 252 | }); 253 | } 254 | } 255 | 256 | Main::Main(gui::ConfigData&& config_) 257 | : config(std::move(config_)), 258 | injector(di::make_injector( 259 | di::bind
.to(*this) 260 | )) 261 | { 262 | injector.create>(); 263 | VFileGetFolderSize_ = injector.create(); 264 | 265 | if (config.FileOperations.Logging.MaxUndoNum_enable) { 266 | injector.create>(); 267 | } 268 | } 269 | 270 | Main::Main() 271 | : Main(gui::Config::GetConfig()) {} 272 | 273 | Main::~Main() {} 274 | } -------------------------------------------------------------------------------- /ViewerPlugin/DOpusExt.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | #include 9 | namespace fs = std::filesystem; 10 | 11 | #include 12 | #include 13 | namespace di = boost::di; 14 | 15 | #include 16 | 17 | #include "DOpus.hpp" 18 | #include "GuiShell.hpp" 19 | #include "helper.hpp" 20 | 21 | namespace DOpusExt { 22 | using namespace DOpus; 23 | 24 | class VFileGetFolderSize { 25 | static decltype(&FindFirstFileW) FindFirstFileW_real; 26 | static HANDLE WINAPI FindFirstFileW_detour( 27 | _In_ LPCWSTR lpFileName, 28 | _Out_ LPWIN32_FIND_DATAW lpFindFileData 29 | ); 30 | 31 | /* 32 | static decltype(&FindFirstFileExW) FindFirstFileExW_real = FindFirstFileExW; 33 | static HANDLE WINAPI FindFirstFileExW_detour( 34 | _In_ LPCWSTR lpFileName, 35 | _In_ FINDEX_INFO_LEVELS fInfoLevelId, 36 | _Out_writes_bytes_(sizeof(WIN32_FIND_DATAW)) LPVOID lpFindFileData, 37 | _In_ FINDEX_SEARCH_OPS fSearchOp, 38 | _Reserved_ LPVOID lpSearchFilter, 39 | _In_ DWORD dwAdditionalFlags 40 | ); 41 | 42 | static decltype(&FindNextFileW) FindNextFileW_Real = FindNextFileW; 43 | static BOOL WINAPI FindNextFileW_Detour( 44 | _In_ HANDLE hFindFile, 45 | _Out_ LPWIN32_FIND_DATAW lpFindFileData 46 | ); 47 | 48 | static decltype(&FindClose) FindClose_Real = FindClose; 49 | static BOOL WINAPI FindClose_Detour(_Inout_ HANDLE hFindFile); 50 | */ 51 | public: 52 | VFileGetFolderSize(); 53 | //VFileGetFolderSize(const VFileGetFolderSize&) = delete; 54 | //VFileGetFolderSize& operator=(VFileGetFolderSize const&) = delete; 55 | 56 | ~VFileGetFolderSize(); 57 | }; 58 | 59 | class Main { 60 | di::core::injector> injector; 61 | VFileGetFolderSize VFileGetFolderSize_; 62 | public: 63 | gui::ConfigData config; 64 | 65 | Main(); 66 | Main(gui::ConfigData&&); 67 | ~Main(); 68 | }; 69 | 70 | class CommandExt { 71 | Command::EventExecuteCommands& event_execute_commands; 72 | decltype(event_execute_commands.before)::Handle event_execute_commands_handle; 73 | Command::EventShellExecute& event_shell_execute; 74 | decltype(event_shell_execute.before)::Handle event_shell_execute_handle; 75 | public: 76 | CommandExt( 77 | Command::EventExecuteCommands& event_execute_commands, 78 | Command::EventShellExecute& event_shell_execute, 79 | Thumbnails::MaxSize& thumb_max_size 80 | ); 81 | 82 | ~CommandExt(); 83 | }; 84 | 85 | class MaxUndoNum { 86 | Modules::dopus& dopus; 87 | public: 88 | MaxUndoNum(Main& main, Modules::dopus& dopus); 89 | ~MaxUndoNum(); 90 | }; 91 | 92 | 93 | template 94 | struct Require { 95 | Require(T&) {} 96 | }; 97 | } -------------------------------------------------------------------------------- /ViewerPlugin/DOpusPlugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #define DOPUS_PLUGIN_HELPER 5 | #include "DOpus/plugin support.h" 6 | #include "DOpus/viewer plugins.h" -------------------------------------------------------------------------------- /ViewerPlugin/GuiShell.cpp: -------------------------------------------------------------------------------- 1 | #include "GuiShell.hpp" 2 | #include 3 | 4 | using namespace System; 5 | using namespace msclr::interop; 6 | 7 | constexpr bool debug = 8 | #ifdef _DEBUG 9 | 1; 10 | #else 11 | 0; 12 | #endif 13 | 14 | namespace gui { 15 | ConfigData ConvertConfigData(GuiShell::ConfigData^ config_) { 16 | ConfigData config; 17 | 18 | if (config.FileOperations.Logging.MaxUndoNum_enable = config_->FileOperations->Logging->MaxUndoNum != 10) { 19 | config.FileOperations.Logging.MaxUndoNum = config_->FileOperations->Logging->MaxUndoNum; 20 | } 21 | 22 | return config; 23 | } 24 | 25 | void ApplyAction(GuiShell::ConfigData^ config) { 26 | Config::ApplyCallback(ConvertConfigData(config)); 27 | } 28 | 29 | void Config::Init(std::wstring_view filename) { 30 | GuiShell::Config::SetUnhandledExceptionHandler(); 31 | GuiShell::Config::ApplyAction += gcnew Action(ApplyAction); 32 | GuiShell::Config::Filename = marshal_as(std::wstring(filename)); 33 | } 34 | 35 | ConfigData Config::GetConfig() { 36 | return ConvertConfigData(GuiShell::Config::Read()); 37 | } 38 | 39 | 40 | PreferenceShow::PreferenceShow() { 41 | if constexpr (debug) 42 | OutputDebugStringW(L"gui::PreferenceShow\n"); 43 | preferences = gcnew GuiShell::PreferenceShow(); 44 | } 45 | 46 | PreferenceShow::~PreferenceShow() { 47 | if constexpr (debug) 48 | OutputDebugStringW(L"gui::~PreferenceShow\n"); 49 | } 50 | 51 | bool PreferenceShow::Show() { 52 | return preferences->Show(); 53 | } 54 | } -------------------------------------------------------------------------------- /ViewerPlugin/GuiShell.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef _MANAGED 4 | #include 5 | #define GCROOT(T) msclr::gcroot 6 | #else 7 | #define GCROOT(T) void* 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | namespace gui { 14 | #pragma managed(push, off) 15 | struct ConfigData { 16 | struct FileOperationsData { 17 | struct LoggingData { 18 | bool MaxUndoNum_enable; 19 | unsigned char MaxUndoNum; 20 | } Logging; 21 | } FileOperations; 22 | 23 | struct FoldersData { 24 | struct FolderBehaviourData { 25 | } FolderBehaviour; 26 | } Folders; 27 | }; 28 | #pragma managed(pop) 29 | 30 | class Config { 31 | public: 32 | static void Init(std::wstring_view filename); 33 | static ConfigData GetConfig(); 34 | static inline void (*ApplyCallback)(ConfigData&&); 35 | }; 36 | 37 | class PreferenceShow { 38 | GCROOT(GuiShell::PreferenceShow^) preferences; 39 | public: 40 | PreferenceShow(); 41 | ~PreferenceShow(); 42 | bool Show(); 43 | }; 44 | } -------------------------------------------------------------------------------- /ViewerPlugin/ViewerPlugin.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource1.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // Chinese (Simplified, China) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) 19 | LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED 20 | #pragma code_page(936) 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource1.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Version 51 | // 52 | 53 | VS_VERSION_INFO VERSIONINFO 54 | FILEVERSION 0,5,0,1 55 | PRODUCTVERSION 0,5,0,1 56 | FILEFLAGSMASK 0x3fL 57 | #ifdef _DEBUG 58 | FILEFLAGS 0x1L 59 | #else 60 | FILEFLAGS 0x0L 61 | #endif 62 | FILEOS 0x40004L 63 | FILETYPE 0x2L 64 | FILESUBTYPE 0x0L 65 | BEGIN 66 | BLOCK "StringFileInfo" 67 | BEGIN 68 | BLOCK "080904b0" 69 | BEGIN 70 | VALUE "CompanyName", "https://github.com/Chaoses-Ib/IbDOpusExt" 71 | VALUE "FileDescription", "An extension for DOpus." 72 | VALUE "FileVersion", "0.5.0.1" 73 | VALUE "InternalName", "IbDOpusExt.dll" 74 | VALUE "LegalCopyright", "Copyright (C) 2022 Chaoses Ib" 75 | VALUE "OriginalFilename", "IbDOpusExt.dll" 76 | VALUE "ProductName", "IbDOpusExt" 77 | VALUE "ProductVersion", "0.5.0.1" 78 | END 79 | END 80 | BLOCK "VarFileInfo" 81 | BEGIN 82 | VALUE "Translation", 0x809, 1200 83 | END 84 | END 85 | 86 | #endif // Chinese (Simplified, China) resources 87 | ///////////////////////////////////////////////////////////////////////////// 88 | 89 | 90 | 91 | #ifndef APSTUDIO_INVOKED 92 | ///////////////////////////////////////////////////////////////////////////// 93 | // 94 | // Generated from the TEXTINCLUDE 3 resource. 95 | // 96 | 97 | 98 | ///////////////////////////////////////////////////////////////////////////// 99 | #endif // not APSTUDIO_INVOKED 100 | 101 | -------------------------------------------------------------------------------- /ViewerPlugin/ViewerPlugin.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {5ddb17fb-f4a0-40d6-9663-86c4f37fcff2} 25 | ViewerPlugin 26 | 10.0 27 | net6.0 28 | 29 | 30 | 31 | DynamicLibrary 32 | true 33 | v143 34 | Unicode 35 | NetCore 36 | 37 | 38 | DynamicLibrary 39 | false 40 | v143 41 | true 42 | Unicode 43 | NetCore 44 | 45 | 46 | DynamicLibrary 47 | true 48 | v143 49 | Unicode 50 | NetCore 51 | 52 | 53 | DynamicLibrary 54 | false 55 | v143 56 | true 57 | Unicode 58 | NetCore 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | true 80 | IbDOpusExt 81 | 82 | 83 | false 84 | IbDOpusExt 85 | 86 | 87 | true 88 | IbDOpusExt 89 | 90 | 91 | false 92 | IbDOpusExt 93 | 94 | 95 | 96 | 97 | x64-windows-static-md 98 | 99 | 100 | x64-windows-static-md 101 | 102 | 103 | 104 | Level3 105 | true 106 | _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING;WIN32;_DEBUG;VIEWERPLUGIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 107 | true 108 | Use 109 | pch.h 110 | stdcpp17 111 | /Zc:twoPhase- %(AdditionalOptions) 112 | $(SolutionDir)external\build\_deps\ibwincpp-src\include;$(SolutionDir)external\build\_deps\ibeverything-src\include;$(SolutionDir)external\build\_deps\sigmatch-src\include;%(AdditionalIncludeDirectories) 113 | 114 | 115 | Windows 116 | true 117 | false 118 | %(AdditionalDependencies) 119 | 120 | 121 | 122 | 123 | Level3 124 | true 125 | true 126 | true 127 | _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING;WIN32;NDEBUG;VIEWERPLUGIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 128 | true 129 | Use 130 | pch.h 131 | stdcpp17 132 | /Zc:twoPhase- %(AdditionalOptions) 133 | $(SolutionDir)external\build\_deps\ibwincpp-src\include;$(SolutionDir)external\build\_deps\ibeverything-src\include;$(SolutionDir)external\build\_deps\sigmatch-src\include;%(AdditionalIncludeDirectories) 134 | 135 | 136 | Windows 137 | true 138 | true 139 | true 140 | false 141 | %(AdditionalDependencies) 142 | 143 | 144 | 145 | 146 | Level3 147 | true 148 | _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING;_DEBUG;VIEWERPLUGIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 149 | true 150 | Use 151 | pch.h 152 | stdcpp17 153 | /Zc:twoPhase- %(AdditionalOptions) 154 | $(SolutionDir)external\build\_deps\ibwincpp-src\include;$(SolutionDir)external\build\_deps\ibeverything-src\include;$(SolutionDir)external\build\_deps\sigmatch-src\include;%(AdditionalIncludeDirectories) 155 | 156 | 157 | Windows 158 | true 159 | false 160 | %(AdditionalDependencies) 161 | 162 | 163 | 164 | 165 | Level3 166 | true 167 | true 168 | true 169 | _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING;NDEBUG;VIEWERPLUGIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 170 | true 171 | Use 172 | pch.h 173 | stdcpp17 174 | /Zc:twoPhase- %(AdditionalOptions) 175 | $(SolutionDir)external\build\_deps\ibwincpp-src\include;$(SolutionDir)external\build\_deps\ibeverything-src\include;$(SolutionDir)external\build\_deps\sigmatch-src\include;%(AdditionalIncludeDirectories) 176 | 177 | 178 | Windows 179 | true 180 | true 181 | true 182 | false 183 | %(AdditionalDependencies) 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | false 204 | false 205 | false 206 | false 207 | 208 | 209 | false 210 | false 211 | false 212 | false 213 | 214 | 215 | NotUsing 216 | NotUsing 217 | NotUsing 218 | NotUsing 219 | 220 | 221 | Create 222 | Create 223 | Create 224 | Create 225 | false 226 | false 227 | false 228 | false 229 | 230 | 231 | stdcpplatest 232 | stdcpplatest 233 | stdcpplatest 234 | stdcpplatest 235 | false 236 | false 237 | false 238 | false 239 | NotUsing 240 | NotUsing 241 | NotUsing 242 | NotUsing 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | {3d68712a-baf7-3103-8454-1fc988c101d1} 257 | 258 | 259 | {d04f5ff3-6d8b-3718-be85-2aac74820582} 260 | 261 | 262 | {75c69f05-44dd-4722-8664-10c0aff2bffe} 263 | 264 | 265 | 266 | 267 | 268 | 269 | -------------------------------------------------------------------------------- /ViewerPlugin/ViewerPlugin.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {00d935a1-6fa9-47f3-a201-c45b09a03377} 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files\DOpus 29 | 30 | 31 | Header Files\DOpus 32 | 33 | 34 | Header Files\DOpus 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | Header Files 53 | 54 | 55 | Header Files 56 | 57 | 58 | Header Files 59 | 60 | 61 | 62 | 63 | Source Files 64 | 65 | 66 | Source Files 67 | 68 | 69 | Source Files 70 | 71 | 72 | Source Files 73 | 74 | 75 | Source Files 76 | 77 | 78 | 79 | 80 | Resource Files 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /ViewerPlugin/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "DOpusPlugin.hpp" 3 | 4 | #include "helper.hpp" 5 | #include "DOpusExt.hpp" 6 | #include "GuiShell.hpp" 7 | 8 | BOOL APIENTRY DllMain( HMODULE hModule, 9 | DWORD ul_reason_for_call, 10 | LPVOID lpReserved 11 | ) 12 | { 13 | switch (ul_reason_for_call) 14 | { 15 | case DLL_PROCESS_ATTACH: 16 | DebugOStream() << L"DLL_PROCESS_ATTACH" << std::endl; 17 | break; 18 | case DLL_THREAD_ATTACH: 19 | break; 20 | case DLL_THREAD_DETACH: 21 | break; 22 | case DLL_PROCESS_DETACH: 23 | DebugOStream() << L"DLL_PROCESS_DETACH" << std::endl; 24 | break; 25 | } 26 | return TRUE; 27 | } 28 | 29 | #define EXPORT extern "C" __declspec(dllexport) 30 | 31 | static ib::HolderB dopus_ext; 32 | 33 | DVPInitExData dvp_init_data; 34 | 35 | void ApplyCallback(gui::ConfigData&& config) { 36 | dopus_ext.recreate(std::move(config)); 37 | } 38 | 39 | EXPORT BOOL DVP_InitEx(DVPInitExData* pInitExData) { 40 | DebugOStream() << L"DVP_InitEx" << std::endl; 41 | 42 | dvp_init_data = *pInitExData; 43 | 44 | if (!dopus_ext.created()) { 45 | using namespace std::filesystem; 46 | path ext_path = [] { 47 | DOpusPluginHelperConfig opusconfig; 48 | wchar program_dir[MAX_PATH]; 49 | opusconfig.GetConfigPath(OPUSPATH_CONFIG, program_dir, (UINT)size(program_dir)); 50 | return path(program_dir) / L"IbDOpusExt"; 51 | }(); 52 | gui::Config::ApplyCallback = ApplyCallback; 53 | gui::Config::Init((ext_path / L"config.xml").wstring()); 54 | 55 | dopus_ext.create(); 56 | } 57 | return TRUE; 58 | } 59 | 60 | EXPORT void DVP_Uninit(void) { 61 | DebugOStream() << L"DVP_Uninit" << std::endl; 62 | 63 | //In order to be autoloaded and still can be unloaded by "Show flushplugins". 64 | static bool first_time = true; 65 | static HMODULE handle; 66 | if (first_time) { 67 | if constexpr (debug) 68 | DebugOStream() << L"first_time" << std::endl; 69 | GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)DVP_Uninit, &handle); 70 | first_time = false; 71 | } 72 | else if(handle) { 73 | FreeLibrary(handle); 74 | handle = nullptr; 75 | 76 | if constexpr (debug) 77 | DebugOStream() << L"dopus_ext.destroy()" << std::endl; 78 | dopus_ext.destroy(); 79 | } 80 | return; 81 | } 82 | 83 | EXPORT BOOL DVP_USBSafe(OpusUSBSafeData* pUSBSafeData) { 84 | DebugOStream() << L"DVP_USBSafe" << std::endl; 85 | return TRUE; 86 | } 87 | 88 | EXPORT BOOL DVP_IdentifyW(DOpusViewerPluginInfoW* lpVPInfo) { 89 | DebugOStream() << L"DVP_IdentifyW" << std::endl; 90 | if (lpVPInfo->cbSize < VIEWERPLUGINFILEINFOW_V4_SIZE) 91 | return FALSE; 92 | lpVPInfo->dwFlags = DVPFIF_ExtensionsOnly //or DVPFIF_CatchAll 93 | | DVPFIF_NoThumbnails 94 | | DVPFIF_NoFileInformation 95 | | DVPFIF_UseVersionResource //only for version and copyright 96 | | DVPFIF_CanConfigure 97 | ; 98 | //wcscpy_s(lpVPInfo->lpszHandleExts, lpVPInfo->cchHandleExtsMax, L".abc"); 99 | 100 | wcscpy_s(lpVPInfo->lpszName, lpVPInfo->cchNameMax, L"IbDOpusExt"); 101 | wcscpy_s(lpVPInfo->lpszDescription, lpVPInfo->cchDescriptionMax, L"An extension for DOpus."); 102 | wcscpy_s(lpVPInfo->lpszURL, lpVPInfo->cchURLMax, L"https://github.com/Chaoses-Ib/IbDOpusExt"); 103 | 104 | // {CB2D22A9-6C03-4B5D-B264-60224E70A46F} 105 | lpVPInfo->idPlugin = { 0xcb2d22a9, 0x6c03, 0x4b5d, { 0xb2, 0x64, 0x60, 0x22, 0x4e, 0x70, 0xa4, 0x6F } }; 106 | 107 | return TRUE; 108 | } 109 | 110 | gui::PreferenceShow& preferences() { 111 | static gui::PreferenceShow preferences; 112 | return preferences; 113 | } 114 | 115 | EXPORT HWND DVP_Configure(HWND hWndParent, HWND hWndNotify, DWORD dwNotifyData) { 116 | DebugOStream() << L"DVP_Configure" << std::endl; 117 | preferences().Show(); 118 | return 0; 119 | } -------------------------------------------------------------------------------- /ViewerPlugin/framework.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 4 | // Windows Header Files 5 | #include 6 | #include 7 | #include 8 | #include 9 | #pragma comment(lib, "Shlwapi.lib") -------------------------------------------------------------------------------- /ViewerPlugin/helper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | using ib::wchar, ib::Byte, ib::Addr; 11 | namespace mem = ib::mem; 12 | 13 | #include "DOpusPlugin.hpp" 14 | extern DVPInitExData dvp_init_data; 15 | 16 | constexpr bool debug = !ib::macro::ndebug; 17 | 18 | inline ib::DebugOStream<> DebugOStream() { 19 | return ib::DebugOStream(L"Ib: "); 20 | } 21 | 22 | 23 | template 24 | LONG IbDetourAttach(_Inout_ T* ppPointer, _In_ T pDetour) { 25 | DetourTransactionBegin(); 26 | DetourUpdateThread(GetCurrentThread()); 27 | DetourAttach((void**)ppPointer, pDetour); 28 | return DetourTransactionCommit(); 29 | } 30 | 31 | template 32 | LONG IbDetourDetach(_Inout_ T* ppPointer, _In_ T pDetour) { 33 | DetourTransactionBegin(); 34 | DetourUpdateThread(GetCurrentThread()); 35 | DetourDetach((void**)ppPointer, pDetour); 36 | return DetourTransactionCommit(); 37 | } -------------------------------------------------------------------------------- /ViewerPlugin/pch.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp: source file corresponding to the pre-compiled header 2 | 3 | #include "pch.h" 4 | 5 | // When you are using pre-compiled headers, this source file is necessary for compilation to succeed. 6 | -------------------------------------------------------------------------------- /ViewerPlugin/pch.h: -------------------------------------------------------------------------------- 1 | // pch.h: This is a precompiled header file. 2 | // Files listed below are compiled only once, improving build performance for future builds. 3 | // This also affects IntelliSense performance, including code completion and many code browsing features. 4 | // However, files listed here are ALL re-compiled if any one of them is updated between builds. 5 | // Do not add files here that you will be updating frequently as this negates the performance advantage. 6 | 7 | #ifndef PCH_H 8 | #define PCH_H 9 | 10 | // add headers that you want to pre-compile here 11 | #include "framework.h" 12 | 13 | #endif //PCH_H 14 | -------------------------------------------------------------------------------- /ViewerPlugin/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by ViewerPlugin.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /ViewerPlugin/resource1.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by ViewerPlugin.rc 4 | // 5 | 6 | // Next default values for new objects 7 | // 8 | #ifdef APSTUDIO_INVOKED 9 | #ifndef APSTUDIO_READONLY_SYMBOLS 10 | #define _APS_NEXT_RESOURCE_VALUE 101 11 | #define _APS_NEXT_COMMAND_VALUE 40001 12 | #define _APS_NEXT_CONTROL_VALUE 1001 13 | #define _APS_NEXT_SYMED_VALUE 101 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /ViewerPlugin/sigmatch.cpp: -------------------------------------------------------------------------------- 1 | // C++20 2 | #include "sigmatch.hpp" 3 | #include 4 | #include 5 | #include "helper.hpp" 6 | 7 | ib::Addr sigmatch_RunCommandB4_True() { 8 | using namespace sigmatch_literals; 9 | 10 | MODULEINFO info; 11 | if (!GetModuleInformation(GetCurrentProcess(), ib::ModuleFactory::current_process().handle, &info, sizeof info)) 12 | return nullptr; 13 | 14 | sigmatch::this_process_target target; 15 | sigmatch::search_context context = target.in_range({ info.lpBaseOfDll, info.SizeOfImage }); 16 | 17 | auto search = [&target, &context](sigmatch::signature sig) -> ib::Addr { 18 | std::vector matches = context.search(sig).matches(); 19 | if (matches.empty()) { 20 | if constexpr (debug) 21 | DebugOStream() << L"search: Found zero result\n"; 22 | return nullptr; 23 | } 24 | if constexpr (debug) 25 | if (matches.size() > 1) 26 | DebugOStream() << L"search: Found more than one results\n"; 27 | return (void*)matches[0]; 28 | }; 29 | auto search_entry = [&target, &context, &search](sigmatch::signature sig, sigmatch::signature entry_sig, size_t entry_range) -> ib::Addr { 30 | ib::Addr code = search(sig); 31 | if (!code) 32 | return nullptr; 33 | 34 | // not stable 35 | //return find_entry_CC(matches[0]); 36 | 37 | std::vector matches = target.in_range({ code - entry_range, entry_range }).search(entry_sig).matches(); 38 | if (matches.empty()) 39 | return nullptr; 40 | 41 | return (void*)matches.back(); 42 | }; 43 | auto search_call = [&target, &context, &search](sigmatch::signature sig, size_t call_offset) -> ib::Addr { 44 | ib::Addr code = search(sig); 45 | if (!code) 46 | return nullptr; 47 | 48 | ib::Addr offset_addr = code + call_offset; 49 | ib::Addr eip = offset_addr + sizeof(offset); 50 | return eip + *(offset*)offset_addr; 51 | }; 52 | 53 | ib::Addr RunCommandB4_True = search_call.template operator()("E8 ?? ?? ?? ?? 49 89 ?? ?? ?? ?? ?? 41 8B FD"_sig, 1); 54 | 55 | if constexpr (debug) 56 | DebugOStream() << "sigmatch_RunCommandB4_True: " << std::hex << (RunCommandB4_True - info.lpBaseOfDll) << L'\n'; 57 | 58 | return RunCommandB4_True; 59 | } 60 | 61 | ib::Addr sigmatch_Prefs() { 62 | using namespace sigmatch_literals; 63 | 64 | MODULEINFO info; 65 | if (!GetModuleInformation(GetCurrentProcess(), ib::ModuleFactory::current_process().handle, &info, sizeof info)) 66 | return nullptr; 67 | 68 | sigmatch::this_process_target target; 69 | sigmatch::search_context context = target.in_range({ info.lpBaseOfDll, info.SizeOfImage }); 70 | 71 | auto search = [&target, &context](sigmatch::signature sig) -> ib::Addr { 72 | std::vector matches = context.search(sig).matches(); 73 | if (matches.empty()) { 74 | if constexpr (debug) 75 | DebugOStream() << L"search: Found zero result\n"; 76 | return nullptr; 77 | } 78 | if constexpr (debug) 79 | if (matches.size() > 1) 80 | DebugOStream() << L"search: Found more than one results\n"; 81 | return (void*)matches[0]; 82 | }; 83 | auto search_entry = [&target, &context, &search](sigmatch::signature sig, sigmatch::signature entry_sig, size_t entry_range) -> ib::Addr { 84 | ib::Addr code = search(sig); 85 | if (!code) 86 | return nullptr; 87 | 88 | // not stable 89 | //return find_entry_CC(matches[0]); 90 | 91 | std::vector matches = target.in_range({ code - entry_range, entry_range }).search(entry_sig).matches(); 92 | if (matches.empty()) 93 | return nullptr; 94 | 95 | return (void*)matches.back(); 96 | }; 97 | auto search_call = [&target, &context, &search](sigmatch::signature sig, size_t call_offset) -> ib::Addr { 98 | ib::Addr code = search(sig); 99 | if (!code) 100 | return nullptr; 101 | 102 | ib::Addr offset_addr = code + call_offset; 103 | ib::Addr eip = offset_addr + sizeof(offset); 104 | return eip + *(offset*)offset_addr; 105 | }; 106 | 107 | ib::Addr Prefs = search_call.template operator() < int32_t > ("4C ?? ?? ?? ?? ?? ?? 49 8B ?? ?? ?? ?? ?? F6 80"_sig, 3); 108 | 109 | if constexpr (debug) 110 | DebugOStream() << "sigmatch_Prefs: " << std::hex << (Prefs - info.lpBaseOfDll) << L'\n'; 111 | 112 | return Prefs; 113 | } 114 | 115 | size_t sigmatch_MaxThumbSize() { 116 | using namespace sigmatch_literals; 117 | 118 | MODULEINFO info; 119 | if (!GetModuleInformation(GetCurrentProcess(), ib::ModuleFactory::current_process().handle, &info, sizeof info)) 120 | return 0; 121 | 122 | sigmatch::this_process_target target; 123 | sigmatch::search_context context = target.in_range({ info.lpBaseOfDll, info.SizeOfImage }); 124 | 125 | auto search = [&target, &context](sigmatch::signature sig) -> ib::Addr { 126 | std::vector matches = context.search(sig).matches(); 127 | if (matches.empty()) { 128 | if constexpr (debug) 129 | DebugOStream() << L"search: Found zero result\n"; 130 | return nullptr; 131 | } 132 | if constexpr (debug) 133 | if (matches.size() > 1) 134 | DebugOStream() << L"search: Found more than one results\n"; 135 | return (void*)matches[0]; 136 | }; 137 | auto search_entry = [&target, &context, &search](sigmatch::signature sig, sigmatch::signature entry_sig, size_t entry_range) -> ib::Addr { 138 | ib::Addr code = search(sig); 139 | if (!code) 140 | return nullptr; 141 | 142 | // not stable 143 | //return find_entry_CC(matches[0]); 144 | 145 | std::vector matches = target.in_range({ code - entry_range, entry_range }).search(entry_sig).matches(); 146 | if (matches.empty()) 147 | return nullptr; 148 | 149 | return (void*)matches.back(); 150 | }; 151 | auto search_call = [&target, &context, &search](sigmatch::signature sig, size_t call_offset) -> ib::Addr { 152 | ib::Addr code = search(sig); 153 | if (!code) 154 | return nullptr; 155 | 156 | ib::Addr offset_addr = code + call_offset; 157 | ib::Addr eip = offset_addr + sizeof(offset); 158 | return eip + *(offset*)offset_addr; 159 | }; 160 | 161 | int32_t offset = *(uint32_t*)(search("48 ?? ?? ?? ?? ?? ?? 8B 88 ?? ?? ?? ?? 41 89 ?? ?? 48 ?? ?? ?? ?? ?? ?? 8B 88 ?? ?? ?? ?? 41 89"_sig) + 7 + 2); 162 | 163 | if constexpr (debug) 164 | DebugOStream() << "sigmatch_MaxThumbSize: " << std::hex << offset << L'\n'; 165 | 166 | return offset; 167 | } -------------------------------------------------------------------------------- /ViewerPlugin/sigmatch.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | ib::Addr sigmatch_RunCommandB4_True(); 4 | ib::Addr sigmatch_Prefs(); 5 | size_t sigmatch_MaxThumbSize(); -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ## DLL hijacking 2 | ### DOpus.exe 3 | Importer | Thread | DLL 4 | --- | --- | --- 5 | | dopus.exe | A | USERENV.dll 6 | | dopus.exe, dopuslib.dll | B | VERSION.dll 7 | | dopus.exe | A | WININET.dll 8 | | dopus.exe | B | MPR.dll 9 | | dopus.exe | C | WINMM.dll 10 | | dopus.exe | B | MSVFW32.dll 11 | | dopus.exe | A | MSACM32.dll 12 | | dopus.exe | D | urlmon.dll 13 | | dopus.exe | C | NETAPI32.dll 14 | | dopus.exe, dopuslib.dll | B | UxTheme.dll 15 | | dopus.exe | C | query.dll 16 | | dopus.exe, dopuslib.dll | D | WTSAPI32.dll 17 | | | C | iertutil.dll 18 | | | D | srvcli.dll 19 | | | B | netutils.dll 20 | | | D | SHFOLDER.dll 21 | | | A | WKSCLI.DLL 22 | | | C | SAMCLI.DLL 23 | | | D | profapi.dll 24 | | | D | ncrypt.dll 25 | | | C | BCRYPT.DLL 26 | | | D | NTASN1.dll 27 | | | D | MSASN1.dll 28 | | | D | DSROLE.DLL 29 | | | D | WindowsCodecs.dll 30 | | | C | USP10.dll 31 | | | A | msls31.dll 32 | | | D | CoreMessaging.dll 33 | | | D | CoreUIComponents.dll 34 | | | D | CRYPTBASE.DLL 35 | | | D | OLEACCRC.DLL 36 | | | E | CFGMGR32.dll 37 | | | F | `/dopusdata\Images\shell32.dll` 38 | | | F | `Images\shell32.dll` 39 | | | F | shell32.dll 40 | 41 | ### DOpusRT.exe 42 | - SHFOLDER.dll 43 | - version.dll 44 | - UxTheme.dll 45 | - WTSAPI32.dll -------------------------------------------------------------------------------- /docs/images/SizeCol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chaoses-Ib/IbDOpusExt/421397f1f73d49b1351ec6cebdf35a74dddb9019/docs/images/SizeCol.png -------------------------------------------------------------------------------- /external/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | project(external) 4 | 5 | include(FetchContent) 6 | FetchContent_Declare(IbWinCpp 7 | GIT_REPOSITORY https://github.com/Chaoses-Ib/IbWinCppLib.git 8 | GIT_TAG a29ac95537f403ac5ae221cb744d3e82076efbf7 9 | ) 10 | FetchContent_Declare(IbDllHijack 11 | GIT_REPOSITORY https://github.com/Chaoses-Ib/IbDllHijackLib.git 12 | GIT_TAG a82533aff8a73129aee2a3757069f7aa89e7dd6a 13 | ) 14 | FetchContent_Declare(IbEverything 15 | GIT_REPOSITORY https://github.com/Chaoses-Ib/IbEverythingLib.git 16 | GIT_TAG 0fda1b6a2db79112b08ebdfb1443a84959ddc042 17 | ) 18 | FetchContent_Declare(sigmatch 19 | GIT_REPOSITORY https://github.com/SpriteOvO/sigmatch.git 20 | GIT_TAG 2ca983dc0cb78fe4f4406b67655e7ee132ecf5da 21 | ) 22 | FetchContent_MakeAvailable(IbWinCpp IbDllHijack IbEverything sigmatch) -------------------------------------------------------------------------------- /external/vcpkg.bat: -------------------------------------------------------------------------------- 1 | vcpkg install detours eventpp bext-di --triplet=x64-windows-static-md 2 | echo **Manually supplement include/boost/di/extension** --------------------------------------------------------------------------------