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