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
July 2011
----- 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
24 participants
517 discussions
Start a n
N
ew thread
[cgutman] 52733: [RTL] - Fix the string length calculation for the partial name - Fixes the 2nd stage regression
by cgutman@svn.reactos.org
Author: cgutman Date: Wed Jul 20 07:11:38 2011 New Revision: 52733 URL:
http://svn.reactos.org/svn/reactos?rev=52733&view=rev
Log: [RTL] - Fix the string length calculation for the partial name - Fixes the 2nd stage regression Modified: trunk/reactos/lib/rtl/path.c Modified: trunk/reactos/lib/rtl/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=52733&r…
============================================================================== --- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Wed Jul 20 07:11:38 2011 @@ -567,7 +567,7 @@ if (NT_SUCCESS(Status)) { /* Set the partial name */ - *PartName = &NewBuffer[LengthChars - PartNameString.Length]; + *PartName = &NewBuffer[LengthChars - (PartNameString.Length / sizeof(WCHAR))]; } else {
13 years, 5 months
1
0
0
0
[cgutman] 52732: [RTL] - Fix returning relative path names for path API calls using RtlpDosPathNameToRelativeNtPathName_Ustr on the backend
by cgutman@svn.reactos.org
Author: cgutman Date: Wed Jul 20 05:34:33 2011 New Revision: 52732 URL:
http://svn.reactos.org/svn/reactos?rev=52732&view=rev
Log: [RTL] - Fix returning relative path names for path API calls using RtlpDosPathNameToRelativeNtPathName_Ustr on the backend Modified: trunk/reactos/lib/rtl/path.c Modified: trunk/reactos/lib/rtl/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=52732&r…
============================================================================== --- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Wed Jul 20 05:34:33 2011 @@ -596,6 +596,7 @@ if (cd->Handle) { RtlInitUnicodeString(&us, Buffer); + us.Length = (cd->DosPath.Length < us.Length) ? cd->DosPath.Length : us.Length; if (RtlEqualUnicodeString(&us, &cd->DosPath, TRUE)) { Length = ((cd->DosPath.Length / sizeof(WCHAR)) - PrefixCut) + ((InputPathType == 1) ? 8 : 4);
13 years, 5 months
1
0
0
0
[dgorbachev] 52731: [NTOSKRNL] Do not assign drive letters to unrecognized partitions. Fixes bug #2564.
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Mon Jul 18 20:27:42 2011 New Revision: 52731 URL:
http://svn.reactos.org/svn/reactos?rev=52731&view=rev
Log: [NTOSKRNL] Do not assign drive letters to unrecognized partitions. Fixes bug #2564. Modified: trunk/reactos/ntoskrnl/fstub/disksup.c Modified: trunk/reactos/ntoskrnl/fstub/disksup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fstub/disksup.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] Mon Jul 18 20:27:42 2011 @@ -398,7 +398,7 @@ /* Read the partition table */ Status = IoReadPartitionTable(DeviceObject, DiskGeometry.BytesPerSector, - FALSE, + TRUE, LayoutInfo); }
13 years, 5 months
1
0
0
0
[cmihail] 52730: [lwIP] - rewrite fix to race condition crash this time in a correct and much more elegant manner
by cmihail@svn.reactos.org
Author: cmihail Date: Mon Jul 18 19:20:12 2011 New Revision: 52730 URL:
http://svn.reactos.org/svn/reactos?rev=52730&view=rev
Log: [lwIP] - rewrite fix to race condition crash this time in a correct and much more elegant manner Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c [iso-8859-1] Mon Jul 18 19:20:12 2011 @@ -587,8 +587,13 @@ LibTCPShutdownCallback(void *arg) { struct shutdown_callback_msg *msg = arg; - - msg->Error = tcp_shutdown(msg->Pcb, msg->shut_rx, msg->shut_tx); + + if (msg->Pcb->state == ESTABLISHED || msg->Pcb->state == SYN_RCVD) + { + msg->Error = tcp_shutdown(msg->Pcb, msg->shut_rx, msg->shut_tx); + } + else + msg->Error = ERR_OK; KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); } @@ -599,7 +604,7 @@ struct shutdown_callback_msg *msg; err_t ret; - DbgPrint("[lwIP, LibTCPShutdown] Called on pcb = 0x%x\n", pcb); + DbgPrint("[lwIP, LibTCPShutdown] Called on pcb = 0x%x with rx = %d, tx = %d\n", pcb, shut_rx, shut_tx); if (!pcb) { @@ -607,7 +612,7 @@ return ERR_CLSD; } - DbgPrint("[lwIP, LibTCPClose] pcb->state = %s\n", tcp_state_str[pcb->state]); + DbgPrint("[lwIP, LibTCPShutdown] pcb->state = %s\n", tcp_state_str[pcb->state]); msg = ExAllocatePool(NonPagedPool, sizeof(struct shutdown_callback_msg)); if (msg) @@ -658,19 +663,18 @@ DbgPrint("[lwIP, LibTCPCloseCallback] Closing a listener\n"); msg->Error = tcp_close(msg->Pcb); } - else if (msg->Pcb->state != LAST_ACK && msg->Pcb->state != CLOSED) + else { DbgPrint("[lwIP, LibTCPCloseCallback] Aborting a connection\n"); tcp_abort(msg->Pcb); msg->Error = ERR_OK; } - else - msg->Error = ERR_OK; KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); } err_t +//LibTCPClose(struct tcp_pcb *pcb, const int safe) LibTCPClose(struct tcp_pcb *pcb, const int safe) { err_t ret; @@ -712,14 +716,12 @@ DbgPrint("[lwIP, LibTCPClose] Closing a listener\n"); ret = tcp_close(pcb); } - else if (pcb->state != LAST_ACK && pcb->state != CLOSED) + else { DbgPrint("[lwIP, LibTCPClose] Aborting a connection\n"); tcp_abort(pcb); ret = ERR_OK; } - else - ret = ERR_OK; return ret; }
13 years, 5 months
1
0
0
0
[cgutman] 52729: [IP] - Register an interface route for interfaces with a static IP address
by cgutman@svn.reactos.org
Author: cgutman Date: Mon Jul 18 16:38:36 2011 New Revision: 52729 URL:
http://svn.reactos.org/svn/reactos?rev=52729&view=rev
Log: [IP] - Register an interface route for interfaces with a static IP address Modified: trunk/reactos/lib/drivers/ip/network/ip.c trunk/reactos/lib/drivers/ip/network/loopback.c Modified: trunk/reactos/lib/drivers/ip/network/ip.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/ip.…
============================================================================== --- trunk/reactos/lib/drivers/ip/network/ip.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/network/ip.c [iso-8859-1] Mon Jul 18 16:38:36 2011 @@ -265,6 +265,11 @@ IF->Index = ChosenIndex; + if (!AddrIsUnspecified(&IF->Unicast)) + { + IPAddInterfaceRoute(IF); + } + /* Add interface to the global interface list */ TcpipInterlockedInsertTailList(&InterfaceListHead, &IF->ListEntry, Modified: trunk/reactos/lib/drivers/ip/network/loopback.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/loo…
============================================================================== --- trunk/reactos/lib/drivers/ip/network/loopback.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/network/loopback.c [iso-8859-1] Mon Jul 18 16:38:36 2011 @@ -125,7 +125,6 @@ AddrInitIPv4(&Loopback->Broadcast, LOOPBACK_BCASTADDR_IPv4); IPRegisterInterface(Loopback); - IPAddInterfaceRoute(Loopback); TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
13 years, 5 months
1
0
0
0
[ion] 52728: [RTL]: Makes sure there is a curdir handle.
by ion@svn.reactos.org
Author: ion Date: Mon Jul 18 13:46:43 2011 New Revision: 52728 URL:
http://svn.reactos.org/svn/reactos?rev=52728&view=rev
Log: [RTL]: Makes sure there is a curdir handle. Modified: trunk/reactos/lib/rtl/path.c Modified: trunk/reactos/lib/rtl/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=52728&r…
============================================================================== --- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Mon Jul 18 13:46:43 2011 @@ -593,14 +593,17 @@ PCURDIR cd; UNICODE_STRING us; cd = (PCURDIR)&(NtCurrentPeb ()->ProcessParameters->CurrentDirectory.DosPath); - RtlInitUnicodeString(&us, Buffer); - if (RtlEqualUnicodeString(&us, &cd->DosPath, TRUE)) + if (cd->Handle) { - Length = ((cd->DosPath.Length / sizeof(WCHAR)) - PrefixCut) + ((InputPathType == 1) ? 8 : 4); - RelativeName->RelativeName.Buffer = NewBuffer + Length; - RelativeName->RelativeName.Length = NtName->Length - (Length * sizeof(WCHAR)); - RelativeName->RelativeName.MaximumLength = RelativeName->RelativeName.Length; - RelativeName->ContainingDirectory = cd->Handle; + RtlInitUnicodeString(&us, Buffer); + if (RtlEqualUnicodeString(&us, &cd->DosPath, TRUE)) + { + Length = ((cd->DosPath.Length / sizeof(WCHAR)) - PrefixCut) + ((InputPathType == 1) ? 8 : 4); + RelativeName->RelativeName.Buffer = NewBuffer + Length; + RelativeName->RelativeName.Length = NtName->Length - (Length * sizeof(WCHAR)); + RelativeName->RelativeName.MaximumLength = RelativeName->RelativeName.Length; + RelativeName->ContainingDirectory = cd->Handle; + } } } }
13 years, 5 months
1
0
0
0
[ion] 52727: [RTL]: Fix a typo in RtlpDosPathNameToRelativeNtPathName_Ustr thanks so smiley. [RTL]: Implement the unimplemented corner case based on the old ReactOS code.
by ion@svn.reactos.org
Author: ion Date: Mon Jul 18 13:45:32 2011 New Revision: 52727 URL:
http://svn.reactos.org/svn/reactos?rev=52727&view=rev
Log: [RTL]: Fix a typo in RtlpDosPathNameToRelativeNtPathName_Ustr thanks so smiley. [RTL]: Implement the unimplemented corner case based on the old ReactOS code. Modified: trunk/reactos/lib/rtl/path.c Modified: trunk/reactos/lib/rtl/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=52727&r…
============================================================================== --- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Mon Jul 18 13:45:32 2011 @@ -449,7 +449,7 @@ CapturedDosName = *DosName; /* Check for \\?\\ form */ - if ((CapturedDosName.Length <= RtlpWin32NtRootSlash.Length) | + if ((CapturedDosName.Length <= RtlpWin32NtRootSlash.Length) || (CapturedDosName.Buffer[0] != RtlpWin32NtRootSlash.Buffer[0]) || (CapturedDosName.Buffer[1] != RtlpWin32NtRootSlash.Buffer[1]) || (CapturedDosName.Buffer[2] != RtlpWin32NtRootSlash.Buffer[2]) || @@ -589,11 +589,19 @@ /* Check if the input path itself was relative */ if (InputPathType == RtlPathTypeRelative) { - /* Don't handle this yet */ - DPRINT1("UNIMPLEMENTED CORNER CASE\n"); - RtlFreeHeap(RtlGetProcessHeap(), 0, NewBuffer); - RtlReleasePebLock(); - return STATUS_NOT_IMPLEMENTED; + /* FIXME: HACK: Old code */ + PCURDIR cd; + UNICODE_STRING us; + cd = (PCURDIR)&(NtCurrentPeb ()->ProcessParameters->CurrentDirectory.DosPath); + RtlInitUnicodeString(&us, Buffer); + if (RtlEqualUnicodeString(&us, &cd->DosPath, TRUE)) + { + Length = ((cd->DosPath.Length / sizeof(WCHAR)) - PrefixCut) + ((InputPathType == 1) ? 8 : 4); + RelativeName->RelativeName.Buffer = NewBuffer + Length; + RelativeName->RelativeName.Length = NtName->Length - (Length * sizeof(WCHAR)); + RelativeName->RelativeName.MaximumLength = RelativeName->RelativeName.Length; + RelativeName->ContainingDirectory = cd->Handle; + } } }
13 years, 5 months
1
0
0
0
[ion] 52726: [RTL]: Implement RtlDosPathNameToRelativeNtPathName_U_WithStatus, RtlDosPathNameToRelativeNtPathName_U, RtlDosPathNameToNtPathName_U_WithStatus. [RTL]: Reimplement RtlDosPathNameToNtPa...
by ion@svn.reactos.org
Author: ion Date: Mon Jul 18 13:22:09 2011 New Revision: 52726 URL:
http://svn.reactos.org/svn/reactos?rev=52726&view=rev
Log: [RTL]: Implement RtlDosPathNameToRelativeNtPathName_U_WithStatus, RtlDosPathNameToRelativeNtPathName_U, RtlDosPathNameToNtPathName_U_WithStatus. [RTL]: Reimplement RtlDosPathNameToNtPathName_U to use UNICODE_STRING semantics. [RTL]: Fix RtlGetFullPathName_Ustr. [RTL]: RtlGetFullPathName_U remains based on the legacy non-UNICODE_STRING mechanism, but it's too complex to attempt changing for now. Modified: trunk/reactos/lib/rtl/path.c Modified: trunk/reactos/lib/rtl/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=52726&r…
============================================================================== --- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Mon Jul 18 13:22:09 2011 @@ -25,126 +25,21 @@ /* GLOBALS ********************************************************************/ static const WCHAR DeviceRootW[] = L"\\\\.\\"; -static const UNICODE_STRING _condev = RTL_CONSTANT_STRING(L"\\\\.\\CON"); -static const UNICODE_STRING _unc = RTL_CONSTANT_STRING(L"\\??\\UNC\\"); - const UNICODE_STRING DeviceRootString = RTL_CONSTANT_STRING(L"\\\\.\\"); + +const UNICODE_STRING RtlpDosDevicesUncPrefix = RTL_CONSTANT_STRING(L"\\??\\UNC\\"); +const UNICODE_STRING RtlpWin32NtRootSlash = RTL_CONSTANT_STRING(L"\\\\?\\"); +const UNICODE_STRING RtlpDosSlashCONDevice = RTL_CONSTANT_STRING(L"\\\\.\\CON"); +const UNICODE_STRING RtlpDosDevicesPrefix = RTL_CONSTANT_STRING(L"\\??\\"); + const UNICODE_STRING RtlpDosLPTDevice = RTL_CONSTANT_STRING(L"LPT"); const UNICODE_STRING RtlpDosCOMDevice = RTL_CONSTANT_STRING(L"COM"); const UNICODE_STRING RtlpDosPRNDevice = RTL_CONSTANT_STRING(L"PRN"); const UNICODE_STRING RtlpDosAUXDevice = RTL_CONSTANT_STRING(L"AUX"); const UNICODE_STRING RtlpDosCONDevice = RTL_CONSTANT_STRING(L"CON"); -const UNICODE_STRING RtlpDosSlashCONDevice = RTL_CONSTANT_STRING(L"\\\\.\\CON"); const UNICODE_STRING RtlpDosNULDevice = RTL_CONSTANT_STRING(L"NUL"); /* PRIVATE FUNCTIONS **********************************************************/ - -BOOLEAN -NTAPI -RtlDoesFileExists_UstrEx(IN PCUNICODE_STRING FileName, - IN BOOLEAN SucceedIfBusy) -{ - BOOLEAN Result; - RTL_RELATIVE_NAME_U RelativeName; - UNICODE_STRING NtPathName; - PVOID Buffer; - OBJECT_ATTRIBUTES ObjectAttributes; - NTSTATUS Status; - FILE_BASIC_INFORMATION BasicInformation; - -#if 0 - /* Get the NT Path */ - Result = RtlDosPathNameToRelativeNtPathName_Ustr(FileName, - &NtPathName, - NULL, - &RelativeName); -#else - /* FIXME: Use the old API for now */ - Result = RtlDosPathNameToNtPathName_U(FileName->Buffer, - &NtPathName, - NULL, - &RelativeName); -#endif - if (!Result) return FALSE; - - /* Save the buffer */ - Buffer = NtPathName.Buffer; - - /* Check if we have a relative name */ - if (RelativeName.RelativeName.Length) - { - /* Use it */ - NtPathName = RelativeName.RelativeName; - } - else - { - /* Otherwise ignore it */ - RelativeName.ContainingDirectory = NULL; - } - - /* Initialize the object attributes */ - InitializeObjectAttributes(&ObjectAttributes, - &NtPathName, - OBJ_CASE_INSENSITIVE, - RelativeName.ContainingDirectory, - NULL); - - /* Query the attributes and free the buffer now */ - Status = ZwQueryAttributesFile(&ObjectAttributes, &BasicInformation); - RtlReleaseRelativeName(&RelativeName); - RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); - - /* Check if we failed */ - if (!NT_SUCCESS(Status)) - { - /* Check if we failed because the file is in use */ - if ((Status == STATUS_SHARING_VIOLATION) || - (Status == STATUS_ACCESS_DENIED)) - { - /* Check if the caller wants this to be considered OK */ - Result = SucceedIfBusy ? TRUE : FALSE; - } - else - { - /* A failure because the file didn't exist */ - Result = FALSE; - } - } - else - { - /* The file exists */ - Result = TRUE; - } - - /* Return the result */ - return Result; -} - -BOOLEAN -NTAPI -RtlDoesFileExists_UStr(IN PUNICODE_STRING FileName) -{ - /* Call the updated API */ - return RtlDoesFileExists_UstrEx(FileName, TRUE); -} - -BOOLEAN -NTAPI -RtlDoesFileExists_UEx(IN PCWSTR FileName, - IN BOOLEAN SucceedIfBusy) -{ - UNICODE_STRING NameString; - - /* Create the unicode name*/ - if (NT_SUCCESS(RtlInitUnicodeStringEx(&NameString, FileName))) - { - /* Call the unicode function */ - return RtlDoesFileExists_UstrEx(&NameString, SucceedIfBusy); - } - - /* Fail */ - return FALSE; -} ULONG NTAPI @@ -381,6 +276,8 @@ NTSTATUS Status; /* For now, assume the name is valid */ + DPRINT("Filename: %wZ\n", FileName); + DPRINT("Size and buffer: %lx %S\n", Size, Buffer); if (InvalidName) *InvalidName = FALSE; /* Handle initial path type and failure case */ @@ -394,7 +291,7 @@ /* Kill trailing spaces */ c = FileNameBuffer[FileNameChars - 1]; - while ((FileNameLength) && (c != L' ')) + while ((FileNameLength) && (c == L' ')) { /* Keep going, ignoring the spaces */ FileNameLength -= sizeof(WCHAR); @@ -402,10 +299,11 @@ } /* Check if anything is left */ - if (!FileNameLength ) return 0; + if (!FileNameLength) return 0; /* Check if this is a DOS name */ DosLength = RtlIsDosDeviceName_Ustr(FileName); + DPRINT("DOS length for filename: %lx %wZ\n", DosLength, FileName); if (DosLength) { /* Zero out the short name */ @@ -450,9 +348,400 @@ /* This should work well enough for our current needs */ *PathType = RtlDetermineDosPathNameType_U(FileNameBuffer); + DPRINT("Path type: %lx\n", *PathType); /* This is disgusting... but avoids re-writing everything */ + DPRINT("Calling old API with %s and %lx and %S\n", FileNameBuffer, Size, Buffer); return RtlGetFullPathName_U(FileNameBuffer, Size, Buffer, (PWSTR*)ShortName); +} + +NTSTATUS +NTAPI +RtlpWin32NTNameToNtPathName_U(IN PUNICODE_STRING DosPath, + IN PUNICODE_STRING NtPath, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + ULONG DosLength; + PWSTR NewBuffer, p; + + /* Validate the DOS length */ + DosLength = DosPath->Length; + if (DosLength >= UNICODE_STRING_MAX_BYTES) return STATUS_NAME_TOO_LONG; + + /* Make space for the new path */ + NewBuffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + DosLength + sizeof(UNICODE_NULL)); + if (!NewBuffer) return STATUS_NO_MEMORY; + + /* Copy the prefix, and then the rest of the DOS path, and NULL-terminate */ + RtlCopyMemory(NewBuffer, RtlpDosDevicesPrefix.Buffer, RtlpDosDevicesPrefix.Length); + RtlCopyMemory((PCHAR)NewBuffer + RtlpDosDevicesPrefix.Length, + DosPath->Buffer + RtlpDosDevicesPrefix.Length / sizeof(WCHAR), + DosPath->Length - RtlpDosDevicesPrefix.Length); + NewBuffer[DosLength / sizeof(WCHAR)] = UNICODE_NULL; + + /* Did the caller send a relative name? */ + if (RelativeName) + { + /* Zero initialize it */ + RtlInitEmptyUnicodeString(&RelativeName->RelativeName, NULL, 0); + RelativeName->ContainingDirectory = NULL; + RelativeName->CurDirRef = 0; + } + + /* Did the caller request a partial name? */ + if (PartName) + { + /* Loop from the back until we find a path separator */ + p = &NewBuffer[(DosLength - 1) / sizeof (WCHAR)]; + while (p > NewBuffer) if (*p-- == '\\') break; + + /* Was one found? */ + if (p > NewBuffer) + { + /* Move past it -- anything left? */ + p++; + if (!*p) + { + /* The path ends with a path separator, no part name */ + *PartName = NULL; + } + else + { + /* What follows the path separator is the part name */ + *PartName = p; + } + } + } + + /* Build the final NT path string */ + NtPath->Length = DosLength; + NtPath->Buffer = NewBuffer; + NtPath->MaximumLength = DosLength + sizeof(UNICODE_NULL); + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +RtlpDosPathNameToRelativeNtPathName_Ustr(IN BOOLEAN HaveRelative, + IN PCUNICODE_STRING DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + WCHAR BigBuffer[MAX_PATH + 1]; + PWCHAR PrefixBuffer, NewBuffer, Buffer; + ULONG MaxLength, PathLength, PrefixLength, PrefixCut, LengthChars, Length; + UNICODE_STRING CapturedDosName, PartNameString; + BOOLEAN QuickPath; + RTL_PATH_TYPE InputPathType, BufferPathType; + NTSTATUS Status; + BOOLEAN NameInvalid; + + /* Assume MAX_PATH for now */ + DPRINT("Relative: %lx DosName: %wZ NtName: %wZ, PartName: %p, RelativeName: %p\n", + HaveRelative, DosName, NtName, PartName, RelativeName); + MaxLength = sizeof(BigBuffer); + + /* Capture input string */ + CapturedDosName = *DosName; + + /* Check for \\?\\ form */ + if ((CapturedDosName.Length <= RtlpWin32NtRootSlash.Length) | + (CapturedDosName.Buffer[0] != RtlpWin32NtRootSlash.Buffer[0]) || + (CapturedDosName.Buffer[1] != RtlpWin32NtRootSlash.Buffer[1]) || + (CapturedDosName.Buffer[2] != RtlpWin32NtRootSlash.Buffer[2]) || + (CapturedDosName.Buffer[3] != RtlpWin32NtRootSlash.Buffer[3])) + { + /* Quick path won't be used */ + QuickPath = FALSE; + + /* Use the static buffer */ + Buffer = BigBuffer; + MaxLength += RtlpDosDevicesUncPrefix.Length; + + /* Allocate a buffer to hold the path */ + NewBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, MaxLength); + DPRINT("Length: %lx\n", MaxLength); + if (!NewBuffer) return STATUS_NO_MEMORY; + } + else + { + /* Use the optimized path after acquiring the lock */ + QuickPath = 1; + NewBuffer = NULL; + } + + /* Lock the PEB and check if the quick path can be used */ + RtlAcquirePebLock(); + if (QuickPath) + { + /* Some simple fixups will get us the correct path */ + DPRINT("Quick path\n"); + Status = RtlpWin32NTNameToNtPathName_U(&CapturedDosName, + NtName, + PartName, + RelativeName); + + /* Release the lock, we're done here */ + RtlReleasePebLock(); + return Status; + } + + /* Call the main function to get the full path name and length */ + PathLength = RtlGetFullPathName_Ustr(&CapturedDosName, + MAX_PATH * sizeof(WCHAR), + Buffer, + PartName, + &NameInvalid, + &InputPathType); + if ((NameInvalid) || !(PathLength) || (PathLength > (MAX_PATH * sizeof(WCHAR)))) + { + /* Invalid name, fail */ + DPRINT("Invalid name: %lx Path Length: %lx\n", NameInvalid, PathLength); + RtlFreeHeap(RtlGetProcessHeap(), 0, NewBuffer); + RtlReleasePebLock(); + return STATUS_OBJECT_NAME_INVALID; + } + + /* Start by assuming the path starts with \??\ (DOS Devices Path) */ + PrefixLength = RtlpDosDevicesPrefix.Length; + PrefixBuffer = RtlpDosDevicesPrefix.Buffer; + PrefixCut = 0; + + /* Check where it really is */ + BufferPathType = RtlDetermineDosPathNameType_U(Buffer); + DPRINT("Buffer: %S Type: %lx\n", Buffer, BufferPathType); + switch (BufferPathType) + { + /* It's actually a UNC path in \??\UNC\ */ + case RtlPathTypeUncAbsolute: + PrefixLength = RtlpDosDevicesUncPrefix.Length; + PrefixBuffer = RtlpDosDevicesUncPrefix.Buffer; + PrefixCut = 2; + break; + + case RtlPathTypeLocalDevice: + /* We made a good guess, go with it but skip the \??\ */ + PrefixCut = 4; + break; + + case RtlPathTypeDriveAbsolute: + case RtlPathTypeDriveRelative: + case RtlPathTypeRooted: + case RtlPathTypeRelative: + /* Our guess was good, roll with it */ + break; + + /* Nothing else is expected */ + default: + ASSERT(FALSE); + + } + + /* Now copy the prefix and the buffer */ + RtlCopyMemory(NewBuffer, PrefixBuffer, PrefixLength); + RtlCopyMemory((PCHAR)NewBuffer + PrefixLength, + &Buffer[PrefixCut], + PathLength - (PrefixCut * sizeof(WCHAR))); + + /* Compute the length */ + Length = PathLength - PrefixCut * sizeof(WCHAR) + PrefixLength; + LengthChars = Length / sizeof(WCHAR); + + /* Setup the actual NT path string and terminate it */ + NtName->Buffer = NewBuffer; + NtName->Length = Length; + NtName->MaximumLength = MaxLength; + NewBuffer[LengthChars] = UNICODE_NULL; + DPRINT("new buffer: %S\n", NewBuffer); + DPRINT("NT Name: %wZ\n", NtName); + + /* Check if a partial name was requested */ + if ((PartName) && (*PartName)) + { + /* Convert to Unicode */ + Status = RtlInitUnicodeStringEx(&PartNameString, *PartName); + if (NT_SUCCESS(Status)) + { + /* Set the partial name */ + *PartName = &NewBuffer[LengthChars - PartNameString.Length]; + } + else + { + /* Fail */ + RtlFreeHeap(RtlGetProcessHeap(), 0, NewBuffer); + RtlReleasePebLock(); + return Status; + } + } + + /* Check if a relative name was asked for */ + if (RelativeName) + { + /* Setup the structure */ + RtlInitEmptyUnicodeString(&RelativeName->RelativeName, NULL, 0); + RelativeName->ContainingDirectory = NULL; + RelativeName->CurDirRef = 0; + + /* Check if the input path itself was relative */ + if (InputPathType == RtlPathTypeRelative) + { + /* Don't handle this yet */ + DPRINT1("UNIMPLEMENTED CORNER CASE\n"); + RtlFreeHeap(RtlGetProcessHeap(), 0, NewBuffer); + RtlReleasePebLock(); + return STATUS_NOT_IMPLEMENTED; + } + } + + /* Done */ + RtlReleasePebLock(); + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +RtlpDosPathNameToRelativeNtPathName_U(IN BOOLEAN HaveRelative, + IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + NTSTATUS Status; + UNICODE_STRING NameString; + + /* Create the unicode name */ + Status = RtlInitUnicodeStringEx(&NameString, DosName); + if (NT_SUCCESS(Status)) + { + /* Call the unicode function */ + Status = RtlpDosPathNameToRelativeNtPathName_Ustr(HaveRelative, + &NameString, + NtName, + PartName, + RelativeName); + } + + /* Return status */ + return Status; +} + +BOOLEAN +NTAPI +RtlDosPathNameToRelativeNtPathName_Ustr(IN PCUNICODE_STRING DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + /* Call the internal function */ + ASSERT(RelativeName); + return NT_SUCCESS(RtlpDosPathNameToRelativeNtPathName_Ustr(TRUE, + DosName, + NtName, + PartName, + RelativeName)); +} + +BOOLEAN +NTAPI +RtlDoesFileExists_UstrEx(IN PCUNICODE_STRING FileName, + IN BOOLEAN SucceedIfBusy) +{ + BOOLEAN Result; + RTL_RELATIVE_NAME_U RelativeName; + UNICODE_STRING NtPathName; + PVOID Buffer; + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status; + FILE_BASIC_INFORMATION BasicInformation; + + /* Get the NT Path */ + Result = RtlDosPathNameToRelativeNtPathName_Ustr(FileName, + &NtPathName, + NULL, + &RelativeName); + if (!Result) return FALSE; + + /* Save the buffer */ + Buffer = NtPathName.Buffer; + + /* Check if we have a relative name */ + if (RelativeName.RelativeName.Length) + { + /* Use it */ + NtPathName = RelativeName.RelativeName; + } + else + { + /* Otherwise ignore it */ + RelativeName.ContainingDirectory = NULL; + } + + /* Initialize the object attributes */ + InitializeObjectAttributes(&ObjectAttributes, + &NtPathName, + OBJ_CASE_INSENSITIVE, + RelativeName.ContainingDirectory, + NULL); + + /* Query the attributes and free the buffer now */ + Status = ZwQueryAttributesFile(&ObjectAttributes, &BasicInformation); + RtlReleaseRelativeName(&RelativeName); + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); + + /* Check if we failed */ + if (!NT_SUCCESS(Status)) + { + /* Check if we failed because the file is in use */ + if ((Status == STATUS_SHARING_VIOLATION) || + (Status == STATUS_ACCESS_DENIED)) + { + /* Check if the caller wants this to be considered OK */ + Result = SucceedIfBusy ? TRUE : FALSE; + } + else + { + /* A failure because the file didn't exist */ + Result = FALSE; + } + } + else + { + /* The file exists */ + Result = TRUE; + } + + /* Return the result */ + return Result; +} + +BOOLEAN +NTAPI +RtlDoesFileExists_UStr(IN PUNICODE_STRING FileName) +{ + /* Call the updated API */ + return RtlDoesFileExists_UstrEx(FileName, TRUE); +} + +BOOLEAN +NTAPI +RtlDoesFileExists_UEx(IN PCWSTR FileName, + IN BOOLEAN SucceedIfBusy) +{ + UNICODE_STRING NameString; + + /* Create the unicode name*/ + if (NT_SUCCESS(RtlInitUnicodeStringEx(&NameString, FileName))) + { + /* Call the unicode function */ + return RtlDoesFileExists_UstrEx(&NameString, SucceedIfBusy); + } + + /* Fail */ + return FALSE; } /* PUBLIC FUNCTIONS ***********************************************************/ @@ -486,7 +775,7 @@ * This is, and has always been equal to, 269 characters, except in Wine * which claims this is 277. Go figure. */ - return (MAX_PATH + _unc.Length + sizeof(ANSI_NULL)); + return (MAX_PATH + RtlpDosDevicesUncPrefix.Length + sizeof(ANSI_NULL)); } /* @@ -1043,177 +1332,75 @@ /* * @implemented */ -BOOLEAN NTAPI -RtlDosPathNameToNtPathName_U(IN PCWSTR DosPathName, - OUT PUNICODE_STRING NtPathName, - OUT PCWSTR *NtFileNamePart, - OUT PRTL_RELATIVE_NAME_U DirectoryInfo) -{ - UNICODE_STRING us; - PCURDIR cd; - ULONG Type; - ULONG Size; - ULONG Length; - ULONG tmpLength; - ULONG Offset; - WCHAR fullname[MAX_PATH + 1]; - PWSTR Buffer = NULL; - - RtlInitUnicodeString (&us, DosPathName); - if (us.Length > 8) - { - Buffer = us.Buffer; - /* check for "\\?\" - allows to use very long filenames ( up to 32k ) */ - if (Buffer[0] == L'\\' && Buffer[1] == L'\\' && - Buffer[2] == L'?' && Buffer[3] == L'\\') - { - /* allocate the new string and simply copy it */ - NtPathName->Length = us.Length; - NtPathName->MaximumLength = us.Length + sizeof(WCHAR); - NtPathName->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - NtPathName->MaximumLength); - if (NtPathName->Buffer == NULL) - { - return FALSE; - } - - /* copy the string */ - RtlCopyMemory(NtPathName->Buffer, - us.Buffer, - NtPathName->Length); - NtPathName->Buffer[us.Length / sizeof(WCHAR)] = L'\0'; - - /* change the \\?\ prefix to \??\ */ - NtPathName->Buffer[1] = L'?'; - - if (NtFileNamePart != NULL) - { - PWSTR FilePart = NULL; - PWSTR s; - - /* try to find the last separator */ - s = NtPathName->Buffer + (NtPathName->Length / sizeof(WCHAR)); - while (s != NtPathName->Buffer) - { - if (*s == L'\\') - { - FilePart = s + 1; - break; - } - s--; - } - - *NtFileNamePart = FilePart; - } - - if (DirectoryInfo != NULL) - { - DirectoryInfo->RelativeName.Length = 0; - DirectoryInfo->RelativeName.MaximumLength = 0; - DirectoryInfo->RelativeName.Buffer = NULL; - DirectoryInfo->ContainingDirectory = NULL; - } - - return TRUE; - } - } - - Buffer = RtlAllocateHeap (RtlGetProcessHeap (), - 0, - sizeof( fullname ) + MAX_PFX_SIZE); - if (Buffer == NULL) - { - return FALSE; - } - - RtlAcquirePebLock (); - - Size = RtlGetFullPathName_U (DosPathName, - sizeof(fullname), - fullname, - (PWSTR*)NtFileNamePart); - if (Size == 0 || Size > MAX_PATH * sizeof(WCHAR)) - { - RtlFreeHeap (RtlGetProcessHeap (), - 0, - Buffer); - RtlReleasePebLock (); - return FALSE; - } - - /* Set NT prefix */ - Offset = 0; - memcpy (Buffer, L"\\??\\", 4 * sizeof(WCHAR)); - tmpLength = 4; - - Type = RtlDetermineDosPathNameType_U (fullname); - switch (Type) - { - case 1: - memcpy (Buffer + tmpLength, L"UNC\\", 4 * sizeof(WCHAR)); - tmpLength += 4; - Offset = 2; - break; /* \\xxx */ - - case 6: - Offset = 4; - break; /* \\.\xxx */ - } - Length = wcslen(fullname + Offset); - memcpy (Buffer + tmpLength, fullname + Offset, (Length + 1) * sizeof(WCHAR)); - Length += tmpLength; - if (Type == RtlPathTypeDriveAbsolute || - Type == RtlPathTypeDriveRelative) - { - /* make the drive letter to uppercase */ - Buffer[tmpLength] = towupper(Buffer[tmpLength]); - } - - /* set NT filename */ - NtPathName->Length = Length * sizeof(WCHAR); - NtPathName->MaximumLength = sizeof(fullname) + MAX_PFX_SIZE; - NtPathName->Buffer = Buffer; - - /* set pointer to file part if possible */ - if (NtFileNamePart && *NtFileNamePart) - *NtFileNamePart = Buffer + Length - wcslen (*NtFileNamePart); - - /* Set name and handle structure if possible */ - if (DirectoryInfo) - { - memset (DirectoryInfo, 0, sizeof(RTL_RELATIVE_NAME_U)); - cd = (PCURDIR)&(NtCurrentPeb ()->ProcessParameters->CurrentDirectory.DosPath); - if (Type == 5 && cd->Handle) - { - RtlInitUnicodeString(&us, fullname); - if (RtlEqualUnicodeString(&us, &cd->DosPath, TRUE)) - { - Length = ((cd->DosPath.Length / sizeof(WCHAR)) - Offset) + ((Type == 1) ? 8 : 4); - DirectoryInfo->RelativeName.Buffer = Buffer + Length; - DirectoryInfo->RelativeName.Length = NtPathName->Length - (Length * sizeof(WCHAR)); - DirectoryInfo->RelativeName.MaximumLength = DirectoryInfo->RelativeName.Length; - DirectoryInfo->ContainingDirectory = cd->Handle; - } - } - } - - RtlReleasePebLock(); - return TRUE; +BOOLEAN +NTAPI +RtlDosPathNameToNtPathName_U(IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + /* Call the internal function */ + return NT_SUCCESS(RtlpDosPathNameToRelativeNtPathName_U(FALSE, + DosName, + NtName, + PartName, + RelativeName)); } /* - * @unimplemented - */ -BOOLEAN NTAPI -RtlDosPathNameToRelativeNtPathName_U(PVOID Unknown1, - PVOID Unknown2, - PVOID Unknown3, - PVOID Unknown4) -{ - DPRINT1("RtlDosPathNameToRelativeNtPathName_U(0x%p, 0x%p, 0x%p, 0x%p) UNIMPLEMENTED!\n", - Unknown1, Unknown2, Unknown3, Unknown4); - return FALSE; + * @implemented + */ +NTSTATUS +NTAPI +RtlDosPathNameToNtPathName_U_WithStatus(IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + /* Call the internal function */ + return RtlpDosPathNameToRelativeNtPathName_U(FALSE, + DosName, + NtName, + PartName, + RelativeName); +} + +/* + * @implemented + */ +BOOLEAN +NTAPI +RtlDosPathNameToRelativeNtPathName_U(IN PWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + /* Call the internal function */ + ASSERT(RelativeName); + return NT_SUCCESS(RtlpDosPathNameToRelativeNtPathName_U(TRUE, + DosName, + NtName, + PartName, + RelativeName)); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlDosPathNameToRelativeNtPathName_U_WithStatus(IN PWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + /* Call the internal function */ + ASSERT(RelativeName); + return RtlpDosPathNameToRelativeNtPathName_U(TRUE, + DosName, + NtName, + PartName, + RelativeName); } /* @@ -1269,7 +1456,7 @@ Extension = NULL; break; } - + /* Next character */ p++; }
13 years, 5 months
1
0
0
0
[cgutman] 52725: [AFD] - Fix typos from my previous commit - Fix another bug with recv() on a datagram socket - Fix cancellation bugs
by cgutman@svn.reactos.org
Author: cgutman Date: Mon Jul 18 11:27:01 2011 New Revision: 52725 URL:
http://svn.reactos.org/svn/reactos?rev=52725&view=rev
Log: [AFD] - Fix typos from my previous commit - Fix another bug with recv() on a datagram socket - Fix cancellation bugs Modified: trunk/reactos/drivers/network/afd/afd/main.c trunk/reactos/drivers/network/afd/afd/read.c trunk/reactos/drivers/network/afd/include/afd.h Modified: trunk/reactos/drivers/network/afd/afd/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/ma…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] Mon Jul 18 11:27:01 2011 @@ -945,6 +945,54 @@ return (Status); } +BOOLEAN CheckUnlockExtraBuffers(PAFD_FCB FCB, PIO_STACK_LOCATION IrpSp) +{ + if (FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS) + { + if (IrpSp->MajorFunction == IRP_MJ_READ || IrpSp->MajorFunction == IRP_MJ_WRITE) + { + /* read()/write() call - no extra buffers */ + return FALSE; + } + else if (IrpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL) + { + if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_RECV_DATAGRAM) + { + /* recvfrom() call - extra buffers */ + return TRUE; + } + else if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_RECV) + { + /* recv() call - no extra buffers */ + return FALSE; + } + else if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_SEND || + IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_SEND_DATAGRAM) + { + /* send()/sendto() call - no extra buffers */ + return FALSE; + } + else + { + /* Unknown IOCTL */ + ASSERT(FALSE); + return FALSE; + } + } + else + { + /* Unknown IRP_MJ code */ + ASSERT(FALSE); + return FALSE; + } + } + else + { + /* Connection-oriented never has extra buffers */ + return FALSE; + } +} + VOID CleanupPendingIrp(PAFD_FCB FCB, PIRP Irp, PIO_STACK_LOCATION IrpSp, PAFD_ACTIVE_POLL Poll) { @@ -956,14 +1004,13 @@ IrpSp->MajorFunction == IRP_MJ_READ) { RecvReq = GetLockedData(Irp, IrpSp); - UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, FALSE); + UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, CheckUnlockExtraBuffers(FCB, IrpSp)); } else if ((IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_SEND || - IrpSp->MajorFunction == IRP_MJ_WRITE) && - !(FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS)) + IrpSp->MajorFunction == IRP_MJ_WRITE)) { SendReq = GetLockedData(Irp, IrpSp); - UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, FALSE); + UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, CheckUnlockExtraBuffers(FCB, IrpSp)); } else if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_SELECT) { Modified: trunk/reactos/drivers/network/afd/afd/read.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/re…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] Mon Jul 18 11:27:01 2011 @@ -44,48 +44,6 @@ return !BytesAvailable && (FCB->PollState & (AFD_EVENT_CLOSE | AFD_EVENT_ABORT)); -} - -static BOOLEAN CheckUnlockExtraBuffers(PAFD_FCB FCB, PIO_STACK_LOCATION IrpSp) -{ - if (FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS) - { - if (IrpSp->MajorFunction == IRP_MJ_READ) - { - /* read() call - no extra buffers */ - return FALSE; - } - else if (IrpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL) - { - if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_RECV_DATAGRAM) - { - /* recvfrom() call - extra buffers */ - return TRUE; - } - else if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_RECV) - { - /* recv() call - no extra buffers */ - return FALSE; - } - else - { - /* Unknown IOCTL */ - ASSERT(FALSE); - return FALSE; - } - } - else - { - /* Unknown IRP_MJ code */ - ASSERT(FALSE); - return FALSE; - } - } - else - { - /* Connection-oriented never has extra buffers */ - return FALSE; - } } static VOID RefillSocketBuffer( PAFD_FCB FCB ) { @@ -343,10 +301,11 @@ GetLockedData(Irp, IrpSp); UINT BytesToCopy = 0, BytesAvailable = DatagramRecv->Len, AddrLen = 0; PAFD_MAPBUF Map; + BOOLEAN ExtraBuffers = CheckUnlockExtraBuffers(FCB, IrpSp); Map = (PAFD_MAPBUF)(RecvReq->BufferArray + RecvReq->BufferCount + - EXTRA_LOCK_BUFFERS); + (ExtraBuffers ? EXTRA_LOCK_BUFFERS : 0)); BytesToCopy = MIN( RecvReq->BufferArray[0].len, BytesAvailable ); @@ -356,7 +315,7 @@ if( Map[0].Mdl ) { /* Copy the address */ - if( Map[1].Mdl && Map[2].Mdl ) { + if( ExtraBuffers && Map[1].Mdl && Map[2].Mdl ) { AFD_DbgPrint(MID_TRACE,("Checking TAAddressCount\n")); if( DatagramRecv->Address->TAAddressCount != 1 ) { @@ -491,7 +450,7 @@ &DatagramRecv->ListEntry); } - if (IsListEmpty(&FCB->DatagramList)) + if (!IsListEmpty(&FCB->DatagramList)) { FCB->PollState |= AFD_EVENT_RECEIVE; FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS; @@ -748,7 +707,7 @@ &DatagramRecv->ListEntry); } - if (IsListEmpty(&FCB->DatagramList)) + if (!IsListEmpty(&FCB->DatagramList)) { FCB->PollState |= AFD_EVENT_RECEIVE; FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS; @@ -757,7 +716,7 @@ else FCB->PollState &= ~AFD_EVENT_RECEIVE; - UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, FALSE); + UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, TRUE); return UnlockAndMaybeComplete(FCB, Status, Irp, Irp->IoStatus.Information); } @@ -766,7 +725,7 @@ AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); Status = STATUS_CANT_WAIT; FCB->PollState &= ~AFD_EVENT_RECEIVE; - UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, FALSE ); + UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE ); return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); } else Modified: trunk/reactos/drivers/network/afd/include/afd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
============================================================================== --- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Mon Jul 18 11:27:01 2011 @@ -316,6 +316,7 @@ VOID NTAPI AfdCancelHandler(PDEVICE_OBJECT DeviceObject, PIRP Irp); VOID RetryDisconnectCompletion(PAFD_FCB FCB); +BOOLEAN CheckUnlockExtraBuffers(PAFD_FCB FCB, PIO_STACK_LOCATION IrpSp); /* read.c */
13 years, 5 months
1
0
0
0
[cgutman] 52724: - Fix copy paste error
by cgutman@svn.reactos.org
Author: cgutman Date: Mon Jul 18 04:25:08 2011 New Revision: 52724 URL:
http://svn.reactos.org/svn/reactos?rev=52724&view=rev
Log: - Fix copy paste error Modified: trunk/reactos/drivers/network/afd/afd/write.c Modified: trunk/reactos/drivers/network/afd/afd/write.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/wr…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] Mon Jul 18 04:25:08 2011 @@ -561,7 +561,7 @@ /* Check the size of the Address given ... */ if( NT_SUCCESS(Status) ) { - FCB->EventSelectDisabled &= ~AFD_EVENT_RECEIVE; + FCB->EventSelectDisabled &= ~AFD_EVENT_SEND; FCB->PollState &= ~AFD_EVENT_SEND; Status = QueueUserModeIrp(FCB, Irp, FUNCTION_SEND);
13 years, 5 months
1
0
0
0
← Newer
1
...
26
27
28
29
30
31
32
...
52
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Results per page:
10
25
50
100
200