From a Vista workstation, I have an attached XP Embedded computer on which I want to programmatically mount a volume locally (e.g., mount the XP Embedded \\MyXPEmbedded\C:\some\path\
to the Vista workstation (mounted to C:\mounted_XPEmbedded\
).
(This is an administrative utility that runs on the Vista workstation that maintains files on the XP Embedded workstation, which is part of a larger device.)
I can see the XP Embedded computer from the Vista workstation. For example, I can ::getnameinfo()
to resolve the XP Embedded computer's name from its IP address.
However, all calls to GetVolumeNameForVolumeMountPoint()
fail (returns false
), with the formatted message from ::GetLastError()
being:
Logon failure: unknown user name or bad password
So clearly, this seems to be a permissions problem. However, I see no discussion in the Microsoft APIs how I may provide the user/password through these volume GUID path APIs.
When "browsing" the XP Embedded from the Windows Explorer on the Vista workstation by typing the IP address for the XP Embedded machine into the address bar, I get prompted for a user name and password, after which I can see everything on the XP Embedded (duh! How do I provide that programatically?)
QUESTION: How can I provide the user login/password programatically when working with the GUID path APIs (and specifically ::GetVolumeNameForVolumeMountPoint()
)?
Part of the problem may be that these computers do not share the same domain (they can't, the Vista computer will be added to the customer's domain, the XP Embedded must be "hidden").
Other info, which probably is not important:
- The Vista workstation and XP Embedded do not share the same domain (they can't)
- Application runs on Vista workstation under an account with Administrative permissions (I assume this is required?)
- That Vista administrative account is not present on the XP Embedded computer (the XP Embedded has a different administrative account)
- The clocks between both computers are current (security credentials should work)
- The Vista workstation has two network cards, one card connects directly to the XP Embedded box, which has only one network card
- Using C++, MSVS2008
BONUS QUESTION: It would be nice if I could run this administrative utility on the Vista workstation without administrative permissions, is this possible? (I know the administrative login/password for the XP embedded.)
WNetAddConnection2()
, but::GetVolumeNameForVolumeMountPoint()
still has logon failure (same user name/password message). But, at least I can get a local drive letter for the moment (I'll need to fix this, because many of our machines auto-mount all 26 drive letters, and none are available). So, I'm still open to suggestions. ;-) – Peachy