Solved

Mapped drive letters in Windows Services

Posted on 2009-05-11
4
346 Views
Last Modified: 2012-05-06
We've written a Windows Service which reads a path for data files from the Registry.

If the data file path is on a network rather than on the local machine we have found we need to run the Service using the Admin name and password in the Logon tab of the services manager.

However we have encountered another problem if the path is given as a mapped drive letter in the Registry. The Service cannot understand the drive letter (what were Microsoft thinking of??!!!) and therefore our Service is going to have to resolve this to a UNC pathname before using it.

We have no way of testing this before putting it on site so your advice appreciated. If we use the relevant API (or probably Delphi's ExpandUNCFilename) to get the full UNC pathname, will our Service be given the path or is this information hidden from all Services as some sort of security measure?

Many thanks.
0
Comment
Question by:ChrisJonesLycos
  • 2
  • 2
4 Comments
 
LVL 83

Expert Comment

by:oBdA
ID: 24352891
This is not an error from Microsoft. Mapped drives are *user* specific, *NOT* machine specific.
For the obvious reasons, if a service needs access to network resources, this service *has* to run under an account that has permissions to access this network resource. This can be a domain user account, or the local "Network Service" account (in which case the computer object needs permissions for the network resource).
Access to this network resource (and the service configuration) should happen with the UNC, not with a mapped drive.
0
 

Author Comment

by:ChrisJonesLycos
ID: 24352976
Many thanks, oBdA.

When you say "the local "Network Service" account (in which case the computer object needs permissions for the network resource)" I don't really understand. Would you mind explaining this to me.

0
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 24353044
There are some special accounts used to run services, namely LocalService, NetworkService, LocalSystem. Depending on what you want to do with your service, one of those can be used to run a service instead of a domain user. Check here for details:
Service User Accounts
http://msdn.microsoft.com/en-us/library/ms686005(VS.85).aspx
0
 

Author Closing Comment

by:ChrisJonesLycos
ID: 31580072
Many thanks. That's very helpful.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now