CTypes wnetaddconnection2

Matthias Janes matthiasjanes at lycos.com
Tue May 27 09:13:35 EDT 2003


Thanks a lot.

This gives me some ideas how to do it -  but it did not really work.


> NetRc=NetRESOURCE()
> NetRc.dwScope = RESOURCE_GLOBALNET
> NetRc.dwType = RESOURCETYPE_ANY
> NetRc.dwDisplayType = RESOURCEDISPLAYTYPE_SHARE
> NetRc.dwUsage = RESOURCEUSAGE_CONNECTABLE
> NetRc.lpLocalName = "X:" #connect with no device (if undefined)
> NetRc.lpRemoteName = RemoteMachine
> #NetRc.lpComment = "optional"
> #NetRc.lpProvider =    you can leave this undefined

I also defined also 

NetRc.lpLocalName = None
NetRc.lpProvider = None

But it does not connect to the IPC$.

> WNetAddConnection2=windll.mpr.WNetAddConnection2A
> 
> err =
> WNetAddConnection2(pointer(NetRc),"PrivilegedUser","PrivilegedUserPassword",
>       CONNECT_UPDATE_PROFILE)


when i use:

WNetAddConnection2=windll.mpr.WNetAddConnection2A

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

print err


it returns:2202

I think this is an error.

Maybe someone has an idea?




More information about the Python-list mailing list