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
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
September 2012
----- 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
17 participants
236 discussions
Start a n
N
ew thread
[ekohl] 57449: [LSASRV] Get rid of the ugly container object code. Let LsapCreateDbObject and LsapOpenDbObject handle container objects instead.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Sep 30 23:50:30 2012 New Revision: 57449 URL:
http://svn.reactos.org/svn/reactos?rev=57449&view=rev
Log: [LSASRV] Get rid of the ugly container object code. Let LsapCreateDbObject and LsapOpenDbObject handle container objects instead. Modified: trunk/reactos/dll/win32/lsasrv/database.c trunk/reactos/dll/win32/lsasrv/lsarpc.c trunk/reactos/dll/win32/lsasrv/lsasrv.h Modified: trunk/reactos/dll/win32/lsasrv/database.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/database.…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/database.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/database.c [iso-8859-1] Sun Sep 30 23:50:30 2012 @@ -283,6 +283,7 @@ /* Open the 'Policy' object */ Status = LsapOpenDbObject(NULL, + NULL, L"Policy", LsaDbPolicyObject, 0, @@ -427,6 +428,7 @@ NTSTATUS LsapCreateDbObject(IN PLSA_DB_OBJECT ParentObject, + IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN LSA_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, @@ -436,7 +438,8 @@ OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING KeyName; HANDLE ParentKeyHandle; - HANDLE ObjectKeyHandle; + HANDLE ContainerKeyHandle = NULL; + HANDLE ObjectKeyHandle = NULL; NTSTATUS Status; if (DbObject == NULL) @@ -447,25 +450,73 @@ else ParentKeyHandle = ParentObject->KeyHandle; - RtlInitUnicodeString(&KeyName, - ObjectName); - - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_CASE_INSENSITIVE, - ParentKeyHandle, - NULL); - - Status = NtCreateKey(&ObjectKeyHandle, - KEY_ALL_ACCESS, - &ObjectAttributes, - 0, - NULL, - 0, - NULL); - if (!NT_SUCCESS(Status)) - { - return Status; + if (ContainerName != NULL) + { + /* Open the container key */ + RtlInitUnicodeString(&KeyName, + ContainerName); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + ParentKeyHandle, + NULL); + + Status = NtOpenKey(&ContainerKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + /* Open the object key */ + RtlInitUnicodeString(&KeyName, + ObjectName); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + ContainerKeyHandle, + NULL); + + Status = NtCreateKey(&ObjectKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + 0, + NULL); + + NtClose(ContainerKeyHandle); + + if (!NT_SUCCESS(Status)) + { + return Status; + } + } + else + { + RtlInitUnicodeString(&KeyName, + ObjectName); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + ParentKeyHandle, + NULL); + + Status = NtCreateKey(&ObjectKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + 0, + NULL); + if (!NT_SUCCESS(Status)) + { + return Status; + } } NewObject = RtlAllocateHeap(RtlGetProcessHeap(), @@ -495,6 +546,7 @@ NTSTATUS LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject, + IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN LSA_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, @@ -504,7 +556,8 @@ OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING KeyName; HANDLE ParentKeyHandle; - HANDLE ObjectKeyHandle; + HANDLE ContainerKeyHandle = NULL; + HANDLE ObjectKeyHandle = NULL; NTSTATUS Status; if (DbObject == NULL) @@ -515,26 +568,71 @@ else ParentKeyHandle = ParentObject->KeyHandle; - RtlInitUnicodeString(&KeyName, - ObjectName); - - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_CASE_INSENSITIVE, - ParentKeyHandle, - NULL); - - Status = NtOpenKey(&ObjectKeyHandle, - KEY_ALL_ACCESS, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - return Status; + if (ContainerName != NULL) + { + /* Open the container key */ + RtlInitUnicodeString(&KeyName, + ContainerName); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + ParentKeyHandle, + NULL); + + Status = NtOpenKey(&ContainerKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + /* Open the object key */ + RtlInitUnicodeString(&KeyName, + ObjectName); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + ContainerKeyHandle, + NULL); + + Status = NtOpenKey(&ObjectKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes); + + NtClose(ContainerKeyHandle); + + if (!NT_SUCCESS(Status)) + { + return Status; + } + } + else + { + /* Open the object key */ + RtlInitUnicodeString(&KeyName, + ObjectName); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + ParentKeyHandle, + NULL); + + Status = NtOpenKey(&ObjectKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + return Status; + } } NewObject = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - sizeof(LSA_DB_OBJECT)); + 0, + sizeof(LSA_DB_OBJECT)); if (NewObject == NULL) { NtClose(ObjectKeyHandle); Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsarpc.c?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] Sun Sep 30 23:50:30 2012 @@ -183,6 +183,7 @@ RtlEnterCriticalSection(&PolicyHandleTableLock); Status = LsapOpenDbObject(NULL, + NULL, L"Policy", LsaDbPolicyObject, DesiredAccess, @@ -435,7 +436,6 @@ LSAPR_HANDLE *AccountHandle) { PLSA_DB_OBJECT PolicyObject; - PLSA_DB_OBJECT AccountsObject = NULL; PLSA_DB_OBJECT AccountObject = NULL; LPWSTR SidString = NULL; NTSTATUS Status = STATUS_SUCCESS; @@ -455,18 +455,6 @@ return Status; } - /* Open the Accounts object */ - Status = LsapOpenDbObject(PolicyObject, - L"Accounts", - LsaDbContainerObject, - 0, - &AccountsObject); - if (!NT_SUCCESS(Status)) - { - ERR("LsapCreateDbObject (Accounts) failed (Status 0x%08lx)\n", Status); - goto done; - } - /* Create SID string */ if (!ConvertSidToStringSid((PSID)AccountSid, &SidString)) @@ -477,14 +465,15 @@ } /* Create the Account object */ - Status = LsapCreateDbObject(AccountsObject, + Status = LsapCreateDbObject(PolicyObject, + L"Accounts", SidString, LsaDbAccountObject, DesiredAccess, &AccountObject); if (!NT_SUCCESS(Status)) { - ERR("LsapCreateDbObject (Account) failed (Status 0x%08lx)\n", Status); + ERR("LsapCreateDbObject failed (Status 0x%08lx)\n", Status); goto done; } @@ -507,9 +496,6 @@ { *AccountHandle = (LSAPR_HANDLE)AccountObject; } - - if (AccountsObject != NULL) - LsapCloseDbObject(AccountsObject); return STATUS_SUCCESS; } @@ -750,7 +736,6 @@ LSAPR_HANDLE *SecretHandle) { PLSA_DB_OBJECT PolicyObject; - PLSA_DB_OBJECT SecretsObject = NULL; PLSA_DB_OBJECT SecretObject = NULL; LARGE_INTEGER Time; NTSTATUS Status = STATUS_SUCCESS; @@ -766,18 +751,6 @@ return Status; } - /* Open the Secrets object */ - Status = LsapOpenDbObject(PolicyObject, - L"Secrets", - LsaDbContainerObject, - 0, - &SecretsObject); - if (!NT_SUCCESS(Status)) - { - ERR("LsapCreateDbObject (Secrets) failed (Status 0x%08lx)\n", Status); - goto done; - } - /* Get the current time */ Status = NtQuerySystemTime(&Time); if (!NT_SUCCESS(Status)) @@ -787,14 +760,15 @@ } /* Create the Secret object */ - Status = LsapCreateDbObject(SecretsObject, + Status = LsapCreateDbObject(PolicyObject, + L"Secrets", SecretName->Buffer, LsaDbSecretObject, DesiredAccess, &SecretObject); if (!NT_SUCCESS(Status)) { - ERR("LsapCreateDbObject (Secret) failed (Status 0x%08lx)\n", Status); + ERR("LsapCreateDbObject failed (Status 0x%08lx)\n", Status); goto done; } @@ -826,9 +800,6 @@ *SecretHandle = (LSAPR_HANDLE)SecretObject; } - if (SecretsObject != NULL) - LsapCloseDbObject(SecretsObject); - return STATUS_SUCCESS; } @@ -841,7 +812,6 @@ LSAPR_HANDLE *AccountHandle) { PLSA_DB_OBJECT PolicyObject; - PLSA_DB_OBJECT AccountsObject = NULL; PLSA_DB_OBJECT AccountObject = NULL; LPWSTR SidString = NULL; NTSTATUS Status = STATUS_SUCCESS; @@ -861,18 +831,6 @@ return Status; } - /* Open the Accounts object */ - Status = LsapOpenDbObject(PolicyObject, - L"Accounts", - LsaDbContainerObject, - 0, - &AccountsObject); - if (!NT_SUCCESS(Status)) - { - ERR("LsapOpenDbObject (Accounts) failed (Status 0x%08lx)\n", Status); - goto done; - } - /* Create SID string */ if (!ConvertSidToStringSid((PSID)AccountSid, &SidString)) @@ -883,14 +841,15 @@ } /* Create the Account object */ - Status = LsapOpenDbObject(AccountsObject, + Status = LsapOpenDbObject(PolicyObject, + L"Accounts", SidString, LsaDbAccountObject, DesiredAccess, &AccountObject); if (!NT_SUCCESS(Status)) { - ERR("LsapOpenDbObject (Account) failed (Status 0x%08lx)\n", Status); + ERR("LsapOpenDbObject failed (Status 0x%08lx)\n", Status); goto done; } @@ -913,9 +872,6 @@ { *AccountHandle = (LSAPR_HANDLE)AccountObject; } - - if (AccountsObject != NULL) - LsapCloseDbObject(AccountsObject); return Status; } @@ -1257,7 +1213,6 @@ LSAPR_HANDLE *SecretHandle) { PLSA_DB_OBJECT PolicyObject; - PLSA_DB_OBJECT SecretsObject = NULL; PLSA_DB_OBJECT SecretObject = NULL; NTSTATUS Status = STATUS_SUCCESS; @@ -1272,27 +1227,16 @@ return Status; } - /* Open the Secrets object */ + /* Create the secret object */ Status = LsapOpenDbObject(PolicyObject, L"Secrets", - LsaDbContainerObject, - 0, - &SecretsObject); - if (!NT_SUCCESS(Status)) - { - ERR("LsapCreateDbObject (Secrets) failed (Status 0x%08lx)\n", Status); - goto done; - } - - /* Create the secret object */ - Status = LsapOpenDbObject(SecretsObject, SecretName->Buffer, LsaDbSecretObject, DesiredAccess, &SecretObject); if (!NT_SUCCESS(Status)) { - ERR("LsapOpenDbObject (Secret) failed (Status 0x%08lx)\n", Status); + ERR("LsapOpenDbObject failed (Status 0x%08lx)\n", Status); goto done; } @@ -1306,9 +1250,6 @@ { *SecretHandle = (LSAPR_HANDLE)SecretObject; } - - if (SecretsObject != NULL) - LsapCloseDbObject(SecretsObject); return STATUS_SUCCESS; } Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Sun Sep 30 23:50:30 2012 @@ -33,7 +33,6 @@ typedef enum _LSA_DB_OBJECT_TYPE { LsaDbIgnoreObject, - LsaDbContainerObject, LsaDbPolicyObject, LsaDbAccountObject, LsaDbDomainObject, @@ -71,6 +70,7 @@ NTSTATUS LsapCreateDbObject(IN PLSA_DB_OBJECT ParentObject, + IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN LSA_DB_OBJECT_TYPE HandleType, IN ACCESS_MASK DesiredAccess, @@ -78,6 +78,7 @@ NTSTATUS LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject, + IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN LSA_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess,
12 years, 2 months
1
0
0
0
[ekohl] 57448: [LSASRV] - Validate Account SIDs in LsarCreateAccount and LsarOpenAccount. - LsarOpenAccount: Do not check the granted access of the policy handle. - LsarOpenAccount: Return the prop...
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Sep 30 22:41:34 2012 New Revision: 57448 URL:
http://svn.reactos.org/svn/reactos?rev=57448&view=rev
Log: [LSASRV] - Validate Account SIDs in LsarCreateAccount and LsarOpenAccount. - LsarOpenAccount: Do not check the granted access of the policy handle. - LsarOpenAccount: Return the proper status code. Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsarpc.c?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] Sun Sep 30 22:41:34 2012 @@ -440,6 +440,10 @@ LPWSTR SidString = NULL; NTSTATUS Status = STATUS_SUCCESS; + /* Validate the AccountSid */ + if (!RtlValidSid(AccountSid)) + return STATUS_INVALID_PARAMETER; + /* Validate the PolicyHandle */ Status = LsapValidateDbObject(PolicyHandle, LsaDbPolicyObject, @@ -842,10 +846,14 @@ LPWSTR SidString = NULL; NTSTATUS Status = STATUS_SUCCESS; + /* Validate the AccountSid */ + if (!RtlValidSid(AccountSid)) + return STATUS_INVALID_PARAMETER; + /* Validate the PolicyHandle */ Status = LsapValidateDbObject(PolicyHandle, LsaDbPolicyObject, - POLICY_CREATE_ACCOUNT, + 0, &PolicyObject); if (!NT_SUCCESS(Status)) { @@ -861,7 +869,7 @@ &AccountsObject); if (!NT_SUCCESS(Status)) { - ERR("LsapCreateDbObject (Accounts) failed (Status 0x%08lx)\n", Status); + ERR("LsapOpenDbObject (Accounts) failed (Status 0x%08lx)\n", Status); goto done; } @@ -909,7 +917,7 @@ if (AccountsObject != NULL) LsapCloseDbObject(AccountsObject); - return STATUS_SUCCESS; + return Status; }
12 years, 2 months
1
0
0
0
[rmessiant] 57447: [DISKPART] - Correct command processing following the first command in interactive mode. - Correct invocation of command-specific help functions.
by rmessiant@svn.reactos.org
Author: rmessiant Date: Sun Sep 30 22:25:26 2012 New Revision: 57447 URL:
http://svn.reactos.org/svn/reactos?rev=57447&view=rev
Log: [DISKPART] - Correct command processing following the first command in interactive mode. - Correct invocation of command-specific help functions. Modified: trunk/reactos/base/system/diskpart/help.c trunk/reactos/base/system/diskpart/interpreter.c Modified: trunk/reactos/base/system/diskpart/help.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/help.…
============================================================================== --- trunk/reactos/base/system/diskpart/help.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/help.c [iso-8859-1] Sun Sep 30 22:25:26 2012 @@ -84,7 +84,7 @@ /* Scan internal command table */ for (cmdptr = cmds; cmdptr->name; cmdptr++) { - if (_wcsicmp(argv[0], cmdptr->name) == 0 && cmdptr->help != NULL) + if (_wcsicmp(argv[1], cmdptr->name) == 0 && cmdptr->help != NULL) { cmdptr->help(argc, argv); return TRUE; Modified: trunk/reactos/base/system/diskpart/interpreter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/diskpart/inter…
============================================================================== --- trunk/reactos/base/system/diskpart/interpreter.c [iso-8859-1] (original) +++ trunk/reactos/base/system/diskpart/interpreter.c [iso-8859-1] Sun Sep 30 22:25:26 2012 @@ -156,6 +156,7 @@ while (bRun == TRUE) { + args_count = 0; memset(args_vector, 0, sizeof(args_vector)); /* shown just before the input where the user places commands */
12 years, 2 months
1
0
0
0
[fireball] 57446: - Sacrifice unneeded branches to a higher purpose. * Ash_Shell (never happened) * baikalnet (unneeded with cgutman's lwIP usage, never happened) * header-work (integrated to trunk...
by fireball@svn.reactos.org
Author: fireball Date: Sun Sep 30 22:20:43 2012 New Revision: 57446 URL:
http://svn.reactos.org/svn/reactos?rev=57446&view=rev
Log: - Sacrifice unneeded branches to a higher purpose. * Ash_Shell (never happened) * baikalnet (unneeded with cgutman's lwIP usage, never happened) * header-work (integrated to trunk) * rbuild (superseded by cmake) * reactos-yarotows (integrated to trunk) Removed: branches/Ash_Shell/ branches/baikalnet/ branches/cache_manager_rewrite/ branches/header-work/ branches/rbuild/ branches/reactos-yarotows/
12 years, 2 months
1
0
0
0
[tkreuzer] 57445: [WIN32K] Fix the hack, so it doesn't cause overwriting of usermode memory.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Sep 30 22:02:02 2012 New Revision: 57445 URL:
http://svn.reactos.org/svn/reactos?rev=57445&view=rev
Log: [WIN32K] Fix the hack, so it doesn't cause overwriting of usermode memory. Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c 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 Sep 30 22:02:02 2012 @@ -1007,6 +1007,7 @@ PBITMAPINFO pbmi; HANDLE hSecure = NULL; INT iResult = 0; + UINT cjAlloc; /* Check for bad iUsage */ if (iUsage > 2) return 0; @@ -1022,10 +1023,10 @@ // HACK: the underlying code sucks and doesn't care for the size, so we // give it the maximum ever needed - cjMaxInfo = sizeof(BITMAPV5HEADER) + 256 * sizeof(RGBQUAD); + cjAlloc = sizeof(BITMAPV5HEADER) + 256 * sizeof(RGBQUAD); /* Allocate a buffer the bitmapinfo */ - pbmi = ExAllocatePoolWithTag(PagedPool, cjMaxInfo, 'imBG'); + pbmi = ExAllocatePoolWithTag(PagedPool, cjAlloc, 'imBG'); if (!pbmi) { /* Fail */
12 years, 2 months
1
0
0
0
[tkreuzer] 57444: [WIN32K] Hack around completely broken GreGetDIBitsInternal. Fixes bugcheck caused by gdi32_winetest bitmap.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Sep 30 21:21:03 2012 New Revision: 57444 URL:
http://svn.reactos.org/svn/reactos?rev=57444&view=rev
Log: [WIN32K] Hack around completely broken GreGetDIBitsInternal. Fixes bugcheck caused by gdi32_winetest bitmap. Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c 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 Sep 30 21:21:03 2012 @@ -1020,6 +1020,10 @@ /* Use maximum size */ cjMaxInfo = min(cjMaxInfo, sizeof(BITMAPV5HEADER) + 256 * sizeof(RGBQUAD)); + // HACK: the underlying code sucks and doesn't care for the size, so we + // give it the maximum ever needed + cjMaxInfo = sizeof(BITMAPV5HEADER) + 256 * sizeof(RGBQUAD); + /* Allocate a buffer the bitmapinfo */ pbmi = ExAllocatePoolWithTag(PagedPool, cjMaxInfo, 'imBG'); if (!pbmi)
12 years, 2 months
1
0
0
0
[tkreuzer] 57443: [WIN32K] - Seperate GreGetDIBitsInternal from NtGdiGetDIBitsInternal - Rewrite IntSynthesizeDib - Fixes heap corruption when doing screen shots or copying from paint CORE-6674 COR...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Sep 30 20:30:23 2012 New Revision: 57443 URL:
http://svn.reactos.org/svn/reactos?rev=57443&view=rev
Log: [WIN32K] - Seperate GreGetDIBitsInternal from NtGdiGetDIBitsInternal - Rewrite IntSynthesizeDib - Fixes heap corruption when doing screen shots or copying from paint CORE-6674 CORE-6093 #resolve Modified: trunk/reactos/win32ss/gdi/ntgdi/dib.h trunk/reactos/win32ss/gdi/ntgdi/dibobj.c trunk/reactos/win32ss/user/ntuser/clipboard.c Modified: trunk/reactos/win32ss/gdi/ntgdi/dib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dib.h?re…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dib.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dib.h [iso-8859-1] Sun Sep 30 20:30:23 2012 @@ -10,4 +10,17 @@ BITMAPINFO* FASTCALL DIB_ConvertBitmapInfo(CONST BITMAPINFO* bmi, DWORD Usage); VOID FASTCALL DIB_FreeConvertedBitmapInfo(BITMAPINFO* converted, BITMAPINFO* orig); +INT +APIENTRY +GreGetDIBitsInternal( + HDC hDC, + HBITMAP hBitmap, + UINT StartScan, + UINT ScanLines, + LPBYTE Bits, + LPBITMAPINFO Info, + UINT Usage, + UINT MaxBits, + UINT MaxInfo); + #define DIB_PAL_BRUSHHACK 3 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 Sep 30 20:30:23 2012 @@ -465,7 +465,7 @@ SourceSize.cx = bmi->bmiHeader.biWidth; SourceSize.cy = ScanLines; - + //DIBWidth = WIDTH_BYTES_ALIGN32(SourceSize.cx, bmi->bmiHeader.biBitCount); hSourceBitmap = GreCreateBitmapEx(bmi->bmiHeader.biWidth, @@ -500,7 +500,7 @@ Status = STATUS_NO_MEMORY; goto Exit; } - + /* This is actually a blit */ DC_vPrepareDCsForBlit(pDC, rcDest, NULL, rcDest); pSurf = pDC->dclevel.pSurface; @@ -510,7 +510,7 @@ ret = ScanLines; goto Exit; } - + ASSERT(pSurf->ppal); /* Initialize EXLATEOBJ */ @@ -520,7 +520,7 @@ RGB(0xff, 0xff, 0xff), pDC->pdcattr->crBackgroundClr, pDC->pdcattr->crForegroundClr); - + pDestSurf = &pSurf->SurfObj; /* Copy the bits */ @@ -541,7 +541,7 @@ /* Cleanup EXLATEOBJ */ EXLATEOBJ_vCleanup(&exlo); - + /* We're done */ DC_vFinishBlit(pDC, NULL); @@ -565,7 +565,7 @@ /* Converts a device-dependent bitmap to a DIB */ INT APIENTRY -NtGdiGetDIBitsInternal( +GreGetDIBitsInternal( HDC hDC, HBITMAP hBitmap, UINT StartScan, @@ -587,30 +587,11 @@ RGBTRIPLE* rgbTriples; RGBQUAD* rgbQuads; VOID* colorPtr; - NTSTATUS Status = STATUS_SUCCESS; DPRINT("Entered NtGdiGetDIBitsInternal()\n"); if ((Usage && Usage != DIB_PAL_COLORS) || !Info || !hBitmap) return 0; - - _SEH2_TRY - { - /* Probe for read and write */ - ProbeForRead(Info, MaxInfo, 1); - ProbeForWrite(Info, MaxInfo, 1); - if (Bits) ProbeForWrite(Bits, MaxBits, 1); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END - - if (!NT_SUCCESS(Status)) - { - return 0; - } colorPtr = (LPBYTE)Info + Info->bmiHeader.biSize; rgbTriples = colorPtr; @@ -834,7 +815,6 @@ colorTriple->rgbtRed = (r * 0xff) / 5; colorTriple->rgbtGreen = (g * 0xff) / 5; colorTriple->rgbtBlue = (b * 0xff) / 5; - color++; } } } @@ -994,22 +974,7 @@ ScanLines = 0; else { - Status = STATUS_SUCCESS; - _SEH2_TRY - { - RtlCopyMemory(Bits, pDIBits, DIB_GetDIBImageBytes (width, ScanLines, bpp)); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END - - if(!NT_SUCCESS(Status)) - { - DPRINT1("Unable to copy bits to the user provided pointer\n"); - ScanLines = 0; - } + RtlCopyMemory(Bits, pDIBits, DIB_GetDIBImageBytes (width, ScanLines, bpp)); } GreDeleteObject(hBmpDest); @@ -1025,6 +990,109 @@ return ScanLines; } + +INT +APIENTRY +NtGdiGetDIBitsInternal( + _In_ HDC hdc, + _In_ HBITMAP hbm, + _In_ UINT iStartScan, + _In_ UINT cScans, + _Out_opt_ LPBYTE pjBits, + _Inout_ LPBITMAPINFO pbmiUser, + _In_ UINT iUsage, + _In_ UINT cjMaxBits, + _In_ UINT cjMaxInfo) +{ + PBITMAPINFO pbmi; + HANDLE hSecure = NULL; + INT iResult = 0; + + /* Check for bad iUsage */ + if (iUsage > 2) return 0; + + /* Check if the size of the bitmap info is large enough */ + if (cjMaxInfo < sizeof(BITMAPINFOHEADER)) + { + return 0; + } + + /* Use maximum size */ + cjMaxInfo = min(cjMaxInfo, sizeof(BITMAPV5HEADER) + 256 * sizeof(RGBQUAD)); + + /* Allocate a buffer the bitmapinfo */ + pbmi = ExAllocatePoolWithTag(PagedPool, cjMaxInfo, 'imBG'); + if (!pbmi) + { + /* Fail */ + return 0; + } + + /* Use SEH */ + _SEH2_TRY + { + /* Probe and copy the BITMAPINFO */ + ProbeForWrite(pbmiUser, cjMaxInfo, 1); + RtlCopyMemory(pbmi, pbmiUser, cjMaxInfo); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + _SEH2_YIELD(goto cleanup;) + } + _SEH2_END; + + /* Check if the header size is large enough */ + if ((pbmi->bmiHeader.biSize < sizeof(BITMAPINFOHEADER)) || + (pbmi->bmiHeader.biSize > cjMaxInfo)) + { + goto cleanup; + } + + /* Check if the caller provided bitmap bits */ + if (pjBits) + { + /* Secure the user mode memory */ + hSecure = EngSecureMem(pjBits, cjMaxBits); + if (!hSecure) + { + goto cleanup; + } + } + + /* Now call the internal function */ + iResult = GreGetDIBitsInternal(hdc, + hbm, + iStartScan, + cScans, + pjBits, + pbmi, + iUsage, + cjMaxBits, + cjMaxInfo); + + /* Check for success */ + if (iResult) + { + /* Use SEH to copy back to user mode */ + _SEH2_TRY + { + /* Buffer is already probed, copy the data back */ + RtlCopyMemory(pbmiUser, pbmi, cjMaxInfo); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* Ignore */ + } + _SEH2_END; + } + +cleanup: + if (hSecure) EngUnsecureMem(hSecure); + ExFreePoolWithTag(pbmi, 'imBG'); + + return iResult; +} + #define ROP_TO_ROP4(Rop) ((Rop) >> 16) @@ -1129,7 +1197,7 @@ rcDst.bottom = rcDst.top + cyDst; IntLPtoDP(pdc, (POINTL*)&rcDst, 2); RECTL_vOffsetRect(&rcDst, pdc->ptlDCOrig.x, pdc->ptlDCOrig.y); - + hbmTmp = GreCreateBitmapEx(pbmi->bmiHeader.biWidth, pbmi->bmiHeader.biHeight, 0, @@ -1163,7 +1231,7 @@ /* Prepare DC for blit */ DC_vPrepareDCsForBlit(pdc, rcDst, NULL, rcSrc); - + psurfDst = pdc->dclevel.pSurface; if (!psurfDst) { @@ -1172,7 +1240,7 @@ bResult = TRUE; goto cleanup; } - + /* Initialize XLATEOBJ */ EXLATEOBJ_vInitialize(&exlo, ppalDIB, Modified: trunk/reactos/win32ss/user/ntuser/clipboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/clipbo…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/clipboard.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/clipboard.c [iso-8859-1] Sun Sep 30 20:30:23 2012 @@ -135,47 +135,80 @@ } VOID static NTAPI -IntSynthesizeDib(PWINSTATION_OBJECT pWinStaObj, HBITMAP hBm) +IntSynthesizeDib( + PWINSTATION_OBJECT pWinStaObj, + HBITMAP hbm) { HDC hdc; - BITMAP bm; - BITMAPINFO bi; - SURFACE *psurf; - PCLIPBOARDDATA pMemObj; + ULONG cjInfoSize, cjDataSize; + PCLIPBOARDDATA pClipboardData; HANDLE hMem; - + INT iResult; + struct + { + BITMAPINFOHEADER bmih; + RGBQUAD rgbColors[256]; + } bmiBuffer; + PBITMAPINFO pbmi = (PBITMAPINFO)&bmiBuffer; + + /* Get the display DC */ hdc = UserGetDCEx(NULL, NULL, DCX_USESTYLE); if (!hdc) + { return; - - psurf = SURFACE_ShareLockSurface(hBm); - if (!psurf) - goto cleanup; - BITMAP_GetObject(psurf, sizeof(BITMAP), (PVOID)&bm); - SURFACE_ShareUnlockSurface(psurf); - - bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bi.bmiHeader.biWidth = bm.bmWidth; - bi.bmiHeader.biHeight = bm.bmHeight; - bi.bmiHeader.biPlanes = bm.bmPlanes; - bi.bmiHeader.biBitCount = bm.bmBitsPixel; - bi.bmiHeader.biCompression = BI_RGB; - bi.bmiHeader.biSizeImage = 0; - bi.bmiHeader.biXPelsPerMeter = 0; - bi.bmiHeader.biYPelsPerMeter = 0; - bi.bmiHeader.biClrUsed = 0; - - NtGdiGetDIBitsInternal(hdc, hBm, 0, bm.bmHeight, NULL, &bi, DIB_RGB_COLORS, 0, 0); - - pMemObj = (PCLIPBOARDDATA)UserCreateObject(gHandleTable, NULL, &hMem, otClipBoardData, - sizeof(BITMAPINFOHEADER) + bi.bmiHeader.biSizeImage); - if(pMemObj) - { - pMemObj->cbData = sizeof(BITMAPINFOHEADER) + bi.bmiHeader.biSizeImage; - memcpy(pMemObj->Data, &bi, sizeof(BITMAPINFOHEADER)); - NtGdiGetDIBitsInternal(hdc, hBm, 0, bm.bmHeight, (LPBYTE)pMemObj->Data + sizeof(BITMAPINFOHEADER), &bi, DIB_RGB_COLORS, 0, 0); - IntAddFormatedData(pWinStaObj, CF_DIB, hMem, TRUE, TRUE); - } + } + + /* Get information about the bitmap format */ + iResult = GreGetDIBitsInternal(hdc, + hbm, + 0, + 0, + NULL, + pbmi, + DIB_RGB_COLORS, + 0, + sizeof(bmiBuffer)); + if (iResult == 0) + { + goto cleanup; + } + + /* Get the size for a full BITMAPINFO */ + cjInfoSize = DIB_BitmapInfoSize(pbmi, DIB_RGB_COLORS); + + /* Calculate the size of the clipboard data, which is a packed DIB */ + cjDataSize = cjInfoSize + pbmi->bmiHeader.biSizeImage; + + /* Create the clipboard data */ + pClipboardData = (PCLIPBOARDDATA)UserCreateObject(gHandleTable, + NULL, + &hMem, + otClipBoardData, + cjDataSize); + if (!pClipboardData) + { + goto cleanup; + } + + /* Set the data size */ + pClipboardData->cbData = cjDataSize; + + /* Copy the BITMAPINFOHEADER */ + memcpy(pClipboardData->Data, pbmi, sizeof(BITMAPINFOHEADER)); + + /* Get the bitmap bits and the color table */ + iResult = GreGetDIBitsInternal(hdc, + hbm, + 0, + abs(pbmi->bmiHeader.biHeight), + (LPBYTE)pClipboardData->Data + cjInfoSize, + (LPBITMAPINFO)pClipboardData->Data, + DIB_RGB_COLORS, + pbmi->bmiHeader.biSizeImage, + cjInfoSize); + + /* Add the clipboard data */ + IntAddFormatedData(pWinStaObj, CF_DIB, hMem, TRUE, TRUE); cleanup: UserReleaseDC(NULL, hdc, FALSE);
12 years, 2 months
1
0
0
0
[rmessiant] 57442: [NET] - Correct copying of arguments into temporary buffer. - Remove some debug prints.
by rmessiant@svn.reactos.org
Author: rmessiant Date: Sun Sep 30 19:47:28 2012 New Revision: 57442 URL:
http://svn.reactos.org/svn/reactos?rev=57442&view=rev
Log: [NET] - Correct copying of arguments into temporary buffer. - Remove some debug prints. Modified: trunk/reactos/base/applications/network/net/cmdStop.c trunk/reactos/base/applications/network/net/cmdstart.c Modified: trunk/reactos/base/applications/network/net/cmdStop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
============================================================================== --- trunk/reactos/base/applications/network/net/cmdStop.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdStop.c [iso-8859-1] Sun Sep 30 19:47:28 2012 @@ -29,7 +29,6 @@ SC_MANAGER_ENUMERATE_SERVICE); if (hManager == NULL) { -printf("1\n"); dwError = GetLastError(); nError = 1; goto done; @@ -40,7 +39,6 @@ SERVICE_STOP); if (hService == NULL) { -printf("2\n"); dwError = GetLastError(); nError = 1; goto done; @@ -48,7 +46,6 @@ if (!ControlService(hService, SERVICE_CONTROL_STOP, &ServiceStatus)) { -printf("3\n"); dwError = GetLastError(); nError = 1; goto done; Modified: trunk/reactos/base/applications/network/net/cmdstart.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
============================================================================== --- trunk/reactos/base/applications/network/net/cmdstart.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdstart.c [iso-8859-1] Sun Sep 30 19:47:28 2012 @@ -130,7 +130,7 @@ for (i = 2; i < argc; i++) { - lpArgVectors[i] = argv[i + 2]; + lpArgVectors[i - 2] = argv[i]; } if (!StartServiceW(hService,
12 years, 2 months
1
0
0
0
[ekohl] 57441: [INCLUDE] Add missing account right strings and system account flags.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Sep 30 17:15:37 2012 New Revision: 57441 URL:
http://svn.reactos.org/svn/reactos?rev=57441&view=rev
Log: [INCLUDE] Add missing account right strings and system account flags. Modified: trunk/reactos/include/psdk/ntlsa.h trunk/reactos/include/psdk/ntsecapi.h Modified: trunk/reactos/include/psdk/ntlsa.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntlsa.h?rev=5…
============================================================================== --- trunk/reactos/include/psdk/ntlsa.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ntlsa.h [iso-8859-1] Sun Sep 30 17:15:37 2012 @@ -33,6 +33,19 @@ #define SECRET_SET_VALUE 1 #define SECRET_QUERY_VALUE 2 +/* System Access Flags */ +#define SECURITY_ACCESS_INTERACTIVE_LOGON 0x00000001 +#define SECURITY_ACCESS_NETWORK_LOGON 0x00000002 +#define SECURITY_ACCESS_BATCH_LOGON 0x00000004 +#define SECURITY_ACCESS_SERVICE_LOGON 0x00000010 +#define SECURITY_ACCESS_PROXY_LOGON 0x00000020 +#define SECURITY_ACCESS_DENY_INTERACTIVE_LOGON 0x00000040 +#define SECURITY_ACCESS_DENY_NETWORK_LOGON 0x00000080 +#define SECURITY_ACCESS_DENY_BATCH_LOGON 0x00000100 +#define SECURITY_ACCESS_DENY_SERVICE_LOGON 0x00000200 +#define SECURITY_ACCESS_REMOTE_INTERACTIVE_LOGON 0x00000400 +#define SECURITY_ACCESS_DENY_REMOTE_INTERACTIVE_LOGON 0x00000800 + #ifdef __cplusplus } 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 [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ntsecapi.h [iso-8859-1] Sun Sep 30 17:15:37 2012 @@ -105,6 +105,12 @@ #define SE_NETWORK_LOGON_NAME TEXT("SeNetworkLogonRight") #define SE_BATCH_LOGON_NAME TEXT("SeBatchLogonRight") #define SE_SERVICE_LOGON_NAME TEXT("SeServiceLogonRight") +#define SE_DENY_INTERACTIVE_LOGON_NAME TEXT("SeDenyInteractiveLogonRight") +#define SE_DENY_NETWORK_LOGON_NAME TEXT("SeDenyNetworkLogonRight") +#define SE_DENY_BATCH_LOGON_NAME TEXT("SeDenyBatchLogonRight") +#define SE_DENY_SERVICE_LOGON_NAME TEXT("SeDenyServiceLogonRight") +#define SE_REMOTE_INTERACTIVE_LOGON_NAME TEXT("SeRemoteInteractiveLogonRight") +#define SE_DENY_REMOTE_INTERACTIVE_LOGON_NAME TEXT("SeDenyRemoteInteractiveLogonRight") #define TRUST_ATTRIBUTE_NON_TRANSITIVE 1 #define TRUST_ATTRIBUTE_UPLEVEL_ONLY 2 #define TRUST_ATTRIBUTE_TREE_PARENT 4194304
12 years, 2 months
1
0
0
0
[tkreuzer] 57440: [GDI32] - Some fixes for CreateDIBitmap (Patch by Victor Martinez, modified by me) CORE-6420 #resolve - Fix warning on MSVC
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Sep 30 14:53:46 2012 New Revision: 57440 URL:
http://svn.reactos.org/svn/reactos?rev=57440&view=rev
Log: [GDI32] - Some fixes for CreateDIBitmap (Patch by Victor Martinez, modified by me) CORE-6420 #resolve - Fix warning on MSVC Modified: trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c trunk/reactos/win32ss/gdi/gdi32/objects/efloat.c Modified: trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/…
============================================================================== --- trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c [iso-8859-1] Sun Sep 30 14:53:46 2012 @@ -449,13 +449,52 @@ HBITMAP hBmp; NTSTATUS Status = STATUS_SUCCESS; - if (!Header) return 0; - + /* Check for CBM_CREATDIB */ + if (Init & CBM_CREATDIB) + { + /* CBM_CREATDIB needs Data. */ + if (!Data) + { + return 0; + } + + /* It only works with PAL or RGB */ + if (ColorUse > DIB_PAL_COLORS) + { + GdiSetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + } + + /* Header is required */ + if (!Header) + { + GdiSetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + /* Get the bitmap format and dimensions */ if (DIB_GetBitmapInfo(Header, &width, &height, &planes, &bpp, &compr, &dibsize) == -1) { GdiSetLastError(ERROR_INVALID_PARAMETER); return NULL; } + + /* Check if the Compr is incompatible */ + if ((compr == BI_JPEG) || (compr == BI_PNG) || (compr == BI_BITFIELDS)) return 0; + + /* Only DIB_RGB_COLORS (0), DIB_PAL_COLORS (1) and 2 are valid. */ + if (ColorUse > DIB_PAL_COLORS + 1) + { + GdiSetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + /* Negative width is not allowed */ + if (width < 0) return 0; + + /* Top-down DIBs have a negative height. */ + height = abs(height); // For Icm support. // GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr)) Modified: trunk/reactos/win32ss/gdi/gdi32/objects/efloat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/…
============================================================================== --- trunk/reactos/win32ss/gdi/gdi32/objects/efloat.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/gdi32/objects/efloat.c [iso-8859-1] Sun Sep 30 14:53:46 2012 @@ -27,7 +27,7 @@ Exp = efp->lExp; Sign = SIGN(Mant); - if (Sign) Mant = -Mant; + if (Sign) Mant = -(LONG)Mant; Mant >>= 7; Exp += (EXCESS-1);
12 years, 2 months
1
0
0
0
← Newer
1
2
3
4
...
24
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
Results per page:
10
25
50
100
200