Closed DigicoolThings closed 1 year ago
HxD will determine the Plugins directory using this logic:
PluginsPath := IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + 'Plugins';
ParamStr(0)
is equivalent to calling GetModuleFileName(0, [...])
, which means:
If this parameter is NULL, GetModuleFileName retrieves the path of the executable file of the current process.
Please be aware that the Windows explorer context menu integration is meant to be used with an unchanging executable directory, i.e., preferably the installed version of HxD, not the portable one. But it works fine, either way:
I just tested it with the demo plugins given in the framework and it works fine, when HxD is installed.
It also works with the portable version, when adding it to the Windows explorer context menu.
Both times the plugins in the Plugins
directory get loaded properly, when the folder structure is as follows:
FolderName\HxD.exe
FolderName\Plugins\
Maybe "Open with HxD" starts another HxD.exe than you think? Try removing the Explorer integration and then readding it, and remove duplicates of HxD.exe on your disk to make sure the right one gets loaded.
Since there has been no feedback anymore, I assume the issue is resolved.
I have replicated this phenomenon, but it still hasn't been resolved.
嗨,Maël,
我的反汇编器插件 (exodustx0) 的用户注意到通过 Windows 的“打开方式”上下文菜单运行 HxD 时的问题。例如,通过右键单击目标文件打开 HxD 时。
完成此操作后,该插件似乎没有被 HxD 激活。
我认为问题只是我的插件本身没有正确定位它自己的 CPU 定义(默认位于同一个 'Plugins' 相对目录中)的问题,我开始实施更改以确保相对目录引用也看起来是相对于实际的应用程序路径的。
然而,在测试中,我确定在使用“打开方式”上下文菜单的情况下,我的插件甚至没有被 HxD 调用/初始化。
即 HxD 似乎没有找到 HxD Applications 目录的“Plugins”子文件夹,因此没有初始化其中包含的 Plugins。
我现在想知道 HxD 是否确保它相对于 Applcation 路径查找它的 'Plugins' 文件夹,以满足 HxD 不直接运行的情况(例如,通过文件管理器的 “打开方式” 上下文菜单运行时)?
出于兴趣,首先尝试在我的插件中解决此问题时,我通过以下任一方法找到实际应用程序的路径:
ApplicationPath := ExtractFilePath(Application.ExeName); // or ApplicationPath := ExtractFilePath(Paramstr(0));
...我已经验证了,它返回了预期的 HxD 安装文件夹。
在我的插件示例中,我还通过以下方式确定用户提供的 CPU 定义路径 (DefinitionFilePath) 是相对路径还是完全定义的路径:
System.IOUtils.TPath.IsPathRooted(IniSettings[CurrentDasmType].DefinitionFilePath)
但是,正如我所说,当我发现 HxD 本身似乎根本没有调用/初始化我的插件时,当我通过 Windows 的“打开方式”连接菜单调用时,我对需要在插件中进行的更改的测试(本质上不是假设相对文件夹引用是相对于 Windows 当前路径的)停止了。
希望您能帮助解决问题,这样我就可以找到一个解决方案来确保 'Plugins' 相对文件夹(或任何 HxD 应用程序文件夹相对引用)始终被正确定位。
Hi Maël,
A user of my Disassembler Plugin (exodustx0), has noted an issue when running HxD via the Windows "Open with" context menu. i.e. When opening HxD via right clicking on the target file.
When this is done, the Plugin does not appear to be activated by HxD.
Thinking the issue was just a problem with my Plugin itself not correctly locating it's own CPU Definitions (which default to being in the same 'Plugins' relative directory), I started implementing changes to ensure relative directory references also look relative to the actual Application path.
However, in testing I determined that in the case of "Open with" context menu use, my Plugin wasn't even being called/initialised by HxD.
i.e. It appeared HxD was not finding the HxD Applications directory's 'Plugins' subfolder, and therefore not intialising the Plugins contained therein.
I am now wondering if HxD is ensuring it looks for it's 'Plugins' folder relative to the Applcation path, to cater for cases where HxD is not being run directly (e.g. when run via the File Manager's "Open with" context menu)?
For interest, in first attempting to resolve this in my Plugin, I locate the actual Application's path via the either of the following:
ApplicationPath := ExtractFilePath(Application.ExeName); // or ApplicationPath := ExtractFilePath(Paramstr(0));
...which I have verified returns the expected HxD installation folder.
In my Plugin's case, I also determine if the user provided CPU defintions path (DefinitionFilePath), is a Relative path or a Fully Defined path via:
System.IOUtils.TPath.IsPathRooted(IniSettings[CurrentDasmType].DefinitionFilePath)
But, as I say, my testing of the changes I need to make within my Plugin (essentially to not assume a relative folder reference is relative to the Windows Current Path), came to a halt when I discovered that HxD itself appears to not be calling/initialising my Plugin at all, when called via the Windows "Open with" contect menu.
Hope you can assist with zeroing in on the problem, so that I can find a solution to ensure the 'Plugins' relative folder (or any HxD application folder relative reference), is always being correctly located.
The plugin is indeed loaded. I suspect that when your DLL is invoked, it does not correctly obtain the folder for the CSV. I tried placing a ‘Plugins’ folder (which contains the CSV) in the folder where the context menu is located, and as a result, it can be decompiled normally.
Hi Maël,
A user of my Disassembler Plugin (exodustx0), has noted an issue when running HxD via the Windows "Open with" context menu. i.e. When opening HxD via right clicking on the target file.
When this is done, the Plugin does not appear to be activated by HxD.
Thinking the issue was just a problem with my Plugin itself not correctly locating it's own CPU Definitions (which default to being in the same 'Plugins' relative directory), I started implementing changes to ensure relative directory references also look relative to the actual Application path.
However, in testing I determined that in the case of "Open with" context menu use, my Plugin wasn't even being called/initialised by HxD.
i.e. It appeared HxD was not finding the HxD Applications directory's 'Plugins' subfolder, and therefore not intialising the Plugins contained therein.
I am now wondering if HxD is ensuring it looks for it's 'Plugins' folder relative to the Applcation path, to cater for cases where HxD is not being run directly (e.g. when run via the File Manager's "Open with" context menu)?
For interest, in first attempting to resolve this in my Plugin, I locate the actual Application's path via the either of the following:
...which I have verified returns the expected HxD installation folder.
In my Plugin's case, I also determine if the user provided CPU defintions path (DefinitionFilePath), is a Relative path or a Fully Defined path via:
But, as I say, my testing of the changes I need to make within my Plugin (essentially to not assume a relative folder reference is relative to the Windows Current Path), came to a halt when I discovered that HxD itself appears to not be calling/initialising my Plugin at all, when called via the Windows "Open with" contect menu.
Hope you can assist with zeroing in on the problem, so that I can find a solution to ensure the 'Plugins' relative folder (or any HxD application folder relative reference), is always being correctly located.