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