Welcome to the Invelos forums. Please read the forum rules before posting.

Read access to our public forums is open to everyone. To post messages, a free registration is required.

If you have an Invelos account, sign in to post.

    Invelos Forums->DVD Profiler: Desktop Technical Support Page: 1  Previous   Next
Is there an easy way to tell if DVD Profiler is running as administrator?
Author Message
DVD Profiler Unlimited RegistrantStar ContributorGSyren
Profiling since 2001
Registered: March 14, 2007
Reputation: Highest Rating
Sweden Posts: 4,686
Posted:
PM this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
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
DVD Profiler Unlimited RegistrantStar Contributorgreyghost
Registered: March 13, 2007
Reputation: Highest Rating
United States Posts: 1,440
Posted:
PM this userView this user's DVD collectionDirect link to this postReply with quote
Registered: February 10, 2002
DVD Profiler Unlimited RegistrantStar ContributorGSyren
Profiling since 2001
Registered: March 14, 2007
Reputation: Highest Rating
Sweden Posts: 4,686
Posted:
PM this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
Thanks!
My freeware tools for DVD Profiler users.
Gunnar
DVD Profiler Unlimited RegistrantStar ContributorGSyren
Profiling since 2001
Registered: March 14, 2007
Reputation: Highest Rating
Sweden Posts: 4,686
Posted:
PM this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
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
DVD Profiler Desktop and Mobile Registrantmediadogg
Aim high. Ride the wind.
Registered: March 18, 2007
Reputation: Highest Rating
United States Posts: 6,463
Posted:
PM this userVisit this user's homepageDirect link to this postReply with 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.
Thanks for your support.
Free Plugins available here.
Advanced plugins available here.
Hey, new product!!! BDPFrog.
 Last edited: by mediadogg
DVD Profiler Desktop and Mobile Registrantmediadogg
Aim high. Ride the wind.
Registered: March 18, 2007
Reputation: Highest Rating
United States Posts: 6,463
Posted:
PM this userVisit this user's homepageDirect link to this postReply with 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. 
Thanks for your support.
Free Plugins available here.
Advanced plugins available here.
Hey, new product!!! BDPFrog.
DVD Profiler Unlimited RegistrantStar ContributorGSyren
Profiling since 2001
Registered: March 14, 2007
Reputation: Highest Rating
Sweden Posts: 4,686
Posted:
PM this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with 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).
My freeware tools for DVD Profiler users.
Gunnar
DVD Profiler Unlimited RegistrantStar ContributorGSyren
Profiling since 2001
Registered: March 14, 2007
Reputation: Highest Rating
Sweden Posts: 4,686
Posted:
PM this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
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
DVD Profiler Desktop and Mobile Registrantmediadogg
Aim high. Ride the wind.
Registered: March 18, 2007
Reputation: Highest Rating
United States Posts: 6,463
Posted:
PM this userVisit this user's homepageDirect link to this postReply with quote
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.
DVD Profiler Desktop and Mobile Registrantmediadogg
Aim high. Ride the wind.
Registered: March 18, 2007
Reputation: Highest Rating
United States Posts: 6,463
Posted:
PM this userVisit this user's homepageDirect link to this postReply with quote
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.
DVD Profiler Unlimited RegistrantStar ContributorGSyren
Profiling since 2001
Registered: March 14, 2007
Reputation: Highest Rating
Sweden Posts: 4,686
Posted:
PM this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
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
    Invelos Forums->DVD Profiler: Desktop Technical Support Page: 1  Previous   Next