2 * Win32 advapi functions
4 * Copyright 1995 Sven Verdoolaege
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/port.h"
35 #include "wine/library.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
40 /******************************************************************************
41 * GetUserNameA [ADVAPI32.@]
43 * Get the current user name.
46 * lpszName [O] Destination for the user name.
47 * lpSize [I/O] Size of lpszName.
50 * Success: The length of the user name, including terminating NUL.
51 * Failure: ERROR_MORE_DATA if *lpSize is too small.
54 GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
59 if (!(buffer = HeapAlloc( GetProcessHeap(), 0, *lpSize * 2 * sizeof(WCHAR) )))
61 SetLastError( ERROR_NOT_ENOUGH_MEMORY );
64 ret = GetUserNameW( buffer, *lpSize * 2 );
67 if (!(*lpSize = WideCharToMultiByte( CP_ACP, 0, buffer, -1, lpszName, *lpSize, NULL, NULL )))
69 *lpSize = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL );
70 SetLastError( ERROR_MORE_DATA );
74 HeapFree( GetProcessHeap(), 0, buffer );
78 /******************************************************************************
79 * GetUserNameW [ADVAPI32.@]
84 GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
86 const char *name = wine_get_user_name();
87 DWORD len = MultiByteToWideChar( CP_UNIXCP, 0, name, -1, NULL, 0 );
91 SetLastError(ERROR_MORE_DATA);
97 MultiByteToWideChar( CP_UNIXCP, 0, name, -1, lpszName, len );
101 /******************************************************************************
102 * GetCurrentHwProfileA [ADVAPI32.@]
104 * Get the current hardware profile.
107 * pInfo [O] Destination for hardware profile information.
110 * Success: TRUE. pInfo is updated with the hardware profile details.
113 BOOL WINAPI GetCurrentHwProfileA(LPHW_PROFILE_INFOA pInfo)
115 FIXME("(%p) semi-stub\n", pInfo);
116 pInfo->dwDockInfo = DOCKINFO_DOCKED;
117 strcpy(pInfo->szHwProfileGuid,"{12340001-1234-1234-1234-1233456789012}");
118 strcpy(pInfo->szHwProfileName,"Wine Profile");
122 /******************************************************************************
123 * AbortSystemShutdownA [ADVAPI32.@]
125 * Stop a system shutdown if one is in progress.
128 * lpMachineName [I] Name of machine to not shutdown.
135 * The Wine implementation of this function is a harmless stub.
137 BOOL WINAPI AbortSystemShutdownA( LPSTR lpMachineName )
139 TRACE("stub %s (harmless)\n", lpMachineName);
143 /******************************************************************************
144 * AbortSystemShutdownW [ADVAPI32.@]
146 * See AbortSystemShutdownA.
148 BOOL WINAPI AbortSystemShutdownW( LPWSTR lpMachineName )
150 TRACE("stub %s (harmless)\n", debugstr_w(lpMachineName));
154 /******************************************************************************
155 * InitiateSystemShutdownExA [ADVAPI32.@]
157 BOOL WINAPI InitiateSystemShutdownExA( LPSTR lpMachineName, LPSTR lpMessage,
158 DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown,
161 FIXME("%s %s %ld %d %d %ld\n", debugstr_a(lpMachineName),
162 debugstr_a(lpMessage), dwTimeout, bForceAppsClosed,
163 bRebootAfterShutdown, dwReason);
167 /******************************************************************************
168 * InitiateSystemShutdownExA [ADVAPI32.@]
170 BOOL WINAPI InitiateSystemShutdownExW( LPWSTR lpMachineName, LPWSTR lpMessage,
171 DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown,
174 FIXME("%s %s %ld %d %d %ld\n", debugstr_w(lpMachineName),
175 debugstr_w(lpMessage), dwTimeout, bForceAppsClosed,
176 bRebootAfterShutdown, dwReason);
180 DWORD WINAPI CommandLineFromMsiDescriptor(WCHAR *Descriptor, WCHAR *CommandLine,
181 DWORD *CommandLineLength)
183 FIXME("stub (%s)\n", debugstr_w(Descriptor));
184 return ERROR_CALL_NOT_IMPLEMENTED;