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
March 2009
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
28 participants
483 discussions
Start a n
N
ew thread
[mkupfer] 39872: Evgeniy Boltik <bstsoft AT narod DOT ru> - Fix crash in Eng function - See issue #4173 for details.
by mkupfer@svn.reactos.org
Author: mkupfer Date: Wed Mar 4 19:34:33 2009 New Revision: 39872 URL:
http://svn.reactos.org/svn/reactos?rev=39872&view=rev
Log: Evgeniy Boltik <bstsoft AT narod DOT ru> - Fix crash in Eng function - See issue #4173 for details. Modified: trunk/reactos/subsystems/win32/win32k/eng/engmisc.c Modified: trunk/reactos/subsystems/win32/win32k/eng/engmisc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/engmisc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/engmisc.c [iso-8859-1] Wed Mar 4 19:34:33 2009 @@ -151,6 +151,7 @@ } } } + else return FALSE; EnterLeave->DestObj = psoDest; EnterLeave->OutputObj = *ppsoOutput;
15 years, 9 months
1
0
0
0
[mkupfer] 39871: Sascha Clausen <r4v3r AT hotmail DOT de> - Draw bullet for menu radio group. - See issue #4193 for details.
by mkupfer@svn.reactos.org
Author: mkupfer Date: Wed Mar 4 19:29:57 2009 New Revision: 39871 URL:
http://svn.reactos.org/svn/reactos?rev=39871&view=rev
Log: Sascha Clausen <r4v3r AT hotmail DOT de> - Draw bullet for menu radio group. - See issue #4193 for details. Modified: trunk/reactos/dll/win32/user32/windows/draw.c Modified: trunk/reactos/dll/win32/user32/windows/draw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] Wed Mar 4 19:29:57 2009 @@ -1276,11 +1276,12 @@ yc = myr.top + SmallDiam - SmallDiam/2; i = 234*SmallDiam/750; i = i < 1 ? 1 : i; - myr.left = xc - i+i/2; + myr.left = xc - i/2; myr.right = xc + i/2; - myr.top = yc - i+i/2; + myr.top = yc - i/2; myr.bottom = yc + i/2; - Pie(dc, myr.left, myr.top, myr.right, myr.bottom, xe, ye, xe, ye); + // if the start and the end point are equal, Pie() only draws a single line, so start one pixel lower + Pie(dc, myr.left, myr.top, myr.right, myr.bottom, xe, ye+1, xe, ye); break; case DFCS_MENUCHECK:
15 years, 9 months
1
0
0
0
[mkupfer] 39870: Evgeniy Boltik <bstsoft AT narod DOT ru> - Fix if param Brush == NULL. - See issue #4220 for details.
by mkupfer@svn.reactos.org
Author: mkupfer Date: Wed Mar 4 19:25:22 2009 New Revision: 39870 URL:
http://svn.reactos.org/svn/reactos?rev=39870&view=rev
Log: Evgeniy Boltik <bstsoft AT narod DOT ru> - Fix if param Brush == NULL. - See issue #4220 for details. Modified: trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c trunk/reactos/subsystems/win32/win32k/eng/bitblt.c trunk/reactos/tools/gendib/gendib.c Modified: trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c [iso-8859-1] Wed Mar 4 19:25:22 2009 @@ -369,7 +369,8 @@ else { /* FIXME: Shouldn't it be expanded? */ - Pattern = BltInfo->Brush->iSolidColor; + if (BltInfo->Brush) + Pattern = BltInfo->Brush->iSolidColor; } } Modified: trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] Wed Mar 4 19:25:22 2009 @@ -263,7 +263,8 @@ } else { - Pattern = BltInfo->Brush->iSolidColor; + if (BltInfo->Brush) + Pattern = BltInfo->Brush->iSolidColor; } } Modified: trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c [iso-8859-1] Wed Mar 4 19:25:22 2009 @@ -271,7 +271,8 @@ } else { - Pattern = ExpandSolidColor[BltInfo->Brush->iSolidColor]; + if (BltInfo->Brush) + Pattern = ExpandSolidColor[BltInfo->Brush->iSolidColor]; } } Modified: trunk/reactos/subsystems/win32/win32k/eng/bitblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] Wed Mar 4 19:25:22 2009 @@ -106,7 +106,7 @@ dx = DestRect->right - DestRect->left; dy = DestRect->bottom - DestRect->top; - if (Brush->iSolidColor == 0xFFFFFFFF) + if (Brush && Brush->iSolidColor == 0xFFFFFFFF) { GdiBrush = CONTAINING_RECORD( Brush, @@ -140,13 +140,13 @@ if (psurfPattern == NULL) { DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel( - Dest, DestRect->left + i, DestRect->top + j, Brush->iSolidColor); + Dest, DestRect->left + i, DestRect->top + j, Brush ? Brush->iSolidColor : 0); } else { DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel( Dest, DestRect->left + i, DestRect->top + j, - DIB_GetSource(psoPattern, (DestRect->left + i) % PatternWidth, PatternY, GdiBrush->XlateObject)); + DIB_GetSource(psoPattern, (DestRect->left + i) % PatternWidth, PatternY, GdiBrush ? GdiBrush->XlateObject : NULL)); } } c8++; @@ -180,7 +180,7 @@ // These functions are assigned if we're working with a DIB // The assigned functions depend on the bitsPerPixel of the DIB - DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_ColorFill(Dest, DestRect, Brush->iSolidColor); + DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_ColorFill(Dest, DestRect, Brush ? Brush->iSolidColor : 0); return TRUE; } @@ -218,7 +218,7 @@ BltInfo.Rop4 = Rop4; /* Pattern brush */ - if (ROP4_USES_PATTERN(Rop4) && Brush->iSolidColor == 0xFFFFFFFF) + if (ROP4_USES_PATTERN(Rop4) && Brush && Brush->iSolidColor == 0xFFFFFFFF) { GdiBrush = CONTAINING_RECORD(Brush, GDIBRUSHINST, BrushObject); if ((psurfPattern = SURFACE_LockSurface(GdiBrush->GdiBrushObject->hbmPattern))) @@ -488,7 +488,7 @@ } else if (ROP3_TO_ROP4(PATCOPY) == Rop4) { - if (Brush->iSolidColor == 0xFFFFFFFF) + if (Brush && Brush->iSolidColor == 0xFFFFFFFF) BltRectFunc = CallDibBitBlt; else BltRectFunc = BltPatCopy; @@ -1547,7 +1547,7 @@ if (Mask != NULL) { - BrushColor = XLATEOBJ_iXlate(SrcColorTranslation, Brush->iSolidColor); + BrushColor = XLATEOBJ_iXlate(SrcColorTranslation, Brush ? Brush->iSolidColor : 0); r = (int)GetRValue(BrushColor); g = (int)GetGValue(BrushColor); b = (int)GetBValue(BrushColor); @@ -1563,7 +1563,7 @@ if (*lMask == 0xff) { DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel( - psoDest, DestRect->left + i, DestRect->top + j, Brush->iSolidColor); + psoDest, DestRect->left + i, DestRect->top + j, Brush ? Brush->iSolidColor : 0); } else { Modified: trunk/reactos/tools/gendib/gendib.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/gendib/gendib.c?rev=…
============================================================================== --- trunk/reactos/tools/gendib/gendib.c [iso-8859-1] (original) +++ trunk/reactos/tools/gendib/gendib.c [iso-8859-1] Wed Mar 4 19:25:22 2009 @@ -877,6 +877,12 @@ { if (0 == Partial) { + Output(Out, "if (!BltInfo->Brush)\n"); + Output(Out, "{\n"); + Output(Out, "Pattern = 0;\n"); + Output(Out, "}\n"); + Output(Out, "else\n"); + Output(Out, "{\n"); Output(Out, "Pattern = BltInfo->Brush->iSolidColor"); } else @@ -887,6 +893,7 @@ if (32 / Bpp <= Partial + 1) { Output(Out, ";\n"); + Output(Out, "}\n"); } else {
15 years, 9 months
1
0
0
0
[dchapyshev] 39869: - Add GUIDs for msctf
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Wed Mar 4 18:32:21 2009 New Revision: 39869 URL:
http://svn.reactos.org/svn/reactos?rev=39869&view=rev
Log: - Add GUIDs for msctf Modified: trunk/reactos/lib/sdk/uuid/uuid.c Modified: trunk/reactos/lib/sdk/uuid/uuid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/uuid/uuid.c?rev=39…
============================================================================== --- trunk/reactos/lib/sdk/uuid/uuid.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/uuid/uuid.c [iso-8859-1] Wed Mar 4 18:32:21 2009 @@ -146,6 +146,9 @@ DEFINE_GUID(CLSID_TF_ThreadMgr, 0x529a9e6b,0x6587,0x4f23,0xab,0x9e,0x9c,0x7d,0x68,0x3e,0x3c,0x50); DEFINE_GUID(CLSID_TF_InputProcessorProfiles, 0x33c53a50,0xf456,0x4884,0xb0,0x49,0x85,0xfd,0x64,0x3e,0xcf,0xed); DEFINE_GUID(CLSID_TF_CategoryMgr, 0xA4B544A1,0x438D,0x4B41,0x93,0x25,0x86,0x95,0x23,0xE2,0xD6,0xC7); +DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745c63,0xb2f0,0x4784,0x8b,0x67,0x5e,0x12,0xc8,0x70,0x1a,0x31); +DEFINE_GUID(GUID_TFCAT_TIP_SPEECH, 0xB5A73CD1,0x8355,0x426B,0xA1,0x61,0x25,0x98,0x08,0xF2,0x6B,0x14); +DEFINE_GUID(GUID_TFCAT_TIP_HANDWRITING, 0x246ecb87,0xc2f2,0x4abe,0x90,0x5b,0xc8,0xb3,0x8a,0xdd,0x2c,0x43); DEFINE_GUID(CLSID_ConnectionManager, 0xBA126AD1,0x2166,0x11D1,0xB1,0xD0,0x0,0x80,0x5F,0xC1,0x27,0x0E); DEFINE_GUID(CLSID_CNetCfg, 0x5B035261,0x40F9,0x11D1,0xAA,0xEC,0x00,0x80,0x5F,0xC1,0x27,0x0E);
15 years, 9 months
1
0
0
0
[dgoette] 39868: * fix problems while selecting entries via dropdown * fix update of user language in admin panel
by dgoette@svn.reactos.org
Author: dgoette Date: Wed Mar 4 18:29:46 2009 New Revision: 39868 URL:
http://svn.reactos.org/svn/reactos?rev=39868&view=rev
Log: * fix problems while selecting entries via dropdown * fix update of user language in admin panel Modified:
branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js
branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_UserDetail…
branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_ViewEntryT…
Modified:
branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
============================================================================== ---
branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js
[iso-8859-1] (original) +++
branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js
[iso-8859-1] Wed Mar 4 18:29:46 2009 @@ -175,7 +175,7 @@ document.getElementById("cbtr"+i).checked = false; } else { - setRowColor(i,"#ffcc99"); + setRowColor('tr'+i,"#ffcc99"); document.getElementById("cbtr"+i).checked = true; } } @@ -193,8 +193,8 @@ // deselect all selectAll(false); - var sstar = status?'cStarOn':'cStartOff'; - + var sstar = status?'cStarOn':'cStarOff'; +alert(sstar); // select choosen ones for (var i=1; i<=nres; i++) { if (document.getElementById("tr"+i).getElementsByTagName('td')[1].getElementsByTagName('div')[0].className == sstar) { Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_UserDetail…
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
============================================================================== ---
branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_UserDetail…
[iso-8859-1] (original) +++
branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_UserDetail…
[iso-8859-1] Wed Mar 4 18:29:46 2009 @@ -37,6 +37,7 @@ { parent::__construct(); + echo $_GET['action']; // some userdata has to be updated ? if (isset($_GET['action'])) { switch ($_GET['action']) { @@ -52,7 +53,7 @@ case 'accountenable': ROSUser::disableAccount($_GET['user']); break; - case 'upateusrlang': + case 'updateusrlang': ROSUser::changeLanguage($_GET['user'], $_GET['lang']); break; } Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_ViewEntryT…
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
============================================================================== ---
branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_ViewEntryT…
[iso-8859-1] (original) +++
branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_ViewEntryT…
[iso-8859-1] Wed Mar 4 18:29:46 2009 @@ -428,6 +428,7 @@ break; } // end switch } + // multiple filters 'AND (foo OR bar)' else {
15 years, 9 months
1
0
0
0
[dchapyshev] 39867: - Sync crypt32, jscript, mapi32, mlang, msctf, msvcrt20, msvcrt40, msxml3, snmpapi, urlmon with Wine head
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Wed Mar 4 18:29:32 2009 New Revision: 39867 URL:
http://svn.reactos.org/svn/reactos?rev=39867&view=rev
Log: - Sync crypt32, jscript, mapi32, mlang, msctf, msvcrt20, msvcrt40, msxml3, snmpapi, urlmon with Wine head Added: trunk/reactos/dll/win32/mapi32/version.rc (with props) trunk/reactos/dll/win32/urlmon/protocol.c (with props) Modified: trunk/reactos/dll/win32/crypt32/chain.c trunk/reactos/dll/win32/crypt32/decode.c trunk/reactos/dll/win32/jscript/jsutils.c trunk/reactos/dll/win32/mapi32/mapi32.rbuild trunk/reactos/dll/win32/mlang/mlang.c trunk/reactos/dll/win32/msctf/categorymgr.c trunk/reactos/dll/win32/msctf/inputprocessor.c trunk/reactos/dll/win32/msvcrt20/msvcrt20.spec trunk/reactos/dll/win32/msvcrt40/msvcrt40.c trunk/reactos/dll/win32/msvcrt40/msvcrt40.spec trunk/reactos/dll/win32/msxml3/node.c trunk/reactos/dll/win32/snmpapi/main.c trunk/reactos/dll/win32/urlmon/binding.c trunk/reactos/dll/win32/urlmon/ftp.c trunk/reactos/dll/win32/urlmon/http.c trunk/reactos/dll/win32/urlmon/umon.c trunk/reactos/dll/win32/urlmon/urlmon.rbuild trunk/reactos/dll/win32/urlmon/urlmon_main.h Modified: trunk/reactos/dll/win32/crypt32/chain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/crypt32/chain.c?…
============================================================================== --- trunk/reactos/dll/win32/crypt32/chain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/crypt32/chain.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -306,7 +306,13 @@ = subjectInfoStatus; /* FIXME: initialize the rest of element */ if (!(chain->cElement % engine->CycleDetectionModulus)) + { CRYPT_CheckSimpleChainForCycles(chain); + /* Reinitialize the element pointer in case the chain is + * cyclic, in which case the chain is truncated. + */ + element = chain->rgpElement[chain->cElement - 1]; + } CRYPT_CombineTrustStatus(&chain->TrustStatus, &element->TrustStatus); ret = TRUE; Modified: trunk/reactos/dll/win32/crypt32/decode.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/crypt32/decode.c…
============================================================================== --- trunk/reactos/dll/win32/crypt32/decode.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/crypt32/decode.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -1724,9 +1724,8 @@ case ASN_UTF8STRING: value->Value.cbData = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)pbEncoded + 1 + lenBytes, dataLen, - str, bytesNeeded - sizeof(CERT_NAME_VALUE)) * 2; - value->Value.pbData[value->Value.cbData / sizeof(WCHAR)] - = 0; + str, bytesNeeded - sizeof(CERT_NAME_VALUE)) * sizeof(WCHAR); + *(WCHAR *)(value->Value.pbData + value->Value.cbData) = 0; value->Value.cbData += sizeof(WCHAR); break; } Modified: trunk/reactos/dll/win32/jscript/jsutils.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/jsutils.…
============================================================================== --- trunk/reactos/dll/win32/jscript/jsutils.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/jsutils.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -27,6 +27,7 @@ #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(jscript); +WINE_DECLARE_DEBUG_CHANNEL(heap); const char *debugstr_variant(const VARIANT *v) { @@ -51,6 +52,7 @@ } #define MIN_BLOCK_SIZE 128 +#define ARENA_FREE_FILLER 0xaa static inline DWORD block_size(DWORD block) { @@ -83,25 +85,25 @@ heap->block_cnt = 1; } - if(heap->offset + size < block_size(heap->last_block)) { + if(heap->offset + size <= block_size(heap->last_block)) { tmp = ((BYTE*)heap->blocks[heap->last_block])+heap->offset; heap->offset += size; return tmp; } - if(size < block_size(heap->last_block+1)) { + if(size <= block_size(heap->last_block+1)) { if(heap->last_block+1 == heap->block_cnt) { tmp = heap_realloc(heap->blocks, (heap->block_cnt+1)*sizeof(void*)); if(!tmp) return NULL; + heap->blocks = tmp; + heap->blocks[heap->block_cnt] = heap_alloc(block_size(heap->block_cnt)); + if(!heap->blocks[heap->block_cnt]) + return NULL; + + heap->block_cnt++; } - - tmp = heap_alloc(block_size(heap->block_cnt+1)); - if(!tmp) - return NULL; - - heap->blocks[heap->block_cnt++] = tmp; heap->last_block++; heap->offset = size; @@ -139,7 +141,15 @@ heap_free(tmp); } + if(WARN_ON(heap)) { + DWORD i; + + for(i=0; i < heap->block_cnt; i++) + memset(heap->blocks[i], ARENA_FREE_FILLER, block_size(i)); + } + heap->last_block = heap->offset = 0; + heap->mark = FALSE; } void jsheap_free(jsheap_t *heap) Modified: trunk/reactos/dll/win32/mapi32/mapi32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mapi32/mapi32.rb…
============================================================================== --- trunk/reactos/dll/win32/mapi32/mapi32.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mapi32/mapi32.rbuild [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -11,6 +11,7 @@ <file>prop.c</file> <file>sendmail.c</file> <file>util.c</file> + <file>version.rc</file> <library>wine</library> <library>shlwapi</library> <library>shell32</library> Added: trunk/reactos/dll/win32/mapi32/version.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mapi32/version.r…
============================================================================== --- trunk/reactos/dll/win32/mapi32/version.rc (added) +++ trunk/reactos/dll/win32/mapi32/version.rc [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -1,0 +1,22 @@ +/* + * Copyright 2009 Vincent Povirk for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define WINE_FILEDESCRIPTION_STR "Wine Messaging API" +#define WINE_FILENAME_STR "mapi32.dll" + +#include "wine/wine_common_ver.rc" Propchange: trunk/reactos/dll/win32/mapi32/version.rc ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/mlang/mlang.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mlang/mlang.c?re…
============================================================================== --- trunk/reactos/dll/win32/mlang/mlang.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mlang/mlang.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -1912,9 +1912,34 @@ DWORD* pdwCodePages, long* pcchCodePages) { - FIXME("(pszSrc=%s, cchSrc=%ld, dwPriorityCodePages=%d) stub\n", debugstr_w(pszSrc), cchSrc, dwPriorityCodePages); - *pdwCodePages = 0; - *pcchCodePages = 1; + long i; + DWORD cps = 0; + + TRACE("(%p)->%s %ld %x %p %p\n", iface, debugstr_wn(pszSrc,cchSrc),cchSrc,dwPriorityCodePages,pdwCodePages,pcchCodePages); + + if (pdwCodePages) *pdwCodePages = 0; + if (pcchCodePages) *pcchCodePages = 0; + + if (!pszSrc || !cchSrc || cchSrc < 0) + return E_INVALIDARG; + + for (i = 0; i < cchSrc; i++) + { + DWORD cp; + HRESULT ret; + + ret = fnIMLangFontLink_GetCharCodePages(iface, pszSrc[i], &cp); + if (ret != S_OK) return E_FAIL; + + if (!cps) cps = cp; + else cps &= cp; + + /* FIXME: not tested */ + if (dwPriorityCodePages & cps) break; + } + + if (pdwCodePages) *pdwCodePages = cps; + if (pcchCodePages) *pcchCodePages = i; return S_OK; } @@ -3179,10 +3204,8 @@ const WCHAR *pszSrc, long cchSrc, DWORD dwPriorityCodePages, DWORD *pdwCodePages, long *pcchCodePages) { - FIXME("(%p)->%s %li %x %p %p\n",This, debugstr_wn(pszSrc,cchSrc),cchSrc,dwPriorityCodePages,pdwCodePages,pcchCodePages); - *pdwCodePages = 0; - *pcchCodePages = 1; - return S_OK; + return fnIMLangFontLink_GetStrCodePages((IMLangFontLink *)This, + pszSrc, cchSrc, dwPriorityCodePages, pdwCodePages, pcchCodePages); } static HRESULT WINAPI fnIMLangFontLink2_CodePageToCodePages(IMLangFontLink2* This, Modified: trunk/reactos/dll/win32/msctf/categorymgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/categorymg…
============================================================================== --- trunk/reactos/dll/win32/msctf/categorymgr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/categorymgr.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -168,9 +168,67 @@ static HRESULT WINAPI CategoryMgr_FindClosestCategory ( ITfCategoryMgr *iface, REFGUID rguid, GUID *pcatid, const GUID **ppcatidList, ULONG ulCount) { - CategoryMgr *This = (CategoryMgr*)iface; - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + static const WCHAR fmt[] = { '%','s','\\','%','s','\\','C','a','t','e','g','o','r','y','\\','I','t','e','m','\\','%','s',0}; + + WCHAR fullkey[110]; + WCHAR buf[39]; + HKEY key; + HRESULT hr = S_FALSE; + INT index = 0; + CategoryMgr *This = (CategoryMgr*)iface; + + TRACE("(%p)\n",This); + + if (!pcatid || (ulCount && ppcatidList == NULL)) + return E_INVALIDARG; + + StringFromGUID2(rguid, buf, 39); + sprintfW(fullkey,fmt,szwSystemTIPKey,buf,buf); + *pcatid = GUID_NULL; + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,fullkey, 0, KEY_READ, &key ) != + ERROR_SUCCESS) + return S_FALSE; + + while (1) + { + HRESULT hr2; + ULONG res; + GUID guid; + WCHAR catid[39]; + DWORD cName; + + cName = 39; + res = RegEnumKeyExW(key, index, catid, &cName, NULL, NULL, NULL, NULL); + if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) break; + index ++; + + hr2 = CLSIDFromString(catid, &guid); + if (FAILED(hr2)) continue; + + if (ulCount) + { + int j; + BOOL found = FALSE; + for (j = 0; j < ulCount; j++) + if (IsEqualGUID(&guid, ppcatidList[j])) + { + found = TRUE; + *pcatid = guid; + hr = S_OK; + break; + } + if (found) break; + } + else + { + *pcatid = guid; + hr = S_OK; + break; + } + } + + return hr; } static HRESULT WINAPI CategoryMgr_RegisterGUIDDescription ( Modified: trunk/reactos/dll/win32/msctf/inputprocessor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/inputproce…
============================================================================== --- trunk/reactos/dll/win32/msctf/inputprocessor.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/inputprocessor.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -72,6 +72,7 @@ DWORD lang_index; LANGID langid; + ITfCategoryMgr *catmgr; } EnumTfLanguageProfiles; static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut); @@ -670,6 +671,7 @@ RegCloseKey(This->tipkey); if (This->langkey) RegCloseKey(This->langkey); + ITfCategoryMgr_Release(This->catmgr); HeapFree(GetProcessHeap(),0,This); } @@ -746,6 +748,9 @@ if (tflp) { + static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD, + &GUID_TFCAT_TIP_SPEECH, + &GUID_TFCAT_TIP_HANDWRITING }; res = CLSIDFromString(profileid, &profile); if (FAILED(res)) return 0; @@ -754,7 +759,10 @@ /* FIXME */ tflp->fActive = FALSE; tflp->guidProfile = profile; - /* FIXME set catid */ + if (ITfCategoryMgr_FindClosestCategory(This->catmgr, &clsid, + &tflp->catid, tipcats, 3) != S_OK) + ITfCategoryMgr_FindClosestCategory(This->catmgr, &clsid, + &tflp->catid, NULL, 0); } return 1; @@ -865,6 +873,7 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut) { + HRESULT hr; EnumTfLanguageProfiles *This; This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(EnumTfLanguageProfiles)); @@ -875,6 +884,13 @@ This->refCount = 1; This->langid = langid; + hr = CategoryMgr_Constructor(NULL,(IUnknown**)&This->catmgr); + if (FAILED(hr)) + { + HeapFree(GetProcessHeap(),0,This); + return hr; + } + if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &This->tipkey, NULL) != ERROR_SUCCESS) return E_FAIL; Modified: trunk/reactos/dll/win32/msvcrt20/msvcrt20.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt20/msvcrt2…
============================================================================== --- trunk/reactos/dll/win32/msvcrt20/msvcrt20.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvcrt20/msvcrt20.spec [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -437,22 +437,22 @@ @ stub ?xsgetn@streambuf@@UAEHPADH@Z # @ stub ?xsputn@streambuf@@UAEHPBDH@Z # @ stub $I10_OUTPUT # -@ cdecl _CIacos() msvcrt._CIacos -@ cdecl _CIasin() msvcrt._CIasin -@ cdecl _CIatan() msvcrt._CIatan -@ cdecl _CIatan2() msvcrt._CIatan2 -@ cdecl _CIcos() msvcrt._CIcos -@ cdecl _CIcosh() msvcrt._CIcosh -@ cdecl _CIexp() msvcrt._CIexp -@ cdecl _CIfmod() msvcrt._CIfmod -@ cdecl _CIlog() msvcrt._CIlog -@ cdecl _CIlog10() msvcrt._CIlog10 -@ cdecl _CIpow() msvcrt._CIpow -@ cdecl _CIsin() msvcrt._CIsin -@ cdecl _CIsinh() msvcrt._CIsinh -@ cdecl _CIsqrt() msvcrt._CIsqrt -@ cdecl _CItan() msvcrt._CItan -@ cdecl _CItanh() msvcrt._CItanh +@ cdecl -arch=i386 _CIacos() msvcrt._CIacos +@ cdecl -arch=i386 _CIasin() msvcrt._CIasin +@ cdecl -arch=i386 _CIatan() msvcrt._CIatan +@ cdecl -arch=i386 _CIatan2() msvcrt._CIatan2 +@ cdecl -arch=i386 _CIcos() msvcrt._CIcos +@ cdecl -arch=i386 _CIcosh() msvcrt._CIcosh +@ cdecl -arch=i386 _CIexp() msvcrt._CIexp +@ cdecl -arch=i386 _CIfmod() msvcrt._CIfmod +@ cdecl -arch=i386 _CIlog() msvcrt._CIlog +@ cdecl -arch=i386 _CIlog10() msvcrt._CIlog10 +@ cdecl -arch=i386 _CIpow() msvcrt._CIpow +@ cdecl -arch=i386 _CIsin() msvcrt._CIsin +@ cdecl -arch=i386 _CIsinh() msvcrt._CIsinh +@ cdecl -arch=i386 _CIsqrt() msvcrt._CIsqrt +@ cdecl -arch=i386 _CItan() msvcrt._CItan +@ cdecl -arch=i386 _CItanh() msvcrt._CItanh @ cdecl _CxxThrowException(long long) msvcrt._CxxThrowException @ extern _HUGE msvcrt._HUGE @ cdecl _XcptFilter(long ptr) msvcrt._XcptFilter @@ -471,32 +471,32 @@ @ cdecl __iscsymf(long) msvcrt.__iscsymf @ cdecl __lconv_init() msvcrt.__lconv_init @ extern __mb_cur_max msvcrt.__mb_cur_max -@ cdecl __p___argc() msvcrt.__p___argc -@ cdecl __p___argv() msvcrt.__p___argv -@ cdecl __p___initenv() msvcrt.__p___initenv -@ cdecl __p___mb_cur_max() msvcrt.__p___mb_cur_max -@ cdecl __p___wargv() msvcrt.__p___wargv -@ cdecl __p___winitenv() msvcrt.__p___winitenv -@ cdecl __p__acmdln() msvcrt.__p__acmdln -@ cdecl __p__amblksiz() msvcrt.__p__amblksiz -@ cdecl __p__commode() msvcrt.__p__commode -@ cdecl __p__daylight() msvcrt.__p__daylight -@ cdecl __p__environ() msvcrt.__p__environ -@ cdecl __p__fmode() msvcrt.__p__fmode -@ cdecl __p__iob() msvcrt.__p__iob -@ cdecl __p__mbctype() msvcrt.__p__mbctype -@ cdecl __p__osver() msvcrt.__p__osver -@ cdecl __p__pctype() msvcrt.__p__pctype -@ cdecl __p__pgmptr() msvcrt.__p__pgmptr -@ cdecl __p__pwctype() msvcrt.__p__pwctype -@ cdecl __p__timezone() msvcrt.__p__timezone -@ cdecl __p__tzname() msvcrt.__p__tzname -@ cdecl __p__wcmdln() msvcrt.__p__wcmdln -@ cdecl __p__wenviron() msvcrt.__p__wenviron -@ cdecl __p__winmajor() msvcrt.__p__winmajor -@ cdecl __p__winminor() msvcrt.__p__winminor -@ cdecl __p__winver() msvcrt.__p__winver -@ cdecl __p__wpgmptr() msvcrt.__p__wpgmptr +@ cdecl -arch=i386 __p___argc() msvcrt.__p___argc +@ cdecl -arch=i386 __p___argv() msvcrt.__p___argv +@ cdecl -arch=i386 __p___initenv() msvcrt.__p___initenv +@ cdecl -arch=i386 __p___mb_cur_max() msvcrt.__p___mb_cur_max +@ cdecl -arch=i386 __p___wargv() msvcrt.__p___wargv +@ cdecl -arch=i386 __p___winitenv() msvcrt.__p___winitenv +@ cdecl -arch=i386 __p__acmdln() msvcrt.__p__acmdln +@ cdecl -arch=i386 __p__amblksiz() msvcrt.__p__amblksiz +@ cdecl -arch=i386 __p__commode() msvcrt.__p__commode +@ cdecl -arch=i386 __p__daylight() msvcrt.__p__daylight +@ cdecl -arch=i386 __p__environ() msvcrt.__p__environ +@ cdecl -arch=i386 __p__fmode() msvcrt.__p__fmode +@ cdecl -arch=i386 __p__iob() msvcrt.__p__iob +@ cdecl -arch=i386 __p__mbctype() msvcrt.__p__mbctype +@ cdecl -arch=i386 __p__osver() msvcrt.__p__osver +@ cdecl -arch=i386 __p__pctype() msvcrt.__p__pctype +@ cdecl -arch=i386 __p__pgmptr() msvcrt.__p__pgmptr +@ cdecl -arch=i386 __p__pwctype() msvcrt.__p__pwctype +@ cdecl -arch=i386 __p__timezone() msvcrt.__p__timezone +@ cdecl -arch=i386 __p__tzname() msvcrt.__p__tzname +@ cdecl -arch=i386 __p__wcmdln() msvcrt.__p__wcmdln +@ cdecl -arch=i386 __p__wenviron() msvcrt.__p__wenviron +@ cdecl -arch=i386 __p__winmajor() msvcrt.__p__winmajor +@ cdecl -arch=i386 __p__winminor() msvcrt.__p__winminor +@ cdecl -arch=i386 __p__winver() msvcrt.__p__winver +@ cdecl -arch=i386 __p__wpgmptr() msvcrt.__p__wpgmptr @ cdecl __pxcptinfoptrs() msvcrt.__pxcptinfoptrs @ cdecl __threadhandle() msvcrt.__threadhandle @ cdecl __threadid() msvcrt.__threadid Modified: trunk/reactos/dll/win32/msvcrt40/msvcrt40.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt40/msvcrt4…
============================================================================== --- trunk/reactos/dll/win32/msvcrt40/msvcrt40.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvcrt40/msvcrt40.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -22,9 +22,6 @@ #include "windef.h" #include "winbase.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(msvcrt40); BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) { Modified: trunk/reactos/dll/win32/msvcrt40/msvcrt40.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt40/msvcrt4…
============================================================================== --- trunk/reactos/dll/win32/msvcrt40/msvcrt40.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvcrt40/msvcrt40.spec [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -481,22 +481,22 @@ @ stub ?xsgetn@streambuf@@UAEHPADH@Z @ stub ?xsputn@streambuf@@UAEHPBDH@Z @ cdecl $I10_OUTPUT() msvcrt.$I10_OUTPUT -@ cdecl _CIacos() msvcrt._CIacos -@ cdecl _CIasin() msvcrt._CIasin -@ cdecl _CIatan() msvcrt._CIatan -@ cdecl _CIatan2() msvcrt._CIatan2 -@ cdecl _CIcos() msvcrt._CIcos -@ cdecl _CIcosh() msvcrt._CIcosh -@ cdecl _CIexp() msvcrt._CIexp -@ cdecl _CIfmod() msvcrt._CIfmod -@ cdecl _CIlog() msvcrt._CIlog -@ cdecl _CIlog10() msvcrt._CIlog10 -@ cdecl _CIpow() msvcrt._CIpow -@ cdecl _CIsin() msvcrt._CIsin -@ cdecl _CIsinh() msvcrt._CIsinh -@ cdecl _CIsqrt() msvcrt._CIsqrt -@ cdecl _CItan() msvcrt._CItan -@ cdecl _CItanh() msvcrt._CItanh +@ cdecl -arch=i386 _CIacos() msvcrt._CIacos +@ cdecl -arch=i386 _CIasin() msvcrt._CIasin +@ cdecl -arch=i386 _CIatan() msvcrt._CIatan +@ cdecl -arch=i386 _CIatan2() msvcrt._CIatan2 +@ cdecl -arch=i386 _CIcos() msvcrt._CIcos +@ cdecl -arch=i386 _CIcosh() msvcrt._CIcosh +@ cdecl -arch=i386 _CIexp() msvcrt._CIexp +@ cdecl -arch=i386 _CIfmod() msvcrt._CIfmod +@ cdecl -arch=i386 _CIlog() msvcrt._CIlog +@ cdecl -arch=i386 _CIlog10() msvcrt._CIlog10 +@ cdecl -arch=i386 _CIpow() msvcrt._CIpow +@ cdecl -arch=i386 _CIsin() msvcrt._CIsin +@ cdecl -arch=i386 _CIsinh() msvcrt._CIsinh +@ cdecl -arch=i386 _CIsqrt() msvcrt._CIsqrt +@ cdecl -arch=i386 _CItan() msvcrt._CItan +@ cdecl -arch=i386 _CItanh() msvcrt._CItanh @ cdecl _CxxThrowException(long long) msvcrt._CxxThrowException @ cdecl -i386 _EH_prolog() msvcrt._EH_prolog @ extern _HUGE msvcrt._HUGE @@ -519,33 +519,33 @@ @ cdecl __iscsymf(long) msvcrt.__iscsymf @ cdecl __lconv_init() msvcrt.__lconv_init @ extern __mb_cur_max msvcrt.__mb_cur_max -@ cdecl __p___argc() msvcrt.__p___argc -@ cdecl __p___argv() msvcrt.__p___argv -@ cdecl __p___initenv() msvcrt.__p___initenv -@ cdecl __p___mb_cur_max() msvcrt.__p___mb_cur_max -@ cdecl __p___wargv() msvcrt.__p___wargv -@ cdecl __p___winitenv() msvcrt.__p___winitenv -@ cdecl __p__acmdln() msvcrt.__p__acmdln -@ cdecl __p__amblksiz() msvcrt.__p__amblksiz -@ cdecl __p__commode() msvcrt.__p__commode -@ cdecl __p__daylight() msvcrt.__p__daylight -@ cdecl __p__dstbias() msvcrt.__p__dstbias -@ cdecl __p__environ() msvcrt.__p__environ -@ cdecl __p__fmode() msvcrt.__p__fmode -@ cdecl __p__iob() msvcrt.__p__iob -@ cdecl __p__mbctype() msvcrt.__p__mbctype -@ cdecl __p__osver() msvcrt.__p__osver -@ cdecl __p__pctype() msvcrt.__p__pctype -@ cdecl __p__pgmptr() msvcrt.__p__pgmptr -@ cdecl __p__pwctype() msvcrt.__p__pwctype -@ cdecl __p__timezone() msvcrt.__p__timezone -@ cdecl __p__tzname() msvcrt.__p__tzname -@ cdecl __p__wcmdln() msvcrt.__p__wcmdln -@ cdecl __p__wenviron() msvcrt.__p__wenviron -@ cdecl __p__winmajor() msvcrt.__p__winmajor -@ cdecl __p__winminor() msvcrt.__p__winminor -@ cdecl __p__winver() msvcrt.__p__winver -@ cdecl __p__wpgmptr() msvcrt.__p__wpgmptr +@ cdecl -arch=i386 __p___argc() msvcrt.__p___argc +@ cdecl -arch=i386 __p___argv() msvcrt.__p___argv +@ cdecl -arch=i386 __p___initenv() msvcrt.__p___initenv +@ cdecl -arch=i386 __p___mb_cur_max() msvcrt.__p___mb_cur_max +@ cdecl -arch=i386 __p___wargv() msvcrt.__p___wargv +@ cdecl -arch=i386 __p___winitenv() msvcrt.__p___winitenv +@ cdecl -arch=i386 __p__acmdln() msvcrt.__p__acmdln +@ cdecl -arch=i386 __p__amblksiz() msvcrt.__p__amblksiz +@ cdecl -arch=i386 __p__commode() msvcrt.__p__commode +@ cdecl -arch=i386 __p__daylight() msvcrt.__p__daylight +@ cdecl -arch=i386 __p__dstbias() msvcrt.__p__dstbias +@ cdecl -arch=i386 __p__environ() msvcrt.__p__environ +@ cdecl -arch=i386 __p__fmode() msvcrt.__p__fmode +@ cdecl -arch=i386 __p__iob() msvcrt.__p__iob +@ cdecl -arch=i386 __p__mbctype() msvcrt.__p__mbctype +@ cdecl -arch=i386 __p__osver() msvcrt.__p__osver +@ cdecl -arch=i386 __p__pctype() msvcrt.__p__pctype +@ cdecl -arch=i386 __p__pgmptr() msvcrt.__p__pgmptr +@ cdecl -arch=i386 __p__pwctype() msvcrt.__p__pwctype +@ cdecl -arch=i386 __p__timezone() msvcrt.__p__timezone +@ cdecl -arch=i386 __p__tzname() msvcrt.__p__tzname +@ cdecl -arch=i386 __p__wcmdln() msvcrt.__p__wcmdln +@ cdecl -arch=i386 __p__wenviron() msvcrt.__p__wenviron +@ cdecl -arch=i386 __p__winmajor() msvcrt.__p__winmajor +@ cdecl -arch=i386 __p__winminor() msvcrt.__p__winminor +@ cdecl -arch=i386 __p__winver() msvcrt.__p__winver +@ cdecl -arch=i386 __p__wpgmptr() msvcrt.__p__wpgmptr @ cdecl __pxcptinfoptrs() msvcrt.__pxcptinfoptrs @ cdecl __set_app_type(long) msvcrt.__set_app_type @ cdecl __setusermatherr(ptr) msvcrt.__setusermatherr Modified: trunk/reactos/dll/win32/msxml3/node.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msxml3/node.c?re…
============================================================================== --- trunk/reactos/dll/win32/msxml3/node.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msxml3/node.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -387,6 +387,11 @@ if ( !out ) return E_INVALIDARG; + + /* if we dont have a doc, use our parent. */ + if(node && !node->doc && node->parent) + node->doc = node->parent->doc; + *out = create_node( node ); if (!*out) return S_FALSE; Modified: trunk/reactos/dll/win32/snmpapi/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/snmpapi/main.c?r…
============================================================================== --- trunk/reactos/dll/win32/snmpapi/main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/snmpapi/main.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" + #include <stdio.h> #include <stdarg.h> Modified: trunk/reactos/dll/win32/urlmon/binding.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/binding.c…
============================================================================== --- trunk/reactos/dll/win32/urlmon/binding.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/binding.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -1200,7 +1200,7 @@ TRACE("(%p)->(%d %u %u)\n", This, bscf, progress, progress_max); - if(This->download_state == END_DOWNLOAD) + if(This->download_state == END_DOWNLOAD || (This->state & BINDING_STOPPED)) return; if(GetCurrentThreadId() != This->apartment_thread) Modified: trunk/reactos/dll/win32/urlmon/ftp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/ftp.c?rev…
============================================================================== --- trunk/reactos/dll/win32/urlmon/ftp.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/ftp.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -1,5 +1,5 @@ /* - * Copyright 2005 Jacek Caban + * Copyright 2005-2009 Jacek Caban for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,13 +22,63 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { + Protocol base; + const IInternetProtocolVtbl *lpInternetProtocolVtbl; + const IInternetPriorityVtbl *lpInternetPriorityVtbl; + LONG ref; } FtpProtocol; +#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) +#define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) + +#define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(FtpProtocol, base, iface) + +static HRESULT FtpProtocol_open_request(Protocol *prot, LPCWSTR url, DWORD request_flags, + IInternetBindInfo *bind_info) +{ + FtpProtocol *This = ASYNCPROTOCOL_THIS(prot); + + This->base.request = InternetOpenUrlW(This->base.internet, url, NULL, 0, + request_flags|INTERNET_FLAG_EXISTING_CONNECT|INTERNET_FLAG_PASSIVE, + (DWORD_PTR)&This->base); + if (!This->base.request && GetLastError() != ERROR_IO_PENDING) { + WARN("InternetOpenUrl failed: %d\n", GetLastError()); + return INET_E_RESOURCE_NOT_FOUND; + } + + return S_OK; +} + +static HRESULT FtpProtocol_start_downloading(Protocol *prot) +{ + FtpProtocol *This = ASYNCPROTOCOL_THIS(prot); + DWORD size; + BOOL res; + + res = FtpGetFileSize(This->base.request, &size); + if(res) + This->base.content_length = size; + else + WARN("FtpGetFileSize failed: %d\n", GetLastError()); + + return S_OK; +} + +static void FtpProtocol_close_connection(Protocol *prot) +{ +} + +#undef ASYNCPROTOCOL_THIS + +static const ProtocolVtbl AsyncProtocolVtbl = { + FtpProtocol_open_request, + FtpProtocol_start_downloading, + FtpProtocol_close_connection +}; + #define PROTOCOL_THIS(iface) DEFINE_THIS(FtpProtocol, InternetProtocol, iface) - -#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { @@ -44,6 +94,9 @@ }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); *ppv = PROTOCOL(This); + }else if(IsEqualGUID(&IID_IInternetPriority, riid)) { + TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv); + *ppv = PRIORITY(This); } if(*ppv) { @@ -71,6 +124,7 @@ TRACE("(%p) ref=%d\n", This, ref); if(!ref) { + protocol_close_connection(&This->base); heap_free(This); URLMON_UnlockModule(); @@ -84,16 +138,25 @@ DWORD grfPI, DWORD dwReserved) { FtpProtocol *This = PROTOCOL_THIS(iface); - FIXME("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink, - pOIBindInfo, grfPI, dwReserved); - return E_NOTIMPL; + + static const WCHAR ftpW[] = {'f','t','p',':'}; + + TRACE("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink, + pOIBindInfo, grfPI, dwReserved); + + if(strncmpW(szUrl, ftpW, sizeof(ftpW)/sizeof(WCHAR))) + return MK_E_SYNTAX; + + return protocol_start(&This->base, PROTOCOL(This), szUrl, pOIProtSink, pOIBindInfo); } static HRESULT WINAPI FtpProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) { FtpProtocol *This = PROTOCOL_THIS(iface); - FIXME("(%p)->(%p)\n", This, pProtocolData); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, pProtocolData); + + return protocol_continue(&This->base, pProtocolData); } static HRESULT WINAPI FtpProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, @@ -107,8 +170,11 @@ static HRESULT WINAPI FtpProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions) { FtpProtocol *This = PROTOCOL_THIS(iface); - FIXME("(%p)->(%08x)\n", This, dwOptions); - return E_NOTIMPL; + + TRACE("(%p)->(%08x)\n", This, dwOptions); + + protocol_close_connection(&This->base); + return S_OK; } static HRESULT WINAPI FtpProtocol_Suspend(IInternetProtocol *iface) @@ -129,8 +195,10 @@ ULONG cb, ULONG *pcbRead) { FtpProtocol *This = PROTOCOL_THIS(iface); - FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); - return E_NOTIMPL; + + TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); + + return protocol_read(&This->base, pv, cb, pcbRead); } static HRESULT WINAPI FtpProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, @@ -144,15 +212,19 @@ static HRESULT WINAPI FtpProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions) { FtpProtocol *This = PROTOCOL_THIS(iface); - FIXME("(%p)->(%08x)\n", This, dwOptions); - return E_NOTIMPL; + + TRACE("(%p)->(%08x)\n", This, dwOptions); + + return protocol_lock_request(&This->base); } static HRESULT WINAPI FtpProtocol_UnlockRequest(IInternetProtocol *iface) { FtpProtocol *This = PROTOCOL_THIS(iface); - FIXME("(%p)\n", This); - return E_NOTIMPL; + + TRACE("(%p)\n", This); + + return protocol_unlock_request(&This->base); } #undef PROTOCOL_THIS @@ -173,6 +245,56 @@ FtpProtocol_UnlockRequest }; +#define PRIORITY_THIS(iface) DEFINE_THIS(FtpProtocol, InternetPriority, iface) + +static HRESULT WINAPI FtpPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv) +{ + FtpProtocol *This = PRIORITY_THIS(iface); + return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv); +} + +static ULONG WINAPI FtpPriority_AddRef(IInternetPriority *iface) +{ + FtpProtocol *This = PRIORITY_THIS(iface); + return IInternetProtocol_AddRef(PROTOCOL(This)); +} + +static ULONG WINAPI FtpPriority_Release(IInternetPriority *iface) +{ + FtpProtocol *This = PRIORITY_THIS(iface); + return IInternetProtocol_Release(PROTOCOL(This)); +} + +static HRESULT WINAPI FtpPriority_SetPriority(IInternetPriority *iface, LONG nPriority) +{ + FtpProtocol *This = PRIORITY_THIS(iface); + + TRACE("(%p)->(%d)\n", This, nPriority); + + This->base.priority = nPriority; + return S_OK; +} + +static HRESULT WINAPI FtpPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority) +{ + FtpProtocol *This = PRIORITY_THIS(iface); + + TRACE("(%p)->(%p)\n", This, pnPriority); + + *pnPriority = This->base.priority; + return S_OK; +} + +#undef PRIORITY_THIS + +static const IInternetPriorityVtbl FtpPriorityVtbl = { + FtpPriority_QueryInterface, + FtpPriority_AddRef, + FtpPriority_Release, + FtpPriority_SetPriority, + FtpPriority_GetPriority +}; + HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) { FtpProtocol *ret; @@ -181,9 +303,11 @@ URLMON_LockModule(); - ret = heap_alloc(sizeof(FtpProtocol)); - + ret = heap_alloc_zero(sizeof(FtpProtocol)); + + ret->base.vtbl = &AsyncProtocolVtbl; ret->lpInternetProtocolVtbl = &FtpProtocolVtbl; + ret->lpInternetPriorityVtbl = &FtpPriorityVtbl; ret->ref = 1; *ppobj = PROTOCOL(ret); Modified: trunk/reactos/dll/win32/urlmon/http.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/http.c?re…
============================================================================== --- trunk/reactos/dll/win32/urlmon/http.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/http.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -29,215 +29,283 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); -/* Flags are needed for, among other things, return HRESULTs from the Read function - * to conform to native. For example, Read returns: - * - * 1. E_PENDING if called before the request has completed, - * (flags = 0) - * 2. S_FALSE after all data has been read and S_OK has been reported, - * (flags = FLAG_REQUEST_COMPLETE | FLAG_ALL_DATA_READ | FLAG_RESULT_REPORTED) - * 3. INET_E_DATA_NOT_AVAILABLE if InternetQueryDataAvailable fails. The first time - * this occurs, INET_E_DATA_NOT_AVAILABLE will also be reported to the sink, - * (flags = FLAG_REQUEST_COMPLETE) - * but upon subsequent calls to Read no reporting will take place, yet - * InternetQueryDataAvailable will still be called, and, on failure, - * INET_E_DATA_NOT_AVAILABLE will still be returned. - * (flags = FLAG_REQUEST_COMPLETE | FLAG_RESULT_REPORTED) - * - * FLAG_FIRST_DATA_REPORTED and FLAG_LAST_DATA_REPORTED are needed for proper - * ReportData reporting. For example, if OnResponse returns S_OK, Continue will - * report BSCF_FIRSTDATANOTIFICATION, and when all data has been read Read will - * report BSCF_INTERMEDIATEDATANOTIFICATION|BSCF_LASTDATANOTIFICATION. However, - * if OnResponse does not return S_OK, Continue will not report data, and Read - * will report BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION when all - * data has been read. - */ -#define FLAG_REQUEST_COMPLETE 0x1 -#define FLAG_FIRST_CONTINUE_COMPLETE 0x2 -#define FLAG_FIRST_DATA_REPORTED 0x4 -#define FLAG_ALL_DATA_READ 0x8 -#define FLAG_LAST_DATA_REPORTED 0x10 -#define FLAG_RESULT_REPORTED 0x20 - typedef struct { + Protocol base; + const IInternetProtocolVtbl *lpInternetProtocolVtbl; const IInternetPriorityVtbl *lpInternetPriorityVtbl; BOOL https; - DWORD flags, grfBINDF; - BINDINFO bind_info; - IInternetProtocolSink *protocol_sink; IHttpNegotiate *http_negotiate; - HINTERNET internet, connect, request; LPWSTR full_header; - HANDLE lock; - ULONG current_position, content_length, available_bytes; - LONG priority; LONG ref; } HttpProtocol; + +#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) +#define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) /* Default headers from native */ static const WCHAR wszHeaders[] = {'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g', ':',' ','g','z','i','p',',',' ','d','e','f','l','a','t','e',0}; -/* - * Helpers - */ - -static void HTTPPROTOCOL_ReportResult(HttpProtocol *This, HRESULT hres) -{ - if (!(This->flags & FLAG_RESULT_REPORTED) && - This->protocol_sink) - { - This->flags |= FLAG_RESULT_REPORTED; - IInternetProtocolSink_ReportResult(This->protocol_sink, hres, 0, NULL); - } -} - -static void HTTPPROTOCOL_ReportData(HttpProtocol *This) -{ - DWORD bscf; - if (!(This->flags & FLAG_LAST_DATA_REPORTED) && - This->protocol_sink) - { - if (This->flags & FLAG_FIRST_DATA_REPORTED) - { - bscf = BSCF_INTERMEDIATEDATANOTIFICATION; +static LPWSTR query_http_info(HttpProtocol *This, DWORD option) +{ + LPWSTR ret = NULL; + DWORD len = 0; + BOOL res; + + res = HttpQueryInfoW(This->base.request, option, NULL, &len, NULL); + if (!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { + ret = heap_alloc(len); + res = HttpQueryInfoW(This->base.request, option, ret, &len, NULL); + } + if(!res) { + TRACE("HttpQueryInfoW(%d) failed: %08x\n", option, GetLastError()); + heap_free(ret); + return NULL; + } + + return ret; +} + +#define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(HttpProtocol, base, iface) + +static HRESULT HttpProtocol_open_request(Protocol *prot, LPCWSTR url, DWORD request_flags, + IInternetBindInfo *bind_info) +{ + HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); + LPWSTR addl_header = NULL, post_cookie = NULL, optional = NULL; + IServiceProvider *service_provider = NULL; + IHttpNegotiate2 *http_negotiate2 = NULL; + LPWSTR host, user, pass, path; + LPOLESTR accept_mimes[257]; + URL_COMPONENTSW url_comp; + BYTE security_id[512]; + DWORD len = 0; + ULONG num = 0; + BOOL res; + HRESULT hres; + + static const WCHAR wszBindVerb[BINDVERB_CUSTOM][5] = + {{'G','E','T',0}, + {'P','O','S','T',0}, + {'P','U','T',0}}; + + memset(&url_comp, 0, sizeof(url_comp)); + url_comp.dwStructSize = sizeof(url_comp); + url_comp.dwSchemeLength = url_comp.dwHostNameLength = url_comp.dwUrlPathLength = + url_comp.dwUserNameLength = url_comp.dwPasswordLength = 1; + if (!InternetCrackUrlW(url, 0, 0, &url_comp)) + return MK_E_SYNTAX; + + if(!url_comp.nPort) + url_comp.nPort = This->https ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT; + + host = heap_strndupW(url_comp.lpszHostName, url_comp.dwHostNameLength); + user = heap_strndupW(url_comp.lpszUserName, url_comp.dwUserNameLength); + pass = heap_strndupW(url_comp.lpszPassword, url_comp.dwPasswordLength); + This->base.connection = InternetConnectW(This->base.internet, host, url_comp.nPort, user, pass, + INTERNET_SERVICE_HTTP, This->https ? INTERNET_FLAG_SECURE : 0, (DWORD_PTR)&This->base); + heap_free(pass); + heap_free(user); + heap_free(host); + if(!This->base.connection) { + WARN("InternetConnect failed: %d\n", GetLastError()); + return INET_E_CANNOT_CONNECT; + } + + num = sizeof(accept_mimes)/sizeof(accept_mimes[0])-1; + hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_ACCEPT_MIMES, accept_mimes, num, &num); + if(hres != S_OK) { + WARN("GetBindString BINDSTRING_ACCEPT_MIMES failed: %08x\n", hres); + return INET_E_NO_VALID_MEDIA; + } + accept_mimes[num] = 0; + + path = heap_strndupW(url_comp.lpszUrlPath, url_comp.dwUrlPathLength); + if(This->https) + request_flags |= INTERNET_FLAG_SECURE; + This->base.request = HttpOpenRequestW(This->base.connection, + This->base.bind_info.dwBindVerb < BINDVERB_CUSTOM + ? wszBindVerb[This->base.bind_info.dwBindVerb] : This->base.bind_info.szCustomVerb, + path, NULL, NULL, (LPCWSTR *)accept_mimes, request_flags, (DWORD_PTR)&This->base); + heap_free(path); + while (num<sizeof(accept_mimes)/sizeof(accept_mimes[0]) && accept_mimes[num]) + CoTaskMemFree(accept_mimes[num++]); + if (!This->base.request) { + WARN("HttpOpenRequest failed: %d\n", GetLastError()); + return INET_E_RESOURCE_NOT_FOUND; + } + + hres = IInternetProtocolSink_QueryInterface(This->base.protocol_sink, &IID_IServiceProvider, + (void **)&service_provider); + if (hres != S_OK) { + WARN("IInternetProtocolSink_QueryInterface IID_IServiceProvider failed: %08x\n", hres); + return hres; + } + + hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate, + &IID_IHttpNegotiate, (void **)&This->http_negotiate); + if (hres != S_OK) { + WARN("IServiceProvider_QueryService IID_IHttpNegotiate failed: %08x\n", hres); + return hres; + } + + hres = IHttpNegotiate_BeginningTransaction(This->http_negotiate, url, wszHeaders, + 0, &addl_header); + if(hres != S_OK) { + WARN("IHttpNegotiate_BeginningTransaction failed: %08x\n", hres); + IServiceProvider_Release(service_provider); + return hres; + } + + if(addl_header) { + int len_addl_header = strlenW(addl_header); + + This->full_header = heap_alloc(len_addl_header*sizeof(WCHAR)+sizeof(wszHeaders)); + + lstrcpyW(This->full_header, addl_header); + lstrcpyW(&This->full_header[len_addl_header], wszHeaders); + CoTaskMemFree(addl_header); + }else { + This->full_header = (LPWSTR)wszHeaders; + } + + hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate2, + &IID_IHttpNegotiate2, (void **)&http_negotiate2); + IServiceProvider_Release(service_provider); + if(hres != S_OK) { + WARN("IServiceProvider_QueryService IID_IHttpNegotiate2 failed: %08x\n", hres); + /* No goto done as per native */ + }else { + len = sizeof(security_id)/sizeof(security_id[0]); + hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, security_id, &len, 0); + IHttpNegotiate2_Release(http_negotiate2); + if (hres != S_OK) + WARN("IHttpNegotiate2_GetRootSecurityId failed: %08x\n", hres); + } + + /* FIXME: Handle security_id. Native calls undocumented function IsHostInProxyBypassList. */ + + if(This->base.bind_info.dwBindVerb == BINDVERB_POST) { + num = 0; + hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_POST_COOKIE, &post_cookie, 1, &num); + if(hres == S_OK && num) { + if(!InternetSetOptionW(This->base.request, INTERNET_OPTION_SECONDARY_CACHE_KEY, + post_cookie, lstrlenW(post_cookie))) + WARN("InternetSetOption INTERNET_OPTION_SECONDARY_CACHE_KEY failed: %d\n", GetLastError()); + CoTaskMemFree(post_cookie); } + } + + if(This->base.bind_info.dwBindVerb != BINDVERB_GET) { + /* Native does not use GlobalLock/GlobalUnlock, so we won't either */ + if (This->base.bind_info.stgmedData.tymed != TYMED_HGLOBAL) + WARN("Expected This->base.bind_info.stgmedData.tymed to be TYMED_HGLOBAL, not %d\n", + This->base.bind_info.stgmedData.tymed); else - { - This->flags |= FLAG_FIRST_DATA_REPORTED; - bscf = BSCF_FIRSTDATANOTIFICATION; + optional = (LPWSTR)This->base.bind_info.stgmedData.u.hGlobal; + } + + res = HttpSendRequestW(This->base.request, This->full_header, lstrlenW(This->full_header), + optional, optional ? This->base.bind_info.cbstgmedData : 0); + if(!res && GetLastError() != ERROR_IO_PENDING) { + WARN("HttpSendRequest failed: %d\n", GetLastError()); + return INET_E_DOWNLOAD_FAILURE; + } + + return S_OK; +} + +static HRESULT HttpProtocol_start_downloading(Protocol *prot) +{ + HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); + LPWSTR content_type = 0, content_length = 0; + DWORD len = sizeof(DWORD); + DWORD status_code; + BOOL res; + HRESULT hres; + + static const WCHAR wszDefaultContentType[] = + {'t','e','x','t','/','h','t','m','l',0}; + + if(!This->http_negotiate) { + WARN("Expected IHttpNegotiate pointer to be non-NULL\n"); + return S_OK; + } + + res = HttpQueryInfoW(This->base.request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, + &status_code, &len, NULL); + if(res) { + LPWSTR response_headers = query_http_info(This, HTTP_QUERY_RAW_HEADERS_CRLF); + if(response_headers) { + hres = IHttpNegotiate_OnResponse(This->http_negotiate, status_code, response_headers, + NULL, NULL); + heap_free(response_headers); + if (hres != S_OK) { + WARN("IHttpNegotiate_OnResponse failed: %08x\n", hres); + return S_OK; + } } - if (This->flags & FLAG_ALL_DATA_READ && - !(This->flags & FLAG_LAST_DATA_REPORTED)) - { - This->flags |= FLAG_LAST_DATA_REPORTED; - bscf |= BSCF_LASTDATANOTIFICATION; - } - IInternetProtocolSink_ReportData(This->protocol_sink, bscf, - This->current_position+This->available_bytes, - This->content_length); - } -} - -static void HTTPPROTOCOL_AllDataRead(HttpProtocol *This) -{ - if (!(This->flags & FLAG_ALL_DATA_READ)) - This->flags |= FLAG_ALL_DATA_READ; - HTTPPROTOCOL_ReportData(This); - HTTPPROTOCOL_ReportResult(This, S_OK); -} - -static void HTTPPROTOCOL_Close(HttpProtocol *This) -{ - if (This->http_negotiate) - { + }else { + WARN("HttpQueryInfo failed: %d\n", GetLastError()); + } + + if(This->https) + IInternetProtocolSink_ReportProgress(This->base.protocol_sink, BINDSTATUS_ACCEPTRANGES, NULL); + + content_type = query_http_info(This, HTTP_QUERY_CONTENT_TYPE); + if(content_type) { + /* remove the charset, if present */ + LPWSTR p = strchrW(content_type, ';'); + if (p) *p = '\0'; + + IInternetProtocolSink_ReportProgress(This->base.protocol_sink, + (This->base.bindf & BINDF_FROMURLMON) + ? BINDSTATUS_MIMETYPEAVAILABLE : BINDSTATUS_RAWMIMETYPE, + content_type); + heap_free(content_type); + }else { + WARN("HttpQueryInfo failed: %d\n", GetLastError()); + IInternetProtocolSink_ReportProgress(This->base.protocol_sink, + (This->base.bindf & BINDF_FROMURLMON) + ? BINDSTATUS_MIMETYPEAVAILABLE : BINDSTATUS_RAWMIMETYPE, + wszDefaultContentType); + } + + content_length = query_http_info(This, HTTP_QUERY_CONTENT_LENGTH); + if(content_length) { + This->base.content_length = atoiW(content_length); + heap_free(content_length); + } + + return S_OK; +} + +static void HttpProtocol_close_connection(Protocol *prot) +{ + HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); + + if(This->http_negotiate) { IHttpNegotiate_Release(This->http_negotiate); This->http_negotiate = 0; } - if (This->request) - InternetCloseHandle(This->request); - if (This->connect) - InternetCloseHandle(This->connect); - if (This->internet) - { - InternetCloseHandle(This->internet); - This->internet = 0; - } - if (This->full_header) - { - if (This->full_header != wszHeaders) + + if(This->full_header) { + if(This->full_header != wszHeaders) heap_free(This->full_header); This->full_header = 0; } - This->flags = 0; -} - -static void CALLBACK HTTPPROTOCOL_InternetStatusCallback( - HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus, - LPVOID lpvStatusInformation, DWORD dwStatusInformationLength) -{ - HttpProtocol *This = (HttpProtocol *)dwContext; - PROTOCOLDATA data; - ULONG ulStatusCode; - - switch (dwInternetStatus) - { - case INTERNET_STATUS_RESOLVING_NAME: - ulStatusCode = BINDSTATUS_FINDINGRESOURCE; - break; - case INTERNET_STATUS_CONNECTING_TO_SERVER: - ulStatusCode = BINDSTATUS_CONNECTING; - break; - case INTERNET_STATUS_SENDING_REQUEST: - ulStatusCode = BINDSTATUS_SENDINGREQUEST; - break; - case INTERNET_STATUS_REQUEST_COMPLETE: - This->flags |= FLAG_REQUEST_COMPLETE; - /* PROTOCOLDATA same as native */ - memset(&data, 0, sizeof(data)); - data.dwState = 0xf1000000; - if (This->flags & FLAG_FIRST_CONTINUE_COMPLETE) - data.pData = (LPVOID)BINDSTATUS_ENDDOWNLOADCOMPONENTS; - else - data.pData = (LPVOID)BINDSTATUS_DOWNLOADINGDATA; - if (This->grfBINDF & BINDF_FROMURLMON) - IInternetProtocolSink_Switch(This->protocol_sink, &data); - else - IInternetProtocol_Continue((IInternetProtocol *)This, &data); - return; - case INTERNET_STATUS_HANDLE_CREATED: - IInternetProtocol_AddRef((IInternetProtocol *)This); - return; - case INTERNET_STATUS_HANDLE_CLOSING: - if (*(HINTERNET *)lpvStatusInformation == This->connect) - { - This->connect = 0; - } - else if (*(HINTERNET *)lpvStatusInformation == This->request) - { - This->request = 0; - if (This->protocol_sink) - { - IInternetProtocolSink_Release(This->protocol_sink); - This->protocol_sink = 0; - } - if (This->bind_info.cbSize) - { - ReleaseBindInfo(&This->bind_info); - memset(&This->bind_info, 0, sizeof(This->bind_info)); - } - } - IInternetProtocol_Release((IInternetProtocol *)This); - return; - default: - WARN("Unhandled Internet status callback %d\n", dwInternetStatus); - return; - } - - IInternetProtocolSink_ReportProgress(This->protocol_sink, ulStatusCode, (LPWSTR)lpvStatusInformation); -} - -static inline LPWSTR strndupW(LPCWSTR string, int len) -{ - LPWSTR ret = NULL; - if (string && - (ret = heap_alloc((len+1)*sizeof(WCHAR))) != NULL) - { - memcpy(ret, string, len*sizeof(WCHAR)); - ret[len] = 0; - } - return ret; -} - -/* - * Interface implementations - */ - -#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) -#define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) +} + +#undef ASYNCPROTOCOL_THIS + +static const ProtocolVtbl AsyncProtocolVtbl = { + HttpProtocol_open_request, + HttpProtocol_start_downloading, + HttpProtocol_close_connection +}; #define PROTOCOL_THIS(iface) DEFINE_THIS(HttpProtocol, InternetProtocol, iface) @@ -285,7 +353,7 @@ TRACE("(%p) ref=%d\n", This, ref); if(!ref) { - HTTPPROTOCOL_Close(This); + protocol_close_connection(&This->base); heap_free(This); URLMON_UnlockModule(); @@ -299,422 +367,28 @@ DWORD grfPI, DWORD dwReserved) { HttpProtocol *This = PROTOCOL_THIS(iface); - URL_COMPONENTSW url; - DWORD len = 0, request_flags = INTERNET_FLAG_KEEP_CONNECTION; - ULONG num = 0; - IServiceProvider *service_provider = 0; - IHttpNegotiate2 *http_negotiate2 = 0; - LPWSTR host = 0, path = 0, user = 0, pass = 0, addl_header = 0, - post_cookie = 0, optional = 0; - BYTE security_id[512]; - LPOLESTR user_agent = NULL, accept_mimes[257]; - HRESULT hres; static const WCHAR httpW[] = {'h','t','t','p',':'}; static const WCHAR httpsW[] = {'h','t','t','p','s',':'}; - static const WCHAR wszBindVerb[BINDVERB_CUSTOM][5] = - {{'G','E','T',0}, - {'P','O','S','T',0}, - {'P','U','T',0}}; TRACE("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved); - - IInternetProtocolSink_AddRef(pOIProtSink); - This->protocol_sink = pOIProtSink; - - memset(&This->bind_info, 0, sizeof(This->bind_info)); - This->bind_info.cbSize = sizeof(BINDINFO); - hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &This->grfBINDF, &This->bind_info); - if (hres != S_OK) - { - WARN("GetBindInfo failed: %08x\n", hres); - goto done; - } if(This->https ? strncmpW(szUrl, httpsW, sizeof(httpsW)/sizeof(WCHAR)) : strncmpW(szUrl, httpW, sizeof(httpW)/sizeof(WCHAR))) - { - hres = MK_E_SYNTAX; - goto done; - } - - memset(&url, 0, sizeof(url)); - url.dwStructSize = sizeof(url); - url.dwSchemeLength = url.dwHostNameLength = url.dwUrlPathLength = url.dwUserNameLength = - url.dwPasswordLength = 1; - if (!InternetCrackUrlW(szUrl, 0, 0, &url)) - { - hres = MK_E_SYNTAX; - goto done; - } - host = strndupW(url.lpszHostName, url.dwHostNameLength); - path = strndupW(url.lpszUrlPath, url.dwUrlPathLength); - user = strndupW(url.lpszUserName, url.dwUserNameLength); - pass = strndupW(url.lpszPassword, url.dwPasswordLength); - if (!url.nPort) - url.nPort = This->https ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT; - - if(!(This->grfBINDF & BINDF_FROMURLMON)) - IInternetProtocolSink_ReportProgress(This->protocol_sink, BINDSTATUS_DIRECTBIND, NULL); - - hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_USER_AGENT, &user_agent, - 1, &num); - if (hres != S_OK || !num) - { - CHAR null_char = 0; - LPSTR user_agenta = NULL; - len = 0; - if ((hres = ObtainUserAgentString(0, &null_char, &len)) != E_OUTOFMEMORY) - { - WARN("ObtainUserAgentString failed: %08x\n", hres); - } - else if (!(user_agenta = heap_alloc(len*sizeof(CHAR)))) - { - WARN("Out of memory\n"); - } - else if ((hres = ObtainUserAgentString(0, user_agenta, &len)) != S_OK) - { - WARN("ObtainUserAgentString failed: %08x\n", hres); - } - else - { - if (!(user_agent = CoTaskMemAlloc((len)*sizeof(WCHAR)))) - WARN("Out of memory\n"); - else - MultiByteToWideChar(CP_ACP, 0, user_agenta, -1, user_agent, len); - } - heap_free(user_agenta); - } - - This->internet = InternetOpenW(user_agent, 0, NULL, NULL, INTERNET_FLAG_ASYNC); - if (!This->internet) - { - WARN("InternetOpen failed: %d\n", GetLastError()); - hres = INET_E_NO_SESSION; - goto done; - } - - /* Native does not check for success of next call, so we won't either */ - InternetSetStatusCallbackW(This->internet, HTTPPROTOCOL_InternetStatusCallback); - - This->connect = InternetConnectW(This->internet, host, url.nPort, user, - pass, INTERNET_SERVICE_HTTP, - This->https ? INTERNET_FLAG_SECURE : 0, - (DWORD_PTR)This); - if (!This->connect) - { - WARN("InternetConnect failed: %d\n", GetLastError()); - hres = INET_E_CANNOT_CONNECT; - goto done; - } - - num = sizeof(accept_mimes)/sizeof(accept_mimes[0])-1; - hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_ACCEPT_MIMES, - accept_mimes, - num, &num); - if (hres != S_OK) - { - WARN("GetBindString BINDSTRING_ACCEPT_MIMES failed: %08x\n", hres); - hres = INET_E_NO_VALID_MEDIA; - goto done; - } - accept_mimes[num] = 0; - - if (This->grfBINDF & BINDF_NOWRITECACHE) - request_flags |= INTERNET_FLAG_NO_CACHE_WRITE; - if (This->grfBINDF & BINDF_NEEDFILE) - request_flags |= INTERNET_FLAG_NEED_FILE; - if (This->https) - request_flags |= INTERNET_FLAG_SECURE; - This->request = HttpOpenRequestW(This->connect, This->bind_info.dwBindVerb < BINDVERB_CUSTOM ? - wszBindVerb[This->bind_info.dwBindVerb] : - This->bind_info.szCustomVerb, - path, NULL, NULL, (LPCWSTR *)accept_mimes, - request_flags, (DWORD_PTR)This); - if (!This->request) - { - WARN("HttpOpenRequest failed: %d\n", GetLastError()); - hres = INET_E_RESOURCE_NOT_FOUND; - goto done; - } - - hres = IInternetProtocolSink_QueryInterface(This->protocol_sink, &IID_IServiceProvider, - (void **)&service_provider); - if (hres != S_OK) - { - WARN("IInternetProtocolSink_QueryInterface IID_IServiceProvider failed: %08x\n", hres); - goto done; - } - - hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate, - &IID_IHttpNegotiate, (void **)&This->http_negotiate); - if (hres != S_OK) - { - WARN("IServiceProvider_QueryService IID_IHttpNegotiate failed: %08x\n", hres); - goto done; - } - - hres = IHttpNegotiate_BeginningTransaction(This->http_negotiate, szUrl, wszHeaders, - 0, &addl_header); - if (hres != S_OK) - { - WARN("IHttpNegotiate_BeginningTransaction failed: %08x\n", hres); - goto done; - } - else if (addl_header == NULL) - { - This->full_header = (LPWSTR)wszHeaders; - } - else - { - int len_addl_header = lstrlenW(addl_header); - This->full_header = heap_alloc(len_addl_header*sizeof(WCHAR)+sizeof(wszHeaders)); - if (!This->full_header) - { - WARN("Out of memory\n"); - hres = E_OUTOFMEMORY; - goto done; - } - lstrcpyW(This->full_header, addl_header); - lstrcpyW(&This->full_header[len_addl_header], wszHeaders); - } - - hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate2, - &IID_IHttpNegotiate2, (void **)&http_negotiate2); - if (hres != S_OK) - { - WARN("IServiceProvider_QueryService IID_IHttpNegotiate2 failed: %08x\n", hres); - /* No goto done as per native */ - } - else - { - len = sizeof(security_id)/sizeof(security_id[0]); - hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, security_id, &len, 0); - if (hres != S_OK) - { - WARN("IHttpNegotiate2_GetRootSecurityId failed: %08x\n", hres); - /* No goto done as per native */ - } - } - - /* FIXME: Handle security_id. Native calls undocumented function IsHostInProxyBypassList. */ - - if (This->bind_info.dwBindVerb == BINDVERB_POST) - { - num = 0; - hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_POST_COOKIE, &post_cookie, - 1, &num); - if (hres == S_OK && num && - !InternetSetOptionW(This->request, INTERNET_OPTION_SECONDARY_CACHE_KEY, - post_cookie, lstrlenW(post_cookie))) - { - WARN("InternetSetOption INTERNET_OPTION_SECONDARY_CACHE_KEY failed: %d\n", - GetLastError()); - } - } - - if (This->bind_info.dwBindVerb != BINDVERB_GET) - { - /* Native does not use GlobalLock/GlobalUnlock, so we won't either */ - if (This->bind_info.stgmedData.tymed != TYMED_HGLOBAL) - WARN("Expected This->bind_info.stgmedData.tymed to be TYMED_HGLOBAL, not %d\n", - This->bind_info.stgmedData.tymed); - else - optional = (LPWSTR)This->bind_info.stgmedData.u.hGlobal; - } - if (!HttpSendRequestW(This->request, This->full_header, lstrlenW(This->full_header), - optional, - optional ? This->bind_info.cbstgmedData : 0) && - GetLastError() != ERROR_IO_PENDING) - { - WARN("HttpSendRequest failed: %d\n", GetLastError()); - hres = INET_E_DOWNLOAD_FAILURE; - goto done; - } - - hres = S_OK; -done: - if (hres != S_OK) - { - IInternetProtocolSink_ReportResult(This->protocol_sink, hres, 0, NULL); - HTTPPROTOCOL_Close(This); - } - - CoTaskMemFree(post_cookie); - CoTaskMemFree(addl_header); - if (http_negotiate2) - IHttpNegotiate2_Release(http_negotiate2); - if (service_provider) - IServiceProvider_Release(service_provider); - - while (num<sizeof(accept_mimes)/sizeof(accept_mimes[0]) && - accept_mimes[num]) - CoTaskMemFree(accept_mimes[num++]); - CoTaskMemFree(user_agent); - - heap_free(pass); - heap_free(user); - heap_free(path); - heap_free(host); - - return hres; + return MK_E_SYNTAX; + + return protocol_start(&This->base, PROTOCOL(This), szUrl, pOIProtSink, pOIBindInfo); } static HRESULT WINAPI HttpProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) { HttpProtocol *This = PROTOCOL_THIS(iface); - DWORD len = sizeof(DWORD), status_code; - LPWSTR response_headers = 0, content_type = 0, content_length = 0; - - static const WCHAR wszDefaultContentType[] = - {'t','e','x','t','/','h','t','m','l',0}; TRACE("(%p)->(%p)\n", This, pProtocolData); - if (!pProtocolData) - { - WARN("Expected pProtocolData to be non-NULL\n"); - return S_OK; - } - else if (!This->request) - { - WARN("Expected request to be non-NULL\n"); - return S_OK; - } - else if (!This->http_negotiate) - { - WARN("Expected IHttpNegotiate pointer to be non-NULL\n"); - return S_OK; - } - else if (!This->protocol_sink) - { - WARN("Expected IInternetProtocolSink pointer to be non-NULL\n"); - return S_OK; - } - - if (pProtocolData->pData == (LPVOID)BINDSTATUS_DOWNLOADINGDATA) - { - if (!HttpQueryInfoW(This->request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, - &status_code, &len, NULL)) - { - WARN("HttpQueryInfo failed: %d\n", GetLastError()); - } - else - { - len = 0; - if ((!HttpQueryInfoW(This->request, HTTP_QUERY_RAW_HEADERS_CRLF, response_headers, &len, - NULL) && - GetLastError() != ERROR_INSUFFICIENT_BUFFER) || - !(response_headers = heap_alloc(len)) || - !HttpQueryInfoW(This->request, HTTP_QUERY_RAW_HEADERS_CRLF, response_headers, &len, - NULL)) - { - WARN("HttpQueryInfo failed: %d\n", GetLastError()); - } - else - { - HRESULT hres = IHttpNegotiate_OnResponse(This->http_negotiate, status_code, - response_headers, NULL, NULL); - if (hres != S_OK) - { - WARN("IHttpNegotiate_OnResponse failed: %08x\n", hres); - goto done; - } - } - } - - if(This->https) - IInternetProtocolSink_ReportProgress(This->protocol_sink, BINDSTATUS_ACCEPTRANGES, NULL); - - len = 0; - if ((!HttpQueryInfoW(This->request, HTTP_QUERY_CONTENT_TYPE, content_type, &len, NULL) && - GetLastError() != ERROR_INSUFFICIENT_BUFFER) || - !(content_type = heap_alloc(len)) || - !HttpQueryInfoW(This->request, HTTP_QUERY_CONTENT_TYPE, content_type, &len, NULL)) - { - WARN("HttpQueryInfo failed: %d\n", GetLastError()); - IInternetProtocolSink_ReportProgress(This->protocol_sink, - (This->grfBINDF & BINDF_FROMURLMON) ? - BINDSTATUS_MIMETYPEAVAILABLE : - BINDSTATUS_RAWMIMETYPE, - wszDefaultContentType); - } - else - { - /* remove the charset, if present */ - LPWSTR p = strchrW(content_type, ';'); - if (p) *p = '\0'; - - IInternetProtocolSink_ReportProgress(This->protocol_sink, - (This->grfBINDF & BINDF_FROMURLMON) ? - BINDSTATUS_MIMETYPEAVAILABLE : - BINDSTATUS_RAWMIMETYPE, - content_type); - } - - len = 0; - if ((!HttpQueryInfoW(This->request, HTTP_QUERY_CONTENT_LENGTH, content_length, &len, NULL) && - GetLastError() != ERROR_INSUFFICIENT_BUFFER) || - !(content_length = heap_alloc(len)) || - !HttpQueryInfoW(This->request, HTTP_QUERY_CONTENT_LENGTH, content_length, &len, NULL)) - { - WARN("HttpQueryInfo failed: %d\n", GetLastError()); - This->content_length = 0; - } - else - { - This->content_length = atoiW(content_length); - } - - if(This->grfBINDF & BINDF_NEEDFILE) { - WCHAR cache_file[MAX_PATH]; - DWORD buflen = sizeof(cache_file); - - if(InternetQueryOptionW(This->request, INTERNET_OPTION_DATAFILE_NAME, - cache_file, &buflen)) - { - IInternetProtocolSink_ReportProgress(This->protocol_sink, - BINDSTATUS_CACHEFILENAMEAVAILABLE, - cache_file); - }else { - FIXME("Could not get cache file\n"); - } - } - - This->flags |= FLAG_FIRST_CONTINUE_COMPLETE; - } - - if (pProtocolData->pData >= (LPVOID)BINDSTATUS_DOWNLOADINGDATA) - { - /* InternetQueryDataAvailable may immediately fork and perform its asynchronous - * read, so clear the flag _before_ calling so it does not incorrectly get cleared - * after the status callback is called */ - This->flags &= ~FLAG_REQUEST_COMPLETE; - if (!InternetQueryDataAvailable(This->request, &This->available_bytes, 0, 0)) - { - if (GetLastError() != ERROR_IO_PENDING) - { - This->flags |= FLAG_REQUEST_COMPLETE; - WARN("InternetQueryDataAvailable failed: %d\n", GetLastError()); - HTTPPROTOCOL_ReportResult(This, INET_E_DATA_NOT_AVAILABLE); - } - } - else - { - This->flags |= FLAG_REQUEST_COMPLETE; - HTTPPROTOCOL_ReportData(This); - } - } - -done: - heap_free(response_headers); - heap_free(content_type); - heap_free(content_length); - - /* Returns S_OK on native */ - return S_OK; + return protocol_continue(&This->base, pProtocolData); } static HRESULT WINAPI HttpProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, @@ -730,8 +404,8 @@ HttpProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); - HTTPPROTOCOL_Close(This); - + + protocol_close_connection(&This->base); return S_OK; } @@ -753,80 +427,10 @@ ULONG cb, ULONG *pcbRead) { HttpProtocol *This = PROTOCOL_THIS(iface); - ULONG read = 0, len = 0; - HRESULT hres = S_FALSE; TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); - if (!(This->flags & FLAG_REQUEST_COMPLETE)) - { - hres = E_PENDING; - } - else while (!(This->flags & FLAG_ALL_DATA_READ) && - read < cb) - { - if (This->available_bytes == 0) - { - /* InternetQueryDataAvailable may immediately fork and perform its asynchronous - * read, so clear the flag _before_ calling so it does not incorrectly get cleared - * after the status callback is called */ - This->flags &= ~FLAG_REQUEST_COMPLETE; - if (!InternetQueryDataAvailable(This->request, &This->available_bytes, 0, 0)) - { - if (GetLastError() == ERROR_IO_PENDING) - { - hres = E_PENDING; - } - else - { - WARN("InternetQueryDataAvailable failed: %d\n", GetLastError()); - hres = INET_E_DATA_NOT_AVAILABLE; - HTTPPROTOCOL_ReportResult(This, hres); - } - goto done; - } - else if (This->available_bytes == 0) - { - HTTPPROTOCOL_AllDataRead(This); - } - } - else - { - if (!InternetReadFile(This->request, ((BYTE *)pv)+read, - This->available_bytes > cb-read ? - cb-read : This->available_bytes, &len)) - { - WARN("InternetReadFile failed: %d\n", GetLastError()); - hres = INET_E_DOWNLOAD_FAILURE; - HTTPPROTOCOL_ReportResult(This, hres); - goto done; - } - else if (len == 0) - { - HTTPPROTOCOL_AllDataRead(This); - } - else - { - read += len; - This->current_position += len; - This->available_bytes -= len; - } - } - } - - /* Per MSDN this should be if (read == cb), but native returns S_OK - * if any bytes were read, so we will too */ - if (read) - hres = S_OK; - -done: - if (pcbRead) - *pcbRead = read; - - if (hres != E_PENDING) - This->flags |= FLAG_REQUEST_COMPLETE; - - return hres; + return protocol_read(&This->base, pv, cb, pcbRead); } static HRESULT WINAPI HttpProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, @@ -843,10 +447,7 @@ TRACE("(%p)->(%08x)\n", This, dwOptions); - if (!InternetLockRequestFile(This->request, &This->lock)) - WARN("InternetLockRequest failed: %d\n", GetLastError()); - - return S_OK; + return protocol_lock_request(&This->base); } static HRESULT WINAPI HttpProtocol_UnlockRequest(IInternetProtocol *iface) @@ -855,67 +456,10 @@ TRACE("(%p)\n", This); - if (This->lock) - { - if (!InternetUnlockRequestFile(This->lock)) - WARN("InternetUnlockRequest failed: %d\n", GetLastError()); - This->lock = 0; - } - - return S_OK; + return protocol_unlock_request(&This->base); } #undef PROTOCOL_THIS - -#define PRIORITY_THIS(iface) DEFINE_THIS(HttpProtocol, InternetPriority, iface) - -static HRESULT WINAPI HttpPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv) -{ - HttpProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv); -} - -static ULONG WINAPI HttpPriority_AddRef(IInternetPriority *iface) -{ - HttpProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocol_AddRef(PROTOCOL(This)); -} - -static ULONG WINAPI HttpPriority_Release(IInternetPriority *iface) -{ - HttpProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocol_Release(PROTOCOL(This)); -} - -static HRESULT WINAPI HttpPriority_SetPriority(IInternetPriority *iface, LONG nPriority) -{ - HttpProtocol *This = PRIORITY_THIS(iface); - - TRACE("(%p)->(%d)\n", This, nPriority); - - This->priority = nPriority; - return S_OK; -} - -static HRESULT WINAPI HttpPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority) -{ - HttpProtocol *This = PRIORITY_THIS(iface); - - TRACE("(%p)->(%p)\n", This, pnPriority); - - *pnPriority = This->priority; - return S_OK; -} - -#undef PRIORITY_THIS - -static const IInternetPriorityVtbl HttpPriorityVtbl = { - HttpPriority_QueryInterface, - HttpPriority_AddRef, - HttpPriority_Release, - HttpPriority_SetPriority, - HttpPriority_GetPriority -}; static const IInternetProtocolVtbl HttpProtocolVtbl = { HttpProtocol_QueryInterface, @@ -933,6 +477,56 @@ HttpProtocol_UnlockRequest }; +#define PRIORITY_THIS(iface) DEFINE_THIS(HttpProtocol, InternetPriority, iface) + +static HRESULT WINAPI HttpPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv) +{ + HttpProtocol *This = PRIORITY_THIS(iface); + return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv); +} + +static ULONG WINAPI HttpPriority_AddRef(IInternetPriority *iface) +{ + HttpProtocol *This = PRIORITY_THIS(iface); + return IInternetProtocol_AddRef(PROTOCOL(This)); +} + +static ULONG WINAPI HttpPriority_Release(IInternetPriority *iface) +{ + HttpProtocol *This = PRIORITY_THIS(iface); + return IInternetProtocol_Release(PROTOCOL(This)); +} + +static HRESULT WINAPI HttpPriority_SetPriority(IInternetPriority *iface, LONG nPriority) +{ + HttpProtocol *This = PRIORITY_THIS(iface); + + TRACE("(%p)->(%d)\n", This, nPriority); + + This->base.priority = nPriority; + return S_OK; +} + +static HRESULT WINAPI HttpPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority) +{ + HttpProtocol *This = PRIORITY_THIS(iface); + + TRACE("(%p)->(%p)\n", This, pnPriority); + + *pnPriority = This->base.priority; + return S_OK; +} + +#undef PRIORITY_THIS + +static const IInternetPriorityVtbl HttpPriorityVtbl = { + HttpPriority_QueryInterface, + HttpPriority_AddRef, + HttpPriority_Release, + HttpPriority_SetPriority, + HttpPriority_GetPriority +}; + static HRESULT create_http_protocol(BOOL https, void **ppobj) { HttpProtocol *ret; @@ -941,6 +535,7 @@ if(!ret) return E_OUTOFMEMORY; + ret->base.vtbl = &AsyncProtocolVtbl; ret->lpInternetProtocolVtbl = &HttpProtocolVtbl; ret->lpInternetPriorityVtbl = &HttpPriorityVtbl; Added: trunk/reactos/dll/win32/urlmon/protocol.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/protocol.…
============================================================================== --- trunk/reactos/dll/win32/urlmon/protocol.c (added) +++ trunk/reactos/dll/win32/urlmon/protocol.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -1,0 +1,430 @@ +/* + * Copyright 2007 Misha Koshelev + * Copyright 2009 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "urlmon_main.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); + +/* Flags are needed for, among other things, return HRESULTs from the Read function + * to conform to native. For example, Read returns: + * + * 1. E_PENDING if called before the request has completed, + * (flags = 0) + * 2. S_FALSE after all data has been read and S_OK has been reported, + * (flags = FLAG_REQUEST_COMPLETE | FLAG_ALL_DATA_READ | FLAG_RESULT_REPORTED) + * 3. INET_E_DATA_NOT_AVAILABLE if InternetQueryDataAvailable fails. The first time + * this occurs, INET_E_DATA_NOT_AVAILABLE will also be reported to the sink, + * (flags = FLAG_REQUEST_COMPLETE) + * but upon subsequent calls to Read no reporting will take place, yet + * InternetQueryDataAvailable will still be called, and, on failure, + * INET_E_DATA_NOT_AVAILABLE will still be returned. + * (flags = FLAG_REQUEST_COMPLETE | FLAG_RESULT_REPORTED) + * + * FLAG_FIRST_DATA_REPORTED and FLAG_LAST_DATA_REPORTED are needed for proper + * ReportData reporting. For example, if OnResponse returns S_OK, Continue will + * report BSCF_FIRSTDATANOTIFICATION, and when all data has been read Read will + * report BSCF_INTERMEDIATEDATANOTIFICATION|BSCF_LASTDATANOTIFICATION. However, + * if OnResponse does not return S_OK, Continue will not report data, and Read + * will report BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION when all + * data has been read. + */ +#define FLAG_REQUEST_COMPLETE 0x0001 +#define FLAG_FIRST_CONTINUE_COMPLETE 0x0002 +#define FLAG_FIRST_DATA_REPORTED 0x0004 +#define FLAG_ALL_DATA_READ 0x0008 +#define FLAG_LAST_DATA_REPORTED 0x0010 +#define FLAG_RESULT_REPORTED 0x0020 + +static inline HRESULT report_progress(Protocol *protocol, ULONG status_code, LPCWSTR status_text) +{ + return IInternetProtocolSink_ReportProgress(protocol->protocol_sink, status_code, status_text); +} + +static inline HRESULT report_result(Protocol *protocol, HRESULT hres) +{ + if (!(protocol->flags & FLAG_RESULT_REPORTED) && protocol->protocol_sink) { + protocol->flags |= FLAG_RESULT_REPORTED; + IInternetProtocolSink_ReportResult(protocol->protocol_sink, hres, 0, NULL); + } + + return hres; +} + +static void report_data(Protocol *protocol) +{ + DWORD bscf; + + if((protocol->flags & FLAG_LAST_DATA_REPORTED) || !protocol->protocol_sink) + return; + + if(protocol->flags & FLAG_FIRST_DATA_REPORTED) { + bscf = BSCF_INTERMEDIATEDATANOTIFICATION; + }else { + protocol->flags |= FLAG_FIRST_DATA_REPORTED; + bscf = BSCF_FIRSTDATANOTIFICATION; + } + + if(protocol->flags & FLAG_ALL_DATA_READ && !(protocol->flags & FLAG_LAST_DATA_REPORTED)) { + protocol->flags |= FLAG_LAST_DATA_REPORTED; + bscf |= BSCF_LASTDATANOTIFICATION; + } + + IInternetProtocolSink_ReportData(protocol->protocol_sink, bscf, + protocol->current_position+protocol->available_bytes, + protocol->content_length); +} + +static void all_data_read(Protocol *protocol) +{ + protocol->flags |= FLAG_ALL_DATA_READ; + + report_data(protocol); + report_result(protocol, S_OK); +} + +static void request_complete(Protocol *protocol, INTERNET_ASYNC_RESULT *ar) +{ + PROTOCOLDATA data; + + if(!ar->dwResult) { + WARN("request failed: %d\n", ar->dwError); + return; + } + + protocol->flags |= FLAG_REQUEST_COMPLETE; + + if(!protocol->request) { + TRACE("setting request handle %p\n", (HINTERNET)ar->dwResult); + protocol->request = (HINTERNET)ar->dwResult; + } + + /* PROTOCOLDATA same as native */ + memset(&data, 0, sizeof(data)); + data.dwState = 0xf1000000; + if(protocol->flags & FLAG_FIRST_CONTINUE_COMPLETE) + data.pData = (LPVOID)BINDSTATUS_ENDDOWNLOADCOMPONENTS; + else + data.pData = (LPVOID)BINDSTATUS_DOWNLOADINGDATA; + + if (protocol->bindf & BINDF_FROMURLMON) + IInternetProtocolSink_Switch(protocol->protocol_sink, &data); + else + protocol_continue(protocol, &data); +} + +static void WINAPI internet_status_callback(HINTERNET internet, DWORD_PTR context, + DWORD internet_status, LPVOID status_info, DWORD status_info_len) +{ + Protocol *protocol = (Protocol*)context; + + switch(internet_status) { + case INTERNET_STATUS_RESOLVING_NAME: + TRACE("%p INTERNET_STATUS_RESOLVING_NAME\n", protocol); + report_progress(protocol, BINDSTATUS_FINDINGRESOURCE, (LPWSTR)status_info); + break; + + case INTERNET_STATUS_CONNECTING_TO_SERVER: + TRACE("%p INTERNET_STATUS_CONNECTING_TO_SERVER\n", protocol); + report_progress(protocol, BINDSTATUS_CONNECTING, (LPWSTR)status_info); + break; + + case INTERNET_STATUS_SENDING_REQUEST: + TRACE("%p INTERNET_STATUS_SENDING_REQUEST\n", protocol); + report_progress(protocol, BINDSTATUS_SENDINGREQUEST, (LPWSTR)status_info); + break; + + case INTERNET_STATUS_REQUEST_COMPLETE: + request_complete(protocol, status_info); + break; + + case INTERNET_STATUS_HANDLE_CREATED: + TRACE("%p INTERNET_STATUS_HANDLE_CREATED\n", protocol); + IInternetProtocol_AddRef(protocol->protocol); + break; + + case INTERNET_STATUS_HANDLE_CLOSING: + TRACE("%p INTERNET_STATUS_HANDLE_CLOSING\n", protocol); + + if(*(HINTERNET *)status_info == protocol->request) { + protocol->request = NULL; + if(protocol->protocol_sink) { + IInternetProtocolSink_Release(protocol->protocol_sink); + protocol->protocol_sink = NULL; + } + + if(protocol->bind_info.cbSize) { + ReleaseBindInfo(&protocol->bind_info); + memset(&protocol->bind_info, 0, sizeof(protocol->bind_info)); + } + }else if(*(HINTERNET *)status_info == protocol->connection) { + protocol->connection = NULL; + } + + IInternetProtocol_Release(protocol->protocol); + break; + + default: + WARN("Unhandled Internet status callback %d\n", internet_status); + } +} + +HRESULT protocol_start(Protocol *protocol, IInternetProtocol *prot, LPCWSTR url, + IInternetProtocolSink *protocol_sink, IInternetBindInfo *bind_info) +{ + LPOLESTR user_agent = NULL; + DWORD request_flags; + ULONG size = 0; + HRESULT hres; + + protocol->protocol = prot; + + IInternetProtocolSink_AddRef(protocol_sink); + protocol->protocol_sink = protocol_sink; + + memset(&protocol->bind_info, 0, sizeof(protocol->bind_info)); + protocol->bind_info.cbSize = sizeof(BINDINFO); + hres = IInternetBindInfo_GetBindInfo(bind_info, &protocol->bindf, &protocol->bind_info); + if(hres != S_OK) { + WARN("GetBindInfo failed: %08x\n", hres); + return report_result(protocol, hres); + } + + if(!(protocol->bindf & BINDF_FROMURLMON)) + report_progress(protocol, BINDSTATUS_DIRECTBIND, NULL); + + hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_USER_AGENT, &user_agent, 1, &size); + if (hres != S_OK || !size) { + DWORD len; + CHAR null_char = 0; + LPSTR user_agenta = NULL; + + len = 0; + if ((hres = ObtainUserAgentString(0, &null_char, &len)) != E_OUTOFMEMORY) { + WARN("ObtainUserAgentString failed: %08x\n", hres); + }else if (!(user_agenta = heap_alloc(len*sizeof(CHAR)))) { + WARN("Out of memory\n"); + }else if ((hres = ObtainUserAgentString(0, user_agenta, &len)) != S_OK) { + WARN("ObtainUserAgentString failed: %08x\n", hres); + }else { + if(!(user_agent = CoTaskMemAlloc((len)*sizeof(WCHAR)))) + WARN("Out of memory\n"); + else + MultiByteToWideChar(CP_ACP, 0, user_agenta, -1, user_agent, len); + } + heap_free(user_agenta); + } + + protocol->internet = InternetOpenW(user_agent, 0, NULL, NULL, INTERNET_FLAG_ASYNC); + CoTaskMemFree(user_agent); + if(!protocol->internet) { + WARN("InternetOpen failed: %d\n", GetLastError()); + return report_result(protocol, INET_E_NO_SESSION); + } + + /* Native does not check for success of next call, so we won't either */ + InternetSetStatusCallbackW(protocol->internet, internet_status_callback); + + request_flags = INTERNET_FLAG_KEEP_CONNECTION; + if(protocol->bindf & BINDF_NOWRITECACHE) + request_flags |= INTERNET_FLAG_NO_CACHE_WRITE; + if(protocol->bindf & BINDF_NEEDFILE) + request_flags |= INTERNET_FLAG_NEED_FILE; + + hres = protocol->vtbl->open_request(protocol, url, request_flags, bind_info); + if(FAILED(hres)) { + protocol_close_connection(protocol); + return report_result(protocol, hres); + } + + return S_OK; +} + +HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data) +{ + HRESULT hres; + + if (!data) { + WARN("Expected pProtocolData to be non-NULL\n"); + return S_OK; + } + + if(!protocol->request) { + WARN("Expected request to be non-NULL\n"); + return S_OK; + } + + if(!protocol->protocol_sink) { + WARN("Expected IInternetProtocolSink pointer to be non-NULL\n"); + return S_OK; + } + + if(data->pData == (LPVOID)BINDSTATUS_DOWNLOADINGDATA) { + hres = protocol->vtbl->start_downloading(protocol); + if(FAILED(hres)) { + protocol_close_connection(protocol); + report_result(protocol, hres); + return S_OK; + } + + if(protocol->bindf & BINDF_NEEDFILE) { + WCHAR cache_file[MAX_PATH]; + DWORD buflen = sizeof(cache_file); + + if(InternetQueryOptionW(protocol->request, INTERNET_OPTION_DATAFILE_NAME, + cache_file, &buflen)) { + report_progress(protocol, BINDSTATUS_CACHEFILENAMEAVAILABLE, cache_file); + }else { + FIXME("Could not get cache file\n"); + } + } + + protocol->flags |= FLAG_FIRST_CONTINUE_COMPLETE; + } + + if(data->pData >= (LPVOID)BINDSTATUS_DOWNLOADINGDATA) { + BOOL res; + + /* InternetQueryDataAvailable may immediately fork and perform its asynchronous + * read, so clear the flag _before_ calling so it does not incorrectly get cleared + * after the status callback is called */ + protocol->flags &= ~FLAG_REQUEST_COMPLETE; + res = InternetQueryDataAvailable(protocol->request, &protocol->available_bytes, 0, 0); + if(res) { + protocol->flags |= FLAG_REQUEST_COMPLETE; + report_data(protocol); + }else if(GetLastError() != ERROR_IO_PENDING) { + protocol->flags |= FLAG_REQUEST_COMPLETE; + WARN("InternetQueryDataAvailable failed: %d\n", GetLastError()); + report_result(protocol, INET_E_DATA_NOT_AVAILABLE); + } + } + + return S_OK; +} + +HRESULT protocol_read(Protocol *protocol, void *buf, ULONG size, ULONG *read_ret) +{ + ULONG read = 0; + BOOL res; + HRESULT hres = S_FALSE; + + if(!(protocol->flags & FLAG_REQUEST_COMPLETE)) { + *read_ret = 0; + return E_PENDING; + } + + if(protocol->flags & FLAG_ALL_DATA_READ) { + *read_ret = 0; + return S_FALSE; + } + + while(read < size) { + if(protocol->available_bytes) { + ULONG len; + + res = InternetReadFile(protocol->request, ((BYTE *)buf)+read, + protocol->available_bytes > size-read ? size-read : protocol->available_bytes, &len); + if(!res) { + WARN("InternetReadFile failed: %d\n", GetLastError()); + hres = INET_E_DOWNLOAD_FAILURE; + report_result(protocol, hres); + break; + } + + if(!len) { + all_data_read(protocol); + break; + } + + read += len; + protocol->current_position += len; + protocol->available_bytes -= len; + }else { + /* InternetQueryDataAvailable may immediately fork and perform its asynchronous + * read, so clear the flag _before_ calling so it does not incorrectly get cleared + * after the status callback is called */ + protocol->flags &= ~FLAG_REQUEST_COMPLETE; + res = InternetQueryDataAvailable(protocol->request, &protocol->available_bytes, 0, 0); + if(!res) { + if (GetLastError() == ERROR_IO_PENDING) { + hres = E_PENDING; + }else { + WARN("InternetQueryDataAvailable failed: %d\n", GetLastError()); + hres = INET_E_DATA_NOT_AVAILABLE; + report_result(protocol, hres); + } + break; + } + + if(!protocol->available_bytes) { + all_data_read(protocol); + break; + } + } + } + + *read_ret = read; + + if (hres != E_PENDING) + protocol->flags |= FLAG_REQUEST_COMPLETE; + if(FAILED(hres)) + return hres; + + return read ? S_OK : S_FALSE; +} + +HRESULT protocol_lock_request(Protocol *protocol) +{ + if (!InternetLockRequestFile(protocol->request, &protocol->lock)) + WARN("InternetLockRequest failed: %d\n", GetLastError()); + + return S_OK; +} + +HRESULT protocol_unlock_request(Protocol *protocol) +{ + if(!protocol->lock) + return S_OK; + + if(!InternetUnlockRequestFile(protocol->lock)) + WARN("InternetUnlockRequest failed: %d\n", GetLastError()); + protocol->lock = 0; + + return S_OK; +} + +void protocol_close_connection(Protocol *protocol) +{ + protocol->vtbl->close_connection(protocol); + + if(protocol->request) + InternetCloseHandle(protocol->request); + + if(protocol->connection) + InternetCloseHandle(protocol->connection); + + if(protocol->internet) { + InternetCloseHandle(protocol->internet); + protocol->internet = 0; + } + + protocol->flags = 0; +} Propchange: trunk/reactos/dll/win32/urlmon/protocol.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/urlmon/umon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/umon.c?re…
============================================================================== --- trunk/reactos/dll/win32/urlmon/umon.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/umon.c [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -532,8 +532,6 @@ if(SUCCEEDED(hres)) { URL_COMPONENTSW url; WCHAR *host, *path, *user, *pass; - DWORD dwService = 0; - BOOL bSuccess; TRACE("got bindinfo. bindf = %08x extrainfo = %s bindinfof = %08x bindverb = %08x iid %s\n", bindf, debugstr_w(bi.szExtraInfo), bi.grfBindInfoF, bi.dwBindVerb, debugstr_guid(&bi.iid)); @@ -583,23 +581,10 @@ break; } - switch ((DWORD) url.nScheme) - { - case INTERNET_SCHEME_FTP: - if (!url.nPort) - url.nPort = INTERNET_DEFAULT_FTP_PORT; - dwService = INTERNET_SERVICE_FTP; - break; - - case INTERNET_SCHEME_GOPHER: - if (!url.nPort) - url.nPort = INTERNET_DEFAULT_GOPHER_PORT; - dwService = INTERNET_SERVICE_GOPHER; - break; - } - + if (!url.nPort) + url.nPort = INTERNET_DEFAULT_GOPHER_PORT; bind->hconnect = InternetConnectW(bind->hinternet, host, url.nPort, user, pass, - dwService, 0, (DWORD_PTR)bind); + INTERNET_SERVICE_GOPHER, 0, (DWORD_PTR)bind); if (!bind->hconnect) { hres = HRESULT_FROM_WIN32(GetLastError()); @@ -612,37 +597,12 @@ hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_CONNECTING, NULL); hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_SENDINGREQUEST, NULL); - bSuccess = FALSE; - - switch (dwService) - { - case INTERNET_SERVICE_GOPHER: - bind->hrequest = GopherOpenFileW(bind->hconnect, - path, - 0, - INTERNET_FLAG_RELOAD, - 0); - if (bind->hrequest) - bSuccess = TRUE; - else - hres = HRESULT_FROM_WIN32(GetLastError()); - break; - - case INTERNET_SERVICE_FTP: - bind->hrequest = FtpOpenFileW(bind->hconnect, - path, - GENERIC_READ, - FTP_TRANSFER_TYPE_BINARY | - INTERNET_FLAG_TRANSFER_BINARY | - INTERNET_FLAG_RELOAD, - 0); - if (bind->hrequest) - bSuccess = TRUE; - else - hres = HRESULT_FROM_WIN32(GetLastError()); - break; - } - if(bSuccess) + bind->hrequest = GopherOpenFileW(bind->hconnect, + path, + 0, + INTERNET_FLAG_RELOAD, + 0); + if (bind->hrequest) { TRACE("res = %d gle = %u url len = %d\n", hres, GetLastError(), bind->expected_size); @@ -660,7 +620,10 @@ } InternetCloseHandle(bind->hrequest); hres = S_OK; + }else { + hres = HRESULT_FROM_WIN32(GetLastError()); } + InternetCloseHandle(bind->hconnect); InternetCloseHandle(bind->hinternet); @@ -704,9 +667,7 @@ return E_FAIL; } - if(IsEqualGUID(&IID_IStream, riid) && - ( url.nScheme == INTERNET_SCHEME_FTP - || url.nScheme == INTERNET_SCHEME_GOPHER)) + if(IsEqualGUID(&IID_IStream, riid) && url.nScheme == INTERNET_SCHEME_GOPHER) return URLMonikerImpl_BindToStorage_hack(This->URLName, pbc, ppvObject); TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObject); Modified: trunk/reactos/dll/win32/urlmon/urlmon.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon.rb…
============================================================================== --- trunk/reactos/dll/win32/urlmon/urlmon.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/urlmon.rbuild [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -18,6 +18,7 @@ <file>http.c</file> <file>internet.c</file> <file>mk.c</file> + <file>protocol.c</file> <file>regsvr.c</file> <file>sec_mgr.c</file> <file>session.c</file> Modified: trunk/reactos/dll/win32/urlmon/urlmon_main.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon_ma…
============================================================================== --- trunk/reactos/dll/win32/urlmon/urlmon_main.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/urlmon_main.h [iso-8859-1] Wed Mar 4 18:29:32 2009 @@ -1,5 +1,6 @@ /* * Copyright 2002 Huw D M Davies for CodeWeavers + * Copyright 2009 Jacek Caban for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,6 +31,7 @@ #include "winuser.h" #include "ole2.h" #include "urlmon.h" +#include "wininet.h" #include "wine/unicode.h" @@ -50,7 +52,8 @@ static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &URLMON_refCount ); } #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) -#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl))) +#define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc))) +#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface) typedef struct { @@ -75,6 +78,43 @@ HRESULT create_binding_protocol(LPCWSTR url, BOOL from_urlmon, IInternetProtocol **protocol); void set_binding_sink(IInternetProtocol *bind_protocol, IInternetProtocolSink *sink); + +typedef struct ProtocolVtbl ProtocolVtbl; + +typedef struct { + const ProtocolVtbl *vtbl; + + IInternetProtocol *protocol; + IInternetProtocolSink *protocol_sink; + + DWORD bindf; + BINDINFO bind_info; + + HINTERNET internet; + HINTERNET request; + HINTERNET connection; + DWORD flags; + HANDLE lock; + + ULONG current_position; + ULONG content_length; + ULONG available_bytes; + + LONG priority; +} Protocol; + +struct ProtocolVtbl { + HRESULT (*open_request)(Protocol*,LPCWSTR,DWORD,IInternetBindInfo*); + HRESULT (*start_downloading)(Protocol*); + void (*close_connection)(Protocol*); +}; + +HRESULT protocol_start(Protocol*,IInternetProtocol*,LPCWSTR,IInternetProtocolSink*,IInternetBindInfo*); +HRESULT protocol_continue(Protocol*,PROTOCOLDATA*); +HRESULT protocol_read(Protocol*,void*,ULONG,ULONG*); +HRESULT protocol_lock_request(Protocol*); +HRESULT protocol_unlock_request(Protocol*); +void protocol_close_connection(Protocol*); static inline void *heap_alloc(size_t len) { @@ -111,6 +151,21 @@ return ret; } +static inline LPWSTR heap_strndupW(LPCWSTR str, int len) +{ + LPWSTR ret = NULL; + + if(str) { + ret = heap_alloc((len+1)*sizeof(WCHAR)); + if(ret) { + memcpy(ret, str, len*sizeof(WCHAR)); + ret[len] = 0; + } + } + + return ret; +} + static inline LPWSTR heap_strdupAtoW(const char *str) { LPWSTR ret = NULL;
15 years, 9 months
1
0
0
0
[dchapyshev] 39866: - Sync spoolss with Wine head - Fix winspool stubs
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Wed Mar 4 18:24:06 2009 New Revision: 39866 URL:
http://svn.reactos.org/svn/reactos?rev=39866&view=rev
Log: - Sync spoolss with Wine head - Fix winspool stubs Modified: trunk/reactos/dll/win32/spoolss/router.c trunk/reactos/dll/win32/spoolss/spoolss.spec trunk/reactos/dll/win32/winspool/stubs.c Modified: trunk/reactos/dll/win32/spoolss/router.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/spoolss/router.c…
============================================================================== --- trunk/reactos/dll/win32/spoolss/router.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/spoolss/router.c [iso-8859-1] Wed Mar 4 18:24:06 2009 @@ -313,6 +313,122 @@ } /****************************************************************** + * AddMonitorW (spoolss.@) + * + * Install a Printmonitor + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * Level [I] Structure-Level (Must be 2) + * pMonitors [I] PTR to MONITOR_INFO_2 + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + * NOTES + * All Files for the Monitor must already be copied to %winsysdir% ("%SystemRoot%\system32") + * + */ +BOOL WINAPI AddMonitorW(LPWSTR pName, DWORD Level, LPBYTE pMonitors) +{ + backend_t * pb; + DWORD res = ROUTER_UNKNOWN; + + TRACE("(%s, %d, %p)\n", debugstr_w(pName), Level, pMonitors); + + if (Level != 2) { + SetLastError(ERROR_INVALID_LEVEL); + return FALSE; + } + + pb = backend_first(pName); + if (pb && pb->fpAddMonitor) + res = pb->fpAddMonitor(pName, Level, pMonitors); + else + { + SetLastError(ERROR_PROC_NOT_FOUND); + } + + TRACE("got %u with %u\n", res, GetLastError()); + return (res == ROUTER_SUCCESS); +} + +/****************************************************************** + * AddPrinterDriverExW (spoolss.@) + * + * Install a Printer Driver with the Option to upgrade / downgrade the Files + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * level [I] Level for the supplied DRIVER_INFO_*W struct + * pDriverInfo [I] PTR to DRIVER_INFO_*W struct with the Driver Parameter + * dwFileCopyFlags [I] How to Copy / Upgrade / Downgrade the needed Files + * + * RESULTS + * Success: TRUE + * Failure: FALSE + * + */ +BOOL WINAPI AddPrinterDriverExW(LPWSTR pName, DWORD level, LPBYTE pDriverInfo, DWORD dwFileCopyFlags) +{ + backend_t * pb; + DWORD res = ROUTER_UNKNOWN; + + TRACE("(%s, %d, %p, 0x%x)\n", debugstr_w(pName), level, pDriverInfo, dwFileCopyFlags); + + if (!pDriverInfo) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + pb = backend_first(pName); + if (pb && pb->fpAddPrinterDriverEx) + res = pb->fpAddPrinterDriverEx(pName, level, pDriverInfo, dwFileCopyFlags); + else + { + SetLastError(ERROR_PROC_NOT_FOUND); + } + + TRACE("got %u with %u\n", res, GetLastError()); + return (res == ROUTER_SUCCESS); +} + +/****************************************************************** + * DeleteMonitorW (spoolss.@) + * + * Delete a specific Printmonitor from a Printing-Environment + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * pEnvironment [I] Printing-Environment of the Monitor or NULL (Default) + * pMonitorName [I] Name of the Monitor, that should be deleted + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + */ +BOOL WINAPI DeleteMonitorW(LPWSTR pName, LPWSTR pEnvironment, LPWSTR pMonitorName) +{ + backend_t * pb; + DWORD res = ROUTER_UNKNOWN; + + TRACE("(%s, %s, %s)\n", debugstr_w(pName), debugstr_w(pEnvironment), debugstr_w(pMonitorName)); + + pb = backend_first(pName); + if (pb && pb->fpDeleteMonitor) + res = pb->fpDeleteMonitor(pName, pEnvironment, pMonitorName); + else + { + SetLastError(ERROR_PROC_NOT_FOUND); + } + + TRACE("got %u with %u\n", res, GetLastError()); + return (res == ROUTER_SUCCESS); +} + +/****************************************************************** * EnumMonitorsW (spoolss.@) * * Enumerate available Port-Monitors @@ -399,3 +515,58 @@ return (res == ROUTER_SUCCESS); } + +/****************************************************************** + * GetPrinterDriverDirectoryW (spoolss.@) + * + * Return the PATH for the Printer-Drivers + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * pEnvironment [I] Printing-Environment or NULL (Default) + * Level [I] Structure-Level (must be 1) + * pDriverDirectory [O] PTR to Buffer that receives the Result + * cbBuf [I] Size of Buffer at pDriverDirectory + * pcbNeeded [O] PTR to DWORD that receives the size in Bytes used / + * required for pDriverDirectory + * + * RETURNS + * Success: TRUE and in pcbNeeded the Bytes used in pDriverDirectory + * Failure: FALSE and in pcbNeeded the Bytes required for pDriverDirectory, + * if cbBuf is too small + * + * Native Values returned in pDriverDirectory on Success: + *| NT(Windows NT x86): "%winsysdir%\\spool\\DRIVERS\\w32x86" + *| NT(Windows x64): "%winsysdir%\\spool\\DRIVERS\\x64" + *| NT(Windows 4.0): "%winsysdir%\\spool\\DRIVERS\\win40" + *| win9x(Windows 4.0): "%winsysdir%" + * + * "%winsysdir%" is the Value from GetSystemDirectoryW() + * + */ +BOOL WINAPI GetPrinterDriverDirectoryW(LPWSTR pName, LPWSTR pEnvironment, + DWORD Level, LPBYTE pDriverDirectory, DWORD cbBuf, LPDWORD pcbNeeded) +{ + backend_t * pb; + DWORD res = ROUTER_UNKNOWN; + + TRACE("(%s, %s, %d, %p, %d, %p)\n", debugstr_w(pName), + debugstr_w(pEnvironment), Level, pDriverDirectory, cbBuf, pcbNeeded); + + if (pcbNeeded) *pcbNeeded = 0; + + pb = backend_first(pName); + if (pb && pb->fpGetPrinterDriverDirectory) + res = pb->fpGetPrinterDriverDirectory(pName, pEnvironment, Level, + pDriverDirectory, cbBuf, pcbNeeded); + else + { + SetLastError(ERROR_PROC_NOT_FOUND); + } + + TRACE("got %u with %u (%u byte)\n", + res, GetLastError(), pcbNeeded ? *pcbNeeded : 0); + + return (res == ROUTER_SUCCESS); + +} Modified: trunk/reactos/dll/win32/spoolss/spoolss.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/spoolss/spoolss.…
============================================================================== --- trunk/reactos/dll/win32/spoolss/spoolss.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/spoolss/spoolss.spec [iso-8859-1] Wed Mar 4 18:24:06 2009 @@ -1,14 +1,14 @@ @ stub AbortPrinter @ stub AddFormW @ stub AddJobW -@ stub AddMonitorW +@ stdcall AddMonitorW(wstr long ptr) @ stub AddPerMachineConnectionW @ stub AddPortExW @ stub AddPortW @ stub AddPrintProcessorW @ stub AddPrintProvidorW @ stub AddPrinterConnectionW -@ stub AddPrinterDriverExW +@ stdcall AddPrinterDriverExW(wstr long ptr long) @ stub AddPrinterDriverW @ stub AddPrinterExW @ stub AddPrinterW @@ -25,7 +25,7 @@ @ stub CreatePrinterIC @ stub DbgGetPointers @ stub DeleteFormW -@ stub DeleteMonitorW +@ stdcall DeleteMonitorW(wstr wstr wstr) @ stub DeletePerMachineConnectionW @ stub DeletePortW @ stub DeletePrintProcessorW @@ -68,7 +68,7 @@ @ stub GetPrintProcessorDirectoryW @ stub GetPrinterDataExW @ stub GetPrinterDataW -@ stub GetPrinterDriverDirectoryW +@ stdcall GetPrinterDriverDirectoryW(wstr wstr long ptr long ptr) @ stub GetPrinterDriverExW @ stub GetPrinterDriverW @ stub GetPrinterW Modified: trunk/reactos/dll/win32/winspool/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winspool/stubs.c…
============================================================================== --- trunk/reactos/dll/win32/winspool/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winspool/stubs.c [iso-8859-1] Wed Mar 4 18:24:06 2009 @@ -1068,9 +1068,9 @@ /* * @unimplemented */ -DWORD -WINAPI -GetPrinterDriverA(HANDLE Printer, LPSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +BOOL +WINAPI +GetPrinterDriverA(HANDLE Printer, LPSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrinterDriverA stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -1082,9 +1082,9 @@ /* * @unimplemented */ -DWORD -WINAPI -GetPrinterDriverW(HANDLE Printer, LPWSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +BOOL +WINAPI +GetPrinterDriverW(HANDLE Printer, LPWSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrinterDriverW stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -1096,9 +1096,9 @@ /* * @unimplemented */ -DWORD -WINAPI -GetPrinterDriverDirectoryA(LPSTR Name, LPSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +BOOL +WINAPI +GetPrinterDriverDirectoryA(LPSTR Name, LPSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrinterDriverDirectoryA stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -1110,9 +1110,9 @@ /* * @unimplemented */ -DWORD -WINAPI -GetPrinterDriverDirectoryW(LPWSTR Name, LPWSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +BOOL +WINAPI +GetPrinterDriverDirectoryW(LPWSTR Name, LPWSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrinterDriverDirectoryW stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -1124,9 +1124,9 @@ /* * @unimplemented */ -DWORD -WINAPI -GetPrintProcessorDirectoryA(LPSTR Name, LPSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +BOOL +WINAPI +GetPrintProcessorDirectoryA(LPSTR Name, LPSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrintProcessorDirectoryA stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -1138,9 +1138,9 @@ /* * @unimplemented */ -DWORD -WINAPI -GetPrintProcessorDirectoryW(LPWSTR Name, LPWSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +BOOL +WINAPI +GetPrintProcessorDirectoryW(LPWSTR Name, LPWSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrintProcessorDirectoryW stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
15 years, 9 months
1
0
0
0
[dchapyshev] 39865: - Fix header
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Wed Mar 4 18:22:48 2009 New Revision: 39865 URL:
http://svn.reactos.org/svn/reactos?rev=39865&view=rev
Log: - Fix header Modified: trunk/reactos/include/psdk/winspool.h Modified: trunk/reactos/include/psdk/winspool.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winspool.h?re…
============================================================================== --- trunk/reactos/include/psdk/winspool.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winspool.h [iso-8859-1] Wed Mar 4 18:22:48 2009 @@ -831,20 +831,20 @@ BOOL WINAPI GetDefaultPrinterA(LPSTR,LPDWORD); BOOL WINAPI GetDefaultPrinterW(LPWSTR,LPDWORD); #endif -BOOL WINAPI GetFormA(HANDLE,LPSTR,DWORD,PBYTE,DWORD,PDWORD); -BOOL WINAPI GetFormW(HANDLE,LPWSTR,DWORD,PBYTE,DWORD,PDWORD); -BOOL WINAPI GetJobA(HANDLE,DWORD,DWORD,PBYTE,DWORD,PDWORD); -BOOL WINAPI GetJobW(HANDLE,DWORD,DWORD,PBYTE,DWORD,PDWORD); -BOOL WINAPI GetPrinterA(HANDLE,DWORD,PBYTE,DWORD,PDWORD); -BOOL WINAPI GetPrinterW(HANDLE,DWORD,PBYTE,DWORD,PDWORD); -DWORD WINAPI GetPrinterDataA(HANDLE,LPSTR,PDWORD,PBYTE,DWORD,PDWORD); -DWORD WINAPI GetPrinterDataW(HANDLE,LPWSTR,PDWORD,PBYTE,DWORD,PDWORD); -DWORD WINAPI GetPrinterDriverA(HANDLE,LPSTR,DWORD,PBYTE,DWORD,PDWORD); -DWORD WINAPI GetPrinterDriverW(HANDLE,LPWSTR,DWORD,PBYTE,DWORD,PDWORD); -DWORD WINAPI GetPrinterDriverDirectoryA(LPSTR,LPSTR,DWORD,PBYTE,DWORD,PDWORD); -DWORD WINAPI GetPrinterDriverDirectoryW(LPWSTR,LPWSTR,DWORD,PBYTE,DWORD,PDWORD); -DWORD WINAPI GetPrintProcessorDirectoryA(LPSTR,LPSTR,DWORD,PBYTE,DWORD,PDWORD); -DWORD WINAPI GetPrintProcessorDirectoryW(LPWSTR,LPWSTR,DWORD,PBYTE,DWORD,PDWORD); +BOOL WINAPI GetFormA(HANDLE,LPSTR,DWORD,LPBYTE,DWORD,LPDWORD); +BOOL WINAPI GetFormW(HANDLE,LPWSTR,DWORD,LPBYTE,DWORD,LPDWORD); +BOOL WINAPI GetJobA(HANDLE,DWORD,DWORD,LPBYTE,DWORD,LPDWORD); +BOOL WINAPI GetJobW(HANDLE,DWORD,DWORD,LPBYTE,DWORD,LPDWORD); +BOOL WINAPI GetPrinterA(HANDLE,DWORD,LPBYTE,DWORD,LPDWORD); +BOOL WINAPI GetPrinterW(HANDLE,DWORD,LPBYTE,DWORD,LPDWORD); +DWORD WINAPI GetPrinterDataA(HANDLE,LPSTR,PDWORD,LPBYTE,DWORD,LPDWORD); +DWORD WINAPI GetPrinterDataW(HANDLE,LPWSTR,LPDWORD,LPBYTE,DWORD,LPDWORD); +BOOL WINAPI GetPrinterDriverA(HANDLE,LPSTR,DWORD,LPBYTE,DWORD,LPDWORD); +BOOL WINAPI GetPrinterDriverW(HANDLE,LPWSTR,DWORD,LPBYTE,DWORD,LPDWORD); +BOOL WINAPI GetPrinterDriverDirectoryA(LPSTR,LPSTR,DWORD,LPBYTE,DWORD,LPDWORD); +BOOL WINAPI GetPrinterDriverDirectoryW(LPWSTR,LPWSTR,DWORD,LPBYTE,DWORD,LPDWORD); +BOOL WINAPI GetPrintProcessorDirectoryA(LPSTR,LPSTR,DWORD,LPBYTE,DWORD,LPDWORD); +BOOL WINAPI GetPrintProcessorDirectoryW(LPWSTR,LPWSTR,DWORD,LPBYTE,DWORD,LPDWORD); BOOL WINAPI OpenPrinterA(LPSTR,PHANDLE,LPPRINTER_DEFAULTSA); BOOL WINAPI OpenPrinterW(LPWSTR,PHANDLE,LPPRINTER_DEFAULTSW); DWORD WINAPI PrinterMessageBoxA(HANDLE,DWORD,HWND,LPSTR,LPSTR,DWORD);
15 years, 9 months
1
0
0
0
[janderwald] 39864: - Import libsamplerate from http://www.mega-nerd.com/SRC/download.html - It will be used for samplerate conversion in kmixer - Thanks to blight for helping with asm - Do not import medium / high quality coeffs (600KB / 8MB file size)
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Mar 4 17:58:14 2009 New Revision: 39864 URL:
http://svn.reactos.org/svn/reactos?rev=39864&view=rev
Log: - Import libsamplerate from
http://www.mega-nerd.com/SRC/download.html
- It will be used for samplerate conversion in kmixer - Thanks to blight for helping with asm - Do not import medium / high quality coeffs (600KB / 8MB file size) Added: trunk/reactos/lib/3rdparty/libsamplerate/ (with props) trunk/reactos/lib/3rdparty/libsamplerate/common.h (with props) trunk/reactos/lib/3rdparty/libsamplerate/config.h (with props) trunk/reactos/lib/3rdparty/libsamplerate/fastest_coeffs.h (with props) trunk/reactos/lib/3rdparty/libsamplerate/float_cast.h (with props) trunk/reactos/lib/3rdparty/libsamplerate/libsamplerate.rbuild (with props) trunk/reactos/lib/3rdparty/libsamplerate/samplerate.c (with props) trunk/reactos/lib/3rdparty/libsamplerate/samplerate.h (with props) trunk/reactos/lib/3rdparty/libsamplerate/src_linear.c (with props) trunk/reactos/lib/3rdparty/libsamplerate/src_sinc.c (with props) trunk/reactos/lib/3rdparty/libsamplerate/src_zoh.c (with props) trunk/reactos/lib/3rdparty/libsamplerate/unistd.h (with props) Modified: trunk/reactos/lib/3rdparty/3rdparty.rbuild [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/lib/3rdparty/3rdparty.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/3rdparty.rbui…
Added: trunk/reactos/lib/3rdparty/libsamplerate/common.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libsamplerate…
Added: trunk/reactos/lib/3rdparty/libsamplerate/config.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libsamplerate…
Added: trunk/reactos/lib/3rdparty/libsamplerate/fastest_coeffs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libsamplerate…
Added: trunk/reactos/lib/3rdparty/libsamplerate/float_cast.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libsamplerate…
Added: trunk/reactos/lib/3rdparty/libsamplerate/libsamplerate.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libsamplerate…
Added: trunk/reactos/lib/3rdparty/libsamplerate/samplerate.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libsamplerate…
Added: trunk/reactos/lib/3rdparty/libsamplerate/samplerate.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libsamplerate…
Added: trunk/reactos/lib/3rdparty/libsamplerate/src_linear.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libsamplerate…
Added: trunk/reactos/lib/3rdparty/libsamplerate/src_sinc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libsamplerate…
Added: trunk/reactos/lib/3rdparty/libsamplerate/src_zoh.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libsamplerate…
Added: trunk/reactos/lib/3rdparty/libsamplerate/unistd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libsamplerate…
15 years, 9 months
1
0
0
0
[fireball] 39863: - Add first version of USB keyboard driver (limitations: no keyboard LEDs support, no repeated keypress support, right-side modifier keys not supported). - Cleanup source code of USB mouse driver.
by fireball@svn.reactos.org
Author: fireball Date: Wed Mar 4 16:40:22 2009 New Revision: 39863 URL:
http://svn.reactos.org/svn/reactos?rev=39863&view=rev
Log: - Add first version of USB keyboard driver (limitations: no keyboard LEDs support, no repeated keypress support, right-side modifier keys not supported). - Cleanup source code of USB mouse driver. Added: trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.c - copied, changed from r39836, trunk/reactos/drivers/usb/nt4compat/usbdriver/mouse.c trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.h - copied, changed from r39836, trunk/reactos/drivers/usb/nt4compat/usbdriver/mouse.h Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.h trunk/reactos/drivers/usb/nt4compat/usbdriver/mouse.c trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.h trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c [iso-8859-1] Wed Mar 4 16:40:22 2009 @@ -162,8 +162,8 @@ pdrvr[MOUSE_DRIVER_IDX].driver_init = mouse_driver_init; pdrvr[MOUSE_DRIVER_IDX].driver_destroy = mouse_driver_destroy; - //pdrvr[KEYBOARD_DRIVER_IDX].driver_init = gendrv_if_driver_init; - //pdrvr[KEYBOARD_DRIVER_IDX].driver_destroy = gendrv_if_driver_destroy; + pdrvr[KEYBOARD_DRIVER_IDX].driver_init = kbd_driver_init; + pdrvr[KEYBOARD_DRIVER_IDX].driver_destroy = kbd_driver_destroy; } BOOLEAN Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.h [iso-8859-1] Wed Mar 4 16:40:22 2009 @@ -50,7 +50,6 @@ } USB_DRIVER_DESCRIPTION,*PUSB_DRIVER_DESCRIPTION; -#define DEVMGR_MAX_DRIVERS 7//8 #define RH_DRIVER_IDX 0 #define HUB_DRIVER_IDX 1 #define UMSS_DRIVER_IDX 2 @@ -58,7 +57,8 @@ #define GEN_DRIVER_IDX 4 #define GEN_IF_DRIVER_IDX 5 #define MOUSE_DRIVER_IDX 6 -#define KEYBOARD_DRIVER_IDX 7//temp disabled +#define KEYBOARD_DRIVER_IDX 7 +#define DEVMGR_MAX_DRIVERS 8 typedef struct _USB_DRIVER { Copied: trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.c (from r39836, trunk/reactos/drivers/usb/nt4compat/usbdriver/mouse.c) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/mouse.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.c [iso-8859-1] Wed Mar 4 16:40:22 2009 @@ -1,40 +1,56 @@ /* * PROJECT: ReactOS USB Drivers * COPYRIGHT: GPL - See COPYING in the top level directory - * FILE: mouse.c - * PURPOSE: Generic USB mouse driver + * FILE: keyboard.c + * PURPOSE: Generic USB keyboard driver * PROGRAMMERS: Aleksey Bragin (aleksey(a)reactos.org) */ #include "usbdriver.h" -#include "ntddmou.h" #include "kbdmou.h" -//FIXME: is it needed at all? -typedef struct _USBMP_DEVICE_EXTENSION -{ - BOOLEAN IsFDO; -} USBMP_DEVICE_EXTENSION, *PUSBMP_DEVICE_EXTENSION; - /* Data for embedded drivers */ -//CONNECT_DATA KbdClassInformation; -CONNECT_DATA MouseClassInformation; - -PDEVICE_OBJECT MouseFdo = NULL; - - -BOOLEAN mouse_connect(PDEV_CONNECT_DATA dev_mgr, DEV_HANDLE dev_handle); -BOOLEAN mouse_disconnect(PUSB_DEV_MANAGER dev_mgr, DEV_HANDLE dev_handle); -BOOLEAN mouse_stop(PUSB_DEV_MANAGER dev_mgr, DEV_HANDLE dev_handle); -VOID mouse_irq(PURB purb, PVOID pcontext); +CONNECT_DATA KbdClassInformation; + +PDEVICE_OBJECT KeyboardFdo = NULL; + +NTSTATUS +AddRegistryEntry(IN PCWSTR PortTypeName, + IN PUNICODE_STRING DeviceName, + IN PCWSTR RegistryPath); + +BOOLEAN kbd_connect(PDEV_CONNECT_DATA dev_mgr, DEV_HANDLE dev_handle); +BOOLEAN kbd_disconnect(PUSB_DEV_MANAGER dev_mgr, DEV_HANDLE dev_handle); +BOOLEAN kbd_stop(PUSB_DEV_MANAGER dev_mgr, DEV_HANDLE dev_handle); +VOID kbd_irq(PURB purb, PVOID pcontext); static NTSTATUS -MouseCreateDevice(IN PDRIVER_OBJECT DriverObject); - +KeyboardCreateDevice(IN PDRIVER_OBJECT DriverObject); +void * memscan(void * addr, int c, size_t size); + +static UCHAR usb_kbd_keycode[256] = +{ + 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, + 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 14, 15, 57, 12, 13, 26, + 27, 43, 43, 39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 87, 88, 99, 70,119,110,102,104,111,107,109,106, + 105,108,103, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71, + 72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190, + 191,192,193,194,134,138,130,132,128,129,131,137,133,135,136,113, + 115,114, 0, 0, 0,121, 0, 89, 93,124, 92, 94, 95, 0, 0, 0, + 122,123, 90, 91, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113, + 150,158,159,128,136,177,178,176,142,152,173,140 +}; BOOLEAN -mouse_driver_init(PUSB_DEV_MANAGER dev_mgr, PUSB_DRIVER pdriver) -{ - PMOUSE_DRVR_EXTENSION pdrvr_ext; +kbd_driver_init(PUSB_DEV_MANAGER dev_mgr, PUSB_DRIVER pdriver) +{ + PKEYBOARD_DRVR_EXTENSION pdrvr_ext; if (dev_mgr == NULL || pdriver == NULL) return FALSE; @@ -49,38 +65,38 @@ pdriver->driver_desc.if_num = 1; // Interface Number pdriver->driver_desc.if_class = USB_CLASS_HID; // Interface Class pdriver->driver_desc.if_sub_class = 1; // Interface SubClass - pdriver->driver_desc.if_protocol = 2; // Interface Protocol - - pdriver->driver_desc.driver_name = "USB Mouse driver"; // Driver name for Name Registry + pdriver->driver_desc.if_protocol = 1; // Interface Protocol + + pdriver->driver_desc.driver_name = "USB Keyboard driver"; // Driver name for Name Registry pdriver->driver_desc.dev_class = USB_CLASS_HID; pdriver->driver_desc.dev_sub_class = 1; // Device Subclass - pdriver->driver_desc.dev_protocol = 2; // Protocol Info. - - pdriver->driver_ext = usb_alloc_mem(NonPagedPool, sizeof(MOUSE_DRVR_EXTENSION)); - pdriver->driver_ext_size = sizeof(MOUSE_DRVR_EXTENSION); - - RtlZeroMemory(pdriver->driver_ext, sizeof(MOUSE_DRVR_EXTENSION)); - pdrvr_ext = (PMOUSE_DRVR_EXTENSION) pdriver->driver_ext; + pdriver->driver_desc.dev_protocol = 1; // Protocol Info. + + pdriver->driver_ext = usb_alloc_mem(NonPagedPool, sizeof(KEYBOARD_DRVR_EXTENSION)); + pdriver->driver_ext_size = sizeof(KEYBOARD_DRVR_EXTENSION); + + RtlZeroMemory(pdriver->driver_ext, sizeof(KEYBOARD_DRVR_EXTENSION)); + pdrvr_ext = (PKEYBOARD_DRVR_EXTENSION) pdriver->driver_ext; pdrvr_ext->dev_mgr = dev_mgr; pdriver->disp_tbl.version = 1; - pdriver->disp_tbl.dev_connect = mouse_connect; - pdriver->disp_tbl.dev_disconnect = mouse_disconnect; - pdriver->disp_tbl.dev_stop = mouse_stop; + pdriver->disp_tbl.dev_connect = kbd_connect; + pdriver->disp_tbl.dev_disconnect = kbd_disconnect; + pdriver->disp_tbl.dev_stop = kbd_stop; pdriver->disp_tbl.dev_reserved = NULL; // Zero out the class information structure - RtlZeroMemory(&MouseClassInformation, sizeof(CONNECT_DATA)); + RtlZeroMemory(&KbdClassInformation, sizeof(CONNECT_DATA)); // Create the device - MouseCreateDevice(dev_mgr->usb_driver_obj); - - usb_dbg_print(DBGLVL_MAXIMUM, ("mouse_driver_init(): mouse driver is initialized\n")); + KeyboardCreateDevice(dev_mgr->usb_driver_obj); + + usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_driver_init(): keyboard driver is initialized\n")); return TRUE; } BOOLEAN -mouse_driver_destroy(PUSB_DEV_MANAGER dev_mgr, PUSB_DRIVER pdriver) +kbd_driver_destroy(PUSB_DEV_MANAGER dev_mgr, PUSB_DRIVER pdriver) { //PMOUSE_DRVR_EXTENSION pdrvr_ext; if (dev_mgr == NULL || pdriver == NULL) @@ -94,35 +110,35 @@ usb_free_mem(pdriver->driver_ext); pdriver->driver_ext = NULL; pdriver->driver_ext_size = 0; - usb_dbg_print(DBGLVL_MAXIMUM, ("mouse_driver_destroy(): mouse driver is destroyed\n")); + usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_driver_destroy(): keyboard driver is destroyed\n")); return TRUE; } BOOLEAN -mouse_connect(PDEV_CONNECT_DATA param, DEV_HANDLE dev_handle) +kbd_connect(PDEV_CONNECT_DATA param, DEV_HANDLE dev_handle) { PURB purb; NTSTATUS status; PUSB_DEV_MANAGER dev_mgr; PUSB_DRIVER pdrvr; PUSB_DEV pdev; - PMOUSE_DRVR_EXTENSION pdev_ext; + PKEYBOARD_DRVR_EXTENSION pdev_ext; // LONG i; PUSB_ENDPOINT_DESC pendp_desc = NULL; ULONG MaxPacketSize; - usb_dbg_print(DBGLVL_MAXIMUM, ("mouse_connect(): entering...\n")); + usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_connect(): entering...\n")); dev_mgr = param->dev_mgr; pdrvr = param->pdriver; - pdev_ext = (PMOUSE_DRVR_EXTENSION)pdrvr->driver_ext; + pdev_ext = (PKEYBOARD_DRVR_EXTENSION)pdrvr->driver_ext; // Lock USB Device status = usb_query_and_lock_dev(dev_mgr, dev_handle, &pdev); if (status != STATUS_SUCCESS) { //usb_free_mem(desc_buf); - usb_dbg_print(DBGLVL_MEDIUM, ("mouse_connect(): unable to query&lock device, status=0x%x\n", status)); + usb_dbg_print(DBGLVL_MEDIUM, ("kbd_connect(): unable to query&lock device, status=0x%x\n", status)); return FALSE; } @@ -138,7 +154,7 @@ while (Offset < 512) { pendp_desc = (PUSB_ENDPOINT_DESC)&Buffer[Offset]; - usb_dbg_print(DBGLVL_MAXIMUM, ("mouse_connect(): DescType=0x%x, Attrs=0x%x, Len=%d\n", + usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_connect(): DescType=0x%x, Attrs=0x%x, Len=%d\n", pendp_desc->bDescriptorType, pendp_desc->bmAttributes, pendp_desc->bLength)); if (pendp_desc->bDescriptorType == USB_DT_ENDPOINT && @@ -161,8 +177,9 @@ // endpoint must be IN if ((pendp_desc->bEndpointAddress & USB_DIR_IN) == 0) return FALSE; - } - + + usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_connect(): FoundEndpoint=%d\n", FoundEndpoint)); + } // Endpoint descriptor substitution code { @@ -183,7 +200,7 @@ // endpoint descriptor myself and copy it memcpy(pendp->pusb_endp_desc, pendp_desc, pendp_desc->bLength); - usb_dbg_print(DBGLVL_MAXIMUM, ("mouse_connect(): [%i][%i] DescType=0x%x, Attrs=0x%x, Len=%d\n",if_idx, endp_idx, + usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_connect(): [%i][%i] DescType=0x%x, Attrs=0x%x, Len=%d\n",if_idx, endp_idx, pendp->pusb_endp_desc->bDescriptorType, pendp->pusb_endp_desc->bmAttributes, pendp->pusb_endp_desc->bLength)); } } @@ -203,12 +220,14 @@ if (MaxPacketSize > 8) MaxPacketSize = 8; + RtlZeroMemory(pdev_ext->kbd_old, 8); + // Build a URB for our interrupt transfer UsbBuildInterruptOrBulkTransferRequest(purb, usb_make_handle((dev_handle >> 16), 0, 0), - (PUCHAR)&pdev_ext->mouse_data, + (PUCHAR)&pdev_ext->kbd_data, MaxPacketSize, //use max packet size - mouse_irq, + kbd_irq, pdev_ext, 0); @@ -224,87 +243,102 @@ } VOID -mouse_irq(PURB purb, PVOID pcontext) -{ - MOUSE_INPUT_DATA MouseInputData; - ULONG InputDataConsumed; +kbd_irq(PURB purb, PVOID pcontext) +{ + KEYBOARD_INPUT_DATA KeyboardInputData[10]; + ULONG DataPrepared=0, DataConsumed, i; + UCHAR ScanCode; NTSTATUS status; - PMOUSE_DRVR_EXTENSION pdev_ext = (PMOUSE_DRVR_EXTENSION)pcontext; - signed char *data = pdev_ext->mouse_data; - usb_dbg_print(DBGLVL_MAXIMUM, ("mouse_irq(): called\n")); + PKEYBOARD_DRVR_EXTENSION pdev_ext = (PKEYBOARD_DRVR_EXTENSION)pcontext; + PUCHAR data = pdev_ext->kbd_data; + PUCHAR data_old = pdev_ext->kbd_old; + usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_irq(): called\n")); ASSERT(purb); if (purb->status != STATUS_SUCCESS) { - usb_dbg_print(DBGLVL_MAXIMUM, ("mouse_irq(): purb->status 0x%08X\n", purb->status)); + usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_irq(): purb->status 0x%08X\n", purb->status)); //return; } - usb_dbg_print(DBGLVL_MAXIMUM, ("Mouse input: x %d, y %d, w %d, btn: 0x%02x\n", data[1], data[2], data[3], data[0])); - - // Fill mouse input data structure - MouseInputData.Flags = MOUSE_MOVE_RELATIVE; - MouseInputData.LastX = data[1]; - MouseInputData.LastY = data[2]; - - MouseInputData.ButtonFlags = 0; - MouseInputData.ButtonData = 0; - - if ((data[0] & 0x01) && ((pdev_ext->btn_old & 0x01) != (data[0] & 0x01))) - MouseInputData.ButtonFlags |= MOUSE_LEFT_BUTTON_DOWN; - else if (!(data[0] & 0x01) && ((pdev_ext->btn_old & 0x01) != (data[0] & 0x01))) - MouseInputData.ButtonFlags |= MOUSE_LEFT_BUTTON_UP; - - if ((data[0] & 0x02) && ((pdev_ext->btn_old & 0x02) != (data[0] & 0x02))) - MouseInputData.ButtonFlags |= MOUSE_RIGHT_BUTTON_DOWN; - else if (!(data[0] & 0x02) && ((pdev_ext->btn_old & 0x02) != (data[0] & 0x02))) - MouseInputData.ButtonFlags |= MOUSE_RIGHT_BUTTON_UP; - - if ((data[0] & 0x04) && ((pdev_ext->btn_old & 0x04) != (data[0] & 0x04))) - MouseInputData.ButtonFlags |= MOUSE_MIDDLE_BUTTON_DOWN; - else if (!(data[0] & 0x04) && ((pdev_ext->btn_old & 0x04) != (data[0] & 0x04))) - MouseInputData.ButtonFlags |= MOUSE_MIDDLE_BUTTON_UP; - - if ((data[0] & 0x08) && ((pdev_ext->btn_old & 0x08) != (data[0] & 0x08))) - MouseInputData.ButtonFlags |= MOUSE_BUTTON_4_DOWN; - else if (!(data[0] & 0x08) && ((pdev_ext->btn_old & 0x08) != (data[0] & 0x08))) - MouseInputData.ButtonFlags |= MOUSE_BUTTON_4_UP; - - if ((data[0] & 0x10) && ((pdev_ext->btn_old & 0x10) != (data[0] & 0x10))) - MouseInputData.ButtonFlags |= MOUSE_BUTTON_5_DOWN; - else if (!(data[0] & 0x10) && ((pdev_ext->btn_old & 0x10) != (data[0] & 0x10))) - MouseInputData.ButtonFlags |= MOUSE_BUTTON_5_UP; - - if (data[3]) - { - MouseInputData.ButtonFlags |= MOUSE_WHEEL; - MouseInputData.ButtonData = data[3]; + usb_dbg_print(DBGLVL_MAXIMUM, ("Kbd input: %d %d %d %d %d %d %d %d\n", data[0], data[1], data[2], data[3], + data[4], data[5], data[6], data[7])); + + // Zero initial kbd data array + RtlZeroMemory(&KeyboardInputData[0], sizeof(KeyboardInputData)); + + // Scan modifier keys + for (i=0; i<8; i++) + { + ScanCode = usb_kbd_keycode[i + 224]; + + if (((data[0] >> i) & 1) != ((data_old[0] >> i) & 1)) + { + usb_dbg_print(DBGLVL_MAXIMUM, ("Scan %d key p/r %d\n", ScanCode, (data[0] >> i) & 1)); + + KeyboardInputData[DataPrepared].MakeCode = ScanCode; + if ((data[0] >> i) & 1) + KeyboardInputData[DataPrepared].Flags |= KEY_MAKE; + else + KeyboardInputData[DataPrepared].Flags |= KEY_BREAK; + DataPrepared++; + } + } + + // Scan normal keys + for (i=2; i<8; i++) + { + if (data_old[i] > 3 && memscan(data + 2, data_old[i], 6) == data + 8) + { + if (usb_kbd_keycode[data_old[i]]) + { + // key released + usb_dbg_print(DBGLVL_MAXIMUM, ("Scan %d key released 1\n", usb_kbd_keycode[data_old[i]])); + + KeyboardInputData[DataPrepared].MakeCode = usb_kbd_keycode[data_old[i]]; + KeyboardInputData[DataPrepared].Flags |= KEY_BREAK; + DataPrepared++; + } + } + + if (data[i] > 3 && memscan(data_old + 2, data[i], 6) == data_old + 8) + { + if (usb_kbd_keycode[data[i]]) + { + // key pressed + usb_dbg_print(DBGLVL_MAXIMUM, ("Scan %d key pressed 1\n", usb_kbd_keycode[data[i]])); + + KeyboardInputData[DataPrepared].MakeCode = usb_kbd_keycode[data[i]]; + KeyboardInputData[DataPrepared].Flags |= KEY_MAKE; + DataPrepared++; + } + } } // Commit the input data somewhere... - if (MouseClassInformation.ClassService) + if (KbdClassInformation.ClassService && DataPrepared > 0) { KIRQL OldIrql; KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); - (*(PSERVICE_CALLBACK_ROUTINE)MouseClassInformation.ClassService)( - MouseClassInformation.ClassDeviceObject, - &MouseInputData, - (&MouseInputData)+1, - &InputDataConsumed); + (*(PSERVICE_CALLBACK_ROUTINE)KbdClassInformation.ClassService)( + KbdClassInformation.ClassDeviceObject, + &KeyboardInputData[0], + (&KeyboardInputData[0])+DataPrepared, + &DataConsumed); KeLowerIrql(OldIrql); } - // Save old button data - pdev_ext->btn_old = data[0]; + // Save old keyboard data + RtlCopyMemory(pdev_ext->kbd_old, data, sizeof(data)); // resubmit the urb status = usb_submit_urb(pdev_ext->dev_mgr, purb); } BOOLEAN -mouse_stop(PUSB_DEV_MANAGER dev_mgr, DEV_HANDLE dev_handle) +kbd_stop(PUSB_DEV_MANAGER dev_mgr, DEV_HANDLE dev_handle) { UNREFERENCED_PARAMETER(dev_handle); UNREFERENCED_PARAMETER(dev_mgr); @@ -312,7 +346,7 @@ } BOOLEAN -mouse_disconnect(PUSB_DEV_MANAGER dev_mgr, DEV_HANDLE dev_handle) +kbd_disconnect(PUSB_DEV_MANAGER dev_mgr, DEV_HANDLE dev_handle) { PDEVICE_OBJECT dev_obj; NTSTATUS status; @@ -344,14 +378,14 @@ // Dispatch routine for our IRPs NTSTATUS -MouseDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) +KbdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) { NTSTATUS Status = STATUS_INVALID_DEVICE_REQUEST; - usb_dbg_print(DBGLVL_MAXIMUM, ("MouseDispatch(DO %p, code 0x%lx) called\n", + usb_dbg_print(DBGLVL_MAXIMUM, ("KbdDispatch(DO %p, code 0x%lx) called\n", DeviceObject, IoGetCurrentIrpStackLocation(Irp)->Parameters.DeviceIoControl.IoControlCode)); -#if 0 + if (DeviceObject == KeyboardFdo) { // it's keyboard's IOCTL @@ -363,23 +397,23 @@ switch (Stk->Parameters.DeviceIoControl.IoControlCode) { case IOCTL_INTERNAL_KEYBOARD_CONNECT: - DPRINT("IOCTL_INTERNAL_KEYBOARD_CONNECT\n"); - if (Stk->Parameters.DeviceIoControl.InputBufferLength < sizeof(DEV_CONNECT_DATA)) { - DPRINT1("Keyboard IOCTL_INTERNAL_KEYBOARD_CONNECT " - "invalid buffer size\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_INTERNAL_KEYBOARD_CONNECT\n")); + if (Stk->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA)) { + usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_INTERNAL_KEYBOARD_CONNECT " + "invalid buffer size\n")); Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; goto intcontfailure; } RtlCopyMemory(&KbdClassInformation, Stk->Parameters.DeviceIoControl.Type3InputBuffer, - sizeof(DEV_CONNECT_DATA)); + sizeof(CONNECT_DATA)); Irp->IoStatus.Status = STATUS_SUCCESS; break; - +#if 0 case IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER: - DPRINT("IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER\n")); if (Stk->Parameters.DeviceIoControl.InputBufferLength < 1) { Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; goto intcontfailure; @@ -391,12 +425,13 @@ Irp->IoStatus.Status = STATUS_SUCCESS; break; +#endif case IOCTL_KEYBOARD_QUERY_ATTRIBUTES: - DPRINT("IOCTL_KEYBOARD_QUERY_ATTRIBUTES\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_KEYBOARD_QUERY_ATTRIBUTES\n")); if (Stk->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_ATTRIBUTES)) { - DPRINT("Keyboard IOCTL_KEYBOARD_QUERY_ATTRIBUTES: " - "invalid buffer size\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_KEYBOARD_QUERY_ATTRIBUTES: " + "invalid buffer size\n")); Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; goto intcontfailure; } @@ -407,11 +442,11 @@ Irp->IoStatus.Status = STATUS_SUCCESS; break; case IOCTL_KEYBOARD_QUERY_INDICATORS: - DPRINT("IOCTL_KEYBOARD_QUERY_INDICATORS\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_KEYBOARD_QUERY_INDICATORS\n")); if (Stk->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS)) { - DPRINT("Keyboard IOCTL_KEYBOARD_QUERY_INDICATORS: " - "invalid buffer size\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_KEYBOARD_QUERY_INDICATORS: " + "invalid buffer size\n")); Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; goto intcontfailure; } @@ -422,11 +457,11 @@ Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; break; case IOCTL_KEYBOARD_QUERY_TYPEMATIC: - DPRINT("IOCTL_KEYBOARD_QUERY_TYPEMATIC\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_KEYBOARD_QUERY_TYPEMATIC\n")); if (Stk->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)) { - DPRINT("Keyboard IOCTL_KEYBOARD_QUERY_TYPEMATIC: " - "invalid buffer size\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_KEYBOARD_QUERY_TYPEMATIC: " + "invalid buffer size\n")); Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; goto intcontfailure; } @@ -437,11 +472,11 @@ Irp->IoStatus.Status = STATUS_SUCCESS; break; case IOCTL_KEYBOARD_SET_INDICATORS: - DPRINT("IOCTL_KEYBOARD_SET_INDICATORS\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_KEYBOARD_SET_INDICATORS\n")); if (Stk->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS)) { - DPRINT("Keyboard IOCTL_KEYBOARD_SET_INDICTATORS: " - "invalid buffer size\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_KEYBOARD_SET_INDICTATORS: " + "invalid buffer size\n")); Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; goto intcontfailure; } @@ -455,11 +490,11 @@ Irp->IoStatus.Status = STATUS_SUCCESS; break; case IOCTL_KEYBOARD_SET_TYPEMATIC: - DPRINT("IOCTL_KEYBOARD_SET_TYPEMATIC\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_KEYBOARD_SET_TYPEMATIC\n")); if (Stk->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)) { - DPRINT("Keyboard IOCTL_KEYBOARD_SET_TYPEMATIC " - "invalid buffer size\n"); + usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_KEYBOARD_SET_TYPEMATIC " + "invalid buffer size\n")); Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; goto intcontfailure; } @@ -480,53 +515,14 @@ Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; break; - case IOCTL_INTERNAL_I8042_HOOK_KEYBOARD: - /* Nothing to do here */ - Irp->IoStatus.Status = STATUS_SUCCESS; - break; default: - Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST; + Irp->IoStatus.Status = STATUS_SUCCESS;//STATUS_INVALID_DEVICE_REQUEST; break; } - intcontfailure: Status = Irp->IoStatus.Status; } - else -#endif - if (DeviceObject == MouseFdo) - { - // it's mouse's IOCTL - PIO_STACK_LOCATION Stk; - - Irp->IoStatus.Information = 0; - Stk = IoGetCurrentIrpStackLocation(Irp); - - switch (Stk->Parameters.DeviceIoControl.IoControlCode) - { - case IOCTL_INTERNAL_MOUSE_CONNECT: - usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_INTERNAL_MOUSE_CONNECT\n")); - if (Stk->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA)) { - usb_dbg_print(DBGLVL_MINIMUM, ("IOCTL_INTERNAL_MOUSE_CONNECT: " - "invalid buffer size\n")); - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - goto intcontfailure2; - } - - RtlCopyMemory(&MouseClassInformation, - Stk->Parameters.DeviceIoControl.Type3InputBuffer, - sizeof(CONNECT_DATA)); - - Irp->IoStatus.Status = STATUS_SUCCESS; - break; - - default: - Irp->IoStatus.Status = STATUS_SUCCESS;//STATUS_INVALID_DEVICE_REQUEST; - break; - } -intcontfailure2: - Status = Irp->IoStatus.Status; - } + if (Status == STATUS_INVALID_DEVICE_REQUEST) { @@ -539,90 +535,65 @@ return Status; } -NTSTATUS -AddRegistryEntry( - IN PCWSTR PortTypeName, - IN PUNICODE_STRING DeviceName, - IN PCWSTR RegistryPath) -{ - UNICODE_STRING PathU = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\HARDWARE\\DEVICEMAP"); - OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE hDeviceMapKey = (HANDLE)-1; - HANDLE hPortKey = (HANDLE)-1; - UNICODE_STRING PortTypeNameU; - NTSTATUS Status; - - InitializeObjectAttributes(&ObjectAttributes, &PathU, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, NULL, NULL); - Status = ZwOpenKey(&hDeviceMapKey, 0, &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - usb_dbg_print(DBGLVL_MINIMUM, ("ZwOpenKey() failed with status 0x%08lx\n", Status)); - goto cleanup; - } - - RtlInitUnicodeString(&PortTypeNameU, PortTypeName); - InitializeObjectAttributes(&ObjectAttributes, &PortTypeNameU, OBJ_KERNEL_HANDLE, hDeviceMapKey, NULL); - Status = ZwCreateKey(&hPortKey, KEY_SET_VALUE, &ObjectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL); - if (!NT_SUCCESS(Status)) - { - usb_dbg_print(DBGLVL_MINIMUM, ("ZwCreateKey() failed with status 0x%08lx\n", Status)); - goto cleanup; - } - - Status = ZwSetValueKey(hPortKey, DeviceName, 0, REG_SZ, (PVOID)RegistryPath, (ULONG)(wcslen(RegistryPath) * sizeof(WCHAR) + sizeof(UNICODE_NULL))); - if (!NT_SUCCESS(Status)) - { - usb_dbg_print(DBGLVL_MINIMUM, ("ZwSetValueKey() failed with status 0x%08lx\n", Status)); - goto cleanup; - } - - Status = STATUS_SUCCESS; - -cleanup: - if (hDeviceMapKey != (HANDLE)-1) - ZwClose(hDeviceMapKey); - if (hPortKey != (HANDLE)-1) - ZwClose(hPortKey); - return Status; -} - static NTSTATUS -MouseCreateDevice(IN PDRIVER_OBJECT DriverObject) -{ - UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\PointerPortUSB"); +KeyboardCreateDevice(IN PDRIVER_OBJECT DriverObject) +{ + UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardPortUSB"); PDEVEXT_HEADER DeviceExtension; PDEVICE_OBJECT Fdo; NTSTATUS Status; - Status = AddRegistryEntry(L"PointerPort", &DeviceName, L"REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\usbdriver"); + Status = AddRegistryEntry(L"KeyboardPort", &DeviceName, L"REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\usbdriver"); if (!NT_SUCCESS(Status)) { - usb_dbg_print(DBGLVL_MINIMUM, ("AddRegistryEntry() for usb mouse driver failed with status 0x%08lx\n", Status)); + usb_dbg_print(DBGLVL_MINIMUM, ("AddRegistryEntry() for usb keyboard driver failed with status 0x%08lx\n", Status)); return Status; } Status = IoCreateDevice(DriverObject, sizeof(DEVEXT_HEADER), &DeviceName, - FILE_DEVICE_MOUSE, + FILE_DEVICE_KEYBOARD, FILE_DEVICE_SECURE_OPEN, TRUE, &Fdo); if (!NT_SUCCESS(Status)) { - usb_dbg_print(DBGLVL_MINIMUM, ("IoCreateDevice() for usb mouse driver failed with status 0x%08lx\n", Status)); + usb_dbg_print(DBGLVL_MINIMUM, ("IoCreateDevice() for usb keyboard driver failed with status 0x%08lx\n", Status)); return Status; } DeviceExtension = (PDEVEXT_HEADER)Fdo->DeviceExtension; RtlZeroMemory(DeviceExtension, sizeof(DEVEXT_HEADER)); - DeviceExtension->dispatch = MouseDispatch; - - MouseFdo = Fdo; + DeviceExtension->dispatch = KbdDispatch; + + KeyboardFdo = Fdo; Fdo->Flags &= ~DO_DEVICE_INITIALIZING; - usb_dbg_print(DBGLVL_MEDIUM, ("Created mouse Fdo: %p\n", Fdo)); + usb_dbg_print(DBGLVL_MEDIUM, ("Created keyboard Fdo: %p\n", Fdo)); return STATUS_SUCCESS; } +/** + * memscan - Find a character in an area of memory. + * @addr: The memory area + * @c: The byte to search for + * @size: The size of the area. + * + * returns the address of the first occurrence of @c, or 1 byte past + * the area if @c is not found + */ +void * memscan(void * addr, int c, size_t size) +{ + unsigned char * p = (unsigned char *) addr; + + while (size) { + if (*p == c) + return (void *) p; + p++; + size--; + } + return (void *) p; +} + Copied: trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.h (from r39836, trunk/reactos/drivers/usb/nt4compat/usbdriver/mouse.h) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/mouse.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.h [iso-8859-1] Wed Mar 4 16:40:22 2009 @@ -1,7 +1,7 @@ -#ifndef __MOUSE_H__ -#define __MOUSE_H__ +#ifndef __KEYBOARD_H__ +#define __KEYBOARD_H__ -typedef struct _MOUSE_DRVR_EXTENSION +typedef struct _KEYBOARD_DRVR_EXTENSION { //INTERRUPT_DATA_BLOCK idb; PUSB_INTERFACE_DESC pif_desc; @@ -9,15 +9,15 @@ PUSB_ENDPOINT_DESC pout_endp_desc, pin_endp_desc, pint_endp_desc; PUSB_DEV_MANAGER dev_mgr; - signed char mouse_data[8]; - UCHAR btn_old; -} MOUSE_DRVR_EXTENSION, *PMOUSE_DRVR_EXTENSION; + UCHAR kbd_data[8]; + UCHAR kbd_old[8]; +} KEYBOARD_DRVR_EXTENSION, *PKEYBOARD_DRVR_EXTENSION; BOOLEAN -mouse_driver_init(PUSB_DEV_MANAGER dev_mgr, PUSB_DRIVER pdriver); +kbd_driver_init(PUSB_DEV_MANAGER dev_mgr, PUSB_DRIVER pdriver); BOOLEAN -mouse_driver_destroy(PUSB_DEV_MANAGER dev_mgr, PUSB_DRIVER pdriver); +kbd_driver_destroy(PUSB_DEV_MANAGER dev_mgr, PUSB_DRIVER pdriver); #endif Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/mouse.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/mouse.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/mouse.c [iso-8859-1] Wed Mar 4 16:40:22 2009 @@ -7,17 +7,9 @@ */ #include "usbdriver.h" -#include "ntddmou.h" #include "kbdmou.h" -//FIXME: is it needed at all? -typedef struct _USBMP_DEVICE_EXTENSION -{ - BOOLEAN IsFDO; -} USBMP_DEVICE_EXTENSION, *PUSBMP_DEVICE_EXTENSION; - /* Data for embedded drivers */ -//CONNECT_DATA KbdClassInformation; CONNECT_DATA MouseClassInformation; PDEVICE_OBJECT MouseFdo = NULL; @@ -351,149 +343,7 @@ usb_dbg_print(DBGLVL_MAXIMUM, ("MouseDispatch(DO %p, code 0x%lx) called\n", DeviceObject, IoGetCurrentIrpStackLocation(Irp)->Parameters.DeviceIoControl.IoControlCode)); -#if 0 - if (DeviceObject == KeyboardFdo) - { - // it's keyboard's IOCTL - PIO_STACK_LOCATION Stk; - - Irp->IoStatus.Information = 0; - Stk = IoGetCurrentIrpStackLocation(Irp); - - switch (Stk->Parameters.DeviceIoControl.IoControlCode) - { - case IOCTL_INTERNAL_KEYBOARD_CONNECT: - DPRINT("IOCTL_INTERNAL_KEYBOARD_CONNECT\n"); - if (Stk->Parameters.DeviceIoControl.InputBufferLength < sizeof(DEV_CONNECT_DATA)) { - DPRINT1("Keyboard IOCTL_INTERNAL_KEYBOARD_CONNECT " - "invalid buffer size\n"); - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - goto intcontfailure; - } - - RtlCopyMemory(&KbdClassInformation, - Stk->Parameters.DeviceIoControl.Type3InputBuffer, - sizeof(DEV_CONNECT_DATA)); - - Irp->IoStatus.Status = STATUS_SUCCESS; - break; - - case IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER: - DPRINT("IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER\n"); - if (Stk->Parameters.DeviceIoControl.InputBufferLength < 1) { - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - goto intcontfailure; - } - /* if (!DevExt->KeyboardInterruptObject) { - Irp->IoStatus.Status = STATUS_DEVICE_NOT_READY; - goto intcontfailure; - }*/ - - Irp->IoStatus.Status = STATUS_SUCCESS; - break; - case IOCTL_KEYBOARD_QUERY_ATTRIBUTES: - DPRINT("IOCTL_KEYBOARD_QUERY_ATTRIBUTES\n"); - if (Stk->Parameters.DeviceIoControl.OutputBufferLength < - sizeof(KEYBOARD_ATTRIBUTES)) { - DPRINT("Keyboard IOCTL_KEYBOARD_QUERY_ATTRIBUTES: " - "invalid buffer size\n"); - Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; - goto intcontfailure; - } - /*RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, - &DevExt->KeyboardAttributes, - sizeof(KEYBOARD_ATTRIBUTES));*/ - - Irp->IoStatus.Status = STATUS_SUCCESS; - break; - case IOCTL_KEYBOARD_QUERY_INDICATORS: - DPRINT("IOCTL_KEYBOARD_QUERY_INDICATORS\n"); - if (Stk->Parameters.DeviceIoControl.OutputBufferLength < - sizeof(KEYBOARD_INDICATOR_PARAMETERS)) { - DPRINT("Keyboard IOCTL_KEYBOARD_QUERY_INDICATORS: " - "invalid buffer size\n"); - Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; - goto intcontfailure; - } - /*RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, - &DevExt->KeyboardIndicators, - sizeof(KEYBOARD_INDICATOR_PARAMETERS));*/ - - Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; - break; - case IOCTL_KEYBOARD_QUERY_TYPEMATIC: - DPRINT("IOCTL_KEYBOARD_QUERY_TYPEMATIC\n"); - if (Stk->Parameters.DeviceIoControl.OutputBufferLength < - sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)) { - DPRINT("Keyboard IOCTL_KEYBOARD_QUERY_TYPEMATIC: " - "invalid buffer size\n"); - Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; - goto intcontfailure; - } - /*RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, - &DevExt->KeyboardTypematic, - sizeof(KEYBOARD_TYPEMATIC_PARAMETERS));*/ - - Irp->IoStatus.Status = STATUS_SUCCESS; - break; - case IOCTL_KEYBOARD_SET_INDICATORS: - DPRINT("IOCTL_KEYBOARD_SET_INDICATORS\n"); - if (Stk->Parameters.DeviceIoControl.InputBufferLength < - sizeof(KEYBOARD_INDICATOR_PARAMETERS)) { - DPRINT("Keyboard IOCTL_KEYBOARD_SET_INDICTATORS: " - "invalid buffer size\n"); - Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; - goto intcontfailure; - } - - /*RtlCopyMemory(&DevExt->KeyboardIndicators, - Irp->AssociatedIrp.SystemBuffer, - sizeof(KEYBOARD_INDICATOR_PARAMETERS));*/ - - //DPRINT("%x\n", DevExt->KeyboardIndicators.LedFlags); - - Irp->IoStatus.Status = STATUS_SUCCESS; - break; - case IOCTL_KEYBOARD_SET_TYPEMATIC: - DPRINT("IOCTL_KEYBOARD_SET_TYPEMATIC\n"); - if (Stk->Parameters.DeviceIoControl.InputBufferLength < - sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)) { - DPRINT("Keyboard IOCTL_KEYBOARD_SET_TYPEMATIC " - "invalid buffer size\n"); - Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; - goto intcontfailure; - } - - /*RtlCopyMemory(&DevExt->KeyboardTypematic, - Irp->AssociatedIrp.SystemBuffer, - sizeof(KEYBOARD_TYPEMATIC_PARAMETERS));*/ - - Irp->IoStatus.Status = STATUS_SUCCESS; - break; - case IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION: - /* We should check the UnitID, but it's kind of pointless as - * all keyboards are supposed to have the same one - */ - /*RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, - &IndicatorTranslation, - sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION));*/ - - Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; - break; - case IOCTL_INTERNAL_I8042_HOOK_KEYBOARD: - /* Nothing to do here */ - Irp->IoStatus.Status = STATUS_SUCCESS; - break; - default: - Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST; - break; - } - -intcontfailure: - Status = Irp->IoStatus.Status; - } - else -#endif + if (DeviceObject == MouseFdo) { // it's mouse's IOCTL Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.h [iso-8859-1] Wed Mar 4 16:40:22 2009 @@ -41,4 +41,5 @@ #include "hub.h" #include "umss.h" #include "mouse.h" +#include "keyboard.h" #include "uhciver.h" Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild [iso-8859-1] Wed Mar 4 16:40:22 2009 @@ -22,6 +22,7 @@ <file>etd.c</file> <file>gendrv.c</file> <file>mouse.c</file> + <file>keyboard.c</file> <file>usbdriver.rc</file> <pch>usbdriver.h</pch> </module>
15 years, 9 months
1
0
0
0
← Newer
1
...
41
42
43
44
45
46
47
48
49
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
Results per page:
10
25
50
100
200