Code Monkey home page Code Monkey logo

amc_patcher-cli's Introduction

AppModeChanger patcher - CLI

HMM Patches app's SUBSYSTEM flag to modify app's behavior.

Download

Trivia

There's an amazing Nirsoft VB snippet of AppModeChanger that does not support CLI usage (unless you want to mess with hotkeys, which is not a stable solution). I rewrote the code for command-line usage, but then turns out Nirsoft don't use any Git repos anywhere (from what I could see) I'd have to just host code and stuff here. The name was trunkated to amc for the easier CLI usage

Note that if you make changes to the AMC code and compile it, you'd need another copy of AMC, either CLI or GUI, to patch for it to work. Further explained in the How to compile section.

Usage:

Nirsoft original screenshot

amc <path_to_app> <new_mode>

Examples:

amc "C:/Projects/My CLI project/Project1.exe" 3 

(to set the Project1 application to the CLI mode), or

amc "C:/Projects/My CLI project converted to XBOX GUI/app.exe" 14

(to convert the app.exe to XBOX GUI app

Manual:

<path_to_app> - Path to your executable. "-tolerable

<new_mode> - New app SUBSYSTEM mode to set

Informally, one'd need to only know of modes: 2 (CLI) and 3 (GUI)

But below all known modes are listed:
        * 0 UNKNOWN Unknown system
        * 1 NATIVE Image doesn't require a subsystem
        * 2 WINDOWS_GUI Image runs in the Windows GUI subsystem
        * 3 WINDOWS_CUI Image runs in the Windows CLI subsystem (console)
        * 5 OS2_CUI image runs in the OS/2 character subsystem
        * 7 POSIX_CUI image runs in the Posix character subsystem
        * 8 NATIVE_WINDOWS image is a native Win9x driver
        * 9 WINDOWS_CE_GUI Image runs in the Windows CE subsystem
        * 10 EFI_APPLICATION An Extensible Firmware Interface (EFI) application
        * 11 EFI_BOOT_SERVICE_DRIVER An EFI driver with boot services
        * 12 EFI_RUNTIME_DRIVER An EFI driver with run-time services
        * 13 EFI_ROM An EFI ROM image
        * 14 IMAGE_SUBSYSTEM_XBOX No description
        * 16 IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION No description

How to compile

  1. [Recommended for compatibility] Get a Windows XP VM

  2. Get Microsoft Visual Basic 6.0

    • Tip: There is is a portable build, only a few megabytes. Look up Portable Microsoft Visual Basic 6.0 SP6
  3. Start Microsoft Visual Basic 6.0, open up the project.

  4. Go to File → Make *.exe → Save

  5. Patch the app for CLI use:

  6. Done!

How to turn your VB6 app into console/CLI

(based on my Stackoverflow answer)

  1. Clone this repo,
  2. Copy CLI.bas to your project, then add CLI.bas to your project. Now you can use the CLI functions. For example,
CLI.setup ' required line, to set up variables
CLI.send "some text -> "
CLI.SetTextColour CLI.FOREGROUND_RED OR CLI.FOREGROUND_GREEN OR CLI.FOREGROUND_INTENSITY ' for Orange and Intensive text, need to use OR, not AND
CLI.sendln "Orange foobar!"
CLI.sendln "maybe another line, why not?"
  1. Now you can use these functions if your code. Make sure to call CLI.setup first. I'd recommend for the first time, just test the functionality in Form1_Load()

  2. Compile your executable via VB6 suite, but the process is not finished yet.

  3. Your compiled app has to be patched to work in command-line mode. To do so, CD into AMC_patcher-CLI folder you called and perform.

     amc "C:/Projects/My CLI project/Project1.exe" 3
    

Where "C:/Projects/My CLI project/Project1.exe" - Is the path to your app EXE

Or alternatively for the patching step, use Nirsoft's original GUI patcher implementation. It is less scalable, but just as sturdy.

Acknowledgements

  • Insulin Pen icon icon by Icons8
    • Although I have their subscription, better safe than sorry

See also

My other small Windows tools,

  • AMC_patcher-CLI – (CLI) Patches app's SUBSYSTEM flag to modify app's behavior.
  • exe2wordsize – (CLI) Detects Windows-compatible application bitness, without ever running it.
  • SCAPTURE.EXE – (GUI) Simple screen-capturing tool for embedded systems.
  • txtShear – (CLI) Fast engine to skew (or shear) text by a desired angle, emulating handwriting.

amc_patcher-cli's People

Contributors

tabdiukov avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

m0n7y5

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.