locked
Network Logon CSP RRS feed

  • Question

  • I want to create an XML provisioning document that will log me into my work network.  I already use one to connect to the Wi-Fi access point, but I need to be able to access files on the server, which means that I need to sign in with my Login credentials.  I can't find a registry entry where user name, password, and domain are saved (which is good, right?)  Is there any way that I can automate this login process through provisioning?

    Tuesday, July 27, 2010 5:29 PM

All replies

  • I have been looking into the Credential Manager API, but I can't figure out if there is any way that I can use it to add network logon credentials to the system?  If anybody has any ideas on this, I would like to hear them.

    Thanks.

    Friday, July 30, 2010 10:37 PM
  • Windows Mobile has no provision to log onto a network Domain. You connect to the network, and no credentials are required. Afterwards, whenever you try to access any credential-protected resources, such as a file share, you will at that time be prompted to enter credentials. Windows XP/Vista/7 has a domain sign-in mechanism that provides these the domain credentials automatically on request, but Windows Mobile does not.

     

    Windows Mobile acts the same way as a Windows XP/Vista/7 Home Edition, or other editions when not joined to a domain.

     

    The Wi-Fi Configuration Service Provider (CSP) for Windows Mobile lets you configure settings for connecting to a WiFi Access Point or other WiFi network. Wired Ethernet has no equivalent to this concept, hence there is no CSP for it.

     

    Credential Manager lets clients authenticate, and helps with managing usernames and passwords. So if you are writing your own application (client), the Credential Manager APIs can be used. In an application, you can provide programmatically credentials when you call Winsock or WinInet or WinHttp APIs, to access a resource. To manage the credentials – storing, retrieving etc. – for repetitive use, your application may call Credential Manager APIs before using the network APIs. This is not a solution for a general domain logon. But if you are building your own file explorer, for example, Credential Manager can be used.

     

    The good news is that the Network UI in Windows Mobile automatically handles and can remember network credentials. So for example, if the user is using the File Explorer to access  a file share, and they are prompted to enter credentials, they only have to enter them once for the same share.

    Chris Cooper

    • Marked as answer by nispio Thursday, August 12, 2010 2:12 PM
    • Unmarked as answer by nispio Thursday, August 12, 2010 4:31 PM
    Thursday, August 5, 2010 10:09 PM
  •  This is not a solution for a general domain logon. But if you are building your own file explorer, for example, Credential Manager can be used.
    Thanks for the response.  I actually want to be able to access the files programatically, that's why I want to log in to the network programatically.  So if I know the absolute path of a file on the network, and I know the login credentials, what do I need to do to access the file?
    Friday, August 6, 2010 7:12 PM
  • The WNetAddConnection3 function can help you on that. See the following thread:

    http://social.msdn.microsoft.com/forums/en-us/windowsmobiledev/thread/170F0E65-197B-4C2C-B681-6772807BA186 

     


    Please mark the post that helps you, and unmark that does not. This benefits our community.
    Monday, August 9, 2010 2:58 AM
  • For files on a SMB file share, Windows treat this as a redirected file system. So there is no special API. Are you calling CopyFile()? That has no provision for password protected files. Or some other API?

     

    This is a good question. How do you programmatically copy a file from a file share when the file is password protected, and avoid the user being prompted for credentials? Let me see what I can find out.


    --Trevor H.
    Send files to Hotmail.com: "MS_TREVORH"
    Check out the Microsoft CTS TFS BLOG: blogs.msdn.com/b/dstfs
    Monday, August 9, 2010 7:27 PM
  • For files on a SMB file share, Windows treat this as a redirected file system. So there is no special API. Are you calling CopyFile()? That has no provision for password protected files. Or some other API?

    Actually, I tend to use C# where possible.  I would imagine that System.IO.File.Copy is little more than a wrapper of the native CopyFile though.

    Does using C# make the problem any simpler?

    Tuesday, August 10, 2010 12:08 AM
  • C# will not make it any simpler. These filesystem functions do not have credential parameters like some of the network functions.  So there is no direct function for this, and we were not able to find a pattern for this. You may open a formal support request with Microsoft if you wish to have your question investigated further, as it's going to take quite a bit of time. Please visit this link to see the various paid support options that are available to better meet your needs:  http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone.
    --Trevor H.
    Send files to Hotmail.com: "MS_TREVORH"
    Check out the Microsoft CTS TFS BLOG: blogs.msdn.com/b/dstfs
    • Marked as answer by nispio Thursday, August 12, 2010 2:12 PM
    • Unmarked as answer by nispio Thursday, August 12, 2010 4:31 PM
    Thursday, August 12, 2010 1:58 PM
  • Thanks, but all of this is for internal testing of our devices only.  It was something that would have made things easier, and I expected it to be available, but it is not essential to ship.  Since I don't think that the support hours will give a great ROI, I will just have to make my credentials shorter, so that I can at least save time in typing them in manually.

    Thanks for looking into it.

    Thursday, August 12, 2010 2:11 PM
  • The WNetAddConnection3 function can help you on that. See the following thread:

    http://social.msdn.microsoft.com/forums/en-us/windowsmobiledev/thread/170F0E65-197B-4C2C-B681-6772807BA186  

     


    Please mark the post that helps you, and unmark that does not. This benefits our community.


    Somehow I skipped right over your post when I saw Trevor's.  This is actually almost exactly what I need, but I am having a little trouble in the implementation.

    The server that I am trying to access is at "\\Company1"  and my user name is "user1" on the domain "company.com."   My calls to WNetAddConnection3 all seem to fail with error code 53: ERROR_BAD_NETPATH.  However, when I use the same credentials through File Explorer, it works just fine.  Is there some way for me to specify the domain?  I have tried this:

    #include "winnetwk.h"
    
    DWORD MapNetworkDrive(LPWSTR, LPWSTR, LPWSTR, LPWSTR);
    
    int _tmain(int argc, _TCHAR* argv[])
    {
      DWORD dwResult = MapNetworkDrive(L"Company1", L"\\\\company1", L"user1", L"password1");
    
    	return 0;
    }
    
    DWORD MapNetworkDrive(LPWSTR lpLocalName, LPWSTR lpRemoteName, LPWSTR lpUserName, LPWSTR lpPassword)
    {
      NETRESOURCE * lpNetResource = new NETRESOURCE();
      lpNetResource->dwType = RESOURCETYPE_DISK;
      lpNetResource->lpLocalName = lpLocalName;
      lpNetResource->lpRemoteName = lpRemoteName;
      lpNetResource->lpProvider = NULL;
    
      return WNetAddConnection3(NULL, lpNetResource, lpPassword, lpUserName, CONNECT_UPDATE_PROFILE);
    }
    
    And I have also tried replacing L"user1" with L"user1@company.com", but I always get ERROR_BAD_NETPATH.  Am I using this incorrectly?
    Thursday, August 12, 2010 6:01 PM