Implemented InsertInASPIChain and fixed minor things.
[wine/multimedia.git] / dlls / advapi32 / advapi.c
blobda847236aa841302432bc1a3b1496349fb3f0153
1 /*
2 * Win32 advapi functions
4 * Copyright 1995 Sven Verdoolaege
5 */
7 #include <unistd.h>
8 #include <string.h>
10 #include "windef.h"
11 #include "winerror.h"
12 #include "wine/winestring.h"
13 #include "heap.h"
15 #include "debug.h"
18 /******************************************************************************
19 * GetUserName32A [ADVAPI32.67]
21 BOOL WINAPI
22 GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
24 size_t len;
25 char *name;
27 name=getlogin();
28 #if 0
29 /* FIXME: should use getpwuid() here */
30 if (!name) name=cuserid(NULL);
31 #endif
32 len = name ? strlen(name) : 0;
33 if (!len || !lpSize || len > *lpSize) {
34 if (lpszName) *lpszName = 0;
35 return 0;
37 *lpSize=len;
38 strcpy(lpszName, name);
39 return 1;
42 /******************************************************************************
43 * GetUserName32W [ADVAPI32.68]
45 * PARAMS
46 * lpszName []
47 * lpSize []
49 BOOL WINAPI
50 GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
52 LPSTR name = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *lpSize );
53 DWORD size = *lpSize;
54 BOOL res = GetUserNameA(name,lpSize);
56 lstrcpynAtoW(lpszName,name,size);
57 HeapFree( GetProcessHeap(), 0, name );
58 return res;