Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: ARM64 build for Windows 10 #1488

Open
tycho opened this issue Mar 22, 2018 · 9 comments
Open

Feature request: ARM64 build for Windows 10 #1488

tycho opened this issue Mar 22, 2018 · 9 comments

Comments

@tycho
Copy link

tycho commented Mar 22, 2018

Windows 10 for ARM64 is out, and it has proper Windows desktop development support (none of this "Windows RT" nonsense). It even runs x86 (and on Windows 11, x86_64) apps under a transparent emulation layer. So ConEmu can sort of run on my ARM64 device, but it's slow and it's not able to hook into the ARM native conhost or anything like that.

It would be very nice to have support for the new architecture. The big things blocking this from what I can see are:

  • premake5.lua needs an ARM64 platform added.
    This patch was pretty close. Managed to build all but 2 of the projects (ConEmuHk, ConEmuCD). I don't know why I had to add the gdi32/shell32/comdlg32/advapi32/ole32 libs to the "links" sections -- or rather, I don't know why it worked previously without them listed there.
  • MinHook doesn't understand how to hook an ARM64 process.
  • The ConEmu hooking infrastructure needs to be taught about the new ConEmuHkArm64.dll (since it currently only knows about 32/64).

The MinHook stuff looks rather hairy and I don't know where to begin on that.

EDIT: Corrected statements about emulation capabilities.

@matbech
Copy link

matbech commented Jun 25, 2018

Detours offers ARM64 support:
https://github.com/microsoft/Detours

@Maximus5
Copy link
Owner

Definitely, I need to check Detours and compare them with Minhook. If there will no speed drawbacks, I may use this package.

@chrisant996
Copy link

@Maximus5 if ConEmu uses IAT style hooking, then Detours might not be a viable alternative: I made Clink use Detours, but eventually had to disable the Detours support and go back to IAT hooking because they have different side effects and the order that hooks are called is different.

  • IAT hooking hooks at the earliest moment of getting called.
  • Detours hooks the API itself, so it hooks the latest moment of getting called.

Switching libraries changes the relative order of hooks being injected, and so if other things are using IAT style hooks on the same APIs ConEmu is hooking, then if ConEmu uses Detours then they will precede ConEmu's hooks. That may or may not cause problems for ConEmu. For Clink, it definitely caused problems.

@Maximus5
Copy link
Owner

Thanks for the info @chrisant996
As I know, Detours works exactly the same way as minhooks I used in ConEmu (replace of first instructions in the API function body)

@chrisant996
Copy link

@Maximus5 @DRSDavidSoft oh, my mistake -- I got minhook mixed up. Yes, both minhook and Detours do jmp hooking, not IAT hooking. In that case, Detours should be compatible.

I thought I read that ARM hooking was the only/main thing preventing an ARM version of ConEmu. But it sounds like Detours should be compatible, so maybe the only thing standing in the way is some time investment?

And if necessary I could probably make Clink use Detours for ARM, since incompatibilities like AnsiCon won't be a problem on ARM (since they don't have ARM versions anyway).

@DRSDavidSoft
Copy link

@chrisant996 I appreciate it nonetheless, this appears to be a (somewhat) straightforward thing to do, I'm willing to spend some time to see if I can make some examples to work on ARM.

P.S. A great ARM64 device to run Windows 11 ARM (albeit, a bit slower than Apple M1) is a Raspberry Pi 4. If interested, see the Windows on Raspberry Pi project. It certainly beats using an emulator, as it's bare metal hardware, and reasonably priced.

@Maximus5 Sorry to bother you, but may I ask if you could take a look at or do some tests with Detour on x86_64? Unfortunately I don't think that I have enough experience or expertise to modify the existing implementation, without some working reference code.

@grealish
Copy link

Any update here? many new WoA devices comming into the picture, like MS DevKit and Thinkpad X13s (both on Qualcomm Snapdragon)

@Sim-md
Copy link

Sim-md commented Sep 11, 2024

I have notebook with Snapdragon X Elite processor.
Do you have an update for ARM64 support?

@RussianE39
Copy link

ConEmu in current state is buildable for ARM64EC, process is basically straightforward. Two things were issue:

  1. Linker for ARM64 not support /DYNAMICBASE:NO so you need to adjust Linker options
  2. Editing .def files for CD and HK:
    `--- a/src/ConEmuCD/export.def
    +++ b/src/ConEmuCD/export.def
    @@ -1,4 +1,4 @@
    -LIBRARY
    +LIBRARY ConEmuCD64

EXPORTS
; functions
@@ -12,10 +12,11 @@ EXPORTS
GuiMacro

; LLKeyHooks (ConEmu GUI)

  • ghKeyHook
  • gnVkWinFix
  • gbWinTabHook
  • gnConsoleKeyShortcuts
  • gnHookedKeys
  • ghKeyHookConEmuRoot
  • ghActiveGhost
  • ghKeyHook DATA
  • gnVkWinFix DATA
  • gbWinTabHook DATA
  • gnConsoleKeyShortcuts DATA
  • gnHookedKeys DATA
  • ghKeyHookConEmuRoot DATA
  • ghActiveGhost DATA

--- a/src/ConEmuHk/export.def
+++ b/src/ConEmuHk/export.def
@@ -1,4 +1,4 @@
-LIBRARY
+LIBRARY ConEmuHk64`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants