我有一个 VDD dll,它由NTVDM内运行的 DOS 程序加载。此 dll 使用 C++/CLI 并引用 .NET 程序集。
总而言之,加载过程是这样的:
NTVDM runs:
prntsr.com which uses VDD RegisterModule to load:
prnvdd.dll which references .NET assembly:
prnlib.dll
和文件prntsr.com
都在同一个文件夹中prnvdd.dll
。prnlib.dll
但是,在加载它时,我得到以下异常:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'PRNLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ecf23cee305e91b7' or one of its dependencies. The system cannot find the file specified.
File name: 'PRNLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ecf23cee305e91b7'
at VDD_Initialise()
=== Pre-bind state information ===
LOG: User = DOMAIN\user
LOG: DisplayName = PRNLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ecf2
3cee305e91b7
(Fully-specified)
LOG: Appbase = file:///C:/WINDOWS/system32/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: PRNLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ecf23cee305e91b7
LOG: Attempting download of new URL file:///C:/WINDOWS/system32/PRNLib.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/system32/PRNLib/PRNLib.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/system32/PRNLib.EXE.
LOG: Attempting download of new URL file:///C:/WINDOWS/system32/PRNLib/PRNLib.EXE.
它只搜索C:\WINDOWS\system32\
程序集,我猜这是由于 NTVDM.EXE - 因为这是加载程序集的实际过程,它将其位置作为 AppBase。
任何想法如何更改 AppBase 或以其他方式解决此问题?