Slightly new and improved stub for GetUserNameA based on the Winehq

code and hacked by Royce and Me.

svn path=/trunk/; revision=11082
This commit is contained in:
Steven Edwards 2004-09-26 21:15:51 +00:00
parent 05848ce54b
commit 21d354a1c1

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.25 2004/09/26 20:26:13 gvg Exp $ /* $Id: misc.c,v 1.26 2004/09/26 21:15:51 sedwards Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -477,30 +477,32 @@ RevertToSelf(VOID)
* lpszName [O] Destination for the user name. * lpszName [O] Destination for the user name.
* lpSize [I/O] Size of lpszName. * lpSize [I/O] Size of lpszName.
* *
* RETURNS
* Success: The length of the user name, including terminating NUL.
* Failure: ERROR_MORE_DATA if *lpSize is too small.
* *
* @unimplemented * @unimplemented
*/ */
BOOL WINAPI BOOL WINAPI
GetUserNameA( LPSTR lpszName, LPDWORD lpSize ) GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
{ {
// size_t len; size_t len;
// char name[] = { "Administrator" }; const char* name = "Administrator";
/* We need to include the null character when determining the size of the buffer. */
// len = strlen(name) + 1;
// if (len > *lpSize)
// {
// SetLastError(ERROR_MORE_DATA);
// *lpSize = len;
// return 0;
// }
// *lpSize = len;
// strcpy(lpszName, name);
DPRINT1("GetUserNameA: stub\n"); DPRINT1("GetUserNameA: stub\n");
if ( !lpSize )
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
/* We need to include the null character when determining the size of the buffer. */
len = strlen(name) + 1;
if (len > *lpSize)
{
SetLastError(ERROR_MORE_DATA);
*lpSize = len;
return FALSE;
}
*lpSize = len;
strcpy(lpszName, name);
return TRUE; return TRUE;
} }