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
2025
January
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
May 2009
----- 2025 -----
January 2025
----- 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
27 participants
504 discussions
Start a n
N
ew thread
[cfinck] 406: Fix warning occuring at higher PHP warning level
by cfinck@svn.reactos.org
Author: cfinck Date: Wed May 6 00:45:33 2009 New Revision: 406 URL:
http://svn.reactos.org/svn/reactos?rev=406&view=rev
Log: Fix warning occuring at higher PHP warning level Modified:
branches/danny-web/www/www.reactos.org/wiki/includes/User.php
Modified:
branches/danny-web/www/www.reactos.org/wiki/includes/User.php
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/w…
============================================================================== ---
branches/danny-web/www/www.reactos.org/wiki/includes/User.php
[iso-8859-1] (original) +++
branches/danny-web/www/www.reactos.org/wiki/includes/User.php
[iso-8859-1] Wed May 6 00:45:33 2009 @@ -769,7 +769,7 @@ $_SESSION['wsToken'] = $this->mToken; /* If the User ID we got does not match with the User ID stored in the session variable, a login/logout was performed, so invalidate the cache. */ - if($_SESSION["wsUserID"] != $this->mId) + if(isset($_SESSION["wsUserID"]) && $_SESSION["wsUserID"] != $this->mId) { $_SESSION["wsUserID"] = $this->mId; $this->invalidateCache();
15 years, 8 months
1
0
0
0
[sginsberg] 40801: - Fix definition of POINTER_ALIGNMENT for 64-bit. Problem reported by Brian Hawley at mingw-w64: http://sourceforge.net/forum/forum.php?thread_id=3163052&forum_id=723797
by sginsberg@svn.reactos.org
Author: sginsberg Date: Tue May 5 23:24:49 2009 New Revision: 40801 URL:
http://svn.reactos.org/svn/reactos?rev=40801&view=rev
Log: - Fix definition of POINTER_ALIGNMENT for 64-bit. Problem reported by Brian Hawley at mingw-w64:
http://sourceforge.net/forum/forum.php?thread_id=3163052&forum_id=723797
Modified: trunk/reactos/include/ddk/winddk.h Modified: trunk/reactos/include/ddk/winddk.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=4…
============================================================================== --- trunk/reactos/include/ddk/winddk.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/winddk.h [iso-8859-1] Tue May 5 23:24:49 2009 @@ -51,7 +51,13 @@ #define VOLATILE volatile #define RESTRICTED_POINTER + +#if defined(_WIN64) +#define POINTER_ALIGNMENT DECLSPEC_ALIGN(8) +#else #define POINTER_ALIGNMENT +#endif + #define DECLSPEC_ADDRSAFE #ifdef NONAMELESSUNION
15 years, 8 months
1
0
0
0
[janderwald] 40800: - Fix build
by janderwald@svn.reactos.org
Author: janderwald Date: Tue May 5 20:59:36 2009 New Revision: 40800 URL:
http://svn.reactos.org/svn/reactos?rev=40800&view=rev
Log: - Fix build Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] Tue May 5 20:59:36 2009 @@ -474,6 +474,8 @@ typedef IPortPinWavePci *PPORTPINWAVEPCI; +#if (NTDDI_VERSION >= NTDDI_VISTA) + /***************************************************************************** * IPortFilterWaveRT ***************************************************************************** @@ -518,6 +520,8 @@ typedef IPortPinWavePci *PPORTPINWAVERT; +#endif + /***************************************************************************** * IPortFilterWaveCyclic ***************************************************************************** Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] Tue May 5 20:59:36 2009 @@ -109,6 +109,8 @@ GetWavePciMiniport( PPORTWAVEPCI Port); +#if (NTDDI_VERSION >= NTDDI_VISTA) + NTSTATUS NewPortFilterWaveRT( OUT IPortFilterWaveRT ** OutFilter); @@ -127,6 +129,8 @@ NTSTATUS NewPortWaveRTStream( PPORTWAVERTSTREAM *OutStream); + +#endif NTSTATUS NTAPI
15 years, 8 months
1
0
0
0
[dchapyshev] 40799: - Add some defines. Fix build for comdlg32/comctl32
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Tue May 5 20:42:49 2009 New Revision: 40799 URL:
http://svn.reactos.org/svn/reactos?rev=40799&view=rev
Log: - Add some defines. Fix build for comdlg32/comctl32 Modified: trunk/reactos/include/psdk/commctrl.h trunk/reactos/include/psdk/commdlg.h Modified: trunk/reactos/include/psdk/commctrl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/commctrl.h?re…
============================================================================== --- trunk/reactos/include/psdk/commctrl.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/commctrl.h [iso-8859-1] Tue May 5 20:42:49 2009 @@ -3174,6 +3174,7 @@ #define LVM_SETITEMTEXT WINELIB_NAME_AW(LVM_SETITEMTEXT) #define LVM_SETITEMCOUNT (LVM_FIRST+47) #define LVM_SORTITEMS (LVM_FIRST+48) +#define LVM_SORTITEMSEX (LVM_FIRST+81) #define LVM_SETITEMPOSITION32 (LVM_FIRST+49) #define LVM_GETSELECTEDCOUNT (LVM_FIRST+50) #define LVM_GETITEMSPACING (LVM_FIRST+51) Modified: trunk/reactos/include/psdk/commdlg.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/commdlg.h?rev…
============================================================================== --- trunk/reactos/include/psdk/commdlg.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/commdlg.h [iso-8859-1] Tue May 5 20:42:49 2009 @@ -37,6 +37,7 @@ #define CDN_HELP (CDN_FIRST-4U) #define CDN_FILEOK (CDN_FIRST-5U) #define CDN_TYPECHANGE (CDN_FIRST-6U) +#define CDN_INCLUDEITEM (CDN_FIRST-7U) #define CDM_FIRST (WM_USER+100) #define CDM_LAST (WM_USER+200) #define CDM_GETSPEC CDM_FIRST @@ -369,6 +370,23 @@ LPOPENFILENAMEW lpOFN; LPWSTR pszFile; } OFNOTIFYW,*LPOFNOTIFYW; + +typedef struct _OFNOTIFYEXA +{ + NMHDR hdr; + LPOPENFILENAMEA lpOFN; + LPVOID psf; + LPVOID pidl; +} OFNOTIFYEXA, *LPOFNOTIFYEXA; + +typedef struct _OFNOTIFYEXW +{ + NMHDR hdr; + LPOPENFILENAMEW lpOFN; + LPVOID psf; + LPVOID pidl; +} OFNOTIFYEXW, *LPOFNOTIFYEXW; + typedef struct tagPSDA { DWORD lStructSize; HWND hwndOwner;
15 years, 8 months
1
0
0
0
[dchapyshev] 40798: - Sync comctl32 with Wine 1.1.20 (without listview.c) - Sync comdlg32 with Wine 1.1.20
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Tue May 5 20:26:56 2009 New Revision: 40798 URL:
http://svn.reactos.org/svn/reactos?rev=40798&view=rev
Log: - Sync comctl32 with Wine 1.1.20 (without listview.c) - Sync comdlg32 with Wine 1.1.20 Modified: trunk/reactos/dll/win32/comctl32/comboex.c trunk/reactos/dll/win32/comctl32/imagelist.c trunk/reactos/dll/win32/comctl32/ipaddress.c trunk/reactos/dll/win32/comctl32/tab.c trunk/reactos/dll/win32/comctl32/toolbar.c trunk/reactos/dll/win32/comctl32/trackbar.c trunk/reactos/dll/win32/comctl32/treeview.c trunk/reactos/dll/win32/comctl32/updown.c trunk/reactos/dll/win32/comdlg32/cdlg_Lt.rc trunk/reactos/dll/win32/comdlg32/cdlg_Sk.rc trunk/reactos/dll/win32/comdlg32/filedlg.c trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c trunk/reactos/dll/win32/comdlg32/printdlg.c Modified: trunk/reactos/dll/win32/comctl32/comboex.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comboex…
============================================================================== --- trunk/reactos/dll/win32/comctl32/comboex.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/comboex.c [iso-8859-1] Tue May 5 20:26:56 2009 @@ -1669,6 +1669,14 @@ } +static LRESULT COMBOEX_SetRedraw(COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +{ + LRESULT ret = DefWindowProcW( infoPtr->hwndSelf, WM_SETREDRAW, wParam, lParam ); + if (wParam) RedrawWindow( infoPtr->hwndSelf, NULL, 0, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN ); + return ret; +} + + static LRESULT COMBOEX_WindowPosChanging (COMBOEX_INFO *infoPtr, WINDOWPOS *wp) { RECT cbx_wrect, cbx_crect, cb_wrect; @@ -2302,6 +2310,9 @@ case WM_SIZE: return COMBOEX_Size (infoPtr, LOWORD(lParam), HIWORD(lParam)); + case WM_SETREDRAW: + return COMBOEX_SetRedraw(infoPtr, wParam, lParam); + case WM_WINDOWPOSCHANGING: return COMBOEX_WindowPosChanging (infoPtr, (WINDOWPOS *)lParam); Modified: trunk/reactos/dll/win32/comctl32/imagelist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/imageli…
============================================================================== --- trunk/reactos/dll/win32/comctl32/imagelist.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/imagelist.c [iso-8859-1] Tue May 5 20:26:56 2009 @@ -155,7 +155,7 @@ * This function CANNOT be used to reduce the number of images. */ static void -IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cy) +IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cx, INT cy) { HDC hdcBitmap; HBITMAP hbmNewBitmap, hbmNull; @@ -166,14 +166,15 @@ && (himl->cy >= cy)) return; + if (cx == 0) cx = himl->cx; nNewCount = himl->cCurImage + nImageCount + himl->cGrow; - imagelist_get_bitmap_size(himl, nNewCount, himl->cx, &sz); + imagelist_get_bitmap_size(himl, nNewCount, cx, &sz); TRACE("Create expanded bitmaps : himl=%p x=%d y=%d count=%d\n", himl, sz.cx, cy, nNewCount); hdcBitmap = CreateCompatibleDC (0); - hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, himl->cx); + hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, cx); if (hbmNewBitmap == 0) ERR("creating new image bitmap (x=%d y=%d)!\n", sz.cx, cy); @@ -247,7 +248,7 @@ nImageCount = bmp.bmWidth / himl->cx; - IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmHeight); + IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight); hdcBitmap = CreateCompatibleDC(0); @@ -349,7 +350,7 @@ else nImageCount = 0; - IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmHeight); + IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight); nIndex = himl->cCurImage; himl->cCurImage += nImageCount; @@ -2303,7 +2304,7 @@ if (nIndex == -1) { if (himl->cCurImage + 1 > himl->cMaxImage) - IMAGELIST_InternalExpandBitmaps (himl, 1, 0); + IMAGELIST_InternalExpandBitmaps (himl, 1, 0, 0); nIndex = himl->cCurImage; himl->cCurImage++; Modified: trunk/reactos/dll/win32/comctl32/ipaddress.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/ipaddre…
============================================================================== --- trunk/reactos/dll/win32/comctl32/ipaddress.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/ipaddress.c [iso-8859-1] Tue May 5 20:26:56 2009 @@ -76,6 +76,29 @@ static LRESULT CALLBACK IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + +static void IPADDRESS_UpdateText (const IPADDRESS_INFO *infoPtr) +{ + static const WCHAR zero[2] = {'0', 0}; + static const WCHAR dot[2] = {'.', 0}; + WCHAR field[4]; + WCHAR ip[16]; + INT i; + + ip[0] = 0; + + for (i = 0; i < 4; i++) { + if (GetWindowTextW (infoPtr->Part[i].EditHwnd, field, 4)) + strcatW(ip, field); + else + /* empty edit treated as zero */ + strcatW(ip, zero); + if (i != 3) + strcatW(ip, dot); + } + + SetWindowTextW(infoPtr->Self, ip); +} static LRESULT IPADDRESS_Notify (const IPADDRESS_INFO *infoPtr, UINT command) { @@ -219,6 +242,8 @@ EnableWindow(part->EditHwnd, infoPtr->Enabled); } + IPADDRESS_UpdateText (infoPtr); + return 0; } @@ -483,7 +508,7 @@ return return_val; } else if (len == 3 && startsel==endsel && endsel==len) IPADDRESS_GotoNextField (infoPtr, index, POS_SELALL); - else if (len < 3) break; + else if (len < 3 || startsel != endsel) break; } else if(c == '.' || c == ' ') { if(len && startsel==endsel && startsel != 0) { IPADDRESS_GotoNextField(infoPtr, index, POS_SELALL); @@ -561,6 +586,7 @@ case WM_COMMAND: switch(wParam >> 16) { case EN_CHANGE: + IPADDRESS_UpdateText(infoPtr); IPADDRESS_Notify(infoPtr, EN_CHANGE); break; case EN_KILLFOCUS: Modified: trunk/reactos/dll/win32/comctl32/tab.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/tab.c?r…
============================================================================== --- trunk/reactos/dll/win32/comctl32/tab.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/tab.c [iso-8859-1] Tue May 5 20:26:56 2009 @@ -32,7 +32,7 @@ * TODO: * * Styles: - * TCS_MULTISELECT + * TCS_MULTISELECT - implement for VK_SPACE selection * TCS_RIGHT * TCS_RIGHTJUSTIFY * TCS_SCROLLOPPOSITE @@ -40,23 +40,13 @@ * TCIF_RTLREADING * * Extended Styles: - * TCS_EX_FLATSEPARATORS * TCS_EX_REGISTERDROP - * - * States: - * TCIS_BUTTONPRESSED * * Notifications: * NM_RELEASEDCAPTURE * TCN_FOCUSCHANGE * TCN_GETOBJECT * TCN_KEYDOWN - * - * Messages: - * TCM_REMOVEIMAGE - * TCM_DESELECTALL - * TCM_GETEXTENDEDSTYLE - * TCM_SETEXTENDEDSTYLE * * Macros: * TabCtrl_AdjustRect @@ -127,6 +117,9 @@ BOOL bUnicode; /* Unicode control? */ HWND hwndUpDown; /* Updown control used for scrolling */ INT cbInfo; /* Number of bytes of caller supplied info per tab */ + + DWORD exStyle; /* Extended style used, currently: + TCS_EX_FLATSEPARATORS, TCS_EX_REGISTERDROP */ } TAB_INFO; /****************************************************************************** @@ -166,6 +159,7 @@ static void TAB_InvalidateTabArea(const TAB_INFO *); static void TAB_EnsureSelectionVisible(TAB_INFO *); static void TAB_DrawItemInterior(const TAB_INFO *, HDC, INT, RECT*); +static LRESULT TAB_DeselectAll(TAB_INFO *, BOOL); static BOOL TAB_SendSimpleNotify (const TAB_INFO *infoPtr, UINT code) @@ -253,6 +247,9 @@ return -1; else { if (infoPtr->iSelected != iItem) { + TAB_GetItem(infoPtr, prevItem)->dwState &= ~TCIS_BUTTONPRESSED; + TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED; + infoPtr->iSelected=iItem; infoPtr->uFocus=iItem; TAB_EnsureSelectionVisible(infoPtr); @@ -490,12 +487,8 @@ { if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING)) { - infoPtr->iSelected = newItem; - infoPtr->uFocus = newItem; + TAB_SetCurSel(infoPtr, newItem); TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE); - - TAB_EnsureSelectionVisible(infoPtr); - TAB_InvalidateTabArea(infoPtr); } } @@ -592,6 +585,7 @@ POINT pt; INT newItem; UINT dummy; + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); if (infoPtr->hwndToolTip) TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd, @@ -612,19 +606,43 @@ TRACE("On Tab, item %d\n", newItem); - if (newItem != -1 && infoPtr->iSelected != newItem) - { - if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING)) - { - infoPtr->iSelected = newItem; - infoPtr->uFocus = newItem; + if ((newItem != -1) && (infoPtr->iSelected != newItem)) + { + if ((lStyle & TCS_BUTTONS) && (lStyle & TCS_MULTISELECT) && + (wParam & MK_CONTROL)) + { + RECT r; + + /* toggle multiselection */ + TAB_GetItem(infoPtr, newItem)->dwState ^= TCIS_BUTTONPRESSED; + if (TAB_InternalGetItemRect (infoPtr, newItem, &r, NULL)) + InvalidateRect (infoPtr->hwnd, &r, TRUE); + } + else + { + INT i; + BOOL pressed = FALSE; + + /* any button pressed ? */ + for (i = 0; i < infoPtr->uNumItem; i++) + if ((TAB_GetItem (infoPtr, i)->dwState & TCIS_BUTTONPRESSED) && + (infoPtr->iSelected != i)) + { + pressed = TRUE; + break; + } + + TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING); + + if (pressed) + TAB_DeselectAll (infoPtr, FALSE); + else + TAB_SetCurSel(infoPtr, newItem); + TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE); - - TAB_EnsureSelectionVisible(infoPtr); - - TAB_InvalidateTabArea(infoPtr); - } - } + } + } + return 0; } @@ -1434,7 +1452,6 @@ BOOL deleteBrush = TRUE; RECT rTemp = *drawRect; - InflateRect(&rTemp, -2, -2); if (lStyle & TCS_BUTTONS) { if (iItem == infoPtr->iSelected) @@ -1463,9 +1480,10 @@ { if (lStyle & TCS_FLATBUTTONS) { - FillRect(hdc, drawRect, hbr); + InflateRect(&rTemp, 2, 2); + FillRect(hdc, &rTemp, hbr); if (iItem == infoPtr->iHotTracked) - DrawEdge(hdc, drawRect, EDGE_RAISED, BF_SOFT|BF_RECT); + DrawEdge(hdc, &rTemp, BDR_RAISEDINNER, BF_RECT); } else FillRect(hdc, &rTemp, hbr); @@ -1474,8 +1492,21 @@ } else /* !TCS_BUTTONS */ { + InflateRect(&rTemp, -2, -2); if (!GetWindowTheme (infoPtr->hwnd)) FillRect(hdc, &rTemp, hbr); + } + + /* highlighting is drawn on top of previous fills */ + if (TAB_GetItem(infoPtr, iItem)->dwState & TCIS_HIGHLIGHTED) + { + if (deleteBrush) + { + DeleteObject(hbr); + deleteBrush = FALSE; + } + hbr = GetSysColorBrush(COLOR_HIGHLIGHT); + FillRect(hdc, &rTemp, hbr); } /* Cleanup */ @@ -1536,7 +1567,22 @@ drawRect->left += 4; drawRect->top += 4; drawRect->right -= 4; - drawRect->bottom -= 1; + + if (lStyle & TCS_VERTICAL) + { + if (!(lStyle & TCS_BOTTOM)) drawRect->right += 1; + drawRect->bottom -= 4; + } + else + { + if (lStyle & TCS_BOTTOM) + { + drawRect->top -= 2; + drawRect->bottom -= 4; + } + else + drawRect->bottom -= 1; + } } else { @@ -1631,10 +1677,15 @@ */ oldBkMode = SetBkMode(hdc, TRANSPARENT); if (!GetWindowTheme (infoPtr->hwnd) || (lStyle & TCS_BUTTONS)) - SetTextColor(hdc, (((lStyle & TCS_HOTTRACK) && (iItem == infoPtr->iHotTracked) - && !(lStyle & TCS_FLATBUTTONS)) - | (TAB_GetItem(infoPtr, iItem)->dwState & TCIS_HIGHLIGHTED)) ? - comctl32_color.clrHighlight : comctl32_color.clrBtnText); + { + if ((lStyle & TCS_HOTTRACK) && (iItem == infoPtr->iHotTracked) && + !(lStyle & TCS_FLATBUTTONS)) + SetTextColor(hdc, comctl32_color.clrHighlight); + else if (TAB_GetItem(infoPtr, iItem)->dwState & TCIS_HIGHLIGHTED) + SetTextColor(hdc, comctl32_color.clrHighlightText); + else + SetTextColor(hdc, comctl32_color.clrBtnText); + } /* * if owner draw, tell the owner to draw @@ -1948,7 +1999,7 @@ r = itemRect; /* Separators between flat buttons */ - if (lStyle & TCS_FLATBUTTONS) + if ((lStyle & TCS_FLATBUTTONS) && (infoPtr->exStyle & TCS_EX_FLATSEPARATORS)) { r1 = r; r1.right += (FLAT_BTN_SPACINGX -2); @@ -1963,8 +2014,13 @@ } else /* ! selected */ { - if (!(lStyle & TCS_FLATBUTTONS)) - DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RECT); + DWORD state = TAB_GetItem(infoPtr, iItem)->dwState; + + if (state & TCIS_BUTTONPRESSED) + DrawEdge(hdc, &r, EDGE_SUNKEN, BF_SOFT|BF_RECT); + else + if (!(lStyle & TCS_FLATBUTTONS)) + DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RECT); } } else /* !TCS_BUTTONS */ @@ -2675,6 +2731,8 @@ TAB_HighlightItem (TAB_INFO *infoPtr, INT iItem, BOOL fHighlight) { LPDWORD lpState; + DWORD oldState; + RECT r; TRACE("(%p,%d,%s)\n", infoPtr, iItem, fHighlight ? "true" : "false"); @@ -2682,12 +2740,16 @@ return FALSE; lpState = &TAB_GetItem(infoPtr, iItem)->dwState; + oldState = *lpState; if (fHighlight) *lpState |= TCIS_HIGHLIGHTED; else *lpState &= ~TCIS_HIGHLIGHTED; + if ((oldState != *lpState) && TAB_InternalGetItemRect (infoPtr, iItem, &r, NULL)) + InvalidateRect (infoPtr->hwnd, &r, TRUE); + return TRUE; } @@ -2715,7 +2777,8 @@ FIXME("TCIF_RTLREADING\n"); if (tabItem->mask & TCIF_STATE) - wineItem->dwState = tabItem->dwState; + wineItem->dwState = (wineItem->dwState & ~tabItem->dwStateMask) | + ( tabItem->dwState & tabItem->dwStateMask); if (tabItem->mask & TCIF_TEXT) { @@ -2762,7 +2825,7 @@ FIXME("TCIF_RTLREADING\n"); if (tabItem->mask & TCIF_STATE) - tabItem->dwState = wineItem->dwState; + tabItem->dwState = wineItem->dwState & tabItem->dwStateMask; if (tabItem->mask & TCIF_TEXT) { @@ -2979,6 +3042,8 @@ dwStyle = GetWindowLongW(hwnd, GWL_STYLE); SetWindowLongW(hwnd, GWL_STYLE, dwStyle|WS_CLIPSIBLINGS); + infoPtr->exStyle = (dwStyle & TCS_FLATBUTTONS) ? TCS_EX_FLATSEPARATORS : 0; + if (dwStyle & TCS_TOOLTIPS) { /* Create tooltip control */ infoPtr->hwndToolTip = @@ -3099,6 +3164,103 @@ return TRUE; } +static LRESULT TAB_RemoveImage (TAB_INFO *infoPtr, INT image) +{ + if (!infoPtr) + return 0; + + if (ImageList_Remove (infoPtr->himl, image)) + { + INT i, *idx; + RECT r; + + /* shift indices, repaint items if needed */ + for (i = 0; i < infoPtr->uNumItem; i++) + { + idx = &TAB_GetItem(infoPtr, i)->iImage; + if (*idx >= image) + { + if (*idx == image) + *idx = -1; + else + (*idx)--; + + /* repaint item */ + if (TAB_InternalGetItemRect (infoPtr, i, &r, NULL)) + InvalidateRect (infoPtr->hwnd, &r, TRUE); + } + } + } + + return 0; +} + +static LRESULT +TAB_SetExtendedStyle (TAB_INFO *infoPtr, DWORD exMask, DWORD exStyle) +{ + DWORD prevstyle = infoPtr->exStyle; + + /* zero mask means all styles */ + if (exMask == 0) exMask = ~0; + + if (exMask & TCS_EX_REGISTERDROP) + { + FIXME("TCS_EX_REGISTERDROP style unimplemented\n"); + exMask &= ~TCS_EX_REGISTERDROP; + exStyle &= ~TCS_EX_REGISTERDROP; + } + + if (exMask & TCS_EX_FLATSEPARATORS) + { + if ((prevstyle ^ exStyle) & TCS_EX_FLATSEPARATORS) + { + infoPtr->exStyle ^= TCS_EX_FLATSEPARATORS; + TAB_InvalidateTabArea(infoPtr); + } + } + + return prevstyle; +} + +static inline LRESULT +TAB_GetExtendedStyle (TAB_INFO *infoPtr) +{ + return infoPtr->exStyle; +} + +static LRESULT +TAB_DeselectAll (TAB_INFO *infoPtr, BOOL excludesel) +{ + LONG style = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); + BOOL paint = FALSE; + INT i, selected = infoPtr->iSelected; + + if (!(style & TCS_BUTTONS)) + return 0; + + for (i = 0; i < infoPtr->uNumItem; i++) + { + if ((TAB_GetItem(infoPtr, i)->dwState & TCIS_BUTTONPRESSED) && + (selected != i)) + { + TAB_GetItem(infoPtr, i)->dwState &= ~TCIS_BUTTONPRESSED; + paint = TRUE; + } + } + + if (!excludesel && (selected != -1)) + { + TAB_GetItem(infoPtr, selected)->dwState &= ~TCIS_BUTTONPRESSED; + infoPtr->iSelected = -1; + paint = TRUE; + } + + if (paint) + TAB_InvalidateTabArea (infoPtr); + + return 0; +} + static LRESULT WINAPI TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -3159,8 +3321,7 @@ return TAB_SetItemSize (infoPtr, lParam); case TCM_REMOVEIMAGE: - FIXME("Unimplemented msg TCM_REMOVEIMAGE\n"); - return 0; + return TAB_RemoveImage (infoPtr, wParam); case TCM_SETPADDING: return TAB_SetPadding (infoPtr, lParam); @@ -3193,16 +3354,13 @@ return TAB_SetMinTabWidth(infoPtr, (INT)lParam); case TCM_DESELECTALL: - FIXME("Unimplemented msg TCM_DESELECTALL\n"); - return 0; + return TAB_DeselectAll (infoPtr, (BOOL)wParam); case TCM_GETEXTENDEDSTYLE: - FIXME("Unimplemented msg TCM_GETEXTENDEDSTYLE\n"); - return 0; + return TAB_GetExtendedStyle (infoPtr); case TCM_SETEXTENDEDSTYLE: - FIXME("Unimplemented msg TCM_SETEXTENDEDSTYLE\n"); - return 0; + return TAB_SetExtendedStyle (infoPtr, wParam, lParam); case WM_GETFONT: return TAB_GetFont (infoPtr); Modified: trunk/reactos/dll/win32/comctl32/toolbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/toolbar…
============================================================================== --- trunk/reactos/dll/win32/comctl32/toolbar.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/toolbar.c [iso-8859-1] Tue May 5 20:26:56 2009 @@ -492,9 +492,9 @@ /*********************************************************************** -* TOOLBAR_DrawDDFlatSeparator +* TOOLBAR_DrawFlatHorizontalSeparator * -* This function draws the separator that was flagged as BTNS_DROPDOWN. +* This function draws horizontal separator for toolbars having CCS_VERT style. * In this case, the separator is a pixel high line of COLOR_BTNSHADOW, * followed by a pixel high line of COLOR_BTNHIGHLIGHT. These separators * are horizontal as opposed to the vertical separators for not dropdown @@ -503,7 +503,7 @@ * FIXME: It is possible that the height of each line is really SM_CYBORDER. */ static void -TOOLBAR_DrawDDFlatSeparator (const RECT *lpRect, HDC hdc, +TOOLBAR_DrawFlatHorizontalSeparator (const RECT *lpRect, HDC hdc, const TOOLBAR_INFO *infoPtr) { RECT myrect; @@ -855,8 +855,8 @@ /* empirical tests show that iBitmap can/will be non-zero */ /* when drawing the vertical bar... */ if ((dwStyle & TBSTYLE_FLAT) /* && (btnPtr->iBitmap == 0) */) { - if (btnPtr->fsStyle & BTNS_DROPDOWN) - TOOLBAR_DrawDDFlatSeparator (&rc, hdc, infoPtr); + if (dwStyle & CCS_VERT) + TOOLBAR_DrawFlatHorizontalSeparator (&rc, hdc, infoPtr); else TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr); } @@ -1326,18 +1326,14 @@ if (btnPtr[i].fsState & TBSTATE_HIDDEN) continue; - /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ - /* it is the actual width of the separator. This is used for */ - /* custom controls in toolbars. */ - /* */ - /* BTNS_DROPDOWN separators are treated as buttons for */ - /* width. - GA 8/01 */ - if ((btnPtr[i].fsStyle & BTNS_SEP) && - !(btnPtr[i].fsStyle & BTNS_DROPDOWN)) - cx = (btnPtr[i].iBitmap > 0) ? - btnPtr[i].iBitmap : SEPARATOR_WIDTH; + if (btnPtr[i].cx > 0) + cx = btnPtr[i].cx; + /* horizontal separators are treated as buttons for width */ + else if ((btnPtr[i].fsStyle & BTNS_SEP) && + !(infoPtr->dwStyle & CCS_VERT)) + cx = (btnPtr[i].iBitmap > 0) ? btnPtr[i].iBitmap : SEPARATOR_WIDTH; else - cx = (btnPtr[i].cx) ? btnPtr[i].cx : infoPtr->nButtonWidth; + cx = infoPtr->nButtonWidth; /* Two or more adjacent separators form a separator group. */ /* The first separator in a group should be wrapped to the */ @@ -1685,18 +1681,14 @@ cy = infoPtr->nButtonHeight; - /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ - /* it is the actual width of the separator. This is used for */ - /* custom controls in toolbars. */ if (btnPtr->fsStyle & BTNS_SEP) { - if (btnPtr->fsStyle & BTNS_DROPDOWN) { - cy = (btnPtr->iBitmap > 0) ? - btnPtr->iBitmap : SEPARATOR_WIDTH; - cx = infoPtr->nButtonWidth; + if (infoPtr->dwStyle & CCS_VERT) { + cy = (btnPtr->iBitmap > 0) ? btnPtr->iBitmap : SEPARATOR_WIDTH; + cx = (btnPtr->cx > 0) ? btnPtr->cx : infoPtr->nWidth; } else - cx = (btnPtr->iBitmap > 0) ? - btnPtr->iBitmap : SEPARATOR_WIDTH; + cx = (btnPtr->cx > 0) ? btnPtr->cx : + (btnPtr->iBitmap > 0) ? btnPtr->iBitmap : SEPARATOR_WIDTH; } else { @@ -1759,12 +1751,9 @@ y += cy; else { - /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ - /* it is the actual width of the separator. This is used for */ - /* custom controls in toolbars. */ - if ( !(btnPtr->fsStyle & BTNS_DROPDOWN)) - y += cy + ( (btnPtr->iBitmap > 0 ) ? - btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; + if ( !(infoPtr->dwStyle & CCS_VERT)) + y += cy + ( (btnPtr->cx > 0 ) ? + btnPtr->cx : SEPARATOR_WIDTH) * 2 /3; else y += cy; @@ -1843,9 +1832,10 @@ for (iButton = 0; iButton < nAddButtons; iButton++) { TBUTTON_INFO *btnPtr = &infoPtr->buttons[iIndex + iButton]; - TOOLBAR_DumpTBButton(lpTbb, fUnicode); + TOOLBAR_DumpTBButton(lpTbb + iButton, fUnicode); ZeroMemory(btnPtr, sizeof(*btnPtr)); + btnPtr->iBitmap = lpTbb[iButton].iBitmap; btnPtr->idCommand = lpTbb[iButton].idCommand; btnPtr->fsState = lpTbb[iButton].fsState; @@ -3401,7 +3391,11 @@ if (lpTbInfo->dwMask & TBIF_LPARAM) lpTbInfo->lParam = btnPtr->dwData; if (lpTbInfo->dwMask & TBIF_SIZE) - lpTbInfo->cx = (WORD)(btnPtr->rect.right - btnPtr->rect.left); + /* tests show that for separators TBIF_SIZE returns not calculated width, + but cx property, that differs from 0 only if application have + specifically set it */ + lpTbInfo->cx = (btnPtr->fsStyle & BTNS_SEP) + ? btnPtr->cx : (WORD)(btnPtr->rect.right - btnPtr->rect.left); if (lpTbInfo->dwMask & TBIF_STATE) lpTbInfo->fsState = btnPtr->fsState; if (lpTbInfo->dwMask & TBIF_STYLE) @@ -4241,7 +4235,9 @@ { /* separator */ nmtbr.tbButton.fsStyle = TBSTYLE_SEP; - nmtbr.tbButton.iBitmap = SEPARATOR_WIDTH; + /* when inserting separators, iBitmap controls it's size. + 0 sets default size (width) */ + nmtbr.tbButton.iBitmap = 0; } else if (*nmtbr.pCurrent == (DWORD)-2) /* hidden button */ @@ -4535,7 +4531,7 @@ * 22 high. Demonstarted in ControlSpy Toolbar. GLA 3/02 */ if (cx == 0) cx = 24; - if (cy == 0) cx = 22; + if (cy == 0) cy = 22; cx = max(cx, infoPtr->szPadding.cx + infoPtr->nBitmapWidth); cy = max(cy, infoPtr->szPadding.cy + infoPtr->nBitmapHeight); @@ -4781,6 +4777,8 @@ HIMAGELIST himlTemp; HIMAGELIST himl = (HIMAGELIST)lParam; INT oldButtonWidth = infoPtr->nButtonWidth; + INT oldBitmapWidth = infoPtr->nBitmapWidth; + INT oldBitmapHeight = infoPtr->nBitmapHeight; INT i, id = 0; if (infoPtr->iVersion >= 5) @@ -4799,9 +4797,12 @@ infoPtr->nBitmapWidth = 1; infoPtr->nBitmapHeight = 1; } - TOOLBAR_CalcToolbar(hwnd); - if (infoPtr->nButtonWidth < oldButtonWidth) - TOOLBAR_SetButtonSize(hwnd, MAKELONG(oldButtonWidth, infoPtr->nButtonHeight)); + if ((oldBitmapWidth != infoPtr->nBitmapWidth) || (oldBitmapHeight != infoPtr->nBitmapHeight)) + { + TOOLBAR_CalcToolbar(hwnd); + if (infoPtr->nButtonWidth < oldButtonWidth) + TOOLBAR_SetButtonSize(hwnd, MAKELONG(oldButtonWidth, infoPtr->nButtonHeight)); + } TRACE("hwnd %p, new himl=%p, id = %d, count=%d, bitmap w=%d, h=%d\n", hwnd, infoPtr->himlDef, id, infoPtr->nNumBitmaps, Modified: trunk/reactos/dll/win32/comctl32/trackbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/trackba…
============================================================================== --- trunk/reactos/dll/win32/comctl32/trackbar.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/trackbar.c [iso-8859-1] Tue May 5 20:26:56 2009 @@ -80,6 +80,8 @@ #define TB_REFRESH_DELAY 500 #define TOOLTIP_OFFSET 2 /* distance from ctrl edge to tooltip */ + +#define TB_DEFAULTPAGESIZE 20 /* Used by TRACKBAR_Refresh to find out which parts of the control need to be recalculated */ @@ -1128,7 +1130,10 @@ { LONG lTemp = infoPtr->lPageSize; - infoPtr->lPageSize = lPageSize; + if (lPageSize != -1) + infoPtr->lPageSize = lPageSize; + else + infoPtr->lPageSize = TB_DEFAULTPAGESIZE; return lTemp; } @@ -1405,7 +1410,7 @@ infoPtr->lRangeMin = 0; infoPtr->lRangeMax = 100; infoPtr->lLineSize = 1; - infoPtr->lPageSize = 20; + infoPtr->lPageSize = TB_DEFAULTPAGESIZE; infoPtr->lSelMin = 0; infoPtr->lSelMax = 0; infoPtr->lPos = 0; Modified: trunk/reactos/dll/win32/comctl32/treeview.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/treevie…
============================================================================== --- trunk/reactos/dll/win32/comctl32/treeview.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/treeview.c [iso-8859-1] Tue May 5 20:26:56 2009 @@ -2837,7 +2837,7 @@ } // - // This is correct, but it causes an infinite loop of WM_PAINT messages, resulting + // This is correct, but is causes and infinite loop of WM_PAINT messages, resulting // in continuous painting of the scroll bar in reactos. Comment out until the real // bug is found // @@ -3297,56 +3297,59 @@ if (bExpandPartial) FIXME("TVE_EXPANDPARTIAL not implemented\n"); - TREEVIEW_RecalculateVisibleOrder(infoPtr, wineItem); - TREEVIEW_UpdateSubTree(infoPtr, wineItem); - TREEVIEW_UpdateScrollBars(infoPtr); - - scrollRect.left = 0; - scrollRect.bottom = infoPtr->treeHeight; - scrollRect.right = infoPtr->clientWidth; - if (nextItem) - { - scrollDist = nextItem->rect.top - orgNextTop; - scrollRect.top = orgNextTop; - - ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, NULL, - NULL, NULL, SW_ERASE | SW_INVALIDATE); - TREEVIEW_Invalidate (infoPtr, wineItem); - } else { - scrollRect.top = wineItem->rect.top; - InvalidateRect(infoPtr->hwnd, &scrollRect, FALSE); - } - - /* Scroll up so that as many children as possible are visible. - * This fails when expanding causes an HScroll bar to appear, but we - * don't know that yet, so the last item is obscured. */ - if (wineItem->firstChild != NULL) - { - int nChildren = wineItem->lastChild->visibleOrder - - wineItem->firstChild->visibleOrder + 1; - - int visible_pos = wineItem->visibleOrder - - infoPtr->firstVisible->visibleOrder; - - int rows_below = TREEVIEW_GetVisibleCount(infoPtr) - visible_pos - 1; - - if (visible_pos > 0 && nChildren > rows_below) - { - int scroll = nChildren - rows_below; - - if (scroll > visible_pos) - scroll = visible_pos; - - if (scroll > 0) - { - TREEVIEW_ITEM *newFirstVisible - = TREEVIEW_GetListItem(infoPtr, infoPtr->firstVisible, - scroll); - - - TREEVIEW_SetFirstVisible(infoPtr, newFirstVisible, TRUE); - } - } + if (ISVISIBLE(wineItem)) + { + TREEVIEW_RecalculateVisibleOrder(infoPtr, wineItem); + TREEVIEW_UpdateSubTree(infoPtr, wineItem); + TREEVIEW_UpdateScrollBars(infoPtr); + + scrollRect.left = 0; + scrollRect.bottom = infoPtr->treeHeight; + scrollRect.right = infoPtr->clientWidth; + if (nextItem) + { + scrollDist = nextItem->rect.top - orgNextTop; + scrollRect.top = orgNextTop; + + ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, NULL, + NULL, NULL, SW_ERASE | SW_INVALIDATE); + TREEVIEW_Invalidate (infoPtr, wineItem); + } else { + scrollRect.top = wineItem->rect.top; + InvalidateRect(infoPtr->hwnd, &scrollRect, FALSE); + } + + /* Scroll up so that as many children as possible are visible. + * This fails when expanding causes an HScroll bar to appear, but we + * don't know that yet, so the last item is obscured. */ + if (wineItem->firstChild != NULL) + { + int nChildren = wineItem->lastChild->visibleOrder + - wineItem->firstChild->visibleOrder + 1; + + int visible_pos = wineItem->visibleOrder + - infoPtr->firstVisible->visibleOrder; + + int rows_below = TREEVIEW_GetVisibleCount(infoPtr) - visible_pos - 1; + + if (visible_pos > 0 && nChildren > rows_below) + { + int scroll = nChildren - rows_below; + + if (scroll > visible_pos) + scroll = visible_pos; + + if (scroll > 0) + { + TREEVIEW_ITEM *newFirstVisible + = TREEVIEW_GetListItem(infoPtr, infoPtr->firstVisible, + scroll); + + + TREEVIEW_SetFirstVisible(infoPtr, newFirstVisible, TRUE); + } + } + } } return TRUE; Modified: trunk/reactos/dll/win32/comctl32/updown.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/updown.…
============================================================================== --- trunk/reactos/dll/win32/comctl32/updown.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/updown.c [iso-8859-1] Tue May 5 20:26:56 2009 @@ -470,6 +470,27 @@ } /*********************************************************************** + * UPDOWN_SetRange + * + * Handle UDM_SETRANGE, UDM_SETRANGE32 + * + * FIXME: handle Max == Min properly: + * - arrows should be disabled (without WS_DISABLED set), + * visually they can't be pressed and don't respond; + * - all input messages should still pass in. + */ +static LRESULT UPDOWN_SetRange(UPDOWN_INFO *infoPtr, INT Max, INT Min) +{ + infoPtr->MaxVal = Max; + infoPtr->MinVal = Min; + + TRACE("UpDown Ctrl new range(%d to %d), hwnd=%p\n", + infoPtr->MinVal, infoPtr->MaxVal, infoPtr->Self); + + return 0; +} + +/*********************************************************************** * UPDOWN_MouseWheel * * Handle mouse wheel scrolling @@ -507,6 +528,7 @@ HWND upDownHwnd = GetPropW(hwnd, BUDDY_UPDOWN_HWND); UPDOWN_KeyPressed(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam); + if ((wParam == VK_UP) || (wParam == VK_DOWN)) return 0; } else if (uMsg == WM_MOUSEWHEEL) { HWND upDownHwnd = GetPropW(hwnd, BUDDY_UPDOWN_HWND); @@ -1044,12 +1066,11 @@ return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal); case UDM_SETRANGE: - /* we must have: */ - infoPtr->MaxVal = (short)(lParam); /* UD_MINVAL <= Max <= UD_MAXVAL */ - infoPtr->MinVal = (short)HIWORD(lParam); /* UD_MINVAL <= Min <= UD_MAXVAL */ - /* |Max-Min| <= UD_MAXVAL */ - TRACE("UpDown Ctrl new range(%d to %d), hwnd=%p\n", - infoPtr->MinVal, infoPtr->MaxVal, hwnd); + /* we must have: + UD_MINVAL <= Max <= UD_MAXVAL + UD_MINVAL <= Min <= UD_MAXVAL + |Max-Min| <= UD_MAXVAL */ + UPDOWN_SetRange(infoPtr, (short)lParam, (short)HIWORD(lParam)); break; case UDM_GETRANGE32: @@ -1058,12 +1079,7 @@ break; case UDM_SETRANGE32: - infoPtr->MinVal = (INT)wParam; - infoPtr->MaxVal = (INT)lParam; - if (infoPtr->MaxVal <= infoPtr->MinVal) - infoPtr->MaxVal = infoPtr->MinVal + 1; - TRACE("UpDown Ctrl new range(%d to %d), hwnd=%p\n", - infoPtr->MinVal, infoPtr->MaxVal, hwnd); + UPDOWN_SetRange(infoPtr, (INT)lParam, (INT)wParam); break; case UDM_GETPOS32: Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Lt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Lt…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Lt.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Lt.rc [iso-8859-1] Tue May 5 20:26:56 2009 @@ -186,10 +186,10 @@ FINDDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 236, 62 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Rasti" -FONT 8, "MS Shell Dlg" -{ - LTEXT "&IeÅ¡koti ko:", -1, 4, 8, 42, 8 +CAPTION "IeÅ¡koti" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Ko &ieÅ¡koti:", -1, 4, 8, 42, 8 EDITTEXT edt1, 47, 7, 128, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP CHECKBOX "Tenkina tik &visas žodis", chx1, 4, 26, 82, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP CHECKBOX "Skirti raidžių &dydį", chx2, 4, 42, 70, 12, BS_AUTOCHECKBOX | WS_TABSTOP @@ -197,7 +197,7 @@ CONTROL "&AukÅ¡tyn", rad1, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 93, 38, 40, 12 CONTROL "&Žemyn", rad2, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 134, 38, 36, 12 - DEFPUSHBUTTON "&Rasti kitÄ ", IDOK, 182, 5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + DEFPUSHBUTTON "IeÅ¡koti &kito", IDOK, 182, 5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Atsisakyti", IDCANCEL , 182, 23, 50, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "&Žinynas", pshHelp , 182, 45, 50, 14, WS_GROUP | WS_TABSTOP } @@ -208,14 +208,14 @@ CAPTION "Pakeisti" FONT 8, "MS Shell Dlg" { - LTEXT "&IeÅ¡koti ko:", -1, 4, 9, 48, 8 + LTEXT "Ko &ieÅ¡koti:", -1, 4, 9, 48, 8 EDITTEXT edt1, 54, 7, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP - LTEXT "Pa&keisti kuo:", -1, 4, 26, 48, 8 + LTEXT "Kuo pa&keisti:", -1, 4, 26, 48, 8 EDITTEXT edt2, 54, 24, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP CHECKBOX "Tenkina tik &visas žodis", chx1, 5, 46, 104, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP CHECKBOX "Skirti raidžių &dydį", chx2, 5, 62, 70, 12, BS_AUTOCHECKBOX | WS_TABSTOP - DEFPUSHBUTTON "&Rasti kitÄ ", IDOK, 174, 4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + DEFPUSHBUTTON "IeÅ¡koti &kito", IDOK, 174, 4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "&Pakeisti", psh1 , 174, 21, 50, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "P&akeisti visus", psh2 , 174, 38, 50, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "Atsisakyti", IDCANCEL , 174, 55, 50, 14, WS_GROUP | WS_TABSTOP Modified: trunk/reactos/dll/win32/comdlg32/cdlg_Sk.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/cdlg_Sk…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/cdlg_Sk.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/cdlg_Sk.rc [iso-8859-1] Tue May 5 20:26:56 2009 @@ -316,13 +316,13 @@ AUTORADIOBUTTON "&Landscape", rad2, 16, 190, 52, 12, BS_AUTORADIOBUTTON GROUPBOX "Borders", grp4, 80, 156, 152, 56, BS_GROUPBOX LTEXT "L&eft:", stc15, 88, 172, 21, 8 - EDITTEXT edt4, 111, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER|ES_NUMBER + EDITTEXT edt4, 111, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER LTEXT "&Right:", stc16, 159, 172, 27, 8 - EDITTEXT edt6, 187, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER|ES_NUMBER + EDITTEXT edt6, 187, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER LTEXT "T&op:", stc17, 88, 192, 21, 8 - EDITTEXT edt5, 111, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER|ES_NUMBER + EDITTEXT edt5, 111, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER LTEXT "&Bottom:", stc18, 159, 192, 23, 8 - EDITTEXT edt7, 187, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER|ES_NUMBER + EDITTEXT edt7, 187, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER DEFPUSHBUTTON "OK", IDOK, 71, 220, 50, 14, BS_PUSHBUTTON PUSHBUTTON "Zrui", IDCANCEL, 126, 220, 50, 14 PUSHBUTTON "P&rinter...", psh3, 184, 220, 48, 14 Modified: trunk/reactos/dll/win32/comdlg32/filedlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/filedlg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/filedlg.c [iso-8859-1] Tue May 5 20:26:56 2009 @@ -37,7 +37,7 @@ * FIXME: add to recent docs * * FIXME: flags not implemented: OFN_DONTADDTORECENT, - * OFN_ENABLEINCLUDENOTIFY, OFN_ENABLESIZING, + * OFN_ENABLESIZING, * OFN_NODEREFERENCELINKS, OFN_NOREADONLYRETURN, * OFN_NOTESTFILECREATE, OFN_USEMONIKERS * @@ -82,8 +82,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); #define UNIMPLEMENTED_FLAGS \ -(OFN_DONTADDTORECENT |\ -OFN_ENABLEINCLUDENOTIFY | OFN_ENABLESIZING |\ +(OFN_DONTADDTORECENT | OFN_ENABLESIZING |\ OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\ OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/) @@ -2788,6 +2787,8 @@ iItem = CBGetCurSel(fodInfos->DlgInfos.hwndLookInCB); + if( iItem == CB_ERR) return FALSE; + if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB, iItem))) return FALSE; Modified: trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c [iso-8859-1] Tue May 5 20:26:56 2009 @@ -846,6 +846,47 @@ return NOERROR; } +/* send_includeitem_notification + * + * Sends a CDN_INCLUDEITEM notification for "pidl" to hwndParentDlg + */ +static LRESULT send_includeitem_notification(HWND hwndParentDlg, LPCITEMIDLIST pidl) +{ + LRESULT hook_result = 0; + FileOpenDlgInfos *fodInfos = GetPropA(hwndParentDlg, FileOpenDlgInfosStr); + + if(!fodInfos) return 0; + + if(fodInfos->DlgInfos.hwndCustomDlg) + { + TRACE("call notify CDN_INCLUDEITEM for pidl=%p\n", pidl); + if(fodInfos->unicode) + { + OFNOTIFYEXW ofnNotify; + ofnNotify.psf = fodInfos->Shell.FOIShellFolder; + ofnNotify.pidl = (LPITEMIDLIST)pidl; + ofnNotify.hdr.hwndFrom = hwndParentDlg; + ofnNotify.hdr.idFrom = 0; + ofnNotify.hdr.code = CDN_INCLUDEITEM; + ofnNotify.lpOFN = fodInfos->ofnInfos; + hook_result = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify); + } + else + { + OFNOTIFYEXA ofnNotify; + ofnNotify.psf = fodInfos->Shell.FOIShellFolder; + ofnNotify.pidl = (LPITEMIDLIST)pidl; + ofnNotify.hdr.hwndFrom = hwndParentDlg; + ofnNotify.hdr.idFrom = 0; + ofnNotify.hdr.code = CDN_INCLUDEITEM; + ofnNotify.lpOFN = (LPOPENFILENAMEA)fodInfos->ofnInfos; + hook_result = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify); + } + } + TRACE("Retval: 0x%08lx\n", hook_result); + return hook_result; +} + /************************************************************************** * IShellBrowserImpl_ICommDlgBrowser_IncludeObject */ @@ -873,6 +914,11 @@ /* always include directories and links */ if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) + return S_OK; + + /* if the application takes care of including the item we are done */ + if(fodInfos->ofnInfos->Flags & OFN_ENABLEINCLUDENOTIFY && + send_includeitem_notification(This->hwndOwner, pidl)) return S_OK; /* Check if there is a mask to apply if not */ Modified: trunk/reactos/dll/win32/comdlg32/printdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/printdl…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/printdlg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/printdlg.c [iso-8859-1] Tue May 5 20:26:56 2009 @@ -3414,8 +3414,7 @@ */ static LRESULT CALLBACK pagesetup_margin_editproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - switch(msg) - case WM_CHAR: + if (msg == WM_CHAR) { WCHAR decimal = get_decimal_sep(); WCHAR wc = (WCHAR)wparam;
15 years, 8 months
1
0
0
0
[janderwald] 40797: - Implement IPortWaveRT, IPortFilterWaveRT, IPortPinWaveRT interface for audio drivers >= Vista
by janderwald@svn.reactos.org
Author: janderwald Date: Tue May 5 20:01:39 2009 New Revision: 40797 URL:
http://svn.reactos.org/svn/reactos?rev=40797&view=rev
Log: - Implement IPortWaveRT, IPortFilterWaveRT, IPortPinWaveRT interface for audio drivers >= Vista Added: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavert.c (with props) trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.c (with props) trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.c (with props) trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavertstream.c (with props) Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h Added: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavert.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavert.c (added) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavert.c [iso-8859-1] Tue May 5 20:01:39 2009 @@ -1,0 +1,462 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel Streaming + * FILE: drivers/wdm/audio/backpln/portcls/filter_wavert.c + * PURPOSE: portcls wave RT filter + * PROGRAMMER: Johannes Anderwald + */ + +#include "private.h" + +typedef struct +{ + IPortFilterWaveRTVtbl *lpVtbl; + + LONG ref; + + IPortWaveRT* Port; + IPortPinWaveRT ** Pins; + SUBDEVICE_DESCRIPTOR * Descriptor; + +}IPortFilterWaveRTImpl; + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortFilterWaveRT_fnQueryInterface( + IPortFilterWaveRT* iface, + IN REFIID refiid, + OUT PVOID* Output) +{ + IPortFilterWaveRTImpl * This = (IPortFilterWaveRTImpl*)iface; + + if (IsEqualGUIDAligned(refiid, &IID_IIrpTarget) || + IsEqualGUIDAligned(refiid, &IID_IUnknown)) + { + *Output = &This->lpVtbl; + InterlockedIncrement(&This->ref); + return STATUS_SUCCESS; + } + else if (IsEqualGUIDAligned(refiid, &IID_IPort)) + { + *Output = This->Port; + This->Port->lpVtbl->AddRef(This->Port); + return STATUS_SUCCESS; + } + + + return STATUS_UNSUCCESSFUL; +} + +/* + * @implemented + */ +ULONG +NTAPI +IPortFilterWaveRT_fnAddRef( + IPortFilterWaveRT* iface) +{ + IPortFilterWaveRTImpl * This = (IPortFilterWaveRTImpl*)iface; + + return InterlockedIncrement(&This->ref); +} + +/* + * @implemented + */ +ULONG +NTAPI +IPortFilterWaveRT_fnRelease( + IPortFilterWaveRT* iface) +{ + IPortFilterWaveRTImpl * This = (IPortFilterWaveRTImpl*)iface; + + InterlockedDecrement(&This->ref); + + if (This->ref == 0) + { + FreeItem(This, TAG_PORTCLASS); + return 0; + } + return This->ref; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortFilterWaveRT_fnNewIrpTarget( + IN IPortFilterWaveRT* iface, + OUT struct IIrpTarget **OutTarget, + IN WCHAR * Name, + IN PUNKNOWN Unknown, + IN POOL_TYPE PoolType, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + IN KSOBJECT_CREATE *CreateObject) +{ + NTSTATUS Status; + IPortPinWaveRT * Pin; + PKSPIN_CONNECT ConnectDetails; + IPortFilterWaveRTImpl * This = (IPortFilterWaveRTImpl *)iface; + + ASSERT(This->Port); + ASSERT(This->Descriptor); + ASSERT(This->Pins); + + DPRINT("IPortFilterWaveRT_fnNewIrpTarget entered\n"); + + /* let's verify the connection request */ + Status = PcValidateConnectRequest(Irp, &This->Descriptor->Factory, &ConnectDetails); + if (!NT_SUCCESS(Status)) + { + return STATUS_UNSUCCESSFUL; + } + + if (This->Pins[ConnectDetails->PinId] && This->Descriptor->Factory.Instances[ConnectDetails->PinId].CurrentPinInstanceCount) + { + /* release existing instance */ + ASSERT(0); + This->Pins[ConnectDetails->PinId]->lpVtbl->Close(This->Pins[ConnectDetails->PinId], DeviceObject, NULL); + } + + /* now create the pin */ + Status = NewPortPinWaveRT(&Pin); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + /* initialize the pin */ + Status = Pin->lpVtbl->Init(Pin, This->Port, iface, ConnectDetails, &This->Descriptor->Factory.KsPinDescriptor[ConnectDetails->PinId], GetDeviceObjectFromPortWaveRT(This->Port)); + if (!NT_SUCCESS(Status)) + { + Pin->lpVtbl->Release(Pin); + return Status; + } + + /* release existing pin */ + if (This->Pins[ConnectDetails->PinId]) + { + This->Pins[ConnectDetails->PinId]->lpVtbl->Release(This->Pins[ConnectDetails->PinId]); + } + /* store pin */ + This->Pins[ConnectDetails->PinId] = Pin; + + /* store result */ + *OutTarget = (IIrpTarget*)Pin; + + /* increment current instance count */ + This->Descriptor->Factory.Instances[ConnectDetails->PinId].CurrentPinInstanceCount++; + + return Status; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortFilterWaveRT_fnDeviceIoControl( + IN IPortFilterWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + ISubdevice *SubDevice = NULL; + SUBDEVICE_DESCRIPTOR * Descriptor; + NTSTATUS Status; + IPortFilterWaveRTImpl * This = (IPortFilterWaveRTImpl *)iface; + + IoStack = IoGetCurrentIrpStackLocation(Irp); + ASSERT(IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY); + Status = This->Port->lpVtbl->QueryInterface(This->Port, &IID_ISubdevice, (PVOID*)&SubDevice); + ASSERT(Status == STATUS_SUCCESS); + ASSERT(SubDevice != NULL); + + Status = SubDevice->lpVtbl->GetDescriptor(SubDevice, &Descriptor); + ASSERT(Status == STATUS_SUCCESS); + ASSERT(Descriptor != NULL); + + SubDevice->lpVtbl->Release(SubDevice); + + return PcPropertyHandler(Irp, Descriptor); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortFilterWaveRT_fnRead( + IN IPortFilterWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortFilterWaveRT_fnWrite( + IN IPortFilterWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortFilterWaveRT_fnFlush( + IN IPortFilterWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortFilterWaveRT_fnClose( + IN IPortFilterWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + ULONG Index; + IPortFilterWaveRTImpl * This = (IPortFilterWaveRTImpl *)iface; + + for(Index = 0; Index < This->Descriptor->Factory.PinDescriptorCount; Index++) + { + if (This->Pins[Index]) + { + This->Pins[Index]->lpVtbl->Close(This->Pins[Index], DeviceObject, NULL); + } + } + + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_UNSUCCESSFUL; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortFilterWaveRT_fnQuerySecurity( + IN IPortFilterWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortFilterWaveRT_fnSetSecurity( + IN IPortFilterWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); +} + +/* + * @implemented + */ +BOOLEAN +NTAPI +IPortFilterWaveRT_fnFastDeviceIoControl( + IN IPortFilterWaveRT* iface, + IN PFILE_OBJECT FileObject, + IN BOOLEAN Wait, + IN PVOID InputBuffer, + IN ULONG InputBufferLength, + OUT PVOID OutputBuffer, + IN ULONG OutputBufferLength, + IN ULONG IoControlCode, + OUT PIO_STATUS_BLOCK StatusBlock, + IN PDEVICE_OBJECT DeviceObject) +{ + ULONG Index; + PKSPROPERTY Property; + NTSTATUS Status; + ISubdevice * SubDevice = NULL; + PSUBDEVICE_DESCRIPTOR Descriptor = NULL; + IPortFilterWaveRTImpl * This = (IPortFilterWaveRTImpl *)iface; + + Property = (PKSPROPERTY)InputBuffer; + + if (InputBufferLength < sizeof(KSPROPERTY)) + return FALSE; + + + /* get private interface */ + Status = This->Port->lpVtbl->QueryInterface(This->Port, &IID_ISubdevice, (PVOID*)&SubDevice); + if (!NT_SUCCESS(Status)) + return FALSE; + + /* get descriptor */ + Status = SubDevice->lpVtbl->GetDescriptor(SubDevice, &Descriptor); + if (!NT_SUCCESS(Status)) + { + SubDevice->lpVtbl->Release(SubDevice); + return FALSE; + } + + for(Index = 0; Index < Descriptor->FilterPropertySet.FreeKsPropertySetOffset; Index++) + { + if (IsEqualGUIDAligned(&Property->Set, Descriptor->FilterPropertySet.Properties[Index].Set)) + { + FastPropertyHandler(FileObject, (PKSPROPERTY)InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength, StatusBlock, + 1, + &Descriptor->FilterPropertySet.Properties[Index], + Descriptor, SubDevice); + } + } + return TRUE; +} + +/* + * @implemented + */ +BOOLEAN +NTAPI +IPortFilterWaveRT_fnFastRead( + IN IPortFilterWaveRT* iface, + IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN BOOLEAN Wait, + IN ULONG LockKey, + IN PVOID Buffer, + OUT PIO_STATUS_BLOCK StatusBlock, + IN PDEVICE_OBJECT DeviceObject) +{ + UNIMPLEMENTED + return FALSE; +} + +/* + * @implemented + */ +BOOLEAN +NTAPI +IPortFilterWaveRT_fnFastWrite( + IN IPortFilterWaveRT* iface, + IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN BOOLEAN Wait, + IN ULONG LockKey, + IN PVOID Buffer, + OUT PIO_STATUS_BLOCK StatusBlock, + IN PDEVICE_OBJECT DeviceObject) +{ + UNIMPLEMENTED + return FALSE; +} + +/* + * @implemented + */ +static +NTSTATUS +NTAPI +IPortFilterWaveRT_fnInit( + IN IPortFilterWaveRT* iface, + IN IPortWaveRT* Port) +{ + ISubdevice * ISubDevice; + SUBDEVICE_DESCRIPTOR * Descriptor; + NTSTATUS Status; + IPortFilterWaveRTImpl * This = (IPortFilterWaveRTImpl*)iface; + + This->Port = Port; + + /* get our private interface */ + Status = This->Port->lpVtbl->QueryInterface(This->Port, &IID_ISubdevice, (PVOID*)&ISubDevice); + if (!NT_SUCCESS(Status)) + return STATUS_UNSUCCESSFUL; + + /* get the subdevice descriptor */ + Status = ISubDevice->lpVtbl->GetDescriptor(ISubDevice, &Descriptor); + + /* release subdevice interface */ + ISubDevice->lpVtbl->Release(ISubDevice); + + if (!NT_SUCCESS(Status)) + return STATUS_UNSUCCESSFUL; + + /* save descriptor */ + This->Descriptor = Descriptor; + + /* allocate pin array */ + This->Pins = AllocateItem(NonPagedPool, Descriptor->Factory.PinDescriptorCount * sizeof(IPortPinWaveRT*), TAG_PORTCLASS); + + if (!This->Pins) + return STATUS_UNSUCCESSFUL; + + /* increment reference count */ + Port->lpVtbl->AddRef(Port); + + return STATUS_SUCCESS; +} + +static IPortFilterWaveRTVtbl vt_IPortFilterWaveRT = +{ + IPortFilterWaveRT_fnQueryInterface, + IPortFilterWaveRT_fnAddRef, + IPortFilterWaveRT_fnRelease, + IPortFilterWaveRT_fnNewIrpTarget, + IPortFilterWaveRT_fnDeviceIoControl, + IPortFilterWaveRT_fnRead, + IPortFilterWaveRT_fnWrite, + IPortFilterWaveRT_fnFlush, + IPortFilterWaveRT_fnClose, + IPortFilterWaveRT_fnQuerySecurity, + IPortFilterWaveRT_fnSetSecurity, + IPortFilterWaveRT_fnFastDeviceIoControl, + IPortFilterWaveRT_fnFastRead, + IPortFilterWaveRT_fnFastWrite, + IPortFilterWaveRT_fnInit +}; + +NTSTATUS +NewPortFilterWaveRT( + OUT IPortFilterWaveRT ** OutFilter) +{ + IPortFilterWaveRTImpl * This; + + This = AllocateItem(NonPagedPool, sizeof(IPortFilterWaveRTImpl), TAG_PORTCLASS); + if (!This) + return STATUS_INSUFFICIENT_RESOURCES; + + /* initialize IPortFilterWaveRT */ + This->ref = 1; + This->lpVtbl = &vt_IPortFilterWaveRT; + + /* return result */ + *OutFilter = (IPortFilterWaveRT*)&This->lpVtbl; + + return STATUS_SUCCESS; +} Propchange: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavert.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c [iso-8859-1] Tue May 5 20:01:39 2009 @@ -76,3 +76,14 @@ const GUID IID_IIrpTarget = {0xB4C90A60, 0x5791, 0x11D0, {0xF9, 0x86, 0x00, 0xA0, 0xC9, 0x11, 0xB5, 0x44}}; const GUID IID_IIrpTargetFactory = {0xB4C90A62, 0x5791, 0x11D0, {0xF9, 0x86, 0x00, 0xA0, 0xC9, 0x11, 0xB5, 0x44}}; + +/// +/// >= Vista GUIDs +/// +const GUID IID_IPortWaveRT = {0x339ff909, 0x68a9, 0x4310, {0xb0, 0x9b, 0x27, 0x4e, 0x96, 0xee, 0x4c, 0xbd}}; +const GUID IID_IPortWaveRTStream = {0x1809ce5a, 0x64bc, 0x4e62, {0xbd, 0x7d, 0x95, 0xbc, 0xe4, 0x3d, 0xe3, 0x93}}; +const GUID IID_IMiniportWaveRT = {0x0f9fc4d6, 0x6061, 0x4f3c, {0xb1, 0xfc, 0x7, 0x5e, 0x35, 0xf7, 0x96, 0xa}}; +const GUID IID_IMiniportWaveRTStream = {0x000ac9ab, 0xfaab, 0x4f3d, {0x94, 0x55, 0x6f, 0xf8, 0x30, 0x6a, 0x74, 0xa0}}; +const GUID IID_IMiniportWaveRTStreamNotification = {0x23759128, 0x96f1, 0x423b, {0xab, 0x4d, 0x81, 0x63, 0x5b, 0xcf, 0x8c, 0xa1}}; + + Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] Tue May 5 20:01:39 2009 @@ -475,6 +475,50 @@ typedef IPortPinWavePci *PPORTPINWAVEPCI; /***************************************************************************** + * IPortFilterWaveRT + ***************************************************************************** + */ + +#undef INTERFACE +#define INTERFACE IPortFilterWaveRT + +DECLARE_INTERFACE_(IPortFilterWaveRT, IIrpTarget) +{ + DEFINE_ABSTRACT_UNKNOWN() + + DEFINE_ABSTRACT_IRPTARGET() + + STDMETHOD_(NTSTATUS, Init)(THIS_ + IN PPORTWAVERT Port)PURE; +}; + +typedef IPortFilterWaveRT *PPORTFILTERWAVERT; + +/***************************************************************************** + * IPortPinWavePci + ***************************************************************************** + */ + +#undef INTERFACE +#define INTERFACE IPortPinWaveRT + +DECLARE_INTERFACE_(IPortPinWaveRT, IIrpTarget) +{ + DEFINE_ABSTRACT_UNKNOWN() + + DEFINE_ABSTRACT_IRPTARGET() + + STDMETHOD_(NTSTATUS, Init)(THIS_ + IN PPORTWAVERT Port, + IN PPORTFILTERWAVERT Filter, + IN KSPIN_CONNECT * ConnectDetails, + IN KSPIN_DESCRIPTOR * PinDescriptor, + IN PDEVICE_OBJECT DeviceObject) PURE; +}; + +typedef IPortPinWavePci *PPORTPINWAVERT; + +/***************************************************************************** * IPortFilterWaveCyclic ***************************************************************************** */ Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] Tue May 5 20:01:39 2009 @@ -31,9 +31,6 @@ IIrpQueue * IrpQueue; - PUCHAR ActiveIrpBuffer; - ULONG ActiveIrpBufferSize; - ULONG ActiveIrpOffset; ULONG FrameSize; BOOL Capture; Added: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.c (added) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.c [iso-8859-1] Tue May 5 20:01:39 2009 @@ -1,0 +1,1044 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel Streaming + * FILE: drivers/wdm/audio/backpln/portcls/pin_wavert.c + * PURPOSE: WaveRT IRP Audio Pin + * PROGRAMMER: Johannes Anderwald + */ + +#include "private.h" + +typedef struct +{ + IPortPinWaveRTVtbl *lpVtbl; + IServiceSinkVtbl *lpVtblServiceSink; + LONG ref; + + IPortWaveRT * Port; + IPortFilterWaveRT * Filter; + KSPIN_DESCRIPTOR * KsPinDescriptor; + PMINIPORTWAVERT Miniport; + PMINIPORTWAVERTSTREAM Stream; + PPORTWAVERTSTREAM PortStream; + PSERVICEGROUP ServiceGroup; + KSSTATE State; + PKSDATAFORMAT Format; + KSPIN_CONNECT * ConnectDetails; + + PVOID CommonBuffer; + ULONG CommonBufferSize; + ULONG CommonBufferOffset; + + IIrpQueue * IrpQueue; + + BOOL Capture; + + ULONG TotalPackets; + ULONG PreCompleted; + ULONG PostCompleted; + + ULONGLONG Delay; + + MEMORY_CACHING_TYPE CacheType; + PMDL Mdl; + +}IPortPinWaveRTImpl; + + +typedef struct +{ + IPortPinWaveRTImpl *Pin; + PIO_WORKITEM WorkItem; + KSSTATE State; +}SETSTREAM_CONTEXT, *PSETSTREAM_CONTEXT; + +static +VOID +NTAPI +SetStreamState( + IN IPortPinWaveRTImpl * This, + IN KSSTATE State); + +//================================================================================================================================== +static +NTSTATUS +NTAPI +IServiceSink_fnQueryInterface( + IServiceSink* iface, + IN REFIID refiid, + OUT PVOID* Output) +{ + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)CONTAINING_RECORD(iface, IPortPinWaveRTImpl, lpVtblServiceSink); + + DPRINT("IServiceSink_fnQueryInterface entered\n"); + + if (IsEqualGUIDAligned(refiid, &IID_IServiceSink) || + IsEqualGUIDAligned(refiid, &IID_IUnknown)) + { + *Output = &This->lpVtblServiceSink; + InterlockedIncrement(&This->ref); + return STATUS_SUCCESS; + } + return STATUS_UNSUCCESSFUL; +} + +static +ULONG +NTAPI +IServiceSink_fnAddRef( + IServiceSink* iface) +{ + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)CONTAINING_RECORD(iface, IPortPinWaveRTImpl, lpVtblServiceSink); + DPRINT("IServiceSink_fnAddRef entered\n"); + + return InterlockedIncrement(&This->ref); +} + +static +ULONG +NTAPI +IServiceSink_fnRelease( + IServiceSink* iface) +{ + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)CONTAINING_RECORD(iface, IPortPinWaveRTImpl, lpVtblServiceSink); + + InterlockedDecrement(&This->ref); + + DPRINT("IServiceSink_fnRelease entered %u\n", This->ref); + + if (This->ref == 0) + { + FreeItem(This, TAG_PORTCLASS); + return 0; + } + /* Return new reference count */ + return This->ref; +} + +static +VOID +NTAPI +IServiceSink_fnRequestService( + IServiceSink* iface) +{ + KSAUDIO_POSITION Position; + NTSTATUS Status; + PUCHAR Buffer; + ULONG BufferSize; + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)CONTAINING_RECORD(iface, IPortPinWaveRTImpl, lpVtblServiceSink); + + ASSERT_IRQL(DISPATCH_LEVEL); + + Status = This->IrpQueue->lpVtbl->GetMapping(This->IrpQueue, &Buffer, &BufferSize); + if (!NT_SUCCESS(Status)) + { + SetStreamState(This, KSSTATE_STOP); + return; + } + + Status = This->Stream->lpVtbl->GetPosition(This->Stream, &Position); + DPRINT("PlayOffset %llu WriteOffset %llu %u Buffer %p BufferSize %u\n", Position.PlayOffset, Position.WriteOffset, Buffer, This->CommonBufferSize, BufferSize); + + //FIXME + // implement writing into cyclic buffer + // + + /* reschedule the timer */ + This->ServiceGroup->lpVtbl->RequestDelayedService(This->ServiceGroup, This->Delay); +} + +static IServiceSinkVtbl vt_IServiceSink = +{ + IServiceSink_fnQueryInterface, + IServiceSink_fnAddRef, + IServiceSink_fnRelease, + IServiceSink_fnRequestService +}; + + +static +VOID +NTAPI +SetStreamWorkerRoutine( + IN PDEVICE_OBJECT DeviceObject, + IN PVOID Context) +{ + IPortPinWaveRTImpl * This; + PSETSTREAM_CONTEXT Ctx = (PSETSTREAM_CONTEXT)Context; + KSSTATE State; + + This = Ctx->Pin; + State = Ctx->State; + + IoFreeWorkItem(Ctx->WorkItem); + FreeItem(Ctx, TAG_PORTCLASS); + + /* Has the audio stream resumed? */ + if (This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue) && State == KSSTATE_STOP) + return; + + /* Set the state */ + if (NT_SUCCESS(This->Stream->lpVtbl->SetState(This->Stream, State))) + { + /* Set internal state to stop */ + This->State = State; + + if (This->State == KSSTATE_STOP) + { + /* reset start stream */ + This->IrpQueue->lpVtbl->CancelBuffers(This->IrpQueue); //FIX function name + This->ServiceGroup->lpVtbl->CancelDelayedService(This->ServiceGroup); + DPRINT1("Stopping PreCompleted %u PostCompleted %u\n", This->PreCompleted, This->PostCompleted); + } + + if (This->State == KSSTATE_RUN) + { + /* start the notification timer */ + This->ServiceGroup->lpVtbl->RequestDelayedService(This->ServiceGroup, This->Delay); + } + } +} + +static +VOID +NTAPI +SetStreamState( + IN IPortPinWaveRTImpl * This, + IN KSSTATE State) +{ + PDEVICE_OBJECT DeviceObject; + PIO_WORKITEM WorkItem; + PSETSTREAM_CONTEXT Context; + + ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL); + + /* Has the audio stream resumed? */ + if (This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue) && State == KSSTATE_STOP) + return; + + /* Has the audio state already been set? */ + if (This->State == State) + return; + + /* Get device object */ + DeviceObject = GetDeviceObjectFromPortWaveRT(This->Port); + + /* allocate set state context */ + Context = AllocateItem(NonPagedPool, sizeof(SETSTREAM_CONTEXT), TAG_PORTCLASS); + + if (!Context) + return; + + /* allocate work item */ + WorkItem = IoAllocateWorkItem(DeviceObject); + + if (!WorkItem) + { + ExFreePool(Context); + return; + } + + Context->Pin = (PVOID)This; + Context->WorkItem = WorkItem; + Context->State = State; + + /* queue the work item */ + IoQueueWorkItem(WorkItem, SetStreamWorkerRoutine, DelayedWorkQueue, (PVOID)Context); +} + +//================================================================================================================================== +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortPinWaveRT_fnQueryInterface( + IPortPinWaveRT* iface, + IN REFIID refiid, + OUT PVOID* Output) +{ + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)iface; + + if (IsEqualGUIDAligned(refiid, &IID_IIrpTarget) || + IsEqualGUIDAligned(refiid, &IID_IUnknown)) + { + *Output = &This->lpVtbl; + InterlockedIncrement(&This->ref); + return STATUS_SUCCESS; + } + + return STATUS_UNSUCCESSFUL; +} + +/* + * @implemented + */ +ULONG +NTAPI +IPortPinWaveRT_fnAddRef( + IPortPinWaveRT* iface) +{ + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)iface; + + return InterlockedIncrement(&This->ref); +} + +/* + * @implemented + */ +ULONG +NTAPI +IPortPinWaveRT_fnRelease( + IPortPinWaveRT* iface) +{ + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)iface; + + InterlockedDecrement(&This->ref); + + if (This->ref == 0) + { + FreeItem(This, TAG_PORTCLASS); + return 0; + } + return This->ref; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IPortPinWaveRT_fnNewIrpTarget( + IN IPortPinWaveRT* iface, + OUT struct IIrpTarget **OutTarget, + IN WCHAR * Name, + IN PUNKNOWN Unknown, + IN POOL_TYPE PoolType, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + IN KSOBJECT_CREATE *CreateObject) +{ + UNIMPLEMENTED + return STATUS_UNSUCCESSFUL; +} + +NTSTATUS +NTAPI +IPortPinWaveRT_HandleKsProperty( + IN IPortPinWaveRT * iface, + IN PIRP Irp) +{ + PKSPROPERTY Property; + NTSTATUS Status; + UNICODE_STRING GuidString; + PIO_STACK_LOCATION IoStack; + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)iface; + + IoStack = IoGetCurrentIrpStackLocation(Irp); + + DPRINT("IPortPinWave_HandleKsProperty entered\n"); + + if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KSPROPERTY)) + { + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INVALID_PARAMETER; + } + + Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer; + + if (IsEqualGUIDAligned(&Property->Set, &KSPROPSETID_Connection)) + { + if (Property->Id == KSPROPERTY_CONNECTION_STATE) + { + PKSSTATE State = (PKSSTATE)Irp->UserBuffer; + + if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KSSTATE)) + { + Irp->IoStatus.Information = sizeof(KSSTATE); + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_BUFFER_TOO_SMALL; + } + + if (Property->Flags & KSPROPERTY_TYPE_SET) + { + Status = STATUS_UNSUCCESSFUL; + Irp->IoStatus.Information = 0; + + if (This->Stream) + { + Status = This->Stream->lpVtbl->SetState(This->Stream, *State); + + DPRINT1("Setting state %u %x\n", *State, Status); + if (NT_SUCCESS(Status)) + { + This->State = *State; + } + } + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; + } + else if (Property->Flags & KSPROPERTY_TYPE_GET) + { + *State = This->State; + Irp->IoStatus.Information = sizeof(KSSTATE); + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + } + } + else if (Property->Id == KSPROPERTY_CONNECTION_DATAFORMAT) + { + PKSDATAFORMAT DataFormat = (PKSDATAFORMAT)Irp->UserBuffer; + if (Property->Flags & KSPROPERTY_TYPE_SET) + { + PKSDATAFORMAT NewDataFormat; + if (!RtlCompareMemory(DataFormat, This->Format, DataFormat->FormatSize)) + { + Irp->IoStatus.Information = DataFormat->FormatSize; + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + } + + NewDataFormat = AllocateItem(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS); + if (!NewDataFormat) + { + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_NO_MEMORY; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_NO_MEMORY; + } + RtlMoveMemory(NewDataFormat, DataFormat, DataFormat->FormatSize); + + if (This->Stream) + { + ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL); + ASSERT(NewDataFormat->FormatSize == sizeof(KSDATAFORMAT_WAVEFORMATEX)); + ASSERT(IsEqualGUIDAligned(&((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->DataFormat.MajorFormat, &KSDATAFORMAT_TYPE_AUDIO)); + ASSERT(IsEqualGUIDAligned(&((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->DataFormat.SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)); + ASSERT(IsEqualGUIDAligned(&((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->DataFormat.Specifier, &KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)); + + ASSERT(This->State == KSSTATE_STOP); + DPRINT1("NewDataFormat: Channels %u Bits %u Samples %u\n", ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nChannels, + ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.wBitsPerSample, + ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nSamplesPerSec); + + Status = This->Stream->lpVtbl->SetFormat(This->Stream, NewDataFormat); + if (NT_SUCCESS(Status)) + { + if (This->Format) + ExFreePoolWithTag(This->Format, TAG_PORTCLASS); + + This->IrpQueue->lpVtbl->UpdateFormat(This->IrpQueue, (PKSDATAFORMAT)NewDataFormat); + This->Format = NewDataFormat; + Irp->IoStatus.Information = DataFormat->FormatSize; + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + } + } + DPRINT1("Failed to set format\n"); + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_UNSUCCESSFUL; + } + else if (Property->Flags & KSPROPERTY_TYPE_GET) + { + if (!This->Format) + { + DPRINT1("No format\n"); + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_UNSUCCESSFUL; + } + if (This->Format->FormatSize > IoStack->Parameters.DeviceIoControl.OutputBufferLength) + { + Irp->IoStatus.Information = This->Format->FormatSize; + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_BUFFER_TOO_SMALL; + } + + RtlMoveMemory(DataFormat, This->Format, This->Format->FormatSize); + Irp->IoStatus.Information = DataFormat->FormatSize; + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + } + } + + } + RtlStringFromGUID(&Property->Set, &GuidString); + DPRINT1("Unhandeled property Set |%S| Id %u Flags %x\n", GuidString.Buffer, Property->Id, Property->Flags); + DbgBreakPoint(); + RtlFreeUnicodeString(&GuidString); + + Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +NTAPI +IPortPinWaveRT_HandleKsStream( + IN IPortPinWaveRT * iface, + IN PIRP Irp) +{ + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)iface; + + DPRINT("IPortPinWaveRT_HandleKsStream entered State %u Stream %p\n", This->State, This->Stream); + + return STATUS_PENDING; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IPortPinWaveRT_fnDeviceIoControl( + IN IPortPinWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + + IoStack = IoGetCurrentIrpStackLocation(Irp); + + + if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY) + { + return IPortPinWaveRT_HandleKsProperty(iface, Irp); + } + else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_ENABLE_EVENT) + { + /// FIXME + /// handle enable event + } + else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_DISABLE_EVENT) + { + /// FIXME + /// handle disable event + } + else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_RESET_STATE) + { + /// FIXME + /// handle reset state + } + else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_WRITE_STREAM || IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_READ_STREAM) + { + return IPortPinWaveRT_HandleKsStream(iface, Irp); + } + else + { + return KsDefaultDeviceIoCompletion(DeviceObject, Irp); + } + + UNIMPLEMENTED + DbgBreakPoint(); + + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_UNSUCCESSFUL; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortPinWaveRT_fnRead( + IN IPortPinWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortPinWaveRT_fnWrite( + IN IPortPinWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortPinWaveRT_fnFlush( + IN IPortPinWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); +} + +static +VOID +NTAPI +CloseStreamRoutine( + IN PDEVICE_OBJECT DeviceObject, + IN PVOID Context) +{ + PMINIPORTWAVERTSTREAM Stream; + NTSTATUS Status; + ISubdevice *ISubDevice; + PSUBDEVICE_DESCRIPTOR Descriptor; + IPortPinWaveRTImpl * This; + PCLOSESTREAM_CONTEXT Ctx = (PCLOSESTREAM_CONTEXT)Context; + + This = (IPortPinWaveRTImpl*)Ctx->Pin; + + if (This->Stream) + { + if (This->State != KSSTATE_STOP) + { + This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_STOP); + KeStallExecutionProcessor(10); + } + } + + Status = This->Port->lpVtbl->QueryInterface(This->Port, &IID_ISubdevice, (PVOID*)&ISubDevice); + if (NT_SUCCESS(Status)) + { + Status = ISubDevice->lpVtbl->GetDescriptor(ISubDevice, &Descriptor); + if (NT_SUCCESS(Status)) + { + ISubDevice->lpVtbl->Release(ISubDevice); + Descriptor->Factory.Instances[This->ConnectDetails->PinId].CurrentPinInstanceCount--; + } + } + + if (This->Format) + { + ExFreePool(This->Format); + This->Format = NULL; + } + + if (This->IrpQueue) + { + This->IrpQueue->lpVtbl->Release(This->IrpQueue); + } + + /* complete the irp */ + Ctx->Irp->IoStatus.Information = 0; + Ctx->Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Ctx->Irp, IO_NO_INCREMENT); + + /* free the work item */ + IoFreeWorkItem(Ctx->WorkItem); + + /* free work item ctx */ + FreeItem(Ctx, TAG_PORTCLASS); + + if (This->Stream) + { + Stream = This->Stream; + This->Stream = NULL; + DPRINT1("Closing stream at Irql %u\n", KeGetCurrentIrql()); + Stream->lpVtbl->Release(Stream); + /* this line is never reached */ + } +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortPinWaveRT_fnClose( + IN IPortPinWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PCLOSESTREAM_CONTEXT Ctx; + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)iface; + + if (This->Stream) + { + Ctx = AllocateItem(NonPagedPool, sizeof(CLOSESTREAM_CONTEXT), TAG_PORTCLASS); + if (!Ctx) + { + DPRINT1("Failed to allocate stream context\n"); + goto cleanup; + } + + Ctx->WorkItem = IoAllocateWorkItem(DeviceObject); + if (!Ctx->WorkItem) + { + DPRINT1("Failed to allocate work item\n"); + goto cleanup; + } + + Ctx->Irp = Irp; + Ctx->Pin = (PVOID)This; + + IoMarkIrpPending(Irp); + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_PENDING; + + /* defer work item */ + IoQueueWorkItem(Ctx->WorkItem, CloseStreamRoutine, DelayedWorkQueue, (PVOID)Ctx); + /* Return result */ + return STATUS_PENDING; + } + + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; + +cleanup: + + if (Ctx) + FreeItem(Ctx, TAG_PORTCLASS); + + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_UNSUCCESSFUL; + +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortPinWaveRT_fnQuerySecurity( + IN IPortPinWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IPortPinWaveRT_fnSetSecurity( + IN IPortPinWaveRT* iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); +} + +/* + * @implemented + */ +BOOLEAN +NTAPI +IPortPinWaveRT_fnFastDeviceIoControl( + IN IPortPinWaveRT* iface, + IN PFILE_OBJECT FileObject, + IN BOOLEAN Wait, + IN PVOID InputBuffer, + IN ULONG InputBufferLength, + OUT PVOID OutputBuffer, + IN ULONG OutputBufferLength, + IN ULONG IoControlCode, + OUT PIO_STATUS_BLOCK StatusBlock, + IN PDEVICE_OBJECT DeviceObject) +{ + UNIMPLEMENTED + return FALSE; +} + +/* + * @implemented + */ +BOOLEAN +NTAPI +IPortPinWaveRT_fnFastRead( + IN IPortPinWaveRT* iface, + IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN BOOLEAN Wait, + IN ULONG LockKey, + IN PVOID Buffer, + OUT PIO_STATUS_BLOCK StatusBlock, + IN PDEVICE_OBJECT DeviceObject) +{ + NTSTATUS Status; + PCONTEXT_WRITE Packet; + PIRP Irp; + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)iface; + + DPRINT("IPortPinWaveRT_fnFastRead entered\n"); + + Packet = (PCONTEXT_WRITE)Buffer; + + Irp = Packet->Irp; + StatusBlock->Status = STATUS_PENDING; + + Status = This->IrpQueue->lpVtbl->AddMapping(This->IrpQueue, Buffer, Length, Irp); + + if (!NT_SUCCESS(Status)) + return FALSE; + + if (This->IrpQueue->lpVtbl->MinimumDataAvailable(This->IrpQueue) == TRUE && This->State != KSSTATE_RUN) + { + /* some should initiate a state request but didnt do it */ + DPRINT1("Starting stream with %lu mappings\n", This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue)); + + This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_RUN); + This->State = KSSTATE_RUN; + } + return TRUE; +} + +/* + * @implemented + */ +BOOLEAN +NTAPI +IPortPinWaveRT_fnFastWrite( + IN IPortPinWaveRT* iface, + IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN BOOLEAN Wait, + IN ULONG LockKey, + IN PVOID Buffer, + OUT PIO_STATUS_BLOCK StatusBlock, + IN PDEVICE_OBJECT DeviceObject) +{ + NTSTATUS Status; + PCONTEXT_WRITE Packet; + PIRP Irp; + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)iface; + + InterlockedIncrement((PLONG)&This->TotalPackets); + + DPRINT("IPortPinWaveRT_fnFastWrite entered Total %u Pre %u Post %u\n", This->TotalPackets, This->PreCompleted, This->PostCompleted); + + Packet = (PCONTEXT_WRITE)Buffer; + + + if (This->IrpQueue->lpVtbl->MinimumDataAvailable(This->IrpQueue)) + { + Irp = Packet->Irp; + StatusBlock->Status = STATUS_PENDING; + InterlockedIncrement((PLONG)&This->PostCompleted); + } + else + { + Irp = NULL; + Packet->Irp->IoStatus.Status = STATUS_SUCCESS; + Packet->Irp->IoStatus.Information = Packet->Header.FrameExtent; + IoCompleteRequest(Packet->Irp, IO_SOUND_INCREMENT); + StatusBlock->Status = STATUS_SUCCESS; + InterlockedIncrement((PLONG)&This->PreCompleted); + } + + Status = This->IrpQueue->lpVtbl->AddMapping(This->IrpQueue, Buffer, Length, Irp); + + if (!NT_SUCCESS(Status)) + return FALSE; + + if (This->IrpQueue->lpVtbl->MinimumDataAvailable(This->IrpQueue) == TRUE && This->State != KSSTATE_RUN) + { + SetStreamState(This, KSSTATE_RUN); + /* some should initiate a state request but didnt do it */ + DPRINT1("Starting stream with %lu mappings Status %x\n", This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue), Status); + } + + return TRUE; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IPortPinWaveRT_fnInit( + IN IPortPinWaveRT* iface, + IN PPORTWAVERT Port, + IN PPORTFILTERWAVERT Filter, + IN KSPIN_CONNECT * ConnectDetails, + IN KSPIN_DESCRIPTOR * KsPinDescriptor, + IN PDEVICE_OBJECT DeviceObject) +{ + NTSTATUS Status; + PKSDATAFORMAT DataFormat; + BOOL Capture; + KSRTAUDIO_HWLATENCY Latency; + IPortPinWaveRTImpl * This = (IPortPinWaveRTImpl*)iface; + + Port->lpVtbl->AddRef(Port); + Filter->lpVtbl->AddRef(Filter); + + This->Port = Port; + This->Filter = Filter; + This->KsPinDescriptor = KsPinDescriptor; + This->ConnectDetails = ConnectDetails; + This->Miniport = GetWaveRTMiniport(Port); + + DataFormat = (PKSDATAFORMAT)(ConnectDetails + 1); + + DPRINT("IPortPinWaveRT_fnInit entered\n"); + + This->Format = AllocateItem(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS); + if (!This->Format) + return STATUS_INSUFFICIENT_RESOURCES; + + RtlMoveMemory(This->Format, DataFormat, DataFormat->FormatSize); + + Status = NewIrpQueue(&This->IrpQueue); + if (!NT_SUCCESS(Status)) + { + goto cleanup; + } + + Status = This->IrpQueue->lpVtbl->Init(This->IrpQueue, ConnectDetails, DataFormat, DeviceObject, 0); + if (!NT_SUCCESS(Status)) + { + goto cleanup; + } + + Status = NewPortWaveRTStream(&This->PortStream); + if (!NT_SUCCESS(Status)) + { + goto cleanup; + } + + Status = PcNewServiceGroup(&This->ServiceGroup, NULL); + if (!NT_SUCCESS(Status)) + { + goto cleanup; + } + + This->ServiceGroup->lpVtbl->AddMember(This->ServiceGroup, (PSERVICESINK)&This->lpVtblServiceSink); + This->ServiceGroup->lpVtbl->SupportDelayedService(This->ServiceGroup); + + if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_IN) + { + Capture = FALSE; + } + else if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_OUT) + { + Capture = TRUE; + } + else + { + DPRINT1("Unexpected Communication %u DataFlow %u\n", KsPinDescriptor->Communication, KsPinDescriptor->DataFlow); + KeBugCheck(0); + } + + Status = This->Miniport->lpVtbl->NewStream(This->Miniport, + &This->Stream, + This->PortStream, + ConnectDetails->PinId, + Capture, + This->Format); + DPRINT("IPortPinWaveRT_fnInit Status %x\n", Status); + + if (!NT_SUCCESS(Status)) + goto cleanup; + + This->Stream->lpVtbl->GetHWLatency(This->Stream, &Latency); + /* minimum delay of 10 milisec */ + This->Delay = Int32x32To64(min(max(Latency.ChipsetDelay + Latency.CodecDelay + Latency.FifoSize, 10), 10), -10000); + + Status = This->Stream->lpVtbl->AllocateAudioBuffer(This->Stream, 16384, &This->Mdl, &This->CommonBufferSize, &This->CommonBufferOffset, &This->CacheType); + if (!NT_SUCCESS(Status)) + { + DPRINT1("AllocateAudioBuffer failed with %x\n", Status); + goto cleanup; + } + + This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_STOP); + This->State = KSSTATE_STOP; + This->Capture = Capture; + + This->Stream->lpVtbl->SetFormat(This->Stream, (PKSDATAFORMAT)This->Format); + return STATUS_SUCCESS; + +cleanup: + if (This->IrpQueue) + { + This->IrpQueue->lpVtbl->Release(This->IrpQueue); + This->IrpQueue = NULL; + } + + if (This->Format) + { + FreeItem(This->Format, TAG_PORTCLASS); + This->Format = NULL; + } + + if (This->ServiceGroup) + { + This->ServiceGroup->lpVtbl->Release(This->ServiceGroup); + This->ServiceGroup = NULL; + } + + if (This->PortStream) + { + This->PortStream->lpVtbl->Release(This->PortStream); + This->PortStream = NULL; + } + + return Status; +} + +static IPortPinWaveRTVtbl vt_IPortPinWaveRT = +{ + IPortPinWaveRT_fnQueryInterface, + IPortPinWaveRT_fnAddRef, + IPortPinWaveRT_fnRelease, + IPortPinWaveRT_fnNewIrpTarget, + IPortPinWaveRT_fnDeviceIoControl, + IPortPinWaveRT_fnRead, + IPortPinWaveRT_fnWrite, + IPortPinWaveRT_fnFlush, + IPortPinWaveRT_fnClose, + IPortPinWaveRT_fnQuerySecurity, + IPortPinWaveRT_fnSetSecurity, + IPortPinWaveRT_fnFastDeviceIoControl, + IPortPinWaveRT_fnFastRead, + IPortPinWaveRT_fnFastWrite, + IPortPinWaveRT_fnInit +}; + +NTSTATUS NewPortPinWaveRT( + OUT IPortPinWaveRT ** OutPin) +{ + IPortPinWaveRTImpl * This; + + This = AllocateItem(NonPagedPool, sizeof(IPortPinWaveRTImpl), TAG_PORTCLASS); + if (!This) + return STATUS_INSUFFICIENT_RESOURCES; + + /* initialize IPortPinWaveRT */ + This->ref = 1; + This->lpVtbl = &vt_IPortPinWaveRT; + This->lpVtblServiceSink = &vt_IServiceSink; + + /* store result */ + *OutPin = (IPortPinWaveRT*)&This->lpVtbl; + + return STATUS_SUCCESS; +} Propchange: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.c (added) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.c [iso-8859-1] Tue May 5 20:01:39 2009 @@ -1,0 +1,676 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel Streaming + * FILE: drivers/wdm/audio/backpln/portcls/port_wavert.c + * PURPOSE: WaveRT Port Driver + * PROGRAMMER: Johannes Anderwald + */ + +#include "private.h" + +typedef struct +{ + IPortWaveRTVtbl *lpVtbl; + IPortEventsVtbl *lpVbtlPortEvents; + IUnregisterSubdeviceVtbl *lpVtblUnregisterSubdevice; + IUnregisterPhysicalConnectionVtbl *lpVtblPhysicalConnection; + IPortEventsVtbl *lpVtblPortEvents; + ISubdeviceVtbl *lpVtblSubDevice; + + LONG ref; + + BOOL bInitialized; + PDEVICE_OBJECT pDeviceObject; + PMINIPORTWAVERT pMiniport; + PRESOURCELIST pResourceList; + PPINCOUNT pPinCount; + PPOWERNOTIFY pPowerNotify; + PPCFILTER_DESCRIPTOR pDescriptor; + PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor; + IPortFilterWaveRT * Filter; +}IPortWaveRTImpl; + +static GUID InterfaceGuids[3] = +{ + { + /// KSCATEGORY_RENDER + 0x65E8773EL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} + }, + { + /// KSCATEGORY_CAPTURE + 0x65E8773DL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} + }, + { + /// KS_CATEGORY_AUDIO + 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} + } +}; + +DEFINE_KSPROPERTY_TOPOLOGYSET(PortFilterWaveRTTopologySet, TopologyPropertyHandler); +DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PortFilterWaveRTPinSet, PinPropertyHandler, PinPropertyHandler, PinPropertyHandler); + +KSPROPERTY_SET WaveRTPropertySet[] = +{ + { + &KSPROPSETID_Topology, + sizeof(PortFilterWaveRTTopologySet) / sizeof(KSPROPERTY_ITEM), + (const KSPROPERTY_ITEM*)&PortFilterWaveRTTopologySet, + 0, + NULL + }, + { + &KSPROPSETID_Pin, + sizeof(PortFilterWaveRTPinSet) / sizeof(KSPROPERTY_ITEM), + (const KSPROPERTY_ITEM*)&PortFilterWaveRTPinSet, + 0, + NULL + } +}; + +//KSEVENTSETID_LoopedStreaming, Type = KSEVENT_LOOPEDSTREAMING_POSITION +//KSEVENTSETID_Connection, Type = KSEVENT_CONNECTION_ENDOFSTREAM, + + + +#if 0 +static const KSIDENTIFIER Identifiers[] = +{ + { + &KSINTERFACESETID_Standard, + 0, + 0 + }, + { + &KSINTERFACESETID_Standard, + 1, + 0 + } +}; +#endif + +//--------------------------------------------------------------- +// IPortEvents +// + +static +NTSTATUS +NTAPI +IPortEvents_fnQueryInterface( + IPortEvents* iface, + IN REFIID refiid, + OUT PVOID* Output) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblPortEvents); + + DPRINT("IPortEvents_fnQueryInterface entered\n"); + + if (IsEqualGUIDAligned(refiid, &IID_IPortEvents) || + IsEqualGUIDAligned(refiid, &IID_IUnknown)) + { + *Output = &This->lpVbtlPortEvents; + InterlockedIncrement(&This->ref); + return STATUS_SUCCESS; + } + return STATUS_UNSUCCESSFUL; +} + +static +ULONG +NTAPI +IPortEvents_fnAddRef( + IPortEvents* iface) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblPortEvents); + DPRINT("IPortEvents_fnQueryInterface entered\n"); + return InterlockedIncrement(&This->ref); +} + +static +ULONG +NTAPI +IPortEvents_fnRelease( + IPortEvents* iface) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblPortEvents); + + DPRINT("IPortEvents_fnRelease entered\n"); + InterlockedDecrement(&This->ref); + + if (This->ref == 0) + { + FreeItem(This, TAG_PORTCLASS); + return 0; + } + /* Return new reference count */ + return This->ref; +} + +static +void +NTAPI +IPortEvents_fnAddEventToEventList( + IPortEvents* iface, + IN PKSEVENT_ENTRY EventEntry) +{ + UNIMPLEMENTED +} + + +static +void +NTAPI +IPortEvents_fnGenerateEventList( + IPortEvents* iface, + IN GUID* Set OPTIONAL, + IN ULONG EventId, + IN BOOL PinEvent, + IN ULONG PinId, + IN BOOL NodeEvent, + IN ULONG NodeId) +{ + UNIMPLEMENTED +} + +static IPortEventsVtbl vt_IPortEvents = +{ + IPortEvents_fnQueryInterface, + IPortEvents_fnAddRef, + IPortEvents_fnRelease, + IPortEvents_fnAddEventToEventList, + IPortEvents_fnGenerateEventList +}; + +//--------------------------------------------------------------- +// IUnknown interface functions +// + +NTSTATUS +NTAPI +IPortWaveRT_fnQueryInterface( + IPortWaveRT* iface, + IN REFIID refiid, + OUT PVOID* Output) +{ + UNICODE_STRING GuidString; + IPortWaveRTImpl * This = (IPortWaveRTImpl*)iface; + + if (IsEqualGUIDAligned(refiid, &IID_IPortWaveRT) || + IsEqualGUIDAligned(refiid, &IID_IUnknown)) + { + *Output = &This->lpVtbl; + InterlockedIncrement(&This->ref); + return STATUS_SUCCESS; + } + else if (IsEqualGUIDAligned(refiid, &IID_IPortEvents)) + { + *Output = &This->lpVtblPortEvents; + InterlockedIncrement(&This->ref); + return STATUS_SUCCESS; + } + else if (IsEqualGUIDAligned(refiid, &IID_ISubdevice)) + { + *Output = &This->lpVtblSubDevice; + InterlockedIncrement(&This->ref); + return STATUS_SUCCESS; + } + else if (IsEqualGUIDAligned(refiid, &IID_IPortClsVersion)) + { + return NewPortClsVersion((PPORTCLSVERSION*)Output); + } + else if (IsEqualGUIDAligned(refiid, &IID_IDrmPort) || + IsEqualGUIDAligned(refiid, &IID_IDrmPort2)) + { + return NewIDrmPort((PDRMPORT2*)Output); + } + + if (RtlStringFromGUID(refiid, &GuidString) == STATUS_SUCCESS) + { + DPRINT1("IPortWaveRT_fnQueryInterface no interface!!! iface %S\n", GuidString.Buffer); + RtlFreeUnicodeString(&GuidString); + } + + return STATUS_UNSUCCESSFUL; +} + +ULONG +NTAPI +IPortWaveRT_fnAddRef( + IPortWaveRT* iface) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)iface; + + return InterlockedIncrement(&This->ref); +} + +ULONG +NTAPI +IPortWaveRT_fnRelease( + IPortWaveRT* iface) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)iface; + + InterlockedDecrement(&This->ref); + + if (This->ref == 0) + { + if (This->bInitialized) + { + This->pMiniport->lpVtbl->Release(This->pMiniport); + } + if (This->pPinCount) + This->pPinCount->lpVtbl->Release(This->pPinCount); + + if (This->pPowerNotify) + This->pPowerNotify->lpVtbl->Release(This->pPowerNotify); + + FreeItem(This, TAG_PORTCLASS); + return 0; + } + /* Return new reference count */ + return This->ref; +} + + +//--------------------------------------------------------------- +// IPort interface functions +// + +NTSTATUS +NTAPI +IPortWaveRT_fnGetDeviceProperty( + IN IPortWaveRT * iface, + IN DEVICE_REGISTRY_PROPERTY DeviceRegistryProperty, + IN ULONG BufferLength, + OUT PVOID PropertyBuffer, + OUT PULONG ReturnLength) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)iface; + ASSERT_IRQL_EQUAL(PASSIVE_LEVEL); + + if (!This->bInitialized) + { + DPRINT("IPortWaveRT_fnNewRegistryKey called w/o initiazed\n"); + return STATUS_UNSUCCESSFUL; + } + + return IoGetDeviceProperty(This->pDeviceObject, DeviceRegistryProperty, BufferLength, PropertyBuffer, ReturnLength); +} + +NTSTATUS +NTAPI +IPortWaveRT_fnInit( + IN IPortWaveRT * iface, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + IN PUNKNOWN UnknownMiniport, + IN PUNKNOWN UnknownAdapter OPTIONAL, + IN PRESOURCELIST ResourceList) +{ + IMiniportWaveRT * Miniport; + NTSTATUS Status; + PPINCOUNT PinCount; + PPOWERNOTIFY PowerNotify; + IPortWaveRTImpl * This = (IPortWaveRTImpl*)iface; + + DPRINT("IPortWaveRT_Init entered %p\n", This); + ASSERT_IRQL_EQUAL(PASSIVE_LEVEL); + + if (This->bInitialized) + { + DPRINT("IPortWaveRT_Init called again\n"); + return STATUS_SUCCESS; + } + + Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport, &IID_IMiniportWaveRT, (PVOID*)&Miniport); + if (!NT_SUCCESS(Status)) + { + DPRINT("IPortWaveRT_Init called with invalid IMiniport adapter\n"); + return STATUS_INVALID_PARAMETER; + } + + /* Initialize port object */ + This->pMiniport = Miniport; + This->pDeviceObject = DeviceObject; + This->bInitialized = TRUE; + This->pResourceList = ResourceList; + + /* increment reference on miniport adapter */ + Miniport->lpVtbl->AddRef(Miniport); + + Status = Miniport->lpVtbl->Init(Miniport, UnknownAdapter, ResourceList, iface); + if (!NT_SUCCESS(Status)) + { + DPRINT("IMiniportWaveRT_Init failed with %x\n", Status); + Miniport->lpVtbl->Release(Miniport); + This->bInitialized = FALSE; + return Status; + } + + + /* get the miniport device descriptor */ + Status = Miniport->lpVtbl->GetDescription(Miniport, &This->pDescriptor); + if (!NT_SUCCESS(Status)) + { + DPRINT1("failed to get description\n"); + Miniport->lpVtbl->Release(Miniport); + This->bInitialized = FALSE; + return Status; + } + + /* create the subdevice descriptor */ + Status = PcCreateSubdeviceDescriptor(&This->SubDeviceDescriptor, + 3, + InterfaceGuids, + 0, + NULL, + 2, + WaveRTPropertySet, + 0, + 0, + 0, + NULL, + 0, + NULL, + This->pDescriptor); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("PcCreateSubdeviceDescriptor failed with %x\n", Status); + Miniport->lpVtbl->Release(Miniport); + This->bInitialized = FALSE; + return Status; + } + + /* check if it supports IPinCount interface */ + Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport, &IID_IPinCount, (PVOID*)&PinCount); + if (NT_SUCCESS(Status)) + { + /* store IPinCount interface */ + This->pPinCount = PinCount; + } + + /* does the Miniport adapter support IPowerNotify interface*/ + Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport, &IID_IPowerNotify, (PVOID*)&PowerNotify); + if (NT_SUCCESS(Status)) + { + /* store reference */ + This->pPowerNotify = PowerNotify; + } + + /* increment reference on resource list */ + ResourceList->lpVtbl->AddRef(ResourceList); + + + DPRINT("IPortWaveRT successfully initialized\n"); + return STATUS_SUCCESS; +} + + +NTSTATUS +NTAPI +IPortWaveRT_fnNewRegistryKey( + IN IPortWaveRT * iface, + OUT PREGISTRYKEY *OutRegistryKey, + IN PUNKNOWN OuterUnknown OPTIONAL, + IN ULONG RegistryKeyType, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN ULONG CreateOptions OPTIONAL, + OUT PULONG Disposition OPTIONAL) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)iface; + + ASSERT_IRQL_EQUAL(PASSIVE_LEVEL); + + if (!This->bInitialized) + { + DPRINT("IPortWaveRT_fnNewRegistryKey called w/o initialized\n"); + return STATUS_UNSUCCESSFUL; + } + return PcNewRegistryKey(OutRegistryKey, OuterUnknown, RegistryKeyType, DesiredAccess, This->pDeviceObject, NULL /*FIXME*/, ObjectAttributes, CreateOptions, Disposition); +} + +static IPortWaveRTVtbl vt_IPortWaveRTVtbl = +{ + IPortWaveRT_fnQueryInterface, + IPortWaveRT_fnAddRef, + IPortWaveRT_fnRelease, + IPortWaveRT_fnInit, + IPortWaveRT_fnGetDeviceProperty, + IPortWaveRT_fnNewRegistryKey +}; + +//--------------------------------------------------------------- +// ISubdevice interface +// + +static +NTSTATUS +NTAPI +ISubDevice_fnQueryInterface( + IN ISubdevice *iface, + IN REFIID InterfaceId, + IN PVOID* Interface) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblSubDevice); + + return IPortWaveRT_fnQueryInterface((IPortWaveRT*)This, InterfaceId, Interface); +} + +static +ULONG +NTAPI +ISubDevice_fnAddRef( + IN ISubdevice *iface) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblSubDevice); + + return IPortWaveRT_fnAddRef((IPortWaveRT*)This); +} + +static +ULONG +NTAPI +ISubDevice_fnRelease( + IN ISubdevice *iface) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblSubDevice); + + return IPortWaveRT_fnRelease((IPortWaveRT*)This); +} + +static +NTSTATUS +NTAPI +ISubDevice_fnNewIrpTarget( + IN ISubdevice *iface, + OUT struct IIrpTarget **OutTarget, + IN WCHAR * Name, + IN PUNKNOWN Unknown, + IN POOL_TYPE PoolType, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + IN KSOBJECT_CREATE *CreateObject) +{ + NTSTATUS Status; + IPortFilterWaveRT * Filter; + IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblSubDevice); + + DPRINT("ISubDevice_NewIrpTarget this %p\n", This); + + if (This->Filter) + { + *OutTarget = (IIrpTarget*)This->Filter; + return STATUS_SUCCESS; + } + + + Status = NewPortFilterWaveRT(&Filter); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + Status = Filter->lpVtbl->Init(Filter, (IPortWaveRT*)This); + if (!NT_SUCCESS(Status)) + { + Filter->lpVtbl->Release(Filter); + return Status; + } + + *OutTarget = (IIrpTarget*)Filter; + return Status; +} + +static +NTSTATUS +NTAPI +ISubDevice_fnReleaseChildren( + IN ISubdevice *iface) +{ + //IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblSubDevice); + + UNIMPLEMENTED + return STATUS_UNSUCCESSFUL; +} + +static +NTSTATUS +NTAPI +ISubDevice_fnGetDescriptor( + IN ISubdevice *iface, + IN SUBDEVICE_DESCRIPTOR ** Descriptor) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblSubDevice); + + ASSERT(This->SubDeviceDescriptor != NULL); + + *Descriptor = This->SubDeviceDescriptor; + + DPRINT("ISubDevice_GetDescriptor this %p desc %p\n", This, This->SubDeviceDescriptor); + return STATUS_SUCCESS; +} + +static +NTSTATUS +NTAPI +ISubDevice_fnDataRangeIntersection( + IN ISubdevice *iface, + IN ULONG PinId, + IN PKSDATARANGE DataRange, + IN PKSDATARANGE MatchingDataRange, + IN ULONG OutputBufferLength, + OUT PVOID ResultantFormat OPTIONAL, + OUT PULONG ResultantFormatLength) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblSubDevice); + + DPRINT("ISubDevice_DataRangeIntersection this %p\n", This); + + if (This->pMiniport) + { + return This->pMiniport->lpVtbl->DataRangeIntersection (This->pMiniport, PinId, DataRange, MatchingDataRange, OutputBufferLength, ResultantFormat, ResultantFormatLength); + } + + return STATUS_UNSUCCESSFUL; +} + +static +NTSTATUS +NTAPI +ISubDevice_fnPowerChangeNotify( + IN ISubdevice *iface, + IN POWER_STATE PowerState) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblSubDevice); + + if (This->pPowerNotify) + { + This->pPowerNotify->lpVtbl->PowerChangeNotify(This->pPowerNotify, PowerState); + } + + return STATUS_SUCCESS; +} + +static +NTSTATUS +NTAPI +ISubDevice_fnPinCount( + IN ISubdevice *iface, + IN ULONG PinId, + IN OUT PULONG FilterNecessary, + IN OUT PULONG FilterCurrent, + IN OUT PULONG FilterPossible, + IN OUT PULONG GlobalCurrent, + IN OUT PULONG GlobalPossible) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl*)CONTAINING_RECORD(iface, IPortWaveRTImpl, lpVtblSubDevice); + + if (This->pPinCount) + { + This->pPinCount->lpVtbl->PinCount(This->pPinCount, PinId, FilterNecessary, FilterCurrent, FilterPossible, GlobalCurrent, GlobalPossible); + return STATUS_SUCCESS; + } + + /* FIXME + * scan filter descriptor + */ + return STATUS_UNSUCCESSFUL; +} + +static ISubdeviceVtbl vt_ISubdeviceVtbl = +{ + ISubDevice_fnQueryInterface, + ISubDevice_fnAddRef, + ISubDevice_fnRelease, + ISubDevice_fnNewIrpTarget, + ISubDevice_fnReleaseChildren, + ISubDevice_fnGetDescriptor, + ISubDevice_fnDataRangeIntersection, + ISubDevice_fnPowerChangeNotify, + ISubDevice_fnPinCount +}; + + +///-------------------------------------------------------------- +PMINIPORTWAVERT +GetWaveRTMiniport( + IN IPortWaveRT* iface) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl *)iface; + return This->pMiniport; +} + +PDEVICE_OBJECT +GetDeviceObjectFromPortWaveRT( + PPORTWAVERT iface) +{ + IPortWaveRTImpl * This = (IPortWaveRTImpl *)iface; + return This->pDeviceObject; +} + +//--------------------------------------------------------------- +// IPortWaveRT constructor +// + +NTSTATUS +NewPortWaveRT( + OUT PPORT* OutPort) +{ + IPortWaveRTImpl * This; + + This = AllocateItem(NonPagedPool, sizeof(IPortWaveRTImpl), TAG_PORTCLASS); + if (!This) + return STATUS_INSUFFICIENT_RESOURCES; + + This->lpVtbl = &vt_IPortWaveRTVtbl; + This->lpVtblSubDevice = &vt_ISubdeviceVtbl; + This->lpVtblPortEvents = &vt_IPortEvents; + This->ref = 1; + *OutPort = (PPORT)(&This->lpVtbl); + + DPRINT("NewPortWaveRT %p\n", *OutPort); + + return STATUS_SUCCESS; +} + Propchange: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavertstream.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavertstream.c (added) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavertstream.c [iso-8859-1] Tue May 5 20:01:39 2009 @@ -1,0 +1,247 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel Streaming + * FILE: drivers/wdm/audio/backpln/portcls/port_wavertstream.c + * PURPOSE: WaveRTStream helper object + * PROGRAMMER: Johannes Anderwald + */ + +#include "private.h" + +typedef struct +{ + IPortWaveRTStreamVtbl *lpVtbl; + LONG ref; + +}IPortWaveRTStreamImpl; + +/* + * @implemented + */ +static +NTSTATUS +NTAPI +IPortWaveRTStream_fnQueryInterface( + IPortWaveRTStream* iface, + IN REFIID refiid, + OUT PVOID* Output) +{ + IPortWaveRTStreamImpl * This = (IPortWaveRTStreamImpl*)iface; + + DPRINT("IPortWaveRTStream_fnQueryInterface entered\n"); + + if (IsEqualGUIDAligned(refiid, &IID_IPortWaveRTStream) || + IsEqualGUIDAligned(refiid, &IID_IUnknown)) + { + *Output = &This->lpVtbl; + InterlockedIncrement(&This->ref); + return STATUS_SUCCESS; + } + return STATUS_UNSUCCESSFUL; +} + +/* + * @implemented + */ +static +ULONG +NTAPI +IPortWaveRTStream_fnAddRef( + IPortWaveRTStream* iface) +{ + IPortWaveRTStreamImpl * This = (IPortWaveRTStreamImpl*)iface; + DPRINT("IPortWaveRTStream_fnAddRef entered\n"); + + return InterlockedIncrement(&This->ref); +} + +/* + * @implemented + */ +static +ULONG +NTAPI +IPortWaveRTStream_fnRelease( + IPortWaveRTStream* iface) +{ + IPortWaveRTStreamImpl * This = (IPortWaveRTStreamImpl*)iface; + + InterlockedDecrement(&This->ref); + + DPRINT("IPortWaveRTStream_fnRelease entered %u\n", This->ref); + + if (This->ref == 0) + { + FreeItem(This, TAG_PORTCLASS); + return 0; + } + /* Return new reference count */ + return This->ref; +} + +/* + * @implemented + */ +static +PMDL +NTAPI +IPortWaveRTStream_fnAllocatePagesForMdl( + IN IPortWaveRTStream* iface, + IN PHYSICAL_ADDRESS HighAddress, + IN SIZE_T TotalBytes) +{ + return MmAllocatePagesForMdl(RtlConvertUlongToLargeInteger(0), HighAddress, RtlConvertUlongToLargeInteger(0), TotalBytes); +} + +/* + * @implemented + */ +static +PMDL +NTAPI +IPortWaveRTStream_fnAllocateContiguousPagesForMdl( + IN IPortWaveRTStream* iface, + IN PHYSICAL_ADDRESS LowAddress, + IN PHYSICAL_ADDRESS HighAddress, + IN SIZE_T TotalBytes) +{ + PMDL Mdl; + PVOID Buffer; + PHYSICAL_ADDRESS Address; + + Buffer = MmAllocateContiguousMemorySpecifyCache(TotalBytes, LowAddress, HighAddress, RtlConvertUlongToLargeInteger(0), MmNonCached); + if (!Buffer) + { + DPRINT1("MmAllocateContiguousMemorySpecifyCache failed\n"); + return NULL; + } + + Address = MmGetPhysicalAddress(Buffer); + + MmFreeContiguousMemorySpecifyCache(Buffer, TotalBytes, MmNonCached); + + Mdl = MmAllocatePagesForMdl(Address, HighAddress, RtlConvertUlongToLargeInteger(0), TotalBytes); + if (!Mdl) + { + DPRINT1("MmAllocatePagesForMdl failed\n"); + return NULL; + } + + if (MmGetMdlByteCount(Mdl) < TotalBytes) + { + MmFreePagesFromMdl(Mdl); + ExFreePool(Mdl); + return NULL; + } + + return NULL; +} + +/* + * @implemented + */ +static +PVOID +NTAPI +IPortWaveRTStream_fnMapAllocatedPages( + IN IPortWaveRTStream* iface, + IN PMDL MemoryDescriptorList, + IN MEMORY_CACHING_TYPE CacheType) +{ + return MmMapLockedPagesSpecifyCache(MemoryDescriptorList, KernelMode, CacheType, NULL, 0, NormalPagePriority); +} + +/* + * @implemented + */ +static +VOID +NTAPI +IPortWaveRTStream_fnUnmapAllocatedPages( + IN IPortWaveRTStream* iface, + IN PVOID BaseAddress, + IN PMDL MemoryDescriptorList) +{ + MmUnmapLockedPages(BaseAddress, MemoryDescriptorList); +} + +/* + * @implemented + */ +static +VOID +NTAPI +IPortWaveRTStream_fnFreePagesFromMdl( + IN IPortWaveRTStream* iface, + IN PMDL MemoryDescriptorList) +{ + MmFreePagesFromMdl(MemoryDescriptorList); + ExFreePool(MemoryDescriptorList); +} + +/* + * @implemented + */ +static +ULONG +NTAPI +IPortWaveRTStream_fnGetPhysicalPagesCount( + IN IPortWaveRTStream* iface, + IN PMDL MemoryDescriptorList) +{ + return ADDRESS_AND_SIZE_TO_SPAN_PAGES(0, MmGetMdlByteCount(MemoryDescriptorList)); +} + +/* + * @implemented + */ +static +PHYSICAL_ADDRESS +NTAPI +IPortWaveRTStream_fnGetPhysicalPageAddress( + IN IPortWaveRTStream* iface, + IN PMDL MemoryDescriptorList, + IN ULONG Index) +{ + PVOID Buffer; + ULONG Pages; + + Pages = ADDRESS_AND_SIZE_TO_SPAN_PAGES(0, MmGetMdlByteCount(MemoryDescriptorList)); + if (Pages <= Index) + { + DPRINT1("OutOfBounds: Pages %u Index %u\n", Pages, Index); + return RtlConvertUlongToLargeInteger(0); + } + + Buffer = UlongToPtr(PtrToUlong(MmGetSystemAddressForMdl(MemoryDescriptorList)) + Index * PAGE_SIZE); + return MmGetPhysicalAddress(Buffer); +} + +static IPortWaveRTStreamVtbl vt_PortWaveRTStream = +{ + IPortWaveRTStream_fnQueryInterface, + IPortWaveRTStream_fnAddRef, + IPortWaveRTStream_fnRelease, + IPortWaveRTStream_fnAllocatePagesForMdl, + IPortWaveRTStream_fnAllocateContiguousPagesForMdl, + IPortWaveRTStream_fnMapAllocatedPages, + IPortWaveRTStream_fnUnmapAllocatedPages, + IPortWaveRTStream_fnFreePagesFromMdl, + IPortWaveRTStream_fnGetPhysicalPagesCount, + IPortWaveRTStream_fnGetPhysicalPageAddress +}; + +NTSTATUS +NewPortWaveRTStream( + PPORTWAVERTSTREAM *OutStream) +{ + IPortWaveRTStreamImpl* This = AllocateItem(NonPagedPool, sizeof(IPortWaveRTStreamImpl), TAG_PORTCLASS); + if (!This) + return STATUS_INSUFFICIENT_RESOURCES; + + This->ref = 1; + This->lpVtbl = &vt_PortWaveRTStream; + + *OutStream = (PPORTWAVERTSTREAM)&This->lpVtbl; + return STATUS_SUCCESS; +} Propchange: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavertstream.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] Tue May 5 20:01:39 2009 @@ -108,6 +108,25 @@ PMINIPORTWAVEPCI GetWavePciMiniport( PPORTWAVEPCI Port); + +NTSTATUS +NewPortFilterWaveRT( + OUT IPortFilterWaveRT ** OutFilter); + +NTSTATUS NewPortPinWaveRT( + OUT IPortPinWaveRT ** OutPin); + +PMINIPORTWAVERT +GetWaveRTMiniport( + IN IPortWaveRT* iface); + +PDEVICE_OBJECT +GetDeviceObjectFromPortWaveRT( + IPortWaveRT* iface); + +NTSTATUS +NewPortWaveRTStream( + PPORTWAVERTSTREAM *OutStream); NTSTATUS NTAPI
15 years, 8 months
1
0
0
0
[dchapyshev] 40796: - Sync gdiplus with Wine 1.1.20
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Tue May 5 19:35:05 2009 New Revision: 40796 URL:
http://svn.reactos.org/svn/reactos?rev=40796&view=rev
Log: - Sync gdiplus with Wine 1.1.20 Modified: trunk/reactos/dll/win32/gdiplus/font.c trunk/reactos/dll/win32/gdiplus/gdiplus.spec trunk/reactos/dll/win32/gdiplus/image.c Modified: trunk/reactos/dll/win32/gdiplus/font.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/font.c?r…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/font.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/font.c [iso-8859-1] Tue May 5 19:35:05 2009 @@ -224,9 +224,7 @@ if(!MultiByteToWideChar(CP_ACP, 0, lfa->lfFaceName, -1, lfw.lfFaceName, LF_FACESIZE)) return GenericError; - GdipCreateFontFromLogfontW(hdc, &lfw, font); - - return Ok; + return GdipCreateFontFromLogfontW(hdc, &lfw, font); } /******************************************************************************* @@ -301,7 +299,7 @@ * * RETURNS * SUCCESS: Ok - * FAILURE: InvalidParamter (font or size was NULL) + * FAILURE: InvalidParameter (font or size was NULL) * * NOTES * Size returned is actually emSize -- not internal size used for drawing. @@ -390,7 +388,7 @@ memcpy(lfa, &lfw, FIELD_OFFSET(LOGFONTA,lfFaceName) ); - if(!MultiByteToWideChar(CP_ACP, 0, lfa->lfFaceName, -1, lfw.lfFaceName, LF_FACESIZE)) + if(!WideCharToMultiByte(CP_ACP, 0, lfw.lfFaceName, -1, lfa->lfFaceName, LF_FACESIZE, NULL, NULL)) return GenericError; return Ok; Modified: trunk/reactos/dll/win32/gdiplus/gdiplus.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/gdiplus.…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/gdiplus.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/gdiplus.spec [iso-8859-1] Tue May 5 19:35:05 2009 @@ -43,7 +43,7 @@ @ stdcall GdipBitmapGetPixel(ptr long long ptr) @ stdcall GdipBitmapLockBits(ptr ptr long long ptr) @ stub GdipBitmapSetPixel -@ stub GdipBitmapSetResolution +@ stdcall GdipBitmapSetResolution(ptr long long) @ stdcall GdipBitmapUnlockBits(ptr ptr) @ stdcall GdipClearPathMarkers(ptr) @ stub GdipCloneBitmapArea Modified: trunk/reactos/dll/win32/gdiplus/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/image.c?…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/image.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/image.c [iso-8859-1] Tue May 5 19:35:05 2009 @@ -190,6 +190,13 @@ GdipFree(pbmi); return Ok; +} + +GpStatus WINGDIPAPI GdipBitmapSetResolution(GpBitmap* bitmap, REAL xdpi, REAL ydpi) +{ + FIXME("(%p, %.2f, %.2f)\n", bitmap, xdpi, ydpi); + + return NotImplemented; } GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
15 years, 8 months
1
0
0
0
[dchapyshev] 40795: - Sync ole32 and oleaut32 with Wine 1.1.20
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Tue May 5 19:31:02 2009 New Revision: 40795 URL:
http://svn.reactos.org/svn/reactos?rev=40795&view=rev
Log: - Sync ole32 and oleaut32 with Wine 1.1.20 Removed: trunk/reactos/dll/win32/ole32/version16.rc Modified: trunk/reactos/dll/win32/ole32/clipboard.c trunk/reactos/dll/win32/ole32/compobj.c trunk/reactos/dll/win32/ole32/compobj_private.h trunk/reactos/dll/win32/ole32/marshal.c trunk/reactos/dll/win32/ole32/moniker.c trunk/reactos/dll/win32/ole32/ole2impl.c trunk/reactos/dll/win32/ole32/ole32.spec trunk/reactos/dll/win32/ole32/rpc.c trunk/reactos/dll/win32/ole32/stg_prop.c trunk/reactos/dll/win32/ole32/storage32.c trunk/reactos/dll/win32/ole32/storage32.h trunk/reactos/dll/win32/ole32/stubmanager.c trunk/reactos/dll/win32/ole32/usrmarshal.c trunk/reactos/dll/win32/oleaut32/olepicture.c trunk/reactos/dll/win32/oleaut32/typelib.c trunk/reactos/dll/win32/oleaut32/typelib.h trunk/reactos/dll/win32/oleaut32/usrmarshal.c trunk/reactos/dll/win32/oleaut32/variant.c trunk/reactos/dll/win32/oleaut32/variant.h trunk/reactos/dll/win32/oleaut32/vartype.c trunk/reactos/include/psdk/objidl.idl [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/ole32/clipboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/clipboard.…
Modified: trunk/reactos/dll/win32/ole32/compobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compobj.c?…
Modified: trunk/reactos/dll/win32/ole32/compobj_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compobj_pr…
Modified: trunk/reactos/dll/win32/ole32/marshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/marshal.c?…
Modified: trunk/reactos/dll/win32/ole32/moniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/moniker.c?…
Modified: trunk/reactos/dll/win32/ole32/ole2impl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole2impl.c…
Modified: trunk/reactos/dll/win32/ole32/ole32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32.spec…
Modified: trunk/reactos/dll/win32/ole32/rpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/rpc.c?rev=…
Modified: trunk/reactos/dll/win32/ole32/stg_prop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stg_prop.c…
Modified: trunk/reactos/dll/win32/ole32/storage32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/storage32.…
Modified: trunk/reactos/dll/win32/ole32/storage32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/storage32.…
Modified: trunk/reactos/dll/win32/ole32/stubmanager.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stubmanage…
Modified: trunk/reactos/dll/win32/ole32/usrmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/usrmarshal…
Removed: trunk/reactos/dll/win32/ole32/version16.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/version16.…
Modified: trunk/reactos/dll/win32/oleaut32/olepicture.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/olepict…
Modified: trunk/reactos/dll/win32/oleaut32/typelib.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
Modified: trunk/reactos/dll/win32/oleaut32/typelib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
Modified: trunk/reactos/dll/win32/oleaut32/usrmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/usrmars…
Modified: trunk/reactos/dll/win32/oleaut32/variant.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/variant…
Modified: trunk/reactos/dll/win32/oleaut32/variant.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/variant…
Modified: trunk/reactos/dll/win32/oleaut32/vartype.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/vartype…
Modified: trunk/reactos/include/psdk/objidl.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/objidl.idl?re…
15 years, 8 months
1
0
0
0
[janderwald] 40794: - Add IPortWaveRT, IPortWaveRTStream, IMiniportWaveRTStream, IMiniportWaveRTStreamNotification, IMiniportWaveRT interface - Add KSAUDIO_POSITION, KSRTAUDIO_HWLATENCY, KSRTAUDIO_HWREGISTER structure
by janderwald@svn.reactos.org
Author: janderwald Date: Tue May 5 17:58:56 2009 New Revision: 40794 URL:
http://svn.reactos.org/svn/reactos?rev=40794&view=rev
Log: - Add IPortWaveRT, IPortWaveRTStream, IMiniportWaveRTStream, IMiniportWaveRTStreamNotification, IMiniportWaveRT interface - Add KSAUDIO_POSITION, KSRTAUDIO_HWLATENCY, KSRTAUDIO_HWREGISTER structure Modified: trunk/reactos/include/ddk/portcls.h trunk/reactos/include/psdk/ksmedia.h Modified: trunk/reactos/include/ddk/portcls.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/portcls.h?rev=…
============================================================================== --- trunk/reactos/include/ddk/portcls.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/portcls.h [iso-8859-1] Tue May 5 17:58:56 2009 @@ -1591,6 +1591,235 @@ typedef IMiniportWavePci *PMINIPORTWAVEPCI; + +#if !defined(DEFINE_ABSTRACT_MINIPORTWAVERTSTREAM) + +#define DEFINE_ABSTRACT_MINIPORTWAVERTSTREAM() \ + STDMETHOD_(NTSTATUS,SetFormat) \ + ( THIS_ \ + IN PKSDATAFORMAT DataFormat \ + ) PURE; \ + STDMETHOD_(NTSTATUS,SetState) \ + ( THIS_ \ + IN KSSTATE State \ + ) PURE; \ + STDMETHOD_(NTSTATUS,GetPosition) \ + ( THIS_ \ + OUT PKSAUDIO_POSITION Position \ + ) PURE; \ + STDMETHOD_(NTSTATUS,AllocateAudioBuffer) \ + ( THIS_ \ + IN ULONG RequestedSize, \ + OUT PMDL *AudioBufferMdl, \ + OUT ULONG *ActualSize, \ + OUT ULONG *OffsetFromFirstPage, \ + OUT MEMORY_CACHING_TYPE *CacheType \ + ) PURE; \ + STDMETHOD_(VOID,FreeAudioBuffer) \ + ( THIS_ \ + IN PMDL AudioBufferMdl, \ + IN ULONG BufferSize \ + ) PURE; \ + STDMETHOD_(VOID,GetHWLatency) \ + ( THIS_ \ + OUT KSRTAUDIO_HWLATENCY *hwLatency \ + ) PURE; \ + STDMETHOD_(NTSTATUS,GetPositionRegister) \ + ( THIS_ \ + OUT KSRTAUDIO_HWREGISTER *Register \ + ) PURE; \ + STDMETHOD_(NTSTATUS,GetClockRegister) \ + ( THIS_ \ + OUT KSRTAUDIO_HWREGISTER *Register \ + ) PURE; + +#endif + + +/* =============================================================== + IAdapterPowerManagement Interface +*/ + +#if (NTDDI_VERSION >= NTDDI_VISTA) +/* =============================================================== + IPortWaveRT Interface +*/ + +DEFINE_GUID(CLSID_PortWaveRT, 0xcc9be57a, 0xeb9e, 0x42b4, 0x94, 0xfc, 0xc, 0xad, 0x3d, 0xbc, 0xe7, 0xfa); +DEFINE_GUID(IID_IPortWaveRT, 0x339ff909, 0x68a9, 0x4310, 0xb0, 0x9b, 0x27, 0x4e, 0x96, 0xee, 0x4c, 0xbd); + +#undef INTERFACE +#define INTERFACE IPortWaveRT + +DECLARE_INTERFACE_(IPortWaveRT,IPort) +{ + DEFINE_ABSTRACT_UNKNOWN() // For IUnknown + + DEFINE_ABSTRACT_PORT() // For IPort +}; + +typedef IPortWaveRT *PPORTWAVERT; + + +/* =============================================================== + IPortWaveRTStream Interface +*/ + +#undef INTERFACE +#define INTERFACE IPortWaveRTStream + +DEFINE_GUID(IID_IPortWaveRTStream, 0x1809ce5a, 0x64bc, 0x4e62, 0xbd, 0x7d, 0x95, 0xbc, 0xe4, 0x3d, 0xe3, 0x93); + +DECLARE_INTERFACE_(IPortWaveRTStream, IUnknown) +{ + DEFINE_ABSTRACT_UNKNOWN() + + STDMETHOD_(PMDL, AllocatePagesForMdl) + ( THIS_ + IN PHYSICAL_ADDRESS HighAddress, + IN SIZE_T TotalBytes + ) PURE; + + STDMETHOD_(PMDL, AllocateContiguousPagesForMdl) + ( THIS_ + IN PHYSICAL_ADDRESS LowAddress, + IN PHYSICAL_ADDRESS HighAddress, + IN SIZE_T TotalBytes + ) PURE; + + STDMETHOD_(PVOID, MapAllocatedPages) + ( THIS_ + IN PMDL MemoryDescriptorList, + IN MEMORY_CACHING_TYPE CacheType + ) PURE; + + STDMETHOD_(VOID, UnmapAllocatedPages) + ( THIS_ + IN PVOID BaseAddress, + IN PMDL MemoryDescriptorList + ) PURE; + + STDMETHOD_(VOID, FreePagesFromMdl) + ( THIS_ + IN PMDL MemoryDescriptorList + ) PURE; + + STDMETHOD_(ULONG, GetPhysicalPagesCount) + ( THIS_ + IN PMDL MemoryDescriptorList + ) PURE; + + STDMETHOD_(PHYSICAL_ADDRESS, GetPhysicalPageAddress) + ( THIS_ + IN PMDL MemoryDescriptorList, + IN ULONG Index + ) PURE; +}; + +typedef IPortWaveRTStream *PPORTWAVERTSTREAM; + + +/* =============================================================== + IMiniportWaveRTStream Interface +*/ + +#undef INTERFACE +#define INTERFACE IMiniportWaveRTStream + +DEFINE_GUID(IID_IMiniportWaveRTStream, 0xac9ab, 0xfaab, 0x4f3d, 0x94, 0x55, 0x6f, 0xf8, 0x30, 0x6a, 0x74, 0xa0); + +DECLARE_INTERFACE_(IMiniportWaveRTStream, IUnknown) +{ + DEFINE_ABSTRACT_UNKNOWN() + DEFINE_ABSTRACT_MINIPORTWAVERTSTREAM() +}; + +typedef IMiniportWaveRTStream *PMINIPORTWAVERTSTREAM; + + +/* =============================================================== + IMiniportWaveRTStreamNotification Interface +*/ + +#undef INTERFACE +#define INTERFACE IMiniportWaveRTStreamNotification + +DEFINE_GUID(IID_IMiniportWaveRTStreamNotification, 0x23759128, 0x96f1, 0x423b, 0xab, 0x4d, 0x81, 0x63, 0x5b, 0xcf, 0x8c, 0xa1); + +DECLARE_INTERFACE_(IMiniportWaveRTStreamNotification, IMiniportWaveRTStream) +{ + DEFINE_ABSTRACT_UNKNOWN() + + DEFINE_ABSTRACT_MINIPORTWAVERTSTREAM() + + STDMETHOD_(NTSTATUS,AllocateBufferWithNotification) + ( THIS_ + IN ULONG NotificationCount, + IN ULONG RequestedSize, + OUT PMDL *AudioBufferMdl, + OUT ULONG *ActualSize, + OUT ULONG *OffsetFromFirstPage, + OUT MEMORY_CACHING_TYPE *CacheType + ) PURE; + + STDMETHOD_(VOID,FreeBufferWithNotification) + ( THIS_ + IN PMDL AudioBufferMdl, + IN ULONG BufferSize + ) PURE; + + STDMETHOD_(NTSTATUS,RegisterNotificationEvent) + ( THIS_ + IN PKEVENT NotificationEvent + ) PURE; + + STDMETHOD_(NTSTATUS,UnregisterNotificationEvent) + ( THIS_ + IN PKEVENT NotificationEvent + ) PURE; +}; + +/* =============================================================== + IMiniportWaveRT Interface +*/ + +#undef INTERFACE +#define INTERFACE IMiniportWaveRT + +DEFINE_GUID(IID_IMiniportWaveRT, 0xf9fc4d6, 0x6061, 0x4f3c, 0xb1, 0xfc, 0x7, 0x5e, 0x35, 0xf7, 0x96, 0xa); + +DECLARE_INTERFACE_(IMiniportWaveRT, IMiniport) +{ + DEFINE_ABSTRACT_UNKNOWN() + + DEFINE_ABSTRACT_MINIPORT() + + STDMETHOD_(NTSTATUS,Init) + ( THIS_ + IN PUNKNOWN UnknownAdapter, + IN PRESOURCELIST ResourceList, + IN PPORTWAVERT Port + ) PURE; + + STDMETHOD_(NTSTATUS,NewStream) + ( THIS_ + OUT PMINIPORTWAVERTSTREAM * Stream, + IN PPORTWAVERTSTREAM PortStream, + IN ULONG Pin, + IN BOOLEAN Capture, + IN PKSDATAFORMAT DataFormat + ) PURE; + + STDMETHOD_(NTSTATUS,GetDeviceDescription) + ( THIS_ + OUT PDEVICE_DESCRIPTION DeviceDescription + ) PURE; +}; + +typedef IMiniportWaveRT *PMINIPORTWAVERT; + +#endif + /* =============================================================== IAdapterPowerManagement Interface */ Modified: trunk/reactos/include/psdk/ksmedia.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ksmedia.h?rev…
============================================================================== --- trunk/reactos/include/psdk/ksmedia.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ksmedia.h [iso-8859-1] Tue May 5 17:58:56 2009 @@ -575,4 +575,28 @@ ULONG Reserved; } KSNODEPROPERTY_AUDIO_CHANNEL, *PKSNODEPROPERTY_AUDIO_CHANNEL; +typedef struct { +#if defined(_NTDDK_) + ULONGLONG PlayOffset; + ULONGLONG WriteOffset; +#else + DWORDLONG PlayOffset; + DWORDLONG WriteOffset; #endif +} KSAUDIO_POSITION, *PKSAUDIO_POSITION; + +typedef struct { + ULONG FifoSize; + ULONG ChipsetDelay; + ULONG CodecDelay; +} KSRTAUDIO_HWLATENCY, *PKSRTAUDIO_HWLATENCY; + +typedef struct { + PVOID Register; + ULONG Width; + ULONGLONG Numerator; + ULONGLONG Denominator; + ULONG Accuracy; +} KSRTAUDIO_HWREGISTER, *PKSRTAUDIO_HWREGISTER; + +#endif
15 years, 8 months
1
0
0
0
[cgutman] 40793: - Implement handing for IRP_MN_SET_POWER and IRP_MN_QUERY_POWER (not plugged in yet) - Allocate a buffer and copy data into it instead of using the buffer passed to us directly - Use a helper function to perform common operations which save lots of lines of duplicated code
by cgutman@svn.reactos.org
Author: cgutman Date: Tue May 5 06:52:43 2009 New Revision: 40793 URL:
http://svn.reactos.org/svn/reactos?rev=40793&view=rev
Log: - Implement handing for IRP_MN_SET_POWER and IRP_MN_QUERY_POWER (not plugged in yet) - Allocate a buffer and copy data into it instead of using the buffer passed to us directly - Use a helper function to perform common operations which save lots of lines of duplicated code Modified: trunk/reactos/drivers/network/ndis/ndis/miniport.c trunk/reactos/drivers/network/ndis/ndis/protocol.c Modified: trunk/reactos/drivers/network/ndis/ndis/miniport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
============================================================================== --- trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Tue May 5 06:52:43 2009 @@ -2838,6 +2838,7 @@ if (Status != NDIS_STATUS_SUCCESS) { + if (NetPnPEvent->Buffer) ExFreePool(NetPnPEvent->Buffer); ExFreePool(NetPnPEvent); Irp->IoStatus.Status = Status; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -2859,6 +2860,7 @@ } else if (NdisStatus != NDIS_STATUS_SUCCESS) { + if (NetPnPEvent->Buffer) ExFreePool(NetPnPEvent->Buffer); ExFreePool(NetPnPEvent); Irp->IoStatus.Status = NdisStatus; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -2868,6 +2870,7 @@ CurrentEntry = CurrentEntry->Flink; } + if (NetPnPEvent->Buffer) ExFreePool(NetPnPEvent->Buffer); ExFreePool(NetPnPEvent); Irp->IoStatus.Status = NDIS_STATUS_SUCCESS; Modified: trunk/reactos/drivers/network/ndis/ndis/protocol.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
============================================================================== --- trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] Tue May 5 06:52:43 2009 @@ -37,27 +37,33 @@ RtlZeroMemory(PnPEvent, sizeof(NET_PNP_EVENT)); PnPEvent->NetEvent = EventCode; - PnPEvent->Buffer = EventBuffer; - PnPEvent->BufferLength = EventBufferLength; + + if (EventBuffer != NULL) + { + PnPEvent->Buffer = ExAllocatePool(PagedPool, EventBufferLength); + if (!PnPEvent->Buffer) + { + ExFreePool(PnPEvent); + return NULL; + } + + PnPEvent->BufferLength = EventBufferLength; + + RtlCopyMemory(PnPEvent->Buffer, EventBuffer, PnPEvent->BufferLength); + } return PnPEvent; } -NTSTATUS -NTAPI -NdisIPnPQueryStopDevice( - IN PDEVICE_OBJECT DeviceObject, - PIRP Irp) +NDIS_STATUS +ProSendAndFreePnPEvent( + PLOGICAL_ADAPTER Adapter, + PNET_PNP_EVENT PnPEvent, + PIRP Irp) { PLIST_ENTRY CurrentEntry; + NDIS_STATUS Status; PADAPTER_BINDING AdapterBinding; - PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)DeviceObject->DeviceExtension; - PNET_PNP_EVENT PnPEvent; - NDIS_STATUS Status; - - PnPEvent = ProSetupPnPEvent(NetEventQueryRemoveDevice, NULL, 0); - if (!PnPEvent) - return NDIS_STATUS_RESOURCES; CurrentEntry = Adapter->ProtocolListHead.Flink; @@ -79,7 +85,7 @@ } else if (Status != NDIS_STATUS_SUCCESS) { - /* One protocol failed so we can fail the query stop device IRP */ + if (PnPEvent->Buffer) ExFreePool(PnPEvent->Buffer); ExFreePool(PnPEvent); return Status; } @@ -87,9 +93,65 @@ CurrentEntry = CurrentEntry->Flink; } + if (PnPEvent->Buffer) ExFreePool(PnPEvent->Buffer); ExFreePool(PnPEvent); return NDIS_STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +NdisIPwrSetPower( + IN PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)DeviceObject->DeviceExtension; + PNET_PNP_EVENT PnPEvent; + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + + ASSERT(Stack->Parameters.Power.Type == DevicePowerState); + + PnPEvent = ProSetupPnPEvent(NetEventSetPower, &Stack->Parameters.Power.State, sizeof(NDIS_DEVICE_POWER_STATE)); + if (!PnPEvent) + return NDIS_STATUS_RESOURCES; + + return ProSendAndFreePnPEvent(Adapter, PnPEvent, Irp); +} + +NTSTATUS +NTAPI +NdisIPwrQueryPower( + IN PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)DeviceObject->DeviceExtension; + PNET_PNP_EVENT PnPEvent; + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + + ASSERT(Stack->Parameters.Power.Type == DevicePowerState); + + PnPEvent = ProSetupPnPEvent(NetEventQueryPower, &Stack->Parameters.Power.State, sizeof(NDIS_DEVICE_POWER_STATE)); + if (!PnPEvent) + return NDIS_STATUS_RESOURCES; + + return ProSendAndFreePnPEvent(Adapter, PnPEvent, Irp); +} + + +NTSTATUS +NTAPI +NdisIPnPQueryStopDevice( + IN PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)DeviceObject->DeviceExtension; + PNET_PNP_EVENT PnPEvent; + + PnPEvent = ProSetupPnPEvent(NetEventQueryRemoveDevice, NULL, 0); + if (!PnPEvent) + return NDIS_STATUS_RESOURCES; + + return ProSendAndFreePnPEvent(Adapter, PnPEvent, Irp); } NTSTATUS @@ -98,42 +160,14 @@ IN PDEVICE_OBJECT DeviceObject, PIRP Irp) { - PLIST_ENTRY CurrentEntry; - PADAPTER_BINDING AdapterBinding; PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)DeviceObject->DeviceExtension; PNET_PNP_EVENT PnPEvent; - NDIS_STATUS Status; PnPEvent = ProSetupPnPEvent(NetEventCancelRemoveDevice, NULL, 0); if (!PnPEvent) return NDIS_STATUS_RESOURCES; - CurrentEntry = Adapter->ProtocolListHead.Flink; - - while (CurrentEntry != &Adapter->ProtocolListHead) - { - AdapterBinding = CONTAINING_RECORD(CurrentEntry, ADAPTER_BINDING, AdapterListEntry); - - Status = (*AdapterBinding->ProtocolBinding->Chars.PnPEventHandler)( - AdapterBinding->NdisOpenBlock.ProtocolBindingContext, - PnPEvent); - - if (Status == NDIS_STATUS_PENDING) - { - IoMarkIrpPending(Irp); - PnPEvent->NdisReserved[0] = (ULONG_PTR)Irp; - PnPEvent->NdisReserved[1] = (ULONG_PTR)CurrentEntry->Flink; - return NDIS_STATUS_PENDING; - } - - ASSERT(Status == NDIS_STATUS_SUCCESS); - - CurrentEntry = CurrentEntry->Flink; - } - - ExFreePool(PnPEvent); - - return NDIS_STATUS_SUCCESS; + return ProSendAndFreePnPEvent(Adapter, PnPEvent, Irp); }
15 years, 8 months
1
0
0
0
← Newer
1
...
43
44
45
46
47
48
49
50
51
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Results per page:
10
25
50
100
200