Use the proper WOW functions everywhere instead of the K32WOW variant.
[wine/testsucceed.git] / dlls / advapi32 / advapi.c
blob45acc14eda66383c7bbe3a2000380a22b3013f03
1 /*
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
21 #include "config.h"
22 #include "wine/port.h"
24 #include <errno.h>
25 #include <stdio.h>
26 #include <string.h>
27 #include <stdarg.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winnls.h"
32 #include "winreg.h"
33 #include "winternl.h"
34 #include "winerror.h"
35 #include "appmgmt.h"
37 #include "wine/library.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
42 /******************************************************************************
43 * GetUserNameA [ADVAPI32.@]
45 * Get the current user name.
47 * PARAMS
48 * lpszName [O] Destination for the user name.
49 * lpSize [I/O] Size of lpszName.
51 * RETURNS
52 * Success: The length of the user name, including terminating NUL.
53 * Failure: ERROR_MORE_DATA if *lpSize is too small.
55 BOOL WINAPI
56 GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
58 WCHAR *buffer;
59 BOOL ret;
60 DWORD sizeW = *lpSize * 2;
62 if (!(buffer = HeapAlloc( GetProcessHeap(), 0, sizeW * sizeof(WCHAR) )))
64 SetLastError( ERROR_NOT_ENOUGH_MEMORY );
65 return FALSE;
67 ret = GetUserNameW( buffer, &sizeW );
68 if (ret)
70 if (!(*lpSize = WideCharToMultiByte( CP_ACP, 0, buffer, -1, lpszName, *lpSize, NULL, NULL )))
72 *lpSize = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL );
73 SetLastError( ERROR_MORE_DATA );
74 ret = FALSE;
77 else *lpSize = sizeW * 2;
78 HeapFree( GetProcessHeap(), 0, buffer );
79 return ret;
82 /******************************************************************************
83 * GetUserNameW [ADVAPI32.@]
85 * See GetUserNameA.
87 BOOL WINAPI
88 GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
90 const char *name = wine_get_user_name();
91 DWORD len = MultiByteToWideChar( CP_UNIXCP, 0, name, -1, NULL, 0 );
93 if (len > *lpSize)
95 SetLastError(ERROR_MORE_DATA);
96 *lpSize = len;
97 return FALSE;
100 *lpSize = len;
101 MultiByteToWideChar( CP_UNIXCP, 0, name, -1, lpszName, len );
102 return TRUE;
105 /******************************************************************************
106 * GetCurrentHwProfileA [ADVAPI32.@]
108 * Get the current hardware profile.
110 * PARAMS
111 * pInfo [O] Destination for hardware profile information.
113 * RETURNS
114 * Success: TRUE. pInfo is updated with the hardware profile details.
115 * Failure: FALSE.
117 BOOL WINAPI GetCurrentHwProfileA(LPHW_PROFILE_INFOA pInfo)
119 FIXME("(%p) semi-stub\n", pInfo);
120 pInfo->dwDockInfo = DOCKINFO_DOCKED;
121 strcpy(pInfo->szHwProfileGuid,"{12340001-1234-1234-1234-1233456789012}");
122 strcpy(pInfo->szHwProfileName,"Wine Profile");
123 return 1;
126 /******************************************************************************
127 * GetCurrentHwProfileW [ADVAPI32.@]
129 * See GetCurrentHwProfileA.
131 BOOL WINAPI GetCurrentHwProfileW(LPHW_PROFILE_INFOW pInfo)
133 FIXME("(%p)\n", pInfo);
134 return FALSE;
138 /**************************************************************************
139 * IsTextUnicode (ADVAPI32.@)
141 * Attempt to guess whether a text buffer is Unicode.
143 * PARAMS
144 * buf [I] Text buffer to test
145 * len [I] Length of buf
146 * flags [O] Destination for test results
148 BOOL WINAPI IsTextUnicode( LPCVOID buf, INT len, LPINT flags )
150 return RtlIsTextUnicode( buf, len, flags );
154 /******************************************************************************
155 * AbortSystemShutdownA [ADVAPI32.@]
157 * Stop a system shutdown if one is in progress.
159 * PARAMS
160 * lpMachineName [I] Name of machine to not shutdown.
162 * RETURNS
163 * Success: TRUE.
164 * Failure: FALSE.
166 * NOTES
167 * The Wine implementation of this function is a harmless stub.
169 BOOL WINAPI AbortSystemShutdownA( LPSTR lpMachineName )
171 TRACE("stub %s (harmless)\n", lpMachineName);
172 return TRUE;
175 /******************************************************************************
176 * AbortSystemShutdownW [ADVAPI32.@]
178 * See AbortSystemShutdownA.
180 BOOL WINAPI AbortSystemShutdownW( LPWSTR lpMachineName )
182 TRACE("stub %s (harmless)\n", debugstr_w(lpMachineName));
183 return TRUE;
186 /******************************************************************************
187 * InitiateSystemShutdownExA [ADVAPI32.@]
189 * Initiate a shutdown or optionally restart the computer.
191 * PARAMS
192 * lpMachineName [I] Network name of machine to shutdown.
193 * lpMessage [I] Message displayed in shutdown dialog box.
194 * dwTimeout [I] Number of seconds dialog is displayed before shutdown.
195 * bForceAppsClosed [I] If TRUE, apps close without saving, else dialog is
196 * displayed requesting user to close apps.
197 * bRebootAfterShutdown [I] If TRUE, system reboots after restart, else the
198 * system flushes all caches to disk and clears
199 * the screen
200 * dwReason [I] Reason for shutting down. Must be a system shutdown reason
201 * code.
203 * RETURNS
204 * Success: TRUE
205 * Failure: FALSE
207 * NOTES
208 * if lpMachineName is NULL, the local computer is shutdown.
210 BOOL WINAPI InitiateSystemShutdownExA( LPSTR lpMachineName, LPSTR lpMessage,
211 DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown,
212 DWORD dwReason)
214 FIXME("%s %s %ld %d %d %ld\n", debugstr_a(lpMachineName),
215 debugstr_a(lpMessage), dwTimeout, bForceAppsClosed,
216 bRebootAfterShutdown, dwReason);
217 return TRUE;
220 /******************************************************************************
221 * InitiateSystemShutdownExW [ADVAPI32.@]
223 * see InitiateSystemShutdownExA
225 BOOL WINAPI InitiateSystemShutdownExW( LPWSTR lpMachineName, LPWSTR lpMessage,
226 DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown,
227 DWORD dwReason)
229 FIXME("%s %s %ld %d %d %ld\n", debugstr_w(lpMachineName),
230 debugstr_w(lpMessage), dwTimeout, bForceAppsClosed,
231 bRebootAfterShutdown, dwReason);
232 return TRUE;
235 BOOL WINAPI InitiateSystemShutdownA( LPSTR lpMachineName, LPSTR lpMessage, DWORD dwTimeout,
236 BOOL bForceAppsClosed, BOOL bRebootAfterShutdown )
238 return InitiateSystemShutdownExA( lpMachineName, lpMessage, dwTimeout,
239 bForceAppsClosed, bRebootAfterShutdown,
240 SHTDN_REASON_MAJOR_LEGACY_API );
243 BOOL WINAPI InitiateSystemShutdownW( LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwTimeout,
244 BOOL bForceAppsClosed, BOOL bRebootAfterShutdown )
246 return InitiateSystemShutdownExW( lpMachineName, lpMessage, dwTimeout,
247 bForceAppsClosed, bRebootAfterShutdown,
248 SHTDN_REASON_MAJOR_LEGACY_API );
251 BOOL WINAPI LogonUserA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword,
252 DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken )
254 FIXME("%s %s %p 0x%08lx 0x%08lx %p - stub\n", debugstr_a(lpszUsername),
255 debugstr_a(lpszDomain), lpszPassword, dwLogonType, dwLogonProvider, phToken);
257 return TRUE;
260 BOOL WINAPI LogonUserW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword,
261 DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken )
263 FIXME("%s %s %p 0x%08lx 0x%08lx %p - stub\n", debugstr_w(lpszUsername),
264 debugstr_w(lpszDomain), lpszPassword, dwLogonType, dwLogonProvider, phToken);
266 return TRUE;
269 DWORD WINAPI CommandLineFromMsiDescriptor(WCHAR *Descriptor, WCHAR *CommandLine,
270 DWORD *CommandLineLength)
272 FIXME("stub (%s)\n", debugstr_w(Descriptor));
273 return ERROR_CALL_NOT_IMPLEMENTED;