2 * Win32 advapi functions
4 * Copyright 1995 Sven Verdoolaege
14 #include "wine/winestring.h"
16 #include "debugtools.h"
19 /******************************************************************************
20 * GetUserName32A [ADVAPI32.67]
23 GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
30 /* FIXME: should use getpwuid() here */
31 if (!name) name=cuserid(NULL);
33 len = name ? strlen(name) : 0;
34 if (!len || !lpSize || len > *lpSize) {
35 if (lpszName) *lpszName = 0;
39 strcpy(lpszName, name);
43 /******************************************************************************
44 * GetUserName32W [ADVAPI32.68]
51 GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
53 LPSTR name = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *lpSize );
55 BOOL res = GetUserNameA(name,lpSize);
57 lstrcpynAtoW(lpszName,name,size);
58 HeapFree( GetProcessHeap(), 0, name );