windows-vista

Detect if running as Administrator with or without elevated privileges?

ⅰ亾dé卋堺 提交于 2019-11-26 04:03:55
I have an application that needs to detect whether or not it is running with elevated privileges or not. I currently have code set up like this: static bool IsAdministrator() { WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); return principal.IsInRole (WindowsBuiltInRole.Administrator); } This works to detect if a user is an administrator or not, but doesn't work if running as an administrator without elevation. (For example in vshost.exe). How can I determine whether or not elevation is [already in force or] possible ?

How do you clear your Visual Studio cache on Windows Vista?

别来无恙 提交于 2019-11-26 03:51:40
问题 I have a problem where my ASP.NET controls are not able to be referenced from the code behind files. I found a solution in Stack Overflow question ASP.NET controls cannot be referenced in code-behind in Visual Studio 2008. But I cannot seem to find my Visual Studio cache to clear it. I am using Visual Studio 2005 on Windows Vista. 回答1: The accepted answer gave two locations: here C:\Documents and Settings\Administrator\Local Settings\Temp\VWDWebCache and possibly here C:\Documents and

Windows shortcut (.lnk) parser in Java?

此生再无相见时 提交于 2019-11-26 03:39:50
问题 I\'m currently using Win32ShellFolderManager2 and ShellFolder.getLinkLocation to resolve windows shortcuts in Java. Unfortunately, if the Java program is running as a service under Vista, getLinkLocation , this does not work. Specifically, I get an exception stating \"Could not get shell folder ID list\". Searching the web does turn up mentions of this error message, but always in connection with JFileChooser . I\'m not using JFileChooser , I just need to resolve a .lnk file to its

How do I disable the 'Debug / Close Application' dialog on Windows Vista?

不想你离开。 提交于 2019-11-26 03:04:29
问题 When an application crashes on Windows and a debugger such as Visual Studio is installed the following modal dialog appears: [Title: Microsoft Windows] X has stopped working A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available. [Debug][Close Application] Is there a way to disable this dialog? That is, have the program just crash and burn silently? My scenario is that I would like to run several automated tests, some

Detect if running as Administrator with or without elevated privileges?

与世无争的帅哥 提交于 2019-11-26 01:15:31
问题 I have an application that needs to detect whether or not it is running with elevated privileges or not. I currently have code set up like this: static bool IsAdministrator() { WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); return principal.IsInRole (WindowsBuiltInRole.Administrator); } This works to detect if a user is an administrator or not, but doesn\'t work if running as an administrator without elevation. (For

How to elevate privileges only when required?

时光毁灭记忆、已成空白 提交于 2019-11-26 00:38:21
问题 This question applies to Windows Vista! I have an application which normally works without administrative privileges. There is one activity which does need administrative privilege but I don\'t want to start the application itself with higher privileges when I know most of time user wont even be using that feature. I am thinking about certain method by which I can elevate the privileges of application on some event (such as press of a button). Example: If user clicks this button then he is

Launching an application (.EXE) from C#?

久未见 提交于 2019-11-26 00:32:25
问题 How can I launch an application using C#? Requirements: Must work on Windows XP and Windows Vista. I have seen a sample from DinnerNow.net sampler that only works in Windows Vista. 回答1: Use System.Diagnostics.Process.Start() method. Check out this article on how to use it. 回答2: Here's a snippet of helpful code: using System.Diagnostics; // Prepare the process to run ProcessStartInfo start = new ProcessStartInfo(); // Enter in the command line arguments, everything you would enter after the

Maximum filename length in NTFS (Windows XP and Windows Vista)?

 ̄綄美尐妖づ 提交于 2019-11-26 00:19:20
问题 I\'m designing a database table which will hold filenames of uploaded files. What is the maximum length of a filename in NTFS as used by Windows XP or Vista? 回答1: Individual components of a filename (i.e. each subdirectory along the path, and the final filename) are limited to 255 characters, and the total path length is limited to approximately 32,000 characters. However, on Windows, you can't exceed MAX_PATH value (259 characters for files, 248 for folders). See http://msdn.microsoft.com/en

Request UAC elevation from within a Python script?

纵饮孤独 提交于 2019-11-25 23:18:06
问题 I want my Python script to copy files on Vista. When I run it from a normal cmd.exe window, no errors are generated, yet the files are NOT copied. If I run cmd.exe \"as administator\" and then run my script, it works fine. This makes sense since User Account Control (UAC) normally prevents many file system actions. Is there a way I can, from within a Python script, invoke a UAC elevation request (those dialogs that say something like \"such and such app needs admin access, is this OK?\") If