Strange Access Denied Problem with Windows 7

I got a new computer about six months ago that came with Windows Vista
Home Premium 64bit. Before that I had done all of my .NET development
either on an XP Pro VM or my former XP Pro computer at home. Shortly
after getting my new computer at home, I also got a license for VMWare
to be able to test my software on multiple platforms and
configurations.

I had wrote an application originally in VB.NET that was a simple
backup utility. It supports mutiple backup configurations. Any given
copnfiguration would define a backup which would be a list of files to
backup, a list of folders to backup and a target device and target
folder. It's a little more complicated than that but those are the
basics.

When a backup is run the user has the option to delete all files at
the target location, then after deleting them it copys all files and
folders specified to the target folder on the target device.

I am now converting this application to C#.NET in a Windows 7 64bit
VM. I ran into some strange access denied problems when trying to copy
files. At first I thought it was a Windows 7/Vista issue. I found out
how to install the application so that when it runs the user is asked
for administrator permission to run. But the problem turned out to be
more sinister.

I found that the problem is only with Windows 7, it doesn't happen on
Vista. IF you have a Windows Explorer window open and have selected
the target folder for the backup, THAT is what causes the access
denied problem. If you just leave Windows Explorer closed, then there
is never an access denied problem.

PLUS, I can switch over to the Windows Explorer window and delete the
file just fine by pointing and clicking.

Any ideas?
0
Joe
2/25/2010 9:25:59 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

2 Replies
1054 Views

Similar Articles

[PageSpeed] 48

Joe Cool wrote:
> [...]
> I am now converting this application to C#.NET in a Windows 7 64bit
> VM. I ran into some strange access denied problems when trying to copy
> files. At first I thought it was a Windows 7/Vista issue. I found out
> how to install the application so that when it runs the user is asked
> for administrator permission to run. But the problem turned out to be
> more sinister.
> 
> I found that the problem is only with Windows 7, it doesn't happen on
> Vista. IF you have a Windows Explorer window open and have selected
> the target folder for the backup, THAT is what causes the access
> denied problem. If you just leave Windows Explorer closed, then there
> is never an access denied problem.
> 
> PLUS, I can switch over to the Windows Explorer window and delete the
> file just fine by pointing and clicking.
> 
> Any ideas?

I haven't tested it extensively, but it sounds like Windows Explorer is 
simply keeping a lock on the folder when it's selected.  Which makes 
some sense, in an awkward sort of way.

Personally, it's my opinion that Explorer should not stand in the way of 
normal uses of the file system.  It's there to provide a view on the 
current state of the file system, and to do so without interfering with 
the proper operation of other programs that use the file system.

But, to the extent that Windows Explorer can't do that job without doing 
at least _some_ locking on the file system, there will always be cases 
where activity in Explorer affects other programs.

For example, when you select a folder, Explorer (eventually) reports the 
total size of the folder, which it do only by traversing the contents, 
and while examining the contents may lock something, which implicitly 
locks the entire sub-tree of the file system.

And depending on the extent to which Microsoft has decided to make 
Explorer a more active "explorer", it will necessarily wind up doing 
more locking.  That aspect being a subjective choice in the 
implementation of Explorer � the trade-off between Windows Explorer 
being non-intrusive and it being able to present all the information to 
the user that Microsoft wants it to � it's something that can easily 
vary from one version of the OS to another.

For the specific question: it seems to me you could just delete the 
_contents_ of the target folder, rather than the whole folder.  You'll 
still run the risk of something in the folder not being able to be 
deleted, but the finer the granularity of the deletion, the lower the 
odds of a problem.

Alternatively, you can just include in your error reporting to the user 
a suggestion that they close any windows for applications that might be 
using a file or folder that failed to delete, including windows in 
Windows Explorer (you may need to do that anyway, since the underlying 
problem is intractable�there will always be ways for the access 
violation to occur).

Pete
0
Peter
2/25/2010 9:48:21 PM
On Feb 25, 4:48=A0pm, Peter Duniho <no.peted.s...@no.nwlink.spam.com>
wrote:
> Joe Cool wrote:
> > [...]
> > I am now converting this application to C#.NET in a Windows 7 64bit
> > VM. I ran into some strange access denied problems when trying to copy
> > files. At first I thought it was a Windows 7/Vista issue. I found out
> > how to install the application so that when it runs the user is asked
> > for administrator permission to run. But the problem turned out to be
> > more sinister.
>
> > I found that the problem is only with Windows 7, it doesn't happen on
> > Vista. IF you have a Windows Explorer window open and have selected
> > the target folder for the backup, THAT is what causes the access
> > denied problem. If you just leave Windows Explorer closed, then there
> > is never an access denied problem.
>
> > PLUS, I can switch over to the Windows Explorer window and delete the
> > file just fine by pointing and clicking.
>
> > Any ideas?
>
> I haven't tested it extensively, but it sounds like Windows Explorer is
> simply keeping a lock on the folder when it's selected. =A0Which makes
> some sense, in an awkward sort of way.

