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
[hbelusca] 58177: [CONSRV] - Temporary make the property dialog working again (but it's not the ultimate solution). - in conio.h : members reorganization only.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Tue Jan 15 00:02:07 2013 New Revision: 58177 URL:
http://svn.reactos.org/svn/reactos?rev=58177&view=rev
Log: [CONSRV] - Temporary make the property dialog working again (but it's not the ultimate solution). - in conio.h : members reorganization only. Modified: branches/ros-csrss/win32ss/user/consrv/conio.h branches/ros-csrss/win32ss/user/consrv/consrv.h branches/ros-csrss/win32ss/user/consrv/guiconsole.c branches/ros-csrss/win32ss/user/consrv/init.c 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] Tue Jan 15 00:02:07 2013 @@ -44,18 +44,20 @@ typedef struct _CONSOLE { Object_t Header; /* Object header */ - LONG ReferenceCount; + 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 */ + 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) */ @@ -66,29 +68,33 @@ BOOLEAN LineInsertToggle; /* replace character over cursor instead of inserting */ ULONG LineWakeupMask; /* bitmap of which control characters will end line input */ + UINT CodePage; + UINT OutputCodePage; + + CONSOLE_SELECTION_INFO Selection; + +/**************************** 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 */ +/******************************* Screen buffers *******************************/ LIST_ENTRY BufferList; /* List of all screen buffers for this console */ - PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */ + 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 */ - WORD Mode; /* Console mode flags */ + DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */ + +/****************************** GUI-related data ******************************/ UNICODE_STRING Title; /* Title of console */ - DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */ HWND hWindow; COORD Size; PVOID PrivateData; - UINT CodePage; - UINT OutputCodePage; - - CONSOLE_SELECTION_INFO Selection; } CONSOLE, *PCONSOLE; /**************************************************************\ 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] Tue Jan 15 00:02:07 2013 @@ -62,8 +62,8 @@ } CONSOLE_IO_HANDLE, *PCONSOLE_IO_HANDLE; -#define ConsoleGetPerProcessData(pcsrprocess) \ - ((PCONSOLE_PROCESS_DATA)((pcsrprocess)->ServerData[CONSRV_SERVERDLL_INDEX])) +#define ConsoleGetPerProcessData(Process) \ + ((PCONSOLE_PROCESS_DATA)((Process)->ServerData[CONSRV_SERVERDLL_INDEX])) typedef struct _CONSOLE_PROCESS_DATA { @@ -78,6 +78,7 @@ RTL_CRITICAL_SECTION HandleTableLock; ULONG HandleTableSize; PCONSOLE_IO_HANDLE HandleTable; // Length-varying table + LPTHREAD_START_ROUTINE CtrlDispatcher; } CONSOLE_PROCESS_DATA, *PCONSOLE_PROCESS_DATA; 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] Tue Jan 15 00:02:07 2013 @@ -1590,6 +1590,7 @@ } CPLFunc(hWnd, CPL_DBLCLK, (LPARAM)&SharedInfo, Defaults); + CPLFunc(hWnd, CPL_EXIT , 0, 0); } static LRESULT GuiConsoleHandleSysMenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) 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] Tue Jan 15 00:02:07 2013 @@ -116,47 +116,47 @@ BOOLEAN ConsoleServerApiServerValidTable[ConsolepMaxApiNumber] = { - FALSE, // SrvOpenConsole, - FALSE, // SrvGetConsoleInput, - FALSE, // SrvWriteConsoleInput, - FALSE, // SrvReadConsoleOutput, - FALSE, // SrvWriteConsoleOutput, - FALSE, // SrvReadConsoleOutputString, - FALSE, // SrvWriteConsoleOutputString, - FALSE, // SrvFillConsoleOutput, - FALSE, // SrvGetConsoleMode, + TRUE /* FALSE */, // SrvOpenConsole, + TRUE /* FALSE */, // SrvGetConsoleInput, + TRUE /* FALSE */, // SrvWriteConsoleInput, + TRUE /* FALSE */, // SrvReadConsoleOutput, + TRUE /* FALSE */, // SrvWriteConsoleOutput, + TRUE /* FALSE */, // SrvReadConsoleOutputString, + TRUE /* FALSE */, // SrvWriteConsoleOutputString, + TRUE /* FALSE */, // SrvFillConsoleOutput, + TRUE /* FALSE */, // SrvGetConsoleMode, // FALSE, // SrvGetConsoleNumberOfFonts, - FALSE, // SrvGetConsoleNumberOfInputEvents, - FALSE, // SrvGetConsoleScreenBufferInfo, - FALSE, // SrvGetConsoleCursorInfo, + TRUE /* FALSE */, // SrvGetConsoleNumberOfInputEvents, + TRUE /* FALSE */, // SrvGetConsoleScreenBufferInfo, + TRUE /* FALSE */, // SrvGetConsoleCursorInfo, // FALSE, // SrvGetConsoleMouseInfo, // FALSE, // SrvGetConsoleFontInfo, // FALSE, // SrvGetConsoleFontSize, // FALSE, // SrvGetConsoleCurrentFont, - FALSE, // SrvSetConsoleMode, - FALSE, // SrvSetConsoleActiveScreenBuffer, - FALSE, // SrvFlushConsoleInputBuffer, + TRUE /* FALSE */, // SrvSetConsoleMode, + TRUE /* FALSE */, // SrvSetConsoleActiveScreenBuffer, + TRUE /* FALSE */, // SrvFlushConsoleInputBuffer, // FALSE, // SrvGetLargestConsoleWindowSize, - FALSE, // SrvSetConsoleScreenBufferSize, - FALSE, // SrvSetConsoleCursorPosition, - FALSE, // SrvSetConsoleCursorInfo, + TRUE /* FALSE */, // SrvSetConsoleScreenBufferSize, + TRUE /* FALSE */, // SrvSetConsoleCursorPosition, + TRUE /* FALSE */, // SrvSetConsoleCursorInfo, // FALSE, // SrvSetConsoleWindowInfo, - FALSE, // SrvScrollConsoleScreenBuffer, - FALSE, // SrvSetConsoleTextAttribute, + TRUE /* FALSE */, // SrvScrollConsoleScreenBuffer, + TRUE /* FALSE */, // SrvSetConsoleTextAttribute, // FALSE, // SrvSetConsoleFont, - FALSE, // SrvSetConsoleIcon, - FALSE, // SrvReadConsole, - FALSE, // SrvWriteConsole, - FALSE, // SrvDuplicateHandle, + TRUE /* FALSE */, // SrvSetConsoleIcon, + TRUE /* FALSE */, // SrvReadConsole, + TRUE /* FALSE */, // SrvWriteConsole, + TRUE /* FALSE */, // SrvDuplicateHandle, // FALSE, // SrvGetHandleInformation, // FALSE, // SrvSetHandleInformation, - FALSE, // SrvCloseHandle, - FALSE, // SrvVerifyConsoleIoHandle, - FALSE, // SrvAllocConsole, - FALSE, // SrvFreeConsole, - FALSE, // SrvGetConsoleTitle, - FALSE, // SrvSetConsoleTitle, - FALSE, // SrvCreateConsoleScreenBuffer, + TRUE /* FALSE */, // SrvCloseHandle, + TRUE /* FALSE */, // SrvVerifyConsoleIoHandle, + TRUE /* FALSE */, // SrvAllocConsole, + TRUE /* FALSE */, // SrvFreeConsole, + TRUE /* FALSE */, // SrvGetConsoleTitle, + TRUE /* FALSE */, // SrvSetConsoleTitle, + TRUE /* FALSE */, // SrvCreateConsoleScreenBuffer, // FALSE, // SrvInvalidateBitMapRect, // FALSE, // SrvVDMConsoleOperation, // FALSE, // SrvSetConsoleCursor, @@ -165,28 +165,28 @@ // FALSE, // SrvSetConsolePalette, // FALSE, // SrvSetConsoleDisplayMode, // FALSE, // SrvRegisterConsoleVDM, - FALSE, // SrvGetConsoleHardwareState, - FALSE, // SrvSetConsoleHardwareState, + TRUE /* FALSE */, // SrvGetConsoleHardwareState, + TRUE /* FALSE */, // SrvSetConsoleHardwareState, // TRUE, // SrvGetConsoleDisplayMode, - FALSE, // SrvAddConsoleAlias, - FALSE, // SrvGetConsoleAlias, - FALSE, // SrvGetConsoleAliasesLength, - FALSE, // SrvGetConsoleAliasExesLength, - FALSE, // SrvGetConsoleAliases, - FALSE, // SrvGetConsoleAliasExes, - FALSE, // SrvExpungeConsoleCommandHistory, - FALSE, // SrvSetConsoleNumberOfCommands, - FALSE, // SrvGetConsoleCommandHistoryLength, - FALSE, // SrvGetConsoleCommandHistory, + TRUE /* FALSE */, // SrvAddConsoleAlias, + TRUE /* FALSE */, // SrvGetConsoleAlias, + TRUE /* FALSE */, // SrvGetConsoleAliasesLength, + TRUE /* FALSE */, // SrvGetConsoleAliasExesLength, + TRUE /* FALSE */, // SrvGetConsoleAliases, + TRUE /* FALSE */, // SrvGetConsoleAliasExes, + TRUE /* FALSE */, // SrvExpungeConsoleCommandHistory, + TRUE /* FALSE */, // SrvSetConsoleNumberOfCommands, + TRUE /* FALSE */, // SrvGetConsoleCommandHistoryLength, + TRUE /* FALSE */, // SrvGetConsoleCommandHistory, // FALSE, // SrvSetConsoleCommandHistoryMode, - FALSE, // SrvGetConsoleCP, - FALSE, // SrvSetConsoleCP, + TRUE /* FALSE */, // SrvGetConsoleCP, + TRUE /* FALSE */, // SrvSetConsoleCP, // FALSE, // SrvSetConsoleKeyShortcuts, // FALSE, // SrvSetConsoleMenuClose, // FALSE, // SrvConsoleNotifyLastClose, - FALSE, // SrvGenerateConsoleCtrlEvent, + TRUE /* FALSE */, // SrvGenerateConsoleCtrlEvent, // FALSE, // SrvGetConsoleKeyboardLayoutName, - FALSE, // SrvGetConsoleWindow, + TRUE /* FALSE */, // SrvGetConsoleWindow, // FALSE, // SrvGetConsoleCharType, // FALSE, // SrvSetConsoleLocalEUDC, // FALSE, // SrvSetConsoleCursorMode, @@ -198,11 +198,11 @@ // FALSE, // SrvRegisterConsoleIME, // FALSE, // SrvUnregisterConsoleIME, // FALSE, // SrvGetConsoleLangId, - FALSE, // SrvAttachConsole, - FALSE, // SrvGetConsoleSelectionInfo, - FALSE, // SrvGetConsoleProcessList, - FALSE, // SrvGetConsoleHistory, - FALSE, // SrvSetConsoleHistory + TRUE /* FALSE */, // SrvAttachConsole, + TRUE /* FALSE */, // SrvGetConsoleSelectionInfo, + TRUE /* FALSE */, // SrvGetConsoleProcessList, + TRUE /* FALSE */, // SrvGetConsoleHistory, + TRUE /* FALSE */, // SrvSetConsoleHistory // FALSE };
11 years, 11 months
1
0
0
0
[ekohl] 58176: [SAMSRV] Implement SamrSetMemberAttributesOfGroup.
by ekohl@svn.reactos.org
Author: ekohl Date: Mon Jan 14 21:56:45 2013 New Revision: 58176 URL:
http://svn.reactos.org/svn/reactos?rev=58176&view=rev
Log: [SAMSRV] Implement SamrSetMemberAttributesOfGroup. Modified: trunk/reactos/dll/win32/samsrv/samrpc.c trunk/reactos/dll/win32/samsrv/samsrv.h trunk/reactos/dll/win32/samsrv/user.c 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] Mon Jan 14 21:56:45 2013 @@ -4158,8 +4158,30 @@ IN unsigned long MemberId, IN unsigned long Attributes) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + PSAM_DB_OBJECT GroupObject; + NTSTATUS Status; + + /* Validate the group handle */ + Status = SampValidateDbObject(GroupHandle, + SamDbGroupObject, + GROUP_ADD_MEMBER, + &GroupObject); + if (!NT_SUCCESS(Status)) + { + TRACE("SampValidateDbObject failed with status 0x%08lx\n", Status); + return Status; + } + + Status = SampSetUserGroupAttributes(GroupObject->ParentObject, + MemberId, + GroupObject->RelativeId, + Attributes); + if (!NT_SUCCESS(Status)) + { + TRACE("SampSetUserGroupAttributes failed with status 0x%08lx\n", Status); + } + + return Status; } 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] Mon Jan 14 21:56:45 2013 @@ -285,4 +285,10 @@ IN ULONG GroupId, OUT PULONG GroupAttributes); +NTSTATUS +SampSetUserGroupAttributes(IN PSAM_DB_OBJECT DomainObject, + IN ULONG UserId, + IN ULONG GroupId, + IN ULONG GroupAttributes); + /* EOF */ Modified: trunk/reactos/dll/win32/samsrv/user.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/user.c?re…
============================================================================== --- trunk/reactos/dll/win32/samsrv/user.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/user.c [iso-8859-1] Mon Jan 14 21:56:45 2013 @@ -214,10 +214,7 @@ &Length); if (Length == 0) - { - *GroupAttributes = 0; - return STATUS_SUCCESS; - } + return STATUS_UNSUCCESSFUL; /* FIXME */ GroupsBuffer = midl_user_allocate(Length); if (GroupsBuffer == NULL) @@ -253,4 +250,75 @@ return Status; } + +NTSTATUS +SampSetUserGroupAttributes(IN PSAM_DB_OBJECT DomainObject, + IN ULONG UserId, + IN ULONG GroupId, + IN ULONG GroupAttributes) +{ + PSAM_DB_OBJECT UserObject = NULL; + PGROUP_MEMBERSHIP GroupsBuffer = NULL; + ULONG Length = 0; + ULONG i; + NTSTATUS Status; + + Status = SampOpenUserObject(DomainObject, + UserId, + 0, + &UserObject); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + SampGetObjectAttribute(UserObject, + L"Groups", + NULL, + NULL, + &Length); + + if (Length == 0) + return STATUS_UNSUCCESSFUL; /* FIXME */ + + GroupsBuffer = midl_user_allocate(Length); + if (GroupsBuffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(UserObject, + L"Groups", + NULL, + GroupsBuffer, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + for (i = 0; i < (Length / sizeof(GROUP_MEMBERSHIP)); i++) + { + if (GroupsBuffer[i].RelativeId == GroupId) + { + GroupsBuffer[i].Attributes = GroupAttributes; + break; + } + } + + Status = SampSetObjectAttribute(UserObject, + L"Groups", + REG_BINARY, + GroupsBuffer, + Length); + +done: + if (GroupsBuffer != NULL) + midl_user_free(GroupsBuffer); + + if (UserObject != NULL) + SampCloseDbObject(UserObject); + + return Status; +} + /* EOF */
11 years, 11 months
1
0
0
0
[tkreuzer] 58175: [NTOSKRNL] Initialize MmCriticalSectionTimeout and use it to setup the value in the PEB (We currently continue to use 2.5 minutes, as opposed to the 30 days that Windows uses). Pr...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Jan 14 13:55:12 2013 New Revision: 58175 URL:
http://svn.reactos.org/svn/reactos?rev=58175&view=rev
Log: [NTOSKRNL] Initialize MmCriticalSectionTimeout and use it to setup the value in the PEB (We currently continue to use 2.5 minutes, as opposed to the 30 days that Windows uses). Probe and copy the timeout value in NtWaitForKeyedEvent and NtReleaseKeyedEvent. [RTL] Use RtlpTimeout for critical sections, which is initialized from the PEB. Implement using the LowMemory keyed event, when allocating the normal event failed. Modified: trunk/reactos/dll/ntdll/ldr/ldrinit.c trunk/reactos/lib/rtl/critical.c trunk/reactos/ntoskrnl/ex/keyedevt.c trunk/reactos/ntoskrnl/mm/ARM3/miarm.h trunk/reactos/ntoskrnl/mm/ARM3/mminit.c trunk/reactos/ntoskrnl/mm/ARM3/procsup.c Modified: trunk/reactos/dll/ntdll/ldr/ldrinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/ldrinit.c?re…
============================================================================== --- trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] Mon Jan 14 13:55:12 2013 @@ -48,7 +48,7 @@ ULONG LdrpNumberOfTlsEntries; ULONG LdrpNumberOfProcessors; PVOID NtDllBase; -LARGE_INTEGER RtlpTimeout; +extern LARGE_INTEGER RtlpTimeout; BOOLEAN RtlpTimeoutDisable; LIST_ENTRY LdrpHashTable[LDR_HASH_TABLE_ENTRIES]; LIST_ENTRY LdrpDllNotificationList; Modified: trunk/reactos/lib/rtl/critical.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/critical.c?rev=581…
============================================================================== --- trunk/reactos/lib/rtl/critical.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/critical.c [iso-8859-1] Mon Jan 14 13:55:12 2013 @@ -21,6 +21,7 @@ static BOOLEAN RtlpCritSectInitialized = FALSE; static RTL_CRITICAL_SECTION_DEBUG RtlpStaticDebugInfo[MAX_STATIC_CS_DEBUG_OBJECTS]; static BOOLEAN RtlpDebugInfoFreeList[MAX_STATIC_CS_DEBUG_OBJECTS]; +LARGE_INTEGER RtlpTimeout; /* FUNCTIONS *****************************************************************/ @@ -39,6 +40,7 @@ * None * *--*/ +_At_(CriticalSection->LockSemaphore, _Post_notnull_) VOID NTAPI RtlpCreateCriticalSectionSem(PRTL_CRITICAL_SECTION CriticalSection) @@ -47,31 +49,38 @@ HANDLE hNewEvent; NTSTATUS Status; - /* Chevk if we have an event */ - if (!hEvent) { + /* Check if we have an event */ + if (!hEvent) + { /* No, so create it */ - if (!NT_SUCCESS(Status = NtCreateEvent(&hNewEvent, - EVENT_ALL_ACCESS, - NULL, - SynchronizationEvent, - FALSE))) { - - /* We failed, this is bad... */ + Status = NtCreateEvent(&hNewEvent, + EVENT_ALL_ACCESS, + NULL, + SynchronizationEvent, + FALSE); + if (!NT_SUCCESS(Status)) + { DPRINT1("Failed to Create Event!\n"); - InterlockedDecrement(&CriticalSection->LockCount); - RtlRaiseStatus(Status); - return; + + /* Use INVALID_HANDLE_VALUE (-1) to signal that the global + keyed event must be used */ + hNewEvent = INVALID_HANDLE_VALUE; } + DPRINT("Created Event: %p \n", hNewEvent); + /* Exchange the LockSemaphore field with the new handle, if it is still 0 */ if (InterlockedCompareExchangePointer((PVOID*)&CriticalSection->LockSemaphore, (PVOID)hNewEvent, - 0)) { - - /* Some just created an event */ - DPRINT("Closing already created event: %p\n", hNewEvent); - NtClose(hNewEvent); + NULL) != NULL) + { + /* Someone else just created an event */ + if (hEvent != INVALID_HANDLE_VALUE) + { + DPRINT("Closing already created event: %p\n", hNewEvent); + NtClose(hNewEvent); + } } } @@ -100,13 +109,6 @@ NTSTATUS Status; EXCEPTION_RECORD ExceptionRecord; BOOLEAN LastChance = FALSE; - LARGE_INTEGER Timeout; - - /* Wait 2.5 minutes */ - Timeout.QuadPart = 150000L * (ULONGLONG)10000; - Timeout.QuadPart = -Timeout.QuadPart; - /* ^^ HACK HACK HACK. Good way: - Timeout = &NtCurrentPeb()->CriticalSectionTimeout */ /* Do we have an Event yet? */ if (!CriticalSection->LockSemaphore) { @@ -127,10 +129,22 @@ if (CriticalSection->DebugInfo) CriticalSection->DebugInfo->ContentionCount++; - /* Wait on the Event */ - Status = NtWaitForSingleObject(CriticalSection->LockSemaphore, - FALSE, - &Timeout); + /* Check if allocating the event failed */ + if (CriticalSection->LockSemaphore == INVALID_HANDLE_VALUE) + { + /* Use the global keyed event (NULL as keyed event handle) */ + Status = NtWaitForKeyedEvent(NULL, + CriticalSection, + FALSE, + &RtlpTimeout); + } + else + { + /* Wait on the Event */ + Status = NtWaitForSingleObject(CriticalSection->LockSemaphore, + FALSE, + &RtlpTimeout); + } /* We have Timed out */ if (Status == STATUS_TIMEOUT) { @@ -192,7 +206,18 @@ DPRINT("Signaling Critical Section Event: %p, %p\n", CriticalSection, CriticalSection->LockSemaphore); - Status = NtSetEvent(CriticalSection->LockSemaphore, NULL); + + /* Check if this critical section needs to use the keyed event */ + if (CriticalSection->LockSemaphore == INVALID_HANDLE_VALUE) + { + /* Release keyed event */ + Status = NtReleaseKeyedEvent(NULL, CriticalSection, FALSE, &RtlpTimeout); + } + else + { + /* Set the event */ + Status = NtSetEvent(CriticalSection->LockSemaphore, NULL); + } if (!NT_SUCCESS(Status)) { Modified: trunk/reactos/ntoskrnl/ex/keyedevt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/keyedevt.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ex/keyedevt.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/keyedevt.c [iso-8859-1] Mon Jan 14 13:55:12 2013 @@ -239,7 +239,7 @@ TRUE); } -_IRQL_requires_max_(APC_LEVEL) +_IRQL_requires_max_(PASSIVE_LEVEL) NTSTATUS NTAPI NtCreateKeyedEvent( @@ -316,7 +316,7 @@ return Status; } -_IRQL_requires_max_(APC_LEVEL) +_IRQL_requires_max_(PASSIVE_LEVEL) NTSTATUS NTAPI NtOpenKeyedEvent( @@ -365,18 +365,35 @@ return Status; } -_IRQL_requires_max_(APC_LEVEL) +_IRQL_requires_max_(PASSIVE_LEVEL) NTSTATUS NTAPI NtWaitForKeyedEvent( - _In_ HANDLE Handle, + _In_opt_ HANDLE Handle, _In_ PVOID Key, _In_ BOOLEAN Alertable, - _In_ PLARGE_INTEGER Timeout) + _In_opt_ PLARGE_INTEGER Timeout) { KPROCESSOR_MODE PreviousMode = KeGetPreviousMode(); PEX_KEYED_EVENT KeyedEvent; NTSTATUS Status; + LARGE_INTEGER TimeoutCopy; + + /* Check if the caller passed a timeout value and this is from user mode */ + if ((Timeout != NULL) && (PreviousMode != KernelMode)) + { + _SEH2_TRY + { + ProbeForRead(Timeout, sizeof(*Timeout), 1); + TimeoutCopy = *Timeout; + Timeout = &TimeoutCopy; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + _SEH2_YIELD(return _SEH2_GetExceptionCode()); + } + _SEH2_END; + } /* Check if the caller provided a handle */ if (Handle != NULL) @@ -408,18 +425,35 @@ return Status; } -_IRQL_requires_max_(APC_LEVEL) +_IRQL_requires_max_(PASSIVE_LEVEL) NTSTATUS NTAPI NtReleaseKeyedEvent( - _In_ HANDLE Handle, + _In_opt_ HANDLE Handle, _In_ PVOID Key, _In_ BOOLEAN Alertable, - _In_ PLARGE_INTEGER Timeout) + _In_opt_ PLARGE_INTEGER Timeout) { KPROCESSOR_MODE PreviousMode = KeGetPreviousMode(); PEX_KEYED_EVENT KeyedEvent; NTSTATUS Status; + LARGE_INTEGER TimeoutCopy; + + /* Check if the caller passed a timeout value and this is from user mode */ + if ((Timeout != NULL) && (PreviousMode != KernelMode)) + { + _SEH2_TRY + { + ProbeForRead(Timeout, sizeof(*Timeout), 1); + TimeoutCopy = *Timeout; + Timeout = &TimeoutCopy; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + _SEH2_YIELD(return _SEH2_GetExceptionCode()); + } + _SEH2_END; + } /* Check if the caller provided a handle */ if (Handle != NULL) Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?r…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Mon Jan 14 13:55:12 2013 @@ -713,6 +713,7 @@ extern PVOID MmHighSectionBase; extern SIZE_T MmSystemLockPagesCount; extern ULONG_PTR MmSubsectionBase; +extern LARGE_INTEGER MmCriticalSectionTimeout; BOOLEAN FORCEINLINE Modified: trunk/reactos/ntoskrnl/mm/ARM3/mminit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/mminit.c?…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] Mon Jan 14 13:55:12 2013 @@ -373,6 +373,9 @@ /* Number of free pages in the loader block */ PFN_NUMBER MiNumberOfFreePages = 0; +/* Timeout value for critical sections (2.5 minutes) */ +ULONG MmCritsectTimeoutSeconds = 150; // NT value: 720 * 60 * 60; (30 days) +LARGE_INTEGER MmCriticalSectionTimeout; /* PRIVATE FUNCTIONS **********************************************************/ @@ -2119,6 +2122,9 @@ /* Initialize the user mode image list */ InitializeListHead(&MmLoadedUserImageList); + /* Initialize critical section timeout value (relative time is negative) */ + MmCriticalSectionTimeout.QuadPart = MmCritsectTimeoutSeconds * (-10000000LL); + /* Initialize the paged pool mutex and the section commit mutex */ KeInitializeGuardedMutex(&MmPagedPoolMutex); KeInitializeGuardedMutex(&MmSectionCommitMutex); Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Mon Jan 14 13:55:12 2013 @@ -690,9 +690,9 @@ /*Peb->HeapSegmentReserve = MmHeapSegmentReserve; Peb->HeapSegmentCommit = MmHeapSegmentCommit; Peb->HeapDeCommitTotalFreeThreshold = MmHeapDeCommitTotalFreeThreshold; - Peb->HeapDeCommitFreeBlockThreshold = MmHeapDeCommitFreeBlockThreshold; - Peb->CriticalSectionTimeout = MmCriticalSectionTimeout; - Peb->MinimumStackCommit = MmMinimumStackCommitInBytes; + Peb->HeapDeCommitFreeBlockThreshold = MmHeapDeCommitFreeBlockThreshold;*/ + Peb->CriticalSectionTimeout = MmCriticalSectionTimeout; + /*Peb->MinimumStackCommit = MmMinimumStackCommitInBytes; */ Peb->MaximumNumberOfHeaps = (PAGE_SIZE - sizeof(PEB)) / sizeof(PVOID); Peb->ProcessHeaps = (PVOID*)(Peb + 1);
11 years, 11 months
1
0
0
0
[tkreuzer] 58174: [RTL] Inititalize the heap lock pointers with actual storage before calling RtlInitializeHeapLock
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Jan 14 10:58:16 2013 New Revision: 58174 URL:
http://svn.reactos.org/svn/reactos?rev=58174&view=rev
Log: [RTL] Inititalize the heap lock pointers with actual storage before calling RtlInitializeHeapLock Modified: trunk/reactos/lib/rtl/heappage.c Modified: trunk/reactos/lib/rtl/heappage.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heappage.c?rev=581…
============================================================================== --- trunk/reactos/lib/rtl/heappage.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/heappage.c [iso-8859-1] Mon Jan 14 10:58:16 2013 @@ -110,11 +110,13 @@ LIST_ENTRY RtlpDphPageHeapList; BOOLEAN RtlpDphPageHeapListInitialized; -PHEAP_LOCK RtlpDphPageHeapListLock; +HEAP_LOCK _RtlpDphPageHeapListLock; +PHEAP_LOCK RtlpDphPageHeapListLock = &_RtlpDphPageHeapListLock; ULONG RtlpDphPageHeapListLength; UNICODE_STRING RtlpDphTargetDllsUnicode; -PHEAP_LOCK RtlpDphDelayedFreeQueueLock; +HEAP_LOCK _RtlpDphDelayedFreeQueueLock; +PHEAP_LOCK RtlpDphDelayedFreeQueueLock = &_RtlpDphDelayedFreeQueueLock; LIST_ENTRY RtlpDphDelayedFreeQueue; SLIST_HEADER RtlpDphDelayedTemporaryPushList; SIZE_T RtlpDphMemoryUsedByDelayedFreeBlocks; @@ -1485,6 +1487,7 @@ /* Initialize the DPH root */ DphRoot->Signature = DPH_SIGNATURE; DphRoot->HeapFlags = Flags; + DphRoot->HeapCritSect = (PHEAP_LOCK)((PCHAR)DphRoot + DPH_POOL_SIZE); DphRoot->ExtraFlags = RtlpDphGlobalFlags; ZwQueryPerformanceCounter(&PerfCounter, NULL);
11 years, 11 months
1
0
0
0
[tkreuzer] 58173: [RTL/NTOSKRNL] - Seperate some usermode only heap functions into their own file and implement dummys in the kernel rtl so that they don't get included in the kernel - Convert usag...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Jan 14 09:35:50 2013 New Revision: 58173 URL:
http://svn.reactos.org/svn/reactos?rev=58173&view=rev
Log: [RTL/NTOSKRNL] - Seperate some usermode only heap functions into their own file and implement dummys in the kernel rtl so that they don't get included in the kernel - Convert usage of RTL_CRITICAL_SECTION in heappage.c to use of HEAP_LOCK - Implement A kernel dummy for RtlCallVectoredExceptionHandlers, so we don't put vectored exception handler code into ntoskrnl - Now we don't have critical section code in the kernel anymore, which wasn't working anyway. Added: trunk/reactos/lib/rtl/heapuser.c (with props) Modified: trunk/reactos/dll/ntdll/ldr/ldrinit.c trunk/reactos/lib/rtl/CMakeLists.txt trunk/reactos/lib/rtl/heap.c trunk/reactos/lib/rtl/heap.h trunk/reactos/lib/rtl/heappage.c trunk/reactos/lib/rtl/i386/except.c trunk/reactos/ntoskrnl/rtl/libsupp.c Modified: trunk/reactos/dll/ntdll/ldr/ldrinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/ldrinit.c?re…
============================================================================== --- trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] Mon Jan 14 09:35:50 2013 @@ -80,7 +80,7 @@ VOID RtlpInitializeVectoredExceptionHandling(VOID); VOID NTAPI RtlpInitDeferedCriticalSection(VOID); -VOID RtlInitializeHeapManager(VOID); +VOID NTAPI RtlInitializeHeapManager(VOID); extern BOOLEAN RtlpPageHeapEnabled; ULONG RtlpDisableHeapLookaside; // TODO: Move to heap.c Modified: trunk/reactos/lib/rtl/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/CMakeLists.txt?rev…
============================================================================== --- trunk/reactos/lib/rtl/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/CMakeLists.txt [iso-8859-1] Mon Jan 14 09:35:50 2013 @@ -30,6 +30,7 @@ heap.c heapdbg.c heappage.c + heapuser.c image.c interlck.c message.c Modified: trunk/reactos/lib/rtl/heap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heap.c?rev=58173&r…
============================================================================== --- trunk/reactos/lib/rtl/heap.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/heap.c [iso-8859-1] Mon Jan 14 09:35:50 2013 @@ -22,8 +22,6 @@ #define NDEBUG #include <debug.h> - -RTL_CRITICAL_SECTION RtlpProcessHeapsListLock; /* Bitmaps stuff */ @@ -964,98 +962,6 @@ { DPRINT1("HEAP: Failed to release segment's memory with status 0x%08X\n", Status); } -} - -/* Usermode only! */ -VOID NTAPI -RtlpAddHeapToProcessList(PHEAP Heap) -{ - PPEB Peb; - - /* Get PEB */ - Peb = RtlGetCurrentPeb(); - - /* Acquire the lock */ - RtlEnterCriticalSection(&RtlpProcessHeapsListLock); - - //_SEH2_TRY { - /* Check if max number of heaps reached */ - if (Peb->NumberOfHeaps == Peb->MaximumNumberOfHeaps) - { - // TODO: Handle this case - ASSERT(FALSE); - } - - /* Add the heap to the process heaps */ - Peb->ProcessHeaps[Peb->NumberOfHeaps] = Heap; - Peb->NumberOfHeaps++; - Heap->ProcessHeapsListIndex = (USHORT)Peb->NumberOfHeaps; - // } _SEH2_FINALLY { - - /* Release the lock */ - RtlLeaveCriticalSection(&RtlpProcessHeapsListLock); - - // } _SEH2_END -} - -/* Usermode only! */ -VOID NTAPI -RtlpRemoveHeapFromProcessList(PHEAP Heap) -{ - PPEB Peb; - PHEAP *Current, *Next; - ULONG Count; - - /* Get PEB */ - Peb = RtlGetCurrentPeb(); - - /* Acquire the lock */ - RtlEnterCriticalSection(&RtlpProcessHeapsListLock); - - /* Check if we don't need anything to do */ - if ((Heap->ProcessHeapsListIndex == 0) || - (Heap->ProcessHeapsListIndex > Peb->NumberOfHeaps) || - (Peb->NumberOfHeaps == 0)) - { - /* Release the lock */ - RtlLeaveCriticalSection(&RtlpProcessHeapsListLock); - - return; - } - - /* The process actually has more than one heap. - Use classic, lernt from university times algorithm for removing an entry - from a static array */ - - Current = (PHEAP *)&Peb->ProcessHeaps[Heap->ProcessHeapsListIndex - 1]; - Next = Current + 1; - - /* How many items we need to shift to the left */ - Count = Peb->NumberOfHeaps - (Heap->ProcessHeapsListIndex - 1); - - /* Move them all in a loop */ - while (--Count) - { - /* Copy it and advance next pointer */ - *Current = *Next; - - /* Update its index */ - (*Current)->ProcessHeapsListIndex -= 1; - - /* Advance pointers */ - Current++; - Next++; - } - - /* Decrease total number of heaps */ - Peb->NumberOfHeaps--; - - /* Zero last unused item */ - Peb->ProcessHeaps[Peb->NumberOfHeaps] = NULL; - Heap->ProcessHeapsListIndex = 0; - - /* Release the lock */ - RtlLeaveCriticalSection(&RtlpProcessHeapsListLock); } PHEAP_FREE_ENTRY NTAPI @@ -3685,22 +3591,6 @@ return HeapValid; } -VOID -RtlInitializeHeapManager(VOID) -{ - PPEB Peb; - - /* Get PEB */ - Peb = RtlGetCurrentPeb(); - - /* Initialize heap-related fields of PEB */ - Peb->NumberOfHeaps = 0; - - /* Initialize the process heaps list protecting lock */ - RtlInitializeCriticalSection(&RtlpProcessHeapsListLock); -} - - /* * @implemented */ Modified: trunk/reactos/lib/rtl/heap.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heap.h?rev=58173&r…
============================================================================== --- trunk/reactos/lib/rtl/heap.h [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/heap.h [iso-8859-1] Mon Jan 14 09:35:50 2013 @@ -467,4 +467,16 @@ ULONG Flags, PVOID Ptr); +VOID +NTAPI +RtlpAddHeapToProcessList(PHEAP Heap); + +VOID +NTAPI +RtlpRemoveHeapFromProcessList(PHEAP Heap); + +VOID +NTAPI +RtlInitializeHeapManager(VOID); + #endif Modified: trunk/reactos/lib/rtl/heappage.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heappage.c?rev=581…
============================================================================== --- trunk/reactos/lib/rtl/heappage.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/heappage.c [iso-8859-1] Mon Jan 14 09:35:50 2013 @@ -61,7 +61,7 @@ { ULONG Signature; ULONG HeapFlags; - PRTL_CRITICAL_SECTION HeapCritSect; + PHEAP_LOCK HeapCritSect; ULONG nRemoteLockAcquired; PDPH_HEAP_BLOCK pVirtualStorageListHead; @@ -110,11 +110,11 @@ LIST_ENTRY RtlpDphPageHeapList; BOOLEAN RtlpDphPageHeapListInitialized; -RTL_CRITICAL_SECTION RtlpDphPageHeapListLock; +PHEAP_LOCK RtlpDphPageHeapListLock; ULONG RtlpDphPageHeapListLength; UNICODE_STRING RtlpDphTargetDllsUnicode; -RTL_CRITICAL_SECTION RtlpDphDelayedFreeQueueLock; +PHEAP_LOCK RtlpDphDelayedFreeQueueLock; LIST_ENTRY RtlpDphDelayedFreeQueue; SLIST_HEADER RtlpDphDelayedTemporaryPushList; SIZE_T RtlpDphMemoryUsedByDelayedFreeBlocks; @@ -234,7 +234,7 @@ if (Flags & HEAP_NO_SERIALIZE) { /* More complex scenario */ - if (!RtlTryEnterCriticalSection(DphRoot->HeapCritSect)) + if (!RtlEnterHeapLock(DphRoot->HeapCritSect, TRUE)) { if (!DphRoot->nRemoteLockAcquired) { @@ -246,13 +246,13 @@ } /* Enter the heap's critical section */ - RtlEnterCriticalSection(DphRoot->HeapCritSect); + RtlEnterHeapLock(DphRoot->HeapCritSect, TRUE); } } else { /* Just enter the heap's critical section */ - RtlEnterCriticalSection(DphRoot->HeapCritSect); + RtlEnterHeapLock(DphRoot->HeapCritSect, TRUE); } } @@ -260,7 +260,7 @@ RtlpDphLeaveCriticalSection(PDPH_HEAP_ROOT DphRoot) { /* Just leave the heap's critical section */ - RtlLeaveCriticalSection(DphRoot->HeapCritSect); + RtlLeaveHeapLock(DphRoot->HeapCritSect); } @@ -1161,7 +1161,7 @@ { NTSTATUS Status; - Status = RtlInitializeCriticalSection(&RtlpDphDelayedFreeQueueLock); + Status = RtlInitializeHeapLock(&RtlpDphDelayedFreeQueueLock); if (!NT_SUCCESS(Status)) { // TODO: Log this error! @@ -1192,7 +1192,7 @@ then it releases the lock and frees the blocks. But let's make it simple for now */ /* Acquire the delayed free queue lock */ - RtlEnterCriticalSection(&RtlpDphDelayedFreeQueueLock); + RtlEnterHeapLock(RtlpDphDelayedFreeQueueLock, TRUE); /* Traverse the list */ Current = RtlpDphDelayedFreeQueue.Flink; @@ -1230,7 +1230,7 @@ } /* Release the delayed free queue lock */ - RtlLeaveCriticalSection(&RtlpDphDelayedFreeQueueLock); + RtlLeaveHeapLock(RtlpDphDelayedFreeQueueLock); } NTSTATUS NTAPI @@ -1391,7 +1391,7 @@ /* Initialize the DPH heap list and its critical section */ InitializeListHead(&RtlpDphPageHeapList); - Status = RtlInitializeCriticalSection(&RtlpDphPageHeapListLock); + Status = RtlInitializeHeapLock(&RtlpDphPageHeapListLock); if (!NT_SUCCESS(Status)) { ASSERT(FALSE); @@ -1485,13 +1485,12 @@ /* Initialize the DPH root */ DphRoot->Signature = DPH_SIGNATURE; DphRoot->HeapFlags = Flags; - DphRoot->HeapCritSect = (PRTL_CRITICAL_SECTION)((PCHAR)DphRoot + DPH_POOL_SIZE); DphRoot->ExtraFlags = RtlpDphGlobalFlags; ZwQueryPerformanceCounter(&PerfCounter, NULL); DphRoot->Seed = PerfCounter.LowPart; - RtlInitializeCriticalSection(DphRoot->HeapCritSect); + RtlInitializeHeapLock(&DphRoot->HeapCritSect); InitializeListHead(&DphRoot->AvailableAllocationHead); /* Create a normal heap for this paged heap */ @@ -1539,7 +1538,7 @@ if (!RtlpDphPageHeapListInitialized) RtlpDphProcessStartupInitialization(); /* Acquire the heap list lock */ - RtlEnterCriticalSection(&RtlpDphPageHeapListLock); + RtlEnterHeapLock(RtlpDphPageHeapListLock, TRUE); /* Insert this heap to the tail of the global list */ InsertTailList(&RtlpDphPageHeapList, &DphRoot->NextHeap); @@ -1548,7 +1547,7 @@ RtlpDphPageHeapListLength++; /* Release the heap list lock */ - RtlLeaveCriticalSection(&RtlpDphPageHeapListLock); + RtlLeaveHeapLock(RtlpDphPageHeapListLock); if (RtlpDphDebugOptions & DPH_DEBUG_VERBOSE) { @@ -1611,18 +1610,18 @@ } /* Acquire the global heap list lock */ - RtlEnterCriticalSection(&RtlpDphPageHeapListLock); + RtlEnterHeapLock(RtlpDphPageHeapListLock, TRUE); /* Remove the entry and decrement the global counter */ RemoveEntryList(&DphRoot->NextHeap); RtlpDphPageHeapListLength--; /* Release the global heap list lock */ - RtlLeaveCriticalSection(&RtlpDphPageHeapListLock); + RtlLeaveHeapLock(RtlpDphPageHeapListLock); /* Leave and delete this heap's critical section */ - RtlLeaveCriticalSection(DphRoot->HeapCritSect); - RtlDeleteCriticalSection(DphRoot->HeapCritSect); + RtlLeaveHeapLock(DphRoot->HeapCritSect); + RtlDeleteHeapLock(DphRoot->HeapCritSect); /* Now go through all virtual list nodes and release the VM */ Node = DphRoot->pVirtualStorageListHead; Added: trunk/reactos/lib/rtl/heapuser.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heapuser.c?rev=581…
============================================================================== --- trunk/reactos/lib/rtl/heapuser.c (added) +++ trunk/reactos/lib/rtl/heapuser.c [iso-8859-1] Mon Jan 14 09:35:50 2013 @@ -1,0 +1,128 @@ +/* COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: lib/rtl/heap.c + * PURPOSE: RTL Heap backend allocator (user mode only functions) + * PROGRAMMERS: Copyright 2010 Aleksey Bragin + */ + +/* INCLUDES *****************************************************************/ + +#include <rtl.h> +#include <heap.h> + +#define NDEBUG +#include <debug.h> + +RTL_CRITICAL_SECTION RtlpProcessHeapsListLock; + + +/* Usermode only! */ +VOID +NTAPI +RtlpAddHeapToProcessList(PHEAP Heap) +{ + PPEB Peb; + + /* Get PEB */ + Peb = RtlGetCurrentPeb(); + + /* Acquire the lock */ + RtlEnterCriticalSection(&RtlpProcessHeapsListLock); + + //_SEH2_TRY { + /* Check if max number of heaps reached */ + if (Peb->NumberOfHeaps == Peb->MaximumNumberOfHeaps) + { + // TODO: Handle this case + ASSERT(FALSE); + } + + /* Add the heap to the process heaps */ + Peb->ProcessHeaps[Peb->NumberOfHeaps] = Heap; + Peb->NumberOfHeaps++; + Heap->ProcessHeapsListIndex = (USHORT)Peb->NumberOfHeaps; + // } _SEH2_FINALLY { + + /* Release the lock */ + RtlLeaveCriticalSection(&RtlpProcessHeapsListLock); + + // } _SEH2_END +} + +/* Usermode only! */ +VOID +NTAPI +RtlpRemoveHeapFromProcessList(PHEAP Heap) +{ + PPEB Peb; + PHEAP *Current, *Next; + ULONG Count; + + /* Get PEB */ + Peb = RtlGetCurrentPeb(); + + /* Acquire the lock */ + RtlEnterCriticalSection(&RtlpProcessHeapsListLock); + + /* Check if we don't need anything to do */ + if ((Heap->ProcessHeapsListIndex == 0) || + (Heap->ProcessHeapsListIndex > Peb->NumberOfHeaps) || + (Peb->NumberOfHeaps == 0)) + { + /* Release the lock */ + RtlLeaveCriticalSection(&RtlpProcessHeapsListLock); + + return; + } + + /* The process actually has more than one heap. + Use classic, lernt from university times algorithm for removing an entry + from a static array */ + + Current = (PHEAP *)&Peb->ProcessHeaps[Heap->ProcessHeapsListIndex - 1]; + Next = Current + 1; + + /* How many items we need to shift to the left */ + Count = Peb->NumberOfHeaps - (Heap->ProcessHeapsListIndex - 1); + + /* Move them all in a loop */ + while (--Count) + { + /* Copy it and advance next pointer */ + *Current = *Next; + + /* Update its index */ + (*Current)->ProcessHeapsListIndex -= 1; + + /* Advance pointers */ + Current++; + Next++; + } + + /* Decrease total number of heaps */ + Peb->NumberOfHeaps--; + + /* Zero last unused item */ + Peb->ProcessHeaps[Peb->NumberOfHeaps] = NULL; + Heap->ProcessHeapsListIndex = 0; + + /* Release the lock */ + RtlLeaveCriticalSection(&RtlpProcessHeapsListLock); +} + +VOID +NTAPI +RtlInitializeHeapManager(VOID) +{ + PPEB Peb; + + /* Get PEB */ + Peb = RtlGetCurrentPeb(); + + /* Initialize heap-related fields of PEB */ + Peb->NumberOfHeaps = 0; + + /* Initialize the process heaps list protecting lock */ + RtlInitializeCriticalSection(&RtlpProcessHeapsListLock); +} + Propchange: trunk/reactos/lib/rtl/heapuser.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/lib/rtl/i386/except.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/i386/except.c?rev=…
============================================================================== --- trunk/reactos/lib/rtl/i386/except.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/i386/except.c [iso-8859-1] Mon Jan 14 09:35:50 2013 @@ -74,15 +74,11 @@ ULONG_PTR StackLow, StackHigh; ULONG_PTR RegistrationFrameEnd; - /* Perform vectored exception handling if we are in user mode */ - if (RtlpGetMode() != KernelMode) - { - /* Call any registered vectored handlers */ - if (RtlCallVectoredExceptionHandlers(ExceptionRecord, Context)) - { - /* Exception handled, continue execution */ - return TRUE; - } + /* Perform vectored exception handling (a dummy in kernel mode) */ + if (RtlCallVectoredExceptionHandlers(ExceptionRecord, Context)) + { + /* Exception handled, continue execution */ + return TRUE; } /* Get the current stack limits and registration frame */ Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/rtl/libsupp.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] Mon Jan 14 09:35:50 2013 @@ -200,6 +200,27 @@ KeLeaveCriticalRegion(); return STATUS_SUCCESS; +} + +struct _HEAP; + +VOID +NTAPI +RtlpAddHeapToProcessList(struct _HEAP *Heap) +{ + UNREFERENCED_PARAMETER(Heap); +} + +VOID +NTAPI +RtlpRemoveHeapFromProcessList(struct _HEAP *Heap) +{ + UNREFERENCED_PARAMETER(Heap); +} + +VOID +RtlInitializeHeapManager(VOID) +{ } #if DBG @@ -696,5 +717,14 @@ return STATUS_SUCCESS; } +BOOLEAN +NTAPI +RtlCallVectoredExceptionHandlers( + _In_ PEXCEPTION_RECORD ExceptionRecord, + _In_ PCONTEXT Context) +{ + /* In the kernel we don't have vectored exception handlers */ + return FALSE; +} /* EOF */
11 years, 11 months
1
0
0
0
[tfaber] 58172: [MSVCRT] - Improve file description. Patch by Lee Schroeder. CORE-6895 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Mon Jan 14 09:31:15 2013 New Revision: 58172 URL:
http://svn.reactos.org/svn/reactos?rev=58172&view=rev
Log: [MSVCRT] - Improve file description. Patch by Lee Schroeder. CORE-6895 #resolve Modified: trunk/reactos/dll/win32/msvcrt/msvcrt.rc Modified: trunk/reactos/dll/win32/msvcrt/msvcrt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt/msvcrt.rc…
============================================================================== --- trunk/reactos/dll/win32/msvcrt/msvcrt.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvcrt/msvcrt.rc [iso-8859-1] Mon Jan 14 09:31:15 2013 @@ -1,4 +1,4 @@ -#define REACTOS_STR_FILE_DESCRIPTION "MSVCRT.DLL Compatibility Library\0" +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS C Runtime Library\0" #define REACTOS_STR_INTERNAL_NAME "msvcrt\0" #define REACTOS_STR_ORIGINAL_FILENAME "msvcrt.dll\0"
11 years, 11 months
1
0
0
0
[tfaber] 58171: [EXPLORER_NEW] - Check policy before processing startup items. Simplify startup code. Patch by Edijs Kolesnikovičs.
by tfaber@svn.reactos.org
Author: tfaber Date: Sun Jan 13 20:13:30 2013 New Revision: 58171 URL:
http://svn.reactos.org/svn/reactos?rev=58171&view=rev
Log: [EXPLORER_NEW] - Check policy before processing startup items. Simplify startup code. Patch by Edijs Kolesnikovičs. Modified: trunk/reactos/base/shell/explorer-new/explorer.c trunk/reactos/base/shell/explorer-new/precomp.h trunk/reactos/base/shell/explorer-new/startup.c Modified: trunk/reactos/base/shell/explorer-new/explorer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/ex…
============================================================================== --- trunk/reactos/base/shell/explorer-new/explorer.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer-new/explorer.c [iso-8859-1] Sun Jan 13 20:13:30 2013 @@ -401,7 +401,7 @@ if (!SetShellReadyEvent(TEXT("msgina: ShellReadyEvent"))) SetShellReadyEvent(TEXT("Global\\msgina: ShellReadyEvent")); - startup(0, NULL); + ProcessStartupItems(); } else { Modified: trunk/reactos/base/shell/explorer-new/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/pr…
============================================================================== --- trunk/reactos/base/shell/explorer-new/precomp.h [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer-new/precomp.h [iso-8859-1] Sun Jan 13 20:13:30 2013 @@ -260,7 +260,8 @@ * startup.c */ -int startup(int argc, const char *argv[]); +int +ProcessStartupItems(VOID); /* * trayprop.h Modified: trunk/reactos/base/shell/explorer-new/startup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/st…
============================================================================== --- trunk/reactos/base/shell/explorer-new/startup.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer-new/startup.c [iso-8859-1] Sun Jan 13 20:13:30 2013 @@ -44,18 +44,6 @@ #include "precomp.h" EXTERN_C HRESULT WINAPI SHCreateSessionKey(REGSAM samDesired, PHKEY phKey); - -enum runkeys { - RUNKEY_RUN, RUNKEY_RUNONCE, RUNKEY_RUNSERVICES, RUNKEY_RUNSERVICESONCE -}; - -const WCHAR runkeys_names[][30]= -{ - {'R','u','n',0}, - {'R','u','n','O','n','c','e',0}, - {'R','u','n','S','e','r','v','i','c','e','s',0}, - {'R','u','n','S','e','r','v','i','c','e','s','O','n','c','e',0} -}; #define INVALID_RUNCMD_RETURN -1 /** @@ -245,24 +233,11 @@ return res == ERROR_SUCCESS ? TRUE : FALSE; } - /// structure holding startup flags -struct op_mask { - BOOL w9xonly; /* Perform only operations done on Windows 9x */ - BOOL ntonly; /* Perform only operations done on Windows NT */ - BOOL startup; /* Perform the operations that are performed every boot */ - BOOL preboot; /* Perform file renames typically done before the system starts */ - BOOL prelogin; /* Perform the operations typically done before the user logs in */ - BOOL postlogin; /* Operations done after login */ -}; - -static const struct op_mask - SESSION_START = {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE}, - SETUP = {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE}; -#define DEFAULT SESSION_START - -int startup(int argc, const char *argv[]) + +int +ProcessStartupItems(VOID) { - struct op_mask ops; /* Which of the ops do we want to perform? */ + BOOL bNormalBoot = GetSystemMetrics(SM_CLEANBOOT) == 0; /* Perform the operations that are performed every boot */ /* First, set the current directory to SystemRoot */ TCHAR gen_path[MAX_PATH]; DWORD res; @@ -305,41 +280,21 @@ } } - if (argc > 1) - { - switch(argv[1][0]) - { - case 'r': /* Restart */ - ops = SETUP; - break; - case 's': /* Full start */ - ops = SESSION_START; - break; - default: - ops = DEFAULT; - break; - } - } - else - ops = DEFAULT; - - /* do not run certain items in Safe Mode */ - if (GetSystemMetrics(SM_CLEANBOOT)) ops.startup = FALSE; - - /* Perform the ops by order, stopping if one fails, skipping if necessary */ + /* Perform the operations by order checking if policy allows it, checking if this is not Safe Mode, + * stopping if one fails, skipping if necessary. + */ res = TRUE; - if (res && !ops.ntonly && ops.prelogin) - res = ProcessRunKeys(HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], TRUE, FALSE); - if (res && !ops.ntonly && ops.prelogin && ops.startup) - res = ProcessRunKeys(HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], FALSE, FALSE); - if (res && ops.postlogin) - res = ProcessRunKeys(HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], TRUE, TRUE); - if (res && ops.postlogin && ops.startup) - res = ProcessRunKeys(HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], FALSE, FALSE); - if (res && ops.postlogin && ops.startup) - res = ProcessRunKeys(HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], FALSE, FALSE); - if (res && ops.postlogin && ops.startup) - res = ProcessRunKeys(HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUNONCE], TRUE, FALSE); + if (res && (SHRestricted(REST_NOLOCALMACHINERUNONCE) == 0)) + res = ProcessRunKeys(HKEY_LOCAL_MACHINE, L"RunOnce", TRUE, TRUE); + + if (res && bNormalBoot && (SHRestricted(REST_NOLOCALMACHINERUN) == 0)) + res = ProcessRunKeys(HKEY_LOCAL_MACHINE, L"Run", FALSE, FALSE); + + if (res && bNormalBoot && (SHRestricted(REST_NOCURRENTUSERRUNONCE) == 0)) + res = ProcessRunKeys(HKEY_CURRENT_USER, L"Run", FALSE, FALSE); + + if (res && bNormalBoot && (SHRestricted(REST_NOCURRENTUSERRUNONCE) == 0)) + res = ProcessRunKeys(HKEY_CURRENT_USER, L"RunOnce", TRUE, FALSE); printf("Operation done\n");
11 years, 11 months
1
0
0
0
[ekohl] 58170: [SAMSRV] Implement SamrGetMembersInGroup.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jan 13 19:51:33 2013 New Revision: 58170 URL:
http://svn.reactos.org/svn/reactos?rev=58170&view=rev
Log: [SAMSRV] Implement SamrGetMembersInGroup. Modified: trunk/reactos/dll/win32/samsrv/samrpc.c trunk/reactos/dll/win32/samsrv/samsrv.h trunk/reactos/dll/win32/samsrv/user.c 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 13 19:51:33 2013 @@ -4055,9 +4055,101 @@ SamrGetMembersInGroup(IN SAMPR_HANDLE GroupHandle, OUT PSAMPR_GET_MEMBERS_BUFFER *Members) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} + PSAMPR_GET_MEMBERS_BUFFER MembersBuffer = NULL; + PSAM_DB_OBJECT GroupObject; + ULONG Length = 0; + ULONG i; + NTSTATUS Status; + + /* Validate the group handle */ + Status = SampValidateDbObject(GroupHandle, + SamDbGroupObject, + GROUP_LIST_MEMBERS, + &GroupObject); + if (!NT_SUCCESS(Status)) + return Status; + + MembersBuffer = midl_user_allocate(sizeof(SAMPR_GET_MEMBERS_BUFFER)); + if (MembersBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + SampGetObjectAttribute(GroupObject, + L"Members", + NULL, + NULL, + &Length); + + if (Length == 0) + { + MembersBuffer->MemberCount = 0; + MembersBuffer->Members = NULL; + MembersBuffer->Attributes = NULL; + + *Members = MembersBuffer; + + return STATUS_SUCCESS; + } + + MembersBuffer->Members = midl_user_allocate(Length); + if (MembersBuffer->Members == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + MembersBuffer->Attributes = midl_user_allocate(Length); + if (MembersBuffer->Attributes == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(GroupObject, + L"Members", + NULL, + MembersBuffer->Members, + &Length); + if (!NT_SUCCESS(Status)) + { + TRACE("SampGetObjectAttributes() failed (Status 0x%08lx)\n", Status); + goto done; + } + + MembersBuffer->MemberCount = Length / sizeof(ULONG); + + for (i = 0; i < MembersBuffer->MemberCount; i++) + { + Status = SampGetUserGroupAttributes(GroupObject->ParentObject, + MembersBuffer->Members[i], + GroupObject->RelativeId, + &(MembersBuffer->Attributes[i])); + if (!NT_SUCCESS(Status)) + { + TRACE("SampGetUserGroupAttributes() failed (Status 0x%08lx)\n", Status); + goto done; + } + } + + *Members = MembersBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (MembersBuffer != NULL) + { + if (MembersBuffer->Members != NULL) + midl_user_free(MembersBuffer->Members); + + if (MembersBuffer->Attributes != NULL) + midl_user_free(MembersBuffer->Attributes); + + midl_user_free(MembersBuffer); + } + } + + return Status; +} + /* Function 26 */ NTSTATUS 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 13 19:51:33 2013 @@ -271,12 +271,18 @@ OUT PSAM_DB_OBJECT *UserObject); NTSTATUS -SampAddGroupMembershipToUser(PSAM_DB_OBJECT UserObject, - ULONG GroupId, - ULONG Attributes); - -NTSTATUS -SampRemoveGroupMembershipFromUser(PSAM_DB_OBJECT UserObject, - ULONG GroupId); +SampAddGroupMembershipToUser(IN PSAM_DB_OBJECT UserObject, + IN ULONG GroupId, + IN ULONG Attributes); + +NTSTATUS +SampRemoveGroupMembershipFromUser(IN PSAM_DB_OBJECT UserObject, + IN ULONG GroupId); + +NTSTATUS +SampGetUserGroupAttributes(IN PSAM_DB_OBJECT DomainObject, + IN ULONG UserId, + IN ULONG GroupId, + OUT PULONG GroupAttributes); /* EOF */ Modified: trunk/reactos/dll/win32/samsrv/user.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/user.c?re…
============================================================================== --- trunk/reactos/dll/win32/samsrv/user.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/user.c [iso-8859-1] Sun Jan 13 19:51:33 2013 @@ -185,4 +185,72 @@ return Status; } + +NTSTATUS +SampGetUserGroupAttributes(IN PSAM_DB_OBJECT DomainObject, + IN ULONG UserId, + IN ULONG GroupId, + OUT PULONG GroupAttributes) +{ + PSAM_DB_OBJECT UserObject = NULL; + PGROUP_MEMBERSHIP GroupsBuffer = NULL; + ULONG Length = 0; + ULONG i; + NTSTATUS Status; + + Status = SampOpenUserObject(DomainObject, + UserId, + 0, + &UserObject); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + SampGetObjectAttribute(UserObject, + L"Groups", + NULL, + NULL, + &Length); + + if (Length == 0) + { + *GroupAttributes = 0; + return STATUS_SUCCESS; + } + + GroupsBuffer = midl_user_allocate(Length); + if (GroupsBuffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = SampGetObjectAttribute(UserObject, + L"Groups", + NULL, + GroupsBuffer, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + for (i = 0; i < (Length / sizeof(GROUP_MEMBERSHIP)); i++) + { + if (GroupsBuffer[i].RelativeId == GroupId) + { + *GroupAttributes = GroupsBuffer[i].Attributes; + goto done; + } + } + +done: + if (GroupsBuffer != NULL) + midl_user_free(GroupsBuffer); + + if (UserObject != NULL) + SampCloseDbObject(UserObject); + + return Status; +} + /* EOF */
11 years, 11 months
1
0
0
0
[hbelusca] 58169: [CONSRV] - Finish to do the replacements HeapAlloc --> RtlAllocateHeap and Co. - Finish to UNICODify consrv (it happens that it has been almost done already). - Modify the way we ...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Jan 13 19:50:52 2013 New Revision: 58169 URL:
http://svn.reactos.org/svn/reactos?rev=58169&view=rev
Log: [CONSRV] - Finish to do the replacements HeapAlloc --> RtlAllocateHeap and Co. - Finish to UNICODify consrv (it happens that it has been almost done already). - Modify the way we start BlueScreen driver (in TUI mode): instead of using the SCM which, at that moment, is starting (and is not ready to answer to start/stop services requests), use the NT apis to start the driver (in the same way the SCM performs driver starting). - Add a note on HAVE_WMEMSET. Modified: branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt branches/ros-csrss/win32ss/user/consrv/alias.c branches/ros-csrss/win32ss/user/consrv/conio.h branches/ros-csrss/win32ss/user/consrv/conoutput.c branches/ros-csrss/win32ss/user/consrv/guiconsole.c branches/ros-csrss/win32ss/user/consrv/tuiconsole.c branches/ros-csrss/win32ss/user/consrv/tuiconsole.h Modified: branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/C…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt [iso-8859-1] Sun Jan 13 19:50:52 2013 @@ -23,7 +23,7 @@ target_link_libraries(consrv win32ksys ${PSEH_LIB}) # win32ksys because of NtUser...() -set_module_type(consrv win32dll) +set_module_type(consrv win32dll UNICODE) add_importlibs(consrv psapi msvcrt kernel32 ntdll csrsrv) add_delay_importlibs(consrv user32 gdi32 advapi32) 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] Sun Jan 13 19:50:52 2013 @@ -64,7 +64,7 @@ return Entry; Entry->lpExeName = (LPCWSTR)(Entry + 1); - wcscpy((WCHAR*)Entry->lpExeName, lpExeName); + wcscpy((PWCHAR)Entry->lpExeName, lpExeName); Entry->Data = NULL; Entry->Next = NULL; return Entry; 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] Sun Jan 13 19:50:52 2013 @@ -107,9 +107,9 @@ typedef struct _CONSOLE_VTBL { VOID (WINAPI *InitScreenBuffer)(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER ScreenBuffer); - VOID (WINAPI *WriteStream)(PCONSOLE Console, SMALL_RECT *Block, LONG CursorStartX, LONG CursorStartY, + VOID (WINAPI *WriteStream)(PCONSOLE Console, SMALL_RECT* Block, LONG CursorStartX, LONG CursorStartY, UINT ScrolledLines, CHAR *Buffer, UINT Length); - VOID (WINAPI *DrawRegion)(PCONSOLE Console, SMALL_RECT *Region); + VOID (WINAPI *DrawRegion)(PCONSOLE Console, SMALL_RECT* Region); BOOL (WINAPI *SetCursorInfo)(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER ScreenBuffer); BOOL (WINAPI *SetScreenInfo)(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER ScreenBuffer, UINT OldCursorX, UINT OldCursorY); 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] Sun Jan 13 19:50:52 2013 @@ -89,7 +89,7 @@ } static VOID FASTCALL -ConioNextLine(PCONSOLE_SCREEN_BUFFER Buff, SMALL_RECT *UpdateRect, UINT *ScrolledLines) +ConioNextLine(PCONSOLE_SCREEN_BUFFER Buff, SMALL_RECT* UpdateRect, UINT *ScrolledLines) { /* If we hit bottom, slide the viewable screen */ if (++Buff->CurrentY == Buff->MaxY) @@ -240,9 +240,9 @@ } __inline BOOLEAN ConioGetIntersection( - SMALL_RECT *Intersection, - SMALL_RECT *Rect1, - SMALL_RECT *Rect2) + SMALL_RECT* Intersection, + SMALL_RECT* Rect1, + SMALL_RECT* Rect2) { if (ConioIsRectEmpty(Rect1) || (ConioIsRectEmpty(Rect2)) || @@ -266,9 +266,9 @@ } __inline BOOLEAN ConioGetUnion( - SMALL_RECT *Union, - SMALL_RECT *Rect1, - SMALL_RECT *Rect2) + SMALL_RECT* Union, + SMALL_RECT* Rect1, + SMALL_RECT* Rect2) { if (ConioIsRectEmpty(Rect1)) { @@ -304,9 +304,9 @@ */ static VOID FASTCALL ConioMoveRegion(PCONSOLE_SCREEN_BUFFER ScreenBuffer, - SMALL_RECT *SrcRegion, - SMALL_RECT *DstRegion, - SMALL_RECT *ClipRegion, + SMALL_RECT* SrcRegion, + SMALL_RECT* DstRegion, + SMALL_RECT* ClipRegion, WORD Fill) { int Width = ConioRectWidth(SrcRegion); @@ -394,7 +394,7 @@ } static VOID FASTCALL -ConioComputeUpdateRect(PCONSOLE_SCREEN_BUFFER Buff, SMALL_RECT *UpdateRect, COORD *Start, UINT Length) +ConioComputeUpdateRect(PCONSOLE_SCREEN_BUFFER Buff, SMALL_RECT* UpdateRect, PCOORD Start, UINT Length) { if (Buff->MaxX <= Start->X + Length) { 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] Sun Jan 13 19:50:52 2013 @@ -15,6 +15,11 @@ #define NDEBUG #include <debug.h> +/* +// Define wmemset(...) +#include <wchar.h> +#define HAVE_WMEMSET +*/ /* GUI Console Window Class name */ #define GUI_CONSOLE_WINDOW_CLASS L"ConsoleWindowClass" @@ -1074,7 +1079,7 @@ } static VOID WINAPI -GuiDrawRegion(PCONSOLE Console, SMALL_RECT *Region) +GuiDrawRegion(PCONSOLE Console, SMALL_RECT* Region) { RECT RegionRect; SmallRectToRect(Console, &RegionRect, Region); @@ -1089,7 +1094,7 @@ } static VOID WINAPI -GuiWriteStream(PCONSOLE Console, SMALL_RECT *Region, LONG CursorStartX, LONG CursorStartY, +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; @@ -1519,7 +1524,7 @@ { PCONSOLE Console; APPLET_PROC CPLFunc; - TCHAR szBuffer[MAX_PATH]; + WCHAR szBuffer[MAX_PATH]; ConsoleInfo SharedInfo; DPRINT("GuiConsoleShowConsoleProperties entered\n"); @@ -1534,9 +1539,9 @@ if (GuiData->ConsoleLibrary == NULL) { - GetWindowsDirectory(szBuffer,MAX_PATH); - _tcscat(szBuffer, _T("\\system32\\console.dll")); - GuiData->ConsoleLibrary = LoadLibrary(szBuffer); + GetWindowsDirectoryW(szBuffer, MAX_PATH); + wcscat(szBuffer, L"\\system32\\console.dll"); + GuiData->ConsoleLibrary = LoadLibraryW(szBuffer); if (GuiData->ConsoleLibrary == NULL) { @@ -1545,7 +1550,7 @@ } } - CPLFunc = (APPLET_PROC) GetProcAddress(GuiData->ConsoleLibrary, _T("CPlApplet")); + CPLFunc = (APPLET_PROC)GetProcAddress(GuiData->ConsoleLibrary, "CPlApplet"); if (!CPLFunc) { DPRINT("Error: Console.dll misses CPlApplet export\n"); @@ -1755,11 +1760,12 @@ BYTE * OldPtr; USHORT CurrentY; BYTE * OldBuffer; -#if HAVE_WMEMSET +#ifdef HAVE_WMEMSET USHORT value = MAKEWORD(' ', ScreenBuffer->DefaultAttrib); +#else + DWORD i; #endif DWORD diff; - DWORD i; /* Buffer size is not allowed to be smaller than window size */ if (Size.X < Console->Size.X || Size.Y < Console->Size.Y) @@ -1792,8 +1798,8 @@ diff = Size.X - ScreenBuffer->MaxX; /* zero new part of it */ -#if HAVE_WMEMSET - wmemset((WCHAR*)&Buffer[Offset], value, diff); +#ifdef HAVE_WMEMSET + wmemset((PWCHAR)&Buffer[Offset], value, diff); #else for (i = 0; i < diff; i++) { @@ -1807,8 +1813,8 @@ if (Size.Y > ScreenBuffer->MaxY) { diff = Size.X * (Size.Y - ScreenBuffer->MaxY); -#if HAVE_WMEMSET - wmemset((WCHAR*)&Buffer[Offset], value, diff); +#ifdef HAVE_WMEMSET + wmemset((PWCHAR)&Buffer[Offset], value, diff); #else for (i = 0; i < diff; i++) { Modified: branches/ros-csrss/win32ss/user/consrv/tuiconsole.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/t…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/tuiconsole.c [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/tuiconsole.c [iso-8859-1] Sun Jan 13 19:50:52 2013 @@ -25,6 +25,157 @@ static BOOL ConsInitialized = FALSE; +/******************************************************************************\ +|** BlueScreen Driver management **| +\**/ +/* Code taken and adapted from base/system/services/driver.c */ +static DWORD EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege) +{ + DWORD dwRet = ERROR_SUCCESS; + HANDLE hToken = NULL; + + if (OpenProcessToken(GetCurrentProcess(), + TOKEN_ADJUST_PRIVILEGES, + &hToken)) + { + TOKEN_PRIVILEGES tp; + + tp.PrivilegeCount = 1; + tp.Privileges[0].Attributes = (bEnablePrivilege ? SE_PRIVILEGE_ENABLED : 0); + + if (LookupPrivilegeValueW(NULL, + lpszPrivilegeName, + &tp.Privileges[0].Luid)) + { + if (AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL)) + { + if (GetLastError() == ERROR_NOT_ALL_ASSIGNED) + dwRet = ERROR_NOT_ALL_ASSIGNED; + } + else + { + dwRet = GetLastError(); + } + } + else + { + dwRet = GetLastError(); + } + + CloseHandle(hToken); + } + else + { + dwRet = GetLastError(); + } + + return dwRet; +} + +static DWORD +ScmLoadDriver(LPCWSTR lpServiceName) +{ + PWSTR pszDriverPath; + UNICODE_STRING DriverPath; + NTSTATUS Status; + DWORD dwError = ERROR_SUCCESS; + + /* Build the driver path */ + /* 52 = wcslen(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\") */ + pszDriverPath = RtlAllocateHeap(ConSrvHeap, + HEAP_ZERO_MEMORY, + (52 + wcslen(lpServiceName) + 1) * sizeof(WCHAR)); + if (pszDriverPath == NULL) + return ERROR_NOT_ENOUGH_MEMORY; + + wcscpy(pszDriverPath, + L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"); + wcscat(pszDriverPath, + lpServiceName); + + RtlInitUnicodeString(&DriverPath, + pszDriverPath); + + DPRINT(" Path: %wZ\n", &DriverPath); + + /* Acquire driver-loading privilege */ + dwError = EnablePrivilege(SE_LOAD_DRIVER_NAME, TRUE); + if (dwError != ERROR_SUCCESS) + { + /* We encountered a failure, exit properly */ + DPRINT1("CONSRV: Cannot acquire driver-loading privilege, error = %lu\n", dwError); + goto done; + } + + Status = NtLoadDriver(&DriverPath); + + /* Release driver-loading privilege */ + EnablePrivilege(SE_LOAD_DRIVER_NAME, FALSE); + + if (!NT_SUCCESS(Status)) + { + dwError = RtlNtStatusToDosError(Status); + } + +done: + RtlFreeHeap(ConSrvHeap, 0, pszDriverPath); + + return dwError; +} + +#ifdef BLUESCREEN_DRIVER_UNLOADING +static DWORD +ScmUnloadDriver(LPCWSTR lpServiceName) +{ + PWSTR pszDriverPath; + UNICODE_STRING DriverPath; + NTSTATUS Status; + DWORD dwError = ERROR_SUCCESS; + + /* Build the driver path */ + /* 52 = wcslen(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\") */ + pszDriverPath = RtlAllocateHeap(ConSrvHeap, + HEAP_ZERO_MEMORY, + (52 + wcslen(lpServiceName) + 1) * sizeof(WCHAR)); + if (pszDriverPath == NULL) + return ERROR_NOT_ENOUGH_MEMORY; + + wcscpy(pszDriverPath, + L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"); + wcscat(pszDriverPath, + lpServiceName); + + RtlInitUnicodeString(&DriverPath, + pszDriverPath); + + /* Acquire driver-unloading privilege */ + dwError = EnablePrivilege(SE_LOAD_DRIVER_NAME, TRUE); + if (dwError != ERROR_SUCCESS) + { + /* We encountered a failure, exit properly */ + DPRINT1("CONSRV: Cannot acquire driver-unloading privilege, error = %lu\n", dwError); + goto done; + } + + Status = NtUnloadDriver(&DriverPath); + + /* Release driver-unloading privilege */ + EnablePrivilege(SE_LOAD_DRIVER_NAME, FALSE); + + if (!NT_SUCCESS(Status)) + { + dwError = RtlNtStatusToDosError(Status); + } + +done: + RtlFreeHeap(ConSrvHeap, 0, pszDriverPath); + + return dwError; +} +#endif +/**\ +\******************************************************************************/ + static LRESULT CALLBACK TuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -37,35 +188,6 @@ } } return DefWindowProcW(hWnd, msg, wParam, lParam); -} - -static BOOL FASTCALL -TuiStartService(LPCWSTR lpServiceName) -{ - SC_HANDLE hSCManager = NULL; - SC_HANDLE hService = NULL; - BOOL ret = FALSE; - - hSCManager = OpenSCManagerW(NULL, NULL, 0); - if (hSCManager == NULL) - goto cleanup; - - hService = OpenServiceW(hSCManager, lpServiceName, SERVICE_START); - if (hService == NULL) - goto cleanup; - - ret = StartServiceW(hService, 0, NULL); - if (!ret) - goto cleanup; - - ret = TRUE; - -cleanup: - if (hSCManager != NULL) - CloseServiceHandle(hSCManager); - if (hService != NULL) - CloseServiceHandle(hService); - return ret; } static BOOL FASTCALL @@ -77,7 +199,7 @@ ATOM ConsoleClassAtom; USHORT TextAttribute = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; - TuiStartService(L"Blue"); + ScmLoadDriver(L"Blue"); ConsoleDeviceHandle = CreateFileW(L"\\\\.\\BlueScreen", FILE_ALL_ACCESS, 0, NULL, OPEN_EXISTING, 0, NULL); @@ -140,7 +262,7 @@ } static void FASTCALL -TuiCopyRect(char *Dest, PCONSOLE_SCREEN_BUFFER Buff, SMALL_RECT *Region) +TuiCopyRect(char *Dest, PCONSOLE_SCREEN_BUFFER Buff, SMALL_RECT* Region) { UINT SrcDelta, DestDelta; LONG i; @@ -163,7 +285,7 @@ } static VOID WINAPI -TuiDrawRegion(PCONSOLE Console, SMALL_RECT *Region) +TuiDrawRegion(PCONSOLE Console, SMALL_RECT* Region) { DWORD BytesReturned; PCONSOLE_SCREEN_BUFFER Buff = Console->ActiveBuffer; @@ -177,10 +299,10 @@ ConsoleDrawSize = sizeof(CONSOLE_DRAW) + (ConioRectWidth(Region) * ConioRectHeight(Region)) * 2; - ConsoleDraw = HeapAlloc(ConSrvHeap, 0, ConsoleDrawSize); + ConsoleDraw = RtlAllocateHeap(ConSrvHeap, 0, ConsoleDrawSize); if (NULL == ConsoleDraw) { - DPRINT1("HeapAlloc failed\n"); + DPRINT1("RtlAllocateHeap failed\n"); return; } ConsoleDraw->X = Region->Left; @@ -196,15 +318,15 @@ NULL, 0, ConsoleDraw, ConsoleDrawSize, &BytesReturned, NULL)) { DPRINT1("Failed to draw console\n"); - HeapFree(ConSrvHeap, 0, ConsoleDraw); + RtlFreeHeap(ConSrvHeap, 0, ConsoleDraw); return; } - HeapFree(ConSrvHeap, 0, ConsoleDraw); + RtlFreeHeap(ConSrvHeap, 0, ConsoleDraw); } static VOID WINAPI -TuiWriteStream(PCONSOLE Console, SMALL_RECT *Region, LONG CursorStartX, LONG CursorStartY, +TuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, LONG CursorStartX, LONG CursorStartY, UINT ScrolledLines, CHAR *Buffer, UINT Length) { DWORD BytesWritten; @@ -437,13 +559,13 @@ } BOOL FASTCALL -TuiSwapConsole(int Next) +TuiSwapConsole(INT Next) { static PCONSOLE SwapConsole = NULL; /* console we are thinking about swapping with */ DWORD BytesReturned; ANSI_STRING Title; - void * Buffer; - COORD *pos; + PVOID Buffer; + PCOORD pos; if (0 != Next) { @@ -458,10 +580,10 @@ SwapConsole = (0 < Next ? SwapConsole->Next : SwapConsole->Prev); Title.MaximumLength = RtlUnicodeStringToAnsiSize(&SwapConsole->Title); Title.Length = 0; - Buffer = HeapAlloc(ConSrvHeap, + Buffer = RtlAllocateHeap(ConSrvHeap, 0, sizeof(COORD) + Title.MaximumLength); - pos = (COORD *)Buffer; + pos = (PCOORD )Buffer; Title.Buffer = (PVOID)((ULONG_PTR)Buffer + sizeof( COORD )); RtlUnicodeStringToAnsiString(&Title, &SwapConsole->Title, FALSE); @@ -475,7 +597,7 @@ { DPRINT1( "Error writing to console\n" ); } - HeapFree(ConSrvHeap, 0, Buffer); + RtlFreeHeap(ConSrvHeap, 0, Buffer); LeaveCriticalSection(&ActiveConsoleLock); return TRUE; Modified: branches/ros-csrss/win32ss/user/consrv/tuiconsole.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/t…
============================================================================== --- branches/ros-csrss/win32ss/user/consrv/tuiconsole.h [iso-8859-1] (original) +++ branches/ros-csrss/win32ss/user/consrv/tuiconsole.h [iso-8859-1] Sun Jan 13 19:50:52 2013 @@ -10,6 +10,6 @@ extern NTSTATUS FASTCALL TuiInitConsole(PCONSOLE Console); extern PCONSOLE FASTCALL TuiGetFocusConsole(VOID); -extern BOOL FASTCALL TuiSwapConsole(int Next); +extern BOOL FASTCALL TuiSwapConsole(INT Next); /* EOF */
11 years, 11 months
1
0
0
0
[hbelusca] 58168: [CONSRV] HeapAlloc --> RtlAllocateHeap HeapFree --> RtlFreeHeap GetProcessHeap --> RtlGetProcessHeap
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Jan 13 19:18:54 2013 New Revision: 58168 URL:
http://svn.reactos.org/svn/reactos?rev=58168&view=rev
Log: [CONSRV] HeapAlloc --> RtlAllocateHeap HeapFree --> RtlFreeHeap GetProcessHeap --> RtlGetProcessHeap Modified: branches/ros-csrss/win32ss/user/consrv/coninput.c branches/ros-csrss/win32ss/user/consrv/conoutput.c branches/ros-csrss/win32ss/user/consrv/console.c branches/ros-csrss/win32ss/user/consrv/guiconsole.c branches/ros-csrss/win32ss/user/consrv/lineinput.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] Sun Jan 13 19:18:54 2013 @@ -312,7 +312,7 @@ { PGET_INPUT_INFO CapturedInputInfo; - CapturedInputInfo = HeapAlloc(ConSrvHeap, 0, sizeof(GET_INPUT_INFO)); + CapturedInputInfo = RtlAllocateHeap(ConSrvHeap, 0, sizeof(GET_INPUT_INFO)); if (!CapturedInputInfo) return STATUS_NO_MEMORY; memmove(CapturedInputInfo, InputInfo, sizeof(GET_INPUT_INFO)); @@ -324,7 +324,7 @@ CapturedInputInfo, NULL)) { - HeapFree(ConSrvHeap, 0, CapturedInputInfo); + RtlFreeHeap(ConSrvHeap, 0, CapturedInputInfo); return STATUS_NO_MEMORY; } } @@ -361,7 +361,7 @@ if (Status != STATUS_PENDING) { WaitApiMessage->Status = Status; - HeapFree(ConSrvHeap, 0, InputInfo); + RtlFreeHeap(ConSrvHeap, 0, InputInfo); } return (Status == STATUS_PENDING ? FALSE : TRUE); @@ -418,7 +418,7 @@ if (Wait) // TRUE --> Read, we remove inputs from the buffer ; FALSE --> Peek, we keep inputs. { RemoveEntryList(&Input->ListEntry); - HeapFree(ConSrvHeap, 0, Input); + RtlFreeHeap(ConSrvHeap, 0, Input); } } @@ -457,7 +457,7 @@ if (Status != STATUS_PENDING) { WaitApiMessage->Status = Status; - HeapFree(ConSrvHeap, 0, InputInfo); + RtlFreeHeap(ConSrvHeap, 0, InputInfo); } return (Status == STATUS_PENDING ? FALSE : TRUE); @@ -485,7 +485,7 @@ { /* Starting a new line */ InputInfo->Console->LineMaxSize = max(256, nNumberOfCharsToRead); - InputInfo->Console->LineBuffer = HeapAlloc(ConSrvHeap, 0, InputInfo->Console->LineMaxSize * sizeof(WCHAR)); + InputInfo->Console->LineBuffer = RtlAllocateHeap(ConSrvHeap, 0, InputInfo->Console->LineMaxSize * sizeof(WCHAR)); if (InputInfo->Console->LineBuffer == NULL) { return STATUS_NO_MEMORY; @@ -528,7 +528,7 @@ LineInputKeyDown(InputInfo->Console, &Input->InputEvent.Event.KeyEvent); ReadConsoleRequest->ControlKeyState = Input->InputEvent.Event.KeyEvent.dwControlKeyState; } - HeapFree(ConSrvHeap, 0, Input); + RtlFreeHeap(ConSrvHeap, 0, Input); } /* Check if we have a complete line to read from */ @@ -556,7 +556,7 @@ if (InputInfo->Console->LinePos == InputInfo->Console->LineSize) { /* Entire line has been read */ - HeapFree(ConSrvHeap, 0, InputInfo->Console->LineBuffer); + RtlFreeHeap(ConSrvHeap, 0, InputInfo->Console->LineBuffer); InputInfo->Console->LineBuffer = NULL; } @@ -600,7 +600,7 @@ /* Did read something */ WaitForMoreToRead = FALSE; } - HeapFree(ConSrvHeap, 0, Input); + RtlFreeHeap(ConSrvHeap, 0, Input); } } @@ -773,7 +773,7 @@ CurrentEntry = RemoveHeadList(&Console->InputEvents); Input = CONTAINING_RECORD(CurrentEntry, ConsoleInput, ListEntry); /* Destroy the event */ - HeapFree(ConSrvHeap, 0, Input); + RtlFreeHeap(ConSrvHeap, 0, Input); } ResetEvent(Console->ActiveEvent); 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] Sun Jan 13 19:18:54 2013 @@ -69,7 +69,7 @@ Buffer->ShowX = 0; Buffer->ShowY = 0; Buffer->VirtualY = 0; - Buffer->Buffer = HeapAlloc(ConSrvHeap, HEAP_ZERO_MEMORY, Buffer->MaxX * Buffer->MaxY * 2); + Buffer->Buffer = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, Buffer->MaxX * Buffer->MaxY * 2); if (NULL == Buffer->Buffer) { return STATUS_INSUFFICIENT_RESOURCES; @@ -379,8 +379,8 @@ } } - HeapFree(ConSrvHeap, 0, Buffer->Buffer); - HeapFree(ConSrvHeap, 0, Buffer); + RtlFreeHeap(ConSrvHeap, 0, Buffer->Buffer); + RtlFreeHeap(ConSrvHeap, 0, Buffer); } VOID FASTCALL @@ -506,7 +506,7 @@ (PWCHAR)WriteConsoleRequest->Buffer, WriteConsoleRequest->NrCharactersToWrite, NULL, 0, NULL, NULL); - Buffer = RtlAllocateHeap(GetProcessHeap(), 0, Length); + Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length); if (Buffer) { WideCharToMultiByte(Console->OutputCodePage, 0, @@ -537,7 +537,7 @@ } if (WriteConsoleRequest->Unicode) { - RtlFreeHeap(GetProcessHeap(), 0, Buffer); + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); } } @@ -931,7 +931,7 @@ (PWCHAR)WriteOutputCodeRequest->pCode.UnicodeChar, WriteOutputCodeRequest->Length, NULL, 0, NULL, NULL); - tmpString = String = RtlAllocateHeap(GetProcessHeap(), 0, Length); + tmpString = String = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length); if (String) { WideCharToMultiByte(Console->OutputCodePage, 0, @@ -996,7 +996,7 @@ if (tmpString) { - RtlFreeHeap(GetProcessHeap(), 0, tmpString); + RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString); } ConioUnlockScreenBuffer(Buff); @@ -1235,7 +1235,7 @@ return Status; } - Buff = HeapAlloc(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CONSOLE_SCREEN_BUFFER)); + Buff = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CONSOLE_SCREEN_BUFFER)); if (Buff != NULL) { if (Console->ActiveBuffer) 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] Sun Jan 13 19:18:54 2013 @@ -102,7 +102,7 @@ *NewConsole = NULL; /* Allocate a console structure */ - Console = HeapAlloc(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CONSOLE)); + Console = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CONSOLE)); if (NULL == Console) { DPRINT1("Not enough memory for console creation.\n"); @@ -146,7 +146,7 @@ if (NULL == Console->ActiveEvent) { RtlFreeUnicodeString(&Console->Title); - HeapFree(ConSrvHeap, 0, Console); + RtlFreeHeap(ConSrvHeap, 0, Console); return STATUS_UNSUCCESSFUL; } Console->PrivateData = NULL; @@ -155,13 +155,13 @@ GuiMode = DtbgIsDesktopVisible(); /* allocate console screen buffer */ - NewBuffer = HeapAlloc(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CONSOLE_SCREEN_BUFFER)); + NewBuffer = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CONSOLE_SCREEN_BUFFER)); if (NULL == NewBuffer) { RtlFreeUnicodeString(&Console->Title); DeleteCriticalSection(&Console->Lock); CloseHandle(Console->ActiveEvent); - HeapFree(ConSrvHeap, 0, Console); + RtlFreeHeap(ConSrvHeap, 0, Console); return STATUS_INSUFFICIENT_RESOURCES; } /* init screen buffer with defaults */ @@ -200,12 +200,12 @@ Status = GuiInitConsole(Console, ShowCmd); if (!NT_SUCCESS(Status)) { - HeapFree(ConSrvHeap,0, NewBuffer); + RtlFreeHeap(ConSrvHeap,0, NewBuffer); RtlFreeUnicodeString(&Console->Title); DeleteCriticalSection(&Console->Lock); CloseHandle(Console->ActiveEvent); DPRINT1("GuiInitConsole: failed, Status = 0x%08lx\n", Status); - HeapFree(ConSrvHeap, 0, Console); + RtlFreeHeap(ConSrvHeap, 0, Console); return Status; } } @@ -217,9 +217,9 @@ RtlFreeUnicodeString(&Console->Title); DeleteCriticalSection(&Console->Lock); CloseHandle(Console->ActiveEvent); - HeapFree(ConSrvHeap, 0, NewBuffer); + RtlFreeHeap(ConSrvHeap, 0, NewBuffer); DPRINT1("CsrInitConsoleScreenBuffer: failed\n"); - HeapFree(ConSrvHeap, 0, Console); + RtlFreeHeap(ConSrvHeap, 0, Console); return Status; } @@ -594,7 +594,7 @@ Event = (ConsoleInput *) Console->InputEvents.Flink; Console->InputEvents.Flink = Console->InputEvents.Flink->Flink; Console->InputEvents.Flink->Flink->Blink = &Console->InputEvents; - HeapFree(ConSrvHeap, 0, Event); + RtlFreeHeap(ConSrvHeap, 0, Event); } ConioCleanupConsole(Console); @@ -614,7 +614,7 @@ DeleteCriticalSection(&Console->Lock); RtlFreeUnicodeString(&Console->Title); IntDeleteAllAliases(Console->Aliases); - HeapFree(ConSrvHeap, 0, Console); + RtlFreeHeap(ConSrvHeap, 0, Console); } VOID WINAPI 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] Sun Jan 13 19:18:54 2013 @@ -710,7 +710,7 @@ if (NULL == GuiData) { - DPRINT1("GuiConsoleNcCreate: HeapAlloc failed\n"); + DPRINT1("GuiConsoleNcCreate: RtlAllocateHeap failed\n"); return FALSE; } @@ -743,7 +743,7 @@ { DPRINT1("GuiConsoleNcCreate: CreateFont failed\n"); DeleteCriticalSection(&GuiData->Lock); - HeapFree(ConSrvHeap, 0, GuiData); + RtlFreeHeap(ConSrvHeap, 0, GuiData); return FALSE; } Dc = GetDC(hWnd); @@ -752,7 +752,7 @@ DPRINT1("GuiConsoleNcCreate: GetDC failed\n"); DeleteObject(GuiData->Font); DeleteCriticalSection(&GuiData->Lock); - HeapFree(ConSrvHeap, 0, GuiData); + RtlFreeHeap(ConSrvHeap, 0, GuiData); return FALSE; } OldFont = SelectObject(Dc, GuiData->Font); @@ -762,7 +762,7 @@ ReleaseDC(hWnd, Dc); DeleteObject(GuiData->Font); DeleteCriticalSection(&GuiData->Lock); - HeapFree(ConSrvHeap, 0, GuiData); + RtlFreeHeap(ConSrvHeap, 0, GuiData); return FALSE; } if (! GetTextMetricsW(Dc, &Metrics)) @@ -772,7 +772,7 @@ ReleaseDC(hWnd, Dc); DeleteObject(GuiData->Font); DeleteCriticalSection(&GuiData->Lock); - HeapFree(ConSrvHeap, 0, GuiData); + RtlFreeHeap(ConSrvHeap, 0, GuiData); return FALSE; } GuiData->CharWidth = Metrics.tmMaxCharWidth; @@ -1312,7 +1312,7 @@ if (GuiData->ConsoleLibrary) FreeLibrary(GuiData->ConsoleLibrary); - HeapFree(ConSrvHeap, 0, GuiData); + RtlFreeHeap(ConSrvHeap, 0, GuiData); } static COORD @@ -1768,7 +1768,7 @@ if (Size.X == ScreenBuffer->MaxX && Size.Y == ScreenBuffer->MaxY) return STATUS_SUCCESS; - Buffer = HeapAlloc(ConSrvHeap, 0, Size.X * Size.Y * 2); + Buffer = RtlAllocateHeap(ConSrvHeap, 0, Size.X * Size.Y * 2); if (!Buffer) return STATUS_NO_MEMORY; @@ -1819,7 +1819,7 @@ } (void)InterlockedExchangePointer((PVOID volatile *)&ScreenBuffer->Buffer, Buffer); - HeapFree(ConSrvHeap, 0, OldBuffer); + RtlFreeHeap(ConSrvHeap, 0, OldBuffer); ScreenBuffer->MaxX = Size.X; ScreenBuffer->MaxY = Size.Y; ScreenBuffer->VirtualY = 0; @@ -2081,8 +2081,8 @@ SetWindowLongW(hWnd, GWL_USERDATA, 0); return 0; case PM_CREATE_CONSOLE: - Buffer = HeapAlloc(ConSrvHeap, 0, - Console->Title.Length + sizeof(WCHAR)); + Buffer = RtlAllocateHeap(ConSrvHeap, 0, + Console->Title.Length + sizeof(WCHAR)); if (NULL != Buffer) { memcpy(Buffer, Console->Title.Buffer, Console->Title.Length); @@ -2107,7 +2107,7 @@ (PVOID)Console); if (NULL != Buffer) { - HeapFree(ConSrvHeap, 0, Buffer); + RtlFreeHeap(ConSrvHeap, 0, Buffer); } if (NULL != NewWindow) { @@ -2247,8 +2247,8 @@ { PWCHAR Buffer, Title; - Buffer = HeapAlloc(ConSrvHeap, 0, - Console->Title.Length + sizeof(WCHAR)); + Buffer = RtlAllocateHeap(ConSrvHeap, 0, + Console->Title.Length + sizeof(WCHAR)); if (NULL != Buffer) { memcpy(Buffer, Console->Title.Buffer, Console->Title.Length); @@ -2264,7 +2264,7 @@ if (NULL != Buffer) { - HeapFree(ConSrvHeap, 0, Buffer); + RtlFreeHeap(ConSrvHeap, 0, Buffer); } return TRUE; @@ -2350,8 +2350,8 @@ return STATUS_UNSUCCESSFUL; } } - GuiData = HeapAlloc(ConSrvHeap, HEAP_ZERO_MEMORY, - sizeof(GUI_CONSOLE_DATA)); + GuiData = RtlAllocateHeap(ConSrvHeap, HEAP_ZERO_MEMORY, + sizeof(GUI_CONSOLE_DATA)); if (!GuiData) { DPRINT1("Win32Csr: Failed to create GUI_CONSOLE_DATA\n"); 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] Sun Jan 13 19:18:54 2013 @@ -42,15 +42,15 @@ } /* Couldn't find the buffer, create a new one */ - Hist = HeapAlloc(ConSrvHeap, 0, sizeof(HISTORY_BUFFER) + ExeName.Length); + Hist = RtlAllocateHeap(ConSrvHeap, 0, sizeof(HISTORY_BUFFER) + ExeName.Length); if (!Hist) return NULL; Hist->MaxEntries = Console->HistoryBufferSize; Hist->NumEntries = 0; - Hist->Entries = HeapAlloc(ConSrvHeap, 0, Hist->MaxEntries * sizeof(UNICODE_STRING)); + Hist->Entries = RtlAllocateHeap(ConSrvHeap, 0, Hist->MaxEntries * sizeof(UNICODE_STRING)); if (!Hist->Entries) { - HeapFree(ConSrvHeap, 0, Hist); + RtlFreeHeap(ConSrvHeap, 0, Hist); return NULL; } Hist->ExeName.Length = Hist->ExeName.MaximumLength = ExeName.Length; @@ -144,9 +144,9 @@ return; while (Hist->NumEntries != 0) RtlFreeUnicodeString(&Hist->Entries[--Hist->NumEntries]); - HeapFree(ConSrvHeap, 0, Hist->Entries); + RtlFreeHeap(ConSrvHeap, 0, Hist->Entries); RemoveEntryList(&Hist->ListEntry); - HeapFree(ConSrvHeap, 0, Hist); + RtlFreeHeap(ConSrvHeap, 0, Hist); } CSR_API(SrvGetConsoleCommandHistoryLength) @@ -281,8 +281,8 @@ if (Hist) { OldEntryList = Hist->Entries; - NewEntryList = HeapAlloc(ConSrvHeap, 0, - MaxEntries * sizeof(UNICODE_STRING)); + NewEntryList = RtlAllocateHeap(ConSrvHeap, 0, + MaxEntries * sizeof(UNICODE_STRING)); if (!NewEntryList) { Status = STATUS_NO_MEMORY; @@ -299,7 +299,7 @@ Hist->MaxEntries = MaxEntries; Hist->Entries = memcpy(NewEntryList, Hist->Entries, Hist->NumEntries * sizeof(UNICODE_STRING)); - HeapFree(ConSrvHeap, 0, OldEntryList); + RtlFreeHeap(ConSrvHeap, 0, OldEntryList); } } ConioUnlockConsole(Console);
11 years, 11 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
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