Nvidia Optimus is a major thorn in my side. I just bought a new laptop that is using this on-the-fly gpu switching crap. This means that unless an application starts by querying the GPU for 3D tech or directx, then it uses the intel integrated. This means many applications don't use the GPU (even if you specify it in the Nvidia Control Panel). Some examples: if you run the WEI rating, or dxdiag, or in my case.. xilisoft video converter. Here is a program that can use the GPU to assist in the processing time of the video encoding. Yet since it doesn't try to access the GPU until the encoding starts.. the options to enable the GPU assist are greyed out. It's maddening.
So, I made a very simple DLL in visual basic that initializes directx. I then created another program in visual basic.. a simple window with a single button. When you click this button, it loads the dll file and runs the function that sends an initialization command to directx.
With the "Nvidia Optimus GPU state viewer" running to show which applications are being rendered by the dGPU I run my simple program. Of course it doesn't show up in the viewer. Then, when I press the button, wham, it's now being rendered by the dGPU.
However, this is where my limited programming knowledge ends. The goal here is when you have an app that you can't get running on the Nvidia, I want it to use this dll.
DLL INJECTION:
I know about DLL injection.. but I don't know how to do it. After injecting the dll.. how do you get the program to call the specific function INSIDE the dll which starts the directx process?
Wrapper:
Is it possible to make a wrapper/loader that could load the desired application but first run this directx function's code prior to the application starting up.. yet running it AS the application.. so it looks like the application made the call (to Optimus at least).
Assembly:
Perhaps we could make a jump after the entry point of the desired app to a "code cave" which then loads the dll and calls the function. Then create a program which can do this automatically for any desired applications.
Anyway, that's where I am. I'll keep plugging away at this, but any help would be appreciated. thanks.