Author |
Message |
Registered: March 14, 2007 | Reputation: | Posts: 4,686 |
| Posted: | | | | When I test the program that I have under development against mediadigg's plugin HTTPJolie, I have to run DVD Profiler as administrator. But at night I need to run it non-elevated, otherwise my backup routines don't work.
The problem is that I tend to forget to shut down Profiler after testing is done and then run it non-elevated. It would help if I could tell in which mode it is running, especially if I could somehow get a visual clue.
It's not that hard to shut down and restart even if it actually isn't necessary (if it's already non-elevated), but I might be more likely to remember doing so if I could tell that it's running as Administrator.
Any suggestions? | | | My freeware tools for DVD Profiler users. Gunnar |
|
Registered: March 13, 2007 | Reputation: | Posts: 1,440 |
| Posted: | | | | | | | Registered: February 10, 2002 |
|
Registered: March 14, 2007 | Reputation: | Posts: 4,686 |
| |
Registered: March 14, 2007 | Reputation: | Posts: 4,686 |
| Posted: | | | | After some digging I found an easy way to determine it programatically, so I wrote a very small program. Just a small square that is blue if Profiler is not running, green if it is running in normal mode and red if it is running elevated. It can also autostart when windows starts. And it stays on top. If, by chance, anyone would be interested in it, send me a PM. PS. Normally I wouldn't place it over the Title field, of course. I just wanted something recognizable for reference. | | | My freeware tools for DVD Profiler users. Gunnar |
|
Registered: March 18, 2007 | Reputation: | Posts: 6,463 |
| Posted: | | | | That might be useful to have as part of the udpWatcher sample code, if you don't mind that I include it. Hopefully, either I or somebody else will help me figure out how to remove that elevated requirement. | | | Thanks for your support. Free Plugins available here. Advanced plugins available here. Hey, new product!!! BDPFrog. | | | Last edited: by mediadogg |
|
Registered: March 18, 2007 | Reputation: | Posts: 6,463 |
| Posted: | | | | By the way, there is some hot shot tool guy that has a program - some kind of task scheduler. You could setup a task to start Profiler in the morning as elevated, shut it down and restart un-elevated for backups, etc. | | | Thanks for your support. Free Plugins available here. Advanced plugins available here. Hey, new product!!! BDPFrog. |
|
Registered: March 14, 2007 | Reputation: | Posts: 4,686 |
| Posted: | | | | Quoting mediadogg: Quote: By the way, there is some hot shot tool guy that has a program - some kind of task scheduler. You could setup a task to start Profiler in the morning as elevated, shut it down and restart un-elevated for backups, etc. Yeah, I thought about that. But there are security restrictions that foil that idea: 1) DvdpScheduler starts on Windows startup. But you can't start a program elevated that way, so it will always run un-elevated. 2) DvdpScheduler can't start a program in elevated mode unattended. 3) DvdpScheduler can't shut down an elevated program (un-elevated programs can't send keystrokes to elevated programs). | | | My freeware tools for DVD Profiler users. Gunnar |
|
Registered: March 14, 2007 | Reputation: | Posts: 4,686 |
| Posted: | | | | Quoting mediadogg: Quote: That might be useful to have as part of the udpWatcher sample code, if you don't mind that I include it. Hopefully, either I or somebody else will help me figure out how to remove that elevated requirement. private void CheckStatus() { try { var DpProc = Process.GetProcessesByName("dvdpro").FirstOrDefault(); if (DpProc is null) { grdMain.Background = Brushes.Blue; // Not running } else { var pc = DpProc.PriorityClass; DpProc.PriorityClass = pc; // This will throw an exception if elevated grdMain.Background = Brushes.Green; } // Running un-elevated } catch (Exception ex) { grdMain.Background = Brushes.Red; } // Running elevated }This is how I select the background color of my tool. I converted it to C# just for you. | | | My freeware tools for DVD Profiler users. Gunnar |
|
Registered: March 18, 2007 | Reputation: | Posts: 6,463 |
| Posted: | | | | Hey now, nothing like being served code on a silver platter! | | | Thanks for your support. Free Plugins available here. Advanced plugins available here. Hey, new product!!! BDPFrog. |
|
Registered: March 18, 2007 | Reputation: | Posts: 6,463 |
| Posted: | | | | Quoting GSyren: Quote: Quoting mediadogg:
Quote: By the way, there is some hot shot tool guy that has a program - some kind of task scheduler. You could setup a task to start Profiler in the morning as elevated, shut it down and restart un-elevated for backups, etc. Yeah, I thought about that. But there are security restrictions that foil that idea: 1) DvdpScheduler starts on Windows startup. But you can't start a program elevated that way, so it will always run un-elevated. 2) DvdpScheduler can't start a program in elevated mode unattended. 3) DvdpScheduler can't shut down an elevated program (un-elevated programs can't send keystrokes to elevated programs). Have you ever tried converting it into a service? Turns out to be dead easy, and might remove some of those restrictions. Running DVD Profiler as a service didn't work for me, but it works great for simpler executables. See here. | | | Thanks for your support. Free Plugins available here. Advanced plugins available here. Hey, new product!!! BDPFrog. |
|
Registered: March 14, 2007 | Reputation: | Posts: 4,686 |
| Posted: | | | | I should point out that my code snippet only works in un-elevated code. If you run it elevated you won't get that necessary security exception. Or so I think, anyway. | | | My freeware tools for DVD Profiler users. Gunnar |
|