Windows Service (using SRVANY) is not able to acces network drive

Hey, I made a simple C program to write a file on a mapped network drive (which is in fact a local directory which I shared and mapped to S:). When I run this program as a user it is able to create a file ( as expected ).

Windows Networking 2246 This topic was started by ,


data/avatar/default/avatar40.webp

1 Posts
Location -
Joined 2006-01-25
Hey,
 
I made a simple C program to write a file on a mapped network drive (which is in fact a local directory which I shared and mapped to S:). When I run this program as a user it is able to create a file ( as expected ). When I install the program as a service using srvinst.exe and srvany.exe it is no longer able to write on the mapped drive. When I try to write on the C: drive there is no problem. I tried several option to run the service with the administrator account but none was succesfull.
Does someone have a suggestion? Or an example how to write a windows service (using VC6.0) to avoid using srvany
 
Ron Bakker

Participate on our website and join the conversation

You have already an account on our website? Use the link below to login.
Login
Create a new user account. Registration is free and takes only a few seconds.
Register
This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


data/avatar/default/avatar21.webp

1 Posts
Location -
Joined 2006-01-28
Windows 2000 and above creates a set of drive letters for each user. Services are not able to access these drives, unless a service running as local system maps the drive. Don't ask me, as Microsoft. The way we got around this issue was by using UNC paths (\\machine name\path). Another way is to create a service that maps your drives, must run as local system, or map the drive in your program. If you are using Microsoft Services for unix or MKS, you can mount the drive by typing mount <\\machine\path> <drive letter>.
 
Good Luck