Git Product home page Git Product logo

Comments (5)

chrisant996 avatar chrisant996 commented on May 23, 2024

Clink has to know what process to inject into. If you don't specify one via --session then it uses the parent process. When cmd.exe runs clink inject, cmd.exe is the parent process, so Clink is able to automatically find the right cmd.exe process.

Since you're using an .exe shim, the shim is the parent process. But no process id was specified, and the Clink cannot inject into the shim process, so it fails. "Unknown host 'clink.exe'" means "clink.exe is not cmd.exe, so can't inject into clink.exe".

The reason it selects the clink_x86.exe is because the alternative exe shim is x86, and so the OS has automatically been dropped into x86 mode, and so the clink.bat file sees that the current OS mode is x86 and so it naturally accommodates that, since that's what the mode the user has selected externally.

Let's back up a few steps:

What was the motivation for trying to use scoop-better-shimexe?
What problem was encountered that is trying to be solved by making an exe shim?

Any attempt to use an exe shim for Clink will force the OS mode to use the same CPU emulation mode as the exe itself. E.g. on an ARM device, if the exe shim is x64, then the exe shim will force x64 mode even though the CPU is natively ARM64 and even if the original cmd.exe that invoked the shim was ARM64.

That's the whole reason Clink has its own clink.bat shim -- it is functionally necessary to have a batch script shim.

If you can share what problem was encountered, maybe there's a better way to solve the problem than creating an exe shim (which will inherently cause other problems).

from clink.

ImportTaste avatar ImportTaste commented on May 23, 2024

What was the motivation for trying to use scoop-better-shimexe?

Having my profile path automatically included in the arguments without having to edit the batch file.

from clink.

chrisant996 avatar chrisant996 commented on May 23, 2024

If you want to always use a particular profile, have you considered setting %CLINK_PROFILE%? See docs for more info.

from clink.

ImportTaste avatar ImportTaste commented on May 23, 2024

If you want to always use a particular profile, have you considered setting %CLINK_PROFILE%? See docs for more info.

I knew about it, but using a shim was more appealing to me. Oh well.

from clink.

chrisant996 avatar chrisant996 commented on May 23, 2024

@ImportTaste You can still use a shim. Just not an exe shim. Or if you want to use an exe shim, then you need to make the shim find its parent process and pass that via --session parent_process_id.

Or you can simply make your own separate clink.bat file in a separate directory, and put that directory earlier in the %PATH% so that it gets used instead of Clink's own clink.bat file. Your separate script can be as simple as:

@c:\clink\bin\clink.bat --profile c:\clink\usr %*

I think there are several easy ways to get exactly the behavior you want, without using %CLINK_PROFILE%. But an exe shim isn't one of them. And also wouldn't be simple to write, because it takes extra coding to avoid interfering with the ability to actually inject. And also an exe shim can inherently interfere with the context and CPU type or emulation, which can in turn mess with registry access and file system access, because of how 64/32 virtualization works in Windows.

from clink.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.