windows-vista

Why doesn't the RequestAdditionalTime() method work on restart in Vista/7?

倖福魔咒の 提交于 2019-11-29 10:21:35
I have been doing some extensive testing of a Windows Service I have been writing in C# .Net 3.5. I am having trouble getting Windows to give me enough time for my service to shutdown properly when I restart or shutdown the computer even though I am invoking the RequestAdditionalTime() method which should update the SCM and keep my service running. My code works properly if I manually stop the service however. I have primarily been testing this code in Windows Vista and Windows 7, upon deciding to test the code in Windows Xp everything worked perfectly. Does anyone know why this call does not

Save File to Desktop in Vista/Windows 7 in .NET 2.0

↘锁芯ラ 提交于 2019-11-29 07:26:28
I'm working on updating one of our applications. It must use .NET 2.0. One portion creates a file on the Desktop using FileStream fs = new FileStream(Environment.GetFolderPath (Environment.SpecialFolder.DesktopDirectory), FileMode.Create); But I get an UnauthorizedAccessException in Windows 7 (and Vista too, I'm assuming, though I haven't tested that yet). I looked into elevation (not for the entire program, but for a separate assembly which would create the file and perform actions on it); however that seems to require .NET 3.0 or 3.5. Is there any way to gain access to the Desktop folder

Invoke Blue Screen of Death using Managed Code

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 06:58:53
问题 Just curious here: is it possible to invoke a Windows Blue Screen of Death using .net managed code under Windows XP/Vista? And if it is possible, what could the example code be? Just for the record, this is not for any malicious purpose, I am just wondering what kind of code it would take to actually kill the operating system as specified. 回答1: The keyboard thing is probably a good option, but if you need to do it by code, continue reading... You don't really need anything to barf, per se,

programmatically kill a process in vista/windows 7 in C#

守給你的承諾、 提交于 2019-11-29 06:45:17
I want to kill a process programmatically in vista/windows 7 (I'm not sure if there's significant problems in the implementation of the UAC between the two to make a difference). Right now, my code looks like: if(killProcess){ System.Diagnostics.Process[] process = System.Diagnostics.Process.GetProcessesByName("MyProcessName"); // Before starting the new process make sure no other MyProcessName is running. foreach (System.Diagnostics.Process p in process) { p.Kill(); } myProcess = System.Diagnostics.Process.Start(psi); } I have to do this because I need to make sure that if the user crashes

Vista UAC - Trouble Mapping Network Drives

戏子无情 提交于 2019-11-29 04:19:34
We have an application that programmatically maps network drives. On Vista with UAC on, we get some strange issues. Our application maps the drive non-elevated, so if the user browses explorer and double clicks to run an exe, it prompts for UAC. So when they approve it, it prompts for a username/password for the share... Strange since the credentials are saved. It turns out, an elevated process cannot access a mapped drive that was mapped from a non-elevated process. To see this issue in action, do the following steps: Run cmd.exe with no UAC Run "net use w: \yourHostname\yourShare /user

Git checkout and reset on Windows occasionally shows random files have changed

ぃ、小莉子 提交于 2019-11-29 04:16:58
Often when I do a checkout of a different branch, or a reset, I will get 'permission denied' errors from windows for one to a dozen files - but the particular files vary from run to run. Here's the output from a test I just did, with GIT_TRACE=1. The trace only added the one line before the error message: $ git checkout master trace: built-in: git 'checkout' 'master' error: git checkout-index: unable to create file dotnet/src/myfile.cs (Permission denied) D dotnet/src/myfile.cs Switched to branch "master" I'm pretty sure this is some race with a virus scanner or other indexing service on my

Determine if O/S is Windows 7

徘徊边缘 提交于 2019-11-29 04:08:29
Working on a project and need to be able to determine whether the O/S is Windows 7, Vista or default to XP. I understand I could run into Win2K and earlier versions but let's just say that's not a concern as other code will catch that before it gets to this point. My application will be in C++ for the time being using VS2005. I've found articles and sample code alike but they seem way bloated for my uses. Just looking for a quick and dirty return. http://msdn.microsoft.com/en-us/library/ms724358%28VS.85%29.aspx List of Windows Version , using GetVersionEx : Version Number Description 6.1

How do I turn Password Protected Sharing on or off programmatically?

故事扮演 提交于 2019-11-29 03:53:13
问题 Windows Vista and 7 has this switch in Network and Sharing Center. It's on by default, and that prevents unauthenticated access to shares even if they're shared with Everyone (like the Public folder). I need to teach my application to turn it on and off automagically. How? I suspect there is a value somewhere in the registry that's responsible for this, but I have no idea how to find it. 回答1: Probably too late :) , but hopefully useful for others. The following steps worked just fine for me

How do I create add a shortcut (.lnk) for my application to the Startup folder programatically in .NET/C#

白昼怎懂夜的黑 提交于 2019-11-29 03:32:26
问题 My application will have a per machine (not per user) Startup shortcut. I can create a shortcut during the installer process no problem. My problem comes when the user later removes it and then tries to re-enable. In otherwords, they turn off RunOnStartup (which deletes the Startup ink) and at a later time they decide they do want it to run on startup so they go back into preferences and re-enable. Apparently, this is a pretty common gripe with .NET that there isn't a native way to create

Write in “ProgramData” folder (W7 and Vista) .NET

♀尐吖头ヾ 提交于 2019-11-29 03:23:48
I install my app under "Program Files" directory. And I install data, under "ProgramData" directory: Environment.SpecialFolder.CommonApplicationData In programData I have created folder to save data. Example: C:\ProgramData\MyApp\MyData\here I have files and folders Under XP all runs fine. But not under Vista or W7 OS. I can read files in this directory, but I can not write files, I can not create new files, etc. The user is logged as Admin. Where I can store data without restrictions? I need store data in a folder visible for all users EDITED: I have this code in my app.manifest file: <?xml