CTypes wnetaddconnection2

Matthias Janes matthiasjanes at lycos.com
Wed May 28 07:26:17 EDT 2003


Thomas Heller <theller at python.net> wrote in message news:<of1ozl06.fsf at python.net>...
> > 
> > when i use:
> > 
> > WNetAddConnection2=windll.mpr.WNetAddConnection2A
> > 
> > err =WNetAddConnection2(pointer(NetRc),"PrivilegedUser","PrivilegedUserPassword",CONNECT_UPDATE_PROFILE)
> > 
> ctypes has a WinError function:
> 
> >>> from ctypes import *
> >>> raise WinError(2202)
> >>> from ctypes import *
> >>> raise WinError(2202)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> WindowsError: [Errno 2202] Der angegebene Benutzername ist unzulässig.
> >>>
> 
> In english: The username is invalid.
> 

Thanks so far for your help.

I discovered the problem : 

err =WNetAddConnection2(pointer(NetRc),"PrivilegedUser","PrivilegedUserPassword",CONNECT_UPDATE_PROFILE)

There was is wrong oder of "PrivilegedUser","PrivilegedUserPassword",

it should be:

err =WNetAddConnection2(pointer(NetRc), "PrivilegedUserPassword",
"PrivilegedUser", "CONNECT_UPDATE_PROFILE)

Thanks all Matthias




More information about the Python-list mailing list