Solved

Mapped drive letters in Windows Services

Posted on 2009-05-11
4
355 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 84

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 84

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Firemonkey allowing RTL on android 6 56
Twebbrowser add css to the header 3 39
Microsoft Access 97 and Delphi XE2 9 72
Problem working with dynamic array - help 2 35
This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

749 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