Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows: How to create custom appcompat shims (Application Fixes)?

Windows has the capability to apply shims to mis-behaving applications. Shims are used to intercept API calls and change it. For example, shims can be used to:

  • change the incoming paramters
  • lie about the return values
  • change it to call something else

The Application Compatibility Tookit has quite a few existing shims you can apply to your own mis-behaving application. Here's an example of one that ignores your API call and instead calls a completely different API instead:

alt text

i need a shim that isn't one of the hundreds of shims Microsoft already wrote. i need a custom shim.

In my case i want to intercept calls to:

GetSystemMetrics(0x1000)

so that it returns 0. i can't find any information on how to give Windows my own DLL that will have the fix i need. i don't even know if you can create custom shims.

Does Windows support custom shims?

like image 744
Ian Boyd Avatar asked Nov 10 '09 22:11

Ian Boyd


People also ask

What is an application shim?

Application shimming is a Windows Application Compatibility framework that Windows created to allow programs to run on versions of the OS that they were not initially created to run on. Most applications that used to run on Windows XP can today run on Windows 10 due to this framework.

What is a Compatibility shim?

In computer programming, a shim is a small library which transparently intercepts an API, changes the parameters passed, handles the operation itself, or redirects the operation elsewhere. Shims can also be used for running programs on different software platforms than they were developed for.


1 Answers

I'm not aware of any way of someone other than Microsoft implementing an appcompat shim.

You might want to investigate Detours, it might provide the functionality you want.

like image 61
ReinstateMonica Larry Osterman Avatar answered Oct 20 '22 07:10

ReinstateMonica Larry Osterman