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
January 2013
----- 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
11 participants
185 discussions
Start a n
N
ew thread
[tkreuzer] 58197: [RTL] Formatting, no code change
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Jan 20 11:03:10 2013 New Revision: 58197 URL:
http://svn.reactos.org/svn/reactos?rev=58197&view=rev
Log: [RTL] Formatting, no code change Modified: trunk/reactos/lib/rtl/resource.c Modified: trunk/reactos/lib/rtl/resource.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/resource.c?rev=581…
============================================================================== --- trunk/reactos/lib/rtl/resource.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/resource.c [iso-8859-1] Sun Jan 20 11:03:10 2013 @@ -20,107 +20,111 @@ /* * @implemented */ -VOID NTAPI +VOID +NTAPI RtlInitializeResource(PRTL_RESOURCE Resource) { - NTSTATUS Status; - - Status = RtlInitializeCriticalSection(&Resource->Lock); - if (!NT_SUCCESS(Status)) - { - RtlRaiseStatus(Status); - } - - Status = NtCreateSemaphore(&Resource->SharedSemaphore, - SEMAPHORE_ALL_ACCESS, - NULL, - 0, - 65535); - if (!NT_SUCCESS(Status)) - { - RtlRaiseStatus(Status); - } - Resource->SharedWaiters = 0; - - Status = NtCreateSemaphore(&Resource->ExclusiveSemaphore, - SEMAPHORE_ALL_ACCESS, - NULL, - 0, - 65535); - if (!NT_SUCCESS(Status)) - { - RtlRaiseStatus(Status); - } - Resource->ExclusiveWaiters = 0; - - Resource->NumberActive = 0; - Resource->OwningThread = NULL; - Resource->TimeoutBoost = 0; /* no info on this one, default value is 0 */ -} - - -/* - * @implemented - */ -VOID NTAPI + NTSTATUS Status; + + Status = RtlInitializeCriticalSection(&Resource->Lock); + if (!NT_SUCCESS(Status)) + { + RtlRaiseStatus(Status); + } + + Status = NtCreateSemaphore(&Resource->SharedSemaphore, + SEMAPHORE_ALL_ACCESS, + NULL, + 0, + 65535); + if (!NT_SUCCESS(Status)) + { + RtlRaiseStatus(Status); + } + Resource->SharedWaiters = 0; + + Status = NtCreateSemaphore(&Resource->ExclusiveSemaphore, + SEMAPHORE_ALL_ACCESS, + NULL, + 0, + 65535); + if (!NT_SUCCESS(Status)) + { + RtlRaiseStatus(Status); + } + + Resource->ExclusiveWaiters = 0; + Resource->NumberActive = 0; + Resource->OwningThread = NULL; + Resource->TimeoutBoost = 0; /* no info on this one, default value is 0 */ +} + + +/* + * @implemented + */ +VOID +NTAPI RtlDeleteResource(PRTL_RESOURCE Resource) { - RtlDeleteCriticalSection(&Resource->Lock); - NtClose(Resource->ExclusiveSemaphore); - NtClose(Resource->SharedSemaphore); - Resource->OwningThread = NULL; - Resource->ExclusiveWaiters = 0; - Resource->SharedWaiters = 0; - Resource->NumberActive = 0; -} - - -/* - * @implemented - */ -BOOLEAN NTAPI -RtlAcquireResourceExclusive(PRTL_RESOURCE Resource, - BOOLEAN Wait) -{ - NTSTATUS Status; - BOOLEAN retVal = FALSE; + RtlDeleteCriticalSection(&Resource->Lock); + NtClose(Resource->ExclusiveSemaphore); + NtClose(Resource->SharedSemaphore); + Resource->OwningThread = NULL; + Resource->ExclusiveWaiters = 0; + Resource->SharedWaiters = 0; + Resource->NumberActive = 0; +} + + +/* + * @implemented + */ +BOOLEAN +NTAPI +RtlAcquireResourceExclusive( + PRTL_RESOURCE Resource, + BOOLEAN Wait) +{ + NTSTATUS Status; + BOOLEAN retVal = FALSE; start: RtlEnterCriticalSection(&Resource->Lock); if (Resource->NumberActive == 0) /* lock is free */ - { - Resource->NumberActive = -1; - retVal = TRUE; - } + { + Resource->NumberActive = -1; + retVal = TRUE; + } else if (Resource->NumberActive < 0) /* exclusive lock in progress */ - { - if (Resource->OwningThread == NtCurrentTeb()->ClientId.UniqueThread) - { - retVal = TRUE; - Resource->NumberActive--; - goto done; - } + { + if (Resource->OwningThread == NtCurrentTeb()->ClientId.UniqueThread) + { + retVal = TRUE; + Resource->NumberActive--; + goto done; + } wait: - if (Wait == TRUE) - { - Resource->ExclusiveWaiters++; - - RtlLeaveCriticalSection(&Resource->Lock); - Status = NtWaitForSingleObject(Resource->ExclusiveSemaphore, - FALSE, - NULL); - if (!NT_SUCCESS(Status)) - goto done; - goto start; /* restart the acquisition to avoid deadlocks */ - } - } - else /* one or more shared locks are in progress */ - { - if (Wait == TRUE) - goto wait; - } - if (retVal == TRUE) - Resource->OwningThread = NtCurrentTeb()->ClientId.UniqueThread; + if (Wait == TRUE) + { + Resource->ExclusiveWaiters++; + + RtlLeaveCriticalSection(&Resource->Lock); + Status = NtWaitForSingleObject(Resource->ExclusiveSemaphore, + FALSE, + NULL); + if (!NT_SUCCESS(Status)) + goto done; + goto start; /* restart the acquisition to avoid deadlocks */ + } + } + else /* one or more shared locks are in progress */ + { + if (Wait == TRUE) + goto wait; + } + if (retVal == TRUE) + Resource->OwningThread = NtCurrentTeb()->ClientId.UniqueThread; done: RtlLeaveCriticalSection(&Resource->Lock); return retVal; @@ -130,186 +134,193 @@ /* * @implemented */ -BOOLEAN NTAPI -RtlAcquireResourceShared(PRTL_RESOURCE Resource, - BOOLEAN Wait) -{ - NTSTATUS Status = STATUS_UNSUCCESSFUL; - BOOLEAN retVal = FALSE; +BOOLEAN +NTAPI +RtlAcquireResourceShared( + PRTL_RESOURCE Resource, + BOOLEAN Wait) +{ + NTSTATUS Status = STATUS_UNSUCCESSFUL; + BOOLEAN retVal = FALSE; start: - RtlEnterCriticalSection(&Resource->Lock); - if (Resource->NumberActive < 0) - { - if (Resource->OwningThread == NtCurrentTeb()->ClientId.UniqueThread) - { - Resource->NumberActive--; - retVal = TRUE; - goto done; - } - - if (Wait == TRUE) - { - Resource->SharedWaiters++; - RtlLeaveCriticalSection(&Resource->Lock); - Status = NtWaitForSingleObject(Resource->SharedSemaphore, - FALSE, - NULL); - if (!NT_SUCCESS(Status)) - goto done; - goto start; - } - } - else - { - if (Status != STATUS_WAIT_0) /* otherwise RtlReleaseResource() has already done it */ - Resource->NumberActive++; - retVal = TRUE; - } + RtlEnterCriticalSection(&Resource->Lock); + if (Resource->NumberActive < 0) + { + if (Resource->OwningThread == NtCurrentTeb()->ClientId.UniqueThread) + { + Resource->NumberActive--; + retVal = TRUE; + goto done; + } + + if (Wait == TRUE) + { + Resource->SharedWaiters++; + RtlLeaveCriticalSection(&Resource->Lock); + Status = NtWaitForSingleObject(Resource->SharedSemaphore, + FALSE, + NULL); + if (!NT_SUCCESS(Status)) + goto done; + goto start; + } + } + else + { + if (Status != STATUS_WAIT_0) /* otherwise RtlReleaseResource() has already done it */ + Resource->NumberActive++; + retVal = TRUE; + } done: - RtlLeaveCriticalSection(&Resource->Lock); - return retVal; -} - - -/* - * @implemented - */ -VOID NTAPI + RtlLeaveCriticalSection(&Resource->Lock); + return retVal; +} + + +/* + * @implemented + */ +VOID +NTAPI RtlConvertExclusiveToShared(PRTL_RESOURCE Resource) { - RtlEnterCriticalSection(&Resource->Lock); - - if (Resource->NumberActive == -1) - { - Resource->OwningThread = NULL; - - if (Resource->SharedWaiters > 0) - { - ULONG n; - /* prevent new writers from joining until - * all queued readers have done their thing */ - n = Resource->SharedWaiters; - Resource->NumberActive = Resource->SharedWaiters + 1; - Resource->SharedWaiters = 0; - NtReleaseSemaphore(Resource->SharedSemaphore, - n, - NULL); - } - else - { - Resource->NumberActive = 1; - } - } - - RtlLeaveCriticalSection(&Resource->Lock); -} - - -/* - * @implemented - */ -VOID NTAPI + RtlEnterCriticalSection(&Resource->Lock); + + if (Resource->NumberActive == -1) + { + Resource->OwningThread = NULL; + + if (Resource->SharedWaiters > 0) + { + ULONG n; + /* prevent new writers from joining until + * all queued readers have done their thing */ + n = Resource->SharedWaiters; + Resource->NumberActive = Resource->SharedWaiters + 1; + Resource->SharedWaiters = 0; + NtReleaseSemaphore(Resource->SharedSemaphore, + n, + NULL); + } + else + { + Resource->NumberActive = 1; + } + } + + RtlLeaveCriticalSection(&Resource->Lock); +} + + +/* + * @implemented + */ +VOID +NTAPI RtlConvertSharedToExclusive(PRTL_RESOURCE Resource) { - NTSTATUS Status; - - RtlEnterCriticalSection(&Resource->Lock); - - if (Resource->NumberActive == 1) - { - Resource->OwningThread = NtCurrentTeb()->ClientId.UniqueThread; - Resource->NumberActive = -1; - } - else - { - Resource->ExclusiveWaiters++; - - RtlLeaveCriticalSection(&Resource->Lock); - Status = NtWaitForSingleObject(Resource->ExclusiveSemaphore, - FALSE, - NULL); - if (!NT_SUCCESS(Status)) - return; - - RtlEnterCriticalSection(&Resource->Lock); - Resource->OwningThread = NtCurrentTeb()->ClientId.UniqueThread; - Resource->NumberActive = -1; - } - RtlLeaveCriticalSection(&Resource->Lock); -} - - -/* - * @implemented - */ -VOID NTAPI + NTSTATUS Status; + + RtlEnterCriticalSection(&Resource->Lock); + + if (Resource->NumberActive == 1) + { + Resource->OwningThread = NtCurrentTeb()->ClientId.UniqueThread; + Resource->NumberActive = -1; + } + else + { + Resource->ExclusiveWaiters++; + + RtlLeaveCriticalSection(&Resource->Lock); + Status = NtWaitForSingleObject(Resource->ExclusiveSemaphore, + FALSE, + NULL); + if (!NT_SUCCESS(Status)) + return; + + RtlEnterCriticalSection(&Resource->Lock); + Resource->OwningThread = NtCurrentTeb()->ClientId.UniqueThread; + Resource->NumberActive = -1; + } + RtlLeaveCriticalSection(&Resource->Lock); +} + + +/* + * @implemented + */ +VOID +NTAPI RtlReleaseResource(PRTL_RESOURCE Resource) { - RtlEnterCriticalSection(&Resource->Lock); - - if (Resource->NumberActive > 0) /* have one or more readers */ - { - Resource->NumberActive--; - if (Resource->NumberActive == 0) - { - if (Resource->ExclusiveWaiters > 0) - { + RtlEnterCriticalSection(&Resource->Lock); + + if (Resource->NumberActive > 0) /* have one or more readers */ + { + Resource->NumberActive--; + if (Resource->NumberActive == 0) + { + if (Resource->ExclusiveWaiters > 0) + { wake_exclusive: - Resource->ExclusiveWaiters--; - NtReleaseSemaphore(Resource->ExclusiveSemaphore, - 1, - NULL); - } - } - } - else if (Resource->NumberActive < 0) /* have a writer, possibly recursive */ - { - Resource->NumberActive++; - if (Resource->NumberActive == 0) - { - Resource->OwningThread = 0; - if (Resource->ExclusiveWaiters > 0) - { - goto wake_exclusive; - } - else - { - if (Resource->SharedWaiters > 0) - { - ULONG n; - /* prevent new writers from joining until - * all queued readers have done their thing */ - n = Resource->SharedWaiters; - Resource->NumberActive = Resource->SharedWaiters; - Resource->SharedWaiters = 0; - NtReleaseSemaphore(Resource->SharedSemaphore, - n, - NULL); - } - } - } - } - RtlLeaveCriticalSection(&Resource->Lock); -} - - -/* - * @implemented - */ -VOID NTAPI + Resource->ExclusiveWaiters--; + NtReleaseSemaphore(Resource->ExclusiveSemaphore, + 1, + NULL); + } + } + } + else if (Resource->NumberActive < 0) /* have a writer, possibly recursive */ + { + Resource->NumberActive++; + if (Resource->NumberActive == 0) + { + Resource->OwningThread = 0; + if (Resource->ExclusiveWaiters > 0) + { + goto wake_exclusive; + } + else + { + if (Resource->SharedWaiters > 0) + { + ULONG n; + /* prevent new writers from joining until + * all queued readers have done their thing */ + n = Resource->SharedWaiters; + Resource->NumberActive = Resource->SharedWaiters; + Resource->SharedWaiters = 0; + NtReleaseSemaphore(Resource->SharedSemaphore, + n, + NULL); + } + } + } + } + RtlLeaveCriticalSection(&Resource->Lock); +} + + +/* + * @implemented + */ +VOID +NTAPI RtlDumpResource(PRTL_RESOURCE Resource) { - DbgPrint("RtlDumpResource(%p):\n\tactive count = %i\n\twaiting readers = %i\n\twaiting writers = %i\n", - Resource, - Resource->NumberActive, - Resource->SharedWaiters, - Resource->ExclusiveWaiters); - if (Resource->NumberActive != 0) - { - DbgPrint("\towner thread = %08x\n", - Resource->OwningThread); - } + DbgPrint("RtlDumpResource(%p):\n\tactive count = %i\n\twaiting readers = %i\n\twaiting writers = %i\n", + Resource, + Resource->NumberActive, + Resource->SharedWaiters, + Resource->ExclusiveWaiters); + + if (Resource->NumberActive != 0) + { + DbgPrint("\towner thread = %08x\n", + Resource->OwningThread); + } } /* EOF */
11 years, 11 months
1
0
0
0
[ekohl] 58196: [SAMSRV] - Add a generic delete function for database objects. - Do not create Members sub keys for group objects. - Get rid of the SamDbContainerObject object type. - Implement Samr...
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jan 20 10:22:15 2013 New Revision: 58196 URL:
http://svn.reactos.org/svn/reactos?rev=58196&view=rev
Log: [SAMSRV] - Add a generic delete function for database objects. - Do not create Members sub keys for group objects. - Get rid of the SamDbContainerObject object type. - Implement SamrDeleteGroup. Modified: trunk/reactos/dll/win32/samsrv/database.c trunk/reactos/dll/win32/samsrv/samrpc.c trunk/reactos/dll/win32/samsrv/samsrv.h Modified: trunk/reactos/dll/win32/samsrv/database.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/database.…
============================================================================== --- trunk/reactos/dll/win32/samsrv/database.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/database.c [iso-8859-1] Sun Jan 20 10:22:15 2013 @@ -157,8 +157,7 @@ 0, NULL); - if ((ObjectType == SamDbAliasObject) || - (ObjectType == SamDbGroupObject)) + if (ObjectType == SamDbAliasObject) { /* Open the object key */ RtlInitUnicodeString(&KeyName, @@ -244,9 +243,6 @@ NewObject->RelativeId = RelativeId; NewObject->ParentObject = ParentObject; - if (ParentObject != NULL) - ParentObject->RefCount++; - *DbObject = NewObject; return STATUS_SUCCESS; @@ -313,8 +309,7 @@ KEY_ALL_ACCESS, &ObjectAttributes); - if ((ObjectType == SamDbAliasObject) || - (ObjectType == SamDbGroupObject)) + if (ObjectType == SamDbAliasObject) { /* Open the object key */ RtlInitUnicodeString(&KeyName, @@ -396,9 +391,6 @@ NewObject->RelativeId = RelativeId; NewObject->ParentObject = ParentObject; - if (ParentObject != NULL) - ParentObject->RefCount++; - *DbObject = NewObject; return STATUS_SUCCESS; @@ -475,13 +467,143 @@ RtlFreeHeap(RtlGetProcessHeap(), 0, DbObject); - if (ParentObject != NULL) - { - ParentObject->RefCount--; - - if (ParentObject->RefCount == 0) - Status = SampCloseDbObject(ParentObject); - } + return Status; +} + + +NTSTATUS +SampDeleteAccountDbObject(PSAM_DB_OBJECT DbObject) +{ + LPCWSTR ContainerName; + LPWSTR AccountName = NULL; + HKEY ContainerKey; + HKEY NamesKey; + ULONG Length = 0; + NTSTATUS Status = STATUS_SUCCESS; + + TRACE("(%p)\n", DbObject); + + /* Server and Domain objects cannot be deleted */ + switch (DbObject->ObjectType) + { + case SamDbAliasObject: + ContainerName = L"Aliases"; + break; + + case SamDbGroupObject: + ContainerName = L"Groups"; + break; + + case SamDbUserObject: + ContainerName = L"Users"; + break; + + default: + return STATUS_INVALID_PARAMETER; + } + + /* Get the account name */ + Status = SampGetObjectAttribute(DbObject, + L"Name", + NULL, + NULL, + &Length); + if (Status != STATUS_BUFFER_OVERFLOW) + { + TRACE("Status 0x%08lx\n", Status); + goto done; + } + + AccountName = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + Length); + if (AccountName == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(DbObject, + L"Name", + NULL, + (PVOID)AccountName, + &Length); + if (!NT_SUCCESS(Status)) + { + TRACE("SampGetObjectAttribute failed (Status 0x%08lx)\n", Status); + goto done; + } + + if (DbObject->KeyHandle != NULL) + NtClose(DbObject->KeyHandle); + + if (DbObject->ObjectType == SamDbAliasObject) + { + if (DbObject->MembersKeyHandle != NULL) + NtClose(DbObject->MembersKeyHandle); + + SampRegDeleteKey(DbObject->KeyHandle, + L"Members"); + } + + /* Open the domain container key */ + Status = SampRegOpenKey(DbObject->ParentObject->KeyHandle, + ContainerName, + DELETE | KEY_SET_VALUE, + &ContainerKey); + if (!NT_SUCCESS(Status)) + { + TRACE("SampRegOpenKey failed (Status 0x%08lx)\n", Status); + goto done; + } + + /* Open the Names key */ + Status = SampRegOpenKey(ContainerKey, + L"Names", + KEY_SET_VALUE, + &NamesKey); + if (!NT_SUCCESS(Status)) + { + TRACE("SampRegOpenKey failed (Status 0x%08lx)\n", Status); + goto done; + } + + /* Remove the account from the Names key */ + Status = SampRegDeleteValue(NamesKey, + AccountName); + if (!NT_SUCCESS(Status)) + { + TRACE("SampRegDeleteValue failed (Status 0x%08lx)\n", Status); + goto done; + } + + /* Remove the account key from the container */ + Status = SampRegDeleteKey(ContainerKey, + DbObject->Name); + if (!NT_SUCCESS(Status)) + { + TRACE("SampRegDeleteKey failed (Status 0x%08lx)\n", Status); + goto done; + } + + /* Release the database object name */ + if (DbObject->Name != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, DbObject->Name); + + /* Release the database object */ + RtlFreeHeap(RtlGetProcessHeap(), 0, DbObject); + + Status = STATUS_SUCCESS; + +done: + if (NamesKey != NULL) + SampRegCloseKey(NamesKey); + + if (ContainerKey != NULL) + SampRegCloseKey(ContainerKey); + + if (AccountName != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, AccountName); return Status; } 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 Jan 20 10:22:15 2013 @@ -3952,7 +3952,7 @@ &UserObject); if (!NT_SUCCESS(Status)) { - ERR("SampOpenUserObject() failed (Status 0x%08lx)\n", Status); + TRACE("SampOpenUserObject() failed (Status 0x%08lx)\n", Status); goto done; } @@ -3962,7 +3962,7 @@ Attributes); if (!NT_SUCCESS(Status)) { - ERR("SampAddGroupMembershipToUser() failed (Status 0x%08lx)\n", Status); + TRACE("SampAddGroupMembershipToUser() failed (Status 0x%08lx)\n", Status); goto done; } @@ -3971,7 +3971,7 @@ MemberId); if (!NT_SUCCESS(Status)) { - ERR("SampAddMemberToGroup() failed (Status 0x%08lx)\n", Status); + TRACE("SampAddMemberToGroup() failed (Status 0x%08lx)\n", Status); } done: @@ -3987,8 +3987,58 @@ NTAPI SamrDeleteGroup(IN OUT SAMPR_HANDLE *GroupHandle) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + PSAM_DB_OBJECT GroupObject; + ULONG Length = 0; + NTSTATUS Status; + + TRACE("(%p)\n", GroupHandle); + + /* Validate the group handle */ + Status = SampValidateDbObject(*GroupHandle, + SamDbGroupObject, + DELETE, + &GroupObject); + if (!NT_SUCCESS(Status)) + { + TRACE("SampValidateDbObject() failed (Status 0x%08lx)\n", Status); + return Status; + } + + /* Fail, if the group is built-in */ + if (GroupObject->RelativeId < 1000) + { + TRACE("You can not delete a special account!\n"); + return STATUS_SPECIAL_ACCOUNT; + } + + /* Get the length of the Members attribute */ + SampGetObjectAttribute(GroupObject, + L"Members", + NULL, + NULL, + &Length); + + /* Fail, if the group has members */ + if (Length != 0) + { + TRACE("There are still members in the group!\n"); + return STATUS_MEMBER_IN_GROUP; + } + + /* FIXME: Remove the group from all aliases */ + + /* Delete the group from the database */ + Status = SampDeleteAccountDbObject(GroupObject); + if (!NT_SUCCESS(Status)) + { + TRACE("SampDeleteAccountDbObject() failed (Status 0x%08lx)\n", Status); + return Status; + } + + /* Invalidate the handle */ + *GroupHandle = NULL; + + return STATUS_SUCCESS; } 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 Jan 20 10:22:15 2013 @@ -29,7 +29,6 @@ typedef enum _SAM_DB_OBJECT_TYPE { SamDbIgnoreObject, - SamDbContainerObject, SamDbServerObject, SamDbDomainObject, SamDbAliasObject, @@ -45,7 +44,7 @@ ACCESS_MASK Access; LPWSTR Name; HANDLE KeyHandle; - HANDLE MembersKeyHandle; // only used by Aliases and Groups + HANDLE MembersKeyHandle; // only used by Aliases ULONG RelativeId; struct _SAM_DB_OBJECT *ParentObject; } SAM_DB_OBJECT, *PSAM_DB_OBJECT; @@ -143,6 +142,9 @@ SampCloseDbObject(PSAM_DB_OBJECT DbObject); NTSTATUS +SampDeleteAccountDbObject(PSAM_DB_OBJECT DbObject); + +NTSTATUS SampSetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, ULONG AttributeType,
11 years, 11 months
1
0
0
0
[tfaber] 58195: [BROWSEUI] - Build an import library
by tfaber@svn.reactos.org
Author: tfaber Date: Sun Jan 20 08:57:34 2013 New Revision: 58195 URL:
http://svn.reactos.org/svn/reactos?rev=58195&view=rev
Log: [BROWSEUI] - Build an import library Modified: trunk/reactos/dll/win32/browseui/CMakeLists.txt Modified: trunk/reactos/dll/win32/browseui/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/browseui/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/CMakeLists.txt [iso-8859-1] Sun Jan 20 08:57:34 2013 @@ -14,7 +14,7 @@ include_directories(${REACTOS_SOURCE_DIR}/lib/atl) -spec2def(browseui.dll browseui.spec) +spec2def(browseui.dll browseui.spec ADD_IMPORTLIB) list(APPEND SOURCE aclmulti.cpp
11 years, 11 months
1
0
0
0
[hbelusca] 58194: [CONSRV] - Get in a simpler way the console owned by a console window: replace GuiConsoleGetDataPointers by GuiGetWindowConsole. - Only in functions which need it, we get the GUI ...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Jan 19 22:06:28 2013 New Revision: 58194 URL:
http://svn.reactos.org/svn/reactos?rev=58194&view=rev
Log: [CONSRV] - Get in a simpler way the console owned by a console window: replace GuiConsoleGetDataPointers by GuiGetWindowConsole. - Only in functions which need it, we get the GUI data held by the console. Modified: branches/ros-csrss/win32ss/user/consrv/coninput.c branches/ros-csrss/win32ss/user/consrv/conio.h branches/ros-csrss/win32ss/user/consrv/console.c branches/ros-csrss/win32ss/user/consrv/guiconsole.c Modified: branches/ros-csrss/win32ss/user/consrv/coninput.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] Sat Jan 19 22:06:28 2013 @@ -206,7 +206,7 @@ if ((ShiftState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED) || KeyState[VK_MENU] & 0x80) && (VirtualKeyCode == VK_ESCAPE || VirtualKeyCode == VK_TAB || VirtualKeyCode == VK_SPACE)) { - DefWindowProcW( msg->hwnd, msg->message, msg->wParam, msg->lParam); + DefWindowProcW(msg->hwnd, msg->message, msg->wParam, msg->lParam); return; } } @@ -219,7 +219,7 @@ Fake = UnicodeChar && (msg->message != WM_CHAR && msg->message != WM_SYSCHAR && - msg->message != WM_KEYUP && msg->message != WM_SYSKEYUP); + msg->message != WM_KEYUP && msg->message != WM_SYSKEYUP); NotChar = (msg->message != WM_CHAR && msg->message != WM_SYSCHAR); if (NotChar) LastVirtualKey = msg->wParam; @@ -281,7 +281,7 @@ { Console->ActiveBuffer->VirtualY = (Console->ActiveBuffer->VirtualY + Console->ActiveBuffer->MaxY - 1) % - Console->ActiveBuffer->MaxY; + Console->ActiveBuffer->MaxY; Console->ActiveBuffer->CurrentY++; } } @@ -291,7 +291,7 @@ if (Console->ActiveBuffer->CurrentY != 0) { Console->ActiveBuffer->VirtualY = (Console->ActiveBuffer->VirtualY + 1) % - Console->ActiveBuffer->MaxY; + Console->ActiveBuffer->MaxY; Console->ActiveBuffer->CurrentY--; } } Modified: branches/ros-csrss/win32ss/user/consrv/conio.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] Sat Jan 19 22:06:28 2013 @@ -106,7 +106,7 @@ UNICODE_STRING Title; /* Title of console */ HWND hWindow; COORD Size; - PVOID PrivateData; + PVOID GuiData; } CONSOLE, *PCONSOLE; Modified: branches/ros-csrss/win32ss/user/consrv/console.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] Sat Jan 19 22:06:28 2013 @@ -128,7 +128,7 @@ RtlFreeHeap(ConSrvHeap, 0, Console); return STATUS_UNSUCCESSFUL; } - Console->PrivateData = NULL; + Console->GuiData = NULL; InitializeCriticalSection(&Console->Lock); GuiMode = DtbgIsDesktopVisible(); Modified: branches/ros-csrss/win32ss/user/consrv/guiconsole.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/g…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/guiconsole.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/guiconsole.c [iso-8859-1] Sat Jan 19 22:06:28 2013 @@ -37,7 +37,7 @@ /* GLOBALS *******************************************************************/ -typedef struct GUI_CONSOLE_DATA_TAG +typedef struct _GUI_CONSOLE_DATA { HFONT Font; unsigned CharWidth; @@ -198,11 +198,10 @@ } } -static VOID -GuiConsoleGetDataPointers(HWND hWnd, PCONSOLE *Console, PGUI_CONSOLE_DATA *GuiData) -{ - *Console = (PCONSOLE)GetWindowLongPtrW(hWnd, GWLP_USERDATA); - *GuiData = (NULL == *Console ? NULL : (*Console)->PrivateData); +static PCONSOLE +GuiGetWindowConsole(HWND hWnd) +{ + return (PCONSOLE)GetWindowLongPtrW(hWnd, GWLP_USERDATA); } static BOOL @@ -409,8 +408,9 @@ } static VOID -GuiConsoleWriteUserSettings(PCONSOLE Console, PGUI_CONSOLE_DATA GuiData) -{ +GuiConsoleWriteUserSettings(PCONSOLE Console) +{ + PGUI_CONSOLE_DATA GuiData = Console->GuiData; HKEY hKey; PCONSOLE_PROCESS_DATA ProcessData; @@ -616,6 +616,7 @@ } } } + static VOID GuiConsoleUseDefaults(PCONSOLE Console, PGUI_CONSOLE_DATA GuiData, PCONSOLE_SCREEN_BUFFER Buffer) { @@ -657,7 +658,7 @@ GuiConsoleInitScrollbar(PCONSOLE Console, HWND hwnd) { SCROLLINFO sInfo; - PGUI_CONSOLE_DATA GuiData = Console->PrivateData; + PGUI_CONSOLE_DATA GuiData = Console->GuiData; DWORD Width = Console->Size.X * GuiData->CharWidth + 2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE)); DWORD Height = Console->Size.Y * GuiData->CharHeight + 2 * (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYEDGE)) + GetSystemMetrics(SM_CYCAPTION); @@ -703,7 +704,7 @@ GuiConsoleHandleNcCreate(HWND hWnd, LPCREATESTRUCTW Create) { PCONSOLE Console = (PCONSOLE)Create->lpCreateParams; - PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)Console->PrivateData; + PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)Console->GuiData; HDC Dc; HFONT OldFont; TEXTMETRICW Metrics; @@ -770,7 +771,7 @@ RtlFreeHeap(ConSrvHeap, 0, GuiData); return FALSE; } - if (! GetTextMetricsW(Dc, &Metrics)) + if (!GetTextMetricsW(Dc, &Metrics)) { DPRINT1("GuiConsoleNcCreate: GetTextMetrics failed\n"); SelectObject(Dc, OldFont); @@ -794,7 +795,7 @@ GuiData->ForceCursorOff = FALSE; DPRINT("Console %p GuiData %p\n", Console, GuiData); - Console->PrivateData = GuiData; + Console->GuiData = GuiData; SetWindowLongPtrW(hWnd, GWLP_USERDATA, (DWORD_PTR)Console); SetTimer(hWnd, CONGUI_UPDATE_TIMER, CONGUI_UPDATE_TIME, NULL); @@ -813,7 +814,7 @@ SmallRectToRect(PCONSOLE Console, PRECT Rect, PSMALL_RECT SmallRect) { PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer; - PGUI_CONSOLE_DATA GuiData = Console->PrivateData; + PGUI_CONSOLE_DATA GuiData = Console->GuiData; Rect->left = (SmallRect->Left - Buffer->ShowX) * GuiData->CharWidth; Rect->top = (SmallRect->Top - Buffer->ShowY) * GuiData->CharHeight; Rect->right = (SmallRect->Right + 1 - Buffer->ShowX) * GuiData->CharWidth; @@ -880,7 +881,6 @@ ConioUnpause(Console, PAUSED_FROM_SELECTION); } } - static VOID GuiConsolePaint(PCONSOLE Console, @@ -1002,68 +1002,62 @@ } static VOID -GuiConsoleHandlePaint(HWND hWnd, HDC hDCPaint) -{ +GuiConsoleHandlePaint(PCONSOLE Console, + HWND hWnd, + HDC hDCPaint) +{ + PGUI_CONSOLE_DATA GuiData = Console->GuiData; HDC hDC; PAINTSTRUCT ps; - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; + + if (GuiData == NULL) return; + if (Console->ActiveBuffer == NULL) return; hDC = BeginPaint(hWnd, &ps); if (hDC != NULL && ps.rcPaint.left < ps.rcPaint.right && ps.rcPaint.top < ps.rcPaint.bottom) { - GuiConsoleGetDataPointers(hWnd, - &Console, - &GuiData); - if (Console != NULL && GuiData != NULL && - Console->ActiveBuffer != NULL) - { - if (Console->ActiveBuffer->Buffer != NULL) - { - EnterCriticalSection(&GuiData->Lock); - - GuiConsolePaint(Console, - GuiData, - hDC, - &ps.rcPaint); - - if (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) + if (Console->ActiveBuffer->Buffer != NULL) + { + EnterCriticalSection(&GuiData->Lock); + + GuiConsolePaint(Console, + GuiData, + hDC, + &ps.rcPaint); + + if (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) + { + RECT rc; + SmallRectToRect(Console, &rc, &Console->Selection.srSelection); + + /* invert the selection */ + if (IntersectRect(&rc, + &ps.rcPaint, + &rc)) { - RECT rc; - SmallRectToRect(Console, &rc, &Console->Selection.srSelection); - - /* invert the selection */ - if (IntersectRect(&rc, - &ps.rcPaint, - &rc)) - { - PatBlt(hDC, - rc.left, - rc.top, - rc.right - rc.left, - rc.bottom - rc.top, - DSTINVERT); - } + PatBlt(hDC, + rc.left, + rc.top, + rc.right - rc.left, + rc.bottom - rc.top, + DSTINVERT); } - - LeaveCriticalSection(&GuiData->Lock); - } - } - + } + + LeaveCriticalSection(&GuiData->Lock); + } } EndPaint(hWnd, &ps); } static VOID -GuiConsoleHandleKey(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; +GuiConsoleHandleKey(PCONSOLE Console, HWND hWnd, + UINT msg, WPARAM wParam, LPARAM lParam) +{ MSG Message; - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); Message.hwnd = hWnd; Message.message = msg; Message.wParam = wParam; @@ -1097,7 +1091,7 @@ GuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, LONG CursorStartX, LONG CursorStartY, UINT ScrolledLines, CHAR *Buffer, UINT Length) { - PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA) Console->PrivateData; + PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA) Console->GuiData; PCONSOLE_SCREEN_BUFFER Buff = Console->ActiveBuffer; LONG CursorEndX, CursorEndY; RECT ScrollRect; @@ -1175,7 +1169,7 @@ static BOOL WINAPI GuiUpdateScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff) { - PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA) Console->PrivateData; + PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA) Console->GuiData; if (Console->ActiveBuffer == Buff) { @@ -1187,15 +1181,14 @@ } static VOID -GuiConsoleHandleTimer(HWND hWnd) -{ - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; +GuiConsoleHandleTimer(PCONSOLE Console, HWND hWnd) +{ + PGUI_CONSOLE_DATA GuiData = Console->GuiData; PCONSOLE_SCREEN_BUFFER Buff; + if (GuiData == NULL) return; + SetTimer(hWnd, CONGUI_UPDATE_TIMER, CURSOR_BLINK_TIME, NULL); - - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); Buff = Console->ActiveBuffer; GuiInvalidateCell(Console, Buff->CurrentX, Buff->CurrentY); @@ -1276,14 +1269,10 @@ } static VOID -GuiConsoleHandleClose(HWND hWnd) -{ - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; +GuiConsoleHandleClose(PCONSOLE Console, HWND hWnd) +{ PLIST_ENTRY current_entry; PCONSOLE_PROCESS_DATA current; - - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); EnterCriticalSection(&Console->Lock); @@ -1303,15 +1292,12 @@ } static VOID -GuiConsoleHandleNcDestroy(HWND hWnd) -{ - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; - - - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); +GuiConsoleHandleNcDestroy(PCONSOLE Console, HWND hWnd) +{ + PGUI_CONSOLE_DATA GuiData = Console->GuiData; + KillTimer(hWnd, 1); - Console->PrivateData = NULL; + Console->GuiData = NULL; DeleteCriticalSection(&GuiData->Lock); GetSystemMenu(hWnd, TRUE); if (GuiData->ConsoleLibrary) @@ -1323,9 +1309,10 @@ static COORD PointToCoord(PCONSOLE Console, LPARAM lParam) { + PGUI_CONSOLE_DATA GuiData = Console->GuiData; PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer; - PGUI_CONSOLE_DATA GuiData = Console->PrivateData; COORD Coord; + Coord.X = Buffer->ShowX + ((short)LOWORD(lParam) / (int)GuiData->CharWidth); Coord.Y = Buffer->ShowY + ((short)HIWORD(lParam) / (int)GuiData->CharHeight); @@ -1334,18 +1321,14 @@ else if (Coord.X >= Buffer->MaxX) Coord.X = Buffer->MaxX - 1; if (Coord.Y < 0) Coord.Y = 0; else if (Coord.Y >= Buffer->MaxY) Coord.Y = Buffer->MaxY - 1; + return Coord; } static VOID -GuiConsoleLeftMouseDown(HWND hWnd, LPARAM lParam) -{ - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; - - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); - if (Console == NULL || GuiData == NULL) return; - +GuiConsoleLeftMouseDown(PCONSOLE Console, HWND hWnd, + LPARAM lParam) +{ Console->Selection.dwSelectionAnchor = PointToCoord(Console, lParam); SetCapture(hWnd); @@ -1356,14 +1339,11 @@ } static VOID -GuiConsoleLeftMouseUp(HWND hWnd, LPARAM lParam) -{ - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; +GuiConsoleLeftMouseUp(PCONSOLE Console, HWND hWnd, + LPARAM lParam) +{ COORD c; - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); - if (Console == NULL || GuiData == NULL) return; if (!(Console->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) return; c = PointToCoord(Console, lParam); @@ -1376,16 +1356,13 @@ } static VOID -GuiConsoleMouseMove(HWND hWnd, WPARAM wParam, LPARAM lParam) -{ - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; +GuiConsoleMouseMove(PCONSOLE Console, HWND hWnd, + WPARAM wParam, LPARAM lParam) +{ COORD c; if (!(wParam & MK_LBUTTON)) return; - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); - if (Console == NULL || GuiData == NULL) return; if (!(Console->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) return; c = PointToCoord(Console, lParam); /* TODO: Scroll buffer to bring c into view */ @@ -1497,14 +1474,8 @@ } static VOID -GuiConsoleRightMouseDown(HWND hWnd) -{ - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; - - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); - if (Console == NULL || GuiData == NULL) return; - +GuiConsoleRightMouseDown(PCONSOLE Console, HWND hWnd) +{ if (!(Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY)) { GuiConsolePaste(hWnd, Console); @@ -1516,26 +1487,21 @@ /* Clear the selection */ GuiConsoleUpdateSelection(Console, NULL); } - } static VOID -GuiConsoleShowConsoleProperties(HWND hWnd, BOOL Defaults, PGUI_CONSOLE_DATA GuiData) -{ - PCONSOLE Console; +GuiConsoleShowConsoleProperties(PCONSOLE Console, + HWND hWnd, + BOOL Defaults) +{ + PGUI_CONSOLE_DATA GuiData = Console->GuiData; APPLET_PROC CPLFunc; WCHAR szBuffer[MAX_PATH]; ConsoleInfo SharedInfo; DPRINT("GuiConsoleShowConsoleProperties entered\n"); - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); - - if (GuiData == NULL) - { - DPRINT("GuiConsoleGetDataPointers failed\n"); - return; - } + if (GuiData == NULL) return; if (GuiData->ConsoleLibrary == NULL) { @@ -1592,68 +1558,67 @@ CPLFunc(hWnd, CPL_DBLCLK, (LPARAM)&SharedInfo, Defaults); CPLFunc(hWnd, CPL_EXIT , 0, 0); } + static LRESULT -GuiConsoleHandleSysMenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) +GuiConsoleHandleSysMenuCommand(PCONSOLE Console, + HWND hWnd, + WPARAM wParam, LPARAM lParam) { LRESULT Ret = TRUE; - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; COORD bottomRight = { 0, 0 }; - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); - - switch(wParam) - { - case ID_SYSTEM_EDIT_MARK: - DPRINT1("Marking not handled yet\n"); - break; - - case ID_SYSTEM_EDIT_COPY: - GuiConsoleCopy(hWnd, Console); - break; - - case ID_SYSTEM_EDIT_PASTE: - GuiConsolePaste(hWnd, Console); - break; - - case ID_SYSTEM_EDIT_SELECTALL: - bottomRight.X = Console->Size.X - 1; - bottomRight.Y = Console->Size.Y - 1; - GuiConsoleUpdateSelection(Console, &bottomRight); - break; - - case ID_SYSTEM_EDIT_SCROLL: - DPRINT1("Scrolling is not handled yet\n"); - break; - - case ID_SYSTEM_EDIT_FIND: - DPRINT1("Finding is not handled yet\n"); - break; - - case ID_SYSTEM_DEFAULTS: - GuiConsoleShowConsoleProperties(hWnd, TRUE, GuiData); - break; - - case ID_SYSTEM_PROPERTIES: - GuiConsoleShowConsoleProperties(hWnd, FALSE, GuiData); - break; - - default: - Ret = DefWindowProcW(hWnd, WM_SYSCOMMAND, wParam, lParam); - break; + switch (wParam) + { + case ID_SYSTEM_EDIT_MARK: + DPRINT1("Marking not handled yet\n"); + break; + + case ID_SYSTEM_EDIT_COPY: + GuiConsoleCopy(hWnd, Console); + break; + + case ID_SYSTEM_EDIT_PASTE: + GuiConsolePaste(hWnd, Console); + break; + + case ID_SYSTEM_EDIT_SELECTALL: + bottomRight.X = Console->Size.X - 1; + bottomRight.Y = Console->Size.Y - 1; + GuiConsoleUpdateSelection(Console, &bottomRight); + break; + + case ID_SYSTEM_EDIT_SCROLL: + DPRINT1("Scrolling is not handled yet\n"); + break; + + case ID_SYSTEM_EDIT_FIND: + DPRINT1("Finding is not handled yet\n"); + break; + + case ID_SYSTEM_DEFAULTS: + GuiConsoleShowConsoleProperties(Console, hWnd, TRUE); + break; + + case ID_SYSTEM_PROPERTIES: + GuiConsoleShowConsoleProperties(Console, hWnd, FALSE); + break; + + default: + Ret = DefWindowProcW(hWnd, WM_SYSCOMMAND, wParam, lParam); + break; } return Ret; } static VOID -GuiConsoleGetMinMaxInfo(HWND hWnd, PMINMAXINFO minMaxInfo) -{ - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; +GuiConsoleGetMinMaxInfo(PCONSOLE Console, + HWND hWnd, + PMINMAXINFO minMaxInfo) +{ + PGUI_CONSOLE_DATA GuiData = Console->GuiData; DWORD windx, windy; - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); - if((Console == NULL)|| (GuiData == NULL)) return; + if (GuiData == NULL) return; windx = CONGUI_MIN_WIDTH * GuiData->CharWidth + 2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE)); windy = CONGUI_MIN_HEIGHT * GuiData->CharHeight + 2 * (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYEDGE)) + GetSystemMetrics(SM_CYCAPTION); @@ -1670,13 +1635,15 @@ minMaxInfo->ptMaxTrackSize.x = windx; minMaxInfo->ptMaxTrackSize.y = windy; } + static VOID -GuiConsoleResize(HWND hWnd, WPARAM wParam, LPARAM lParam) -{ - PCONSOLE Console; - PGUI_CONSOLE_DATA GuiData; - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); - if((Console == NULL) || (GuiData == NULL)) return; +GuiConsoleResize(PCONSOLE Console, + HWND hWnd, + WPARAM wParam, LPARAM lParam) +{ + PGUI_CONSOLE_DATA GuiData = Console->GuiData; + + if (GuiData == NULL) return; if ((GuiData->WindowSizeLock == FALSE) && (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED || wParam == SIZE_MINIMIZED)) { @@ -1848,8 +1815,10 @@ } static VOID -GuiApplyUserSettings(PCONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsoleInfo pConInfo) -{ +GuiApplyUserSettings(PCONSOLE Console, + PConsoleInfo pConInfo) +{ + PGUI_CONSOLE_DATA GuiData = Console->GuiData; DWORD windx, windy; PCONSOLE_SCREEN_BUFFER ActiveBuffer = Console->ActiveBuffer; COORD BufSize; @@ -1896,19 +1865,20 @@ static LRESULT -GuiConsoleHandleScroll(HWND hwnd, UINT uMsg, WPARAM wParam) -{ - PCONSOLE Console; +GuiConsoleHandleScroll(PCONSOLE Console, + HWND hWnd, + UINT uMsg, + WPARAM wParam) +{ + PGUI_CONSOLE_DATA GuiData = Console->GuiData; PCONSOLE_SCREEN_BUFFER Buff; - PGUI_CONSOLE_DATA GuiData; SCROLLINFO sInfo; int fnBar; int old_pos, Maximum; PUSHORT pShowXY; - GuiConsoleGetDataPointers(hwnd, &Console, &GuiData); - if (Console == NULL || GuiData == NULL) - return FALSE; + if (GuiData == NULL) return FALSE; + Buff = Console->ActiveBuffer; if (uMsg == WM_HSCROLL) @@ -1928,50 +1898,50 @@ sInfo.cbSize = sizeof(SCROLLINFO); sInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE | SIF_TRACKPOS; - if (!GetScrollInfo(hwnd, fnBar, &sInfo)) + if (!GetScrollInfo(hWnd, fnBar, &sInfo)) { return FALSE; } old_pos = sInfo.nPos; - switch(LOWORD(wParam)) - { - case SB_LINELEFT: - sInfo.nPos -= 1; - break; - - case SB_LINERIGHT: - sInfo.nPos += 1; - break; - - case SB_PAGELEFT: - sInfo.nPos -= sInfo.nPage; - break; - - case SB_PAGERIGHT: - sInfo.nPos += sInfo.nPage; - break; - - case SB_THUMBTRACK: - sInfo.nPos = sInfo.nTrackPos; - ConioPause(Console, PAUSED_FROM_SCROLLBAR); - break; - - case SB_THUMBPOSITION: - ConioUnpause(Console, PAUSED_FROM_SCROLLBAR); - break; - - case SB_TOP: - sInfo.nPos = sInfo.nMin; - break; - - case SB_BOTTOM: - sInfo.nPos = sInfo.nMax; - break; - - default: - break; + switch (LOWORD(wParam)) + { + case SB_LINELEFT: + sInfo.nPos -= 1; + break; + + case SB_LINERIGHT: + sInfo.nPos += 1; + break; + + case SB_PAGELEFT: + sInfo.nPos -= sInfo.nPage; + break; + + case SB_PAGERIGHT: + sInfo.nPos += sInfo.nPage; + break; + + case SB_THUMBTRACK: + sInfo.nPos = sInfo.nTrackPos; + ConioPause(Console, PAUSED_FROM_SCROLLBAR); + break; + + case SB_THUMBPOSITION: + ConioUnpause(Console, PAUSED_FROM_SCROLLBAR); + break; + + case SB_TOP: + sInfo.nPos = sInfo.nMin; + break; + + case SB_BOTTOM: + sInfo.nPos = sInfo.nMax; + break; + + default: + break; } sInfo.nPos = max(sInfo.nPos, 0); @@ -1983,7 +1953,7 @@ USHORT OldY = Buff->ShowY; *pShowXY = sInfo.nPos; - ScrollWindowEx(hwnd, + ScrollWindowEx(hWnd, (OldX - Buff->ShowX) * GuiData->CharWidth, (OldY - Buff->ShowY) * GuiData->CharHeight, NULL, @@ -1993,10 +1963,11 @@ SW_INVALIDATE); sInfo.fMask = SIF_POS; - SetScrollInfo(hwnd, fnBar, &sInfo, TRUE); - - UpdateWindow(hwnd); - } + SetScrollInfo(hWnd, fnBar, &sInfo, TRUE); + + UpdateWindow(hWnd); + } + return 0; } @@ -2004,70 +1975,96 @@ GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { LRESULT Result = 0; - PGUI_CONSOLE_DATA GuiData = NULL; PCONSOLE Console = NULL; - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); - - switch(msg) - { - case WM_NCCREATE: - Result = (LRESULT) GuiConsoleHandleNcCreate(hWnd, (LPCREATESTRUCTW)lParam); - break; - case WM_PAINT: - GuiConsoleHandlePaint(hWnd, (HDC)wParam); - break; - case WM_KEYDOWN: - case WM_KEYUP: - case WM_SYSKEYDOWN: - case WM_SYSKEYUP: - case WM_CHAR: - GuiConsoleHandleKey(hWnd, msg, wParam, lParam); - break; - case WM_TIMER: - GuiConsoleHandleTimer(hWnd); - break; - case WM_CLOSE: - GuiConsoleHandleClose(hWnd); - break; - case WM_NCDESTROY: - GuiConsoleHandleNcDestroy(hWnd); - break; - case WM_LBUTTONDOWN: - GuiConsoleLeftMouseDown(hWnd, lParam); - break; - case WM_LBUTTONUP: - GuiConsoleLeftMouseUp(hWnd, lParam); - break; - case WM_RBUTTONDOWN: - GuiConsoleRightMouseDown(hWnd); - break; - case WM_MOUSEMOVE: - GuiConsoleMouseMove(hWnd, wParam, lParam); - break; - case WM_SYSCOMMAND: - Result = GuiConsoleHandleSysMenuCommand(hWnd, wParam, lParam); - break; - case WM_HSCROLL: - case WM_VSCROLL: - Result = GuiConsoleHandleScroll(hWnd, msg, wParam); - break; - case WM_GETMINMAXINFO: - GuiConsoleGetMinMaxInfo(hWnd, (PMINMAXINFO)lParam); - break; - case WM_SIZE: - GuiConsoleResize(hWnd, wParam, lParam); - break; - case PM_APPLY_CONSOLE_INFO: - GuiApplyUserSettings(Console, GuiData, (PConsoleInfo)wParam); - if (lParam) - { - GuiConsoleWriteUserSettings(Console, GuiData); - } - break; - default: - Result = DefWindowProcW(hWnd, msg, wParam, lParam); - break; + /* + * If it's the first time we create a window + * for the console, just initialize it. + */ + if (msg == WM_NCCREATE) + { + return (LRESULT)GuiConsoleHandleNcCreate(hWnd, (LPCREATESTRUCTW)lParam); + } + + /* + * Now the console window is initialized. + * Get the console owned by the window. + * If there is no console, just go away. + */ + Console = GuiGetWindowConsole(hWnd); + if (Console == NULL) return 0; + + /* We have a console, start message dispatching. */ + switch (msg) + { + case WM_PAINT: + GuiConsoleHandlePaint(Console, hWnd, (HDC)wParam); + break; + + case WM_KEYDOWN: + case WM_KEYUP: + case WM_SYSKEYDOWN: + case WM_SYSKEYUP: + case WM_CHAR: + GuiConsoleHandleKey(Console, hWnd, msg, wParam, lParam); + break; + + case WM_TIMER: + GuiConsoleHandleTimer(Console, hWnd); + break; + + case WM_CLOSE: + GuiConsoleHandleClose(Console, hWnd); + break; + + case WM_NCDESTROY: + GuiConsoleHandleNcDestroy(Console, hWnd); + break; + + case WM_LBUTTONDOWN: + GuiConsoleLeftMouseDown(Console, hWnd, lParam); + break; + + case WM_LBUTTONUP: + GuiConsoleLeftMouseUp(Console, hWnd, lParam); + break; + + case WM_RBUTTONDOWN: + GuiConsoleRightMouseDown(Console, hWnd); + break; + + case WM_MOUSEMOVE: + GuiConsoleMouseMove(Console, hWnd, wParam, lParam); + break; + + case WM_SYSCOMMAND: + Result = GuiConsoleHandleSysMenuCommand(Console, hWnd, wParam, lParam); + break; + + case WM_HSCROLL: + case WM_VSCROLL: + Result = GuiConsoleHandleScroll(Console, hWnd, msg, wParam); + break; + + case WM_GETMINMAXINFO: + GuiConsoleGetMinMaxInfo(Console, hWnd, (PMINMAXINFO)lParam); + break; + + case WM_SIZE: + GuiConsoleResize(Console, hWnd, wParam, lParam); + break; + + case PM_APPLY_CONSOLE_INFO: + GuiApplyUserSettings(Console, (PConsoleInfo)wParam); + if (lParam) + { + GuiConsoleWriteUserSettings(Console); + } + break; + + default: + Result = DefWindowProcW(hWnd, msg, wParam, lParam); + break; } return Result; @@ -2082,71 +2079,71 @@ PWCHAR Buffer, Title; PCONSOLE Console = (PCONSOLE) lParam; - switch(msg) - { - case WM_CREATE: - SetWindowLongW(hWnd, GWL_USERDATA, 0); - return 0; - case PM_CREATE_CONSOLE: - Buffer = RtlAllocateHeap(ConSrvHeap, 0, - Console->Title.Length + sizeof(WCHAR)); - if (NULL != Buffer) - { - memcpy(Buffer, Console->Title.Buffer, Console->Title.Length); - Buffer[Console->Title.Length / sizeof(WCHAR)] = L'\0'; - Title = Buffer; - } - else - { - Title = L""; - } - NewWindow = CreateWindowExW(WS_EX_CLIENTEDGE, - GUI_CONSOLE_WINDOW_CLASS, - Title, - WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, - NULL, - (HINSTANCE)GetModuleHandleW(NULL), - (PVOID)Console); - if (NULL != Buffer) - { - RtlFreeHeap(ConSrvHeap, 0, Buffer); - } - if (NULL != NewWindow) - { - SetConsoleWndConsoleLeaderCID(Console); - SetWindowLongW(hWnd, GWL_USERDATA, GetWindowLongW(hWnd, GWL_USERDATA) + 1); - ShowWindow(NewWindow, (int)wParam); - } - return (LRESULT)NewWindow; - case PM_DESTROY_CONSOLE: - /* Window creation is done using a PostMessage(), so it's possible that the - * window that we want to destroy doesn't exist yet. So first empty the message - * queue */ - while(PeekMessageW(&Msg, NULL, 0, 0, PM_REMOVE)) - { - TranslateMessage(&Msg); - DispatchMessageW(&Msg); - } - DestroyWindow(Console->hWindow); - Console->hWindow = NULL; - WindowCount = GetWindowLongW(hWnd, GWL_USERDATA); - WindowCount--; - SetWindowLongW(hWnd, GWL_USERDATA, WindowCount); - if (0 == WindowCount) - { - NotifyWnd = NULL; - DestroyWindow(hWnd); - PrivateCsrssManualGuiCheck(-1); - PostQuitMessage(0); - } - return 0; - default: - return DefWindowProcW(hWnd, msg, wParam, lParam); + switch (msg) + { + case WM_CREATE: + SetWindowLongW(hWnd, GWL_USERDATA, 0); + return 0; + case PM_CREATE_CONSOLE: + Buffer = RtlAllocateHeap(ConSrvHeap, 0, + Console->Title.Length + sizeof(WCHAR)); + if (NULL != Buffer) + { + memcpy(Buffer, Console->Title.Buffer, Console->Title.Length); + Buffer[Console->Title.Length / sizeof(WCHAR)] = L'\0'; + Title = Buffer; + } + else + { + Title = L""; + } + NewWindow = CreateWindowExW(WS_EX_CLIENTEDGE, + GUI_CONSOLE_WINDOW_CLASS, + Title, + WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + NULL, + NULL, + (HINSTANCE)GetModuleHandleW(NULL), + (PVOID)Console); + if (NULL != Buffer) + { + RtlFreeHeap(ConSrvHeap, 0, Buffer); + } + if (NULL != NewWindow) + { + SetConsoleWndConsoleLeaderCID(Console); + SetWindowLongW(hWnd, GWL_USERDATA, GetWindowLongW(hWnd, GWL_USERDATA) + 1); + ShowWindow(NewWindow, (int)wParam); + } + return (LRESULT)NewWindow; + case PM_DESTROY_CONSOLE: + /* Window creation is done using a PostMessage(), so it's possible that the + * window that we want to destroy doesn't exist yet. So first empty the message + * queue */ + while(PeekMessageW(&Msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&Msg); + DispatchMessageW(&Msg); + } + DestroyWindow(Console->hWindow); + Console->hWindow = NULL; + WindowCount = GetWindowLongW(hWnd, GWL_USERDATA); + WindowCount--; + SetWindowLongW(hWnd, GWL_USERDATA, WindowCount); + if (0 == WindowCount) + { + NotifyWnd = NULL; + DestroyWindow(hWnd); + PrivateCsrssManualGuiCheck(-1); + PostQuitMessage(0); + } + return 0; + default: + return DefWindowProcW(hWnd, msg, wParam, lParam); } } @@ -2365,7 +2362,7 @@ return STATUS_UNSUCCESSFUL; } - Console->PrivateData = (PVOID)GuiData; + Console->GuiData = (PVOID)GuiData; /* * we need to wait until the GUI has been fully initialized * to retrieve custom settings i.e. WindowSize etc.. @@ -2379,7 +2376,7 @@ /* wait until initialization has finished */ WaitForSingleObject(GuiData->hGuiInitEvent, INFINITE); - DPRINT("received event Console %p GuiData %p X %d Y %d\n", Console, Console->PrivateData, Console->Size.X, Console->Size.Y); + DPRINT("received event Console %p GuiData %p X %d Y %d\n", Console, Console->GuiData, Console->Size.X, Console->Size.Y); CloseHandle(GuiData->hGuiInitEvent); GuiData->hGuiInitEvent = NULL;
11 years, 11 months
1
0
0
0
[tkreuzer] 58193: [SAL.H] "Implement" all used annotations [XDK/DDK] Add missing annotations, move some prototypes to more appropriate headers [NDK] Fix a number of annotations [NDK] Use SAL2 dummy...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Jan 19 21:49:12 2013 New Revision: 58193 URL:
http://svn.reactos.org/svn/reactos?rev=58193&view=rev
Log: [SAL.H] "Implement" all used annotations [XDK/DDK] Add missing annotations, move some prototypes to more appropriate headers [NDK] Fix a number of annotations [NDK] Use SAL2 dummys from umtypes as well Modified: trunk/reactos/include/ddk/ntifs.h trunk/reactos/include/ddk/wdm.h trunk/reactos/include/ndk/exfuncs.h trunk/reactos/include/ndk/kefuncs.h trunk/reactos/include/ndk/mmfuncs.h trunk/reactos/include/ndk/obfuncs.h trunk/reactos/include/ndk/rtlfuncs.h trunk/reactos/include/ndk/sefuncs.h trunk/reactos/include/ndk/setypes.h trunk/reactos/include/ndk/umtypes.h trunk/reactos/include/psdk/sal.h trunk/reactos/include/xdk/mmfuncs.h trunk/reactos/include/xdk/ntifs.template.h trunk/reactos/include/xdk/obfuncs.h trunk/reactos/include/xdk/rtlfuncs.h trunk/reactos/include/xdk/zwfuncs.h [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/include/ddk/ntifs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ntifs.h?rev=58…
Modified: trunk/reactos/include/ddk/wdm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=5819…
Modified: trunk/reactos/include/ndk/exfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/exfuncs.h?rev=…
Modified: trunk/reactos/include/ndk/kefuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/kefuncs.h?rev=…
Modified: trunk/reactos/include/ndk/mmfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/mmfuncs.h?rev=…
Modified: trunk/reactos/include/ndk/obfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/obfuncs.h?rev=…
Modified: trunk/reactos/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
Modified: trunk/reactos/include/ndk/sefuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/sefuncs.h?rev=…
Modified: trunk/reactos/include/ndk/setypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/setypes.h?rev=…
Modified: trunk/reactos/include/ndk/umtypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/umtypes.h?rev=…
Modified: trunk/reactos/include/psdk/sal.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/sal.h?rev=581…
Modified: trunk/reactos/include/xdk/mmfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/mmfuncs.h?rev=…
Modified: trunk/reactos/include/xdk/ntifs.template.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/ntifs.template…
Modified: trunk/reactos/include/xdk/obfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/obfuncs.h?rev=…
Modified: trunk/reactos/include/xdk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/rtlfuncs.h?rev…
Modified: trunk/reactos/include/xdk/zwfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/zwfuncs.h?rev=…
11 years, 11 months
1
0
0
0
[tfaber] 58192: [EXPLORER_NEW] - Restructure TaskSwitchWnd_CheckActivateTaskItem. No logic change intended.
by tfaber@svn.reactos.org
Author: tfaber Date: Fri Jan 18 23:34:51 2013 New Revision: 58192 URL:
http://svn.reactos.org/svn/reactos?rev=58192&view=rev
Log: [EXPLORER_NEW] - Restructure TaskSwitchWnd_CheckActivateTaskItem. No logic change intended. Modified: trunk/reactos/base/shell/explorer-new/taskswnd.c Modified: trunk/reactos/base/shell/explorer-new/taskswnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/ta…
============================================================================== --- trunk/reactos/base/shell/explorer-new/taskswnd.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer-new/taskswnd.c [iso-8859-1] Fri Jan 18 23:34:51 2013 @@ -945,58 +945,49 @@ if (TaskItem != NULL) TaskGroup = TaskItem->Group; - if (This->IsGroupingEnabled && TaskGroup != NULL) - { - if (TaskGroup->IsCollapsed) - { + if (This->IsGroupingEnabled && + TaskGroup != NULL && + TaskGroup->IsCollapsed) + { + /* FIXME */ + return; + } + + if (ActiveTaskItem != NULL) + { + PTASK_GROUP ActiveTaskGroup; + + if (ActiveTaskItem == TaskItem) + return; + + ActiveTaskGroup = ActiveTaskItem->Group; + + if (This->IsGroupingEnabled && + ActiveTaskGroup != NULL && + ActiveTaskGroup->IsCollapsed) + { + if (ActiveTaskGroup == TaskGroup) + return; + /* FIXME */ } else - goto ChangeTaskItemButton; - } - else - { -ChangeTaskItemButton: - if (ActiveTaskItem != NULL) - { - PTASK_GROUP ActiveTaskGroup; - - if (ActiveTaskItem == TaskItem) - return; - - ActiveTaskGroup = ActiveTaskItem->Group; - - if (This->IsGroupingEnabled && ActiveTaskGroup != NULL) - { - if (ActiveTaskGroup->IsCollapsed) - { - if (ActiveTaskGroup == TaskGroup) - return; - - /* FIXME */ - } - else - goto ChangeActiveTaskItemButton; - } - else - { -ChangeActiveTaskItemButton: - This->ActiveTaskItem = NULL; - if (ActiveTaskItem->Index >= 0) - { - TaskSwitchWnd_UpdateTaskItemButton(This, - ActiveTaskItem); - } - } - } - - This->ActiveTaskItem = TaskItem; - - if (TaskItem != NULL && TaskItem->Index >= 0) - { - TaskSwitchWnd_UpdateTaskItemButton(This, - TaskItem); - } + { + This->ActiveTaskItem = NULL; + if (ActiveTaskItem->Index >= 0) + { + TaskSwitchWnd_UpdateTaskItemButton(This, + ActiveTaskItem); + } + } + } + + This->ActiveTaskItem = TaskItem; + + if (TaskItem != NULL && TaskItem->Index >= 0) + { + TaskSwitchWnd_UpdateTaskItemButton(This, + TaskItem); } }
11 years, 11 months
1
0
0
0
[hbelusca] 58191: [CONSRV] - Isolate the members of the CONSOLE structure which are used as input buffer data, in a new structure called ... CONSOLE_INPUT_BUFFER ! - Rename some helper functions to...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Fri Jan 18 22:31:16 2013 New Revision: 58191 URL:
http://svn.reactos.org/svn/reactos?rev=58191&view=rev
Log: [CONSRV] - Isolate the members of the CONSOLE structure which are used as input buffer data, in a new structure called ... CONSOLE_INPUT_BUFFER ! - Rename some helper functions to better match what they are doing. Modified: branches/ros-csrss/win32ss/user/consrv/alias.c branches/ros-csrss/win32ss/user/consrv/coninput.c branches/ros-csrss/win32ss/user/consrv/conio.h branches/ros-csrss/win32ss/user/consrv/conoutput.c branches/ros-csrss/win32ss/user/consrv/console.c branches/ros-csrss/win32ss/user/consrv/consrv.h branches/ros-csrss/win32ss/user/consrv/handle.c branches/ros-csrss/win32ss/user/consrv/init.c branches/ros-csrss/win32ss/user/consrv/lineinput.c Modified: branches/ros-csrss/win32ss/user/consrv/alias.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/a…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/alias.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/alias.c [iso-8859-1] Fri Jan 18 22:31:16 2013 @@ -324,7 +324,7 @@ return STATUS_INVALID_PARAMETER; } - ApiMessage->Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + ApiMessage->Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(ApiMessage->Status)) { return ApiMessage->Status; @@ -411,7 +411,7 @@ return STATUS_INVALID_PARAMETER; } - ApiMessage->Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + ApiMessage->Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(ApiMessage->Status)) { return ApiMessage->Status; @@ -468,7 +468,7 @@ return STATUS_INVALID_PARAMETER; } - ApiMessage->Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + ApiMessage->Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(ApiMessage->Status)) { return ApiMessage->Status; @@ -516,7 +516,7 @@ return STATUS_INVALID_PARAMETER; } - ApiMessage->Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + ApiMessage->Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(ApiMessage->Status)) { return ApiMessage->Status; @@ -552,7 +552,7 @@ return STATUS_INVALID_PARAMETER; } - ApiMessage->Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + ApiMessage->Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(ApiMessage->Status)) { return ApiMessage->Status; @@ -587,7 +587,7 @@ PCONSOLE Console; DPRINT("SrvGetConsoleAliasExesLength entered\n"); - ApiMessage->Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + ApiMessage->Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (NT_SUCCESS(ApiMessage->Status)) { GetAliasesExesLengthRequest->Length = IntGetConsoleAliasesExesLength(Console->Aliases); Modified: branches/ros-csrss/win32ss/user/consrv/coninput.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] Fri Jan 18 22:31:16 2013 @@ -60,7 +60,7 @@ if (!(Console->PauseFlags & PAUSED_FROM_KEYBOARD)) { DWORD cks = InputEvent->Event.KeyEvent.dwControlKeyState; - if (Console->Mode & ENABLE_LINE_INPUT && + if (Console->InputBuffer.Mode & ENABLE_LINE_INPUT && (vk == VK_PAUSE || (vk == 'S' && (cks & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) && !(cks & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED))))) @@ -85,10 +85,10 @@ if (ConInRec == NULL) return STATUS_INSUFFICIENT_RESOURCES; ConInRec->InputEvent = *InputEvent; - InsertTailList(&Console->InputEvents, &ConInRec->ListEntry); - - SetEvent(Console->ActiveEvent); - CsrNotifyWait(&Console->ReadWaitQueue, + InsertTailList(&Console->InputBuffer.InputEvents, &ConInRec->ListEntry); + + SetEvent(Console->InputBuffer.ActiveEvent); + CsrNotifyWait(&Console->InputBuffer.ReadWaitQueue, WaitAny, NULL, NULL); @@ -239,7 +239,7 @@ return; /* process Ctrl-C and Ctrl-Break */ - if (Console->Mode & ENABLE_PROCESSED_INPUT && + if (Console->InputBuffer.Mode & ENABLE_PROCESSED_INPUT && er.Event.KeyEvent.bKeyDown && ((er.Event.KeyEvent.wVirtualKeyCode == VK_PAUSE) || (er.Event.KeyEvent.wVirtualKeyCode == 'C')) && @@ -317,7 +317,7 @@ memmove(CapturedInputInfo, InputInfo, sizeof(GET_INPUT_INFO)); - if (!CsrCreateWait(&InputInfo->Console->ReadWaitQueue, + if (!CsrCreateWait(&InputInfo->Console->InputBuffer.ReadWaitQueue, WaitFunction, CsrGetClientThread(), ApiMessage, @@ -373,7 +373,7 @@ IN PCSR_API_MESSAGE ApiMessage, IN BOOL CreateWaitBlock OPTIONAL) { - if (IsListEmpty(&InputInfo->Console->InputEvents)) + if (IsListEmpty(&InputInfo->Console->InputBuffer.InputEvents)) { if (Wait) { @@ -397,9 +397,9 @@ PINPUT_RECORD InputRecord = GetInputRequest->InputRecord; /* Only get input if there is any */ - CurrentInput = InputInfo->Console->InputEvents.Flink; - - while ( CurrentInput != &InputInfo->Console->InputEvents && + CurrentInput = InputInfo->Console->InputBuffer.InputEvents.Flink; + + while ( CurrentInput != &InputInfo->Console->InputBuffer.InputEvents && GetInputRequest->InputsRead < Length ) { Input = CONTAINING_RECORD(CurrentInput, ConsoleInput, ListEntry); @@ -422,9 +422,9 @@ } } - if (IsListEmpty(&InputInfo->Console->InputEvents)) - { - ResetEvent(InputInfo->Console->ActiveEvent); + if (IsListEmpty(&InputInfo->Console->InputBuffer.InputEvents)) + { + ResetEvent(InputInfo->Console->InputBuffer.ActiveEvent); } /* We read all the inputs available, we return success */ @@ -479,7 +479,7 @@ /* We haven't read anything (yet) */ - if (InputInfo->Console->Mode & ENABLE_LINE_INPUT) + if (InputInfo->Console->InputBuffer.Mode & ENABLE_LINE_INPUT) { if (InputInfo->Console->LineBuffer == NULL) { @@ -511,13 +511,13 @@ /* If we don't have a complete line yet, process the pending input */ while ( !InputInfo->Console->LineComplete && - !IsListEmpty(&InputInfo->Console->InputEvents) ) + !IsListEmpty(&InputInfo->Console->InputBuffer.InputEvents) ) { /* Remove input event from queue */ - CurrentEntry = RemoveHeadList(&InputInfo->Console->InputEvents); - if (IsListEmpty(&InputInfo->Console->InputEvents)) - { - ResetEvent(InputInfo->Console->ActiveEvent); + CurrentEntry = RemoveHeadList(&InputInfo->Console->InputBuffer.InputEvents); + if (IsListEmpty(&InputInfo->Console->InputBuffer.InputEvents)) + { + ResetEvent(InputInfo->Console->InputBuffer.ActiveEvent); } Input = CONTAINING_RECORD(CurrentEntry, ConsoleInput, ListEntry); @@ -567,13 +567,13 @@ { /* Character input */ while ( ReadConsoleRequest->NrCharactersRead < nNumberOfCharsToRead && - !IsListEmpty(&InputInfo->Console->InputEvents) ) + !IsListEmpty(&InputInfo->Console->InputBuffer.InputEvents) ) { /* Remove input event from queue */ - CurrentEntry = RemoveHeadList(&InputInfo->Console->InputEvents); - if (IsListEmpty(&InputInfo->Console->InputEvents)) - { - ResetEvent(InputInfo->Console->ActiveEvent); + CurrentEntry = RemoveHeadList(&InputInfo->Console->InputBuffer.InputEvents); + if (IsListEmpty(&InputInfo->Console->InputBuffer.InputEvents)) + { + ResetEvent(InputInfo->Console->InputBuffer.ActiveEvent); } Input = CONTAINING_RECORD(CurrentEntry, ConsoleInput, ListEntry); @@ -626,7 +626,7 @@ NTSTATUS Status; PCONSOLE_GETINPUT GetInputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetInputRequest; PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); - PCONSOLE Console; + PCONSOLE_INPUT_BUFFER InputBuffer; GET_INPUT_INFO InputInfo; DPRINT("SrvGetConsoleInput\n"); @@ -639,20 +639,20 @@ return STATUS_INVALID_PARAMETER; } - Status = ConioLockConsole(ProcessData, GetInputRequest->InputHandle, &Console, GENERIC_READ); + Status = ConioLockInputBuffer(ProcessData, GetInputRequest->InputHandle, &InputBuffer, GENERIC_READ); if(!NT_SUCCESS(Status)) return Status; GetInputRequest->InputsRead = 0; InputInfo.ProcessData = ProcessData; // ConsoleGetPerProcessData(CsrGetClientThread()->Process); - InputInfo.Console = Console; + InputInfo.Console = InputBuffer->Header.Console; Status = ReadInputBuffer(&InputInfo, GetInputRequest->bRead, ApiMessage, TRUE); - ConioUnlockConsole(Console); + ConioUnlockInputBuffer(InputBuffer); if (Status == STATUS_PENDING) *ReplyCode = CsrReplyPending; @@ -666,6 +666,7 @@ PCONSOLE_WRITEINPUT WriteInputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteInputRequest; PINPUT_RECORD InputRecord; PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE_INPUT_BUFFER InputBuffer; PCONSOLE Console; DWORD Length; DWORD i; @@ -680,9 +681,10 @@ return STATUS_INVALID_PARAMETER; } - Status = ConioLockConsole(ProcessData, WriteInputRequest->InputHandle, &Console, GENERIC_WRITE); + Status = ConioLockInputBuffer(ProcessData, WriteInputRequest->InputHandle, &InputBuffer, GENERIC_WRITE); if (!NT_SUCCESS(Status)) return Status; + Console = InputBuffer->Header.Console; InputRecord = WriteInputRequest->InputRecord; Length = WriteInputRequest->Length; @@ -700,7 +702,7 @@ Status = ConioProcessChar(Console, InputRecord++); } - ConioUnlockConsole(Console); + ConioUnlockInputBuffer(InputBuffer); WriteInputRequest->Length = i; @@ -712,7 +714,7 @@ NTSTATUS Status; PCONSOLE_READCONSOLE ReadConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadConsoleRequest; PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); - PCONSOLE Console; + PCONSOLE_INPUT_BUFFER InputBuffer; GET_INPUT_INFO InputInfo; DPRINT("SrvReadConsole\n"); @@ -731,19 +733,19 @@ return STATUS_INVALID_PARAMETER; } - Status = ConioLockConsole(ProcessData, ReadConsoleRequest->InputHandle, &Console, GENERIC_READ); + Status = ConioLockInputBuffer(ProcessData, ReadConsoleRequest->InputHandle, &InputBuffer, GENERIC_READ); if (!NT_SUCCESS(Status)) return Status; ReadConsoleRequest->NrCharactersRead = 0; InputInfo.ProcessData = ProcessData; // ConsoleGetPerProcessData(CsrGetClientThread()->Process); - InputInfo.Console = Console; + InputInfo.Console = InputBuffer->Header.Console; Status = ReadChars(&InputInfo, ApiMessage, TRUE); - ConioUnlockConsole(Console); + ConioUnlockInputBuffer(InputBuffer); if (Status == STATUS_PENDING) *ReplyCode = CsrReplyPending; @@ -756,28 +758,28 @@ NTSTATUS Status; PCONSOLE_FLUSHINPUTBUFFER FlushInputBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FlushInputBufferRequest; PLIST_ENTRY CurrentEntry; - PCONSOLE Console; + PCONSOLE_INPUT_BUFFER InputBuffer; ConsoleInput* Input; DPRINT("SrvFlushConsoleInputBuffer\n"); - Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + Status = ConioLockInputBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), FlushInputBufferRequest->InputHandle, - &Console, + &InputBuffer, GENERIC_WRITE); if(!NT_SUCCESS(Status)) return Status; /* Discard all entries in the input event queue */ - while (!IsListEmpty(&Console->InputEvents)) - { - CurrentEntry = RemoveHeadList(&Console->InputEvents); + while (!IsListEmpty(&InputBuffer->InputEvents)) + { + CurrentEntry = RemoveHeadList(&InputBuffer->InputEvents); Input = CONTAINING_RECORD(CurrentEntry, ConsoleInput, ListEntry); /* Destroy the event */ RtlFreeHeap(ConSrvHeap, 0, Input); } - ResetEvent(Console->ActiveEvent); - - ConioUnlockConsole(Console); + ResetEvent(InputBuffer->ActiveEvent); + + ConioUnlockInputBuffer(InputBuffer); return STATUS_SUCCESS; } @@ -786,26 +788,26 @@ { NTSTATUS Status; PCONSOLE_GETNUMINPUTEVENTS GetNumInputEventsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetNumInputEventsRequest; - PCONSOLE Console; + PCONSOLE_INPUT_BUFFER InputBuffer; PLIST_ENTRY CurrentInput; DWORD NumEvents; DPRINT("SrvGetConsoleNumberOfInputEvents\n"); - Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), GetNumInputEventsRequest->InputHandle, &Console, GENERIC_READ); + Status = ConioLockInputBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), GetNumInputEventsRequest->InputHandle, &InputBuffer, GENERIC_READ); if (!NT_SUCCESS(Status)) return Status; - CurrentInput = Console->InputEvents.Flink; + CurrentInput = InputBuffer->InputEvents.Flink; NumEvents = 0; /* If there are any events ... */ - while (CurrentInput != &Console->InputEvents) + while (CurrentInput != &InputBuffer->InputEvents) { CurrentInput = CurrentInput->Flink; NumEvents++; } - ConioUnlockConsole(Console); + ConioUnlockInputBuffer(InputBuffer); GetNumInputEventsRequest->NumInputEvents = NumEvents; Modified: branches/ros-csrss/win32ss/user/consrv/conio.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] Fri Jan 18 22:31:16 2013 @@ -28,46 +28,58 @@ typedef struct _CONSOLE_SCREEN_BUFFER { - Object_t Header; /* Object header */ - LIST_ENTRY ListEntry; /* Entry in console's list of buffers */ - - BYTE *Buffer; /* Pointer to screen buffer */ - USHORT MaxX, MaxY; /* Size of the entire scrollback buffer */ - USHORT ShowX, ShowY; /* Beginning offset for the actual display area */ - ULONG CurrentX; /* Current X cursor position */ - ULONG CurrentY; /* Current Y cursor position */ - WORD DefaultAttrib; /* Default char attribute */ - USHORT VirtualY; /* Top row of buffer being displayed, reported to callers */ + Object_t Header; /* Object header */ + LIST_ENTRY ListEntry; /* Entry in console's list of buffers */ + + BYTE *Buffer; /* Pointer to screen buffer */ + USHORT MaxX, MaxY; /* Size of the entire scrollback buffer */ + USHORT ShowX, ShowY; /* Beginning offset for the actual display area */ + ULONG CurrentX; /* Current X cursor position */ + ULONG CurrentY; /* Current Y cursor position */ + WORD DefaultAttrib; /* Default char attribute */ + USHORT VirtualY; /* Top row of buffer being displayed, reported to callers */ CONSOLE_CURSOR_INFO CursorInfo; USHORT Mode; } CONSOLE_SCREEN_BUFFER, *PCONSOLE_SCREEN_BUFFER; +typedef struct _CONSOLE_INPUT_BUFFER +{ + Object_t Header; /* Object header */ + + LIST_ENTRY InputEvents; /* List head for input event queue */ + HANDLE ActiveEvent; /* Event set when an input event is added in its queue */ + LIST_ENTRY ReadWaitQueue; /* List head for the queue of read wait blocks */ + WORD Mode; /* Console Input Buffer mode flags */ +} CONSOLE_INPUT_BUFFER, *PCONSOLE_INPUT_BUFFER; + +typedef struct ConsoleInput_t +{ + LIST_ENTRY ListEntry; + INPUT_RECORD InputEvent; +} ConsoleInput; + typedef struct _CONSOLE { - Object_t Header; /* Object header */ - LONG ReferenceCount; /* Is incremented each time a handle to a screen-buffer or the input buffer of this console gets referenced, or the console gets locked */ + LONG ReferenceCount; /* Is incremented each time a handle to a screen-buffer or the input buffer of this console gets referenced, or the console gets locked */ CRITICAL_SECTION Lock; - struct _CONSOLE *Prev, *Next; /* Next and Prev consoles in console wheel */ - struct _CONSOLE_VTBL *Vtbl; /* Using CUI or GUI consoles */ - - CLIENT_ID ConsoleLeaderCID; /* Contains the Console Leader Process CID for this console. TODO: Is it possible to compute it via the contents of the ProcessList list ?? */ + struct _CONSOLE *Prev, *Next; /* Next and Prev consoles in console wheel */ + struct _CONSOLE_VTBL *Vtbl; /* Using CUI or GUI consoles */ + + CLIENT_ID ConsoleLeaderCID; /* Contains the Console Leader Process CID for this console. TODO: Is it possible to compute it via the contents of the ProcessList list ?? */ LIST_ENTRY ProcessList; /**************************** Input buffer and data ***************************/ - LIST_ENTRY InputEvents; /* List head for input event queue */ - HANDLE ActiveEvent; /* Event set when an input event is added in its queue */ - LIST_ENTRY ReadWaitQueue; /* List head for the queue of read wait blocks */ - WORD Mode; /* Console Input Buffer mode flags */ - - PWCHAR LineBuffer; /* current line being input, in line buffered mode */ - WORD LineMaxSize; /* maximum size of line in characters (including CR+LF) */ - WORD LineSize; /* current size of line */ - WORD LinePos; /* current position within line */ - BOOLEAN LineComplete; /* user pressed enter, ready to send back to client */ + CONSOLE_INPUT_BUFFER InputBuffer; /* Input buffer of the console */ + + PWCHAR LineBuffer; /* Current line being input, in line buffered mode */ + WORD LineMaxSize; /* Maximum size of line in characters (including CR+LF) */ + WORD LineSize; /* Current size of line */ + WORD LinePos; /* Current position within line */ + BOOLEAN LineComplete; /* User pressed enter, ready to send back to client */ BOOLEAN LineUpPressed; - BOOLEAN LineInsertToggle; /* replace character over cursor instead of inserting */ - ULONG LineWakeupMask; /* bitmap of which control characters will end line input */ + BOOLEAN LineInsertToggle; /* Replace character over cursor instead of inserting */ + ULONG LineWakeupMask; /* Bitmap of which control characters will end line input */ UINT CodePage; UINT OutputCodePage; @@ -77,21 +89,21 @@ /**************************** Aliases and Histories ***************************/ struct _ALIAS_HEADER *Aliases; LIST_ENTRY HistoryBuffers; - UINT HistoryBufferSize; /* size for newly created history buffers */ - UINT NumberOfHistoryBuffers; /* maximum number of history buffers allowed */ - BOOLEAN HistoryNoDup; /* remove old duplicate history entries */ + UINT HistoryBufferSize; /* Size for newly created history buffers */ + UINT NumberOfHistoryBuffers; /* Maximum number of history buffers allowed */ + BOOLEAN HistoryNoDup; /* Remove old duplicate history entries */ /******************************* Screen buffers *******************************/ - LIST_ENTRY BufferList; /* List of all screen buffers for this console */ - PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */ + LIST_ENTRY BufferList; /* List of all screen buffers for this console */ + PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */ BYTE PauseFlags; HANDLE UnpauseEvent; - LIST_ENTRY WriteWaitQueue; /* List head for the queue of write wait blocks */ - - DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */ + LIST_ENTRY WriteWaitQueue; /* List head for the queue of write wait blocks */ + + DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */ /****************************** GUI-related data ******************************/ - UNICODE_STRING Title; /* Title of console */ + UNICODE_STRING Title; /* Title of console */ HWND hWindow; COORD Size; PVOID PrivateData; @@ -126,12 +138,6 @@ BOOL (WINAPI *ChangeIcon)(PCONSOLE Console, HICON hWindowIcon); NTSTATUS (WINAPI *ResizeBuffer)(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER ScreenBuffer, COORD Size); } CONSOLE_VTBL, *PCONSOLE_VTBL; - -typedef struct ConsoleInput_t -{ - LIST_ENTRY ListEntry; - INPUT_RECORD InputEvent; -} ConsoleInput; /* CONSOLE_SELECTION_INFO dwFlags values */ #define CONSOLE_NO_SELECTION 0x0 @@ -163,8 +169,10 @@ #define ConioResizeBuffer(Console, Buff, Size) (Console)->Vtbl->ResizeBuffer(Console, Buff, Size) /* console.c */ -NTSTATUS FASTCALL ConioConsoleFromProcessData(PCONSOLE_PROCESS_DATA ProcessData, - PCONSOLE *Console); +#define ConioLockConsole(ProcessData, Console) \ + ConioConsoleFromProcessData((ProcessData), (Console)) +#define ConioUnlockConsole(Console) \ + Win32CsrUnlockConsole(Console) VOID WINAPI ConioDeleteConsole(PCONSOLE Console); VOID WINAPI CsrInitConsoleSupport(VOID); NTSTATUS WINAPI CsrInitConsole(PCONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProcess); @@ -176,10 +184,10 @@ DWORD Timeout); /* coninput.c */ -#define ConioLockConsole(ProcessData, Handle, Ptr, Access) \ - Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), Access, CONIO_CONSOLE_MAGIC) -#define ConioUnlockConsole(Console) \ - Win32CsrUnlockObject((Object_t *) Console) +#define ConioLockInputBuffer(ProcessData, Handle, Ptr, Access) \ + Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), (Access), CONIO_INPUT_BUFFER_MAGIC) +#define ConioUnlockInputBuffer(Buff) \ + Win32CsrUnlockObject(&(Buff)->Header) void WINAPI ConioProcessKey(MSG *msg, PCONSOLE Console, BOOL TextMode); /* conoutput.c */ @@ -188,9 +196,9 @@ #define ConioRectWidth(Rect) \ (((Rect)->Left) > ((Rect)->Right) ? 0 : ((Rect)->Right) - ((Rect)->Left) + 1) #define ConioLockScreenBuffer(ProcessData, Handle, Ptr, Access) \ - Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), Access, CONIO_SCREEN_BUFFER_MAGIC) + Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), (Access), CONIO_SCREEN_BUFFER_MAGIC) #define ConioUnlockScreenBuffer(Buff) \ - Win32CsrUnlockObject((Object_t *) Buff) + Win32CsrUnlockObject(&(Buff)->Header) PBYTE FASTCALL ConioCoordToPointer(PCONSOLE_SCREEN_BUFFER Buf, ULONG X, ULONG Y); VOID FASTCALL ConioDrawConsole(PCONSOLE Console); NTSTATUS FASTCALL ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, Modified: branches/ros-csrss/win32ss/user/consrv/conoutput.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/conoutput.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/conoutput.c [iso-8859-1] Fri Jan 18 22:31:16 2013 @@ -1228,7 +1228,7 @@ RtlEnterCriticalSection(&ProcessData->HandleTableLock); - Status = ConioConsoleFromProcessData(ProcessData, &Console); + Status = ConioLockConsole(ProcessData, &Console); if (!NT_SUCCESS(Status)) { RtlLeaveCriticalSection(&ProcessData->HandleTableLock); Modified: branches/ros-csrss/win32ss/user/consrv/console.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] Fri Jan 18 22:31:16 2013 @@ -31,30 +31,6 @@ return VisibleDesktopWindow != NULL; } -NTSTATUS FASTCALL -ConioConsoleFromProcessData(PCONSOLE_PROCESS_DATA ProcessData, - PCONSOLE *Console) -{ - PCONSOLE ProcessConsole; - - RtlEnterCriticalSection(&ProcessData->HandleTableLock); - ProcessConsole = ProcessData->Console; - - if (!ProcessConsole) - { - *Console = NULL; - RtlLeaveCriticalSection(&ProcessData->HandleTableLock); - return STATUS_INVALID_HANDLE; - } - - InterlockedIncrement(&ProcessConsole->ReferenceCount); - RtlLeaveCriticalSection(&ProcessData->HandleTableLock); - EnterCriticalSection(&(ProcessConsole->Lock)); - *Console = ProcessConsole; - - return STATUS_SUCCESS; -} - VOID FASTCALL ConioConsoleCtrlEventTimeout(DWORD Event, PCONSOLE_PROCESS_DATA ProcessData, @@ -124,16 +100,19 @@ Console->ReferenceCount = 0; Console->LineBuffer = NULL; - Console->Header.Type = CONIO_CONSOLE_MAGIC; - Console->Header.Console = Console; - Console->Mode = ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT; Console->ConsoleLeaderCID = ConsoleLeaderProcess->ClientId; InitializeListHead(&Console->ProcessList); InitializeListHead(&Console->BufferList); Console->ActiveBuffer = NULL; - InitializeListHead(&Console->ReadWaitQueue); + + /* Initialize the input buffer */ + Console->InputBuffer.Header.Type = CONIO_INPUT_BUFFER_MAGIC; + Console->InputBuffer.Header.Console = Console; + Console->InputBuffer.Mode = ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT; + InitializeListHead(&Console->InputBuffer.ReadWaitQueue); + InitializeListHead(&Console->InputBuffer.InputEvents); + InitializeListHead(&Console->WriteWaitQueue); - InitializeListHead(&Console->InputEvents); InitializeListHead(&Console->HistoryBuffers); Console->CodePage = GetOEMCP(); Console->OutputCodePage = GetOEMCP(); @@ -142,8 +121,8 @@ SecurityAttributes.lpSecurityDescriptor = NULL; SecurityAttributes.bInheritHandle = TRUE; - Console->ActiveEvent = CreateEventW(&SecurityAttributes, TRUE, FALSE, NULL); - if (NULL == Console->ActiveEvent) + Console->InputBuffer.ActiveEvent = CreateEventW(&SecurityAttributes, TRUE, FALSE, NULL); + if (NULL == Console->InputBuffer.ActiveEvent) { RtlFreeUnicodeString(&Console->Title); RtlFreeHeap(ConSrvHeap, 0, Console); @@ -160,7 +139,7 @@ { RtlFreeUnicodeString(&Console->Title); DeleteCriticalSection(&Console->Lock); - CloseHandle(Console->ActiveEvent); + CloseHandle(Console->InputBuffer.ActiveEvent); RtlFreeHeap(ConSrvHeap, 0, Console); return STATUS_INSUFFICIENT_RESOURCES; } @@ -168,7 +147,7 @@ NewBuffer->CursorInfo.bVisible = TRUE; NewBuffer->CursorInfo.dwSize = CSR_DEFAULT_CURSOR_SIZE; /* make console active, and insert into console list */ - Console->ActiveBuffer = (PCONSOLE_SCREEN_BUFFER) NewBuffer; + Console->ActiveBuffer = (PCONSOLE_SCREEN_BUFFER)NewBuffer; /* * If we are not in GUI-mode, start the text-mode console. If we fail, @@ -203,7 +182,7 @@ RtlFreeHeap(ConSrvHeap,0, NewBuffer); RtlFreeUnicodeString(&Console->Title); DeleteCriticalSection(&Console->Lock); - CloseHandle(Console->ActiveEvent); + CloseHandle(Console->InputBuffer.ActiveEvent); DPRINT1("GuiInitConsole: failed, Status = 0x%08lx\n", Status); RtlFreeHeap(ConSrvHeap, 0, Console); return Status; @@ -216,7 +195,7 @@ ConioCleanupConsole(Console); RtlFreeUnicodeString(&Console->Title); DeleteCriticalSection(&Console->Lock); - CloseHandle(Console->ActiveEvent); + CloseHandle(Console->InputBuffer.ActiveEvent); RtlFreeHeap(ConSrvHeap, 0, NewBuffer); DPRINT1("CsrInitConsoleScreenBuffer: failed\n"); RtlFreeHeap(ConSrvHeap, 0, Console); @@ -259,9 +238,13 @@ DPRINT1("SrvOpenConsole - Checkpoint 3\n"); if (OpenConsoleRequest->HandleType == HANDLE_OUTPUT) + { Object = &Console->ActiveBuffer->Header; + } else // HANDLE_INPUT - Object = &Console->Header; + { + Object = &Console->InputBuffer.Header; + } if (((DesiredAccess & GENERIC_READ) && Object->ExclusiveRead != 0) || ((DesiredAccess & GENERIC_WRITE) && Object->ExclusiveWrite != 0) || @@ -342,7 +325,7 @@ /* Duplicate the Event */ Status = NtDuplicateObject(NtCurrentProcess(), - ProcessData->Console->ActiveEvent, + ProcessData->Console->InputBuffer.ActiveEvent, ProcessData->Process->ProcessHandle, &ProcessData->ConsoleEvent, EVENT_ALL_ACCESS, 0, 0); @@ -476,7 +459,7 @@ /* Duplicate the Event */ Status = NtDuplicateObject(NtCurrentProcess(), - TargetProcessData->Console->ActiveEvent, + TargetProcessData->Console->InputBuffer.ActiveEvent, TargetProcessData->Process->ProcessHandle, &TargetProcessData->ConsoleEvent, EVENT_ALL_ACCESS, 0, 0); @@ -524,11 +507,11 @@ DPRINT("ConioDeleteConsole\n"); /* Drain input event queue */ - while (Console->InputEvents.Flink != &Console->InputEvents) - { - Event = (ConsoleInput *) Console->InputEvents.Flink; - Console->InputEvents.Flink = Console->InputEvents.Flink->Flink; - Console->InputEvents.Flink->Flink->Blink = &Console->InputEvents; + while (Console->InputBuffer.InputEvents.Flink != &Console->InputBuffer.InputEvents) + { + Event = (ConsoleInput *) Console->InputBuffer.InputEvents.Flink; + Console->InputBuffer.InputEvents.Flink = Console->InputBuffer.InputEvents.Flink->Flink; + Console->InputBuffer.InputEvents.Flink->Flink->Blink = &Console->InputBuffer.InputEvents; RtlFreeHeap(ConSrvHeap, 0, Event); } @@ -544,7 +527,7 @@ DPRINT1("BUG: screen buffer list not empty\n"); } - CloseHandle(Console->ActiveEvent); + CloseHandle(Console->InputBuffer.ActiveEvent); if (Console->UnpauseEvent) CloseHandle(Console->UnpauseEvent); DeleteCriticalSection(&Console->Lock); RtlFreeUnicodeString(&Console->Title); @@ -591,24 +574,25 @@ { NTSTATUS Status; PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest; - PCONSOLE Console; - PCONSOLE_SCREEN_BUFFER Buff; + Object_t* Object = NULL; DPRINT("SrvSetConsoleMode\n"); Status = Win32CsrLockObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ConsoleModeRequest->ConsoleHandle, - (Object_t **) &Console, GENERIC_WRITE, 0); + &Object, GENERIC_WRITE, 0); if (!NT_SUCCESS(Status)) return Status; - Buff = (PCONSOLE_SCREEN_BUFFER)Console; - - if (CONIO_CONSOLE_MAGIC == Console->Header.Type) - { - Console->Mode = ConsoleModeRequest->ConsoleMode & CONSOLE_INPUT_MODE_VALID; - } - else if (CONIO_SCREEN_BUFFER_MAGIC == Console->Header.Type) - { + Status = STATUS_SUCCESS; + + if (CONIO_INPUT_BUFFER_MAGIC == Object->Type) + { + PCONSOLE Console = (PCONSOLE)Object; + Console->InputBuffer.Mode = ConsoleModeRequest->ConsoleMode & CONSOLE_INPUT_MODE_VALID; + } + else if (CONIO_SCREEN_BUFFER_MAGIC == Object->Type) + { + PCONSOLE_SCREEN_BUFFER Buff = (PCONSOLE_SCREEN_BUFFER)Object; Buff->Mode = ConsoleModeRequest->ConsoleMode & CONSOLE_OUTPUT_MODE_VALID; } else @@ -616,7 +600,7 @@ Status = STATUS_INVALID_HANDLE; } - Win32CsrUnlockObject((Object_t *)Console); + Win32CsrUnlockObject(Object); return Status; } @@ -625,25 +609,25 @@ { NTSTATUS Status; PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest; - PCONSOLE Console; - PCONSOLE_SCREEN_BUFFER Buff; + Object_t* Object = NULL; DPRINT("SrvGetConsoleMode\n"); Status = Win32CsrLockObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ConsoleModeRequest->ConsoleHandle, - (Object_t **) &Console, GENERIC_READ, 0); + &Object, GENERIC_READ, 0); if (!NT_SUCCESS(Status)) return Status; Status = STATUS_SUCCESS; - Buff = (PCONSOLE_SCREEN_BUFFER) Console; - - if (CONIO_CONSOLE_MAGIC == Console->Header.Type) - { - ConsoleModeRequest->ConsoleMode = Console->Mode; - } - else if (CONIO_SCREEN_BUFFER_MAGIC == Buff->Header.Type) - { + + if (CONIO_INPUT_BUFFER_MAGIC == Object->Type) + { + PCONSOLE Console = (PCONSOLE)Object; + ConsoleModeRequest->ConsoleMode = Console->InputBuffer.Mode; + } + else if (CONIO_SCREEN_BUFFER_MAGIC == Object->Type) + { + PCONSOLE_SCREEN_BUFFER Buff = (PCONSOLE_SCREEN_BUFFER)Object; ConsoleModeRequest->ConsoleMode = Buff->Mode; } else @@ -651,7 +635,8 @@ Status = STATUS_INVALID_HANDLE; } - Win32CsrUnlockObject((Object_t *)Console); + Win32CsrUnlockObject(Object); + return Status; } @@ -673,7 +658,7 @@ return STATUS_INVALID_PARAMETER; } - Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if(NT_SUCCESS(Status)) { Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, TitleRequest->Length); @@ -723,7 +708,7 @@ return STATUS_INVALID_PARAMETER; } - Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(Status)) { DPRINT1("Can't get console\n"); @@ -783,13 +768,14 @@ { NTSTATUS Status; PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest; + PCONSOLE_SCREEN_BUFFER Buff; PCONSOLE Console; DPRINT("SrvGetConsoleHardwareState\n"); - Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + Status = ConioLockScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), HardwareStateRequest->OutputHandle, - &Console, + &Buff, GENERIC_READ); if (!NT_SUCCESS(Status)) { @@ -797,9 +783,10 @@ return Status; } + Console = Buff->Header.Console; HardwareStateRequest->State = Console->HardwareState; - ConioUnlockConsole(Console); + ConioUnlockScreenBuffer(Buff); return Status; } @@ -808,13 +795,14 @@ { NTSTATUS Status; PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest; + PCONSOLE_SCREEN_BUFFER Buff; PCONSOLE Console; DPRINT("SrvSetConsoleHardwareState\n"); - Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + Status = ConioLockScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), HardwareStateRequest->OutputHandle, - &Console, + &Buff, GENERIC_READ); if (!NT_SUCCESS(Status)) { @@ -823,9 +811,10 @@ } DPRINT("Setting console hardware state.\n"); + Console = Buff->Header.Console; Status = SetConsoleHardwareState(Console, HardwareStateRequest->State); - ConioUnlockConsole(Console); + ConioUnlockScreenBuffer(Buff); return Status; } @@ -838,7 +827,7 @@ DPRINT("SrvGetConsoleWindow\n"); - Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(Status)) return Status; GetWindowRequest->WindowHandle = Console->hWindow; @@ -855,7 +844,7 @@ DPRINT("SrvSetConsoleIcon\n"); - Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(Status)) return Status; Status = (ConioChangeIcon(Console, SetIconRequest->WindowIcon) @@ -876,7 +865,7 @@ DPRINT("SrvGetConsoleCP, getting %s Code Page\n", ConsoleCPRequest->InputCP ? "Input" : "Output"); - Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(Status)) return Status; ConsoleCPRequest->CodePage = (ConsoleCPRequest->InputCP ? Console->CodePage @@ -894,7 +883,7 @@ DPRINT("SrvSetConsoleCP, setting %s Code Page\n", ConsoleCPRequest->InputCP ? "Input" : "Output"); - Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(Status)) return Status; if (IsValidCodePage(ConsoleCPRequest->CodePage)) @@ -935,7 +924,7 @@ Buffer = GetProcessListRequest->pProcessIds; - Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(Status)) return Status; for (current_entry = Console->ProcessList.Flink; @@ -964,7 +953,7 @@ PLIST_ENTRY current_entry; DWORD Group; - Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (!NT_SUCCESS(Status)) return Status; Group = GenerateCtrlEventRequest->ProcessGroup; @@ -992,7 +981,7 @@ PCONSOLE_GETSELECTIONINFO GetSelectionInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetSelectionInfoRequest; PCONSOLE Console; - Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (NT_SUCCESS(Status)) { memset(&GetSelectionInfoRequest->Info, 0, sizeof(CONSOLE_SELECTION_INFO)); Modified: branches/ros-csrss/win32ss/user/consrv/consrv.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/consrv.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/consrv.h [iso-8859-1] Fri Jan 18 22:31:16 2013 @@ -39,13 +39,13 @@ // extern PBASE_STATIC_SERVER_DATA BaseStaticServerData; /* Object type magic numbers */ -#define CONIO_CONSOLE_MAGIC 0x00000001 // --> Input-type handles +#define CONIO_INPUT_BUFFER_MAGIC 0x00000001 // --> Input-type handles #define CONIO_SCREEN_BUFFER_MAGIC 0x00000002 // --> Output-type handles /* Common things to input/output/console objects */ typedef struct Object_tt { - LONG Type; + ULONG Type; struct _CONSOLE *Console; LONG AccessRead, AccessWrite; LONG ExclusiveRead, ExclusiveWrite; @@ -157,8 +157,9 @@ HANDLE Handle, Object_t **Object, DWORD Access, - LONG Type); + ULONG Type); VOID FASTCALL Win32CsrUnlockObject(Object_t *Object); +VOID FASTCALL Win32CsrUnlockConsole(struct _CONSOLE* Console); NTSTATUS FASTCALL Win32CsrReleaseObject(PCONSOLE_PROCESS_DATA ProcessData, HANDLE Handle); @@ -169,6 +170,8 @@ int ShowCmd, PCSR_PROCESS CsrProcess); VOID FASTCALL Win32CsrReleaseConsole(PCONSOLE_PROCESS_DATA ProcessData); +NTSTATUS FASTCALL ConioConsoleFromProcessData(PCONSOLE_PROCESS_DATA ProcessData, + struct _CONSOLE** Console); NTSTATUS NTAPI ConsoleNewProcess(PCSR_PROCESS SourceProcess, PCSR_PROCESS TargetProcess); Modified: branches/ros-csrss/win32ss/user/consrv/handle.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/h…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] Fri Jan 18 22:31:16 2013 @@ -2,7 +2,7 @@ * LICENSE: GPL - See COPYING in the top level directory * PROJECT: ReactOS Console Server DLL * FILE: win32ss/user/consrv/handle.c - * PURPOSE: Console IO Handle functions + * PURPOSE: Console I/O Handles functions * PROGRAMMERS: */ @@ -64,10 +64,9 @@ if (Buffer->ListEntry.Flink != Buffer->ListEntry.Blink) ConioDeleteScreenBuffer(Buffer); } - else if (Object->Type == CONIO_CONSOLE_MAGIC) + else if (Object->Type == CONIO_INPUT_BUFFER_MAGIC) { - /* TODO: FIXME: Destroy here the console ?? */ - // ConioDeleteConsole(Console); + DPRINT1("Closing the input buffer\n"); } } @@ -104,7 +103,7 @@ /* Insert the Input handle */ Status = Win32CsrInsertObject(ProcessData, &InputHandle, - &ProcessData->Console->Header, + &ProcessData->Console->InputBuffer.Header, GENERIC_READ | GENERIC_WRITE, TRUE, FILE_SHARE_READ | FILE_SHARE_WRITE); @@ -243,6 +242,8 @@ BOOL Inheritable, DWORD ShareMode) { +#define IO_HANDLES_INCREMENT 2*3 + ULONG i; PCONSOLE_IO_HANDLE Block; @@ -259,7 +260,8 @@ { Block = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, - (ProcessData->HandleTableSize + 64) * sizeof(CONSOLE_IO_HANDLE)); + (ProcessData->HandleTableSize + + IO_HANDLES_INCREMENT) * sizeof(CONSOLE_IO_HANDLE)); if (Block == NULL) { RtlLeaveCriticalSection(&ProcessData->HandleTableLock); @@ -270,8 +272,9 @@ ProcessData->HandleTableSize * sizeof(CONSOLE_IO_HANDLE)); RtlFreeHeap(ConSrvHeap, 0, ProcessData->HandleTable); ProcessData->HandleTable = Block; - ProcessData->HandleTableSize += 64; - } + ProcessData->HandleTableSize += IO_HANDLES_INCREMENT; + } + ProcessData->HandleTable[i].Object = Object; ProcessData->HandleTable[i].Access = Access; ProcessData->HandleTable[i].Inheritable = Inheritable; @@ -280,6 +283,7 @@ *Handle = ULongToHandle((i << 2) | 0x3); RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return STATUS_SUCCESS; } @@ -314,12 +318,12 @@ HANDLE Handle, Object_t **Object, DWORD Access, - LONG Type) + ULONG Type) { ULONG_PTR h = (ULONG_PTR)Handle >> 2; - DPRINT("Win32CsrLockObject, Object: %x, %x, %x\n", - Object, Handle, ProcessData ? ProcessData->HandleTableSize : 0); + // DPRINT("Win32CsrLockObject, Object: %x, %x, %x\n", + // Object, Handle, ProcessData ? ProcessData->HandleTableSize : 0); RtlEnterCriticalSection(&ProcessData->HandleTableLock); @@ -329,7 +333,7 @@ ~ProcessData->HandleTable[h].Access & Access || (Type != 0 && (*Object)->Type != Type) ) { - DPRINT1("CsrGetObject returning invalid handle (%x)\n", Handle); + DPRINT1("CsrGetObject returning invalid handle (%x) of type %lu with access %lu\n", Handle, Type, Access); RtlLeaveCriticalSection(&ProcessData->HandleTableLock); return STATUS_INVALID_HANDLE; } @@ -337,7 +341,7 @@ _InterlockedIncrement(&(*Object)->Console->ReferenceCount); RtlLeaveCriticalSection(&ProcessData->HandleTableLock); - EnterCriticalSection(&((*Object)->Console->Lock)); + EnterCriticalSection(&(*Object)->Console->Lock); return STATUS_SUCCESS; } @@ -419,6 +423,31 @@ //CloseHandle(ProcessData->ConsoleEvent); //ProcessData->ConsoleEvent = NULL; } +} + +NTSTATUS +FASTCALL +ConioConsoleFromProcessData(PCONSOLE_PROCESS_DATA ProcessData, + PCONSOLE* Console) +{ + PCONSOLE ProcessConsole; + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + ProcessConsole = ProcessData->Console; + + if (!ProcessConsole) + { + *Console = NULL; + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + return STATUS_INVALID_HANDLE; + } + + InterlockedIncrement(&ProcessConsole->ReferenceCount); + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + EnterCriticalSection(&(ProcessConsole->Lock)); + *Console = ProcessConsole; + + return STATUS_SUCCESS; } @@ -581,7 +610,7 @@ /// TODO: Move this up ? /* Duplicate the Event */ Status = NtDuplicateObject(NtCurrentProcess(), - ProcessData->Console->ActiveEvent, + ProcessData->Console->InputBuffer.ActiveEvent, ProcessData->Process->ProcessHandle, &ProcessData->ConsoleEvent, EVENT_ALL_ACCESS, 0, 0); Modified: branches/ros-csrss/win32ss/user/consrv/init.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/i…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/init.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/init.c [iso-8859-1] Fri Jan 18 22:31:16 2013 @@ -448,6 +448,15 @@ /* Initialize memory */ ConSrvHeap = RtlGetProcessHeap(); // Initialize our own heap. +/* + ConSrvHeap = RtlCreateHeap( HEAP_GROWABLE | HEAP_CLASS_5, // Flags + NULL, // HeapBase + 64 * 1024, // ReserveSize + 4096, // CommitSize + NULL, // Lock to use for serialization + NULL // GrowthThreshold + ); +*/ // BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap. // LoadedServerDll->SharedSection = BaseStaticServerData; Modified: branches/ros-csrss/win32ss/user/consrv/lineinput.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/l…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/lineinput.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/lineinput.c [iso-8859-1] Fri Jan 18 22:31:16 2013 @@ -167,7 +167,7 @@ return STATUS_INVALID_PARAMETER; } - Status = ConioConsoleFromProcessData(ProcessData, &Console); + Status = ConioLockConsole(ProcessData, &Console); if (NT_SUCCESS(Status)) { Hist = HistoryFindBuffer(Console, &GetCommandHistoryLengthRequest->ExeName); @@ -205,7 +205,7 @@ return STATUS_INVALID_PARAMETER; } - Status = ConioConsoleFromProcessData(ProcessData, &Console); + Status = ConioLockConsole(ProcessData, &Console); if (NT_SUCCESS(Status)) { Hist = HistoryFindBuffer(Console, &GetCommandHistoryRequest->ExeName); @@ -246,7 +246,7 @@ return STATUS_INVALID_PARAMETER; } - Status = ConioConsoleFromProcessData(ProcessData, &Console); + Status = ConioLockConsole(ProcessData, &Console); if (NT_SUCCESS(Status)) { Hist = HistoryFindBuffer(Console, &ExpungeCommandHistoryRequest->ExeName); @@ -274,7 +274,7 @@ return STATUS_INVALID_PARAMETER; } - Status = ConioConsoleFromProcessData(ProcessData, &Console); + Status = ConioLockConsole(ProcessData, &Console); if (NT_SUCCESS(Status)) { Hist = HistoryFindBuffer(Console, &SetHistoryNumberCommandsRequest->ExeName); @@ -311,7 +311,7 @@ { PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest; PCONSOLE Console; - NTSTATUS Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + NTSTATUS Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (NT_SUCCESS(Status)) { HistoryInfoRequest->HistoryBufferSize = Console->HistoryBufferSize; @@ -326,7 +326,7 @@ { PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest; PCONSOLE Console; - NTSTATUS Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); + NTSTATUS Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console); if (NT_SUCCESS(Status)) { Console->HistoryBufferSize = HistoryInfoRequest->HistoryBufferSize; @@ -340,7 +340,7 @@ static VOID LineInputSetPos(PCONSOLE Console, UINT Pos) { - if (Pos != Console->LinePos && Console->Mode & ENABLE_ECHO_INPUT) + if (Pos != Console->LinePos && Console->InputBuffer.Mode & ENABLE_ECHO_INPUT) { PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer; UINT OldCursorX = Buffer->CurrentX; @@ -377,7 +377,7 @@ (Console->LineSize - (Pos + NumToDelete)) * sizeof(WCHAR)); memcpy(&Console->LineBuffer[Pos], Insertion, NumToInsert * sizeof(WCHAR)); - if (Console->Mode & ENABLE_ECHO_INPUT) + if (Console->InputBuffer.Mode & ENABLE_ECHO_INPUT) { for (i = Pos; i < NewSize; i++) { @@ -559,7 +559,7 @@ return; } - if (KeyEvent->uChar.UnicodeChar == L'\b' && Console->Mode & ENABLE_PROCESSED_INPUT) + if (KeyEvent->uChar.UnicodeChar == L'\b' && Console->InputBuffer.Mode & ENABLE_PROCESSED_INPUT) { /* backspace handling - if processed input enabled then we handle it here * otherwise we treat it like a normal char. */ @@ -577,17 +577,17 @@ LineInputSetPos(Console, Console->LineSize); Console->LineBuffer[Console->LineSize++] = L'\r'; - if (Console->Mode & ENABLE_ECHO_INPUT) + if (Console->InputBuffer.Mode & ENABLE_ECHO_INPUT) ConioWriteConsole(Console, Console->ActiveBuffer, "\r", 1, TRUE); /* Add \n if processed input. There should usually be room for it, * but an exception to the rule exists: the buffer could have been * pre-filled with LineMaxSize - 1 characters. */ - if (Console->Mode & ENABLE_PROCESSED_INPUT && + if (Console->InputBuffer.Mode & ENABLE_PROCESSED_INPUT && Console->LineSize < Console->LineMaxSize) { Console->LineBuffer[Console->LineSize++] = L'\n'; - if (Console->Mode & ENABLE_ECHO_INPUT) + if (Console->InputBuffer.Mode & ENABLE_ECHO_INPUT) ConioWriteConsole(Console, Console->ActiveBuffer, "\n", 1, TRUE); } Console->LineComplete = TRUE;
11 years, 11 months
1
0
0
0
[hbelusca] 58190: [BASESRV] Remove an unneeded comment.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Fri Jan 18 22:28:14 2013 New Revision: 58190 URL:
http://svn.reactos.org/svn/reactos?rev=58190&view=rev
Log: [BASESRV] Remove an unneeded comment. Modified: branches/ros-csrss/subsystems/win/basesrv/init.c Modified: branches/ros-csrss/subsystems/win/basesrv/init.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
============================================================================== --- branches/ros-csrss/subsystems/win/basesrv/init.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win/basesrv/init.c [iso-8859-1] Fri Jan 18 22:28:14 2013 @@ -502,7 +502,6 @@ } /* Finally, set the pointer */ - // CsrSrvSharedStaticServerData[CSR_CONSOLE] = BaseStaticServerData; LoadedServerDll->SharedSection = BaseStaticServerData; }
11 years, 11 months
1
0
0
0
[akhaldi] 58189: [SHELL32] * Fix a typo.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Jan 18 17:19:23 2013 New Revision: 58189 URL:
http://svn.reactos.org/svn/reactos?rev=58189&view=rev
Log: [SHELL32] * Fix a typo. Modified: trunk/reactos/dll/win32/shell32/pidl.cpp Modified: trunk/reactos/dll/win32/shell32/pidl.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/pidl.cpp…
============================================================================== --- trunk/reactos/dll/win32/shell32/pidl.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/pidl.cpp [iso-8859-1] Fri Jan 18 17:19:23 2013 @@ -1144,7 +1144,7 @@ if (len < (int)sizeof(WIN32_FIND_DATAW)) return E_INVALIDARG; - ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA)); + ZeroMemory(pfd, sizeof (WIN32_FIND_DATAW)); _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime)); pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0); pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0);
11 years, 11 months
1
0
0
0
[akhaldi] 58188: [SETUPAPI] * Don't check the return twice here.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Jan 18 15:52:10 2013 New Revision: 58188 URL:
http://svn.reactos.org/svn/reactos?rev=58188&view=rev
Log: [SETUPAPI] * Don't check the return twice here. Modified: trunk/reactos/dll/win32/setupapi/install.c 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 [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/install.c [iso-8859-1] Fri Jan 18 15:52:10 2013 @@ -1060,8 +1060,7 @@ if (SUCCEEDED(hr)) { /* Fill link properties */ - if (SUCCEEDED(hr)) - hr = IShellLinkW_SetPath(psl, FullFileName); + hr = IShellLinkW_SetPath(psl, FullFileName); if (SUCCEEDED(hr)) hr = IShellLinkW_SetArguments(psl, L""); if (SUCCEEDED(hr))
11 years, 11 months
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
19
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Results per page:
10
25
50
100
200