~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/advapi32/advapi.c

Version: ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /*
  2  * Win32 advapi functions
  3  *
  4  * Copyright 1995 Sven Verdoolaege
  5  *
  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.
 10  *
 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.
 15  *
 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #include <errno.h>
 22 #include <stdio.h>
 23 #include <string.h>
 24 #include <stdarg.h>
 25 
 26 #include "windef.h"
 27 #include "winbase.h"
 28 #include "winnls.h"
 29 #include "winreg.h"
 30 #include "winternl.h"
 31 #include "winerror.h"
 32 #include "wincred.h"
 33 
 34 #include "wine/library.h"
 35 #include "wine/debug.h"
 36 
 37 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
 38 
 39 /******************************************************************************
 40  * GetUserNameA [ADVAPI32.@]
 41  *
 42  * Get the current user name.
 43  *
 44  * PARAMS
 45  *  lpszName [O]   Destination for the user name.
 46  *  lpSize   [I/O] Size of lpszName.
 47  *
 48  * RETURNS
 49  *  Success: The length of the user name, including terminating NUL.
 50  *  Failure: ERROR_MORE_DATA if *lpSize is too small.
 51  */
 52 BOOL WINAPI
 53 GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
 54 {
 55     WCHAR *buffer;
 56     BOOL ret;
 57     DWORD sizeW = *lpSize * 2;
 58 
 59     if (!(buffer = HeapAlloc( GetProcessHeap(), 0, sizeW * sizeof(WCHAR) )))
 60     {
 61         SetLastError( ERROR_NOT_ENOUGH_MEMORY );
 62         return FALSE;
 63     }
 64     ret = GetUserNameW( buffer, &sizeW );
 65     if (ret)
 66     {
 67         if (!(*lpSize = WideCharToMultiByte( CP_ACP, 0, buffer, -1, lpszName, *lpSize, NULL, NULL )))
 68         {
 69             *lpSize = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL );
 70             SetLastError( ERROR_MORE_DATA );
 71             ret = FALSE;
 72         }
 73     }
 74     else *lpSize = sizeW * 2;
 75     HeapFree( GetProcessHeap(), 0, buffer );
 76     return ret;
 77 }
 78 
 79 /******************************************************************************
 80  * GetUserNameW [ADVAPI32.@]
 81  *
 82  * See GetUserNameA.
 83  */
 84 BOOL WINAPI
 85 GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
 86 {
 87     const char *name = wine_get_user_name();
 88     DWORD i, len = MultiByteToWideChar( CP_UNIXCP, 0, name, -1, NULL, 0 );
 89 
 90     if (len > *lpSize)
 91     {
 92         SetLastError(ERROR_MORE_DATA);
 93         *lpSize = len;
 94         return FALSE;
 95     }
 96 
 97     *lpSize = len;
 98     MultiByteToWideChar( CP_UNIXCP, 0, name, -1, lpszName, len );
 99 
100     /* Word uses the user name to create named mutexes and file mappings,
101      * and backslashes in the name cause the creation to fail.
102      */
103     for (i = 0; lpszName[i]; i++)
104         if (lpszName[i] == '\\' || lpszName[i] == '/') lpszName[i] = '_';
105     return TRUE;
106 }
107 
108 /******************************************************************************
109  * GetCurrentHwProfileA [ADVAPI32.@]
110  *
111  * Get the current hardware profile.
112  *
113  * PARAMS
114  *  pInfo [O] Destination for hardware profile information.
115  *
116  * RETURNS
117  *  Success: TRUE. pInfo is updated with the hardware profile details.
118  *  Failure: FALSE.
119  */
120 BOOL WINAPI GetCurrentHwProfileA(LPHW_PROFILE_INFOA pInfo)
121 {
122         FIXME("(%p) semi-stub\n", pInfo);
123         pInfo->dwDockInfo = DOCKINFO_DOCKED;
124         strcpy(pInfo->szHwProfileGuid,"{12340001-1234-1234-1234-123456789012}");
125         strcpy(pInfo->szHwProfileName,"Wine Profile");
126         return 1;
127 }
128 
129 /******************************************************************************
130  * GetCurrentHwProfileW [ADVAPI32.@]
131  *
132  * See GetCurrentHwProfileA.
133  */
134 BOOL WINAPI GetCurrentHwProfileW(LPHW_PROFILE_INFOW pInfo)
135 {
136        FIXME("(%p)\n", pInfo);
137        return FALSE;
138 }
139 
140 
141 /**************************************************************************
142  *      IsTextUnicode (ADVAPI32.@)
143  *
144  * Attempt to guess whether a text buffer is Unicode.
145  *
146  * PARAMS
147  *  buf   [I] Text buffer to test
148  *  len   [I] Length of buf
149  *  flags [O] Destination for test results
150  *
151  * RETURNS
152  *  TRUE if the buffer is likely Unicode, FALSE otherwise.
153  */
154 BOOL WINAPI IsTextUnicode( LPCVOID buf, INT len, LPINT flags )
155 {
156     return RtlIsTextUnicode( buf, len, flags );
157 }
158 
159 
160 /******************************************************************************
161  * AbortSystemShutdownA [ADVAPI32.@]
162  *
163  * Stop a system shutdown if one is in progress.
164  *
165  * PARAMS
166  *  lpMachineName [I] Name of machine to not shutdown.
167  *
168  * RETURNS
169  *  Success: TRUE.
170  *  Failure: FALSE.
171  *
172  * NOTES
173  *  The Wine implementation of this function is a harmless stub.
174  */
175 BOOL WINAPI AbortSystemShutdownA( LPSTR lpMachineName )
176 {
177     TRACE("stub %s (harmless)\n", lpMachineName);
178     return TRUE;
179 }
180 
181 /******************************************************************************
182  * AbortSystemShutdownW [ADVAPI32.@]
183  *
184  * See AbortSystemShutdownA.
185  */
186 BOOL WINAPI AbortSystemShutdownW( LPWSTR lpMachineName )
187 {
188     TRACE("stub %s (harmless)\n", debugstr_w(lpMachineName));
189     return TRUE;
190 }
191 
192 /******************************************************************************
193  * InitiateSystemShutdownExA [ADVAPI32.@]
194  *
195  * Initiate a shutdown or optionally restart the computer.
196  *
197  * PARAMS
198  *  lpMachineName    [I] Network name of machine to shutdown.
199  *  lpMessage        [I] Message displayed in shutdown dialog box.
200  *  dwTimeout        [I] Number of seconds dialog is displayed before shutdown.
201  *  bForceAppsClosed [I] If TRUE, apps close without saving, else dialog is
202  *                       displayed requesting user to close apps.
203  *  bRebootAfterShutdown [I] If TRUE, system reboots after restart, else the
204  *                           system flushes all caches to disk and clears
205  *                           the screen
206  *  dwReason [I] Reason for shutting down.  Must be a system shutdown reason
207  *               code.
208  *
209  *  RETURNS
210  *   Success: TRUE
211  *   Failure: FALSE
212  *
213  *  NOTES
214  *   if lpMachineName is NULL, the local computer is shutdown.
215  */
216 BOOL WINAPI InitiateSystemShutdownExA( LPSTR lpMachineName, LPSTR lpMessage,
217          DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown,
218          DWORD dwReason)
219 {
220      FIXME("%s %s %d %d %d %d\n", debugstr_a(lpMachineName),
221             debugstr_a(lpMessage), dwTimeout, bForceAppsClosed,
222             bRebootAfterShutdown, dwReason);
223      return TRUE;
224 } 
225 
226 /******************************************************************************
227  * InitiateSystemShutdownExW [ADVAPI32.@]
228  *
229  * See InitiateSystemShutdownExA.
230  */
231 BOOL WINAPI InitiateSystemShutdownExW( LPWSTR lpMachineName, LPWSTR lpMessage,
232          DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown,
233          DWORD dwReason)
234 {
235      FIXME("%s %s %d %d %d %d\n", debugstr_w(lpMachineName),
236             debugstr_w(lpMessage), dwTimeout, bForceAppsClosed,
237             bRebootAfterShutdown, dwReason);
238      return TRUE;
239 } 
240 
241 BOOL WINAPI InitiateSystemShutdownA( LPSTR lpMachineName, LPSTR lpMessage, DWORD dwTimeout,
242                                      BOOL bForceAppsClosed, BOOL bRebootAfterShutdown )
243 {
244     return InitiateSystemShutdownExA( lpMachineName, lpMessage, dwTimeout,
245                                       bForceAppsClosed, bRebootAfterShutdown,
246                                       SHTDN_REASON_MAJOR_LEGACY_API );
247 }
248 
249 BOOL WINAPI InitiateSystemShutdownW( LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwTimeout,
250                                      BOOL bForceAppsClosed, BOOL bRebootAfterShutdown )
251 {
252     return InitiateSystemShutdownExW( lpMachineName, lpMessage, dwTimeout,
253                                       bForceAppsClosed, bRebootAfterShutdown,
254                                       SHTDN_REASON_MAJOR_LEGACY_API );
255 }
256 
257 BOOL WINAPI LogonUserA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword,
258                         DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken )
259 {
260     FIXME("%s %s %p 0x%08x 0x%08x %p - stub\n", debugstr_a(lpszUsername),
261           debugstr_a(lpszDomain), lpszPassword, dwLogonType, dwLogonProvider, phToken);
262 
263     return TRUE;
264 }
265 
266 BOOL WINAPI LogonUserW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword,
267                         DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken )
268 {
269     FIXME("%s %s %p 0x%08x 0x%08x %p - stub\n", debugstr_w(lpszUsername),
270           debugstr_w(lpszDomain), lpszPassword, dwLogonType, dwLogonProvider, phToken);
271 
272     return TRUE;
273 }
274 
275 typedef UINT (WINAPI *fnMsiProvideComponentFromDescriptor)(LPCWSTR,LPWSTR,DWORD*,DWORD*);
276 
277 DWORD WINAPI CommandLineFromMsiDescriptor( WCHAR *szDescriptor,
278                     WCHAR *szCommandLine, DWORD *pcchCommandLine )
279 {
280     static const WCHAR szMsi[] = { 'm','s','i',0 };
281     fnMsiProvideComponentFromDescriptor mpcfd;
282     HMODULE hmsi;
283     UINT r = ERROR_CALL_NOT_IMPLEMENTED;
284 
285     TRACE("%s %p %p\n", debugstr_w(szDescriptor), szCommandLine, pcchCommandLine);
286 
287     hmsi = LoadLibraryW( szMsi );
288     if (!hmsi)
289         return r;
290     mpcfd = (fnMsiProvideComponentFromDescriptor)GetProcAddress( hmsi,
291                                                                  "MsiProvideComponentFromDescriptorW" );
292     if (mpcfd)
293         r = mpcfd( szDescriptor, szCommandLine, pcchCommandLine, NULL );
294     FreeLibrary( hmsi );
295     return r;
296 }
297 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.