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);