Intermittent "access denied" when creating or opening a file to a shared drive

  • Thread starter Thread starter Mohit Tendolkar
  • Start date Start date
M

Mohit Tendolkar

Hello:

I have a set of software module that lets the user save data to a
file, or read data from an existing file. The file can be on any kind
of drive visible to Windows. The software uses the Win32 CreateFile()
API to open or create the file.

What is really amazing is when the file is targeted at a drive that is
mapped to a shared drive on a remote Windows2000 professional
computer: "sometimes" the call succeeds - sometimes it fails. When the
file open/create fails, the error code is the Win32 error code for
"Access denied". Similarly I tried Creating/opening files to a drive
mapped to a remote Windows NT 4.0 server and the error code I get then
when it fails is "invalid password".

All this time, the drive has been mapped by the user with the correct
authentication. Explorer shows the shared drive and all its file
system. The file open box from my software shows it too - its only
when I actually proceed to open or create the file that this error
"MAY" happen. Once the error occurs, on a subsequent retry it works!
This is very exasperating to our customers.

I looked up MSDN and they have articles related to such behavior, and
a couple of them actually state that this occurs because the
redirector sometimes sends an invalid authentication message to the
server computer and the server "resets" the NetBIOS connection in
response (one can see that because immediately I can see a red cross
on the drive in explorer). This is not to be confused with the issue
where network connections timeout after about 15minutes.

MSDN requests users with this problem to specifically communicate with
Microsoft support for the fix, and I have had no luck that route. Has
anyone out there experienced a similar situation, or knows about a
solution?

Do let me know - I need a fix for this urgent!
regards
Mohit
 
shalom said:
what priveleges does your software use when it is run? try
experimenting with differnt variations of priveleges for
both the local machine and the remote machine, if the
remote machine is on a domain, try using the username in
the form of user@domain or domain/user.

I am no programmer but if this CreateFile() function is
causing too many problems, it would be ideal to save the
file locally and then use a scriptlet that just copies the
files over to the mapped drive after your application has
run.

Basically, the user maps the drive from Windows Explorer specifying
all credentials for authenticating the drive share. The program is run
by the same use just one runs any other program like Notepad which
should be able to copy or create a file on the mapped drive.

Mohit
 
Back
Top