wine-wine/dlls/advapi32/advapi.c

173 lines
4.7 KiB
C
Raw Normal View History

/*
* Win32 advapi functions
*
* Copyright 1995 Sven Verdoolaege
*
* 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
*/
#include "config.h"
#include "wine/port.h"
#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>
#include <stdarg.h>
1999-03-14 16:35:05 +00:00
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winerror.h"
#include "wine/library.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
1999-01-28 13:46:25 +00:00
/******************************************************************************
2001-02-14 23:11:17 +00:00
* GetUserNameA [ADVAPI32.@]
*
2003-03-18 18:35:48 +00:00
* Get the current user name.
*
* PARAMS
* lpszName [O] Destination for the user name.
* lpSize [I/O] Size of lpszName.
*
* RETURNS
* Success: The length of the user name, including terminating NUL.
* Failure: ERROR_MORE_DATA if *lpSize is too small.
*/
BOOL WINAPI
GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
{
size_t len;
const char *name = wine_get_user_name();
/* 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;
return 0;
}
*lpSize = len;
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
*
2003-03-18 18:35:48 +00:00
* See GetUserNameA.
*/
BOOL WINAPI
GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
{
const char *name = wine_get_user_name();
DWORD len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
if (len > *lpSize)
{
SetLastError(ERROR_MORE_DATA);
*lpSize = len;
return FALSE;
}
*lpSize = len;
MultiByteToWideChar( CP_ACP, 0, name, -1, lpszName, len );
return TRUE;
}
2002-06-14 23:32:46 +00:00
/******************************************************************************
* GetCurrentHwProfileA [ADVAPI32.@]
2003-03-18 18:35:48 +00:00
*
* Get the current hardware profile.
*
* PARAMS
* pInfo [O] Destination for hardware profile information.
*
* RETURNS
* Success: TRUE. pInfo is updated with the hardware profile details.
* Failure: FALSE.
2002-06-14 23:32:46 +00:00
*/
2003-03-18 18:35:48 +00:00
BOOL WINAPI GetCurrentHwProfileA(LPHW_PROFILE_INFOA pInfo)
2002-06-14 23:32:46 +00:00
{
2003-03-18 18:35:48 +00:00
FIXME("(%p) semi-stub\n", pInfo);
pInfo->dwDockInfo = DOCKINFO_DOCKED;
strcpy(pInfo->szHwProfileGuid,"{12340001-1234-1234-1234-1233456789012}");
strcpy(pInfo->szHwProfileName,"Wine Profile");
2002-06-14 23:32:46 +00:00
return 1;
}
/******************************************************************************
* AbortSystemShutdownA [ADVAPI32.@]
*
2003-03-18 18:35:48 +00:00
* Stop a system shutdown if one is in progress.
*
* PARAMS
2003-03-18 18:35:48 +00:00
* lpMachineName [I] Name of machine to not shutdown.
*
* RETURNS
* Success: TRUE.
* Failure: FALSE.
*
* NOTES
* The Wine implementation of this function is a harmless stub.
*/
BOOL WINAPI AbortSystemShutdownA( LPSTR lpMachineName )
{
TRACE("stub %s (harmless)\n", lpMachineName);
return TRUE;
}
/******************************************************************************
* AbortSystemShutdownW [ADVAPI32.@]
*
2003-03-18 18:35:48 +00:00
* See AbortSystemShutdownA.
*/
BOOL WINAPI AbortSystemShutdownW( LPCWSTR lpMachineName )
{
TRACE("stub %s (harmless)\n", debugstr_w(lpMachineName));
return TRUE;
}
/******************************************************************************
* InitiateSystemShutdownExA [ADVAPI32.@]
*/
BOOL WINAPI InitiateSystemShutdownExA( LPSTR lpMachineName, LPSTR lpMessage,
DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown,
DWORD dwReason)
{
FIXME("%s %s %ld %d %d %ld\n", debugstr_a(lpMachineName),
debugstr_a(lpMessage), dwTimeout, bForceAppsClosed,
bRebootAfterShutdown, dwReason);
return TRUE;
}
/******************************************************************************
* InitiateSystemShutdownExA [ADVAPI32.@]
*/
BOOL WINAPI InitiateSystemShutdownExW( LPWSTR lpMachineName, LPWSTR lpMessage,
DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown,
DWORD dwReason)
{
FIXME("%s %s %ld %d %d %ld\n", debugstr_w(lpMachineName),
debugstr_w(lpMessage), dwTimeout, bForceAppsClosed,
bRebootAfterShutdown, dwReason);
return TRUE;
}