[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-07-06 05:23:42
|
Bugs item #1517601, was opened at 2006-07-05 10:52 Message generated for change (Comment added) made by rupole 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: Roger Upole (rupole) Date: 2006-07-06 00: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-05 14: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-05 14: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 |