That is my suspicion.

>
> Personally, it's my opinion that Explorer should not stand in the way of
> normal uses of the file system. =A0It's there to provide a view on the
> current state of the file system, and to do so without interfering with
> the proper operation of other programs that use the file system.

Agreed.

>
> But, to the extent that Windows Explorer can't do that job without doing
> at least _some_ locking on the file system, there will always be cases
> where activity in Explorer affects other programs.
>
> For example, when you select a folder, Explorer (eventually) reports the
> total size of the folder, which it do only by traversing the contents,
> and while examining the contents may lock something, which implicitly
> locks the entire sub-tree of the file system.
>
> And depending on the extent to which Microsoft has decided to make
> Explorer a more active "explorer", it will necessarily wind up doing
> more locking. =A0That aspect being a subjective choice in the
> implementation of Explorer the trade-off between Windows Explorer
> being non-intrusive and it being able to present all the information to
> the user that Microsoft wants it to it's something that can easily
> vary from one version of the OS to another.
>
> For the specific question: it seems to me you could just delete the
> _contents_ of the target folder, rather than the whole folder. =A0You'll
> still run the risk of something in the folder not being able to be
> deleted, but the finer the granularity of the deletion, the lower the
> odds of a problem.

Actually the exception being thrown does mention a problem with a
specific file, the entire process of deleting the target folders and
files is by deleting the main backup folder a la:

Directory.Delete(pathToBackupFolder);

>
> Alternatively, you can just include in your error reporting to the user
> a suggestion that they close any windows for applications that might be
> using a file or folder that failed to delete, including windows in
> Windows Explorer (you may need to do that anyway, since the underlying
> problem is intractable there will always be ways for the access
> violation to occur).
>

Good suggestion. There doesn't seem to be any other way to handle this
situation.

I had hoped someone else may had seen this problem and figured out a
way around it.
0
Joe
2/26/2010 12:05:47 AM
Reply:

Similar Artilces:

Problem
Ever since I added a Microsoft Exchange Server Account and all it6s associated folders and its in-box to my pre-existing Personal Outlook 2003 POP3 folders, I have had nothing but confusion. The Exchange Server account from my workplace downloads its messages into the in-Box for my private ISP POP3 account and vice versa. When I try to configure a rule for my personal POP3 account so that any messages addressed to my workplace account are loaded into the exchange server in-box on my client PC, the software tells me I have to go on-line to Exchange Server - even to create rules for th...

windows live block list help
This is a multi-part message in MIME format. ------=_NextPart_000_04E7_01CAA00F.21DD8640 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello and good day to all=20 does any one know any way to get names out or off the block list in the = messenger when the other user has not or will not delete my user id = email address from their list I have tried contacting the other user to = get them to delete my id but a few of the ids in the block list are from = them dumb spim bots and I just want them out of it can some one try and...

Access denied opening XML attachment
A user on my network cannot open an xml attachment in Outlook 2003. It works fine in previous versions. It says "access denied. Error processing resource." If the file is saved to a drive, then it opens without a problem. Is there some security configuration that would cause this behavior? I have tested on multiple machines and multiple users to rule out profile or other causes. I have also checked security on the tmp folder the file is trying to open from. Any insight would be helpful. -Paul ...

date problem #10
Thanks a lot, Dave This piece of code works great. M P Redd -- mpredd ----------------------------------------------------------------------- mpreddy's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1327 View this thread: http://www.excelforum.com/showthread.php?threadid=26358 ...

How to make Access 2007 Navigation pane invisible?
I have tried the Access Options. | Current Database | Navigation, uncheck Display Navigation Pane, and the vertical "Navigation Pane" still displays in a compiled .ade. Something else yet? Dean Slindee "Dean Slindee" <slindee@charter.net> wrote in message news:%23o1Zj8odKHA.2188@TK2MSFTNGP04.phx.gbl... >I have tried the Access Options. | Current Database | Navigation, uncheck >Display Navigation Pane, and the vertical "Navigation Pane" still displays >in a compiled .ade. > > Something else yet? > > Dean Slinde...

