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
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2011
----- 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
18 participants
498 discussions
Start a n
N
ew thread
[gedmurphy] 53101: Remove shell32_new, the real one is in the branch
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Sat Aug 6 12:51:02 2011 New Revision: 53101 URL:
http://svn.reactos.org/svn/reactos?rev=53101&view=rev
Log: Remove shell32_new, the real one is in the branch Removed: trunk/reactos/dll/win32/shell32_new/
13 years, 3 months
1
0
0
0
[cgutman] 53100: [MSAFD] - Remove a broken debug print
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Aug 6 12:01:09 2011 New Revision: 53100 URL:
http://svn.reactos.org/svn/reactos?rev=53100&view=rev
Log: [MSAFD] - Remove a broken debug print Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
============================================================================== --- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Sat Aug 6 12:01:09 2011 @@ -2366,9 +2366,6 @@ InfoData.Information.Boolean = *Boolean; } - AFD_DbgPrint(MID_TRACE,("XXX Info %x (Data %x)\n", - AfdInformationClass, *Ulong)); - /* Send IOCTL */ Status = NtDeviceIoControlFile((HANDLE)Socket->Handle, SockEvent,
13 years, 3 months
1
0
0
0
[tkreuzer] 53099: [GDI FONT DRIVER] - Implement font hash handling (adding fonts only atm) - Don't link win32k to ftfd.dll anymore - Dereference logical font, when deleting a DC
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Aug 6 11:10:42 2011 New Revision: 53099 URL:
http://svn.reactos.org/svn/reactos?rev=53099&view=rev
Log: [GDI FONT DRIVER] - Implement font hash handling (adding fonts only atm) - Don't link win32k to ftfd.dll anymore - Dereference logical font, when deleting a DC Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/CMakeLists.txt branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontrsrc.c branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/lfont.c branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/font.h branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/objects/dclife.c branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/objects/path.c Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
============================================================================== --- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/CMakeLists.txt [iso-8859-1] (original) +++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/CMakeLists.txt [iso-8859-1] Sat Aug 6 11:10:42 2011 @@ -203,7 +203,7 @@ dxguid libcntpr) -add_importlibs(win32k ntoskrnl hal ftfd) +add_importlibs(win32k ntoskrnl hal) add_pch(win32k pch.h) add_cd_file(TARGET win32k DESTINATION reactos/system32 FOR all) add_importlib_target(win32k.spec) Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontrsrc.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
============================================================================== --- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontrsrc.c [iso-8859-1] (original) +++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontrsrc.c [iso-8859-1] Sat Aug 6 11:10:42 2011 @@ -12,30 +12,265 @@ #include <debug.h> PFT gpftPublic; -static LIST_ENTRY glePrivatePFFList = {&glePrivatePFFList, &glePrivatePFFList}; -static LIST_ENTRY glePublicPFFList = {&glePublicPFFList, &glePublicPFFList}; +ULONG gulHashBucketId = 0; + +VOID +NTAPI +UpcaseString( + OUT PWSTR pwszDest, + IN PWSTR pwszSource, + IN ULONG cwc) +{ + WCHAR wc; + + while (--cwc) + { + wc = *pwszSource++; + if (wc == 0) break; + *pwszDest++ = RtlUpcaseUnicodeChar(wc); + } + + *pwszDest = 0; +} + + +static +ULONG +CalculateNameHash(PWSTR pwszName) +{ + ULONG iHash = 0; + WCHAR wc; + + while ((wc = *pwszName++) != 0) + { + iHash = _rotl(iHash, 7); + iHash += wc; + } + + return iHash; +} + + +static +PHASHBUCKET +HASHBUCKET_Allocate(void) +{ + PHASHBUCKET pbkt; + + + pbkt = ExAllocatePoolWithTag(PagedPool, + sizeof(HASHBUCKET), + GDITAG_PFE_HASHBUCKET); + if (!pbkt) return NULL; + + RtlZeroMemory(pbkt, sizeof(HASHBUCKET)); + pbkt->ulTime = InterlockedIncrement((LONG*)gulHashBucketId); + + return pbkt; +} static BOOL -PFF_bCompareFiles( - PPFF ppff, - ULONG cFiles, - PFONTFILEVIEW apffv[]) -{ - ULONG i; - - /* Check if number of files matches */ - if (ppff->cFiles != cFiles) return FALSE; - - /* Loop all files */ - for (i = 0; i < cFiles; i++) - { - /* Check if the files match */ - if (apffv[i] != ppff->apffv[i]) return FALSE; - } +HASHBUCKET_bLinkPFE( + IN PHASHBUCKET pbkt, + IN PPFE ppfe) +{ + PPFELINK ppfel; + + ppfel = ExAllocatePoolWithTag(PagedPool, sizeof(PFELINK), GDITAG_PFE_LINK); + if (!ppfel) + { + return FALSE; + } + + ppfel->ppfe = ppfe; + + ppfel->ppfelNext = pbkt->ppfelEnumHead; + pbkt->ppfelEnumHead = ppfel; + if (!ppfel->ppfelNext) pbkt->ppfelEnumTail = ppfel; return TRUE; } + +static +VOID +HASHBUCKET_vUnlinkPFE( + IN PHASHBUCKET pbkt, + IN PPFE ppfe) +{ + PPFELINK ppfel, ppfelPrev; + + /* List must not be empty */ + ASSERT(pbkt->ppfelEnumHead); + ASSERT(pbkt->ppfelEnumTail); + + /* First check the list head */ + ppfel = pbkt->ppfelEnumHead; + if (ppfel->ppfe == ppfe) + { + pbkt->ppfelEnumHead = ppfel->ppfelNext; + ppfelPrev = NULL; + } + else + { + /* Loop through the rest of the list */ + while (TRUE) + { + ppfelPrev = ppfel; + ppfel = ppfel->ppfelNext; + + if (!ppfel) + { + DPRINT1("PFE not found!\n"); + ASSERT(FALSE); + } + + if (ppfel && (ppfel->ppfe == ppfe)) + { + ppfelPrev->ppfelNext = ppfel->ppfelNext; + break; + } + } + } + + /* Check list tail */ + if (ppfel == pbkt->ppfelEnumTail) pbkt->ppfelEnumTail = ppfelPrev; + + /* Free the PFELINK */ + ExFreePoolWithTag(ppfel, GDITAG_PFE_LINK); +} + +static +PFONTHASH +FONTHASH_Allocate( + FONT_HASH_TYPE fht, + ULONG cBuckets) +{ + PFONTHASH pfh; + + pfh = ExAllocatePoolWithTag(PagedPool, + sizeof(FONTHASH) + cBuckets * sizeof(PVOID), + GDITAG_PFE_HASHTABLE); + + if (!pfh) return NULL; + + pfh->id = 'HSAH'; + pfh->fht = fht; + pfh->cBuckets = cBuckets; + pfh->cUsed = 0; + pfh->cCollisions = 0; + pfh->pbktFirst = NULL; + pfh->pbktLast = NULL; + RtlZeroMemory(pfh->apbkt, cBuckets * sizeof(PVOID)); + + return pfh; +} + + +static +VOID +FONTHASH_vInsertBucket( + PFONTHASH pfh, + PHASHBUCKET pbkt, + ULONG iHashValue) +{ + ULONG iHashIndex = iHashValue % pfh->cBuckets; + + pbkt->iHashValue = iHashValue; + + /* Insert the bucket into the list */ + pbkt->pbktPrev = pfh->pbktLast; + pbkt->pbktNext = NULL; + pfh->pbktLast = pbkt; + if (!pfh->pbktFirst) pfh->pbktFirst = pbkt; + + /* Insert the bucket into the slot */ + pbkt->pbktCollision = pfh->apbkt[iHashIndex]; + pfh->apbkt[iHashIndex] = pbkt; + + /* Update counter */ + if (pbkt->pbktCollision) pfh->cCollisions++; + else pfh->cUsed++; +} + + + +static +PHASHBUCKET +FONTHASH_pbktFindBucketByName( + PFONTHASH pfh, + PWSTR pwszCapName, + ULONG iHashValue) +{ + ULONG iHashIndex = iHashValue % pfh->cBuckets; + PHASHBUCKET pbkt; + + /* Loop all colliding hash buckets */ + for (pbkt = pfh->apbkt[iHashIndex]; pbkt; pbkt = pbkt->pbktCollision) + { + /* Quick check */ + if (pbkt->iHashValue != iHashValue) continue; + + /* Compare the font name */ + if (wcsncmp(pbkt->u.wcCapName, pwszCapName, LF_FACESIZE) == 0) break; + } + + return pbkt; +} + +static +VOID +FONTHASH_vInsertPFE( + PFONTHASH pfh, + PPFE ppfe) +{ + PIFIMETRICS pifi = ppfe->pifi; + PWSTR pwszName; + WCHAR awcCapName[LF_FACESIZE]; + ULONG iHashValue; + PHASHBUCKET pbkt; + + + if (pfh->fht == FHT_UFI) + { + ASSERT(FALSE); + } + else + { + if (pfh->fht == FHT_FACE) + pwszName = (PWSTR)((PUCHAR)pifi + pifi->dpwszFaceName); + else + pwszName = (PWSTR)((PUCHAR)pifi + pifi->dpwszFamilyName); + + UpcaseString(awcCapName, pwszName, LF_FACESIZE); + iHashValue = CalculateNameHash(awcCapName); + + pbkt = FONTHASH_pbktFindBucketByName(pfh, awcCapName, iHashValue); + } + + if (!pbkt) + { + pbkt = HASHBUCKET_Allocate(); + + if (!pbkt) + { + ASSERT(FALSE); + } + + RtlCopyMemory(pbkt->u.wcCapName, awcCapName, sizeof(awcCapName)); + + FONTHASH_vInsertBucket(pfh, pbkt, iHashValue); + } + + /* Finally add the PFE to the HASHBUCKET */ + if (!HASHBUCKET_bLinkPFE(pbkt, ppfe)) + { + ASSERT(FALSE); + } + + +} + BOOL NTAPI @@ -46,9 +281,26 @@ RtlZeroMemory(ppft, sizeof(PFT)); ppft->hsem = EngCreateSemaphore(); - if (!ppft->hsem) return FALSE; + if (!ppft->hsem) goto failed; + + ppft->cBuckets = MAX_FONT_LIST; + + ppft->pfhFace = FONTHASH_Allocate(FHT_FACE, MAX_FONT_LIST); + if (!ppft->pfhFace) goto failed; + + ppft->pfhFamily = FONTHASH_Allocate(FHT_FAMILY, MAX_FONT_LIST); + if (!ppft->pfhFace) goto failed; + + ppft->pfhUFI = FONTHASH_Allocate(FHT_UFI, MAX_FONT_LIST); + if (!ppft->pfhFace) goto failed; return TRUE; + +failed: + // FIXME: cleanup + ASSERT(FALSE); + + return FALSE; } static @@ -60,11 +312,11 @@ ULONG cFiles, ULONG iFileNameHash) { - ULONG iListIndex = iFileNameHash % MAX_FONT_LIST; + ULONG iListIndex = iFileNameHash % ppft->cBuckets; PPFF ppff = NULL; - /* Acquire PFT lock */ - EngAcquireSemaphore(ppft->hsem); + /* Acquire PFT lock for reading */ + EngAcquireSemaphoreShared(ppft->hsem); /* Loop all PFFs in the slot */ for (ppff = ppft->apPFF[iListIndex]; ppff; ppff = ppff->pPFFNext) @@ -82,28 +334,6 @@ return ppff; } -static -VOID -PFT_vInsertPFE( - PPFT ppft, - PPFE ppfe) -{ - UCHAR ajWinChatSet[2] = {0, DEFAULT_CHARSET}; - UCHAR *pjCharSets; - PIFIMETRICS pifi = ppfe->pifi; - - if (pifi->dpCharSets) - { - pjCharSets = (PUCHAR)pifi + pifi->dpCharSets; - } - else - { - ajWinChatSet[0] = pifi->jWinCharSet; - pjCharSets = ajWinChatSet; - } - - -} static VOID @@ -112,7 +342,7 @@ PPFF ppff, ULONG iFileNameHash) { - ULONG i, iListIndex = iFileNameHash % MAX_FONT_LIST; + ULONG i, iHashIndex = iFileNameHash % ppft->cBuckets; ppff->iFileNameHash = iFileNameHash; @@ -121,34 +351,23 @@ /* Insert the font file into the hash bucket */ ppff->pPFFPrev = NULL; - ppff->pPFFNext = ppft->apPFF[iListIndex]; - ppft->apPFF[iListIndex] = ppff; + ppff->pPFFNext = ppft->apPFF[iHashIndex]; + ppft->apPFF[iHashIndex] = ppff; + + ppft->cFiles++; /* Loop all PFE's */ for (i = 0; i < ppff->cFonts; i++) { - PFT_vInsertPFE(ppft, &ppff->apfe[i]); + FONTHASH_vInsertPFE(ppft->pfhFace, &ppff->apfe[i]); + FONTHASH_vInsertPFE(ppft->pfhFamily, &ppff->apfe[i]); + //FONTHASH_vInsertPFE(ppft->pfhUFI, &ppff->apfe[i]); } /* Release PFT lock */ EngReleaseSemaphore(ppft->hsem); } -static -ULONG -CalculateNameHash(PWSTR pwszName) -{ - ULONG iHash = 0; - WCHAR wc; - - while ((wc = *pwszName++) != 0) - { - iHash = _rotl(iHash, 7); - iHash += wc; - } - - return iHash; -} @@ -232,7 +451,6 @@ ULONG cjSize; DESIGNVECTOR dv; INT iRes = 0; - ULONG i; /* Check parameters */ if (cFiles == 0 || cFiles > FD_MAX_FILES || @@ -261,10 +479,7 @@ } /* Convert the string to upper case */ - for (i = 0; i < cwc; i++) - { - pwszUpcase[i] = RtlUpcaseUnicodeChar(pwszFiles[i]); - } + UpcaseString(pwszUpcase, pwszFiles, cwc); /* Check if we have a DESIGNVECTOR */ if (pdv) Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/lfont.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
============================================================================== --- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/lfont.c [iso-8859-1] (original) +++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/lfont.c [iso-8859-1] Sat Aug 6 11:10:42 2011 @@ -47,6 +47,11 @@ plfnt->fl = fl; plfnt->elfexw = *pelfw; + /* Upcase the font name */ + UpcaseString(plfnt->awchFace, + pelfw->elfEnumLogfontEx.elfLogFont.lfFaceName, + LF_FACESIZE); + /* Set client data */ GDIOBJ_vSetObjectAttr(&plfnt->baseobj, pvCliData); Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/font.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
============================================================================== --- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/font.h [iso-8859-1] (original) +++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/font.h [iso-8859-1] Sat Aug 6 11:10:42 2011 @@ -97,43 +97,50 @@ ULONG cFonts; void *pPvtDataHead; PFONTFILEVIEW apffv[FD_MAX_FILES]; - PFE apfe[1]; + PFE apfe[]; } PFF, *PPFF; +typedef struct _PFELINK +{ + struct _PFELINK *ppfelNext; + PPFE ppfe; +} PFELINK, *PPFELINK; + typedef struct _HASHBUCKET { struct _HASHBUCKET *pbktCollision; - // PFELINK *ppfelEnumHead; - // PFELINK *ppfelEnumTail; + PFELINK *ppfelEnumHead; + PFELINK *ppfelEnumTail; ULONG cTrueType; + ULONG iHashValue; FLONG fl; struct _HASHBUCKET * pbktPrev; struct _HASHBUCKET * pbktNext; ULONG ulTime; union { - WCHAR wcCapName[1]; + WCHAR wcCapName[LF_FACESIZE]; // LF_FULLFACESIZE? dynamic? UNIVERSAL_FONT_ID ufi; } u; } HASHBUCKET, *PHASHBUCKET; typedef enum _FONT_HASH_TYPE { + FHT_FACE = 0, FHT_FAMILY = 1, - FHT_FACE, - FHT_UFI, + FHT_UFI = 2, } FONT_HASH_TYPE; -typedef struct +typedef struct _FONTHASH { DWORD id; FONT_HASH_TYPE fht; ULONG cBuckets; ULONG cUsed; ULONG cCollisions; - HASHBUCKET * pbktFirst; - HASHBUCKET * pbktLast; - HASHBUCKET * apbkt[]; + PHASHBUCKET pbktFirst; + PHASHBUCKET pbktLast; + PHASHBUCKET apbkt[]; } FONTHASH, *PFONTHASH; #define MAX_FONT_LIST 100 @@ -150,7 +157,7 @@ HSEMAPHORE hsem; } PFT, *PPFT; -typedef struct +typedef struct _RFONTLINK { PRFONT prfntPrev; PRFONT prfntNext; @@ -325,6 +332,13 @@ ULONG acFaceNameGlyphs[8]; } ESTROBJ, *PESTROBJ; +VOID +NTAPI +UpcaseString( + OUT PWSTR pwszDest, + IN PWSTR pwszSource, + IN ULONG cwc); + FORCEINLINE PLFONT LFONT_ShareLockFont(HFONT hfont) @@ -398,3 +412,8 @@ #define DbgDefaultChannel 0x0 + +VOID +NTAPI +EngAcquireSemaphoreShared( + IN HSEMAPHORE hsem); Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/objects/dclife.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
============================================================================== --- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original) +++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Sat Aug 6 11:10:42 2011 @@ -358,6 +358,8 @@ DC_vSelectLineBrush(pdc, NULL); DC_vSelectPalette(pdc, NULL); + GDIOBJ_vDereferenceObject((PVOID)pdc->dclevel.plfnt); + /* Cleanup the dc brushes */ EBRUSHOBJ_vCleanup(&pdc->eboFill); EBRUSHOBJ_vCleanup(&pdc->eboLine); Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/objects/path.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
============================================================================== --- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original) +++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/objects/path.c [iso-8859-1] Sat Aug 6 11:10:42 2011 @@ -2061,6 +2061,8 @@ GLYPHMETRICS gm; DWORD dwSize; void *outline; + + __debugbreak(); #if 0 dwSize = ftGdiGetGlyphOutline( dc, str[idx],
13 years, 3 months
1
0
0
0
[ekohl] 53098: [SERVICES] Fix coding style. No code changes.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Aug 6 10:37:12 2011 New Revision: 53098 URL:
http://svn.reactos.org/svn/reactos?rev=53098&view=rev
Log: [SERVICES] Fix coding style. No code changes. Modified: trunk/reactos/base/system/services/database.c Modified: trunk/reactos/base/system/services/database.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/datab…
============================================================================== --- trunk/reactos/base/system/services/database.c [iso-8859-1] (original) +++ trunk/reactos/base/system/services/database.c [iso-8859-1] Sat Aug 6 10:37:12 2011 @@ -1289,18 +1289,26 @@ ServiceEntry = ServiceListHead.Flink; while (ServiceEntry != &ServiceListHead) { - CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry); + CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry); + /* Build the safe boot path */ wcscpy(szSafeBootServicePath, L"SYSTEM\\CurrentControlSet\\Control\\SafeBoot"); - switch(GetSystemMetrics(SM_CLEANBOOT)) + + switch (GetSystemMetrics(SM_CLEANBOOT)) { /* NOTE: Assumes MINIMAL (1) and DSREPAIR (3) load same items */ case 1: - case 3: wcscat(szSafeBootServicePath, L"\\Minimal\\"); break; - case 2: wcscat(szSafeBootServicePath, L"\\Network\\"); break; - } - if(GetSystemMetrics(SM_CLEANBOOT)) + case 3: + wcscat(szSafeBootServicePath, L"\\Minimal\\"); + break; + + case 2: + wcscat(szSafeBootServicePath, L"\\Network\\"); + break; + } + + if (GetSystemMetrics(SM_CLEANBOOT)) { /* If key does not exist then do not assume safe mode */ dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, @@ -1308,20 +1316,22 @@ 0, KEY_READ, &hKey); - if(dwError == ERROR_SUCCESS) + if (dwError == ERROR_SUCCESS) { RegCloseKey(hKey); + /* Finish Safe Boot path off */ wcsncat(szSafeBootServicePath, CurrentService->lpServiceName, MAX_PATH - wcslen(szSafeBootServicePath)); + /* Check that the key is in the Safe Boot path */ dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szSafeBootServicePath, 0, KEY_READ, &hKey); - if(dwError != ERROR_SUCCESS) + if (dwError != ERROR_SUCCESS) { /* Mark service as visited so it is not auto-started */ CurrentService->ServiceVisited = TRUE; @@ -1339,7 +1349,8 @@ CurrentService->ServiceVisited = FALSE; } } - ServiceEntry = ServiceEntry->Flink; + + ServiceEntry = ServiceEntry->Flink; } /* Start all services which are members of an existing group */
13 years, 3 months
1
0
0
0
[cgutman] 53097: [LWIP] - Fix a couple bugs in my previous commit
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Aug 6 10:07:24 2011 New Revision: 53097 URL:
http://svn.reactos.org/svn/reactos?rev=53097&view=rev
Log: [LWIP] - Fix a couple bugs in my previous commit Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Sat Aug 6 10:07:24 2011 @@ -476,7 +476,6 @@ PVOID Context ) { PTDI_BUCKET Bucket; - KIRQL OldIrql; PUCHAR DataBuffer; UINT DataLen, Received; NTSTATUS Status; @@ -485,8 +484,6 @@ ReceiveLength, Connection->SocketContext)); NdisQueryBuffer(Buffer, &DataBuffer, &DataLen); - - LockObject(Connection, &OldIrql); Status = LibTCPGetDataFromConnectionQueue(Connection, DataBuffer, DataLen, &Received); @@ -498,7 +495,6 @@ if (!Bucket) { TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Failed to allocate bucket\n")); - UnlockObject(Connection, OldIrql); return STATUS_NO_MEMORY; } @@ -506,7 +502,7 @@ Bucket->Request.RequestNotifyObject = Complete; Bucket->Request.RequestContext = Context; - InsertTailList( &Connection->ReceiveRequest, &Bucket->Entry ); + ExInterlockedInsertTailList( &Connection->ReceiveRequest, &Bucket->Entry, &Connection->Lock ); TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Queued read irp\n")); TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Leaving. Status = STATUS_PENDING\n")); @@ -517,8 +513,6 @@ { (*BytesReceived) = Received; } - - UnlockObject(Connection, OldIrql); return Status; } 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] Sat Aug 6 10:07:24 2011 @@ -83,9 +83,13 @@ PQUEUE_ENTRY qp; struct pbuf* p; NTSTATUS Status = STATUS_PENDING; - UINT ReadLength, ExistingDataLength; + UINT ReadLength, ExistingDataLength, SpaceLeft; + KIRQL OldIrql; (*Received) = 0; + SpaceLeft = RecvLen; + + LockObject(Connection, &OldIrql); if (!IsListEmpty(&Connection->PacketQueue)) { @@ -94,14 +98,37 @@ p = qp->p; ExistingDataLength = (*Received); - ReadLength = MIN(p->tot_len, RecvLen); - + Status = STATUS_SUCCESS; + + ReadLength = MIN(p->tot_len, SpaceLeft); + if (ReadLength != p->tot_len) + { + if (ExistingDataLength) + { + /* The packet was too big but we used some data already so give it another shot later */ + InsertHeadList(&Connection->PacketQueue, &qp->ListEntry); + break; + } + else + { + /* The packet is just too big to fit fully in our buffer, even when empty so + * return an informative status but still copy all the data we can fit. + */ + Status = STATUS_BUFFER_OVERFLOW; + } + } + + UnlockObject(Connection, OldIrql); + + /* Return to a lower IRQL because the receive buffer may be pageable memory */ for (; (*Received) < ReadLength + ExistingDataLength; (*Received) += p->len, p = p->next) { RtlCopyMemory(RecvBuffer + (*Received), p->payload, p->len); } - RecvLen -= ReadLength; + LockObject(Connection, &OldIrql); + + SpaceLeft -= ReadLength; /* Use this special pbuf free callback function because we're outside tcpip thread */ pbuf_free_callback(qp->p); @@ -110,9 +137,10 @@ if (!RecvLen) break; + + if (Status != STATUS_SUCCESS) + break; } - - Status = STATUS_SUCCESS; } else { @@ -121,6 +149,8 @@ else Status = STATUS_PENDING; } + + UnlockObject(Connection, OldIrql); return Status; }
13 years, 3 months
1
0
0
0
[cgutman] 53096: [LWIP] - Optimize reading from the packet queue by trying to fill the caller's buffer with as many packets as we can fit before returning
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Aug 6 09:36:13 2011 New Revision: 53096 URL:
http://svn.reactos.org/svn/reactos?rev=53096&view=rev
Log: [LWIP] - Optimize reading from the packet queue by trying to fill the caller's buffer with as many packets as we can fit before returning 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] Sat Aug 6 09:36:13 2011 @@ -69,6 +69,8 @@ PLIST_ENTRY Entry; PQUEUE_ENTRY qp = NULL; + if (IsListEmpty(&Connection->PacketQueue)) return NULL; + Entry = RemoveHeadList(&Connection->PacketQueue); qp = CONTAINING_RECORD(Entry, QUEUE_ENTRY, ListEntry); @@ -81,23 +83,34 @@ PQUEUE_ENTRY qp; struct pbuf* p; NTSTATUS Status = STATUS_PENDING; + UINT ReadLength, ExistingDataLength; + + (*Received) = 0; if (!IsListEmpty(&Connection->PacketQueue)) { - qp = LibTCPDequeuePacket(Connection); - p = qp->p; - - RecvLen = MIN(p->tot_len, RecvLen); - - for ((*Received) = 0; (*Received) < RecvLen; (*Received) += p->len, p = p->next) + while ((qp = LibTCPDequeuePacket(Connection)) != NULL) { - RtlCopyMemory(RecvBuffer + (*Received), p->payload, p->len); + p = qp->p; + ExistingDataLength = (*Received); + + ReadLength = MIN(p->tot_len, RecvLen); + + for (; (*Received) < ReadLength + ExistingDataLength; (*Received) += p->len, p = p->next) + { + RtlCopyMemory(RecvBuffer + (*Received), p->payload, p->len); + } + + RecvLen -= ReadLength; + + /* Use this special pbuf free callback function because we're outside tcpip thread */ + pbuf_free_callback(qp->p); + + ExFreeToNPagedLookasideList(&QueueEntryLookasideList, qp); + + if (!RecvLen) + break; } - - /* Use this special pbuf free callback function because we're outside tcpip thread */ - pbuf_free_callback(qp->p); - - ExFreeToNPagedLookasideList(&QueueEntryLookasideList, qp); Status = STATUS_SUCCESS; } @@ -107,8 +120,6 @@ Status = STATUS_SUCCESS; else Status = STATUS_PENDING; - - (*Received) = 0; } return Status;
13 years, 3 months
1
0
0
0
[cgutman] 53095: [TCPIP] - Fail sends if the connection is shutdown in the send direction - Complete receives with 0 bytes if the connection is shutdown in the receive direction - Fixes hangs in ws...
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Aug 6 08:45:46 2011 New Revision: 53095 URL:
http://svn.reactos.org/svn/reactos?rev=53095&view=rev
Log: [TCPIP] - Fail sends if the connection is shutdown in the send direction - Complete receives with 0 bytes if the connection is shutdown in the receive direction - Fixes hangs in ws2_32:sock and wininet:ftp Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/titypes.h branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/titypes.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/titypes.h [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/titypes.h [iso-8859-1] Sat Aug 6 08:45:46 2011 @@ -269,13 +269,14 @@ LIST_ENTRY ShutdownRequest;/* Queued shutdown requests */ LIST_ENTRY PacketQueue; /* Queued received packets waiting to be processed */ - - /* Signals */ - UINT SignalState; /* Active signals from oskit */ /* Disconnect Timer */ KTIMER DisconnectTimer; KDPC DisconnectDpc; + + /* Socket state */ + BOOLEAN SendShutdown; + BOOLEAN ReceiveShutdown; struct _CONNECTION_ENDPOINT *Next; /* Next connection in address file list */ } CONNECTION_ENDPOINT, *PCONNECTION_ENDPOINT; Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Sat Aug 6 08:45:46 2011 @@ -486,11 +486,12 @@ NdisQueryBuffer(Buffer, &DataBuffer, &DataLen); + LockObject(Connection, &OldIrql); + Status = LibTCPGetDataFromConnectionQueue(Connection, DataBuffer, DataLen, &Received); if (Status == STATUS_PENDING) { - LockObject(Connection, &OldIrql); /* Freed in TCPSocketState */ Bucket = ExAllocatePoolWithTag(NonPagedPool, sizeof(*Bucket), TDI_BUCKET_TAG); @@ -508,8 +509,6 @@ InsertTailList( &Connection->ReceiveRequest, &Bucket->Entry ); TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Queued read irp\n")); - UnlockObject(Connection, OldIrql); - TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Leaving. Status = STATUS_PENDING\n")); (*BytesReceived) = 0; @@ -518,6 +517,8 @@ { (*BytesReceived) = Received; } + + UnlockObject(Connection, OldIrql); return Status; } 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] Sat Aug 6 08:45:46 2011 @@ -69,7 +69,7 @@ PLIST_ENTRY Entry; PQUEUE_ENTRY qp = NULL; - Entry = ExInterlockedRemoveHeadList(&Connection->PacketQueue, &Connection->Lock); + Entry = RemoveHeadList(&Connection->PacketQueue); qp = CONTAINING_RECORD(Entry, QUEUE_ENTRY, ListEntry); @@ -103,7 +103,12 @@ } else { - Status = STATUS_PENDING; + if (Connection->ReceiveShutdown) + Status = STATUS_SUCCESS; + else + Status = STATUS_PENDING; + + (*Received) = 0; } return Status; @@ -150,6 +155,7 @@ err_t InternalRecvEventHandler(void *arg, PTCP_PCB pcb, struct pbuf *p, const err_t err) { + PCONNECTION_ENDPOINT Connection = arg; u32_t len; /* Make sure the socket didn't get closed */ @@ -184,7 +190,7 @@ } else { - LibTCPEnqueuePacket((PCONNECTION_ENDPOINT)arg, p); + LibTCPEnqueuePacket(Connection, p); tcp_recved(pcb, p->tot_len); @@ -197,6 +203,7 @@ * but note that send is still possible in this state so we don't close the * whole socket here (by calling tcp_close()) as that would violate TCP specs */ + Connection->ReceiveShutdown = TRUE; TCPFinEventHandler(arg, ERR_OK); } @@ -406,6 +413,12 @@ goto done; } + if (msg->Input.Send.Connection->SendShutdown) + { + msg->Output.Send.Error = ERR_CLSD; + goto done; + } + if (tcp_sndbuf((PTCP_PCB)msg->Input.Send.Connection->SocketContext) < msg->Input.Send.DataLength) { msg->Output.Send.Error = ERR_INPROGRESS; @@ -537,6 +550,14 @@ if (msg->Output.Shutdown.Error) { msg->Input.Shutdown.Connection->SocketContext = pcb; + } + else + { + if (msg->Input.Shutdown.shut_rx) + msg->Input.Shutdown.Connection->ReceiveShutdown = TRUE; + + if (msg->Input.Shutdown.shut_tx) + msg->Input.Shutdown.Connection->SendShutdown = TRUE; } done:
13 years, 3 months
1
0
0
0
[cgutman] 53094: [IP] - Fix the bytes sent value returned when the send fails
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Aug 6 06:18:02 2011 New Revision: 53094 URL:
http://svn.reactos.org/svn/reactos?rev=53094&view=rev
Log: [IP] - Fix the bytes sent value returned when the send fails Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Sat Aug 6 06:18:02 2011 @@ -570,11 +570,13 @@ InsertTailList( &Connection->SendRequest, &Bucket->Entry ); TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Queued write irp\n")); } + else if (Status == STATUS_SUCCESS) + { + *BytesSent = SendLength; + } else { - TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Got status %x, bytes %d\n", - Status, SendLength)); - *BytesSent = SendLength; + *BytesSent = 0; } UnlockObject(Connection, OldIrql);
13 years, 3 months
1
0
0
0
[cgutman] 53093: [IP] - Fix unused variable warnings
by cgutman@svn.reactos.org
Author: cgutman Date: Fri Aug 5 23:09:18 2011 New Revision: 53093 URL:
http://svn.reactos.org/svn/reactos?rev=53093&view=rev
Log: [IP] - Fix unused variable warnings Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] Fri Aug 5 23:09:18 2011 @@ -228,10 +228,7 @@ VOID FlushAllQueues(PCONNECTION_ENDPOINT Connection, NTSTATUS Status) -{ - PTDI_BUCKET Bucket; - PLIST_ENTRY Entry; - +{ ReferenceObject(Connection); // flush receive queue
13 years, 3 months
1
0
0
0
[cmihail] 53092: [lwIP] - fix build because of missing rosip.h in sys_arch.c [TCPIP] - implement disconnect timer - minor code refactoring
by cmihail@svn.reactos.org
Author: cmihail Date: Fri Aug 5 21:33:20 2011 New Revision: 53092 URL:
http://svn.reactos.org/svn/reactos?rev=53092&view=rev
Log: [lwIP] - fix build because of missing rosip.h in sys_arch.c [TCPIP] - implement disconnect timer - minor code refactoring Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/tcp.h branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/sys_arch.c Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/tcp.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/tcp.h [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/tcp.h [iso-8859-1] Fri Aug 5 21:33:20 2011 @@ -141,6 +141,7 @@ NTSTATUS TCPDisconnect( PCONNECTION_ENDPOINT Connection, UINT Flags, + PLARGE_INTEGER Timeout, PTDI_CONNECTION_INFORMATION ConnInfo, PTDI_CONNECTION_INFORMATION ReturnInfo, PTCP_COMPLETION_ROUTINE Complete, @@ -192,4 +193,21 @@ TCPUpdateInterfaceIPInformation(PIP_INTERFACE IF); VOID -FlushAllQueues(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status); +FlushListenQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status); + +VOID +FlushConnectQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status); + +VOID +FlushReceiveQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked); + +VOID +FlushSendQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked); + +VOID +FlushShutdownQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked); + +VOID +FlushAllQueues(PCONNECTION_ENDPOINT Connection, NTSTATUS Status); + +VOID CompleteBucket(PCONNECTION_ENDPOINT Connection, PTDI_BUCKET Bucket, const BOOLEAN Synchronous); Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] Fri Aug 5 21:33:20 2011 @@ -518,7 +518,7 @@ { Status = TCPDisconnect(TranContext->Handle.ConnectionContext, DisReq->RequestFlags, - //DisReq->RequestSpecific, /* FIXME */ + DisReq->RequestSpecific, DisReq->RequestConnectionInformation, DisReq->ReturnConnectionInformation, DispDataRequestComplete, Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] Fri Aug 5 21:33:20 2011 @@ -46,7 +46,6 @@ ExFreePoolWithTag(Bucket, TDI_BUCKET_TAG); } -static VOID CompleteBucket(PCONNECTION_ENDPOINT Connection, PTDI_BUCKET Bucket, const BOOLEAN Synchronous) { @@ -63,20 +62,138 @@ } VOID -FlushReceiveQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) -{ - PTDI_BUCKET Bucket; - PLIST_ENTRY Entry; - - ReferenceObject(Connection); - - while ((Entry = ExInterlockedRemoveHeadList(&Connection->ReceiveRequest, &Connection->Lock))) +FlushReceiveQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked) +{ + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); + + if (interlocked) + { + while ((Entry = ExInterlockedRemoveHeadList(&Connection->ReceiveRequest, &Connection->Lock))) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + TI_DbgPrint(DEBUG_TCP, + ("Completing Receive request: %x %x\n", + Bucket->Request, Status)); + + Bucket->Status = Status; + Bucket->Information = 0; + + CompleteBucket(Connection, Bucket, FALSE); + } + } + else + { + while (!IsListEmpty(&Connection->ReceiveRequest)) + { + Entry = RemoveHeadList(&Connection->ReceiveRequest); + + Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); + + Bucket->Information = 0; + Bucket->Status = Status; + + CompleteBucket(Connection, Bucket, FALSE); + } + } + + DereferenceObject(Connection); +} + +VOID +FlushSendQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked) +{ + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); + + if (interlocked) + { + while ((Entry = ExInterlockedRemoveHeadList(&Connection->SendRequest, &Connection->Lock))) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + TI_DbgPrint(DEBUG_TCP, + ("Completing Send request: %x %x\n", + Bucket->Request, Status)); + + Bucket->Status = Status; + Bucket->Information = 0; + + CompleteBucket(Connection, Bucket, FALSE); + } + } + else + { + while (!IsListEmpty(&Connection->SendRequest)) + { + Entry = RemoveHeadList(&Connection->SendRequest); + + Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); + + Bucket->Information = 0; + Bucket->Status = Status; + + CompleteBucket(Connection, Bucket, FALSE); + } + } + + DereferenceObject(Connection); +} + +VOID +FlushShutdownQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked) +{ + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); + + if (interlocked) + { + while ((Entry = ExInterlockedRemoveHeadList(&Connection->ShutdownRequest, &Connection->Lock))) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + Bucket->Status = Status; + Bucket->Information = 0; + + CompleteBucket(Connection, Bucket, FALSE); + } + } + else + { + while (!IsListEmpty(&Connection->ShutdownRequest)) + { + Entry = RemoveHeadList(&Connection->ShutdownRequest); + + Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); + + Bucket->Information = 0; + Bucket->Status = Status; + + CompleteBucket(Connection, Bucket, FALSE); + } + } + + DereferenceObject(Connection); +} + +VOID +FlushConnectQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) +{ + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); + + while ((Entry = ExInterlockedRemoveHeadList(&Connection->ConnectRequest, &Connection->Lock))) { Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - TI_DbgPrint(DEBUG_TCP, - ("Completing Receive request: %x %x\n", - Bucket->Request, Status)); Bucket->Status = Status; Bucket->Information = 0; @@ -88,26 +205,37 @@ } VOID -FlushAllQueues(PCONNECTION_ENDPOINT Connection, NTSTATUS Status) -{ - PTDI_BUCKET Bucket; - PLIST_ENTRY Entry; - - ReferenceObject(Connection); - - while ((Entry = ExInterlockedRemoveHeadList(&Connection->ReceiveRequest, &Connection->Lock))) +FlushListenQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) +{ + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); + + while ((Entry = ExInterlockedRemoveHeadList(&Connection->ListenRequest, &Connection->Lock))) { Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - TI_DbgPrint(DEBUG_TCP, - ("Completing Receive request: %x %x\n", - Bucket->Request, Status)); Bucket->Status = Status; Bucket->Information = 0; + DereferenceObject(Bucket->AssociatedEndpoint); CompleteBucket(Connection, Bucket, FALSE); } + + DereferenceObject(Connection); +} + +VOID +FlushAllQueues(PCONNECTION_ENDPOINT Connection, NTSTATUS Status) +{ + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); + + // flush receive queue + FlushReceiveQueue(Connection, Status, TRUE); /* We completed the reads successfully but we need to return failure now */ if (Status == STATUS_SUCCESS) @@ -115,40 +243,17 @@ Status = STATUS_FILE_CLOSED; } - while ((Entry = ExInterlockedRemoveHeadList(&Connection->ListenRequest, &Connection->Lock))) - { - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - Bucket->Status = Status; - Bucket->Information = 0; - - DereferenceObject(Bucket->AssociatedEndpoint); - CompleteBucket(Connection, Bucket, FALSE); - } - - while ((Entry = ExInterlockedRemoveHeadList(&Connection->SendRequest, &Connection->Lock))) - { - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - TI_DbgPrint(DEBUG_TCP, - ("Completing Send request: %x %x\n", - Bucket->Request, Status)); - - Bucket->Status = Status; - Bucket->Information = 0; - - CompleteBucket(Connection, Bucket, FALSE); - } - - while ((Entry = ExInterlockedRemoveHeadList(&Connection->ConnectRequest, &Connection->Lock))) - { - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - Bucket->Status = Status; - Bucket->Information = 0; - - CompleteBucket(Connection, Bucket, FALSE); - } + // flush listen queue + FlushListenQueue(Connection, Status); + + // flush send queue + FlushSendQueue(Connection, Status, TRUE); + + // flush connect queue + FlushConnectQueue(Connection, Status); + + // flush shutdown queue + FlushShutdownQueue(Connection, Status, TRUE); DereferenceObject(Connection); } @@ -166,7 +271,7 @@ if (err == ERR_OK && Connection->SocketContext) { /* Just flush the receive queue and get out of here */ - FlushReceiveQueue(Connection, STATUS_SUCCESS); + FlushReceiveQueue(Connection, STATUS_SUCCESS, TRUE); } else { @@ -331,6 +436,18 @@ CompleteBucket(Connection, Bucket, FALSE); } } + + // If we completed all outstanding send requests then finish all pending shutdown requests, + // cancel the timer and dereference the connection + if (IsListEmpty(&Connection->SendRequest)) + { + FlushShutdownQueue(Connection, STATUS_SUCCESS, FALSE); + + if (KeCancelTimer(&Connection->DisconnectTimer)) + { + DereferenceObject(Connection); + } + } DereferenceObject(Connection); } Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Fri Aug 5 21:33:20 2011 @@ -23,6 +23,51 @@ #include "rosip.h" +VOID NTAPI +DisconnectTimeoutDpc(PKDPC Dpc, + PVOID DeferredContext, + PVOID SystemArgument1, + PVOID SystemArgument2) +{ + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)DeferredContext; + PLIST_ENTRY Entry; + PTDI_BUCKET Bucket; + NTSTATUS Status; + + LockObjectAtDpcLevel(Connection); + + /* We timed out waiting for pending sends so force it to shutdown */ + Status = TCPTranslateError(LibTCPShutdown(Connection, 0, 1)); + + while (!IsListEmpty(&Connection->SendRequest)) + { + Entry = RemoveHeadList(&Connection->SendRequest); + + Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); + + Bucket->Information = 0; + Bucket->Status = STATUS_FILE_CLOSED; + + CompleteBucket(Connection, Bucket, FALSE); + } + + while (!IsListEmpty(&Connection->ShutdownRequest)) + { + Entry = RemoveHeadList( &Connection->ShutdownRequest ); + + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + Bucket->Status = STATUS_TIMEOUT; + Bucket->Information = 0; + + CompleteBucket(Connection, Bucket, FALSE); + } + + UnlockObjectFromDpcLevel(Connection); + + DereferenceObject(Connection); +} + VOID ConnectionFree(PVOID Object) { PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)Object; @@ -57,6 +102,10 @@ InitializeListHead(&Connection->SendRequest); InitializeListHead(&Connection->ShutdownRequest); InitializeListHead(&Connection->PacketQueue); + + /* Initialize disconnect timer */ + KeInitializeTimer(&Connection->DisconnectTimer); + KeInitializeDpc(&Connection->DisconnectDpc, DisconnectTimeoutDpc, Connection); /* Save client context pointer */ Connection->ClientContext = ClientContext; @@ -331,13 +380,16 @@ NTSTATUS TCPDisconnect ( PCONNECTION_ENDPOINT Connection, UINT Flags, + PLARGE_INTEGER Timeout, PTDI_CONNECTION_INFORMATION ConnInfo, PTDI_CONNECTION_INFORMATION ReturnInfo, PTCP_COMPLETION_ROUTINE Complete, PVOID Context ) { NTSTATUS Status = STATUS_INVALID_PARAMETER; - KIRQL OldIrql; + PTDI_BUCKET Bucket; + KIRQL OldIrql; + LARGE_INTEGER ActualTimeout; TI_DbgPrint(DEBUG_TCP,("[IP, TCPDisconnect] Called\n")); @@ -347,11 +399,57 @@ { if (Flags & TDI_DISCONNECT_RELEASE) { - Status = TCPTranslateError(LibTCPShutdown(Connection, 0, 1)); + if (IsListEmpty(&Connection->SendRequest)) + { + Status = TCPTranslateError(LibTCPShutdown(Connection, 0, 1)); + } + else if (Timeout && Timeout->QuadPart == 0) + { + FlushSendQueue(Connection, STATUS_FILE_CLOSED, FALSE); + TCPTranslateError(LibTCPShutdown(Connection, 0, 1)); + Status = STATUS_TIMEOUT; + } + else + { + /* Use the timeout specified or 1 second if none was specified */ + if (Timeout) + { + ActualTimeout = *Timeout; + } + else + { + ActualTimeout.QuadPart = -1000000; + } + + /* We couldn't complete the request now because we need to wait for outstanding I/O */ + Bucket = ExAllocatePoolWithTag(NonPagedPool, sizeof(*Bucket), TDI_BUCKET_TAG); + if (!Bucket) + { + UnlockObject(Connection, OldIrql); + return STATUS_NO_MEMORY; + } + + Bucket->Request.RequestNotifyObject = (PVOID)Complete; + Bucket->Request.RequestContext = Context; + + InsertTailList(&Connection->ShutdownRequest, &Bucket->Entry); + + ReferenceObject(Connection); + if (KeCancelTimer(&Connection->DisconnectTimer)) + { + DereferenceObject(Connection); + } + KeSetTimer(&Connection->DisconnectTimer, ActualTimeout, &Connection->DisconnectDpc); + + Status = STATUS_PENDING; + } } if ((Flags & TDI_DISCONNECT_ABORT) || !Flags) { + FlushReceiveQueue(Connection, STATUS_FILE_CLOSED, FALSE); + FlushSendQueue(Connection, STATUS_FILE_CLOSED, FALSE); + FlushShutdownQueue(Connection, STATUS_FILE_CLOSED, FALSE); Status = TCPTranslateError(LibTCPShutdown(Connection, 1, 1)); } } Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/sys_arch.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/sys_arch.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/sys_arch.c [iso-8859-1] Fri Aug 5 21:33:20 2011 @@ -3,6 +3,8 @@ #include "lwip/tcp.h" #include "lwip/pbuf.h" #include "lwip/err.h" + +#include "rosip.h" #include <debug.h>
13 years, 3 months
1
0
0
0
← Newer
1
...
39
40
41
42
43
44
45
...
50
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
Results per page:
10
25
50
100
200