Skip to content

Commit

Permalink
#143 情報取得サンプル完成
Browse files Browse the repository at this point in the history
  • Loading branch information
yamahubuki committed Feb 16, 2020
1 parent 892bc58 commit 61037cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
19 changes: 19 additions & 0 deletions tests/networkDriveList.py
Original file line number Diff line number Diff line change
@@ -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
9 changes: 0 additions & 9 deletions tests/networkDriveList.txt

This file was deleted.

0 comments on commit 61037cc

Please sign in to comment.