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
2025
April
March
February
January
2024
December
November
October
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
July 2012
----- 2025 -----
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 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
14 participants
193 discussions
Start a n
N
ew thread
[ekohl] 56818: [SAMSRV] - Implement all cases of SamrQueryInformationDomain. - Store all fixed size domain attributes in the registry value "F". - Initialize all domain attribute in SampCreateDomain.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jul 1 16:51:10 2012 New Revision: 56818 URL:
http://svn.reactos.org/svn/reactos?rev=56818&view=rev
Log: [SAMSRV] - Implement all cases of SamrQueryInformationDomain. - Store all fixed size domain attributes in the registry value "F". - Initialize all domain attribute in SampCreateDomain. Modified: trunk/reactos/dll/win32/samsrv/samrpc.c trunk/reactos/dll/win32/samsrv/samsrv.h trunk/reactos/dll/win32/samsrv/setup.c trunk/reactos/include/ddk/ntsam.h trunk/reactos/include/reactos/idl/sam.idl Modified: trunk/reactos/dll/win32/samsrv/samrpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samrpc.c?…
============================================================================== --- trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] Sun Jul 1 16:51:10 2012 @@ -540,6 +540,290 @@ static NTSTATUS +SampQueryDomainPassword(PSAM_DB_OBJECT DomainObject, + PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL; + SAM_DOMAIN_FIXED_DATA FixedData; + ULONG Length = 0; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Length = sizeof(SAM_DOMAIN_FIXED_DATA); + Status = SampGetObjectAttribute(DomainObject, + L"F", + NULL, + (PVOID)&FixedData, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->Password.MinPasswordLength = FixedData.MinPasswordLength; + InfoBuffer->Password.PasswordHistoryLength = FixedData.PasswordHistoryLength; + InfoBuffer->Password.PasswordProperties = FixedData.PasswordProperties; + InfoBuffer->Password.MaxPasswordAge.LowPart = FixedData.MaxPasswordAge.LowPart; + InfoBuffer->Password.MaxPasswordAge.HighPart = FixedData.MaxPasswordAge.HighPart; + InfoBuffer->Password.MinPasswordAge.LowPart = FixedData.MinPasswordAge.LowPart; + InfoBuffer->Password.MinPasswordAge.HighPart = FixedData.MinPasswordAge.HighPart; + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + +static NTSTATUS +SampQueryDomainGeneral(PSAM_DB_OBJECT DomainObject, + PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL; + SAM_DOMAIN_FIXED_DATA FixedData; + ULONG Length = 0; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Length = sizeof(SAM_DOMAIN_FIXED_DATA); + Status = SampGetObjectAttribute(DomainObject, + L"F", + NULL, + (PVOID)&FixedData, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->General.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart; + InfoBuffer->General.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart; + InfoBuffer->General.DomainModifiedCount.LowPart = FixedData.DomainModifiedCount.LowPart; + InfoBuffer->General.DomainModifiedCount.HighPart = FixedData.DomainModifiedCount.HighPart; + InfoBuffer->General.DomainServerState = FixedData.DomainServerState; + InfoBuffer->General.DomainServerRole = FixedData.DomainServerRole; + InfoBuffer->General.UasCompatibilityRequired = FixedData.UasCompatibilityRequired; + + Length = 0; + Status = SampGetObjectAttribute(DomainObject, + L"OemInformation", + NULL, + NULL, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->General.OemInformation.Length = Length - sizeof(WCHAR); + InfoBuffer->General.OemInformation.MaximumLength = Length; + InfoBuffer->General.OemInformation.Buffer = midl_user_allocate(Length); + if (InfoBuffer->General.OemInformation.Buffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(DomainObject, + L"OemInformation", + NULL, + (PVOID)InfoBuffer->General.OemInformation.Buffer, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + Length = 0; + Status = SampGetObjectAttribute(DomainObject, + L"Name", + NULL, + NULL, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->General.DomainName.Length = Length - sizeof(WCHAR); + InfoBuffer->General.DomainName.MaximumLength = Length; + InfoBuffer->General.DomainName.Buffer = midl_user_allocate(Length); + if (InfoBuffer->General.DomainName.Buffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(DomainObject, + L"Name", + NULL, + (PVOID)InfoBuffer->General.DomainName.Buffer, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + Length = 0; + Status = SampGetObjectAttribute(DomainObject, + L"ReplicaSourceNodeName", + NULL, + NULL, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->General.ReplicaSourceNodeName.Length = Length - sizeof(WCHAR); + InfoBuffer->General.ReplicaSourceNodeName.MaximumLength = Length; + InfoBuffer->General.ReplicaSourceNodeName.Buffer = midl_user_allocate(Length); + if (InfoBuffer->General.ReplicaSourceNodeName.Buffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(DomainObject, + L"ReplicaSourceNodeName", + NULL, + (PVOID)InfoBuffer->General.ReplicaSourceNodeName.Buffer, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->General.UserCount = 0; /* FIXME */ + InfoBuffer->General.GroupCount = 0; /* FIXME */ + InfoBuffer->General.AliasCount = 0; /* FIXME */ + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + if (InfoBuffer->General.OemInformation.Buffer != NULL) + midl_user_free(InfoBuffer->General.OemInformation.Buffer); + + if (InfoBuffer->General.DomainName.Buffer != NULL) + midl_user_free(InfoBuffer->General.DomainName.Buffer); + + if (InfoBuffer->General.ReplicaSourceNodeName.Buffer != NULL) + midl_user_free(InfoBuffer->General.ReplicaSourceNodeName.Buffer); + + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + +static NTSTATUS +SampQueryDomainLogoff(PSAM_DB_OBJECT DomainObject, + PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL; + SAM_DOMAIN_FIXED_DATA FixedData; + ULONG Length = 0; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Length = sizeof(SAM_DOMAIN_FIXED_DATA); + Status = SampGetObjectAttribute(DomainObject, + L"F", + NULL, + (PVOID)&FixedData, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->Logoff.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart; + InfoBuffer->Logoff.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart; + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + +static NTSTATUS +SampQueryDomainOem(PSAM_DB_OBJECT DomainObject, + PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL; + ULONG Length = 0; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Status = SampGetObjectAttribute(DomainObject, + L"OemInformation", + NULL, + NULL, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->Oem.OemInformation.Length = Length - sizeof(WCHAR); + InfoBuffer->Oem.OemInformation.MaximumLength = Length; + InfoBuffer->Oem.OemInformation.Buffer = midl_user_allocate(Length); + if (InfoBuffer->Oem.OemInformation.Buffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(DomainObject, + L"OemInformation", + NULL, + (PVOID)InfoBuffer->Oem.OemInformation.Buffer, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + if (InfoBuffer->Oem.OemInformation.Buffer != NULL) + midl_user_free(InfoBuffer->Oem.OemInformation.Buffer); + + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + +static NTSTATUS SampQueryDomainName(PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer) { @@ -596,6 +880,420 @@ } +static NTSTATUS +SampQueryDomainReplication(PSAM_DB_OBJECT DomainObject, + PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL; + ULONG Length = 0; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Status = SampGetObjectAttribute(DomainObject, + L"ReplicaSourceNodeName", + NULL, + NULL, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->Replication.ReplicaSourceNodeName.Length = Length - sizeof(WCHAR); + InfoBuffer->Replication.ReplicaSourceNodeName.MaximumLength = Length; + InfoBuffer->Replication.ReplicaSourceNodeName.Buffer = midl_user_allocate(Length); + if (InfoBuffer->Replication.ReplicaSourceNodeName.Buffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(DomainObject, + L"ReplicaSourceNodeName", + NULL, + (PVOID)InfoBuffer->Replication.ReplicaSourceNodeName.Buffer, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + if (InfoBuffer->Replication.ReplicaSourceNodeName.Buffer != NULL) + midl_user_free(InfoBuffer->Replication.ReplicaSourceNodeName.Buffer); + + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + +static NTSTATUS +SampQueryDomainServerRole(PSAM_DB_OBJECT DomainObject, + PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL; + SAM_DOMAIN_FIXED_DATA FixedData; + ULONG Length = 0; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Length = sizeof(SAM_DOMAIN_FIXED_DATA); + Status = SampGetObjectAttribute(DomainObject, + L"F", + NULL, + (PVOID)&FixedData, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->Role.DomainServerRole = FixedData.DomainServerRole; + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + +static NTSTATUS +SampQueryDomainModified(PSAM_DB_OBJECT DomainObject, + PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL; + SAM_DOMAIN_FIXED_DATA FixedData; + ULONG Length = 0; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Length = sizeof(SAM_DOMAIN_FIXED_DATA); + Status = SampGetObjectAttribute(DomainObject, + L"F", + NULL, + (PVOID)&FixedData, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->Modified.DomainModifiedCount.LowPart = FixedData.DomainModifiedCount.LowPart; + InfoBuffer->Modified.DomainModifiedCount.HighPart = FixedData.DomainModifiedCount.HighPart; + InfoBuffer->Modified.CreationTime.LowPart = FixedData.CreationTime.LowPart; + InfoBuffer->Modified.CreationTime.HighPart = FixedData.CreationTime.HighPart; + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + +static NTSTATUS +SampQueryDomainState(PSAM_DB_OBJECT DomainObject, + PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL; + SAM_DOMAIN_FIXED_DATA FixedData; + ULONG Length = 0; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Length = sizeof(SAM_DOMAIN_FIXED_DATA); + Status = SampGetObjectAttribute(DomainObject, + L"F", + NULL, + (PVOID)&FixedData, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->State.DomainServerState = FixedData.DomainServerState; + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + +static NTSTATUS +SampQueryDomainGeneral2(PSAM_DB_OBJECT DomainObject, + PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL; + SAM_DOMAIN_FIXED_DATA FixedData; + ULONG Length = 0; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Length = sizeof(SAM_DOMAIN_FIXED_DATA); + Status = SampGetObjectAttribute(DomainObject, + L"F", + NULL, + (PVOID)&FixedData, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->General2.I1.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart; + InfoBuffer->General2.I1.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart; + InfoBuffer->General2.I1.DomainModifiedCount.LowPart = FixedData.DomainModifiedCount.LowPart; + InfoBuffer->General2.I1.DomainModifiedCount.HighPart = FixedData.DomainModifiedCount.HighPart; + InfoBuffer->General2.I1.DomainServerState = FixedData.DomainServerState; + InfoBuffer->General2.I1.DomainServerRole = FixedData.DomainServerRole; + InfoBuffer->General2.I1.UasCompatibilityRequired = FixedData.UasCompatibilityRequired; + + InfoBuffer->General2.LockoutDuration = FixedData.LockoutDuration; + InfoBuffer->General2.LockoutObservationWindow = FixedData.LockoutObservationWindow; + InfoBuffer->General2.LockoutThreshold = FixedData.LockoutThreshold; + + Length = 0; + Status = SampGetObjectAttribute(DomainObject, + L"OemInformation", + NULL, + NULL, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->General2.I1.OemInformation.Length = Length - sizeof(WCHAR); + InfoBuffer->General2.I1.OemInformation.MaximumLength = Length; + InfoBuffer->General2.I1.OemInformation.Buffer = midl_user_allocate(Length); + if (InfoBuffer->General2.I1.OemInformation.Buffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(DomainObject, + L"OemInformation", + NULL, + (PVOID)InfoBuffer->General2.I1.OemInformation.Buffer, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + Length = 0; + Status = SampGetObjectAttribute(DomainObject, + L"Name", + NULL, + NULL, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->General2.I1.DomainName.Length = Length - sizeof(WCHAR); + InfoBuffer->General2.I1.DomainName.MaximumLength = Length; + InfoBuffer->General2.I1.DomainName.Buffer = midl_user_allocate(Length); + if (InfoBuffer->General2.I1.DomainName.Buffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(DomainObject, + L"Name", + NULL, + (PVOID)InfoBuffer->General2.I1.DomainName.Buffer, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + Length = 0; + Status = SampGetObjectAttribute(DomainObject, + L"ReplicaSourceNodeName", + NULL, + NULL, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->General2.I1.ReplicaSourceNodeName.Length = Length - sizeof(WCHAR); + InfoBuffer->General2.I1.ReplicaSourceNodeName.MaximumLength = Length; + InfoBuffer->General2.I1.ReplicaSourceNodeName.Buffer = midl_user_allocate(Length); + if (InfoBuffer->General2.I1.ReplicaSourceNodeName.Buffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(DomainObject, + L"ReplicaSourceNodeName", + NULL, + (PVOID)InfoBuffer->General2.I1.ReplicaSourceNodeName.Buffer, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->General2.I1.UserCount = 0; /* FIXME */ + InfoBuffer->General2.I1.GroupCount = 0; /* FIXME */ + InfoBuffer->General2.I1.AliasCount = 0; /* FIXME */ + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + if (InfoBuffer->General2.I1.OemInformation.Buffer != NULL) + midl_user_free(InfoBuffer->General2.I1.OemInformation.Buffer); + + if (InfoBuffer->General2.I1.DomainName.Buffer != NULL) + midl_user_free(InfoBuffer->General2.I1.DomainName.Buffer); + + if (InfoBuffer->General2.I1.ReplicaSourceNodeName.Buffer != NULL) + midl_user_free(InfoBuffer->General2.I1.ReplicaSourceNodeName.Buffer); + + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + +static NTSTATUS +SampQueryDomainLockout(PSAM_DB_OBJECT DomainObject, + PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL; + SAM_DOMAIN_FIXED_DATA FixedData; + ULONG Length = 0; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Length = sizeof(SAM_DOMAIN_FIXED_DATA); + Status = SampGetObjectAttribute(DomainObject, + L"F", + NULL, + (PVOID)&FixedData, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->Lockout.LockoutDuration = FixedData.LockoutDuration; + InfoBuffer->Lockout.LockoutObservationWindow = FixedData.LockoutObservationWindow; + InfoBuffer->Lockout.LockoutThreshold = FixedData.LockoutThreshold; + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + +static NTSTATUS +SampQueryDomainModified2(PSAM_DB_OBJECT DomainObject, + PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL; + SAM_DOMAIN_FIXED_DATA FixedData; + ULONG Length = 0; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Length = sizeof(SAM_DOMAIN_FIXED_DATA); + Status = SampGetObjectAttribute(DomainObject, + L"F", + NULL, + (PVOID)&FixedData, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + InfoBuffer->Modified2.DomainModifiedCount.LowPart = FixedData.DomainModifiedCount.LowPart; + InfoBuffer->Modified2.DomainModifiedCount.HighPart = FixedData.DomainModifiedCount.HighPart; + InfoBuffer->Modified2.CreationTime.LowPart = FixedData.CreationTime.LowPart; + InfoBuffer->Modified2.CreationTime.HighPart = FixedData.CreationTime.HighPart; + InfoBuffer->Modified2.ModifiedCountAtLastPromotion.LowPart = FixedData.ModifiedCountAtLastPromotion.LowPart; + InfoBuffer->Modified2.ModifiedCountAtLastPromotion.HighPart = FixedData.ModifiedCountAtLastPromotion.HighPart; + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + /* Function 8 */ NTSTATUS NTAPI @@ -604,44 +1302,113 @@ OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer) { PSAM_DB_OBJECT DomainObject; + ACCESS_MASK DesiredAccess; NTSTATUS Status; TRACE("SamrQueryInformationDomain(%p %lu %p)\n", DomainHandle, DomainInformationClass, Buffer); + + switch (DomainInformationClass) + { + case DomainPasswordInformation: + case DomainLockoutInformation: + DesiredAccess = DOMAIN_READ_PASSWORD_PARAMETERS; + break; + + case DomainGeneralInformation: + case DomainLogoffInformation: + case DomainOemInformation: + case DomainNameInformation: + case DomainReplicationInformation: + case DomainServerRoleInformation: + case DomainModifiedInformation: + case DomainStateInformation: + case DomainModifiedInformation2: + DesiredAccess = DOMAIN_READ_OTHER_PARAMETERS; + break; + + case DomainGeneralInformation2: + DesiredAccess = DOMAIN_READ_PASSWORD_PARAMETERS | + DOMAIN_READ_OTHER_PARAMETERS; + break; + + default: + return STATUS_INVALID_INFO_CLASS; + } /* Validate the server handle */ Status = SampValidateDbObject(DomainHandle, SamDbDomainObject, - DOMAIN_READ_OTHER_PARAMETERS, + DesiredAccess, &DomainObject); if (!NT_SUCCESS(Status)) return Status; switch (DomainInformationClass) { + case DomainPasswordInformation: + Status = SampQueryDomainPassword(DomainObject, + Buffer); + break; + + case DomainGeneralInformation: + Status = SampQueryDomainGeneral(DomainObject, + Buffer); + break; + + case DomainLogoffInformation: + Status = SampQueryDomainLogoff(DomainObject, + Buffer); + break; + + case DomainOemInformation: + Status = SampQueryDomainOem(DomainObject, + Buffer); + break; + case DomainNameInformation: Status = SampQueryDomainName(DomainObject, Buffer); break; + case DomainReplicationInformation: + Status = SampQueryDomainReplication(DomainObject, + Buffer); + break; + + case DomainServerRoleInformation: + Status = SampQueryDomainServerRole(DomainObject, + Buffer); + break; + + case DomainModifiedInformation: + Status = SampQueryDomainModified(DomainObject, + Buffer); + break; + + case DomainStateInformation: + Status = SampQueryDomainState(DomainObject, + Buffer); + break; + + case DomainGeneralInformation2: + Status = SampQueryDomainGeneral2(DomainObject, + Buffer); + break; + + case DomainLockoutInformation: + Status = SampQueryDomainLockout(DomainObject, + Buffer); + break; + + case DomainModifiedInformation2: + Status = SampQueryDomainModified2(DomainObject, + Buffer); + break; + default: Status = STATUS_NOT_IMPLEMENTED; } - - return Status; -} - -static NTSTATUS -SampSetDomainName(PSAM_DB_OBJECT DomainObject, - PSAMPR_DOMAIN_NAME_INFORMATION DomainNameInfo) -{ - NTSTATUS Status; - - Status = SampSetObjectAttribute(DomainObject, - L"Name", - REG_SZ, - DomainNameInfo->DomainName.Buffer, - DomainNameInfo->DomainName.Length + sizeof(WCHAR)); return Status; } @@ -654,24 +1421,82 @@ IN PSAMPR_DOMAIN_INFO_BUFFER DomainInformation) { PSAM_DB_OBJECT DomainObject; + ACCESS_MASK DesiredAccess; NTSTATUS Status; TRACE("SamrSetInformationDomain(%p %lu %p)\n", DomainHandle, DomainInformationClass, DomainInformation); + + switch (DomainInformationClass) + { + case DomainPasswordInformation: + case DomainLockoutInformation: + DesiredAccess = DOMAIN_WRITE_PASSWORD_PARAMS; + break; + + case DomainLogoffInformation: + case DomainOemInformation: + case DomainNameInformation: + DesiredAccess = DOMAIN_WRITE_OTHER_PARAMETERS; + break; + + case DomainReplicationInformation: + case DomainServerRoleInformation: + case DomainStateInformation: + DesiredAccess = DOMAIN_ADMINISTER_SERVER; + break; + + default: + return STATUS_INVALID_INFO_CLASS; + } /* Validate the server handle */ Status = SampValidateDbObject(DomainHandle, SamDbDomainObject, - DOMAIN_WRITE_OTHER_PARAMETERS, + DesiredAccess, &DomainObject); if (!NT_SUCCESS(Status)) return Status; switch (DomainInformationClass) { + case DomainPasswordInformation: + break; + + case DomainLogoffInformation: + break; + + case DomainOemInformation: + Status = SampSetObjectAttribute(DomainObject, + L"OemInformation", + REG_SZ, + DomainInformation->Oem.OemInformation.Buffer, + DomainInformation->Oem.OemInformation.Length + sizeof(WCHAR)); + break; + case DomainNameInformation: - Status = SampSetDomainName(DomainObject, - &DomainInformation->Name); + Status = SampSetObjectAttribute(DomainObject, + L"Name", + REG_SZ, + DomainInformation->Name.DomainName.Buffer, + DomainInformation->Name.DomainName.Length + sizeof(WCHAR)); + break; + + case DomainReplicationInformation: + Status = SampSetObjectAttribute(DomainObject, + L"ReplicaSourceNodeName", + REG_SZ, + DomainInformation->Replication.ReplicaSourceNodeName.Buffer, + DomainInformation->Replication.ReplicaSourceNodeName.Length + sizeof(WCHAR)); + break; + + case DomainServerRoleInformation: + break; + + case DomainStateInformation: + break; + + case DomainLockoutInformation: break; default: @@ -1800,37 +2625,6 @@ return Status; } - -static NTSTATUS -SampSetAliasName(PSAM_DB_OBJECT AliasObject, - PSAMPR_ALIAS_INFO_BUFFER Buffer) -{ - NTSTATUS Status; - - Status = SampSetObjectAttribute(AliasObject, - L"Name", - REG_SZ, - Buffer->Name.Name.Buffer, - Buffer->Name.Name.Length + sizeof(WCHAR)); - - return Status; -} - -static NTSTATUS -SampSetAliasAdminComment(PSAM_DB_OBJECT AliasObject, - PSAMPR_ALIAS_INFO_BUFFER Buffer) -{ - NTSTATUS Status; - - Status = SampSetObjectAttribute(AliasObject, - L"Description", - REG_SZ, - Buffer->AdminComment.AdminComment.Buffer, - Buffer->AdminComment.AdminComment.Length + sizeof(WCHAR)); - - return Status; -} - /* Function 29 */ NTSTATUS NTAPI @@ -1855,13 +2649,19 @@ switch (AliasInformationClass) { case AliasNameInformation: - Status = SampSetAliasName(AliasObject, - Buffer); + Status = SampSetObjectAttribute(AliasObject, + L"Name", + REG_SZ, + Buffer->Name.Name.Buffer, + Buffer->Name.Name.Length + sizeof(WCHAR)); break; case AliasAdminCommentInformation: - Status = SampSetAliasAdminComment(AliasObject, - Buffer); + Status = SampSetObjectAttribute(AliasObject, + L"Description", + REG_SZ, + Buffer->AdminComment.AdminComment.Buffer, + Buffer->AdminComment.AdminComment.Length + sizeof(WCHAR)); break; default: @@ -2166,6 +2966,15 @@ return STATUS_NOT_IMPLEMENTED; } +static +NTSTATUS +SampQueryUserName(PSAM_DB_OBJECT UserObject, + PSAMPR_USER_INFO_BUFFER *Buffer) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + /* Function 36 */ NTSTATUS NTAPI @@ -2173,8 +2982,52 @@ IN USER_INFORMATION_CLASS UserInformationClass, OUT PSAMPR_USER_INFO_BUFFER *Buffer) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + PSAM_DB_OBJECT UserObject; + ACCESS_MASK DesiredAccess; + NTSTATUS Status; + + TRACE("SamrQueryInformationUser(%p %lu %p)\n", + UserHandle, UserInformationClass, Buffer); + + switch (UserInformationClass) + { + case UserGeneralInformation: + case UserNameInformation: + case UserAccountNameInformation: + case UserFullNameInformation: + case UserPrimaryGroupInformation: + case UserAdminCommentInformation: + DesiredAccess = USER_READ_GENERAL; + break; + + + default: + return STATUS_INVALID_INFO_CLASS; + } + + /* Validate the domain handle */ + Status = SampValidateDbObject(UserHandle, + SamDbUserObject, + DesiredAccess, + &UserObject); + if (!NT_SUCCESS(Status)) + { + TRACE("failed with status 0x%08lx\n", Status); + return Status; + } + + switch (UserInformationClass) + { + case UserNameInformation: + Status = SampQueryUserName(UserObject, + Buffer); + break; + + default: + Status = STATUS_INVALID_INFO_CLASS; + } + + return Status; } /* Function 37 */ Modified: trunk/reactos/dll/win32/samsrv/samsrv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samsrv.h?…
============================================================================== --- trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] Sun Jul 1 16:51:10 2012 @@ -12,6 +12,7 @@ #include <windows.h> #define NTOS_MODE_USER #include <ndk/cmfuncs.h> +#include <ndk/kefuncs.h> #include <ndk/obfuncs.h> #include <ndk/rtlfuncs.h> #include <ndk/umtypes.h> @@ -49,6 +50,28 @@ } SAM_DB_OBJECT, *PSAM_DB_OBJECT; #define SAMP_DB_SIGNATURE 0x87654321 + +typedef struct _SAM_DOMAIN_FIXED_DATA +{ + ULONG Version; + ULONG Reserved; + LARGE_INTEGER CreationTime; + LARGE_INTEGER DomainModifiedCount; + LARGE_INTEGER MaxPasswordAge; + LARGE_INTEGER MinPasswordAge; + LARGE_INTEGER ForceLogoff; + LARGE_INTEGER LockoutDuration; + LARGE_INTEGER LockoutObservationWindow; + LARGE_INTEGER ModifiedCountAtLastPromotion; + ULONG NextRid; + ULONG PasswordProperties; + USHORT MinPasswordLength; + USHORT PasswordHistoryLength; + USHORT LockoutThreshold; + DOMAIN_SERVER_ENABLE_STATE DomainServerState; + DOMAIN_SERVER_ROLE DomainServerRole; + BOOLEAN UasCompatibilityRequired; +} SAM_DOMAIN_FIXED_DATA, *PSAM_DOMAIN_FIXED_DATA; /* database.c */ Modified: trunk/reactos/dll/win32/samsrv/setup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/setup.c?r…
============================================================================== --- trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] Sun Jul 1 16:51:10 2012 @@ -277,6 +277,8 @@ IN PSID lpDomainSid, OUT PHKEY lpDomainKey) { + SAM_DOMAIN_FIXED_DATA FixedData; + LPWSTR lpEmptyString = L""; DWORD dwDisposition; HKEY hDomainKey = NULL; HKEY hAliasesKey = NULL; @@ -286,6 +288,26 @@ if (lpDomainKey != NULL) *lpDomainKey = NULL; + + /* Initialize the fixed domain data */ + memset(&FixedData, 0, sizeof(SAM_DOMAIN_FIXED_DATA)); + FixedData.Version = 1; + NtQuerySystemTime(&FixedData.CreationTime); + FixedData.DomainModifiedCount.QuadPart = 0; +// FixedData.MaxPasswordAge // 6 Weeks + FixedData.MinPasswordAge.QuadPart = 0; // Now +// FixedData.ForceLogoff +// FixedData.LockoutDuration // 30 minutes +// FixedData.LockoutObservationWindow // 30 minutes + FixedData.ModifiedCountAtLastPromotion.QuadPart = 0; + FixedData.NextRid = 1000; + FixedData.PasswordProperties = 0; + FixedData.MinPasswordLength = 0; + FixedData.PasswordHistoryLength = 0; + FixedData.LockoutThreshold = 0; + FixedData.DomainServerState = DomainServerEnabled; + FixedData.DomainServerRole = DomainServerRolePrimary; + FixedData.UasCompatibilityRequired = TRUE; if (RegCreateKeyExW(hDomainsKey, lpKeyName, @@ -298,6 +320,15 @@ &dwDisposition)) return FALSE; + /* Set the fixed data value */ + if (RegSetValueEx(hDomainKey, + L"F", + 0, + REG_BINARY, + (LPVOID)&FixedData, + sizeof(SAM_DOMAIN_FIXED_DATA))) + return FALSE; + if (lpDomainSid != NULL) { RegSetValueEx(hDomainKey, @@ -314,6 +345,20 @@ (LPVOID)lpDomainSid, RtlLengthSid(lpDomainSid)); } + + RegSetValueEx(hDomainKey, + L"OemInformation", + 0, + REG_SZ, + (LPVOID)lpEmptyString, + sizeof(WCHAR)); + + RegSetValueEx(hDomainKey, + L"ReplicaSourceNodeName", + 0, + REG_SZ, + (LPVOID)lpEmptyString, + sizeof(WCHAR)); /* Create the Alias container */ if (!RegCreateKeyExW(hDomainKey, @@ -507,22 +552,22 @@ { SampCreateAliasAccount(hDomainKey, L"Administrators", - L"", + L"Testabc1234567890", DOMAIN_ALIAS_RID_ADMINS); SampCreateAliasAccount(hDomainKey, L"Users", - L"", + L"Users Group", DOMAIN_ALIAS_RID_USERS); SampCreateAliasAccount(hDomainKey, L"Guests", - L"", + L"Guests Group", DOMAIN_ALIAS_RID_GUESTS); SampCreateAliasAccount(hDomainKey, L"Power Users", - L"", + L"Power Users Group", DOMAIN_ALIAS_RID_POWER_USERS); Modified: trunk/reactos/include/ddk/ntsam.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ntsam.h?rev=56…
============================================================================== --- trunk/reactos/include/ddk/ntsam.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/ntsam.h [iso-8859-1] Sun Jul 1 16:51:10 2012 @@ -219,6 +219,18 @@ DomainLockoutInformation, DomainModifiedInformation2 } DOMAIN_INFORMATION_CLASS; + +typedef enum _DOMAIN_SERVER_ENABLE_STATE +{ + DomainServerEnabled = 1, + DomainServerDisabled +} DOMAIN_SERVER_ENABLE_STATE, *PDOMAIN_SERVER_ENABLE_STATE; + +typedef enum _DOMAIN_SERVER_ROLE +{ + DomainServerRoleBackup = 2, + DomainServerRolePrimary +} DOMAIN_SERVER_ROLE, *PDOMAIN_SERVER_ROLE; typedef struct _DOMAIN_NAME_INFORMATION { @@ -386,6 +398,11 @@ NTSTATUS NTAPI +SamRemoveMemberFromAlias(IN SAM_HANDLE AliasHandle, + IN PSID MemberId); + +NTSTATUS +NTAPI SamSetInformationAlias(IN SAM_HANDLE AliasHandle, IN ALIAS_INFORMATION_CLASS AliasInformationClass, IN PVOID Buffer); Modified: trunk/reactos/include/reactos/idl/sam.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/idl/sam.id…
============================================================================== --- trunk/reactos/include/reactos/idl/sam.idl [iso-8859-1] (original) +++ trunk/reactos/include/reactos/idl/sam.idl [iso-8859-1] Sun Jul 1 16:51:10 2012 @@ -135,22 +135,26 @@ unsigned long PasswordProperties; } USER_DOMAIN_PASSWORD_INFORMATION, *PUSER_DOMAIN_PASSWORD_INFORMATION; +cpp_quote("#ifndef _NTSAM_") typedef enum _DOMAIN_SERVER_ENABLE_STATE { DomainServerEnabled = 1, DomainServerDisabled } DOMAIN_SERVER_ENABLE_STATE, *PDOMAIN_SERVER_ENABLE_STATE; +cpp_quote("#endif") typedef struct _DOMAIN_STATE_INFORMATION { DOMAIN_SERVER_ENABLE_STATE DomainServerState; } DOMAIN_STATE_INFORMATION, *PDOMAIN_STATE_INFORMATION; +cpp_quote("#ifndef _NTSAM_") typedef enum _DOMAIN_SERVER_ROLE { DomainServerRoleBackup = 2, DomainServerRolePrimary = 3 } DOMAIN_SERVER_ROLE, *PDOMAIN_SERVER_ROLE; +cpp_quote("#endif") cpp_quote("#ifndef _NTSECAPI_H") typedef struct _DOMAIN_PASSWORD_INFORMATION
12 years, 9 months
1
0
0
0
[ekohl] 56817: [USETUP] Fix a little layout issue.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jul 1 15:55:14 2012 New Revision: 56817 URL:
http://svn.reactos.org/svn/reactos?rev=56817&view=rev
Log: [USETUP] Fix a little layout issue. Modified: trunk/reactos/base/setup/usetup/lang/de-DE.h Modified: trunk/reactos/base/setup/usetup/lang/de-DE.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/lang/de-…
============================================================================== --- trunk/reactos/base/setup/usetup/lang/de-DE.h [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/lang/de-DE.h [iso-8859-1] Sun Jul 1 15:55:14 2012 @@ -28,7 +28,7 @@ TEXT_STYLE_NORMAL }, { - 8, + 11, 11, "wollen. Dann drcken Sie ENTER.", TEXT_STYLE_NORMAL
12 years, 9 months
1
0
0
0
[tkreuzer] 56816: [WIN32K] - Implement SURFACE_vSetPalette and use it everywhere to set the palette for a surface. Make SURFACE::ppal const, so noone accidentally modifies it without properly handl...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Jul 1 13:43:33 2012 New Revision: 56816 URL:
http://svn.reactos.org/svn/reactos?rev=56816&view=rev
Log: [WIN32K] - Implement SURFACE_vSetPalette and use it everywhere to set the palette for a surface. Make SURFACE::ppal const, so noone accidentally modifies it without properly handling the references. Modified: trunk/reactos/win32ss/gdi/eng/surface.c trunk/reactos/win32ss/gdi/eng/surface.h trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c trunk/reactos/win32ss/gdi/ntgdi/dibobj.c Modified: trunk/reactos/win32ss/gdi/eng/surface.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/surface.c?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/surface.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/surface.c [iso-8859-1] Sun Jul 1 13:43:33 2012 @@ -267,8 +267,7 @@ } /* Assign a default palette and increment its reference count */ - psurf->ppal = appalSurfaceDefault[iFormat]; - GDIOBJ_vReferenceObjectByPointer(&psurf->ppal->BaseObject); + SURFACE_vSetPalette(psurf, appalSurfaceDefault[iFormat]); return psurf; } @@ -399,6 +398,7 @@ SURFOBJ *pso; PSURFACE psurf; PDEVOBJ* ppdev; + PPALETTE ppal; ppdev = (PDEVOBJ*)hdev; @@ -418,8 +418,10 @@ psurf->flags &= ~HOOK_FLAGS; psurf->flags |= (flHooks & HOOK_FLAGS); - /* Get palette */ - psurf->ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault); + /* Assign the PDEV's palette */ + ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault); + SURFACE_vSetPalette(psurf, ppal); + PALETTE_ShareUnlockPalette(ppal); SURFACE_ShareUnlockSurface(psurf); @@ -441,6 +443,7 @@ SURFOBJ *pso; PSURFACE psurf; PDEVOBJ* ppdev; + PPALETTE ppal; psurf = SURFACE_ShareLockSurface(hsurf); if (psurf == NULL) @@ -462,8 +465,10 @@ psurf->flags &= ~HOOK_FLAGS; psurf->flags |= (flHooks & HOOK_FLAGS); - /* Get palette */ - psurf->ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault); + /* Assign the PDEV's palette */ + ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault); + SURFACE_vSetPalette(psurf, ppal); + PALETTE_ShareUnlockPalette(ppal); SURFACE_ShareUnlockSurface(psurf); Modified: trunk/reactos/win32ss/gdi/eng/surface.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/surface.h?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/surface.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/surface.h [iso-8859-1] Sun Jul 1 13:43:33 2012 @@ -10,7 +10,7 @@ SURFOBJ SurfObj; //XDCOBJ * pdcoAA; FLONG flags; - struct _PALETTE *ppal; + struct _PALETTE * const ppal; // Use SURFACE_vSetPalette to assign a palette //UINT unk_050; union @@ -123,3 +123,17 @@ _In_ ULONG fjBitmap, _In_opt_ ULONG cjWidth, _In_opt_ PVOID pvBits); + +VOID +FORCEINLINE +SURFACE_vSetPalette( + _Inout_ PSURFACE psurf, + _In_ PPALETTE ppal) +{ + if (psurf->ppal) + GDIOBJ_vDereferenceObject((POBJ)psurf->ppal); + if (ppal) + GDIOBJ_vReferenceObjectByPointer((POBJ)ppal); + *(PVOID*)&psurf->ppal = ppal; +} + Modified: trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitmaps.…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c [iso-8859-1] Sun Jul 1 13:43:33 2012 @@ -223,6 +223,7 @@ INT Height) { HBITMAP Bmp = NULL; + PPALETTE ppal; /* MS doc says if width or height is 0, return 1-by-1 pixel, monochrome bitmap */ if (0 == Width || 0 == Height) @@ -241,8 +242,13 @@ NULL); psurf = SURFACE_ShareLockSurface(Bmp); ASSERT(psurf); - /* Set palette */ - psurf->ppal = PALETTE_ShareLockPalette(Dc->ppdev->devinfo.hpalDefault); + + /* Dereference old palette and set new palette */ + ppal = PALETTE_ShareLockPalette(Dc->ppdev->devinfo.hpalDefault); + ASSERT(ppal); + SURFACE_vSetPalette(psurf, ppal); + PALETTE_ShareUnlockPalette(ppal); + /* Set flags */ psurf->flags = API_BITMAP; psurf->hdc = NULL; // FIXME: @@ -266,9 +272,10 @@ NULL); psurfBmp = SURFACE_ShareLockSurface(Bmp); ASSERT(psurfBmp); - /* Assign palette */ - psurfBmp->ppal = psurf->ppal; - GDIOBJ_vReferenceObjectByPointer((POBJ)psurf->ppal); + + /* Dereference old palette and set new palette */ + SURFACE_vSetPalette(psurfBmp, psurf->ppal); + /* Set flags */ psurfBmp->flags = API_BITMAP; psurfBmp->hdc = NULL; // FIXME: @@ -622,12 +629,9 @@ psurfSrc->SurfObj.pvBits, psurfNew->SurfObj.cjBits); - /* Dereference the new bitmaps palette, we will use a different */ - GDIOBJ_vDereferenceObject(&psurfNew->ppal->BaseObject); /* Reference the palette of the source bitmap and use it */ - GDIOBJ_vReferenceObjectByPointer(&psurfSrc->ppal->BaseObject); - psurfNew->ppal = psurfSrc->ppal; + SURFACE_vSetPalette(psurfNew, psurfSrc->ppal); /* Unlock the new surface */ SURFACE_ShareUnlockSurface(psurfNew); Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Sun Jul 1 13:43:33 2012 @@ -1599,8 +1599,8 @@ ppalDIB = CreateDIBPalette(bmi, dc, usage); if (ppalDIB) { - if (bmp->ppal) PALETTE_ShareUnlockPalette(bmp->ppal); - bmp->ppal = ppalDIB; + SURFACE_vSetPalette(bmp, ppalDIB); + PALETTE_ShareUnlockPalette(ppalDIB); } // Clean up in case of errors
12 years, 9 months
1
0
0
0
← Newer
1
...
17
18
19
20
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Results per page:
10
25
50
100
200