1999-01-03 13:48:29 +01:00
|
|
|
/*
|
|
|
|
* Win32 advapi functions
|
|
|
|
*
|
|
|
|
* Copyright 1995 Sven Verdoolaege
|
|
|
|
*/
|
|
|
|
|
1999-02-17 14:51:06 +01:00
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "wintypes.h"
|
1999-01-03 13:48:29 +01:00
|
|
|
#include "winerror.h"
|
1999-02-17 14:51:06 +01:00
|
|
|
#include "wine/winestring.h"
|
1999-01-03 13:48:29 +01:00
|
|
|
#include "heap.h"
|
|
|
|
|
1999-02-17 14:51:06 +01:00
|
|
|
#include "debug.h"
|
|
|
|
|
1999-01-03 13:48:29 +01:00
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* GetUserName32A [ADVAPI32.67]
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-01-28 14:46:25 +01:00
|
|
|
BOOL32 WINAPI
|
|
|
|
GetUserName32A( LPSTR lpszName, LPDWORD lpSize )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
|
|
|
size_t len;
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
name=getlogin();
|
|
|
|
#if 0
|
|
|
|
/* FIXME: should use getpwuid() here */
|
|
|
|
if (!name) name=cuserid(NULL);
|
|
|
|
#endif
|
|
|
|
len = name ? strlen(name) : 0;
|
|
|
|
if (!len || !lpSize || len > *lpSize) {
|
|
|
|
if (lpszName) *lpszName = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
*lpSize=len;
|
|
|
|
strcpy(lpszName, name);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1999-01-28 14:46:25 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* GetUserName32W [ADVAPI32.68]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpszName []
|
|
|
|
* lpSize []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-01-28 14:46:25 +01:00
|
|
|
BOOL32 WINAPI
|
|
|
|
GetUserName32W( LPWSTR lpszName, LPDWORD lpSize )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
|
|
|
LPSTR name = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *lpSize );
|
|
|
|
DWORD size = *lpSize;
|
|
|
|
BOOL32 res = GetUserName32A(name,lpSize);
|
|
|
|
|
|
|
|
lstrcpynAtoW(lpszName,name,size);
|
|
|
|
HeapFree( GetProcessHeap(), 0, name );
|
|
|
|
return res;
|
|
|
|
}
|