ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
October 2006
----- 2024 -----
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
357 discussions
Start a n
N
ew thread
[hpoussin] 24493: Read object security descriptors from .inf file. Apply them for registry keys and services and display a message for files
by hpoussin@svn.reactos.org
Author: hpoussin Date: Thu Oct 12 13:01:16 2006 New Revision: 24493 URL:
http://svn.reactos.org/svn/reactos?rev=24493&view=rev
Log: Read object security descriptors from .inf file. Apply them for registry keys and services and display a message for files Modified: trunk/reactos/dll/win32/setupapi/devinst.c trunk/reactos/dll/win32/setupapi/install.c trunk/reactos/dll/win32/setupapi/queue.c trunk/reactos/dll/win32/setupapi/setupapi_private.h Modified: trunk/reactos/dll/win32/setupapi/devinst.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/devinst…
============================================================================== --- trunk/reactos/dll/win32/setupapi/devinst.c (original) +++ trunk/reactos/dll/win32/setupapi/devinst.c Thu Oct 12 13:01:16 2006 @@ -2270,8 +2270,8 @@ SetLastError(ERROR_NOT_ENOUGH_MEMORY); goto cleanup; } - strcpyW(DriverKey, L"{"); - strcatW(DriverKey, lpGuidString); + DriverKey[0] = '{'; + strcpyW(&DriverKey[1], lpGuidString); strcatW(DriverKey, L"}\\"); pDeviceInstance = &DriverKey[strlenW(DriverKey)]; rc = RegOpenKeyExW(RootKey, Modified: trunk/reactos/dll/win32/setupapi/install.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/install…
============================================================================== --- trunk/reactos/dll/win32/setupapi/install.c (original) +++ trunk/reactos/dll/win32/setupapi/install.c Thu Oct 12 13:01:16 2006 @@ -89,6 +89,7 @@ static const WCHAR ProfileItems[] = {'P','r','o','f','i','l','e','I','t','e','m','s',0}; static const WCHAR Include[] = {'I','n','c','l','u','d','e',0}; static const WCHAR Needs[] = {'N','e','e','d','s',0}; +static const WCHAR DotSecurity[] = {'.','S','e','c','u','r','i','t','y',0}; /*********************************************************************** @@ -386,12 +387,49 @@ static BOOL registry_callback( HINF hinf, PCWSTR field, void *arg ) { struct registry_callback_info *info = arg; - INFCONTEXT context; + LPWSTR security_key, security_descriptor; + INFCONTEXT context, security_context; + PSECURITY_DESCRIPTOR sd = NULL; + SECURITY_ATTRIBUTES security_attributes = { 0, }; HKEY root_key, hkey; + DWORD required; BOOL ok = SetupFindFirstLineW( hinf, field, NULL, &context ); - - for (; ok; ok = SetupFindNextLine( &context, &context )) + if (!ok) + return TRUE; + + /* Check for .Security section */ + security_key = MyMalloc( (strlenW( field ) + strlenW( DotSecurity )) * sizeof(WCHAR) + sizeof(UNICODE_NULL) ); + if (!security_key) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + strcpyW( security_key, field ); + strcatW( security_key, DotSecurity ); + ok = SetupFindFirstLineW( hinf, security_key, NULL, &security_context ); + MyFree(security_key); + if (ok) + { + if (!SetupGetLineText( &security_context, NULL, NULL, NULL, NULL, 0, &required )) + return FALSE; + security_descriptor = MyMalloc( required * sizeof(WCHAR) ); + if (!security_descriptor) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + if (!SetupGetLineText( &security_context, NULL, NULL, NULL, security_descriptor, required, NULL )) + return FALSE; + ok = ConvertStringSecurityDescriptorToSecurityDescriptorW( security_descriptor, SDDL_REVISION_1, &sd, NULL ); + MyFree( security_descriptor ); + if (!ok) + return FALSE; + security_attributes.nLength = sizeof(SECURITY_ATTRIBUTES); + security_attributes.lpSecurityDescriptor = sd; + } + + for (ok = TRUE; ok; ok = SetupFindNextLine( &context, &context )) { WCHAR buffer[MAX_INF_STRING_LENGTH]; INT flags; @@ -423,7 +461,8 @@ { if (RegOpenKeyW( root_key, buffer, &hkey )) continue; /* ignore if it doesn't exist */ } - else if (RegCreateKeyW( root_key, buffer, &hkey )) + else if (RegCreateKeyExW( root_key, buffer, 0, NULL, 0, MAXIMUM_ALLOWED, + sd ? &security_attributes : NULL, &hkey, NULL )) { ERR( "could not create key %p %s\n", root_key, debugstr_w(buffer) ); continue; @@ -438,10 +477,12 @@ if (!do_reg_operation( hkey, buffer, &context, flags )) { if (hkey != root_key) RegCloseKey( hkey ); + if (sd) LocalFree( sd ); return FALSE; } if (hkey != root_key) RegCloseKey( hkey ); } + if (sd) LocalFree( sd ); return TRUE; } @@ -1274,6 +1315,8 @@ LPWSTR DisplayName = NULL; LPWSTR Description = NULL; LPWSTR Dependencies = NULL; + LPWSTR SecurityDescriptor = NULL; + PSECURITY_DESCRIPTOR sd = NULL; INT ServiceType, StartType, ErrorControl; DWORD dwRegType; DWORD tagId = (DWORD)-1; @@ -1304,7 +1347,7 @@ hService = OpenServiceW( hSCManager, ServiceName, - GENERIC_READ | GENERIC_WRITE); + DELETE | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | WRITE_DAC); if (hService == NULL && GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST) goto cleanup; @@ -1322,7 +1365,7 @@ hSCManager, ServiceName, DisplayName, - 0, + WRITE_DAC, ServiceType, StartType, ErrorControl, @@ -1365,6 +1408,17 @@ (ServiceFlags & SPSVCINST_NOCLOBBER_DEPENDENCIES && ServiceConfig->lpDependencies) ? NULL : Dependencies, NULL, NULL, (ServiceFlags & SPSVCINST_NOCLOBBER_DISPLAYNAME && ServiceConfig->lpDisplayName) ? NULL : DisplayName); + if (!ret) + goto cleanup; + } + + /* Set security */ + if (GetLineText(hInf, ServiceSection, L"Security", &SecurityDescriptor)) + { + ret = ConvertStringSecurityDescriptorToSecurityDescriptorW(SecurityDescriptor, SDDL_REVISION_1, &sd, NULL); + if (!ret) + goto cleanup; + ret = SetServiceObjectSecurity(hService, DACL_SECURITY_INFORMATION, sd); if (!ret) goto cleanup; } @@ -1462,12 +1516,15 @@ CloseServiceHandle(hService); if (hGroupOrderListKey != NULL) RegCloseKey(hGroupOrderListKey); + if (sd != NULL) + LocalFree(sd); MyFree(ServiceConfig); MyFree(ServiceBinary); MyFree(LoadOrderGroup); MyFree(DisplayName); MyFree(Description); MyFree(Dependencies); + MyFree(SecurityDescriptor); MyFree(GroupOrder); TRACE("Returning %d\n", ret); Modified: trunk/reactos/dll/win32/setupapi/queue.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/queue.c…
============================================================================== --- trunk/reactos/dll/win32/setupapi/queue.c (original) +++ trunk/reactos/dll/win32/setupapi/queue.c Thu Oct 12 13:01:16 2006 @@ -22,6 +22,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi); +/* Unicode constants */ +static const WCHAR DotSecurity[] = {'.','S','e','c','u','r','i','t','y',0}; + /* context structure for the default queue callback */ struct default_callback_context { @@ -313,6 +316,7 @@ } if (!op->src_path && !(op->style & SP_COPY_SOURCE_ABSOLUTE)) { + len = len2 = 0; if (!(op->style & SP_COPY_SOURCEPATH_ABSOLUTE)) { /* retrieve relative path for this disk */ @@ -331,7 +335,7 @@ ptr = op->src_path + strlenW(op->src_path); if (len2 && ptr > op->src_path && ptr[-1] != '\\') *ptr++ = '\\'; } - if (!SetupGetStringFieldW( &disk_ctx, 4, ptr, len2, NULL )) *ptr = 0; + if (!SetupGetStringFieldW( &file_ctx, 2, ptr, len2, NULL )) *ptr = 0; } } if (!op->src_root) op->src_root = PARSER_get_src_root(hinf); @@ -486,6 +490,8 @@ op->src_tag = strdupW( params->SourceTagfile ); op->dst_path = strdupW( params->TargetDirectory ); op->dst_file = strdupW( params->TargetFilename ); + if (params->SecurityDescriptor) + FIXME( "Need to apply %s to %s\n", debugstr_w( params->SecurityDescriptor ), debugstr_w( op->dst_file )); /* some defaults */ if (!op->src_file) op->src_file = op->dst_file; @@ -731,12 +737,43 @@ PCWSTR section, DWORD style ) { SP_FILE_COPY_PARAMS_W params; - INFCONTEXT context; + LPWSTR security_key, security_descriptor = NULL; + INFCONTEXT context, security_context; WCHAR dest[MAX_PATH], src[MAX_PATH]; INT flags; + DWORD required; + BOOL ret; TRACE( "hinf=%p/%p section=%s root=%s\n", hinf, hlist, debugstr_w(section), debugstr_w(src_root) ); + + /* Check for .Security section */ + security_key = MyMalloc( (strlenW( section ) + strlenW( DotSecurity )) * sizeof(WCHAR) + sizeof(UNICODE_NULL) ); + if (!security_key) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + strcpyW( security_key, section ); + strcatW( security_key, DotSecurity ); + ret = SetupFindFirstLineW( hinf, security_key, NULL, &security_context ); + MyFree(security_key); + if (ret) + { + if (!SetupGetLineText( &security_context, NULL, NULL, NULL, NULL, 0, &required )) + return FALSE; + security_descriptor = MyMalloc( required * sizeof(WCHAR) ); + if (!security_descriptor) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + if (!SetupGetLineText( &security_context, NULL, NULL, NULL, security_descriptor, required, NULL )) + { + MyFree( security_descriptor ); + return FALSE; + } + } params.cbSize = sizeof(params); params.QueueHandle = queue; @@ -747,23 +784,29 @@ params.TargetFilename = dest; params.CopyStyle = style; params.LayoutInf = hinf; - params.SecurityDescriptor = NULL; - + params.SecurityDescriptor = security_descriptor; + + ret = FALSE; if (!hlist) hlist = hinf; if (!hinf) hinf = hlist; - if (!SetupFindFirstLineW( hlist, section, NULL, &context )) return FALSE; - if (!(params.TargetDirectory = get_destination_dir( hinf, section ))) return FALSE; + if (!SetupFindFirstLineW( hlist, section, NULL, &context )) goto done; + if (!(params.TargetDirectory = get_destination_dir( hinf, section ))) goto done; do { if (!SetupGetStringFieldW( &context, 1, dest, sizeof(dest)/sizeof(WCHAR), NULL )) - return FALSE; + goto done; if (!SetupGetStringFieldW( &context, 2, src, sizeof(src)/sizeof(WCHAR), NULL )) *src = 0; if (!SetupGetIntField( &context, 4, &flags )) flags = 0; /* FIXME */ params.SourceFilename = *src ? src : NULL; - if (!SetupQueueCopyIndirectW( ¶ms )) return FALSE; + if (!SetupQueueCopyIndirectW( ¶ms )) goto done; } while (SetupFindNextLine( &context, &context )); - return TRUE; + ret = TRUE; + +done: + if (security_descriptor) + MyFree( security_descriptor ); + return ret; } Modified: trunk/reactos/dll/win32/setupapi/setupapi_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupap…
============================================================================== --- trunk/reactos/dll/win32/setupapi/setupapi_private.h (original) +++ trunk/reactos/dll/win32/setupapi/setupapi_private.h Thu Oct 12 13:01:16 2006 @@ -32,6 +32,7 @@ #include <cfgmgr32.h> #include <fdi.h> #include <regstr.h> +#include <sddl.h> #include <setupapi.h> #include <shlobj.h> #include <wine/debug.h>
17 years, 11 months
1
0
0
0
[hpoussin] 24492: Better stubs for RpcImpersonateClient and RpcRevertToSelf (taken from Wine)
by hpoussin@svn.reactos.org
Author: hpoussin Date: Thu Oct 12 12:57:21 2006 New Revision: 24492 URL:
http://svn.reactos.org/svn/reactos?rev=24492&view=rev
Log: Better stubs for RpcImpersonateClient and RpcRevertToSelf (taken from Wine) Modified: trunk/reactos/dll/win32/rpcrt4/rpc_binding.c trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec Modified: trunk/reactos/dll/win32/rpcrt4/rpc_binding.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_bindi…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_binding.c (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_binding.c Thu Oct 12 12:57:21 2006 @@ -1163,6 +1163,7 @@ RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle) { FIXME("(%p): stub\n", BindingHandle); + ImpersonateSelf(SecurityImpersonation); return RPC_S_OK; } @@ -1189,3 +1190,13 @@ FIXME("(%p): stub\n", BindingHandle); return RPC_S_OK; } + +/*********************************************************************** + * RpcRevertToSelf (RPCRT4.@) + */ +RPC_STATUS WINAPI RpcRevertToSelf(void) +{ + FIXME("stub\n"); + RevertToSelf(); + return RPC_S_OK; +} Modified: trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpcrt4.sp…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec (original) +++ trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec Thu Oct 12 12:57:21 2006 @@ -458,7 +458,7 @@ @ stub RpcProtseqVectorFreeW @ stdcall RpcRaiseException(long) @ stub RpcRegisterAsyncInfo -@ stub RpcRevertToSelf +@ stdcall RpcRevertToSelf() @ stdcall RpcRevertToSelfEx(ptr) @ stdcall RpcServerInqBindings(ptr) @ stub RpcServerInqCallAttributesA # wxp
17 years, 11 months
1
0
0
0
[hpoussin] 24491: Send right security descriptor to InitializeObjectAttributes, so ntoskrnl won't fail The code was working because we never tried to call RegCreateKeyEx with a security descriptor...
by hpoussin@svn.reactos.org
Author: hpoussin Date: Thu Oct 12 03:11:59 2006 New Revision: 24491 URL:
http://svn.reactos.org/svn/reactos?rev=24491&view=rev
Log: Send right security descriptor to InitializeObjectAttributes, so ntoskrnl won't fail The code was working because we never tried to call RegCreateKeyEx with a security descriptor... Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
============================================================================== --- trunk/reactos/dll/win32/advapi32/reg/reg.c (original) +++ trunk/reactos/dll/win32/advapi32/reg/reg.c Thu Oct 12 03:11:59 2006 @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/advapi32/reg/reg.c @@ -981,6 +980,9 @@ TRACE("RegCreateKeyExA() called\n"); + if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES)) + return ERROR_INVALID_USER_BUFFER; + /* get the real parent key */ Status = MapDefaultKey (&ParentKey, hKey); @@ -1002,7 +1004,7 @@ &SubKeyString, OBJ_CASE_INSENSITIVE, (HANDLE)ParentKey, - (PSECURITY_DESCRIPTOR)lpSecurityAttributes); + lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL); Status = CreateNestedKey(phkResult, &Attributes, (lpClass == NULL)? NULL : &ClassString, @@ -1051,6 +1053,9 @@ TRACE("RegCreateKeyExW() called\n"); + if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES)) + return ERROR_INVALID_USER_BUFFER; + /* get the real parent key */ Status = MapDefaultKey (&ParentKey, hKey); @@ -1068,7 +1073,7 @@ &SubKeyString, OBJ_CASE_INSENSITIVE, (HANDLE)ParentKey, - (PSECURITY_DESCRIPTOR)lpSecurityAttributes); + lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL); Status = CreateNestedKey(phkResult, &Attributes, (lpClass == NULL)? NULL : &ClassString,
17 years, 11 months
1
0
0
0
[hpoussin] 24490: Replace incomplete and broken implementations of ConvertStringSecurityDescriptorToSecurityDescriptorW and ConvertStringSidToSidW by new ones
by hpoussin@svn.reactos.org
Author: hpoussin Date: Thu Oct 12 02:14:05 2006 New Revision: 24490 URL:
http://svn.reactos.org/svn/reactos?rev=24490&view=rev
Log: Replace incomplete and broken implementations of ConvertStringSecurityDescriptorToSecurityDescriptorW and ConvertStringSidToSidW by new ones Modified: trunk/reactos/dll/win32/advapi32/advapi32.rbuild trunk/reactos/dll/win32/advapi32/sec/ac.c trunk/reactos/dll/win32/advapi32/sec/misc.c trunk/reactos/dll/win32/advapi32/sec/sid.c Modified: trunk/reactos/dll/win32/advapi32/advapi32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/advapi3…
============================================================================== --- trunk/reactos/dll/win32/advapi32/advapi32.rbuild (original) +++ trunk/reactos/dll/win32/advapi32/advapi32.rbuild Thu Oct 12 02:14:05 2006 @@ -7,6 +7,8 @@ <define name="WINVER">0x600</define> <define name="_WIN32_IE">0x0500</define> <define name="_WIN32_WINNT">0x0600</define> + <define name="UNICODE"></define> + <define name="_UNICODE"></define> <library>scm_client</library> <library>lsa_client</library> <library>ntdll</library> Modified: trunk/reactos/dll/win32/advapi32/sec/ac.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/ac.…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/ac.c (original) +++ trunk/reactos/dll/win32/advapi32/sec/ac.c Thu Oct 12 02:14:05 2006 @@ -536,7 +536,7 @@ PACL pAcl, PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL, PGENERIC_MAPPING pGenericMapping, - PINHERITED_FROM pInheritArray + PINHERITED_FROMA pInheritArray ) { /* That's all this function does, at least up to w2k3... Even MS was too @@ -609,14 +609,14 @@ //ASSERT(sizeof(TRUSTEE_W) == sizeof(TRUSTEE_A)); - TrusteeForm = GetTrusteeForm(pTrusteeA); + TrusteeForm = GetTrusteeFormA(pTrusteeA); switch (TrusteeForm) { case TRUSTEE_IS_NAME: { /* directly copy the array, this works as the size of the EXPLICIT_ACCESS_A structure matches the size of the EXPLICIT_ACCESS_W version */ - lpStr = GetTrusteeName(pTrusteeA); + lpStr = GetTrusteeNameA(pTrusteeA); if (lpStr != NULL) BufferSize = strlen(lpStr) + 1; @@ -800,7 +800,7 @@ Size = cCountOfExplicitEntries * sizeof(EXPLICIT_ACCESS_W); for (i = 0; i != cCountOfExplicitEntries; i++) { - TrusteeForm = GetTrusteeForm(&pListOfExplicitEntriesA[i].Trustee); + TrusteeForm = GetTrusteeFormA(&pListOfExplicitEntriesA[i].Trustee); switch (TrusteeForm) { @@ -852,7 +852,7 @@ peaw[i].grfInheritance = pListOfExplicitEntriesA[i].grfInheritance; /* convert or copy the TRUSTEE structure */ - TrusteeForm = GetTrusteeForm(&pListOfExplicitEntriesA[i].Trustee); + TrusteeForm = GetTrusteeFormA(&pListOfExplicitEntriesA[i].Trustee); switch (TrusteeForm) { case TRUSTEE_IS_NAME: Modified: trunk/reactos/dll/win32/advapi32/sec/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/mis…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/misc.c (original) +++ trunk/reactos/dll/win32/advapi32/sec/misc.c Thu Oct 12 02:14:05 2006 @@ -916,7 +916,7 @@ { *pdwAccountName = dwSrcLen; RtlCopyMemory ( pAccountName, TranslatedName->Name.Buffer, TranslatedName->Name.Length ); - pAccountName[TranslatedName->Name.Length / sizeof(WCHAR)] = L'\0'; + pAccountName[TranslatedName->Name.Length / sizeof(WCHAR)] = L'\0'; } if ( peUse ) *peUse = TranslatedName->Use; @@ -936,7 +936,7 @@ { *pdwDomainName = dwSrcLen; RtlCopyMemory ( pDomainName, ReferencedDomain->Domains[0].Name.Buffer, ReferencedDomain->Domains[0].Name.Length ); - pDomainName[ReferencedDomain->Domains[0].Name.Length / sizeof(WCHAR)] = L'\0'; + pDomainName[ReferencedDomain->Domains[0].Name.Length / sizeof(WCHAR)] = L'\0'; } } } @@ -1960,7 +1960,7 @@ NULL, NULL); - pifnProgressData->fnProgress(pObjectNameA, + pifnProgressData->fnProgress((LPWSTR)pObjectNameA, /* FIXME: wrong cast!! */ Status, pInvokeSetting, pifnProgressData->Args, Modified: trunk/reactos/dll/win32/advapi32/sec/sid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/sid…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/sid.c (original) +++ trunk/reactos/dll/win32/advapi32/sec/sid.c Thu Oct 12 02:14:05 2006 @@ -1,9 +1,9 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * WINE COPYRIGHT: * Copyright 1999, 2000 Juergen Schmied <juergen.schmied(a)debitel.net> * Copyright 2003 CodeWeavers Inc. (Ulrich Czekalla) + * Copyright 2006 Hervé Poussineau * * PROJECT: ReactOS system libraries * FILE: lib/advapi32/sec/sid.c @@ -11,25 +11,20 @@ */ #include <advapi32.h> +#include <sddl.h> #include <wine/debug.h> #include <wine/unicode.h> WINE_DEFAULT_DEBUG_CHANNEL(advapi); - -static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes); -static BOOL ParseStringAclToAcl(LPCWSTR StringAcl, LPDWORD lpdwFlags, - PACL pAcl, LPDWORD cBytes); -static BYTE ParseAceStringFlags(LPCWSTR* StringAcl); -static BYTE ParseAceStringType(LPCWSTR* StringAcl); -static DWORD ParseAceStringRights(LPCWSTR* StringAcl); -static DWORD ParseAclStringFlags(LPCWSTR* StringAcl); - -typedef struct _ACEFLAG -{ - LPCWSTR wstr; - DWORD value; -} ACEFLAG, *LPACEFLAG; +#define MAX_GUID_STRING_LEN 39 + +typedef struct RECORD +{ + LPCWSTR key; + DWORD value; +} RECORD; + typedef struct _MAX_SID { @@ -91,18 +86,6 @@ static const SID sidWorld = { SID_REVISION, 1, { SECURITY_WORLD_SID_AUTHORITY} , { SECURITY_WORLD_RID } }; /* - * ACE access rights - */ -static const WCHAR SDDL_READ_CONTROL[] = {'R','C',0}; -static const WCHAR SDDL_WRITE_DAC[] = {'W','D',0}; -static const WCHAR SDDL_WRITE_OWNER[] = {'W','O',0}; -static const WCHAR SDDL_STANDARD_DELETE[] = {'S','D',0}; -static const WCHAR SDDL_GENERIC_ALL[] = {'G','A',0}; -static const WCHAR SDDL_GENERIC_READ[] = {'G','R',0}; -static const WCHAR SDDL_GENERIC_WRITE[] = {'G','W',0}; -static const WCHAR SDDL_GENERIC_EXECUTE[] = {'G','X',0}; - -/* * ACE types */ static const WCHAR SDDL_ACCESS_ALLOWED[] = {'A',0}; @@ -113,6 +96,19 @@ static const WCHAR SDDL_ALARM[] = {'A','L',0}; static const WCHAR SDDL_OBJECT_AUDIT[] = {'O','U',0}; static const WCHAR SDDL_OBJECT_ALARM[] = {'O','L',0}; + +/* + * SDDL ADS Rights + */ +#define ADS_RIGHT_DS_CREATE_CHILD 0x0001 +#define ADS_RIGHT_DS_DELETE_CHILD 0x0002 +#define ADS_RIGHT_ACTRL_DS_LIST 0x0004 +#define ADS_RIGHT_DS_SELF 0x0008 +#define ADS_RIGHT_DS_READ_PROP 0x0010 +#define ADS_RIGHT_DS_WRITE_PROP 0x0020 +#define ADS_RIGHT_DS_DELETE_TREE 0x0040 +#define ADS_RIGHT_DS_LIST_OBJECT 0x0080 +#define ADS_RIGHT_DS_CONTROL_ACCESS 0x0100 /* * ACE flags @@ -184,532 +180,343 @@ return !status; } -#define WINE_SIZE_OF_WORLD_ACCESS_ACL (sizeof(ACL) + FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + sizeof(sidWorld)) - - -/* some helper functions - taken from winehq cvs 20050916 */ -/****************************************************************************** - * ComputeStringSidSize - */ -static DWORD ComputeStringSidSize(LPCWSTR StringSid) -{ - int ctok = 0; - DWORD size = sizeof(SID); - - while (*StringSid) - { - if (*StringSid == '-') - ctok++; - StringSid++; - } - - if (ctok > 3) - size += (ctok - 3) * sizeof(DWORD); - - return size; -} - -/****************************************************************************** - * ParseAceStringType - */ -static const ACEFLAG AceType[] = -{ - { SDDL_ACCESS_ALLOWED, ACCESS_ALLOWED_ACE_TYPE }, - { SDDL_ALARM, SYSTEM_ALARM_ACE_TYPE }, - { SDDL_AUDIT, SYSTEM_AUDIT_ACE_TYPE }, - { SDDL_ACCESS_DENIED, ACCESS_DENIED_ACE_TYPE }, - { SDDL_OBJECT_ACCESS_ALLOWED, ACCESS_ALLOWED_OBJECT_ACE_TYPE }, - { SDDL_OBJECT_ACCESS_DENIED, ACCESS_DENIED_OBJECT_ACE_TYPE }, - { SDDL_OBJECT_ALARM, SYSTEM_ALARM_OBJECT_ACE_TYPE }, - { SDDL_OBJECT_AUDIT, SYSTEM_AUDIT_OBJECT_ACE_TYPE }, - { NULL, 0 }, +static BOOL +FindKeyInTable( + IN const RECORD* Table, + IN LPCWSTR Key, + OUT SIZE_T* pKeyLength, + OUT DWORD* pItem) +{ + const RECORD* pRecord = Table; + while (pRecord->key != NULL) + { + if (wcsncmp(pRecord->key, Key, wcslen(pRecord->key)) == 0) + { + *pKeyLength = wcslen(pRecord->key); + *pItem = pRecord->value; + return TRUE; + } + pRecord++; + } + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; +} + +static BOOL +ParseSidString( + IN LPCWSTR Buffer, + OUT PSID* pSid, + OUT SIZE_T* pLength) +{ + WCHAR str[SDDL_ALIAS_SIZE + 1]; + LPWSTR strSid; + LPCWSTR end; + BOOL ret; + DWORD i; + + wcsncpy(str, Buffer, SDDL_ALIAS_SIZE); + for (i = SDDL_ALIAS_SIZE; i > 0; i--) + { + str[i] = UNICODE_NULL; + if (ConvertStringSidToSidW(str, pSid)) + { + *pLength = i; + return TRUE; + } + } + + end = wcschr(Buffer, SDDL_ACE_ENDC); + if (!end) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + strSid = (LPWSTR)LocalAlloc(0, (end - Buffer) * sizeof(WCHAR) + sizeof(UNICODE_NULL)); + if (!strSid) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + wcsncpy(strSid, Buffer, end - Buffer + 1); + strSid[end - Buffer] = UNICODE_NULL; + *pLength = end - Buffer; + ret = ConvertStringSidToSidW(strSid, pSid); + LocalFree(strSid); + return ret; +} + +static const RECORD DaclFlagTable[] = +{ + { SDDL_PROTECTED, SE_DACL_PROTECTED }, + { SDDL_AUTO_INHERIT_REQ, SE_DACL_AUTO_INHERIT_REQ }, + { SDDL_AUTO_INHERITED, SE_DACL_AUTO_INHERITED }, + { NULL, 0 }, }; -static BYTE ParseAceStringType(LPCWSTR* StringAcl) -{ - UINT len = 0; - LPCWSTR szAcl = *StringAcl; - const ACEFLAG *lpaf = AceType; - - while (lpaf->wstr && - (len = strlenW(lpaf->wstr)) && - strncmpW(lpaf->wstr, szAcl, len)) - lpaf++; - - if (!lpaf->wstr) - return 0; - - *StringAcl += len; - return lpaf->value; -} - - -/****************************************************************************** - * ParseAceStringFlags - */ -static const ACEFLAG AceFlags[] = -{ - { SDDL_CONTAINER_INHERIT, CONTAINER_INHERIT_ACE }, - { SDDL_AUDIT_FAILURE, FAILED_ACCESS_ACE_FLAG }, - { SDDL_INHERITED, INHERITED_ACE }, - { SDDL_INHERIT_ONLY, INHERIT_ONLY_ACE }, - { SDDL_NO_PROPAGATE, NO_PROPAGATE_INHERIT_ACE }, - { SDDL_OBJECT_INHERIT, OBJECT_INHERIT_ACE }, - { SDDL_AUDIT_SUCCESS, SUCCESSFUL_ACCESS_ACE_FLAG }, - { NULL, 0 }, +static const RECORD SaclFlagTable[] = +{ + { SDDL_PROTECTED, SE_SACL_PROTECTED }, + { SDDL_AUTO_INHERIT_REQ, SE_SACL_AUTO_INHERIT_REQ }, + { SDDL_AUTO_INHERITED, SE_SACL_AUTO_INHERITED }, + { NULL, 0 }, }; -static BYTE ParseAceStringFlags(LPCWSTR* StringAcl) -{ - UINT len = 0; - BYTE flags = 0; - LPCWSTR szAcl = *StringAcl; - - while (*szAcl != ';') - { - const ACEFLAG *lpaf = AceFlags; - - while (lpaf->wstr && - (len = strlenW(lpaf->wstr)) && - strncmpW(lpaf->wstr, szAcl, len)) - lpaf++; - - if (!lpaf->wstr) - return 0; - - flags |= lpaf->value; - szAcl += len; - } - - *StringAcl = szAcl; - return flags; -} - - -/****************************************************************************** - * ParseAceStringRights - */ -static const ACEFLAG AceRights[] = -{ - { SDDL_GENERIC_ALL, GENERIC_ALL }, - { SDDL_GENERIC_READ, GENERIC_READ }, - { SDDL_GENERIC_WRITE, GENERIC_WRITE }, - { SDDL_GENERIC_EXECUTE, GENERIC_EXECUTE }, - { SDDL_READ_CONTROL, READ_CONTROL }, - { SDDL_STANDARD_DELETE, DELETE }, - { SDDL_WRITE_DAC, WRITE_DAC }, - { SDDL_WRITE_OWNER, WRITE_OWNER }, - { NULL, 0 }, +static const RECORD AceFlagTable[] = +{ + { SDDL_CONTAINER_INHERIT, CONTAINER_INHERIT_ACE }, + { SDDL_OBJECT_INHERIT, OBJECT_INHERIT_ACE }, + { SDDL_NO_PROPAGATE, NO_PROPAGATE_INHERIT_ACE }, + { SDDL_INHERIT_ONLY, INHERIT_ONLY_ACE }, + { SDDL_INHERITED, INHERITED_ACE }, + { SDDL_AUDIT_SUCCESS, SUCCESSFUL_ACCESS_ACE_FLAG }, + { SDDL_AUDIT_FAILURE, FAILED_ACCESS_ACE_FLAG }, + { NULL, 0 }, }; -static DWORD ParseAceStringRights(LPCWSTR* StringAcl) -{ - UINT len = 0; - DWORD rights = 0; - LPCWSTR szAcl = *StringAcl; - - if ((*szAcl == '0') && (*(szAcl + 1) == 'x')) - { - LPCWSTR p = szAcl; - - while (*p && *p != ';') - p++; - - if (p - szAcl <= 8) - { - rights = strtoulW(szAcl, NULL, 16); - *StringAcl = p; - } - else - WARN("Invalid rights string format: %s\n", debugstr_wn(szAcl, p - szAcl)); - } - else - { - while (*szAcl != ';') - { - const ACEFLAG *lpaf = AceRights; - - while (lpaf->wstr && - (len = strlenW(lpaf->wstr)) && - strncmpW(lpaf->wstr, szAcl, len)) - { - lpaf++; - } - - if (!lpaf->wstr) - return 0; - - rights |= lpaf->value; - szAcl += len; - } - } - - *StringAcl = szAcl; - return rights; -} - -/****************************************************************************** - * ParseStringAclToAcl - * - * dacl_flags(string_ace1)(string_ace2)... (string_acen) - */ -static BOOL ParseStringAclToAcl(LPCWSTR StringAcl, LPDWORD lpdwFlags, - PACL pAcl, LPDWORD cBytes) -{ - DWORD val; - DWORD sidlen; - DWORD length = sizeof(ACL); - PACCESS_ALLOWED_ACE pAce = NULL; /* pointer to current ACE */ - - TRACE("%s\n", debugstr_w(StringAcl)); - - if (!StringAcl) - return FALSE; - - if (pAcl) /* pAce is only useful if we're setting values */ - pAce = (PACCESS_ALLOWED_ACE) ((LPBYTE)pAcl + sizeof(PACL)); - - /* Parse ACL flags */ - *lpdwFlags = ParseAclStringFlags(&StringAcl); - - /* Parse ACE */ - while (*StringAcl == '(') - { - StringAcl++; - - /* Parse ACE type */ - val = ParseAceStringType(&StringAcl); - if (pAce) - pAce->Header.AceType = (BYTE) val; - if (*StringAcl != ';') - goto lerr; - StringAcl++; - - /* Parse ACE flags */ - val = ParseAceStringFlags(&StringAcl); - if (pAce) - pAce->Header.AceFlags = (BYTE) val; - if (*StringAcl != ';') - goto lerr; - StringAcl++; - - /* Parse ACE rights */ - val = ParseAceStringRights(&StringAcl); - if (pAce) - pAce->Mask = val; - if (*StringAcl != ';') - goto lerr; - StringAcl++; - - /* Parse ACE object guid */ - if (*StringAcl != ';') - { - FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n"); - goto lerr; - } - StringAcl++; - - /* Parse ACE inherit object guid */ - if (*StringAcl != ';') - { - FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n"); - goto lerr; - } - StringAcl++; - - /* Parse ACE account sid */ - if (ParseStringSidToSid(StringAcl, pAce ? (PSID)&pAce->SidStart : NULL, &sidlen)) - { - while (*StringAcl && *StringAcl != ')') - StringAcl++; - } - - if (*StringAcl != ')') - goto lerr; - StringAcl++; - - length += FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + sidlen; - } - - *cBytes = length; - return TRUE; - -lerr: - WARN("Invalid ACE string format\n"); - return FALSE; -} - -/****************************************************************************** - * ParseStringSecurityDescriptorToSecurityDescriptor - */ -static BOOL ParseStringSecurityDescriptorToSecurityDescriptor( - LPCWSTR StringSecurityDescriptor, - SECURITY_DESCRIPTOR* SecurityDescriptor, - LPDWORD cBytes) -{ - BOOL bret = FALSE; - WCHAR toktype; - WCHAR tok[MAX_PATH]; - LPCWSTR lptoken; - LPBYTE lpNext = NULL; - DWORD len; - - *cBytes = 0; - - if (SecurityDescriptor) - lpNext = ((LPBYTE) SecurityDescriptor) + sizeof(SECURITY_DESCRIPTOR); - - while (*StringSecurityDescriptor) - { - toktype = *StringSecurityDescriptor; - - /* Expect char identifier followed by ':' */ - StringSecurityDescriptor++; - if (*StringSecurityDescriptor != ':') - { - SetLastError(ERROR_INVALID_PARAMETER); - goto lend; - } - StringSecurityDescriptor++; - - /* Extract token */ - lptoken = StringSecurityDescriptor; - while (*lptoken && *lptoken != ':') - lptoken++; - - if (*lptoken) - lptoken--; - - len = lptoken - StringSecurityDescriptor; - memcpy( tok, StringSecurityDescriptor, len * sizeof(WCHAR) ); - tok[len] = 0; - - switch (toktype) - { - case 'O': - { - DWORD bytes; - - if (!ParseStringSidToSid(tok, (PSID)lpNext, &bytes)) - goto lend; - - if (SecurityDescriptor) - { - SecurityDescriptor->Owner = (PSID) ((DWORD) lpNext - - (DWORD) SecurityDescriptor); - lpNext += bytes; /* Advance to next token */ - } - - *cBytes += bytes; - - break; - } - - case 'G': - { - DWORD bytes; - - if (!ParseStringSidToSid(tok, (PSID)lpNext, &bytes)) - goto lend; - - if (SecurityDescriptor) - { - SecurityDescriptor->Group = (PSID) ((DWORD) lpNext - - (DWORD) SecurityDescriptor); - lpNext += bytes; /* Advance to next token */ - } - - *cBytes += bytes; - - break; - } - - case 'D': - { - DWORD flags; - DWORD bytes; - - if (!ParseStringAclToAcl(tok, &flags, (PACL)lpNext, &bytes)) - goto lend; - - if (SecurityDescriptor) - { - SecurityDescriptor->Control |= SE_DACL_PRESENT | flags; - SecurityDescriptor->Dacl = (PACL) ((DWORD) lpNext - - (DWORD) SecurityDescriptor); - lpNext += bytes; /* Advance to next token */ +static BOOL +ParseFlagsString( + IN LPCWSTR Buffer, + IN const RECORD* FlagTable, + IN WCHAR LimitChar, + OUT DWORD* pFlags, + OUT SIZE_T* pLength) +{ + LPCWSTR ptr = Buffer; + SIZE_T PartialLength; + DWORD Flag; + + *pFlags = 0; + while (*ptr != LimitChar) + { + if (!FindKeyInTable(FlagTable, ptr, &PartialLength, &Flag)) + return FALSE; + *pFlags |= Flag; + ptr += PartialLength; + } + *pLength = ptr - Buffer; + return TRUE; +} + +static const RECORD AccessMaskTable[] = +{ + { SDDL_GENERIC_ALL, GENERIC_ALL }, + { SDDL_GENERIC_READ, GENERIC_READ }, + { SDDL_GENERIC_WRITE, GENERIC_WRITE }, + { SDDL_GENERIC_EXECUTE, GENERIC_EXECUTE }, + { SDDL_READ_CONTROL, READ_CONTROL }, + { SDDL_STANDARD_DELETE, DELETE }, + { SDDL_WRITE_DAC, WRITE_DAC }, + { SDDL_WRITE_OWNER, WRITE_OWNER }, + { SDDL_READ_PROPERTY, ADS_RIGHT_DS_READ_PROP }, + { SDDL_WRITE_PROPERTY, ADS_RIGHT_DS_WRITE_PROP }, + { SDDL_CREATE_CHILD, ADS_RIGHT_DS_CREATE_CHILD }, + { SDDL_DELETE_CHILD, ADS_RIGHT_DS_DELETE_CHILD }, + { SDDL_LIST_CHILDREN, ADS_RIGHT_ACTRL_DS_LIST }, + { SDDL_SELF_WRITE, ADS_RIGHT_DS_SELF }, + { SDDL_LIST_OBJECT, ADS_RIGHT_DS_LIST_OBJECT }, + { SDDL_DELETE_TREE, ADS_RIGHT_DS_DELETE_TREE }, + { SDDL_CONTROL_ACCESS, ADS_RIGHT_DS_CONTROL_ACCESS }, + { SDDL_FILE_ALL, FILE_ALL_ACCESS }, + { SDDL_FILE_READ, FILE_GENERIC_READ }, + { SDDL_FILE_WRITE, FILE_GENERIC_WRITE }, + { SDDL_FILE_EXECUTE, FILE_GENERIC_EXECUTE }, + { SDDL_KEY_ALL, KEY_ALL_ACCESS }, + { SDDL_KEY_READ, KEY_READ }, + { SDDL_KEY_WRITE, KEY_WRITE }, + { SDDL_KEY_EXECUTE, KEY_EXECUTE }, + { NULL, 0 }, +}; + +static BOOL +ParseAccessMaskString( + IN LPCWSTR Buffer, + OUT DWORD* pAccessMask, + OUT SIZE_T* pLength) +{ + /* FIXME: Allow hexadecimal string for access rights! */ + + return ParseFlagsString(Buffer, AccessMaskTable, SDDL_SEPERATORC, pAccessMask, pLength); +} + +static BOOL +ParseGuidString( + IN LPCWSTR Buffer, + OUT GUID* pGuid, + OUT BOOL* pIsGuidValid, + OUT SIZE_T* pLength) +{ + WCHAR GuidStr[MAX_GUID_STRING_LEN + 1]; + LPCWSTR end; + + end = wcschr(Buffer, SDDL_SEPERATORC); + if (!end) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + *pLength = end - Buffer; + *pIsGuidValid = (end != Buffer); + if (!*pIsGuidValid) + return TRUE; + + if (end - Buffer > MAX_GUID_STRING_LEN - 1) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + GuidStr[end - Buffer] = UNICODE_NULL; + wcsncpy(GuidStr, Buffer, end - Buffer); + if (RPC_S_OK != UuidFromStringW((unsigned short*)&GuidStr, pGuid)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + return TRUE; +} + +static const RECORD AceTypeTable[] = +{ + { SDDL_OBJECT_ACCESS_ALLOWED, ACCESS_ALLOWED_OBJECT_ACE_TYPE }, + { SDDL_OBJECT_ACCESS_DENIED, ACCESS_DENIED_OBJECT_ACE_TYPE }, + { SDDL_AUDIT, SYSTEM_AUDIT_ACE_TYPE }, + { SDDL_ALARM, SYSTEM_ALARM_ACE_TYPE }, + { SDDL_OBJECT_AUDIT, SYSTEM_AUDIT_OBJECT_ACE_TYPE }, + { SDDL_OBJECT_ALARM, SYSTEM_ALARM_OBJECT_ACE_TYPE }, + { SDDL_ACCESS_ALLOWED, ACCESS_ALLOWED_ACE_TYPE }, + { SDDL_ACCESS_DENIED, ACCESS_DENIED_ACE_TYPE }, + { NULL, 0 }, +}; + +static BOOL +ParseAceString( + IN LPCWSTR Buffer, + IN PACL pAcl, + OUT SIZE_T* pLength) +{ + LPCWSTR ptr = Buffer; + SIZE_T PartialLength; + DWORD aceType, aceFlags, accessMask; + GUID object, inheritObject; + BOOL objectValid, inheritObjectValid; + PSID sid = NULL; + BOOL ret; + + if (*ptr != SDDL_ACE_BEGINC) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + ptr++; /* Skip SDDL_ACE_BEGINC */ + + if (!FindKeyInTable(AceTypeTable, ptr, &PartialLength, &aceType)) + return FALSE; + ptr += PartialLength; + + if (*ptr != SDDL_SEPERATORC) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + ptr++; /* Skip SDDL_SEPERATORC */ + + if (!ParseFlagsString(ptr, AceFlagTable, SDDL_SEPERATORC, &aceFlags, &PartialLength)) + return FALSE; + ptr += PartialLength + 1; + + if (!ParseAccessMaskString(ptr, &accessMask, &PartialLength)) + return FALSE; + ptr += PartialLength + 1; + + if (!ParseGuidString(ptr, &object, &objectValid, &PartialLength)) + return FALSE; + ptr += PartialLength + 1; + + if (!ParseGuidString(ptr, &inheritObject, &inheritObjectValid, &PartialLength)) + return FALSE; + ptr += PartialLength + 1; + + if (!ParseSidString(ptr, &sid, &PartialLength)) + return FALSE; + ptr += PartialLength; + if (*ptr != SDDL_ACE_ENDC) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + ptr++; /* Skip SDDL_ACE_ENDC */ + *pLength = ptr - Buffer; + + switch (aceType) + { + case ACCESS_ALLOWED_ACE_TYPE: + ret = AddAccessAllowedAceEx( + pAcl, + ACL_REVISION_DS, + aceFlags, + accessMask, + sid); + break; + case ACCESS_ALLOWED_OBJECT_ACE_TYPE: + ret = AddAccessAllowedObjectAce( + pAcl, + ACL_REVISION_DS, + aceFlags, + accessMask, + objectValid ? &object : NULL, + inheritObjectValid ? &inheritObject : NULL, + sid); + break; + case ACCESS_DENIED_ACE_TYPE: + ret = AddAccessDeniedAceEx( + pAcl, + ACL_REVISION_DS, + aceFlags, + accessMask, + sid); + break; + case ACCESS_DENIED_OBJECT_ACE_TYPE: + ret = AddAccessDeniedObjectAce( + pAcl, + ACL_REVISION_DS, + aceFlags, + accessMask, + objectValid ? &object : NULL, + inheritObjectValid ? &inheritObject : NULL, + sid); + break; + case SYSTEM_AUDIT_ACE_TYPE: + ret = AddAuditAccessAceEx( + pAcl, + ACL_REVISION_DS, + aceFlags, + accessMask, + sid, + FALSE, + FALSE); + break; + case SYSTEM_AUDIT_OBJECT_ACE_TYPE: + ret = AddAuditAccessObjectAce( + pAcl, + ACL_REVISION_DS, + aceFlags, + accessMask, + objectValid ? &object : NULL, + inheritObjectValid ? &inheritObject : NULL, + sid, + FALSE, + FALSE); + break; + case SYSTEM_ALARM_ACE_TYPE: + case SYSTEM_ALARM_OBJECT_ACE_TYPE: + default: + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + ret = FALSE; } - - *cBytes += bytes; - - break; - } - - case 'S': - { - DWORD flags; - DWORD bytes; - - if (!ParseStringAclToAcl(tok, &flags, (PACL)lpNext, &bytes)) - goto lend; - - if (SecurityDescriptor) - { - SecurityDescriptor->Control |= SE_SACL_PRESENT | flags; - SecurityDescriptor->Sacl = (PACL) ((DWORD) lpNext - - (DWORD) SecurityDescriptor); - lpNext += bytes; /* Advance to next token */ - } - - *cBytes += bytes; - - break; - } - - default: - FIXME("Unknown token\n"); - SetLastError(ERROR_INVALID_PARAMETER); - goto lend; - } - - StringSecurityDescriptor = lptoken; - } - - bret = TRUE; - -lend: - return bret; -} - -/****************************************************************************** - * ParseAclStringFlags - */ -static DWORD ParseAclStringFlags(LPCWSTR* StringAcl) -{ - DWORD flags = 0; - LPCWSTR szAcl = *StringAcl; - - while (*szAcl != '(') - { - if (*szAcl == 'P') - { - flags |= SE_DACL_PROTECTED; - } - else if (*szAcl == 'A') - { - szAcl++; - if (*szAcl == 'R') - flags |= SE_DACL_AUTO_INHERIT_REQ; - else if (*szAcl == 'I') - flags |= SE_DACL_AUTO_INHERITED; - } - szAcl++; - } - - *StringAcl = szAcl; - return flags; -} - -/****************************************************************************** - * ParseStringSidToSid - */ -static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes) -{ - BOOL bret = FALSE; - SID* pisid=pSid; - - TRACE("%s, %p, %p\n", debugstr_w(StringSid), pSid, cBytes); - if (!StringSid) - { - SetLastError(ERROR_INVALID_PARAMETER); - TRACE("StringSid is NULL, returning FALSE\n"); - return FALSE; - } - - *cBytes = ComputeStringSidSize(StringSid); - if (!pisid) /* Simply compute the size */ - { - TRACE("only size requested, returning TRUE\n"); - return TRUE; - } - - if (*StringSid != 'S' || *StringSid != '-') /* S-R-I-S-S */ - { - DWORD i = 0, identAuth; - DWORD csubauth = ((*cBytes - sizeof(SID)) / sizeof(DWORD)) + 1; - - StringSid += 2; /* Advance to Revision */ - pisid->Revision = atoiW(StringSid); - - if (pisid->Revision != SDDL_REVISION) - { - TRACE("Revision %d is unknown\n", pisid->Revision); - goto lend; /* ERROR_INVALID_SID */ - } - if (csubauth == 0) - { - TRACE("SubAuthorityCount is 0\n"); - goto lend; /* ERROR_INVALID_SID */ - } - - pisid->SubAuthorityCount = csubauth; - - /* Advance to identifier authority */ - while (*StringSid && *StringSid != '-') - StringSid++; - if (*StringSid == '-') - StringSid++; - - /* MS' implementation can't handle values greater than 2^32 - 1, so - * we don't either; assume most significant bytes are always 0 - */ - pisid->IdentifierAuthority.Value[0] = 0; - pisid->IdentifierAuthority.Value[1] = 0; - identAuth = atoiW(StringSid); - pisid->IdentifierAuthority.Value[5] = identAuth & 0xff; - pisid->IdentifierAuthority.Value[4] = (identAuth & 0xff00) >> 8; - pisid->IdentifierAuthority.Value[3] = (identAuth & 0xff0000) >> 16; - pisid->IdentifierAuthority.Value[2] = (identAuth & 0xff000000) >> 24; - - /* Advance to first sub authority */ - while (*StringSid && *StringSid != '-') - StringSid++; - if (*StringSid == '-') - StringSid++; - - while (*StringSid) - { - while (*StringSid && *StringSid != '-') - StringSid++; - - pisid->SubAuthority[i++] = atoiW(StringSid); - } - - if (i != pisid->SubAuthorityCount) - goto lend; /* ERROR_INVALID_SID */ - - bret = TRUE; - } - else /* String constant format - Only available in winxp and above */ - { - pisid->Revision = SDDL_REVISION; - pisid->SubAuthorityCount = 1; - - FIXME("String constant not supported: %s\n", debugstr_wn(StringSid, 2)); - - /* TODO: Lookup string of well-known SIDs in table */ - pisid->IdentifierAuthority.Value[5] = 0; - pisid->SubAuthority[0] = 0; - - bret = TRUE; - } - -lend: - if (!bret) - SetLastError(ERROR_INVALID_SID); - - TRACE("returning %s\n", bret ? "TRUE" : "FALSE"); - return bret; + } + LocalFree(sid); + return ret; } /* Exported functions */ @@ -793,60 +600,190 @@ return TRUE; } -/* Winehq cvs 20050916 */ /****************************************************************************** * ConvertStringSecurityDescriptorToSecurityDescriptorW [ADVAPI32.@] * @implemented */ -BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW( - LPCWSTR StringSecurityDescriptor, - DWORD StringSDRevision, - PSECURITY_DESCRIPTOR* SecurityDescriptor, - PULONG SecurityDescriptorSize) -{ - DWORD cBytes; - SECURITY_DESCRIPTOR* psd; - BOOL bret = FALSE; - - TRACE("%s\n", debugstr_w(StringSecurityDescriptor)); - - if (GetVersion() & 0x80000000) - { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - goto lend; - } - else if (StringSDRevision != SID_REVISION) - { - SetLastError(ERROR_UNKNOWN_REVISION); - goto lend; - } - - /* Compute security descriptor length */ - if (!ParseStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor, - NULL, &cBytes)) - goto lend; - - psd = *SecurityDescriptor = (SECURITY_DESCRIPTOR*) LocalAlloc( - GMEM_ZEROINIT, cBytes); - - psd->Revision = SID_REVISION; - psd->Control |= SE_SELF_RELATIVE; - - if (!ParseStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor, - psd, &cBytes)) - { - LocalFree(psd); - goto lend; - } - - if (SecurityDescriptorSize) - *SecurityDescriptorSize = cBytes; - - bret = TRUE; - -lend: - TRACE(" ret=%d\n", bret); - return bret; +BOOL WINAPI +ConvertStringSecurityDescriptorToSecurityDescriptorW( + IN LPCWSTR StringSecurityDescriptor, + IN DWORD StringSDRevision, + OUT PSECURITY_DESCRIPTOR* SecurityDescriptor, + OUT PULONG SecurityDescriptorSize) +{ + PSECURITY_DESCRIPTOR sd = NULL; + BOOL ret = FALSE; + + if (!StringSecurityDescriptor) + SetLastError(ERROR_INVALID_PARAMETER); + else if (StringSDRevision != SDDL_REVISION_1) + SetLastError(ERROR_INVALID_PARAMETER); + else + { + LPCWSTR ptr = StringSecurityDescriptor; + DWORD numberOfAces = 0; + DWORD relativeSdSize; + SIZE_T MaxAclSize; + PSECURITY_DESCRIPTOR relativeSd = NULL; + PSID pSid; + PACL pAcl; + BOOL present, dummy; + /* An easy way to know how much space we need for an ACL is to count + * the number of ACEs and say that we have 1 SID by ACE + */ + ptr = wcschr(StringSecurityDescriptor, SDDL_ACE_BEGINC); + while (ptr != NULL) + { + numberOfAces++; + ptr = wcschr(ptr + 1, SDDL_ACE_BEGINC); + } + MaxAclSize = sizeof(ACL) + numberOfAces * + (sizeof(ACCESS_ALLOWED_OBJECT_ACE) + SECURITY_MAX_SID_SIZE); + + sd = (SECURITY_DESCRIPTOR*)LocalAlloc(0, sizeof(SECURITY_DESCRIPTOR)); + if (!sd) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + ret = InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION); + if (!ret) + goto cleanup; + + /* Now, really parse the string */ + ptr = StringSecurityDescriptor; + while (*ptr) + { + if (ptr[1] != SDDL_DELIMINATORC) + { + SetLastError(ERROR_INVALID_PARAMETER); + ret = FALSE; + goto cleanup; + } + ptr += 2; + switch (ptr[-2]) + { + case 'O': + case 'G': + { + PSID pSid; + SIZE_T Length; + + ret = ParseSidString(ptr, &pSid, &Length); + if (!ret) + goto cleanup; + if (ptr[-2] == 'O') + ret = SetSecurityDescriptorOwner(sd, pSid, FALSE); + else + ret = SetSecurityDescriptorGroup(sd, pSid, FALSE); + if (!ret) + { + LocalFree(pSid); + goto cleanup; + } + ptr += Length; + break; + } + case 'D': + case 'S': + { + DWORD aclFlags; + SIZE_T Length; + BOOL isDacl = (ptr[-2] == 'D'); + + if (isDacl) + ret = ParseFlagsString(ptr, DaclFlagTable, SDDL_ACE_BEGINC, &aclFlags, &Length); + else + ret = ParseFlagsString(ptr, SaclFlagTable, SDDL_ACE_BEGINC, &aclFlags, &Length); + if (!ret) + goto cleanup; + pAcl = (PACL)LocalAlloc(0, MaxAclSize); + if (!pAcl) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ret = FALSE; + goto cleanup; + } + if (!InitializeAcl(pAcl, (DWORD)MaxAclSize, ACL_REVISION_DS)) + { + LocalFree(pAcl); + goto cleanup; + } + if (aclFlags != 0) + { + ret = SetSecurityDescriptorControl( + sd, + (SECURITY_DESCRIPTOR_CONTROL)aclFlags, + (SECURITY_DESCRIPTOR_CONTROL)aclFlags); + if (!ret) + { + LocalFree(pAcl); + goto cleanup; + } + } + ptr += Length; + while (*ptr == SDDL_ACE_BEGINC) + { + ret = ParseAceString(ptr, pAcl, &Length); + if (!ret) + { + LocalFree(pAcl); + goto cleanup; + } + ptr += Length; + } + if (isDacl) + ret = SetSecurityDescriptorDacl(sd, TRUE, pAcl, FALSE); + else + ret = SetSecurityDescriptorSacl(sd, TRUE, pAcl, FALSE); + if (!ret) + { + LocalFree(pAcl); + goto cleanup; + } + break; + } + default: + { + SetLastError(ERROR_INVALID_PARAMETER); + ret = FALSE; + goto cleanup; + } + } + } + + relativeSdSize = 0; + while (TRUE) + { + if (relativeSd) + LocalFree(relativeSd); + relativeSd = LocalAlloc(0, relativeSdSize); + if (!relativeSd) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + goto cleanup; + } + ret = MakeSelfRelativeSD(sd, relativeSd, &relativeSdSize); + if (ret || GetLastError() != ERROR_INSUFFICIENT_BUFFER) + break; + } + if (SecurityDescriptorSize) + *SecurityDescriptorSize = relativeSdSize; + *SecurityDescriptor = relativeSd; + +cleanup: + if (GetSecurityDescriptorOwner(sd, &pSid, &dummy)) + LocalFree(pSid); + if (GetSecurityDescriptorGroup(sd, &pSid, &dummy)) + LocalFree(pSid); + if (GetSecurityDescriptorDacl(sd, &present, &pAcl, &dummy) && present) + LocalFree(pAcl); + if (GetSecurityDescriptorSacl(sd, &present, &pAcl, &dummy) && present) + LocalFree(pAcl); + LocalFree(sd); + return ret; + } + return FALSE; } /* Winehq cvs 20050916 */ @@ -1204,16 +1141,206 @@ return bRetVal; } -/* - * @unimplemented - */ -BOOL STDCALL +/****************************************************************************** + * ComputeStringSidSize + */ +static DWORD ComputeStringSidSize(LPCWSTR StringSid) +{ + DWORD size = sizeof(SID); + + if (StringSid[0] == 'S' && StringSid[1] == '-') /* S-R-I-S-S */ + { + int ctok = 0; + while (*StringSid) + { + if (*StringSid == '-') + ctok++; + StringSid++; + } + + if (ctok > 3) + size += (ctok - 3) * sizeof(DWORD); + } + else /* String constant format - Only available in winxp and above */ + { + int i; + + for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++) + if (!strncmpW(WellKnownSids[i].wstr, StringSid, 2)) + size += (WellKnownSids[i].Sid.SubAuthorityCount - 1) * sizeof(DWORD); + } + + return size; +} + +static const RECORD SidTable[] = +{ + { SDDL_ACCOUNT_OPERATORS, WinBuiltinAccountOperatorsSid }, + { SDDL_ALIAS_PREW2KCOMPACC, WinBuiltinPreWindows2000CompatibleAccessSid }, + { SDDL_ANONYMOUS, WinAnonymousSid }, + { SDDL_AUTHENTICATED_USERS, WinAuthenticatedUserSid }, + { SDDL_BUILTIN_ADMINISTRATORS, WinBuiltinAdministratorsSid }, + { SDDL_BUILTIN_GUESTS, WinBuiltinGuestsSid }, + { SDDL_BACKUP_OPERATORS, WinBuiltinBackupOperatorsSid }, + { SDDL_BUILTIN_USERS, WinBuiltinUsersSid }, + { SDDL_CERT_SERV_ADMINISTRATORS, WinAccountCertAdminsSid /* FIXME: DOMAIN_GROUP_RID_CERT_ADMINS */ }, + { SDDL_CREATOR_GROUP, WinCreatorGroupSid }, + { SDDL_CREATOR_OWNER, WinCreatorOwnerSid }, + { SDDL_DOMAIN_ADMINISTRATORS, WinAccountDomainAdminsSid /* FIXME: DOMAIN_GROUP_RID_ADMINS */ }, + { SDDL_DOMAIN_COMPUTERS, WinAccountComputersSid /* FIXME: DOMAIN_GROUP_RID_COMPUTERS */ }, + { SDDL_DOMAIN_DOMAIN_CONTROLLERS, WinAccountControllersSid /* FIXME: DOMAIN_GROUP_RID_CONTROLLERS */ }, + { SDDL_DOMAIN_GUESTS, WinAccountDomainGuestsSid /* FIXME: DOMAIN_GROUP_RID_GUESTS */ }, + { SDDL_DOMAIN_USERS, WinAccountDomainUsersSid /* FIXME: DOMAIN_GROUP_RID_USERS */ }, + { SDDL_ENTERPRISE_ADMINS, WinAccountEnterpriseAdminsSid /* FIXME: DOMAIN_GROUP_RID_ENTERPRISE_ADMINS */ }, + { SDDL_ENTERPRISE_DOMAIN_CONTROLLERS, WinLogonIdsSid /* FIXME: SECURITY_SERVER_LOGON_RID */ }, + { SDDL_EVERYONE, WinWorldSid }, + { SDDL_GROUP_POLICY_ADMINS, WinAccountPolicyAdminsSid /* FIXME: DOMAIN_GROUP_RID_POLICY_ADMINS */ }, + { SDDL_INTERACTIVE, WinInteractiveSid }, + { SDDL_LOCAL_ADMIN, WinAccountAdministratorSid /* FIXME: DOMAIN_USER_RID_ADMIN */ }, + { SDDL_LOCAL_GUEST, WinAccountGuestSid /* FIXME: DOMAIN_USER_RID_GUEST */ }, + { SDDL_LOCAL_SERVICE, WinLocalServiceSid }, + { SDDL_LOCAL_SYSTEM, WinLocalSystemSid }, + { SDDL_NETWORK, WinNetworkSid }, + { SDDL_NETWORK_CONFIGURATION_OPS, WinBuiltinNetworkConfigurationOperatorsSid }, + { SDDL_NETWORK_SERVICE, WinNetworkServiceSid }, + { SDDL_PRINTER_OPERATORS, WinBuiltinPrintOperatorsSid }, + { SDDL_PERSONAL_SELF, WinSelfSid }, + { SDDL_POWER_USERS, WinBuiltinPowerUsersSid }, + { SDDL_RAS_SERVERS, WinAccountRasAndIasServersSid /* FIXME: DOMAIN_ALIAS_RID_RAS_SERVERS */ }, + { SDDL_REMOTE_DESKTOP, WinBuiltinRemoteDesktopUsersSid }, + { SDDL_REPLICATOR, WinBuiltinReplicatorSid }, + { SDDL_RESTRICTED_CODE, WinRestrictedCodeSid }, + { SDDL_SCHEMA_ADMINISTRATORS, WinAccountSchemaAdminsSid /* FIXME: DOMAIN_GROUP_RID_SCHEMA_ADMINS */ }, + { SDDL_SERVER_OPERATORS, WinBuiltinSystemOperatorsSid }, + { SDDL_SERVICE, WinServiceSid }, + { NULL, 0 }, +}; + +/* + * @implemented + */ +BOOL WINAPI ConvertStringSidToSidW( - IN LPCWSTR StringSid, - OUT PSID* sid) -{ - FIXME("unimplemented!\n", __FUNCTION__); - return FALSE; + IN LPCWSTR StringSid, + OUT PSID* sid) +{ + DWORD size; + DWORD i, cBytes, identAuth, csubauth; + BOOL ret; + SID* pisid; + + TRACE("%s %p\n", StringSid, sid); + + if (!StringSid) + { + SetLastError(ERROR_INVALID_SID); + return FALSE; + } + for (i = 0; i < sizeof(SidTable) / sizeof(SidTable[0]) - 1; i++) + { + if (wcscmp(StringSid, SidTable[i].key) == 0) + { + WELL_KNOWN_SID_TYPE knownSid = (WELL_KNOWN_SID_TYPE)SidTable[i].value; + size = SECURITY_MAX_SID_SIZE; + *sid = LocalAlloc(0, size); + if (!*sid) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + ret = CreateWellKnownSid( + knownSid, + NULL, + *sid, + &size); + if (!ret) + { + SetLastError(ERROR_INVALID_SID); + LocalFree(*sid); + } + return ret; + } + } + + /* That's probably a string S-R-I-S-S... */ + if (StringSid[0] != 'S' || StringSid[1] != '-') + { + SetLastError(ERROR_INVALID_SID); + return FALSE; + } + + cBytes = ComputeStringSidSize(StringSid); + pisid = (SID*)LocalAlloc( 0, cBytes ); + if (!pisid) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + i = 0; + ret = FALSE; + csubauth = ((cBytes - sizeof(SID)) / sizeof(DWORD)) + 1; + + StringSid += 2; /* Advance to Revision */ + pisid->Revision = atoiW(StringSid); + + if (pisid->Revision != SDDL_REVISION) + { + TRACE("Revision %d is unknown\n", pisid->Revision); + goto lend; /* ERROR_INVALID_SID */ + } + if (csubauth == 0) + { + TRACE("SubAuthorityCount is 0\n"); + goto lend; /* ERROR_INVALID_SID */ + } + + pisid->SubAuthorityCount = csubauth; + + /* Advance to identifier authority */ + while (*StringSid && *StringSid != '-') + StringSid++; + if (*StringSid == '-') + StringSid++; + + /* MS' implementation can't handle values greater than 2^32 - 1, so + * we don't either; assume most significant bytes are always 0 + */ + pisid->IdentifierAuthority.Value[0] = 0; + pisid->IdentifierAuthority.Value[1] = 0; + identAuth = atoiW(StringSid); + pisid->IdentifierAuthority.Value[5] = identAuth & 0xff; + pisid->IdentifierAuthority.Value[4] = (identAuth & 0xff00) >> 8; + pisid->IdentifierAuthority.Value[3] = (identAuth & 0xff0000) >> 16; + pisid->IdentifierAuthority.Value[2] = (identAuth & 0xff000000) >> 24; + + /* Advance to first sub authority */ + while (*StringSid && *StringSid != '-') + StringSid++; + if (*StringSid == '-') + StringSid++; + + while (*StringSid) + { + while (*StringSid && *StringSid != '-') + StringSid++; + if (*StringSid == '-') + StringSid++; + + pisid->SubAuthority[i++] = atoiW(StringSid); + } + + if (i != pisid->SubAuthorityCount) + goto lend; /* ERROR_INVALID_SID */ + + *sid = pisid; + ret = TRUE; + +lend: + if (!ret) + SetLastError(ERROR_INVALID_SID); + + TRACE("returning %s\n", ret ? "TRUE" : "FALSE"); + return ret; }
17 years, 11 months
1
0
0
0
[hpoussin] 24489: Add some definitions
by hpoussin@svn.reactos.org
Author: hpoussin Date: Thu Oct 12 01:57:22 2006 New Revision: 24489 URL:
http://svn.reactos.org/svn/reactos?rev=24489&view=rev
Log: Add some definitions Modified: trunk/reactos/include/psdk/sddl.h Modified: trunk/reactos/include/psdk/sddl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/sddl.h?rev=24…
============================================================================== --- trunk/reactos/include/psdk/sddl.h (original) +++ trunk/reactos/include/psdk/sddl.h Thu Oct 12 01:57:22 2006 @@ -39,12 +39,94 @@ #define SDDL_SACL TEXT("S") /* + * SDDL Security descriptor controls + */ +#define SDDL_PROTECTED TEXT("P") +#define SDDL_AUTO_INHERIT_REQ TEXT("AR") +#define SDDL_AUTO_INHERITED TEXT("AI") + +/* + * SDDL Rights + */ +#define SDDL_READ_PROPERTY TEXT("RP") +#define SDDL_WRITE_PROPERTY TEXT("WP") +#define SDDL_CREATE_CHILD TEXT("CC") +#define SDDL_DELETE_CHILD TEXT("DC") +#define SDDL_LIST_CHILDREN TEXT("LC") +#define SDDL_SELF_WRITE TEXT("SW") +#define SDDL_LIST_OBJECT TEXT("LO") +#define SDDL_DELETE_TREE TEXT("DT") +#define SDDL_CONTROL_ACCESS TEXT("CR") +#define SDDL_READ_CONTROL TEXT("RC") +#define SDDL_WRITE_DAC TEXT("WD") +#define SDDL_WRITE_OWNER TEXT("WO") +#define SDDL_STANDARD_DELETE TEXT("SD") +#define SDDL_GENERIC_ALL TEXT("GA") +#define SDDL_GENERIC_READ TEXT("GR") +#define SDDL_GENERIC_WRITE TEXT("GW") +#define SDDL_GENERIC_EXECUTE TEXT("GX") +#define SDDL_FILE_ALL TEXT("FA") +#define SDDL_FILE_READ TEXT("FR") +#define SDDL_FILE_WRITE TEXT("FW") +#define SDDL_FILE_EXECUTE TEXT("FX") +#define SDDL_KEY_ALL TEXT("KA") +#define SDDL_KEY_READ TEXT("KR") +#define SDDL_KEY_WRITE TEXT("KW") +#define SDDL_KEY_EXECUTE TEXT("KX") + +#define SDDL_ALIAS_SIZE 2 + +/* + * SDDL User aliases + */ +#define SDDL_DOMAIN_ADMINISTRATORS TEXT("DA") +#define SDDL_DOMAIN_GUESTS TEXT("DG") +#define SDDL_DOMAIN_USERS TEXT("DU") +#define SDDL_ENTERPRISE_DOMAIN_CONTROLLERS TEXT("ED") +#define SDDL_DOMAIN_DOMAIN_CONTROLLERS TEXT("DD") +#define SDDL_DOMAIN_COMPUTERS TEXT("DC") +#define SDDL_BUILTIN_ADMINISTRATORS TEXT("BA") +#define SDDL_BUILTIN_GUESTS TEXT("BG") +#define SDDL_BUILTIN_USERS TEXT("BU") +#define SDDL_LOCAL_ADMIN TEXT("LA") +#define SDDL_LOCAL_GUEST TEXT("LG") +#define SDDL_ACCOUNT_OPERATORS TEXT("AO") +#define SDDL_BACKUP_OPERATORS TEXT("BO") +#define SDDL_PRINTER_OPERATORS TEXT("PO") +#define SDDL_SERVER_OPERATORS TEXT("SO") +#define SDDL_AUTHENTICATED_USERS TEXT("AU") +#define SDDL_PERSONAL_SELF TEXT("PS") +#define SDDL_CREATOR_OWNER TEXT("CO") +#define SDDL_CREATOR_GROUP TEXT("CG") +#define SDDL_LOCAL_SYSTEM TEXT("SY") +#define SDDL_POWER_USERS TEXT("PU") +#define SDDL_EVERYONE TEXT("WD") +#define SDDL_REPLICATOR TEXT("RE") +#define SDDL_INTERACTIVE TEXT("IU") +#define SDDL_NETWORK TEXT("NU") +#define SDDL_SERVICE TEXT("SU") +#define SDDL_RESTRICTED_CODE TEXT("RC") +#define SDDL_ANONYMOUS TEXT("AN") +#define SDDL_SCHEMA_ADMINISTRATORS TEXT("SA") +#define SDDL_CERT_SERV_ADMINISTRATORS TEXT("CA") +#define SDDL_RAS_SERVERS TEXT("RS") +#define SDDL_ENTERPRISE_ADMINS TEXT("EA") +#define SDDL_GROUP_POLICY_ADMINS TEXT("PA") +#define SDDL_ALIAS_PREW2KCOMPACC TEXT("RU") +#define SDDL_LOCAL_SERVICE TEXT("LS") +#define SDDL_NETWORK_SERVICE TEXT("NS") +#define SDDL_REMOTE_DESKTOP TEXT("RD") +#define SDDL_NETWORK_CONFIGURATION_OPS TEXT("NO") +#define SDDL_PERFMON_USERS TEXT("MU") +#define SDDL_PERFLOG_USERS TEXT("LU") + +/* * SDDL Separators - character version */ -#define SDDL_SEPERATORC TEXT(";") -#define SDDL_DELIMINATORC TEXT(":") -#define SDDL_ACE_BEGINC TEXT("(") -#define SDDL_ACE_ENDC TEXT(")") +#define SDDL_SEPERATORC TEXT(';') +#define SDDL_DELIMINATORC TEXT(':') +#define SDDL_ACE_BEGINC TEXT('(') +#define SDDL_ACE_ENDC TEXT(')') /* * SDDL Separators - string version
17 years, 11 months
1
0
0
0
[hpoussin] 24488: Don't try to signal init event, as it has been removed in r24413/24414
by hpoussin@svn.reactos.org
Author: hpoussin Date: Wed Oct 11 22:25:22 2006 New Revision: 24488 URL:
http://svn.reactos.org/svn/reactos?rev=24488&view=rev
Log: Don't try to signal init event, as it has been removed in r24413/24414 Modified: trunk/reactos/base/setup/usetup/usetup.c Modified: trunk/reactos/base/setup/usetup/usetup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/usetup.c…
============================================================================== --- trunk/reactos/base/setup/usetup/usetup.c (original) +++ trunk/reactos/base/setup/usetup/usetup.c Wed Oct 11 22:25:22 2006 @@ -3475,49 +3475,11 @@ static VOID -SignalInitEvent() -{ - NTSTATUS Status; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING UnicodeString = RTL_CONSTANT_STRING(L"\\ReactOSInitDone"); - HANDLE ReactOSInitEvent; - - InitializeObjectAttributes(&ObjectAttributes, - &UnicodeString, - 0, - 0, - NULL); - Status = NtOpenEvent(&ReactOSInitEvent, - EVENT_ALL_ACCESS, - &ObjectAttributes); - if (NT_SUCCESS(Status)) - { - LARGE_INTEGER Timeout; - /* This will cause the boot screen image to go away (if displayed) */ - NtPulseEvent(ReactOSInitEvent, NULL); - - /* Wait for the display mode to be changed (if in graphics mode) */ - Timeout.QuadPart = -50000000LL; /* 5 second timeout */ - NtWaitForSingleObject(ReactOSInitEvent, FALSE, &Timeout); - - NtClose(ReactOSInitEvent); - } - else - { - /* We don't really care if this fails */ - DPRINT1("USETUP: Failed to open ReactOS init notification event\n"); - } -} - - -static VOID RunUSetup(VOID) { INPUT_RECORD Ir; PAGE_NUMBER Page; BOOL ret; - - SignalInitEvent(); ret = AllocConsole(); if (!ret)
17 years, 11 months
1
0
0
0
[weiden] 24487: Fixed InterlockedExchangeAdd
by weiden@svn.reactos.org
Author: weiden Date: Wed Oct 11 21:41:42 2006 New Revision: 24487 URL:
http://svn.reactos.org/svn/reactos?rev=24487&view=rev
Log: Fixed InterlockedExchangeAdd Modified: trunk/reactos/include/psdk/intrin.h Modified: trunk/reactos/include/psdk/intrin.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/intrin.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/intrin.h (original) +++ trunk/reactos/include/psdk/intrin.h Wed Oct 11 21:41:42 2006 @@ -265,7 +265,7 @@ static __inline__ __attribute__((always_inline)) long _InterlockedExchangeAdd(volatile long * const Addend, const long Value) { long retval = Value; - __asm__("lock; xaddl %[retval], %[Addend]" : "=r" (retval) : "rm" (Addend)); + __asm__("lock; xaddl %[retval], %[Addend]" : [retval] "=r" (retval) : [Addend] "rm" (Addend)); return retval; }
17 years, 11 months
1
0
0
0
[hyperion] 24486: How could so much be so wrong in so little code is something future generations will forever ponder in vain. Fixed constraints on inline asm outputs for compare-exchange intrinsics
by hyperion@svn.reactos.org
Author: hyperion Date: Wed Oct 11 20:07:45 2006 New Revision: 24486 URL:
http://svn.reactos.org/svn/reactos?rev=24486&view=rev
Log: How could so much be so wrong in so little code is something future generations will forever ponder in vain. Fixed constraints on inline asm outputs for compare-exchange intrinsics Modified: trunk/reactos/include/psdk/intrin.h Modified: trunk/reactos/include/psdk/intrin.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/intrin.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/intrin.h (original) +++ trunk/reactos/include/psdk/intrin.h Wed Oct 11 20:07:45 2006 @@ -190,21 +190,21 @@ static __inline__ __attribute__((always_inline)) char _InterlockedCompareExchange8(volatile char * const Destination, const char Exchange, const char Comperand) { char retval = Comperand; - __asm__("lock; cmpxchgb %b[Exchange], %[Destination]" : "a" (retval) : [Destination] "rm" (Destination), [Exchange] "r" (Exchange) : "memory"); + __asm__("lock; cmpxchgb %b[Exchange], %[Destination]" : "=a" (retval) : [Destination] "rm" (Destination), [Exchange] "r" (Exchange) : "memory"); return retval; } static __inline__ __attribute__((always_inline)) short _InterlockedCompareExchange16(volatile short * const Destination, const short Exchange, const short Comperand) { short retval = Comperand; - __asm__("lock; cmpxchgw %w[Exchange], %[Destination]" : "a" (retval) : [Destination] "rm" (Destination), [Exchange] "r" (Exchange): "memory"); + __asm__("lock; cmpxchgw %w[Exchange], %[Destination]" : "=a" (retval) : [Destination] "rm" (Destination), [Exchange] "r" (Exchange): "memory"); return retval; } static __inline__ __attribute__((always_inline)) long _InterlockedCompareExchange(volatile long * const Destination, const long Exchange, const long Comperand) { long retval = Comperand; - __asm__("lock; cmpxchgl %k[Exchange], %[Destination]" : "a" (retval) : [Destination] "rm" (Destination), [Exchange] "r" (Exchange): "memory"); + __asm__("lock; cmpxchgl %k[Exchange], %[Destination]" : "=a" (retval) : [Destination] "rm" (Destination), [Exchange] "r" (Exchange): "memory"); return retval; } @@ -219,7 +219,7 @@ __asm__ ( "cmpxchg8b %[Destination]" : - "a" (lo32Retval), "d" (hi32Retval) : + "=a" (lo32Retval), "=d" (hi32Retval) : [Destination] "rm" (Destination), "b" (lo32Exchange), "c" (hi32Exchange) : "memory" ); @@ -244,28 +244,28 @@ static __inline__ __attribute__((always_inline)) void * _InterlockedCompareExchangePointer(void * volatile * const Destination, void * const Exchange, void * const Comperand) { void * retval; - __asm__("lock; cmpxchgl %k[Exchange], %[Destination]" : "a" (retval) : [Destination] "rm" (Destination), [Exchange] "r" (Exchange), "a" (Comperand) : "memory"); + __asm__("lock; cmpxchgl %k[Exchange], %[Destination]" : "=a" (retval) : [Destination] "rm" (Destination), [Exchange] "r" (Exchange), "a" (Comperand) : "memory"); return retval; } static __inline__ __attribute__((always_inline)) long _InterlockedExchange(volatile long * const Target, const long Value) { long retval = Value; - __asm__("lock; xchgl %[retval], %[Target]" : [retval] "r" (retval) : [Target] "rm" (Target) : "memory"); + __asm__("lock; xchgl %[retval], %[Target]" : [retval] "=r" (retval) : [Target] "rm" (Target) : "memory"); return retval; } static __inline__ __attribute__((always_inline)) void * _InterlockedExchangePointer(void * volatile * const Target, void * const Value) { void * retval = Value; - __asm__("lock; xchgl %[retval], %[Target]" : [retval] "r" (retval) : [Target] "rm" (Target) : "memory"); + __asm__("lock; xchgl %[retval], %[Target]" : [retval] "=r" (retval) : [Target] "rm" (Target) : "memory"); return retval; } static __inline__ __attribute__((always_inline)) long _InterlockedExchangeAdd(volatile long * const Addend, const long Value) { long retval = Value; - __asm__("lock; xaddl %[retval], %[Addend]" : "r" (retval) : "rm" (Addend)); + __asm__("lock; xaddl %[retval], %[Addend]" : "=r" (retval) : "rm" (Addend)); return retval; }
17 years, 11 months
1
0
0
0
[weiden] 24485: Some header upgrades
by weiden@svn.reactos.org
Author: weiden Date: Wed Oct 11 15:44:40 2006 New Revision: 24485 URL:
http://svn.reactos.org/svn/reactos?rev=24485&view=rev
Log: Some header upgrades Modified: trunk/reactos/include/psdk/ndrtypes.h trunk/reactos/include/psdk/ntsecapi.h trunk/reactos/include/psdk/rpcndr.h trunk/reactos/include/psdk/schannel.h trunk/reactos/include/psdk/security.h trunk/reactos/include/psdk/winbase.h trunk/reactos/include/psdk/winerror.h trunk/reactos/include/psdk/winsock2.h trunk/reactos/include/psdk/ws2tcpip.h trunk/reactos/include/reactos/wine/rpcfc.h Modified: trunk/reactos/include/psdk/ndrtypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ndrtypes.h?re…
============================================================================== --- trunk/reactos/include/psdk/ndrtypes.h (original) +++ trunk/reactos/include/psdk/ndrtypes.h Wed Oct 11 15:44:40 2006 @@ -54,4 +54,129 @@ * call. */ } PARAM_ATTRIBUTES; +typedef struct +{ + unsigned char ServerMustSize : 1; /* 0x01 - the server must perform a + * sizing pass. */ + unsigned char ClientMustSize : 1; /* 0x02 - the client must perform a + * sizing pass. */ + unsigned char HasReturn : 1; /* 0x04 - procedure has a return value. */ + unsigned char HasPipes : 1; /* 0x08 - the pipe package should be used. */ + unsigned char Unused : 1; /* 0x10 - not used */ + unsigned char HasAsyncUuid : 1; /* 0x20 - indicates an asynchronous DCOM + * procedure. */ + unsigned char HasExtensions : 1; /* 0x40 - indicates that Win2000 + * extensions are in use. */ + unsigned char HasAsyncHandle : 1; /* 0x80 - indicates an asynchronous RPC + * procedure. */ +} INTERPRETER_OPT_FLAGS, *PINTERPRETER_OPT_FLAGS; + +typedef struct +{ + unsigned char HasNewCorrDesc : 1; /* 0x01 - indicates new correlation + * descriptors in use. */ + unsigned char ClientCorrCheck : 1; /* 0x02 - client needs correlation + * check. */ + unsigned char ServerCorrCheck : 1; /* 0x04 - server needs correlation + * check. */ + unsigned char HasNotify : 1; /* 0x08 - should call MIDL [notify] + * routine @ NotifyIndex. */ + unsigned char HasNotify2 : 1; /* 0x10 - should call MIDL [notify_flag] routine @ + * NotifyIndex. */ + unsigned char Unused : 3; +} INTERPRETER_OPT_FLAGS2, *PINTERPRETER_OPT_FLAGS2; + +/* Win2000 extensions */ +typedef struct +{ + /* size in bytes of all following extensions */ + unsigned char Size; + + INTERPRETER_OPT_FLAGS2 Flags2; + + /* client cache size hint */ + unsigned short ClientCorrHint; + + /* server cache size hint */ + unsigned short ServerCorrHint; + + /* index of routine in MIDL_STUB_DESC::NotifyRoutineTable to call if + * HasNotify or HasNotify2 flag set */ + unsigned short NotifyIndex; +} NDR_PROC_HEADER_EXTS; + +typedef struct +{ + /* size in bytes of all following extensions */ + unsigned char Size; + + INTERPRETER_OPT_FLAGS2 Flags2; + + /* client cache size hint */ + unsigned short ClientCorrHint; + + /* server cache size hint */ + unsigned short ServerCorrHint; + + /* index of routine in MIDL_STUB_DESC::NotifyRoutineTable to call if + * HasNotify or HasNotify2 flag set */ + unsigned short NotifyIndex; + + /* needed only on IA64 to cope with float/register loading */ + unsigned short FloatArgMask; +} NDR_PROC_HEADER_EXTS64; + +typedef enum +{ + FC_BYTE = 0x01, /* 0x01 */ + FC_CHAR, /* 0x02 */ + FC_SMALL, /* 0x03 */ + FC_USMALL, /* 0x04 */ + FC_WCHAR, /* 0x05 */ + FC_SHORT, /* 0x06 */ + FC_USHORT, /* 0x07 */ + FC_LONG, /* 0x08 */ + FC_ULONG, /* 0x09 */ + FC_FLOAT, /* 0x0a */ + FC_HYPER, /* 0x0b */ + FC_DOUBLE, /* 0x0c */ + FC_ENUM16, /* 0x0d */ + FC_ENUM32, /* 0x0e */ + FC_IGNORE, /* 0x0f */ + FC_ERROR_STATUS_T, /* 0x10 */ + + FC_RP, /* 0x11 */ /* reference pointer */ + FC_UP, /* 0x12 */ /* unique pointer */ + FC_OP, /* 0x13 */ /* object pointer */ + FC_FP, /* 0x14 */ /* full pointer */ + + FC_STRUCT, /* 0x15 */ /* simple structure */ + FC_PSTRUCT, /* 0x16 */ /* simple structure w/ pointers */ + FC_CSTRUCT, /* 0x17 */ /* conformant structure */ + FC_CPSTRUCT, /* 0x18 */ /* conformant structure w/ pointers */ + FC_CVSTRUCT, /* 0x19 */ /* conformant varying struct */ + FC_BOGUS_STRUCT, /* 0x1a */ /* complex structure */ + + FC_CARRAY, /* 0x1b */ /* conformant array */ + FC_CVARRAY, /* 0x1c */ /* conformant varying array */ + FC_SMFARRAY, /* 0x1d */ /* small (<64K) fixed array */ + FC_LGFARRAY, /* 0x1e */ /* large (>= 64k) fixed array */ + FC_SMVARRAY, /* 0x1f */ /* small (<64k) varying array */ + FC_LGVARRAY, /* 0x20 */ /* large (>= 64k) varying array */ + FC_BOGUS_ARRAY, /* 0x21 */ /* complex array */ +} FORMAT_CHARACTER; + +/* flags for all handle types */ +#define HANDLE_PARAM_IS_VIA_PTR 0x80 +#define HANDLE_PARAM_IS_IN 0x40 +#define HANDLE_PARAM_IS_OUT 0x20 +#define HANDLE_PARAM_IS_RETURN 0x10 + +/* flags for context handles */ +#define NDR_STRICT_CONTEXT_HANDLE 0x08 +#define NDR_CONTEXT_HANDLE_NOSERIALIZE 0x04 +#define NDR_CONTEXT_HANDLE_SERIALIZE 0x02 +#define NDR_CONTEXT_HANDLE_CANNOT_BE_NULL 0x01 + + #endif Modified: trunk/reactos/include/psdk/ntsecapi.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntsecapi.h?re…
============================================================================== --- trunk/reactos/include/psdk/ntsecapi.h (original) +++ trunk/reactos/include/psdk/ntsecapi.h Wed Oct 11 15:44:40 2006 @@ -123,11 +123,11 @@ #define TRUST_TYPE_MIT 3 #define TRUST_TYPE_DCE 4 -#if !defined(_NTDEF_H) && !defined(_SUBAUTH_H) +#if !defined(_NTDEF_) typedef LONG NTSTATUS, *PNTSTATUS; #endif -#if defined (_NTDEF_H) +#if defined (_NTDEF_) typedef UNICODE_STRING LSA_UNICODE_STRING, *PLSA_UNICODE_STRING; typedef STRING LSA_STRING, *PLSA_STRING; typedef OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES; @@ -157,6 +157,9 @@ PVOID SecurityDescriptor; PVOID SecurityQualityOfService; } LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES; + +typedef LSA_UNICODE_STRING UNICODE_STRING, *PUNICODE_STRING; +typedef LSA_STRING STRING, *PSTRING ; #endif @@ -374,13 +377,6 @@ LONG DomainIndex; } LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME; -#if !defined(_NTDEF_) && !defined(UNICODE_STRING) -typedef LSA_UNICODE_STRING UNICODE_STRING, *PUNICODE_STRING; -#endif -#if !defined(_NTDEF_) && !defined(STRING) -typedef LSA_STRING STRING, *PSTRING ; -#endif - typedef struct _MSV1_0_INTERACTIVE_LOGON { MSV1_0_LOGON_SUBMIT_TYPE MessageType; UNICODE_STRING LogonDomainName; Modified: trunk/reactos/include/psdk/rpcndr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/rpcndr.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/rpcndr.h (original) +++ trunk/reactos/include/psdk/rpcndr.h Wed Oct 11 15:44:40 2006 @@ -12,6 +12,13 @@ extern "C" { #endif #include <objfwd.h> + +#ifdef CONST_VTABLE +#define CONST_VTBL const +#else +#define CONST_VTBL +#endif + #define TARGET_IS_NT50_OR_LATER 1 #define TARGET_IS_NT40_OR_LATER 1 #define TARGET_IS_NT351_OR_WIN95_OR_LATER 1 Modified: trunk/reactos/include/psdk/schannel.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/schannel.h?re…
============================================================================== --- trunk/reactos/include/psdk/schannel.h (original) +++ trunk/reactos/include/psdk/schannel.h Wed Oct 11 15:44:40 2006 @@ -10,11 +10,24 @@ extern "C" { #endif +#define SCHANNEL_NAME_A "Schannel" +#define SCHANNEL_NAME_W L"Schannel" +#ifdef UNICODE +#define SCHANNEL_NAME SCHANNEL_NAME_W +#else +#define SCHANNEL_NAME SCHANNEL_NAME_A +#endif + +#define SCH_CRED_V1 1 +#define SCH_CRED_V2 2 +#define SCH_CRED_VERSION 2 +#define SCH_CRED_V3 3 #define SCHANNEL_CRED_VERSION 4 -#define SCHANNEL_SHUTDOWN 1 -/* ? Do these belong here or in wincrypt.h */ -#define AUTHTYPE_CLIENT 1 -#define AUTHTYPE_SERVER 2 + +#define SCHANNEL_RENEGOTIATE 0 +#define SCHANNEL_SHUTDOWN 1 +#define SCHANNEL_ALERT 2 +#define SCHANNEL_SESSION 3 #define SP_PROT_TLS1_CLIENT 128 #define SP_PROT_TLS1_SERVER 64 @@ -22,65 +35,96 @@ #define SP_PROT_SSL3_SERVER 16 #define SP_PROT_SSL2_CLIENT 8 #define SP_PROT_SSL2_SERVER 4 +#define SP_PROT_PCT1_CLIENT 2 #define SP_PROT_PCT1_SERVER 1 -#define SP_PROT_PCT1_CLIENT 2 -#define SP_PROT_PCT1 (SP_PROT_PCT1_CLIENT|SP_PROT_PCT1_SERVER) -#define SP_PROT_TLS1 (SP_PROT_TLS1_CLIENT|SP_PROT_TLS1_SERVER) -#define SP_PROT_SSL2 (SP_PROT_SSL2_CLIENT|SP_PROT_SSL2_SERVER) -#define SP_PROT_SSL3 (SP_PROT_SSL3_CLIENT|SP_PROT_SSL3_SERVER) +#define SP_PROT_TLS1 (SP_PROT_TLS1_CLIENT | SP_PROT_TLS1_SERVER) +#define SP_PROT_SSL3 (SP_PROT_SSL3_CLIENT | SP_PROT_SSL3_SERVER) +#define SP_PROT_SSL2 (SP_PROT_SSL2_CLIENT | SP_PROT_SSL2_SERVER) +#define SP_PROT_PCT1 (SP_PROT_PCT1_CLIENT | SP_PROT_PCT1_SERVER) -#define SCH_CRED_NO_SYSTEM_MAPPER 2 -#define SCH_CRED_NO_SERVERNAME_CHECK 4 -#define SCH_CRED_MANUAL_CRED_VALIDATION 8 -#define SCH_CRED_NO_DEFAULT_CREDS 16 -#define SCH_CRED_AUTO_CRED_VALIDATION 32 -#define SCH_CRED_REVOCATION_CHECK_CHAIN 512 -#define SCH_CRED_REVOCATION_CHECK_END_CERT 256 +#define SCH_CRED_NO_SYSTEM_MAPPER 2 +#define SCH_CRED_NO_SERVERNAME_CHECK 4 +#define SCH_CRED_MANUAL_CRED_VALIDATION 8 +#define SCH_CRED_NO_DEFAULT_CREDS 16 +#define SCH_CRED_AUTO_CRED_VALIDATION 32 +#define SCH_CRED_USE_DEFAULT_CREDS 64 +#define SCH_CRED_REVOCATION_CHECK_CHAIN_END_CERT 256 +#define SCH_CRED_REVOCATION_CHECK_CHAIN 512 #define SCH_CRED_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 1024 -#define SCH_CRED_IGNORE_NO_REVOCATION_CHECK 2048 -#define SCH_CRED_IGNORE_REVOCATION_OFFLINE 4096 -#define SCH_CRED_USE_DEFAULT_CREDS 64 +#define SCH_CRED_IGNORE_NO_REVOCATION_CHECK 2048 +#define SCH_CRED_IGNORE_REVOCATION_OFFLINE 4096 -typedef struct _SCHANNEL_CRED { - DWORD dwVersion; - DWORD cCreds; - PCCERT_CONTEXT* paCred; - HCERTSTORE hRootStore; - DWORD cMappers; - struct _HMAPPER** aphMappers; - DWORD cSupportedAlgs; - ALG_ID* palgSupportedAlgs; - DWORD grbitEnabledProtocols; - DWORD dwMinimumCypherStrength; - DWORD dwMaximumCypherStrength; - DWORD dwSessionLifespan; - DWORD dwFlags; - DWORD reserved; +#define SECPKG_ATTR_ISSUER_LIST 0x50 +#define SECPKG_ATTR_REMOTE_CRED 0x51 +#define SECPKG_ATTR_LOCAL_CRED 0x52 +#define SECPKG_ATTR_REMOTE_CERT_CONTEXT 0x53 +#define SECPKG_ATTR_LOCAL_CERT_CONTEXT 0x54 +#define SECPKG_ATTR_ROOT_STORE 0x55 +#define SECPKG_ATTR_SUPPORTED_ALGS 0x56 +#define SECPKG_ATTR_CIPHER_STRENGTHS 0x57 +#define SECPKG_ATTR_SUPPORTED_PROTOCOLS 0x58 +#define SECPKG_ATTR_ISSUER_LIST_EX 0x59 +#define SECPKG_ATTR_CONNECTION_INFO 0x5a +#define SECPKG_ATTR_EAP_KEY_BLOCK 0x5b +#define SECPKG_ATTR_MAPPED_CRED_ATTR 0x5c +#define SECPKG_ATTR_SESSION_INFO 0x5d +#define SECPKG_ATTR_APP_DATA 0x5e + +#define UNISP_RPC_ID 14 + +struct _HMAPPER; + +typedef struct _SCHANNEL_CRED +{ + DWORD dwVersion; + DWORD cCreds; + PCCERT_CONTEXT *paCred; + HCERTSTORE hRootStore; + DWORD cMappers; + struct _HMAPPER **aphMappers; + DWORD cSupportedAlgs; + ALG_ID *palgSupportedAlgs; + DWORD grbitEnabledProtocols; + DWORD dwMinimumCipherStrength; + DWORD dwMaximumCipherStrength; + DWORD dwSessionLength; + DWORD dwFlags; + DWORD reserved; } SCHANNEL_CRED, *PSCHANNEL_CRED; -typedef struct _SecPkgCred_SupportedAlgs { - DWORD cSupportedAlgs; - ALG_ID* palgSupportedAlgs; + +typedef struct _SecPkgCred_SupportedAlgs +{ + DWORD cSupportedAlgs; + ALG_ID *palgSupportedAlgs; } SecPkgCred_SupportedAlgs, *PSecPkgCred_SupportedAlgs; -typedef struct _SecPkgCred_CypherStrengths { - DWORD dwMinimumCypherStrength; - DWORD dwMaximumCypherStrength; -} SecPkgCred_CypherStrengths, *PSecPkgCred_CypherStrengths; -typedef struct _SecPkgCred_SupportedProtocols { - DWORD grbitProtocol; + +typedef struct _SecPkgCred_CipherStrengths +{ + DWORD dwMinimumCipherStrength; + DWORD dwMaximumCipherStrength; +} SecPkgCred_CipherStrengths, *PSecPkgCred_CipherStrengths; + +typedef struct _SecPkgCred_SupportedProtocols +{ + DWORD grbitProtocol; } SecPkgCred_SupportedProtocols, *PSecPkgCred_SupportedProtocols; -typedef struct _SecPkgContext_IssuerListInfoEx { - PCERT_NAME_BLOB aIssuers; - DWORD cIssuers; + +typedef struct _SecPkgContext_IssuerListInfoEx +{ + PCERT_NAME_BLOB aIssuers; + DWORD cIssuers; } SecPkgContext_IssuerListInfoEx, *PSecPkgContext_IssuerListInfoEx; -typedef struct _SecPkgContext_ConnectionInfo { - DWORD dwProtocol; - ALG_ID aiCipher; - DWORD dwCipherStrength; - ALG_ID aiHash; - DWORD dwHashStrength; - ALG_ID aiExch; - DWORD dwExchStrength; + +typedef struct _SecPkgContext_ConnectionInfo +{ + DWORD dwProtocol; + ALG_ID aiCipher; + DWORD dwCipherStrength; + ALG_ID aiHash; + DWORD dwHashStrength; + ALG_ID aiExch; + DWORD dwExchStrength; } SecPkgContext_ConnectionInfo, *PSecPkgContext_ConnectionInfo; #ifdef __cplusplus Modified: trunk/reactos/include/psdk/security.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/security.h?re…
============================================================================== --- trunk/reactos/include/psdk/security.h (original) +++ trunk/reactos/include/psdk/security.h Wed Oct 11 15:44:40 2006 @@ -4,37 +4,6 @@ #pragma GCC system_header #endif - -#define SEC_E_OK 0 -#define SEC_E_CERT_EXPIRED (-2146893016) -#define SEC_E_INCOMPLETE_MESSAGE (-2146893032) -#define SEC_E_INSUFFICIENT_MEMORY (-2146893056) -#define SEC_E_INTERNAL_ERROR (-2146893052) -#define SEC_E_INVALID_HANDLE (-2146893055) -#define SEC_E_INVALID_TOKEN (-2146893048) -#define SEC_E_LOGON_DENIED (-2146893044) -#define SEC_E_NO_AUTHENTICATING_AUTHORITY (-2146893039) -#define SEC_E_NO_CREDENTIALS (-2146893042) -#define SEC_E_TARGET_UNKNOWN (-2146893053) -#define SEC_E_UNSUPPORTED_FUNCTION (-2146893054) -#define SEC_E_UNTRUSTED_ROOT (-2146893019) -#define SEC_E_WRONG_PRINCIPAL (-2146893022) -#define SEC_E_SECPKG_NOT_FOUND (-2146893051) -#define SEC_E_QOP_NOT_SUPPORTED (-2146893046) -#define SEC_E_UNKNOWN_CREDENTIALS (-2146893043) -#define SEC_E_NOT_OWNER (-2146893050) -#define SEC_I_RENEGOTIATE 590625 -#define SEC_I_COMPLETE_AND_CONTINUE 590612 -#define SEC_I_COMPLETE_NEEDED 590611 -#define SEC_I_CONTINUE_NEEDED 590610 -#define SEC_I_INCOMPLETE_CREDENTIALS 590624 - -/* always a char */ -typedef char SEC_CHAR; -typedef wchar_t SEC_WCHAR; -typedef long SECURITY_STATUS; -#define SEC_FAR - #include <sspi.h> #include <ntsecpkg.h> #include <secext.h> Modified: trunk/reactos/include/psdk/winbase.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winbase.h?rev…
============================================================================== --- trunk/reactos/include/psdk/winbase.h (original) +++ trunk/reactos/include/psdk/winbase.h Wed Oct 11 15:44:40 2006 @@ -788,6 +788,9 @@ WORD wSecond; WORD wMilliseconds; } SYSTEMTIME,*LPSYSTEMTIME,*PSYSTEMTIME; +#if (_WIN32_WINNT >= 0x0500) +typedef WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACK ; +#endif typedef struct _WIN32_FILE_ATTRIBUTE_DATA { DWORD dwFileAttributes; FILETIME ftCreationTime; @@ -1144,6 +1147,9 @@ BOOL WINAPI Beep(DWORD,DWORD); HANDLE WINAPI BeginUpdateResourceA(LPCSTR,BOOL); HANDLE WINAPI BeginUpdateResourceW(LPCWSTR,BOOL); +#if (_WIN32_WINNT >= 0x0500) +BOOL WINAPI BindIoCompletionCallback(HANDLE,LPOVERLAPPED_COMPLETION_ROUTINE,ULONG); +#endif BOOL WINAPI BuildCommDCBA(LPCSTR,LPDCB); BOOL WINAPI BuildCommDCBW(LPCWSTR,LPDCB); BOOL WINAPI BuildCommDCBAndTimeoutsA(LPCSTR,LPDCB,LPCOMMTIMEOUTS); @@ -1837,6 +1843,9 @@ BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER); BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER); DWORD WINAPI QueueUserAPC(PAPCFUNC,HANDLE,DWORD); +#if (_WIN32_WINNT >= 0x0500) +BOOL WINAPI QueueUserWorkItem(LPTHREAD_START_ROUTINE,PVOID,ULONG); +#endif void WINAPI RaiseException(DWORD,DWORD,DWORD,const ULONG_PTR*); BOOL WINAPI ReadDirectoryChangesW(HANDLE,PVOID,DWORD,BOOL,DWORD,PDWORD,LPOVERLAPPED,LPOVERLAPPED_COMPLETION_ROUTINE); BOOL WINAPI ReadEventLogA(HANDLE,DWORD,DWORD,PVOID,DWORD,DWORD *,DWORD *); @@ -1853,6 +1862,10 @@ #endif HANDLE WINAPI RegisterEventSourceA (LPCSTR,LPCSTR); HANDLE WINAPI RegisterEventSourceW(LPCWSTR,LPCWSTR); +#if (_WIN32_WINNT >= 0x0500) +BOOL WINAPI RegisterWaitForSingleObject(PHANDLE,HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG); +HANDLE WINAPI RegisterWaitForSingleObjectEx(HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG); +#endif #if (_WIN32_WINNT >= 0x0501) void WINAPI ReleaseActCtx(HANDLE); #endif @@ -2007,6 +2020,7 @@ #define UnlockSegment(w) GlobalUnfix((HANDLE)(w)) /* Obsolete: Has no effect. */ BOOL WINAPI UnmapViewOfFile(PVOID); #if (_WIN32_WINNT >= 0x0500) +BOOL WINAPI UnregisterWait(HANDLE); BOOL WINAPI UnregisterWaitEx(HANDLE,HANDLE); #endif BOOL WINAPI UpdateResourceA(HANDLE,LPCSTR,LPCSTR,WORD,PVOID,DWORD); Modified: trunk/reactos/include/psdk/winerror.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winerror.h?re…
============================================================================== --- trunk/reactos/include/psdk/winerror.h (original) +++ trunk/reactos/include/psdk/winerror.h Wed Oct 11 15:44:40 2006 @@ -416,14 +416,31 @@ #define ERROR_PKINIT_FAILURE 1263L #define ERROR_SMARTCARD_SUBSYSTEM_FAILURE 1264L #define ERROR_DOWNGRADE_DETECTED 1265L -/* wrong: */ -#if 0 -#define SEC_E_SMARTCARD_CERT_REVOKED 1266L -#define SEC_E_ISSUING_CA_UNTRUSTED 1267L -#define SEC_E_REVOCATION_OFFLINE_C 1268L -#define SEC_E_PKINIT_CLIENT_FAILUR 1269L -#define SEC_E_SMARTCARD_CERT_EXPIRED 1270L -#endif + +#define SEC_E_OK 0 +#define SEC_E_CERT_EXPIRED (-2146893016) +#define SEC_E_INCOMPLETE_MESSAGE (-2146893032) +#define SEC_E_INSUFFICIENT_MEMORY (-2146893056) +#define SEC_E_INTERNAL_ERROR (-2146893052) +#define SEC_E_INVALID_HANDLE (-2146893055) +#define SEC_E_INVALID_TOKEN (-2146893048) +#define SEC_E_LOGON_DENIED (-2146893044) +#define SEC_E_NO_AUTHENTICATING_AUTHORITY (-2146893039) +#define SEC_E_NO_CREDENTIALS (-2146893042) +#define SEC_E_TARGET_UNKNOWN (-2146893053) +#define SEC_E_UNSUPPORTED_FUNCTION (-2146893054) +#define SEC_E_UNTRUSTED_ROOT (-2146893019) +#define SEC_E_WRONG_PRINCIPAL (-2146893022) +#define SEC_E_SECPKG_NOT_FOUND (-2146893051) +#define SEC_E_QOP_NOT_SUPPORTED (-2146893046) +#define SEC_E_UNKNOWN_CREDENTIALS (-2146893043) +#define SEC_E_NOT_OWNER (-2146893050) +#define SEC_I_RENEGOTIATE 590625 +#define SEC_I_COMPLETE_AND_CONTINUE 590612 +#define SEC_I_COMPLETE_NEEDED 590611 +#define SEC_I_CONTINUE_NEEDED 590610 +#define SEC_I_INCOMPLETE_CREDENTIALS 590624 + #define ERROR_MACHINE_LOCKED 1271L #define ERROR_CALLBACK_SUPPLIED_INVALID_DATA 1273L #define ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED 1274L @@ -1911,6 +1928,7 @@ #define CO_E_INIT_SCM_EXEC_FAILURE ((HRESULT)0x80004011L) #define CO_E_INIT_ONLY_SINGLE_THREADED ((HRESULT)0x80004012L) #define S_OK ((HRESULT)0x00000000L) +#define SEC_E_OK ((HRESULT)0x00000000L) #define S_FALSE ((HRESULT)0x00000001L) #define OLE_E_FIRST ((HRESULT)0x80040000L) #define OLE_E_LAST ((HRESULT)0x800400FFL) Modified: trunk/reactos/include/psdk/winsock2.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winsock2.h?re…
============================================================================== --- trunk/reactos/include/psdk/winsock2.h (original) +++ trunk/reactos/include/psdk/winsock2.h Wed Oct 11 15:44:40 2006 @@ -380,6 +380,7 @@ #define MSG_OOB 1 #define MSG_PEEK 2 #define MSG_DONTROUTE 4 +#define MSG_WAITALL 8 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */ #define MSG_MAXIOVLEN 16 #define MSG_PARTIAL 0x8000 Modified: trunk/reactos/include/psdk/ws2tcpip.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ws2tcpip.h?re…
============================================================================== --- trunk/reactos/include/psdk/ws2tcpip.h (original) +++ trunk/reactos/include/psdk/ws2tcpip.h Wed Oct 11 15:44:40 2006 @@ -292,8 +292,42 @@ int WSAAPI getaddrinfo (const char*,const char*,const struct addrinfo*, struct addrinfo**); -char* WSAAPI gai_strerrorA(int); -WCHAR* WSAAPI gai_strerrorW(int); +#define GAI_STRERROR_BUFFER_SIZE 1024 + +static __inline char* +gai_strerrorA(int ecode) +{ + static char buff[GAI_STRERROR_BUFFER_SIZE + 1]; + + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, + NULL, + ecode, + MAKELANGID(LANG_NEUTRAL, + SUBLANG_DEFAULT), + (LPSTR)buff, + GAI_STRERROR_BUFFER_SIZE, + NULL); + + return buff; +} + +static __inline WCHAR* +gai_strerrorW(int ecode) +{ + static WCHAR buff[GAI_STRERROR_BUFFER_SIZE + 1]; + + FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, + NULL, + ecode, + MAKELANGID(LANG_NEUTRAL, + SUBLANG_DEFAULT), + (LPWSTR)buff, + GAI_STRERROR_BUFFER_SIZE, + NULL); + + return buff; +} + #ifdef UNICODE #define gai_strerror gai_strerrorW #else Modified: trunk/reactos/include/reactos/wine/rpcfc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/rpcfc…
============================================================================== --- trunk/reactos/include/reactos/wine/rpcfc.h (original) +++ trunk/reactos/include/reactos/wine/rpcfc.h Wed Oct 11 15:44:40 2006 @@ -88,7 +88,13 @@ #define RPC_FC_ALIGNM4 0x38 #define RPC_FC_ALIGNM8 0x39 +#define RPC_FC_STRUCTPAD1 0x3d #define RPC_FC_STRUCTPAD2 0x3e +#define RPC_FC_STRUCTPAD3 0x3f +#define RPC_FC_STRUCTPAD4 0x40 +#define RPC_FC_STRUCTPAD5 0x41 +#define RPC_FC_STRUCTPAD6 0x42 +#define RPC_FC_STRUCTPAD7 0x43 #define RPC_FC_STRING_SIZED 0x44
17 years, 11 months
1
0
0
0
[weiden] 24484: Fix polling of ShutdownNotify
by weiden@svn.reactos.org
Author: weiden Date: Wed Oct 11 14:34:36 2006 New Revision: 24484 URL:
http://svn.reactos.org/svn/reactos?rev=24484&view=rev
Log: Fix polling of ShutdownNotify Modified: trunk/reactos/drivers/base/bootvid/bootvid.c Modified: trunk/reactos/drivers/base/bootvid/bootvid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/bootvid/bootv…
============================================================================== --- trunk/reactos/drivers/base/bootvid/bootvid.c (original) +++ trunk/reactos/drivers/base/bootvid/bootvid.c Wed Oct 11 14:34:36 2006 @@ -33,7 +33,7 @@ /* GLOBALS *******************************************************************/ -static LONG ShutdownNotify; +static volatile LONG ShutdownNotify; static KEVENT ShutdownCompleteEvent; /* DATA **********************************************************************/
17 years, 11 months
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
...
36
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Results per page:
10
25
50
100
200