[pywin32-bugs] [ pywin32-Bugs-1517601 ] WNetGetUser fails if connection is specified
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2006-09-22 14:41:43
|
Bugs item #1517601, was opened at 2006-07-06 01:52 Message generated for change (Comment added) made by mhammond You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1517601&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: pythonwin Group: None Status: Open Resolution: None Priority: 5 Submitted By: rberrett (rberrett) Assigned to: Nobody/Anonymous (nobody) Summary: WNetGetUser fails if connection is specified Initial Comment: When trying to run WNetGetUser with connection (drive letter) supplied, raise a "Couldn't get the buffer size!" runtime errror Example: username = win32wnet.WNetGetUser( "z:" ) NOTE: This appears to be a caused by an inconstancy in they windows WNetGetUser call. The win32wnet wrapper calls WNetGetUser with NULL in the username argument to get the buffer size. But unless the connections (lpName) is also NULL the length is does not appear to be set Following sets the length correctly: WNetGetUser(NULL, NULL, &length ); Following fails to set the length: WNetGetUser("v:", NULL, &length ); ---------------------------------------------------------------------- >Comment By: Mark Hammond (mhammond) Date: 2006-09-23 00:41 Message: Logged In: YES user_id=14198 Is it possible the share is connected with *no* user - ie, anonymously? Its not obvious to me how to set that up to test though... ---------------------------------------------------------------------- Comment By: rberrett (rberrett) Date: 2006-08-09 23:56 Message: Logged In: YES user_id=1121829 With build 209, WNetGetUser now always gived the following: error: (234, 'WNetGetUser', 'More data is available.') Even on mounts that NetUseGetInfo info is retruned correctly. ---------------------------------------------------------------------- Comment By: Roger Upole (rupole) Date: 2006-07-30 14:18 Message: Logged In: YES user_id=771074 Can you try this with build 209 and see what error you get back now ? ---------------------------------------------------------------------- Comment By: rberrett (rberrett) Date: 2006-07-07 23:52 Message: Logged In: YES user_id=1121829 I tried this against a few systems, both Windows XP and Unix based, with the same results ---------------------------------------------------------------------- Comment By: Roger Upole (rupole) Date: 2006-07-07 18:20 Message: Logged In: YES user_id=771074 What type of systems provide the shares that the local drives are mapped to ? I also added WNetGetLastError to win32wnet, in case extended error info is available from them. ---------------------------------------------------------------------- Comment By: rberrett (rberrett) Date: 2006-07-07 00:34 Message: Logged In: YES user_id=1121829 Versions: python 2.4.2 win32 2.4.205.0 OS: Windows XP ServicePack 2 NetUseGetInfo is giving good information, but GetUser still seems to be failing. I have tried this one a couple of our test machines. I have attached a small test program I used to to examine the problem I was having. Here is a sample of the output: X: Microsoft Windows Network \\b3server3\storage_1 NetUseGetInfo: {'remote': u'\\\\b3server3\\storage_1', 'local': u'X:'} WNetGetUser: Couldn't get the buffer size! W: Microsoft Windows Network \\nssgsvr\test NetUseGetInfo: {'remote': u'\\\\nssgsvr\\test', 'local': u'W:'} WNetGetUser: Couldn't get the buffer size! ---------------------------------------------------------------------- Comment By: Mark Hammond (mhammond) Date: 2006-07-06 16:38 Message: Logged In: YES user_id=14198 My experience is exactly the same as Roger's - it works fine for an existing connection. I tried XP and (thanks to vmware!) Win98. ---------------------------------------------------------------------- Comment By: Roger Upole (rupole) Date: 2006-07-06 15:23 Message: Logged In: YES user_id=771074 I can't reproduce this with an existing connection on Win2k or WinXP. What OS and python/pywin32 versions do you have ? Also, could you verify that the mapped drive exists under the current user by adding this line before WNetGetUser: print win32net.NetUseGetInfo(None,'v:') (or z:, or whichever drive letter you're passing to WNetGetUser) Roger Roger ---------------------------------------------------------------------- Comment By: rberrett (rberrett) Date: 2006-07-06 05:48 Message: Logged In: YES user_id=1121829 I see this with any existing mapped drive letters. The only time I do not get this message is if I do not specify the connection. username = win32wnet.WNetGetUser() ---------------------------------------------------------------------- Comment By: Roger Upole (rupole) Date: 2006-07-06 05:01 Message: Logged In: YES user_id=771074 I see this too, but only if a nonexistent connection is passed to it. Do you get this error if you pass a drive letter that's actually mapped ? The first call for the buffer size isn't checking the returned error code. I'll check in a fix shortly. Roger ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1517601&group_id=78018 |