Moved ADVAPI32 files to dlls/advapi32.
[wine/multimedia.git] / dlls / advapi32 / advapi.c
blob483fee390dd9e214d04cce09288f22b2ce99e964
1 /*
2 * Win32 advapi functions
4 * Copyright 1995 Sven Verdoolaege
5 */
7 #include "windows.h"
8 #include "winerror.h"
9 #include "debug.h"
10 #include "heap.h"
12 #include <unistd.h>
14 /***********************************************************************
15 * GetUserNameA [ADVAPI32.67]
17 BOOL32 WINAPI GetUserName32A(LPSTR lpszName, LPDWORD lpSize)
19 size_t len;
20 char *name;
22 name=getlogin();
23 #if 0
24 /* FIXME: should use getpwuid() here */
25 if (!name) name=cuserid(NULL);
26 #endif
27 len = name ? strlen(name) : 0;
28 if (!len || !lpSize || len > *lpSize) {
29 if (lpszName) *lpszName = 0;
30 return 0;
32 *lpSize=len;
33 strcpy(lpszName, name);
34 return 1;
37 /***********************************************************************
38 * GetUserNameW [ADVAPI32.68]
40 BOOL32 WINAPI GetUserName32W(LPWSTR lpszName, LPDWORD lpSize)
42 LPSTR name = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *lpSize );
43 DWORD size = *lpSize;
44 BOOL32 res = GetUserName32A(name,lpSize);
46 lstrcpynAtoW(lpszName,name,size);
47 HeapFree( GetProcessHeap(), 0, name );
48 return res;