Spelling fixes.
[wine.git] / dlls / advapi32 / advapi.c
blob966adf574c9099dfffabb7d99ffdad7fbfb13831
1 /*
2 * Win32 advapi functions
4 * Copyright 1995 Sven Verdoolaege
5 */
7 #include <stdio.h>
8 #include <unistd.h>
9 #include <string.h>
11 #include "winbase.h"
12 #include "windef.h"
13 #include "winerror.h"
14 #include "wine/winestring.h"
16 #include "debugtools.h"
19 /******************************************************************************
20 * GetUserNameA [ADVAPI32.67]
22 BOOL WINAPI
23 GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
25 size_t len;
26 char *name;
28 name=getlogin();
29 #if 0
30 /* FIXME: should use getpwuid() here */
31 if (!name) name=cuserid(NULL);
32 #endif
33 len = name ? strlen(name) : 0;
34 if (!len || !lpSize || len > *lpSize) {
35 if (lpszName) *lpszName = 0;
36 return 0;
38 *lpSize=len;
39 strcpy(lpszName, name);
40 return 1;
43 /******************************************************************************
44 * GetUserNameW [ADVAPI32.68]
46 * PARAMS
47 * lpszName []
48 * lpSize []
50 BOOL WINAPI
51 GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
53 LPSTR name = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *lpSize );
54 DWORD size = *lpSize;
55 BOOL res = GetUserNameA(name,lpSize);
57 lstrcpynAtoW(lpszName,name,size);
58 HeapFree( GetProcessHeap(), 0, name );
59 return res;