Use VisualStudioMock.exe (still not fully working)
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-02-20 12:51:22 +01:00
parent 36fe0d3bf2
commit 8c165a7194
6 changed files with 20 additions and 6 deletions

View File

@@ -6,6 +6,7 @@ steps:
image: mcr.microsoft.com/dotnet/sdk:8.0
commands:
- dotnet build --configuration Release Eazfuscator-Launcher/Eazfuscator-Launcher.csproj
- dotnet build --configuration Release VisualStudioMock/VisualStudioMock.csproj
- name: docker
image: plugins/docker

View File

@@ -38,7 +38,9 @@ RUN wget -nv -O- https://dl.winehq.org/wine-builds/winehq.key | APT_KEY_DONT_WAR
&& dpkg --add-architecture i386 \
&& apt-get update \
&& DEBIAN_FRONTEND="noninteractive" apt-get install -y --install-recommends wine-${WINE_BRANCH} \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
&& sed -i -E "s:PATH=\"?([^\"]*)\"?:PATH=/opt/wine-stable/bin\:\1:g" /etc/environment \
&& export PATH=/opt/wine-stable/bin:$PATH
COPY entrypoint.sh /usr/bin/entrypoint
@@ -63,6 +65,7 @@ ENV DISPLAY ":95"
ENV WINEARCH win32
COPY tools/* /root/.wine/drive_c/windows/system32/
COPY VisualStudioMock/bin/Release/net472/VisualStudioMock.exe /root/.wine/drive_c/VisualStudioMock.exe
RUN set -x -e; \
# Install dotnet
@@ -102,6 +105,8 @@ RUN set -x -e; \
# Install socat to temporarily overcome bug until dotnet 9 gets released and have the bug https://github.com/dotnet/runtime/issues/98441 fixed
apt update; \
apt install -y --no-install-recommends socat; \
# Register VisualStudioMock
wine "c:\\VisualStudioMock.exe" /reg; \
# Clean-up
rm -rf /tmp/eaz.zip /tmp/eaz /tmp/dotnet.exe /tmp/chk /var/lib/apt/lists/*; \
# Complete

View File

@@ -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)

View File

@@ -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");

View File

@@ -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()

View File

@@ -18,6 +18,7 @@ class A {
ISetupInstance2 c = (ISetupInstance2)b[0];
Console.WriteLine("Instance - " + c.GetDisplayName());
Console.WriteLine("\t GetDisplayName = " + c.GetDisplayName());
Console.WriteLine("\t GetInstallationVersion = " + c.GetInstallationVersion());
Console.WriteLine("\t GetInstallationPath = " + c.GetInstallationPath());
Console.WriteLine("\t GetEnginePath = " + c.GetEnginePath());