User / Password Issues Using GetVolumeNameForVolumeMountPoint () (Windows Remote Hard Drive?)

On a Vista workstation, I have an embedded XP Embedded computer on which I want to programmatically mount volumes locally (for example, mount XP Embedded \\MyXPEmbedded\C:\some\path\ on a Vista workstation (installed on C:\mounted_XPEmbedded\ ).

(This is an administrative utility that runs on a Vista workstation that supports files on an XP Embedded workstation, which is part of a larger device.)

I see an XP Embedded computer from a Vista workstation. For example, I can ::getnameinfo() resolve the name of an XP Embedded computer from its IP address.

However, all calls to GetVolumeNameForVolumeMountPoint() fail (returns false ), and the formatted message ::GetLastError() looks like:

 Logon failure: unknown user name or bad password 

So it is clear that this is a resolution problem. However, I do not see a discussion in the Microsoft API how I can provide the user / password with these volume GUIDs.

When you browse “XP Embedded” from Windows Explorer on a Vista workstation by entering the IP address for the XP Embedded computer in the address bar, I will be asked to enter a username and password, after which I can see everything on XP Embedded (duh! How is it do it programmatically?)

QUESTION: How can I automatically specify the user name / password when working with the GUID APIs (and especially ::GetVolumeNameForVolumeMountPoint() )?

Part of the problem may be that these computers do not use the same domain (they cannot, the Vista computer will be added to the client domain, XP Embedded must be "hidden").

Other information that is probably not important:

  • Vista Workstation and XP Embedded do not use the same domain (they cannot)
  • The application runs on a Vista workstation with an account with administrator privileges (I assume that this is required?)
  • This Vista administrator account is not available on the XP built-in computer (XP Embedded has a different administrative account)
  • The clock between both computers is current (security credentials should work)
  • Vista workstation has two network cards, one card is directly connected 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 a Vista workstation without administrative permissions, is this possible? (I know the administrative login / password for embedded XP.)

+2
source share
2 answers

Before you try to access the shared resources of the embedded box, call WNetAddConnection2 . You may need a username in the form MyXPEmbedded\[admin username] .

You may run into problems if you have previously tried to connect to the integrated box. To remove any lingering connections that you can use from the command line, net use with the /delete option. You can also play with a network connection before starting your program for debugging purposes.

As for runs without administrator privileges, which will mainly be related to where you decided to make a local mount point, but you could probably get away with UNC . Using public shares (which are turned off if "use simple file sharing" is disabled), you can access the embedded system using something like \\MyXPEmbedded\c$\some\path .

+2
source

You probably need to establish at least one SMB connection (named pipe / file share) from the Vista workstation to the XP workstation on any resource with sufficient rights, for example \\ myXP \ whatever or \\ myXp \ c $ or \\ myXP \ icp $ before you can open any network traffic to target the computer "myXP".

You can do this programmatically using the WNetAddConnection2 function with a username and password.

+2
source

Source: https://habr.com/ru/post/891870/


All Articles