From 61037ccb971e9e7ee8d82d2252d67c7f42500a53 Mon Sep 17 00:00:00 2001 From: kochi Date: Sun, 16 Feb 2020 22:53:57 +0900 Subject: [PATCH] =?UTF-8?q?#143=20=E6=83=85=E5=A0=B1=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/networkDriveList.py | 19 +++++++++++++++++++ tests/networkDriveList.txt | 9 --------- 2 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 tests/networkDriveList.py delete mode 100644 tests/networkDriveList.txt diff --git a/tests/networkDriveList.py b/tests/networkDriveList.py new file mode 100644 index 0000000..38ffeff --- /dev/null +++ b/tests/networkDriveList.py @@ -0,0 +1,19 @@ +import win32wnet +import socket + +h=win32wnet.WNetOpenEnum(5,1,0,None) + #5=RESOURCE_CONTEXT + #1=RESOURCETYPE_DISK +lst=win32wnet.WNetEnumResource(h,64) #65以上の指定不可 +win32wnet.WNetCloseEnum(h); +lst.pop(0) + +for l in lst: + print("------------------") + print(l.lpLocalName) + print(l.lpRemoteName) + for address in socket.getaddrinfo(l.lpRemoteName[2:],None): + print(address[4][0]) + +#動かない時は下記を参考にサービスを起動するとよい +#https://itojisan.xyz/trouble/12595/#3 \ No newline at end of file diff --git a/tests/networkDriveList.txt b/tests/networkDriveList.txt deleted file mode 100644 index ee8eeb7..0000000 --- a/tests/networkDriveList.txt +++ /dev/null @@ -1,9 +0,0 @@ -import win32wnet - -h=win32wnet.WNetOpenEnum(2,1,0,None) - #2=RESOURCE_GLOBALNET - #1=RESOURCETYPE_DISK -lst=win32wnet.WNetEnumResource(h,64) #65以上の指定不可 -win32wnet.WNetCloseEnum(h); - -print(lst);