My app will be used on LAN on a client desktop computer. In this LAN, there is one dedicated Windows 2k server. There is no AD.
The user have to fill in a server's user account informations so the app can then do some remote operations with this account (Map network drives)
How can I check the user credentials against this server?
When mapping drivers, I will have the error if the user account authentication is not ok, but I would like to have this information before trying to map.
Something like LogonUser API function, but working on a remote computer.
Thanks,
You can use the
WNetUseConnectionfunction withCONNECT_INTERACTIVEandCONNECT_PROMPTflags. That will in combination with empty user ID and password parameters invoke the credentials dialog and connect to a network resource when you enter correct credentials:To connect to a network resource without prompting for credentials remove the flags specified above as it's shown in the following function, which should return True, when the connection succeed, False when it fails. Here's the parameter description: