1 | /* $Id: security.cpp,v 1.6 2000-10-21 14:29:49 sandervl Exp $ */
|
---|
2 | /*
|
---|
3 | * Win32 security API functions for OS/2
|
---|
4 | *
|
---|
5 | * Copyright 1998 Sander van Leeuwen (OS/2 Port)
|
---|
6 | *
|
---|
7 | * Based on Wine code (dlls\advapi32\security.c)
|
---|
8 | *
|
---|
9 | * Copyright original Wine author(s) (????)
|
---|
10 | *
|
---|
11 | * dlls/advapi32/security.c
|
---|
12 | * FIXME: for all functions thunking down to Rtl* functions: implement SetLastError()
|
---|
13 | */
|
---|
14 | #ifdef __WIN32OS2__
|
---|
15 | #include <os2win.h>
|
---|
16 | #include <heapstring.h>
|
---|
17 | #endif
|
---|
18 |
|
---|
19 | #include <string.h>
|
---|
20 |
|
---|
21 | #include "windef.h"
|
---|
22 | #include "winerror.h"
|
---|
23 | #include "heap.h"
|
---|
24 | #include "ntddk.h"
|
---|
25 | #include "ntsecapi.h"
|
---|
26 | #include "debugtools.h"
|
---|
27 |
|
---|
28 | DECLARE_DEBUG_CHANNEL(advapi-security)
|
---|
29 |
|
---|
30 | static BOOL fInitSecurity = FALSE;
|
---|
31 | static BOOL fHasSecurity = FALSE;
|
---|
32 |
|
---|
33 | static BOOL Wine_HasSecurity(void)
|
---|
34 | {
|
---|
35 | //SvL: Let's not check this for every single call please...
|
---|
36 | if(!fInitSecurity)
|
---|
37 | {
|
---|
38 | OSVERSIONINFOA osi;
|
---|
39 | osi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
|
---|
40 | GetVersionExA(&osi);
|
---|
41 | if (osi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
|
---|
42 | fHasSecurity = TRUE;
|
---|
43 | }
|
---|
44 | fInitSecurity = TRUE;
|
---|
45 | }
|
---|
46 | if(!fHasSecurity) {
|
---|
47 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
48 | return FALSE;
|
---|
49 | }
|
---|
50 | return TRUE;
|
---|
51 | }
|
---|
52 |
|
---|
53 |
|
---|
54 | #define CallWin32ToNt(func) \
|
---|
55 | { NTSTATUS ret; \
|
---|
56 | ret = (func); \
|
---|
57 | if (ret !=STATUS_SUCCESS) \
|
---|
58 | { SetLastError (RtlNtStatusToDosError(ret)); return FALSE; } \
|
---|
59 | return TRUE; \
|
---|
60 | }
|
---|
61 |
|
---|
62 | /* ##############################
|
---|
63 | ###### TOKEN FUNCTIONS ######
|
---|
64 | ##############################
|
---|
65 | */
|
---|
66 |
|
---|
67 | /******************************************************************************
|
---|
68 | * OpenProcessToken [ADVAPI32.109]
|
---|
69 | * Opens the access token associated with a process
|
---|
70 | *
|
---|
71 | * PARAMS
|
---|
72 | * ProcessHandle [I] Handle to process
|
---|
73 | * DesiredAccess [I] Desired access to process
|
---|
74 | * TokenHandle [O] Pointer to handle of open access token
|
---|
75 | *
|
---|
76 | * RETURNS STD
|
---|
77 | */
|
---|
78 | BOOL WINAPI
|
---|
79 | OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess,
|
---|
80 | HANDLE *TokenHandle )
|
---|
81 | {
|
---|
82 | if (!Wine_HasSecurity()) return FALSE;
|
---|
83 | CallWin32ToNt(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle ));
|
---|
84 | }
|
---|
85 |
|
---|
86 | /******************************************************************************
|
---|
87 | * OpenThreadToken [ADVAPI32.114]
|
---|
88 | *
|
---|
89 | * PARAMS
|
---|
90 | * thread []
|
---|
91 | * desiredaccess []
|
---|
92 | * openasself []
|
---|
93 | * thandle []
|
---|
94 | */
|
---|
95 | BOOL WINAPI
|
---|
96 | OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess,
|
---|
97 | BOOL OpenAsSelf, HANDLE *TokenHandle)
|
---|
98 | {
|
---|
99 | if (!Wine_HasSecurity()) return FALSE;
|
---|
100 | CallWin32ToNt (NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle));
|
---|
101 | }
|
---|
102 |
|
---|
103 | /*************************************************************************
|
---|
104 | * SetThreadToken [ADVAPI32.231]
|
---|
105 | *
|
---|
106 | * Assigns an "impersonation token" to a thread so it can assume the
|
---|
107 | * security privledges of another thread or process. Can also remove
|
---|
108 | * a previously assigned token. Only supported on NT - it's a stub
|
---|
109 | * exactly like this one on Win9X.
|
---|
110 | *
|
---|
111 | */
|
---|
112 |
|
---|
113 | BOOL WINAPI SetThreadToken(PHANDLE thread, HANDLE token)
|
---|
114 | {
|
---|
115 | #ifdef __WIN32OS2__
|
---|
116 |
|
---|
117 | dprintf(("SetThreadToken %x %x NOT IMPLEMENTED (FAKED)", thread, token));
|
---|
118 |
|
---|
119 | if (!Wine_HasSecurity()) return FALSE;
|
---|
120 | return TRUE; //pretend it succeeded
|
---|
121 | #else
|
---|
122 | FIXME(__FUNCTION__"(%p, %x): stub\n", thread, token);
|
---|
123 |
|
---|
124 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
125 |
|
---|
126 | return FALSE;
|
---|
127 | #endif
|
---|
128 | }
|
---|
129 |
|
---|
130 | /******************************************************************************
|
---|
131 | * AdjustTokenPrivileges [ADVAPI32.10]
|
---|
132 | *
|
---|
133 | * PARAMS
|
---|
134 | * TokenHandle []
|
---|
135 | * DisableAllPrivileges []
|
---|
136 | * NewState []
|
---|
137 | * BufferLength []
|
---|
138 | * PreviousState []
|
---|
139 | * ReturnLength []
|
---|
140 | */
|
---|
141 | BOOL WINAPI
|
---|
142 | AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges,
|
---|
143 | PTOKEN_PRIVILEGES NewState, DWORD BufferLength,
|
---|
144 | PTOKEN_PRIVILEGES PreviousState, LPDWORD ReturnLength )
|
---|
145 | {
|
---|
146 | CallWin32ToNt(NtAdjustPrivilegesToken(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength));
|
---|
147 | }
|
---|
148 |
|
---|
149 | /******************************************************************************
|
---|
150 | * GetTokenInformation [ADVAPI32.66]
|
---|
151 | *
|
---|
152 | * PARAMS
|
---|
153 | * token []
|
---|
154 | * tokeninfoclass []
|
---|
155 | * tokeninfo []
|
---|
156 | * tokeninfolength []
|
---|
157 | * retlen []
|
---|
158 | *
|
---|
159 | */
|
---|
160 | BOOL WINAPI
|
---|
161 | GetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
|
---|
162 | LPVOID tokeninfo, DWORD tokeninfolength, LPDWORD retlen )
|
---|
163 | {
|
---|
164 | CallWin32ToNt (NtQueryInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength, retlen));
|
---|
165 | }
|
---|
166 |
|
---|
167 | /* ##############################
|
---|
168 | ###### SID FUNCTIONS ######
|
---|
169 | ##############################
|
---|
170 | */
|
---|
171 |
|
---|
172 | /******************************************************************************
|
---|
173 | * CopySid [ADVAPI32.24]
|
---|
174 | *
|
---|
175 | * PARAMS
|
---|
176 | * nDestinationSidLength []
|
---|
177 | * pDestinationSid []
|
---|
178 | * pSourceSid []
|
---|
179 | */
|
---|
180 | BOOL WINAPI
|
---|
181 | CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
|
---|
182 | {
|
---|
183 | CallWin32ToNt (RtlCopySid( nDestinationSidLength, pDestinationSid, pSourceSid));
|
---|
184 | }
|
---|
185 |
|
---|
186 | /******************************************************************************
|
---|
187 | * IsValidSid [ADVAPI32.80]
|
---|
188 | *
|
---|
189 | * PARAMS
|
---|
190 | * pSid []
|
---|
191 | */
|
---|
192 | BOOL WINAPI
|
---|
193 | IsValidSid( PSID pSid )
|
---|
194 | {
|
---|
195 | CallWin32ToNt (RtlValidSid( pSid));
|
---|
196 | }
|
---|
197 |
|
---|
198 | /******************************************************************************
|
---|
199 | * EqualSid [ADVAPI32.40]
|
---|
200 | *
|
---|
201 | * PARAMS
|
---|
202 | * pSid1 []
|
---|
203 | * pSid2 []
|
---|
204 | */
|
---|
205 | BOOL WINAPI
|
---|
206 | EqualSid( PSID pSid1, PSID pSid2 )
|
---|
207 | {
|
---|
208 | CallWin32ToNt (RtlEqualSid( pSid1, pSid2));
|
---|
209 | }
|
---|
210 |
|
---|
211 | /******************************************************************************
|
---|
212 | * EqualPrefixSid [ADVAPI32.39]
|
---|
213 | */
|
---|
214 | BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2)
|
---|
215 | {
|
---|
216 | CallWin32ToNt (RtlEqualPrefixSid( pSid1, pSid2));
|
---|
217 | }
|
---|
218 |
|
---|
219 | /******************************************************************************
|
---|
220 | * InitializeSid [ADVAPI32.74]
|
---|
221 | *
|
---|
222 | * PARAMS
|
---|
223 | * pIdentifierAuthority []
|
---|
224 | */
|
---|
225 | BOOL WINAPI
|
---|
226 | InitializeSid (PSID pSid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
|
---|
227 | BYTE nSubAuthorityCount)
|
---|
228 | {
|
---|
229 | CallWin32ToNt (RtlInitializeSid( pSid, pIdentifierAuthority, nSubAuthorityCount));
|
---|
230 | }
|
---|
231 |
|
---|
232 | /* ##############################################
|
---|
233 | ###### SECURITY DESCRIPTOR FUNCTIONS ######
|
---|
234 | ##############################################
|
---|
235 | */
|
---|
236 |
|
---|
237 | /******************************************************************************
|
---|
238 | * InitializeSecurityDescriptor [ADVAPI32.73]
|
---|
239 | *
|
---|
240 | * PARAMS
|
---|
241 | * pDescr []
|
---|
242 | * revision []
|
---|
243 | */
|
---|
244 | BOOL WINAPI
|
---|
245 | InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, DWORD revision )
|
---|
246 | {
|
---|
247 | CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision ));
|
---|
248 | }
|
---|
249 |
|
---|
250 | /******************************************************************************
|
---|
251 | * GetSecurityDescriptorLength [ADVAPI32.55]
|
---|
252 | */
|
---|
253 | DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr)
|
---|
254 | {
|
---|
255 | return (RtlLengthSecurityDescriptor(pDescr));
|
---|
256 | }
|
---|
257 |
|
---|
258 | /******************************************************************************
|
---|
259 | * GetSecurityDescriptorOwner [ADVAPI32.56]
|
---|
260 | *
|
---|
261 | * PARAMS
|
---|
262 | * pOwner []
|
---|
263 | * lpbOwnerDefaulted []
|
---|
264 | */
|
---|
265 | BOOL WINAPI
|
---|
266 | GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner,
|
---|
267 | LPBOOL lpbOwnerDefaulted )
|
---|
268 | {
|
---|
269 | CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted ));
|
---|
270 | }
|
---|
271 |
|
---|
272 | /******************************************************************************
|
---|
273 | * SetSecurityDescriptorOwner [ADVAPI32]
|
---|
274 | *
|
---|
275 | * PARAMS
|
---|
276 | */
|
---|
277 | BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
---|
278 | PSID pOwner, BOOL bOwnerDefaulted)
|
---|
279 | {
|
---|
280 | CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted));
|
---|
281 | }
|
---|
282 | /******************************************************************************
|
---|
283 | * GetSecurityDescriptorGroup [ADVAPI32.54]
|
---|
284 | */
|
---|
285 | BOOL WINAPI GetSecurityDescriptorGroup(
|
---|
286 | PSECURITY_DESCRIPTOR SecurityDescriptor,
|
---|
287 | PSID *Group,
|
---|
288 | LPBOOL GroupDefaulted)
|
---|
289 | {
|
---|
290 | CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted));
|
---|
291 | }
|
---|
292 | /******************************************************************************
|
---|
293 | * SetSecurityDescriptorGroup
|
---|
294 | */
|
---|
295 | BOOL WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor,
|
---|
296 | PSID Group, BOOL GroupDefaulted)
|
---|
297 | {
|
---|
298 | CallWin32ToNt (RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted));
|
---|
299 | }
|
---|
300 |
|
---|
301 | /******************************************************************************
|
---|
302 | * IsValidSecurityDescriptor [ADVAPI32.79]
|
---|
303 | *
|
---|
304 | * PARAMS
|
---|
305 | * lpsecdesc []
|
---|
306 | */
|
---|
307 | BOOL WINAPI
|
---|
308 | IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor )
|
---|
309 | {
|
---|
310 | CallWin32ToNt (RtlValidSecurityDescriptor(SecurityDescriptor));
|
---|
311 | }
|
---|
312 |
|
---|
313 | /******************************************************************************
|
---|
314 | * GetSecurityDescriptorDacl [ADVAPI.91]
|
---|
315 | */
|
---|
316 | BOOL WINAPI GetSecurityDescriptorDacl(
|
---|
317 | IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
---|
318 | OUT LPBOOL lpbDaclPresent,
|
---|
319 | OUT PACL *pDacl,
|
---|
320 | OUT LPBOOL lpbDaclDefaulted)
|
---|
321 | {
|
---|
322 | CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent,
|
---|
323 | pDacl, (PBOOLEAN)lpbDaclDefaulted));
|
---|
324 | }
|
---|
325 |
|
---|
326 | /******************************************************************************
|
---|
327 | * SetSecurityDescriptorDacl [ADVAPI.224]
|
---|
328 | */
|
---|
329 | BOOL WINAPI
|
---|
330 | SetSecurityDescriptorDacl (
|
---|
331 | PSECURITY_DESCRIPTOR lpsd,
|
---|
332 | BOOL daclpresent,
|
---|
333 | PACL dacl,
|
---|
334 | BOOL dacldefaulted )
|
---|
335 | {
|
---|
336 | CallWin32ToNt (RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted ));
|
---|
337 | }
|
---|
338 | /******************************************************************************
|
---|
339 | * GetSecurityDescriptorSacl [ADVAPI.]
|
---|
340 | */
|
---|
341 | BOOL WINAPI GetSecurityDescriptorSacl(
|
---|
342 | IN PSECURITY_DESCRIPTOR lpsd,
|
---|
343 | OUT LPBOOL lpbSaclPresent,
|
---|
344 | OUT PACL *pSacl,
|
---|
345 | OUT LPBOOL lpbSaclDefaulted)
|
---|
346 | {
|
---|
347 | CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd, (PBOOLEAN)lpbSaclPresent,
|
---|
348 | pSacl, (PBOOLEAN)lpbSaclDefaulted));
|
---|
349 | }
|
---|
350 |
|
---|
351 | /**************************************************************************
|
---|
352 | * SetSecurityDescriptorSacl [NTDLL.488]
|
---|
353 | */
|
---|
354 | BOOL WINAPI SetSecurityDescriptorSacl (
|
---|
355 | PSECURITY_DESCRIPTOR lpsd,
|
---|
356 | BOOL saclpresent,
|
---|
357 | PACL lpsacl,
|
---|
358 | BOOL sacldefaulted)
|
---|
359 | {
|
---|
360 | CallWin32ToNt (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted));
|
---|
361 | }
|
---|
362 | /******************************************************************************
|
---|
363 | * MakeSelfRelativeSD [ADVAPI32.95]
|
---|
364 | *
|
---|
365 | * PARAMS
|
---|
366 | * lpabssecdesc []
|
---|
367 | * lpselfsecdesc []
|
---|
368 | * lpbuflen []
|
---|
369 | */
|
---|
370 | BOOL WINAPI
|
---|
371 | MakeSelfRelativeSD( PSECURITY_DESCRIPTOR lpabssecdesc,
|
---|
372 | PSECURITY_DESCRIPTOR lpselfsecdesc, LPDWORD lpbuflen )
|
---|
373 | {
|
---|
374 | FIXME(__FUNCTION__"(%p,%p,%p),stub!\n",lpabssecdesc,lpselfsecdesc,lpbuflen);
|
---|
375 | return TRUE;
|
---|
376 | }
|
---|
377 |
|
---|
378 | /******************************************************************************
|
---|
379 | * GetSecurityDescriptorControl32 [ADVAPI32]
|
---|
380 | */
|
---|
381 |
|
---|
382 | BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
---|
383 | PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
|
---|
384 | { FIXME(__FUNCTION__"(%p,%p,%p),stub!\n",pSecurityDescriptor,pControl,lpdwRevision);
|
---|
385 | return 1;
|
---|
386 | }
|
---|
387 |
|
---|
388 | /* ##############################
|
---|
389 | ###### MISC FUNCTIONS ######
|
---|
390 | ##############################
|
---|
391 | */
|
---|
392 |
|
---|
393 | /******************************************************************************
|
---|
394 | * LookupPrivilegeValue32W [ADVAPI32.93]
|
---|
395 | * Retrieves LUID used on a system to represent the privilege name.
|
---|
396 | *
|
---|
397 | * NOTES
|
---|
398 | * lpLuid should be PLUID
|
---|
399 | *
|
---|
400 | * PARAMS
|
---|
401 | * lpSystemName [I] Address of string specifying the system
|
---|
402 | * lpName [I] Address of string specifying the privilege
|
---|
403 | * lpLuid [I] Address of locally unique identifier
|
---|
404 | *
|
---|
405 | * RETURNS STD
|
---|
406 | */
|
---|
407 | BOOL WINAPI
|
---|
408 | LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, LPVOID lpLuid )
|
---|
409 | {
|
---|
410 | FIXME(__FUNCTION__"(%s,%s,%p): stub\n",debugstr_w(lpSystemName),
|
---|
411 | debugstr_w(lpName), lpLuid);
|
---|
412 | return TRUE;
|
---|
413 | }
|
---|
414 |
|
---|
415 | /******************************************************************************
|
---|
416 | * LookupPrivilegeValue32A [ADVAPI32.92]
|
---|
417 | */
|
---|
418 | BOOL WINAPI
|
---|
419 | LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, LPVOID lpLuid )
|
---|
420 | {
|
---|
421 | dprintf(("LookupPrivilegeValueA %s %s %x NOT IMPLEMENTED", lpSystemName, lpName, lpLuid));
|
---|
422 | LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName);
|
---|
423 | LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName);
|
---|
424 | BOOL ret = LookupPrivilegeValueW( lpSystemNameW, lpNameW, lpLuid);
|
---|
425 | HeapFree(GetProcessHeap(), 0, lpNameW);
|
---|
426 | HeapFree(GetProcessHeap(), 0, lpSystemNameW);
|
---|
427 | return ret;
|
---|
428 | }
|
---|
429 |
|
---|
430 | /******************************************************************************
|
---|
431 | * GetFileSecurity32A [ADVAPI32.45]
|
---|
432 | *
|
---|
433 | * Obtains Specified information about the security of a file or directory
|
---|
434 | * The information obtained is constrained by the callers access rights and
|
---|
435 | * privileges
|
---|
436 | */
|
---|
437 | BOOL WINAPI
|
---|
438 | GetFileSecurityA( LPCSTR lpFileName,
|
---|
439 | SECURITY_INFORMATION RequestedInformation,
|
---|
440 | PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
---|
441 | DWORD nLength, LPDWORD lpnLengthNeeded )
|
---|
442 | {
|
---|
443 | FIXME(__FUNCTION__"(%s) : stub\n", debugstr_a(lpFileName));
|
---|
444 | return TRUE;
|
---|
445 | }
|
---|
446 |
|
---|
447 | /******************************************************************************
|
---|
448 | * GetFileSecurity32W [ADVAPI32.46]
|
---|
449 | *
|
---|
450 | * Obtains Specified information about the security of a file or directory
|
---|
451 | * The information obtained is constrained by the callers access rights and
|
---|
452 | * privileges
|
---|
453 | *
|
---|
454 | * PARAMS
|
---|
455 | * lpFileName []
|
---|
456 | * RequestedInformation []
|
---|
457 | * pSecurityDescriptor []
|
---|
458 | * nLength []
|
---|
459 | * lpnLengthNeeded []
|
---|
460 | */
|
---|
461 | BOOL WINAPI
|
---|
462 | GetFileSecurityW( LPCWSTR lpFileName,
|
---|
463 | SECURITY_INFORMATION RequestedInformation,
|
---|
464 | PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
---|
465 | DWORD nLength, LPDWORD lpnLengthNeeded )
|
---|
466 | {
|
---|
467 | FIXME(__FUNCTION__"(%s) : stub\n", debugstr_w(lpFileName) );
|
---|
468 | return TRUE;
|
---|
469 | }
|
---|
470 |
|
---|
471 | /******************************************************************************
|
---|
472 | * SetFileSecurity32A [ADVAPI32.182]
|
---|
473 | * Sets the security of a file or directory
|
---|
474 | */
|
---|
475 | BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
|
---|
476 | SECURITY_INFORMATION RequestedInformation,
|
---|
477 | PSECURITY_DESCRIPTOR pSecurityDescriptor)
|
---|
478 | {
|
---|
479 | FIXME(__FUNCTION__"(%s) : stub\n", debugstr_a(lpFileName));
|
---|
480 | return TRUE;
|
---|
481 | }
|
---|
482 |
|
---|
483 | /******************************************************************************
|
---|
484 | * SetFileSecurity32W [ADVAPI32.183]
|
---|
485 | * Sets the security of a file or directory
|
---|
486 | *
|
---|
487 | * PARAMS
|
---|
488 | * lpFileName []
|
---|
489 | * RequestedInformation []
|
---|
490 | * pSecurityDescriptor []
|
---|
491 | */
|
---|
492 | BOOL WINAPI
|
---|
493 | SetFileSecurityW( LPCWSTR lpFileName,
|
---|
494 | SECURITY_INFORMATION RequestedInformation,
|
---|
495 | PSECURITY_DESCRIPTOR pSecurityDescriptor )
|
---|
496 | {
|
---|
497 | FIXME(__FUNCTION__"(%s) : stub\n", debugstr_w(lpFileName) );
|
---|
498 | return TRUE;
|
---|
499 | }
|
---|
500 |
|
---|
501 | /******************************************************************************
|
---|
502 | * LookupAccountSid32A [ADVAPI32.86]
|
---|
503 | */
|
---|
504 | BOOL WINAPI
|
---|
505 | LookupAccountSidA(
|
---|
506 | IN LPCSTR system,
|
---|
507 | IN PSID sid,
|
---|
508 | OUT LPSTR account,
|
---|
509 | IN OUT LPDWORD accountSize,
|
---|
510 | OUT LPSTR domain,
|
---|
511 | IN OUT LPDWORD domainSize,
|
---|
512 | OUT PSID_NAME_USE name_use )
|
---|
513 | {
|
---|
514 | char * ac = "Administrator";
|
---|
515 | char * dm = "DOMAIN";
|
---|
516 | dprintf(("LookupAccountSidA(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub",
|
---|
517 | sid,
|
---|
518 | account,accountSize,accountSize?*accountSize:0,
|
---|
519 | domain,domainSize,domainSize?*domainSize:0,
|
---|
520 | name_use));
|
---|
521 |
|
---|
522 | if (accountSize) *accountSize = strlen(ac)+1;
|
---|
523 | if (account && (*accountSize > strlen(ac)))
|
---|
524 | strcpy(account, ac);
|
---|
525 |
|
---|
526 | if (domainSize) *domainSize = strlen(dm)+1;
|
---|
527 | if (domain && (*domainSize > strlen(dm)))
|
---|
528 | strcpy(domain,dm);
|
---|
529 |
|
---|
530 | if (name_use) *name_use = SidTypeUser;
|
---|
531 | return TRUE;
|
---|
532 | }
|
---|
533 |
|
---|
534 | /******************************************************************************
|
---|
535 | * LookupAccountSid32W [ADVAPI32.87]
|
---|
536 | *
|
---|
537 | * PARAMS
|
---|
538 | * system []
|
---|
539 | * sid []
|
---|
540 | * account []
|
---|
541 | * accountSize []
|
---|
542 | * domain []
|
---|
543 | * domainSize []
|
---|
544 | * name_use []
|
---|
545 | */
|
---|
546 | BOOL WINAPI
|
---|
547 | LookupAccountSidW(
|
---|
548 | IN LPCWSTR system,
|
---|
549 | IN PSID sid,
|
---|
550 | OUT LPWSTR account,
|
---|
551 | IN OUT LPDWORD accountSize,
|
---|
552 | OUT LPWSTR domain,
|
---|
553 | IN OUT LPDWORD domainSize,
|
---|
554 | OUT PSID_NAME_USE name_use )
|
---|
555 | {
|
---|
556 | char * ac = "Administrator";
|
---|
557 | char * dm = "DOMAIN";
|
---|
558 | dprintf(("LookupAccountSidW(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub",
|
---|
559 | sid,
|
---|
560 | account,accountSize,accountSize?*accountSize:0,
|
---|
561 | domain,domainSize,domainSize?*domainSize:0,
|
---|
562 | name_use));
|
---|
563 |
|
---|
564 | if (accountSize) *accountSize = strlen(ac)+1;
|
---|
565 | if (account && (*accountSize > strlen(ac)))
|
---|
566 | lstrcpyAtoW(account, ac);
|
---|
567 |
|
---|
568 | if (domainSize) *domainSize = strlen(dm)+1;
|
---|
569 | if (domain && (*domainSize > strlen(dm)))
|
---|
570 | lstrcpyAtoW(domain,dm);
|
---|
571 |
|
---|
572 | if (name_use) *name_use = SidTypeUser;
|
---|
573 | return TRUE;
|
---|
574 | }
|
---|
575 |
|
---|
576 | /******************************************************************************
|
---|
577 | * QueryWindows31FilesMigration [ADVAPI32.266]
|
---|
578 | *
|
---|
579 | * PARAMS
|
---|
580 | * x1 []
|
---|
581 | */
|
---|
582 | BOOL WINAPI
|
---|
583 | QueryWindows31FilesMigration( DWORD x1 )
|
---|
584 | {
|
---|
585 | FIXME(__FUNCTION__"(%ld):stub\n",x1);
|
---|
586 | return TRUE;
|
---|
587 | }
|
---|
588 |
|
---|
589 | /******************************************************************************
|
---|
590 | * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.265]
|
---|
591 | *
|
---|
592 | * PARAMS
|
---|
593 | * x1 []
|
---|
594 | * x2 []
|
---|
595 | * x3 []
|
---|
596 | * x4 []
|
---|
597 | */
|
---|
598 | BOOL WINAPI
|
---|
599 | SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
|
---|
600 | DWORD x4 )
|
---|
601 | {
|
---|
602 | FIXME(__FUNCTION__"(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
|
---|
603 | return TRUE;
|
---|
604 | }
|
---|
605 |
|
---|
606 | /******************************************************************************
|
---|
607 | * LsaOpenPolicy [ADVAPI32.200]
|
---|
608 | *
|
---|
609 | * PARAMS
|
---|
610 | * x1 []
|
---|
611 | * x2 []
|
---|
612 | * x3 []
|
---|
613 | * x4 []
|
---|
614 | */
|
---|
615 | NTSTATUS WINAPI
|
---|
616 | LsaOpenPolicy(PLSA_UNICODE_STRING SystemName,
|
---|
617 | PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
|
---|
618 | ACCESS_MASK DesiredAccess,
|
---|
619 | PLSA_HANDLE PolicyHandle)
|
---|
620 | {
|
---|
621 | FIXME(__FUNCTION__"(%p,%p,0x%08lx,%p):stub\n",
|
---|
622 | SystemName, ObjectAttributes,
|
---|
623 | DesiredAccess, PolicyHandle);
|
---|
624 | return 0xc0000000; /* generic error */
|
---|
625 | }
|
---|
626 |
|
---|
627 | /******************************************************************************
|
---|
628 | * NotifyBootConfigStatus [ADVAPI32.97]
|
---|
629 | *
|
---|
630 | * PARAMS
|
---|
631 | * x1 []
|
---|
632 | */
|
---|
633 | BOOL WINAPI
|
---|
634 | NotifyBootConfigStatus( DWORD x1 )
|
---|
635 | {
|
---|
636 | FIXME(__FUNCTION__"(0x%08lx):stub\n",x1);
|
---|
637 | return 1;
|
---|
638 | }
|
---|
639 |
|
---|
640 | /******************************************************************************
|
---|
641 | * RevertToSelf [ADVAPI32.180]
|
---|
642 | *
|
---|
643 | * PARAMS
|
---|
644 | * void []
|
---|
645 | */
|
---|
646 | BOOL WINAPI
|
---|
647 | RevertToSelf( void )
|
---|
648 | {
|
---|
649 | FIXME(__FUNCTION__"(), stub\n");
|
---|
650 | return TRUE;
|
---|
651 | }
|
---|
652 |
|
---|
653 | /******************************************************************************
|
---|
654 | * ImpersonateSelf [ADVAPI32.71]
|
---|
655 | */
|
---|
656 | BOOL WINAPI
|
---|
657 | ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
|
---|
658 | {
|
---|
659 | FIXME(__FUNCTION__"(%08x), stub\n", ImpersonationLevel);
|
---|
660 | return TRUE;
|
---|
661 | }
|
---|
662 |
|
---|
663 | /******************************************************************************
|
---|
664 | * AccessCheck32 [ADVAPI32.71]
|
---|
665 | */
|
---|
666 | BOOL WINAPI
|
---|
667 | AccessCheck(PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken,
|
---|
668 | DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet,
|
---|
669 | LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus)
|
---|
670 | {
|
---|
671 | FIXME(__FUNCTION__"(%p, %04x, %08lx, %p, %p, %p, %p, %p), stub\n",
|
---|
672 | pSecurityDescriptor, ClientToken, DesiredAccess, GenericMapping,
|
---|
673 | PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus);
|
---|
674 | *AccessStatus = TRUE;
|
---|
675 | return TRUE;
|
---|
676 | }
|
---|
677 |
|
---|
678 | /*****************************************************************************
|
---|
679 | * Name : InitializeAcl
|
---|
680 | * Purpose : The InitializeAcl function creates a new ACL structure.
|
---|
681 | * An ACL is an access-control list.
|
---|
682 | * Parameters: PACL pAcl address of access-control list
|
---|
683 | * DWORD nAclLength size of access-control list
|
---|
684 | * DWORD dwAclRevision revision level of access-control list
|
---|
685 | * Variables :
|
---|
686 | * Result :
|
---|
687 | * Remark :
|
---|
688 | * Status : UNTESTED STUB
|
---|
689 | *
|
---|
690 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
691 | *****************************************************************************/
|
---|
692 |
|
---|
693 | BOOL WIN32API InitializeAcl(PACL pAcl,
|
---|
694 | DWORD nAclLength,
|
---|
695 | DWORD dwAclRevision)
|
---|
696 | {
|
---|
697 | dprintf(("ADVAPI32: InitializeAcl(%08xh,%08xh,%08xh)",
|
---|
698 | pAcl,
|
---|
699 | nAclLength,
|
---|
700 | dwAclRevision));
|
---|
701 |
|
---|
702 | CallWin32ToNt (RtlCreateAcl(pAcl, nAclLength, dwAclRevision));
|
---|
703 | }
|
---|