error 1202 - ERROR_DEVICE_ALREADY_REMEMBERED in WNetAddConnection2A

Posted by Don on Stack Overflow See other posts from Stack Overflow or by Don
Published on 2010-05-10T21:17:02Z Indexed on 2010/05/10 21:24 UTC
Read the original article Hit count: 158

Filed under:
|

I used the function - WNetAddConnection2A(n, UserName, Password, dwFlags) to programmatically map a drive and read the drive info out, and then used WNetCancelConnection2A(DriveLetter, dwFlags, ForceDisconnect) to unmap the drive. The first map and unmap were fine. But the next map will bring me the error 1202 - ERROR_DEVICE_ALREADY_REMEMBERED when the same driver letter is used.

I set dwFlags = 0. It works in my development machine but fails in server. How to eliminate the error 1202?

Thanks!

© Stack Overflow or respective owner

Related posts about win32

Related posts about .NET