ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
January 2007
----- 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
21 participants
401 discussions
Start a n
N
ew thread
[weiden] 25566: Fix the NdisQueryBufferOffset and the ARGUMENTS_PRESENT macro
by weiden@svn.reactos.org
Author: weiden Date: Sun Jan 21 22:44:42 2007 New Revision: 25566 URL:
http://svn.reactos.org/svn/reactos?rev=25566&view=rev
Log: Fix the NdisQueryBufferOffset and the ARGUMENTS_PRESENT macro Modified: trunk/reactos/include/ddk/ndis.h trunk/reactos/include/ddk/winddk.h Modified: trunk/reactos/include/ddk/ndis.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ndis.h?rev=255…
============================================================================== --- trunk/reactos/include/ddk/ndis.h (original) +++ trunk/reactos/include/ddk/ndis.h Sun Jan 21 22:44:42 2007 @@ -1806,7 +1806,7 @@ VirtualAddress, \ Length) \ { \ - if (VirtualAddress) \ + if (ARGUMENT_PRESENT(VirtualAddress)) \ *((PVOID*)VirtualAddress) = MmGetSystemAddressForMdl(Buffer); \ \ *((PUINT)Length) = MmGetMdlByteCount(Buffer); \ @@ -2032,7 +2032,7 @@ OUT PUINT TotalPacketLength OPTIONAL) { if (FirstBuffer) - *((PNDIS_BUFFER*)FirstBuffer) = Packet->Private.Head; + *FirstBuffer = Packet->Private.Head; if (TotalPacketLength || BufferCount || PhysicalBufferCount) { if (!Packet->Private.ValidCounts) @@ -2060,14 +2060,14 @@ } if (PhysicalBufferCount) - *((PUINT)PhysicalBufferCount) = Packet->Private.PhysicalCount; + *PhysicalBufferCount = Packet->Private.PhysicalCount; if (BufferCount) - *((PUINT)BufferCount) = Packet->Private.Count; + *BufferCount = Packet->Private.Count; if (TotalPacketLength) - *((PUINT)TotalPacketLength) = Packet->Private.TotalLength; - } + *TotalPacketLength = Packet->Private.TotalLength; + } } /* Modified: trunk/reactos/include/ddk/winddk.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=2…
============================================================================== --- trunk/reactos/include/ddk/winddk.h (original) +++ trunk/reactos/include/ddk/winddk.h Sun Jan 21 22:44:42 2007 @@ -5429,7 +5429,7 @@ */ #define ARGUMENT_PRESENT(ArgumentPointer) \ - ((BOOLEAN) ((PVOID)ArgumentPointer != (PVOID)NULL)) + ((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL) /* * ULONG
17 years, 11 months
1
0
0
0
[janderwald] 25564: - small fix
by janderwald@svn.reactos.org
Author: janderwald Date: Sun Jan 21 22:12:46 2007 New Revision: 25564 URL:
http://svn.reactos.org/svn/reactos?rev=25564&view=rev
Log: - small fix Modified: trunk/reactos/base/system/autochk/autochk.c Modified: trunk/reactos/base/system/autochk/autochk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/autochk/autoch…
============================================================================== --- trunk/reactos/base/system/autochk/autochk.c (original) +++ trunk/reactos/base/system/autochk/autochk.c Sun Jan 21 22:12:46 2007 @@ -360,7 +360,7 @@ if ((DeviceMap.Query.DriveMap & (1 << i)) && (DeviceMap.Query.DriveType[i] == DOSDEVICE_DRIVE_FIXED)) { - swprintf(DrivePath, L"%c:\\", 'A'+i); + swprintf(DrivePath, L"%c:\\", L'A'+i); CheckVolume(DrivePath); } }
17 years, 11 months
1
0
0
0
[weiden] 25563: Convert NdisQueryPacket to an inline function (The DDK also defines it as an inline function). Should fix some warnings with GCC4.2
by weiden@svn.reactos.org
Author: weiden Date: Sun Jan 21 21:49:10 2007 New Revision: 25563 URL:
http://svn.reactos.org/svn/reactos?rev=25563&view=rev
Log: Convert NdisQueryPacket to an inline function (The DDK also defines it as an inline function). Should fix some warnings with GCC4.2 Modified: trunk/reactos/drivers/network/dd/ne2000/include/ne2000.h trunk/reactos/include/ddk/ndis.h Modified: trunk/reactos/drivers/network/dd/ne2000/include/ne2000.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/dd/ne2000/…
============================================================================== --- trunk/reactos/drivers/network/dd/ne2000/include/ne2000.h (original) +++ trunk/reactos/drivers/network/dd/ne2000/include/ne2000.h Sun Jan 21 21:49:10 2007 @@ -155,7 +155,7 @@ UINT TXFree; /* Number of free transmit buffers */ UINT TXNext; /* Next buffer to use */ /* Length of packet. 0 means buffer is unused */ - INT TXSize[DRIVER_DEFAULT_TX_BUFFER_COUNT]; + UINT TXSize[DRIVER_DEFAULT_TX_BUFFER_COUNT]; INT TXCurrent; /* Current buffer beeing transmitted. -1 means none */ /* Head of transmit queue */ Modified: trunk/reactos/include/ddk/ndis.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ndis.h?rev=255…
============================================================================== --- trunk/reactos/include/ddk/ndis.h (original) +++ trunk/reactos/include/ddk/ndis.h Sun Jan 21 21:49:10 2007 @@ -2022,48 +2022,52 @@ * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL, * OUT PUINT TotalPacketLength OPTIONAL); */ -#define NdisQueryPacket(Packet, \ - PhysicalBufferCount, \ - BufferCount, \ - FirstBuffer, \ - TotalPacketLength) \ -{ \ - if (FirstBuffer) \ - *((PNDIS_BUFFER*)FirstBuffer) = (Packet)->Private.Head; \ - if ((TotalPacketLength) || (BufferCount) || (PhysicalBufferCount)) \ - { \ - if (!(Packet)->Private.ValidCounts) { \ - UINT _Offset; \ - UINT _PacketLength; \ - PNDIS_BUFFER _NdisBuffer; \ - UINT _PhysicalBufferCount = 0; \ - UINT _TotalPacketLength = 0; \ - UINT _Count = 0; \ - \ - for (_NdisBuffer = (Packet)->Private.Head; \ - _NdisBuffer != (PNDIS_BUFFER)NULL; \ - _NdisBuffer = _NdisBuffer->Next) \ - { \ - _PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(_NdisBuffer); \ - NdisQueryBufferOffset(_NdisBuffer, &_Offset, &_PacketLength); \ - _TotalPacketLength += _PacketLength; \ - _Count++; \ - } \ - (Packet)->Private.PhysicalCount = _PhysicalBufferCount; \ - (Packet)->Private.TotalLength = _TotalPacketLength; \ - (Packet)->Private.Count = _Count; \ - (Packet)->Private.ValidCounts = TRUE; \ - } \ - \ - if (PhysicalBufferCount) \ - *((PUINT)PhysicalBufferCount) = (Packet)->Private.PhysicalCount; \ - \ - if (BufferCount) \ - *((PUINT)BufferCount) = (Packet)->Private.Count; \ - \ - if (TotalPacketLength) \ - *((PUINT)TotalPacketLength) = (Packet)->Private.TotalLength; \ - } \ +static __inline +VOID +NdisQueryPacket( + IN PNDIS_PACKET Packet, + OUT PUINT PhysicalBufferCount OPTIONAL, + OUT PUINT BufferCount OPTIONAL, + OUT PNDIS_BUFFER *FirstBuffer OPTIONAL, + OUT PUINT TotalPacketLength OPTIONAL) +{ + if (FirstBuffer) + *((PNDIS_BUFFER*)FirstBuffer) = Packet->Private.Head; + if (TotalPacketLength || BufferCount || PhysicalBufferCount) + { + if (!Packet->Private.ValidCounts) + { + UINT Offset; + UINT PacketLength; + PNDIS_BUFFER NdisBuffer; + UINT PhysicalBufferCount = 0; + UINT TotalPacketLength = 0; + UINT Count = 0; + + for (NdisBuffer = Packet->Private.Head; + NdisBuffer != (PNDIS_BUFFER)NULL; + NdisBuffer = NdisBuffer->Next) + { + PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(NdisBuffer); + NdisQueryBufferOffset(NdisBuffer, &Offset, &PacketLength); + TotalPacketLength += PacketLength; + Count++; + } + Packet->Private.PhysicalCount = PhysicalBufferCount; + Packet->Private.TotalLength = TotalPacketLength; + Packet->Private.Count = Count; + Packet->Private.ValidCounts = TRUE; + } + + if (PhysicalBufferCount) + *((PUINT)PhysicalBufferCount) = Packet->Private.PhysicalCount; + + if (BufferCount) + *((PUINT)BufferCount) = Packet->Private.Count; + + if (TotalPacketLength) + *((PUINT)TotalPacketLength) = Packet->Private.TotalLength; + } } /*
17 years, 11 months
1
0
0
0
[cwittich] 25562: fix some warnings (gcc 4.2)
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jan 21 21:25:47 2007 New Revision: 25562 URL:
http://svn.reactos.org/svn/reactos?rev=25562&view=rev
Log: fix some warnings (gcc 4.2) Modified: trunk/reactos/dll/win32/setupapi/devclass.c trunk/reactos/drivers/filesystems/ms/create.c Modified: trunk/reactos/dll/win32/setupapi/devclass.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/devclas…
============================================================================== --- trunk/reactos/dll/win32/setupapi/devclass.c (original) +++ trunk/reactos/dll/win32/setupapi/devclass.c Sun Jan 21 21:25:47 2007 @@ -1515,7 +1515,7 @@ { LPWSTR Buffer = NULL; LPCWSTR DllName; - INT iconIndex; + INT iconIndex = 0; HKEY hKey = INVALID_HANDLE_VALUE; hKey = SetupDiOpenClassRegKey(ClassGuid, KEY_QUERY_VALUE); Modified: trunk/reactos/drivers/filesystems/ms/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ms/cre…
============================================================================== --- trunk/reactos/drivers/filesystems/ms/create.c (original) +++ trunk/reactos/drivers/filesystems/ms/create.c Sun Jan 21 21:25:47 2007 @@ -111,7 +111,7 @@ PMSFS_CCB Ccb; KIRQL oldIrql; PLIST_ENTRY current_entry; - PMSFS_FCB current; + PMSFS_FCB current = NULL; PMAILSLOT_CREATE_PARAMETERS Buffer; DPRINT("MsfsCreateMailslot(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
17 years, 11 months
1
0
0
0
[cwittich] 25561: set the correct limits for the GDT Entry in KiInitializeTSS2
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jan 21 21:20:06 2007 New Revision: 25561 URL:
http://svn.reactos.org/svn/reactos?rev=25561&view=rev
Log: set the correct limits for the GDT Entry in KiInitializeTSS2 Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/cpu.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/cpu.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/cpu.c Sun Jan 21 21:20:06 2007 @@ -544,7 +544,7 @@ { /* Set the Limit */ TssEntry->LimitLow = sizeof(KTSS) - 1; - TssEntry->HighWord.Bits.LimitHi &= 0xF0; + TssEntry->HighWord.Bits.LimitHi = 0; } /* Now clear the I/O Map */
17 years, 11 months
1
0
0
0
[cwittich] 25560: fix KeFlushCurrentTb
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jan 21 20:53:16 2007 New Revision: 25560 URL:
http://svn.reactos.org/svn/reactos?rev=25560&view=rev
Log: fix KeFlushCurrentTb Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/cpu.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/cpu.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/cpu.c Sun Jan 21 20:53:16 2007 @@ -667,7 +667,7 @@ KeFlushCurrentTb(VOID) { /* Flush the TLB by resetting CR3 */ - __writecr3((ULONGLONG)__readcr3); + __writecr3((ULONGLONG)__readcr3()); } VOID
17 years, 11 months
1
0
0
0
[cwittich] 25559: -fix a call to ExGetPreviousMode() -initialize CurKey in CmiScanKeyList
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jan 21 20:32:11 2007 New Revision: 25559 URL:
http://svn.reactos.org/svn/reactos?rev=25559&view=rev
Log: -fix a call to ExGetPreviousMode() -initialize CurKey in CmiScanKeyList Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c trunk/reactos/ntoskrnl/cm/regobj.c Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/ntfunc.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/cm/ntfunc.c (original) +++ trunk/reactos/ntoskrnl/cm/ntfunc.c Sun Jan 21 20:32:11 2007 @@ -88,7 +88,7 @@ NewEntry.GrantedAccess = GrantedAccess; if ((HandleAttributes & OBJ_KERNEL_HANDLE) && - ExGetPreviousMode == KernelMode) + ExGetPreviousMode() == KernelMode) { Process = PsInitialSystemProcess; if (Process != CurrentProcess) Modified: trunk/reactos/ntoskrnl/cm/regobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regobj.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/cm/regobj.c (original) +++ trunk/reactos/ntoskrnl/cm/regobj.c Sun Jan 21 20:32:11 2007 @@ -972,7 +972,7 @@ ULONG Attributes, PKEY_OBJECT* ReturnedObject) { - PKEY_OBJECT CurKey; + PKEY_OBJECT CurKey = NULL; ULONG Index; DPRINT("Scanning key list for: %wZ (Parent: %wZ)\n",
17 years, 11 months
1
0
0
0
[cwittich] 25558: fix some warnings (gcc 4.2) thanks to w3seek
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jan 21 20:23:23 2007 New Revision: 25558 URL:
http://svn.reactos.org/svn/reactos?rev=25558&view=rev
Log: fix some warnings (gcc 4.2) thanks to w3seek Modified: trunk/reactos/base/shell/explorer/explorer.cpp trunk/reactos/base/shell/explorer/services/shellservices.h trunk/reactos/base/shell/explorer/services/startup.c trunk/reactos/dll/cpl/sysdm/virtmem.c trunk/reactos/dll/win32/opengl32/opengl32.h trunk/reactos/dll/win32/version/info.c trunk/reactos/subsystems/win32/win32k/include/object.h Modified: trunk/reactos/base/shell/explorer/explorer.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/explor…
============================================================================== --- trunk/reactos/base/shell/explorer/explorer.cpp (original) +++ trunk/reactos/base/shell/explorer/explorer.cpp Sun Jan 21 20:23:23 2007 @@ -1186,7 +1186,7 @@ /**TODO launching autostart programs can be moved into a background thread. */ if (autostart) { - char* argv[] = {"", "s"}; // call startup routine in SESSION_START mode + const char* argv[] = {"", "s"}; // call startup routine in SESSION_START mode startup(2, argv); } Modified: trunk/reactos/base/shell/explorer/services/shellservices.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/servic…
============================================================================== --- trunk/reactos/base/shell/explorer/services/shellservices.h (original) +++ trunk/reactos/base/shell/explorer/services/shellservices.h Sun Jan 21 20:23:23 2007 @@ -27,7 +27,7 @@ // launch start programs -extern "C" int startup(int argc, char *argv[]); +extern "C" int startup(int argc, const char *argv[]); // load Shell Service Objects (volume control, printer/network icons, ...) struct SSOThread : public Thread Modified: trunk/reactos/base/shell/explorer/services/startup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/servic…
============================================================================== --- trunk/reactos/base/shell/explorer/services/startup.c (original) +++ trunk/reactos/base/shell/explorer/services/startup.c Sun Jan 21 20:23:23 2007 @@ -416,7 +416,7 @@ SETUP = {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE}; #define DEFAULT SESSION_START -int startup(int argc, char *argv[]) +int startup(int argc, const char *argv[]) { struct op_mask ops; /* Which of the ops do we want to perform? */ /* First, set the current directory to SystemRoot */ Modified: trunk/reactos/dll/cpl/sysdm/virtmem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/virtmem.c?re…
============================================================================== --- trunk/reactos/dll/cpl/sysdm/virtmem.c (original) +++ trunk/reactos/dll/cpl/sysdm/virtmem.c Sun Jan 21 20:23:23 2007 @@ -152,7 +152,7 @@ NULL, 0)) { - if (szVolume != _T('\0')) + if (szVolume[0] != _T('\0')) { TCHAR szVol[MAX_PATH + 2]; Modified: trunk/reactos/dll/win32/opengl32/opengl32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/opengl32/opengl3…
============================================================================== --- trunk/reactos/dll/win32/opengl32/opengl32.h (original) +++ trunk/reactos/dll/win32/opengl32/opengl32.h Sun Jan 21 20:23:23 2007 @@ -115,7 +115,7 @@ typedef void GLvoid; /* Called by the driver to set the dispatch table */ -typedef DWORD APIENTRY (*SetContextCallBack)( const ICDTable * ); +typedef DWORD WINAPI (*SetContextCallBack)( const ICDTable * ); /* OpenGL ICD data */ typedef struct tagGLDRIVERDATA @@ -129,23 +129,23 @@ DWORD driver_version; /*!< DriverVersion value from registry */ DWORD flags; /*!< Flags value from registry */ - BOOL APIENTRY (*DrvCopyContext)( HGLRC, HGLRC, UINT ); - HGLRC APIENTRY (*DrvCreateContext)( HDC ); - HGLRC APIENTRY (*DrvCreateLayerContext)( HDC, int ); - BOOL APIENTRY (*DrvDeleteContext)( HGLRC ); - BOOL APIENTRY (*DrvDescribeLayerPlane)( HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR ); - int APIENTRY (*DrvDescribePixelFormat)( IN HDC, IN int, IN UINT, OUT LPPIXELFORMATDESCRIPTOR ); - int APIENTRY (*DrvGetLayerPaletteEntries)( HDC, int, int, int, COLORREF * ); - PROC APIENTRY (*DrvGetProcAddress)( LPCSTR lpProcName ); - void APIENTRY (*DrvReleaseContext)( HGLRC hglrc ); /* maybe returns BOOL? */ - BOOL APIENTRY (*DrvRealizeLayerPalette)( HDC, int, BOOL ); - PICDTable APIENTRY (*DrvSetContext)( HDC hdc, HGLRC hglrc, SetContextCallBack callback ); - int APIENTRY (*DrvSetLayerPaletteEntries)( HDC, int, int, int, CONST COLORREF * ); - BOOL APIENTRY (*DrvSetPixelFormat)( IN HDC, IN int ); /*, IN CONST PIXELFORMATDESCRIPTOR * );*/ - BOOL APIENTRY (*DrvShareLists)( HGLRC, HGLRC ); - BOOL APIENTRY (*DrvSwapBuffers)( HDC ); - BOOL APIENTRY (*DrvSwapLayerBuffers)( HDC, UINT ); - BOOL APIENTRY (*DrvValidateVersion)( DWORD ); + BOOL WINAPI (*DrvCopyContext)( HGLRC, HGLRC, UINT ); + HGLRC WINAPI (*DrvCreateContext)( HDC ); + HGLRC WINAPI (*DrvCreateLayerContext)( HDC, int ); + BOOL WINAPI (*DrvDeleteContext)( HGLRC ); + BOOL WINAPI (*DrvDescribeLayerPlane)( HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR ); + int WINAPI (*DrvDescribePixelFormat)( IN HDC, IN int, IN UINT, OUT LPPIXELFORMATDESCRIPTOR ); + int WINAPI (*DrvGetLayerPaletteEntries)( HDC, int, int, int, COLORREF * ); + PROC WINAPI (*DrvGetProcAddress)( LPCSTR lpProcName ); + void WINAPI (*DrvReleaseContext)( HGLRC hglrc ); /* maybe returns BOOL? */ + BOOL WINAPI (*DrvRealizeLayerPalette)( HDC, int, BOOL ); + PICDTable WINAPI (*DrvSetContext)( HDC hdc, HGLRC hglrc, SetContextCallBack callback ); + int WINAPI (*DrvSetLayerPaletteEntries)( HDC, int, int, int, CONST COLORREF * ); + BOOL WINAPI (*DrvSetPixelFormat)( IN HDC, IN int ); /*, IN CONST PIXELFORMATDESCRIPTOR * );*/ + BOOL WINAPI (*DrvShareLists)( HGLRC, HGLRC ); + BOOL WINAPI (*DrvSwapBuffers)( HDC ); + BOOL WINAPI (*DrvSwapLayerBuffers)( HDC, UINT ); + BOOL WINAPI (*DrvValidateVersion)( DWORD ); struct tagGLDRIVERDATA *next; /* next ICD -- linked list */ } GLDRIVERDATA; Modified: trunk/reactos/dll/win32/version/info.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/version/info.c?r…
============================================================================== --- trunk/reactos/dll/win32/version/info.c (original) +++ trunk/reactos/dll/win32/version/info.c Sun Jan 21 20:23:23 2007 @@ -259,7 +259,7 @@ } hRsrc = FindResourceW(hModule, MAKEINTRESOURCEW(VS_VERSION_INFO), - MAKEINTRESOURCEW(VS_FILE_INFO)); + (LPCWSTR) VS_FILE_INFO); if(!hRsrc) { WARN("Could not find VS_VERSION_INFO in %s\n", debugstr_w(filename)); Modified: trunk/reactos/subsystems/win32/win32k/include/object.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/object.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/object.h Sun Jan 21 20:23:23 2007 @@ -73,56 +73,62 @@ #include <malloc.h> -#define ASSERT_LAST_REF(_obj_) \ -{ \ - PW32THREAD t; \ - PSINGLE_LIST_ENTRY e; \ - PUSER_REFERENCE_ENTRY ref; \ - \ - ASSERT(_obj_); \ - t = PsGetCurrentThreadWin32Thread(); \ - ASSERT(t); \ - e = t->ReferencesList.Next; \ - ASSERT(e); \ - ref = CONTAINING_RECORD(e, USER_REFERENCE_ENTRY, Entry); \ - ASSERT(ref); \ - \ - ASSERT(_obj_ == ref->obj); \ - \ +#define USER_ASSERT(exp,file,line) \ + if (!(exp)) {RtlAssert(#exp,(PVOID)file,line,"");} + +static __inline VOID +UserAssertLastRef(PVOID obj, const char *file, int line) +{ + PW32THREAD W32Thread; + PSINGLE_LIST_ENTRY ReferenceEntry; + PUSER_REFERENCE_ENTRY UserReferenceEntry; + + USER_ASSERT(obj != NULL, file, line); + W32Thread = PsGetCurrentThreadWin32Thread(); + USER_ASSERT(W32Thread != NULL, file, line); + ReferenceEntry = W32Thread->ReferencesList.Next; + USER_ASSERT(ReferenceEntry != NULL, file, line); + UserReferenceEntry = CONTAINING_RECORD(ReferenceEntry, USER_REFERENCE_ENTRY, Entry); + USER_ASSERT(UserReferenceEntry != NULL, file, line); + USER_ASSERT(obj == UserReferenceEntry->obj, file, line); } -#define UserRefObjectCo(_obj_, _ref_) \ -{ \ - PW32THREAD t; \ - \ - ASSERT(_obj_); \ - t = PsGetCurrentThreadWin32Thread(); \ - ASSERT(t); \ - ASSERT(_ref_); \ - (_ref_)->obj = _obj_; \ - ObmReferenceObject(_obj_); \ - \ - PushEntryList(&t->ReferencesList, &(_ref_)->Entry); \ - \ +#define ASSERT_LAST_REF(_obj_) UserAssertLastRef(_obj,__FILE__,__LINE__) + +#undef USER_ASSERT + +VOID FASTCALL ObmReferenceObject(PVOID obj); +BOOL FASTCALL ObmDereferenceObject2(PVOID obj); + +static __inline VOID +UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry) +{ + PW32THREAD W32Thread; + + W32Thread = PsGetCurrentThreadWin32Thread(); + ASSERT(W32Thread != NULL); + ASSERT(UserReferenceEntry != NULL); + UserReferenceEntry->obj = obj; + ObmReferenceObject(obj); + PushEntryList(&W32Thread->ReferencesList, &UserReferenceEntry->Entry); } +static __inline VOID +UserDerefObjectCo(PVOID obj) +{ + PW32THREAD W32Thread; + PSINGLE_LIST_ENTRY ReferenceEntry; + PUSER_REFERENCE_ENTRY UserReferenceEntry; -#define UserDerefObjectCo(_obj_) \ -{ \ - PW32THREAD t; \ - PSINGLE_LIST_ENTRY e; \ - PUSER_REFERENCE_ENTRY ref; \ - \ - ASSERT(_obj_); \ - t = PsGetCurrentThreadWin32Thread(); \ - ASSERT(t); \ - e = PopEntryList(&t->ReferencesList); \ - ASSERT(e); \ - ref = CONTAINING_RECORD(e, USER_REFERENCE_ENTRY, Entry); \ - ASSERT(ref); \ - \ - ASSERT(_obj_ == ref->obj); \ - ObmDereferenceObject(_obj_); \ - \ + ASSERT(obj != NULL); + W32Thread = PsGetCurrentThreadWin32Thread(); + ASSERT(W32Thread != NULL); + ReferenceEntry = PopEntryList(&W32Thread->ReferencesList); + ASSERT(ReferenceEntry != NULL); + UserReferenceEntry = CONTAINING_RECORD(ReferenceEntry, USER_REFERENCE_ENTRY, Entry); + ASSERT(UserReferenceEntry != NULL); + + ASSERT(obj == UserReferenceEntry->obj); + ObmDereferenceObject2(obj); } HANDLE FASTCALL ObmObjectToHandle(PVOID obj);
17 years, 11 months
1
0
0
0
[ion] 25557: - Fix multiple LPC race conditions. - Improve LpcpFreeToPortZone calls for optimizing lock release. - Use RtlCopyMemory instead of RtlMoveMemory to optimize data transfer speed. - Always hold a reference to the connection port associated to the LPC port and properly handle this reference in all the LPC code. - Hold a reference to the process that mapped a server/client view, and use this field when freeing memory in case we're called out-of-process. - Fix a lot of list parsing loops
by ion@svn.reactos.org
Author: ion Date: Sun Jan 21 20:21:42 2007 New Revision: 25557 URL:
http://svn.reactos.org/svn/reactos?rev=25557&view=rev
Log: - Fix multiple LPC race conditions. - Improve LpcpFreeToPortZone calls for optimizing lock release. - Use RtlCopyMemory instead of RtlMoveMemory to optimize data transfer speed. - Always hold a reference to the connection port associated to the LPC port and properly handle this reference in all the LPC code. - Hold a reference to the process that mapped a server/client view, and use this field when freeing memory in case we're called out-of-process. - Fix a lot of list parsing loops and code to handle the case when the list is now empty. - Validate more fields and data in the code. - There are still some LPC bugs at system shutdown. Modified: trunk/reactos/ntoskrnl/include/internal/lpc_x.h trunk/reactos/ntoskrnl/ke/gate.c trunk/reactos/ntoskrnl/lpc/close.c trunk/reactos/ntoskrnl/lpc/complete.c trunk/reactos/ntoskrnl/lpc/connect.c trunk/reactos/ntoskrnl/lpc/create.c trunk/reactos/ntoskrnl/lpc/listen.c trunk/reactos/ntoskrnl/lpc/port.c trunk/reactos/ntoskrnl/lpc/reply.c trunk/reactos/ntoskrnl/lpc/send.c Modified: trunk/reactos/ntoskrnl/include/internal/lpc_x.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/lpc_x.h (original) +++ trunk/reactos/ntoskrnl/include/internal/lpc_x.h Sun Jan 21 20:21:42 2007 @@ -45,7 +45,7 @@ { \ /* It's still signaled, so wait on it */ \ KeWaitForSingleObject(s, \ - Executive, \ + WrExecutive, \ KernelMode, \ FALSE, \ NULL); \ @@ -73,7 +73,7 @@ { \ /* It's still signaled, so wait on it */ \ KeWaitForSingleObject(s, \ - Executive, \ + WrExecutive, \ KernelMode, \ FALSE, \ NULL); \ Modified: trunk/reactos/ntoskrnl/ke/gate.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/gate.c?rev=255…
============================================================================== --- trunk/reactos/ntoskrnl/ke/gate.c (original) +++ trunk/reactos/ntoskrnl/ke/gate.c Sun Jan 21 20:21:42 2007 @@ -137,7 +137,6 @@ KIRQL OldIrql; ASSERT_GATE(Gate); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); - ASSERT(FALSE); /* Start entry loop */ for (;;) Modified: trunk/reactos/ntoskrnl/lpc/close.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/close.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/lpc/close.c (original) +++ trunk/reactos/ntoskrnl/lpc/close.c Sun Jan 21 20:21:42 2007 @@ -19,6 +19,7 @@ LpcExitThread(IN PETHREAD Thread) { PLPCP_MESSAGE Message; + ASSERT(Thread == PsGetCurrentThread()); /* Acquire the lock */ KeAcquireGuardedMutex(&LpcpLock); @@ -54,7 +55,7 @@ PLPCP_CONNECTION_MESSAGE ConnectMessage; PLPCP_PORT_OBJECT ClientPort = NULL; PETHREAD Thread = NULL; - BOOLEAN LockHeld = Flags & 1; + BOOLEAN LockHeld = Flags & 1, ReleaseLock = Flags & 2; PAGED_CODE(); LPCTRACE(LPC_CLOSE_DEBUG, "Message: %p. Flags: %lx\n", Message, Flags); @@ -99,7 +100,7 @@ ExFreeToPagedLookasideList(&LpcpMessagesLookaside, Message); /* Reacquire the lock if needed */ - if ((LockHeld) && !(Flags & 2)) KeAcquireGuardedMutex(&LpcpLock); + if ((LockHeld) && !(ReleaseLock)) KeAcquireGuardedMutex(&LpcpLock); } VOID @@ -110,14 +111,27 @@ PLIST_ENTRY ListHead, NextEntry; PETHREAD Thread; PLPCP_MESSAGE Message; + PLPCP_PORT_OBJECT ConnectionPort = NULL; PLPCP_CONNECTION_MESSAGE ConnectMessage; + PAGED_CODE(); LPCTRACE(LPC_CLOSE_DEBUG, "Port: %p. Flags: %lx\n", Port, Port->Flags); /* Hold the lock */ KeAcquireGuardedMutex(&LpcpLock); - /* Disconnect the port to which this port is connected */ - if (Port->ConnectedPort) Port->ConnectedPort->ConnectedPort = NULL; + /* Check if we have a connected port */ + if (((Port->Flags & LPCP_PORT_TYPE_MASK) != LPCP_UNCONNECTED_PORT) && + (Port->ConnectedPort)) + { + /* Disconnect it */ + Port->ConnectedPort->ConnectedPort = NULL; + if (Port->ConnectedPort->ConnectionPort) + { + /* Save and clear connection port */ + ConnectionPort = Port->ConnectedPort->ConnectionPort; + Port->ConnectedPort->ConnectionPort = NULL; + } + } /* Check if this is a connection port */ if ((Port->Flags & LPCP_PORT_TYPE_MASK) == LPCP_CONNECTION_PORT) @@ -129,7 +143,7 @@ /* Walk all the threads waiting and signal them */ ListHead = &Port->LpcReplyChainHead; NextEntry = ListHead->Flink; - while (NextEntry != ListHead) + while ((NextEntry) && (NextEntry != ListHead)) { /* Get the Thread */ Thread = CONTAINING_RECORD(NextEntry, ETHREAD, LpcReplyChain); @@ -147,57 +161,63 @@ /* Check if someone is waiting */ if (!KeReadStateSemaphore(&Thread->LpcReplySemaphore)) { - /* Get the message and check if it's a connection request */ + /* Get the message */ Message = Thread->LpcReplyMessage; - if (Message->Request.u2.s2.Type == LPC_CONNECTION_REQUEST) + if (Message) { - /* Get the connection message */ - ConnectMessage = (PLPCP_CONNECTION_MESSAGE)(Message + 1); - - /* Check if it had a section */ - if (ConnectMessage->SectionToMap) + /* Check if it's a connection request */ + if (Message->Request.u2.s2.Type == LPC_CONNECTION_REQUEST) { - /* Dereference it */ - ObDereferenceObject(ConnectMessage->SectionToMap); + /* Get the connection message */ + ConnectMessage = (PLPCP_CONNECTION_MESSAGE)(Message + 1); + + /* Check if it had a section */ + if (ConnectMessage->SectionToMap) + { + /* Dereference it */ + ObDereferenceObject(ConnectMessage->SectionToMap); + } } + + /* Clear the reply message */ + Thread->LpcReplyMessage = NULL; + + /* And remove the message from the port zone */ + LpcpFreeToPortZone(Message, 1); + NextEntry = Port->LpcReplyChainHead.Flink; } - /* Clear the reply message */ - Thread->LpcReplyMessage = NULL; - - /* And remove the message from the port zone */ - LpcpFreeToPortZone(Message, TRUE); - } - - /* Release the semaphore and reset message id count */ - Thread->LpcReplyMessageId = 0; - LpcpCompleteWait(&Thread->LpcReplySemaphore); + /* Release the semaphore and reset message id count */ + Thread->LpcReplyMessageId = 0; + KeReleaseSemaphore(&Thread->LpcReplySemaphore, 0, 1, FALSE); + } } /* Reinitialize the list head */ InitializeListHead(&Port->LpcReplyChainHead); /* Loop queued messages */ - ListHead = &Port->MsgQueue.ReceiveHead; - NextEntry = ListHead->Flink; - while ((NextEntry) && (ListHead != NextEntry)) + while ((Port->MsgQueue.ReceiveHead.Flink) && + !(IsListEmpty (&Port->MsgQueue.ReceiveHead))) { /* Get the message */ - Message = CONTAINING_RECORD(NextEntry, LPCP_MESSAGE, Entry); - NextEntry = NextEntry->Flink; + Message = CONTAINING_RECORD(Port->MsgQueue.ReceiveHead.Flink, + LPCP_MESSAGE, + Entry); /* Free and reinitialize it's list head */ + RemoveEntryList(&Message->Entry); InitializeListHead(&Message->Entry); /* Remove it from the port zone */ - LpcpFreeToPortZone(Message, TRUE); - } - - /* Reinitialize the message queue list head */ - InitializeListHead(&Port->MsgQueue.ReceiveHead); + LpcpFreeToPortZone(Message, 1); + } /* Release the lock */ KeReleaseGuardedMutex(&LpcpLock); + + /* Dereference the connection port */ + if (ConnectionPort) ObDereferenceObject(ConnectionPort); /* Check if we have to free the port entirely */ if (Destroy) @@ -334,13 +354,32 @@ /* Destroy the port queue */ LpcpDestroyPortQueue(Port, TRUE); - /* Check if we had a client view */ - if (Port->ClientSectionBase) MmUnmapViewOfSection(PsGetCurrentProcess(), - Port->ClientSectionBase); - - /* Check for a server view */ - if (Port->ServerSectionBase) MmUnmapViewOfSection(PsGetCurrentProcess(), - Port->ServerSectionBase); + /* Check if we had views */ + if ((Port->ClientSectionBase) || (Port->ServerSectionBase)) + { + /* Check if we had a client view */ + if (Port->ClientSectionBase) + { + /* Unmap it */ + MmUnmapViewOfSection(Port->MappingProcess, + Port->ClientSectionBase); + } + + /* Check for a server view */ + if (Port->ServerSectionBase) + { + /* Unmap it */ + MmUnmapViewOfSection(Port->MappingProcess, + Port->ServerSectionBase); + } + + /* Dereference the mapping process */ + ObDereferenceObject(Port->MappingProcess); + Port->MappingProcess = NULL; + } + + /* Acquire the lock */ + KeAcquireGuardedMutex(&LpcpLock); /* Get the connection port */ ConnectionPort = Port->ConnectionPort; @@ -348,9 +387,6 @@ { /* Get the PID */ Pid = PsGetCurrentProcessId(); - - /* Acquire the lock */ - KeAcquireGuardedMutex(&LpcpLock); /* Loop the data lists */ ListHead = &ConnectionPort->LpcDataInfoChainHead; @@ -361,12 +397,29 @@ Message = CONTAINING_RECORD(NextEntry, LPCP_MESSAGE, Entry); NextEntry = NextEntry->Flink; - /* Check if the PID matches */ - if (Message->Request.ClientId.UniqueProcess == Pid) + /* Check if this is the connection port */ + if (Port == ConnectionPort) + { + /* Free queued messages */ + RemoveEntryList(&Message->Entry); + InitializeListHead(&Message->Entry); + LpcpFreeToPortZone(Message, 1); + + /* Restart at the head */ + NextEntry = ListHead->Flink; + } + else if ((Message->Request.ClientId.UniqueProcess == Pid) && + ((Message->SenderPort == Port) || + (Message->SenderPort == Port->ConnectedPort) || + (Message->SenderPort == ConnectionPort))) { /* Remove it */ RemoveEntryList(&Message->Entry); - LpcpFreeToPortZone(Message, TRUE); + InitializeListHead(&Message->Entry); + LpcpFreeToPortZone(Message, 1); + + /* Restart at the head */ + NextEntry = ListHead->Flink; } } @@ -375,6 +428,11 @@ /* Dereference the object unless it's the same port */ if (ConnectionPort != Port) ObDereferenceObject(ConnectionPort); + } + else + { + /* Release the lock */ + KeReleaseGuardedMutex(&LpcpLock); } /* Check if this is a connection port with a server process*/ Modified: trunk/reactos/ntoskrnl/lpc/complete.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/complete.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/lpc/complete.c (original) +++ trunk/reactos/ntoskrnl/lpc/complete.c Sun Jan 21 20:21:42 2007 @@ -145,7 +145,7 @@ Message->Request.ClientId = ReplyMessage->ClientId; Message->Request.MessageId = ReplyMessage->MessageId; Message->Request.ClientViewSize = 0; - RtlMoveMemory(ConnectMessage + 1, ReplyMessage + 1, ConnectionInfoLength); + RtlCopyMemory(ConnectMessage + 1, ReplyMessage + 1, ConnectionInfoLength); /* At this point, if the caller refused the connection, go to cleanup */ if (!AcceptConnection) goto Cleanup; @@ -213,6 +213,10 @@ /* Set the view base */ ConnectMessage->ClientView.ViewRemoteBase = ServerPort-> ClientSectionBase; + + /* Save and reference the mapping process */ + ServerPort->MappingProcess = PsGetCurrentProcess(); + ObReferenceObject(ServerPort->MappingProcess); } else { @@ -351,10 +355,10 @@ /* Make sure it has a reply message */ if (!Thread->LpcReplyMessage) { - /* It doesn't, fail */ + /* It doesn't, quit */ KeReleaseGuardedMutex(&LpcpLock); ObDereferenceObject(Port); - return STATUS_PORT_DISCONNECTED; + return STATUS_SUCCESS; } /* Clear the client thread and wake it up */ Modified: trunk/reactos/ntoskrnl/lpc/connect.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/connect.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/lpc/connect.c (original) +++ trunk/reactos/ntoskrnl/lpc/connect.c Sun Jan 21 20:21:42 2007 @@ -21,6 +21,7 @@ IN PETHREAD CurrentThread) { PVOID SectionToMap; + PLPCP_MESSAGE ReplyMessage; /* Acquire the LPC lock */ KeAcquireGuardedMutex(&LpcpLock); @@ -34,10 +35,19 @@ } /* Check if there's a reply message */ - if (CurrentThread->LpcReplyMessage) + ReplyMessage = CurrentThread->LpcReplyMessage; + if (ReplyMessage) { /* Get the message */ - *Message = CurrentThread->LpcReplyMessage; + *Message = ReplyMessage; + + /* Check if it's got messages */ + if (!IsListEmpty(&ReplyMessage->Entry)) + { + /* Clear the list */ + RemoveEntryList(&ReplyMessage->Entry); + InitializeListHead(&ReplyMessage->Entry); + } /* Clear message data */ CurrentThread->LpcReceivedMessageId = 0; @@ -124,7 +134,7 @@ Status = ObReferenceObjectByName(PortName, 0, NULL, - PORT_ALL_ACCESS, + PORT_CONNECT, LpcPortObjectType, PreviousMode, NULL, @@ -286,6 +296,10 @@ /* Update the base */ ClientView->ViewBase = Port->ClientSectionBase; + + /* Reference and remember the process */ + ClientPort->MappingProcess = PsGetCurrentProcess(); + ObReferenceObject(ClientPort->MappingProcess); } else { @@ -321,7 +335,7 @@ Message->Request.ClientViewSize = ClientView->ViewSize; /* Copy the client view and clear the server view */ - RtlMoveMemory(&ConnectMessage->ClientView, + RtlCopyMemory(&ConnectMessage->ClientView, ClientView, sizeof(PORT_VIEW)); RtlZeroMemory(&ConnectMessage->ServerView, sizeof(REMOTE_PORT_VIEW)); @@ -348,7 +362,7 @@ if (ConnectionInformation) { /* Copy it in */ - RtlMoveMemory(ConnectMessage + 1, + RtlCopyMemory(ConnectMessage + 1, ConnectionInformation, ConnectionInfoLength); } @@ -360,51 +374,63 @@ if (Port->Flags & LPCP_NAME_DELETED) { /* Fail the request */ - KeReleaseGuardedMutex(&LpcpLock); Status = STATUS_OBJECT_NAME_NOT_FOUND; - goto Cleanup; - } - - /* Associate no thread yet */ - Message->RepliedToThread = NULL; - - /* Generate the Message ID and set it */ - Message->Request.MessageId = LpcpNextMessageId++; - if (!LpcpNextMessageId) LpcpNextMessageId = 1; - Thread->LpcReplyMessageId = Message->Request.MessageId; - - /* Insert the message into the queue and thread chain */ - InsertTailList(&Port->MsgQueue.ReceiveHead, &Message->Entry); - InsertTailList(&Port->LpcReplyChainHead, &Thread->LpcReplyChain); - Thread->LpcReplyMessage = Message; - - /* Now we can finally reference the client port and link it*/ - ObReferenceObject(ClientPort); - ConnectMessage->ClientPort = ClientPort; + } + else + { + /* Associate no thread yet */ + Message->RepliedToThread = NULL; + + /* Generate the Message ID and set it */ + Message->Request.MessageId = LpcpNextMessageId++; + if (!LpcpNextMessageId) LpcpNextMessageId = 1; + Thread->LpcReplyMessageId = Message->Request.MessageId; + + /* Insert the message into the queue and thread chain */ + InsertTailList(&Port->MsgQueue.ReceiveHead, &Message->Entry); + InsertTailList(&Port->LpcReplyChainHead, &Thread->LpcReplyChain); + Thread->LpcReplyMessage = Message; + + /* Now we can finally reference the client port and link it*/ + ObReferenceObject(ClientPort); + ConnectMessage->ClientPort = ClientPort; + + /* Enter a critical region */ + KeEnterCriticalRegion(); + } + + /* Add another reference to the port */ + ObReferenceObject(Port); /* Release the lock */ KeReleaseGuardedMutex(&LpcpLock); - LPCTRACE(LPC_CONNECT_DEBUG, - "Messages: %p/%p. Ports: %p/%p. Status: %lx\n", - Message, - ConnectMessage, - Port, - ClientPort, - Status); - - /* If this is a waitable port, set the event */ - if (Port->Flags & LPCP_WAITABLE_PORT) KeSetEvent(&Port->WaitEvent, - 1, - FALSE); - - /* Release the queue semaphore */ - LpcpCompleteWait(Port->MsgQueue.Semaphore); - - /* Now wait for a reply */ - LpcpConnectWait(&Thread->LpcReplySemaphore, PreviousMode); - - /* Check if our wait ended in success */ - if (Status != STATUS_SUCCESS) goto Cleanup; + + /* Check for success */ + if (NT_SUCCESS(Status)) + { + LPCTRACE(LPC_CONNECT_DEBUG, + "Messages: %p/%p. Ports: %p/%p. Status: %lx\n", + Message, + ConnectMessage, + Port, + ClientPort, + Status); + + /* If this is a waitable port, set the event */ + if (Port->Flags & LPCP_WAITABLE_PORT) KeSetEvent(&Port->WaitEvent, + 1, + FALSE); + + /* Release the queue semaphore and leave the critical region */ + LpcpCompleteWait(Port->MsgQueue.Semaphore); + KeLeaveCriticalRegion(); + + /* Now wait for a reply */ + LpcpConnectWait(&Thread->LpcReplySemaphore, PreviousMode); + } + + /* Check for failure */ + if (!NT_SUCCESS(Status)) goto Cleanup; /* Free the connection message */ SectionToMap = LpcpFreeConMsg(&Message, &ConnectMessage, Thread); @@ -432,7 +458,7 @@ } /* Return the connection information */ - RtlMoveMemory(ConnectionInformation, + RtlCopyMemory(ConnectionInformation, ConnectMessage + 1, ConnectionInfoLength ); } @@ -466,7 +492,7 @@ if (ClientView) { /* Copy it back */ - RtlMoveMemory(ClientView, + RtlCopyMemory(ClientView, &ConnectMessage->ClientView, sizeof(PORT_VIEW)); } @@ -475,7 +501,7 @@ if (ServerView) { /* Copy it back */ - RtlMoveMemory(ServerView, + RtlCopyMemory(ServerView, &ConnectMessage->ServerView, sizeof(REMOTE_PORT_VIEW)); } @@ -486,8 +512,12 @@ /* No connection port, we failed */ if (SectionToMap) ObDereferenceObject(SectionToMap); + /* Acquire the lock */ + KeAcquireGuardedMutex(&LpcpLock); + /* Check if it's because the name got deleted */ - if (Port->Flags & LPCP_NAME_DELETED) + if (!(ClientPort->ConnectionPort) || + (Port->Flags & LPCP_NAME_DELETED)) { /* Set the correct status */ Status = STATUS_OBJECT_NAME_NOT_FOUND; @@ -498,19 +528,27 @@ Status = STATUS_PORT_CONNECTION_REFUSED; } + /* Release the lock */ + KeReleaseGuardedMutex(&LpcpLock); + /* Kill the port */ ObDereferenceObject(ClientPort); } /* Free the message */ - LpcpFreeToPortZone(Message, FALSE); - return Status; - } - - /* No reply message, fail */ - if (SectionToMap) ObDereferenceObject(SectionToMap); - ObDereferenceObject(ClientPort); - return STATUS_PORT_CONNECTION_REFUSED; + LpcpFreeToPortZone(Message, 0); + } + else + { + /* No reply message, fail */ + if (SectionToMap) ObDereferenceObject(SectionToMap); + ObDereferenceObject(ClientPort); + Status = STATUS_PORT_CONNECTION_REFUSED; + } + + /* Return status */ + ObDereferenceObject(Port); + return Status; Cleanup: /* We failed, free the message */ @@ -521,20 +559,21 @@ { /* Wait on it */ KeWaitForSingleObject(&Thread->LpcReplySemaphore, + WrExecutive, KernelMode, - Executive, FALSE, NULL); } /* Check if we had a message and free it */ - if (Message) LpcpFreeToPortZone(Message, FALSE); + if (Message) LpcpFreeToPortZone(Message, 0); /* Dereference other objects */ if (SectionToMap) ObDereferenceObject(SectionToMap); ObDereferenceObject(ClientPort); /* Return status */ + ObDereferenceObject(Port); return Status; } Modified: trunk/reactos/ntoskrnl/lpc/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/create.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/lpc/create.c (original) +++ trunk/reactos/ntoskrnl/lpc/create.c Sun Jan 21 20:21:42 2007 @@ -19,6 +19,7 @@ LpcpInitializePortQueue(IN PLPCP_PORT_OBJECT Port) { PLPCP_NONPAGED_PORT_QUEUE MessageQueue; + PAGED_CODE(); /* Allocate the queue */ MessageQueue = ExAllocatePoolWithTag(NonPagedPool, @@ -48,6 +49,7 @@ KPROCESSOR_MODE PreviousMode = KeGetPreviousMode(); NTSTATUS Status; PLPCP_PORT_OBJECT Port; + PAGED_CODE(); LPCTRACE(LPC_CREATE_DEBUG, "Name: %wZ\n", ObjectAttributes->ObjectName); /* Create the Object */ Modified: trunk/reactos/ntoskrnl/lpc/listen.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/listen.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/lpc/listen.c (original) +++ trunk/reactos/ntoskrnl/lpc/listen.c Sun Jan 21 20:21:42 2007 @@ -22,30 +22,30 @@ NtListenPort(IN HANDLE PortHandle, OUT PPORT_MESSAGE ConnectMessage) { - NTSTATUS Status; - PAGED_CODE(); - LPCTRACE(LPC_LISTEN_DEBUG, "Handle: %lx\n", PortHandle); + NTSTATUS Status; + PAGED_CODE(); + LPCTRACE(LPC_LISTEN_DEBUG, "Handle: %lx\n", PortHandle); - /* Wait forever for a connection request. */ - for (;;) + /* Wait forever for a connection request. */ + for (;;) + { + /* Do the wait */ + Status = NtReplyWaitReceivePort(PortHandle, + NULL, + NULL, + ConnectMessage); + + /* Accept only LPC_CONNECTION_REQUEST requests. */ + if ((Status != STATUS_SUCCESS) || + (LpcpGetMessageType(ConnectMessage) == LPC_CONNECTION_REQUEST)) { - /* Do the wait */ - Status = NtReplyWaitReceivePort(PortHandle, - NULL, - NULL, - ConnectMessage); + /* Break out */ + break; + } + } - /* Accept only LPC_CONNECTION_REQUEST requests. */ - if ((Status != STATUS_SUCCESS) || - (LpcpGetMessageType(ConnectMessage) == LPC_CONNECTION_REQUEST)) - { - /* Break out */ - break; - } - } - - /* Return status */ - return Status; + /* Return status */ + return Status; } Modified: trunk/reactos/ntoskrnl/lpc/port.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/port.c?rev=25…
============================================================================== --- trunk/reactos/ntoskrnl/lpc/port.c (original) +++ trunk/reactos/ntoskrnl/lpc/port.c Sun Jan 21 20:21:42 2007 @@ -18,7 +18,7 @@ ULONG LpcpMaxMessageSize; PAGED_LOOKASIDE_LIST LpcpMessagesLookaside; KGUARDED_MUTEX LpcpLock; -ULONG LpcpTraceLevel = 0; +ULONG LpcpTraceLevel = LPC_CLOSE_DEBUG; ULONG LpcpNextMessageId = 1, LpcpNextCallbackId = 1; static GENERIC_MAPPING LpcpPortMapping = @@ -54,7 +54,6 @@ ObjectTypeInitializer.CloseProcedure = LpcpClosePort; ObjectTypeInitializer.DeleteProcedure = LpcpDeletePort; ObjectTypeInitializer.ValidAccessMask = PORT_ALL_ACCESS; - ObjectTypeInitializer.MaintainTypeList = TRUE; ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, Modified: trunk/reactos/ntoskrnl/lpc/reply.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/reply.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/lpc/reply.c (original) +++ trunk/reactos/ntoskrnl/lpc/reply.c Sun Jan 21 20:21:42 2007 @@ -18,7 +18,8 @@ NTAPI LpcpFreeDataInfoMessage(IN PLPCP_PORT_OBJECT Port, IN ULONG MessageId, - IN ULONG CallbackId) + IN ULONG CallbackId, + IN CLIENT_ID ClientId) { PLPCP_MESSAGE Message; PLIST_ENTRY ListHead, NextEntry; @@ -28,6 +29,7 @@ { /* Use it */ Port = Port->ConnectionPort; + if (!Port) return; } /* Loop the list */ @@ -40,12 +42,13 @@ /* Make sure it matches */ if ((Message->Request.MessageId == MessageId) && - (Message->Request.CallbackId == CallbackId)) + (Message->Request.ClientId.UniqueThread == ClientId.UniqueThread) && + (Message->Request.ClientId.UniqueProcess == ClientId.UniqueProcess)) { /* Unlink and free it */ RemoveEntryList(&Message->Entry); InitializeListHead(&Message->Entry); - LpcpFreeToPortZone(Message, TRUE); + LpcpFreeToPortZone(Message, 1); break; } @@ -58,25 +61,31 @@ NTAPI LpcpSaveDataInfoMessage(IN PLPCP_PORT_OBJECT Port, IN PLPCP_MESSAGE Message, - IN ULONG LockFlags) + IN ULONG LockHeld) { PAGED_CODE(); /* Acquire the lock */ - KeAcquireGuardedMutex(&LpcpLock); + if (!LockHeld) KeAcquireGuardedMutex(&LpcpLock); /* Check if the port we want is the connection port */ if ((Port->Flags & LPCP_PORT_TYPE_MASK) > LPCP_UNCONNECTED_PORT) { /* Use it */ Port = Port->ConnectionPort; + if (!Port) + { + /* Release the lock and return */ + if (!LockHeld) KeReleaseGuardedMutex(&LpcpLock); + return; + } } /* Link the message */ InsertTailList(&Port->LpcDataInfoChainHead, &Message->Entry); /* Release the lock */ - KeReleaseGuardedMutex(&LpcpLock); + if (!LockHeld) KeReleaseGuardedMutex(&LpcpLock); } VOID @@ -119,7 +128,7 @@ Destination->ClientViewSize = Origin->ClientViewSize; /* Copy the Message Data */ - RtlMoveMemory(Destination + 1, + RtlCopyMemory(Destination + 1, Data, ((Destination->u1.Length & 0xFFFF) + 3) &~3); } @@ -149,7 +158,7 @@ OUT PPORT_MESSAGE ReceiveMessage, IN PLARGE_INTEGER Timeout OPTIONAL) { - PLPCP_PORT_OBJECT Port, ReceivePort; + PLPCP_PORT_OBJECT Port, ReceivePort, ConnectionPort = NULL; KPROCESSOR_MODE PreviousMode = KeGetPreviousMode(), WaitMode = PreviousMode; NTSTATUS Status; PLPCP_MESSAGE Message; @@ -207,8 +216,32 @@ /* Check if this is anything but a client port */ if ((Port->Flags & LPCP_PORT_TYPE_MASK) != LPCP_CLIENT_PORT) { - /* Use the connection port */ - ReceivePort = Port->ConnectionPort; + /* Check if this is the connection port */ + if (Port->ConnectionPort == Port) + { + /* Use this port */ + ConnectionPort = ReceivePort = Port; + ObReferenceObject(ConnectionPort); + } + else + { + /* Acquire the lock */ + KeAcquireGuardedMutex(&LpcpLock); + + /* Get the port */ + ConnectionPort = ReceivePort = Port->ConnectionPort; + if (!ConnectionPort) + { + /* Fail */ + KeReleaseGuardedMutex(&LpcpLock); + ObDereferenceObject(Port); + return STATUS_PORT_DISCONNECTED; + } + + /* Release lock and reference */ + ObReferenceObject(Port); + KeReleaseGuardedMutex(&LpcpLock); + } } else { @@ -227,6 +260,7 @@ { /* No thread found, fail */ ObDereferenceObject(Port); + if (ConnectionPort) ObDereferenceObject(ConnectionPort); return Status; } @@ -235,6 +269,7 @@ if (!Message) { /* Fail if we couldn't allocate a message */ + if (ConnectionPort) ObDereferenceObject(ConnectionPort); ObDereferenceObject(WakeupThread); ObDereferenceObject(Port); return STATUS_NO_MEMORY; @@ -244,11 +279,16 @@ KeAcquireGuardedMutex(&LpcpLock); /* Make sure this is the reply the thread is waiting for */ - if (WakeupThread->LpcReplyMessageId != ReplyMessage->MessageId) + if ((WakeupThread->LpcReplyMessageId != ReplyMessage->MessageId))// || +#if 0 + ((WakeupThread->LpcReplyMessage) && + (LpcpGetMessageType(&((PLPCP_MESSAGE)WakeupThread-> + LpcReplyMessage)->Request) != LPC_REQUEST))) +#endif { /* It isn't, fail */ - LpcpFreeToPortZone(Message, TRUE); - KeReleaseGuardedMutex(&LpcpLock); + LpcpFreeToPortZone(Message, 3); + if (ConnectionPort) ObDereferenceObject(ConnectionPort); ObDereferenceObject(WakeupThread); ObDereferenceObject(Port); return STATUS_REPLY_MESSAGE_MISMATCH; @@ -261,36 +301,37 @@ LPC_REPLY, NULL); + /* Reference the thread while we use it */ + ObReferenceObject(WakeupThread); + Message->RepliedToThread = WakeupThread; + + /* Set this as the reply message */ + WakeupThread->LpcReplyMessageId = 0; + WakeupThread->LpcReplyMessage = (PVOID)Message; + + /* Check if we have messages on the reply chain */ + if (!(WakeupThread->LpcExitThreadCalled) && + !(IsListEmpty(&WakeupThread->LpcReplyChain))) + { + /* Remove us from it and reinitialize it */ + RemoveEntryList(&WakeupThread->LpcReplyChain); + InitializeListHead(&WakeupThread->LpcReplyChain); + } + + /* Check if this is the message the thread had received */ + if ((Thread->LpcReceivedMsgIdValid) && + (Thread->LpcReceivedMessageId == ReplyMessage->MessageId)) + { + /* Clear this data */ + Thread->LpcReceivedMessageId = 0; + Thread->LpcReceivedMsgIdValid = FALSE; + } + /* Free any data information */ LpcpFreeDataInfoMessage(Port, ReplyMessage->MessageId, - ReplyMessage->CallbackId); - - /* Reference the thread while we use it */ - ObReferenceObject(WakeupThread); - Message->RepliedToThread = WakeupThread; - - /* Set this as the reply message */ - WakeupThread->LpcReplyMessageId = 0; - WakeupThread->LpcReplyMessage = (PVOID)Message; - - /* Check if we have messages on the reply chain */ - if (!(WakeupThread->LpcExitThreadCalled) && - !(IsListEmpty(&WakeupThread->LpcReplyChain))) - { - /* Remove us from it and reinitialize it */ - RemoveEntryList(&WakeupThread->LpcReplyChain); - InitializeListHead(&WakeupThread->LpcReplyChain); - } - - /* Check if this is the message the thread had received */ - if ((Thread->LpcReceivedMsgIdValid) && - (Thread->LpcReceivedMessageId == ReplyMessage->MessageId)) - { - /* Clear this data */ - Thread->LpcReceivedMessageId = 0; - Thread->LpcReceivedMsgIdValid = FALSE; - } + ReplyMessage->CallbackId, + ReplyMessage->ClientId); /* Release the lock and release the LPC semaphore to wake up waiters */ KeReleaseGuardedMutex(&LpcpLock); @@ -319,6 +360,7 @@ /* Release the lock and fail */ KeReleaseGuardedMutex(&LpcpLock); + if (ConnectionPort) ObDereferenceObject(ConnectionPort); ObDereferenceObject(Port); return STATUS_UNSUCCESSFUL; } @@ -346,9 +388,6 @@ /* Set this as the received message */ Thread->LpcReceivedMessageId = Message->Request.MessageId; Thread->LpcReceivedMsgIdValid = TRUE; - - /* Done touching global data, release the lock */ - KeReleaseGuardedMutex(&LpcpLock); /* Check if this was a connection request */ if (LpcpGetMessageType(&Message->Request) == LPC_CONNECTION_REQUEST) @@ -374,7 +413,7 @@ ReceiveMessage->u1.s1.TotalLength = sizeof(LPCP_MESSAGE) + ConnectionInfoLength; ReceiveMessage->u1.s1.DataLength = ConnectionInfoLength; - RtlMoveMemory(ReceiveMessage + 1, + RtlCopyMemory(ReceiveMessage + 1, ConnectMessage + 1, ConnectionInfoLength); @@ -413,8 +452,17 @@ ASSERT(FALSE); } - /* If we have a message pointer here, free it */ - if (Message) LpcpFreeToPortZone(Message, FALSE); + /* Check if we have a message pointer here */ + if (Message) + { + /* Free it and release the lock */ + LpcpFreeToPortZone(Message, 3); + } + else + { + /* Just release the lock */ + KeReleaseGuardedMutex(&LpcpLock); + } Cleanup: /* All done, dereference the port and return the status */ @@ -422,6 +470,7 @@ "Port: %p. Status: %p\n", Port, Status); + if (ConnectionPort) ObDereferenceObject(ConnectionPort); ObDereferenceObject(Port); return Status; } Modified: trunk/reactos/ntoskrnl/lpc/send.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/send.c?rev=25…
============================================================================== --- trunk/reactos/ntoskrnl/lpc/send.c (original) +++ trunk/reactos/ntoskrnl/lpc/send.c Sun Jan 21 20:21:42 2007 @@ -22,7 +22,7 @@ LpcRequestPort(IN PVOID PortObject, IN PPORT_MESSAGE LpcMessage) { - PLPCP_PORT_OBJECT Port = (PLPCP_PORT_OBJECT)PortObject, QueuePort; + PLPCP_PORT_OBJECT Port = PortObject, QueuePort, ConnectionPort = NULL; ULONG MessageType; PLPCP_MESSAGE Message; KPROCESSOR_MODE PreviousMode = KeGetPreviousMode(); @@ -42,7 +42,7 @@ return STATUS_INVALID_PARAMETER; } - /* Mark this as a kernel-mode message only if we really came from there */ + /* Mark this as a kernel-mode message only if we really came from it */ if ((PreviousMode == KernelMode) && (LpcMessage->u2.s2.Type & LPC_KERNELMODE_MESSAGE)) { @@ -72,6 +72,7 @@ if (!Message) return STATUS_NO_MEMORY; /* Clear the context */ + Message->RepliedToThread = NULL; Message->PortContext = NULL; /* Copy the message */ @@ -96,13 +97,28 @@ { /* Then copy the context */ Message->PortContext = QueuePort->PortContext; - QueuePort = Port->ConnectionPort; + ConnectionPort = QueuePort = Port->ConnectionPort; + if (!ConnectionPort) + { + /* Fail */ + LpcpFreeToPortZone(Message, 3); + return STATUS_PORT_DISCONNECTED; + } } else if ((Port->Flags & LPCP_PORT_TYPE_MASK) != LPCP_COMMUNICATION_PORT) { /* Any other kind of port, use the connection port */ - QueuePort = Port->ConnectionPort; - } + ConnectionPort = QueuePort = Port->ConnectionPort; + if (!ConnectionPort) + { + /* Fail */ + LpcpFreeToPortZone(Message, 3); + return STATUS_PORT_DISCONNECTED; + } + } + + /* If we have a connection port, reference it */ + if (ConnectionPort) ObReferenceObject(ConnectionPort); } } else @@ -126,6 +142,7 @@ InsertTailList(&QueuePort->MsgQueue.ReceiveHead, &Message->Entry); /* Release the lock and release the semaphore */ + KeEnterCriticalRegion(); KeReleaseGuardedMutex(&LpcpLock); LpcpCompleteWait(QueuePort->MsgQueue.Semaphore); @@ -137,13 +154,15 @@ } /* We're done */ + KeLeaveCriticalRegion(); LPCTRACE(LPC_SEND_DEBUG, "Port: %p. Message: %p\n", QueuePort, Message); + if (ConnectionPort) ObDereferenceObject(ConnectionPort); return STATUS_SUCCESS; } /* If we got here, then free the message and fail */ - LpcpFreeToPortZone(Message, TRUE); - KeReleaseGuardedMutex(&LpcpLock); + LpcpFreeToPortZone(Message, 3); + if (ConnectionPort) ObDereferenceObject(ConnectionPort); return STATUS_PORT_DISCONNECTED; } @@ -181,7 +200,7 @@ IN PPORT_MESSAGE LpcRequest, IN OUT PPORT_MESSAGE LpcReply) { - PLPCP_PORT_OBJECT Port, QueuePort, ReplyPort; + PLPCP_PORT_OBJECT Port, QueuePort, ReplyPort, ConnectionPort = NULL; KPROCESSOR_MODE PreviousMode = KeGetPreviousMode(); NTSTATUS Status; PLPCP_MESSAGE Message; @@ -286,8 +305,7 @@ if (!QueuePort) { /* We have no connected port, fail */ - LpcpFreeToPortZone(Message, TRUE); - KeReleaseGuardedMutex(&LpcpLock); + LpcpFreeToPortZone(Message, 3); ObDereferenceObject(Port); return STATUS_PORT_DISCONNECTED; } @@ -299,15 +317,32 @@ if ((Port->Flags & LPCP_PORT_TYPE_MASK) == LPCP_CLIENT_PORT) { /* Copy the port context and use the connection port */ - Message->PortContext = ReplyPort->PortContext; - QueuePort = Port->ConnectionPort; + Message->PortContext = QueuePort->PortContext; + ConnectionPort = QueuePort = Port->ConnectionPort; + if (!ConnectionPort) + { + /* Fail */ + LpcpFreeToPortZone(Message, 3); + ObDereferenceObject(Port); + return STATUS_PORT_DISCONNECTED; + } } else if ((Port->Flags & LPCP_PORT_TYPE_MASK) != LPCP_COMMUNICATION_PORT) { /* Use the connection port for anything but communication ports */ - QueuePort = Port->ConnectionPort; - } + ConnectionPort = QueuePort = Port->ConnectionPort; + if (!ConnectionPort) + { + /* Fail */ + LpcpFreeToPortZone(Message, 3); + ObDereferenceObject(Port); + return STATUS_PORT_DISCONNECTED; + } + } + + /* Reference the connection port if it exists */ + if (ConnectionPort) ObReferenceObject(ConnectionPort); } else { @@ -317,6 +352,7 @@ /* No reply thread */ Message->RepliedToThread = NULL; + Message->SenderPort = Port; /* Generate the Message ID and set it */ Message->Request.MessageId = LpcpNextMessageId++; @@ -330,8 +366,10 @@ /* Insert the message in our chain */ InsertTailList(&QueuePort->MsgQueue.ReceiveHead, &Message->Entry); InsertTailList(&ReplyPort->LpcReplyChainHead, &Thread->LpcReplyChain); + Thread->LpcWaitingOnPort = Port; /* Release the lock and get the semaphore we'll use later */ + KeEnterCriticalRegion(); KeReleaseGuardedMutex(&LpcpLock); Semaphore = QueuePort->MsgQueue.Semaphore; @@ -345,6 +383,7 @@ /* Now release the semaphore */ LpcpCompleteWait(Semaphore); + KeLeaveCriticalRegion(); /* And let's wait for the reply */ LpcpReplyWait(&Thread->LpcReplySemaphore, PreviousMode); @@ -396,7 +435,7 @@ else { /* Otherwise, just free it */ - LpcpFreeToPortZone(Message, FALSE); + LpcpFreeToPortZone(Message, 0); } } else @@ -407,10 +446,8 @@ } else { - /* The wait failed, free the message while holding the lock */ - KeAcquireGuardedMutex(&LpcpLock); - LpcpFreeToPortZone(Message, TRUE); - KeReleaseGuardedMutex(&LpcpLock); + /* The wait failed, free the message */ + if (Message) LpcpFreeToPortZone(Message, 0); } /* All done */ @@ -419,6 +456,7 @@ Port, Status); ObDereferenceObject(Port); + if (ConnectionPort) ObDereferenceObject(ConnectionPort); return Status; }
17 years, 11 months
1
0
0
0
[cwittich] 25556: fix some warnings (gcc 4.2)
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jan 21 19:04:17 2007 New Revision: 25556 URL:
http://svn.reactos.org/svn/reactos?rev=25556&view=rev
Log: fix some warnings (gcc 4.2) Modified: trunk/reactos/base/applications/taskmgr/proclist.c trunk/reactos/base/applications/testsets/smss/movefile/movefile.cpp trunk/reactos/base/setup/welcome/welcome.c Modified: trunk/reactos/base/applications/taskmgr/proclist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
============================================================================== --- trunk/reactos/base/applications/taskmgr/proclist.c (original) +++ trunk/reactos/base/applications/taskmgr/proclist.c Sun Jan 21 19:04:17 2007 @@ -72,10 +72,13 @@ * subtract it from our clip rect because we don't * use icons in this list control. */ - (void)ListView_GetItemRect(hWnd, 0, &rcClip, LVIR_BOUNDS); - (void)ListView_GetItemRect(hWnd, ListView_GetItemCount(hWnd) - 1, &rcItem, LVIR_BOUNDS); - rcClip.bottom = rcItem.bottom; - (void)ListView_GetItemRect(hWnd, 0, &rcItem, LVIR_ICON); + rcClip.left = LVIR_BOUNDS; + SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcClip); + rcClip.left = LVIR_BOUNDS; + SendMessage(hWnd, LVM_GETITEMRECT, ListView_GetItemCount(hWnd) - 1, (LPARAM)&rcItem); + rcClip.bottom = rcItem.bottom; + rcClip.left = LVIR_ICON; + SendMessage(hWnd, LVM_GETITEMRECT, 0, (LPARAM)&rcItem); rcClip.left = rcItem.right; /* Modified: trunk/reactos/base/applications/testsets/smss/movefile/movefile.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/testsets…
============================================================================== --- trunk/reactos/base/applications/testsets/smss/movefile/movefile.cpp (original) +++ trunk/reactos/base/applications/testsets/smss/movefile/movefile.cpp Sun Jan 21 19:04:17 2007 @@ -85,11 +85,11 @@ HANDLE hFile = NULL; BOOL fReturnValue; - char *szxReplacedFile = "c:\\testFileIsReplaced"; - char *szxMovedFileWithRepl = "c:\\testFileShouldBeMovedW"; - char *szxMovedFile = "c:\\testFileShouldBeMoved"; - char *szxNewMovedFile = "c:\\testFileIsMoved"; - char *szxDeletedFile = "c:\\testFileShouldBeDeleted"; + const char szxReplacedFile[] = "c:\\testFileIsReplaced"; + const char szxMovedFileWithRepl[] = "c:\\testFileShouldBeMovedW"; + const char szxMovedFile[] = "c:\\testFileShouldBeMoved"; + const char szxNewMovedFile[] = "c:\\testFileIsMoved"; + const char szxDeletedFile[] = "c:\\testFileShouldBeDeleted"; memset(sBuf, 0xaa, sizeof(sBuf)); Modified: trunk/reactos/base/setup/welcome/welcome.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/welcome/welcome…
============================================================================== --- trunk/reactos/base/setup/welcome/welcome.c (original) +++ trunk/reactos/base/setup/welcome/welcome.c Sun Jan 21 19:04:17 2007 @@ -129,7 +129,7 @@ wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = hMainIcon; - wndclass.hCursor = LoadCursor (NULL, MAKEINTRESOURCE(IDC_ARROW)); + wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); wndclass.hbrBackground = 0; wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szFrameClass;
17 years, 11 months
1
0
0
0
← Newer
1
...
8
9
10
11
12
13
14
...
41
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
Results per page:
10
25
50
100
200