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
)
58 DWORD sizeW
= *lpSize
* 2;
60 if (!(buffer
= HeapAlloc( GetProcessHeap(), 0, sizeW
* sizeof(WCHAR
) )))
62 SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
65 ret
= GetUserNameW( buffer
, &sizeW
);
68 if (!(*lpSize
= WideCharToMultiByte( CP_ACP
, 0, buffer
, -1, lpszName
, *lpSize
, NULL
, NULL
)))
70 *lpSize
= WideCharToMultiByte( CP_ACP
, 0, buffer
, -1, NULL
, 0, NULL
, NULL
);
71 SetLastError( ERROR_MORE_DATA
);
75 else *lpSize
= sizeW
* 2;
76 HeapFree( GetProcessHeap(), 0, buffer
);
80 /******************************************************************************
81 * GetUserNameW [ADVAPI32.@]
86 GetUserNameW( LPWSTR lpszName
, LPDWORD lpSize
)
88 const char *name
= wine_get_user_name();
89 DWORD len
= MultiByteToWideChar( CP_UNIXCP
, 0, name
, -1, NULL
, 0 );
93 SetLastError(ERROR_MORE_DATA
);
99 MultiByteToWideChar( CP_UNIXCP
, 0, name
, -1, lpszName
, len
);
103 /******************************************************************************
104 * GetCurrentHwProfileA [ADVAPI32.@]
106 * Get the current hardware profile.
109 * pInfo [O] Destination for hardware profile information.
112 * Success: TRUE. pInfo is updated with the hardware profile details.
115 BOOL WINAPI
GetCurrentHwProfileA(LPHW_PROFILE_INFOA pInfo
)
117 FIXME("(%p) semi-stub\n", pInfo
);
118 pInfo
->dwDockInfo
= DOCKINFO_DOCKED
;
119 strcpy(pInfo
->szHwProfileGuid
,"{12340001-1234-1234-1234-1233456789012}");
120 strcpy(pInfo
->szHwProfileName
,"Wine Profile");
124 /******************************************************************************
125 * AbortSystemShutdownA [ADVAPI32.@]
127 * Stop a system shutdown if one is in progress.
130 * lpMachineName [I] Name of machine to not shutdown.
137 * The Wine implementation of this function is a harmless stub.
139 BOOL WINAPI
AbortSystemShutdownA( LPSTR lpMachineName
)
141 TRACE("stub %s (harmless)\n", lpMachineName
);
145 /******************************************************************************
146 * AbortSystemShutdownW [ADVAPI32.@]
148 * See AbortSystemShutdownA.
150 BOOL WINAPI
AbortSystemShutdownW( LPWSTR lpMachineName
)
152 TRACE("stub %s (harmless)\n", debugstr_w(lpMachineName
));
156 /******************************************************************************
157 * InitiateSystemShutdownExA [ADVAPI32.@]
159 * Initiate a shutdown or optionally restart the computer.
162 * lpMachineName [I] Network name of machine to shutdown.
163 * lpMessage [I] Message displayed in shutdown dialog box.
164 * dwTimeout [I] Number of seconds dialog is displayed before shutdown.
165 * bForceAppsClosed [I] If TRUE, apps close without saving, else dialog is
166 * displayed requesting user to close apps.
167 * bRebootAfterShutdown [I] If TRUE, system reboots after restart, else the
168 * system flushes all caches to disk and clears
170 * dwReason [I] Reason for shutting down. Must be a system shutdown reason
178 * if lpMachineName is NULL, the local computer is shutdown.
180 BOOL WINAPI
InitiateSystemShutdownExA( LPSTR lpMachineName
, LPSTR lpMessage
,
181 DWORD dwTimeout
, BOOL bForceAppsClosed
, BOOL bRebootAfterShutdown
,
184 FIXME("%s %s %ld %d %d %ld\n", debugstr_a(lpMachineName
),
185 debugstr_a(lpMessage
), dwTimeout
, bForceAppsClosed
,
186 bRebootAfterShutdown
, dwReason
);
190 /******************************************************************************
191 * InitiateSystemShutdownExW [ADVAPI32.@]
193 * see InitiateSystemShutdownExA
195 BOOL WINAPI
InitiateSystemShutdownExW( LPWSTR lpMachineName
, LPWSTR lpMessage
,
196 DWORD dwTimeout
, BOOL bForceAppsClosed
, BOOL bRebootAfterShutdown
,
199 FIXME("%s %s %ld %d %d %ld\n", debugstr_w(lpMachineName
),
200 debugstr_w(lpMessage
), dwTimeout
, bForceAppsClosed
,
201 bRebootAfterShutdown
, dwReason
);
205 DWORD WINAPI
CommandLineFromMsiDescriptor(WCHAR
*Descriptor
, WCHAR
*CommandLine
,
206 DWORD
*CommandLineLength
)
208 FIXME("stub (%s)\n", debugstr_w(Descriptor
));
209 return ERROR_CALL_NOT_IMPLEMENTED
;