mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-16 02:02:53 -07:00
Also updates: - importlib-metadata-0.7 - jaraco-windows - jaraco.classes-1.5 - jaraco.collections-1.6.0 - jaraco.functools-1.20 - jaraco.structures-1.1.2 - jaraco.text-1.10.1 - jaraco.ui-1.6 - more-itertools-4.3.0 - path.py-11.5.0 - six-1.12.0
30 lines
588 B
Python
30 lines
588 B
Python
"""
|
|
API hooks for network stuff.
|
|
"""
|
|
|
|
__all__ = ('AddConnection')
|
|
|
|
from jaraco.windows.error import WindowsError
|
|
from .api import net
|
|
|
|
|
|
def AddConnection(
|
|
remote_name, type=net.RESOURCETYPE_ANY, local_name=None,
|
|
provider_name=None, user=None, password=None, flags=0):
|
|
resource = net.NETRESOURCE(
|
|
type=type,
|
|
remote_name=remote_name,
|
|
local_name=local_name,
|
|
provider_name=provider_name,
|
|
# WNetAddConnection2 ignores the other members of NETRESOURCE
|
|
)
|
|
|
|
result = net.WNetAddConnection2(
|
|
resource,
|
|
password,
|
|
user,
|
|
flags,
|
|
)
|
|
|
|
if result != 0:
|
|
raise WindowsError(result)
|