win32wnet.WNetAddConnection2, win32wnet.WNetCancelConnection2

Mark Tompkins mdtompkins at home.com
Sat Dec 16 00:08:29 CET 2000


Hi,

Well, the last time I called, I couldn't map a local drive to a remote
network share.  I was able to solve this problem by assigning the
following privileges first to the Administrator group using the user
administrator, and then, from within the service itself, changing the
privileges of the service process (SYSTEM and LocalSystem are members of
the local Administrators group by default, I believe):


        # SE_TCB_NAME - Act as Part of the Operating System
        # SE_CHANGE_NOTIFY_NAME - Bypass Traverse Checking (This
privilege is granted to all users by default).
        # SE_ASSIGNPRIMARYTOKEN_NAME - Replace a Process Level Token

Next I try to create a connection to a remote share

win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK,'Y:','\\\\clun1-172\\source',None,'orabatch','orabatch')

This works just great.

Then, I try to cancel the connection

win32wnet.WNetCancelConnection2('Y:',0,1)

This fails, with error (the error message gives the pywintypes.api_error
information, wrapped by my error message):

Unable to delete net file share: Y: + Code: 2250 + Func:
WNetCancelConnection2 + descr: This network connection does not exist.

I've tried running the service as default (SYSTEM account - a local
account only), (LocalSystem account) and orabatch, an account that is a
domain account that is enabled to make the connection to the remote
share.

Why is the current process not owner of the connection that it has just
created???? Why can't the current process see the connection that it has
just made?

What must I do so that when orabatch user creates a connection to a
remote share, that the local drive (in this case Y:) can be deleted from
within the service?

thx

Mark





More information about the Python-list mailing list