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
November 2009
----- 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
444 discussions
Start a n
N
ew thread
[cgutman] 44166: - Fix build (try 3) - I have no idea how this built for me
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Nov 14 20:03:37 2009 New Revision: 44166 URL:
http://svn.reactos.org/svn/reactos?rev=44166&view=rev
Log: - Fix build (try 3) - I have no idea how this built for me Modified: trunk/reactos/lib/drivers/ip/transport/tcp/if.c Modified: trunk/reactos/lib/drivers/ip/transport/tcp/if.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
============================================================================== --- trunk/reactos/lib/drivers/ip/transport/tcp/if.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/transport/tcp/if.c [iso-8859-1] Sat Nov 14 20:03:37 2009 @@ -36,8 +36,6 @@ struct sockaddr_in *addr_in; struct sockaddr_in *dstaddr_in; ASSERT(ifaddr); - - ASSERT_LOCKED(&TCPLock); RtlZeroMemory(ifaddr, sizeof(OSK_IFADDR) + 2 * sizeof( struct sockaddr_in )); @@ -81,8 +79,6 @@ struct sockaddr_in *addr_in = (struct sockaddr_in *)ReqAddr; POSK_IFADDR InterfaceData; - ASSERT_LOCKED(&TCPLock); - TI_DbgPrint(DEBUG_TCPIF,("called for type %d\n", FindType)); if( !ReqAddr ) {
15 years, 1 month
1
0
0
0
[cgutman] 44165: - Fix build (try 2)
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Nov 14 19:52:33 2009 New Revision: 44165 URL:
http://svn.reactos.org/svn/reactos?rev=44165&view=rev
Log: - Fix build (try 2) Modified: trunk/reactos/drivers/network/tcpip/include/lock.h Modified: trunk/reactos/drivers/network/tcpip/include/lock.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/lock.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/lock.h [iso-8859-1] Sat Nov 14 19:52:33 2009 @@ -12,8 +12,5 @@ PKSPIN_LOCK Lock ); extern VOID TcpipAcquireFastMutex( PFAST_MUTEX Mutex ); extern VOID TcpipReleaseFastMutex( PFAST_MUTEX Mutex ); -extern VOID TcpipRecursiveMutexInit( PRECURSIVE_MUTEX RecMutex ); -extern VOID TcpipRecursiveMutexEnter( PRECURSIVE_MUTEX RecMutex ); -extern VOID TcpipRecursiveMutexLeave( PRECURSIVE_MUTEX RecMutex ); #endif/*_LOCK_H*/
15 years, 1 month
1
0
0
0
[cgutman] 44164: - Fix build
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Nov 14 19:48:07 2009 New Revision: 44164 URL:
http://svn.reactos.org/svn/reactos?rev=44164&view=rev
Log: - Fix build Modified: trunk/reactos/drivers/network/tcpip/include/precomp.h Modified: trunk/reactos/drivers/network/tcpip/include/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/precomp.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/precomp.h [iso-8859-1] Sat Nov 14 19:48:07 2009 @@ -3,7 +3,6 @@ #include <ntifs.h> #include <tdi.h> #include <tdistat.h> -#include <../recmutex/recmutex.h> #include <tcpip.h> #include <loopback.h> #include <ip.h>
15 years, 1 month
1
0
0
0
[cgutman] 44163: - Use a spin lock to protect OSKit instead of a recursive mutex - Remove the now unused recursive mutex code - Don't clear the SS_ISCONNECTING flag when soconnect returns EINPROGRESS because it causes a crash during soreceive - Lock CONNECTION_ENDPOINT and ADDRESS_FILE structs better - Remove incorrect IoMarkIrpPending calls - Remove useless ASSERT_LOCKED - Don't destroy so_connection when we close a connection - Remove useless FileFindConnectionByContext - Remove SignalledConne
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Nov 14 19:38:02 2009 New Revision: 44163 URL:
http://svn.reactos.org/svn/reactos?rev=44163&view=rev
Log: - Use a spin lock to protect OSKit instead of a recursive mutex - Remove the now unused recursive mutex code - Don't clear the SS_ISCONNECTING flag when soconnect returns EINPROGRESS because it causes a crash during soreceive - Lock CONNECTION_ENDPOINT and ADDRESS_FILE structs better - Remove incorrect IoMarkIrpPending calls - Remove useless ASSERT_LOCKED - Don't destroy so_connection when we close a connection - Remove useless FileFindConnectionByContext - Remove SignalledConnectionsList and SignalledConnectionsLock and simply loop through ConnectionEndpointList for signalled connections - Add connections to ConnectionEndpointList in TCPAllocateConnectionEndpoint instead of FileOpenConnection so we don't miss listeners - Remove connections from ConnectionEndpointList in TCPFreeConnectionEndpoint instead of FileCloseConnection so we don't miss listeners - Use ExInterlockedRemoveHeadList to remove entries in the address file's request lists - Remove useless members, flags, and variables in titypes.h and tcp.h - Fixes bug 4955 and 4434 Removed: trunk/reactos/drivers/network/tcpip/recmutex/ Modified: trunk/reactos/drivers/network/tcpip/include/fileobjs.h trunk/reactos/drivers/network/tcpip/include/tcp.h trunk/reactos/drivers/network/tcpip/include/titypes.h trunk/reactos/drivers/network/tcpip/tcpip.rbuild trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c trunk/reactos/drivers/network/tcpip/tcpip/lock.c trunk/reactos/drivers/network/tcpip/tcpip/mocklock.c trunk/reactos/lib/drivers/ip/transport/datagram/datagram.c trunk/reactos/lib/drivers/ip/transport/rawip/rawip.c trunk/reactos/lib/drivers/ip/transport/tcp/accept.c trunk/reactos/lib/drivers/ip/transport/tcp/event.c trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c trunk/reactos/lib/drivers/ip/transport/udp/udp.c trunk/reactos/lib/drivers/oskittcp/include/oskittcp.h trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c Modified: trunk/reactos/drivers/network/tcpip/include/fileobjs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/fileobjs.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/fileobjs.h [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -13,7 +13,6 @@ extern LIST_ENTRY ConnectionEndpointListHead; extern KSPIN_LOCK ConnectionEndpointListLock; - NTSTATUS FileOpenAddress( PTDI_REQUEST Request, PTA_IP_ADDRESS AddrList, @@ -27,8 +26,6 @@ PTDI_REQUEST Request, PVOID ClientContext); -PCONNECTION_ENDPOINT FileFindConnectionByContext( PVOID Context ); - NTSTATUS FileCloseConnection( PTDI_REQUEST Request); Modified: trunk/reactos/drivers/network/tcpip/include/tcp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/tcp.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/tcp.h [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -84,11 +84,6 @@ #define SRF_FIN TCP_FIN extern LONG TCP_IPIdentification; -extern LIST_ENTRY SignalledConnectionsList; -extern KSPIN_LOCK SignalledConnectionsLock; -extern LIST_ENTRY SleepingThreadsList; -extern FAST_MUTEX SleepingThreadsLock; -extern RECURSIVE_MUTEX TCPLock; /* accept.c */ NTSTATUS TCPServiceListeningSocket( PCONNECTION_ENDPOINT Listener, @@ -105,7 +100,6 @@ PVOID Context ); /* tcp.c */ -ULONG HandleSignalledConnection( PCONNECTION_ENDPOINT Connection ); PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext ); VOID TCPFreeConnectionEndpoint( PCONNECTION_ENDPOINT Connection ); Modified: trunk/reactos/drivers/network/tcpip/include/titypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/titypes.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/titypes.h [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -153,7 +153,6 @@ LIST_ENTRY ListEntry; /* Entry on list */ KSPIN_LOCK Lock; /* Spin lock to manipulate this structure */ OBJECT_FREE_ROUTINE Free; /* Routine to use to free resources for the object */ - USHORT Flags; /* Flags for address file (see below) */ IP_ADDRESS Address; /* Address of this address file */ USHORT Family; /* Address family */ USHORT Protocol; /* Protocol number */ @@ -213,29 +212,6 @@ BOOLEAN RegisteredChainedReceiveExpeditedHandler; } ADDRESS_FILE, *PADDRESS_FILE; -/* Address File Flag constants */ -#define AFF_VALID 0x0001 /* Address file object is valid for use */ -#define AFF_BUSY 0x0002 /* Address file object is exclusive to someone */ -#define AFF_DELETE 0x0004 /* Address file object is sheduled to be deleted */ -#define AFF_SEND 0x0008 /* A send request is pending */ -#define AFF_RECEIVE 0x0010 /* A receive request is pending */ -#define AFF_PENDING 0x001C /* A request is pending */ - -/* Macros for manipulating address file object flags */ - -#define AF_IS_VALID(ADF) ((ADF)->Flags & AFF_VALID) -#define AF_SET_VALID(ADF) ((ADF)->Flags |= AFF_VALID) -#define AF_CLR_VALID(ADF) ((ADF)->Flags &= ~AFF_VALID) - -#define AF_IS_BUSY(ADF) ((ADF)->Flags & AFF_BUSY) -#define AF_SET_BUSY(ADF) ((ADF)->Flags |= AFF_BUSY) -#define AF_CLR_BUSY(ADF) ((ADF)->Flags &= ~AFF_BUSY) - -#define AF_IS_PENDING(ADF, X) (ADF->Flags & X) -#define AF_SET_PENDING(ADF, X) (ADF->Flags |= X) -#define AF_CLR_PENDING(ADF, X) (ADF->Flags &= ~X) - - /* Structure used to search through Address Files */ typedef struct _AF_SEARCH { PLIST_ENTRY Next; /* Next address file to check */ @@ -306,8 +282,6 @@ LIST_ENTRY SendRequest; /* Queued send requests */ /* Signals */ - LIST_ENTRY SignalList; /* Entry in the list of sockets waiting for - * notification service to the client */ UINT SignalState; /* Active signals from oskit */ } CONNECTION_ENDPOINT, *PCONNECTION_ENDPOINT; Modified: trunk/reactos/drivers/network/tcpip/tcpip.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip.rbuild [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip.rbuild [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -21,9 +21,6 @@ <directory name="datalink"> <file>lan.c</file> </directory> - <directory name="recmutex"> - <file>recmutex.c</file> - </directory> <directory name="tcpip"> <file>ainfo.c</file> <file>buffer.c</file> Modified: trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -210,9 +210,8 @@ TCPRemoveIRP(Connection, Irp); - TCPAbortListenForSocket( - Connection->AddressFile->Listener, - Connection ); + TCPAbortListenForSocket(Connection->AddressFile->Listener, + Connection); IoReleaseCancelSpinLock(Irp->CancelIrql); @@ -1044,7 +1043,7 @@ Parameters = (PTDI_REQUEST_KERNEL_SET_EVENT)&IrpSp->Parameters; Status = STATUS_SUCCESS; - TcpipAcquireSpinLock(&AddrFile->Lock, &OldIrql); + KeAcquireSpinLock(&AddrFile->Lock, &OldIrql); /* Set the event handler. if an event handler is associated with a specific event, it's flag (RegisteredXxxHandler) is TRUE. @@ -1165,7 +1164,7 @@ Status = STATUS_INVALID_PARAMETER; } - TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); return Status; } Modified: trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -295,9 +295,6 @@ /* Initialize spin lock that protects the address file object */ KeInitializeSpinLock(&AddrFile->Lock); - /* Set valid flag so the address can be used */ - AF_SET_VALID(AddrFile); - /* Return address file object */ Request->Handle.AddressHandle = AddrFile; @@ -328,7 +325,7 @@ KIRQL OldIrql; PDATAGRAM_RECEIVE_REQUEST ReceiveRequest; PDATAGRAM_SEND_REQUEST SendRequest; - PLIST_ENTRY CurrentEntry, NextEntry; + PLIST_ENTRY CurrentEntry; AddrFile = Request->Handle.AddressHandle; @@ -339,8 +336,6 @@ RemoveEntryList(&AddrFile->ListEntry); TcpipReleaseSpinLock(&AddressFileListLock, OldIrql); - TcpipAcquireSpinLock(&AddrFile->Lock, &OldIrql); - /* FIXME: Kill TCP connections on this address file object */ /* Return pending requests with error */ @@ -348,43 +343,27 @@ TI_DbgPrint(DEBUG_ADDRFILE, ("Aborting receive requests on AddrFile at (0x%X).\n", AddrFile)); /* Go through pending receive request list and cancel them all */ - CurrentEntry = AddrFile->ReceiveQueue.Flink; - while (CurrentEntry != &AddrFile->ReceiveQueue) { - NextEntry = CurrentEntry->Flink; + while ((CurrentEntry = ExInterlockedRemoveHeadList(&AddrFile->ReceiveQueue, &AddrFile->Lock))) { ReceiveRequest = CONTAINING_RECORD(CurrentEntry, DATAGRAM_RECEIVE_REQUEST, ListEntry); - /* Abort the request and free its resources */ - TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); (*ReceiveRequest->Complete)(ReceiveRequest->Context, STATUS_CANCELLED, 0); - TcpipAcquireSpinLock(&AddrFile->Lock, &OldIrql); - CurrentEntry = NextEntry; + /* exFreePool(ReceiveRequest); FIXME: WTF? */ } TI_DbgPrint(DEBUG_ADDRFILE, ("Aborting send requests on address file at (0x%X).\n", AddrFile)); /* Go through pending send request list and cancel them all */ - CurrentEntry = AddrFile->TransmitQueue.Flink; - while (CurrentEntry != &AddrFile->TransmitQueue) { - NextEntry = CurrentEntry->Flink; - SendRequest = CONTAINING_RECORD(CurrentEntry, - DATAGRAM_SEND_REQUEST, ListEntry); - /* Abort the request and free its resources */ - TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); + while ((CurrentEntry = ExInterlockedRemoveHeadList(&AddrFile->ReceiveQueue, &AddrFile->Lock))) { + SendRequest = CONTAINING_RECORD(CurrentEntry, DATAGRAM_SEND_REQUEST, ListEntry); (*SendRequest->Complete)(SendRequest->Context, STATUS_CANCELLED, 0); exFreePool(SendRequest); - TcpipAcquireSpinLock(&AddrFile->Lock, &OldIrql); - CurrentEntry = NextEntry; - } - - TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); + } /* Protocol specific handling */ switch (AddrFile->Protocol) { case IPPROTO_TCP: TCPFreePort( AddrFile->Port ); - if( AddrFile->Listener ) { - TCPClose( AddrFile->Listener ); - exFreePool( AddrFile->Listener ); - } + if( AddrFile->Listener ) + TCPClose( AddrFile->Listener ); break; case IPPROTO_UDP: @@ -433,46 +412,9 @@ /* Return connection endpoint file object */ Request->Handle.ConnectionContext = Connection; - /* Add connection endpoint to global list */ - ExInterlockedInsertTailList( - &ConnectionEndpointListHead, - &Connection->ListEntry, - &ConnectionEndpointListLock); - TI_DbgPrint(MAX_TRACE, ("Leaving.\n")); return STATUS_SUCCESS; -} - - -/* - * FUNCTION: Find a connection by examining the context field. This - * is needed in some situations where a FIN reply is needed after a - * socket is formally broken. - * ARGUMENTS: - * Request = Pointer to TDI request structure for this request - * RETURNS: - * Status of operation - */ -PCONNECTION_ENDPOINT FileFindConnectionByContext( PVOID Context ) { - PLIST_ENTRY Entry; - KIRQL OldIrql; - PCONNECTION_ENDPOINT Connection = NULL; - - TcpipAcquireSpinLock( &ConnectionEndpointListLock, &OldIrql ); - - for( Entry = ConnectionEndpointListHead.Flink; - Entry != &ConnectionEndpointListHead; - Entry = Entry->Flink ) { - Connection = - CONTAINING_RECORD( Entry, CONNECTION_ENDPOINT, ListEntry ); - if( Connection->SocketContext == Context ) break; - else Connection = NULL; - } - - TcpipReleaseSpinLock( &ConnectionEndpointListLock, OldIrql ); - - return Connection; } /* @@ -486,19 +428,12 @@ PTDI_REQUEST Request) { PCONNECTION_ENDPOINT Connection; - KIRQL OldIrql; TI_DbgPrint(MID_TRACE, ("Called.\n")); Connection = Request->Handle.ConnectionContext; - TcpipAcquireSpinLock(&ConnectionEndpointListLock, &OldIrql); - RemoveEntryList(&Connection->ListEntry); - TcpipReleaseSpinLock(&ConnectionEndpointListLock, OldIrql); - TCPClose( Connection ); - - TCPFreeConnectionEndpoint(Connection); TI_DbgPrint(MAX_TRACE, ("Leaving.\n")); Modified: trunk/reactos/drivers/network/tcpip/tcpip/lock.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/lock.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/lock.c [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -44,16 +44,3 @@ ExReleaseFastMutex( Mutex ); } -VOID TcpipRecursiveMutexInit( PRECURSIVE_MUTEX RecMutex ) { - RecursiveMutexInit( RecMutex ); -} - -VOID TcpipRecursiveMutexEnter( PRECURSIVE_MUTEX RecMutex ) { - //TI_DbgPrint(DEBUG_LOCK,("Locking\n")); - RecursiveMutexEnter( RecMutex ); -} - -VOID TcpipRecursiveMutexLeave( PRECURSIVE_MUTEX RecMutex ) { - //TI_DbgPrint(DEBUG_LOCK,("Unlocking\n")); - RecursiveMutexLeave( RecMutex ); -} Modified: trunk/reactos/drivers/network/tcpip/tcpip/mocklock.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/mocklock.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/mocklock.c [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -45,11 +45,3 @@ VOID TcpipReleaseFastMutex( PFAST_MUTEX Mutex ) { } -VOID TcpipRecursiveMutexInit( PRECURSIVE_MUTEX RecMutex ) { -} - -VOID TcpipRecursiveMutexEnter( PRECURSIVE_MUTEX RecMutex ) { -} - -VOID TcpipRecursiveMutexLeave( PRECURSIVE_MUTEX RecMutex ) { -} Modified: trunk/reactos/lib/drivers/ip/transport/datagram/datagram.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/d…
============================================================================== --- trunk/reactos/lib/drivers/ip/transport/datagram/datagram.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/transport/datagram/datagram.c [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -79,7 +79,7 @@ TI_DbgPrint(MAX_TRACE, ("Called.\n")); - TcpipAcquireSpinLock(&AddrFile->Lock, &OldIrql); + KeAcquireSpinLock(&AddrFile->Lock, &OldIrql); if (AddrFile->Protocol == IPPROTO_UDP) { @@ -136,7 +136,7 @@ &SrcAddress->Address.IPv4Address, sizeof(SrcAddress->Address.IPv4Address) ); - TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); /* Complete the receive request */ if (Current->BufferSize < DataSize) @@ -144,11 +144,11 @@ else Current->Complete(Current->Context, STATUS_SUCCESS, DataSize); - TcpipAcquireSpinLock(&AddrFile->Lock, &OldIrql); + KeAcquireSpinLock(&AddrFile->Lock, &OldIrql); } } - TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); } else if (AddrFile->RegisteredReceiveDatagramHandler) { @@ -157,8 +157,6 @@ ReceiveHandler = AddrFile->ReceiveDatagramHandler; HandlerContext = AddrFile->ReceiveDatagramHandlerContext; - TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); - if (SrcAddress->Type == IP_ADDRESS_V4) { AddressLength = sizeof(IPv4_RAW_ADDRESS); @@ -169,6 +167,8 @@ AddressLength = sizeof(IPv6_RAW_ADDRESS); SourceAddress = SrcAddress->Address.IPv6Address; } + + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); Status = (*ReceiveHandler)(HandlerContext, AddressLength, @@ -184,7 +184,7 @@ } else { - TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); TI_DbgPrint(MAX_TRACE, ("Discarding datagram.\n")); } @@ -228,75 +228,66 @@ * This is the high level interface for receiving DG datagrams */ { - KIRQL OldIrql; NTSTATUS Status; PDATAGRAM_RECEIVE_REQUEST ReceiveRequest; + KIRQL OldIrql; TI_DbgPrint(MAX_TRACE, ("Called.\n")); - TcpipAcquireSpinLock(&AddrFile->Lock, &OldIrql); - - if (AF_IS_VALID(AddrFile)) - { - ReceiveRequest = exAllocatePool(NonPagedPool, sizeof(DATAGRAM_RECEIVE_REQUEST)); - if (ReceiveRequest) - { - /* Initialize a receive request */ - - /* Extract the remote address filter from the request (if any) */ - if ((ConnInfo->RemoteAddressLength != 0) && - (ConnInfo->RemoteAddress)) + KeAcquireSpinLock(&AddrFile->Lock, &OldIrql); + + ReceiveRequest = exAllocatePool(NonPagedPool, sizeof(DATAGRAM_RECEIVE_REQUEST)); + if (ReceiveRequest) + { + /* Initialize a receive request */ + + /* Extract the remote address filter from the request (if any) */ + if ((ConnInfo->RemoteAddressLength != 0) && + (ConnInfo->RemoteAddress)) + { + Status = AddrGetAddress(ConnInfo->RemoteAddress, + &ReceiveRequest->RemoteAddress, + &ReceiveRequest->RemotePort); + if (!NT_SUCCESS(Status)) { - Status = AddrGetAddress(ConnInfo->RemoteAddress, - &ReceiveRequest->RemoteAddress, - &ReceiveRequest->RemotePort); - if (!NT_SUCCESS(Status)) - { - TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); - exFreePool(ReceiveRequest); - return Status; - } + exFreePool(ReceiveRequest); + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); + return Status; } - else - { - ReceiveRequest->RemotePort = 0; - AddrInitIPv4(&ReceiveRequest->RemoteAddress, 0); - } - - IoMarkIrpPending(Irp); - - ReceiveRequest->ReturnInfo = ReturnInfo; - ReceiveRequest->Buffer = BufferData; - ReceiveRequest->BufferSize = ReceiveLength; - ReceiveRequest->UserComplete = Complete; - ReceiveRequest->UserContext = Context; - ReceiveRequest->Complete = + } + else + { + ReceiveRequest->RemotePort = 0; + AddrInitIPv4(&ReceiveRequest->RemoteAddress, 0); + } + + IoMarkIrpPending(Irp); + + ReceiveRequest->ReturnInfo = ReturnInfo; + ReceiveRequest->Buffer = BufferData; + ReceiveRequest->BufferSize = ReceiveLength; + ReceiveRequest->UserComplete = Complete; + ReceiveRequest->UserContext = Context; + ReceiveRequest->Complete = (PDATAGRAM_COMPLETION_ROUTINE)DGReceiveComplete; - ReceiveRequest->Context = ReceiveRequest; - ReceiveRequest->AddressFile = AddrFile; - ReceiveRequest->Irp = Irp; - - /* Queue receive request */ - InsertTailList(&AddrFile->ReceiveQueue, &ReceiveRequest->ListEntry); - AF_SET_PENDING(AddrFile, AFF_RECEIVE); - - TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); - - TI_DbgPrint(MAX_TRACE, ("Leaving (pending %08x).\n", ReceiveRequest)); - - return STATUS_PENDING; - } - else - { - Status = STATUS_INSUFFICIENT_RESOURCES; - } + ReceiveRequest->Context = ReceiveRequest; + ReceiveRequest->AddressFile = AddrFile; + ReceiveRequest->Irp = Irp; + + /* Queue receive request */ + InsertTailList(&AddrFile->ReceiveQueue, &ReceiveRequest->ListEntry); + + TI_DbgPrint(MAX_TRACE, ("Leaving (pending %08x).\n", ReceiveRequest)); + + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); + + return STATUS_PENDING; } else { - Status = STATUS_INVALID_ADDRESS; - } - - TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); + Status = STATUS_INSUFFICIENT_RESOURCES; + } TI_DbgPrint(MAX_TRACE, ("Leaving with errors (0x%X).\n", Status)); Modified: trunk/reactos/lib/drivers/ip/transport/rawip/rawip.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/r…
============================================================================== --- trunk/reactos/lib/drivers/ip/transport/rawip/rawip.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/transport/rawip/rawip.c [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -195,6 +195,9 @@ USHORT RemotePort; NTSTATUS Status; PNEIGHBOR_CACHE_ENTRY NCE; + KIRQL OldIrql; + + KeAcquireSpinLock(&AddrFile->Lock, &OldIrql); TI_DbgPrint(MID_TRACE,("Sending Datagram(%x %x %x %d)\n", AddrFile, ConnInfo, BufferData, DataSize)); @@ -209,13 +212,17 @@ break; default: + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); return STATUS_UNSUCCESSFUL; } TI_DbgPrint(MID_TRACE,("About to get route to destination\n")); if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) + { + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); return STATUS_NETWORK_UNREACHABLE; + } LocalAddress = AddrFile->Address; if (AddrIsUnspecified(&LocalAddress)) @@ -237,17 +244,23 @@ DataSize ); if( !NT_SUCCESS(Status) ) + { + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); return Status; + } TI_DbgPrint(MID_TRACE,("About to send datagram\n")); if (!NT_SUCCESS(Status = IPSendDatagram( &Packet, NCE, RawIpSendPacketComplete, NULL ))) { + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); FreeNdisPacket(Packet.NdisPacket); return Status; } TI_DbgPrint(MID_TRACE,("Leaving\n")); + + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); return STATUS_SUCCESS; } Modified: trunk/reactos/lib/drivers/ip/transport/tcp/accept.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
============================================================================== --- trunk/reactos/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -10,6 +10,7 @@ #include "precomp.h" +/* Listener->Lock MUST be acquired */ NTSTATUS TCPServiceListeningSocket( PCONNECTION_ENDPOINT Listener, PCONNECTION_ENDPOINT Connection, PTDI_REQUEST_KERNEL Request ) { @@ -26,17 +27,14 @@ WhoIsConnecting = (PTDI_CONNECTION_INFORMATION) Request->ReturnConnectionInformation; - TcpipRecursiveMutexEnter(&TCPLock); - Status = TCPTranslateError ( OskitTCPAccept( Listener->SocketContext, &Connection->SocketContext, + Connection, &OutAddr, sizeof(OutAddr), &OutAddrLen, Request->RequestFlags & TDI_QUERY_ACCEPT ? 0 : 1 ) ); - - TcpipRecursiveMutexLeave(&TCPLock); TI_DbgPrint(DEBUG_TCP,("Status %x\n", Status)); @@ -71,10 +69,13 @@ NTSTATUS TCPListen( PCONNECTION_ENDPOINT Connection, UINT Backlog ) { NTSTATUS Status = STATUS_SUCCESS; SOCKADDR_IN AddressToBind; + KIRQL OldIrql; ASSERT(Connection); ASSERT_KM_POINTER(Connection->SocketContext); ASSERT_KM_POINTER(Connection->AddressFile); + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); TI_DbgPrint(DEBUG_TCP,("TCPListen started\n")); @@ -89,8 +90,6 @@ TI_DbgPrint(DEBUG_TCP,("AddressToBind - %x:%x\n", AddressToBind.sin_addr, AddressToBind.sin_port)); - TcpipRecursiveMutexEnter( &TCPLock ); - Status = TCPTranslateError( OskitTCPBind( Connection->SocketContext, &AddressToBind, sizeof(AddressToBind) ) ); @@ -98,7 +97,7 @@ if (NT_SUCCESS(Status)) Status = TCPTranslateError( OskitTCPListen( Connection->SocketContext, Backlog ) ); - TcpipRecursiveMutexLeave( &TCPLock ); + KeReleaseSpinLock(&Connection->Lock, OldIrql); TI_DbgPrint(DEBUG_TCP,("TCPListen finished %x\n", Status)); @@ -137,11 +136,16 @@ { NTSTATUS Status; PTDI_BUCKET Bucket; + KIRQL OldIrql; TI_DbgPrint(DEBUG_TCP,("TCPAccept started\n")); + KeAcquireSpinLock(&Listener->Lock, &OldIrql); + Status = TCPServiceListeningSocket( Listener, Connection, (PTDI_REQUEST_KERNEL)Request ); + + KeReleaseSpinLock(&Listener->Lock, OldIrql); if( Status == STATUS_PENDING ) { Bucket = exAllocatePool( NonPagedPool, sizeof(*Bucket) ); @@ -150,8 +154,8 @@ Bucket->AssociatedEndpoint = Connection; Bucket->Request.RequestNotifyObject = Complete; Bucket->Request.RequestContext = Context; - IoMarkIrpPending((PIRP)Context); - ExInterlockedInsertTailList( &Listener->ListenRequest, &Bucket->Entry, &Listener->Lock ); + ExInterlockedInsertTailList( &Listener->ListenRequest, &Bucket->Entry, + &Listener->Lock ); } else Status = STATUS_NO_MEMORY; } Modified: trunk/reactos/lib/drivers/ip/transport/tcp/event.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
============================================================================== --- trunk/reactos/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -15,56 +15,30 @@ void *WhichConnection, OSK_UINT NewState ) { PCONNECTION_ENDPOINT Connection = WhichConnection; - ULONG OldState; - KIRQL OldIrql; - - ASSERT_LOCKED(&TCPLock); - - TI_DbgPrint(MID_TRACE,("Flags: %c%c%c%c\n", + + TI_DbgPrint(DEBUG_TCP,("Connection: %x Flags: %c%c%c%c%c\n", + Connection, NewState & SEL_CONNECT ? 'C' : 'c', NewState & SEL_READ ? 'R' : 'r', NewState & SEL_FIN ? 'F' : 'f', - NewState & SEL_ACCEPT ? 'A' : 'a')); + NewState & SEL_ACCEPT ? 'A' : 'a', + NewState & SEL_WRITE ? 'W' : 'w')); + + if (!Connection) + { + return 0; + } + + KeAcquireSpinLockAtDpcLevel(&Connection->Lock); TI_DbgPrint(DEBUG_TCP,("Called: NewState %x (Conn %x) (Change %x)\n", NewState, Connection, - Connection ? Connection->SignalState ^ NewState : + Connection->SignalState ^ NewState, NewState)); - if( !Connection ) { - TI_DbgPrint(DEBUG_TCP,("Socket closing.\n")); - Connection = FileFindConnectionByContext( WhichSocket ); - if( !Connection ) - return 0; - else - TI_DbgPrint(DEBUG_TCP,("Found socket %x\n", Connection)); - } - - OldState = Connection->SignalState; - Connection->SignalState |= NewState; - TcpipRecursiveMutexLeave(&TCPLock); - - /* We must not be locked when handling signalled connections - * because a completion could trigger another IOCTL which - * would cause a deadlock - */ - NewState = HandleSignalledConnection(Connection); - - TcpipRecursiveMutexEnter(&TCPLock); - - KeAcquireSpinLock(&SignalledConnectionsLock, &OldIrql); - if ((NewState == 0 || NewState == SEL_FIN) && - (OldState != 0 && OldState != SEL_FIN)) - { - RemoveEntryList(&Connection->SignalList); - } - else if (NewState != 0 && NewState != SEL_FIN) - { - InsertTailList(&SignalledConnectionsList, &Connection->SignalList); - } - KeReleaseSpinLock(&SignalledConnectionsLock, OldIrql); + KeReleaseSpinLockFromDpcLevel(&Connection->Lock); return 0; } @@ -85,8 +59,6 @@ IP_PACKET Packet = { 0 }; IP_ADDRESS RemoteAddress, LocalAddress; PIPv4_HEADER Header; - - ASSERT_LOCKED(&TCPLock); if( *data == 0x45 ) { /* IPv4 */ Header = (PIPv4_HEADER)data; @@ -180,8 +152,6 @@ OSK_UINT Bytes, OSK_PCHAR File, OSK_UINT Line ) { void *v; ULONG Signature; - - ASSERT_LOCKED(&TCPLock); #if 0 != MEM_PROFILE static OSK_UINT *Sizes = NULL, *Counts = NULL, ArrayAllocated = 0; @@ -258,8 +228,6 @@ void *data, OSK_PCHAR File, OSK_UINT Line ) { ULONG Signature; - ASSERT_LOCKED(&TCPLock); - UntrackFL( (PCHAR)File, Line, data, FOURCC('f','b','s','d') ); data = (void *)((char *) data - sizeof(ULONG)); Signature = *((ULONG *) data); Modified: trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
============================================================================== --- trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -15,12 +15,12 @@ LONG TCP_IPIdentification = 0; static BOOLEAN TCPInitialized = FALSE; static NPAGED_LOOKASIDE_LIST TCPSegmentList; -LIST_ENTRY SignalledConnectionsList; -KSPIN_LOCK SignalledConnectionsLock; -RECURSIVE_MUTEX TCPLock; PORT_SET TCPPorts; -ULONG HandleSignalledConnection( PCONNECTION_ENDPOINT Connection ) { +static VOID DrainSignals() { + PCONNECTION_ENDPOINT Connection; + PLIST_ENTRY CurrentEntry, NextEntry; + KIRQL OldIrql; NTSTATUS Status = STATUS_SUCCESS; PTCP_COMPLETION_ROUTINE Complete; PTDI_BUCKET Bucket; @@ -28,279 +28,290 @@ PIRP Irp; PMDL Mdl; - TI_DbgPrint(MID_TRACE,("Handling signalled state on %x (%x)\n", - Connection, Connection->SocketContext)); - - if( Connection->SignalState & SEL_FIN ) { - TI_DbgPrint(DEBUG_TCP, ("EOF From socket\n")); - - Connection->SignalState &= ~SEL_READ; - while ((Entry = ExInterlockedRemoveHeadList( &Connection->ReceiveRequest, - &Connection->Lock )) != NULL) - { - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - Complete = Bucket->Request.RequestNotifyObject; - - Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 ); - - exFreePool(Bucket); - } - - Connection->SignalState &= ~SEL_WRITE; - while ((Entry = ExInterlockedRemoveHeadList( &Connection->SendRequest, - &Connection->Lock )) != NULL) - { - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - Complete = Bucket->Request.RequestNotifyObject; - - Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 ); - - exFreePool(Bucket); - } - - Connection->SignalState &= ~SEL_ACCEPT; - while ((Entry = ExInterlockedRemoveHeadList( &Connection->ListenRequest, - &Connection->Lock )) != NULL) - { - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - Complete = Bucket->Request.RequestNotifyObject; - - /* We have to notify oskittcp of the abortion */ - TCPAbortListenForSocket(Connection->AddressFile->Listener, - Connection); - - Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 ); - - exFreePool(Bucket); - } - - Connection->SignalState &= ~SEL_CONNECT; - while ((Entry = ExInterlockedRemoveHeadList( &Connection->ConnectRequest, - &Connection->Lock )) != NULL) - { - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - Complete = Bucket->Request.RequestNotifyObject; - - Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 ); - - exFreePool(Bucket); - } - } - - /* Things that can happen when we try the initial connection */ - if( Connection->SignalState & SEL_CONNECT ) { - Connection->SignalState &= ~SEL_CONNECT; - while( (Entry = ExInterlockedRemoveHeadList( &Connection->ConnectRequest, - &Connection->Lock )) != NULL ) { + KeAcquireSpinLock(&ConnectionEndpointListLock, &OldIrql); + CurrentEntry = ConnectionEndpointListHead.Flink; + while (CurrentEntry != &ConnectionEndpointListHead) + { + NextEntry = CurrentEntry->Flink; + KeReleaseSpinLock(&ConnectionEndpointListLock, OldIrql); + + Connection = CONTAINING_RECORD( CurrentEntry, CONNECTION_ENDPOINT, + ListEntry ); + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); + + TI_DbgPrint(MID_TRACE,("Handling signalled state on %x (%x)\n", + Connection, Connection->SocketContext)); + + if( !Connection->SocketContext || Connection->SignalState & SEL_FIN ) { + KeReleaseSpinLock(&Connection->Lock, OldIrql); + TI_DbgPrint(DEBUG_TCP, ("EOF From socket\n")); + + while ((Entry = ExInterlockedRemoveHeadList( &Connection->ReceiveRequest, + &Connection->Lock )) != NULL) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + Complete = Bucket->Request.RequestNotifyObject; + + Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 ); + + exFreePool(Bucket); + } + + while ((Entry = ExInterlockedRemoveHeadList( &Connection->SendRequest, + &Connection->Lock )) != NULL) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + Complete = Bucket->Request.RequestNotifyObject; + + Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 ); + + exFreePool(Bucket); + } + + while ((Entry = ExInterlockedRemoveHeadList( &Connection->ListenRequest, + &Connection->Lock )) != NULL) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + Complete = Bucket->Request.RequestNotifyObject; + + Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 ); + + exFreePool(Bucket); + } + + while ((Entry = ExInterlockedRemoveHeadList( &Connection->ConnectRequest, + &Connection->Lock )) != NULL) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + Complete = Bucket->Request.RequestNotifyObject; + + Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 ); + + exFreePool(Bucket); + } + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); + } + + /* Things that can happen when we try the initial connection */ + if( Connection->SignalState & SEL_CONNECT ) { + KeReleaseSpinLock(&Connection->Lock, OldIrql); + while( (Entry = ExInterlockedRemoveHeadList( &Connection->ConnectRequest, + &Connection->Lock )) != NULL ) { - TI_DbgPrint(DEBUG_TCP, ("Connect Event\n")); - - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - Complete = Bucket->Request.RequestNotifyObject; - TI_DbgPrint(DEBUG_TCP, - ("Completing Request %x\n", Bucket->Request.RequestContext)); - - Complete( Bucket->Request.RequestContext, STATUS_SUCCESS, 0 ); - - /* Frees the bucket allocated in TCPConnect */ - exFreePool( Bucket ); - } - } - - if( Connection->SignalState & SEL_ACCEPT ) { - /* Handle readable on a listening socket -- - * TODO: Implement filtering - */ - - TI_DbgPrint(DEBUG_TCP,("Accepting new connection on %x (Queue: %s)\n", - Connection, - IsListEmpty(&Connection->ListenRequest) ? - "empty" : "nonempty")); - - Connection->SignalState &= ~SEL_ACCEPT; - while( (Entry = ExInterlockedRemoveHeadList( &Connection->ListenRequest, - &Connection->Lock )) != NULL ) { - PIO_STACK_LOCATION IrpSp; - - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - Complete = Bucket->Request.RequestNotifyObject; - - Irp = Bucket->Request.RequestContext; - IrpSp = IoGetCurrentIrpStackLocation( Irp ); - - TI_DbgPrint(DEBUG_TCP,("Getting the socket\n")); - Status = TCPServiceListeningSocket - ( Connection->AddressFile->Listener, - Bucket->AssociatedEndpoint, - (PTDI_REQUEST_KERNEL)&IrpSp->Parameters ); - - TI_DbgPrint(DEBUG_TCP,("Socket: Status: %x\n")); - - if( Status == STATUS_PENDING ) { - Connection->SignalState |= SEL_ACCEPT; - ExInterlockedInsertHeadList( &Connection->ListenRequest, &Bucket->Entry, &Connection->Lock ); - break; - } else { - Complete( Bucket->Request.RequestContext, Status, 0 ); - exFreePool( Bucket ); - } - } - } - - /* Things that happen after we're connected */ - if( Connection->SignalState & SEL_READ ) { - TI_DbgPrint(DEBUG_TCP,("Readable: irp list %s\n", - IsListEmpty(&Connection->ReceiveRequest) ? - "empty" : "nonempty")); - - Connection->SignalState &= ~SEL_READ; - while( (Entry = ExInterlockedRemoveHeadList( &Connection->ReceiveRequest, - &Connection->Lock )) != NULL ) { - OSK_UINT RecvLen = 0, Received = 0; - PVOID RecvBuffer = 0; - - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - Complete = Bucket->Request.RequestNotifyObject; - - Irp = Bucket->Request.RequestContext; - Mdl = Irp->MdlAddress; - - TI_DbgPrint(DEBUG_TCP, - ("Getting the user buffer from %x\n", Mdl)); - - NdisQueryBuffer( Mdl, &RecvBuffer, &RecvLen ); - - TI_DbgPrint(DEBUG_TCP, - ("Reading %d bytes to %x\n", RecvLen, RecvBuffer)); - - TI_DbgPrint(DEBUG_TCP, ("Connection: %x\n", Connection)); - TI_DbgPrint + TI_DbgPrint(DEBUG_TCP, ("Connect Event\n")); + + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + Complete = Bucket->Request.RequestNotifyObject; + TI_DbgPrint(DEBUG_TCP, + ("Completing Request %x\n", Bucket->Request.RequestContext)); + + Complete( Bucket->Request.RequestContext, STATUS_SUCCESS, 0 ); + + /* Frees the bucket allocated in TCPConnect */ + exFreePool( Bucket ); + } + KeAcquireSpinLock(&Connection->Lock, &OldIrql); + } + + if( Connection->SignalState & SEL_ACCEPT ) { + /* Handle readable on a listening socket -- + * TODO: Implement filtering + */ + + KeReleaseSpinLock(&Connection->Lock, OldIrql); + + TI_DbgPrint(DEBUG_TCP,("Accepting new connection on %x (Queue: %s)\n", + Connection, + IsListEmpty(&Connection->ListenRequest) ? + "empty" : "nonempty")); + + while( (Entry = ExInterlockedRemoveHeadList( &Connection->ListenRequest, + &Connection->Lock )) != NULL ) { + PIO_STACK_LOCATION IrpSp; + + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + Complete = Bucket->Request.RequestNotifyObject; + + Irp = Bucket->Request.RequestContext; + IrpSp = IoGetCurrentIrpStackLocation( Irp ); + + TI_DbgPrint(DEBUG_TCP,("Getting the socket\n")); + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); + + Status = TCPServiceListeningSocket + ( Connection->AddressFile->Listener, + Bucket->AssociatedEndpoint, + (PTDI_REQUEST_KERNEL)&IrpSp->Parameters ); + + KeReleaseSpinLock(&Connection->Lock, OldIrql); + + TI_DbgPrint(DEBUG_TCP,("Socket: Status: %x\n")); + + if( Status == STATUS_PENDING ) { + ExInterlockedInsertHeadList( &Connection->ListenRequest, &Bucket->Entry, + &Connection->Lock ); + break; + } else { + Complete( Bucket->Request.RequestContext, Status, 0 ); + exFreePool( Bucket ); + } + } + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); + } + + /* Things that happen after we're connected */ + if( Connection->SignalState & SEL_READ && + Connection->SignalState & SEL_CONNECT ) { + TI_DbgPrint(DEBUG_TCP,("Readable: irp list %s\n", + IsListEmpty(&Connection->ReceiveRequest) ? + "empty" : "nonempty")); + + KeReleaseSpinLock(&Connection->Lock, OldIrql); + + while( (Entry = ExInterlockedRemoveHeadList( &Connection->ReceiveRequest, + &Connection->Lock )) != NULL ) { + OSK_UINT RecvLen = 0, Received = 0; + PVOID RecvBuffer = 0; + + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + Complete = Bucket->Request.RequestNotifyObject; + + Irp = Bucket->Request.RequestContext; + Mdl = Irp->MdlAddress; + + TI_DbgPrint(DEBUG_TCP, + ("Getting the user buffer from %x\n", Mdl)); + + NdisQueryBuffer( Mdl, &RecvBuffer, &RecvLen ); + + TI_DbgPrint(DEBUG_TCP, + ("Reading %d bytes to %x\n", RecvLen, RecvBuffer)); + + TI_DbgPrint(DEBUG_TCP, ("Connection: %x\n", Connection)); + TI_DbgPrint + (DEBUG_TCP, + ("Connection->SocketContext: %x\n", + Connection->SocketContext)); + TI_DbgPrint(DEBUG_TCP, ("RecvBuffer: %x\n", RecvBuffer)); + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); + + Status = TCPTranslateError + ( OskitTCPRecv( Connection->SocketContext, + RecvBuffer, + RecvLen, + &Received, + 0 ) ); + + KeReleaseSpinLock(&Connection->Lock, OldIrql); + + TI_DbgPrint(DEBUG_TCP,("TCP Bytes: %d\n", Received)); + + if( Status == STATUS_SUCCESS ) { + TI_DbgPrint(DEBUG_TCP,("Received %d bytes with status %x\n", + Received, Status)); + Complete( Bucket->Request.RequestContext, + STATUS_SUCCESS, Received ); + exFreePool( Bucket ); + } else if( Status == STATUS_PENDING ) { + ExInterlockedInsertHeadList( &Connection->ReceiveRequest, &Bucket->Entry, + &Connection->Lock ); + break; + } else { + TI_DbgPrint(DEBUG_TCP, + ("Completing Receive request: %x %x\n", + Bucket->Request, Status)); + Complete( Bucket->Request.RequestContext, Status, 0 ); + exFreePool( Bucket ); + } + } + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); + } + if( Connection->SignalState & SEL_WRITE && + Connection->SignalState & SEL_CONNECT ) { + TI_DbgPrint(DEBUG_TCP,("Writeable: irp list %s\n", + IsListEmpty(&Connection->SendRequest) ? + "empty" : "nonempty")); + + KeReleaseSpinLock(&Connection->Lock, OldIrql); + + while( (Entry = ExInterlockedRemoveHeadList( &Connection->SendRequest, + &Connection->Lock )) != NULL ) { + OSK_UINT SendLen = 0, Sent = 0; + PVOID SendBuffer = 0; + + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + Complete = Bucket->Request.RequestNotifyObject; + + Irp = Bucket->Request.RequestContext; + Mdl = Irp->MdlAddress; + + TI_DbgPrint(DEBUG_TCP, + ("Getting the user buffer from %x\n", Mdl)); + + NdisQueryBuffer( Mdl, &SendBuffer, &SendLen ); + + TI_DbgPrint(DEBUG_TCP, + ("Writing %d bytes to %x\n", SendLen, SendBuffer)); + + TI_DbgPrint(DEBUG_TCP, ("Connection: %x\n", Connection)); + TI_DbgPrint (DEBUG_TCP, ("Connection->SocketContext: %x\n", Connection->SocketContext)); - TI_DbgPrint(DEBUG_TCP, ("RecvBuffer: %x\n", RecvBuffer)); - - Status = TCPTranslateError - ( OskitTCPRecv( Connection->SocketContext, - RecvBuffer, - RecvLen, - &Received, - 0 ) ); - - TI_DbgPrint(DEBUG_TCP,("TCP Bytes: %d\n", Received)); - - if( Status == STATUS_SUCCESS ) { - TI_DbgPrint(DEBUG_TCP,("Received %d bytes with status %x\n", - Received, Status)); - - Complete( Bucket->Request.RequestContext, - STATUS_SUCCESS, Received ); - exFreePool( Bucket ); - } else if( Status == STATUS_PENDING ) { - ExInterlockedInsertHeadList - ( &Connection->ReceiveRequest, &Bucket->Entry, &Connection->Lock ); - Connection->SignalState |= SEL_READ; - break; - } else { - TI_DbgPrint(DEBUG_TCP, - ("Completing Receive request: %x %x\n", - Bucket->Request, Status)); - Complete( Bucket->Request.RequestContext, Status, 0 ); - exFreePool( Bucket ); - } - } - } - if( Connection->SignalState & SEL_WRITE ) { - TI_DbgPrint(DEBUG_TCP,("Writeable: irp list %s\n", - IsListEmpty(&Connection->SendRequest) ? - "empty" : "nonempty")); - - Connection->SignalState &= ~SEL_WRITE; - while( (Entry = ExInterlockedRemoveHeadList( &Connection->SendRequest, - &Connection->Lock )) != NULL ) { - OSK_UINT SendLen = 0, Sent = 0; - PVOID SendBuffer = 0; - - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - Complete = Bucket->Request.RequestNotifyObject; - - Irp = Bucket->Request.RequestContext; - Mdl = Irp->MdlAddress; - - TI_DbgPrint(DEBUG_TCP, - ("Getting the user buffer from %x\n", Mdl)); - - NdisQueryBuffer( Mdl, &SendBuffer, &SendLen ); - - TI_DbgPrint(DEBUG_TCP, - ("Writing %d bytes to %x\n", SendLen, SendBuffer)); - - TI_DbgPrint(DEBUG_TCP, ("Connection: %x\n", Connection)); - TI_DbgPrint - (DEBUG_TCP, - ("Connection->SocketContext: %x\n", - Connection->SocketContext)); - - Status = TCPTranslateError - ( OskitTCPSend( Connection->SocketContext, - SendBuffer, - SendLen, - &Sent, - 0 ) ); - - TI_DbgPrint(DEBUG_TCP,("TCP Bytes: %d\n", Sent)); - - if( Status == STATUS_SUCCESS ) { - TI_DbgPrint(DEBUG_TCP,("Sent %d bytes with status %x\n", + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); + + Status = TCPTranslateError + ( OskitTCPSend( Connection->SocketContext, + SendBuffer, + SendLen, + &Sent, + 0 ) ); + + KeReleaseSpinLock(&Connection->Lock, OldIrql); + + TI_DbgPrint(DEBUG_TCP,("TCP Bytes: %d\n", Sent)); + + if( Status == STATUS_SUCCESS ) { + TI_DbgPrint(DEBUG_TCP,("Sent %d bytes with status %x\n", Sent, Status)); - - Complete( Bucket->Request.RequestContext, - STATUS_SUCCESS, Sent ); - exFreePool( Bucket ); - } else if( Status == STATUS_PENDING ) { - ExInterlockedInsertHeadList - ( &Connection->SendRequest, &Bucket->Entry, &Connection->Lock ); - Connection->SignalState |= SEL_WRITE; - break; - } else { - TI_DbgPrint(DEBUG_TCP, - ("Completing Send request: %x %x\n", - Bucket->Request, Status)); - Complete( Bucket->Request.RequestContext, Status, 0 ); - exFreePool( Bucket ); - } - } - } - - return Connection->SignalState; -} - -static VOID DrainSignals() { - PCONNECTION_ENDPOINT Connection; - PLIST_ENTRY CurrentEntry, NextEntry; - ULONG NewState; - KIRQL OldIrql; - - KeAcquireSpinLock(&SignalledConnectionsLock, &OldIrql); - CurrentEntry = SignalledConnectionsList.Flink; - while (CurrentEntry != &SignalledConnectionsList) - { - NextEntry = CurrentEntry->Flink; - Connection = CONTAINING_RECORD( CurrentEntry, CONNECTION_ENDPOINT, - SignalList ); - - KeReleaseSpinLock(&SignalledConnectionsLock, OldIrql); - NewState = HandleSignalledConnection(Connection); - KeAcquireSpinLock(&SignalledConnectionsLock, &OldIrql); - - if (NewState == SEL_FIN || NewState == 0) - { - RemoveEntryList(CurrentEntry); - } - - CurrentEntry = NextEntry; - } - KeReleaseSpinLock(&SignalledConnectionsLock, OldIrql); + Complete( Bucket->Request.RequestContext, + STATUS_SUCCESS, Sent ); + exFreePool( Bucket ); + } else if( Status == STATUS_PENDING ) { + ExInterlockedInsertHeadList( &Connection->SendRequest, &Bucket->Entry, + &Connection->Lock ); + break; + } else { + TI_DbgPrint(DEBUG_TCP, + ("Completing Send request: %x %x\n", + Bucket->Request, Status)); + Complete( Bucket->Request.RequestContext, Status, 0 ); + exFreePool( Bucket ); + } + } + KeAcquireSpinLock(&Connection->Lock, &OldIrql); + } + + KeReleaseSpinLock(&Connection->Lock, OldIrql); + + if (!Connection->SocketContext) + { + TCPFreeConnectionEndpoint(Connection); + } + + CurrentEntry = NextEntry; + + KeAcquireSpinLock(&ConnectionEndpointListLock, &OldIrql); + } + + KeReleaseSpinLock(&ConnectionEndpointListLock, OldIrql); } PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext ) { @@ -314,7 +325,7 @@ RtlZeroMemory(Connection, sizeof(CONNECTION_ENDPOINT)); /* Initialize spin lock that protects the connection endpoint file object */ - TcpipInitializeSpinLock(&Connection->Lock); + KeInitializeSpinLock(&Connection->Lock); InitializeListHead(&Connection->ConnectRequest); InitializeListHead(&Connection->ListenRequest); InitializeListHead(&Connection->ReceiveRequest); @@ -323,19 +334,32 @@ /* Save client context pointer */ Connection->ClientContext = ClientContext; + /* Add connection endpoint to global list */ + ExInterlockedInsertTailList(&ConnectionEndpointListHead, + &Connection->ListEntry, + &ConnectionEndpointListLock); + return Connection; } VOID TCPFreeConnectionEndpoint( PCONNECTION_ENDPOINT Connection ) { + KIRQL OldIrql; + TI_DbgPrint(DEBUG_TCP, ("Freeing TCP Endpoint\n")); + + TcpipAcquireSpinLock(&ConnectionEndpointListLock, &OldIrql); + RemoveEntryList(&Connection->ListEntry); + TcpipReleaseSpinLock(&ConnectionEndpointListLock, OldIrql); + exFreePool( Connection ); } NTSTATUS TCPSocket( PCONNECTION_ENDPOINT Connection, UINT Family, UINT Type, UINT Proto ) { NTSTATUS Status; - - TcpipRecursiveMutexEnter(&TCPLock); + KIRQL OldIrql; + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); TI_DbgPrint(DEBUG_TCP,("Called: Connection %x, Family %d, Type %d, " "Proto %d\n", @@ -352,7 +376,7 @@ TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext %x\n", Connection->SocketContext)); - TcpipRecursiveMutexLeave(&TCPLock); + KeReleaseSpinLock(&Connection->Lock, OldIrql); return Status; } @@ -370,13 +394,9 @@ IPPacket->TotalSize, IPPacket->HeaderSize)); - TcpipRecursiveMutexEnter( &TCPLock ); - OskitTCPReceiveDatagram( IPPacket->Header, IPPacket->TotalSize, IPPacket->HeaderSize ); - - TcpipRecursiveMutexLeave( &TCPLock ); } /* event.c */ @@ -447,10 +467,7 @@ PsTerminateSystemThread(Status); } - TcpipRecursiveMutexEnter( &TCPLock ); TimerOskitTCP( Next == NextFast, Next == NextSlow ); - TcpipRecursiveMutexLeave( &TCPLock ); - if (Next == NextSlow) { DrainSignals(); } @@ -483,9 +500,6 @@ { NTSTATUS Status; - TcpipRecursiveMutexInit( &TCPLock ); - KeInitializeSpinLock( &SignalledConnectionsLock ); - InitializeListHead( &SignalledConnectionsList ); Status = TCPMemStartup(); if ( ! NT_SUCCESS(Status) ) { return Status; @@ -497,10 +511,8 @@ return Status; } - TcpipRecursiveMutexEnter(&TCPLock); RegisterOskitTCPEventHandlers( &EventHandlers ); InitOskitTCP(); - TcpipRecursiveMutexLeave(&TCPLock); /* Register this protocol with IP layer */ IPRegisterProtocol(IPPROTO_TCP, TCPReceive); @@ -545,9 +557,7 @@ TCPInitialized = FALSE; - TcpipRecursiveMutexEnter(&TCPLock); DeinitOskitTCP(); - TcpipRecursiveMutexLeave(&TCPLock); PortsShutdown( &TCPPorts ); @@ -597,6 +607,7 @@ USHORT RemotePort; PTDI_BUCKET Bucket; PNEIGHBOR_CACHE_ENTRY NCE; + KIRQL OldIrql; TI_DbgPrint(DEBUG_TCP,("TCPConnect: Called\n")); @@ -625,7 +636,7 @@ AddressToBind = AddressToConnect; AddressToBind.sin_addr.s_addr = NCE->Interface->Unicast.Address.IPv4Address; - TcpipRecursiveMutexEnter(&TCPLock); + KeAcquireSpinLock(&Connection->Lock, &OldIrql); Status = TCPTranslateError ( OskitTCPBind( Connection->SocketContext, @@ -640,25 +651,28 @@ Status = TCPTranslateError ( OskitTCPConnect( Connection->SocketContext, - Connection, &AddressToConnect, sizeof(AddressToConnect) ) ); + + KeReleaseSpinLock(&Connection->Lock, OldIrql); if (Status == STATUS_PENDING) { Bucket = exAllocatePool( NonPagedPool, sizeof(*Bucket) ); - if( !Bucket ) return STATUS_NO_MEMORY; + if( !Bucket ) + { + return STATUS_NO_MEMORY; + } Bucket->Request.RequestNotifyObject = (PVOID)Complete; Bucket->Request.RequestContext = Context; - - IoMarkIrpPending((PIRP)Context); - ExInterlockedInsertTailList( &Connection->ConnectRequest, &Bucket->Entry, &Connection->Lock ); - } - } - - TcpipRecursiveMutexLeave(&TCPLock); + ExInterlockedInsertTailList( &Connection->ConnectRequest, &Bucket->Entry, + &Connection->Lock ); + } + } else { + KeReleaseSpinLock(&Connection->Lock, OldIrql); + } return Status; } @@ -671,12 +685,11 @@ PTCP_COMPLETION_ROUTINE Complete, PVOID Context ) { NTSTATUS Status = STATUS_INVALID_PARAMETER; - - ASSERT_LOCKED(&TCPLock); + KIRQL OldIrql; TI_DbgPrint(DEBUG_TCP,("started\n")); - TcpipRecursiveMutexEnter(&TCPLock); + KeAcquireSpinLock(&Connection->Lock, &OldIrql); if (Flags & TDI_DISCONNECT_RELEASE) Status = TCPTranslateError(OskitTCPDisconnect(Connection->SocketContext)); @@ -684,7 +697,7 @@ if ((Flags & TDI_DISCONNECT_ABORT) || !Flags) Status = TCPTranslateError(OskitTCPShutdown(Connection->SocketContext, FWRITE | FREAD)); - TcpipRecursiveMutexLeave(&TCPLock); + KeReleaseSpinLock(&Connection->Lock, OldIrql); TI_DbgPrint(DEBUG_TCP,("finished %x\n", Status)); @@ -694,20 +707,20 @@ NTSTATUS TCPClose ( PCONNECTION_ENDPOINT Connection ) { NTSTATUS Status; + KIRQL OldIrql; + PVOID Socket; TI_DbgPrint(DEBUG_TCP,("TCPClose started\n")); - /* Make our code remove all pending IRPs */ - Connection->SignalState |= SEL_FIN; - HandleSignalledConnection(Connection); - - TcpipRecursiveMutexEnter(&TCPLock); - - Status = TCPTranslateError( OskitTCPClose( Connection->SocketContext ) ); - if (Status == STATUS_SUCCESS) - Connection->SocketContext = NULL; - - TcpipRecursiveMutexLeave(&TCPLock); + KeAcquireSpinLock(&Connection->Lock, &OldIrql); + Socket = Connection->SocketContext; + Connection->SocketContext = NULL; + Status = TCPTranslateError( OskitTCPClose( Socket ) ); + if (!NT_SUCCESS(Status)) + { + Connection->SocketContext = Socket; + } + KeReleaseSpinLock(&Connection->Lock, OldIrql); TI_DbgPrint(DEBUG_TCP,("TCPClose finished %x\n", Status)); @@ -726,17 +739,18 @@ UINT DataLen, Received = 0; NTSTATUS Status; PTDI_BUCKET Bucket; + KIRQL OldIrql; TI_DbgPrint(DEBUG_TCP,("Called for %d bytes (on socket %x)\n", ReceiveLength, Connection->SocketContext)); + NdisQueryBuffer( Buffer, &DataBuffer, &DataLen ); + + TI_DbgPrint(DEBUG_TCP,("TCP>|< Got an MDL %x (%x:%d)\n", Buffer, DataBuffer, DataLen)); + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); + ASSERT_KM_POINTER(Connection->SocketContext); - - NdisQueryBuffer( Buffer, &DataBuffer, &DataLen ); - - TI_DbgPrint(DEBUG_TCP,("TCP>|< Got an MDL %x (%x:%d)\n", Buffer, DataBuffer, DataLen)); - - TcpipRecursiveMutexEnter(&TCPLock); Status = TCPTranslateError ( OskitTCPRecv @@ -746,7 +760,7 @@ &Received, ReceiveFlags ) ); - TcpipRecursiveMutexLeave(&TCPLock); + KeReleaseSpinLock(&Connection->Lock, OldIrql); TI_DbgPrint(DEBUG_TCP,("OskitTCPReceive: %x, %d\n", Status, Received)); @@ -763,9 +777,8 @@ Bucket->Request.RequestContext = Context; *BytesReceived = 0; - IoMarkIrpPending((PIRP)Context); - - ExInterlockedInsertTailList( &Connection->ReceiveRequest, &Bucket->Entry, &Connection->Lock ); + ExInterlockedInsertTailList( &Connection->ReceiveRequest, &Bucket->Entry, + &Connection->Lock ); TI_DbgPrint(DEBUG_TCP,("Queued read irp\n")); } else { TI_DbgPrint(DEBUG_TCP,("Got status %x, bytes %d\n", Status, Received)); @@ -788,8 +801,9 @@ UINT Sent = 0; NTSTATUS Status; PTDI_BUCKET Bucket; - - ASSERT_LOCKED(&TCPLock); + KIRQL OldIrql; + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); TI_DbgPrint(DEBUG_TCP,("Called for %d bytes (on socket %x)\n", SendLength, Connection->SocketContext)); @@ -799,15 +813,13 @@ TI_DbgPrint(DEBUG_TCP,("Connection = %x\n", Connection)); TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext = %x\n", Connection->SocketContext)); - - TcpipRecursiveMutexEnter(&TCPLock); Status = TCPTranslateError ( OskitTCPSend( Connection->SocketContext, (OSK_PCHAR)BufferData, SendLength, &Sent, 0 ) ); - TcpipRecursiveMutexLeave(&TCPLock); + KeReleaseSpinLock(&Connection->Lock, OldIrql); TI_DbgPrint(DEBUG_TCP,("OskitTCPSend: %x, %d\n", Status, Sent)); @@ -823,10 +835,9 @@ Bucket->Request.RequestNotifyObject = Complete; Bucket->Request.RequestContext = Context; *BytesSent = 0; - - IoMarkIrpPending((PIRP)Context); - ExInterlockedInsertTailList( &Connection->SendRequest, &Bucket->Entry, &Connection->Lock ); + ExInterlockedInsertTailList( &Connection->SendRequest, &Bucket->Entry, + &Connection->Lock ); TI_DbgPrint(DEBUG_TCP,("Queued write irp\n")); } else { TI_DbgPrint(DEBUG_TCP,("Got status %x, bytes %d\n", Status, Sent)); @@ -865,14 +876,15 @@ OSK_UI16 LocalPort, RemotePort; PTA_IP_ADDRESS AddressIP = (PTA_IP_ADDRESS)Address; NTSTATUS Status; - - TcpipRecursiveMutexEnter(&TCPLock); + KIRQL OldIrql; + + KeAcquireSpinLock(&Connection->Lock, &OldIrql); Status = TCPTranslateError(OskitTCPGetAddress(Connection->SocketContext, &LocalAddress, &LocalPort, &RemoteAddress, &RemotePort)); - TcpipRecursiveMutexLeave(&TCPLock); + KeReleaseSpinLock(&Connection->Lock, OldIrql); if (!NT_SUCCESS(Status)) return Status; Modified: trunk/reactos/lib/drivers/ip/transport/udp/udp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/u…
============================================================================== --- trunk/reactos/lib/drivers/ip/transport/udp/udp.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/transport/udp/udp.c [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -172,6 +172,9 @@ USHORT RemotePort; NTSTATUS Status; PNEIGHBOR_CACHE_ENTRY NCE; + KIRQL OldIrql; + + KeAcquireSpinLock(&AddrFile->Lock, &OldIrql); TI_DbgPrint(MID_TRACE,("Sending Datagram(%x %x %x %d)\n", AddrFile, ConnInfo, BufferData, DataSize)); @@ -186,10 +189,12 @@ break; default: + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); return STATUS_UNSUCCESSFUL; } if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) { + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); return STATUS_NETWORK_UNREACHABLE; } @@ -213,13 +218,19 @@ DataSize ); if( !NT_SUCCESS(Status) ) + { + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); return Status; + } if (!NT_SUCCESS(Status = IPSendDatagram( &Packet, NCE, UDPSendPacketComplete, NULL ))) { + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); FreeNdisPacket(Packet.NdisPacket); return Status; } + + KeReleaseSpinLock(&AddrFile->Lock, OldIrql); return STATUS_SUCCESS; } Modified: trunk/reactos/lib/drivers/oskittcp/include/oskittcp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/oskittcp/inclu…
============================================================================== --- trunk/reactos/lib/drivers/oskittcp/include/oskittcp.h [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/oskittcp/include/oskittcp.h [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -123,7 +123,7 @@ OSK_UINT *OutLen, OSK_UINT Flags ); -extern int OskitTCPConnect( void *socket, void *connection, +extern int OskitTCPConnect( void *socket, void *nam, OSK_UINT namelen ); extern int OskitTCPClose( void *socket ); @@ -131,7 +131,7 @@ void *nam, OSK_UINT namelen ); extern int OskitTCPAccept( void *socket, void **new_socket, - void *addr_out, + void *context, void *addr_out, OSK_UINT addr_len, OSK_UINT *out_addr_len, OSK_UINT finish_accept ); @@ -187,4 +187,27 @@ #define FREAD 0x0001 #define FWRITE 0x0002 +/* Don't define this unless your are insane or aicom */ +//#define LOCK_SPAM + +#ifdef LOCK_SPAM +#define OSKLock() if (!KeTryToAcquireSpinLockAtDpcLevel(&OSKLock)) \ + { \ + DbgPrint("OSKLock WAIT (%s)\n", __FUNCTION__); \ + KeAcquireSpinLockAtDpcLevel(&OSKLock); \ + } \ + DbgPrint("OSKLock >>>> (%s)\n", __FUNCTION__) + +#define OSKUnlock() KeReleaseSpinLockFromDpcLevel(&OSKLock); \ + DbgPrint("OSKLock <<<< (%s)\n", __FUNCTION__) +#else +#define OSKLock() KeAcquireSpinLockAtDpcLevel(&OSKLock) +#define OSKUnlock() KeReleaseSpinLockFromDpcLevel(&OSKLock) +#endif + +#define OSKLockAndRaise(x) KeRaiseIrql(DISPATCH_LEVEL, x); \ + OSKLock() +#define OSKUnlockAndLower(x) OSKUnlock(); \ + KeLowerIrql(x) + #endif/*OSKITTCP_H*/ Modified: trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/oskittcp/oskit…
============================================================================== --- trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c [iso-8859-1] Sat Nov 14 19:38:02 2009 @@ -23,6 +23,8 @@ //OSK_UINT OskitDebugTraceLevel = OSK_DEBUG_ULTRA; OSK_UINT OskitDebugTraceLevel = 0; +KSPIN_LOCK OSKLock; + /* SPL */ unsigned cpl; unsigned net_imask; @@ -45,6 +47,7 @@ void InitOskitTCP() { OS_DbgPrint(OSK_MID_TRACE,("Init Called\n")); + KeInitializeSpinLock(&OSKLock); OS_DbgPrint(OSK_MID_TRACE,("MB Init\n")); mbinit(); OS_DbgPrint(OSK_MID_TRACE,("Rawip Init\n")); @@ -66,12 +69,19 @@ } void TimerOskitTCP( int FastTimer, int SlowTimer ) { + KIRQL OldIrql; + + /* This function is a special case in which we cannot use OSKLock/OSKUnlock + * because we don't enter with the connection lock held */ + + OSKLockAndRaise(&OldIrql); if ( SlowTimer ) { tcp_slowtimo(); } if ( FastTimer ) { tcp_fasttimo(); } + OSKUnlockAndLower(OldIrql); } void RegisterOskitTCPEventHandlers( POSKITTCP_EVENT_HANDLERS EventHandlers ) { @@ -115,12 +125,16 @@ int proto ) { struct socket *so; + + OSKLock(); int error = socreate(domain, &so, type, proto); if( !error ) { so->so_connection = context; so->so_state |= SS_NBIO; *aso = so; } + OSKUnlock(); + return error; } @@ -153,8 +167,11 @@ OS_DbgPrint(OSK_MID_TRACE,("Reading %d bytes from TCP:\n", Len)); + OSKLock(); error = soreceive( connection, NULL, &uio, NULL, NULL /* SCM_RIGHTS */, &tcp_flags ); + OSKUnlock(); + *OutLen = Len - uio.uio_resid; return error; @@ -182,14 +199,15 @@ addr.sa_family = addr.sa_len; addr.sa_len = sizeof(struct sockaddr); + OSKLock(); error = sobind(so, &sabuf); + OSKUnlock(); OS_DbgPrint(OSK_MID_TRACE,("Ending: %08x\n", error)); return (error); } -int OskitTCPConnect( void *socket, void *connection, - void *nam, OSK_UINT namelen ) { +int OskitTCPConnect( void *socket, void *nam, OSK_UINT namelen ) { struct socket *so = socket; int error = EFAULT; struct mbuf sabuf; @@ -197,8 +215,7 @@ OS_DbgPrint(OSK_MID_TRACE,("Called, socket = %08x\n", socket)); - so->so_connection = connection; - + OSKLock(); if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) { error = EALREADY; goto done; @@ -217,7 +234,9 @@ error = soconnect(so, &sabuf); - if (error) + if (error == EINPROGRESS) + goto done; + else if (error) goto bad; if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) { @@ -232,34 +251,49 @@ error = EINTR; done: + OSKUnlock(); OS_DbgPrint(OSK_MID_TRACE,("Ending: %08x\n", error)); return (error); } int OskitTCPDisconnect(void *socket) { - if (!socket) - return OSK_ESHUTDOWN; - - return sodisconnect(socket); + int error; + + if (!socket) + return OSK_ESHUTDOWN; + + OSKLock(); + error = sodisconnect(socket); + OSKUnlock(); + + return error; } int OskitTCPShutdown( void *socket, int disconn_type ) { - if (!socket) - return OSK_ESHUTDOWN; - - return soshutdown( socket, disconn_type ); + int error; + + if (!socket) + return OSK_ESHUTDOWN; + + OSKLock(); + error = soshutdown( socket, disconn_type ); + OSKUnlock(); + + return error; } int OskitTCPClose( void *socket ) { - struct socket *so = socket; - - if (!socket) - return OSK_ESHUTDOWN; - - so->so_connection = 0; - soclose( so ); - return 0; + int error; + + if (!socket) + return OSK_ESHUTDOWN; + + OSKLock(); + error = soclose( socket ); + OSKUnlock(); + + return error; } int OskitTCPSend( void *socket, OSK_PCHAR Data, OSK_UINT Len, @@ -281,7 +315,10 @@ uio.uio_rw = UIO_WRITE; uio.uio_procp = NULL; + OSKLock(); error = sosend( socket, NULL, &uio, NULL, NULL, 0 ); + OSKUnlock(); + *OutLen = Len - uio.uio_resid; return error; @@ -289,6 +326,7 @@ int OskitTCPAccept( void *socket, void **new_socket, + void *context, void *AddrOut, OSK_UINT AddrLen, OSK_UINT *OutAddrLen, @@ -317,11 +355,12 @@ /* that's a copyin actually */ namelen = *OutAddrLen; + OSKLock(); + s = splnet(); #if 0 if ((head->so_options & SO_ACCEPTCONN) == 0) { - splx(s); OS_DbgPrint(OSK_MID_TRACE,("OSKITTCP: head->so_options = %x, wanted bit %x\n", head->so_options, SO_ACCEPTCONN)); error = EINVAL; @@ -333,38 +372,9 @@ head->so_q, head->so_state)); if ((head->so_state & SS_NBIO) && head->so_q == NULL) { - splx(s); error = EWOULDBLOCK; goto out; } - - OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); - while (head->so_q == NULL && head->so_error == 0) { - if (head->so_state & SS_CANTRCVMORE) { - head->so_error = ECONNABORTED; - break; - } - OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); - error = tsleep((caddr_t)&head->so_timeo, PSOCK | PCATCH, - "accept", 0); - if (error) { - splx(s); - goto out; - } - OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); - } - OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); - -#if 0 - if (head->so_error) { - OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); - error = head->so_error; - head->so_error = 0; - splx(s); - goto out; - } - OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); -#endif /* * At this point we know that there is at least one connection @@ -384,19 +394,20 @@ head->so_q = so->so_q; head->so_qlen--; - *newso = so; - - /*so->so_state &= ~SS_COMP;*/ - mnam.m_data = (char *)&sa; mnam.m_len = sizeof(sa); - (void) soaccept(so, &mnam); - - so->so_state = SS_NBIO | SS_ISCONNECTED; + error = soaccept(so, &mnam); + if (error) + goto out; + + so->so_state |= SS_NBIO | SS_ISCONNECTED; so->so_q = so->so_q0 = NULL; so->so_qlen = 0; so->so_head = 0; + so->so_connection = context; + + *newso = so; OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); if (name) { @@ -406,9 +417,10 @@ *OutAddrLen = namelen; /* copyout actually */ } OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); - splx(s); } out: + splx(s); + OSKUnlock(); OS_DbgPrint(OSK_MID_TRACE,("OSKITTCP: Returning %d\n", error)); return (error); } @@ -421,10 +433,20 @@ void OskitTCPReceiveDatagram( OSK_PCHAR Data, OSK_UINT Len, OSK_UINT IpHeaderLen ) { - struct mbuf *Ip = m_devget( (char *)Data, Len, 0, NULL, NULL ); + struct mbuf *Ip; struct ip *iph; - - if( !Ip ) return; /* drop the segment */ + KIRQL OldIrql; + + /* This function is a special case in which we cannot use OSKLock/OSKUnlock + * because we don't enter with the connection lock held */ + + OSKLockAndRaise(&OldIrql); + Ip = m_devget( (char *)Data, Len, 0, NULL, NULL ); + if( !Ip ) + { + OSKUnlockAndLower(OldIrql); + return; /* drop the segment */ + } //memcpy( Ip->m_data, Data, Len ); Ip->m_pkthdr.len = IpHeaderLen; @@ -439,6 +461,7 @@ IpHeaderLen)); tcp_input(Ip, IpHeaderLen); + OSKUnlockAndLower(OldIrql); /* The buffer Ip is freed by tcp_input */ } @@ -450,6 +473,7 @@ int size) { struct mbuf *m; + int error; if (!socket) return OSK_ESHUTDOWN; @@ -457,16 +481,23 @@ if (size >= MLEN) return OSK_EINVAL; + OSKLock(); m = m_get(M_WAIT, MT_SOOPTS); if (!m) + { + OSKUnlock(); return OSK_ENOMEM; + } m->m_len = size; memcpy(m->m_data, buffer, size); /* m is freed by sosetopt */ - return sosetopt(socket, level, optname, m); + error = sosetopt(socket, level, optname, m); + OSKUnlock(); + + return error; } int OskitTCPGetSockOpt(void *socket, @@ -481,6 +512,7 @@ if (!socket) return OSK_ESHUTDOWN; + OSKLock(); error = sogetopt(socket, level, optname, &m); if (!error) { @@ -489,6 +521,7 @@ if (!buffer || oldsize < m->m_len) { m_freem(m); + OSKUnlock(); return OSK_EINVAL; } @@ -496,6 +529,7 @@ m_freem(m); } + OSKUnlock(); return error; } @@ -507,7 +541,11 @@ return OSK_ESHUTDOWN; OS_DbgPrint(OSK_MID_TRACE,("Called, socket = %08x\n", socket)); + + OSKLock(); error = solisten( socket, backlog ); + OSKUnlock(); + OS_DbgPrint(OSK_MID_TRACE,("Ending: %08x\n", error)); return error; @@ -524,11 +562,13 @@ if (!socket) return OSK_ESHUTDOWN; + OSKLock(); inp = (struct inpcb *)so->so_pcb; inp->inp_laddr.s_addr = LocalAddress; inp->inp_lport = LocalPort; inp->inp_faddr.s_addr = RemoteAddress; inp->inp_fport = RemotePort; + OSKUnlock(); return 0; } @@ -544,11 +584,13 @@ if (!socket) return OSK_ESHUTDOWN; + OSKLock(); inp = (struct inpcb *)so->so_pcb; *LocalAddress = inp->inp_laddr.s_addr; *LocalPort = inp->inp_lport; *RemoteAddress = inp->inp_faddr.s_addr; *RemotePort = inp->inp_fport; + OSKUnlock(); return 0; }
15 years, 1 month
1
0
0
0
[spetreolle] 44162: fix win32k build.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sat Nov 14 19:25:03 2009 New Revision: 44162 URL:
http://svn.reactos.org/svn/reactos?rev=44162&view=rev
Log: fix win32k build. Modified: branches/pierre-fsd/include/psdk/winuser.h branches/pierre-fsd/include/reactos/win32k/ntuser.h branches/pierre-fsd/subsystems/win32/win32k/include/dc.h branches/pierre-fsd/subsystems/win32/win32k/include/eng.h branches/pierre-fsd/subsystems/win32/win32k/include/gdifloat.h branches/pierre-fsd/subsystems/win32/win32k/include/hook.h branches/pierre-fsd/subsystems/win32/win32k/include/msgqueue.h branches/pierre-fsd/subsystems/win32/win32k/include/window.h branches/pierre-fsd/subsystems/win32/win32k/ntuser/defwnd.c branches/pierre-fsd/subsystems/win32/win32k/ntuser/event.c branches/pierre-fsd/subsystems/win32/win32k/ntuser/hook.c branches/pierre-fsd/subsystems/win32/win32k/ntuser/message.c branches/pierre-fsd/subsystems/win32/win32k/objects/color.c branches/pierre-fsd/subsystems/win32/win32k/objects/dc.c branches/pierre-fsd/subsystems/win32/win32k/objects/dcutil.c branches/pierre-fsd/subsystems/win32/win32k/objects/fillshap.c branches/pierre-fsd/subsystems/win32/win32k/objects/path.c Modified: branches/pierre-fsd/include/psdk/winuser.h URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/include/psdk/winuser…
============================================================================== --- branches/pierre-fsd/include/psdk/winuser.h [iso-8859-1] (original) +++ branches/pierre-fsd/include/psdk/winuser.h [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -1172,6 +1172,12 @@ #define SMTO_ABORTIFHUNG 2 #define SMTO_BLOCK 1 #define SMTO_NORMAL 0 +#if (WINVER >= 0x0500) +#define SMTO_NOTIMEOUTIFNOTHUNG 8 +#endif +#if (WINVER >= 0x0600) +#define SMTO_ERRORONEXIT 32 +#endif #define SIF_ALL 23 #define SIF_PAGE 2 #define SIF_POS 4 @@ -2834,7 +2840,7 @@ WPARAM wParam; DWORD message; HWND hwnd; -} CWPRETSTRUCT; +} CWPRETSTRUCT,*PCWPRETSTRUCT, *LPCWPRETSTRUCT; typedef struct tagCWPSTRUCT { LPARAM lParam; WPARAM wParam; @@ -3236,6 +3242,20 @@ UINT wHitTestCode; ULONG_PTR dwExtraInfo; } MOUSEHOOKSTRUCT,*LPMOUSEHOOKSTRUCT,*PMOUSEHOOKSTRUCT; +#if ( _WIN32_WINNT >= 0x0500 ) +#ifdef __cplusplus +typedef struct tagMOUSEHOOKSTRUCTEX : public tagMOUSEHOOKSTRUCT +{ + DWORD mouseData; +} MOUSEHOOKSTRUCTEX, *LPMOUSEHOOKSTRUCTEX, *PMOUSEHOOKSTRUCTEX; +#else +typedef struct tagMOUSEHOOKSTRUCTEX +{ + MOUSEHOOKSTRUCT MOUSEHOOKSTRUCT; + DWORD mouseData; +} MOUSEHOOKSTRUCTEX, *LPMOUSEHOOKSTRUCTEX, *PMOUSEHOOKSTRUCTEX; +#endif +#endif typedef struct tagTRACKMOUSEEVENT { DWORD cbSize; DWORD dwFlags; Modified: branches/pierre-fsd/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/include/reactos/win3…
============================================================================== --- branches/pierre-fsd/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ branches/pierre-fsd/include/reactos/win32k/ntuser.h [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -242,23 +242,34 @@ } PFNCLIENTWORKER, *PPFNCLIENTWORKER; -// FNID's for NtUserSetWindowFNID -#define FNID_SCROLLBAR 0x029A -#define FNID_ICONTITLE 0x029B -#define FNID_MENU 0x029C -#define FNID_DESKTOP 0x029D -#define FNID_SWITCH 0x02A0 -#define FNID_BUTTON 0x02A1 -#define FNID_COMBOBOX 0x02A2 -#define FNID_COMBOLBOX 0x02A3 -#define FNID_DIALOG 0x02A4 -#define FNID_EDIT 0x02A5 -#define FNID_LISTBOX 0x02A6 -#define FNID_MDICLIENT 0x02A7 -#define FNID_STATIC 0x02A8 -#define FNID_IME 0x02A9 -#define FNID_TOOLTIPS 0x02B5 -#define FNID_UNKNOWN 0x02B6 +// FNID's for NtUserSetWindowFNID, NtUserMessageCall +#define FNID_SCROLLBAR 0x029A +#define FNID_ICONTITLE 0x029B +#define FNID_MENU 0x029C +#define FNID_DESKTOP 0x029D +#define FNID_DEFWINDOWPROC 0x029E +#define FNID_SWITCH 0x02A0 +#define FNID_BUTTON 0x02A1 +#define FNID_COMBOBOX 0x02A2 +#define FNID_COMBOLBOX 0x02A3 +#define FNID_DIALOG 0x02A4 +#define FNID_EDIT 0x02A5 +#define FNID_LISTBOX 0x02A6 +#define FNID_MDICLIENT 0x02A7 +#define FNID_STATIC 0x02A8 +#define FNID_IME 0x02A9 +#define FNID_CALLWNDPROC 0x02AA +#define FNID_CALLWNDPROCRET 0x02AB +#define FNID_SENDMESSAGE 0x02B0 +// Kernel has option to use TimeOut or normal msg send, based on type of msg. +#define FNID_SENDMESSAGEWTOOPTION 0x02B1 +#define FNID_SENDMESSAGETIMEOUT 0x02B2 +#define FNID_BROADCASTSYSTEMMESSAGE 0x02B4 +#define FNID_TOOLTIPS 0x02B5 +#define FNID_UNKNOWN 0x02B6 +#define FNID_SENDNOTIFYMESSAGE 0x02B7 +#define FNID_SENDMESSAGECALLBACK 0x02B8 + #define FNID_DDEML 0x2000 // Registers DDEML #define FNID_DESTROY 0x4000 // This is sent when WM_NCDESTROY or in the support routine. @@ -366,12 +377,28 @@ } W32THREADINFO, *PW32THREADINFO; /* Window Client Information structure */ +struct _ETHREAD; + + +typedef struct tagHOOK +{ + LIST_ENTRY Chain; /* Hook chain entry */ + HHOOK Self; /* user handle for this hook */ + struct _ETHREAD* Thread; /* Thread owning the hook */ + int HookId; /* Hook table index */ + HOOKPROC Proc; /* Hook function */ + BOOLEAN Ansi; /* Is it an Ansi hook? */ + ULONG Flags; /* Some internal flags */ + UNICODE_STRING ModuleName; /* Module name for global hooks */ +} HOOK, *PHOOK; typedef struct _CALLBACKWND { HWND hWnd; PVOID pvWnd; } CALLBACKWND, *PCALLBACKWND; + +#define CI_CURTHPRHOOK 0x00000010 typedef struct _CLIENTINFO { @@ -383,7 +410,7 @@ DWORD dwTIFlags; PDESKTOPINFO pDeskInfo; ULONG_PTR ulClientDelta; - PVOID phkCurrent; + PHOOK phkCurrent; ULONG fsHooks; CALLBACKWND CallbackWnd; ULONG Win32ClientInfo; @@ -430,7 +457,14 @@ ATOM Atom; } PROPERTY, *PPROPERTY; - +typedef struct _BROADCASTPARM +{ + DWORD flags; + DWORD recipients; + HDESK hDesk; + HWND hWnd; + LUID luid; +} BROADCASTPARM, *PBROADCASTPARM; PW32THREADINFO GetW32ThreadInfo(VOID); PW32PROCESSINFO GetW32ProcessInfo(VOID); @@ -938,10 +972,10 @@ LRESULT NTAPI NtUserCallNextHookEx( - HHOOK Hook, int Code, WPARAM wParam, - LPARAM lParam); + LPARAM lParam, + BOOL Ansi); DWORD NTAPI @@ -1838,15 +1872,6 @@ UINT transType, DWORD keyboardId, HKL dwhkl ); -// Look like fnID's -#define NUMC_DEFWINDOWPROC 0x029E -#define NUMC_SENDMESSAGE 0x02B0 -// Kernel has option to use TO or normal msg send, based on type of msg. -#define NUMC_SENDMESSAGEWTOOPTION 0x02B1 -#define NUMC_SENDMESSAGETIMEOUT 0x02B2 -#define NUMC_BROADCASTSYSTEMMESSAGE 0x02B4 -#define NUMC_SENDNOTIFYMESSAGE 0x02B7 -#define NUMC_SENDMESSAGECALLBACK 0x02B8 LRESULT NTAPI NtUserMessageCall( @@ -1855,7 +1880,7 @@ WPARAM wParam, LPARAM lParam, ULONG_PTR ResultInfo, - DWORD dwType, // NUMC_XX types + DWORD dwType, // FNID_XX types BOOL Ansi); DWORD Modified: branches/pierre-fsd/subsystems/win32/win32k/include/dc.h URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/include/dc.h [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -32,10 +32,7 @@ typedef struct _WIN_DC_INFO { HRGN hClipRgn; /* Clip region (may be 0) */ - HRGN hrgnMeta; /* Meta region (may be 0) */ - HRGN hMetaClipRgn; /* Intersection of meta and clip regions (may be 0) */ HRGN hVisRgn; /* Should me to DC. Visible region (must never be 0) */ - HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */ HBITMAP hBitmap; @@ -93,7 +90,7 @@ FLOATOBJ efPr22; PSURFACE pSurface; SIZE sizl; -} DCLEVEL, PDCLEVEL; +} DCLEVEL, *PDCLEVEL; /* The DC object structure */ typedef struct _DC @@ -141,8 +138,6 @@ /* Reactos specific members */ WIN_DC_INFO w; - HRGN hprgnAPI; // should use prgnAPI - HRGN hprgnVis; // should use prgnVis CLIPOBJ *CombinedClip; XLATEOBJ *XlateBrush; XLATEOBJ *XlatePen; Modified: branches/pierre-fsd/subsystems/win32/win32k/include/eng.h URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/include/eng.h [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/include/eng.h [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -22,5 +22,6 @@ VOID FASTCALL IntGdiAcquireSemaphore ( HSEMAPHORE hsem ); VOID FASTCALL IntGdiReleaseSemaphore ( HSEMAPHORE hsem ); +ULONGLONG APIENTRY EngGetTickCount(VOID); #endif /* _WIN32K_ENG_H */ Modified: branches/pierre-fsd/subsystems/win32/win32k/include/gdifloat.h URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/include/gdifloat.h [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/include/gdifloat.h [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -31,16 +31,20 @@ static __inline void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point) { FLOAT x, y; + XFORM xformWorld2Vport; + + MatrixS2XForm(&xformWorld2Vport, &dc->DcLevel.mxWorldToDevice); /* Perform the transformation */ x = point->x; y = point->y; - point->x = x * dc->DcLevel.xformWorld2Vport.eM11 + - y * dc->DcLevel.xformWorld2Vport.eM21 + - dc->DcLevel.xformWorld2Vport.eDx; - point->y = x * dc->DcLevel.xformWorld2Vport.eM12 + - y * dc->DcLevel.xformWorld2Vport.eM22 + - dc->DcLevel.xformWorld2Vport.eDy; + point->x = x * xformWorld2Vport.eM11 + + y * xformWorld2Vport.eM21 + + xformWorld2Vport.eDx; + + point->y = x * xformWorld2Vport.eM12 + + y * xformWorld2Vport.eM22 + + xformWorld2Vport.eDy; } /* Performs a viewport-to-world transformation on the specified point (which @@ -105,8 +109,6 @@ #define YLSTODS(Dc_Attr,ty) \ MulDiv((ty), (Dc_Attr)->szlViewportExt.cy, (Dc_Attr)->szlWindowExt.cy) -VOID FASTCALL XForm2MatrixS( MATRIX_S *, PXFORM); -VOID FASTCALL MatrixS2XForm( PXFORM, MATRIX_S *); - #endif + Modified: branches/pierre-fsd/subsystems/win32/win32k/include/hook.h URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/include/hook.h [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/include/hook.h [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -2,7 +2,7 @@ #define _WIN32K_HOOK_H #define HOOK_THREAD_REFERENCED (0x1) - +#if 0 typedef struct tagHOOK { LIST_ENTRY Chain; /* Hook chain entry */ @@ -14,7 +14,7 @@ ULONG Flags; /* Some internal flags */ UNICODE_STRING ModuleName; /* Module name for global hooks */ } HOOK, *PHOOK; - +#endif #define NB_HOOKS (WH_MAXHOOK-WH_MINHOOK+1) #define HOOKID_TO_INDEX(HookId) (HookId - WH_MINHOOK) #define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1)) @@ -33,6 +33,8 @@ PETHREAD Thread; /* Thread owning the event */ UINT eventMin; UINT eventMax; + DWORD idProcess; + DWORD idThread; WINEVENTPROC Proc; /* Event function */ BOOLEAN Ansi; /* Is it an Ansi event? */ ULONG Flags; /* Some internal flags */ @@ -49,6 +51,8 @@ LRESULT FASTCALL co_EVENT_CallEvents(DWORD, HWND, UINT_PTR, LONG_PTR); VOID FASTCALL HOOK_DestroyThreadHooks(PETHREAD Thread); PHOOK FASTCALL IntGetHookObject(HHOOK); +PHOOK FASTCALL IntGetNextHook(PHOOK Hook); +LRESULT FASTCALL UserCallNextHookEx( PHOOK pHook, int Code, WPARAM wParam, LPARAM lParam, BOOL Ansi); #endif /* _WIN32K_HOOK_H */ Modified: branches/pierre-fsd/subsystems/win32/win32k/include/msgqueue.h URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -4,6 +4,9 @@ #include "hook.h" #define MSQ_HUNG 5000 +#define MSQ_NORMAL 0 +#define MSQ_ISHOOK 1 +#define MSQ_ISEVENT 2 typedef struct _USER_MESSAGE { @@ -25,7 +28,7 @@ ULONG_PTR CompletionCallbackContext; /* entry in the dispatching list of the sender's message queue */ LIST_ENTRY DispatchingListEntry; - BOOL HookMessage; + INT HookMessage; } USER_SENT_MESSAGE, *PUSER_SENT_MESSAGE; typedef struct _USER_SENT_MESSAGE_NOTIFY @@ -121,7 +124,7 @@ NTSTATUS FASTCALL co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, - UINT uTimeout, BOOL Block, BOOL HookMessage, + UINT uTimeout, BOOL Block, INT HookMessage, ULONG_PTR *uResult); PUSER_MESSAGE FASTCALL MsqCreateMessage(LPMSG Msg, BOOLEAN FreeLParam); Modified: branches/pierre-fsd/subsystems/win32/win32k/include/window.h URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/include/window.h [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/include/window.h [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -165,7 +165,7 @@ IntShowOwnedPopups( PWINDOW_OBJECT owner, BOOL fShow ); LRESULT FASTCALL -IntDefWindowProc( PWINDOW_OBJECT Window, UINT Msg, WPARAM wParam, LPARAM lParam); +IntDefWindowProc( PWINDOW_OBJECT Window, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi); VOID FASTCALL IntNotifyWinEvent(DWORD, PWINDOW_OBJECT, LONG, LONG); Modified: branches/pierre-fsd/subsystems/win32/win32k/ntuser/defwnd.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -4,8 +4,7 @@ * PURPOSE: Misc User funcs * FILE: subsystem/win32/win32k/ntuser/defwnd.c * PROGRAMER: - * REVISION HISTORY: - * 2003/05/22 Created + * */ #include <w32k.h> @@ -13,7 +12,25 @@ #define NDEBUG #include <debug.h> +LRESULT FASTCALL +IntDefWinHandleSysCommand( PWINDOW_OBJECT Window, WPARAM wParam, LPARAM lParam , BOOL Ansi) +{ + DPRINT1("hwnd %p WM_SYSCOMMAND %lx %lx\n", Window->hSelf, wParam, lParam ); + if (!ISITHOOKED(WH_CBT)) return 0; + +// if (!UserCallNextHookEx(WH_CBT, HCBT_SYSCOMMAND, wParam, lParam, Ansi)) + return 0; + + switch (wParam & 0xfff0) + { + case SC_MOVE: + case SC_SIZE: + // return UserCallNextHookEx(WH_CBT, HCBT_MOVESIZE, (WPARAM)Window->hSelf, lParam, Ansi); + break; + } + return 1; +} /* Win32k counterpart of User DefWindowProc */ @@ -22,9 +39,11 @@ PWINDOW_OBJECT Window, UINT Msg, WPARAM wParam, - LPARAM lParam) + LPARAM lParam, + BOOL Ansi) { PWINDOW Wnd; + LRESULT lResult = 0; if (Msg > WM_USER) return 0; @@ -33,6 +52,11 @@ switch (Msg) { + case WM_SYSCOMMAND: + { + lResult = IntDefWinHandleSysCommand( Window, wParam, lParam, Ansi ); + break; + } case WM_SHOWWINDOW: { if ((Wnd->Style & WS_VISIBLE) && wParam) break; @@ -54,7 +78,7 @@ break; } - return 0; + return lResult; } Modified: branches/pierre-fsd/subsystems/win32/win32k/ntuser/event.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/ntuser/event.c [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/ntuser/event.c [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -12,7 +12,6 @@ } EVENTPACK, *PEVENTPACK; static PEVENTTABLE GlobalEvents = NULL; - /* PRIVATE FUNCTIONS *********************************************************/ @@ -237,6 +236,7 @@ IntNotifyWinEvent( Event, Window, idObject, idChild); UserDerefObjectCo(Window); } + UserLeave(); } HWINEVENTHOOK @@ -251,11 +251,14 @@ DWORD idThread, UINT dwflags) { - gpsi->SrvEventActivity |= GetMaskFromEvent(eventMin); - gpsi->SrvEventActivity &= ~GetMaskFromEvent(eventMin); + PEVENTHOOK pEH; + HWINEVENTHOOK Ret = NULL; + UNICODE_STRING ModuleName; + NTSTATUS Status; + HANDLE Handle; PETHREAD Thread = NULL; - UNIMPLEMENTED + UserEnterExclusive(); if ( !GlobalEvents ) { @@ -381,7 +384,8 @@ NtUserUnhookWinEvent( HWINEVENTHOOK hWinEventHook) { - UNIMPLEMENTED + PEVENTHOOK pEH; + BOOL Ret = FALSE; UserEnterExclusive(); Modified: branches/pierre-fsd/subsystems/win32/win32k/ntuser/hook.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -15,9 +15,6 @@ #define NDEBUG #include <debug.h> -#define HOOKID_TO_INDEX(HookId) (HookId - WH_MINHOOK) -#define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1)) - static PHOOKTABLE GlobalHooks; @@ -164,7 +161,8 @@ } /* find the next hook in the chain, skipping the deleted ones */ -static PHOOK FASTCALL +PHOOK +FASTCALL IntGetNextHook(PHOOK Hook) { PHOOKTABLE Table = IntGetTable(Hook); @@ -269,7 +267,7 @@ } static LRESULT FASTCALL -IntCallLowLevelHook(INT HookId, INT Code, WPARAM wParam, LPARAM lParam, PHOOK Hook) +IntCallLowLevelHook(PHOOK Hook, INT Code, WPARAM wParam, LPARAM lParam) { NTSTATUS Status; ULONG_PTR uResult; @@ -289,10 +287,14 @@ return NT_SUCCESS(Status) ? uResult : 0; } -LRESULT FASTCALL +/* + Called from inside kernel space. + */ +LRESULT +FASTCALL co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam) { - PHOOK Hook; + PHOOK Hook, SaveHook; PTHREADINFO pti; PCLIENTINFO ClientInfo; PHOOKTABLE Table; @@ -322,17 +324,10 @@ } } - if (Hook->Thread != PsGetCurrentThread() - && (WH_KEYBOARD_LL == HookId || WH_MOUSE_LL == HookId)) - { - DPRINT("Calling hook in owning thread\n"); - return IntCallLowLevelHook(HookId, Code, wParam, lParam, Hook); - } - - if (Hook->Thread != PsGetCurrentThread()) - { - DPRINT1("Calling hooks in other threads not implemented yet"); - return 0; + if ((Hook->Thread != PsGetCurrentThread()) && (Hook->Thread != NULL)) + { + // Post it in message queue. + return IntCallLowLevelHook(Hook, Code, wParam, lParam); } Table->Counts[HOOKID_TO_INDEX(HookId)]++; @@ -341,8 +336,19 @@ GlobalHooks->Counts[HOOKID_TO_INDEX(HookId)]++; } - Result = co_IntCallHookProc(HookId, Code, wParam, lParam, Hook->Proc, - Hook->Ansi, &Hook->ModuleName); + ClientInfo = GetWin32ClientInfo(); + SaveHook = ClientInfo->phkCurrent; + ClientInfo->phkCurrent = Hook; // Load the call. + + Result = co_IntCallHookProc( HookId, + Code, + wParam, + lParam, + Hook->Proc, + Hook->Ansi, + &Hook->ModuleName); + + ClientInfo->phkCurrent = SaveHook; Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation, KernelMode, @@ -405,10 +411,28 @@ break; } } - - ObDereferenceObject(WinStaObj); - } -} + } +} + +static LRESULT +FASTCALL +co_HOOK_CallHookNext(PHOOK Hook, INT Code, WPARAM wParam, LPARAM lParam) +{ + if ((Hook->Thread != PsGetCurrentThread()) && (Hook->Thread != NULL)) + { + DPRINT1("CALLING HOOK from another Thread. %d\n",Hook->HookId); + return IntCallLowLevelHook(Hook, Code, wParam, lParam); + } + DPRINT("CALLING HOOK %d\n",Hook->HookId); + return co_IntCallHookProc(Hook->HookId, + Code, + wParam, + lParam, + Hook->Proc, + Hook->Ansi, + &Hook->ModuleName); +} + LRESULT FASTCALL @@ -856,10 +880,10 @@ LRESULT APIENTRY NtUserCallNextHookEx( - HHOOK Hook, int Code, WPARAM wParam, - LPARAM lParam) + LPARAM lParam, + BOOL Ansi) { PHOOK HookObj, NextObj; PCLIENTINFO ClientInfo; @@ -874,30 +898,25 @@ KernelMode, 0, &WinStaObj); - - if (! NT_SUCCESS(Status)) + if (!NT_SUCCESS(Status)) { SetLastNtError(Status); - RETURN( FALSE); - } - - //Status = UserReferenceObjectByHandle(gHandleTable, Hook, - // otHookProc, (PVOID *) &HookObj); + RETURN( 0); + } + ObDereferenceObject(WinStaObj); - // if (! NT_SUCCESS(Status)) - // { - // DPRINT1("Invalid handle passed to NtUserCallNextHookEx\n"); - // SetLastNtError(Status); - // RETURN( 0); - // } - - if (!(HookObj = IntGetHookObject(Hook))) - { - RETURN(0); - } - - ASSERT(Hook == HookObj->Self); + ClientInfo = GetWin32ClientInfo(); + + if (!ClientInfo) RETURN( 0); + + HookObj = ClientInfo->phkCurrent; + + if (!HookObj) RETURN( 0); + + UserReferenceObject(HookObj); + + Ansi = HookObj->Ansi; if (NULL != HookObj->Thread && (HookObj->Thread != PsGetCurrentThread())) { @@ -906,18 +925,13 @@ SetLastWin32Error(ERROR_INVALID_HANDLE); RETURN( 0); } - + NextObj = IntGetNextHook(HookObj); + ClientInfo->phkCurrent = NextObj; // Preset next hook from list. + UserCallNextHookEx( HookObj, Code, wParam, lParam, Ansi); UserDereferenceObject(HookObj); - if (NULL != NextObj) - { - DPRINT1("Calling next hook not implemented\n"); - UNIMPLEMENTED - SetLastWin32Error(ERROR_NOT_SUPPORTED); - RETURN( 0); - } - - RETURN( 0); + + RETURN( (LRESULT)NextObj); CLEANUP: DPRINT("Leave NtUserCallNextHookEx, ret=%i\n",_ret_); Modified: branches/pierre-fsd/subsystems/win32/win32k/ntuser/message.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -407,9 +407,11 @@ BOOL APIENTRY NtUserCallMsgFilter( - LPMSG msg, + LPMSG lpmsg, INT code) { + BOOL BadChk = FALSE, Ret = TRUE; + MSG Msg; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserCallMsgFilter\n"); @@ -434,9 +436,7 @@ else RETURN( FALSE); - if (co_HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)msg)) - RETURN( TRUE); - RETURN( co_HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)msg)); + if (BadChk) RETURN( FALSE); if (!co_HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)&Msg)) { @@ -747,6 +747,7 @@ BOOL Present, RemoveMessages; USER_REFERENCE_ENTRY Ref; USHORT HitTest; + MOUSEHOOKSTRUCT MHook; /* The queues and order in which they are checked are documented in the MSDN article on GetMessage() */ @@ -784,7 +785,7 @@ { ThreadQueue->QuitPosted = FALSE; } - return TRUE; + goto MsgExit; } /* Now check for normal messages. */ @@ -831,7 +832,7 @@ if (IntGetPaintMessage(hWnd, MsgFilterMin, MsgFilterMax, pti, &Msg->Msg, RemoveMessages)) { Msg->FreeLParam = FALSE; - return TRUE; + goto MsgExit; } if (ThreadQueue->WakeMask & QS_TIMER) @@ -897,7 +898,7 @@ // UserDereferenceObject(MsgWindow); // } - return TRUE; + goto MsgExit; } if((Msg->Msg.hwnd && Msg->Msg.message >= WM_MOUSEFIRST && Msg->Msg.message <= WM_MOUSELAST) && @@ -1000,12 +1001,9 @@ } Present = co_IntPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, RemoveMsg); - // The WH_GETMESSAGE hook enables an application to monitor messages about to - // be returned by the GetMessage or PeekMessage function. - co_HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, RemoveMsg & PM_REMOVE, (LPARAM)&Msg); - if (Present) { + Info.Msg = Msg.Msg; /* See if this message type is present in the table */ MsgMemoryEntry = FindMsgMemory(Info.Msg.message); @@ -1491,7 +1489,6 @@ DECLARE_RETURN(LRESULT); USER_REFERENCE_ENTRY Ref; - /* FIXME: Call hooks. */ if (!(Window = UserGetWindowObject(hWnd))) { RETURN( FALSE); @@ -1501,8 +1498,10 @@ Win32Thread = PsGetCurrentThreadWin32Thread(); + IntCallWndProc( Window, hWnd, Msg, wParam, lParam); + if (NULL != Win32Thread && - Window->MessageQueue == Win32Thread->MessageQueue) + Window->MessageQueue == Win32Thread->MessageQueue) { if (Win32Thread->IsExiting) { @@ -1523,7 +1522,7 @@ if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam))) { - DPRINT1("Failed to pack message parameters\n"); + DPRINT1("Failed to pack message parameters\n"); RETURN( FALSE); } @@ -1535,31 +1534,47 @@ *uResult = Result; } + IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult); + if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam))) { DPRINT1("Failed to unpack message parameters\n"); - RETURN( TRUE); - } - - RETURN( TRUE); - } - - if(uFlags & SMTO_ABORTIFHUNG && MsqIsHung(Window->MessageQueue)) + RETURN( TRUE); + } + + RETURN( TRUE); + } + + if (uFlags & SMTO_ABORTIFHUNG && MsqIsHung(Window->MessageQueue)) { /* FIXME - Set a LastError? */ - RETURN( FALSE); - } - - if(Window->Status & WINDOWSTATUS_DESTROYING) + RETURN( FALSE); + } + + if (Window->Status & WINDOWSTATUS_DESTROYING) { /* FIXME - last error? */ DPRINT1("Attempted to send message to window 0x%x that is being destroyed!\n", hWnd); - RETURN( FALSE); - } - - Status = co_MsqSendMessage(Window->MessageQueue, hWnd, Msg, wParam, lParam, - uTimeout, (uFlags & SMTO_BLOCK), FALSE, uResult); - + RETURN( FALSE); + } + + do + { + Status = co_MsqSendMessage( Window->MessageQueue, + hWnd, + Msg, + wParam, + lParam, + uTimeout, + (uFlags & SMTO_BLOCK), + MSQ_NORMAL, + uResult); + } + while ((STATUS_TIMEOUT == Status) && + (uFlags & SMTO_NOTIMEOUTIFNOTHUNG) && + !MsqIsHung(Window->MessageQueue)); + + IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult); if (STATUS_TIMEOUT == Status) { @@ -1577,7 +1592,7 @@ else if (! NT_SUCCESS(Status)) { SetLastNtError(Status); - RETURN( FALSE); + RETURN( FALSE); } RETURN( TRUE); @@ -1659,8 +1674,7 @@ } else { - if(!co_IntSendMessageTimeoutSingle(hWnd, Msg, wParam, lParam, SMTO_NORMAL, 0, &Result)) - { + if(!co_IntSendMessageTimeoutSingle(hWnd, Msg, wParam, lParam, SMTO_NORMAL, 0, &Result)) { Result = 0; } } @@ -1719,6 +1733,8 @@ Info.Ansi = ! Window->Wnd->Unicode; } + IntCallWndProc( Window, hWnd, Msg, wParam, lParam); + if (Window->Wnd->IsSystem) { Info.Proc = (!Info.Ansi ? Window->Wnd->WndProc : Window->Wnd->WndProcExtra); @@ -1728,6 +1744,9 @@ Info.Ansi = !Window->Wnd->Unicode; Info.Proc = Window->Wnd->WndProc; } + + IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, &Result); + } else { @@ -2022,11 +2041,12 @@ { return 0; } - UserRefObjectCo(Window, &Ref); switch(dwType) { - case NUMC_DEFWINDOWPROC: - lResult = IntDefWindowProc(Window, Msg, wParam, lParam); + case FNID_DEFWINDOWPROC: + UserRefObjectCo(Window, &Ref); + lResult = IntDefWindowProc(Window, Msg, wParam, lParam, Ansi); + UserDerefObjectCo(Window); break; case FNID_BROADCASTSYSTEMMESSAGE: { @@ -2165,7 +2185,6 @@ } break; } - UserDerefObjectCo(Window); UserLeave(); return lResult; } @@ -2198,6 +2217,7 @@ if (!NT_SUCCESS(Status)) { + UserLeave(); SetLastNtError(Status); return WAIT_FAILED; } @@ -2206,16 +2226,22 @@ if (!W32Process) { ObDereferenceObject(Process); + UserLeave(); SetLastWin32Error(ERROR_INVALID_PARAMETER); return WAIT_FAILED; } EngCreateEvent((PEVENT *)&W32Process->InputIdleEvent); - Handles[0] = hProcess; + Handles[0] = Process; Handles[1] = W32Process->InputIdleEvent; - if (!Handles[1]) return STATUS_SUCCESS; /* no event to wait on */ + if (!Handles[1]) + { + ObDereferenceObject(Process); + UserLeave(); + return STATUS_SUCCESS; /* no event to wait on */ + } StartTime = EngGetTickCount(); Modified: branches/pierre-fsd/subsystems/win32/win32k/objects/color.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/objects/color.c [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/objects/color.c [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -436,18 +436,16 @@ { if (pe != NULL) { - UINT CopyEntries; - - if (StartIndex + Entries < palGDI->NumColors) - CopyEntries = StartIndex + Entries; - else - CopyEntries = palGDI->NumColors - StartIndex; + if (StartIndex >= palGDI->NumColors) + Entries = 0; + else if (Entries > palGDI->NumColors - StartIndex) + Entries = palGDI->NumColors - StartIndex; memcpy(pe, palGDI->IndexedColors + StartIndex, - CopyEntries * sizeof(pe[0])); - - Ret = CopyEntries; + Entries * sizeof(pe[0])); + + Ret = Entries; } else { @@ -498,33 +496,26 @@ USHORT sysMode, palMode; dc = DC_LockDc(hDC); - if (!dc) - return 0; + if (!dc) return 0; systemPalette = NtGdiGetStockObject(DEFAULT_PALETTE); palGDI = PALETTE_LockPalette(dc->DcLevel.hpal); if (palGDI == NULL) { - /* FIXME - Handle palGDI == NULL!!!! - we should not unlock dc and return 0 ?? - shall we create the pallete ?? - */ - DC_UnlockDc(dc); - return 0; + DPRINT1("IntGdiRealizePalette(): palGDI is NULL, exiting\n"); + DC_UnlockDc(dc); + return 0; } sysGDI = PALETTE_LockPalette(systemPalette); if (sysGDI == NULL) { - /* FIXME - Handle sysGDI == NULL!!!!! - we should not unlock dc and return 0 ?? - shall we create the pallete ?? - */ - PALETTE_UnlockPalette(palGDI); - DC_UnlockDc(dc); - return 0; + DPRINT1("IntGdiRealizePalette(): sysGDI is NULL, exiting\n"); + PALETTE_UnlockPalette(palGDI); + DC_UnlockDc(dc); + return 0; } // The RealizePalette function modifies the palette for the device associated with the specified device context. If the @@ -799,6 +790,7 @@ IN BOOL bInbound) { LONG ret; + LPVOID pEntries = NULL; /* FIXME: Handle bInbound correctly */ @@ -808,9 +800,12 @@ return 0; } - _SEH_TRY + if (pUnsafeEntries) { - switch(iFunc) + pEntries = ExAllocatePool(PagedPool, cEntries * sizeof(PALETTEENTRY)); + if (!pEntries) + return 0; + if (bInbound) { _SEH2_TRY { @@ -847,13 +842,10 @@ ret = IntGetSystemPaletteEntries((HDC)hObj, iStart, cEntries, (LPPALETTEENTRY)pEntries); break; - case GdiPalGetColorTable: - if (pUnsafeEntries) - { - ProbeForWrite(pUnsafeEntries, cEntries * sizeof(PALETTEENTRY), 1); - } - ret = IntGetDIBColorTable((HDC)hObj, iStart, cEntries, (RGBQUAD*)pUnsafeEntries); - break; + case GdiPalSetColorTable: + if (pEntries) + ret = IntSetDIBColorTable((HDC)hObj, iStart, cEntries, (RGBQUAD*)pEntries); + break; case GdiPalGetColorTable: if (pEntries) @@ -876,12 +868,8 @@ } _SEH2_END } + ExFreePool(pEntries); } - _SEH_HANDLE - { - ret = 0; - } - _SEH_END return ret; } Modified: branches/pierre-fsd/subsystems/win32/win32k/objects/dc.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/objects/dc.c [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -1419,9 +1419,9 @@ #endif nDc_Attr->ptlCurrent = Dc_Attr->ptlCurrent; nDc_Attr->ptfxCurrent = Dc_Attr->ptfxCurrent; - newdc->DcLevel.xformWorld2Wnd = dc->DcLevel.xformWorld2Wnd; - newdc->DcLevel.xformWorld2Vport = dc->DcLevel.xformWorld2Vport; - newdc->DcLevel.xformVport2World = dc->DcLevel.xformVport2World; + newdc->DcLevel.mxWorldToDevice = dc->DcLevel.mxWorldToDevice; + newdc->DcLevel.mxDeviceToWorld = dc->DcLevel.mxDeviceToWorld; + newdc->DcLevel.mxWorldToPage = dc->DcLevel.mxWorldToPage; nDc_Attr->flXform = Dc_Attr->flXform; nDc_Attr->ptlWindowOrg = Dc_Attr->ptlWindowOrg; nDc_Attr->szlWindowExt = Dc_Attr->szlWindowExt; @@ -1485,9 +1485,9 @@ #endif Dc_Attr->ptlCurrent = sDc_Attr->ptlCurrent; Dc_Attr->ptfxCurrent = sDc_Attr->ptfxCurrent; - dc->DcLevel.xformWorld2Wnd = dcs->DcLevel.xformWorld2Wnd; - dc->DcLevel.xformWorld2Vport = dcs->DcLevel.xformWorld2Vport; - dc->DcLevel.xformVport2World = dcs->DcLevel.xformVport2World; + dc->DcLevel.mxWorldToDevice = dcs->DcLevel.mxWorldToDevice; + dc->DcLevel.mxDeviceToWorld = dcs->DcLevel.mxDeviceToWorld; + dc->DcLevel.mxWorldToPage = dcs->DcLevel.mxWorldToPage; Dc_Attr->flXform = sDc_Attr->flXform; Dc_Attr->ptlWindowOrg = sDc_Attr->ptlWindowOrg; Dc_Attr->szlWindowExt = sDc_Attr->szlWindowExt; @@ -2402,6 +2402,7 @@ PDC_ATTR Dc_Attr; HDC hDC; PWSTR Buf = NULL; + XFORM xformTemplate; if (Driver != NULL) { @@ -2438,20 +2439,24 @@ if(!Dc_Attr) Dc_Attr = &NewDC->Dc_Attr; NewDC->BaseObject.hHmgr = (HGDIOBJ) hDC; // Save the handle for this DC object. - NewDC->DcLevel.xformWorld2Wnd.eM11 = 1.0f; - NewDC->DcLevel.xformWorld2Wnd.eM12 = 0.0f; - NewDC->DcLevel.xformWorld2Wnd.eM21 = 0.0f; - NewDC->DcLevel.xformWorld2Wnd.eM22 = 1.0f; - NewDC->DcLevel.xformWorld2Wnd.eDx = 0.0f; - NewDC->DcLevel.xformWorld2Wnd.eDy = 0.0f; - NewDC->DcLevel.xformWorld2Vport = NewDC->DcLevel.xformWorld2Wnd; - NewDC->DcLevel.xformVport2World = NewDC->DcLevel.xformWorld2Wnd; + + xformTemplate.eM11 = 1.0f; + xformTemplate.eM12 = 0.0f; + xformTemplate.eM21 = 0.0f; + xformTemplate.eM22 = 1.0f; + xformTemplate.eDx = 0.0f; + xformTemplate.eDy = 0.0f; + XForm2MatrixS(&NewDC->DcLevel.mxWorldToDevice, &xformTemplate); + XForm2MatrixS(&NewDC->DcLevel.mxDeviceToWorld, &xformTemplate); + XForm2MatrixS(&NewDC->DcLevel.mxWorldToPage, &xformTemplate); + // Setup syncing bits for the dcattr data packets. Dc_Attr->flXform = DEVICE_TO_PAGE_INVALID; Dc_Attr->ulDirty_ = 0; // Server side Dc_Attr->iMapMode = MM_TEXT; + Dc_Attr->iGraphicsMode = GM_COMPATIBLE; Dc_Attr->jFillMode = ALTERNATE; Dc_Attr->szlWindowExt.cx = 1; // Float to Int,,, WRONG! @@ -2631,6 +2636,7 @@ FLOAT scaleX, scaleY; PDC_ATTR Dc_Attr = dc->pDc_Attr; if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr; + XFORM xformWorld2Vport, xformWorld2Wnd, xformVport2World; /* Construct a transformation to do the window-to-viewport conversion */ scaleX = (Dc_Attr->szlWindowExt.cx ? (FLOAT)Dc_Attr->szlViewportExt.cx / (FLOAT)Dc_Attr->szlWindowExt.cx : 0.0f); @@ -2643,13 +2649,23 @@ xformWnd2Vport.eDy = (FLOAT)Dc_Attr->ptlViewportOrg.y - scaleY * (FLOAT)Dc_Attr->ptlWindowOrg.y; /* Combine with the world transformation */ - IntGdiCombineTransform(&dc->DcLevel.xformWorld2Vport, &dc->DcLevel.xformWorld2Wnd, &xformWnd2Vport); + MatrixS2XForm(&xformWorld2Vport, &dc->DcLevel.mxWorldToDevice); + MatrixS2XForm(&xformWorld2Wnd, &dc->DcLevel.mxWorldToPage); + IntGdiCombineTransform(&xformWorld2Vport, &xformWorld2Wnd, &xformWnd2Vport); /* Create inverse of world-to-viewport transformation */ - if (DC_InvertXform(&dc->DcLevel.xformWorld2Vport, &dc->DcLevel.xformVport2World)) - Dc_Attr->flXform &= ~DEVICE_TO_WORLD_INVALID; + MatrixS2XForm(&xformVport2World, &dc->DcLevel.mxDeviceToWorld); + if (DC_InvertXform(&xformWorld2Vport, &xformVport2World)) + { + Dc_Attr->flXform &= ~DEVICE_TO_WORLD_INVALID; + } else - Dc_Attr->flXform |= DEVICE_TO_WORLD_INVALID; + { + Dc_Attr->flXform |= DEVICE_TO_WORLD_INVALID; + } + + XForm2MatrixS(&dc->DcLevel.mxWorldToDevice, &xformWorld2Vport); + } BOOL FASTCALL Modified: branches/pierre-fsd/subsystems/win32/win32k/objects/dcutil.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -113,9 +113,10 @@ CopytoUserDcAttr(PDC dc, PDC_ATTR Dc_Attr) { NTSTATUS Status = STATUS_SUCCESS; - XForm2MatrixS( &dc->Dc_Attr.mxWorldToDevice, &dc->DcLevel.xformWorld2Vport); - XForm2MatrixS( &dc->Dc_Attr.mxDevicetoWorld, &dc->DcLevel.xformVport2World); - XForm2MatrixS( &dc->Dc_Attr.mxWorldToPage, &dc->DcLevel.xformWorld2Wnd); + dc->Dc_Attr.mxWorldToDevice = dc->DcLevel.mxWorldToDevice; + dc->Dc_Attr.mxDeviceToWorld = dc->DcLevel.mxDeviceToWorld; + dc->Dc_Attr.mxWorldToPage = dc->DcLevel.mxWorldToPage; + _SEH2_TRY { ProbeForWrite( Dc_Attr, Modified: branches/pierre-fsd/subsystems/win32/win32k/objects/fillshap.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -73,10 +73,6 @@ Dc_Attr = dc->pDc_Attr; if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr; - BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap); - /* FIXME - BitmapObj can be NULL!!!! don't assert but handle this case gracefully! */ - ASSERT(BitmapObj); - /* Convert to screen coordinates */ IntLPtoDP(dc, Points, Count); for (CurrentPoint = 0; CurrentPoint < Count; CurrentPoint++) @@ -113,16 +109,14 @@ ASSERT(psurf); /* Now fill the polygon with the current brush. */ - FillBrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush); if (FillBrushObj && !(FillBrushObj->flAttrs & GDIBRUSH_IS_NULL)) { IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush); ret = FillPolygon ( dc, psurf, &FillBrushInst.BrushObject, ROP2_TO_MIX(Dc_Attr->jROP2), Points, Count, DestRect ); } - BRUSHOBJ_UnlockBrush(FillBrushObj); - - /* get BRUSHOBJ from current pen. */ - PenBrushObj = PENOBJ_LockPen(Dc_Attr->hpen); + if (FillBrushObj) + BRUSHOBJ_UnlockBrush(FillBrushObj); + // Draw the Polygon Edges with the current pen ( if not a NULL pen ) if (PenBrushObj && !(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL)) { @@ -162,7 +156,8 @@ ROP2_TO_MIX(Dc_Attr->jROP2)); /* MIX */ } } - PENOBJ_UnlockPen(PenBrushObj); + if (PenBrushObj) + PENOBJ_UnlockPen(PenBrushObj); } SURFACE_UnlockSurface(psurf); @@ -519,8 +514,6 @@ PDC_ATTR Dc_Attr; ASSERT ( dc ); // caller's responsibility to set this up - /* FIXME - BitmapObj can be NULL!!! Don't assert but handle this case gracefully! */ - ASSERT ( BitmapObj ); Dc_Attr = dc->pDc_Attr; if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr; @@ -541,42 +534,27 @@ // Rectangle Path only. if ( PATH_IsPathOpen(dc->DcLevel) ) { - ret = PATH_Rectangle ( dc, LeftRect, TopRect, RightRect, BottomRect ); - } - else - { - LeftRect += dc->ptlDCOrig.x; - RightRect += dc->ptlDCOrig.x - 1; - TopRect += dc->ptlDCOrig.y; - BottomRect += dc->ptlDCOrig.y - 1; - - DestRect.left = LeftRect; - DestRect.right = RightRect; - DestRect.top = TopRect; - DestRect.bottom = BottomRect; - - FillBrushObj = BRUSHOBJ_LockBrush(Dc_Attr->hbrush); - - if ( FillBrushObj ) - { - if (!(FillBrushObj->flAttrs & GDIBRUSH_IS_NULL)) - { - IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush); - ret = IntEngBitBlt(&BitmapObj->SurfObj, - NULL, - NULL, - dc->CombinedClip, - NULL, - &DestRect, - NULL, - NULL, - &FillBrushInst.BrushObject, - NULL, - ROP3_TO_ROP4(PATCOPY)); - } - } - - BRUSHOBJ_UnlockBrush(FillBrushObj); + return PATH_Rectangle ( dc, LeftRect, TopRect, RightRect, BottomRect ); + } + + DestRect.left = LeftRect; + DestRect.right = RightRect; + DestRect.top = TopRect; + DestRect.bottom = BottomRect; + + IntLPtoDP(dc, (LPPOINT)&DestRect, 2); + + DestRect.left += dc->ptlDCOrig.x; + DestRect.right += dc->ptlDCOrig.x; + DestRect.top += dc->ptlDCOrig.y; + DestRect.bottom += dc->ptlDCOrig.y; + + /* In GM_COMPATIBLE, don't include bottom and right edges */ + if (IntGetGraphicsMode(dc) == GM_COMPATIBLE) + { + DestRect.right--; + DestRect.bottom--; + } if (Dc_Attr->ulDirty_ & DC_BRUSH_DIRTY) IntGdiSelectBrush(dc,Dc_Attr->hbrush); @@ -616,12 +594,13 @@ NULL, ROP3_TO_ROP4(PATCOPY)); } - - IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen); - - // Draw the rectangle with the current pen - - ret = TRUE; // change default to success + } + + IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen); + + // Draw the rectangle with the current pen + + ret = TRUE; // change default to success if (!(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL)) { @@ -655,8 +634,12 @@ Mix); } +cleanup: + if (FillBrushObj) + BRUSHOBJ_UnlockBrush(FillBrushObj); + + if (PenBrushObj) PENOBJ_UnlockPen(PenBrushObj); - } if (psurf) SURFACE_UnlockSurface(psurf); @@ -664,7 +647,7 @@ /* Move current position in DC? MSDN: The current position is neither used nor updated by Rectangle. */ - return TRUE; + return ret; } BOOL Modified: branches/pierre-fsd/subsystems/win32/win32k/objects/path.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/subsystems/win32/win…
============================================================================== --- branches/pierre-fsd/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original) +++ branches/pierre-fsd/subsystems/win32/win32k/objects/path.c [iso-8859-1] Sat Nov 14 19:25:03 2009 @@ -135,7 +135,7 @@ * tests show that resetting the graphics mode to GM_COMPATIBLE does * not reset the world transform. */ - xform = dc->DcLevel.xformWorld2Wnd; + MatrixS2XForm(&xform, &dc->DcLevel.mxWorldToPage); /* Set MM_TEXT */ // IntGdiSetMapMode( dc, MM_TEXT ); @@ -1353,7 +1353,8 @@ IntGetViewportOrgEx(dc, &ptViewportOrg); IntGetWindowExtEx(dc, &szWindowExt); IntGetWindowOrgEx(dc, &ptWindowOrg); - xform = dc->DcLevel.xformWorld2Wnd; + + MatrixS2XForm(&xform, &dc->DcLevel.mxWorldToPage); /* Set MM_TEXT */ Dc_Attr->iMapMode = MM_TEXT; @@ -1480,7 +1481,7 @@ Dc_Attr->ptlViewportOrg.y = ptViewportOrg.y; /* Restore the world transform */ - dc->DcLevel.xformWorld2Wnd = xform; + XForm2MatrixS(&dc->DcLevel.mxWorldToPage, &xform); /* If we've moved the current point then get its new position which will be in device (MM_TEXT) co-ords, convert it to
15 years, 1 month
1
0
0
0
[arty] 44161: Untested implementation of large mcb (merging back).
by arty@svn.reactos.org
Author: arty Date: Sat Nov 14 19:00:32 2009 New Revision: 44161 URL:
http://svn.reactos.org/svn/reactos?rev=44161&view=rev
Log: Untested implementation of large mcb (merging back). Modified: branches/pierre-fsd/include/ddk/ntifs.h branches/pierre-fsd/ntoskrnl/fsrtl/largemcb.c Modified: branches/pierre-fsd/include/ddk/ntifs.h URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/include/ddk/ntifs.h?…
============================================================================== --- branches/pierre-fsd/include/ddk/ntifs.h [iso-8859-1] (original) +++ branches/pierre-fsd/include/ddk/ntifs.h [iso-8859-1] Sat Nov 14 19:00:32 2009 @@ -25,7 +25,6 @@ #define _GNU_NTIFS_ #ifdef _NTOSKRNL_ -/* HACKHACKHACK!!! We shouldn't include this header from ntoskrnl! */ #define NTKERNELAPI #else #define NTKERNELAPI DECLSPEC_IMPORT @@ -44,13 +43,26 @@ #define VER_PRODUCTBUILD 10000 #endif -#ifndef NTSYSAPI -#define NTSYSAPI -#endif - #define EX_PUSH_LOCK ULONG_PTR #define PEX_PUSH_LOCK PULONG_PTR + +#ifndef FlagOn +#define FlagOn(_F,_SF) ((_F) & (_SF)) +#endif + +#ifndef BooleanFlagOn +#define BooleanFlagOn(F,SF) ((BOOLEAN)(((F) & (SF)) != 0)) +#endif + +#ifndef SetFlag +#define SetFlag(_F,_SF) ((_F) |= (_SF)) +#endif + +#ifndef ClearFlag +#define ClearFlag(_F,_SF) ((_F) &= ~(_SF)) +#endif + #include "csq.h" #ifdef _NTOSKRNL_ @@ -197,7 +209,10 @@ #define FILE_SUPPORTS_OBJECT_IDS 0x00010000 #define FILE_SUPPORTS_ENCRYPTION 0x00020000 #define FILE_NAMED_STREAMS 0x00040000 - +#define FILE_READ_ONLY_VOLUME 0x00080000 +#define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000 +#define FILE_SUPPORTS_TRANSACTIONS 0x00200000 + #define FILE_PIPE_BYTE_STREAM_TYPE 0x00000000 #define FILE_PIPE_MESSAGE_TYPE 0x00000001 @@ -261,6 +276,7 @@ #define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_EX (0x08) #define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH (0x10) #define FSRTL_FLAG_USER_MAPPED_FILE (0x20) +#define FSRTL_FLAG_ADVANCED_HEADER (0x40) #define FSRTL_FLAG_EOF_ADVANCE_ACTIVE (0x80) #define FSRTL_FLAG2_DO_MODIFIED_WRITE (0x01) @@ -317,8 +333,6 @@ #define MAILSLOT_SIZE_AUTO 0 -#define MAP_PROCESS 1L -#define MAP_SYSTEM 2L #define MEM_DOS_LIM 0x40000000 #define MCB_FLAG_RAISE_ON_ALLOCATION_FAILURE 1 @@ -933,10 +947,10 @@ UCHAR Revision; UCHAR Sbz1; SECURITY_DESCRIPTOR_CONTROL Control; - DWORD_PTR Owner; - DWORD_PTR Group; - DWORD_PTR Sacl; - DWORD_PTR Dacl; + ULONG Owner; + ULONG Group; + ULONG Sacl; + ULONG Dacl; } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE; typedef enum _TOKEN_INFORMATION_CLASS { TokenUser=1,TokenGroups,TokenPrivileges,TokenOwner, @@ -1025,24 +1039,6 @@ WCHAR FileName[1]; } FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION; -typedef struct _FILE_ID_BOTH_DIR_INFORMATION { - ULONG NextEntryOffset; - ULONG FileIndex; - LARGE_INTEGER CreationTime; - LARGE_INTEGER LastAccessTime; - LARGE_INTEGER LastWriteTime; - LARGE_INTEGER ChangeTime; - LARGE_INTEGER EndOfFile; - LARGE_INTEGER AllocationSize; - ULONG FileAttributes; - ULONG FileNameLength; - ULONG EaSize; - CCHAR ShortNameLength; - WCHAR ShortName[12]; - LARGE_INTEGER FileId; - WCHAR FileName[1]; -} FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION; - typedef struct _FILE_COMPLETION_INFORMATION { HANDLE Port; PVOID Key; @@ -1090,8 +1086,42 @@ ULONG FileAttributes; ULONG FileNameLength; ULONG EaSize; - WCHAR FileName[0]; + WCHAR FileName[ANYSIZE_ARRAY]; } FILE_FULL_DIRECTORY_INFORMATION, *PFILE_FULL_DIRECTORY_INFORMATION; + +typedef struct _FILE_ID_FULL_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + LARGE_INTEGER FileId; + WCHAR FileName[1]; +} FILE_ID_FULL_DIR_INFORMATION, *PFILE_ID_FULL_DIR_INFORMATION; + +typedef struct _FILE_ID_BOTH_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + CCHAR ShortNameLength; + WCHAR ShortName[12]; + LARGE_INTEGER FileId; + WCHAR FileName[1]; +} FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION; typedef struct _FILE_EA_INFORMATION { ULONG EaSize; @@ -1177,22 +1207,6 @@ ULONG EaSize; WCHAR FileName[1]; } FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION; - -typedef struct _FILE_ID_FULL_DIR_INFORMATION { - ULONG NextEntryOffset; - ULONG FileIndex; - LARGE_INTEGER CreationTime; - LARGE_INTEGER LastAccessTime; - LARGE_INTEGER LastWriteTime; - LARGE_INTEGER ChangeTime; - LARGE_INTEGER EndOfFile; - LARGE_INTEGER AllocationSize; - ULONG FileAttributes; - ULONG FileNameLength; - ULONG EaSize; - LARGE_INTEGER FileId; - WCHAR FileName[1]; -} FILE_ID_FULL_DIR_INFORMATION, *PFILE_ID_FULL_DIR_INFORMATION; typedef struct _FILE_GET_EA_INFORMATION { ULONG NextEntryOffset; @@ -1503,6 +1517,10 @@ } FILE_ALLOCATED_RANGE_BUFFER, *PFILE_ALLOCATED_RANGE_BUFFER; #endif /* (VER_PRODUCTBUILD >= 2195) */ +#define FSRTL_FCB_HEADER_V0 (0x00) +#define FSRTL_FCB_HEADER_V1 (0x01) + + typedef struct _FSRTL_COMMON_FCB_HEADER { CSHORT NodeTypeCode; CSHORT NodeByteSize; @@ -1519,6 +1537,13 @@ LARGE_INTEGER ValidDataLength; } FSRTL_COMMON_FCB_HEADER, *PFSRTL_COMMON_FCB_HEADER; +typedef enum _FSRTL_COMPARISON_RESULT +{ + LessThan = -1, + EqualTo = 0, + GreaterThan = 1 +} FSRTL_COMPARISON_RESULT; + #if (VER_PRODUCTBUILD >= 2600) typedef struct _FSRTL_ADVANCED_FCB_HEADER { @@ -1897,6 +1922,63 @@ PRTL_AVL_FREE_ROUTINE FreeRoutine, PVOID TableContext ); + +NTSYSAPI +PVOID +NTAPI +RtlInsertElementGenericTableAvl ( + PRTL_AVL_TABLE Table, + PVOID Buffer, + CLONG BufferSize, + PBOOLEAN NewElement OPTIONAL + ); + +NTSYSAPI +BOOLEAN +NTAPI +RtlDeleteElementGenericTableAvl ( + PRTL_AVL_TABLE Table, + PVOID Buffer + ); + +NTSYSAPI +PVOID +NTAPI +RtlLookupElementGenericTableAvl ( + PRTL_AVL_TABLE Table, + PVOID Buffer + ); + +NTSYSAPI +PVOID +NTAPI +RtlEnumerateGenericTableWithoutSplayingAvl ( + PRTL_AVL_TABLE Table, + PVOID *RestartKey + ); + +NTSYSAPI +PVOID +NTAPI +RtlEnumerateGenericTableAvl ( + PRTL_AVL_TABLE Table, + BOOLEAN Reset + ); + +NTSYSAPI +ULONG +NTAPI +RtlNumberGenericTableElementsAvl ( + PRTL_AVL_TABLE Table + ); + +NTSYSAPI +PVOID +NTAPI +RtlGetElementGenericTableAvl ( + PRTL_AVL_TABLE Table, + ULONG i + ); #if defined(USE_LPC6432) #define LPC_CLIENT_ID CLIENT_ID64 @@ -2321,7 +2403,7 @@ OUT PIO_STATUS_BLOCK IoStatus OPTIONAL ); -typedef VOID (*PDIRTY_PAGE_ROUTINE) ( +typedef VOID (NTAPI *PDIRTY_PAGE_ROUTINE) ( IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, @@ -2758,7 +2840,20 @@ #endif #endif /* (VER_PRODUCTBUILD >= 2600) */ -#define FlagOn(x, f) ((x) & (f)) + +#define FsRtlSetupAdvancedHeader( _advhdr, _fmutx ) \ +{ \ + SetFlag( (_advhdr)->Flags, FSRTL_FLAG_ADVANCED_HEADER ); \ + SetFlag( (_advhdr)->Flags2, FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS ); \ + (_advhdr)->Version = FSRTL_FCB_HEADER_V1; \ + InitializeListHead( &(_advhdr)->FilterContexts ); \ + if ((_fmutx) != NULL) { \ + (_advhdr)->FastMutex = (_fmutx); \ + } \ + *((PULONG_PTR)(&(_advhdr)->PushLock)) = 0; \ + /*ExInitializePushLock( &(_advhdr)->PushLock ); API Not avaliable downlevel*/\ + (_advhdr)->FileContextSupportPointer = NULL; \ +} NTKERNELAPI BOOLEAN @@ -3038,6 +3133,17 @@ IN PUNICODE_STRING Name ); +NTKERNELAPI +BOOLEAN +NTAPI +FsRtlIsFatDbcsLegal ( + IN ANSI_STRING DbcsName, + IN BOOLEAN WildCardsPermissible, + IN BOOLEAN PathNamePermissible, + IN BOOLEAN LeadingBackslashPermissible + ); + + #define FsRtlCompleteRequest(IRP,STATUS) { \ (IRP)->IoStatus.Status = (STATUS); \ IoCompleteRequest( (IRP), IO_DISK_INCREMENT ); \ @@ -3520,7 +3626,7 @@ IN PVOID FsContext ); -typedef BOOLEAN (*PCHECK_FOR_TRAVERSE_ACCESS) ( +typedef BOOLEAN (NTAPI *PCHECK_FOR_TRAVERSE_ACCESS) ( IN PVOID NotifyContext, IN PVOID TargetContext, IN PSECURITY_SUBJECT_CONTEXT SubjectContext @@ -3593,17 +3699,6 @@ NTAPI FsRtlNotifyInitializeSync ( IN PNOTIFY_SYNC *NotifySync -); - -NTKERNELAPI -VOID -NTAPI -FsRtlNotifyReportChange ( - IN PNOTIFY_SYNC NotifySync, - IN PLIST_ENTRY NotifyList, - IN PSTRING FullTargetName, - IN PUSHORT FileNamePartLength, - IN ULONG FilterMatch ); NTKERNELAPI @@ -3755,19 +3850,19 @@ NTKERNELAPI BOOLEAN NTAPI -FsRtlRemoveBaseMcbEntry ( - IN PBASE_MCB Mcb, - IN LONGLONG Vbn, - IN LONGLONG SectorCount -); - -NTKERNELAPI -VOID -NTAPI -FsRtlRemoveLargeMcbEntry ( - IN PLARGE_MCB Mcb, - IN LONGLONG Vbn, - IN LONGLONG SectorCount +FsRtlRemoveBaseMcbEntry( + IN PBASE_MCB Mcb, + IN LONGLONG Vbn, + IN LONGLONG SectorCount +); + +NTKERNELAPI +VOID +NTAPI +FsRtlRemoveLargeMcbEntry( + IN PLARGE_MCB Mcb, + IN LONGLONG Vbn, + IN LONGLONG SectorCount ); NTKERNELAPI @@ -3884,13 +3979,6 @@ NTAPI FsRtlUninitializeOplock ( IN OUT POPLOCK Oplock -); - -NTHALAPI -VOID -NTAPI -HalDisplayString ( - IN PCHAR String ); NTKERNELAPI @@ -4003,6 +4091,32 @@ IoGetBaseFileSystemDeviceObject ( IN PFILE_OBJECT FileObject ); + +#if (VER_PRODUCTBUILD >= 2600) + +NTKERNELAPI +PDEVICE_OBJECT +NTAPI +IoGetDeviceAttachmentBaseRef ( + IN PDEVICE_OBJECT DeviceObject +); + +NTKERNELAPI +NTSTATUS +NTAPI +IoGetDiskDeviceObject ( + IN PDEVICE_OBJECT FileSystemDeviceObject, + OUT PDEVICE_OBJECT *DiskDeviceObject +); + +NTKERNELAPI +PDEVICE_OBJECT +NTAPI +IoGetLowerDeviceObject ( + IN PDEVICE_OBJECT DeviceObject +); + +#endif /* (VER_PRODUCTBUILD >= 2600) */ NTKERNELAPI PEPROCESS @@ -4988,6 +5102,24 @@ NTSYSAPI NTSTATUS NTAPI +RtlOemStringToCountedUnicodeString( + IN OUT PUNICODE_STRING DestinationString, + IN PCOEM_STRING SourceString, + IN BOOLEAN AllocateDestinationString +); + +NTSYSAPI +NTSTATUS +NTAPI +RtlUnicodeStringToCountedOemString( + IN OUT POEM_STRING DestinationString, + IN PCUNICODE_STRING SourceString, + IN BOOLEAN AllocateDestinationString +); + +NTSYSAPI +NTSTATUS +NTAPI RtlReserveChunk ( IN USHORT CompressionFormat, IN OUT PUCHAR *CompressedBuffer, @@ -5065,6 +5197,17 @@ OUT PULONG BytesInMultiByteString OPTIONAL, IN PWCH UnicodeString, IN ULONG BytesInUnicodeString +); + +NTSYSAPI +NTSTATUS +NTAPI +RtlOemToUnicodeN( + OUT PWSTR UnicodeString, + IN ULONG MaxBytesInUnicodeString, + OUT PULONG BytesInUnicodeString OPTIONAL, + IN PCH OemString, + IN ULONG BytesInOemString ); /* RTL Splay Tree Functions */ @@ -5404,7 +5547,7 @@ ((PSECURITY_SUBJECT_CONTEXT) SubjectContext)->ClientToken : \ ((PSECURITY_SUBJECT_CONTEXT) SubjectContext)->PrimaryToken ) -typedef NTSTATUS (*PSE_LOGON_SESSION_TERMINATED_ROUTINE) ( +typedef NTSTATUS (NTAPI *PSE_LOGON_SESSION_TERMINATED_ROUTINE) ( IN PLUID LogonId ); Modified: branches/pierre-fsd/ntoskrnl/fsrtl/largemcb.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/ntoskrnl/fsrtl/large…
============================================================================== --- branches/pierre-fsd/ntoskrnl/fsrtl/largemcb.c [iso-8859-1] (original) +++ branches/pierre-fsd/ntoskrnl/fsrtl/largemcb.c [iso-8859-1] Sat Nov 14 19:00:32 2009 @@ -5,6 +5,7 @@ * PURPOSE: Large Mapped Control Block (MCB) support for File System Drivers * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) * Pierre Schweitzer (heis_spiter(a)hotmail.com) + * Art Yerkes (art.yerkes(a)gmail.com) */ /* INCLUDES ******************************************************************/ @@ -15,13 +16,50 @@ /* GLOBALS *******************************************************************/ +#define GET_LIST_HEAD(x) ((PLIST_ENTRY)(&((PRTL_GENERIC_TABLE)x)[1])) + PAGED_LOOKASIDE_LIST FsRtlFirstMappingLookasideList; NPAGED_LOOKASIDE_LIST FsRtlFastMutexLookasideList; +typedef struct _LARGE_MCB_MAPPING_ENTRY +{ + LARGE_INTEGER RunStartVbn; + LARGE_INTEGER SectorCount; + LARGE_INTEGER StartingLbn; + LIST_ENTRY Sequence; +} LARGE_MCB_MAPPING_ENTRY, *PLARGE_MCB_MAPPING_ENTRY; + +static PVOID NTAPI McbMappingAllocate(PRTL_GENERIC_TABLE Table, CLONG Bytes) +{ + PVOID Result; + PBASE_MCB Mcb = (PBASE_MCB)Table->TableContext; + Result = ExAllocatePoolWithTag(Mcb->PoolType, Bytes, 'LMCB'); + DPRINT("McbMappingAllocate(%d) => %p\n", Bytes, Result); + return Result; +} + +static VOID NTAPI McbMappingFree(PRTL_GENERIC_TABLE Table, PVOID Buffer) +{ + DPRINT("McbMappingFree(%p)\n", Buffer); + ExFreePoolWithTag(Buffer, 'LMCB'); +} + +static RTL_GENERIC_COMPARE_RESULTS NTAPI McbMappingCompare +(RTL_GENERIC_TABLE Table, PVOID PtrA, PVOID PtrB) +{ + PLARGE_MCB_MAPPING_ENTRY A = PtrA, B = PtrB; + return + (A->RunStartVbn.QuadPart + A->SectorCount.QuadPart < + B->RunStartVbn.QuadPart) ? GenericLessThan : + (A->RunStartVbn.QuadPart > + B->RunStartVbn.QuadPart + B->SectorCount.QuadPart) ? + GenericGreaterThan : GenericEqual; +} + /* PUBLIC FUNCTIONS **********************************************************/ /* - * @unimplemented + * @implemented */ BOOLEAN NTAPI @@ -30,8 +68,59 @@ IN LONGLONG Lbn, IN LONGLONG SectorCount) { - KeBugCheck(FILE_SYSTEM); - return FALSE; + LARGE_MCB_MAPPING_ENTRY Node; + PLARGE_MCB_MAPPING_ENTRY Existing = NULL; + BOOLEAN NewElement = FALSE; + + Node.RunStartVbn.QuadPart = Vbn; + Node.StartingLbn.QuadPart = Lbn; + Node.SectorCount.QuadPart = SectorCount; + + while (!NewElement) + { + Existing = RtlInsertElementGenericTable + (Mcb->Mapping, &Node, sizeof(Node), &NewElement); + if (!Existing) break; + + if (!NewElement) + { + // We merge the existing runs + LARGE_INTEGER StartVbn, FinalVbn; + if (Existing->RunStartVbn.QuadPart < Node.RunStartVbn.QuadPart) + { + StartVbn = Existing->RunStartVbn; + Node.StartingLbn = Existing->StartingLbn; + } + else + { + StartVbn = Node.RunStartVbn; + } + if (Existing->RunStartVbn.QuadPart + Existing->SectorCount.QuadPart > + Node.RunStartVbn.QuadPart + Node.SectorCount.QuadPart) + { + FinalVbn.QuadPart = + Existing->RunStartVbn.QuadPart + Existing->SectorCount.QuadPart; + } + else + { + FinalVbn.QuadPart = + Node.RunStartVbn.QuadPart + Node.SectorCount.QuadPart; + } + Node.RunStartVbn.QuadPart = StartVbn.QuadPart; + Node.SectorCount.QuadPart = FinalVbn.QuadPart - StartVbn.QuadPart; + RemoveHeadList(&Existing->Sequence); + RtlDeleteElementGenericTable(Mcb->Mapping, Existing); + Mcb->PairCount--; + } + else + { + Mcb->MaximumPairCount++; + Mcb->PairCount++; + InsertHeadList(GET_LIST_HEAD(Mcb->Mapping), &Existing->Sequence); + } + } + + return !!Existing; } /* @@ -45,6 +134,8 @@ IN LONGLONG SectorCount) { BOOLEAN Result; + + DPRINT1("Mcb %x Vbn %x Lbn %x SectorCount %x\n", Mcb, Vbn, Lbn, SectorCount); KeAcquireGuardedMutex(Mcb->GuardedMutex); Result = FsRtlAddBaseMcbEntry(&(Mcb->BaseMcb), @@ -67,11 +158,26 @@ OUT PLONGLONG Lbn, OUT PLONGLONG SectorCount) { - KeBugCheck(FILE_SYSTEM); - *Vbn = 0; - *Lbn = 0; - *SectorCount= 0; - return FALSE; + ULONG i = 0; + BOOLEAN Result = FALSE; + PLARGE_MCB_MAPPING_ENTRY Entry; + for (Entry = (PLARGE_MCB_MAPPING_ENTRY) + RtlEnumerateGenericTable(Mcb->Mapping, TRUE); + Entry && i < RunIndex; + Entry = (PLARGE_MCB_MAPPING_ENTRY) + RtlEnumerateGenericTable(Mcb->Mapping, FALSE), i++); + if (Entry) + { + Result = TRUE; + if (Vbn) + *Vbn = Entry->RunStartVbn.QuadPart; + if (Lbn) + *Lbn = Entry->StartingLbn.QuadPart; + if (SectorCount) + *SectorCount = Entry->SectorCount.QuadPart; + } + + return Result; } /* @@ -115,12 +221,19 @@ else { Mcb->Mapping = ExAllocatePoolWithTag(PoolType | POOL_RAISE_IF_ALLOCATION_FAILURE, - sizeof(INT_MAPPING) * MAXIMUM_PAIR_COUNT, - TAG('F', 'S', 'B', 'C')); + sizeof(RTL_GENERIC_TABLE) + sizeof(LIST_ENTRY), + 'FSBC'); } Mcb->PoolType = PoolType; Mcb->MaximumPairCount = MAXIMUM_PAIR_COUNT; + RtlInitializeGenericTable + (Mcb->Mapping, + (PRTL_GENERIC_COMPARE_ROUTINE)McbMappingCompare, + McbMappingAllocate, + McbMappingFree, + Mcb); + InitializeListHead(GET_LIST_HEAD(Mcb->Mapping)); } /* @@ -160,7 +273,7 @@ NULL, NULL, POOL_RAISE_IF_ALLOCATION_FAILURE, - sizeof(INT_MAPPING) * MAXIMUM_PAIR_COUNT, + sizeof(RTL_GENERIC_TABLE) + sizeof(LIST_ENTRY), IFS_POOL_TAG, 0); /* FIXME: Should be 4 */ @@ -187,10 +300,42 @@ OUT PLONGLONG SectorCountFromStartingLbn OPTIONAL, OUT PULONG Index OPTIONAL) { - KeBugCheck(FILE_SYSTEM); - *Lbn = 0; - *SectorCountFromLbn = 0; - return FALSE; + BOOLEAN Result = FALSE; + LARGE_MCB_MAPPING_ENTRY ToLookup; + PLARGE_MCB_MAPPING_ENTRY Entry; + + ToLookup.RunStartVbn.QuadPart = Vbn; + ToLookup.SectorCount.QuadPart = 1; + + Entry = RtlLookupElementGenericTable(Mcb->Mapping, &ToLookup); + if (!Entry) + { + // Find out if we have a following entry. The spec says we should return + // found with Lbn == -1 when we're beneath the largest map. + ToLookup.SectorCount.QuadPart = (1ull<<62) - ToLookup.RunStartVbn.QuadPart; + Entry = RtlLookupElementGenericTable(Mcb->Mapping, &ToLookup); + if (Entry) + { + Result = TRUE; + if (Lbn) *Lbn = ~0ull; + } + else + { + Result = FALSE; + } + } + else + { + LARGE_INTEGER Offset; + Offset.QuadPart = Vbn - Entry->RunStartVbn.QuadPart; + Result = TRUE; + if (Lbn) *Lbn = Entry->StartingLbn.QuadPart + Offset.QuadPart; + if (SectorCountFromLbn) *SectorCountFromLbn = Entry->SectorCount.QuadPart - Offset.QuadPart; + if (StartingLbn) *StartingLbn = Entry->StartingLbn.QuadPart; + if (SectorCountFromStartingLbn) *SectorCountFromStartingLbn = Entry->SectorCount.QuadPart; + } + + return Result; } /* @@ -231,11 +376,28 @@ IN OUT PLONGLONG LargeLbn, IN OUT PULONG Index) { - KeBugCheck(FILE_SYSTEM); - *LargeVbn = 0; - *LargeLbn = 0; - *Index = 0; - return FALSE; + ULONG i = 0; + BOOLEAN Result = FALSE; + PLIST_ENTRY ListEntry; + PLARGE_MCB_MAPPING_ENTRY Entry; + PLARGE_MCB_MAPPING_ENTRY CountEntry; + + ListEntry = GET_LIST_HEAD(OpaqueMcb->Mapping); + if (!IsListEmpty(ListEntry)) + { + Entry = CONTAINING_RECORD(ListEntry->Flink, LARGE_MCB_MAPPING_ENTRY, Sequence); + Result = TRUE; + *LargeVbn = Entry->RunStartVbn.QuadPart; + *LargeLbn = Entry->StartingLbn.QuadPart; + + for (i = 0, CountEntry = RtlEnumerateGenericTable(OpaqueMcb->Mapping, TRUE); + CountEntry != Entry; + CountEntry = RtlEnumerateGenericTable(OpaqueMcb->Mapping, FALSE)); + + *Index = i; + } + + return Result; } /* @@ -269,8 +431,20 @@ OUT PLONGLONG Vbn, OUT PLONGLONG Lbn) { - KeBugCheck(FILE_SYSTEM); - return FALSE; + BOOLEAN Result = FALSE; + PLIST_ENTRY ListEntry; + PLARGE_MCB_MAPPING_ENTRY Entry; + + ListEntry = GET_LIST_HEAD(Mcb->Mapping); + if (!IsListEmpty(ListEntry)) + { + Entry = CONTAINING_RECORD(ListEntry->Flink, LARGE_MCB_MAPPING_ENTRY, Sequence); + Result = TRUE; + *Vbn = Entry->RunStartVbn.QuadPart; + *Lbn = Entry->StartingLbn.QuadPart; + } + + return Result; } /* @@ -331,8 +505,90 @@ IN LONGLONG Vbn, IN LONGLONG SectorCount) { - KeBugCheck(FILE_SYSTEM); - return FALSE; + LARGE_MCB_MAPPING_ENTRY Node; + PLARGE_MCB_MAPPING_ENTRY Element; + + Node.RunStartVbn.QuadPart = Vbn; + Node.SectorCount.QuadPart = SectorCount; + + while ((Element = RtlLookupElementGenericTable(Mcb->Mapping, &Node))) + { + // Must split + if (Element->RunStartVbn.QuadPart < Node.RunStartVbn.QuadPart && + Element->SectorCount.QuadPart > Node.SectorCount.QuadPart) + { + LARGE_MCB_MAPPING_ENTRY Upper, Reinsert; + PLARGE_MCB_MAPPING_ENTRY Reinserted, Inserted; + LARGE_INTEGER StartHole = Node.RunStartVbn; + LARGE_INTEGER EndHole; + EndHole.QuadPart = Node.RunStartVbn.QuadPart + Node.SectorCount.QuadPart; + Upper.RunStartVbn.QuadPart = EndHole.QuadPart; + Upper.StartingLbn.QuadPart = + Element->StartingLbn.QuadPart + + EndHole.QuadPart - + Element->RunStartVbn.QuadPart; + Upper.SectorCount.QuadPart = + Element->SectorCount.QuadPart - + (EndHole.QuadPart - Element->RunStartVbn.QuadPart); + Reinsert = *Element; + Reinsert.SectorCount.QuadPart = + Element->RunStartVbn.QuadPart - StartHole.QuadPart; + RemoveEntryList(&Element->Sequence); + RtlDeleteElementGenericTable(Mcb->Mapping, Element); + Mcb->PairCount--; + + Reinserted = RtlInsertElementGenericTable + (Mcb->Mapping, &Reinsert, sizeof(Reinsert), NULL); + InsertHeadList(GET_LIST_HEAD(Mcb->Mapping), &Reinserted->Sequence); + Mcb->PairCount++; + + Inserted = RtlInsertElementGenericTable + (Mcb->Mapping, &Upper, sizeof(Upper), NULL); + InsertHeadList(GET_LIST_HEAD(Mcb->Mapping), &Inserted->Sequence); + Mcb->PairCount++; + } + else if (Element->RunStartVbn.QuadPart < Node.RunStartVbn.QuadPart) + { + LARGE_MCB_MAPPING_ENTRY NewElement; + PLARGE_MCB_MAPPING_ENTRY Reinserted; + LARGE_INTEGER StartHole = Node.RunStartVbn; + NewElement.RunStartVbn = Element->RunStartVbn; + NewElement.StartingLbn = Element->StartingLbn; + NewElement.SectorCount.QuadPart = StartHole.QuadPart - Element->StartingLbn.QuadPart; + + RemoveEntryList(&Element->Sequence); + RtlDeleteElementGenericTable(Mcb->Mapping, Element); + Mcb->PairCount--; + + Reinserted = RtlInsertElementGenericTable + (Mcb->Mapping, &NewElement, sizeof(NewElement), NULL); + InsertHeadList(GET_LIST_HEAD(Mcb->Mapping), &Reinserted->Sequence); + Mcb->PairCount++; + } + else + { + LARGE_MCB_MAPPING_ENTRY NewElement; + PLARGE_MCB_MAPPING_ENTRY Reinserted; + LARGE_INTEGER EndHole = Element->RunStartVbn; + LARGE_INTEGER EndRun; + EndRun.QuadPart = Element->RunStartVbn.QuadPart + Element->SectorCount.QuadPart; + NewElement.RunStartVbn = EndHole; + NewElement.StartingLbn.QuadPart = Element->StartingLbn.QuadPart + + (EndHole.QuadPart - Element->RunStartVbn.QuadPart); + NewElement.SectorCount.QuadPart = EndRun.QuadPart - EndHole.QuadPart; + + RemoveEntryList(&Element->Sequence); + RtlDeleteElementGenericTable(Mcb->Mapping, Element); + Mcb->PairCount--; + + Reinserted = RtlInsertElementGenericTable + (Mcb->Mapping, &NewElement, sizeof(NewElement), NULL); + InsertHeadList(GET_LIST_HEAD(Mcb->Mapping), &Reinserted->Sequence); + Mcb->PairCount++; + } + } + + return TRUE; } /* @@ -358,7 +614,16 @@ NTAPI FsRtlResetBaseMcb(IN PBASE_MCB Mcb) { - Mcb->PairCount = 0; + PLARGE_MCB_MAPPING_ENTRY Element; + + while (RtlNumberGenericTableElements(Mcb->Mapping) && + (Element = (PLARGE_MCB_MAPPING_ENTRY)RtlGetElementGenericTable(Mcb->Mapping, 0))) + { + RtlDeleteElementGenericTable(Mcb->Mapping, Element); + } + + Mcb->PairCount = 0; + Mcb->MaximumPairCount = 0; } /* @@ -372,13 +637,44 @@ if (!SelfSynchronized) { KeAcquireGuardedMutex(Mcb->GuardedMutex); - Mcb->BaseMcb.PairCount = 0; - KeReleaseGuardedMutex(Mcb->GuardedMutex); + } + + FsRtlResetBaseMcb(&Mcb->BaseMcb); + + + if (!SelfSynchronized) + { + KeReleaseGuardedMutex(Mcb->GuardedMutex); } - else - { - Mcb->BaseMcb.PairCount = 0; - } +} + +#define MCB_BUMP_NO_MORE 0 +#define MCB_BUMP_AGAIN 1 + +static ULONG NTAPI McbBump(PBASE_MCB Mcb, PLARGE_MCB_MAPPING_ENTRY FixedPart) +{ + LARGE_MCB_MAPPING_ENTRY Reimagined; + PLARGE_MCB_MAPPING_ENTRY Found = NULL; + + Reimagined = *FixedPart; + while ((Found = RtlLookupElementGenericTable(Mcb->Mapping, &Reimagined))) + { + Reimagined = *Found; + Reimagined.RunStartVbn.QuadPart = + FixedPart->RunStartVbn.QuadPart + FixedPart->SectorCount.QuadPart; + } + + if (!Found) return MCB_BUMP_NO_MORE; + DPRINT1 + ("Moving %x-%x to %x because %x-%x overlaps\n", + Found->RunStartVbn.LowPart, + Found->RunStartVbn.LowPart + Found->SectorCount.QuadPart, + Reimagined.RunStartVbn.LowPart + Reimagined.SectorCount.LowPart, + Reimagined.RunStartVbn.LowPart, + Reimagined.RunStartVbn.LowPart + Reimagined.SectorCount.LowPart); + Found->RunStartVbn.QuadPart = Reimagined.RunStartVbn.QuadPart + Reimagined.SectorCount.QuadPart; + Found->StartingLbn.QuadPart = Reimagined.StartingLbn.QuadPart + Reimagined.SectorCount.QuadPart; + return MCB_BUMP_AGAIN; } /* @@ -390,8 +686,66 @@ IN LONGLONG Vbn, IN LONGLONG Amount) { - KeBugCheck(FILE_SYSTEM); - return FALSE; + ULONG Result; + LARGE_MCB_MAPPING_ENTRY Node; + PLARGE_MCB_MAPPING_ENTRY Existing = NULL; + + Node.RunStartVbn.QuadPart = Vbn; + Node.SectorCount.QuadPart = 0; + + Existing = RtlLookupElementGenericTable(Mcb->Mapping, &Node); + + if (Existing) + { + // We're in the middle of a run + LARGE_MCB_MAPPING_ENTRY UpperPart; + LARGE_MCB_MAPPING_ENTRY LowerPart; + PLARGE_MCB_MAPPING_ENTRY InsertedUpper; + + UpperPart.RunStartVbn.QuadPart = Node.RunStartVbn.QuadPart + Amount; + UpperPart.SectorCount.QuadPart = Existing->RunStartVbn.QuadPart + + (Existing->SectorCount.QuadPart - Node.RunStartVbn.QuadPart); + UpperPart.StartingLbn.QuadPart = Existing->StartingLbn.QuadPart + + (Node.RunStartVbn.QuadPart - Existing->RunStartVbn.QuadPart); + LowerPart.RunStartVbn.QuadPart = Existing->RunStartVbn.QuadPart; + LowerPart.SectorCount.QuadPart = Node.RunStartVbn.QuadPart - Existing->RunStartVbn.QuadPart; + LowerPart.StartingLbn.QuadPart = Existing->StartingLbn.QuadPart; + + Node = UpperPart; + + while ((Result = McbBump(Mcb, &Node)) == MCB_BUMP_AGAIN); + + if (Result == MCB_BUMP_NO_MORE) + { + Node = *Existing; + RemoveHeadList(&Existing->Sequence); + RtlDeleteElementGenericTable(Mcb->Mapping, Existing); + Mcb->PairCount--; + + // Adjust the element we found. + Existing->SectorCount = LowerPart.SectorCount; + + InsertedUpper = RtlInsertElementGenericTable + (Mcb->Mapping, &UpperPart, sizeof(UpperPart), NULL); + if (!InsertedUpper) + { + // Just make it like it was + Existing->SectorCount = Node.SectorCount; + return FALSE; + } + InsertHeadList(GET_LIST_HEAD(Mcb->Mapping), &InsertedUpper->Sequence); + Mcb->PairCount++; + } + else + { + Node.RunStartVbn.QuadPart = Vbn; + Node.SectorCount.QuadPart = Amount; + while ((Result = McbBump(Mcb, &Node)) == MCB_BUMP_AGAIN); + return Result == MCB_BUMP_NO_MORE; + } + } + + return TRUE; } /* @@ -422,7 +776,23 @@ FsRtlTruncateBaseMcb(IN PBASE_MCB Mcb, IN LONGLONG Vbn) { - KeBugCheck(FILE_SYSTEM); + if (!Vbn) + { + FsRtlResetBaseMcb(Mcb); + } + else + { + LARGE_MCB_MAPPING_ENTRY Truncate; + PLARGE_MCB_MAPPING_ENTRY Found; + Truncate.RunStartVbn.QuadPart = Vbn; + Truncate.SectorCount.QuadPart = (1ull<<62) - Truncate.RunStartVbn.QuadPart; + while ((Found = RtlLookupElementGenericTable(Mcb->Mapping, &Truncate))) + { + RemoveEntryList(&Found->Sequence); + RtlDeleteElementGenericTable(Mcb->Mapping, Found); + Mcb->PairCount--; + } + } } /* @@ -446,6 +816,8 @@ NTAPI FsRtlUninitializeBaseMcb(IN PBASE_MCB Mcb) { + FsRtlResetBaseMcb(Mcb); + if ((Mcb->PoolType == PagedPool) && (Mcb->MaximumPairCount == MAXIMUM_PAIR_COUNT)) { ExFreeToPagedLookasideList(&FsRtlFirstMappingLookasideList, @@ -453,7 +825,7 @@ } else { - ExFreePoolWithTag(Mcb->Mapping, TAG('F', 'S', 'B', 'C')); + ExFreePoolWithTag(Mcb->Mapping, 'FSBC'); } }
15 years, 1 month
1
0
0
0
[pschweitzer] 44160: Various other build fixes
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sat Nov 14 18:49:19 2009 New Revision: 44160 URL:
http://svn.reactos.org/svn/reactos?rev=44160&view=rev
Log: Various other build fixes Modified: branches/pierre-fsd/base/setup/reactos/reactos.c branches/pierre-fsd/base/setup/reactos/reactos.rbuild branches/pierre-fsd/base/setup/reactos/rsrc.rc branches/pierre-fsd/dll/win32/opengl32/gl.c branches/pierre-fsd/drivers/storage/class/ramdisk/ramdisk.c branches/pierre-fsd/drivers/storage/class/ramdisk/ramdisk.rbuild branches/pierre-fsd/include/reactos/drivers/ntddrdsk.h branches/pierre-fsd/ntoskrnl/io/iomgr/ramdisk.c Modified: branches/pierre-fsd/base/setup/reactos/reactos.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/base/setup/reactos/r…
============================================================================== --- branches/pierre-fsd/base/setup/reactos/reactos.c [iso-8859-1] (original) +++ branches/pierre-fsd/base/setup/reactos/reactos.c [iso-8859-1] Sat Nov 14 18:49:19 2009 @@ -21,7 +21,8 @@ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS GUI first stage setup application * FILE: subsys/system/reactos/reactos.c - * PROGRAMMERS: Eric Kohl, Matthias Kupfer + * PROGRAMMERS: Eric Kohl + * Matthias Kupfer * Dmitry Chapyshev (dmitry(a)reactos.org) */ @@ -152,6 +153,29 @@ return hFont; } +static VOID +InitImageInfo(PIMGINFO ImgInfo) +{ + BITMAP bitmap; + + ZeroMemory(ImgInfo, sizeof(*ImgInfo)); + + ImgInfo->hBitmap = LoadImage(hInstance, + MAKEINTRESOURCE(IDB_ROSLOGO), + IMAGE_BITMAP, + 0, + 0, + LR_DEFAULTCOLOR); + + if (ImgInfo->hBitmap != NULL) + { + GetObject(ImgInfo->hBitmap, sizeof(BITMAP), &bitmap); + + ImgInfo->cxSource = bitmap.bmWidth; + ImgInfo->cySource = bitmap.bmHeight; + } +} + static INT_PTR CALLBACK StartDlgProc(HWND hwndDlg, UINT uMsg, Modified: branches/pierre-fsd/base/setup/reactos/reactos.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/base/setup/reactos/r…
============================================================================== --- branches/pierre-fsd/base/setup/reactos/reactos.rbuild [iso-8859-1] (original) +++ branches/pierre-fsd/base/setup/reactos/reactos.rbuild [iso-8859-1] Sat Nov 14 18:49:19 2009 @@ -7,6 +7,7 @@ <library>gdi32</library> <library>user32</library> <library>comctl32</library> + <library>setupapi</library> <library>uuid</library> <file>reactos.c</file> <file>reactos.rc</file> Modified: branches/pierre-fsd/base/setup/reactos/rsrc.rc URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/base/setup/reactos/r…
============================================================================== --- branches/pierre-fsd/base/setup/reactos/rsrc.rc [iso-8859-1] (original) +++ branches/pierre-fsd/base/setup/reactos/rsrc.rc [iso-8859-1] Sat Nov 14 18:49:19 2009 @@ -21,7 +21,7 @@ #include "lang/pt-BR.rc" #include "lang/ru-RU.rc" #include "lang/sk-SK.rc" -#include "lang/sv-SE.rc" +/*#include "lang/sv-SE.rc" #include "lang/th-TH.rc"*/ #include "lang/uk-UA.rc" //#include "lang/zh-CN.rc" Modified: branches/pierre-fsd/dll/win32/opengl32/gl.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/dll/win32/opengl32/g…
============================================================================== --- branches/pierre-fsd/dll/win32/opengl32/gl.c [iso-8859-1] (original) +++ branches/pierre-fsd/dll/win32/opengl32/gl.c [iso-8859-1] Sat Nov 14 18:49:19 2009 @@ -19,11 +19,8 @@ * * On other machines we use C to forward the calls (slow...) */ - -#define WIN32_LEANER_AND_MEANER -#define WIN32_NO_STATUS -#include <windows.h> -#include "teb.h" + +#include "opengl32.h" C_ASSERT(FIELD_OFFSET(TEB, glTable) == 0xbe8); Modified: branches/pierre-fsd/drivers/storage/class/ramdisk/ramdisk.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/storage/clas…
============================================================================== --- branches/pierre-fsd/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ branches/pierre-fsd/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Sat Nov 14 18:49:19 2009 @@ -11,8 +11,10 @@ #include <initguid.h> #include <ntddk.h> #include <ntdddisk.h> +#include <ntddcdrm.h> #include <scsi.h> #include <ntddscsi.h> +#include <ntddvol.h> #include <mountdev.h> #include <mountmgr.h> #include <ketypes.h> @@ -20,15 +22,25 @@ #include <rtlfuncs.h> #include <arc/arc.h> #include <reactos/drivers/ntddrdsk.h> +#include "../../../filesystems/fs_rec/fs_rec.h" +#include <stdio.h> #define NDEBUG #include <debug.h> /* GLOBALS ********************************************************************/ +#define RAMDISK_SESSION_SIZE \ + FIELD_OFFSET(CDROM_TOC, TrackData) + sizeof(TRACK_DATA) + +#define RAMDISK_TOC_SIZE \ + FIELD_OFFSET(CDROM_TOC, TrackData) + 2 * sizeof(TRACK_DATA) + +#define TOC_DATA_TRACK (0x04) + typedef enum _RAMDISK_DEVICE_TYPE { - RamdiskFdo, - RamdiskPdo + RamdiskBus, + RamdiskDrive } RAMDISK_DEVICE_TYPE; typedef enum _RAMDISK_DEVICE_STATE @@ -39,6 +51,7 @@ RamdiskStateStopped, RamdiskStateRemoved, RamdiskStateBusRemoved, + RamdiskStateEnumerated, } RAMDISK_DEVICE_STATE; DEFINE_GUID(RamdiskBusInterface, @@ -55,10 +68,46 @@ PDEVICE_OBJECT PhysicalDeviceObject; PDEVICE_OBJECT AttachedDevice; IO_REMOVE_LOCK RemoveLock; + UNICODE_STRING DriveDeviceName; + UNICODE_STRING BusDeviceName; + FAST_MUTEX DiskListLock; + LIST_ENTRY DiskList; +} RAMDISK_EXTENSION, *PRAMDISK_EXTENSION; + +typedef struct _RAMDISK_BUS_EXTENSION +{ + RAMDISK_EXTENSION; +} RAMDISK_BUS_EXTENSION, *PRAMDISK_BUS_EXTENSION; + +typedef struct _RAMDISK_DRIVE_EXTENSION +{ + // + // Inherited base class + // + RAMDISK_EXTENSION; + + // + // Data we get from the creator + // + GUID DiskGuid; + UNICODE_STRING GuidString; UNICODE_STRING SymbolicLinkName; - FAST_MUTEX DiskListLock; - LIST_ENTRY DiskListHead; -} RAMDISK_EXTENSION, *PRAMDISK_EXTENSION; + ULONG DiskType; + RAMDISK_CREATE_OPTIONS DiskOptions; + LARGE_INTEGER DiskLength; + LONG DiskOffset; + WCHAR DriveLetter; + ULONG BasePage; + + // + // Data we get from the disk + // + ULONG BytesPerSector; + ULONG SectorsPerTrack; + ULONG NumberOfHeads; + ULONG Cylinders; + ULONG HiddenSectors; +} RAMDISK_DRIVE_EXTENSION, *PRAMDISK_DRIVE_EXTENSION; ULONG MaximumViewLength; ULONG MaximumPerDiskViewLength; @@ -230,37 +279,495 @@ } } +PVOID +NTAPI +RamdiskMapPages(IN PRAMDISK_DRIVE_EXTENSION DeviceExtension, + IN LARGE_INTEGER Offset, + IN ULONG Length, + OUT PULONG OutputLength) +{ + PHYSICAL_ADDRESS PhysicalAddress; + PVOID MappedBase; + ULONG PageOffset; + SIZE_T ActualLength; + LARGE_INTEGER ActualOffset; + LARGE_INTEGER ActualPages; + + // + // We only support boot disks for now + // + ASSERT(DeviceExtension->DiskType == RAMDISK_BOOT_DISK); + + // + // Calculate the actual offset in the drive + // + ActualOffset.QuadPart = DeviceExtension->DiskOffset + Offset.QuadPart; + + // + // Convert to pages + // + ActualPages.QuadPart = ActualOffset.QuadPart >> PAGE_SHIFT; + + // + // Now add the base page + // + ActualPages.QuadPart = DeviceExtension->BasePage + ActualPages.QuadPart; + + // + // Calculate final amount of bytes + // + PhysicalAddress.QuadPart = ActualPages.QuadPart << PAGE_SHIFT; + + // + // Calculate pages spanned for the mapping + // + ActualLength = ADDRESS_AND_SIZE_TO_SPAN_PAGES(ActualOffset.QuadPart, Length); + + // + // And convert this back to bytes + // + ActualLength <<= PAGE_SHIFT; + + // + // Get the offset within the page + // + PageOffset = BYTE_OFFSET(ActualOffset.QuadPart); + + // + // Map the I/O Space from the loader + // + MappedBase = MmMapIoSpace(PhysicalAddress, ActualLength, MmCached); + + // + // Return actual offset within the page as well as the length + // + if (MappedBase) MappedBase = (PVOID)((ULONG_PTR)MappedBase + PageOffset); + *OutputLength = Length; + return MappedBase; +} + +VOID +NTAPI +RamdiskUnmapPages(IN PRAMDISK_DRIVE_EXTENSION DeviceExtension, + IN PVOID BaseAddress, + IN LARGE_INTEGER Offset, + IN ULONG Length) +{ + LARGE_INTEGER ActualOffset; + SIZE_T ActualLength; + ULONG PageOffset; + + // + // We only support boot disks for now + // + ASSERT(DeviceExtension->DiskType == RAMDISK_BOOT_DISK); + + // + // Calculate the actual offset in the drive + // + ActualOffset.QuadPart = DeviceExtension->DiskOffset + Offset.QuadPart; + + // + // Calculate pages spanned for the mapping + // + ActualLength = ADDRESS_AND_SIZE_TO_SPAN_PAGES(ActualOffset.QuadPart, Length); + + // + // And convert this back to bytes + // + ActualLength <<= PAGE_SHIFT; + + // + // Get the offset within the page + // + PageOffset = BYTE_OFFSET(ActualOffset.QuadPart); + + // + // Calculate actual base address where we mapped this + // + BaseAddress = (PVOID)((ULONG_PTR)BaseAddress - PageOffset); + + // + // Unmap the I/O space we got from the loader + // + MmUnmapIoSpace(BaseAddress, ActualLength); +} + NTSTATUS NTAPI -RamdiskOpenClose(IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp) -{ - // - // Complete the IRP - // - Irp->IoStatus.Information = 1; - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -RamdiskReadWrite(IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp) -{ - UNIMPLEMENTED; - while (TRUE); - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -RamdiskCreateDiskDevice(IN PRAMDISK_EXTENSION DeviceExtension, +RamdiskCreateDiskDevice(IN PRAMDISK_BUS_EXTENSION DeviceExtension, IN PRAMDISK_CREATE_INPUT Input, IN BOOLEAN ValidateOnly, - OUT PDEVICE_OBJECT *DeviceObject) -{ + OUT PRAMDISK_DRIVE_EXTENSION *NewDriveExtension) +{ + ULONG BasePage, ViewCount, DiskType, Length; + NTSTATUS Status; + PDEVICE_OBJECT DeviceObject; + PRAMDISK_DRIVE_EXTENSION DriveExtension; + PVOID Buffer; + WCHAR LocalBuffer[16]; + UNICODE_STRING SymbolicLinkName, DriveString, GuidString, DeviceName; + PPACKED_BOOT_SECTOR BootSector; + BIOS_PARAMETER_BLOCK BiosBlock; + ULONG BytesPerSector, SectorsPerTrack, Heads, BytesRead; + PVOID BaseAddress; + LARGE_INTEGER CurrentOffset, CylinderSize, DiskLength; + ULONG CylinderCount, SizeByCylinders; + + // + // Check if we're a boot RAM disk + // + DiskType = Input->DiskType; + if (DiskType >= RAMDISK_BOOT_DISK) + { + // + // Check if we're an ISO + // + if (DiskType == RAMDISK_BOOT_DISK) + { + // + // NTLDR mounted us somewhere + // + BasePage = Input->BasePage; + if (!BasePage) return STATUS_INVALID_PARAMETER; + + // + // Sanitize disk options + // + Input->Options.Fixed = TRUE; + Input->Options.Readonly = Input->Options.ExportAsCd | + Input->Options.Readonly; + Input->Options.Hidden = FALSE; + Input->Options.NoDosDevice = FALSE; + Input->Options.NoDriveLetter = IsWinPEBoot ? TRUE : FALSE; + } + else + { + // + // The only other possibility is a WIM disk + // + if (DiskType != RAMDISK_WIM_DISK) + { + // + // Fail + // + return STATUS_INVALID_PARAMETER; + } + + // + // Read the view count instead + // + ViewCount = Input->ViewCount; + + // + // Sanitize disk options + // + Input->Options.Hidden = FALSE; + Input->Options.NoDosDevice = FALSE; + Input->Options.Readonly = FALSE; + Input->Options.NoDriveLetter = TRUE; + Input->Options.Fixed = TRUE; + } + + // + // Are we just validating and returning to the user? + // + if (ValidateOnly) return STATUS_SUCCESS; + + // + // Build the GUID string + // + Status = RtlStringFromGUID(&Input->DiskGuid, &GuidString); + if (!(NT_SUCCESS(Status)) || !(GuidString.Buffer)) + { + // + // Fail + // + Status = STATUS_INSUFFICIENT_RESOURCES; + goto FailCreate; + } + + // + // Allocate our device name + // + Length = GuidString.Length + 32; + Buffer = ExAllocatePoolWithTag(NonPagedPool, + Length, + TAG('R', 'a', 'm', 'd')); + if (!Buffer) + { + // + // Fail + // + Status = STATUS_INSUFFICIENT_RESOURCES; + goto FailCreate; + } + + // + // Build the device name string + // + DeviceName.Buffer = Buffer; + DeviceName.Length = Length - 2; + DeviceName.MaximumLength = Length; + wcsncpy(Buffer, L"\\Device\\Ramdisk", Length / sizeof(WCHAR)); + wcsncat(Buffer, GuidString.Buffer, Length / sizeof(WCHAR)); + + // + // Create the drive device + // + Status = IoCreateDevice(DeviceExtension->DeviceObject->DriverObject, + sizeof(RAMDISK_DRIVE_EXTENSION), + &DeviceName, + (Input->Options.ExportAsCd) ? + FILE_DEVICE_CD_ROM : FILE_DEVICE_DISK, + 0, + 0, + &DeviceObject); + if (!NT_SUCCESS(Status)) goto FailCreate; + + // + // Grab the drive extension + // + DriveExtension = DeviceObject->DeviceExtension; + + // + // Check if we need a DOS device + // + if (!Input->Options.NoDosDevice) + { + // + // Build the symbolic link name + // + SymbolicLinkName.MaximumLength = GuidString.Length + 36; + SymbolicLinkName.Length = GuidString.Length + 34; + Buffer = ExAllocatePoolWithTag(NonPagedPool, + SymbolicLinkName.MaximumLength, + TAG('R', 'a', 'm', 'd')); + SymbolicLinkName.Buffer = Buffer; + if (Buffer) + { + // + // Create it + // + wcsncpy(Buffer, + L"\\GLOBAL??\\Ramdisk", + SymbolicLinkName.MaximumLength / sizeof(WCHAR)); + wcsncat(Buffer, + GuidString.Buffer, + SymbolicLinkName.MaximumLength / sizeof(WCHAR)); + Status = IoCreateSymbolicLink(&SymbolicLinkName, &DeviceName); + if (!NT_SUCCESS(Status)) + { + // + // Nevermind... + // + Input->Options.NoDosDevice = TRUE; + ExFreePool(Buffer); + SymbolicLinkName.Buffer = NULL; + } + } + else + { + // + // No DOS device + // + Input->Options.NoDosDevice = TRUE; + } + + // + // It this an ISO boot ramdisk? + // + if (Input->DiskType == RAMDISK_BOOT_DISK) + { + // + // Does it need a drive letter? + // + if (!Input->Options.NoDriveLetter) + { + // + // Build it and take over the existing symbolic link + // + _snwprintf(LocalBuffer, + 30, + L"\\DosDevices\\%wc:", + Input->DriveLetter); + RtlInitUnicodeString(&DriveString, LocalBuffer); + IoDeleteSymbolicLink(&DriveString); + IoCreateSymbolicLink(&DriveString, &DeviceName); + + // + // Save the drive letter + // + DriveExtension->DriveLetter = Input->DriveLetter; + } + } + + } + + // + // Setup the device object flags + // + DeviceObject->Flags |= (DO_XIP | DO_POWER_PAGABLE | DO_DIRECT_IO); + DeviceObject->AlignmentRequirement = 1; + + // + // Build the drive FDO + // + *NewDriveExtension = DriveExtension; + DriveExtension->Type = RamdiskDrive; + DiskLength = Input->DiskLength; + ExInitializeFastMutex(&DriveExtension->DiskListLock); + IoInitializeRemoveLock(&DriveExtension->RemoveLock, + TAG('R', 'a', 'm', 'd'), + 0, + 1); + DriveExtension->DriveDeviceName = DeviceName; + DriveExtension->SymbolicLinkName = SymbolicLinkName; + DriveExtension->GuidString = GuidString; + DriveExtension->DiskGuid = Input->DiskGuid; + DriveExtension->PhysicalDeviceObject = DeviceObject; + DriveExtension->DeviceObject = RamdiskBusFdo; + DriveExtension->AttachedDevice = RamdiskBusFdo; + DriveExtension->DiskType = Input->DiskType; + DriveExtension->DiskOptions = Input->Options; + DriveExtension->DiskLength = DiskLength; + DriveExtension->DiskOffset = Input->DiskOffset; + DriveExtension->BasePage = Input->BasePage; + DriveExtension->BytesPerSector = 0; + DriveExtension->SectorsPerTrack = 0; + DriveExtension->NumberOfHeads = 0; + + // + // Make sure we don't free it later + // + DeviceName.Buffer = NULL; + SymbolicLinkName.Buffer = NULL; + GuidString.Buffer = NULL; + + // + // Check if this is an boot disk, or a registry ram drive + // + if (!(Input->Options.ExportAsCd) && + (Input->DiskType == RAMDISK_BOOT_DISK)) + { + // + // Not an ISO boot, but it's a boot FS -- map it to figure out the + // drive settings + // + CurrentOffset.QuadPart = 0; + BaseAddress = RamdiskMapPages(DriveExtension, + CurrentOffset, + PAGE_SIZE, + &BytesRead); + if (BaseAddress) + { + // + // Get the data + // + BootSector = (PPACKED_BOOT_SECTOR)BaseAddress; + FatUnpackBios(&BiosBlock, &BootSector->PackedBpb); + BytesPerSector = BiosBlock.BytesPerSector; + SectorsPerTrack = BiosBlock.SectorsPerTrack; + Heads = BiosBlock.Heads; + + // + // Save it + // + DriveExtension->BytesPerSector = BytesPerSector; + DriveExtension->SectorsPerTrack = SectorsPerTrack; + DriveExtension->NumberOfHeads = Heads; + + // + // Unmap now + // + CurrentOffset.QuadPart = 0; + RamdiskUnmapPages(DriveExtension, + BaseAddress, + CurrentOffset, + BytesRead); + } + else + { + // + // Fail + // + Status = STATUS_INSUFFICIENT_RESOURCES; + goto FailCreate; + } + } + + // + // Check if the drive settings haven't been set yet + // + if ((DriveExtension->BytesPerSector == 0) || + (DriveExtension->SectorsPerTrack == 0) || + (DriveExtension->NumberOfHeads == 0)) + { + // + // Check if this is a CD + // + if (Input->Options.ExportAsCd) + { + // + // Setup partition parameters default for ISO 9660 + // + DriveExtension->BytesPerSector = 2048; + DriveExtension->SectorsPerTrack = 32; + DriveExtension->NumberOfHeads = 64; + } + else + { + // + // Setup partition parameters default for FAT + // + DriveExtension->BytesPerSector = 512; + DriveExtension->SectorsPerTrack = 128; + DriveExtension->NumberOfHeads = 16; + } + } + + // + // Calculate the cylinder size + // + CylinderSize.QuadPart = DriveExtension->BytesPerSector * + DriveExtension->SectorsPerTrack * + DriveExtension->NumberOfHeads; + CylinderCount = DiskLength.QuadPart / CylinderSize.QuadPart; + SizeByCylinders = CylinderSize.QuadPart * CylinderCount; + DriveExtension->Cylinders = CylinderCount; + if ((DiskLength.HighPart > 0) || (SizeByCylinders < DiskLength.LowPart)) + { + // + // Align cylinder size up + // + DriveExtension->Cylinders++; + } + + // + // Acquire the disk lock + // + KeEnterCriticalRegion(); + ExAcquireFastMutex(&DeviceExtension->DiskListLock); + + // + // Insert us + // + InsertTailList(&DeviceExtension->DiskList, &DriveExtension->DiskList); + + // + // Release the lock + // + ExReleaseFastMutex(&DeviceExtension->DiskListLock); + KeLeaveCriticalRegion(); + + // + // Clear init flag + // + DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; + return STATUS_SUCCESS; + } + +FailCreate: UNIMPLEMENTED; while (TRUE); return STATUS_SUCCESS; @@ -274,7 +781,8 @@ { PRAMDISK_CREATE_INPUT Input; ULONG Length; - PRAMDISK_EXTENSION DeviceExtension; + PRAMDISK_BUS_EXTENSION DeviceExtension; + PRAMDISK_DRIVE_EXTENSION DriveExtension; ULONG DiskType; PWCHAR FileNameStart, FileNameEnd; NTSTATUS Status; @@ -283,7 +791,7 @@ // // Get the device extension and our input data // - DeviceExtension = (PRAMDISK_EXTENSION)DeviceObject->DeviceExtension; + DeviceExtension = DeviceObject->DeviceExtension; Length = IoStackLocation->Parameters.DeviceIoControl.InputBufferLength; Input = (PRAMDISK_CREATE_INPUT)Irp->AssociatedIrp.SystemBuffer; @@ -303,12 +811,12 @@ // Validate the disk type // DiskType = Input->DiskType; - if (DiskType == FILE_DEVICE_CONTROLLER) return STATUS_INVALID_PARAMETER; + if (DiskType == RAMDISK_WIM_DISK) return STATUS_INVALID_PARAMETER; // // Look at the disk type // - if (DiskType == FILE_DEVICE_CD_ROM_FILE_SYSTEM) + if (DiskType == RAMDISK_BOOT_DISK) { // // We only allow this as an early-init boot @@ -325,18 +833,18 @@ // // Validate the disk type // - if ((Input->Options.ExportAsCd) && (DiskType != FILE_DEVICE_CD_ROM_FILE_SYSTEM)) + if ((Input->Options.ExportAsCd) && (DiskType != RAMDISK_BOOT_DISK)) { // // If the type isn't CDFS, it has to at least be raw CD // - if (DiskType != FILE_DEVICE_CD_ROM) return STATUS_INVALID_PARAMETER; + if (DiskType != RAMDISK_MEMORY_MAPPED_DISK) return STATUS_INVALID_PARAMETER; } // // Check if this is an actual file // - if (DiskType <= FILE_DEVICE_CD_ROM) + if (DiskType <= RAMDISK_MEMORY_MAPPED_DISK) { // // Validate the file name @@ -353,7 +861,7 @@ Status = RamdiskCreateDiskDevice(DeviceExtension, Input, ValidateOnly, - &DeviceObject); + &DriveExtension); if (NT_SUCCESS(Status)) { // @@ -367,6 +875,152 @@ // We're done // return Status; +} + +VOID +NTAPI +RamdiskWorkerThread(IN PDEVICE_OBJECT DeviceObject, + IN PVOID Context) +{ + PRAMDISK_BUS_EXTENSION DeviceExtension; + NTSTATUS Status; + PIO_STACK_LOCATION IoStackLocation; + PIRP Irp = Context; + + // + // Get the stack location + // + IoStackLocation = IoGetCurrentIrpStackLocation(Irp); + + // + // Free the work item + // + IoFreeWorkItem(Irp->Tail.Overlay.DriverContext[0]); + + // + // Grab the device extension and lock it + // + DeviceExtension = DeviceObject->DeviceExtension; + Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, Irp); + if (NT_SUCCESS(Status)) + { + // + // Discriminate by major code + // + switch (IoStackLocation->MajorFunction) + { + // + // Device control + // + case IRP_MJ_DEVICE_CONTROL: + + // + // Let's take a look at the IOCTL + // + switch (IoStackLocation->Parameters.DeviceIoControl.IoControlCode) + { + // + // Ramdisk create request + // + case FSCTL_CREATE_RAM_DISK: + + // + // This time we'll do it for real + // + Status = RamdiskCreateRamdisk(DeviceObject, Irp, FALSE); + break; + + case IOCTL_DISK_SET_PARTITION_INFO: + + DPRINT1("Set partition info request\n"); + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_DISK_GET_DRIVE_LAYOUT: + + DPRINT1("Get drive layout request\n"); + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_DISK_GET_PARTITION_INFO: + + DPRINT1("Get partitinon info request\n"); + UNIMPLEMENTED; + while (TRUE); + break; + + default: + + DPRINT1("Invalid request\n"); + UNIMPLEMENTED; + while (TRUE); + break; + } + + // + // We're here + // + break; + + // + // Read or write request + // + case IRP_MJ_READ: + case IRP_MJ_WRITE: + + DPRINT1("Read/Write request\n"); + UNIMPLEMENTED; + while (TRUE); + break; + + // + // Internal request (SCSI?) + // + case IRP_MJ_INTERNAL_DEVICE_CONTROL: + + DPRINT1("SCSI request\n"); + UNIMPLEMENTED; + while (TRUE); + break; + + // + // Flush request + // + case IRP_MJ_FLUSH_BUFFERS: + + DPRINT1("Flush request\n"); + UNIMPLEMENTED; + while (TRUE); + break; + + // + // Anything else + // + default: + + DPRINT1("Invalid request: %lx\n", IoStackLocation->MajorFunction); + UNIMPLEMENTED; + while (TRUE); + break; + } + + // + // Complete the I/O + // + IoReleaseRemoveLock(&DeviceExtension->RemoveLock, Irp); + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + return IoCompleteRequest(Irp, IO_DISK_INCREMENT); + } + + // + // Fail the I/O + // + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + return IoCompleteRequest(Irp, IO_NO_INCREMENT); } NTSTATUS @@ -721,8 +1375,11 @@ { NTSTATUS Status; PIO_STACK_LOCATION IoStackLocation = IoGetCurrentIrpStackLocation(Irp); - PRAMDISK_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; - ULONG Information = 0; + PRAMDISK_BUS_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + PRAMDISK_DRIVE_EXTENSION DriveExtension = (PVOID)DeviceExtension; + ULONG Information; + PCDROM_TOC Toc; + PDISK_GEOMETRY DiskGeometry; // // Grab the remove lock @@ -740,9 +1397,15 @@ } // - // Check if this is an FDO or PDO - // - if (DeviceExtension->Type == RamdiskFdo) + // Setup some defaults + // + Status = STATUS_INVALID_DEVICE_REQUEST; + Information = 0; + + // + // Check if this is an bus device or the drive + // + if (DeviceExtension->Type == RamdiskBus) { // // Check what the request is @@ -773,16 +1436,266 @@ else { // - // PDO code not yet done - // - ASSERT(FALSE); + // Check what the request is + // + switch (IoStackLocation->Parameters.DeviceIoControl.IoControlCode) + { + case IOCTL_DISK_CHECK_VERIFY: + case IOCTL_STORAGE_CHECK_VERIFY: + case IOCTL_STORAGE_CHECK_VERIFY2: + case IOCTL_CDROM_CHECK_VERIFY: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_STORAGE_GET_MEDIA_TYPES: + case IOCTL_DISK_GET_MEDIA_TYPES: + case IOCTL_DISK_GET_DRIVE_GEOMETRY: + case IOCTL_CDROM_GET_DRIVE_GEOMETRY: + + // + // Validate the length + // + if (IoStackLocation->Parameters.DeviceIoControl. + OutputBufferLength < sizeof(DISK_GEOMETRY)) + { + // + // Invalid length + // + Status = STATUS_BUFFER_TOO_SMALL; + break; + } + + // + // Fill it out + // + DiskGeometry = Irp->AssociatedIrp.SystemBuffer; + DiskGeometry->Cylinders.QuadPart = DriveExtension->Cylinders; + DiskGeometry->BytesPerSector = DriveExtension->BytesPerSector; + DiskGeometry->SectorsPerTrack = DriveExtension->SectorsPerTrack; + DiskGeometry->TracksPerCylinder = DriveExtension->NumberOfHeads; + DiskGeometry->MediaType = DriveExtension->DiskOptions.Fixed ? + FixedMedia : RemovableMedia; + + // + // We're done + // + Status = STATUS_SUCCESS; + Information = sizeof(DISK_GEOMETRY); + break; + + // + // Hack to support ReactOS's broken CDFS + // + case IOCTL_CDROM_GET_LAST_SESSION: + + // + // Validate the length + // + if (IoStackLocation->Parameters.DeviceIoControl. + OutputBufferLength < RAMDISK_SESSION_SIZE) + { + // + // Invalid length + // + Status = STATUS_BUFFER_TOO_SMALL; + break; + } + + // + // Fill out the TOC + // + Toc = Irp->AssociatedIrp.SystemBuffer; + Toc->Length[0] = 0; + Toc->Length[1] = RAMDISK_SESSION_SIZE - sizeof(Toc->Length); + Toc->FirstTrack = 1; + Toc->LastTrack = 1; + Toc->TrackData[0].Adr = 1; + Toc->TrackData[0].Control = TOC_DATA_TRACK; + Toc->TrackData[0].TrackNumber = 1; + Toc->TrackData[0].Address[0] = + Toc->TrackData[0].Address[1] = + Toc->TrackData[0].Address[2] = + Toc->TrackData[0].Address[3] = 0; + + // + // We're done + // + Status = STATUS_SUCCESS; + Information = RAMDISK_SESSION_SIZE; + break; + + case IOCTL_CDROM_READ_TOC: + + // + // Validate the length + // + if (IoStackLocation->Parameters.DeviceIoControl. + OutputBufferLength < sizeof(CDROM_TOC)) + { + // + // Invalid length + // + Status = STATUS_BUFFER_TOO_SMALL; + break; + } + + // + // Clear the TOC + // + Toc = Irp->AssociatedIrp.SystemBuffer; + RtlZeroMemory(Toc, sizeof(CDROM_TOC)); + + // + // Fill it out + // + Toc->Length[0] = 0; + Toc->Length[1] = RAMDISK_TOC_SIZE - sizeof(Toc->Length); + Toc->FirstTrack = 1; + Toc->LastTrack = 1; + Toc->TrackData[0].Adr = 1; + Toc->TrackData[0].Control = TOC_DATA_TRACK; + Toc->TrackData[0].TrackNumber = 1; + + // + // We're done + // + Status = STATUS_SUCCESS; + Information = RAMDISK_TOC_SIZE; + break; + + case IOCTL_DISK_SET_PARTITION_INFO: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_DISK_GET_PARTITION_INFO: + + // + // Validate the length + // + if (IoStackLocation->Parameters.DeviceIoControl. + OutputBufferLength < sizeof(PARTITION_INFORMATION)) + { + // + // Invalid length + // + Status = STATUS_BUFFER_TOO_SMALL; + break; + } + + // + // Check if we need to do this sync or async + // + if (DriveExtension->DiskType > RAMDISK_MEMORY_MAPPED_DISK) + { + // + // Call the helper function + // + Status = RamdiskGetPartitionInfo(Irp, DriveExtension); + } + else + { + // + // Do it asynchronously later + // + goto CallWorker; + } + + // + // We're done + // + Information = Irp->IoStatus.Information; + break; + + case IOCTL_DISK_GET_DRIVE_LAYOUT: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_DISK_GET_LENGTH_INFO: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_DISK_IS_WRITABLE: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_SCSI_MINIPORT: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_STORAGE_QUERY_PROPERTY: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_MOUNTDEV_QUERY_UNIQUE_ID: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_MOUNTDEV_QUERY_STABLE_GUID: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_VOLUME_SET_GPT_ATTRIBUTES: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_VOLUME_GET_GPT_ATTRIBUTES: + + UNIMPLEMENTED; + while (TRUE); + break; + + case IOCTL_VOLUME_OFFLINE: + + UNIMPLEMENTED; + while (TRUE); + break; + + default: + + // + // Drive code not emulated + // + DPRINT1("IOCTL: %lx\n", IoStackLocation->Parameters.DeviceIoControl.IoControlCode); + break; + } + + // + // If requests drop down here, we just return them complete them + // + goto CompleteRequest; } // // Queue the request to our worker thread // - UNIMPLEMENTED; - while (TRUE); +CallWorker: + Status = SendIrpToThread(DeviceObject, Irp); CompleteRequest: // @@ -803,6 +1716,211 @@ // Return status // return Status; +} + +NTSTATUS +NTAPI +RamdiskQueryDeviceRelations(IN DEVICE_RELATION_TYPE Type, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PRAMDISK_BUS_EXTENSION DeviceExtension; + PRAMDISK_DRIVE_EXTENSION DriveExtension; + PDEVICE_RELATIONS DeviceRelations, OurDeviceRelations; + ULONG Count, DiskCount, FinalCount; + PLIST_ENTRY ListHead, NextEntry; + PDEVICE_OBJECT* DriveDeviceObject; + RAMDISK_DEVICE_STATE State; + + // + // Get the device extension and check if this is a drive + // + DeviceExtension = DeviceObject->DeviceExtension; + if (DeviceExtension->Type == RamdiskDrive) + { + // + // FIXME: TODO + // + UNIMPLEMENTED; + while (TRUE); + } + + // + // Anything but bus relations, we don't handle + // + if (Type) goto PassToNext; + + // + // Acquire the disk list lock + // + KeEnterCriticalRegion(); + ExAcquireFastMutex(&DeviceExtension->DiskListLock); + + // + // Did a device already fill relations? + // + DeviceRelations = (PDEVICE_RELATIONS)Irp->IoStatus.Information; + if (DeviceRelations) + { + // + // Use the data + // + Count = DeviceRelations->Count; + } + else + { + // + // We're the first + // + Count = 0; + } + + // + // Now loop our drives + // + DiskCount = 0; + ListHead = &DeviceExtension->DiskList; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + // + // As long as it wasn't removed, count it in + // + DriveExtension = CONTAINING_RECORD(NextEntry, + RAMDISK_DRIVE_EXTENSION, + DiskList); + if (DriveExtension->State < RamdiskStateBusRemoved) DiskCount++; + + // + // Move to the next one + // + NextEntry = NextEntry->Flink; + } + + // + // Now we know our final count + // + FinalCount = Count + DiskCount; + + // + // Allocate the structure + // + OurDeviceRelations = ExAllocatePoolWithTag(PagedPool, + FIELD_OFFSET(DEVICE_RELATIONS, + Objects) + + FinalCount * + sizeof(PDEVICE_OBJECT), + TAG('R', 'a', 'm', 'd')); + if (!OurDeviceRelations) + { + // + // Fail + // + ExReleaseFastMutex(&DeviceExtension->DiskListLock); + KeLeaveCriticalRegion(); + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INSUFFICIENT_RESOURCES; + } + + // + // Check if we already had some relations + // + if (Count) + { + // + // Copy them in + // + RtlCopyMemory(OurDeviceRelations->Objects, + DeviceRelations->Objects, + Count * sizeof(PDEVICE_OBJECT)); + } + + // + // Save the count + // + OurDeviceRelations->Count = FinalCount; + + // + // Now loop our drives again + // + ListHead = &DeviceExtension->DiskList; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + // + // Go to the end of the list + // + DriveDeviceObject = &OurDeviceRelations->Objects[Count]; + + // + // Get the drive state + // + DriveExtension = CONTAINING_RECORD(NextEntry, + RAMDISK_DRIVE_EXTENSION, + DiskList); + State = DriveExtension->State; + + // + // If it was removed or enumerated, we don't touch the device object + // + if (State >= RamdiskStateBusRemoved) + { + // + // If it was removed, we still have to keep track of this though + // + if (State == RamdiskStateBusRemoved) + { + // + // Mark it as enumerated now, but don't actually reference it + // + DriveExtension->State = RamdiskStateEnumerated; + } + } + else + { + // + // First time it's enumerated, reference the device object + // + ObReferenceObject(DriveExtension->DeviceObject); + + // + // Save the object pointer, and move on + // + *DriveDeviceObject++ = DriveExtension->DeviceObject; + } + + if (DriveExtension->State < RamdiskStateBusRemoved) DiskCount++; + + // + // Move to the next one + // + NextEntry = NextEntry->Flink; + } + + // + // Release the lock + // + ExReleaseFastMutex(&DeviceExtension->DiskListLock); + KeLeaveCriticalRegion(); + + // + // Cleanup old relations + // + if (DeviceRelations) ExFreePool(DeviceRelations); + + // + // Complete our IRP + // + Irp->IoStatus.Information = (ULONG_PTR)OurDeviceRelations; + Irp->IoStatus.Status = STATUS_SUCCESS; + + // + // Pass to the next driver + // +PassToNext: + IoCopyCurrentIrpStackLocationToNext(Irp); + return IoCallDriver(DeviceExtension->AttachedDevice, Irp); } NTSTATUS @@ -811,7 +1929,7 @@ IN PIRP Irp) { PIO_STACK_LOCATION IoStackLocation; - PRAMDISK_EXTENSION DeviceExtension; + PRAMDISK_BUS_EXTENSION DeviceExtension; NTSTATUS Status; UCHAR Minor; @@ -913,9 +2031,9 @@ case IRP_MN_QUERY_ID: // - // Are we a PDO? - // - if (DeviceExtension->Type == RamdiskPdo) + // Are we a drive? + // + if (DeviceExtension->Type == RamdiskDrive) { DPRINT1("PnP IRP: %lx\n", Minor); while (TRUE); @@ -925,9 +2043,9 @@ case IRP_MN_QUERY_BUS_INFORMATION: // - // Are we a PDO? - // - if (DeviceExtension->Type == RamdiskPdo) + // Are we a drive? + // + if (DeviceExtension->Type == RamdiskDrive) { DPRINT1("PnP IRP: %lx\n", Minor); while (TRUE); @@ -943,9 +2061,9 @@ case IRP_MN_QUERY_DEVICE_TEXT: // - // Are we a PDO? - // - if (DeviceExtension->Type == RamdiskPdo) + // Are we a drive? + // + if (DeviceExtension->Type == RamdiskDrive) { DPRINT1("PnP IRP: %lx\n", Minor); while (TRUE); @@ -954,16 +2072,22 @@ case IRP_MN_QUERY_DEVICE_RELATIONS: - DPRINT1("PnP IRP: %lx\n", Minor); - while (TRUE); - break; + // + // Call our main routine + // + Status = RamdiskQueryDeviceRelations(IoStackLocation-> + Parameters. + QueryDeviceRelations.Type, + DeviceObject, + Irp); + goto ReleaseAndReturn; case IRP_MN_QUERY_CAPABILITIES: // - // Are we a PDO? - // - if (DeviceExtension->Type == RamdiskPdo) + // Are we a drive? + // + if (DeviceExtension->Type == RamdiskDrive) { DPRINT1("PnP IRP: %lx\n", Minor); while (TRUE); @@ -986,9 +2110,9 @@ } // - // Are we an FDO? - // - if (DeviceExtension->Type == RamdiskFdo) + // Are we the bus? + // + if (DeviceExtension->Type == RamdiskBus) { // // Do we have an attached device? @@ -1064,23 +2188,23 @@ RamdiskAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject) { - PRAMDISK_EXTENSION DeviceExtension; + PRAMDISK_BUS_EXTENSION DeviceExtension; PDEVICE_OBJECT AttachedDevice; NTSTATUS Status; UNICODE_STRING DeviceName; PDEVICE_OBJECT DeviceObject; // - // Only create the FDO once + // Only create the bus FDO once // if (RamdiskBusFdo) return STATUS_DEVICE_ALREADY_ATTACHED; // - // Create the FDO + // Create the bus FDO // RtlInitUnicodeString(&DeviceName, L"\\Device\\Ramdisk"); Status = IoCreateDevice(DriverObject, - sizeof(RAMDISK_EXTENSION), + sizeof(RAMDISK_BUS_EXTENSION), &DeviceName, FILE_DEVICE_BUS_EXTENDER, FILE_DEVICE_SECURE_OPEN, @@ -1089,26 +2213,27 @@ if (NT_SUCCESS(Status)) { // - // Initialize the FDO extension - // - DeviceExtension = (PRAMDISK_EXTENSION)DeviceObject->DeviceExtension; - RtlZeroMemory(DeviceObject->DeviceExtension, sizeof(RAMDISK_EXTENSION)); - - // - // Set FDO flags + // Initialize the bus FDO extension + // + DeviceExtension = DeviceObject->DeviceExtension; + RtlZeroMemory(DeviceObject->DeviceExtension, + sizeof(RAMDISK_BUS_EXTENSION)); + + // + // Set bus FDO flags // DeviceObject->Flags |= DO_POWER_PAGABLE | DO_DIRECT_IO; // - // Setup the FDO extension - // - DeviceExtension->Type = RamdiskFdo; + // Setup the bus FDO extension + // + DeviceExtension->Type = RamdiskBus; ExInitializeFastMutex(&DeviceExtension->DiskListLock); IoInitializeRemoveLock(&DeviceExtension->RemoveLock, TAG('R', 'a', 'm', 'd'), 0, 1); - InitializeListHead(&DeviceExtension->DiskListHead); + InitializeListHead(&DeviceExtension->DiskList); DeviceExtension->PhysicalDeviceObject = PhysicalDeviceObject; DeviceExtension->DeviceObject = DeviceObject; @@ -1118,7 +2243,7 @@ Status = IoRegisterDeviceInterface(PhysicalDeviceObject, &RamdiskBusInterface, NULL, - &DeviceExtension->SymbolicLinkName); + &DeviceExtension->BusDeviceName); if (!NT_SUCCESS(Status)) { // @@ -1139,14 +2264,14 @@ // // Fail // - IoSetDeviceInterfaceState(&DeviceExtension->SymbolicLinkName, 0); - RtlFreeUnicodeString(&DeviceExtension->SymbolicLinkName); + IoSetDeviceInterfaceState(&DeviceExtension->BusDeviceName, 0); + RtlFreeUnicodeString(&DeviceExtension->BusDeviceName); IoDeleteDevice(DeviceObject); return STATUS_NO_SUCH_DEVICE; } // - // FDO is initialized + // Bus FDO is initialized // RamdiskBusFdo = DeviceObject; @@ -1300,7 +2425,9 @@ // the required keys when reporting a detected device. // We hack around this ourselves. // - RtlCreateUnicodeString(&((PEXTENDED_DEVOBJ_EXTENSION)PhysicalDeviceObject->DeviceObjectExtension)->DeviceNode->InstancePath, + RtlCreateUnicodeString(&((PEXTENDED_DEVOBJ_EXTENSION) + PhysicalDeviceObject->DeviceObjectExtension) + ->DeviceNode->InstancePath, L"Root\\UNKNOWN\\0000"); // Modified: branches/pierre-fsd/drivers/storage/class/ramdisk/ramdisk.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/storage/clas…
============================================================================== --- branches/pierre-fsd/drivers/storage/class/ramdisk/ramdisk.rbuild [iso-8859-1] (original) +++ branches/pierre-fsd/drivers/storage/class/ramdisk/ramdisk.rbuild [iso-8859-1] Sat Nov 14 18:49:19 2009 @@ -6,4 +6,5 @@ <library>hal</library> <file>ramdisk.c</file> <file>ramdisk.rc</file> + <compilerflag>-fms-extensions</compilerflag> </module> Modified: branches/pierre-fsd/include/reactos/drivers/ntddrdsk.h URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/include/reactos/driv…
============================================================================== --- branches/pierre-fsd/include/reactos/drivers/ntddrdsk.h [iso-8859-1] (original) +++ branches/pierre-fsd/include/reactos/drivers/ntddrdsk.h [iso-8859-1] Sat Nov 14 18:49:19 2009 @@ -37,6 +37,14 @@ #define FSCTL_CREATE_RAM_DISK CTL_CODE(FILE_DEVICE_VIRTUAL_DISK, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS) // +// Disk Types +// +#define RAMDISK_REGISTRY_DISK 1 // Loaded from the registry +#define RAMDISK_MEMORY_MAPPED_DISK 2 // Loaded from the registry +#define RAMDISK_BOOT_DISK 3 // Used as a boot device +#define RAMDISK_WIM_DISK 4 // Used as an installation device + +// // Options when creating a ramdisk // typedef struct _RAMDISK_CREATE_OPTIONS @@ -58,8 +66,8 @@ GUID DiskGuid; ULONG DiskType; RAMDISK_CREATE_OPTIONS Options; - ULONGLONG DiskLength; - ULONG DiskOffset; + LARGE_INTEGER DiskLength; + LONG DiskOffset; union { struct Modified: branches/pierre-fsd/ntoskrnl/io/iomgr/ramdisk.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/ntoskrnl/io/iomgr/ra…
============================================================================== --- branches/pierre-fsd/ntoskrnl/io/iomgr/ramdisk.c [iso-8859-1] (original) +++ branches/pierre-fsd/ntoskrnl/io/iomgr/ramdisk.c [iso-8859-1] Sat Nov 14 18:49:19 2009 @@ -83,10 +83,10 @@ // RtlZeroMemory(&RamdiskCreate, sizeof(RamdiskCreate)); RamdiskCreate.Version = sizeof(RamdiskCreate); - RamdiskCreate.DiskType = FILE_DEVICE_CD_ROM_FILE_SYSTEM; + RamdiskCreate.DiskType = RAMDISK_BOOT_DISK; RamdiskCreate.BasePage = MemoryDescriptor->BasePage; RamdiskCreate.DiskOffset = 0; - RamdiskCreate.DiskLength = MemoryDescriptor->PageCount << PAGE_SHIFT; + RamdiskCreate.DiskLength.QuadPart = MemoryDescriptor->PageCount << PAGE_SHIFT; RamdiskCreate.DiskGuid = RAMDISK_BOOTDISK_GUID; RamdiskCreate.DriveLetter = L'C'; RamdiskCreate.Options.Fixed = TRUE; @@ -124,7 +124,7 @@ // // Reduce the disk length // - RamdiskCreate.DiskLength -= RamdiskCreate.DiskOffset; + RamdiskCreate.DiskLength.QuadPart -= RamdiskCreate.DiskOffset; // // Check for length parameter @@ -141,7 +141,7 @@ // // Set the offset // - RamdiskCreate.DiskLength = _atoi64(LengthValue + 1); + RamdiskCreate.DiskLength.QuadPart = _atoi64(LengthValue + 1); } } }
15 years, 1 month
1
0
0
0
[pschweitzer] 44159: Make ntoskrnl build
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sat Nov 14 18:02:04 2009 New Revision: 44159 URL:
http://svn.reactos.org/svn/reactos?rev=44159&view=rev
Log: Make ntoskrnl build Modified: branches/pierre-fsd/ntoskrnl/ntoskrnl-generic.rbuild Modified: branches/pierre-fsd/ntoskrnl/ntoskrnl-generic.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/ntoskrnl/ntoskrnl-ge…
============================================================================== --- branches/pierre-fsd/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original) +++ branches/pierre-fsd/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Sat Nov 14 18:02:04 2009 @@ -13,7 +13,7 @@ <if property="_WINKD_" value="1"> <define name="_WINKD_" /> </if> - <if property="_ELF" value="1"> + <if property="_ELF_" value="1"> <define name="_ELF_" /> </if> <include base="cmlib">.</include> @@ -276,6 +276,13 @@ <file>pnproot.c</file> </directory> </directory> + <directory name="kd"> + <if property="ARCH" value="i386"> + <directory name="i386"> + <file>kdmemsup.c</file> + </directory> + </if> + </directory> <if property="_WINKD_" value="0"> <directory name="kdbg"> <if property="ARCH" value="i386">
15 years, 1 month
1
0
0
0
[spetreolle] 44158: GetCurrencyFormatW() formatting bug fix by Viliam Lejcik <lejcik at host dot sk>
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sat Nov 14 16:44:27 2009 New Revision: 44158 URL:
http://svn.reactos.org/svn/reactos?rev=44158&view=rev
Log: GetCurrencyFormatW() formatting bug fix by Viliam Lejcik <lejcik at host dot sk> Modified: trunk/reactos/dll/win32/kernel32/misc/lcformat.c Modified: trunk/reactos/dll/win32/kernel32/misc/lcformat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/lc…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/lcformat.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/lcformat.c [iso-8859-1] Sat Nov 14 16:44:27 2009 @@ -1587,7 +1587,7 @@ dwState |= NF_DIGITS_OUT; dwCurrentGroupCount++; - if (szSrc >= lpszValue && dwCurrentGroupCount == dwGroupCount) + if (szSrc >= lpszValue && dwCurrentGroupCount == dwGroupCount && *szSrc != '-') { LPWSTR lpszGrp = lpFormat->lpThousandSep + strlenW(lpFormat->lpThousandSep) - 1;
15 years, 1 month
1
0
0
0
[pschweitzer] 44157: Forgotten French translation for Fraginator lost on my HD
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sat Nov 14 16:44:02 2009 New Revision: 44157 URL:
http://svn.reactos.org/svn/reactos?rev=44157&view=rev
Log: Forgotten French translation for Fraginator lost on my HD Added: trunk/rosapps/applications/fraginator/lang/fr-FR.rc (with props) Modified: trunk/rosapps/applications/fraginator/Fraginator.rc Modified: trunk/rosapps/applications/fraginator/Fraginator.rc URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/fraginator/Fr…
============================================================================== --- trunk/rosapps/applications/fraginator/Fraginator.rc [iso-8859-1] (original) +++ trunk/rosapps/applications/fraginator/Fraginator.rc [iso-8859-1] Sat Nov 14 16:44:02 2009 @@ -15,5 +15,6 @@ #include "lang/en-US.rc" #include "lang/es-ES.rc" +#include "lang/fr-FR.rc" #include "lang/no-NO.rc" #include "lang/sk-SK.rc" Added: trunk/rosapps/applications/fraginator/lang/fr-FR.rc URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/fraginator/la…
============================================================================== --- trunk/rosapps/applications/fraginator/lang/fr-FR.rc (added) +++ trunk/rosapps/applications/fraginator/lang/fr-FR.rc [iso-8859-1] Sat Nov 14 16:44:02 2009 @@ -1,0 +1,230 @@ +// Microsoft Visual C++ generated resource script. +// + +///////////////////////////////////////////////////////////////////////////// +// French resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_MAIN DIALOGEX 0, 0, 346, 103 +STYLE DS_SHELLFONT | DS_CENTERMOUSE | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + COMBOBOX IDC_DRIVES_LIST,78,52,29,111,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_METHODS_LIST,135,52,77,79,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_PRIORITY_LIST,223,52,59,91,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Démarrer",IDC_STARTSTOP,294,7,45,15 + PUSHBUTTON "Aide",ID_MAIN_HELP,294,28,45,15 + PUSHBUTTON "Quitter",IDC_QUIT,294,49,45,15 + CONTROL 110,-1,"Static",SS_BITMAP | SS_SUNKEN | + WS_BORDER,7,7,63,58 + LTEXT "Choisissez un lecteur :",-1,78,40,50,8 + LTEXT "Choisissez une action :",-1,135,40,58,8 + CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER | + 0x1,7,71,299,10 + CONTROL "Static",IDC_STATUS,"Static",SS_LEFTNOWORDWRAP | + SS_SUNKEN | WS_GROUP,7,86,332,10 + LTEXT "Je suis un singe, ententez-moi eeK",IDC_WISECRACKS,78,15,91,8 + LTEXT "100.00%",IDC_PERCENT,311,71,28,8,0,WS_EX_RIGHT + LTEXT "Priorité du processus :",-1,223,40,51,8 +END + +IDD_REPORT DIALOGEX 0, 0, 391, 169 +STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION +CAPTION "Rapport" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Octets",IDC_BYTES,7,148,50,14 + DEFPUSHBUTTON "Kilooctets",IDC_KILOBYTES,61,148,50,14 + DEFPUSHBUTTON "Mégaoctets",IDC_MEGABYTES,115,148,50,14 + DEFPUSHBUTTON "Gigaoctets",IDC_GIGABYTES,169,148,50,14 + DEFPUSHBUTTON "OK",IDC_REPORTOK,334,148,50,14 + RTEXT "Volume",-1,7,7,24,8 + LTEXT "Capacité",-1,7,51,28,8 + RTEXT "(Lettre du lecteur)",IDC_DRIVELETTER,63,7,117,10,SS_SUNKEN + RTEXT "(Taille du disque, Octets)",IDC_DISKSIZEBYTES,63,51,117,10, + SS_SUNKEN + RTEXT "(Taille du disque, Clusters)",IDC_DISKSIZECLUSTERS,63,73,117, + 10,SS_SUNKEN + LTEXT "Nombre de clusters",-1,7,73,43,8 + RTEXT "(Taille d'un Cluster)",IDC_DISKCLUSTERSIZE,63,84,117,10, + SS_SUNKEN + LTEXT "Taille d'un cluster",-1,7,84,36,8 + RTEXT "(Nombre de fichiers)",IDC_FILESCOUNT,267,18,117,10,SS_SUNKEN + RTEXT "(Taille des fichiers, octets)",IDC_FILESSIZEBYTES,267,29,117,10, + SS_SUNKEN + LTEXT "# des fichiers",-1,194,18,28,8 + LTEXT "Taille totale",-1,194,29,31,8 + LTEXT "Taille sur le disque",-1,194,40,39,8 + RTEXT "(Taille totale, octets)",IDC_FILESSIZEONDISK,267,40,117,10, + SS_SUNKEN + RTEXT "(Octets perdus par les fichiers)",IDC_FILESSLACKBYTES,267,51,117,10, + SS_SUNKEN + LTEXT "Espace perdu",-1,194,51,44,8 + RTEXT "(Espace libre, octets)",IDC_DISKFREEBYTES,63,62,117,10, + SS_SUNKEN + LTEXT "Espace libre",-1,7,62,36,8 + RTEXT "(Fichiers fragmentés, nombre)",IDC_FILESFRAGGED,267,62,117, + 10,SS_SUNKEN + LTEXT "Fichiers fragmentés",-1,194,62,52,8 + RTEXT "(Nombre de répertoires)",IDC_DIRSCOUNT,267,7,117,10,SS_SUNKEN + LTEXT "# répertoires",-1,194,7,48,8 + RTEXT "Système de fichiers",-1,7,40,36,8 + RTEXT "(Nom du système de fichiers)",IDC_FILESYSTEM,63,40,117,10, + SS_SUNKEN + RTEXT "Nom du volume",-1,7,18,44,8 + RTEXT "(Nom du volume)",IDC_VOLUMELABEL,63,18,117,10,SS_SUNKEN + RTEXT "Numéro de série",-1,7,29,18,8 + RTEXT "(Numéro de série du volume)",IDC_VOLUMESERIAL,63,29,117,10, + SS_SUNKEN + RTEXT "(Fragements par fichier en moyenne)",IDC_AVERAGEFRAGS,267,73,117, + 10,SS_SUNKEN + LTEXT "Fragements par fichier en moyenne",-1,194,73,60,20 + LTEXT "XX.X% des fichiers sur ce lecteur sont fragmentés. Il est recommandé que vous effectuiez une défragmentation.", + IDC_RECOMMEND,7,106,377,38,SS_SUNKEN + LTEXT "Recommandations :",-1,7,96,62,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_MAIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 339 + TOPMARGIN, 7 + BOTTOMMARGIN, 96 + END + + IDD_REPORT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 384 + TOPMARGIN, 7 + BOTTOMMARGIN, 162 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""windows.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,3,0,0 + PRODUCTVERSION 1,3,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", " " + VALUE "FileDescription", "Fraginator" + VALUE "FileVersion", "1.03" + VALUE "InternalName", "Fraginator" + VALUE "LegalCopyright", "Copyright © 2000-2002 Rick Brewster" + VALUE "OriginalFilename", "Fraginator.exe" + VALUE "ProductName", "Fraginator" + VALUE "ProductVersion", "1.03" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_LOGO BITMAP "Fraginator Motif Icon.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON ICON "icon1.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "default1.bin" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + Propchange: trunk/rosapps/applications/fraginator/lang/fr-FR.rc ------------------------------------------------------------------------------ svn:eol-style = native
15 years, 1 month
1
0
0
0
← Newer
1
...
15
16
17
18
19
20
21
...
45
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
Results per page:
10
25
50
100
200