diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2007-08-20 12:35:49 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2007-08-20 12:35:49 +0000 |
commit | ce20f07029422077bd7182e3918ceee64a255ae6 (patch) | |
tree | 459b15509416ebb124d79dd5166db756c7c8c83b /sal/osl/w32 | |
parent | 7e4ddfeff4d60374a57385a753268acfa3dd9017 (diff) |
INTEGRATION: CWS hro23_SRC680 (1.12.8); FILE MERGED
2007/08/16 09:51:27 hro 1.12.8.1: #71342# Currently there is a problem with patching/replacing UWINAPI on WinME. So we do not export CheckTokenMembership to stay compatible
Diffstat (limited to 'sal/osl/w32')
-rw-r--r-- | sal/osl/w32/security.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/sal/osl/w32/security.c b/sal/osl/w32/security.c index 6fb0ac572d23..9265b447f036 100644 --- a/sal/osl/w32/security.c +++ b/sal/osl/w32/security.c @@ -4,9 +4,9 @@ * * $RCSfile: security.c,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: rt $ $Date: 2007-07-26 08:50:26 $ + * last change: $Author: ihi $ $Date: 2007-08-20 13:35:49 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -227,6 +227,33 @@ oslSecurityError SAL_CALL osl_loginUserOnFileServer(rtl_uString *strUserName, } +static BOOL WINAPI CheckTokenMembership_Stub( HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember ) +{ + typedef BOOL (WINAPI *CheckTokenMembership_PROC)( HANDLE, PSID, PBOOL ); + + static HMODULE hModule = NULL; + static CheckTokenMembership_PROC pCheckTokenMembership = NULL; + + if ( !hModule ) + { + /* SAL is always linked against ADVAPI32 so we can rely on that it is already mapped */ + + hModule = GetModuleHandleA( "ADVAPI32.DLL" ); + + pCheckTokenMembership = (CheckTokenMembership_PROC)GetProcAddress( hModule, "CheckTokenMembership" ); + } + + if ( pCheckTokenMembership ) + return pCheckTokenMembership( TokenHandle, SidToCheck, IsMember ); + else + { + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return FALSE; + } + +} + + sal_Bool SAL_CALL osl_isAdministrator(oslSecurity Security) { if (Security != NULL) @@ -270,7 +297,7 @@ sal_Bool SAL_CALL osl_isAdministrator(oslSecurity Security) { BOOL fSuccess = FALSE; - if ( CheckTokenMembership( hImpersonationToken, psidAdministrators, &fSuccess ) && fSuccess ) + if ( CheckTokenMembership_Stub( hImpersonationToken, psidAdministrators, &fSuccess ) && fSuccess ) bSuccess = sal_True; FreeSid(psidAdministrators); |