Re: advapi: test and fix GetUserName() in case where buffer is too small

2011-05-31 Thread Dan Kegel
I'm looking forward to Andrew's test-only patch... When I saw he had a test on testbot, I probably should have dropped mine.

Re: advapi: test and fix GetUserName() in case where buffer is too small

2011-05-31 Thread Andrew Nguyen
On 05/31/2011 08:17 AM, Hans Leidekker wrote: > On Tue, 2011-05-31 at 06:32 -0500, Andrew Nguyen wrote: > >> -DWORD sizeW = *lpSize * 2; >> +DWORD sizeW = 0; >> + >> +GetUserNameW( NULL, &sizeW ); > > Can we avoid the extra call? I was trying to avoid making the assumption that a Uni

Re: advapi: test and fix GetUserName() in case where buffer is too small

2011-05-31 Thread Hans Leidekker
On Tue, 2011-05-31 at 06:32 -0500, Andrew Nguyen wrote: > -DWORD sizeW = *lpSize * 2; > +DWORD sizeW = 0; > + > +GetUserNameW( NULL, &sizeW ); Can we avoid the extra call? > I didn't intend to scoop Dan's work, but I have a version of his fix, > which is attached, with deeper tests w

Re: advapi: test and fix GetUserName() in case where buffer is too small

2011-05-31 Thread Andrew Nguyen
On 05/31/2011 02:17 AM, Hans Leidekker wrote: > On Mon, 2011-05-30 at 21:13 -0700, Dan Kegel wrote: > >> @@ -91,7 +91,7 @@ GetUserNameW( LPWSTR lpszName, LPDWORD lpSize ) >> >> if (len > *lpSize) >> { >> -SetLastError(ERROR_MORE_DATA); >> +SetLastError(ERROR_INSUFFICIEN

Re: advapi: test and fix GetUserName() in case where buffer is too small

2011-05-31 Thread Hans Leidekker
On Mon, 2011-05-30 at 21:13 -0700, Dan Kegel wrote: > @@ -91,7 +91,7 @@ GetUserNameW( LPWSTR lpszName, LPDWORD lpSize ) > > if (len > *lpSize) > { > -SetLastError(ERROR_MORE_DATA); > +SetLastError(ERROR_INSUFFICIENT_BUFFER); GetUserNameA also needs to be fixed. It sets