3

问题始于对尚不支持的单声道函数的函数调用。该调用是从一个名为 MWARRAY.DLL(.net 版本 2.x)的关闭 matlab DLL 进行的,此 dll 通常与 VS .NET 一起使用,并且如果您使用 .net 3.5 则可以正常工作。

函数是:[mscorlib]System.Security.Principal.WindowsIdentity::GetCurrent(bool)

我可以想到一些可能的解决方案,但我不知道该怎么做:

  1. 反编译 dll 并用类似的工作函数替换字节码: [mscorlib]System.Security.Principal.WindowsIdentity::GetCurrent() 注意没有传递给函数的布尔值
  2. 编译单声道并自己编写函数
  3. 使用旧版本的 MWARRAY.DLL(找不到,但可能仍使用相同的代码)

对于反编译,我使用了 IDA。我找到了调用第一个函数的位置,CIL + HEX 下面

loc_38B1:    
ldsfld  native     
int [mscorlib]System.IntPtr::Zero   
stloc.s 7    
ldc.i4.0
stloc.s 8
ldc.i4.1
stloc.s 9
ldc.i4.1
call    class [mscorlib]System.Security.Principal.WindowsIdentity::GetCurrent(bool)
stloc.s 0xA
call    void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::PrepareConstrainedRegions()
  .try {
ldc.i4.0
stloc.s 0xB
br      loc_3982

call 和 stloc 命令的 HEX:

28 96 00 00 0A 

我还编译和反编译了我自己的 dll,调用这两个函数只是为了查看另一个命令在字节码中的样子:

loc_3AE:
call    class [mscorlib]System.Security.Principal.WindowsIdentity [mscorlib]System.Security.Principal.WindowsIdentity::GetCurrent()
callvirt class System.String [mscorlib]System.Security.Principal.WindowsIdentity::get_Name()
stloc.s 8
ldc.i4.1

自定义编译/反编译行的十六进制粗体:

28  00 00 0A 6F 1B 00 00 0A  13 08 17

我想知道是否有人知道建议的解决方案路径,或者其他可能会想到的东西?

4

1 回答 1

2

这已经解决了。

使用 .net 反射器提取 mwarray.dll 可以从 Visual Studio 内部更改代码。

在第 330 行附近的 MCR() 类中,调用了 getcurrent()。替换为 =null;

于 2012-01-17T06:03:31.847 回答