Switching between multiple open windows
I ran across an option to change how to switch between multiple open windows on my desktop. It was an option to choose between hovering over a window or clicking on it. Thinking that only having to hover over a window to switch to it would save time, I selecting the option to hover... big mistake as it just became a big pain in the a_ _ for me. Now I would like to change back to one-clicking to change between viewed windows but can't remember or find where the option is located. Any help will be appreciated. -- rushl On 2/03/10, rushl posted: > I ran across an opti...

Outlook pop up windows stops outgoing mail
In the last 3 weeks I continue to get a pop up window titled "Enter Network Password". There is a key icon and the request: "Please type your user name and password." It then list my Server: (entered) Password: (entered with asterisk showing) I continually enter my Outlook password with Bellsouth and click the box "Save this password in your password list" and click "OK". Everything then works alright and then the window pops up again in 5 minutes. It happens over and over again. Anybody have any ideas on how to eliminate this? I use XP Pr...

Problem changing parent Business unit
WE have re-arranged some business units into a more appropriate hierarchy, however, we have noticed that a user in a role with deep privileges (own business unit and children I think) to read users can only see users in his own business unit and only one of the child business units (there are 2 child business units). We cannot enable him to see all the users in both child business units. We tried reassigning the parent business unit to the one child that is not appearing, but it doesn't seem to make any difference. WE also tried adjusting the privileges up and down (i.e. Global and local...

Only printing header in Windows Live Mail
My canon printer has suddenly stopped printing the email content - only the header. Printing in word, excel etc not affected. Using W7 (+ Firefox if that relavent). Any suggestions please Does you have the same problem if you try printing from IE? WLM depends on IE for printing services. Take a look at this: Print and Print Preview May Display Only Text at Top of Page http://support.microsoft.com/?kbid=272518 It's a similar problem for a different version but the fix may apply. -- Mike - http://TechHelp.Santovec.us "Jem" <Jem@discussions.mic...

create new users STRANGE problem
Hi, I'm developing a web application (using standard asp and not asp.net) to let certain remote users administer exchange 2003. I have installed win2003 standard edition, exchange 2003 enterprise edition,owa and my web application on the same server. My web app, let users to create mailboxes, delete mailboxes, change user password. All works fine, but for example, if I reboot the server, a web application user can create 50 mailboxes. But when any of these users log on to owa, something goes wrong and the admin user cannot mailbox enable other user accounts through the web app, even if he ...

Problem w/ Outlook
I'm running Office XP and all of a sudden I can't move messages to other folders not delete messages from my Inbox. It doesn't give me a specific error code, just suggests that I restart Outlook. I've tried that with no success. I went to ControlPanel and repaired my Office installation. Any ideas? Eudora is looking beter all the time. ...

Error Message 550 5.7.1
i recive the following message - i use outlook 2002:- our message did not reach some or all of the intended recipients. Subject: FW: test Sent: 12/15/2003 4:21 AM The following recipient(s) could not be reached: Osama Haiba (osama.h@york-egypt.com.eg) on 12/15/2003 4:21 AM 550 5.7.1 Unable to relay for osama.h@york- egypt.com.eg Set your incoming server to authenticate using your outgoing server credentials. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the Swen virus, all e-mails sent to my actual ...

ProbleM: when I restore a mailbox using Exmerge with a pst file, nothing is transferred.
Hi, I am practising Exmerge for a big remote site migration in a couple of weeks. One thing I dont understand is that I can backup one test mailbox fine using Exmerge (I know this works, as I have opened the mailbox pst file within outlook and everything is there), but when I perform the restore using the pst file, nothing happens. There is no error messages, and Emerge goes through the motions (though it finishes supsiciously quick), but when I open the mailbox, no emails have been restored. Although it is great that Exmerge is working for the backup part of the stage, I am disappointed it i...

Problems with Outlook 2003
This only happens with externally sent messages. Internal messages work fine. One of my users alerted me to this issue, so I tested this myself. I created 2 messages (internal and external) and added delayed delivery to both. They were both set to go out at the same time. The internal message went, and the external message is still in the outbox. The user who alerted me to this found her message went "before" the scheduled time.We are not running in cached mode and of course running Outlook on Exchange. Is this a bug? ...

Unable to open the outlook window.
I just downloaded Microsoft Office Outlook 2003 to my computer. When I try to open Outlook, the window opens for about 2 seconds and then closes automatically. I received an error message: "cannot start microsoft office outlook. unable to open the outlok window. the server is not available. contact your system administrator if this problem persist." I'm have home based computer and don't have an administrator. Can anyone help? Did you create a profile with settings (email account, POP3 and SMPT server names, etc.) for Outlook to use? -- Kathleen Orland Outlook Ti...

