ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2005
----- 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
23 participants
669 discussions
Start a n
N
ew thread
[ea] 17419: Minor changes.
by ea@svn.reactos.com
Minor changes. Modified: trunk/reactos/subsys/smss/client.c _____ Modified: trunk/reactos/subsys/smss/client.c --- trunk/reactos/subsys/smss/client.c 2005-08-16 23:37:17 UTC (rev 17418) +++ trunk/reactos/subsys/smss/client.c 2005-08-17 06:14:55 UTC (rev 17419) @@ -250,7 +250,7 @@ NTSTATUS Status = STATUS_NOT_FOUND; PSM_CLIENT_DATA Client = NULL; - DPRINT("SM: %s called\n", __FUNCTION__); + DPRINT("SM: %s(%lu) called\n", __FUNCTION__, ProcessId); RtlEnterCriticalSection (& SmpClientDirectory.Lock); if (SmpClientDirectory.Count > 0) @@ -284,6 +284,11 @@ * * RETURN VALUE * NTSTATUS: + * STATUS_SUCCESS if all OK; + * STATUS_DEVICE_BUSY if another SS is still booting; + * STATUS_NO_MEMORY if client descriptor allocation failed; + * + * */ NTSTATUS STDCALL SmCreateClient (PRTL_USER_PROCESS_INFORMATION ProcessInfo, PWSTR ProgramName) @@ -292,46 +297,49 @@ DPRINT("SM: %s(%lx) called\n", __FUNCTION__, ProcessInfo->ProcessHandle); + RtlEnterCriticalSection (& SmpClientDirectory.Lock); /* * Check if the candidate client slot is empty. */ - if (NULL != SmpClientDirectory.CandidateClient) - { - DPRINT1("SM: %s: CandidateClient pending!\n", __FUNCTION__); - RtlLeaveCriticalSection (& SmpClientDirectory.Lock); - return STATUS_UNSUCCESSFUL; - } - /* - * Allocate the storage for client data - */ - SmpClientDirectory.CandidateClient = - RtlAllocateHeap (SmpHeap, - HEAP_ZERO_MEMORY, - sizeof (SM_CLIENT_DATA)); if (NULL == SmpClientDirectory.CandidateClient) { - DPRINT("SM: %s(%lx): out of memory!\n", - __FUNCTION__, ProcessInfo->ProcessHandle); - Status = STATUS_NO_MEMORY; - } - else - { - /* Initialize the candidate client. */ - RtlInitializeCriticalSection(& SmpClientDirectory.CandidateClient->Lock); - SmpClientDirectory.CandidateClient->ServerProcess = - (HANDLE) ProcessInfo->ProcessHandle; - SmpClientDirectory.CandidateClient->ServerProcessId = - (ULONG) ProcessInfo->ClientId.UniqueProcess; /* - * Copy the program name + * Allocate the storage for client data */ - RtlCopyMemory (SmpClientDirectory.CandidateClient->ProgramName, - ProgramName, - SM_SB_NAME_MAX_LENGTH); + SmpClientDirectory.CandidateClient = + RtlAllocateHeap (SmpHeap, + HEAP_ZERO_MEMORY, + sizeof (SM_CLIENT_DATA)); + if (NULL == SmpClientDirectory.CandidateClient) + { + DPRINT("SM: %s(%lx): out of memory!\n", + __FUNCTION__, ProcessInfo->ProcessHandle); + Status = STATUS_NO_MEMORY; + } + else + { + /* Initialize the candidate client. */ + RtlInitializeCriticalSection(& SmpClientDirectory.CandidateClient->Lock); + SmpClientDirectory.CandidateClient->ServerProcess = + (HANDLE) ProcessInfo->ProcessHandle; + SmpClientDirectory.CandidateClient->ServerProcessId = + (ULONG) ProcessInfo->ClientId.UniqueProcess; + /* + * Copy the program name + */ + RtlCopyMemory (SmpClientDirectory.CandidateClient->ProgramName, + ProgramName, + SM_SB_NAME_MAX_LENGTH); + } + } else { + DPRINT1("SM: %s: CandidateClient pending!\n", __FUNCTION__); + RtlLeaveCriticalSection (& SmpClientDirectory.Lock); + Status = STATUS_DEVICE_BUSY; } RtlLeaveCriticalSection (& SmpClientDirectory.Lock); + return Status; }
19 years, 4 months
1
0
0
0
[amunger] 17418: Do not free a Critical Section we did not initialize. Fixes the silent UM exception I was seeing while trying to install VMWare tools. Patch by Filip.
by amunger@svn.reactos.com
Do not free a Critical Section we did not initialize. Fixes the silent UM exception I was seeing while trying to install VMWare tools. Patch by Filip. Modified: trunk/reactos/lib/kernel32/misc/dllmain.c _____ Modified: trunk/reactos/lib/kernel32/misc/dllmain.c --- trunk/reactos/lib/kernel32/misc/dllmain.c 2005-08-16 23:05:33 UTC (rev 17417) +++ trunk/reactos/lib/kernel32/misc/dllmain.c 2005-08-16 23:37:17 UTC (rev 17418) @@ -26,6 +26,7 @@ HANDLE hBaseDir = NULL; static BOOL DllInitialized = FALSE; +static BOOL ConsoleInitialized = FALSE; BOOL STDCALL DllMain(HANDLE hInst, @@ -141,6 +142,7 @@ } /* Initialize Console Ctrl Handler */ + ConsoleInitialized = TRUE; RtlInitializeCriticalSection(&ConsoleLock); SetConsoleCtrlHandler(DefaultConsoleCtrlHandler, TRUE); @@ -289,7 +291,10 @@ NlsUninit(); /* Delete DLL critical section */ - RtlDeleteCriticalSection (&ConsoleLock); + if (ConsoleInitialized == TRUE) + { + RtlDeleteCriticalSection (&ConsoleLock); + } RtlDeleteCriticalSection (&DllLock); /* Close object base directory */
19 years, 4 months
1
0
0
0
[ion] 17417: Remove all non-official LPC structures/defines/hardcoded hacks, and use actual correct sizes and structures.
by ion@svn.reactos.com
Remove all non-official LPC structures/defines/hardcoded hacks, and use actual correct sizes and structures. Modified: trunk/reactos/boot/freeldr/freeldr/include/freeldr.h Modified: trunk/reactos/include/ndk/fixmes.txt Modified: trunk/reactos/include/ndk/lpctypes.h Modified: trunk/reactos/include/ndk/ntndk.h Modified: trunk/reactos/include/reactos/helper.h Modified: trunk/reactos/include/subsys/csrss/csrss.h Modified: trunk/reactos/include/subsys/lsass/lsass.h Modified: trunk/reactos/include/subsys/sm/api.h Modified: trunk/reactos/lib/lsasrv/lsaport.c Modified: trunk/reactos/lib/ntdll/csr/lpc.c Modified: trunk/reactos/lib/rtl/thread.c Modified: trunk/reactos/lib/secur32/lsa.c Modified: trunk/reactos/ntoskrnl/include/internal/port.h Modified: trunk/reactos/ntoskrnl/io/error.c Modified: trunk/reactos/ntoskrnl/lpc/send.c Modified: trunk/reactos/services/eventlog/eventlog.h Modified: trunk/reactos/services/eventlog/logport.c Modified: trunk/reactos/subsys/csrss/api/process.c Modified: trunk/reactos/subsys/csrss/api/user.c Modified: trunk/reactos/subsys/csrss/api/wapi.c Modified: trunk/reactos/subsys/csrss/win32csr/conio.c Modified: trunk/reactos/subsys/csrss/win32csr/desktopbg.c Modified: trunk/reactos/subsys/csrss/win32csr/exitros.c Modified: trunk/reactos/subsys/smss/debug.c Modified: trunk/reactos/subsys/smss/smapi.c Modified: trunk/reactos/subsys/system/dhcp/dhclient.c Modified: trunk/reactos/subsys/win32k/ntuser/csr.c Modified: trunk/reactos/w32api/include/ddk/ntifs.h Modified: trunk/reactos/w32api/include/ddk/prntfont.h _____ Modified: trunk/reactos/boot/freeldr/freeldr/include/freeldr.h --- trunk/reactos/boot/freeldr/freeldr/include/freeldr.h 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/boot/freeldr/freeldr/include/freeldr.h 2005-08-16 23:05:33 UTC (rev 17417) @@ -35,8 +35,6 @@ #include <portio.h> #include <reactos.h> -#define ROUND_UP(N, S) (((N) + (S) - 1) & ~((S) - 1)) -#define ROUND_DOWN(N, S) ((N) & ~((S) - 1)) #define Ke386EraseFlags(x) __asm__ __volatile__("pushl $0 ; popfl\n") extern BOOL UserInterfaceUp; /* Tells us if the user interface is displayed */ _____ Modified: trunk/reactos/include/ndk/fixmes.txt --- trunk/reactos/include/ndk/fixmes.txt 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/include/ndk/fixmes.txt 2005-08-16 23:05:33 UTC (rev 17417) @@ -33,8 +33,45 @@ Priority 4: - FIXED: Kernel and Memory Types are not architecture-specific (Eric) [ketypes.h, mmtypes.h] - FIXED: Win32K Builds with windows.h (Filip) [extypes.h, ketypes.h] + - Move out stuff from umtypes.h into the actual header where they should go. Use ifdeffing + directly in that file to protect user-mode versus kernel-mode types. umtypes.h will only + end up containing the misc types that are needed for compatibility. This would create a + significant cleanup. Priority 5: - - LPC Types are totally wrong. [lpctypes.h] + - FIXED: LPC Types are totally wrong. (Alex) [lpctypes.h] - Missing System Info Classes [zwtypes.h] - FIXED: Process Priority Classes are messed up (Alex) [pstypes.h] + +Generic Note: + One of the most difficult things is when certain structures require the IFS for some of their + members. Up until some time ago, the IFS was 1000$, so it was senseless to require it in order + to allow people to use the NDK. Recently, however, the IFS price went down to 100$. This is + still way too much. Even though the GNU NTIFS.H exists, I don't want to fallback on it. The + good news is that the WDK (Windows Driver Kit), which will supplant the DDK in about a year, + includes the IFS. At that point we can remove all the #ifndef/ifdef NTIFS hacks, since it'll + be OK to "force" IFS usage. + + UPDATE: + However, I'm giving serious consideration of making the IFS a requirement, and suggesting + usage of the GNU IFS for anyone that needs it. The problem, however, is that the official + GNU IFS is outdated and quite invalid in many ways, compared to the ReactOS IFS (which still + isn't perfect yet). Also, this would include many more definitions then needed. A third + option that I'm considering is creating a new header, until the WDK is out, which will be + called ifstypes. It would be the brother of umtypes, but for kernel mode. Only a small + number of types will need to be included, and hence they will be easy to locate in case + the official ones change (by the time they do, the WDK will be out however, so no worries). + It would reduce all the ifdeffing to a single file. + + UPDATE2: + No. This is a bad idea. I've just added a note to purge out large parts of umtypes.h into the + actual xxtypes.h files, and then use iffdefing. This is a direct contradiction to my idea of + generalizing all the IFS stuff together. + + UPDATE3: + No. This is different...the user-mode types will always be unavailable in kernel-mode, and + dissipating them into the real files is a good thing, because they will never move out and + they are much easier to maintain. However, once the WDK comes out, all #ifdef ntifs will + become obsolete, and they will have to be hunted down and removed. Having a single file that + is automatically added if the IFS is not detected is much easier to remove once the time + comes. _____ Modified: trunk/reactos/include/ndk/lpctypes.h --- trunk/reactos/include/ndk/lpctypes.h 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/include/ndk/lpctypes.h 2005-08-16 23:05:33 UTC (rev 17417) @@ -9,18 +9,10 @@ #ifndef _LPCTYPES_H #define _LPCTYPES_H -#define LPC_MESSAGE_TYPE(m) ((m).Header.u2.s2.Type) - /* DEPENDENCIES **************************************************************/ /* EXPORTED DATA *************************************************************/ -/* CONSTANTS *****************************************************************/ -#define LPC_MESSAGE_BASE_SIZE 24 -#define MAX_MESSAGE_DATA (0x130) -#define LPC_MAX_DATA_LENGTH 0x104 -#define LPC_MAX_MESSAGE_LENGTH 0x148 - /* ENUMERATIONS **************************************************************/ typedef enum _LPC_TYPE @@ -42,6 +34,13 @@ /* TYPES *********************************************************************/ +/* + * Native Structures in IFS. Duplicated here for user-mode. + * Also duplicated if the IFS is not present. Until the WDK is + * released, we should not force the usage of a 100$ kit. + */ +#if defined(NTOS_MODE_USER) || !(defined(_NTIFS_)) + #if defined(USE_LPC6432) #define LPC_CLIENT_ID CLIENT_ID64 #define LPC_SIZE_T ULONGLONG @@ -104,11 +103,98 @@ LPC_PVOID ViewBase; } REMOTE_PORT_VIEW, *PREMOTE_PORT_VIEW; -/* FIXME: USE REAL DEFINITION */ -typedef struct _LPC_MAX_MESSAGE +typedef struct _LPCP_MESSAGE { - PORT_MESSAGE Header; - BYTE Data[MAX_MESSAGE_DATA]; -} LPC_MAX_MESSAGE, *PLPC_MAX_MESSAGE; + UCHAR Data[0x14]; + PORT_MESSAGE Request; +} LPCP_MESSAGE; +typedef struct _LPCP_CONNECTION_MESSAGE +{ + UCHAR Data[0x2C]; +} LPCP_CONNECTION_MESSAGE; + +/* Kernel-Mode Structures */ +#else + +typedef struct _LPCP_NONPAGED_PORT_QUEUE +{ + KSEMAPHORE Semaphore; + struct _LPCP_PORT_OBJECT *BackPointer; +} LPCP_NONPAGED_PORT_QUEUE, *PLPCP_NONPAGED_PORT_QUEUE; + +typedef struct _LPCP_PORT_QUEUE +{ + PLPCP_NONPAGED_PORT_QUEUE NonPagedPortQueue; + KSEMAPHORE Semaphore; + LIST_ENTRY ReceiveHead; +} LPCP_PORT_QUEUE, *PLPCP_PORT_QUEUE; + +#ifdef _NTIFS_ +typedef struct _LPCP_PORT_OBJECT +{ + ULONG Length; + ULONG Flags; + struct _LPCP_PORT_OBJECT *ConnectionPort; + struct _LPCP_PORT_OBJECT *ConnectedPort; + LPCP_PORT_QUEUE MsgQueue; + CLIENT_ID Creator; + PVOID ClientSectionBase; + PVOID ServerSectionBase; + PVOID PortContext; + ULONG MaxMessageLength; + ULONG MaxConnectionInfoLength; + PETHREAD ClientThread; + SECURITY_QUALITY_OF_SERVICE SecurityQos; + SECURITY_CLIENT_CONTEXT StaticSecurity; + LIST_ENTRY LpcReplyChainHead; + LIST_ENTRY LpcDataInfoChainHead; +} LPCP_PORT_OBJECT, *PLPCP_PORT_OBJECT; + +typedef struct _LPCP_MESSAGE +{ + union + { + LIST_ENTRY Entry; + struct + { + SINGLE_LIST_ENTRY FreeEntry; + ULONG Reserved0; + }; + }; + PLPCP_PORT_OBJECT SenderPort; + PETHREAD RepliedToThread; + PVOID PortContext; + PORT_MESSAGE Request; +} LPCP_MESSAGE, *PLPCP_MESSAGE; + +typedef struct _LPCP_CONNECTION_MESSAGE +{ + PORT_VIEW ClientView; + PLPCP_PORT_OBJECT ClientPort; + PVOID SectionToMap; + REMOTE_PORT_VIEW ServerView; +} LPCP_CONNECTION_MESSAGE, *PLPCP_CONNECTION_MESSAGE; #endif + +#endif + +/* CONSTANTS *****************************************************************/ + +#define PORT_MAXIMUM_MESSAGE_LENGTH 256 + +#define LPCP_MAX_MESSAGE_SIZE \ + ROUND_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \ + sizeof(LPCP_MESSAGE) + \ + sizeof(LPCP_CONNECTION_MESSAGE), 16) + +#define LPC_MAX_MESSAGE_LENGTH \ + (LPCP_MAX_MESSAGE_SIZE - \ + FIELD_OFFSET(LPCP_MESSAGE, Request)) + +#define LPC_MAX_DATA_LENGTH \ + (LPC_MAX_MESSAGE_LENGTH - \ + sizeof(PORT_MESSAGE) - \ + sizeof(LPCP_CONNECTION_MESSAGE)) + +#endif _____ Modified: trunk/reactos/include/ndk/ntndk.h --- trunk/reactos/include/ndk/ntndk.h 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/include/ndk/ntndk.h 2005-08-16 23:05:33 UTC (rev 17417) @@ -13,6 +13,9 @@ #include <stdarg.h> #include <excpt.h> +/* Helper Header */ +#include <helper.h> + /* Kernel-Mode NDK */ #ifndef NTOS_MODE_USER #include "kdtypes.h" /* Kernel Debugger Types */ @@ -27,7 +30,6 @@ #include "iofuncs.h" /* Input/Output Manager Functions */ #include "ketypes.h" /* Kernel Types */ #include "kefuncs.h" /* Kernel Functions */ - #include "lpctypes.h" /* Local Procedure Call Types */ #include "mmtypes.h" /* Memory Manager Types */ #include "mmfuncs.h" /* Memory Manager Functions */ #include "obtypes.h" /* Object Manager Types */ @@ -45,6 +47,7 @@ /* Shared NDK */ #include "ldrfuncs.h" /* Loader Functions */ #include "ldrtypes.h" /* Loader Types */ +#include "lpctypes.h" /* Local Procedure Call Types */ #include "pstypes.h" /* Process Manager Types */ #include "rtltypes.h" /* Runtime Library Types */ #include "rtlfuncs.h" /* Runtime Library Functions */ _____ Modified: trunk/reactos/include/reactos/helper.h --- trunk/reactos/include/reactos/helper.h 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/include/reactos/helper.h 2005-08-16 23:05:33 UTC (rev 17417) @@ -1,6 +1,7 @@ #ifndef _HELPER_H #define _HELPER_H - + +/* FIXME: clean this mess up and move to NDK */ #define ROUNDUP(a,b) ((((a)+(b)-1)/(b))*(b)) #define ROUNDDOWN(a,b) (((a)/(b))*(b)) #define ROUND_UP ROUNDUP _____ Modified: trunk/reactos/include/subsys/csrss/csrss.h --- trunk/reactos/include/subsys/csrss/csrss.h 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/include/subsys/csrss/csrss.h 2005-08-16 23:05:33 UTC (rev 17417) @@ -411,19 +411,19 @@ } CSRSS_GET_INPUT_WAIT_HANDLE, *PCSRSS_GET_INPUT_WAIT_HANDLE; #define CSRSS_MAX_WRITE_CONSOLE \ - (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE)) + (LPC_MAX_DATA_LENGTH - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE)) -#define CSRSS_MAX_SET_TITLE (MAX_MESSAGE_DATA - sizeof( HANDLE ) - sizeof( DWORD ) - sizeof( ULONG ) - LPC_MESSAGE_BASE_SIZE) +#define CSRSS_MAX_SET_TITLE (LPC_MAX_DATA_LENGTH - sizeof( HANDLE ) - sizeof( DWORD ) - sizeof( ULONG ) - sizeof(PORT_MESSAGE)) -#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_CHAR )) +#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR (LPC_MAX_DATA_LENGTH - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_CHAR )) -#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB ((MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB )) / 2) +#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB ((LPC_MAX_DATA_LENGTH - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB )) / 2) -#define CSRSS_MAX_READ_CONSOLE (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_READ_CONSOLE )) +#define CSRSS_MAX_READ_CONSOLE (LPC_MAX_DATA_LENGTH - sizeof( ULONG ) - sizeof( CSRSS_READ_CONSOLE )) -#define CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_CHAR)) +#define CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR (LPC_MAX_DATA_LENGTH - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_CHAR)) -#define CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB)) +#define CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB (LPC_MAX_DATA_LENGTH - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB)) /* WCHARs, not bytes! */ #define CSRSS_MAX_TITLE_LENGTH 80 @@ -485,7 +485,7 @@ #define GET_PROCESS_LIST (0x36) /* Keep in sync with definition below. */ -#define CSRSS_HEADER_SIZE (LPC_MESSAGE_BASE_SIZE + sizeof(ULONG) + sizeof(NTSTATUS)) +#define CSRSS_HEADER_SIZE (sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(NTSTATUS)) typedef struct _CSR_API_MESSAGE { @@ -494,7 +494,7 @@ PORT_MESSAGE Header; struct { - BYTE HeaderReserved[LPC_MESSAGE_BASE_SIZE]; + BYTE HeaderReserved[sizeof(PORT_MESSAGE)]; ULONG Type; NTSTATUS Status; union _____ Modified: trunk/reactos/include/subsys/lsass/lsass.h --- trunk/reactos/include/subsys/lsass/lsass.h 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/include/subsys/lsass/lsass.h 2005-08-16 23:05:33 UTC (rev 17417) @@ -98,7 +98,7 @@ { PORT_MESSAGE Header; struct { - UCHAR LpcHeader[LPC_MESSAGE_BASE_SIZE]; + UCHAR LpcHeader[sizeof(PORT_MESSAGE)]; ULONG Type; union { _____ Modified: trunk/reactos/include/subsys/sm/api.h --- trunk/reactos/include/subsys/sm/api.h 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/include/subsys/sm/api.h 2005-08-16 23:05:33 UTC (rev 17417) @@ -112,7 +112,7 @@ /*** LPC common header ***/ PORT_MESSAGE Header; struct { - UCHAR LpcHeader[LPC_MESSAGE_BASE_SIZE]; + UCHAR LpcHeader[sizeof(PORT_MESSAGE)]; /*** SM common header ***/ struct { DWORD ApiIndex; _____ Modified: trunk/reactos/lib/lsasrv/lsaport.c --- trunk/reactos/lib/lsasrv/lsaport.c 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/lib/lsasrv/lsaport.c 2005-08-16 23:05:33 UTC (rev 17417) @@ -19,7 +19,7 @@ { OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING PortName; - LPC_MAX_MESSAGE Request; + PORT_MESSAGE Request; NTSTATUS Status; ConnectPortHandle = NULL; @@ -46,7 +46,7 @@ } Status = NtListenPort(ConnectPortHandle, - &Request.Header); + &Request); if (!NT_SUCCESS(Status)) { DPRINT1("NtListenPort() failed (Status %lx)\n", Status); @@ -89,7 +89,7 @@ static NTSTATUS ProcessPortMessage(VOID) { - LPC_MAX_MESSAGE Request; + PORT_MESSAGE Request; // LPC_MAX_MESSAGE Reply; NTSTATUS Status; @@ -103,7 +103,7 @@ Status = NtReplyWaitReceivePort(MessagePortHandle, 0, NULL, - &Request.Header); + &Request); if (!NT_SUCCESS(Status)) { DPRINT1("NtReplyWaitReceivePort() failed (Status %lx)\n", Status); @@ -112,18 +112,18 @@ DPRINT("Received message\n"); - if (Request.Header.u2.s2.Type == LPC_PORT_CLOSED) + if (Request.u2.s2.Type == LPC_PORT_CLOSED) { DPRINT("Port closed\n"); // return STATUS_UNSUCCESSFUL; } - if (Request.Header.u2.s2.Type == LPC_REQUEST) + if (Request.u2.s2.Type == LPC_REQUEST) { DPRINT("Received request\n"); } - else if (Request.Header.u2.s2.Type == LPC_DATAGRAM) + else if (Request.u2.s2.Type == LPC_DATAGRAM) { DPRINT("Received datagram\n"); _____ Modified: trunk/reactos/lib/ntdll/csr/lpc.c --- trunk/reactos/lib/ntdll/csr/lpc.c 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/lib/ntdll/csr/lpc.c 2005-08-16 23:05:33 UTC (rev 17417) @@ -81,7 +81,7 @@ /* Fill out the header */ Request->Type = ApiNumber; - Request->Header.u1.s1.DataLength = RequestLength - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = RequestLength - sizeof(PORT_MESSAGE); Request->Header.u1.s1.TotalLength = RequestLength; DPRINT("CSR: API: %x, u1.s1.DataLength: %x, u1.s1.TotalLength: %x\n", ApiNumber, _____ Modified: trunk/reactos/lib/rtl/thread.c --- trunk/reactos/lib/rtl/thread.c 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/lib/rtl/thread.c 2005-08-16 23:05:33 UTC (rev 17417) @@ -192,7 +192,7 @@ OBJECT_ATTRIBUTES ObjectAttributes; CONTEXT Context; - DPRINT("RtlCreateUserThread: (hProcess: %lx, Suspended: %lx," + DPRINT1("RtlCreateUserThread: (hProcess: %lx, Suspended: %lx," "ZeroBits: %lx, StackReserve: %lx, StackCommit: %lx," "StartAddress: %p, Parameter: %lx)\n", ProcessHandle, CreateSuspended, StackZeroBits, StackReserve, StackCommit, _____ Modified: trunk/reactos/lib/secur32/lsa.c --- trunk/reactos/lib/secur32/lsa.c 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/lib/secur32/lsa.c 2005-08-16 23:05:33 UTC (rev 17417) @@ -75,18 +75,18 @@ { PLSASS_REQUEST Request; PLSASS_REPLY Reply; - UCHAR RawRequest[MAX_MESSAGE_DATA]; - UCHAR RawReply[MAX_MESSAGE_DATA]; + LSASS_REQUEST RawRequest; + LSASS_REPLY RawReply; NTSTATUS Status; ULONG OutBufferSize; - Request = (PLSASS_REQUEST)RawRequest; - Reply = (PLSASS_REPLY)RawReply; + Request = (PLSASS_REQUEST)&RawRequest; + Reply = (PLSASS_REPLY)&RawReply; Request->Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) + SubmitBufferLength - - LPC_MESSAGE_BASE_SIZE; + sizeof(PORT_MESSAGE); Request->Header.u1.s1.TotalLength = - Request->Header.u1.s1.DataLength + LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength + sizeof(PORT_MESSAGE); Request->Type = LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE; Request->d.CallAuthenticationPackageRequest.AuthenticationPackage = AuthenticationPackage; @@ -142,14 +142,14 @@ { NTSTATUS Status; PLSASS_REQUEST Request; - UCHAR RawRequest[MAX_MESSAGE_DATA]; + LSASS_REQUEST RawRequest; LSASS_REPLY Reply; - Request = (PLSASS_REQUEST)RawRequest; + Request = (PLSASS_REQUEST)&RawRequest; Request->Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) + PackageName->Length - - LPC_MESSAGE_BASE_SIZE; + sizeof(PORT_MESSAGE); Request->Header.u1.s1.TotalLength = Request->Header.u1.s1.DataLength + - LPC_MESSAGE_BASE_SIZE; + sizeof(PORT_MESSAGE); Request->Type = LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE; Status = NtRequestWaitReplyPort(LsaHandle, @@ -192,23 +192,23 @@ ULONG RequestLength; ULONG CurrentLength; PLSASS_REQUEST Request; - UCHAR RawMessage[MAX_MESSAGE_DATA]; + LSASS_REQUEST RawMessage; PLSASS_REPLY Reply; - UCHAR RawReply[MAX_MESSAGE_DATA]; + LSASS_REPLY RawReply; NTSTATUS Status; - RequestLength = sizeof(LSASS_REQUEST) - LPC_MESSAGE_BASE_SIZE; + RequestLength = sizeof(LSASS_REQUEST) - sizeof(PORT_MESSAGE); RequestLength = RequestLength + (OriginName->Length * sizeof(WCHAR)); RequestLength = RequestLength + AuthenticationInformationLength; RequestLength = RequestLength + (LocalGroups->GroupCount * sizeof(SID_AND_ATTRIBUTES)); CurrentLength = 0; - Request = (PLSASS_REQUEST)RawMessage; + Request = (PLSASS_REQUEST)&RawMessage; Request->d.LogonUserRequest.OriginNameLength = OriginName->Length; - Request->d.LogonUserRequest.OriginName = (PWSTR)&RawMessage[CurrentLength]; - memcpy((PWSTR)&RawMessage[CurrentLength], + Request->d.LogonUserRequest.OriginName = (PWSTR)&RawMessage + CurrentLength; + memcpy((PWSTR)&RawMessage + CurrentLength, OriginName->Buffer, OriginName->Length * sizeof(WCHAR)); CurrentLength = CurrentLength + (OriginName->Length * sizeof(WCHAR)); @@ -219,28 +219,28 @@ AuthenticationPackage; Request->d.LogonUserRequest.AuthenticationInformation = - (PVOID)&RawMessage[CurrentLength]; + (PVOID)((ULONG_PTR)&RawMessage + CurrentLength); Request->d.LogonUserRequest.AuthenticationInformationLength = AuthenticationInformationLength; - memcpy((PVOID)&RawMessage[CurrentLength], + memcpy((PVOID)((ULONG_PTR)&RawMessage + CurrentLength), AuthenticationInformation, AuthenticationInformationLength); CurrentLength = CurrentLength + AuthenticationInformationLength; Request->d.LogonUserRequest.LocalGroupsCount = LocalGroups->GroupCount; Request->d.LogonUserRequest.LocalGroups = - (PSID_AND_ATTRIBUTES)&RawMessage[CurrentLength]; - memcpy((PSID_AND_ATTRIBUTES)&RawMessage[CurrentLength], + (PSID_AND_ATTRIBUTES)&RawMessage + CurrentLength; + memcpy((PSID_AND_ATTRIBUTES)&RawMessage + CurrentLength, LocalGroups->Groups, LocalGroups->GroupCount * sizeof(SID_AND_ATTRIBUTES)); Request->d.LogonUserRequest.SourceContext = *SourceContext; Request->Type = LSASS_REQUEST_LOGON_USER; - Request->Header.u1.s1.DataLength = RequestLength - LPC_MESSAGE_BASE_SIZE; - Request->Header.u1.s1.TotalLength = RequestLength + LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = RequestLength - sizeof(PORT_MESSAGE); + Request->Header.u1.s1.TotalLength = RequestLength + sizeof(PORT_MESSAGE); - Reply = (PLSASS_REPLY)RawReply; + Reply = (PLSASS_REPLY)&RawReply; Status = NtRequestWaitReplyPort(LsaHandle, &Request->Header, @@ -304,7 +304,7 @@ Request.Type = LSASS_REQUEST_REGISTER_LOGON_PROCESS; Request.Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) - - LPC_MESSAGE_BASE_SIZE; + sizeof(PORT_MESSAGE); Request.Header.u1.s1.TotalLength = sizeof(LSASS_REQUEST); Request.d.RegisterLogonProcessRequest.Length = LsaLogonProcessName->Length; _____ Modified: trunk/reactos/ntoskrnl/include/internal/port.h --- trunk/reactos/ntoskrnl/include/internal/port.h 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/ntoskrnl/include/internal/port.h 2005-08-16 23:05:33 UTC (rev 17417) @@ -88,7 +88,6 @@ PEPORT Sender; LIST_ENTRY QueueListEntry; PORT_MESSAGE Message; - UCHAR MessageData [MAX_MESSAGE_DATA]; } QUEUEDMESSAGE, *PQUEUEDMESSAGE; typedef struct _LPC_DBG_MESSAGE _____ Modified: trunk/reactos/ntoskrnl/io/error.c --- trunk/reactos/ntoskrnl/io/error.c 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/ntoskrnl/io/error.c 2005-08-16 23:05:33 UTC (rev 17417) @@ -159,7 +159,7 @@ IopLogWorker (PVOID Parameter) { PERROR_LOG_ENTRY LogEntry; - PLPC_MAX_MESSAGE Request; + PPORT_MESSAGE Request; PIO_ERROR_LOG_MESSAGE Message; PIO_ERROR_LOG_PACKET Packet; KIRQL Irql; @@ -249,7 +249,7 @@ /* Allocate request buffer */ Request = ExAllocatePool (NonPagedPool, - sizeof(LPC_MAX_MESSAGE)); + sizeof(PORT_MESSAGE) + PORT_MAXIMUM_MESSAGE_LENGTH); if (Request == NULL) { DPRINT ("Failed to allocate request buffer!\n"); @@ -264,7 +264,7 @@ } /* Initialize the log message */ - Message = (PIO_ERROR_LOG_MESSAGE)Request->Data; + Message = (PIO_ERROR_LOG_MESSAGE)(Request + 1); Message->Type = IO_TYPE_ERROR_MESSAGE; Message->Size = sizeof(IO_ERROR_LOG_MESSAGE) - sizeof(IO_ERROR_LOG_PACKET) + @@ -285,13 +285,13 @@ DPRINT ("SequenceNumber %lx\n", Packet->SequenceNumber); - Request->Header.u1.s1.DataLength = Message->Size; - Request->Header.u1.s1.TotalLength = - Request->Header.u1.s1.DataLength + sizeof(PPORT_MESSAGE); + Request->u1.s1.DataLength = Message->Size; + Request->u1.s1.TotalLength = + Request->u1.s1.DataLength + sizeof(PPORT_MESSAGE); /* Send the error message to the log port */ Status = ZwRequestPort (IopLogPort, - &Request->Header); + Request); /* Release request buffer */ ExFreePool (Request); _____ Modified: trunk/reactos/ntoskrnl/lpc/send.c --- trunk/reactos/ntoskrnl/lpc/send.c 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/ntoskrnl/lpc/send.c 2005-08-16 23:05:33 UTC (rev 17417) @@ -292,7 +292,7 @@ KeDetachProcess(); } - if (LpcRequestMessageSize > (sizeof(PORT_MESSAGE) + MAX_MESSAGE_DATA)) + if (LpcRequestMessageSize > LPC_MAX_MESSAGE_LENGTH) { if (NULL != AttachedProcess) { @@ -347,7 +347,7 @@ LpcRequestDataSize = LpcRequest->u1.s1.DataLength; } - if (LpcRequestMessageSize > (sizeof(PORT_MESSAGE) + MAX_MESSAGE_DATA)) + if (LpcRequestMessageSize > LPC_MAX_MESSAGE_LENGTH) { ExFreePool(LpcRequest); if (NULL != AttachedProcess) _____ Modified: trunk/reactos/services/eventlog/eventlog.h --- trunk/reactos/services/eventlog/eventlog.h 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/services/eventlog/eventlog.h 2005-08-16 23:05:33 UTC (rev 17417) @@ -2,6 +2,11 @@ #ifndef __EVENTLOG_H__ #define __EVENTLOG_H__ +typedef struct _IO_ERROR_LPC +{ + PORT_MESSAGE Header; + IO_ERROR_LOG_MESSAGE Message; +} IO_ERROR_LPC, *PIO_ERROR_LPC; BOOL StartPortThread(VOID); _____ Modified: trunk/reactos/services/eventlog/logport.c --- trunk/reactos/services/eventlog/logport.c 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/services/eventlog/logport.c 2005-08-16 23:05:33 UTC (rev 17417) @@ -50,7 +50,7 @@ { OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING PortName; - LPC_MAX_MESSAGE Request; + PORT_MESSAGE Request; NTSTATUS Status; ConnectPortHandle = NULL; @@ -76,7 +76,7 @@ } Status = NtListenPort(ConnectPortHandle, - &Request.Header); + &Request); if (!NT_SUCCESS(Status)) { DPRINT1("NtListenPort() failed (Status %lx)\n", Status); @@ -115,11 +115,10 @@ return Status; } - static NTSTATUS ProcessPortMessage(VOID) { - LPC_MAX_MESSAGE Request; + IO_ERROR_LPC Request; PIO_ERROR_LOG_MESSAGE Message; //#ifndef NDEBUG ULONG i; @@ -162,7 +161,7 @@ DPRINT("Received datagram\n"); - Message = (PIO_ERROR_LOG_MESSAGE)&Request.Data; + Message = (PIO_ERROR_LOG_MESSAGE)&Request.Message; DPRINT("Message->Type %hx\n", Message->Type); DPRINT("Message->Size %hu\n", Message->Size); _____ Modified: trunk/reactos/subsys/csrss/api/process.c --- trunk/reactos/subsys/csrss/api/process.c 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/subsys/csrss/api/process.c 2005-08-16 23:05:33 UTC (rev 17417) @@ -194,7 +194,7 @@ PCSRSS_PROCESS_DATA NewProcessData; NTSTATUS Status; - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); NewProcessData = CsrCreateProcessData(Request->Data.CreateProcessRequest.NewProcessId); @@ -224,7 +224,7 @@ CSR_API(CsrTerminateProcess) { - Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE); if (ProcessData == NULL) @@ -239,7 +239,7 @@ CSR_API(CsrConnectProcess) { Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); Request->Status = STATUS_SUCCESS; @@ -249,7 +249,7 @@ CSR_API(CsrGetShutdownParameters) { Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); if (ProcessData == NULL) { @@ -267,7 +267,7 @@ CSR_API(CsrSetShutdownParameters) { Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); if (ProcessData == NULL) { @@ -285,7 +285,7 @@ CSR_API(CsrGetInputHandle) { Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); if (ProcessData == NULL) { @@ -310,7 +310,7 @@ CSR_API(CsrGetOutputHandle) { Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); if (ProcessData == NULL) { @@ -337,7 +337,7 @@ CSR_API(CsrCloseHandle) { Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); if (ProcessData == NULL) { @@ -353,7 +353,7 @@ CSR_API(CsrVerifyHandle) { Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); Request->Status = CsrVerifyObject(ProcessData, Request->Data.VerifyHandleRequest.Handle); if (!NT_SUCCESS(Request->Status)) @@ -369,7 +369,7 @@ Object_t *Object; Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); ProcessData = CsrGetProcessData(Request->Data.DuplicateHandleRequest.ProcessId); Request->Status = CsrGetObject(ProcessData, Request->Data.DuplicateHandleRequest.Handle, &Object); @@ -389,7 +389,7 @@ CSR_API(CsrGetInputWaitHandle) { Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); if (ProcessData == NULL) { _____ Modified: trunk/reactos/subsys/csrss/api/user.c --- trunk/reactos/subsys/csrss/api/user.c 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/subsys/csrss/api/user.c 2005-08-16 23:05:33 UTC (rev 17417) @@ -27,7 +27,7 @@ NTSTATUS Status; Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); if (ServicesProcessIdValid == TRUE) { _____ Modified: trunk/reactos/subsys/csrss/api/wapi.c --- trunk/reactos/subsys/csrss/api/wapi.c 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/subsys/csrss/api/wapi.c 2005-08-16 23:05:33 UTC (rev 17417) @@ -97,7 +97,7 @@ { DPRINT1("CSR: Unknown request type 0x%x\n", Request->Type); Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); Request->Status = STATUS_INVALID_SYSTEM_SERVICE; } } @@ -108,8 +108,7 @@ ClientConnectionThread(HANDLE ServerPort) { NTSTATUS Status; - LPC_MAX_MESSAGE LpcRequest; - PCSR_API_MESSAGE Request; + CSR_API_MESSAGE Request; PCSR_API_MESSAGE Reply; PCSRSS_PROCESS_DATA ProcessData; @@ -125,7 +124,7 @@ Status = NtReplyWaitReceivePort(ServerPort, 0, &Reply->Header, - &LpcRequest.Header); + &Request.Header); if (!NT_SUCCESS(Status)) { DPRINT1("CSR: NtReplyWaitReceivePort failed\n"); @@ -133,34 +132,31 @@ } /* If the connection was closed, handle that */ - if (LpcRequest.Header.u2.s2.Type == LPC_PORT_CLOSED) + if (Request.Header.u2.s2.Type == LPC_PORT_CLOSED) { - CsrFreeProcessData( LpcRequest.Header.ClientId.UniqueProcess ); + CsrFreeProcessData( Request.Header.ClientId.UniqueProcess ); break; } - - /* Get the CSR Message */ - Request = (PCSR_API_MESSAGE)&LpcRequest; - + DPRINT("CSR: Got CSR API: %x [Message Origin: %x]\n", - Request->Type, - Request->Header.ClientId.UniqueProcess); + Request.Type, + Request.Header.ClientId.UniqueProcess); /* Get the Process Data */ - ProcessData = CsrGetProcessData(LpcRequest.Header.ClientId.UniqueProcess); + ProcessData = CsrGetProcessData(Request.Header.ClientId.UniqueProcess); if (ProcessData == NULL) { DPRINT1("CSR: Message %d: Unable to find data for process 0x%x\n", - LpcRequest.Header.u2.s2.Type, - LpcRequest.Header.ClientId.UniqueProcess); + Request.Header.u2.s2.Type, + Request.Header.ClientId.UniqueProcess); break; } /* Call the Handler */ - CsrApiCallHandler(ProcessData, Request); + CsrApiCallHandler(ProcessData, &Request); /* Send back the reply */ - Reply = Request; + Reply = &Request; } /* Close the port and exit the thread */ @@ -180,7 +176,7 @@ ServerApiPortThread (PVOID PortHandle) { NTSTATUS Status = STATUS_SUCCESS; - LPC_MAX_MESSAGE Request; + PORT_MESSAGE Request; HANDLE hApiListenPort = * (PHANDLE) PortHandle; HANDLE ServerPort = (HANDLE) 0; HANDLE ServerThread = (HANDLE) 0; @@ -195,7 +191,7 @@ REMOTE_PORT_VIEW LpcRead; ServerPort = NULL; - Status = NtListenPort (hApiListenPort, & Request.Header); + Status = NtListenPort (hApiListenPort, &Request); if (!NT_SUCCESS(Status)) { DPRINT1("CSR: NtListenPort() failed\n"); @@ -213,11 +209,11 @@ break; } - ProcessData = CsrCreateProcessData(Request.Header.ClientId.UniqueProcess); + ProcessData = CsrCreateProcessData(Request.ClientId.UniqueProcess); if (ProcessData == NULL) { DPRINT1("Unable to allocate or find data for process 0x%x\n", - Request.Header.ClientId.UniqueProcess); + Request.ClientId.UniqueProcess); Status = STATUS_UNSUCCESSFUL; break; } @@ -273,14 +269,14 @@ { HANDLE hSbApiPortListen = * (PHANDLE) PortHandle; HANDLE hConnectedPort = (HANDLE) 0; - LPC_MAX_MESSAGE Request; + PORT_MESSAGE Request; PVOID Context = NULL; NTSTATUS Status = STATUS_SUCCESS; DPRINT("CSR: %s called\n", __FUNCTION__); - RtlZeroMemory(&Request, sizeof(LPC_MAX_MESSAGE)); - Status = NtListenPort (hSbApiPortListen, & Request.Header); + RtlZeroMemory(&Request, sizeof(PORT_MESSAGE)); + Status = NtListenPort (hSbApiPortListen, & Request); if (!NT_SUCCESS(Status)) { DPRINT1("CSR: %s: NtListenPort(SB) failed (Status=0x%08lx)\n", @@ -324,19 +320,19 @@ Status = NtReplyWaitReceivePort(hConnectedPort, Context, Reply, - & Request.Header); + & Request); if(!NT_SUCCESS(Status)) { DPRINT1("CSR: %s: NtReplyWaitReceivePort failed (Status=0x%08lx)\n", __FUNCTION__, Status); break; } - switch (Request.Header.u2.s2.Type)//fix .h PORT_MESSAGE_TYPE(Request)) + switch (Request.u2.s2.Type)//fix .h PORT_MESSAGE_TYPE(Request)) { /* TODO */ default: DPRINT1("CSR: %s received message (type=%d)\n", - __FUNCTION__, Request.Header.u2.s2.Type); + __FUNCTION__, Request.u2.s2.Type); } DPRINT("-- 5\n"); } _____ Modified: trunk/reactos/subsys/csrss/win32csr/conio.c --- trunk/reactos/subsys/csrss/win32csr/conio.c 2005-08-16 22:16:09 UTC (rev 17416) +++ trunk/reactos/subsys/csrss/win32csr/conio.c 2005-08-16 23:05:33 UTC (rev 17417) @@ -228,7 +228,7 @@ DPRINT("CsrAllocConsole\n"); Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); if (ProcessData == NULL) { @@ -357,7 +357,7 @@ DPRINT("CsrFreeConsole\n"); Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); if (ProcessData == NULL || ProcessData->Console == NULL) { @@ -562,7 +562,7 @@ /* truncate length to CSRSS_MAX_READ_CONSOLE_REQUEST */ nNumberOfCharsToRead = min(Request->Data.ReadConsoleRequest.NrCharactersToRead, CSRSS_MAX_READ_CONSOLE / CharSize); Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = Request->Header.u1.s1.TotalLength - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = Request->Header.u1.s1.TotalLength - sizeof(PORT_MESSAGE); Buffer = Request->Data.ReadConsoleRequest.Buffer; UnicodeBuffer = (PWCHAR)Buffer; @@ -927,13 +927,13 @@ { DPRINT1("Invalid request size\n"); Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); return Request->Status = STATUS_INVALID_PARAMETER; } Status = ConioConsoleFromProcessData(ProcessData, &Console); Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); if (! NT_SUCCESS(Status)) { @@ -1431,7 +1431,7 @@ DPRINT("CsrGetScreenBufferInfo\n"); Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); Status = ConioLockScreenBuffer(ProcessData, Request->Data.ScreenBufferInfoRequest.ConsoleHandle, &Buff); if (! NT_SUCCESS(Status)) @@ -1474,7 +1474,7 @@ [truncated at 1000 lines; 558 more skipped]
19 years, 4 months
1
0
0
0
[ea] 17416: Add a stub for NTDLL!CsrGetProcessId.
by ea@svn.reactos.com
Add a stub for NTDLL!CsrGetProcessId. Added: trunk/reactos/lib/ntdll/csr/srv.c Modified: trunk/reactos/lib/ntdll/def/ntdll.def Modified: trunk/reactos/lib/ntdll/ntdll.xml _____ Added: trunk/reactos/lib/ntdll/csr/srv.c --- trunk/reactos/lib/ntdll/csr/srv.c 2005-08-16 20:36:03 UTC (rev 17415) +++ trunk/reactos/lib/ntdll/csr/srv.c 2005-08-16 22:16:09 UTC (rev 17416) @@ -0,0 +1,25 @@ +/* $Id$ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: lib/ntdll/csr/srv.c + * PURPOSE: Get CSR.EXE PID + * + */ + +/* INCLUDES *****************************************************************/ + +#include <ntdll.h> +#define NDEBUG +#include <debug.h> + +/* GLOBALS *******************************************************************/ + +DWORD ProcessId = 0; // TODO: set it on startup + +DWORD STDCALL CsrGetProcessId (VOID) +{ + return ProcessId; +} + +/* EOF */ Property changes on: trunk/reactos/lib/ntdll/csr/srv.c ___________________________________________________________________ Name: svn:keywords + author date id revision Name: svn:eol-style + native _____ Modified: trunk/reactos/lib/ntdll/def/ntdll.def --- trunk/reactos/lib/ntdll/def/ntdll.def 2005-08-16 20:36:03 UTC (rev 17415) +++ trunk/reactos/lib/ntdll/def/ntdll.def 2005-08-16 22:16:09 UTC (rev 17416) @@ -16,6 +16,7 @@ CsrClientCallServer@16 CsrClientConnectToServer@24 CsrFreeCaptureBuffer@4 +CsrGetProcessId@0 CsrIdentifyAlertableThread@0 CsrNewThread@0 CsrProbeForRead@12 _____ Modified: trunk/reactos/lib/ntdll/ntdll.xml --- trunk/reactos/lib/ntdll/ntdll.xml 2005-08-16 20:36:03 UTC (rev 17415) +++ trunk/reactos/lib/ntdll/ntdll.xml 2005-08-16 22:16:09 UTC (rev 17416) @@ -17,6 +17,7 @@ <file>capture.c</file> <file>lpc.c</file> <file>probe.c</file> + <file>srv.c</file> <file>thread.c</file> </directory> <directory name="dbg">
19 years, 4 months
1
0
0
0
[hbirr] 17415: - Fixed the offset calculation in MmWritePagePhysicalAddress and MmPageOutPhysicalAddress.
by hbirr@svn.reactos.com
- Fixed the offset calculation in MmWritePagePhysicalAddress and MmPageOutPhysicalAddress. - Add some code which will check for adding of multiple rmap entries. Modified: trunk/reactos/ntoskrnl/mm/rmap.c _____ Modified: trunk/reactos/ntoskrnl/mm/rmap.c --- trunk/reactos/ntoskrnl/mm/rmap.c 2005-08-16 16:17:47 UTC (rev 17414) +++ trunk/reactos/ntoskrnl/mm/rmap.c 2005-08-16 20:36:03 UTC (rev 17415) @@ -21,6 +21,9 @@ struct _MM_RMAP_ENTRY* Next; PEPROCESS Process; PVOID Address; +#ifdef DBG + PVOID Caller; +#endif } MM_RMAP_ENTRY, *PMM_RMAP_ENTRY; @@ -110,8 +113,8 @@ Type = MemoryArea->Type; if (Type == MEMORY_AREA_SECTION_VIEW) { - Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress; - + Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress + + MemoryArea->Data.SectionData.ViewOffset; /* * Get or create a pageop */ @@ -234,7 +237,8 @@ Type = MemoryArea->Type; if (Type == MEMORY_AREA_SECTION_VIEW) { - Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress; + Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress + + MemoryArea->Data.SectionData.ViewOffset;; /* * Get or create a pageop @@ -381,6 +385,9 @@ } new_entry->Address = Address; new_entry->Process = Process; +#ifdef DBG + new_entry->Caller = __builtin_return_address(0); +#endif if (MmGetPfnForProcess(Process, Address) != Page) { @@ -394,6 +401,22 @@ ExAcquireFastMutex(&RmapListLock); current_entry = MmGetRmapListHeadPage(Page); new_entry->Next = current_entry; +#ifdef DBG + while (current_entry) + { + if (current_entry->Address == new_entry->Address && current_entry->Process == new_entry->Process) + { + DbgPrint("MmInsertRmap tries to add a second rmap entry for address %p\n current caller ", + current_entry->Address); + KeRosPrintAddress(new_entry->Caller); + DbgPrint("\n previous caller "); + KeRosPrintAddress(current_entry->Caller); + DbgPrint("\n"); + KeBugCheck(0); + } + current_entry = current_entry->Next; + } +#endif MmSetRmapListHeadPage(Page, new_entry); ExReleaseFastMutex(&RmapListLock); if (Process == NULL)
19 years, 4 months
1
0
0
0
[hbirr] 17414: If we delete a page table, we have also to clear the entry in the page directory area explicitly. This may fix parts of bug #710.
by hbirr@svn.reactos.com
If we delete a page table, we have also to clear the entry in the page directory area explicitly. This may fix parts of bug #710. Modified: trunk/reactos/ntoskrnl/mm/i386/page.c _____ Modified: trunk/reactos/ntoskrnl/mm/i386/page.c --- trunk/reactos/ntoskrnl/mm/i386/page.c 2005-08-16 15:47:38 UTC (rev 17413) +++ trunk/reactos/ntoskrnl/mm/i386/page.c 2005-08-16 16:17:47 UTC (rev 17414) @@ -411,17 +411,18 @@ { ULONGLONG ZeroPde = 0LL; ExfpInterlockedExchange64UL(PAE_ADDR_TO_PDE(Address), &ZeroPde); + MiFlushTlb((PULONG)PAE_ADDR_TO_PDE(Address), PAE_ADDR_TO_PTE(Address)); } else { *(ADDR_TO_PDE(Address)) = 0; + MiFlushTlb(ADDR_TO_PDE(Address), ADDR_TO_PTE(Address)); } if (Address >= MmSystemRangeStart) { KEBUGCHECK(0); // MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0; } - MiFlushTlb(NULL, Address); if (Process != NULL && Process != CurrentProcess) { KeDetachProcess(); @@ -455,6 +456,7 @@ } Pfn = PAE_PTE_TO_PFN(*(PAE_ADDR_TO_PDE(Address))); ExfpInterlockedExchange64UL(PAE_ADDR_TO_PDE(Address), &ZeroPte); + MiFlushTlb((PULONG)PAE_ADDR_TO_PDE(Address), PAE_ADDR_TO_PTE(Address)); } else { @@ -471,8 +473,8 @@ } Pfn = PTE_TO_PFN(*(ADDR_TO_PDE(Address))); *(ADDR_TO_PDE(Address)) = 0; + MiFlushTlb(ADDR_TO_PDE(Address), ADDR_TO_PTE(Address)); } - MiFlushTlb(NULL, Address); if (Address >= MmSystemRangeStart) {
19 years, 4 months
1
0
0
0
[chorns] 17413: module_test proxy makefile support
by chorns@svn.reactos.com
module_test proxy makefile support Modified: trunk/reactos/proxy.mak _____ Modified: trunk/reactos/proxy.mak --- trunk/reactos/proxy.mak 2005-08-16 14:39:17 UTC (rev 17412) +++ trunk/reactos/proxy.mak 2005-08-16 15:47:38 UTC (rev 17413) @@ -15,4 +15,7 @@ clean: @$(MAKE) -C $(TOP) $(DEFAULT)_clean +test: + @$(MAKE) -C $(TOP) $(DEFAULT)_test + $(DEFAULT)_clean: clean
19 years, 4 months
1
0
0
0
[chorns] 17412: Change o to optional
by chorns@svn.reactos.com
Change o to optional Modified: trunk/reactos/bootdata/packages/reactos.dff _____ Modified: trunk/reactos/bootdata/packages/reactos.dff --- trunk/reactos/bootdata/packages/reactos.dff 2005-08-16 14:24:00 UTC (rev 17411) +++ trunk/reactos/bootdata/packages/reactos.dff 2005-08-16 14:39:17 UTC (rev 17412) @@ -287,8 +287,8 @@ modules\os2\lib\doscalls\doscalls.dll 1 optional modules\posix\server\psxsrv.dll 1 optional modules\posix\lib\psxdll\psxdll.dll 1 optional -modules\rosky\lib\libsky\libsky.dll 1 o -modules\rosky\lib\libskygi\libskygi.dll 1 o +modules\rosky\lib\libsky\libsky.dll 1 optional +modules\rosky\lib\libskygi\libskygi.dll 1 optional modules\vms\server\vmssrv.dll 1 optional modules\vms\lib\vmsdll\vmsdll.dll 1 optional modules\rosapps\cmdutils\find.exe 1 optional
19 years, 4 months
1
0
0
0
[ea] 17411: Make NTDLL not bind automatically to the Win32 server.
by ea@svn.reactos.com
Make NTDLL not bind automatically to the Win32 server. This will allow other personality subsystem not to depend on Win32. Modified: trunk/reactos/lib/kernel32/misc/dllmain.c Modified: trunk/reactos/lib/ntdll/csr/lpc.c Modified: trunk/reactos/subsys/csrss/init.c _____ Modified: trunk/reactos/lib/kernel32/misc/dllmain.c --- trunk/reactos/lib/kernel32/misc/dllmain.c 2005-08-16 05:17:06 UTC (rev 17410) +++ trunk/reactos/lib/kernel32/misc/dllmain.c 2005-08-16 14:24:00 UTC (rev 17411) @@ -218,7 +218,7 @@ /* * Connect to the csrss server */ - Status = CsrClientConnectToServer(NULL, + Status = CsrClientConnectToServer(L"\\Windows\\ApiPort", 0, NULL, NULL, _____ Modified: trunk/reactos/lib/ntdll/csr/lpc.c --- trunk/reactos/lib/ntdll/csr/lpc.c 2005-08-16 05:17:06 UTC (rev 17410) +++ trunk/reactos/lib/ntdll/csr/lpc.c 2005-08-16 14:24:00 UTC (rev 17411) @@ -109,8 +109,8 @@ ULONG ContextLength, PBOOLEAN ServerToServerCall) { - NTSTATUS Status; - UNICODE_STRING PortName = RTL_CONSTANT_STRING(L"\\Windows\\ApiPort"); + NTSTATUS Status = STATUS_SUCCESS; + UNICODE_STRING PortName; ULONG ConnectInfoLength; CSR_API_MESSAGE Request; PORT_VIEW LpcWrite; @@ -122,6 +122,13 @@ return STATUS_SUCCESS; } + if (NULL == ObjectDirectory) + { + return STATUS_INVALID_PARAMETER; + } + + RtlInitUnicodeString (& PortName, ObjectDirectory); + CsrSectionViewSize.QuadPart = CSR_CSRSS_SECTION_SIZE; Status = NtCreateSection(&CsrSectionHandle, SECTION_ALL_ACCESS, _____ Modified: trunk/reactos/subsys/csrss/init.c --- trunk/reactos/subsys/csrss/init.c 2005-08-16 05:17:06 UTC (rev 17410) +++ trunk/reactos/subsys/csrss/init.c 2005-08-16 14:24:00 UTC (rev 17411) @@ -458,7 +458,8 @@ static NTSTATUS CsrpCCTS (ULONG argc, PWSTR* argv) { - return CsrClientConnectToServer(NULL, 0, NULL, NULL, 0, NULL); + return CsrClientConnectToServer(L"\\Windows\\ApiPort", + 0, NULL, NULL, 0, NULL); } /**********************************************************************
19 years, 4 months
1
0
0
0
[sedwards] 17410: Changes to get msi based installers mostly working
by sedwards@svn.reactos.com
Changes to get msi based installers mostly working ConvertStringSecurityDescriptorToSecurityDescriptor[W/A] - implement based on Winehq code InitiateSystemShutdownExW - add stub from Wine Convert registry source file to use Wine debugging Macros Modified: trunk/reactos/lib/advapi32/advapi32.def Modified: trunk/reactos/lib/advapi32/advapi32.h Modified: trunk/reactos/lib/advapi32/advapi32.xml Modified: trunk/reactos/lib/advapi32/misc/shutdown.c Modified: trunk/reactos/lib/advapi32/reg/reg.c Modified: trunk/reactos/lib/advapi32/sec/sid.c _____ Modified: trunk/reactos/lib/advapi32/advapi32.def --- trunk/reactos/lib/advapi32/advapi32.def 2005-08-16 00:27:39 UTC (rev 17409) +++ trunk/reactos/lib/advapi32/advapi32.def 2005-08-16 05:17:06 UTC (rev 17410) @@ -91,8 +91,8 @@ ;ConvertStringSDToSDDomainW@24 ;ConvertStringSDToSDRootDomainA@20 ;ConvertStringSDToSDRootDomainW@20 -;ConvertStringSecurityDescriptorToSecurityDescriptorA@20 -;ConvertStringSecurityDescriptorToSecurityDescriptorW@20 +ConvertStringSecurityDescriptorToSecurityDescriptorA@16 +ConvertStringSecurityDescriptorToSecurityDescriptorW@16 ;ConvertStringSidToSidA@8 ;ConvertStringSidToSidW@8 ConvertToAutoInheritPrivateObjectSecurity@24 @@ -315,7 +315,7 @@ InitializeSid@12 InitiateSystemShutdownA@20 ;InitiateSystemShutdownExA@24 -;InitiateSystemShutdownExW@24 +InitiateSystemShutdownExW@24 InitiateSystemShutdownW@20 ;InstallApplication IsTextUnicode(a)12=NTDLL.RtlIsTextUnicode _____ Modified: trunk/reactos/lib/advapi32/advapi32.h --- trunk/reactos/lib/advapi32/advapi32.h 2005-08-16 00:27:39 UTC (rev 17409) +++ trunk/reactos/lib/advapi32/advapi32.h 2005-08-16 05:17:06 UTC (rev 17410) @@ -14,6 +14,7 @@ /* PSDK/NDK Headers */ #include <windows.h> #include <accctrl.h> +#include <sddl.h> #define NTOS_MODE_USER #include <ndk/ntndk.h> _____ Modified: trunk/reactos/lib/advapi32/advapi32.xml --- trunk/reactos/lib/advapi32/advapi32.xml 2005-08-16 00:27:39 UTC (rev 17409) +++ trunk/reactos/lib/advapi32/advapi32.xml 2005-08-16 05:17:06 UTC (rev 17410) @@ -10,6 +10,7 @@ <library>ntdll</library> <library>kernel32</library> <library>rpcrt4</library> + <library>wine</library> <pch>advapi32.h</pch> <directory name="crypt"> <file>crypt.c</file> _____ Modified: trunk/reactos/lib/advapi32/misc/shutdown.c --- trunk/reactos/lib/advapi32/misc/shutdown.c 2005-08-16 00:27:39 UTC (rev 17409) +++ trunk/reactos/lib/advapi32/misc/shutdown.c 2005-08-16 05:17:06 UTC (rev 17410) @@ -11,6 +11,7 @@ */ #include <advapi32.h> +#include <wine/debug.h> #define USZ {0,0,0} @@ -146,4 +147,19 @@ return rv; } +/********************************************************************** ******** + * InitiateSystemShutdownExW [ADVAPI32.@] + * + * see InitiateSystemShutdownExA + */ +BOOL WINAPI InitiateSystemShutdownExW( LPWSTR lpMachineName, LPWSTR lpMessage, + DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown, + DWORD dwReason) +{ + FIXME("%s %s %ld %d %d %ld\n", debugstr_w(lpMachineName), + debugstr_w(lpMessage), dwTimeout, bForceAppsClosed, + bRebootAfterShutdown, dwReason); + return TRUE; +} + /* EOF */ _____ Modified: trunk/reactos/lib/advapi32/reg/reg.c --- trunk/reactos/lib/advapi32/reg/reg.c 2005-08-16 00:27:39 UTC (rev 17409) +++ trunk/reactos/lib/advapi32/reg/reg.c 2005-08-16 05:17:06 UTC (rev 17410) @@ -15,7 +15,7 @@ #include <advapi32.h> #define NDEBUG -#include <debug.h> +#include <wine/debug.h> /* DEFINES ******************************************************************/ @@ -56,7 +56,7 @@ BOOL RegInitialize (VOID) { - DPRINT("RegInitialize()\n"); + TRACE("RegInitialize()\n"); ProcessHeap = RtlGetProcessHeap(); RtlZeroMemory (DefaultHandleTable, @@ -73,7 +73,7 @@ BOOL RegCleanup (VOID) { - DPRINT("RegCleanup()\n"); + TRACE("RegCleanup()\n"); CloseDefaultKeys (); RtlDeleteCriticalSection (&HandleTableCS); @@ -90,7 +90,7 @@ ULONG Index; NTSTATUS Status = STATUS_SUCCESS; - DPRINT("MapDefaultKey (Key %x)\n", Key); + TRACE("MapDefaultKey (Key %x)\n", Key); if (((ULONG)Key & 0xF0000000) != 0x80000000) { @@ -142,7 +142,7 @@ break; default: - DPRINT("MapDefaultHandle() no handle creator\n"); + WARN("MapDefaultHandle() no handle creator\n"); Status = STATUS_INVALID_PARAMETER; } } @@ -181,7 +181,7 @@ OBJECT_ATTRIBUTES Attributes; UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software\\CLASSES"); - DPRINT("OpenClassesRootKey()\n"); + TRACE("OpenClassesRootKey()\n"); InitializeObjectAttributes (&Attributes, &KeyName, @@ -201,7 +201,7 @@ UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine"); NTSTATUS Status; - DPRINT("OpenLocalMachineKey()\n"); + TRACE("OpenLocalMachineKey()\n"); InitializeObjectAttributes (&Attributes, &KeyName, @@ -212,7 +212,7 @@ MAXIMUM_ALLOWED, &Attributes); - DPRINT("NtOpenKey(%wZ) => %08x\n", &KeyName, Status); + TRACE("NtOpenKey(%wZ) => %08x\n", &KeyName, Status); return Status; } @@ -223,7 +223,7 @@ OBJECT_ATTRIBUTES Attributes; UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\User"); - DPRINT("OpenUsersKey()\n"); + TRACE("OpenUsersKey()\n"); InitializeObjectAttributes (&Attributes, &KeyName, @@ -243,7 +243,7 @@ UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Ha rdware Profiles\\Current"); - DPRINT("OpenCurrentConfigKey()\n"); + TRACE("OpenCurrentConfigKey()\n"); InitializeObjectAttributes (&Attributes, &KeyName, @@ -341,7 +341,7 @@ ClassString, dwOptions, (PULONG)lpdwDisposition); - DPRINT("NtCreateKey(%wZ) called (Status %lx)\n", ObjectAttributes->ObjectName, Status); + TRACE("NtCreateKey(%wZ) called (Status %lx)\n", ObjectAttributes->ObjectName, Status); if (Status != STATUS_OBJECT_NAME_NOT_FOUND) return Status; @@ -373,7 +373,7 @@ NULL, 0, &Disposition); - DPRINT("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status); + TRACE("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status); } if (!NT_SUCCESS(Status)) @@ -410,7 +410,7 @@ NULL, 0, &Disposition); - DPRINT("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status); + TRACE("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status); if (!NT_SUCCESS(Status)) break; } @@ -443,7 +443,7 @@ HANDLE ParentKey; NTSTATUS Status; - DPRINT("RegCreateKeyExA() called\n"); + TRACE("RegCreateKeyExA() called\n"); /* get the real parent key */ Status = MapDefaultKey (&ParentKey, @@ -452,7 +452,7 @@ { return RtlNtStatusToDosError (Status); } - DPRINT("ParentKey %x\n", (ULONG)ParentKey); + TRACE("ParentKey %x\n", (ULONG)ParentKey); if (lpClass != NULL) { @@ -479,7 +479,7 @@ RtlFreeUnicodeString (&ClassString); } - DPRINT("Status %x\n", Status); + TRACE("Status %x\n", Status); if (!NT_SUCCESS(Status)) { return RtlNtStatusToDosError (Status); @@ -511,7 +511,7 @@ HANDLE ParentKey; NTSTATUS Status; - DPRINT("RegCreateKeyExW() called\n"); + TRACE("RegCreateKeyExW() called\n"); /* get the real parent key */ Status = MapDefaultKey (&ParentKey, @@ -520,7 +520,7 @@ { return RtlNtStatusToDosError(Status); } - DPRINT("ParentKey %x\n", (ULONG)ParentKey); + TRACE("ParentKey %x\n", (ULONG)ParentKey); RtlInitUnicodeString (&ClassString, lpClass); @@ -537,7 +537,7 @@ dwOptions, samDesired, lpdwDisposition); - DPRINT("Status %x\n", Status); + TRACE("Status %x\n", Status); if (!NT_SUCCESS(Status)) { return RtlNtStatusToDosError (Status); @@ -838,7 +838,7 @@ HANDLE KeyHandle; NTSTATUS Status; - DPRINT("RegEnumKeyExA(hKey 0x%x, dwIndex %d, lpName 0x%x, *lpcbName %d, lpClass 0x%x, lpcbClass %d)\n", + TRACE("RegEnumKeyExA(hKey 0x%x, dwIndex %d, lpName 0x%x, *lpcbName %d, lpClass 0x%x, lpcbClass %d)\n", hKey, dwIndex, lpName, *lpcbName, lpClass, lpcbClass ? *lpcbClass : 0); if ((lpClass) && (!lpcbClass)) @@ -892,7 +892,7 @@ KeyInfo, BufferSize, &ResultSize); - DPRINT("NtEnumerateKey() returned status 0x%X\n", Status); + TRACE("NtEnumerateKey() returned status 0x%X\n", Status); if (!NT_SUCCESS(Status)) { ErrorCode = RtlNtStatusToDosError (Status); @@ -960,10 +960,10 @@ } } - DPRINT("Key Namea0 Length %d\n", StringU.Length); - DPRINT("Key Namea1 Length %d\n", NameLength); - DPRINT("Key Namea Length %d\n", *lpcbName); - DPRINT("Key Namea %s\n", lpName); + TRACE("Key Namea0 Length %d\n", StringU.Length); + TRACE("Key Namea1 Length %d\n", NameLength); + TRACE("Key Namea Length %d\n", *lpcbName); + TRACE("Key Namea %s\n", lpName); RtlFreeHeap (ProcessHeap, 0, @@ -1050,7 +1050,7 @@ KeyInfo, BufferSize, &ResultSize); - DPRINT("NtEnumerateKey() returned status 0x%X\n", Status); + TRACE("NtEnumerateKey() returned status 0x%X\n", Status); if (!NT_SUCCESS(Status)) { ErrorCode = RtlNtStatusToDosError (Status); @@ -1386,7 +1386,7 @@ hKey); if (!NT_SUCCESS(Status)) { - DPRINT("MapDefaultKey() failed (Status %lx)\n", Status); + TRACE("MapDefaultKey() failed (Status %lx)\n", Status); return RtlNtStatusToDosError (Status); } @@ -1397,7 +1397,7 @@ lpcbSecurityDescriptor); if (!NT_SUCCESS(Status)) { - DPRINT("NtQuerySecurityObject() failed (Status %lx)\n", Status); + WARN("NtQuerySecurityObject() failed (Status %lx)\n", Status); return RtlNtStatusToDosError (Status); } @@ -1590,7 +1590,7 @@ LPCSTR lpSubKey, PHKEY phkResult) { - DPRINT("RegOpenKeyA hKey 0x%x lpSubKey %s phkResult %p\n", hKey, lpSubKey, phkResult); + TRACE("RegOpenKeyA hKey 0x%x lpSubKey %s phkResult %p\n", hKey, lpSubKey, phkResult); if (!lpSubKey || !*lpSubKey) { @@ -1616,7 +1616,7 @@ LPCWSTR lpSubKey, PHKEY phkResult) { - DPRINT("RegOpenKeyW hKey 0x%x lpSubKey %S phkResult %p\n", hKey, lpSubKey, phkResult); + TRACE("RegOpenKeyW hKey 0x%x lpSubKey %S phkResult %p\n", hKey, lpSubKey, phkResult); if (!lpSubKey || !*lpSubKey) { @@ -1644,7 +1644,7 @@ HANDLE KeyHandle; NTSTATUS Status; - DPRINT("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n", + TRACE("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n", hKey, lpSubKey, ulOptions, samDesired, phkResult); Status = MapDefaultKey (&KeyHandle, hKey); @@ -1688,7 +1688,7 @@ HANDLE KeyHandle; NTSTATUS Status; - DPRINT("RegOpenKeyExW hKey 0x%x lpSubKey %S ulOptions 0x%x samDesired 0x%x phkResult %p\n", + TRACE("RegOpenKeyExW hKey 0x%x lpSubKey %S ulOptions 0x%x samDesired 0x%x phkResult %p\n", hKey, lpSubKey, ulOptions, samDesired, phkResult); Status = MapDefaultKey (&KeyHandle, hKey); @@ -1837,7 +1837,7 @@ RtlAppendUnicodeToString(&UserClassesKeyRoot, UserClassesKeySuffix); - DPRINT("RegOpenUserClassesRoot: Absolute path: %wZ\n", &UserClassesKeyRoot); + TRACE("RegOpenUserClassesRoot: Absolute path: %wZ\n", &UserClassesKeyRoot); /* * Open the key @@ -2001,7 +2001,7 @@ FullInfo, FullInfoSize, &Length); - DPRINT("NtQueryKey() returned status 0x%X\n", Status); + TRACE("NtQueryKey() returned status 0x%X\n", Status); if (!NT_SUCCESS(Status)) { if (lpClass != NULL) @@ -2014,37 +2014,37 @@ return RtlNtStatusToDosError (Status); } - DPRINT("SubKeys %d\n", FullInfo->SubKeys); + TRACE("SubKeys %d\n", FullInfo->SubKeys); if (lpcSubKeys != NULL) { *lpcSubKeys = FullInfo->SubKeys; } - DPRINT("MaxNameLen %lu\n", FullInfo->MaxNameLen); + TRACE("MaxNameLen %lu\n", FullInfo->MaxNameLen); if (lpcbMaxSubKeyLen != NULL) { *lpcbMaxSubKeyLen = FullInfo->MaxNameLen / sizeof(WCHAR) + 1; } - DPRINT("MaxClassLen %lu\n", FullInfo->MaxClassLen); + TRACE("MaxClassLen %lu\n", FullInfo->MaxClassLen); if (lpcbMaxClassLen != NULL) { *lpcbMaxClassLen = FullInfo->MaxClassLen / sizeof(WCHAR) + 1; } - DPRINT("Values %lu\n", FullInfo->Values); + TRACE("Values %lu\n", FullInfo->Values); if (lpcValues != NULL) { *lpcValues = FullInfo->Values; } - DPRINT("MaxValueNameLen %lu\n", FullInfo->MaxValueNameLen); + TRACE("MaxValueNameLen %lu\n", FullInfo->MaxValueNameLen); if (lpcbMaxValueNameLen != NULL) { *lpcbMaxValueNameLen = FullInfo->MaxValueNameLen / sizeof(WCHAR) + 1; } - DPRINT("MaxValueDataLen %lu\n", FullInfo->MaxValueDataLen); + TRACE("MaxValueDataLen %lu\n", FullInfo->MaxValueDataLen); if (lpcbMaxValueLen != NULL) { *lpcbMaxValueLen = FullInfo->MaxValueDataLen; @@ -2124,7 +2124,7 @@ *ldwTotsize = 0; - DPRINT ("RegQueryMultipleValuesA(%p,%p,%ld,%p,%p=%ld)\n", + TRACE("RegQueryMultipleValuesA(%p,%p,%ld,%p,%p=%ld)\n", hKey, val_list, num_vals, lpValueBuf, ldwTotsize, *ldwTotsize); for (i = 0; i < num_vals; i++) @@ -2188,7 +2188,7 @@ *ldwTotsize = 0; - DPRINT ("RegQueryMultipleValuesW(%p,%p,%ld,%p,%p=%ld)\n", + TRACE ("RegQueryMultipleValuesW(%p,%p,%ld,%p,%p=%ld)\n", hKey, val_list, num_vals, lpValueBuf, ldwTotsize, *ldwTotsize); for (i = 0; i < num_vals; i++) @@ -2252,7 +2252,7 @@ LONG ErrorCode = ERROR_SUCCESS; ULONG MaxCopy = lpcbData != NULL && lpData != NULL ? *lpcbData : 0; - DPRINT("hKey 0x%X lpValueName %S lpData 0x%X lpcbData %d\n", + TRACE("hKey 0x%X lpValueName %S lpData 0x%X lpcbData %d\n", hKey, lpValueName, lpData, lpcbData ? *lpcbData : 0); Status = MapDefaultKey (&KeyHandle, @@ -2284,7 +2284,7 @@ ValueInfo, BufferSize, &ResultSize); - DPRINT("Status 0x%X\n", Status); + TRACE("Status 0x%X\n", Status); if (Status == STATUS_BUFFER_OVERFLOW) { /* Return ERROR_SUCCESS and the buffer space needed for a successful call */ @@ -2325,7 +2325,7 @@ if (lpcbData != NULL) { *lpcbData = (ResultSize - FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0])); - DPRINT("(string) Returning Size: %lu\n", *lpcbData); + TRACE("(string) Returning Size: %lu\n", *lpcbData); } } else @@ -2333,11 +2333,11 @@ if (lpcbData != NULL) { *lpcbData = ResultSize - FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]); - DPRINT("(other) Returning Size: %lu\n", *lpcbData); + TRACE("(other) Returning Size: %lu\n", *lpcbData); } } - DPRINT("Type %d Size %d\n", ValueInfo->Type, ValueInfo->DataLength); + TRACE("Type %d Size %d\n", ValueInfo->Type, ValueInfo->DataLength); RtlFreeHeap (ProcessHeap, 0, @@ -2367,7 +2367,7 @@ DWORD Length; DWORD Type; - DPRINT("hKey 0x%X lpValueName %s lpData 0x%X lpcbData %d\n", + TRACE("hKey 0x%X lpValueName %s lpData 0x%X lpcbData %d\n", hKey, lpValueName, lpData, lpcbData ? *lpcbData : 0); if (lpData != NULL && lpcbData == NULL) @@ -2404,7 +2404,7 @@ &Type, (lpData == NULL) ? NULL : (LPBYTE)ValueData.Buffer, &Length); - DPRINT("ErrorCode %lu\n", ErrorCode); + TRACE("ErrorCode %lu\n", ErrorCode); RtlFreeUnicodeString(&ValueName); if (ErrorCode == ERROR_SUCCESS || @@ -2473,7 +2473,7 @@ LONG ValueSize; LONG ErrorCode; - DPRINT("hKey 0x%X lpSubKey %s lpValue %p lpcbValue %d\n", + TRACE("hKey 0x%X lpSubKey %s lpValue %p lpcbValue %d\n", hKey, lpSubKey, lpValue, lpcbValue ? *lpcbValue : 0); if (lpValue != NULL && @@ -2562,7 +2562,7 @@ BOOL CloseRealKey; NTSTATUS Status; - DPRINT("hKey 0x%X lpSubKey %S lpValue %p lpcbValue %d\n", + TRACE("hKey 0x%X lpSubKey %S lpValue %p lpcbValue %d\n", hKey, lpSubKey, lpValue, lpcbValue ? *lpcbValue : 0); Status = MapDefaultKey (&KeyHandle, _____ Modified: trunk/reactos/lib/advapi32/sec/sid.c --- trunk/reactos/lib/advapi32/sec/sid.c 2005-08-16 00:27:39 UTC (rev 17409) +++ trunk/reactos/lib/advapi32/sec/sid.c 2005-08-16 05:17:06 UTC (rev 17410) @@ -1,16 +1,614 @@ /* $Id$ * * COPYRIGHT: See COPYING in the top level directory + * WINE COPYRIGHT: + * Copyright 1999, 2000 Juergen Schmied <juergen.schmied(a)debitel.net> + * Copyright 2003 CodeWeavers Inc. (Ulrich Czekalla) + * * PROJECT: ReactOS system libraries * FILE: lib/advapi32/sec/sid.c * PURPOSE: Security ID functions */ #include <advapi32.h> -#include <debug.h> +#include <wine/debug.h> +#include <wine/unicode.h> +WINE_DEFAULT_DEBUG_CHANNEL(advapi); + +static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes); +static BOOL ParseStringAclToAcl(LPCWSTR StringAcl, LPDWORD lpdwFlags, + PACL pAcl, LPDWORD cBytes); +static BYTE ParseAceStringFlags(LPCWSTR* StringAcl); +static BYTE ParseAceStringType(LPCWSTR* StringAcl); +static DWORD ParseAceStringRights(LPCWSTR* StringAcl); +static DWORD ParseAclStringFlags(LPCWSTR* StringAcl); + +typedef struct _ACEFLAG +{ + LPCWSTR wstr; + DWORD value; +} ACEFLAG, *LPACEFLAG; + +static SID const sidWorld = { SID_REVISION, 1, { SECURITY_WORLD_SID_AUTHORITY} , { SECURITY_WORLD_RID } }; + /* + * ACE access rights + */ +static const WCHAR SDDL_READ_CONTROL[] = {'R','C',0}; +static const WCHAR SDDL_WRITE_DAC[] = {'W','D',0}; +static const WCHAR SDDL_WRITE_OWNER[] = {'W','O',0}; +static const WCHAR SDDL_STANDARD_DELETE[] = {'S','D',0}; +static const WCHAR SDDL_GENERIC_ALL[] = {'G','A',0}; +static const WCHAR SDDL_GENERIC_READ[] = {'G','R',0}; +static const WCHAR SDDL_GENERIC_WRITE[] = {'G','W',0}; +static const WCHAR SDDL_GENERIC_EXECUTE[] = {'G','X',0}; + +/* + * ACE types + */ +static const WCHAR SDDL_ACCESS_ALLOWED[] = {'A',0}; +static const WCHAR SDDL_ACCESS_DENIED[] = {'D',0}; +static const WCHAR SDDL_OBJECT_ACCESS_ALLOWED[] = {'O','A',0}; +static const WCHAR SDDL_OBJECT_ACCESS_DENIED[] = {'O','D',0}; +static const WCHAR SDDL_AUDIT[] = {'A','U',0}; +static const WCHAR SDDL_ALARM[] = {'A','L',0}; +static const WCHAR SDDL_OBJECT_AUDIT[] = {'O','U',0}; +static const WCHAR SDDL_OBJECT_ALARMp[] = {'O','L',0}; + +/* + * ACE flags + */ +static const WCHAR SDDL_CONTAINER_INHERIT[] = {'C','I',0}; +static const WCHAR SDDL_OBJECT_INHERIT[] = {'O','I',0}; +static const WCHAR SDDL_NO_PROPAGATE[] = {'N','P',0}; +static const WCHAR SDDL_INHERIT_ONLY[] = {'I','O',0}; +static const WCHAR SDDL_INHERITED[] = {'I','D',0}; +static const WCHAR SDDL_AUDIT_SUCCESS[] = {'S','A',0}; +static const WCHAR SDDL_AUDIT_FAILURE[] = {'F','A',0}; + +/* set last error code from NT status and get the proper boolean return value */ +/* used for functions that are a simple wrapper around the corresponding ntdll API */ +static inline BOOL set_ntstatus( NTSTATUS status ) +{ + if (status) SetLastError( RtlNtStatusToDosError( status )); + return !status; +} + +#define WINE_SIZE_OF_WORLD_ACCESS_ACL (sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + sizeof(sidWorld) - sizeof(DWORD)) + + +/* some helper functions - taken from winehq cvs 20050916 */ +/********************************************************************** ******** + * ComputeStringSidSize + */ +static DWORD ComputeStringSidSize(LPCWSTR StringSid) +{ + int ctok = 0; + DWORD size = sizeof(SID); + + while (*StringSid) + { + if (*StringSid == '-') + ctok++; + StringSid++; + } + + if (ctok > 3) + size += (ctok - 3) * sizeof(DWORD); + + return size; +} + +/********************************************************************** ******** + * ParseAceStringType + */ +ACEFLAG AceType[] = +{ + { SDDL_ACCESS_ALLOWED, ACCESS_ALLOWED_ACE_TYPE }, + { SDDL_ALARM, SYSTEM_ALARM_ACE_TYPE }, + { SDDL_AUDIT, SYSTEM_AUDIT_ACE_TYPE }, + { SDDL_ACCESS_DENIED, ACCESS_DENIED_ACE_TYPE }, + /* + { SDDL_OBJECT_ACCESS_ALLOWED, ACCESS_ALLOWED_OBJECT_ACE_TYPE }, + { SDDL_OBJECT_ACCESS_DENIED, ACCESS_DENIED_OBJECT_ACE_TYPE }, + { SDDL_OBJECT_ALARM, SYSTEM_ALARM_OBJECT_ACE_TYPE }, + { SDDL_OBJECT_AUDIT, SYSTEM_AUDIT_OBJECT_ACE_TYPE }, + */ + { NULL, 0 }, +}; + +static BYTE ParseAceStringType(LPCWSTR* StringAcl) +{ + UINT len = 0; + LPCWSTR szAcl = *StringAcl; + LPACEFLAG lpaf = AceType; + + while (lpaf->wstr && + (len = strlenW(lpaf->wstr)) && + strncmpW(lpaf->wstr, szAcl, len)) + lpaf++; + + if (!lpaf->wstr) + return 0; + + *StringAcl += len; + return lpaf->value; +} + + +/********************************************************************** ******** + * ParseAceStringFlags + */ +ACEFLAG AceFlags[] = +{ + { SDDL_CONTAINER_INHERIT, CONTAINER_INHERIT_ACE }, + { SDDL_AUDIT_FAILURE, FAILED_ACCESS_ACE_FLAG }, + { SDDL_INHERITED, INHERITED_ACE }, + { SDDL_INHERIT_ONLY, INHERIT_ONLY_ACE }, + { SDDL_NO_PROPAGATE, NO_PROPAGATE_INHERIT_ACE }, + { SDDL_OBJECT_INHERIT, OBJECT_INHERIT_ACE }, + { SDDL_AUDIT_SUCCESS, SUCCESSFUL_ACCESS_ACE_FLAG }, + { NULL, 0 }, +}; + +static BYTE ParseAceStringFlags(LPCWSTR* StringAcl) +{ + UINT len = 0; + BYTE flags = 0; + LPCWSTR szAcl = *StringAcl; + + while (*szAcl != ';') + { + LPACEFLAG lpaf = AceFlags; + + while (lpaf->wstr && + (len = strlenW(lpaf->wstr)) && + strncmpW(lpaf->wstr, szAcl, len)) + lpaf++; + + if (!lpaf->wstr) + return 0; + + flags |= lpaf->value; + szAcl += len; + } + + *StringAcl = szAcl; + return flags; +} + + +/********************************************************************** ******** + * ParseAceStringRights + */ +ACEFLAG AceRights[] = +{ + { SDDL_GENERIC_ALL, GENERIC_ALL }, + { SDDL_GENERIC_READ, GENERIC_READ }, + { SDDL_GENERIC_WRITE, GENERIC_WRITE }, + { SDDL_GENERIC_EXECUTE, GENERIC_EXECUTE }, + { SDDL_READ_CONTROL, READ_CONTROL }, + { SDDL_STANDARD_DELETE, DELETE }, + { SDDL_WRITE_DAC, WRITE_DAC }, + { SDDL_WRITE_OWNER, WRITE_OWNER }, + { NULL, 0 }, +}; + +static DWORD ParseAceStringRights(LPCWSTR* StringAcl) +{ + UINT len = 0; + DWORD rights = 0; + LPCWSTR szAcl = *StringAcl; + + if ((*szAcl == '0') && (*(szAcl + 1) == 'x')) + { + LPCWSTR p = szAcl; + + while (*p && *p != ';') + p++; + + if (p - szAcl <= 8) + { + rights = strtoulW(szAcl, NULL, 16); + *StringAcl = p; + } + else + WARN("Invalid rights string format: %s\n", debugstr_wn(szAcl, p - szAcl)); + } + else + { + while (*szAcl != ';') + { + LPACEFLAG lpaf = AceRights; + + while (lpaf->wstr && + (len = strlenW(lpaf->wstr)) && + strncmpW(lpaf->wstr, szAcl, len)) + { + lpaf++; + } + + if (!lpaf->wstr) + return 0; + + rights |= lpaf->value; + szAcl += len; + } + } + + *StringAcl = szAcl; + return rights; +} + +/********************************************************************** ******** + * ParseStringAclToAcl + * + * dacl_flags(string_ace1)(string_ace2)... (string_acen) + */ +static BOOL ParseStringAclToAcl(LPCWSTR StringAcl, LPDWORD lpdwFlags, + PACL pAcl, LPDWORD cBytes) +{ + DWORD val; + DWORD sidlen; + DWORD length = sizeof(ACL); + PACCESS_ALLOWED_ACE pAce = NULL; /* pointer to current ACE */ + + TRACE("%s\n", debugstr_w(StringAcl)); + + if (!StringAcl) + return FALSE; + + if (pAcl) /* pAce is only useful if we're setting values */ + pAce = (PACCESS_ALLOWED_ACE) ((LPBYTE)pAcl + sizeof(PACL)); + + /* Parse ACL flags */ + *lpdwFlags = ParseAclStringFlags(&StringAcl); + + /* Parse ACE */ + while (*StringAcl == '(') + { + StringAcl++; + + /* Parse ACE type */ + val = ParseAceStringType(&StringAcl); + if (pAce) + pAce->Header.AceType = (BYTE) val; + if (*StringAcl != ';') + goto lerr; + StringAcl++; + + /* Parse ACE flags */ + val = ParseAceStringFlags(&StringAcl); + if (pAce) + pAce->Header.AceFlags = (BYTE) val; + if (*StringAcl != ';') + goto lerr; + StringAcl++; + + /* Parse ACE rights */ + val = ParseAceStringRights(&StringAcl); + if (pAce) + pAce->Mask = val; + if (*StringAcl != ';') + goto lerr; + StringAcl++; + + /* Parse ACE object guid */ + if (*StringAcl != ';') + { + FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n"); + goto lerr; + } + StringAcl++; + + /* Parse ACE inherit object guid */ + if (*StringAcl != ';') + { + FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n"); + goto lerr; + } + StringAcl++; + + /* Parse ACE account sid */ + if (ParseStringSidToSid(StringAcl, pAce ? (PSID)&pAce->SidStart : NULL, &sidlen)) + { + while (*StringAcl && *StringAcl != ')') + StringAcl++; + } + + if (*StringAcl != ')') + goto lerr; + StringAcl++; + + length += sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD) + sidlen; + } + + *cBytes = length; + return TRUE; + +lerr: + WARN("Invalid ACE string format\n"); + return FALSE; +} + +/********************************************************************** ******** + * ParseStringSecurityDescriptorToSecurityDescriptor + */ +static BOOL ParseStringSecurityDescriptorToSecurityDescriptor( + LPCWSTR StringSecurityDescriptor, + SECURITY_DESCRIPTOR* SecurityDescriptor, + LPDWORD cBytes) +{ + BOOL bret = FALSE; + WCHAR toktype; + WCHAR tok[MAX_PATH]; + LPCWSTR lptoken; + LPBYTE lpNext = NULL; + DWORD len; + + *cBytes = 0; + + if (SecurityDescriptor) + lpNext = ((LPBYTE) SecurityDescriptor) + sizeof(SECURITY_DESCRIPTOR); + + while (*StringSecurityDescriptor) + { + toktype = *StringSecurityDescriptor; + + /* Expect char identifier followed by ':' */ + StringSecurityDescriptor++; + if (*StringSecurityDescriptor != ':') + { + SetLastError(ERROR_INVALID_PARAMETER); + goto lend; + } + StringSecurityDescriptor++; + + /* Extract token */ + lptoken = StringSecurityDescriptor; + while (*lptoken && *lptoken != ':') + lptoken++; + + if (*lptoken) + lptoken--; + + len = lptoken - StringSecurityDescriptor; + memcpy( tok, StringSecurityDescriptor, len * sizeof(WCHAR) ); + tok[len] = 0; + + switch (toktype) + { + case 'O': + { + DWORD bytes; + + if (!ParseStringSidToSid(tok, (PSID)lpNext, &bytes)) + goto lend; + + if (SecurityDescriptor) + { + SecurityDescriptor->Owner = (PSID) ((DWORD) lpNext - + (DWORD) SecurityDescriptor); + lpNext += bytes; /* Advance to next token */ + } + + *cBytes += bytes; + + break; + } + + case 'G': + { + DWORD bytes; + + if (!ParseStringSidToSid(tok, (PSID)lpNext, &bytes)) + goto lend; + + if (SecurityDescriptor) + { + SecurityDescriptor->Group = (PSID) ((DWORD) lpNext - + (DWORD) SecurityDescriptor); + lpNext += bytes; /* Advance to next token */ + } + + *cBytes += bytes; + + break; + } + + case 'D': + { + DWORD flags; + DWORD bytes; + + if (!ParseStringAclToAcl(tok, &flags, (PACL)lpNext, &bytes)) + goto lend; + + if (SecurityDescriptor) + { + SecurityDescriptor->Control |= SE_DACL_PRESENT | flags; + SecurityDescriptor->Dacl = (PACL) ((DWORD) lpNext - + (DWORD) SecurityDescriptor); + lpNext += bytes; /* Advance to next token */ + } + + *cBytes += bytes; + + break; + } + + case 'S': + { + DWORD flags; + DWORD bytes; + + if (!ParseStringAclToAcl(tok, &flags, (PACL)lpNext, &bytes)) + goto lend; + + if (SecurityDescriptor) + { + SecurityDescriptor->Control |= SE_SACL_PRESENT | flags; + SecurityDescriptor->Sacl = (PACL) ((DWORD) lpNext - + (DWORD) SecurityDescriptor); + lpNext += bytes; /* Advance to next token */ + } + + *cBytes += bytes; + + break; + } + + default: + FIXME("Unknown token\n"); + SetLastError(ERROR_INVALID_PARAMETER); + goto lend; + } + + StringSecurityDescriptor = lptoken; + } + + bret = TRUE; + +lend: + return bret; +} + +/********************************************************************** ******** + * ParseAclStringFlags + */ +static DWORD ParseAclStringFlags(LPCWSTR* StringAcl) +{ + DWORD flags = 0; + LPCWSTR szAcl = *StringAcl; + + while (*szAcl != '(') [truncated at 1000 lines; 249 more skipped]
19 years, 4 months
1
0
0
0
← Newer
1
...
16
17
18
19
20
21
22
...
67
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
59
60
61
62
63
64
65
66
67
Results per page:
10
25
50
100
200