| 1 | /* $Id: security_odin.cpp,v 1.1 2002-02-21 22:52:01 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 | 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 |  | 
|---|
| 69 | /***************************************************************************** | 
|---|
| 70 | * Name      : AddAce | 
|---|
| 71 | * Purpose   : The AddAce function adds one or more ACEs to a specified ACL. | 
|---|
| 72 | *             An ACE is an access-control entry. An ACL is an access-control list. | 
|---|
| 73 | * Parameters: PACL   pAcl               address of access-control list | 
|---|
| 74 | *             DWORD  dwAceRevision      ACL revision level | 
|---|
| 75 | *             DWORD  dwStartingAceIndex index of ACE position in ACL | 
|---|
| 76 | *             LPVOID pAceList           address of one or more ACEs | 
|---|
| 77 | *             DWORD  nAceListLength     size of buffer for ACEs | 
|---|
| 78 | * Variables : | 
|---|
| 79 | * Result    : | 
|---|
| 80 | * Remark    : | 
|---|
| 81 | * Status    : UNTESTED STUB | 
|---|
| 82 | * | 
|---|
| 83 | * Author    : Patrick Haller [Tue, 1998/06/16 23:00] | 
|---|
| 84 | *****************************************************************************/ | 
|---|
| 85 |  | 
|---|
| 86 | BOOL WIN32API AddAce(PACL   pAcl, | 
|---|
| 87 | DWORD  dwAceRevision, | 
|---|
| 88 | DWORD  dwStartingAceIndex, | 
|---|
| 89 | LPVOID pAceList, | 
|---|
| 90 | DWORD  nAceListLength) | 
|---|
| 91 | { | 
|---|
| 92 | CallWin32ToNt (RtlAddAce(pAcl, dwAceRevision, dwStartingAceIndex, (PACE_HEADER)pAceList, nAceListLength)); | 
|---|
| 93 | } | 
|---|
| 94 |  | 
|---|
| 95 |  | 
|---|