Author: pschweitzer
Date: Wed May 1 09:10:34 2013
New Revision: 58897
URL: http://svn.reactos.org/svn/reactos?rev=58897&view=rev
Log:
[NTOSKRNL]
Patch by Aleksey Bragin (he's not aware yet!):
Also implement FsRtlIs*InExpression prologue in FsRtlIsDbcsInExpression (adapted from Aleksey's work on FsRtlIsNameInExpression)
Also added support for Dbcs chars in it
Modified:
trunk/reactos/ntoskrnl/fsrtl/dbcsname.c
Modified: trunk/reactos/ntoskrnl/fsrtl/dbcsname.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/dbcsname.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/fsrtl/dbcsname.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/dbcsname.c [iso-8859-1] Wed May 1 09:10:34 2013
@@ -169,9 +169,67 @@
ASSERT(Expression->Length);
ASSERT(!FsRtlDoesDbcsContainWildCards(Name));
- if (Name->Length == 0)
- {
- return (Expression->Length == 0);
+ /* Check if we were given strings at all */
+ if (!Name->Length || !Expression->Length)
+ {
+ /* Return TRUE if both strings are empty, otherwise FALSE */
+ if (Name->Length == 0 && Expression->Length == 0)
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ /* Check for a shortcut: just one wildcard */
+ if (Expression->Length == sizeof(CHAR))
+ {
+ if (Expression->Buffer[0] == '*')
+ return TRUE;
+ }
+
+ //ASSERT(FsRtlDoesDbcsContainWildCards(Expression));
+
+ /* Another shortcut, wildcard followed by some string */
+ if (Expression->Buffer[0] == '*')
+ {
+ /* Copy Expression to our local variable */
+ ANSI_STRING IntExpression = *Expression;
+
+ /* Skip the first char */
+ IntExpression.Buffer++;
+ IntExpression.Length -= sizeof(CHAR);
+
+ /* Continue only if the rest of the expression does NOT contain
+ any more wildcards */
+ if (!FsRtlDoesDbcsContainWildCards(&IntExpression))
+ {
+ /* Check for a degenerate case */
+ if (Name->Length < (Expression->Length - sizeof(CHAR)))
+ return FALSE;
+
+ /* Calculate position */
+ NamePosition = (Name->Length - IntExpression.Length) / sizeof(CHAR);
+
+ /* Check whether we are breaking a two chars char (DBCS) */
+ if (NlsMbOemCodePageTag)
+ {
+ MatchingChars = 0;
+
+ while (MatchingChars < NamePosition)
+ {
+ /* Check if current char is DBCS lead char, if so, jump by two chars */
+ MatchingChars += FsRtlIsLeadDbcsCharacter(Name->Buffer[MatchingChars]) ? 2 : 1;
+ }
+
+ /* If so, deny */
+ if (MatchingChars > NamePosition)
+ return FALSE;
+ }
+
+ /* Compare */
+ return RtlEqualMemory(IntExpression.Buffer,
+ (Name->Buffer + NamePosition),
+ IntExpression.Length);
+ }
}
while (NamePosition < Name->Length && ExpressionPosition < Expression->Length)
Author: cgutman
Date: Tue Apr 30 09:33:40 2013
New Revision: 58896
URL: http://svn.reactos.org/svn/reactos?rev=58896&view=rev
Log:
[LWIP]
- Call tcp_shutdown() two different times for TX|RX shutdown to avoid the tcp_close() problem entirely
- Forcefully close the socket in LibTCPCloseCallback (not optimal, but good enough)
Modified:
trunk/reactos/lib/drivers/lwip/src/rostcp.c
Modified: trunk/reactos/lib/drivers/lwip/src/rostcp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/lwip/src/rostc…
==============================================================================
--- trunk/reactos/lib/drivers/lwip/src/rostcp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/lwip/src/rostcp.c [iso-8859-1] Tue Apr 30 09:33:40 2013
@@ -631,7 +631,14 @@
goto done;
}
- msg->Output.Shutdown.Error = tcp_shutdown(pcb, msg->Input.Shutdown.shut_rx, msg->Input.Shutdown.shut_tx);
+ /* These need to be called separately, otherwise we get a tcp_close() */
+ if (msg->Input.Shutdown.shut_rx) {
+ msg->Output.Shutdown.Error = tcp_shutdown(pcb, TRUE, FALSE);
+ }
+ if (msg->Input.Shutdown.shut_tx) {
+ msg->Output.Shutdown.Error = tcp_shutdown(pcb, FALSE, TRUE);
+ }
+
if (!msg->Output.Shutdown.Error)
{
if (msg->Input.Shutdown.shut_rx)
@@ -642,10 +649,6 @@
if (msg->Input.Shutdown.shut_tx)
msg->Input.Shutdown.Connection->SendShutdown = TRUE;
-
- /* Shutting down both sides is like a close to LwIP, so clear the context */
- if (msg->Input.Shutdown.shut_rx && msg->Input.Shutdown.shut_tx)
- msg->Input.Shutdown.Connection->SocketContext = NULL;
}
done:
@@ -706,7 +709,6 @@
case CLOSED:
case LISTEN:
case SYN_SENT:
- case CLOSE_WAIT:
msg->Output.Close.Error = tcp_close(pcb);
if (!msg->Output.Close.Error && msg->Input.Close.Callback)
@@ -714,8 +716,9 @@
break;
default:
- /* Start the graceful close process (or send RST for pending data) */
- msg->Output.Close.Error = tcp_close(pcb);
+ /* Abort the socket */
+ tcp_abort(pcb);
+ msg->Output.Close.Error = ERR_OK;
break;
}