memory problem of Excel 2003 copy & paste
Hi all, I am using Excel 2003 for some project. I am having 2GB C drive harddisk space. After a while, the Excel begins to be extremely slow in copy and paste... It takes about half an hour to copy and paste just a few cells... I've consulted people. It seems a memory problem. But I cannot close my windows and kill the processes, because I am running long-running (overnight) jobs... I cannot reboot either. Is there a way to clean the memory and let Excel 2003 clipboard function properly without rebooting or killing my 4 long-running processes? Thanks! p.s. I am sure this is an is...

Dynamics CRM windows blocked by a pop-up blocker
Need some help resolving an issue. This morning opening records through Outlook CRM stopped working. When clicking on the item in Outlook, the following message would appear after a short delay: "A Microsoft Dynamics CRM window was unable to open, and may have been blocked by a pop-up blocker. Please add this Microsoft Dynamics CRM server to the list of the sites your pop-up blocker allows to open new windows:our server name" The following items have been done in an effort to resolve the problem: 1. Disabled IE pop-up blocker and checked computer for any other pop- up blockers...

Windows Media Player no picture 08-03-10
Vista windows Media Player 11 has sound and visualization but no picture on some AVI files. One file that does not respond is Fill Handle.exe. AVI which is a tutorial for Windows Office 2007. ...

One Record Per Page Printing-Access 2007
Report for daily appointments for senior transportation drivers. Report is grouped by Driver. Keep together is selected. Detail band: Keep together-Yes; Force New Page-Before Section; Can Grow-Yes; Can Shrink-Yes Goal: Report generated so each driver has his/her own appointments. Orientation: Landscape, paper size 8.5 x 14, column width: 13.5729"; column height: 0.3069" When previewing in Print Preview one record per page is appearing rather than all appointments for a driver for a given date. I have the bands as narrow as I can make them. I am missing somethi...

Public Folder/OWA problem
We're running a pure Ex2k3 environment. I'm trying to setup a public folder where end-user software can be posted. This way, users can access our front-end OWA server outside of the network, open public folders, and then save the software to their local PC. The problem is that i get a "403 Forbidden" error whenever i try to download the file off of OWA. I checked that users had all permissions to the folder.. I found this TechNet article that describes something very similar (http://support.microsoft.com/kb/834743/en-us). The only problem is that it refers to som...

Shared workbook and VBA problem
Shared workbook and VBA problem Hi Group, I am new at this Excel stuff and I am hitting my head on a silly problem that I am sure many have seen before. I wrote a very simple spreadsheet where I use the Calendar control to pick some dates. Everything was fine until I decided that I needed to share it on the network with other users. As soon as I share it the calendar control stops working. I get a "runtime error 1004, unable to set left property of oleobject class". That's because the first thing I try to do is position the calendar. If I don't do that, it still doesn't...

outlook express 6 password problem
Help I have outlook express 6, windows xp. My internet provider just changed from att broadband to comcast. now i keep getting a password rejected error and i cant receive any mail. i cant seem to find a way to shut off the password. in my wifes page of xp it works ok. Hi, Bill - This is a group to support Outlook from the Office group of programs. Outlook Express is a part of Internet Explorer and is a quite different program, despite its similar name.. You will probably get a faster and more expert answer if you post this to an Outlook Express news group. Try posting in one of these n...

cannot get BCM to work on Office Enterprise 2007 and Windows 7
I have Windows 7 and Office enterprise 2007 and tried to install BCM 2007 and got it installed then opened Outlook and said it could not setup database. Is BCM 2007 compatible with Enterprise and Windows 7. Is there a work around? ...

Windows XP Shared PC
We are using Outlook 2000. The PC, which already had Microsoft Office 2000 loaded on it, was upgraded from Win 98 to Win XP. I then created Windows XP logons for all four people that will be sharing this PC. When I did, the Outlook shortcut automatically ended up on the desktop of each person when they individually logged in. When I clicked the shortcut the first time I went in to each person's desktop, I setup the mail account for JUST THAT PERSON. And when I go back and log into each person's desktop it still shows ONLY THEIR ACCOUNT. However, whatever mail they receive ALS...

MFC Registry Access in Automation Servers (EXE)
I have written a MFC server application (MFC automation server). Some configuration settings are saved with WriteProfileInt /WriteProfileString to the registry. I used SetRegistryKey("Mycompany") for the registry path. The application works fine under different users. Now this application is started as embedded server via my ASP code from the IIS. The machine is a Windows 2003 Web Edition Server. For this case the DCOM and IIS settings uses a predefined user for the ASP code and the COM server. If I start the app per hand now under this user everything is going well. But if the app ...