Solved

Mapped drive letters in Windows Services

Posted on 2009-05-11
4
360 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 85

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 85

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Suggested Courses
Course of the Month9 days, left to enroll

617 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