2 * Win32 advapi functions
4 * Copyright 1995 Sven Verdoolaege
14 /***********************************************************************
15 * GetUserNameA [ADVAPI32.67]
17 BOOL32 WINAPI
GetUserName32A(LPSTR lpszName
, LPDWORD lpSize
)
24 /* FIXME: should use getpwuid() here */
25 if (!name
) name
=cuserid(NULL
);
27 len
= name
? strlen(name
) : 0;
28 if (!len
|| !lpSize
|| len
> *lpSize
) {
29 if (lpszName
) *lpszName
= 0;
33 strcpy(lpszName
, name
);
37 /***********************************************************************
38 * GetUserNameW [ADVAPI32.68]
40 BOOL32 WINAPI
GetUserName32W(LPWSTR lpszName
, LPDWORD lpSize
)
42 LPSTR name
= (LPSTR
)HeapAlloc( GetProcessHeap(), 0, *lpSize
);
44 BOOL32 res
= GetUserName32A(name
,lpSize
);
46 lstrcpynAtoW(lpszName
,name
,size
);
47 HeapFree( GetProcessHeap(), 0, name
);