3 Commits
Author SHA1 Message Date
tiennm99 a9a76fb541 Update InjectionManager.cs 2026-02-27 15:56:25 +07:00
tiennm99 add9912ddd Update release.yml 2026-02-27 15:35:08 +07:00
tiennm99 d394f6f589 Revert "feat: update actions"
This reverts commit ad9624f1d72b1c75b65a3c7876ef75d3171df874.
2026-02-27 15:29:26 +07:00
3 changed files with 25 additions and 18 deletions

No files matched your search

+6 -4
View File
@@ -10,17 +10,19 @@ permissions:
jobs:
build-and-release:
runs-on: windows-2019
runs-on: windows-2025-vs2026
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
- name: Build Solution
run: msbuild TimeMocker.sln -p:Configuration=Release -p:Platform=x64 -m
run: dotnet build TimeMocker.sln -c Release -p:Platform=x64
- name: Prepare Release Artifacts
run: |
@@ -65,29 +65,23 @@ namespace TimeMocker.Hook
public void Run(RemoteHooking.IContext context, string mmfName)
{
string logPath = Path.Combine(Path.GetTempPath(), "TimeMocker.Hook.log");
try
{
File.AppendAllText(logPath, $"[{DateTime.Now}] Starting hook, MMF: {mmfName}\r\n");
// Open the shared memory created by the UI process
_mmf = System.IO.MemoryMappedFiles.MemoryMappedFile.OpenExisting(mmfName);
_view = _mmf.CreateViewAccessor(0, Marshal.SizeOf<MockTimeInfo>());
File.AppendAllText(logPath, $"[{DateTime.Now}] MMF opened successfully\r\n");
InstallHooks();
File.AppendAllText(logPath, $"[{DateTime.Now}] Hooks installed successfully\r\n");
RemoteHooking.WakeUpProcess();
File.AppendAllText(logPath, $"[{DateTime.Now}] Process woken up\r\n");
// Keep alive until process exits
while (true) Thread.Sleep(500);
}
catch (Exception ex)
{
File.AppendAllText(logPath, $"[{DateTime.Now}] ERROR: {ex.GetType().Name}: {ex.Message}\r\n{ex.StackTrace}\r\n");
File.AppendAllText(
Path.Combine(Path.GetTempPath(), "TimeMocker.Hook.log"),
$"[{DateTime.Now}] ERROR: {ex}\r\n");
}
finally
{
+16 -5
View File
@@ -95,17 +95,28 @@ namespace TimeMocker.UI.Core
}
}
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool IsWow64Process2(
IntPtr hProcess,
out ushort pProcessMachine,
out ushort pNativeMachine);
private static bool Is64BitProcess(Process process)
{
if (!Environment.Is64BitOperatingSystem)
return false;
bool isWow64;
if (!IsWow64Process(process.Handle, out isWow64))
return false;
ushort processMachine, nativeMachine;
if (IsWow64Process2(process.Handle, out processMachine, out nativeMachine))
{
// IMAGE_FILE_MACHINE_UNKNOWN (0) means it's a native 64-bit process
// IMAGE_FILE_MACHINE_I386 (0x014c) means it's 32-bit on 64-bit Windows
return processMachine == 0x0000; // 0 = native, not emulated
}
// If IsWow64Process returns false, it's a 64-bit process
// If it returns true, it's a 32-bit process running on 64-bit Windows
// Fallback
bool isWow64;
IsWow64Process(process.Handle, out isWow64);
return !isWow64;
}