ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
February 2012
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
22 participants
577 discussions
Start a n
N
ew thread
[ion] 55617: [CSRSRV/WIN32CSR]: No code change, but rename CSRSS_PROCESS_DATA to CSR_PROCESS and all the right fields -- put ReactOS-specific fields at the end. Do all the right renames needed for ...
by ion@svn.reactos.org
Author: ion Date: Wed Feb 15 20:29:08 2012 New Revision: 55617 URL:
http://svn.reactos.org/svn/reactos?rev=55617&view=rev
Log: [CSRSRV/WIN32CSR]: No code change, but rename CSRSS_PROCESS_DATA to CSR_PROCESS and all the right fields -- put ReactOS-specific fields at the end. Do all the right renames needed for compilation. No functionality change. Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c trunk/reactos/subsystems/win32/csrss/csrsrv/init.c trunk/reactos/subsystems/win32/csrss/csrsrv/procsup.c trunk/reactos/subsystems/win32/csrss/csrsrv/thredsup.c trunk/reactos/subsystems/win32/csrss/include/api.h trunk/reactos/subsystems/win32/csrss/include/csrplugin.h trunk/reactos/subsystems/win32/csrss/win32csr/coninput.c trunk/reactos/subsystems/win32/csrss/win32csr/conio.h trunk/reactos/subsystems/win32/csrss/win32csr/conoutput.c trunk/reactos/subsystems/win32/csrss/win32csr/console.c trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c trunk/reactos/subsystems/win32/csrss/win32csr/exitros.c trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c trunk/reactos/subsystems/win32/csrss/win32csr/handle.c trunk/reactos/subsystems/win32/csrss/win32csr/harderror.c trunk/reactos/subsystems/win32/csrss/win32csr/w32csr.h trunk/reactos/subsystems/win32/csrss/win32csr/win32csr.h Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -18,15 +18,15 @@ #define CsrAcquireProcessLock() LOCK #define CsrReleaseProcessLock() UNLOCK -extern NTSTATUS CallProcessInherit(PCSRSS_PROCESS_DATA, PCSRSS_PROCESS_DATA); -extern NTSTATUS CallProcessDeleted(PCSRSS_PROCESS_DATA); +extern NTSTATUS CallProcessInherit(PCSR_PROCESS, PCSR_PROCESS); +extern NTSTATUS CallProcessDeleted(PCSR_PROCESS); /* GLOBALS *******************************************************************/ static ULONG NrProcess; -PCSRSS_PROCESS_DATA ProcessData[256]; +PCSR_PROCESS ProcessData[256]; RTL_CRITICAL_SECTION ProcessDataLock; -extern PCSRSS_PROCESS_DATA CsrRootProcess; +extern PCSR_PROCESS CsrRootProcess; extern LIST_ENTRY CsrThreadHashTable[256]; /* FUNCTIONS *****************************************************************/ @@ -44,10 +44,10 @@ for (i = 0; i < 256; i++) InitializeListHead(&CsrThreadHashTable[i]); } -PCSRSS_PROCESS_DATA WINAPI CsrGetProcessData(HANDLE ProcessId) +PCSR_PROCESS WINAPI CsrGetProcessData(HANDLE ProcessId) { ULONG hash; - PCSRSS_PROCESS_DATA pProcessData; + PCSR_PROCESS pProcessData; hash = ((ULONG_PTR)ProcessId >> 2) % (sizeof(ProcessData) / sizeof(*ProcessData)); @@ -55,7 +55,7 @@ pProcessData = ProcessData[hash]; - while (pProcessData && pProcessData->ProcessId != ProcessId) + while (pProcessData && pProcessData->ClientId.UniqueProcess != ProcessId) { pProcessData = pProcessData->next; } @@ -63,10 +63,10 @@ return pProcessData; } -PCSRSS_PROCESS_DATA WINAPI CsrCreateProcessData(HANDLE ProcessId) +PCSR_PROCESS WINAPI CsrCreateProcessData(HANDLE ProcessId) { ULONG hash; - PCSRSS_PROCESS_DATA pProcessData; + PCSR_PROCESS pProcessData; OBJECT_ATTRIBUTES ObjectAttributes; CLIENT_ID ClientId; NTSTATUS Status; @@ -77,7 +77,7 @@ pProcessData = ProcessData[hash]; - while (pProcessData && pProcessData->ProcessId != ProcessId) + while (pProcessData && pProcessData->ClientId.UniqueProcess != ProcessId) { pProcessData = pProcessData->next; } @@ -85,15 +85,15 @@ { pProcessData = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, - sizeof(CSRSS_PROCESS_DATA)); + sizeof(CSR_PROCESS)); if (pProcessData) { - pProcessData->ProcessId = ProcessId; + pProcessData->ClientId.UniqueProcess = ProcessId; pProcessData->next = ProcessData[hash]; ProcessData[hash] = pProcessData; ClientId.UniqueThread = NULL; - ClientId.UniqueProcess = pProcessData->ProcessId; + ClientId.UniqueProcess = pProcessData->ClientId.UniqueProcess; InitializeObjectAttributes(&ObjectAttributes, NULL, 0, @@ -101,11 +101,11 @@ NULL); /* using OpenProcess is not optimal due to HANDLE vs. DWORD PIDs... */ - Status = NtOpenProcess(&pProcessData->Process, + Status = NtOpenProcess(&pProcessData->ProcessHandle, PROCESS_ALL_ACCESS, &ObjectAttributes, &ClientId); - DPRINT("CSR Process: %p Handle: %p\n", pProcessData, pProcessData->Process); + DPRINT("CSR Process: %p Handle: %p\n", pProcessData, pProcessData->ProcessHandle); if (!NT_SUCCESS(Status)) { ProcessData[hash] = pProcessData->next; @@ -129,7 +129,7 @@ } else { - pProcessData->Terminated = FALSE; + pProcessData->Flags = ~CsrProcessTerminated; /* Set default shutdown parameters */ pProcessData->ShutdownLevel = 0x280; @@ -144,7 +144,7 @@ NTSTATUS WINAPI CsrFreeProcessData(HANDLE Pid) { ULONG hash; - PCSRSS_PROCESS_DATA pProcessData, *pPrevLink; + PCSR_PROCESS pProcessData, *pPrevLink; HANDLE Process; PLIST_ENTRY NextEntry; PCSR_THREAD Thread; @@ -154,7 +154,7 @@ LOCK; - while ((pProcessData = *pPrevLink) && pProcessData->ProcessId != Pid) + while ((pProcessData = *pPrevLink) && pProcessData->ClientId.UniqueProcess != Pid) { pPrevLink = &pProcessData->next; } @@ -162,7 +162,7 @@ if (pProcessData) { DPRINT("CsrFreeProcessData pid: %d\n", Pid); - Process = pProcessData->Process; + Process = pProcessData->ProcessHandle; CallProcessDeleted(pProcessData); /* Dereference all process threads */ @@ -175,14 +175,14 @@ CsrThreadRefcountZero(Thread); } - if (pProcessData->CsrSectionViewBase) + if (pProcessData->ClientViewBase) { - NtUnmapViewOfSection(NtCurrentProcess(), pProcessData->CsrSectionViewBase); + NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)pProcessData->ClientViewBase); } - if (pProcessData->ServerCommunicationPort) + if (pProcessData->ClientPort) { - NtClose(pProcessData->ServerCommunicationPort); + NtClose(pProcessData->ClientPort); } *pPrevLink = pProcessData->next; @@ -206,7 +206,7 @@ CSR_API(CsrCreateProcess) { - PCSRSS_PROCESS_DATA NewProcessData; + PCSR_PROCESS NewProcessData; Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); @@ -229,11 +229,11 @@ if (Request->Data.CreateProcessRequest.Flags & CREATE_NEW_PROCESS_GROUP) { - NewProcessData->ProcessGroup = (DWORD)(ULONG_PTR)NewProcessData->ProcessId; + NewProcessData->ProcessGroupId = (DWORD)(ULONG_PTR)NewProcessData->ClientId.UniqueProcess; } else { - NewProcessData->ProcessGroup = ProcessData->ProcessGroup; + NewProcessData->ProcessGroupId = ProcessData->ProcessGroupId; } return(STATUS_SUCCESS); @@ -244,7 +244,7 @@ PCSR_THREAD CurrentThread; HANDLE ThreadHandle; NTSTATUS Status; - PCSRSS_PROCESS_DATA CsrProcess; + PCSR_PROCESS CsrProcess; Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); @@ -253,11 +253,11 @@ CsrProcess = CurrentThread->Process; // DPRINT1("Current thread: %p %p\n", CurrentThread, CsrProcess); // DPRINT1("Request CID: %lx %lx %lx\n", -// CsrProcess->ProcessId, +// CsrProcess->ClientId.UniqueProcess, // NtCurrentTeb()->ClientId.UniqueProcess, // Request->Data.CreateThreadRequest.ClientId.UniqueProcess); - if (CsrProcess->ProcessId != Request->Data.CreateThreadRequest.ClientId.UniqueProcess) + if (CsrProcess->ClientId.UniqueProcess != Request->Data.CreateThreadRequest.ClientId.UniqueProcess) { if (Request->Data.CreateThreadRequest.ClientId.UniqueProcess == NtCurrentTeb()->ClientId.UniqueProcess) { @@ -270,12 +270,12 @@ if (!NT_SUCCESS(Status)) return Status; } -// DPRINT1("PIDs: %lx %lx\n", CurrentThread->Process->ProcessId, CsrProcess->ProcessId); +// DPRINT1("PIDs: %lx %lx\n", CurrentThread->Process->ClientId.UniqueProcess, CsrProcess->ClientId.UniqueProcess); // DPRINT1("Thread handle is: %lx Process Handle is: %lx %lx\n", // Request->Data.CreateThreadRequest.ThreadHandle, - // CurrentThread->Process->Process, + // CurrentThread->Process->ProcessHandle, // CsrProcess->Process); - Status = NtDuplicateObject(CsrProcess->Process, + Status = NtDuplicateObject(CsrProcess->ProcessHandle, Request->Data.CreateThreadRequest.ThreadHandle, NtCurrentProcess(), &ThreadHandle, @@ -285,7 +285,7 @@ //DPRINT1("Duplicate status: %lx\n", Status); if (!NT_SUCCESS(Status)) { - Status = NtDuplicateObject(CurrentThread->Process->Process, + Status = NtDuplicateObject(CurrentThread->Process->ProcessHandle, Request->Data.CreateThreadRequest.ThreadHandle, NtCurrentProcess(), &ThreadHandle, @@ -327,7 +327,7 @@ } - ProcessData->Terminated = TRUE; + ProcessData->Flags |= CsrProcessTerminated; return STATUS_SUCCESS; } Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -72,7 +72,7 @@ VOID FASTCALL -CsrApiCallHandler(PCSRSS_PROCESS_DATA ProcessData, +CsrApiCallHandler(PCSR_PROCESS ProcessData, PCSR_API_MESSAGE Request) { unsigned DefIndex; @@ -108,13 +108,13 @@ } BOOL -CallHardError(IN PCSRSS_PROCESS_DATA ProcessData, +CallHardError(IN PCSR_PROCESS ProcessData, IN PHARDERROR_MSG HardErrorMessage); static VOID NTAPI -CsrHandleHardError(IN PCSRSS_PROCESS_DATA ProcessData, +CsrHandleHardError(IN PCSR_PROCESS ProcessData, IN OUT PHARDERROR_MSG Message) { DPRINT1("CSR: received hard error %lx\n", Message->Status); @@ -275,7 +275,7 @@ *--*/ NTSTATUS NTAPI -CsrSrvAttachSharedSection(IN PCSRSS_PROCESS_DATA CsrProcess OPTIONAL, +CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL, OUT PCSR_CONNECTION_INFO ConnectInfo) { NTSTATUS Status; @@ -285,9 +285,9 @@ if (CsrProcess) { /* Map the section into this process */ - DPRINT("CSR Process Handle: %p. CSR Process: %p\n", CsrProcess->Process, CsrProcess); + DPRINT("CSR Process Handle: %p. CSR Process: %p\n", CsrProcess->ProcessHandle, CsrProcess); Status = NtMapViewOfSection(CsrSrvSharedSection, - CsrProcess->Process, + CsrProcess->ProcessHandle, &CsrSrvSharedSectionBase, 0, 0, @@ -701,7 +701,7 @@ { NTSTATUS Status; HANDLE ServerPort = NULL, ServerThread = NULL; - PCSRSS_PROCESS_DATA ProcessData = NULL; + PCSR_PROCESS ProcessData = NULL; REMOTE_PORT_VIEW LpcRead; CLIENT_ID ClientId; BOOLEAN AllowConnection = FALSE; @@ -728,7 +728,7 @@ } } - if (ProcessData->Process == NULL) + if (ProcessData->ProcessHandle == NULL) { OBJECT_ATTRIBUTES ObjectAttributes; @@ -739,11 +739,11 @@ NULL); DPRINT1("WARNING: CSR PROCESS WITH NO CSR PROCESS HANDLE???\n"); ClientId.UniqueThread = 0; - Status = NtOpenProcess(&ProcessData->Process, + Status = NtOpenProcess(&ProcessData->ProcessHandle, PROCESS_ALL_ACCESS, &ObjectAttributes, &Request->ClientId); - DPRINT1("Status: %lx. Handle: %lx\n", Status, ProcessData->Process); + DPRINT1("Status: %lx. Handle: %lx\n", Status, ProcessData->ProcessHandle); } if (ProcessData) @@ -773,9 +773,9 @@ return Status; } - ProcessData->CsrSectionViewBase = LpcRead.ViewBase; - ProcessData->CsrSectionViewSize = LpcRead.ViewSize; - ProcessData->ServerCommunicationPort = ServerPort; + ProcessData->ClientViewBase = (ULONG_PTR)LpcRead.ViewBase; + ProcessData->ClientViewBounds = LpcRead.ViewSize; + ProcessData->ClientPort = ServerPort; if (AllowConnection) Status = NtCompleteConnectPort(ServerPort); if (!NT_SUCCESS(Status)) @@ -866,7 +866,7 @@ BYTE RawRequest[LPC_MAX_DATA_LENGTH]; PCSR_API_MESSAGE Request = (PCSR_API_MESSAGE)RawRequest; PCSR_API_MESSAGE Reply; - PCSRSS_PROCESS_DATA ProcessData; + PCSR_PROCESS ProcessData; PCSR_THREAD ServerThread; DPRINT("CSR: %s called\n", __FUNCTION__); @@ -947,7 +947,7 @@ Request->Header.ClientId.UniqueProcess); break; } - if (ProcessData->Terminated) + if (ProcessData->Flags & CsrProcessTerminated) { DPRINT1("Message %d: process %d already terminated\n", Request->Type, Request->Header.ClientId.UniqueProcess); @@ -963,7 +963,7 @@ else { PCSR_THREAD Thread; - PCSRSS_PROCESS_DATA Process = NULL; + PCSR_PROCESS Process = NULL; //DPRINT1("locate thread %lx/%lx\n", Request->Header.ClientId.UniqueProcess, Request->Header.ClientId.UniqueThread); Thread = CsrLocateThreadByClientId(&Process, &Request->Header.ClientId); Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/init.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/init.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -65,7 +65,7 @@ } BOOL -CallHardError(IN PCSRSS_PROCESS_DATA ProcessData, +CallHardError(IN PCSR_PROCESS ProcessData, IN PHARDERROR_MSG HardErrorMessage) { BOOL Ok; @@ -83,8 +83,8 @@ } NTSTATUS -CallProcessInherit(IN PCSRSS_PROCESS_DATA SourceProcessData, - IN PCSRSS_PROCESS_DATA TargetProcessData) +CallProcessInherit(IN PCSR_PROCESS SourceProcessData, + IN PCSR_PROCESS TargetProcessData) { NTSTATUS Status = STATUS_SUCCESS; unsigned i; @@ -98,7 +98,7 @@ } NTSTATUS -CallProcessDeleted(IN PCSRSS_PROCESS_DATA ProcessData) +CallProcessDeleted(IN PCSR_PROCESS ProcessData) { NTSTATUS Status = STATUS_SUCCESS; unsigned i; Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/procsup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/procsup.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/procsup.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -23,8 +23,8 @@ /* GLOBALS ********************************************************************/ extern RTL_CRITICAL_SECTION ProcessDataLock; -extern PCSRSS_PROCESS_DATA ProcessData[256]; -PCSRSS_PROCESS_DATA CsrRootProcess; +extern PCSR_PROCESS ProcessData[256]; +PCSR_PROCESS CsrRootProcess; SECURITY_QUALITY_OF_SERVICE CsrSecurityQos = { sizeof(SECURITY_QUALITY_OF_SERVICE), @@ -221,12 +221,12 @@ return NT_SUCCESS(Status); } -PCSRSS_PROCESS_DATA +PCSR_PROCESS NTAPI FindProcessForShutdown(IN PLUID CallerLuid) { ULONG Hash; - PCSRSS_PROCESS_DATA CsrProcess, ReturnCsrProcess = NULL; + PCSR_PROCESS CsrProcess, ReturnCsrProcess = NULL; NTSTATUS Status; ULONG Level = 0; LUID ProcessLuid; @@ -243,7 +243,7 @@ if (CsrProcess->Flags & CsrProcessSkipShutdown) goto Next; /* Get the LUID of this Process */ - Status = CsrGetProcessLuid(CsrProcess->Process, &ProcessLuid); + Status = CsrGetProcessLuid(CsrProcess->ProcessHandle, &ProcessLuid); /* Check if we didn't get access to the LUID */ if (Status == STATUS_ACCESS_DENIED) @@ -303,7 +303,7 @@ { PVOID* RealContext = (PVOID*)Context; PLUID CallerLuid = RealContext[0]; - PCSRSS_PROCESS_DATA CsrProcess = NULL; + PCSR_PROCESS CsrProcess = NULL; NTSTATUS Status = STATUS_UNSUCCESSFUL; BOOLEAN FirstTry; ULONG Result = 0; @@ -349,7 +349,7 @@ LoopAgain: /* Release the lock, make the callback, and acquire it back */ - //DPRINT1("Found process: %lx\n", CsrProcess->ProcessId); + //DPRINT1("Found process: %lx\n", CsrProcess->ClientId.UniqueProcess); CsrReleaseProcessLock(); Result = (ULONG)EnumProc(CsrProcess, (PVOID)((ULONG_PTR)Context | FirstTry)); CsrAcquireProcessLock(); @@ -391,10 +391,10 @@ NTSTATUS NTAPI CsrLockProcessByClientId(IN HANDLE Pid, - OUT PCSRSS_PROCESS_DATA *CsrProcess OPTIONAL) + OUT PCSR_PROCESS *CsrProcess OPTIONAL) { ULONG Hash; - PCSRSS_PROCESS_DATA CurrentProcess = NULL; + PCSR_PROCESS CurrentProcess = NULL; NTSTATUS Status = STATUS_UNSUCCESSFUL; /* Acquire the lock */ @@ -408,7 +408,7 @@ while (CurrentProcess) { /* Check for PID match */ - if (CurrentProcess->ProcessId == Pid) + if (CurrentProcess->ClientId.UniqueProcess == Pid) { /* Get out of here with success */ // DPRINT1("Found %p for PID %lx\n", CurrentProcess, Pid); @@ -432,7 +432,7 @@ NTSTATUS NTAPI -CsrUnlockProcess(IN PCSRSS_PROCESS_DATA CsrProcess) +CsrUnlockProcess(IN PCSR_PROCESS CsrProcess) { /* Dereference the process */ //CsrLockedDereferenceProcess(CsrProcess); Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/thredsup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/thredsup.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/thredsup.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -26,9 +26,9 @@ /* GLOBALS ********************************************************************/ LIST_ENTRY CsrThreadHashTable[256]; -extern PCSRSS_PROCESS_DATA CsrRootProcess; +extern PCSR_PROCESS CsrRootProcess; extern RTL_CRITICAL_SECTION ProcessDataLock; -extern PCSRSS_PROCESS_DATA ProcessData[256]; +extern PCSR_PROCESS ProcessData[256]; /* FUNCTIONS ******************************************************************/ @@ -112,7 +112,7 @@ PCSR_THREAD NTAPI -CsrAllocateThread(IN PCSRSS_PROCESS_DATA CsrProcess) +CsrAllocateThread(IN PCSR_PROCESS CsrProcess) { PCSR_THREAD CsrThread; @@ -133,7 +133,7 @@ PCSR_THREAD NTAPI -CsrLocateThreadByClientId(OUT PCSRSS_PROCESS_DATA *Process OPTIONAL, +CsrLocateThreadByClientId(OUT PCSR_PROCESS *Process OPTIONAL, IN PCLIENT_ID ClientId) { ULONG i; @@ -174,7 +174,7 @@ PCSR_THREAD NTAPI -CsrLocateThreadInProcess(IN PCSRSS_PROCESS_DATA CsrProcess OPTIONAL, +CsrLocateThreadInProcess(IN PCSR_PROCESS CsrProcess OPTIONAL, IN PCLIENT_ID Cid) { PLIST_ENTRY ListHead, NextEntry; @@ -208,7 +208,7 @@ VOID NTAPI -CsrInsertThread(IN PCSRSS_PROCESS_DATA Process, +CsrInsertThread(IN PCSR_PROCESS Process, IN PCSR_THREAD Thread) { ULONG i; @@ -295,12 +295,12 @@ NTSTATUS NTAPI -CsrCreateThread(IN PCSRSS_PROCESS_DATA CsrProcess, +CsrCreateThread(IN PCSR_PROCESS CsrProcess, IN HANDLE hThread, IN PCLIENT_ID ClientId) { PCSR_THREAD CsrThread; - //PCSRSS_PROCESS_DATA CurrentProcess; + //PCSR_PROCESS CurrentProcess; //PCSR_THREAD CurrentThread = NtCurrentTeb()->CsrClientThread; //CLIENT_ID CurrentCid; KERNEL_USER_TIMES KernelTimes; Modified: trunk/reactos/subsystems/win32/csrss/include/api.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/inc…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/include/api.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/include/api.h [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -45,31 +45,47 @@ CsrProcessIsConsoleApp = 0x800 } CSR_PROCESS_FLAGS, *PCSR_PROCESS_FLAGS; -typedef struct _CSRSS_PROCESS_DATA +typedef struct _CSRSS_CON_PROCESS_DATA { - struct tagCSRSS_CONSOLE *Console; - struct tagCSRSS_CONSOLE *ParentConsole; - BOOL bInheritHandles; - RTL_CRITICAL_SECTION HandleTableLock; - ULONG HandleTableSize; - struct _CSRSS_HANDLE *HandleTable; - HANDLE ProcessId; - DWORD ProcessGroup; - HANDLE Process; - ULONG ShutdownLevel; - ULONG ShutdownFlags; - HANDLE ConsoleEvent; - PVOID CsrSectionViewBase; - ULONG CsrSectionViewSize; - HANDLE ServerCommunicationPort; - struct _CSRSS_PROCESS_DATA * next; - LIST_ENTRY ProcessEntry; - PCONTROLDISPATCHER CtrlDispatcher; - BOOL Terminated; - ULONG Flags; - ULONG ThreadCount; - LIST_ENTRY ThreadList; -} CSRSS_PROCESS_DATA, *PCSRSS_PROCESS_DATA; + HANDLE ConsoleEvent; + struct tagCSRSS_CONSOLE *Console; + struct tagCSRSS_CONSOLE *ParentConsole; + BOOL bInheritHandles; + RTL_CRITICAL_SECTION HandleTableLock; + ULONG HandleTableSize; + struct _CSRSS_HANDLE *HandleTable; + PCONTROLDISPATCHER CtrlDispatcher; +} CSRSS_CON_PROCESS_DATA, *PCSRSS_CON_PROCESS_DATA; + +typedef struct _CSR_PROCESS +{ + CLIENT_ID ClientId; + LIST_ENTRY ListLink; + LIST_ENTRY ThreadList; + struct _CSR_PROCESS *Parent; +// PCSR_NT_SESSION NtSession; + ULONG ExpectedVersion; + HANDLE ClientPort; + ULONG_PTR ClientViewBase; + ULONG_PTR ClientViewBounds; + HANDLE ProcessHandle; + ULONG SequenceNumber; + ULONG Flags; + ULONG DebugFlags; + CLIENT_ID DebugCid; + ULONG ReferenceCount; + ULONG ProcessGroupId; + ULONG ProcessGroupSequence; + ULONG fVDM; + ULONG ThreadCount; + ULONG PriorityClass; + ULONG Reserved; + ULONG ShutdownLevel; + ULONG ShutdownFlags; +// PVOID ServerData[ANYSIZE_ARRAY]; + struct _CSR_PROCESS* next; + CSRSS_CON_PROCESS_DATA; +} CSR_PROCESS, *PCSR_PROCESS; typedef struct _CSR_THREAD { @@ -77,7 +93,7 @@ LIST_ENTRY Link; LIST_ENTRY HashLinks; CLIENT_ID ClientId; - PCSRSS_PROCESS_DATA Process; + PCSR_PROCESS Process; //struct _CSR_WAIT_BLOCK *WaitBlock; HANDLE ThreadHandle; ULONG Flags; @@ -85,7 +101,7 @@ ULONG ImpersonationCount; } CSR_THREAD, *PCSR_THREAD; -typedef NTSTATUS (WINAPI *CSRSS_API_PROC)(PCSRSS_PROCESS_DATA ProcessData, +typedef NTSTATUS (WINAPI *CSRSS_API_PROC)(PCSR_PROCESS ProcessData, PCSR_API_MESSAGE Request); typedef struct _CSRSS_API_DEFINITION @@ -106,7 +122,7 @@ } CSRSS_LISTEN_DATA, *PCSRSS_LISTEN_DATA; #define CSR_API(n) NTSTATUS WINAPI n (\ -PCSRSS_PROCESS_DATA ProcessData,\ +PCSR_PROCESS ProcessData,\ PCSR_API_MESSAGE Request) /* init.c */ @@ -123,11 +139,11 @@ PCSR_THREAD NTAPI -CsrAllocateThread(IN PCSRSS_PROCESS_DATA CsrProcess); +CsrAllocateThread(IN PCSR_PROCESS CsrProcess); /* api/wapi.c */ NTSTATUS FASTCALL CsrApiRegisterDefinitions(PCSRSS_API_DEFINITION NewDefinitions); -VOID FASTCALL CsrApiCallHandler(PCSRSS_PROCESS_DATA ProcessData, +VOID FASTCALL CsrApiCallHandler(PCSR_PROCESS ProcessData, PCSR_API_MESSAGE Request); VOID WINAPI CsrSbApiRequestThread (PVOID PortHandle); VOID NTAPI ClientConnectionThread(HANDLE ServerPort); @@ -135,19 +151,19 @@ extern HANDLE CsrSbApiPort; /* api/process.c */ -typedef NTSTATUS (WINAPI *CSRSS_ENUM_PROCESS_PROC)(PCSRSS_PROCESS_DATA ProcessData, +typedef NTSTATUS (WINAPI *CSRSS_ENUM_PROCESS_PROC)(PCSR_PROCESS ProcessData, PVOID Context); VOID WINAPI CsrInitProcessData(VOID); -PCSRSS_PROCESS_DATA WINAPI CsrGetProcessData(HANDLE ProcessId); -PCSRSS_PROCESS_DATA WINAPI CsrCreateProcessData(HANDLE ProcessId); +PCSR_PROCESS WINAPI CsrGetProcessData(HANDLE ProcessId); +PCSR_PROCESS WINAPI CsrCreateProcessData(HANDLE ProcessId); NTSTATUS WINAPI CsrFreeProcessData( HANDLE Pid ); NTSTATUS WINAPI CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc, PVOID Context); PCSR_THREAD NTAPI CsrAddStaticServerThread(IN HANDLE hThread, IN PCLIENT_ID ClientId, IN ULONG ThreadFlags); -PCSR_THREAD NTAPI CsrLocateThreadInProcess(IN PCSRSS_PROCESS_DATA CsrProcess OPTIONAL, IN PCLIENT_ID Cid); -PCSR_THREAD NTAPI CsrLocateThreadByClientId(OUT PCSRSS_PROCESS_DATA *Process OPTIONAL, IN PCLIENT_ID ClientId); -NTSTATUS NTAPI CsrLockProcessByClientId(IN HANDLE Pid, OUT PCSRSS_PROCESS_DATA *CsrProcess OPTIONAL); -NTSTATUS NTAPI CsrCreateThread(IN PCSRSS_PROCESS_DATA CsrProcess, IN HANDLE hThread, IN PCLIENT_ID ClientId); -NTSTATUS NTAPI CsrUnlockProcess(IN PCSRSS_PROCESS_DATA CsrProcess); +PCSR_THREAD NTAPI CsrLocateThreadInProcess(IN PCSR_PROCESS CsrProcess OPTIONAL, IN PCLIENT_ID Cid); +PCSR_THREAD NTAPI CsrLocateThreadByClientId(OUT PCSR_PROCESS *Process OPTIONAL, IN PCLIENT_ID ClientId); +NTSTATUS NTAPI CsrLockProcessByClientId(IN HANDLE Pid, OUT PCSR_PROCESS *CsrProcess OPTIONAL); +NTSTATUS NTAPI CsrCreateThread(IN PCSR_PROCESS CsrProcess, IN HANDLE hThread, IN PCLIENT_ID ClientId); +NTSTATUS NTAPI CsrUnlockProcess(IN PCSR_PROCESS CsrProcess); //hack VOID NTAPI CsrThreadRefcountZero(IN PCSR_THREAD CsrThread); Modified: trunk/reactos/subsystems/win32/csrss/include/csrplugin.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/inc…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/include/csrplugin.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/include/csrplugin.h [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -31,13 +31,13 @@ typedef BOOL (WINAPI *CSRPLUGIN_INIT_COMPLETE_PROC)(void); -typedef BOOL (WINAPI *CSRPLUGIN_HARDERROR_PROC)(IN PCSRSS_PROCESS_DATA ProcessData, +typedef BOOL (WINAPI *CSRPLUGIN_HARDERROR_PROC)(IN PCSR_PROCESS ProcessData, IN PHARDERROR_MSG HardErrorMessage); -typedef NTSTATUS (WINAPI *CSRPLUGIN_PROCESS_INHERIT_PROC)(IN PCSRSS_PROCESS_DATA SourceProcessData, - IN PCSRSS_PROCESS_DATA TargetProcessData); +typedef NTSTATUS (WINAPI *CSRPLUGIN_PROCESS_INHERIT_PROC)(IN PCSR_PROCESS SourceProcessData, + IN PCSR_PROCESS TargetProcessData); -typedef NTSTATUS (WINAPI *CSRPLUGIN_PROCESS_DELETED_PROC)(IN PCSRSS_PROCESS_DATA ProcessData); +typedef NTSTATUS (WINAPI *CSRPLUGIN_PROCESS_DELETED_PROC)(IN PCSR_PROCESS ProcessData); typedef struct tagCSRSS_SERVER_PROCS { Modified: trunk/reactos/subsystems/win32/csrss/win32csr/coninput.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/coninput.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/coninput.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -367,13 +367,13 @@ (er.Event.KeyEvent.wVirtualKeyCode == 'C')) && (er.Event.KeyEvent.dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED) || KeyState[VK_CONTROL] & 0x80)) { - PCSRSS_PROCESS_DATA current; + PCSR_PROCESS current; PLIST_ENTRY current_entry; DPRINT1("Console_Api Ctrl-C\n"); current_entry = Console->ProcessList.Flink; while (current_entry != &Console->ProcessList) { - current = CONTAINING_RECORD(current_entry, CSRSS_PROCESS_DATA, ProcessEntry); + current = CONTAINING_RECORD(current_entry, CSR_PROCESS, ListLink); current_entry = current_entry->Flink; ConioConsoleCtrlEvent((DWORD)CTRL_C_EVENT, current); } Modified: trunk/reactos/subsystems/win32/csrss/win32csr/conio.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/conio.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/conio.h [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -141,13 +141,13 @@ #define ConioResizeBuffer(Console, Buff, Size) (Console)->Vtbl->ResizeBuffer(Console, Buff, Size) /* console.c */ -NTSTATUS FASTCALL ConioConsoleFromProcessData(PCSRSS_PROCESS_DATA ProcessData, PCSRSS_CONSOLE *Console); +NTSTATUS FASTCALL ConioConsoleFromProcessData(PCSR_PROCESS ProcessData, PCSRSS_CONSOLE *Console); VOID WINAPI ConioDeleteConsole(Object_t *Object); VOID WINAPI CsrInitConsoleSupport(VOID); VOID FASTCALL ConioPause(PCSRSS_CONSOLE Console, UINT Flags); VOID FASTCALL ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags); -VOID FASTCALL ConioConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData); -VOID FASTCALL ConioConsoleCtrlEventTimeout(DWORD Event, PCSRSS_PROCESS_DATA ProcessData, +VOID FASTCALL ConioConsoleCtrlEvent(DWORD Event, PCSR_PROCESS ProcessData); +VOID FASTCALL ConioConsoleCtrlEventTimeout(DWORD Event, PCSR_PROCESS ProcessData, DWORD Timeout); CSR_API(CsrAllocConsole); CSR_API(CsrFreeConsole); Modified: trunk/reactos/subsystems/win32/csrss/win32csr/conoutput.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/conoutput.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/conoutput.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -389,7 +389,7 @@ if (Console->UnpauseEvent) { Status = NtDuplicateObject(GetCurrentProcess(), Console->UnpauseEvent, - ProcessData->Process, &Request->Data.WriteConsoleRequest.UnpauseEvent, + ProcessData->ProcessHandle, &Request->Data.WriteConsoleRequest.UnpauseEvent, SYNCHRONIZE, 0, 0); ConioUnlockScreenBuffer(Buff); return NT_SUCCESS(Status) ? STATUS_PENDING : Status; Modified: trunk/reactos/subsystems/win32/csrss/win32csr/console.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/console.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/console.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -15,7 +15,7 @@ /* FUNCTIONS *****************************************************************/ NTSTATUS FASTCALL -ConioConsoleFromProcessData(PCSRSS_PROCESS_DATA ProcessData, PCSRSS_CONSOLE *Console) +ConioConsoleFromProcessData(PCSR_PROCESS ProcessData, PCSRSS_CONSOLE *Console) { PCSRSS_CONSOLE ProcessConsole; @@ -38,16 +38,16 @@ } VOID FASTCALL -ConioConsoleCtrlEventTimeout(DWORD Event, PCSRSS_PROCESS_DATA ProcessData, DWORD Timeout) +ConioConsoleCtrlEventTimeout(DWORD Event, PCSR_PROCESS ProcessData, DWORD Timeout) { HANDLE Thread; - DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->ProcessId); + DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->ClientId.UniqueProcess); if (ProcessData->CtrlDispatcher) { - Thread = CreateRemoteThread(ProcessData->Process, NULL, 0, + Thread = CreateRemoteThread(ProcessData->ProcessHandle, NULL, 0, (LPTHREAD_START_ROUTINE) ProcessData->CtrlDispatcher, UlongToPtr(Event), 0, NULL); if (NULL == Thread) @@ -61,7 +61,7 @@ } VOID FASTCALL -ConioConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData) +ConioConsoleCtrlEvent(DWORD Event, PCSR_PROCESS ProcessData) { ConioConsoleCtrlEventTimeout(Event, ProcessData, 0); } @@ -215,7 +215,7 @@ /* initialize list head */ InitializeListHead(&Console->ProcessList); /* insert process data required for GUI initialization */ - InsertHeadList(&Console->ProcessList, &ProcessData->ProcessEntry); + InsertHeadList(&Console->ProcessList, &ProcessData->ListLink); /* Initialize the Console */ Status = CsrInitConsole(Console, Request->Data.AllocConsoleRequest.ShowCmd); if (!NT_SUCCESS(Status)) @@ -280,7 +280,7 @@ /* Duplicate the Event */ if (!DuplicateHandle(GetCurrentProcess(), ProcessData->Console->ActiveEvent, - ProcessData->Process, + ProcessData->ProcessHandle, &ProcessData->ConsoleEvent, EVENT_ALL_ACCESS, FALSE, @@ -307,7 +307,7 @@ if (!NewConsole) { /* Insert into the list if it has not been added */ - InsertHeadList(&ProcessData->Console->ProcessList, &ProcessData->ProcessEntry); + InsertHeadList(&ProcessData->Console->ProcessList, &ProcessData->ListLink); } RtlLeaveCriticalSection(&ProcessData->HandleTableLock); @@ -762,7 +762,7 @@ { PDWORD Buffer; PCSRSS_CONSOLE Console; - PCSRSS_PROCESS_DATA current; + PCSR_PROCESS current; PLIST_ENTRY current_entry; ULONG nItems = 0; NTSTATUS Status; @@ -786,10 +786,10 @@ current_entry != &Console->ProcessList; current_entry = current_entry->Flink) { - current = CONTAINING_RECORD(current_entry, CSRSS_PROCESS_DATA, ProcessEntry); + current = CONTAINING_RECORD(current_entry, CSR_PROCESS, ListLink); if (++nItems <= Request->Data.GetProcessListRequest.nMaxIds) { - *Buffer++ = HandleToUlong(current->ProcessId); + *Buffer++ = HandleToUlong(current->ClientId.UniqueProcess); } } @@ -802,7 +802,7 @@ CSR_API(CsrGenerateCtrlEvent) { PCSRSS_CONSOLE Console; - PCSRSS_PROCESS_DATA current; + PCSR_PROCESS current; PLIST_ENTRY current_entry; DWORD Group; NTSTATUS Status; @@ -822,8 +822,8 @@ current_entry != &Console->ProcessList; current_entry = current_entry->Flink) { - current = CONTAINING_RECORD(current_entry, CSRSS_PROCESS_DATA, ProcessEntry); - if (Group == 0 || current->ProcessGroup == Group) + current = CONTAINING_RECORD(current_entry, CSR_PROCESS, ListLink); + if (Group == 0 || current->ProcessGroupId == Group) { ConioConsoleCtrlEvent(Request->Data.GenerateCtrlEvent.Event, current); Status = STATUS_SUCCESS; Modified: trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -278,7 +278,7 @@ /* Ensure that a captured buffer is safe to access */ BOOL FASTCALL -Win32CsrValidateBuffer(PCSRSS_PROCESS_DATA ProcessData, PVOID Buffer, +Win32CsrValidateBuffer(PCSR_PROCESS ProcessData, PVOID Buffer, SIZE_T NumElements, SIZE_T ElementSize) { /* Check that the following conditions are true: @@ -289,14 +289,14 @@ * instead of division; remember that 2147483648 * 2 = 0.) * 3. The buffer is DWORD-aligned. */ - ULONG_PTR Offset = (BYTE *)Buffer - (BYTE *)ProcessData->CsrSectionViewBase; - if (Offset >= ProcessData->CsrSectionViewSize - || NumElements > (ProcessData->CsrSectionViewSize - Offset) / ElementSize + ULONG_PTR Offset = (BYTE *)Buffer - (BYTE *)ProcessData->ClientViewBase; + if (Offset >= ProcessData->ClientViewBounds + || NumElements > (ProcessData->ClientViewBounds - Offset) / ElementSize || (Offset & (sizeof(DWORD) - 1)) != 0) { DPRINT1("Invalid buffer %p(%u*%u); section view is %p(%u)\n", Buffer, NumElements, ElementSize, - ProcessData->CsrSectionViewBase, ProcessData->CsrSectionViewSize); + ProcessData->ClientViewBase, ProcessData->ClientViewBounds); return FALSE; } return TRUE; Modified: trunk/reactos/subsystems/win32/csrss/win32csr/exitros.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/exitros.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/exitros.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -462,7 +462,7 @@ } static BOOL FASTCALL -NotifyAndTerminateProcess(PCSRSS_PROCESS_DATA ProcessData, +NotifyAndTerminateProcess(PCSR_PROCESS ProcessData, PSHUTDOWN_SETTINGS ShutdownSettings, UINT Flags) { @@ -481,7 +481,7 @@ } else { - Context.ProcessId = (DWORD_PTR) ProcessData->ProcessId; + Context.ProcessId = (DWORD_PTR) ProcessData->ClientId.UniqueProcess; Context.wParam = 0; Context.lParam = (0 != (Flags & EWX_INTERNAL_FLAG_LOGOFF) ? ENDSESSION_LOGOFF : 0); @@ -527,10 +527,10 @@ /* Terminate this process */ Process = OpenProcess(PROCESS_TERMINATE, FALSE, - (DWORD_PTR) ProcessData->ProcessId); + (DWORD_PTR) ProcessData->ClientId.UniqueProcess); if (NULL == Process) { - DPRINT1("Unable to open process %d, error %d\n", ProcessData->ProcessId, + DPRINT1("Unable to open process %d, error %d\n", ProcessData->ClientId.UniqueProcess, GetLastError()); return TRUE; } @@ -543,35 +543,35 @@ typedef struct tagPROCESS_ENUM_CONTEXT { UINT ProcessCount; - PCSRSS_PROCESS_DATA *ProcessData; + PCSR_PROCESS *ProcessData; TOKEN_ORIGIN TokenOrigin; DWORD ShellProcess; DWORD CsrssProcess; } PROCESS_ENUM_CONTEXT, *PPROCESS_ENUM_CONTEXT; static NTSTATUS WINAPI -ExitReactosProcessEnum(PCSRSS_PROCESS_DATA ProcessData, PVOID Data) +ExitReactosProcessEnum(PCSR_PROCESS ProcessData, PVOID Data) { HANDLE Process; HANDLE Token; TOKEN_ORIGIN Origin; DWORD ReturnLength; PPROCESS_ENUM_CONTEXT Context = (PPROCESS_ENUM_CONTEXT) Data; - PCSRSS_PROCESS_DATA *NewData; + PCSR_PROCESS *NewData; /* Do not kill winlogon or csrss */ - if ((DWORD_PTR) ProcessData->ProcessId == Context->CsrssProcess || - ProcessData->ProcessId == LogonProcess) + if ((DWORD_PTR) ProcessData->ClientId.UniqueProcess == Context->CsrssProcess || + ProcessData->ClientId.UniqueProcess == LogonProcess) { return STATUS_SUCCESS; } /* Get the login session of this process */ Process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, - (DWORD_PTR) ProcessData->ProcessId); + (DWORD_PTR) ProcessData->ClientId.UniqueProcess); if (NULL == Process) { - DPRINT1("Unable to open process %d, error %d\n", ProcessData->ProcessId, + DPRINT1("Unable to open process %d, error %d\n", ProcessData->ClientId.UniqueProcess, GetLastError()); return STATUS_UNSUCCESSFUL; } @@ -579,7 +579,7 @@ if (! OpenProcessToken(Process, TOKEN_QUERY, &Token)) { DPRINT1("Unable to open token for process %d, error %d\n", - ProcessData->ProcessId, GetLastError()); + ProcessData->ClientId.UniqueProcess, GetLastError()); CloseHandle(Process); return STATUS_UNSUCCESSFUL; } @@ -589,7 +589,7 @@ sizeof(TOKEN_ORIGIN), &ReturnLength)) { DPRINT1("GetTokenInformation failed for process %d with error %d\n", - ProcessData->ProcessId, GetLastError()); + ProcessData->ClientId.UniqueProcess, GetLastError()); CloseHandle(Token); return STATUS_UNSUCCESSFUL; } @@ -600,12 +600,12 @@ &(Origin.OriginatingLogonSession))) { /* Kill the shell process last */ - if ((DWORD_PTR) ProcessData->ProcessId == Context->ShellProcess) + if ((DWORD_PTR) ProcessData->ClientId.UniqueProcess == Context->ShellProcess) { ProcessData->ShutdownLevel = 0; } NewData = HeapAlloc(Win32CsrApiHeap, 0, (Context->ProcessCount + 1) - * sizeof(PCSRSS_PROCESS_DATA)); + * sizeof(PCSR_PROCESS)); if (NULL == NewData) { return STATUS_NO_MEMORY; @@ -613,7 +613,7 @@ if (0 != Context->ProcessCount) { memcpy(NewData, Context->ProcessData, - Context->ProcessCount * sizeof(PCSRSS_PROCESS_DATA)); + Context->ProcessCount * sizeof(PCSR_PROCESS)); HeapFree(Win32CsrApiHeap, 0, Context->ProcessData); } Context->ProcessData = NewData; @@ -627,8 +627,8 @@ static int ProcessDataCompare(const void *Elem1, const void *Elem2) { - const PCSRSS_PROCESS_DATA *ProcessData1 = (PCSRSS_PROCESS_DATA *) Elem1; - const PCSRSS_PROCESS_DATA *ProcessData2 = (PCSRSS_PROCESS_DATA *) Elem2; + const PCSR_PROCESS *ProcessData1 = (PCSR_PROCESS *) Elem1; + const PCSR_PROCESS *ProcessData2 = (PCSR_PROCESS *) Elem2; if ((*ProcessData1)->ShutdownLevel < (*ProcessData2)->ShutdownLevel) { @@ -638,11 +638,11 @@ { return -1; } - else if ((*ProcessData1)->ProcessId < (*ProcessData2)->ProcessId) + else if ((*ProcessData1)->ClientId.UniqueProcess < (*ProcessData2)->ClientId.UniqueProcess) { return +1; } - else if ((*ProcessData2)->ProcessId < (*ProcessData1)->ProcessId) + else if ((*ProcessData2)->ClientId.UniqueProcess < (*ProcessData1)->ClientId.UniqueProcess) { return -1; } @@ -864,7 +864,7 @@ return Status; } - qsort(Context.ProcessData, Context.ProcessCount, sizeof(PCSRSS_PROCESS_DATA), + qsort(Context.ProcessData, Context.ProcessCount, sizeof(PCSR_PROCESS), ProcessDataCompare); /* Terminate processes, stop if we find one kicking and screaming it doesn't Modified: trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -393,15 +393,15 @@ GuiConsoleWriteUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData) { HKEY hKey; - PCSRSS_PROCESS_DATA ProcessData; + PCSR_PROCESS ProcessData; if (Console->ProcessList.Flink == &Console->ProcessList) { DPRINT("GuiConsoleWriteUserSettings: No Process!!!\n"); return; } - ProcessData = CONTAINING_RECORD(Console->ProcessList.Flink, CSRSS_PROCESS_DATA, ProcessEntry); - if (!GuiConsoleOpenUserSettings(GuiData, PtrToUlong(ProcessData->ProcessId), &hKey, KEY_READ | KEY_WRITE, TRUE)) + ProcessData = CONTAINING_RECORD(Console->ProcessList.Flink, CSR_PROCESS, ListLink); + if (!GuiConsoleOpenUserSettings(GuiData, PtrToUlong(ProcessData->ClientId.UniqueProcess), &hKey, KEY_READ | KEY_WRITE, TRUE)) { return; } @@ -690,7 +690,7 @@ HFONT OldFont; TEXTMETRICW Metrics; SIZE CharSize; - PCSRSS_PROCESS_DATA ProcessData; + PCSR_PROCESS ProcessData; HKEY hKey; Console->hWindow = hWnd; @@ -704,8 +704,8 @@ GuiConsoleUseDefaults(Console, GuiData, Console->ActiveBuffer); if (Console->ProcessList.Flink != &Console->ProcessList) { - ProcessData = CONTAINING_RECORD(Console->ProcessList.Flink, CSRSS_PROCESS_DATA, ProcessEntry); - if (GuiConsoleOpenUserSettings(GuiData, PtrToUlong(ProcessData->ProcessId), &hKey, KEY_READ, FALSE)) + ProcessData = CONTAINING_RECORD(Console->ProcessList.Flink, CSR_PROCESS, ListLink); + if (GuiConsoleOpenUserSettings(GuiData, PtrToUlong(ProcessData->ClientId.UniqueProcess), &hKey, KEY_READ, FALSE)) { GuiConsoleReadUserSettings(hKey, Console, GuiData, Console->ActiveBuffer); RegCloseKey(hKey); @@ -1263,7 +1263,7 @@ PCSRSS_CONSOLE Console; PGUI_CONSOLE_DATA GuiData; PLIST_ENTRY current_entry; - PCSRSS_PROCESS_DATA current; + PCSR_PROCESS current; GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); @@ -1272,7 +1272,7 @@ current_entry = Console->ProcessList.Flink; while (current_entry != &Console->ProcessList) { - current = CONTAINING_RECORD(current_entry, CSRSS_PROCESS_DATA, ProcessEntry); + current = CONTAINING_RECORD(current_entry, CSR_PROCESS, ListLink); current_entry = current_entry->Flink; /* FIXME: Windows will wait up to 5 seconds for the thread to exit. Modified: trunk/reactos/subsystems/win32/csrss/win32csr/handle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/handle.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/handle.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -73,7 +73,7 @@ NTSTATUS FASTCALL Win32CsrReleaseObject( - PCSRSS_PROCESS_DATA ProcessData, + PCSR_PROCESS ProcessData, HANDLE Handle) { ULONG_PTR h = (ULONG_PTR)Handle >> 2; @@ -93,7 +93,7 @@ NTSTATUS FASTCALL -Win32CsrLockObject(PCSRSS_PROCESS_DATA ProcessData, +Win32CsrLockObject(PCSR_PROCESS ProcessData, HANDLE Handle, Object_t **Object, DWORD Access, @@ -135,7 +135,7 @@ NTSTATUS WINAPI Win32CsrReleaseConsole( - PCSRSS_PROCESS_DATA ProcessData) + PCSR_PROCESS ProcessData) { PCSRSS_CONSOLE Console; ULONG i; @@ -154,7 +154,7 @@ { ProcessData->Console = NULL; EnterCriticalSection(&Console->Lock); - RemoveEntryList(&ProcessData->ProcessEntry); + RemoveEntryList(&ProcessData->ListLink); LeaveCriticalSection(&Console->Lock); if (_InterlockedDecrement(&Console->ReferenceCount) == 0) ConioDeleteConsole(&Console->Header); @@ -170,7 +170,7 @@ NTSTATUS FASTCALL Win32CsrInsertObject( - PCSRSS_PROCESS_DATA ProcessData, + PCSR_PROCESS ProcessData, PHANDLE Handle, Object_t *Object, DWORD Access, @@ -219,8 +219,8 @@ NTSTATUS WINAPI Win32CsrDuplicateHandleTable( - PCSRSS_PROCESS_DATA SourceProcessData, - PCSRSS_PROCESS_DATA TargetProcessData) + PCSR_PROCESS SourceProcessData, + PCSR_PROCESS TargetProcessData) { ULONG i; Modified: trunk/reactos/subsystems/win32/csrss/win32csr/harderror.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/harderror.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/harderror.c [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -503,7 +503,7 @@ BOOL WINAPI Win32CsrHardError( - IN PCSRSS_PROCESS_DATA ProcessData, + IN PCSR_PROCESS ProcessData, IN PHARDERROR_MSG Message) { ULONG_PTR Parameters[MAXIMUM_HARDERROR_PARAMETERS]; Modified: trunk/reactos/subsystems/win32/csrss/win32csr/w32csr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/w32csr.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/w32csr.h [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -26,7 +26,7 @@ BOOL WINAPI Win32CsrHardError( - IN PCSRSS_PROCESS_DATA ProcessData, + IN PCSR_PROCESS ProcessData, IN PHARDERROR_MSG Message); /* EOF */ Modified: trunk/reactos/subsystems/win32/csrss/win32csr/win32csr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/win32csr.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/win32csr.h [iso-8859-1] Wed Feb 15 20:29:08 2012 @@ -40,30 +40,30 @@ } CSRSS_OBJECT_DEFINITION, *PCSRSS_OBJECT_DEFINITION; /* handle.c */ -NTSTATUS FASTCALL Win32CsrInsertObject(PCSRSS_PROCESS_DATA ProcessData, +NTSTATUS FASTCALL Win32CsrInsertObject(PCSR_PROCESS ProcessData, PHANDLE Handle, Object_t *Object, DWORD Access, BOOL Inheritable, DWORD ShareMode); -NTSTATUS FASTCALL Win32CsrLockObject(PCSRSS_PROCESS_DATA ProcessData, +NTSTATUS FASTCALL Win32CsrLockObject(PCSR_PROCESS ProcessData, HANDLE Handle, Object_t **Object, DWORD Access, long Type); VOID FASTCALL Win32CsrUnlockObject(Object_t *Object); -NTSTATUS FASTCALL Win32CsrReleaseObject(PCSRSS_PROCESS_DATA ProcessData, +NTSTATUS FASTCALL Win32CsrReleaseObject(PCSR_PROCESS ProcessData, HANDLE Object); -NTSTATUS WINAPI Win32CsrReleaseConsole(PCSRSS_PROCESS_DATA ProcessData); -NTSTATUS WINAPI Win32CsrDuplicateHandleTable(PCSRSS_PROCESS_DATA SourceProcessData, - PCSRSS_PROCESS_DATA TargetProcessData); +NTSTATUS WINAPI Win32CsrReleaseConsole(PCSR_PROCESS ProcessData); +NTSTATUS WINAPI Win32CsrDuplicateHandleTable(PCSR_PROCESS SourceProcessData, + PCSR_PROCESS TargetProcessData); CSR_API(CsrGetHandle); CSR_API(CsrCloseHandle); CSR_API(CsrVerifyHandle); CSR_API(CsrDuplicateHandle); CSR_API(CsrGetInputWaitHandle); -BOOL FASTCALL Win32CsrValidateBuffer(PCSRSS_PROCESS_DATA ProcessData, +BOOL FASTCALL Win32CsrValidateBuffer(PCSR_PROCESS ProcessData, PVOID Buffer, SIZE_T NumElements, SIZE_T ElementSize);
12 years, 10 months
1
0
0
0
[rharabien] 55616: - Fix MSVC build
by rharabien@svn.reactos.org
Author: rharabien Date: Wed Feb 15 20:25:35 2012 New Revision: 55616 URL:
http://svn.reactos.org/svn/reactos?rev=55616&view=rev
Log: - Fix MSVC build Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Cn.rc trunk/reactos/dll/win32/comdlg32/cdlg_Cs.rc trunk/reactos/dll/win32/comdlg32/cdlg_Da.rc trunk/reactos/dll/win32/comdlg32/cdlg_Eo.rc trunk/reactos/dll/win32/comdlg32/cdlg_Hu.rc trunk/reactos/dll/win32/comdlg32/cdlg_No.rc trunk/reactos/dll/win32/comdlg32/cdlg_Pt.rc trunk/reactos/dll/win32/comdlg32/cdlg_Ro.rc trunk/reactos/dll/win32/comdlg32/cdlg_Sr.rc trunk/reactos/dll/win32/comdlg32/cdlg_Zh.rc Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Cn.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Cn…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Cn.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Cn.rc [iso-8859-1] Wed Feb 15 20:25:35 2012 @@ -64,10 +64,7 @@ PD32_PRINT_ERROR "å°è¡¨æ©é¯èª¤ã" PD32_NO_DEFAULT_PRINTER "æ²æé»èªå°è¡¨æ©ã" PD32_CANT_FIND_PRINTER "æ¾ä¸å°å°è¡¨æ©ã" - PD32_OUT_OF_MEMORY "#-#-#-#-# zh_TW.po (Wine) #-#-#-#-#\n\ -å §å溢åºã\n\ -#-#-#-#-# zh_TW.po (Wine) #-#-#-#-#\n\ -å §åä¸å¤ ã" + PD32_OUT_OF_MEMORY "å §åä¸å¤ ã" PD32_GENERIC_ERROR "åºç¾ä¸äºé¯èª¤ã" PD32_DRIVER_UNKNOWN "æ¾ä¸å°å°è¡¨æ©é© åå¨ã" PD32_NO_DEVICES "å¨ä½¿ç¨èå°è¡¨æ©æéåè½(çé¢è¨å®, åå°æªæ¡)ä¹å, ä½ å¿ é å è£å°è¡¨æ©ãè«è£ä¸åå°è¡¨æ©å試ã" Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Cs.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Cs…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Cs.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Cs.rc [iso-8859-1] Wed Feb 15 20:25:35 2012 @@ -64,10 +64,7 @@ PD32_PRINT_ERROR "Nastala chyba tisku." PD32_NO_DEFAULT_PRINTER "Výchozà tiskárna neexistuje." PD32_CANT_FIND_PRINTER "Nemohu najÃt tiskárnu." - PD32_OUT_OF_MEMORY "#-#-#-#-# cs.po (Wine) #-#-#-#-#\n\ -DoÅ¡la pamÄÅ¥.\n\ -#-#-#-#-# cs.po (Wine) #-#-#-#-#\n\ -Dostupná pamÄÅ¥ byla vyÄerpána." + PD32_OUT_OF_MEMORY "Dostupná pamÄÅ¥ byla vyÄerpána." PD32_GENERIC_ERROR "Vyskytla se chyba." PD32_DRIVER_UNKNOWN "Neznámý ovladaÄ tiskárny." PD32_NO_DEVICES "" Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Da.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Da…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Da.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Da.rc [iso-8859-1] Wed Feb 15 20:25:35 2012 @@ -64,10 +64,7 @@ PD32_PRINT_ERROR "Der opstod en printer fejl." PD32_NO_DEFAULT_PRINTER "Ingen standard printer defineret." PD32_CANT_FIND_PRINTER "Kan ikke finde printeren." - PD32_OUT_OF_MEMORY "#-#-#-#-# da.po (Wine) #-#-#-#-#\n\ -Ikke nok hukommelse.\n\ -#-#-#-#-# da.po (Wine) #-#-#-#-#\n\ -Ikke mere hukommelse." + PD32_OUT_OF_MEMORY "Ikke mere hukommelse." PD32_GENERIC_ERROR "Der opstod en fejl." PD32_DRIVER_UNKNOWN "Ukendt printer driver." PD32_NO_DEVICES "Før du kan udføre printer-relaterede opgaver, som f.eks sideopsætning eller udskrivning af dokumenter, skal du installere en printer. Installer venligst en og prøv igen." Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Eo.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Eo…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Eo.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Eo.rc [iso-8859-1] Wed Feb 15 20:25:35 2012 @@ -477,10 +477,7 @@ CAPTION "Malfermu" FONT 8, "MS Shell Dlg" { - LTEXT "#-#-#-#-# eo.po (Wine) #-#-#-#-#\n\ -Dosiero\n\ -#-#-#-#-# eo.po (Wine) #-#-#-#-#\n\ -&Dosiero", IDC_FILENAMESTATIC, 160, 240, 60, 9, SS_RIGHT + LTEXT "&Dosiero", IDC_FILENAMESTATIC, 160, 240, 60, 9, SS_RIGHT EDITTEXT IDC_FILENAME, 226, 240, 100, 12, WS_CHILD | WS_VISIBLE | WS_TABSTOP LTEXT "Dosier&speco:", IDC_FILETYPESTATIC, 160, 256, 60, 9, SS_RIGHT Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Hu.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Hu…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Hu.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Hu.rc [iso-8859-1] Wed Feb 15 20:25:35 2012 @@ -64,10 +64,7 @@ PD32_PRINT_ERROR "Nyomtatási hiba történt." PD32_NO_DEFAULT_PRINTER "Nincs alapértelmezett nyomtató megadva." PD32_CANT_FIND_PRINTER "Nem találom a nyomtatót." - PD32_OUT_OF_MEMORY "#-#-#-#-# hu.po (Wine) #-#-#-#-#\n\ -RendkÃvül kevés a memória\n\ -#-#-#-#-# hu.po (Wine) #-#-#-#-#\n\ -Elfogyott a memória." + PD32_OUT_OF_MEMORY "Elfogyott a memória." PD32_GENERIC_ERROR "Hiba történt." PD32_DRIVER_UNKNOWN "Ismeretlen nyomtató eszközmeghajtó." PD32_NO_DEVICES "mielõtt nyomtatási feladatokat hajtana végre mint például oldalbeállÃtás vagy dokumentum nyomtatása, Ãnnek telepÃtenie kell egy nyomtatót. Please install one and retry." Modified: trunk/reactos/dll/win32/comdlg32/cdlg_No.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_No…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_No.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_No.rc [iso-8859-1] Wed Feb 15 20:25:35 2012 @@ -64,10 +64,7 @@ PD32_PRINT_ERROR "En skriverfeil har oppstått." PD32_NO_DEFAULT_PRINTER "Ingen standardskriver er definert." PD32_CANT_FIND_PRINTER "Kunne ikke finne skriveren." - PD32_OUT_OF_MEMORY "#-#-#-#-# nb_NO.po (Wine) #-#-#-#-#\n\ -Ikke nok minne.\n\ -#-#-#-#-# nb_NO.po (Wine) #-#-#-#-#\n\ -Ikke mer minne." + PD32_OUT_OF_MEMORY "Ikke mer minne." PD32_GENERIC_ERROR "En feil har oppstått." PD32_DRIVER_UNKNOWN "Ukjent skriverdriver." PD32_NO_DEVICES "Du må installere en skriver før du kan gjøre skriver-relaterte oppgaver som å endre sideoppsettet og skrive ut et dokument. Installer en og prøv på nytt." @@ -122,10 +119,7 @@ IDS_COLOR_OLIVE "Oliven" IDS_COLOR_NAVY "Marineblå" IDS_COLOR_PURPLE "Purpur" - IDS_COLOR_TEAL "#-#-#-#-# nb_NO.po (Wine) #-#-#-#-#\n\ -Blågrønn\n\ -#-#-#-#-# nb_NO.po (Wine) #-#-#-#-#\n\ -Teal" + IDS_COLOR_TEAL "Teal" IDS_COLOR_GRAY "Grå" IDS_COLOR_SILVER "Sølv" IDS_COLOR_RED "Rød" @@ -133,10 +127,7 @@ IDS_COLOR_YELLOW "Gul" IDS_COLOR_BLUE "Blå" IDS_COLOR_FUCHSIA "Fuchsia" - IDS_COLOR_AQUA "#-#-#-#-# nb_NO.po (Wine) #-#-#-#-#\n\ -Turkis\n\ -#-#-#-#-# nb_NO.po (Wine) #-#-#-#-#\n\ -Aqua" + IDS_COLOR_AQUA "Aqua" IDS_COLOR_WHITE "Hvit" } Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Pt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Pt…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Pt.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Pt.rc [iso-8859-1] Wed Feb 15 20:25:35 2012 @@ -64,10 +64,7 @@ PD32_PRINT_ERROR "Ocorreu um erro de impressão." PD32_NO_DEFAULT_PRINTER "Não existe uma impressora predefinida." PD32_CANT_FIND_PRINTER "Não é possÃvel encontrar uma impressora." - PD32_OUT_OF_MEMORY "#-#-#-#-# pt_PT.po (Wine) #-#-#-#-#\n\ -Sem memória.\n\ -#-#-#-#-# pt_PT.po (Wine) #-#-#-#-#\n\ -Memória insuficiente." + PD32_OUT_OF_MEMORY "Memória insuficiente." PD32_GENERIC_ERROR "Ocorreu algum erro." PD32_DRIVER_UNKNOWN "Controlador de impressora desconhecido." PD32_NO_DEVICES "Antes de realizar tarefas relacionadas com a impressora tais como configuração de páginas ou imprimir um documento, precisa instalar uma impressora. Por favor instale uma e tente novamente." Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Ro.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Ro…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Ro.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Ro.rc [iso-8859-1] Wed Feb 15 20:25:35 2012 @@ -75,10 +75,7 @@ PD32_MARGINS_IN_MILLIMETERS "Margini [mm]" PD32_MILLIMETERS "mm" - PD32_PRINTER_STATUS_READY "#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -PregÄtit\n\ -#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Gata" + PD32_PRINTER_STATUS_READY "Gata" PD32_PRINTER_STATUS_PAUSED "PauzÄ; " PD32_PRINTER_STATUS_ERROR "Eroare; " PD32_PRINTER_STATUS_PENDING_DELETION "AÈtept stergerea; " @@ -119,39 +116,18 @@ IDS_COLOR_BLACK "Negru" IDS_COLOR_MAROON "Maro" IDS_COLOR_GREEN "Verde" - IDS_COLOR_OLIVE "#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Oliv\n\ -#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Oliviu" - IDS_COLOR_NAVY "#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Bleumarin\n\ -#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Ultramarin" + IDS_COLOR_OLIVE "Oliviu" + IDS_COLOR_NAVY "Ultramarin" IDS_COLOR_PURPLE "Violet" - IDS_COLOR_TEAL "#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Verde-albÄstrui\n\ -#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Verde-albastru" - IDS_COLOR_GRAY "#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Gri\n\ -#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Griu" + IDS_COLOR_TEAL "Verde-albastru" + IDS_COLOR_GRAY "Griu" IDS_COLOR_SILVER "Argintiu" IDS_COLOR_RED "RoÈu" - IDS_COLOR_LIME "#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -LÄmâie verde\n\ -#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Verde deschis" + IDS_COLOR_LIME "Verde deschis" IDS_COLOR_YELLOW "Galben" IDS_COLOR_BLUE "Albastru" - IDS_COLOR_FUCHSIA "#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Fuchsia\n\ -#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Roz" - IDS_COLOR_AQUA "#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Culoarea apei\n\ -#-#-#-#-# ro.po (Wine) #-#-#-#-#\n\ -Azur" + IDS_COLOR_FUCHSIA "Roz" + IDS_COLOR_AQUA "Azur" IDS_COLOR_WHITE "Alb" } Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Sr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Sr…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Sr.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Sr.rc [iso-8859-1] Wed Feb 15 20:25:35 2012 @@ -50,10 +50,7 @@ STRINGTABLE { - PD32_PRINT_TITLE "#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampaj\n\ -#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampanje" + PD32_PRINT_TITLE "Å tampanje" PD32_VALUE_UREADABLE "Unos je neÄitljiv" PD32_INVALID_PAGE_RANGE "Ova vrednost ne leži na opsegu strane.\n\ @@ -194,25 +191,16 @@ PRINT DIALOG 36, 24, 264, 134 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampaj\n\ -#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampanje" -FONT 8, "MS Shell Dlg" -{ - LTEXT "#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampaj\n\ -#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampanje", stc1, 6, 6, 40, 9 +CAPTION "Å tampanje" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Å tampanje", stc1, 6, 6, 40, 9 LTEXT "", stc2, 60, 6, 150, 9 GROUPBOX "&Å tampaj objekat", grp1, 6, 30, 160, 65, BS_GROUPBOX RADIOBUTTON "", rad1, 16, 45, 60, 12 RADIOBUTTON "Odabir teksta", rad2, 16, 60, 60, 12 RADIOBUTTON "Nagore", rad3, 16, 75, 60, 12 - DEFPUSHBUTTON "#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampaj\n\ -#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampanje", IDOK, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP + DEFPUSHBUTTON "Å tampanje", IDOK, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP PUSHBUTTON "Otkaži", IDCANCEL, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "Postavke strane", psh1, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP LTEXT "", stc3, 60, 80, 30, 9 @@ -229,10 +217,7 @@ CAPTION "Postavke &Å¡tampe..." FONT 8, "MS Shell Dlg" { - GROUPBOX "#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampaj\n\ -#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampanje", grp1, 6, 6, 180, 72, BS_GROUPBOX + GROUPBOX "Å tampanje", grp1, 6, 6, 180, 72, BS_GROUPBOX RADIOBUTTON "Podrazumevani Å¡tampaÄ; ", rad1, 16, 16, 150, 12 LTEXT "", stc1, 35, 30, 120, 9 RADIOBUTTON "", rad2, 16, 44, 150, 12 @@ -361,20 +346,14 @@ PRINT32 DIALOG 32, 32, 288, 186 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_CONTEXTHELP | DS_3DLOOK -CAPTION "#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampaj\n\ -#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampanje" +CAPTION "Å tampanje" FONT 8, "MS Shell Dlg" { DEFPUSHBUTTON "U redu", IDOK, 176,164, 50,14, WS_GROUP | BS_DEFPUSHBUTTON PUSHBUTTON "Otkaži", IDCANCEL, 230,164, 50,14, WS_GROUP PUSHBUTTON "&PomoÄ", pshHelp, 50, 161, 50,14, WS_GROUP - GROUPBOX "#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampaj\n\ -#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampanje", grp4, 8, 4, 272,84, WS_GROUP + GROUPBOX "Å tampanje", grp4, 8, 4, 272,84, WS_GROUP CONTROL "Å tampanje na datoteku", chx1, "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,185,36,90,16 PUSHBUTTON "&Svojstva", psh2, 212, 17, 60,14, WS_GROUP LTEXT "&Naziv:", stc6, 16, 20, 36,8 @@ -397,10 +376,7 @@ GROUPBOX "&Å tampaj objekat", grp1, 8,92, 144,64, WS_GROUP CONTROL "", rad1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,16,106,64,12 CONTROL "", rad3,"Button",BS_AUTORADIOBUTTON,16,122,36,12 - CONTROL "#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -&Izbor\n\ -#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -&Izaberi", rad2,"Button",BS_AUTORADIOBUTTON,16,138,64,12 + CONTROL "&Izaberi", rad2,"Button",BS_AUTORADIOBUTTON,16,138,64,12 EDITTEXT edt1, 73,122, 26,12, WS_GROUP | ES_NUMBER EDITTEXT edt2, 120,122, 26,12, WS_GROUP | ES_NUMBER RTEXT "", stc2, 52,124, 20,8 @@ -416,10 +392,7 @@ PUSHBUTTON "Otkaži",IDCANCEL,230,156,50,14 /* PUSHBUTTON "Network...", psh5, 284,156,48,14 */ - GROUPBOX "#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampaj\n\ -#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -Å tampanje", grp4, 8, 4, 272,84, WS_GROUP + GROUPBOX "Å tampanje", grp4, 8, 4, 272,84, WS_GROUP PUSHBUTTON "&Svojstva", psh2, 212, 17, 60,14, WS_GROUP LTEXT "&Naziv:", stc6, 16, 20, 36,8 COMBOBOX cmb1, 52, 18, 152,152,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP @@ -488,10 +461,7 @@ LTEXT "&Datoteka",IDC_FILENAMESTATIC,5,112,56,16, SS_NOTIFY EDITTEXT IDC_FILENAME,63,110,150,12,ES_AUTOHSCROLL - LTEXT "#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -&Datoteka\n\ -#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -&Fajl",IDC_FILETYPESTATIC,5,130,56,16, SS_NOTIFY + LTEXT "&Fajl",IDC_FILETYPESTATIC,5,130,56,16, SS_NOTIFY COMBOBOX IDC_FILETYPE,63,128,150,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,63,148,150,10 @@ -510,10 +480,7 @@ LTEXT "&Datoteka", IDC_FILENAMESTATIC, 160, 240, 60, 9, SS_RIGHT EDITTEXT IDC_FILENAME, 226, 240, 100, 12, WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT "#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -&Datoteka\n\ -#-#-#-#-# sr_RS(a)latin.po (Wine) #-#-#-#-#\n\ -&Fajl", IDC_FILETYPESTATIC, 160, 256, 60, 9, SS_RIGHT + LTEXT "&Fajl", IDC_FILETYPESTATIC, 160, 256, 60, 9, SS_RIGHT COMBOBOX IDC_FILETYPE, 226, 256, 100, 12, WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_HASSTRINGS | CBS_DROPDOWNLIST Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Zh.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Zh…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Zh.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Zh.rc [iso-8859-1] Wed Feb 15 20:25:35 2012 @@ -64,10 +64,7 @@ PD32_PRINT_ERROR "æå°æºé误ã" PD32_NO_DEFAULT_PRINTER "没æé»è®¤æå°æºã" PD32_CANT_FIND_PRINTER "æ¾ä¸å°æå°æºã" - PD32_OUT_OF_MEMORY "#-#-#-#-# zh_CN.po (Wine) #-#-#-#-#\n\ -å å溢åºã\n\ -#-#-#-#-# zh_CN.po (Wine) #-#-#-#-#\n\ -å åä¸å¤ã" + PD32_OUT_OF_MEMORY "å åä¸å¤ã" PD32_GENERIC_ERROR "åºç°äºé误ã" PD32_DRIVER_UNKNOWN "æ¾ä¸å°æå°æºé©±å¨ç¨åºã" PD32_NO_DEVICES "å¨å®è£ æå°æºåæè½ä½¿ç¨åæå°æºç¸å ³çåè½ã请å®è£ ååè¯ã"
12 years, 10 months
1
0
0
0
[ion] 55615: [CSRSRV]: Remove the CSRAPI Heap and just use the CSR Heap. In the future there will be separate DLLs each with their own heap, but now it's all one DLL. [CSRSRV]: Port CsrSbApiRequest...
by ion@svn.reactos.org
Author: ion Date: Wed Feb 15 19:53:31 2012 New Revision: 55615 URL:
http://svn.reactos.org/svn/reactos?rev=55615&view=rev
Log: [CSRSRV]: Remove the CSRAPI Heap and just use the CSR Heap. In the future there will be separate DLLs each with their own heap, but now it's all one DLL. [CSRSRV]: Port CsrSbApiRequestThread, CsrSbApiHandleConnectionRequest and all the Sb* APIs from CSRSRV2. Comment out parts that can't work yet. [CSRSRV]; Port CsrSbApiPortInitialize, CsrSetProcessSecurity, CsrCreateLocalSystemSD, and almost all of CsrServerInitialization. Initialization is almost identical to CSRSRV2 now. [CSRSRV]: Kill "Complete" routine support, nobody was using this. Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c trunk/reactos/subsystems/win32/csrss/csrsrv/init.c trunk/reactos/subsystems/win32/csrss/include/api.h trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/api/process.c [iso-8859-1] Wed Feb 15 19:53:31 2012 @@ -83,7 +83,7 @@ } if (pProcessData == NULL) { - pProcessData = RtlAllocateHeap(CsrssApiHeap, + pProcessData = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, sizeof(CSRSS_PROCESS_DATA)); if (pProcessData) @@ -109,7 +109,7 @@ if (!NT_SUCCESS(Status)) { ProcessData[hash] = pProcessData->next; - RtlFreeHeap(CsrssApiHeap, 0, pProcessData); + RtlFreeHeap(CsrHeap, 0, pProcessData); pProcessData = NULL; } else @@ -187,7 +187,7 @@ *pPrevLink = pProcessData->next; - RtlFreeHeap(CsrssApiHeap, 0, pProcessData); + RtlFreeHeap(CsrHeap, 0, pProcessData); UNLOCK; if (Process) { Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c [iso-8859-1] Wed Feb 15 19:53:31 2012 @@ -19,10 +19,17 @@ extern HANDLE hApiPort; -HANDLE CsrssApiHeap = (HANDLE) 0; - static unsigned ApiDefinitionsCount = 0; static PCSRSS_API_DEFINITION ApiDefinitions = NULL; + +PCHAR CsrServerSbApiName[5] = +{ + "SbCreateSession", + "SbTerminateSession", + "SbForeignSessionComplete", + "SbCreateProcess", + "Unknown Csr Sb Api Number" +}; /* FUNCTIONS *****************************************************************/ @@ -41,7 +48,7 @@ NewCount++; } - New = RtlAllocateHeap(CsrssApiHeap, 0, + New = RtlAllocateHeap(CsrHeap, 0, (ApiDefinitionsCount + NewCount) * sizeof(CSRSS_API_DEFINITION)); if (NULL == New) @@ -53,7 +60,7 @@ { RtlCopyMemory(New, ApiDefinitions, ApiDefinitionsCount * sizeof(CSRSS_API_DEFINITION)); - RtlFreeHeap(CsrssApiHeap, 0, ApiDefinitions); + RtlFreeHeap(CsrHeap, 0, ApiDefinitions); } RtlCopyMemory(New + ApiDefinitionsCount, NewDefinitions, NewCount * sizeof(CSRSS_API_DEFINITION)); @@ -180,7 +187,6 @@ /* Multiply by 1024 entries and round to page size */ CsrSrvSharedSectionSize = ROUND_UP(Size * 1024, CsrNtSysInfo.PageSize); - DPRINT1("Size: %lx\n", CsrSrvSharedSectionSize); /* Create the Secion */ SectionSize.LowPart = CsrSrvSharedSectionSize; @@ -980,115 +986,391 @@ RtlExitUserThread(STATUS_SUCCESS); } -/********************************************************************** - * NAME - * ServerSbApiPortThread/1 - * - * DESCRIPTION - * Handle connection requests from SM to the port - * "\Windows\SbApiPort". We will accept only one - * connection request (from the SM). - */ -DWORD WINAPI -ServerSbApiPortThread (HANDLE hSbApiPortListen) -{ - HANDLE hConnectedPort = (HANDLE) 0; - SB_API_MSG Request; - PVOID Context = NULL; - NTSTATUS Status = STATUS_SUCCESS; - PPORT_MESSAGE Reply = NULL; - - DPRINT("CSR: %s called\n", __FUNCTION__); - - RtlZeroMemory(&Request, sizeof(PORT_MESSAGE)); - Status = NtListenPort (hSbApiPortListen, & Request.h); - +/* SESSION MANAGER FUNCTIONS**************************************************/ + +/*++ + * @name CsrSbCreateSession + * + * The CsrSbCreateSession API is called by the Session Manager whenever a new + * session is created. + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE othwerwise. + * + * @remarks The CsrSbCreateSession routine will initialize a new CSR NT + * Session and allocate a new CSR Process for the subsystem process. + * + *--*/ +BOOLEAN +NTAPI +CsrSbCreateSession(IN PSB_API_MSG ApiMessage) +{ + PSB_CREATE_SESSION_MSG CreateSession = &ApiMessage->CreateSession; + HANDLE hProcess, hThread; +// PCSR_PROCESS CsrProcess; + NTSTATUS Status; + KERNEL_USER_TIMES KernelTimes; + //PCSR_THREAD CsrThread; + //PVOID ProcessData; + //ULONG i; + + /* Save the Process and Thread Handles */ + hProcess = CreateSession->ProcessInfo.ProcessHandle; + hThread = CreateSession->ProcessInfo.ThreadHandle; + +#if 0 + /* Lock the Processes */ + CsrAcquireProcessLock(); + + /* Allocate a new process */ + CsrProcess = CsrAllocateProcess(); + if (!CsrProcess) + { + /* Fail */ + ApiMessage->ReturnValue = STATUS_NO_MEMORY; + CsrReleaseProcessLock(); + return TRUE; + } +#endif + + /* Set the exception port */ + Status = NtSetInformationProcess(hProcess, + ProcessExceptionPort, + &hApiPort,//&CsrApiPort, + sizeof(HANDLE)); + + /* Check for success */ if (!NT_SUCCESS(Status)) { - DPRINT1("CSR: %s: NtListenPort(SB) failed (Status=0x%08lx)\n", - __FUNCTION__, Status); - } else { - DPRINT("-- 1\n"); - Status = NtAcceptConnectPort(&hConnectedPort, - NULL, - &Request.h, - TRUE, - NULL, - NULL); - if(!NT_SUCCESS(Status)) - { - DPRINT1("CSR: %s: NtAcceptConnectPort() failed (Status=0x%08lx)\n", - __FUNCTION__, Status); - } else { - DPRINT("-- 2\n"); - Status = NtCompleteConnectPort (hConnectedPort); - if(!NT_SUCCESS(Status)) + /* Fail the request */ +#if 0 + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); +#endif + /* Strange as it seems, NTSTATUSes are actually returned */ + return (BOOLEAN)STATUS_NO_MEMORY; + } + + /* Get the Create Time */ + Status = NtQueryInformationThread(hThread, + ThreadTimes, + &KernelTimes, + sizeof(KERNEL_USER_TIMES), + NULL); + + /* Check for success */ + if (!NT_SUCCESS(Status)) + { + /* Fail the request */ +#if 0 + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); +#endif + + /* Strange as it seems, NTSTATUSes are actually returned */ + return (BOOLEAN)Status; + } + + /* Allocate a new Thread */ +#if 0 + CsrThread = CsrAllocateThread(CsrProcess); + if (!CsrThread) + { + /* Fail the request */ + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); + + ApiMessage->ReturnValue = STATUS_NO_MEMORY; + return TRUE; + } + + /* Setup the Thread Object */ + CsrThread->CreateTime = KernelTimes.CreateTime; + CsrThread->ClientId = CreateSession->ProcessInfo.ClientId; + CsrThread->ThreadHandle = hThread; + ProtectHandle(hThread); + CsrThread->Flags = 0; + + /* Insert it into the Process List */ + CsrInsertThread(CsrProcess, CsrThread); + + /* Setup Process Data */ + CsrProcess->ClientId = CreateSession->ProcessInfo.ClientId; + CsrProcess->ProcessHandle = hProcess; + CsrProcess->NtSession = CsrAllocateNtSession(CreateSession->SessionId); + + /* Set the Process Priority */ + CsrSetBackgroundPriority(CsrProcess); + + /* Get the first data location */ + ProcessData = &CsrProcess->ServerData[CSR_SERVER_DLL_MAX]; + + /* Loop every DLL */ + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Check if the DLL is loaded and has Process Data */ + if (CsrLoadedServerDll[i] && CsrLoadedServerDll[i]->SizeOfProcessData) + { + /* Write the pointer to the data */ + CsrProcess->ServerData[i] = ProcessData; + + /* Move to the next data location */ + ProcessData = (PVOID)((ULONG_PTR)ProcessData + + CsrLoadedServerDll[i]->SizeOfProcessData); + } + else + { + /* Nothing for this Process */ + CsrProcess->ServerData[i] = NULL; + } + } + + /* Insert the Process */ + CsrInsertProcess(NULL, NULL, CsrProcess); +#endif + /* Activate the Thread */ + ApiMessage->ReturnValue = NtResumeThread(hThread, NULL); + + /* Release lock and return */ +// CsrReleaseProcessLock(); + return TRUE; +} + +/*++ + * @name CsrSbForeignSessionComplete + * + * The CsrSbForeignSessionComplete API is called by the Session Manager + * whenever a foreign session is completed (ie: terminated). + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE othwerwise. + * + * @remarks The CsrSbForeignSessionComplete API is not yet implemented. + * + *--*/ +BOOLEAN +NTAPI +CsrSbForeignSessionComplete(IN PSB_API_MSG ApiMessage) +{ + /* Deprecated/Unimplemented in NT */ + ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; + return TRUE; +} + +/*++ + * @name CsrSbTerminateSession + * + * The CsrSbTerminateSession API is called by the Session Manager + * whenever a foreign session should be destroyed. + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE othwerwise. + * + * @remarks The CsrSbTerminateSession API is not yet implemented. + * + *--*/ +BOOLEAN +NTAPI +CsrSbTerminateSession(IN PSB_API_MSG ApiMessage) +{ + ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; + return TRUE; +} + +/*++ + * @name CsrSbCreateProcess + * + * The CsrSbCreateProcess API is called by the Session Manager + * whenever a foreign session is created and a new process should be started. + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE othwerwise. + * + * @remarks The CsrSbCreateProcess API is not yet implemented. + * + *--*/ +BOOLEAN +NTAPI +CsrSbCreateProcess(IN PSB_API_MSG ApiMessage) +{ + ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; + return TRUE; +} + +PSB_API_ROUTINE CsrServerSbApiDispatch[5] = +{ + CsrSbCreateSession, + CsrSbTerminateSession, + CsrSbForeignSessionComplete, + CsrSbCreateProcess, + NULL +}; + +/*++ + * @name CsrSbApiHandleConnectionRequest + * + * The CsrSbApiHandleConnectionRequest routine handles and accepts a new + * connection request to the SM API LPC Port. + * + * @param ApiMessage + * Pointer to the incoming CSR API Message which contains the + * connection request. + * + * @return STATUS_SUCCESS in case of success, or status code which caused + * the routine to error. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSbApiHandleConnectionRequest(IN PSB_API_MSG Message) +{ + NTSTATUS Status; + REMOTE_PORT_VIEW RemotePortView; + HANDLE hPort; + + /* Set the Port View Structure Length */ + RemotePortView.Length = sizeof(REMOTE_PORT_VIEW); + + /* Accept the connection */ + Status = NtAcceptConnectPort(&hPort, + NULL, + (PPORT_MESSAGE)Message, + TRUE, + NULL, + &RemotePortView); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: Sb Accept Connection failed %lx\n", Status); + return Status; + } + + /* Complete the Connection */ + Status = NtCompleteConnectPort(hPort); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: Sb Complete Connection failed %lx\n",Status); + } + + /* Return status */ + return Status; +} + +/*++ + * @name CsrSbApiRequestThread + * + * The CsrSbApiRequestThread routine handles incoming messages or connection + * requests on the SM API LPC Port. + * + * @param Parameter + * System-default user-defined parameter. Unused. + * + * @return The thread exit code, if the thread is terminated. + * + * @remarks Before listening on the port, the routine will first attempt + * to connect to the user subsystem. + * + *--*/ +VOID +NTAPI +CsrSbApiRequestThread(IN PVOID Parameter) +{ + NTSTATUS Status; + SB_API_MSG ReceiveMsg; + PSB_API_MSG ReplyMsg = NULL; + PVOID PortContext; + ULONG MessageType; + + /* Start the loop */ + while (TRUE) + { + /* Wait for a message to come in */ + Status = NtReplyWaitReceivePort(CsrSbApiPort, + &PortContext, + &ReplyMsg->h, + &ReceiveMsg.h); + + /* Check if we didn't get success */ + if (Status != STATUS_SUCCESS) + { + /* If we only got a warning, keep going */ + if (NT_SUCCESS(Status)) continue; + + /* We failed big time, so start out fresh */ + ReplyMsg = NULL; + DPRINT1("CSRSS: ReceivePort failed - Status == %X\n", Status); + continue; + } + + /* Save the message type */ + MessageType = ReceiveMsg.h.u2.s2.Type; + + /* Check if this is a connection request */ + if (MessageType == LPC_CONNECTION_REQUEST) + { + /* Handle connection request */ + CsrSbApiHandleConnectionRequest(&ReceiveMsg); + + /* Start over */ + ReplyMsg = NULL; + continue; + } + + /* Check if the port died */ + if (MessageType == LPC_PORT_CLOSED) + { + /* Close the handle if we have one */ + if (PortContext) NtClose((HANDLE)PortContext); + + /* Client died, start over */ + ReplyMsg = NULL; + continue; + } + else if (MessageType == LPC_CLIENT_DIED) + { + /* Client died, start over */ + ReplyMsg = NULL; + continue; + } + + /* + * It's an API Message, check if it's within limits. If it's not, the + * NT Behaviour is to set this to the Maximum API. + */ + if (ReceiveMsg.ApiNumber > SbpMaxApiNumber) + { + ReceiveMsg.ApiNumber = SbpMaxApiNumber; + DPRINT1("CSRSS: %lx is invalid Sb ApiNumber\n", ReceiveMsg.ApiNumber); + } + + /* Reuse the message */ + ReplyMsg = &ReceiveMsg; + + /* Make sure that the message is supported */ + if (ReceiveMsg.ApiNumber < SbpMaxApiNumber) + { + /* Call the API */ + if (!CsrServerSbApiDispatch[ReceiveMsg.ApiNumber](&ReceiveMsg)) { - DPRINT1("CSR: %s: NtCompleteConnectPort() failed (Status=0x%08lx)\n", - __FUNCTION__, Status); - } else { - DPRINT("-- 3\n"); - /* - * Tell the init thread the SM gave the - * green light for boostrapping. - */ - Status = NtSetEvent (hBootstrapOk, NULL); - if(!NT_SUCCESS(Status)) - { - DPRINT1("CSR: %s: NtSetEvent failed (Status=0x%08lx)\n", - __FUNCTION__, Status); - } - /* Wait for messages from the SM */ - DPRINT("-- 4\n"); - while (TRUE) - { - Status = NtReplyWaitReceivePort(hConnectedPort, - Context, - Reply, - &Request.h); - if(!NT_SUCCESS(Status)) - { - DPRINT1("CSR: %s: NtReplyWaitReceivePort failed (Status=0x%08lx)\n", - __FUNCTION__, Status); - break; - } - - switch (Request.h.u2.s2.Type) //fix .h PORT_MESSAGE_TYPE(Request)) - { - /* TODO */ - case LPC_PORT_CLOSED: - case LPC_CLIENT_DIED: - DPRINT1("CSR: SMSS died\n"); - Reply = NULL; - break; - - default: - DPRINT1("CSR: %s received message (type=%d)\n", - __FUNCTION__, Request.h.u2.s2.Type); - - if (Request.ApiNumber == SbpCreateSession) - { - DPRINT("Session create... legacy CSRSS resuming thread as minimum work done\n"); - Request.ReturnValue = NtResumeThread(Request.CreateSession.ProcessInfo.ThreadHandle, NULL); - } - else - { - DPRINT1("CSR: %d Not implemented in legacy CSRSS... faking success\n", Request.ApiNumber); - Request.ReturnValue = STATUS_SUCCESS; - } - Reply = &Request.h; - } - DPRINT("-- 5\n"); - } + /* It failed, so return nothing */ + ReplyMsg = NULL; } } - } - - DPRINT("CSR: %s: terminating!\n", __FUNCTION__); - if(hConnectedPort) NtClose (hConnectedPort); - NtClose (hSbApiPortListen); - NtTerminateThread (NtCurrentThread(), Status); - return 0; + else + { + /* We don't support this API Number */ + ReplyMsg->ReturnValue = STATUS_NOT_IMPLEMENTED; + } + } } /* EOF */ Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/init.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/init.c [iso-8859-1] Wed Feb 15 19:53:31 2012 @@ -17,12 +17,13 @@ HANDLE CsrHeap = (HANDLE) 0; HANDLE CsrObjectDirectory = (HANDLE) 0; UNICODE_STRING CsrDirectoryName; -extern HANDLE CsrssApiHeap; +UNICODE_STRING CsrSbApiPortName; +HANDLE CsrSbApiPort = 0; +PCSR_THREAD CsrSbApiRequestThreadPtr; static unsigned ServerProcCount; static CSRPLUGIN_SERVER_PROCS *ServerProcs = NULL; +HANDLE CsrSmApiPort; HANDLE hSbApiPort = (HANDLE) 0; -HANDLE hBootstrapOk = (HANDLE) 0; -HANDLE hSmApiPort = (HANDLE) 0; HANDLE hApiPort = (HANDLE) 0; ULONG CsrDebug = 0xFFFFFFFF; ULONG CsrMaxApiRequestThreads; @@ -31,6 +32,8 @@ HANDLE BNOLinksDirectory; HANDLE SessionObjectDirectory; HANDLE DosDevicesDirectory; +HANDLE CsrInitializationEvent; +SYSTEM_BASIC_INFORMATION CsrNtSysInfo; /* PRIVATE FUNCTIONS **********************************************************/ @@ -41,7 +44,7 @@ DPRINT("CSR: %s called\n", __FUNCTION__); - NewProcs = RtlAllocateHeap(CsrssApiHeap, 0, + NewProcs = RtlAllocateHeap(CsrHeap, 0, (ServerProcCount + 1) * sizeof(CSRPLUGIN_SERVER_PROCS)); if (NULL == NewProcs) @@ -52,33 +55,13 @@ { RtlCopyMemory(NewProcs, ServerProcs, ServerProcCount * sizeof(CSRPLUGIN_SERVER_PROCS)); - RtlFreeHeap(CsrssApiHeap, 0, ServerProcs); + RtlFreeHeap(CsrHeap, 0, ServerProcs); } NewProcs[ServerProcCount] = *Procs; ServerProcs = NewProcs; ServerProcCount++; return STATUS_SUCCESS; -} - -/********************************************************************** - * CallInitComplete/0 - */ -static BOOL FASTCALL -CallInitComplete(void) -{ - BOOL Ok; - unsigned i; - - DPRINT("CSR: %s called\n", __FUNCTION__); - - Ok = TRUE; - for (i = 0; i < ServerProcCount && Ok; i++) - { - Ok = (*ServerProcs[i].InitCompleteProc)(); - } - - return Ok; } BOOL @@ -167,7 +150,7 @@ return Status; } Exports.CsrEnumProcessesProc = CsrEnumProcesses; - if (! (*InitProc)(&ApiDefinitions, &ServerProcs, &Exports, CsrssApiHeap)) + if (! (*InitProc)(&ApiDefinitions, &ServerProcs, &Exports, CsrHeap)) { return STATUS_UNSUCCESSFUL; } @@ -233,12 +216,12 @@ *Port, &ServerThread, &ClientId); - + if (ListenThread == (PVOID)ClientConnectionThread) { CsrAddStaticServerThread(ServerThread, &ClientId, 0); } - + NtResumeThread(ServerThread, NULL); NtClose(ServerThread); return Status; @@ -254,94 +237,118 @@ NTAPI CsrSrvCreateSharedSection(IN PCHAR ParameterValue); -/********************************************************************** - * CsrpCreateHeap/3 - */ -static NTSTATUS -CsrpCreateHeap (VOID) -{ - DPRINT("CSR: %s called\n", __FUNCTION__); - - CsrHeap = RtlGetProcessHeap(); - CsrssApiHeap = RtlCreateHeap(HEAP_GROWABLE, - NULL, - 65536, - 65536, - NULL, - NULL); - if (CsrssApiHeap == NULL) - { - return STATUS_UNSUCCESSFUL; - } - - return STATUS_SUCCESS; -} - -/********************************************************************** - * CsrpRegisterSubsystem/3 - */ -BOOLEAN g_ModernSm; -static NTSTATUS -CsrpRegisterSubsystem (VOID) -{ - NTSTATUS Status = STATUS_SUCCESS; - OBJECT_ATTRIBUTES BootstrapOkAttributes; - UNICODE_STRING Name; - - DPRINT("CSR: %s called\n", __FUNCTION__); - - /* - * Create the event object the callback port - * thread will signal *if* the SM will - * authorize us to bootstrap. - */ - RtlInitUnicodeString (& Name, L"\\CsrssBooting"); - InitializeObjectAttributes(& BootstrapOkAttributes, - & Name, - 0, NULL, NULL); - Status = NtCreateEvent (& hBootstrapOk, - EVENT_ALL_ACCESS, - & BootstrapOkAttributes, - SynchronizationEvent, - FALSE); - if(!NT_SUCCESS(Status)) - { - DPRINT("CSR: %s: NtCreateEvent failed (Status=0x%08lx)\n", - __FUNCTION__, Status); - return Status; - } - /* - * Let's tell the SM a new environment - * subsystem server is in the system. - */ - RtlInitUnicodeString (& Name, L"\\Windows\\SbApiPort"); - DPRINT("CSR: %s: registering with SM for\n IMAGE_SUBSYSTEM_WINDOWS_CUI == 3\n", __FUNCTION__); - Status = SmConnectApiPort (& Name, - hSbApiPort, - IMAGE_SUBSYSTEM_WINDOWS_CUI, - & hSmApiPort); - if (!NT_SUCCESS(Status)) - { - Status = SmConnectToSm(&Name, hSbApiPort, IMAGE_SUBSYSTEM_WINDOWS_GUI, &hSmApiPort); - g_ModernSm = TRUE; - } - if(!NT_SUCCESS(Status)) - { - DPRINT("CSR: %s unable to connect to the SM (Status=0x%08lx)\n", - __FUNCTION__, Status); - NtClose (hBootstrapOk); - return Status; - } - /* - * Wait for SM to reply OK... If the SM - * won't answer, we hang here forever! - */ - DPRINT("CSR: %s: waiting for SM to OK boot...\n", __FUNCTION__); - Status = NtWaitForSingleObject (hBootstrapOk, - FALSE, - NULL); - NtClose (hBootstrapOk); - return Status; +/*++ + * @name CsrSetProcessSecurity + * + * The CsrSetProcessSecurity routine protects access to the CSRSS process + * from unauthorized tampering. + * + * @param None. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL + * othwerwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSetProcessSecurity(VOID) +{ + NTSTATUS Status; + HANDLE hToken, hProcess = NtCurrentProcess(); + ULONG Length; + PTOKEN_USER TokenInfo = NULL; + PSECURITY_DESCRIPTOR ProcSd = NULL; + PACL Dacl; + PSID UserSid; + + /* Open our token */ + Status = NtOpenProcessToken(hProcess, TOKEN_QUERY, &hToken); + if (!NT_SUCCESS(Status)) goto Quickie; + + /* Get the Token User Length */ + NtQueryInformationToken(hToken, TokenUser, NULL, 0, &Length); + + /* Allocate space for it */ + TokenInfo = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, Length); + if (!TokenInfo) + { + Status = STATUS_NO_MEMORY; + goto Quickie; + } + + /* Now query the data */ + Status = NtQueryInformationToken(hToken, TokenUser, TokenInfo, Length, &Length); + NtClose(hToken); + if (!NT_SUCCESS(Status)) goto Quickie; + + /* Now check the SID Length */ + UserSid = TokenInfo->User.Sid; + Length = RtlLengthSid(UserSid) + sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE); + + /* Allocate a buffer for the Security Descriptor, with SID and DACL */ + ProcSd = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, SECURITY_DESCRIPTOR_MIN_LENGTH + Length); + if (!ProcSd) + { + Status = STATUS_NO_MEMORY; + goto Quickie; + } + + /* Set the pointer to the DACL */ + Dacl = (PACL)((ULONG_PTR)ProcSd + SECURITY_DESCRIPTOR_MIN_LENGTH); + + /* Now create the SD itself */ + Status = RtlCreateSecurityDescriptor(ProcSd, SECURITY_DESCRIPTOR_REVISION); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: SD creation failed - status = %lx\n", Status); + goto Quickie; + } + + /* Create the DACL for it*/ + Status = RtlCreateAcl(Dacl, Length, ACL_REVISION2); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: DACL creation failed - status = %lx\n", Status); + goto Quickie; + } + + /* Create the ACE */ + Status = RtlAddAccessAllowedAce(Dacl, + ACL_REVISION, + PROCESS_VM_READ | PROCESS_VM_WRITE | + PROCESS_VM_OPERATION | PROCESS_DUP_HANDLE | + PROCESS_TERMINATE | PROCESS_SUSPEND_RESUME | + PROCESS_QUERY_INFORMATION | READ_CONTROL, + UserSid); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: ACE creation failed - status = %lx\n", Status); + goto Quickie; + } + + /* Clear the DACL in the SD */ + Status = RtlSetDaclSecurityDescriptor(ProcSd, TRUE, Dacl, FALSE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: set DACL failed - status = %lx\n", Status); + goto Quickie; + } + + /* Write the SD into the Process */ + Status = NtSetSecurityObject(hProcess, DACL_SECURITY_INFORMATION, ProcSd); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: set process DACL failed - status = %lx\n", Status); + goto Quickie; + } + + /* Free the memory and return */ +Quickie: + if (ProcSd) RtlFreeHeap(CsrHeap, 0, ProcSd); + RtlFreeHeap(CsrHeap, 0, TokenInfo); + return Status; } /*++ @@ -764,11 +771,9 @@ { /* Split Name and Value */ ParameterName = Arguments[i]; - DPRINT1("Name: %s\n", ParameterName); ParameterValue = NULL; ParameterValue = strchr(ParameterName, '='); if (ParameterValue) *ParameterValue++ = ANSI_NULL; - DPRINT1("Name=%s, Value=%s\n", ParameterName, ParameterValue); /* Check for Object Directory */ if (!_stricmp(ParameterName, "ObjectDirectory")) @@ -898,21 +903,218 @@ return Status; } -/* PUBLIC FUNCTIONS ***********************************************************/ - +/*++ + * @name CsrCreateLocalSystemSD + * + * The CsrCreateLocalSystemSD routine creates a Security Descriptor for + * the local account with PORT_ALL_ACCESS. + * + * @param LocalSystemSd + * Pointer to a pointer to the security descriptor to create. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL + * othwerwise. + * + * @remarks None. + * + *--*/ NTSTATUS NTAPI -CsrServerInitialization(ULONG ArgumentCount, - PCHAR Arguments[]) -{ - NTSTATUS Status = STATUS_SUCCESS; - - DPRINT("CSR: %s called\n", __FUNCTION__); - - Status = CsrpCreateHeap(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpCreateHeap", Status); +CsrCreateLocalSystemSD(OUT PSECURITY_DESCRIPTOR *LocalSystemSd) +{ + SID_IDENTIFIER_AUTHORITY NtSidAuthority = {SECURITY_NT_AUTHORITY}; + PSID SystemSid; + ULONG Length; + PSECURITY_DESCRIPTOR SystemSd; + PACL Dacl; + NTSTATUS Status; + + /* Initialize the System SID */ + RtlAllocateAndInitializeSid(&NtSidAuthority, 1, + SECURITY_LOCAL_SYSTEM_RID, + 0, 0, 0, 0, 0, 0, 0, + &SystemSid); + + /* Get the length of the SID */ + Length = RtlLengthSid(SystemSid) + sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE); + + /* Allocate a buffer for the Security Descriptor, with SID and DACL */ + SystemSd = RtlAllocateHeap(CsrHeap, 0, SECURITY_DESCRIPTOR_MIN_LENGTH + Length); + + /* Set the pointer to the DACL */ + Dacl = (PACL)((ULONG_PTR)SystemSd + SECURITY_DESCRIPTOR_MIN_LENGTH); + + /* Now create the SD itself */ + Status = RtlCreateSecurityDescriptor(SystemSd, SECURITY_DESCRIPTOR_REVISION); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + RtlFreeHeap(CsrHeap, 0, SystemSd); + return Status; + } + + /* Create the DACL for it*/ + RtlCreateAcl(Dacl, Length, ACL_REVISION2); + + /* Create the ACE */ + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, PORT_ALL_ACCESS, SystemSid); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + RtlFreeHeap(CsrHeap, 0, SystemSd); + return Status; + } + + /* Clear the DACL in the SD */ + Status = RtlSetDaclSecurityDescriptor(SystemSd, TRUE, Dacl, FALSE); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + RtlFreeHeap(CsrHeap, 0, SystemSd); + return Status; + } + + /* Free the SID and return*/ + RtlFreeSid(SystemSid); + *LocalSystemSd = SystemSd; + return Status; +} + +/*++ + * @name CsrSbApiPortInitialize + * + * The CsrSbApiPortInitialize routine initializes the LPC Port used for + * communications with the Session Manager (SM) and initializes the static + * thread that will handle connection requests and APIs. + * + * @param None + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL + * othwerwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSbApiPortInitialize(VOID) +{ + ULONG Size; + PSECURITY_DESCRIPTOR PortSd; + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status; + HANDLE hRequestThread; + CLIENT_ID ClientId; + + /* Calculate how much space we'll need for the Port Name */ + Size = CsrDirectoryName.Length + sizeof(SB_PORT_NAME) + sizeof(WCHAR); + + /* Create the buffer for it */ + CsrSbApiPortName.Buffer = RtlAllocateHeap(CsrHeap, 0, Size); + if (!CsrSbApiPortName.Buffer) return STATUS_NO_MEMORY; + + /* Setup the rest of the empty string */ + CsrSbApiPortName.Length = 0; + CsrSbApiPortName.MaximumLength = (USHORT)Size; + + /* Now append the full port name */ + RtlAppendUnicodeStringToString(&CsrSbApiPortName, &CsrDirectoryName); + RtlAppendUnicodeToString(&CsrSbApiPortName, UNICODE_PATH_SEP); + RtlAppendUnicodeToString(&CsrSbApiPortName, SB_PORT_NAME); + if (CsrDebug & 2) DPRINT1("CSRSS: Creating %wZ port and associated thread\n", &CsrSbApiPortName); + + /* Create Security Descriptor for this Port */ + Status = CsrCreateLocalSystemSD(&PortSd); + if (!NT_SUCCESS(Status)) return Status; + + /* Initialize the Attributes */ + InitializeObjectAttributes(&ObjectAttributes, + &CsrSbApiPortName, + 0, + NULL, + PortSd); + + /* Create the Port Object */ + Status = NtCreatePort(&CsrSbApiPort, + &ObjectAttributes, + sizeof(SB_CONNECTION_INFO), + sizeof(SB_API_MSG), + 32 * sizeof(SB_API_MSG)); + if (PortSd) RtlFreeHeap(CsrHeap, 0, PortSd); + + if (NT_SUCCESS(Status)) + { + /* Create the Thread to handle the API Requests */ + Status = RtlCreateUserThread(NtCurrentProcess(), + NULL, + TRUE, + 0, + 0, + 0, + (PVOID)CsrSbApiRequestThread, + NULL, + &hRequestThread, + &ClientId); + if (NT_SUCCESS(Status)) + { + /* Add it as a Static Server Thread */ + CsrSbApiRequestThreadPtr = CsrAddStaticServerThread(hRequestThread, + &ClientId, + 0); + + /* Activate it */ + Status = NtResumeThread(hRequestThread, NULL); + } + } + + return Status; +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + +NTSTATUS +NTAPI +CsrServerInitialization(IN ULONG ArgumentCount, + IN PCHAR Arguments[]) +{ + NTSTATUS Status = STATUS_SUCCESS; + DPRINT("CSRSRV: %s called\n", __FUNCTION__); + + /* Create the Init Event */ + Status = NtCreateEvent(&CsrInitializationEvent, + EVENT_ALL_ACCESS, + NULL, + SynchronizationEvent, + FALSE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: NtCreateEvent failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Cache System Basic Information so we don't always request it */ + Status = NtQuerySystemInformation(SystemBasicInformation, + &CsrNtSysInfo, + sizeof(SYSTEM_BASIC_INFORMATION), + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: NtQuerySystemInformation failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Save our Heap */ + CsrHeap = RtlGetProcessHeap(); + + /* Set our Security Descriptor to protect the process */ + Status = CsrSetProcessSecurity(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: CsrSetProcessSecurity failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; } /* Parse the command line */ @@ -923,51 +1125,71 @@ __FUNCTION__, Status); return Status; } - + CsrInitProcessData(); + Status = CsrApiRegisterDefinitions(NativeDefinitions); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrApiRegisterDefinitions", Status); + } + Status = CsrpCreateListenPort(L"\\Windows\\ApiPort", &hApiPort, (PTHREAD_START_ROUTINE)ClientConnectionThread); if (!NT_SUCCESS(Status)) { DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpCreateApiPort", Status); } - Status = CsrApiRegisterDefinitions(NativeDefinitions); - if (!NT_SUCCESS(Status)) - { - DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrApiRegisterDefinitions", Status); - } - Status = CsrpInitWin32Csr(); if (!NT_SUCCESS(Status)) { DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpInitWin32Csr", Status); } - Status = CsrpCreateListenPort(L"\\Windows\\SbApiPort", &hSbApiPort, ServerSbApiPortThread); - if (!NT_SUCCESS(Status)) - { - DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpCreateCallbackPort", Status); - } - - Status = CsrpRegisterSubsystem(); - if (!NT_SUCCESS(Status)) - { - DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpRegisterSubsystem", Status); - } - + /* Initialize the API Port for SM communication */ + Status = CsrSbApiPortInitialize(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: CsrSbApiPortInitialize failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* We're all set! Connect to SM! */ + Status = SmConnectToSm(&CsrSbApiPortName, + CsrSbApiPort, + IMAGE_SUBSYSTEM_WINDOWS_GUI, + &CsrSmApiPort); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: SmConnectToSm failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Finito! Signal the event */ + Status = NtSetEvent(CsrInitializationEvent, NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: NtSetEvent failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Close the event handle now */ + NtClose(CsrInitializationEvent); + + /* Have us handle Hard Errors */ Status = NtSetDefaultHardErrorPort(hApiPort); if (!NT_SUCCESS(Status)) { - DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpCreateHardErrorPort", Status); - } - - if (CallInitComplete()) - { - return STATUS_SUCCESS; - } - - return STATUS_UNSUCCESSFUL; + DPRINT1("CSRSRV:%s: NtSetDefaultHardErrorPort failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + /* Return status */ + return Status; } BOOL Modified: trunk/reactos/subsystems/win32/csrss/include/api.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/inc…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/include/api.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/include/api.h [iso-8859-1] Wed Feb 15 19:53:31 2012 @@ -121,14 +121,18 @@ CSR_API(CsrGetShutdownParameters); CSR_API(CsrSetShutdownParameters); +PCSR_THREAD +NTAPI +CsrAllocateThread(IN PCSRSS_PROCESS_DATA CsrProcess); + /* api/wapi.c */ NTSTATUS FASTCALL CsrApiRegisterDefinitions(PCSRSS_API_DEFINITION NewDefinitions); VOID FASTCALL CsrApiCallHandler(PCSRSS_PROCESS_DATA ProcessData, PCSR_API_MESSAGE Request); -DWORD WINAPI ServerSbApiPortThread (PVOID PortHandle); +VOID WINAPI CsrSbApiRequestThread (PVOID PortHandle); VOID NTAPI ClientConnectionThread(HANDLE ServerPort); -extern HANDLE CsrssApiHeap; +extern HANDLE CsrSbApiPort; /* api/process.c */ typedef NTSTATUS (WINAPI *CSRSS_ENUM_PROCESS_PROC)(PCSRSS_PROCESS_DATA ProcessData, Modified: trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] Wed Feb 15 19:53:31 2012 @@ -335,14 +335,14 @@ Win32CsrInitialization(PCSRSS_API_DEFINITION *ApiDefinitions, PCSRPLUGIN_SERVER_PROCS ServerProcs, PCSRSS_EXPORTED_FUNCS Exports, - HANDLE CsrssApiHeap) + HANDLE CsrHeap) { HANDLE ServerThread; CLIENT_ID ClientId; NTSTATUS Status; CsrExports = *Exports; - Win32CsrApiHeap = CsrssApiHeap; + Win32CsrApiHeap = CsrHeap; CsrpInitVideo();
12 years, 10 months
1
0
0
0
[ion] 55614: [CSRSRV2]: Fix some bugs.
by ion@svn.reactos.org
Author: ion Date: Wed Feb 15 19:47:28 2012 New Revision: 55614 URL:
http://svn.reactos.org/svn/reactos?rev=55614&view=rev
Log: [CSRSRV2]: Fix some bugs. Modified: trunk/reactos/subsystems/csr/csrsrv/api.c trunk/reactos/subsystems/csr/csrsrv/init.c Modified: trunk/reactos/subsystems/csr/csrsrv/api.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/csr/csrsrv/api.…
============================================================================== --- trunk/reactos/subsystems/csr/csrsrv/api.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/csr/csrsrv/api.c [iso-8859-1] Wed Feb 15 19:47:28 2012 @@ -153,15 +153,15 @@ InitializeObjectAttributes(&ObjectAttributes, &CsrSbApiPortName, 0, - PortSd, - NULL); + NULL, + PortSd); /* Create the Port Object */ Status = NtCreatePort(&CsrSbApiPort, &ObjectAttributes, sizeof(SB_CONNECTION_INFO), - sizeof(PSB_API_MSG), - 32 * sizeof(PSB_API_MSG)); + sizeof(SB_API_MSG), + 32 * sizeof(SB_API_MSG)); if (PortSd) RtlFreeHeap(CsrHeap, 0, PortSd); if (NT_SUCCESS(Status)) Modified: trunk/reactos/subsystems/csr/csrsrv/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/csr/csrsrv/init…
============================================================================== --- trunk/reactos/subsystems/csr/csrsrv/init.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/csr/csrsrv/init.c [iso-8859-1] Wed Feb 15 19:47:28 2012 @@ -771,8 +771,8 @@ *--*/ NTSTATUS NTAPI -CsrServerInitialization(ULONG ArgumentCount, - PCHAR Arguments[]) +CsrServerInitialization(IN ULONG ArgumentCount, + IN PCHAR Arguments[]) { NTSTATUS Status = STATUS_SUCCESS; ULONG i = 0; @@ -865,7 +865,7 @@ ServerDll = CsrLoadedServerDll[i]; /* Is it loaded, and does it have per process data? */ - if (ServerDll && ServerDll->SizeOfProcessData) + if ((ServerDll) && (ServerDll->SizeOfProcessData)) { /* It does, give it part of our allocated heap */ CsrRootProcess->ServerData[i] = ProcessData; @@ -888,10 +888,10 @@ ServerDll = CsrLoadedServerDll[i]; /* Is it loaded, and does it a callback for new processes? */ - if (ServerDll && ServerDll->NewProcessCallback) + if ((ServerDll) && (ServerDll->NewProcessCallback)) { /* Call the callback */ - (*ServerDll->NewProcessCallback)(NULL, CsrRootProcess); + ServerDll->NewProcessCallback(NULL, CsrRootProcess); } }
12 years, 10 months
1
0
0
0
[rharabien] 55613: - Fix MSVC build
by rharabien@svn.reactos.org
Author: rharabien Date: Wed Feb 15 17:39:18 2012 New Revision: 55613 URL:
http://svn.reactos.org/svn/reactos?rev=55613&view=rev
Log: - Fix MSVC build Modified: trunk/reactos/include/psdk/shobjidl.idl Modified: trunk/reactos/include/psdk/shobjidl.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/shobjidl.idl?…
============================================================================== --- trunk/reactos/include/psdk/shobjidl.idl [iso-8859-1] (original) +++ trunk/reactos/include/psdk/shobjidl.idl [iso-8859-1] Wed Feb 15 17:39:18 2012 @@ -4523,12 +4523,4 @@ coclass DestinationList { interface ICustomDestinationList; } - - [ - uuid(2d3468c1-36a7-43b6-ac24-d3f02fd9607a) - ] - coclass EnumerableObjectCollection - { - interface IEnumObjects; - } -} +}
12 years, 10 months
1
0
0
0
[rharabien] 55612: [COMDLG32] - Sync to Wine 1.3.37
by rharabien@svn.reactos.org
Author: rharabien Date: Wed Feb 15 17:35:24 2012 New Revision: 55612 URL:
http://svn.reactos.org/svn/reactos?rev=55612&view=rev
Log: [COMDLG32] - Sync to Wine 1.3.37 Added: trunk/rostests/winetests/comdlg32/finddlg.c (with props) trunk/rostests/winetests/comdlg32/itemdlg.c (with props) Modified: trunk/rostests/winetests/comdlg32/CMakeLists.txt trunk/rostests/winetests/comdlg32/comdlg32.rbuild trunk/rostests/winetests/comdlg32/filedlg.c trunk/rostests/winetests/comdlg32/fontdlg.c trunk/rostests/winetests/comdlg32/printdlg.c trunk/rostests/winetests/comdlg32/testlist.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/rostests/winetests/comdlg32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/CMakeL…
Modified: trunk/rostests/winetests/comdlg32/comdlg32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/comdlg…
Modified: trunk/rostests/winetests/comdlg32/filedlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/filedl…
Added: trunk/rostests/winetests/comdlg32/finddlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/finddl…
Modified: trunk/rostests/winetests/comdlg32/fontdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/fontdl…
Added: trunk/rostests/winetests/comdlg32/itemdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/itemdl…
Modified: trunk/rostests/winetests/comdlg32/printdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/printd…
Modified: trunk/rostests/winetests/comdlg32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/testli…
12 years, 10 months
1
0
0
0
[rharabien] 55611: [COMDLG32] - Sync to Wine 1.3.37
by rharabien@svn.reactos.org
Author: rharabien Date: Wed Feb 15 17:33:15 2012 New Revision: 55611 URL:
http://svn.reactos.org/svn/reactos?rev=55611&view=rev
Log: [COMDLG32] - Sync to Wine 1.3.37 Added: trunk/reactos/dll/win32/comdlg32/cdlg_Eo.rc (with props) trunk/reactos/dll/win32/comdlg32/cdlg_He.rc (with props) trunk/reactos/dll/win32/comdlg32/itemdlg.c (with props) Modified: trunk/reactos/dll/win32/comdlg32/CMakeLists.txt trunk/reactos/dll/win32/comdlg32/cdlg.h trunk/reactos/dll/win32/comdlg32/cdlg32.c trunk/reactos/dll/win32/comdlg32/cdlg_Bg.rc trunk/reactos/dll/win32/comdlg32/cdlg_Ca.rc trunk/reactos/dll/win32/comdlg32/cdlg_Cn.rc trunk/reactos/dll/win32/comdlg32/cdlg_Cs.rc trunk/reactos/dll/win32/comdlg32/cdlg_Da.rc trunk/reactos/dll/win32/comdlg32/cdlg_De.rc trunk/reactos/dll/win32/comdlg32/cdlg_El.rc trunk/reactos/dll/win32/comdlg32/cdlg_En.rc trunk/reactos/dll/win32/comdlg32/cdlg_Es.rc trunk/reactos/dll/win32/comdlg32/cdlg_Fi.rc trunk/reactos/dll/win32/comdlg32/cdlg_Fr.rc trunk/reactos/dll/win32/comdlg32/cdlg_Hu.rc trunk/reactos/dll/win32/comdlg32/cdlg_It.rc trunk/reactos/dll/win32/comdlg32/cdlg_Ja.rc trunk/reactos/dll/win32/comdlg32/cdlg_Ko.rc trunk/reactos/dll/win32/comdlg32/cdlg_Lt.rc trunk/reactos/dll/win32/comdlg32/cdlg_Nl.rc trunk/reactos/dll/win32/comdlg32/cdlg_No.rc trunk/reactos/dll/win32/comdlg32/cdlg_Pl.rc trunk/reactos/dll/win32/comdlg32/cdlg_Pt.rc trunk/reactos/dll/win32/comdlg32/cdlg_Ro.rc trunk/reactos/dll/win32/comdlg32/cdlg_Ru.rc trunk/reactos/dll/win32/comdlg32/cdlg_Si.rc trunk/reactos/dll/win32/comdlg32/cdlg_Sk.rc trunk/reactos/dll/win32/comdlg32/cdlg_Sr.rc trunk/reactos/dll/win32/comdlg32/cdlg_Sv.rc trunk/reactos/dll/win32/comdlg32/cdlg_Th.rc trunk/reactos/dll/win32/comdlg32/cdlg_Tr.rc trunk/reactos/dll/win32/comdlg32/cdlg_Uk.rc trunk/reactos/dll/win32/comdlg32/cdlg_Zh.rc trunk/reactos/dll/win32/comdlg32/comdlg32.rbuild trunk/reactos/dll/win32/comdlg32/comdlg32.spec trunk/reactos/dll/win32/comdlg32/filedlg.c trunk/reactos/dll/win32/comdlg32/filedlg31.c trunk/reactos/dll/win32/comdlg32/filedlg31.h trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c trunk/reactos/dll/win32/comdlg32/filedlgbrowser.h trunk/reactos/dll/win32/comdlg32/finddlg.c trunk/reactos/dll/win32/comdlg32/fontdlg.c trunk/reactos/dll/win32/comdlg32/printdlg.c trunk/reactos/dll/win32/comdlg32/rsrc.rc trunk/reactos/include/psdk/shobjidl.idl [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/comdlg32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/CMakeLi…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg.h?…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg32.…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Bg.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Bg…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Ca.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Ca…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Cn.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Cn…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Cs.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Cs…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Da.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Da…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_De.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_De…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_El.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_El…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_En.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_En…
Added: trunk/reactos/dll/win32/comdlg32/cdlg_Eo.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Eo…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Es.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Es…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Fi.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Fi…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Fr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Fr…
Added: trunk/reactos/dll/win32/comdlg32/cdlg_He.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_He…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Hu.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Hu…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_It.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_It…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Ja.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Ja…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Ko.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Ko…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Lt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Lt…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Nl.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Nl…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_No.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_No…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Pl.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Pl…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Pt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Pt…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Ro.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Ro…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Ru.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Ru…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Si.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Si…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Sk.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Sk…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Sr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Sr…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Sv.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Sv…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Th.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Th…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Tr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Tr…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Uk.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Uk…
Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Zh.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Zh…
Modified: trunk/reactos/dll/win32/comdlg32/comdlg32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/comdlg3…
Modified: trunk/reactos/dll/win32/comdlg32/comdlg32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/comdlg3…
Modified: trunk/reactos/dll/win32/comdlg32/filedlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
Modified: trunk/reactos/dll/win32/comdlg32/filedlg31.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
Modified: trunk/reactos/dll/win32/comdlg32/filedlg31.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
Modified: trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
Modified: trunk/reactos/dll/win32/comdlg32/filedlgbrowser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
Modified: trunk/reactos/dll/win32/comdlg32/finddlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/finddlg…
Modified: trunk/reactos/dll/win32/comdlg32/fontdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/fontdlg…
Added: trunk/reactos/dll/win32/comdlg32/itemdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/itemdlg…
Modified: trunk/reactos/dll/win32/comdlg32/printdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/printdl…
Modified: trunk/reactos/dll/win32/comdlg32/rsrc.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/rsrc.rc…
Modified: trunk/reactos/include/psdk/shobjidl.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/shobjidl.idl?…
12 years, 10 months
1
0
0
0
[ion] 55610: [CSRSRV]: Merge some initialization code from CSRSRV, including CsrParseServerCommandLine and CsrCreateSessionObjectDirectory. CsrSrvCreateSharedSection is now called correctly based o...
by ion@svn.reactos.org
Author: ion Date: Wed Feb 15 16:11:12 2012 New Revision: 55610 URL:
http://svn.reactos.org/svn/reactos?rev=55610&view=rev
Log: [CSRSRV]: Merge some initialization code from CSRSRV, including CsrParseServerCommandLine and CsrCreateSessionObjectDirectory. CsrSrvCreateSharedSection is now called correctly based on registry/command-line settings. Remove legacy functions that are no longer needed as a result. [CSRSRV]: Flatten out the initialization code instead of a table of initialization functions. [CSRSRV]: Make BasepFakeStaticServerData (our fake BaseSrv.DLL that's static inside CSRSRV for now) also create the BaseNamedObject Directory, along with the right ACLs and symbolic links, as well as the \Restricted sub-directory. Remove legacy function that was doing this before. Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c trunk/reactos/subsystems/win32/csrss/csrsrv/init.c trunk/reactos/subsystems/win32/csrss/csrsrv/procsup.c trunk/reactos/subsystems/win32/csrss/csrsrv/srv.h trunk/reactos/subsystems/win32/csrss/csrss.c Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c [iso-8859-1] Wed Feb 15 16:11:12 2012 @@ -149,14 +149,14 @@ ULONG ViewSize = 0; SYSTEM_BASIC_INFORMATION CsrNtSysInfo; PPEB Peb = NtCurrentPeb(); - + /* ReactOS Hackssss */ Status = NtQuerySystemInformation(SystemBasicInformation, &CsrNtSysInfo, sizeof(SYSTEM_BASIC_INFORMATION), NULL); ASSERT(NT_SUCCESS(Status)); - + /* Find the first comma, and null terminate */ while (*SizeValue) { @@ -170,18 +170,18 @@ SizeValue++; } } - + /* Make sure it's valid */ if (!*SizeValue) return STATUS_INVALID_PARAMETER; - + /* Convert it to an integer */ Status = RtlCharToInteger(SizeValue, 0, &Size); if (!NT_SUCCESS(Status)) return Status; - + /* Multiply by 1024 entries and round to page size */ CsrSrvSharedSectionSize = ROUND_UP(Size * 1024, CsrNtSysInfo.PageSize); DPRINT1("Size: %lx\n", CsrSrvSharedSectionSize); - + /* Create the Secion */ SectionSize.LowPart = CsrSrvSharedSectionSize; SectionSize.HighPart = 0; @@ -193,7 +193,7 @@ SEC_BASED | SEC_RESERVE, NULL); if (!NT_SUCCESS(Status)) return Status; - + /* Map the section */ Status = NtMapViewOfSection(CsrSrvSharedSection, NtCurrentProcess(), @@ -211,12 +211,12 @@ NtClose(CsrSrvSharedSection); return(Status); } - + /* FIXME: Write the value to registry */ - + /* The Heap is the same place as the Base */ CsrSrvSharedSectionHeap = CsrSrvSharedSectionBase; - + /* Create the heap */ if (!(RtlCreateHeap(HEAP_ZERO_MEMORY, CsrSrvSharedSectionHeap, @@ -231,18 +231,18 @@ NtClose(CsrSrvSharedSection); return STATUS_NO_MEMORY; } - + /* Now allocate space from the heap for the Shared Data */ CsrSrvSharedStaticServerData = RtlAllocateHeap(CsrSrvSharedSectionHeap, 0, 4 * // HAX CSR_SERVER_DLL_MAX * sizeof(PVOID)); - + /* Write the values to the PEB */ Peb->ReadOnlySharedMemoryBase = CsrSrvSharedSectionBase; Peb->ReadOnlySharedMemoryHeap = CsrSrvSharedSectionHeap; Peb->ReadOnlyStaticServerData = CsrSrvSharedStaticServerData; - + /* Return */ return STATUS_SUCCESS; } @@ -274,7 +274,7 @@ { NTSTATUS Status; ULONG ViewSize = 0; - + /* Check if we have a process */ if (CsrProcess) { @@ -298,17 +298,132 @@ } if (!NT_SUCCESS(Status)) return Status; } - + /* Write the values in the Connection Info structure */ ConnectInfo->SharedSectionBase = CsrSrvSharedSectionBase; ConnectInfo->SharedSectionHeap = CsrSrvSharedSectionHeap; ConnectInfo->SharedSectionData = CsrSrvSharedStaticServerData; - + /* Return success */ return STATUS_SUCCESS; } PBASE_STATIC_SERVER_DATA BaseStaticServerData; + +NTSTATUS +NTAPI +CreateBaseAcls(OUT PACL* Dacl, + OUT PACL* RestrictedDacl) +{ + PSID SystemSid, WorldSid, RestrictedSid; + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; + NTSTATUS Status; + UCHAR KeyValueBuffer[0x40]; + PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo; + UNICODE_STRING KeyName; + ULONG ProtectionMode = 0; + ULONG AclLength, ResultLength; + HANDLE hKey; + OBJECT_ATTRIBUTES ObjectAttributes; + + /* Open the Session Manager Key */ + RtlInitUnicodeString(&KeyName, SM_REG_KEY); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenKey(&hKey, KEY_READ, &ObjectAttributes); + if (NT_SUCCESS(Status)) + { + /* Read the key value */ + RtlInitUnicodeString(&KeyName, L"ProtectionMode"); + Status = NtQueryValueKey(hKey, + &KeyName, + KeyValuePartialInformation, + KeyValueBuffer, + sizeof(KeyValueBuffer), + &ResultLength); + + /* Make sure it's what we expect it to be */ + KeyValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyValueBuffer; + if ((NT_SUCCESS(Status)) && (KeyValuePartialInfo->Type == REG_DWORD) && + (*(PULONG)KeyValuePartialInfo->Data)) + { + /* Save the Protection Mode */ + ProtectionMode = *(PULONG)KeyValuePartialInfo->Data; + } + + /* Close the handle */ + NtClose(hKey); + } + + /* Allocate the System SID */ + Status = RtlAllocateAndInitializeSid(&NtAuthority, + 1, SECURITY_LOCAL_SYSTEM_RID, + 0, 0, 0, 0, 0, 0, 0, + &SystemSid); + ASSERT(NT_SUCCESS(Status)); + + /* Allocate the World SID */ + Status = RtlAllocateAndInitializeSid(&WorldAuthority, + 1, SECURITY_WORLD_RID, + 0, 0, 0, 0, 0, 0, 0, + &WorldSid); + ASSERT(NT_SUCCESS(Status)); + + /* Allocate the restricted SID */ + Status = RtlAllocateAndInitializeSid(&NtAuthority, + 1, SECURITY_RESTRICTED_CODE_RID, + 0, 0, 0, 0, 0, 0, 0, + &RestrictedSid); + ASSERT(NT_SUCCESS(Status)); + + /* Allocate one ACL with 3 ACEs each for one SID */ + AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + + RtlLengthSid(SystemSid) + + RtlLengthSid(RestrictedSid) + + RtlLengthSid(WorldSid); + *Dacl = RtlAllocateHeap(CsrHeap, 0, AclLength); + ASSERT(*Dacl != NULL); + + /* Set the correct header fields */ + Status = RtlCreateAcl(*Dacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); + + /* Give the appropriate rights to each SID */ + /* FIXME: Should check SessionId/ProtectionMode */ + Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_QUERY | DIRECTORY_TRAVERSE | DIRECTORY_CREATE_OBJECT | DIRECTORY_CREATE_SUBDIRECTORY | READ_CONTROL, WorldSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_ALL_ACCESS, SystemSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_TRAVERSE, RestrictedSid); + ASSERT(NT_SUCCESS(Status)); + + /* Now allocate the restricted DACL */ + *RestrictedDacl = RtlAllocateHeap(CsrHeap, 0, AclLength); + ASSERT(*RestrictedDacl != NULL); + + /* Initialize it */ + Status = RtlCreateAcl(*RestrictedDacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); + + /* And add the same ACEs as before */ + /* FIXME: Not really fully correct */ + Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_QUERY | DIRECTORY_TRAVERSE | DIRECTORY_CREATE_OBJECT | DIRECTORY_CREATE_SUBDIRECTORY | READ_CONTROL, WorldSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_ALL_ACCESS, SystemSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_TRAVERSE, RestrictedSid); + ASSERT(NT_SUCCESS(Status)); + + /* The SIDs are captured, can free them now */ + RtlFreeHeap(CsrHeap, 0, SystemSid); + RtlFreeHeap(CsrHeap, 0, WorldSid); + RtlFreeHeap(CsrHeap, 0, RestrictedSid); + return Status; +} VOID WINAPI @@ -323,6 +438,15 @@ UNICODE_STRING BaseSrvWindowsDirectory; UNICODE_STRING BaseSrvWindowsSystemDirectory; UNICODE_STRING BnoString; + OBJECT_ATTRIBUTES ObjectAttributes; + ULONG SessionId; + HANDLE BaseSrvNamedObjectDirectory; + HANDLE BaseSrvRestrictedObjectDirectory; + PACL BnoDacl, BnoRestrictedDacl; + PSECURITY_DESCRIPTOR BnoSd; + HANDLE SymHandle; + UNICODE_STRING DirectoryName, SymlinkName; + BOOLEAN LuidEnabled; RTL_QUERY_REGISTRY_TABLE BaseServerRegistryConfigurationTable[2] = { { @@ -334,37 +458,39 @@ {0} }; + /* Get the session ID */ + SessionId = NtCurrentPeb()->SessionId; + /* Get the Windows directory */ RtlInitEmptyUnicodeString(&SystemRootString, Buffer, sizeof(Buffer)); Status = RtlExpandEnvironmentStrings_U(NULL, &UnexpandedSystemRootString, &SystemRootString, NULL); - DPRINT1("Status: %lx. Root: %wZ\n", Status, &SystemRootString); - ASSERT(NT_SUCCESS(Status)); - + ASSERT(NT_SUCCESS(Status)); + /* Create the base directory */ Buffer[SystemRootString.Length / sizeof(WCHAR)] = UNICODE_NULL; Status = RtlCreateUnicodeString(&BaseSrvWindowsDirectory, SystemRootString.Buffer); ASSERT(NT_SUCCESS(Status)); - + /* Create the system directory */ wcscat(SystemRootString.Buffer, L"\\system32"); Status = RtlCreateUnicodeString(&BaseSrvWindowsSystemDirectory, SystemRootString.Buffer); ASSERT(NT_SUCCESS(Status)); - + /* FIXME: Check Session ID */ wcscpy(Buffer, L"\\BaseNamedObjects"); RtlInitUnicodeString(&BnoString, Buffer); - + /* Allocate the server data */ BaseStaticServerData = RtlAllocateHeap(CsrSrvSharedSectionHeap, HEAP_ZERO_MEMORY, sizeof(BASE_STATIC_SERVER_DATA)); ASSERT(BaseStaticServerData != NULL); - + /* Process timezone information */ BaseStaticServerData->TermsrvClientTimeZoneId = TIME_ZONE_ID_INVALID; BaseStaticServerData->TermsrvClientTimeZoneChangeNum = 0; @@ -373,7 +499,7 @@ sizeof(BaseStaticServerData->TimeOfDay), NULL); ASSERT(NT_SUCCESS(Status)); - + /* Make a shared heap copy of the Windows directory */ BaseStaticServerData->WindowsDirectory = BaseSrvWindowsDirectory; HeapBuffer = RtlAllocateHeap(CsrSrvSharedSectionHeap, @@ -384,7 +510,7 @@ BaseStaticServerData->WindowsDirectory.Buffer, BaseSrvWindowsDirectory.MaximumLength); BaseStaticServerData->WindowsDirectory.Buffer = HeapBuffer; - + /* Make a shared heap copy of the System directory */ BaseStaticServerData->WindowsSystemDirectory = BaseSrvWindowsSystemDirectory; HeapBuffer = RtlAllocateHeap(CsrSrvSharedSectionHeap, @@ -395,12 +521,12 @@ BaseStaticServerData->WindowsSystemDirectory.Buffer, BaseSrvWindowsSystemDirectory.MaximumLength); BaseStaticServerData->WindowsSystemDirectory.Buffer = HeapBuffer; - + /* This string is not used */ RtlInitEmptyUnicodeString(&BaseStaticServerData->WindowsSys32x86Directory, NULL, 0); - + /* Make a shared heap copy of the BNO directory */ BaseStaticServerData->NamedObjectDirectory = BnoString; BaseStaticServerData->NamedObjectDirectory.MaximumLength = BnoString.Length + @@ -413,7 +539,7 @@ BaseStaticServerData->NamedObjectDirectory.Buffer, BaseStaticServerData->NamedObjectDirectory.MaximumLength); BaseStaticServerData->NamedObjectDirectory.Buffer = HeapBuffer; - + /* * Confirmed that in Windows, CSDNumber and RCNumber are actually Length * and MaximumLength of the CSD String, since the same UNICODE_STRING is @@ -424,7 +550,7 @@ */ BaseStaticServerData->CSDNumber = 0; BaseStaticServerData->RCNumber = 0; - + /* Initialize the CSD string and query its value from the registry */ RtlInitEmptyUnicodeString(&BaseSrvCSDString, Buffer, sizeof(Buffer)); Status = RtlQueryRegistryValues(RTL_REGISTRY_WINDOWS_NT, @@ -444,21 +570,121 @@ /* NULL-terminate to indicate nothing is there */ BaseStaticServerData->CSDVersion[0] = UNICODE_NULL; } - + /* Cache the system information */ Status = NtQuerySystemInformation(SystemBasicInformation, &BaseStaticServerData->SysInfo, sizeof(BaseStaticServerData->SysInfo), NULL); ASSERT(NT_SUCCESS(Status)); - + /* FIXME: Should query the registry for these */ BaseStaticServerData->DefaultSeparateVDM = FALSE; BaseStaticServerData->IsWowTaskReady = FALSE; - BaseStaticServerData->LUIDDeviceMapsEnabled = FALSE; - - /* FIXME: Symlinks */ + + /* Allocate a security descriptor and create it */ + BnoSd = RtlAllocateHeap(CsrHeap, 0, 1024); + ASSERT(BnoSd); + Status = RtlCreateSecurityDescriptor(BnoSd, SECURITY_DESCRIPTOR_REVISION); + ASSERT(NT_SUCCESS(Status)); + /* Create the BNO and \Restricted DACLs */ + Status = CreateBaseAcls(&BnoDacl, &BnoRestrictedDacl); + ASSERT(NT_SUCCESS(Status)); + + /* Set the BNO DACL as active for now */ + Status = RtlSetDaclSecurityDescriptor(BnoSd, TRUE, BnoDacl, FALSE); + ASSERT(NT_SUCCESS(Status)); + + /* Create the BNO directory */ + RtlInitUnicodeString(&BnoString, L"\\BaseNamedObjects"); + InitializeObjectAttributes(&ObjectAttributes, + &BnoString, + OBJ_OPENIF | OBJ_PERMANENT | OBJ_CASE_INSENSITIVE, + NULL, + BnoSd); + Status = NtCreateDirectoryObject(&BaseSrvNamedObjectDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + ASSERT(NT_SUCCESS(Status)); + + /* Check if we are session 0 */ + if (!SessionId) + { + /* Mark this as a session 0 directory */ + Status = NtSetInformationObject(BaseSrvNamedObjectDirectory, + ObjectSessionInformation, + NULL, + 0); + ASSERT(NT_SUCCESS(Status)); + } + + /* Check if LUID device maps are enabled */ + NtQueryInformationProcess(NtCurrentProcess(), + ProcessLUIDDeviceMapsEnabled, + &LuidEnabled, + sizeof(LuidEnabled), + NULL); + BaseStaticServerData->LUIDDeviceMapsEnabled = LuidEnabled; + if (!BaseStaticServerData->LUIDDeviceMapsEnabled) + { + /* Make Global point back to BNO */ + RtlInitUnicodeString(&DirectoryName, L"Global"); + RtlInitUnicodeString(&SymlinkName, L"\\BaseNamedObjects"); + InitializeObjectAttributes(&ObjectAttributes, + &DirectoryName, + OBJ_OPENIF | OBJ_PERMANENT | OBJ_CASE_INSENSITIVE, + BaseSrvNamedObjectDirectory, + BnoSd); + Status = NtCreateSymbolicLinkObject(&SymHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &SymlinkName); + if ((NT_SUCCESS(Status)) && !(SessionId)) NtClose(SymHandle); + + /* Make local point back to \Sessions\x\BNO */ + RtlInitUnicodeString(&DirectoryName, L"Local"); + RtlInitUnicodeString(&SymlinkName, Buffer); + InitializeObjectAttributes(&ObjectAttributes, + &DirectoryName, + OBJ_OPENIF | OBJ_PERMANENT | OBJ_CASE_INSENSITIVE, + BaseSrvNamedObjectDirectory, + BnoSd); + Status = NtCreateSymbolicLinkObject(&SymHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &SymlinkName); + if ((NT_SUCCESS(Status)) && !(SessionId)) NtClose(SymHandle); + + /* Make Session point back to BNOLINKS */ + RtlInitUnicodeString(&DirectoryName, L"Session"); + RtlInitUnicodeString(&SymlinkName, L"\\Sessions\\BNOLINKS"); + InitializeObjectAttributes(&ObjectAttributes, + &DirectoryName, + OBJ_OPENIF | OBJ_PERMANENT | OBJ_CASE_INSENSITIVE, + BaseSrvNamedObjectDirectory, + BnoSd); + Status = NtCreateSymbolicLinkObject(&SymHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &SymlinkName); + if ((NT_SUCCESS(Status)) && !(SessionId)) NtClose(SymHandle); + + /* Create the BNO\Restricted directory and set the restricted DACL */ + RtlInitUnicodeString(&DirectoryName, L"Restricted"); + Status = RtlSetDaclSecurityDescriptor(BnoSd, TRUE, BnoRestrictedDacl, FALSE); + ASSERT(NT_SUCCESS(Status)); + InitializeObjectAttributes(&ObjectAttributes, + &DirectoryName, + OBJ_OPENIF | OBJ_PERMANENT | OBJ_CASE_INSENSITIVE, + BaseSrvNamedObjectDirectory, + BnoSd); + Status = NtCreateDirectoryObject(&BaseSrvRestrictedObjectDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + ASSERT(NT_SUCCESS(Status)); + } + /* Finally, set the pointer */ CsrSrvSharedStaticServerData[CSR_CONSOLE] = BaseStaticServerData; } @@ -480,11 +706,11 @@ DPRINT("CSR: %s: Handling: %p\n", __FUNCTION__, Request); ConnectInfo = (PCSR_CONNECTION_INFO)(Request + 1); - + /* Save the process ID */ RtlZeroMemory(ConnectInfo, sizeof(CSR_CONNECTION_INFO)); ConnectInfo->ProcessId = NtCurrentTeb()->ClientId.UniqueProcess; - + ProcessData = CsrGetProcessData(Request->ClientId.UniqueProcess); if (ProcessData == NULL) { @@ -495,11 +721,11 @@ Request->ClientId.UniqueProcess); } } - + if (ProcessData->Process == NULL) { OBJECT_ATTRIBUTES ObjectAttributes; - + InitializeObjectAttributes(&ObjectAttributes, NULL, 0, @@ -513,7 +739,7 @@ &Request->ClientId); DPRINT1("Status: %lx. Handle: %lx\n", Status, ProcessData->Process); } - + if (ProcessData) { /* Attach the Shared Section */ @@ -528,7 +754,7 @@ DPRINT1("Shared section map failed: %lx\n", Status); } } - + Status = NtAcceptConnectPort(&ServerPort, NULL, Request, @@ -567,9 +793,9 @@ DPRINT1("CSR: Unable to create server thread\n"); return Status; } - + CsrAddStaticServerThread(ServerThread, &ClientId, 0); - + NtResumeThread(ServerThread, NULL); NtClose(ServerThread); @@ -638,7 +864,7 @@ PCSR_THREAD ServerThread; DPRINT("CSR: %s called\n", __FUNCTION__); - + /* Connect to user32 */ while (!CsrConnectToUser()) { @@ -732,11 +958,11 @@ { PCSR_THREAD Thread; PCSRSS_PROCESS_DATA Process = NULL; - + //DPRINT1("locate thread %lx/%lx\n", Request->Header.ClientId.UniqueProcess, Request->Header.ClientId.UniqueThread); Thread = CsrLocateThreadByClientId(&Process, &Request->Header.ClientId); //DPRINT1("Thread found: %p %p\n", Thread, Process); - + /* Call the Handler */ if (Thread) NtCurrentTeb()->CsrClientThread = Thread; CsrApiCallHandler(ProcessData, Request); @@ -835,7 +1061,7 @@ DPRINT1("CSR: SMSS died\n"); Reply = NULL; break; - + default: DPRINT1("CSR: %s received message (type=%d)\n", __FUNCTION__, Request.h.u2.s2.Type); Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/init.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/init.c [iso-8859-1] Wed Feb 15 16:11:12 2012 @@ -24,6 +24,13 @@ HANDLE hBootstrapOk = (HANDLE) 0; HANDLE hSmApiPort = (HANDLE) 0; HANDLE hApiPort = (HANDLE) 0; +ULONG CsrDebug = 0xFFFFFFFF; +ULONG CsrMaxApiRequestThreads; +ULONG CsrTotalPerProcessDataLength; +ULONG SessionId; +HANDLE BNOLinksDirectory; +HANDLE SessionObjectDirectory; +HANDLE DosDevicesDirectory; /* PRIVATE FUNCTIONS **********************************************************/ @@ -119,38 +126,6 @@ Status = (*ServerProcs[i].ProcessDeletedProc)(ProcessData); return Status; -} - - -ULONG -InitializeVideoAddressSpace(VOID); - -/********************************************************************** - * CsrpCreateObjectDirectory/3 - */ -static NTSTATUS -CsrpCreateObjectDirectory (int argc, char ** argv, char ** envp) -{ - NTSTATUS Status; - OBJECT_ATTRIBUTES Attributes; - - DPRINT("CSR: %s called\n", __FUNCTION__); - - - /* create object directory ('\Windows') */ - RtlCreateUnicodeString (&CsrDirectoryName, - L"\\Windows"); - - InitializeObjectAttributes (&Attributes, - &CsrDirectoryName, - OBJ_OPENIF, - NULL, - NULL); - - Status = NtOpenDirectoryObject(&CsrObjectDirectory, - DIRECTORY_ALL_ACCESS, - &Attributes); - return Status; } /********************************************************************** @@ -166,7 +141,7 @@ * TODO: DWORD ServerId) */ static NTSTATUS -CsrpInitWin32Csr (int argc, char ** argv, char ** envp) +CsrpInitWin32Csr (VOID) { NTSTATUS Status; UNICODE_STRING DllName; @@ -271,74 +246,6 @@ /* === INIT ROUTINES === */ -/********************************************************************** - * CsrpCreateBNODirectory/3 - * - * These used to be part of kernel32 startup, but that clearly wasn't a good - * idea, as races were definately possible. These are moved (as in the - * previous fixmes). - */ -static NTSTATUS -CsrpCreateBNODirectory (int argc, char ** argv, char ** envp) -{ - NTSTATUS Status; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING Name = RTL_CONSTANT_STRING(L"\\BaseNamedObjects"); - UNICODE_STRING SymName = RTL_CONSTANT_STRING(L"Local"); - UNICODE_STRING SymName2 = RTL_CONSTANT_STRING(L"Global"); - HANDLE DirHandle, SymHandle; - - /* Seems like a good place to create these objects which are needed by - * win32 processes */ - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtCreateDirectoryObject(&DirHandle, - DIRECTORY_ALL_ACCESS, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtCreateDirectoryObject() failed %08x\n", Status); - } - - /* Create the "local" Symbolic Link. - * FIXME: CSR should do this -- Fixed */ - InitializeObjectAttributes(&ObjectAttributes, - &SymName, - OBJ_CASE_INSENSITIVE, - DirHandle, - NULL); - Status = NtCreateSymbolicLinkObject(&SymHandle, - SYMBOLIC_LINK_ALL_ACCESS, - &ObjectAttributes, - &Name); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtCreateDirectoryObject() failed %08x\n", Status); - } - - /* Create the "global" Symbolic Link. */ - InitializeObjectAttributes(&ObjectAttributes, - &SymName2, - OBJ_CASE_INSENSITIVE, - DirHandle, - NULL); - Status = NtCreateSymbolicLinkObject(&SymHandle, - SYMBOLIC_LINK_ALL_ACCESS, - &ObjectAttributes, - &Name); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtCreateDirectoryObject() failed %08x\n", Status); - } - - return Status; -} - - VOID WINAPI BasepFakeStaticServerData(VOID); @@ -351,12 +258,11 @@ * CsrpCreateHeap/3 */ static NTSTATUS -CsrpCreateHeap (int argc, char ** argv, char ** envp) -{ - CHAR Value[] = "1024,3072,512"; - NTSTATUS Status; +CsrpCreateHeap (VOID) +{ DPRINT("CSR: %s called\n", __FUNCTION__); + CsrHeap = RtlGetProcessHeap(); CsrssApiHeap = RtlCreateHeap(HEAP_GROWABLE, NULL, 65536, @@ -368,29 +274,7 @@ return STATUS_UNSUCCESSFUL; } - - Status = CsrSrvCreateSharedSection(Value); - if (Status != STATUS_SUCCESS) - { - DPRINT1("CsrSrvCreateSharedSection failed with status 0x%08lx\n", Status); - ASSERT(FALSE); - } - - BasepFakeStaticServerData(); return STATUS_SUCCESS; -} - -/********************************************************************** - * CsrpCreateCallbackPort/3 - */ -static NTSTATUS -CsrpCreateCallbackPort (int argc, char ** argv, char ** envp) -{ - DPRINT("CSR: %s called\n", __FUNCTION__); - - return CsrpCreateListenPort (L"\\Windows\\SbApiPort", - & hSbApiPort, - ServerSbApiPortThread); } /********************************************************************** @@ -398,7 +282,7 @@ */ BOOLEAN g_ModernSm; static NTSTATUS -CsrpRegisterSubsystem (int argc, char ** argv, char ** envp) +CsrpRegisterSubsystem (VOID) { NTSTATUS Status = STATUS_SUCCESS; OBJECT_ATTRIBUTES BootstrapOkAttributes; @@ -460,52 +344,559 @@ return Status; } -/********************************************************************** - * CsrpCreateApiPort/2 - */ -static NTSTATUS -CsrpCreateApiPort (int argc, char ** argv, char ** envp) -{ - DPRINT("CSR: %s called\n", __FUNCTION__); - - CsrInitProcessData(); - - return CsrpCreateListenPort(L"\\Windows\\ApiPort", &hApiPort, - (PTHREAD_START_ROUTINE)ClientConnectionThread); -} - -/********************************************************************** - * CsrpApiRegisterDef/0 - */ -static NTSTATUS -CsrpApiRegisterDef (int argc, char ** argv, char ** envp) -{ - return CsrApiRegisterDefinitions(NativeDefinitions); -} - -static NTSTATUS -CsrpCreateHardErrorPort (int argc, char ** argv, char ** envp) -{ - return NtSetDefaultHardErrorPort(hApiPort); -} - -typedef NTSTATUS (* CSR_INIT_ROUTINE)(int,char**,char**); - -struct { - BOOL Required; - CSR_INIT_ROUTINE EntryPoint; - PCHAR ErrorMessage; -} InitRoutine [] = { - {TRUE, CsrpCreateBNODirectory, "create base named objects directory"}, - {TRUE, CsrpCreateHeap, "create the CSR heap"}, - {TRUE, CsrpCreateApiPort, "create the api port \\Windows\\ApiPort"}, - {TRUE, CsrpCreateHardErrorPort, "create the hard error port"}, - {TRUE, CsrpCreateObjectDirectory,"create the object directory \\Windows"}, - {TRUE, CsrpApiRegisterDef, "initialize api definitions"}, - {TRUE, CsrpInitWin32Csr, "load usermode dll"}, - {TRUE, CsrpCreateCallbackPort, "create the callback port \\Windows\\SbApiPort"}, - {TRUE, CsrpRegisterSubsystem, "register with SM"}, -}; +/*++ + * @name CsrSetDirectorySecurity + * + * The CsrSetDirectorySecurity routine sets the security descriptor for the + * specified Object Directory. + * + * @param ObjectDirectory + * Handle fo the Object Directory to protect. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL + * othwerwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSetDirectorySecurity(IN HANDLE ObjectDirectory) +{ + /* FIXME: Implement */ + return STATUS_SUCCESS; +} + +/*++ + * @name GetDosDevicesProtection + * + * The GetDosDevicesProtection creates a security descriptor for the DOS Devices + * Object Directory. + * + * @param DosDevicesSd + * Pointer to the Security Descriptor to return. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL + * othwerwise. + * + * @remarks Depending on the DOS Devices Protection Mode (set in the registry), + * regular users may or may not have full access to the directory. + * + *--*/ +NTSTATUS +NTAPI +GetDosDevicesProtection(OUT PSECURITY_DESCRIPTOR DosDevicesSd) +{ + SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; + SID_IDENTIFIER_AUTHORITY CreatorAuthority = {SECURITY_CREATOR_SID_AUTHORITY}; + SID_IDENTIFIER_AUTHORITY NtSidAuthority = {SECURITY_NT_AUTHORITY}; + PSID WorldSid, CreatorSid, AdminSid, SystemSid; + UCHAR KeyValueBuffer[0x40]; + PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo; + UNICODE_STRING KeyName; + ULONG ProtectionMode = 0; + OBJECT_ATTRIBUTES ObjectAttributes; + PACL Dacl; + PACCESS_ALLOWED_ACE Ace; + HANDLE hKey; + NTSTATUS Status; + ULONG ResultLength, SidLength, AclLength; + + /* Create the SD */ + Status = RtlCreateSecurityDescriptor(DosDevicesSd, SECURITY_DESCRIPTOR_REVISION); + ASSERT(NT_SUCCESS(Status)); + + /* Initialize the System SID */ + Status = RtlAllocateAndInitializeSid(&NtSidAuthority, 1, + SECURITY_LOCAL_SYSTEM_RID, + 0, 0, 0, 0, 0, 0, 0, + &SystemSid); + ASSERT(NT_SUCCESS(Status)); + + /* Initialize the World SID */ + Status = RtlAllocateAndInitializeSid(&WorldAuthority, 1, + SECURITY_WORLD_RID, + 0, 0, 0, 0, 0, 0, 0, + &WorldSid); + ASSERT(NT_SUCCESS(Status)); + + /* Initialize the Admin SID */ + Status = RtlAllocateAndInitializeSid(&NtSidAuthority, 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, + &AdminSid); + ASSERT(NT_SUCCESS(Status)); + + /* Initialize the Creator SID */ + Status = RtlAllocateAndInitializeSid(&CreatorAuthority, 1, + SECURITY_CREATOR_OWNER_RID, + 0, 0, 0, 0, 0, 0, 0, + &CreatorSid); + ASSERT(NT_SUCCESS(Status)); + + /* Open the Session Manager Key */ + RtlInitUnicodeString(&KeyName, SM_REG_KEY); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenKey(&hKey, KEY_READ, &ObjectAttributes); + if (NT_SUCCESS(Status)) + { + /* Read the key value */ + RtlInitUnicodeString(&KeyName, L"ProtectionMode"); + Status = NtQueryValueKey(hKey, + &KeyName, + KeyValuePartialInformation, + KeyValueBuffer, + sizeof(KeyValueBuffer), + &ResultLength); + + /* Make sure it's what we expect it to be */ + KeyValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyValueBuffer; + if ((NT_SUCCESS(Status)) && (KeyValuePartialInfo->Type == REG_DWORD) && + (*(PULONG)KeyValuePartialInfo->Data)) + { + /* Save the Protection Mode */ + ProtectionMode = *(PULONG)KeyValuePartialInfo->Data; + } + + /* Close the handle */ + NtClose(hKey); + } + + /* Check the Protection Mode */ + if (ProtectionMode & 3) + { + /* Calculate SID Lengths */ + SidLength = RtlLengthSid(CreatorSid) + RtlLengthSid(SystemSid) + + RtlLengthSid(AdminSid); + AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + SidLength; + + /* Allocate memory for the DACL */ + Dacl = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, AclLength); + ASSERT(Dacl != NULL); + + /* Build the ACL and add 3 ACEs */ + Status = RtlCreateAcl(Dacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, SystemSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, AdminSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, CreatorSid); + ASSERT(NT_SUCCESS(Status)); + + /* Edit the ACEs to make them inheritable */ + Status = RtlGetAce(Dacl, 0, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); + Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + Status = RtlGetAce(Dacl, 1, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); + Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); + Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE; + + /* Set this DACL with the SD */ + Status = RtlSetDaclSecurityDescriptor(DosDevicesSd, TRUE, Dacl, FALSE); + ASSERT(NT_SUCCESS(Status)); + goto Quickie; + } + else + { + /* Calculate SID Lengths */ + SidLength = RtlLengthSid(WorldSid) + RtlLengthSid(SystemSid); + AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + SidLength; + + /* Allocate memory for the DACL */ + Dacl = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, AclLength); + ASSERT(Dacl != NULL); + + /* Build the ACL and add 3 ACEs */ + Status = RtlCreateAcl(Dacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE, WorldSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, SystemSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, WorldSid); + ASSERT(NT_SUCCESS(Status)); + + /* Edit the last ACE to make it inheritable */ + Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); + Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE; + + /* Set this DACL with the SD */ + Status = RtlSetDaclSecurityDescriptor(DosDevicesSd, TRUE, Dacl, FALSE); + ASSERT(NT_SUCCESS(Status)); + goto Quickie; + } + +/* FIXME: failure cases! Fail: */ + /* Free the memory */ + RtlFreeHeap(CsrHeap, 0, Dacl); + +/* FIXME: semi-failure cases! Quickie: */ +Quickie: + /* Free the SIDs */ + RtlFreeSid(SystemSid); + RtlFreeSid(WorldSid); + RtlFreeSid(AdminSid); + RtlFreeSid(CreatorSid); + + /* Return */ + return Status; +} + +/*++ + * @name FreeDosDevicesProtection + * + * The FreeDosDevicesProtection frees the security descriptor that was created + * by GetDosDevicesProtection + * + * @param DosDevicesSd + * Pointer to the security descriptor to free. + + * @return None. + * + * @remarks None. + * + *--*/ +VOID +NTAPI +FreeDosDevicesProtection(IN PSECURITY_DESCRIPTOR DosDevicesSd) +{ + PACL Dacl; + BOOLEAN Present, Default; + NTSTATUS Status; + + /* Get the DACL corresponding to this SD */ + Status = RtlGetDaclSecurityDescriptor(DosDevicesSd, &Present, &Dacl, &Default); + ASSERT(NT_SUCCESS(Status)); + ASSERT(Present); + ASSERT(Dacl != NULL); + + /* Free it */ + if ((NT_SUCCESS(Status)) && (Dacl)) RtlFreeHeap(CsrHeap, 0, Dacl); +} + +/*++ + * @name CsrCreateSessionObjectDirectory + * + * The CsrCreateSessionObjectDirectory routine creates the BaseNamedObjects, + * Session and Dos Devices directories for the specified session. + * + * @param Session + * Session ID for which to create the directories. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL + * othwerwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrCreateSessionObjectDirectory(IN ULONG Session) +{ + WCHAR SessionBuffer[512], BnoBuffer[512]; + UNICODE_STRING SessionString, BnoString; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE BnoHandle; + SECURITY_DESCRIPTOR DosDevicesSd; + NTSTATUS Status; + + /* Generate the Session BNOLINKS Directory name */ + swprintf(SessionBuffer, L"%ws\\BNOLINKS", SESSION_ROOT); + RtlInitUnicodeString(&SessionString, SessionBuffer); + + /* Create it */ + InitializeObjectAttributes(&ObjectAttributes, + &SessionString, + OBJ_OPENIF | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtCreateDirectoryObject(&BNOLinksDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: NtCreateDirectoryObject failed in " + "CsrCreateSessionObjectDirectory - status = %lx\n", Status); + return Status; + } + + /* Now add the Session ID */ + swprintf(SessionBuffer, L"%ld", Session); + RtlInitUnicodeString(&SessionString, SessionBuffer); + + /* Check if this is the first Session */ + if (Session) + { + /* Not the first, so the name will be slighly more complex */ + swprintf(BnoBuffer, L"%ws\\%ld\\BaseNamedObjects", SESSION_ROOT, Session); + RtlInitUnicodeString(&BnoString, BnoBuffer); + } + else + { + /* Use the direct name */ + RtlInitUnicodeString(&BnoString, L"\\BaseNamedObjects"); + } + + /* Create the symlink */ + InitializeObjectAttributes(&ObjectAttributes, + &SessionString, + OBJ_OPENIF | OBJ_CASE_INSENSITIVE, + BNOLinksDirectory, + NULL); + Status = NtCreateSymbolicLinkObject(&BnoHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &BnoString); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: NtCreateSymbolicLinkObject failed in " + "CsrCreateSessionObjectDirectory - status = %lx\n", Status); + return Status; + } + + /* Create the \DosDevices Security Descriptor */ + Status = GetDosDevicesProtection(&DosDevicesSd); + if (!NT_SUCCESS(Status)) return Status; + + /* Now create a directory for this session */ + swprintf(SessionBuffer, L"%ws\\%ld", SESSION_ROOT, Session); + RtlInitUnicodeString(&SessionString, SessionBuffer); + + /* Create the directory */ + InitializeObjectAttributes(&ObjectAttributes, + &SessionString, + OBJ_OPENIF | OBJ_CASE_INSENSITIVE, + 0, + &DosDevicesSd); + Status = NtCreateDirectoryObject(&SessionObjectDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: NtCreateDirectoryObject failed in " + "CsrCreateSessionObjectDirectory - status = %lx\n", Status); + FreeDosDevicesProtection(&DosDevicesSd); + return Status; + } + + /* Next, create a directory for this session's DOS Devices */ + RtlInitUnicodeString(&SessionString, L"DosDevices"); + InitializeObjectAttributes(&ObjectAttributes, + &SessionString, + OBJ_CASE_INSENSITIVE, + SessionObjectDirectory, + &DosDevicesSd); + Status = NtCreateDirectoryObject(&DosDevicesDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: NtCreateDirectoryObject failed in " + "CsrCreateSessionObjectDirectory - status = %lx\n", Status); + } + + /* Release the Security Descriptor */ + FreeDosDevicesProtection(&DosDevicesSd); + + /* Return */ + return Status; +} + +/*++ + * @name CsrParseServerCommandLine + * + * The CsrParseServerCommandLine routine parses the CSRSS command-line in the + * registry and performs operations for each entry found. + * + * @param ArgumentCount + * Number of arguments on the command line. + * + * @param Arguments + * Array of arguments. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL + * othwerwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +FASTCALL +CsrParseServerCommandLine(IN ULONG ArgumentCount, + IN PCHAR Arguments[]) +{ + NTSTATUS Status; + PCHAR ParameterName = NULL, ParameterValue = NULL, EntryPoint, ServerString; + ULONG i, DllIndex; + ANSI_STRING AnsiString; + OBJECT_ATTRIBUTES ObjectAttributes; + + /* Set the Defaults */ + CsrTotalPerProcessDataLength = 0; + CsrObjectDirectory = NULL; + CsrMaxApiRequestThreads = 16; + + /* Save our Session ID, and create a Directory for it */ + SessionId = NtCurrentPeb()->SessionId; + Status = CsrCreateSessionObjectDirectory(SessionId); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: CsrCreateSessionObjectDirectory failed (%lx)\n", + Status); + + /* It's not fatal if the session ID isn't zero */ + if (SessionId) return Status; + ASSERT(NT_SUCCESS(Status)); + } + + /* Loop through every argument */ + for (i = 1; i < ArgumentCount; i++) + { + /* Split Name and Value */ + ParameterName = Arguments[i]; + DPRINT1("Name: %s\n", ParameterName); + ParameterValue = NULL; + ParameterValue = strchr(ParameterName, '='); + if (ParameterValue) *ParameterValue++ = ANSI_NULL; + DPRINT1("Name=%s, Value=%s\n", ParameterName, ParameterValue); + + /* Check for Object Directory */ + if (!_stricmp(ParameterName, "ObjectDirectory")) + { + /* Check if a session ID is specified */ + if (SessionId) + { + DPRINT1("Sessions not yet implemented\n"); + ASSERT(SessionId); + } + + /* Initialize the directory name */ + RtlInitAnsiString(&AnsiString, ParameterValue); + Status = RtlAnsiStringToUnicodeString(&CsrDirectoryName, + &AnsiString, + TRUE); + ASSERT(NT_SUCCESS(Status) || SessionId != 0); + if (!NT_SUCCESS(Status)) return Status; + + /* Create it */ + InitializeObjectAttributes(&ObjectAttributes, + &CsrDirectoryName, + OBJ_OPENIF | OBJ_CASE_INSENSITIVE | OBJ_PERMANENT, + NULL, + NULL); + Status = NtCreateDirectoryObject(&CsrObjectDirectory, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) return Status; + + /* Secure it */ + Status = CsrSetDirectorySecurity(CsrObjectDirectory); + if (!NT_SUCCESS(Status)) return Status; + } + else if (!_stricmp(ParameterName, "SubSystemType")) + { + /* Ignored */ + } + else if (!_stricmp(ParameterName, "MaxRequestThreads")) + { + Status = RtlCharToInteger(ParameterValue, + 0, + &CsrMaxApiRequestThreads); + } + else if (!_stricmp(ParameterName, "RequestThreads")) + { + /* Ignored */ + Status = STATUS_SUCCESS; + } + else if (!_stricmp(ParameterName, "ProfileControl")) + { + /* Ignored */ + } + else if (!_stricmp(ParameterName, "SharedSection")) + { + /* Create the Section */ + Status = CsrSrvCreateSharedSection(ParameterValue); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: *** Invalid syntax for %s=%s (Status == %X)\n", + ParameterName, ParameterValue, Status); + return Status; + } + + /* Load us */ + BasepFakeStaticServerData(); + #if 0 + Status = CsrLoadServerDll("CSRSS", NULL, CSR_SRV_SERVER); + #endif + } + else if (!_stricmp(ParameterName, "ServerDLL")) + { + /* Loop the command line */ + EntryPoint = NULL; + Status = STATUS_INVALID_PARAMETER; + ServerString = ParameterValue; + while (*ServerString) + { + /* Check for the Entry Point */ + if ((*ServerString == ':') && (!EntryPoint)) + { + /* Found it. Add a nullchar and save it */ + *ServerString++ = ANSI_NULL; + EntryPoint = ServerString; + } + + /* Check for the Dll Index */ + if (*ServerString++ == ',') break; + } + + /* Did we find something to load? */ + if (!*ServerString) + { + DPRINT1("CSRSS: *** Invalid syntax for ServerDll=%s (Status == %X)\n", + ParameterValue, Status); + return Status; + } + + /* Convert it to a ULONG */ + Status = RtlCharToInteger(ServerString, 10, &DllIndex); + + /* Add a null char if it was valid */ + if (NT_SUCCESS(Status)) ServerString[-1] = ANSI_NULL; + + /* Load it */ + if (CsrDebug & 1) DPRINT1("CSRSS: Should be loading ServerDll=%s:%s\n", ParameterValue, EntryPoint); + Status = STATUS_SUCCESS; + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: *** Failed loading ServerDll=%s (Status == 0x%x)\n", + ParameterValue, Status); + return Status; + } + } + else if (!_stricmp(ParameterName, "Windows")) + { + /* Ignored */ + } + else + { + /* Invalid parameter on the command line */ + Status = STATUS_INVALID_PARAMETER; + } + } + + /* Return status */ + return Status; +} /* PUBLIC FUNCTIONS ***********************************************************/ @@ -514,26 +905,63 @@ CsrServerInitialization(ULONG ArgumentCount, PCHAR Arguments[]) { - UINT i = 0; NTSTATUS Status = STATUS_SUCCESS; DPRINT("CSR: %s called\n", __FUNCTION__); - for (i=0; i < (sizeof InitRoutine / sizeof InitRoutine[0]); i++) - { - Status = InitRoutine[i].EntryPoint(ArgumentCount,Arguments,NULL); - if(!NT_SUCCESS(Status)) - { - DPRINT1("CSR: %s: failed to %s (Status=%08lx)\n", - __FUNCTION__, - InitRoutine[i].ErrorMessage, - Status); - if (InitRoutine[i].Required) - { - return FALSE; - } - } - } + Status = CsrpCreateHeap(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpCreateHeap", Status); + } + + /* Parse the command line */ + Status = CsrParseServerCommandLine(ArgumentCount, Arguments); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV:%s: CsrParseServerCommandLine failed (Status=%08lx)\n", + __FUNCTION__, Status); + return Status; + } + + CsrInitProcessData(); + + Status = CsrpCreateListenPort(L"\\Windows\\ApiPort", &hApiPort, (PTHREAD_START_ROUTINE)ClientConnectionThread); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpCreateApiPort", Status); + } + + Status = CsrApiRegisterDefinitions(NativeDefinitions); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrApiRegisterDefinitions", Status); + } + + Status = CsrpInitWin32Csr(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpInitWin32Csr", Status); + } + + Status = CsrpCreateListenPort(L"\\Windows\\SbApiPort", &hSbApiPort, ServerSbApiPortThread); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpCreateCallbackPort", Status); + } + + Status = CsrpRegisterSubsystem(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpRegisterSubsystem", Status); + } + + Status = NtSetDefaultHardErrorPort(hApiPort); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSRV failed in %s with status %lx\n", "CsrpCreateHardErrorPort", Status); + } + if (CallInitComplete()) { return STATUS_SUCCESS; Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/procsup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/procsup.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/procsup.c [iso-8859-1] Wed Feb 15 16:11:12 2012 @@ -16,7 +16,6 @@ #define LOCK RtlEnterCriticalSection(&ProcessDataLock) #define UNLOCK RtlLeaveCriticalSection(&ProcessDataLock) -#define CsrHeap RtlGetProcessHeap() #define CsrAcquireProcessLock() LOCK #define CsrReleaseProcessLock() UNLOCK Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/srv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/srv.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/srv.h [iso-8859-1] Wed Feb 15 16:11:12 2012 @@ -4,16 +4,7 @@ #define WIN32_NO_STATUS #include <windows.h> #include <winnt.h> -#include <ndk/exfuncs.h> -#include <ndk/iofuncs.h> -#include <ndk/kefuncs.h> -#include <ndk/lpcfuncs.h> -#include <ndk/ldrfuncs.h> -#include <ndk/mmfuncs.h> -#include <ndk/obfuncs.h> -#include <ndk/setypes.h> -#include <ndk/sefuncs.h> -#include <ndk/umfuncs.h> +#include <ndk/ntndk.h> /* CSR Header */ //#include <csr/server.h> @@ -29,6 +20,18 @@ #include <api.h> #include <csrplugin.h> +extern HANDLE CsrHeap; + +#define SM_REG_KEY \ + L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Session Manager" + +#define SESSION_ROOT L"\\Sessions" +#define GLOBAL_ROOT L"\\GLOBAL??" +#define SYMLINK_NAME L"SymbolicLink" +#define SB_PORT_NAME L"SbAbiPort" +#define CSR_PORT_NAME L"ApiPort" +#define UNICODE_PATH_SEP L"\\" + /* Defines */ #define ROUND_UP(n, align) ROUND_DOWN(((ULONG)n) + (align) - 1, (align)) #define ROUND_DOWN(n, align) (((ULONG)n) & ~((align) - 1l)) Modified: trunk/reactos/subsystems/win32/csrss/csrss.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrss.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrss.c [iso-8859-1] Wed Feb 15 16:11:12 2012 @@ -11,6 +11,8 @@ #define WIN32_NO_STATUS #include <windows.h> +#define NTOS_MODE_USER +#include <ndk/ntndk.h> #include <api.h> #define NDEBUG #include <debug.h> @@ -39,12 +41,34 @@ { KPRIORITY BasePriority = (8 + 1) + 4; NTSTATUS Status; + //ULONG Response; + UNREFERENCED_PARAMETER(envp); + UNREFERENCED_PARAMETER(DebugFlag); /* Set the Priority */ NtSetInformationProcess(NtCurrentProcess(), ProcessBasePriority, &BasePriority, sizeof(KPRIORITY)); + + /* Give us IOPL so that we can access the VGA registers */ + Status = NtSetInformationProcess(NtCurrentProcess(), + ProcessUserModeIOPL, + NULL, + 0); + if (!NT_SUCCESS(Status)) + { + /* Raise a hard error */ + DPRINT1("CSRSS: Could not raise IOPL: %x\n", Status); + #if 0 + Status = NtRaiseHardError(STATUS_IO_PRIVILEGE_FAILED, + 0, + 0, + NULL, + OptionOk, + &Response); + #endif + } /* Initialize CSR through CSRSRV */ Status = CsrServerInitialization(argc, argv); @@ -62,7 +86,7 @@ if (!NtCurrentPeb()->SessionId) RtlSetProcessIsCritical(TRUE, NULL, FALSE); /* Kill this thread. CSRSRV keeps us going */ - NtTerminateThread (NtCurrentThread(), Status); + NtTerminateThread(NtCurrentThread(), Status); return 0; }
12 years, 10 months
1
0
0
0
[tkreuzer] 55609: [FREELDR] Silence some heap debug prints
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Feb 15 16:03:01 2012 New Revision: 55609 URL:
http://svn.reactos.org/svn/reactos?rev=55609&view=rev
Log: [FREELDR] Silence some heap debug prints Modified: trunk/reactos/boot/freeldr/freeldr/mm/heap_new.c Modified: trunk/reactos/boot/freeldr/freeldr/mm/heap_new.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/mm/he…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/mm/heap_new.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/mm/heap_new.c [iso-8859-1] Wed Feb 15 16:03:01 2012 @@ -212,7 +212,7 @@ if (Block->Size == 0) break; } - ERR("HeapRelease() done, freed %ld pages\n", AllFreePages); + TRACE("HeapRelease() done, freed %ld pages\n", AllFreePages); } VOID @@ -221,12 +221,12 @@ PHEAP Heap; Heap = FrLdrDefaultHeap; - ERR("Heap statistics for default heap:\n" + TRACE("Heap statistics for default heap:\n" "CurrentAlloc=0x%lx, MaxAlloc=0x%lx, LargestAllocation=0x%lx\n" "NumAllocs=%ld, NumFrees=%ld\n", Heap->CurrentAllocBytes, Heap->MaxAllocBytes, Heap->LargestAllocation, Heap->NumAllocs, Heap->NumFrees); - ERR("AllocTime = %I64d, FreeTime = %I64d, sum = %I64d\n", + TRACE("AllocTime = %I64d, FreeTime = %I64d, sum = %I64d\n", Heap->AllocationTime, Heap->FreeTime, Heap->AllocationTime + Heap->FreeTime); @@ -234,7 +234,7 @@ HeapRelease(FrLdrDefaultHeap); Heap = FrLdrTempHeap; - ERR("Heap statistics for temp heap:\n" + TRACE("Heap statistics for temp heap:\n" "CurrentAlloc=0x%lx, MaxAlloc=0x%lx, LargestAllocation=0x%lx\n" "NumAllocs=%ld, NumFrees=%ld\n", Heap->CurrentAllocBytes, Heap->MaxAllocBytes, Heap->LargestAllocation,
12 years, 10 months
1
0
0
0
[ion] 55608: [CSRSRV2]: Fix GetDosDevicesProtection.
by ion@svn.reactos.org
Author: ion Date: Wed Feb 15 15:06:53 2012 New Revision: 55608 URL:
http://svn.reactos.org/svn/reactos?rev=55608&view=rev
Log: [CSRSRV2]: Fix GetDosDevicesProtection. Modified: trunk/reactos/subsystems/csr/csrsrv/init.c Modified: trunk/reactos/subsystems/csr/csrsrv/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/csr/csrsrv/init…
============================================================================== --- trunk/reactos/subsystems/csr/csrsrv/init.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/csr/csrsrv/init.c [iso-8859-1] Wed Feb 15 15:06:53 2012 @@ -324,32 +324,37 @@ ULONG ResultLength, SidLength, AclLength; /* Create the SD */ - RtlCreateSecurityDescriptor(DosDevicesSd, SECURITY_DESCRIPTOR_REVISION); + Status = RtlCreateSecurityDescriptor(DosDevicesSd, SECURITY_DESCRIPTOR_REVISION); + ASSERT(NT_SUCCESS(Status)); /* Initialize the System SID */ - RtlAllocateAndInitializeSid(&NtSidAuthority, 1, - SECURITY_LOCAL_SYSTEM_RID, - 0, 0, 0, 0, 0, 0, 0, - &SystemSid); + Status = RtlAllocateAndInitializeSid(&NtSidAuthority, 1, + SECURITY_LOCAL_SYSTEM_RID, + 0, 0, 0, 0, 0, 0, 0, + &SystemSid); + ASSERT(NT_SUCCESS(Status)); /* Initialize the World SID */ - RtlAllocateAndInitializeSid(&WorldAuthority, 1, - SECURITY_WORLD_RID, - 0, 0, 0, 0, 0, 0, 0, - &WorldSid); + Status = RtlAllocateAndInitializeSid(&WorldAuthority, 1, + SECURITY_WORLD_RID, + 0, 0, 0, 0, 0, 0, 0, + &WorldSid); + ASSERT(NT_SUCCESS(Status)); /* Initialize the Admin SID */ - RtlAllocateAndInitializeSid(&NtSidAuthority, 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, - 0, 0, 0, 0, 0, 0, - &AdminSid); + Status = RtlAllocateAndInitializeSid(&NtSidAuthority, 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, + &AdminSid); + ASSERT(NT_SUCCESS(Status)); /* Initialize the Creator SID */ - RtlAllocateAndInitializeSid(&CreatorAuthority, 1, - SECURITY_CREATOR_OWNER_RID, - 0, 0, 0, 0, 0, 0, 0, - &CreatorSid); + Status = RtlAllocateAndInitializeSid(&CreatorAuthority, 1, + SECURITY_CREATOR_OWNER_RID, + 0, 0, 0, 0, 0, 0, 0, + &CreatorSid); + ASSERT(NT_SUCCESS(Status)); /* Open the Session Manager Key */ RtlInitUnicodeString(&KeyName, SM_REG_KEY); @@ -372,7 +377,7 @@ /* Make sure it's what we expect it to be */ KeyValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyValueBuffer; - if ((KeyValuePartialInfo->Type == REG_DWORD) && + if ((NT_SUCCESS(Status)) && (KeyValuePartialInfo->Type == REG_DWORD) && (*(PULONG)KeyValuePartialInfo->Data)) { /* Save the Protection Mode */ @@ -393,23 +398,33 @@ /* Allocate memory for the DACL */ Dacl = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, AclLength); + ASSERT(Dacl != NULL); /* Build the ACL and add 3 ACEs */ Status = RtlCreateAcl(Dacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, SystemSid); + ASSERT(NT_SUCCESS(Status)); Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, AdminSid); + ASSERT(NT_SUCCESS(Status)); Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, CreatorSid); + ASSERT(NT_SUCCESS(Status)); /* Edit the ACEs to make them inheritable */ Status = RtlGetAce(Dacl, 0, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; Status = RtlGetAce(Dacl, 1, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE; /* Set this DACL with the SD */ Status = RtlSetDaclSecurityDescriptor(DosDevicesSd, TRUE, Dacl, FALSE); + ASSERT(NT_SUCCESS(Status)); + goto Quickie; } else { @@ -419,19 +434,27 @@ /* Allocate memory for the DACL */ Dacl = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, AclLength); + ASSERT(Dacl != NULL); /* Build the ACL and add 3 ACEs */ Status = RtlCreateAcl(Dacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE, WorldSid); + ASSERT(NT_SUCCESS(Status)); Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, SystemSid); + ASSERT(NT_SUCCESS(Status)); Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, GENERIC_ALL, WorldSid); + ASSERT(NT_SUCCESS(Status)); /* Edit the last ACE to make it inheritable */ Status = RtlGetAce(Dacl, 2, (PVOID*)&Ace); + ASSERT(NT_SUCCESS(Status)); Ace->Header.AceFlags |= OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE; /* Set this DACL with the SD */ Status = RtlSetDaclSecurityDescriptor(DosDevicesSd, TRUE, Dacl, FALSE); + ASSERT(NT_SUCCESS(Status)); + goto Quickie; } /* FIXME: failure cases! Fail: */ @@ -439,6 +462,7 @@ RtlFreeHeap(CsrHeap, 0, Dacl); /* FIXME: semi-failure cases! Quickie: */ +Quickie: /* Free the SIDs */ RtlFreeSid(SystemSid); RtlFreeSid(WorldSid);
12 years, 10 months
1
0
0
0
← Newer
1
...
30
31
32
33
34
35
36
...
58
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Results per page:
10
25
50
100
200