How to bake in Administrator request into compiled .exe
Posted: Fri Dec 20, 2024 3:29 pm
Hello everyone at Love2D!
Today I finished up creating a tool that I want to distribute to my companies customers so they can easilly update their embedded systems via serial (targetted at Windows 7 or higher). This works amazingly on multiple COM ports at the same time with different threads, however I also descided to include an auto driver installer into the application so users don't have to go to device manager, and install the .inf themselves and that's where I hit a wall.
The problem is that the Microsoft pnputil install command required admin privileges to actually install the driver which means when I found out I have to either run that command as admin, or the application. I went for the "run the whole app as admin" approach since I don't want a driver installer thread to ask for admin rights for every new driver since new ones might be required in the future since my new embedded board is getting micro controllers from different brands, which also need updating.
What I tried was after compiling the application into a convinient .exe to replace the default manifest with the one in the picture which I patched with Mt.exe. Now when running the app I need to grant admin rights which is great but a "No game" screen shows which I can't explain why. When patching the app with the default love2D manifest where you are not asked for admin rights it finds the applications Lua files perfectly.
The question is, is there a better way to bake in admin rights into the program, or is something wrong with the manifest?
When baking the new manifest with resource hacker it goes smoothly, but this doesn't seem to be automatable via a CLI.
Sorry for the long post...
Today I finished up creating a tool that I want to distribute to my companies customers so they can easilly update their embedded systems via serial (targetted at Windows 7 or higher). This works amazingly on multiple COM ports at the same time with different threads, however I also descided to include an auto driver installer into the application so users don't have to go to device manager, and install the .inf themselves and that's where I hit a wall.
The problem is that the Microsoft pnputil install command required admin privileges to actually install the driver which means when I found out I have to either run that command as admin, or the application. I went for the "run the whole app as admin" approach since I don't want a driver installer thread to ask for admin rights for every new driver since new ones might be required in the future since my new embedded board is getting micro controllers from different brands, which also need updating.
What I tried was after compiling the application into a convinient .exe to replace the default manifest with the one in the picture which I patched with Mt.exe. Now when running the app I need to grant admin rights which is great but a "No game" screen shows which I can't explain why. When patching the app with the default love2D manifest where you are not asked for admin rights it finds the applications Lua files perfectly.
The question is, is there a better way to bake in admin rights into the program, or is something wrong with the manifest?
When baking the new manifest with resource hacker it goes smoothly, but this doesn't seem to be automatable via a CLI.
Sorry for the long post...