Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Elevate to Admin while runtime

What's the different to the IDE setting?

h t t p : / / s14.directupload .net/images/141108/ahhgavre .png
So much fail in the code.

Return in the catch block? why? lol
And why it's on a Try block ? Why not check if the file exists first? since it's running, it will exist...
Why put shellexecute = true when it's default?
Why you didn't use Application.ExecutablePath instead of reflection crap?
Why you didn't use Application.StartupPath instead of CurrentDirectory?
(Nov 8, 2014 04:13 PM)imi-tat0r Wrote:  Because this code is really really old and I just found it on my HardDrive. thought I could share it as it is nothing ub3r mega private but it's not posted here.

And the difference to the IDE Settings is just, that you can elevate on button press or just when you need it :)

What IDE settings ? Do you even have a clue what the code does?
It does not work...

I've tried the following:

Code
Private Sub aa()
      Dim wp = New WindowsPrincipal(WindowsIdentity.GetCurrent())
      If wp.IsInRole(WindowsBuiltInRole.Administrator) Then
      MessageBox.Show("Admin!")
      Else
      MessageBox.Show("Other User")
      End If
    End Sub

OS is Win 8.1.

Returns "Other User" although I have administrator rights.
(Nov 10, 2014 05:19 AM)Easi-- Wrote:  It does not work...

I've tried the following:

Code
Private Sub aa()
      Dim wp = New WindowsPrincipal(WindowsIdentity.GetCurrent())
      If wp.IsInRole(WindowsBuiltInRole.Administrator) Then
      MessageBox.Show("Admin!")
      Else
      MessageBox.Show("Other User")
      End If
    End Sub

OS is Win 8.1.

Returns "Other User" although I have administrator rights.

That code doesn't check if the current account logged to windows has admin privileges, that checks if your application has them.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by gogglebotMay 26, 2018 08:48 PM 30 1,727 May 26, 2018 08:48 PM
Last Post: Erhan
[C#] by MalwareOct 16, 2014 08:07 PM 13 877 Oct 16, 2014 08:07 PM
Last Post: Malware
[.NET] by E3zh00rnApr 3, 2014 11:34 AM 3 149 Apr 3, 2014 11:34 AM
Last Post: E3zh00rn