1999-01-03 12:48:29 +00:00
|
|
|
/*
|
|
|
|
* Win32 advapi functions
|
|
|
|
*
|
|
|
|
* Copyright 1995 Sven Verdoolaege
|
2002-03-09 23:29:33 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1999-01-03 12:48:29 +00:00
|
|
|
*/
|
|
|
|
|
2002-04-26 19:05:15 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
2001-11-20 20:26:54 +00:00
|
|
|
#include <errno.h>
|
1999-06-12 14:55:11 +00:00
|
|
|
#include <stdio.h>
|
1999-02-19 15:42:11 +00:00
|
|
|
#include <string.h>
|
1999-02-17 13:51:06 +00:00
|
|
|
|
1999-07-03 16:01:42 +00:00
|
|
|
#include "winbase.h"
|
1999-03-14 16:35:05 +00:00
|
|
|
#include "windef.h"
|
2000-11-28 22:40:56 +00:00
|
|
|
#include "winnls.h"
|
1999-01-03 12:48:29 +00:00
|
|
|
#include "winerror.h"
|
|
|
|
|
2002-08-27 18:30:53 +00:00
|
|
|
#include "wine/library.h"
|
2002-03-09 23:29:33 +00:00
|
|
|
#include "wine/debug.h"
|
1999-02-17 13:51:06 +00:00
|
|
|
|
2002-03-09 23:29:33 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
|
1999-01-03 12:48:29 +00:00
|
|
|
|
1999-01-28 13:46:25 +00:00
|
|
|
/******************************************************************************
|
2001-02-14 23:11:17 +00:00
|
|
|
* GetUserNameA [ADVAPI32.@]
|
2001-11-20 20:26:54 +00:00
|
|
|
*
|
|
|
|
* NOTE: lpSize returns the total length of the username, including the
|
|
|
|
* terminating null character.
|
1999-01-03 12:48:29 +00:00
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
BOOL WINAPI
|
|
|
|
GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
|
1999-01-03 12:48:29 +00:00
|
|
|
{
|
|
|
|
size_t len;
|
2002-08-27 18:30:53 +00:00
|
|
|
const char *name = wine_get_user_name();
|
2001-11-20 20:26:54 +00:00
|
|
|
|
|
|
|
/* We need to include the null character when determining the size of the buffer. */
|
|
|
|
len = strlen(name) + 1;
|
|
|
|
if (len > *lpSize)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_MORE_DATA);
|
|
|
|
*lpSize = len;
|
1999-01-03 12:48:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2001-11-20 20:26:54 +00:00
|
|
|
|
|
|
|
*lpSize = len;
|
1999-01-03 12:48:29 +00:00
|
|
|
strcpy(lpszName, name);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1999-01-28 13:46:25 +00:00
|
|
|
/******************************************************************************
|
2001-02-14 23:11:17 +00:00
|
|
|
* GetUserNameW [ADVAPI32.@]
|
1999-01-28 13:46:25 +00:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpszName []
|
|
|
|
* lpSize []
|
1999-01-03 12:48:29 +00:00
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
BOOL WINAPI
|
|
|
|
GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
|
1999-01-03 12:48:29 +00:00
|
|
|
{
|
2002-08-27 18:30:53 +00:00
|
|
|
const char *name = wine_get_user_name();
|
|
|
|
DWORD len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
|
1999-01-03 12:48:29 +00:00
|
|
|
|
2002-08-27 18:30:53 +00:00
|
|
|
if (len > *lpSize)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_MORE_DATA);
|
|
|
|
*lpSize = len;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*lpSize = len;
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, name, -1, lpszName, len );
|
|
|
|
return TRUE;
|
1999-01-03 12:48:29 +00:00
|
|
|
}
|
2002-04-19 00:04:27 +00:00
|
|
|
|
2002-06-14 23:32:46 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GetCurrentHwProfileA [ADVAPI32.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI GetCurrentHwProfileA(LPHW_PROFILE_INFOA info)
|
|
|
|
{
|
|
|
|
FIXME("Mostly Stub\n");
|
|
|
|
info->dwDockInfo = DOCKINFO_DOCKED;
|
|
|
|
strcpy(info->szHwProfileGuid,"{12340001-1234-1234-1234-1233456789012}");
|
|
|
|
strcpy(info->szHwProfileName,"Wine Profile");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2002-04-19 00:04:27 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* AbortSystemShutdownA [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpMachineName
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AbortSystemShutdownA( LPSTR lpMachineName )
|
|
|
|
{
|
|
|
|
TRACE("stub %s (harmless)\n", lpMachineName);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* AbortSystemShutdownW [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpMachineName
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AbortSystemShutdownW( LPCWSTR lpMachineName )
|
|
|
|
{
|
|
|
|
TRACE("stub %s (harmless)\n", debugstr_w(lpMachineName));
|
|
|
|
return TRUE;
|
|
|
|
}
|