Changeset 57
- Timestamp:
- 01/15/05 09:00:04 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykoticon/trunk/bin/pykoticon
r56 r57 26 26 import urllib 27 27 import urllib2 28 29 try : 30 import win32api 31 import win32net 32 import win32netcon 33 hasWindowsExtensions = 1 34 except ImportError : 35 hasWindowsExtensions = 0 36 28 37 29 38 DUMPYKOTA_URL = "http://cgi.librelogiciel.com/cgi-bin/dumpykota.cgi" … … 136 145 return User(username, info, quotas) 137 146 147 def getWindowsUserName() : 148 """Retrieves the current user's name under MS Windows.""" 149 dc = win32net.NetServerEnum(None, 100, win32netcon.SV_TYPE_DOMAIN_CTRL) 150 user = win32api.GetUserName() 151 if dc[0] : 152 dcname = dc[0][0]['name'] 153 return win32net.NetUserGetInfo("\\\\" + dcname, user, 1) 154 else: 155 return win32net.NetUserGetInfo(None, user, 1) 156 138 157 if __name__ == "__main__" : 139 158 net = CGINetworkInterface(DUMPYKOTA_URL) … … 143 162 144 163 #print "User print quotas : ", net.getUserPQuotas("jerome") 145 jerome = net.getUser("jerome") 164 #jerome = net.getUser("jerome") 165 print getWindowsUserName() 146 166