Use VisualStudioMock.exe (still not fully working)
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//#define LOG_CALLS
|
||||
#define LOG_CALLS
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -44,6 +44,8 @@ namespace VisualStudioMock
|
||||
this._realInstanceN = Marshal.GetIUnknownForObject(instance);
|
||||
this._proxyInstanceN = Marshal.AllocHGlobal(IntPtr.Size * 4);
|
||||
|
||||
this._getInterfaceN = Marshal.GetFunctionPointerForDelegate((Delegate)(this._getInterface = new GetInterfaceDelegate(GetInterface)));
|
||||
|
||||
IntPtr vtbl = _proxyInstanceN + IntPtr.Size;
|
||||
Marshal.WriteIntPtr(_proxyInstanceN, vtbl);
|
||||
Marshal.WriteIntPtr(vtbl, this._getInterfaceN = Marshal.GetFunctionPointerForDelegate((Delegate)(this._getInterface = new GetInterfaceDelegate(GetInterface))));
|
||||
@@ -120,12 +122,12 @@ namespace VisualStudioMock
|
||||
|
||||
private int AddRef(IntPtr @this)
|
||||
{
|
||||
return 1;
|
||||
return Marshal.AddRef(_realInstanceN);
|
||||
}
|
||||
|
||||
private int Release(IntPtr @this)
|
||||
{
|
||||
return 1;
|
||||
return Marshal.Release(_realInstanceN);
|
||||
}
|
||||
|
||||
private static IntPtr CreateThunk(IntPtr @this, IntPtr jmpTarget)
|
||||
|
||||
@@ -10,6 +10,11 @@ namespace VisualStudioMock
|
||||
{
|
||||
private readonly SetupInstance _singleInstance;
|
||||
|
||||
static SetupConfiguration()
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => Console.WriteLine("Exception: ");
|
||||
}
|
||||
|
||||
public SetupConfiguration()
|
||||
{
|
||||
Ext.LogCall(nameof(SetupConfiguration), ".ctor");
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace VisualStudioMock
|
||||
|
||||
public string GetDisplayName([In, MarshalAs(UnmanagedType.U4)] int lcid = 0)
|
||||
{
|
||||
Ext.LogCall(nameof(SetupInstance), nameof(GetDisplayName));
|
||||
return "display name";
|
||||
Ext.LogCall(nameof(SetupInstance), nameof(GetDisplayName), "Lcid = " + lcid.ToString());
|
||||
return "Visual Studio Community 2022";
|
||||
}
|
||||
|
||||
public string GetInstallationName()
|
||||
|
||||
Reference in New Issue
Block a user