ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2010
----- 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
19 participants
896 discussions
Start a n
N
ew thread
[jimtabor] 45847: - [User32] Sync controls to wine 1.1.39.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Fri Mar 5 00:25:30 2010 New Revision: 45847 URL:
http://svn.reactos.org/svn/reactos?rev=45847&view=rev
Log: - [User32] Sync controls to wine 1.1.39. Modified: trunk/reactos/dll/win32/user32/controls/button.c trunk/reactos/dll/win32/user32/controls/combo.c trunk/reactos/dll/win32/user32/controls/icontitle.c trunk/reactos/dll/win32/user32/controls/listbox.c trunk/reactos/dll/win32/user32/controls/scrollbar.c trunk/reactos/dll/win32/user32/controls/static.c trunk/reactos/include/psdk/winuser.h trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/user32/controls/button.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/button.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/button.c [iso-8859-1] Fri Mar 5 00:25:30 2010 @@ -102,8 +102,6 @@ static void UB_Paint( HWND hwnd, HDC hDC, UINT action ); static void OB_Paint( HWND hwnd, HDC hDC, UINT action ); static void BUTTON_CheckAutoRadioButton( HWND hwnd ); -//static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); -//static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); #define MAX_BTN_TYPE 12 @@ -291,6 +289,13 @@ } if (btn_type >= MAX_BTN_TYPE) return -1; /* abort */ + + /* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */ + if (btn_type == BS_USERBUTTON ) + { + style = (style & ~0x0f) | BS_PUSHBUTTON; + SetWindowLongPtrW( hWnd, GWL_STYLE, style ); + } set_button_state( hWnd, BUTTON_UNCHECKED ); button_update_uistate( hWnd, unicode ); return 0; @@ -474,9 +479,6 @@ InvalidateRect( hWnd, NULL, FALSE ); break; -#ifndef __REACTOS__ - case BM_SETSTYLE16: -#endif case BM_SETSTYLE: if ((wParam & 0x0f) >= MAX_BTN_TYPE) break; btn_type = wParam & 0x0f; @@ -485,7 +487,7 @@ /* Only redraw if lParam flag is set.*/ if (lParam) - paint_button( hWnd, btn_type, ODA_DRAWENTIRE ); + InvalidateRect( hWnd, NULL, TRUE ); break; @@ -514,15 +516,9 @@ case BM_GETIMAGE: return GetWindowLongPtrW( hWnd, HIMAGE_GWL_OFFSET ); -#ifndef __REACTOS__ - case BM_GETCHECK16: -#endif case BM_GETCHECK: return get_button_state( hWnd ) & 3; -#ifndef __REACTOS__ - case BM_SETCHECK16: -#endif case BM_SETCHECK: if (wParam > maxCheckState[btn_type]) wParam = maxCheckState[btn_type]; state = get_button_state( hWnd ); @@ -541,15 +537,9 @@ BUTTON_CheckAutoRadioButton( hWnd ); break; -#ifndef __REACTOS__ - case BM_GETSTATE16: -#endif case BM_GETSTATE: return get_button_state( hWnd ); -#ifndef __REACTOS__ - case BM_SETSTATE16: -#endif case BM_SETSTATE: state = get_button_state( hWnd ); if (wParam) @@ -871,9 +861,15 @@ if (get_button_type(style) == BS_DEFPUSHBUTTON) { - Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); + if (action != ODA_FOCUS) + Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); InflateRect( &rc, -1, -1 ); } + + focus_rect = rc; + + /* completely skip the drawing if only focus has changed */ + if (action == ODA_FOCUS) goto draw_focus; uState = DFCS_BUTTONPUSH | DFCS_ADJUSTRECT; @@ -892,8 +888,6 @@ DrawFrameControl( hDC, &rc, DFC_BUTTON, uState ); - focus_rect = rc; - /* draw button label */ r = rc; dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &r); @@ -912,7 +906,9 @@ SetTextColor( hDC, oldTxtColor ); - if (state & BUTTON_HASFOCUS) +draw_focus: + if ((action == ODA_FOCUS) || + ((action == ODA_DRAWENTIRE) && (state & BUTTON_HASFOCUS))) { if (!(get_ui_state(hwnd) & UISF_HIDEFOCUS)) { @@ -1165,6 +1161,8 @@ if (!(get_ui_state(hwnd) & UISF_HIDEFOCUS)) DrawFocusRect( hDC, &rc ); } + + BUTTON_NOTIFY_PARENT( hwnd, BN_PAINT ); } Modified: trunk/reactos/dll/win32/user32/controls/combo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/combo.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/combo.c [iso-8859-1] Fri Mar 5 00:25:30 2010 @@ -73,9 +73,6 @@ #define COMBO_YBORDERSIZE() 2 #define COMBO_EDITBUTTONSPACE() 0 #define EDIT_CONTROL_PADDING() 1 - -//static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); -//static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); /********************************************************************* * combo class descriptor Modified: trunk/reactos/dll/win32/user32/controls/icontitle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/icontitle.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/icontitle.c [iso-8859-1] Fri Mar 5 00:25:30 2010 @@ -29,8 +29,6 @@ static BOOL bMultiLineTitle; static HFONT hIconTitleFont; - -//static LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); /********************************************************************* * icon title class descriptor Modified: trunk/reactos/dll/win32/user32/controls/listbox.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/listbox.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/listbox.c [iso-8859-1] Fri Mar 5 00:25:30 2010 @@ -39,13 +39,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(listbox); /* Start of hack section -------------------------------- */ - -typedef short *LPINT16; - -BOOL is_old_app(HWND hwnd) -{ - return FALSE; -} #define WM_LBTRACKPOINT 0x0131 #define WS_EX_DRAGDETECT 0x00000002L @@ -105,7 +98,7 @@ HFONT font; /* Current font */ LCID locale; /* Current locale for string comparisons */ LPHEADCOMBO lphc; /* ComboLBox */ - LONG UIState; + LONG UIState; // REACTOS } LB_DESCR; @@ -137,9 +130,6 @@ } TIMER_DIRECTION; static TIMER_DIRECTION LISTBOX_Timer = LB_TIMER_NONE; - -//static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam,LPARAM lParam ); -//static LRESULT WINAPI ListBoxWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); static LRESULT LISTBOX_GetItemRect( const LB_DESCR *descr, INT index, RECT *rect ); @@ -173,14 +163,6 @@ IDC_ARROW, /* cursor */ 0 /* brush */ }; - -#ifndef __REACTOS__ -/* check whether app is a Win 3.1 app */ -static inline BOOL is_old_app( LB_DESCR *descr ) -{ - return (GetExpWinVer16( GetWindowLongPtrW(descr->self, GWLP_HINSTANCE) ) & 0xFF00 ) == 0x0300; -} -#endif /*********************************************************************** @@ -409,16 +391,6 @@ remaining = 0; if ((descr->height > descr->item_height) && remaining) { -#ifndef __REACTOS__ - if (is_old_app(descr)) - { /* give a margin for error to 16 bits programs - if we need - less than the height of the nonclient area, round to the - *next* number of items */ - int ncheight = rect.bottom - rect.top - descr->height; - if ((descr->item_height - remaining) <= ncheight) - remaining = remaining - descr->item_height; - } -#endif TRACE("[%p]: changing height %d -> %d\n", descr->self, descr->height, descr->height - remaining ); SetWindowPos( descr->self, 0, 0, 0, rect.right - rect.left, @@ -565,10 +537,10 @@ if (!item) { if (action == ODA_FOCUS) - { - if (!(descr->UIState & UISF_HIDEFOCUS)) - DrawFocusRect( hdc, rect ); - } + { // REACTOS + if (!(descr->UIState & UISF_HIDEFOCUS)) + DrawFocusRect( hdc, rect ); + } // else ERR("called with an out of bounds index %d(%d) in owner draw, Not good.\n",index,descr->nb_items); return; @@ -608,7 +580,7 @@ if (action == ODA_FOCUS) { - if (!(descr->UIState & UISF_HIDEFOCUS)) + if (!(descr->UIState & UISF_HIDEFOCUS)) // REACTOS DrawFocusRect( hdc, rect ); return; } @@ -771,7 +743,7 @@ /*********************************************************************** * LISTBOX_SetTabStops */ -static BOOL LISTBOX_SetTabStops( LB_DESCR *descr, INT count, LPINT tabs, BOOL short_ints ) +static BOOL LISTBOX_SetTabStops( LB_DESCR *descr, INT count, LPINT tabs ) { INT i; @@ -790,23 +762,7 @@ if (!(descr->tabs = HeapAlloc( GetProcessHeap(), 0, descr->nb_tabs * sizeof(INT) ))) return FALSE; -#ifndef __REACTOS__ - if (short_ints) - { - INT i; - LPINT16 p = (LPINT16)tabs; - - TRACE("[%p]: settabstops ", descr->self ); - for (i = 0; i < descr->nb_tabs; i++) { - descr->tabs[i] = *p++<<1; /* FIXME */ - TRACE("%hd ", descr->tabs[i]); - } - TRACE("\n"); - } - else memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(INT) ); -#else - memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(INT) ); -#endif + memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(INT) ); /* convert into "dialog units"*/ for (i = 0; i < descr->nb_tabs; i++) @@ -1049,23 +1005,6 @@ } -#ifndef __REACTOS__ -/*********************************************************************** - * LISTBOX_GetSelItems16 - */ -static LRESULT LISTBOX_GetSelItems16( const LB_DESCR *descr, INT16 max, LPINT16 array ) -{ - INT i, count; - const LB_ITEMDATA *item = descr->items; - - if (!(descr->style & LBS_MULTIPLESEL)) return LB_ERR; - for (i = count = 0; (i < descr->nb_items) && (count < max); i++, item++) - if (item->selected) array[count++] = (INT16)i; - return count; -} -#endif - - /*********************************************************************** * LISTBOX_GetSelItems */ @@ -1595,15 +1534,8 @@ /* We need to grow the array */ max_items += LB_ARRAY_GRANULARITY; if (descr->items) - { item = HeapReAlloc( GetProcessHeap(), 0, descr->items, max_items * sizeof(LB_ITEMDATA) ); - if (!item) - { - SEND_NOTIFICATION( descr, LBN_ERRSPACE ); - return LB_ERRSPACE; - } - } else item = HeapAlloc( GetProcessHeap(), 0, max_items * sizeof(LB_ITEMDATA) ); @@ -2166,7 +2098,7 @@ } if (!descr->lphc) - { + { // See rev 40864 use Ptr for 64 bit. if (GetWindowLongPtrW( descr->self, GWL_EXSTYLE ) & WS_EX_DRAGDETECT) { POINT pt; @@ -2539,7 +2471,7 @@ return 0; } -/* Retrieve the UI state for the control */ +/* ReactOS Retrieve the UI state for the control */ static BOOL LISTBOX_update_uistate(LB_DESCR *descr) { LONG prev_flags; @@ -2589,18 +2521,6 @@ descr->locale = GetUserDefaultLCID(); descr->lphc = lphc; -#ifndef __REACTOS__ - if (is_old_app(descr) && ( descr->style & ( WS_VSCROLL | WS_HSCROLL ) ) ) - { - /* Win95 document "List Box Differences" from MSDN: - If a list box in a version 3.x application has either the - WS_HSCROLL or WS_VSCROLL style, the list box receives both - horizontal and vertical scroll bars. - */ - descr->style |= WS_VSCROLL | WS_HSCROLL; - } -#endif - if( lphc ) { TRACE("[%p]: resetting owner %p -> %p\n", descr->self, descr->owner, lphc->self ); @@ -2609,7 +2529,7 @@ SetWindowLongPtrW( descr->self, 0, (LONG_PTR)descr ); - LISTBOX_update_uistate(descr); + LISTBOX_update_uistate(descr); // ReactOS /* if (wnd->dwExStyle & WS_EX_NOPARENTNOTIFY) descr->style &= ~LBS_NOTIFY; */ @@ -2689,20 +2609,12 @@ switch(msg) { -#ifndef __REACTOS__ - case LB_RESETCONTENT16: -#endif case LB_RESETCONTENT: LISTBOX_ResetContent( descr ); LISTBOX_UpdateScroll( descr ); InvalidateRect( descr->self, NULL, TRUE ); return 0; -#ifndef __REACTOS__ - case LB_ADDSTRING16: - if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam); - /* fall through */ -#endif case LB_ADDSTRING: case LB_ADDSTRING_LOWER: case LB_ADDSTRING_UPPER: @@ -2733,12 +2645,6 @@ return ret; } -#ifndef __REACTOS__ - case LB_INSERTSTRING16: - if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam); - wParam = (INT)(INT16)wParam; - /* fall through */ -#endif case LB_INSERTSTRING: case LB_INSERTSTRING_UPPER: case LB_INSERTSTRING_LOWER: @@ -2768,11 +2674,6 @@ return ret; } -#ifndef __REACTOS__ - case LB_ADDFILE16: - if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam); - /* fall through */ -#endif case LB_ADDFILE: { INT ret; @@ -2795,9 +2696,6 @@ return ret; } -#ifndef __REACTOS__ - case LB_DELETESTRING16: -#endif case LB_DELETESTRING: if (LISTBOX_RemoveItem( descr, wParam) != LB_ERR) return descr->nb_items; @@ -2807,9 +2705,6 @@ return LB_ERR; } -#ifndef __REACTOS__ - case LB_GETITEMDATA16: -#endif case LB_GETITEMDATA: if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items)) { @@ -2818,9 +2713,6 @@ } return descr->items[wParam].data; -#ifndef __REACTOS__ - case LB_SETITEMDATA16: -#endif case LB_SETITEMDATA: if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items)) { @@ -2831,24 +2723,12 @@ /* undocumented: returns TRUE, not LB_OKAY (0) */ return TRUE; -#ifndef __REACTOS__ - case LB_GETCOUNT16: -#endif case LB_GETCOUNT: return descr->nb_items; -#ifndef __REACTOS__ - case LB_GETTEXT16: - lParam = (LPARAM)MapSL(lParam); - /* fall through */ -#endif case LB_GETTEXT: return LISTBOX_GetText( descr, wParam, (LPWSTR)lParam, unicode ); -#ifndef __REACTOS__ - case LB_GETTEXTLEN16: - /* fall through */ -#endif case LB_GETTEXTLEN: if ((INT)wParam >= descr->nb_items || (INT)wParam < 0) { @@ -2860,9 +2740,6 @@ return WideCharToMultiByte( CP_ACP, 0, descr->items[wParam].str, strlenW(descr->items[wParam].str), NULL, 0, NULL, NULL ); -#ifndef __REACTOS__ - case LB_GETCURSEL16: -#endif case LB_GETCURSEL: if (descr->nb_items == 0) return LB_ERR; @@ -2873,23 +2750,12 @@ return descr->focus_item; /* otherwise, if the user tries to move the selection with the */ /* arrow keys, we will give the application something to choke on */ -#ifndef __REACTOS__ - case LB_GETTOPINDEX16: -#endif case LB_GETTOPINDEX: return descr->top_item; -#ifndef __REACTOS__ - case LB_GETITEMHEIGHT16: -#endif case LB_GETITEMHEIGHT: return LISTBOX_GetItemHeight( descr, wParam ); -#ifndef __REACTOS__ - case LB_SETITEMHEIGHT16: - lParam = LOWORD(lParam); - /* fall through */ -#endif case LB_SETITEMHEIGHT: return LISTBOX_SetItemHeight( descr, wParam, lParam, TRUE ); @@ -2931,9 +2797,6 @@ return MAKELONG(index, hit ? 0 : 1); } -#ifndef __REACTOS__ - case LB_SETCARETINDEX16: -#endif case LB_SETCARETINDEX: if ((!IS_MULTISELECT(descr)) && (descr->selected_item != -1)) return LB_ERR; if (LISTBOX_SetCaretIndex( descr, wParam, !lParam ) == LB_ERR) @@ -2943,47 +2806,18 @@ else return LB_OKAY; -#ifndef __REACTOS__ - case LB_GETCARETINDEX16: -#endif case LB_GETCARETINDEX: return descr->focus_item; -#ifndef __REACTOS__ - case LB_SETTOPINDEX16: -#endif case LB_SETTOPINDEX: return LISTBOX_SetTopItem( descr, wParam, TRUE ); -#ifndef __REACTOS__ - case LB_SETCOLUMNWIDTH16: -#endif case LB_SETCOLUMNWIDTH: return LISTBOX_SetColumnWidth( descr, wParam ); -#ifndef __REACTOS__ - case LB_GETITEMRECT16: - { - RECT rect; - RECT16 *r16 = MapSL(lParam); - ret = LISTBOX_GetItemRect( descr, (INT16)wParam, &rect ); - r16->left = rect.left; - r16->top = rect.top; - r16->right = rect.right; - r16->bottom = rect.bottom; - } - return ret; -#endif - case LB_GETITEMRECT: return LISTBOX_GetItemRect( descr, wParam, (RECT *)lParam ); -#ifndef __REACTOS__ - case LB_FINDSTRING16: - wParam = (INT)(INT16)wParam; - if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam); - /* fall through */ -#endif case LB_FINDSTRING: { INT ret; @@ -3003,12 +2837,6 @@ return ret; } -#ifndef __REACTOS__ - case LB_FINDSTRINGEXACT16: - wParam = (INT)(INT16)wParam; - if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam); - /* fall through */ -#endif case LB_FINDSTRINGEXACT: { INT ret; @@ -3028,12 +2856,6 @@ return ret; } -#ifndef __REACTOS__ - case LB_SELECTSTRING16: - wParam = (INT)(INT16)wParam; - if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam); - /* fall through */ -#endif case LB_SELECTSTRING: { INT index; @@ -3062,29 +2884,14 @@ return index; } -#ifndef __REACTOS__ - case LB_GETSEL16: - wParam = (INT)(INT16)wParam; - /* fall through */ -#endif case LB_GETSEL: if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items)) return LB_ERR; return descr->items[wParam].selected; -#ifndef __REACTOS__ - case LB_SETSEL16: - lParam = (INT)(INT16)lParam; - /* fall through */ -#endif case LB_SETSEL: return LISTBOX_SetSelection( descr, lParam, wParam, FALSE ); -#ifndef __REACTOS__ - case LB_SETCURSEL16: - wParam = (INT)(INT16)wParam; - /* fall through */ -#endif case LB_SETCURSEL: if (IS_MULTISELECT(descr)) return LB_ERR; LISTBOX_SetCaretIndex( descr, wParam, FALSE ); @@ -3092,23 +2899,12 @@ if (ret != LB_ERR) ret = descr->selected_item; return ret; -#ifndef __REACTOS__ - case LB_GETSELCOUNT16: -#endif case LB_GETSELCOUNT: return LISTBOX_GetSelCount( descr ); -#ifndef __REACTOS__ - case LB_GETSELITEMS16: - return LISTBOX_GetSelItems16( descr, wParam, (LPINT16)MapSL(lParam) ); -#endif - case LB_GETSELITEMS: return LISTBOX_GetSelItems( descr, wParam, (LPINT)lParam ); -#ifndef __REACTOS__ - case LB_SELITEMRANGE16: -#endif case LB_SELITEMRANGE: if (LOWORD(lParam) <= HIWORD(lParam)) return LISTBOX_SelectItemRange( descr, LOWORD(lParam), @@ -3117,38 +2913,21 @@ return LISTBOX_SelectItemRange( descr, HIWORD(lParam), LOWORD(lParam), wParam ); -#ifndef __REACTOS__ - case LB_SELITEMRANGEEX16: -#endif case LB_SELITEMRANGEEX: if ((INT)lParam >= (INT)wParam) return LISTBOX_SelectItemRange( descr, wParam, lParam, TRUE ); else return LISTBOX_SelectItemRange( descr, lParam, wParam, FALSE); -#ifndef __REACTOS__ - case LB_GETHORIZONTALEXTENT16: -#endif case LB_GETHORIZONTALEXTENT: return descr->horz_extent; -#ifndef __REACTOS__ - case LB_SETHORIZONTALEXTENT16: -#endif case LB_SETHORIZONTALEXTENT: return LISTBOX_SetHorizontalExtent( descr, wParam ); -#ifndef __REACTOS__ - case LB_GETANCHORINDEX16: -#endif case LB_GETANCHORINDEX: return descr->anchor_item; -#ifndef __REACTOS__ - case LB_SETANCHORINDEX16: - wParam = (INT)(INT16)wParam; - /* fall through */ -#endif case LB_SETANCHORINDEX: if (((INT)wParam < -1) || ((INT)wParam >= descr->nb_items)) { @@ -3158,14 +2937,6 @@ descr->anchor_item = (INT)wParam; return LB_OKAY; -#ifndef __REACTOS__ - case LB_DIR16: - /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE - * be set automatically (this is different in Win32) */ - if (wParam & DDL_DRIVES) wParam |= DDL_EXCLUSIVE; - lParam = (LPARAM)MapSL(lParam); - /* fall through */ -#endif case LB_DIR: { INT ret; @@ -3204,17 +2975,9 @@ case LB_SETCOUNT: return LISTBOX_SetCount( descr, (INT)wParam ); -#ifndef __REACTOS__ - case LB_SETTABSTOPS16: - return LISTBOX_SetTabStops( descr, (INT)(INT16)wParam, MapSL(lParam), TRUE ); -#endif - case LB_SETTABSTOPS: - return LISTBOX_SetTabStops( descr, wParam, (LPINT)lParam, FALSE ); - -#ifndef __REACTOS__ - case LB_CARETON16: -#endif + return LISTBOX_SetTabStops( descr, wParam, (LPINT)lParam ); + case LB_CARETON: if (descr->caret_on) return LB_OKAY; @@ -3223,9 +2986,6 @@ LISTBOX_RepaintItem( descr, descr->focus_item, ODA_FOCUS ); return LB_OKAY; -#ifndef __REACTOS__ - case LB_CARETOFF16: -#endif case LB_CARETOFF: if (!descr->caret_on) return LB_OKAY; @@ -3418,7 +3178,7 @@ case WM_NCACTIVATE: if (lphc) return 0; break; - +// ReactOS case WM_UPDATEUISTATE: if (unicode) DefWindowProcW(descr->self, msg, wParam, lParam); @@ -3432,7 +3192,7 @@ LISTBOX_DrawFocusRect( descr, descr->in_focus ); } break; - +// default: if ((msg >= WM_USER) && (msg < 0xc000)) WARN("[%p]: unknown msg %04x wp %08lx lp %08lx\n", Modified: trunk/reactos/dll/win32/user32/controls/scrollbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/scrollbar.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/scrollbar.c [iso-8859-1] Fri Mar 5 00:25:30 2010 @@ -67,9 +67,6 @@ static BOOL ScrollTrackVertical; HBRUSH DefWndControlColor(HDC hDC, UINT ctlType); - -//static LRESULT WINAPI ScrollBarWndProcW( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); -//static LRESULT WINAPI ScrollBarWndProcA( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); UINT WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC); BOOL WINAPI KillSystemTimer(HWND,UINT_PTR); @@ -712,6 +709,22 @@ DrawFrameControl(Dc, &Rect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP); } +/*********************************************************************** + * SCROLL_RefreshScrollBar + * + * Repaint the scroll bar interior after a SetScrollRange() or + * SetScrollPos() call. + */ +static void SCROLL_RefreshScrollBar( HWND hwnd, INT nBar, + BOOL arrows, BOOL interior ) +{ + HDC hdc = GetDCEx( hwnd, 0, + DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) ); + if (!hdc) return; + + IntDrawScrollBar( hwnd, hdc, nBar);//, arrows, interior ); + ReleaseDC( hwnd, hdc ); +} /*********************************************************************** @@ -1399,14 +1412,14 @@ case SBM_GETPOS: return IntScrollGetScrollPos(Wnd, SB_CTL); + case SBM_SETRANGEREDRAW: case SBM_SETRANGE: { INT OldPos = IntScrollGetScrollPos(Wnd, SB_CTL); SetScrollRange(Wnd, SB_CTL, wParam, lParam, FALSE); - if (OldPos != IntScrollGetScrollPos(Wnd, SB_CTL)) - { - return OldPos; - } + if (Msg == SBM_SETRANGEREDRAW) + SCROLL_RefreshScrollBar( Wnd, SB_CTL, TRUE, TRUE ); + if (OldPos != IntScrollGetScrollPos(Wnd, SB_CTL)) return OldPos; } return 0; @@ -1416,27 +1429,19 @@ case SBM_ENABLE_ARROWS: return EnableScrollBar(Wnd, SB_CTL, wParam); - case SBM_SETRANGEREDRAW: - { - INT OldPos = IntScrollGetScrollPos(Wnd, SB_CTL); - SetScrollRange(Wnd, SB_CTL, wParam, lParam, TRUE); - if (OldPos != IntScrollGetScrollPos(Wnd, SB_CTL)) - { - return OldPos; - } - } - return 0; - case SBM_SETSCROLLINFO: return NtUserSetScrollInfo(Wnd, SB_CTL, (SCROLLINFO *) lParam, wParam); case SBM_GETSCROLLINFO: return NtUserSBGetParms(Wnd, SB_CTL, NULL, (SCROLLINFO *) lParam); + + case SBM_GETSCROLLBARINFO: + ((PSCROLLBARINFO)lParam)->cbSize = sizeof(SCROLLBARINFO); + return NtUserGetScrollBarInfo(Wnd, OBJID_CLIENT, (PSCROLLBARINFO)lParam); case 0x00e5: case 0x00e7: case 0x00e8: - case 0x00eb: case 0x00ec: case 0x00ed: case 0x00ee: @@ -1505,8 +1510,8 @@ PWND pWnd; PSBDATA pSBData = NULL; - if (SB_CTL == SBType) - { + if (SB_CTL == SBType) + { return SendMessageW(Wnd, SBM_GETSCROLLINFO, 0, (LPARAM) Info); } Modified: trunk/reactos/dll/win32/user32/controls/static.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/static.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/static.c [iso-8859-1] Fri Mar 5 00:25:30 2010 @@ -296,23 +296,25 @@ * * Load the icon for an SS_ICON control. */ -static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name, DWORD style ) -{ - HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); - if ((style & SS_REALSIZEIMAGE) != 0) - { - return LoadImageA(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED); - } - else - { - HICON hicon = LoadIconA( hInstance, name ); - if (!hicon) hicon = LoadCursorA( hInstance, name ); - if (!hicon) hicon = LoadIconA( 0, name ); - /* Windows doesn't try to load a standard cursor, - probably because most IDs for standard cursors conflict - with the IDs for standard icons anyway */ - return hicon; - } +static HICON STATIC_LoadIconA( HINSTANCE hInstance, LPCSTR name, DWORD style ) +{ + HICON hicon = 0; + + if (hInstance && ((ULONG_PTR)hInstance >> 16)) + { + if ((style & SS_REALSIZEIMAGE) != 0) + hicon = LoadImageA(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED); + else + { + hicon = LoadIconA( hInstance, name ); + if (!hicon) hicon = LoadCursorA( hInstance, name ); + } + } + if (!hicon) hicon = LoadIconA( 0, name ); + /* Windows doesn't try to load a standard cursor, + probably because most IDs for standard cursors conflict + with the IDs for standard icons anyway */ + return hicon; } /*********************************************************************** @@ -320,48 +322,27 @@ * * Load the icon for an SS_ICON control. */ -static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name, DWORD style ) -{ - HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); - if ((style & SS_REALSIZEIMAGE) != 0) - { - return LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED); - } - else - { - HICON hicon = LoadIconW( hInstance, name ); - if (!hicon) hicon = LoadCursorW( hInstance, name ); - if (!hicon) hicon = LoadIconW( 0, name ); - /* Windows doesn't try to load a standard cursor, - probably because most IDs for standard cursors conflict - with the IDs for standard icons anyway */ - return hicon; - } -} - -/*********************************************************************** - * STATIC_LoadBitmapA - * - * Load the bitmap for an SS_BITMAP control. - */ -static HBITMAP STATIC_LoadBitmapA( HWND hwnd, LPCSTR name ) -{ - HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); - /* Windows doesn't try to load OEM Bitmaps (hInstance == NULL) */ - return LoadBitmapA( hInstance, name ); -} - -/*********************************************************************** - * STATIC_LoadBitmapW - * - * Load the bitmap for an SS_BITMAP control. - */ -static HBITMAP STATIC_LoadBitmapW( HWND hwnd, LPCWSTR name ) -{ - HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); - /* Windows doesn't try to load OEM Bitmaps (hInstance == NULL) */ - return LoadBitmapW( hInstance, name ); -} +static HICON STATIC_LoadIconW( HINSTANCE hInstance, LPCWSTR name, DWORD style ) +{ + HICON hicon = 0; + + if (hInstance && ((ULONG_PTR)hInstance >> 16)) + { + if ((style & SS_REALSIZEIMAGE) != 0) + hicon = LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED); + else + { + hicon = LoadIconW( hInstance, name ); + if (!hicon) hicon = LoadCursorW( hInstance, name ); + } + } + if (!hicon) hicon = LoadIconW( 0, name ); + /* Windows doesn't try to load a standard cursor, + probably because most IDs for standard cursors conflict + with the IDs for standard icons anyway */ + return hicon; +} + /*********************************************************************** * STATIC_TryPaintFcn @@ -513,6 +494,7 @@ { LPCSTR textA; LPCWSTR textW; + HINSTANCE hInstance; if (full_style & SS_SUNKEN) SetWindowLongPtrW( hwnd, GWL_EXSTYLE, @@ -527,26 +509,30 @@ { textA = ((LPCREATESTRUCTA)lParam)->lpszName; textW = NULL; + } + + hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); switch (style) { case SS_ICON: { HICON hIcon; - if(unicode) - hIcon = STATIC_LoadIconW(hwnd, textW, full_style); + if(unicode ) + hIcon = STATIC_LoadIconW(hInstance, textW, full_style); else - hIcon = STATIC_LoadIconA(hwnd, textA, full_style); + hIcon = STATIC_LoadIconA(hInstance, textA, full_style); STATIC_SetIcon(hwnd, hIcon, full_style); } break; case SS_BITMAP: + if ((ULONG_PTR)hInstance >> 16) { HBITMAP hBitmap; if(unicode) - hBitmap = STATIC_LoadBitmapW(hwnd, textW); + hBitmap = LoadBitmapW(hInstance, textW); else - hBitmap = STATIC_LoadBitmapA(hwnd, textA); + hBitmap = LoadBitmapA(hInstance, textA); STATIC_SetBitmap(hwnd, hBitmap, full_style); } break; @@ -575,8 +561,8 @@ if (hasTextStyle( full_style )) { SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, wParam ); - if (LOWORD(lParam)) - RedrawWindow( hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN ); + if (LOWORD(lParam)) + RedrawWindow( hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN ); } break; @@ -608,9 +594,7 @@ case STM_GETIMAGE: return (LRESULT)STATIC_GetImage( hwnd, wParam, full_style ); -#ifndef __REACTOS__ - case STM_GETICON16: -#endif + case STM_GETICON: return (LRESULT)STATIC_GetImage( hwnd, IMAGE_ICON, full_style ); @@ -636,9 +620,6 @@ STATIC_TryPaintFcn( hwnd, full_style ); break; -#ifndef __REACTOS__ - case STM_SETICON16: -#endif case STM_SETICON: lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)wParam, full_style ); STATIC_TryPaintFcn( hwnd, full_style ); Modified: trunk/reactos/include/psdk/winuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winuser.h?rev…
============================================================================== --- trunk/reactos/include/psdk/winuser.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winuser.h [iso-8859-1] Fri Mar 5 00:25:30 2010 @@ -1993,11 +1993,16 @@ #define SBM_ENABLE_ARROWS 228 #define SBM_GETPOS 225 #define SBM_GETRANGE 227 -#define SBM_GETSCROLLINFO 234 #define SBM_SETPOS 224 #define SBM_SETRANGE 226 #define SBM_SETRANGEREDRAW 230 +#if (_WIN32_WINNT >= 0x0400) +#define SBM_GETSCROLLINFO 234 #define SBM_SETSCROLLINFO 233 +#endif +#if (_WIN32_WINNT >= 0x0501) +#define SBM_GETSCROLLBARINFO 235 +#endif #define STM_GETICON 369 #define STM_GETIMAGE 371 #define STM_SETICON 368 Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Mar 5 00:25:30 2010 @@ -230,13 +230,13 @@ reactos/dll/win32/snmpapi/main.c # Synced at 20090222 User32 - - reactos/dll/win32/user32/controls/button.c # Synced to Wine-1_1_22 - reactos/dll/win32/user32/controls/combo.c # Synced to Wine-1_1_22 - reactos/dll/win32/user32/controls/edit.c # Synced to Wine-1_1_29 - reactos/dll/win32/user32/controls/icontitle.c # Synced to Wine-1_1_13 - reactos/dll/win32/user32/controls/listbox.c # Synced to Wine-1_1_22 + reactos/dll/win32/user32/controls/button.c # Synced to Wine-1_1_39 + reactos/dll/win32/user32/controls/combo.c # Synced to Wine-1_1_39 + reactos/dll/win32/user32/controls/edit.c # Synced to Wine-1_1_39 + reactos/dll/win32/user32/controls/icontitle.c # Synced to Wine-1_1_39 + reactos/dll/win32/user32/controls/listbox.c # Synced to Wine-1_1_39 reactos/dll/win32/user32/controls/scrollbar.c # Forked - reactos/dll/win32/user32/controls/static.c # Synced to Wine-1_1_22 + reactos/dll/win32/user32/controls/static.c # Synced to Wine-1_1_39 reactos/dll/win32/user32/include/dde_private.h # Synced to wine 1.1.24
14 years, 9 months
1
0
0
0
[akhaldi] 45846: More work on USB related definitions
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Mar 4 23:58:41 2010 New Revision: 45846 URL:
http://svn.reactos.org/svn/reactos?rev=45846&view=rev
Log: More work on USB related definitions Added: branches/header-work/include/ddk/usbprotocoldefs.h (with props) branches/header-work/include/ddk/usbstorioctl.h (with props) Modified: branches/header-work/include/ddk/usbbusif.h branches/header-work/include/ddk/usbdlib.h branches/header-work/include/ddk/usbscan.h Modified: branches/header-work/include/ddk/usbbusif.h URL:
http://svn.reactos.org/svn/reactos/branches/header-work/include/ddk/usbbusi…
============================================================================== --- branches/header-work/include/ddk/usbbusif.h [iso-8859-1] (original) +++ branches/header-work/include/ddk/usbbusif.h [iso-8859-1] Thu Mar 4 23:58:41 2010 @@ -18,13 +18,13 @@ typedef VOID (USB_BUSIFFN *PUSB_BUSIFFN_GETUSBDI_VERSION) ( IN PVOID, - OUT PUSBD_VERSION_INFORMATION, - OUT PULONG); + OUT PUSBD_VERSION_INFORMATION OPTIONAL, + OUT PULONG OPTIONAL); typedef NTSTATUS (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_TIME) ( IN PVOID, - OUT PULONG); + OUT PULONG OPTIONAL); typedef NTSTATUS (USB_BUSIFFN *PUSB_BUSIFFN_ENUM_LOG_ENTRY) ( @@ -32,31 +32,31 @@ IN ULONG, IN ULONG, IN ULONG, - IN ULONG); + IN ULONG); typedef struct _USB_BUS_INFORMATION_LEVEL_0 { ULONG TotalBandwidth; - ULONG ConsumedBandwidth; + ULONG ConsumedBandwidth; } USB_BUS_INFORMATION_LEVEL_0, *PUSB_BUS_INFORMATION_LEVEL_0; typedef struct _USB_BUS_INFORMATION_LEVEL_1 { ULONG TotalBandwidth; - ULONG ConsumedBandwidth; + ULONG ConsumedBandwidth; ULONG ControllerNameLength; - WCHAR ControllerNameUnicodeString[1]; + WCHAR ControllerNameUnicodeString[1]; } USB_BUS_INFORMATION_LEVEL_1, *PUSB_BUS_INFORMATION_LEVEL_1; typedef NTSTATUS (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_INFORMATION) ( IN PVOID, IN ULONG, - INout PVOID, + IN OUT PVOID, OUT PULONG, - OUT PULONG); + OUT PULONG OPTIONAL); typedef BOOLEAN (USB_BUSIFFN *PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED) ( - IN PVOID); + IN PVOID OPTIONAL); #define USB_BUSIF_USBDI_VERSION_0 0x0000 #define USB_BUSIF_USBDI_VERSION_1 0x0001 @@ -111,19 +111,19 @@ typedef NTSTATUS (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_TIME_EX) ( - IN PVOID, - OUT PULONG); + IN PVOID OPTIONAL, + OUT PULONG OPTIONAL); typedef NTSTATUS (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_CONTROLLER_TYPE) ( - IN PVOID, - OUT PULONG, - OUT PUSHORT, - OUT PUSHORT, - OUT PUCHAR, - OUT PUCHAR, - OUT PUCHAR, - OUT PUCHAR); + IN PVOID OPTIONAL, + OUT PULONG OPTIONAL, + OUT PUSHORT OPTIONAL, + OUT PUSHORT OPTIONAL, + OUT PUCHAR OPTIONAL, + OUT PUCHAR OPTIONAL, + OUT PUCHAR OPTIONAL, + OUT PUCHAR OPTIONAL); typedef struct _USB_BUS_INTERFACE_USBDI_V3 { USHORT Size; @@ -162,7 +162,7 @@ (USB_BUSIFFN *USBC_START_DEVICE_CALLBACK)( IN PUSB_DEVICE_DESCRIPTOR DeviceDescriptor, IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, - PUSBC_FUNCTION_DESCRIPTOR *FunctionDescriptorBuffer, + OUT PUSBC_FUNCTION_DESCRIPTOR *FunctionDescriptorBuffer, OUT PULONG FunctionDescriptorBufferLength, IN PDEVICE_OBJECT FdoDeviceObject, IN PDEVICE_OBJECT PdoDeviceObject); Modified: branches/header-work/include/ddk/usbdlib.h URL:
http://svn.reactos.org/svn/reactos/branches/header-work/include/ddk/usbdlib…
============================================================================== --- branches/header-work/include/ddk/usbdlib.h [iso-8859-1] (original) +++ branches/header-work/include/ddk/usbdlib.h [iso-8859-1] Thu Mar 4 23:58:41 2010 @@ -1,12 +1,9 @@ -#ifndef USBDLIB_H__ -#define USBDLIB_H__ - - -typedef struct _USBD_INTERFACE_LIST_ENTRY -{ - PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor; - PUSBD_INTERFACE_INFORMATION Interface; -}USBD_INTERFACE_LIST_ENTRY, *PUSBD_INTERFACE_LIST_ENTRY; +#pragma once + +typedef struct _USBD_INTERFACE_LIST_ENTRY { + PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor; + PUSBD_INTERFACE_INFORMATION Interface; +} USBD_INTERFACE_LIST_ENTRY, *PUSBD_INTERFACE_LIST_ENTRY; #define UsbBuildInterruptOrBulkTransferRequest(urb,length, pipeHandle, transferBuffer, transferBufferMDL, transferBufferLength, transferFlags, link) \ { \ @@ -43,7 +40,6 @@ (urb)->UrbControlGetStatusRequest.Index = (index); \ (urb)->UrbControlGetStatusRequest.UrbLink = (link); \ } - #define UsbBuildFeatureRequest(urb, op, featureSelector, index, link) \ { \ @@ -120,102 +116,87 @@ #define GET_ISO_URB_SIZE(n) (sizeof(struct _URB_ISOCH_TRANSFER)+ \ sizeof(USBD_ISO_PACKET_DESCRIPTOR)*n) - #ifndef _USBD_ DECLSPEC_IMPORT VOID NTAPI USBD_GetUSBDIVersion( - OUT PUSBD_VERSION_INFORMATION VersionInformation -); - + OUT PUSBD_VERSION_INFORMATION VersionInformation); DECLSPEC_IMPORT PUSB_INTERFACE_DESCRIPTOR NTAPI USBD_ParseConfigurationDescriptor( - IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, - IN UCHAR InterfaceNumber, - IN UCHAR AlternateSetting -); + IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, + IN UCHAR InterfaceNumber, + IN UCHAR AlternateSetting); DECLSPEC_IMPORT PURB NTAPI USBD_CreateConfigurationRequest( - IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, - OUT PUSHORT Siz -); + IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, + OUT PUSHORT Siz); DECLSPEC_IMPORT PUSB_COMMON_DESCRIPTOR NTAPI USBD_ParseDescriptors( - IN PVOID DescriptorBuffer, - IN ULONG TotalLength, - IN PVOID StartPosition, - IN LONG DescriptorType -); + IN PVOID DescriptorBuffer, + IN ULONG TotalLength, + IN PVOID StartPosition, + IN LONG DescriptorType); DECLSPEC_IMPORT PUSB_INTERFACE_DESCRIPTOR NTAPI USBD_ParseConfigurationDescriptorEx( - IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, - IN PVOID StartPosition, - IN LONG InterfaceNumber, - IN LONG AlternateSetting, - IN LONG InterfaceClass, - IN LONG InterfaceSubClass, - IN LONG InterfaceProtocol -); + IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, + IN PVOID StartPosition, + IN LONG InterfaceNumber, + IN LONG AlternateSetting, + IN LONG InterfaceClass, + IN LONG InterfaceSubClass, + IN LONG InterfaceProtocol); DECLSPEC_IMPORT PURB NTAPI USBD_CreateConfigurationRequestEx( - IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, - IN PUSBD_INTERFACE_LIST_ENTRY InterfaceList -); - - -DECLSPEC_IMPORT + IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, + IN PUSBD_INTERFACE_LIST_ENTRY InterfaceList); + +DECLSPEC_EXPORT ULONG NTAPI USBD_GetInterfaceLength( - IN PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor, - IN PUCHAR BufferEnd -); - -DECLSPEC_IMPORT + IN PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor, + IN PUCHAR BufferEnd); + +DECLSPEC_EXPORT VOID NTAPI USBD_RegisterHcFilter( - IN PDEVICE_OBJECT DeviceObject, - IN PDEVICE_OBJECT FilterDeviceObject -); - - - -DECLSPEC_IMPORT + IN PDEVICE_OBJECT DeviceObject, + IN PDEVICE_OBJECT FilterDeviceObject); + +DECLSPEC_EXPORT NTSTATUS NTAPI USBD_GetPdoRegistryParameter( - IN PDEVICE_OBJECT PhysicalDeviceObject, - IN PVOID Parameter, - IN ULONG ParameterLength, - IN PWSTR KeyName, - IN ULONG KeyNameLength -); - -DECLSPEC_IMPORT + IN PDEVICE_OBJECT PhysicalDeviceObject, + IN OUT PVOID Parameter, + IN ULONG ParameterLength, + IN PWSTR KeyName, + IN ULONG KeyNameLength); + +DECLSPEC_EXPORT NTSTATUS NTAPI USBD_QueryBusTime( - IN PDEVICE_OBJECT RootHubPdo, - OUT PULONG CurrentFrame -); + IN PDEVICE_OBJECT RootHubPdo, + OUT PULONG CurrentFrame); #if (NTDDI_VERSION >= NTDDI_WINXP) @@ -223,10 +204,9 @@ ULONG NTAPI USBD_CalculateUsbBandwidth( - IN ULONG MaxPacketSize, - IN UCHAR EndpointType, - IN BOOLEAN LowSpeed -); + IN ULONG MaxPacketSize, + IN UCHAR EndpointType, + IN BOOLEAN LowSpeed); #endif @@ -236,16 +216,12 @@ USBD_STATUS NTAPI USBD_ValidateConfigurationDescriptor( - IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc, - IN ULONG BufferLength, - IN USHORT Level, - OUT PUCHAR *Offset, - IN ULONG Tag -); - - -#endif - -#endif - -#endif + IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc, + IN ULONG BufferLength, + IN USHORT Level, + OUT PUCHAR *Offset, + IN ULONG Tag OPTIONAL); + +#endif + +#endif Added: branches/header-work/include/ddk/usbprotocoldefs.h URL:
http://svn.reactos.org/svn/reactos/branches/header-work/include/ddk/usbprot…
============================================================================== --- branches/header-work/include/ddk/usbprotocoldefs.h (added) +++ branches/header-work/include/ddk/usbprotocoldefs.h [iso-8859-1] Thu Mar 4 23:58:41 2010 @@ -1,0 +1,677 @@ +#pragma once + +#include <PSHPACK1.h> + +#define USB_UnConnected_Device_Address 0 +#define USB_UNCONNECTED_ADDRESS(address) ( USB_UnConnected_Device_Address == (address)) +#define USB_CONNECTED_ADDRESS(address) ( USB_UnConnected_Device_Address != (address) ) + +#define PID_OUT 1 +#define PID_IN 9 +#define PID_SOF 5 +#define PID_SETUP 13 + +#define PID_DATA0 3 +#define PID_DATA1 11 +#define PID_DATA2 7 +#define PID_MDATA 15 + +#define USB_ACK 2 +#define USB_NAK 10 +#define USB_STALL 14 +#define USB_NYET 6 + +#define USB_PRE 12 +#define USB_ERR 12 +#define USB_SPLIT 8 +#define USB_PING 4 + +#define USB_TIMEOUT 0 + +#define USB_SPEC 0x0200 +#define HID_SPEC 0x0101 + +#define USB_20_SPEC 0x0200 +#define USB_11_SPEC 0x0110 +#define USB_10_SPEC 0x0100 + +#define HID_MAX_PACKET_SIZE0 0x08 +#define MICROSOFT_VENDOR_ID 0x045E +#define HID_DEVICE_RELEASE 0x0100 + +#define HID_MAX_PACKET_SIZE 0x0008 +#define HID_POLLING_INTERVAL 0x0A +#define MAX_POLLING_INTERVAL 0xFF + +#define USB_DEFAULT_KEYBOARD_PRODUCT_ID 0x000B +#define USB_DEFAULT_MOUSE_PRODUCT_ID 0x0040 + +#define DEVICE_DESCRIPTOR 0x01 +#define CONFIGURATION_DESCRIPTOR 0x02 +#define STRING_DESCRIPTOR 0x03 +#define INTERFACE_DESCRIPTOR 0x04 +#define ENDPOINT_DESCRIPTOR 0x05 +#define QUALIFIER_DESCRIPTOR 0x06 +#define OTHER_SPEED_DESCRIPTOR 0x07 +#define INTERFACE_POWER_DESCRIPTOR 0x08 + +#define HID_DESCRIPTOR 0x21 +#define REPORT_DESCRIPTOR 0x22 +#define PHYSICAL_DESCRIPTOR 0x23 +#define HUB_DESCRIPTOR 0x29 + +#define USB_DESCRIPTOR_TYPE_STD 0 +#define USB_DESCRIPTOR_TYPE_CLASS 1 +#define USB_DESCRIPTOR_TYPE_VENDOR 2 +#define USB_DESCRIPTOR_TYPE_RESERVED 3 + +#define DIR_HOST_TO_DEVICE 0 +#define DIR_DEVICE_TO_HOST 1 + +#define TYPE_STANDARD 0 +#define TYPE_CLASS 1 +#define TYPE_VENDOR 2 +#define TYPE_RESERVED 3 + +#define RCPT_DEVICE 0 +#define RCPT_INTERFACE 1 +#define RCPT_ENDPOINT 2 +#define RCPT_OTHER 3 +#define RCPT_PORT 4 +#define RCPT_RPIPE 5 + +#if !defined(MIDL_PASS) +#define USB_MAKE_REQUEST_TYPE(direction, type, recipient) (BYTE)( ((BYTE)direction << 7) | ((BYTE)type << 5) | ((BYTE)recipient & 0x07) ) +#endif + +#define GET_STATUS 0 +#define CLEAR_FEATURE 1 +#define SET_FEATURE 3 +#define SET_ADDRESS 5 +#define GET_DESCRIPTOR 6 +#define SET_DESCRIPTOR 7 +#define GET_CONFIGURATION 8 +#define SET_CONFIGURATION 9 +#define GET_INTERFACE 10 +#define SET_INTERFACE 11 +#define SYNCH_FRAME 12 + +#define USB_BULK_ONLY_MASS_STG_RESET 0xFF +#define USB_BULK_ONLY_MASS_STG_GET_MAX_LUN 0xFE + +#define GET_REPORT 0x01 +#define GET_IDLE 0x02 +#define GET_PROTOCOL 0x03 +#define SET_REPORT 0x09 +#define SET_IDLE 0x0A +#define SET_PROTOCOL 0x0B + +#define ADD_MMC_IE 20 +#define REMOVE_MMC_IE 21 +#define SET_NUM_DNTS 22 +#define SET_CLUSTER_ID 23 +#define SET_DEVICE_INFO 24 +#define GET_TIME 25 +#define SET_STREAM_INDEX 26 +#define SET_WUSB_MAS 27 +#define WUSB_CH_STOP 28 + +#define EXEC_RC_CMD 40 + +#define TIME_ADJ 0x01 +#define TIME_BPST 0x02 +#define TIME_WUSB 0x03 + +#define HID_REPORT_TYPE_INPUT 0x01 +#define HID_REPORT_TYPE_OUTPUT 0x02 +#define HID_REPORT_TYPE_FEATURE 0x03 + +#define HID_PROTOCOL_TYPE_BOOT 0x00 +#define HID_PROTOCOL_TYPE_REPORT 0x01 + +#define HUB_DEVICE_PROTOCOL_1X 0 +#define HUB_DEVICE_PROTOCOL_SINGLE_TT 1 +#define HUB_DEVICE_PROTOCOL_MULTI_TT 2 + +#define HUB_INTERFACE_PROTOCOL_1X 0 +#define HUB_INTERFACE_PROTOCOL_SINGLE_TT 0 +#define HUB_INTERFACE_PROTOCOL_MULTI_TT_IN_SINGLE_TT_MODE 1 +#define HUB_INTERFACE_PROTOCOL_MULTI_TT_IN_MULTI_TT_MODE 2 + +#define CLEAR_TT_BUFFER 8 +#define RESET_TT 9 +#define GET_TT_STATE 10 +#define STOP_TT 11 + +#define C_HUB_LOCAL_POWER 0 +#define C_HUB_OVER_CURRENT 1 +#define PORT_CONNECTION 0 +#define PORT_ENABLE 1 +#define PORT_SUSPEND 2 +#define PORT_OVER_CURRENT 3 +#define PORT_RESET 4 +#define PORT_POWER 8 +#define PORT_LOW_SPEED 9 +#define C_PORT_CONNECTION 16 +#define C_PORT_ENABLE 17 +#define C_PORT_SUSPEND 18 +#define C_PORT_OVER_CURRENT 19 +#define C_PORT_RESET 20 +#define PORT_TEST 21 +#define PORT_INDICATOR 22 + +#define USBSETUPSIZE 8 +#define USBINREQUEST 128 + +#define BM_GET_DEVICE 128 +#define BM_GET_INTERFACE 129 +#define BM_GET_ENDPOINT 130 + +#define BM_SET_DEVICE 0 +#define BM_SET_INTERFACE 1 +#define BM_SET_ENDPOINT 2 + +#define HALT_ENDPOINT 0 +#define REMOTE_WAKEUP 1 +#define TEST_MODE 2 + +#define DEVICE_DESCRIPTION_TYPE 0x100 +#define QUALIFIER_DESCRIPTION_TYPE 0x600 +#define OTHER_SPEED_DESCRIPTION_TYPE 0x700 +#define CONFIG_DESCRIPTION_TYPE 0x200 +#define STRING_DESCRIPTION_TYPE 0x300 +#define MSOS_DESCRIPTION_TYPE 0x3EE + +#define CONFIG_BUS_POWERED 0x80 +#define CONFIG_SELF_POWERED 0x40 +#define CONFIG_REMOTE_WAKEUP 0x20 + +#define USB_WA_MULTIFUNCTION 0x02 +#define USB_WA_PROTOCOL 0x01 +#define USB_RADIO_CONTROL 0x2 + +#define USB_HID_CLASS_CODE 0x03 +#define USB_MASS_STORAGE_CLASS_CODE 0x08 +#define USB_HUB_CLASS_CODE 0x09 +#define USB_MISCELLANEOUS 0xEF +#define USB_WIRELESS_WA 0xE0 + +#define BOOT_INTERFACE_SUBCLASS 0x01 +#define COMMON_CLASS 0x02 +#define USB_RF_CONTROL 0x01 + +#define PROTOCOL_NONE 0x00 +#define PROTOCOL_KEYBOARD 0x01 +#define PROTOCOL_MOUSE 0x02 + +#define EP_OUT 0 +#define EP_IN 1 + +#define MAKE_ENDPOINT_ADDRESS(num, dir) ( ((BYTE)(dir) << 7) | ((BYTE)(num) & 0x0F) ) + +#define ENDPOINT_TYPE 0x03 +#define CONTROL_ENDPOINT 0 +#define ISOCHRONOUS_ENDPOINT 1 +#define BULK_ENDPOINT 2 +#define INTERRUPT_ENDPOINT 3 + +typedef union _USBDESCRIPTORTYPE { + BYTE Byte; +#if !defined(MIDL_PASS) + struct Bits { + BYTE Descriptor:5; + BYTE Type:2; + BYTE Reserved:1; + } Bits; +#endif +} USBDESCRIPTORTYPE; + +typedef union _USBCONFIGATTRIBS { + BYTE Byte; +#if !defined(MIDL_PASS) + struct Bits { + BYTE bReserved0_4:5; + BYTE bRemoteWakeup:1; + BYTE bSelfPowered:1; + BYTE bReserved7:1; + } Bits; +#endif +} USBCONFIGATTRIBS; + +typedef union _USBREQUESTTYPE { + BYTE Byte; +#if !defined(MIDL_PASS) + struct Bits { + BYTE Recipient:5; + BYTE Type:2; + BYTE Direction:1; + } Bits; +#endif +} USBREQUESTTYPE; + +#if !defined(MIDL_PASS) +C_ASSERT((sizeof(USBREQUESTTYPE) == sizeof(BYTE))); +#endif + +typedef struct _USBSETUPREQUEST { + USBREQUESTTYPE bmRequestType; + BYTE bRequest; + SHORT sSetupValue; + SHORT sSetupIndex; + SHORT sSetupLength; +} USBSETUPREQUEST; + +#if !defined(MIDL_PASS) + +typedef struct _USBDEVICEDESC { + BYTE bLength; + BYTE bDescriptorType; + USHORT usUSB; + BYTE bDeviceClass; + BYTE bDeviceSubClass; + BYTE bProtocol; + BYTE bMaxPacket0; + USHORT usVendor; + USHORT usProduct; + USHORT usDeviceNumber; + BYTE bManufacturer; + BYTE bProductDesc; + BYTE bSerialNumber; + BYTE bNumConfigs; +} USBDEVICEDESC; + +typedef struct _USBCONFIGDESC { + BYTE bLength; + BYTE bDescriptorType; + USHORT usTotalLength; + BYTE bNumInterfaces; + BYTE bConfigValue; + BYTE bConfig; + BYTE bAttributes; + BYTE bMaxPower; +} USBCONFIGDESC; + + +typedef struct _USBINTERFACEDESC { + BYTE bLength; + BYTE bDescriptorType; + BYTE bInterfaceNumber; + BYTE bAlternateSetting; + BYTE bNumEndpoints; + BYTE bClass; + BYTE bSubClass; + BYTE bProtocol; + BYTE bDescription; +} USBINTERFACEDESC; + +#define ENDPOINT_DIRECTION_OUT 0 +#define ENDPOINT_DIRECTION_IN 1 + +typedef union _USBENDPOINTADDRESS { + BYTE Byte; + struct Bits { + BYTE Number:4; + BYTE Reserved:3; + BYTE Direction:1; + } Bits; +} USBENDPOINTADDRESS; + +C_ASSERT((sizeof(USBENDPOINTADDRESS) == sizeof(BYTE))); + +#define USB_TRANSFER_TYPE_CONTROL 0 +#define USB_TRANSFER_TYPE_ISOCH 1 +#define USB_TRANSFER_TYPE_BULK 2 +#define USB_TRANSFER_TYPE_INTERRUPT 3 + +#define USB_SYNC_TYPE_NONE 0 +#define USB_SYNC_TYPE_ASYNC 1 +#define USB_SYNC_TYPE_ADAPTIVE 2 +#define USB_SYNC_TYPE_SYNC 3 + +#define USB_USAGE_TYPE_DATA 0 +#define USB_USAGE_TYPE_FEEDBACK 1 +#define USB_USAGE_TYPE_IMPLICIT 2 +#define USB_USAGE_TYPE_RESERVED 3 + +typedef union _USBENDPOINTATTRIBS { + BYTE Byte; + struct Bits { + BYTE TransferType:2; + BYTE SyncType:2; + BYTE UsageType:2; + BYTE Reserved:2; + } Bits; +} USBENDPOINTATTRIBS; + +C_ASSERT((sizeof(USBENDPOINTATTRIBS) == sizeof(BYTE))); + +typedef union _USBMAXPACKET { + WORD Word; + struct Bits { + WORD Size:11; + WORD AdditionalXactions:2; + WORD Reserved:3; + } Bits; +} USBMAXPACKET; + +C_ASSERT((sizeof(USBMAXPACKET) == sizeof(WORD))); + +typedef struct _USBENDPOINTDESC { + BYTE bLength; + BYTE bDescriptorType; + USBENDPOINTADDRESS Address; + USBENDPOINTATTRIBS Attributes; + USBMAXPACKET MaxPacket; + BYTE bInterval; +} USBENDPOINTDESC; + +typedef struct _USBQUALIFIERDESC { + BYTE bLength; + BYTE bDescriptorType; + USHORT usUSB; + BYTE bDeviceClass; + BYTE bDeviceSubClass; + BYTE bProtocol; + BYTE bMaxPacket; + BYTE bNumConfigs; + BYTE bReserved; +} USBQUALIFIERDESC; + +typedef struct _USBSTRINGDESC { + BYTE bLength; + BYTE bDescriptorType; + WCHAR wchData[1]; +} USBSTRINGDESC; + +typedef struct _USBSTRINGLANGIDS { + BYTE bLength; + BYTE bDescriptorType; + WORD wLANGIDs[1]; +} USBSTRINGLANGIDS; + +typedef struct _USBHIDSTANDARDDESC { + BYTE bLength; + BYTE bDescriptorType; + USHORT bcdHID; + BYTE bCountryCode; + BYTE bNumDescriptors; +} USBHIDSTANDARDDESC; + +typedef struct _USBHIDOPTIONALDESC { + BYTE bClassDescriptorType; + USHORT usDescriptorLength; +} USBHIDOPTIONALDESC; + +typedef struct _USBPHYSICALDESCSET0 { + BYTE bNumber; + BYTE bLength; +} USBPHYSICALDESCSET0; + +typedef union _USBPHYSICALDESCSET { + BYTE bPhysicalInfo; + struct Bits { + BYTE bPreference:5; + BYTE bBias:3; + } Bits; +} USBPHYSICALDESCSET; + +typedef struct _USBPHYSICALDESCITEM { + BYTE bDesignator; + union Flags { + BYTE bFlags; + struct Bits { + BYTE bEffort:5; + BYTE bQualifier:3; + } Bits; + } Flags; +} USBPHYSICALDESCITEM; + +typedef union _USBHUBCHARACTERISTICS { + WORD wHubCharacteristics; + struct Bits { + BYTE bLogicalPowerSwitchingMode:2; + BYTE fCompoundDevice:1; + BYTE bOverCurrentMode:2; + BYTE bTTThinkTime:2; + BYTE fPortIndicatorSupport:1; + BYTE bReserved:8; + } Bits; +} USBHUBCHARACTERISTICS; + +#if !defined(MIDL_PASS) +C_ASSERT((sizeof(USBHUBCHARACTERISTICS) == sizeof(WORD))); +#endif + +typedef struct _USBHUBDESC { + BYTE bLength; + BYTE bDescriptorType; + BYTE bNumberOfPorts; + USBHUBCHARACTERISTICS Characteristics; + BYTE bPwrOn2PwrGood; + BYTE bHubContrCurrent; + BYTE bDeviceRemovable[32]; + BYTE bPortPwrCtrlMask[32]; +} USBHUBDESC; + +#if !defined(MIDL_PASS) +C_ASSERT((sizeof(USBHUBDESC) == 71)); +#endif + +typedef union _USBHUBPORTSTATUS { + WORD wPortStatus; + struct Bits { + BYTE fCurrentConnectionStatus:1; + BYTE fEnabled:1; + BYTE fSuspend:1; + BYTE fOverCurrent:1; + BYTE fReset:1; + BYTE bReserved1:3; + BYTE fPortPower:1; + BYTE fLowSpeedDevice:1; + BYTE fHighSpeedDevice:1; + BYTE fTestMode:1; + BYTE fPortIndicatorControl:1; + BYTE bReserved2:3; + } Bits; +} USBHUBPORTSTATUS; + +#if !defined(MIDL_PASS) +C_ASSERT((sizeof(USBHUBPORTSTATUS) == sizeof(WORD))); +#endif + +typedef union _USBHUBPORTSTATUSCHANGE { + WORD wPortStatusChange; + struct Bits { + BYTE fConnectionStatusChange:1; + BYTE fEnabledChange:1; + BYTE fSuspendChange:1; + BYTE fOverCurrentChange:1; + BYTE fResetChange:1; + BYTE bReserved1:3; + BYTE bReserved2:8; + } Bits; +} USBHUBPORTSTATUSCHANGE; + +#if !defined(MIDL_PASS) +C_ASSERT((sizeof(USBHUBPORTSTATUSCHANGE) == sizeof(WORD))); +#endif + +typedef struct _USBHUBPORTDATA { + USBHUBPORTSTATUS PortStatus; + USBHUBPORTSTATUSCHANGE PortStatusChange; +} USBHUBPORTDATA; + +#define USB_MAKE_LANGID(lang, sublang) ((((USHORT)(sublang)) << 10) | (USHORT)(lang)) + +#define USB_LANG_RESERVED 0x00 +#define USB_LANG_ARABIC 0x01 +#define USB_LANG_BULGARIAN 0x02 +#define USB_LANG_CATALAN 0x03 +#define USB_LANG_CHINESE 0x04 +#define USB_LANG_CZECH 0x05 +#define USB_LANG_DANISH 0x06 +#define USB_LANG_GERMAN 0x07 +#define USB_LANG_GREEK 0x08 +#define USB_LANG_ENGLISH 0x09 +#define USB_LANG_SPANISH 0x0a +#define USB_LANG_FINNISH 0x0b +#define USB_LANG_FRENCH 0x0c +#define USB_LANG_HEBREW 0x0d +#define USB_LANG_HUNGARIAN 0x0e +#define USB_LANG_ICELANDIC 0x0f +#define USB_LANG_ITALIAN 0x10 +#define USB_LANG_JAPANESE 0x11 +#define USB_LANG_KOREAN 0x12 +#define USB_LANG_DUTCH 0x13 +#define USB_LANG_NORWEGIAN 0x14 +#define USB_LANG_POLISH 0x15 +#define USB_LANG_PORTUGUESE 0x16 +#define USB_LANG_ROMANIAN 0x18 +#define USB_LANG_RUSSIAN 0x19 +#define USB_LANG_CROATIAN 0x1a +#define USB_LANG_SERBIAN 0x1a +#define USB_LANG_SLOVAK 0x1b +#define USB_LANG_ALBANIAN 0x1c +#define USB_LANG_SWEDISH 0x1d +#define USB_LANG_THAI 0x1e +#define USB_LANG_TURKISH 0x1f +#define USB_LANG_URDU 0x20 +#define USB_LANG_INDONESIAN 0x21 +#define USB_LANG_UKRANIAN 0x22 +#define USB_LANG_BELARUSIAN 0x23 +#define USB_LANG_SLOVENIAN 0x24 +#define USB_LANG_ESTONIAN 0x25 +#define USB_LANG_LATVIAN 0x26 +#define USB_LANG_LITHUANIAN 0x27 +#define USB_LANG_FARSI 0x29 +#define USB_LANG_VIETNAMESE 0x2a +#define USB_LANG_ARMENIAN 0x2b +#define USB_LANG_AZERI 0x2c +#define USB_LANG_BASQUE 0x2d +#define USB_LANG_MACEDONIAN 0x2f +#define USB_LANG_AFRIKAANS 0x36 +#define USB_LANG_GEORGIAN 0x37 +#define USB_LANG_FAEROESE 0x38 +#define USB_LANG_HINDI 0x39 +#define USB_LANG_MALAY 0x3e +#define USB_LANG_KAZAK 0x3f +#define USB_LANG_SWAHILI 0x41 +#define USB_LANG_UZBEK 0x43 +#define USB_LANG_TATAR 0x44 +#define USB_LANG_BENGALI 0x45 +#define USB_LANG_PUNJABI 0x46 +#define USB_LANG_GUJARATI 0x47 +#define USB_LANG_ORIYA 0x48 +#define USB_LANG_TAMIL 0x49 +#define USB_LANG_TELUGU 0x4a +#define USB_LANG_KANNADA 0x4b +#define USB_LANG_MALAYALAM 0x4c +#define USB_LANG_ASSAMESE 0x4d +#define USB_LANG_MARATHI 0x4e +#define USB_LANG_SANSKRIT 0x4f +#define USB_LANG_KONKANI 0x57 +#define USB_LANG_MANIPURI 0x58 +#define USB_LANG_SINDHI 0x59 +#define USB_LANG_KASHMIRI 0x60 +#define USB_LANG_NEPALI 0x61 +#define USB_LANG_HID 0xff + +#define USB_SUBLANG_ARABIC_SAUDI_ARABIA 0x01 +#define USB_SUBLANG_ARABIC_SAUDI_ARABIA 0x01 +#define USB_SUBLANG_ARABIC_IRAQ 0x02 +#define USB_SUBLANG_ARABIC_EGYPT 0x03 +#define USB_SUBLANG_ARABIC_LIBYA 0x04 +#define USB_SUBLANG_ARABIC_ALGERIA 0x05 +#define USB_SUBLANG_ARABIC_MOROCCO 0x06 +#define USB_SUBLANG_ARABIC_TUNISIA 0x07 +#define USB_SUBLANG_ARABIC_OMAN 0x08 +#define USB_SUBLANG_ARABIC_YEMEN 0x09 +#define USB_SUBLANG_ARABIC_SYRIA 0x10 +#define USB_SUBLANG_ARABIC_JORDAN 0x11 +#define USB_SUBLANG_ARABIC_LEBANON 0x12 +#define USB_SUBLANG_ARABIC_KUWAIT 0x13 +#define USB_SUBLANG_ARABIC_UAE 0x14 +#define USB_SUBLANG_ARABIC_BAHRAIN 0x15 +#define USB_SUBLANG_ARABIC_QATAR 0x16 +#define USB_SUBLANG_AZERI_CYRILLIC 0x01 +#define USB_SUBLANG_AZERI_LATIN 0x02 +#define USB_SUBLANG_CHINESE_TRADITIONAL 0x01 +#define USB_SUBLANG_CHINESE_SIMPLIFIED 0x02 +#define USB_SUBLANG_CHINESE_HONGKONG 0x03 +#define USB_SUBLANG_CHINESE_SINGAPORE 0x04 +#define USB_SUBLANG_CHINESE_MACAU 0x05 +#define USB_SUBLANG_DUTCH 0x01 +#define USB_SUBLANG_DUTCH_BELGIAN 0x02 +#define USB_SUBLANG_ENGLISH_US 0x01 +#define USB_SUBLANG_ENGLISH_UK 0x02 +#define USB_SUBLANG_ENGLISH_AUS 0x03 +#define USB_SUBLANG_ENGLISH_CAN 0x04 +#define USB_SUBLANG_ENGLISH_NZ 0x05 +#define USB_SUBLANG_ENGLISH_EIRE 0x06 +#define USB_SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 +#define USB_SUBLANG_ENGLISH_JAMAICA 0x08 +#define USB_SUBLANG_ENGLISH_CARIBBEAN 0x09 +#define USB_SUBLANG_ENGLISH_BELIZE 0x0a +#define USB_SUBLANG_ENGLISH_TRINIDAD 0x0b +#define USB_SUBLANG_ENGLISH_PHILIPPINES 0x0c +#define USB_SUBLANG_ENGLISH_ZIMBABWE 0x0d +#define USB_SUBLANG_FRENCH 0x01 +#define USB_SUBLANG_FRENCH_BELGIAN 0x02 +#define USB_SUBLANG_FRENCH_CANADIAN 0x03 +#define USB_SUBLANG_FRENCH_SWISS 0x04 +#define USB_SUBLANG_FRENCH_LUXEMBOURG 0x05 +#define USB_SUBLANG_FRENCH_MONACO 0x06 +#define USB_SUBLANG_GERMAN 0x01 +#define USB_SUBLANG_GERMAN_SWISS 0x02 +#define USB_SUBLANG_GERMAN_AUSTRIAN 0x03 +#define USB_SUBLANG_GERMAN_LUXEMBOURG 0x04 +#define USB_SUBLANG_GERMAN_LIECHTENSTEIN 0x05 +#define USB_SUBLANG_ITALIAN 0x01 +#define USB_SUBLANG_ITALIAN_SWISS 0x02 +#define USB_SUBLANG_KASHMIRI_INDIA 0x02 +#define USB_SUBLANG_KOREAN 0x01 +#define USB_SUBLANG_LITHUANIAN 0x01 +#define USB_SUBLANG_MALAY_MALAYSIA 0x01 +#define USB_SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 +#define USB_SUBLANG_NEPALI_INDIA 0x02 +#define USB_SUBLANG_NORWEGIAN_BOKMAL 0x01 +#define USB_SUBLANG_NORWEGIAN_NYNORSK 0x02 +#define USB_SUBLANG_PORTUGUESE 0x01 +#define USB_SUBLANG_PORTUGUESE_BRAZILIAN 0x02 +#define USB_SUBLANG_SERBIAN_LATIN 0x02 +#define USB_SUBLANG_SERBIAN_CYRILLIC 0x03 +#define USB_SUBLANG_SPANISH 0x01 +#define USB_SUBLANG_SPANISH_MEXICAN 0x02 +#define USB_SUBLANG_SPANISH_MODERN 0x03 +#define USB_SUBLANG_SPANISH_GUATEMALA 0x04 +#define USB_SUBLANG_SPANISH_COSTA_RICA 0x05 +#define USB_SUBLANG_SPANISH_PANAMA 0x06 +#define USB_SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 +#define USB_SUBLANG_SPANISH_VENEZUELA 0x08 +#define USB_SUBLANG_SPANISH_COLOMBIA 0x09 +#define USB_SUBLANG_SPANISH_PERU 0x0a +#define USB_SUBLANG_SPANISH_ARGENTINA 0x0b +#define USB_SUBLANG_SPANISH_ECUADOR 0x0c +#define USB_SUBLANG_SPANISH_CHILE 0x0d +#define USB_SUBLANG_SPANISH_URUGUAY 0x0e +#define USB_SUBLANG_SPANISH_PARAGUAY 0x0f +#define USB_SUBLANG_SPANISH_BOLIVIA 0x10 +#define USB_SUBLANG_SPANISH_EL_SALVADOR 0x11 +#define USB_SUBLANG_SPANISH_HONDURAS 0x12 +#define USB_SUBLANG_SPANISH_NICARAGUA 0x13 +#define USB_SUBLANG_SPANISH_PUERTO_RICO 0x14 +#define USB_SUBLANG_SWEDISH 0x01 +#define USB_SUBLANG_SWEDISH_FINLAND 0x02 +#define USB_SUBLANG_URDU_PAKISTAN 0x01 +#define USB_SUBLANG_URDU_INDIA 0x02 +#define USB_SUBLANG_UZBEK_LATIN 0x01 +#define USB_SUBLANG_UZBEK_CYRILLIC 0x02 +#define USB_SUBLANG_HID_USAGE_DATA_DESCRIPTOR 0x01 +#define USB_SUBLANG_HID_VENDOR_DEFINED_1 0x3c +#define USB_SUBLANG_HID_VENDOR_DEFINED_2 0x3d +#define USB_SUBLANG_HID_VENDOR_DEFINED_3 0x3e +#define USB_SUBLANG_HID_VENDOR_DEFINED_4 0x3f + +#endif // !defined(MIDL_PASS) + +#include <POPPACK.h> Propchange: branches/header-work/include/ddk/usbprotocoldefs.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/header-work/include/ddk/usbscan.h URL:
http://svn.reactos.org/svn/reactos/branches/header-work/include/ddk/usbscan…
============================================================================== --- branches/header-work/include/ddk/usbscan.h [iso-8859-1] (original) +++ branches/header-work/include/ddk/usbscan.h [iso-8859-1] Thu Mar 4 23:58:41 2010 @@ -20,21 +20,33 @@ * */ -#ifndef __USBSCAN_H -#define __USBSCAN_H +#pragma once #ifdef __cplusplus extern "C" { #endif +#if (NTDDI_VERSION >= NTDDI_WIN2K) + +#pragma pack(push,8) + #define FILE_DEVICE_USB_SCAN 0x8000 #define IOCTL_INDEX 0x0800 + +#define IOCTL_GET_VERSION \ + CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 0, METHOD_BUFFERED,FILE_ANY_ACCESS) #define IOCTL_CANCEL_IO \ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 1, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_GET_VERSION \ - CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 0, METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_WAIT_ON_DEVICE_EVENT \ + CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 2, METHOD_BUFFERED,FILE_ANY_ACCESS) + +#define IOCTL_READ_REGISTERS \ + CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 3, METHOD_BUFFERED,FILE_ANY_ACCESS) + +#define IOCTL_WRITE_REGISTERS \ + CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 4, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_GET_CHANNEL_ALIGN_RQST \ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 5, METHOD_BUFFERED,FILE_ANY_ACCESS) @@ -42,32 +54,26 @@ #define IOCTL_GET_DEVICE_DESCRIPTOR \ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 6, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_GET_PIPE_CONFIGURATION \ - CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 10,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_RESET_PIPE \ + CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 7, METHOD_BUFFERED,FILE_ANY_ACCESS) #define IOCTL_GET_USB_DESCRIPTOR \ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 8, METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_READ_REGISTERS \ - CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 3, METHOD_BUFFERED,FILE_ANY_ACCESS) - -#define IOCTL_RESET_PIPE \ - CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 7, METHOD_BUFFERED,FILE_ANY_ACCESS) - #define IOCTL_SEND_USB_REQUEST \ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 9, METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_GET_PIPE_CONFIGURATION \ + CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 10,METHOD_BUFFERED,FILE_ANY_ACCESS) + +#if (NTDDI_VERSION >= NTDDI_WINXP) #define IOCTL_SET_TIMEOUT \ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 11,METHOD_BUFFERED,FILE_ANY_ACCESS) +#endif -#define IOCTL_WAIT_ON_DEVICE_EVENT \ - CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 2, METHOD_BUFFERED,FILE_ANY_ACCESS) - -#define IOCTL_WRITE_REGISTERS \ - CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 4, METHOD_BUFFERED, FILE_ANY_ACCESS) - - +#ifndef MAX_NUM_PIPES #define MAX_NUM_PIPES 8 +#endif #define BULKIN_FLAG 0x80 @@ -114,10 +120,10 @@ } USBSCAN_GET_DESCRIPTOR, *PUSBSCAN_GET_DESCRIPTOR; typedef enum _RAW_PIPE_TYPE { - USBSCAN_PIPE_CONTROL, - USBSCAN_PIPE_ISOCHRONOUS, - USBSCAN_PIPE_BULK, - USBSCAN_PIPE_INTERRUPT + USBSCAN_PIPE_CONTROL, + USBSCAN_PIPE_ISOCHRONOUS, + USBSCAN_PIPE_BULK, + USBSCAN_PIPE_INTERRUPT } RAW_PIPE_TYPE; typedef struct _USBSCAN_PIPE_INFORMATION { @@ -132,21 +138,25 @@ OUT USBSCAN_PIPE_INFORMATION PipeInfo[MAX_NUM_PIPES]; } USBSCAN_PIPE_CONFIGURATION, *PUSBSCAN_PIPE_CONFIGURATION; +#if (NTDDI_VERSION >= NTDDI_WINXP) typedef struct _USBSCAN_TIMEOUT { IN ULONG TimeoutRead; IN ULONG TimeoutWrite; IN ULONG TimeoutEvent; } USBSCAN_TIMEOUT, *PUSBSCAN_TIMEOUT; +#endif typedef enum _PIPE_TYPE { - EVENT_PIPE, - READ_DATA_PIPE, - WRITE_DATA_PIPE, - ALL_PIPE + EVENT_PIPE, + READ_DATA_PIPE, + WRITE_DATA_PIPE, + ALL_PIPE } PIPE_TYPE; + +#pragma pack(pop) + +#endif // (NTDDI_VERSION >= NTDDI_WIN2K) #ifdef __cplusplus } #endif - -#endif /* __USBSCAN_H */ Added: branches/header-work/include/ddk/usbstorioctl.h URL:
http://svn.reactos.org/svn/reactos/branches/header-work/include/ddk/usbstor…
============================================================================== --- branches/header-work/include/ddk/usbstorioctl.h (added) +++ branches/header-work/include/ddk/usbstorioctl.h [iso-8859-1] Thu Mar 4 23:58:41 2010 @@ -1,0 +1,64 @@ +#pragma once + +#ifndef MAX_PATH +#define MAX_PATH 260 +#endif + +#define SIZE_ENUM_PDO_RESULTS_HEADER (sizeof(ENUM_PDO_RESULTS) - sizeof(ENUM_PDO_ENTRY)) + +#define IOCTL_EHSTOR_DEVICE_SET_AUTHZ_STATE CTL_CODE(IOCTL_STORAGE_BASE, 0x501, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_EHSTOR_DEVICE_GET_AUTHZ_STATE CTL_CODE(IOCTL_STORAGE_BASE, 0x502, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_EHSTOR_DEVICE_SILO_COMMAND CTL_CODE(IOCTL_STORAGE_BASE, 0x503, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_EHSTOR_DEVICE_ENUMERATE_PDOS CTL_CODE(IOCTL_STORAGE_BASE, 0x504, METHOD_BUFFERED, FILE_ANY_ACCESS) + +DEFINE_GUID(GUID_USBSTOR_EHSTOR_SILO_INTERFACE, 0x7c2bcf57, 0x2bea, 0x46da, 0xad, 0x26, 0x78, 0xfd, 0xc8, 0x3c, 0xee, 0x46); +DEFINE_GUID(GUID_USBSTOR_EHSTOR_CONTROL_INTERFACE, 0x4f40006f, 0xb933, 0x4550, 0xb5, 0x32, 0x2b, 0x58, 0xce, 0xe6, 0x14, 0xd3); + +typedef struct tagACT_AUTHZ_STATE { + UCHAR ACT; + BOOLEAN fAuthorized; +} ACT_AUTHZ_STATE, *PACT_AUTHZ_STATE; + +typedef struct tagSILO_COMMAND { + UCHAR SiloIndex; + UCHAR Command; + ULONG cbCommandBuffer; + UCHAR rgbCommandBuffer[ANYSIZE_ARRAY]; +} SILO_COMMAND, *PSILO_COMMAND; + +typedef enum _PDO_TYPE { + PDO_TYPE_UNDEFINED = 0, + PDO_TYPE_DISK, + PDO_TYPE_CONTROL, + PDO_TYPE_SILO, + PDO_TYPE_THIS = 256 +} PDO_TYPE; + +typedef enum _PDO_STATE { + PDO_STATE_UNDEFINED = 0, + PDO_STATE_STARTED, + PDO_STATE_NOT_STARTED +} PDO_STATE; + +typedef enum _PDO_CAPS { + PDO_CAPABILITY_UNDEFINED = 0, + PDO_CAPABILITY_INC512_SET = 1, + PDO_CAPABILITY_INC512_CLEAR = 2 +} PDO_CAPS; + +typedef struct _ENUM_PDO_ENTRY { + UCHAR type; + UCHAR state; + UCHAR capabilities; + ULONG ulSTID; + UCHAR bSpecificationMajor; + UCHAR bSpecificationMinor; + UCHAR bImplementationMajor; + UCHAR bImplementationMinor; + WCHAR wszDeviceInstancePath[(2 * MAX_PATH) + 1]; +} ENUM_PDO_ENTRY, *PENUM_PDO_ENTRY; + +typedef struct _ENUM_PDO_RESULTS { + ULONG cEntries; + ENUM_PDO_ENTRY rgEntries[ANYSIZE_ARRAY]; +} ENUM_PDO_RESULTS, *PENUM_PDO_RESULTS; Propchange: branches/header-work/include/ddk/usbstorioctl.h ------------------------------------------------------------------------------ svn:eol-style = native
14 years, 9 months
1
0
0
0
[fireball] 45845: [RTL] - Fix Samuel's mistake of assuming that xmlstrs are zero-terminated by adding a xmlstr2unicode function, which returns a UNICODE_STRING representation of xmlstr suitable for printing. No debug log garbage now (disadvantage: more code changes compared to the original code).
by fireball@svn.reactos.org
Author: fireball Date: Thu Mar 4 23:05:34 2010 New Revision: 45845 URL:
http://svn.reactos.org/svn/reactos?rev=45845&view=rev
Log: [RTL] - Fix Samuel's mistake of assuming that xmlstrs are zero-terminated by adding a xmlstr2unicode function, which returns a UNICODE_STRING representation of xmlstr suitable for printing. No debug log garbage now (disadvantage: more code changes compared to the original code). Modified: trunk/reactos/lib/rtl/actctx.c Modified: trunk/reactos/lib/rtl/actctx.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/actctx.c?rev=45845…
============================================================================== --- trunk/reactos/lib/rtl/actctx.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/actctx.c [iso-8859-1] Thu Mar 4 23:05:34 2010 @@ -232,6 +232,16 @@ strW[str->len] = 0; } return strW; +} + +static UNICODE_STRING xmlstr2unicode(const xmlstr_t *xmlstr) +{ + UNICODE_STRING res; + + res.Buffer = (PWSTR)xmlstr->ptr; + res.Length = res.MaximumLength = xmlstr->len; + + return res; } static inline BOOL xmlstr_cmp(const xmlstr_t* xmlstr, const WCHAR *str) @@ -732,6 +742,7 @@ unsigned int ver[4]; unsigned int pos; const WCHAR *curr; + UNICODE_STRING strU; /* major.minor.build.revision */ ver[0] = ver[1] = ver[2] = ver[3] = pos = 0; @@ -755,28 +766,34 @@ return TRUE; error: - DPRINT1( "Wrong version definition in manifest file (%S)\n", str->ptr ); + strU = xmlstr2unicode(str); + DPRINT1( "Wrong version definition in manifest file (%wZ)\n", &strU ); return FALSE; } static BOOL parse_expect_elem(xmlbuf_t* xmlbuf, const WCHAR* name) { xmlstr_t elem; + UNICODE_STRING elemU; if (!next_xml_elem(xmlbuf, &elem)) return FALSE; if (xmlstr_cmp(&elem, name)) return TRUE; - DPRINT1( "unexpected element %S\n", elem.ptr ); + elemU = xmlstr2unicode(&elem); + DPRINT1( "unexpected element %wZ\n", &elemU ); return FALSE; } static BOOL parse_expect_no_attr(xmlbuf_t* xmlbuf, BOOL* end) { xmlstr_t attr_name, attr_value; + UNICODE_STRING attr_nameU, attr_valueU; BOOL error; while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, end)) { - DPRINT1( "unexpected attr %S=%S\n", attr_name.ptr, - attr_value.ptr); + attr_nameU = xmlstr2unicode(&attr_name); + attr_valueU = xmlstr2unicode(&attr_name); + DPRINT1( "unexpected attr %S=%S\n", &attr_nameU, + &attr_valueU); } return !error; } @@ -790,10 +807,12 @@ static BOOL parse_expect_end_elem(xmlbuf_t *xmlbuf, const WCHAR *name) { xmlstr_t elem; + UNICODE_STRING elemU; if (!next_xml_elem(xmlbuf, &elem)) return FALSE; if (!xmlstr_cmp_end(&elem, name)) { - DPRINT1( "unexpected element %S\n", elem.ptr ); + elemU = xmlstr2unicode(&elem); + DPRINT1( "unexpected element %wZ\n", &elemU ); return FALSE; } return parse_end_element(xmlbuf); @@ -824,6 +843,7 @@ { xmlstr_t attr_name, attr_value; BOOL end = FALSE, error; + UNICODE_STRING attr_valueU, attr_nameU; while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end)) { @@ -849,14 +869,15 @@ } else if (xmlstr_cmp(&attr_name, languageW)) { + if (!(ai->language = xmlstrdupW(&attr_value))) return FALSE; DPRINT1("Unsupported yet language attribute (%S)\n", - attr_value.ptr); - if (!(ai->language = xmlstrdupW(&attr_value))) return FALSE; + ai->language); } else { - DPRINT1("unknown attr %S=%S\n", attr_name.ptr, - attr_value.ptr); + attr_nameU = xmlstr2unicode(&attr_name); + attr_valueU = xmlstr2unicode(&attr_value); + DPRINT1("unknown attr %wZ=%wZ\n", &attr_nameU, &attr_valueU); } } @@ -869,6 +890,7 @@ xmlstr_t elem, attr_name, attr_value; BOOL ret, end = FALSE, error; struct entity* entity; + UNICODE_STRING attr_valueU, attr_nameU; if (!(entity = add_entity(&dll->entities, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION))) return FALSE; @@ -881,7 +903,9 @@ } else { - DPRINT1("unknown attr %S=%S\n", attr_name.ptr, attr_value.ptr); + attr_nameU = xmlstr2unicode(&attr_name); + attr_valueU = xmlstr2unicode(&attr_value); + DPRINT1("unknown attr %wZ=%wZ\n", &attr_nameU, &attr_valueU); } } @@ -896,7 +920,8 @@ } else { - DPRINT1("unknown elem %S\n", elem.ptr); + attr_nameU = xmlstr2unicode(&elem); + DPRINT1("unknown elem %wZ\n", &attr_nameU); ret = parse_unknown_elem(xmlbuf, &elem); } } @@ -908,6 +933,7 @@ xmlstr_t attr_name, attr_value; BOOL end = FALSE, error; struct entity* entity; + UNICODE_STRING attr_valueU, attr_nameU; if (!(entity = add_entity(&dll->entities, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION))) return FALSE; @@ -924,7 +950,9 @@ } else { - DPRINT1("unknown attr %S=%S\n", attr_name.ptr, attr_value.ptr); + attr_nameU = xmlstr2unicode(&attr_name); + attr_valueU = xmlstr2unicode(&attr_value); + DPRINT1("unknown attr %wZ=%wZ\n", &attr_nameU, &attr_valueU); } } @@ -937,6 +965,7 @@ xmlstr_t attr_name, attr_value; BOOL end = FALSE, error; struct entity* entity; + UNICODE_STRING attr_valueU, attr_nameU; if (!(entity = add_entity(&dll->entities, ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION))) return FALSE; @@ -957,7 +986,9 @@ } else { - DPRINT1("unknown attr %S=%S\n", attr_name.ptr , attr_value.ptr); + attr_nameU = xmlstr2unicode(&attr_name); + attr_valueU = xmlstr2unicode(&attr_value); + DPRINT1("unknown attr %wZ=%wZ\n", &attr_nameU, &attr_valueU); } } @@ -970,6 +1001,7 @@ xmlstr_t elem, content; BOOL end = FALSE, ret = TRUE; struct entity* entity; + UNICODE_STRING elemU; if (!(entity = add_entity(&dll->entities, ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION))) return FALSE; @@ -990,7 +1022,8 @@ } else { - DPRINT1("unknown elem %S\n", elem.ptr); + elemU = xmlstr2unicode(&elem); + DPRINT1("unknown elem %wZ\n", &elemU); ret = parse_unknown_elem(xmlbuf, &elem); } } @@ -1001,21 +1034,25 @@ static BOOL parse_binding_redirect_elem(xmlbuf_t* xmlbuf) { xmlstr_t attr_name, attr_value; + UNICODE_STRING attr_valueU, attr_nameU; BOOL end = FALSE, error; while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end)) { + attr_nameU = xmlstr2unicode(&attr_name); + attr_valueU = xmlstr2unicode(&attr_value); + if (xmlstr_cmp(&attr_name, oldVersionW)) { - DPRINT1("Not stored yet oldVersion=%S\n", attr_value.ptr); + DPRINT1("Not stored yet oldVersion=%wZ\n", &attr_valueU); } else if (xmlstr_cmp(&attr_name, newVersionW)) { - DPRINT1("Not stored yet newVersion=%S\n", attr_value.ptr); + DPRINT1("Not stored yet newVersion=%wZ\n", &attr_valueU); } else { - DPRINT1("unknown attr %S=%S\n", attr_name.ptr, attr_value.ptr); + DPRINT1("unknown attr %wZ=%wZ\n", &attr_nameU, &attr_valueU); } } @@ -1026,13 +1063,15 @@ static BOOL parse_description_elem(xmlbuf_t* xmlbuf) { xmlstr_t elem, content; + UNICODE_STRING elemU; BOOL end = FALSE, ret = TRUE; if (!parse_expect_no_attr(xmlbuf, &end) || end || !parse_text_content(xmlbuf, &content)) return FALSE; - DPRINT("Got description %S\n", content.ptr); + elemU = xmlstr2unicode(&content); + DPRINT("Got description %wZ\n", &elemU); while (ret && (ret = next_xml_elem(xmlbuf, &elem))) { @@ -1043,7 +1082,8 @@ } else { - DPRINT1("unknown elem %S\n", elem.ptr); + elemU = xmlstr2unicode(&elem); + DPRINT1("unknown elem %wZ\n", &elemU); ret = parse_unknown_elem(xmlbuf, &elem); } } @@ -1084,6 +1124,7 @@ static BOOL parse_clr_class_elem(xmlbuf_t* xmlbuf, struct assembly* assembly) { xmlstr_t attr_name, attr_value; + UNICODE_STRING attr_nameU, attr_valueU; BOOL end = FALSE, error; struct entity* entity; @@ -1102,7 +1143,9 @@ } else { - DPRINT1("unknown attr %S=%S\n", attr_name.ptr, attr_value.ptr); + attr_nameU = xmlstr2unicode(&attr_name); + attr_valueU = xmlstr2unicode(&attr_value); + DPRINT1("unknown attr %wZ=%wZ\n", &attr_nameU, &attr_valueU); } } @@ -1113,6 +1156,7 @@ static BOOL parse_clr_surrogate_elem(xmlbuf_t* xmlbuf, struct assembly* assembly) { xmlstr_t attr_name, attr_value; + UNICODE_STRING attr_nameU, attr_valueU; BOOL end = FALSE, error; struct entity* entity; @@ -1131,7 +1175,9 @@ } else { - DPRINT1("unknown attr %S=%S\n", attr_name.ptr, attr_value.ptr); + attr_nameU = xmlstr2unicode(&attr_name); + attr_valueU = xmlstr2unicode(&attr_value); + DPRINT1("unknown attr %wZ=%wZ\n", &attr_nameU, &attr_valueU); } } @@ -1181,19 +1227,23 @@ static BOOL parse_dependency_elem(xmlbuf_t* xmlbuf, struct actctx_loader* acl) { xmlstr_t attr_name, attr_value, elem; + UNICODE_STRING attr_nameU, attr_valueU; BOOL end = FALSE, ret = TRUE, error, optional = FALSE; while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end)) { + attr_nameU = xmlstr2unicode(&attr_name); + attr_valueU = xmlstr2unicode(&attr_value); + if (xmlstr_cmp(&attr_name, optionalW)) { static const WCHAR yesW[] = {'y','e','s',0}; optional = xmlstr_cmpi( &attr_value, yesW ); - DPRINT1("optional=%S\n", attr_value.ptr); + DPRINT1("optional=%wZ\n", &attr_valueU); } else { - DPRINT1("unknown attr %S=%S\n", attr_name.ptr, attr_value.ptr); + DPRINT1("unknown attr %wZ=%wZ\n", &attr_nameU, &attr_valueU); } } @@ -1210,7 +1260,8 @@ } else { - DPRINT1("unknown element %S\n", elem.ptr); + attr_nameU = xmlstr2unicode(&elem); + DPRINT1("unknown element %wZ\n", &attr_nameU); ret = parse_unknown_elem(xmlbuf, &elem); } } @@ -1237,6 +1288,7 @@ static BOOL parse_file_elem(xmlbuf_t* xmlbuf, struct assembly* assembly) { xmlstr_t attr_name, attr_value, elem; + UNICODE_STRING attr_nameU, attr_valueU; BOOL end = FALSE, error, ret = TRUE; struct dll_redirect* dll; @@ -1244,10 +1296,13 @@ while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end)) { + attr_nameU = xmlstr2unicode(&attr_name); + attr_valueU = xmlstr2unicode(&attr_value); + if (xmlstr_cmp(&attr_name, nameW)) { if (!(dll->name = xmlstrdupW(&attr_value))) return FALSE; - DPRINT("name=%S\n", attr_value.ptr); + DPRINT("name=%wZ\n", &attr_valueU); } else if (xmlstr_cmp(&attr_name, hashW)) { @@ -1257,11 +1312,11 @@ { static const WCHAR sha1W[] = {'S','H','A','1',0}; if (!xmlstr_cmpi(&attr_value, sha1W)) - DPRINT1("hashalg should be SHA1, got %S\n", attr_value.ptr); + DPRINT1("hashalg should be SHA1, got %wZ\n", &attr_valueU); } else { - DPRINT1("unknown attr %S=%S\n", attr_name.ptr, attr_value.ptr); + DPRINT1("unknown attr %wZ=%wZ\n", &attr_nameU, &attr_valueU); } } @@ -1298,7 +1353,8 @@ } else { - DPRINT1("unknown elem %S\n", elem.ptr); + attr_nameU = xmlstr2unicode(&elem); + DPRINT1("unknown elem %wZ\n", &attr_nameU); ret = parse_unknown_elem( xmlbuf, &elem ); } } @@ -1311,16 +1367,20 @@ struct assembly_identity* expected_ai) { xmlstr_t attr_name, attr_value, elem; + UNICODE_STRING attr_nameU, attr_valueU; BOOL end = FALSE, error, version = FALSE, xmlns = FALSE, ret = TRUE; while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end)) { + attr_nameU = xmlstr2unicode(&attr_name); + attr_valueU = xmlstr2unicode(&attr_value); + if (xmlstr_cmp(&attr_name, manifestVersionW)) { static const WCHAR v10W[] = {'1','.','0',0}; if (!xmlstr_cmp(&attr_value, v10W)) { - DPRINT1("wrong version %S\n", attr_value.ptr); + DPRINT1("wrong version %wZ\n", &attr_valueU); return FALSE; } version = TRUE; @@ -1329,14 +1389,14 @@ { if (!xmlstr_cmp(&attr_value, manifestv1W) && !xmlstr_cmp(&attr_value, manifestv3W)) { - DPRINT1("wrong namespace %S\n", attr_value.ptr); + DPRINT1("wrong namespace %wZ\n", &attr_valueU); return FALSE; } xmlns = TRUE; } else { - DPRINT1("unknown attr %S=%S\n", attr_name.ptr, attr_value.ptr); + DPRINT1("unknown attr %wZ=%wZ\n", &attr_nameU, &attr_valueU); } } @@ -1421,7 +1481,8 @@ } else { - DPRINT1("unknown element %S\n", elem.ptr); + attr_nameU = xmlstr2unicode(&elem); + DPRINT1("unknown element %wZ\n", &attr_nameU); ret = parse_unknown_elem(xmlbuf, &elem); } if (ret) ret = next_xml_elem(xmlbuf, &elem); @@ -1434,6 +1495,7 @@ struct assembly_identity* ai, xmlbuf_t *xmlbuf ) { xmlstr_t elem; + UNICODE_STRING elemU; if (!next_xml_elem(xmlbuf, &elem)) return STATUS_SXS_CANT_GEN_ACTCTX; @@ -1443,7 +1505,8 @@ if (!xmlstr_cmp(&elem, assemblyW)) { - DPRINT1("root element is %S, not <assembly>\n", elem.ptr); + elemU = xmlstr2unicode(&elem); + DPRINT1("root element is %wZ, not <assembly>\n", &elemU); return STATUS_SXS_CANT_GEN_ACTCTX; } @@ -1455,7 +1518,8 @@ if (next_xml_elem(xmlbuf, &elem)) { - DPRINT1("unexpected element %S\n", elem.ptr); + elemU = xmlstr2unicode(&elem); + DPRINT1("unexpected element %wZ\n", &elemU); return STATUS_SXS_CANT_GEN_ACTCTX; }
14 years, 9 months
1
0
0
0
[cgutman] 45844: - Implement VideoPortIsNoVesa
by cgutman@svn.reactos.org
Author: cgutman Date: Thu Mar 4 22:53:12 2010 New Revision: 45844 URL:
http://svn.reactos.org/svn/reactos?rev=45844&view=rev
Log: - Implement VideoPortIsNoVesa Modified: trunk/reactos/drivers/video/videoprt/videoprt.c trunk/reactos/drivers/video/videoprt/videoprt.spec Modified: trunk/reactos/drivers/video/videoprt/videoprt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/videoprt/vid…
============================================================================== --- trunk/reactos/drivers/video/videoprt/videoprt.c [iso-8859-1] (original) +++ trunk/reactos/drivers/video/videoprt/videoprt.c [iso-8859-1] Thu Mar 4 22:53:12 2010 @@ -1417,3 +1417,99 @@ return MmAllocateContiguousMemory(NumberOfBytes, HighestAcceptableAddress); } + +/* + * @implemented + */ +BOOLEAN NTAPI +VideoPortIsNoVesa(VOID) +{ + NTSTATUS Status; + HANDLE KeyHandle; + UNICODE_STRING Path = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control"); + UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"SystemStartOptions"); + OBJECT_ATTRIBUTES ObjectAttributes; + PKEY_VALUE_PARTIAL_INFORMATION KeyInfo; + ULONG Length, NewLength; + + /* Initialize object attributes with the path we want */ + InitializeObjectAttributes(&ObjectAttributes, + &Path, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, + NULL); + + /* Open the key */ + Status = ZwOpenKey(&KeyHandle, + KEY_QUERY_VALUE, + &ObjectAttributes); + + if (!NT_SUCCESS(Status)) + { + VideoPortDebugPrint(Error, "ZwOpenKey failed (0x%x)\n", Status); + return FALSE; + } + + /* Find out how large our buffer should be */ + Status = ZwQueryValueKey(KeyHandle, + &ValueName, + KeyValuePartialInformation, + NULL, + 0, + &Length); + if (Status != STATUS_BUFFER_OVERFLOW && Status != STATUS_BUFFER_TOO_SMALL) + { + VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status); + ZwClose(KeyHandle); + return FALSE; + } + + /* Allocate it */ + KeyInfo = ExAllocatePool(PagedPool, Length); + if (!KeyInfo) + { + VideoPortDebugPrint(Error, "Out of memory\n"); + ZwClose(KeyHandle); + return FALSE; + } + + /* Now for real this time */ + Status = ZwQueryValueKey(KeyHandle, + &ValueName, + KeyValuePartialInformation, + KeyInfo, + Length, + &NewLength); + + ZwClose(KeyHandle); + + if (!NT_SUCCESS(Status)) + { + VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status); + ExFreePool(KeyInfo); + return FALSE; + } + + /* Sanity check */ + if (KeyInfo->Type != REG_SZ) + { + VideoPortDebugPrint(Error, "Invalid type for SystemStartOptions\n"); + ExFreePool(KeyInfo); + return FALSE; + } + + /* Check if NOVESA is present in the start options */ + if (wcsstr((PWCHAR)KeyInfo->Data, L"NOVESA")) + { + VideoPortDebugPrint(Info, "VESA mode disabled\n"); + ExFreePool(KeyInfo); + return TRUE; + } + + ExFreePool(KeyInfo); + + VideoPortDebugPrint(Info, "VESA mode enabled\n"); + + return FALSE; +} + Modified: trunk/reactos/drivers/video/videoprt/videoprt.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/videoprt/vid…
============================================================================== --- trunk/reactos/drivers/video/videoprt/videoprt.spec [iso-8859-1] (original) +++ trunk/reactos/drivers/video/videoprt/videoprt.spec [iso-8859-1] Thu Mar 4 22:53:12 2010 @@ -47,6 +47,7 @@ @ fastcall VideoPortInterlockedDecrement(ptr) NTOSKRNL.InterlockedDecrement @ fastcall VideoPortInterlockedExchange(ptr long) NTOSKRNL.InterlockedExchange @ fastcall VideoPortInterlockedIncrement(ptr) NTOSKRNL.InterlockedIncrement +@ stdcall VideoPortIsNoVesa() @ stdcall VideoPortLockBuffer(ptr ptr long long) @ stdcall VideoPortLockPages(ptr ptr ptr ptr long) @ stdcall VideoPortLogError(ptr ptr long long)
14 years, 9 months
1
0
0
0
[fireball] 45843: [PSDK] - Update RPC includes to Wine-1.1.39.
by fireball@svn.reactos.org
Author: fireball Date: Thu Mar 4 22:16:09 2010 New Revision: 45843 URL:
http://svn.reactos.org/svn/reactos?rev=45843&view=rev
Log: [PSDK] - Update RPC includes to Wine-1.1.39. Modified: trunk/reactos/dll/win32/rpcrt4/rpc_transport.c trunk/reactos/include/psdk/rpcdce.h trunk/reactos/include/psdk/rpcndr.h trunk/reactos/include/reactos/wine/rpcfc.h Modified: trunk/reactos/dll/win32/rpcrt4/rpc_transport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_trans…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_transport.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_transport.c [iso-8859-1] Thu Mar 4 22:16:09 2010 @@ -207,7 +207,7 @@ dwFlags |= SECURITY_DELEGATION; break; } - if (Connection->QOS->qos->IdentityTracking == RPC_C_QOS_IDENTIFY_DYNAMIC) + if (Connection->QOS->qos->IdentityTracking == RPC_C_QOS_IDENTITY_DYNAMIC) dwFlags |= SECURITY_CONTEXT_TRACKING; } pipe = CreateFileA(pname, GENERIC_READ|GENERIC_WRITE, 0, NULL, Modified: trunk/reactos/include/psdk/rpcdce.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/rpcdce.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/rpcdce.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/rpcdce.h [iso-8859-1] Thu Mar 4 22:16:09 2010 @@ -108,6 +108,11 @@ #define RPC_C_LISTEN_MAX_CALLS_DEFAULT 1234 #define RPC_C_PROTSEQ_MAX_REQS_DEFAULT 10 +#define RPC_PROTSEQ_TCP 0x1 +#define RPC_PROTSEQ_NMP 0x2 +#define RPC_PROTSEQ_LRPC 0x3 +#define RPC_PROTSEQ_HTTP 0x4 + /* RPC_POLICY EndpointFlags */ #define RPC_C_BIND_TO_ALL_NICS 0x1 #define RPC_C_USE_INTERNET_PORT 0x1 @@ -158,8 +163,8 @@ #define RPC_C_IMP_LEVEL_DELEGATE 4 /* values for RPC_SECURITY_QOS*::IdentityTracking */ -#define RPC_C_QOS_IDENTIFY_STATIC 0 -#define RPC_C_QOS_IDENTIFY_DYNAMIC 1 +#define RPC_C_QOS_IDENTITY_STATIC 0 +#define RPC_C_QOS_IDENTITY_DYNAMIC 1 /* flags for RPC_SECURITY_QOS*::Capabilities */ #define RPC_C_QOS_CAPABILITIES_DEFAULT 0x0 @@ -190,7 +195,7 @@ #define RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE 0x10 typedef RPC_STATUS RPC_ENTRY RPC_IF_CALLBACK_FN( RPC_IF_HANDLE InterfaceUuid, void *Context ); -typedef void (__RPC_USER *RPC_AUTH_KEY_RETRIEVAL_FN)( void *Arg, unsigned char *ServerPrincName, unsigned long KeyVer, void **Key, RPC_STATUS *Status ); +typedef void (__RPC_USER *RPC_AUTH_KEY_RETRIEVAL_FN)(void *, RPC_WSTR, ULONG, void **, RPC_STATUS *); typedef struct _RPC_POLICY { @@ -504,6 +509,28 @@ ULONG *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, ULONG *AuthzSvc ); #define RpcBindingInqAuthInfo WINELIB_NAME_AW(RpcBindingInqAuthInfo) +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcBindingInqAuthClientA( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, + RPC_CSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, + ULONG *AuthzSvc ); + +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcBindingInqAuthClientW( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, + RPC_WSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, + ULONG *AuthzSvc ); +#define RpcBindingInqAuthClient WINELIB_NAME_AW(RpcBindingInqAuthClient) + +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcBindingInqAuthClientExA( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, + RPC_CSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, + ULONG *AuthzSvc, ULONG Flags ); + +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcBindingInqAuthClientExW( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, + RPC_WSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, + ULONG *AuthzSvc, ULONG Flags ); +#define RpcBindingInqAuthClientEx WINELIB_NAME_AW(RpcBindingInqAuthClientEx) + RPCRTAPI RPC_STATUS RPC_ENTRY RpcCancelThread(void*); RPCRTAPI RPC_STATUS RPC_ENTRY RpcCancelThreadEx(void*,LONG); Modified: trunk/reactos/include/psdk/rpcndr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/rpcndr.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/rpcndr.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/rpcndr.h [iso-8859-1] Thu Mar 4 22:16:09 2010 @@ -104,8 +104,8 @@ #define small char typedef unsigned char byte; -#define hyper __int64 -#define MIDL_uhyper unsigned __int64 +typedef INT64 hyper; +typedef UINT64 MIDL_uhyper; typedef unsigned char boolean; #define __RPC_CALLEE WINAPI @@ -128,7 +128,7 @@ (RpcExceptionCode() == RPC_X_BAD_STUB_DATA) || \ (RpcExceptionCode() == RPC_S_INVALID_BOUND)) -typedef struct _NDR_SCONTEXT +typedef struct { void *pad[2]; void *userContext; @@ -211,19 +211,19 @@ struct _FULL_PTR_XLAT_TABLES *FullPtrXlatTables; ULONG FullPtrRefId; ULONG PointerLength; - int fInDontFree:1; - int fDontCallFreeInst:1; - int fInOnlyParam:1; - int fHasReturn:1; - int fHasExtensions:1; - int fHasNewCorrDesc:1; - int fIsIn:1; - int fIsOut:1; - int fIsOicf:1; - int fBufferValid:1; - int fHasMemoryValidateCallback:1; - int fInFree:1; - int fNeedMCCP:1; + unsigned int fInDontFree:1; + unsigned int fDontCallFreeInst:1; + unsigned int fInOnlyParam:1; + unsigned int fHasReturn:1; + unsigned int fHasExtensions:1; + unsigned int fHasNewCorrDesc:1; + unsigned int fIsIn:1; + unsigned int fIsOut:1; + unsigned int fIsOicf:1; + unsigned int fBufferValid:1; + unsigned int fHasMemoryValidateCallback:1; + unsigned int fInFree:1; + unsigned int fNeedMCCP:1; int fUnused:3; int fUnused2:16; DWORD dwDestContext; @@ -390,7 +390,11 @@ typedef void (__RPC_API *STUB_THUNK)( PMIDL_STUB_MESSAGE ); +#ifdef WINE_STRICT_PROTOTYPES +typedef LONG (__RPC_API *SERVER_ROUTINE)(void); +#else typedef LONG (__RPC_API *SERVER_ROUTINE)(); +#endif typedef struct _MIDL_SERVER_INFO_ { Modified: trunk/reactos/include/reactos/wine/rpcfc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/rpcfc…
============================================================================== --- trunk/reactos/include/reactos/wine/rpcfc.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/wine/rpcfc.h [iso-8859-1] Thu Mar 4 22:16:09 2010 @@ -167,6 +167,7 @@ #define RPC_FC_PROC_OIF_OBJECT 0x04 #define RPC_FC_PROC_OIF_RPCFLAGS 0x08 #define RPC_FC_PROC_OIF_OBJ_V2 0x20 +#define RPC_FC_PROC_OIF_HAS_COMM_OR_FAULT 0x20 #define RPC_FC_PROC_OIF_NEWINIT 0x40 #define RPC_FC_PROC_PF_MUSTSIZE 0x0001
14 years, 9 months
1
0
0
0
[cwittich] 45842: [SHELL32_WINETEST] sync shell32_winetest to wine 1.1.39
by cwittich@svn.reactos.org
Author: cwittich Date: Thu Mar 4 21:55:58 2010 New Revision: 45842 URL:
http://svn.reactos.org/svn/reactos?rev=45842&view=rev
Log: [SHELL32_WINETEST] sync shell32_winetest to wine 1.1.39 Modified: trunk/rostests/winetests/shell32/autocomplete.c trunk/rostests/winetests/shell32/progman_dde.c trunk/rostests/winetests/shell32/shelllink.c trunk/rostests/winetests/shell32/shellpath.c trunk/rostests/winetests/shell32/shlfileop.c Modified: trunk/rostests/winetests/shell32/autocomplete.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/autocom…
============================================================================== --- trunk/rostests/winetests/shell32/autocomplete.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/autocomplete.c [iso-8859-1] Thu Mar 4 21:55:58 2010 @@ -33,7 +33,8 @@ static HINSTANCE hinst; static int killfocus_count; -static BOOL test_init(void) { +static IAutoComplete *test_init(void) +{ HRESULT r; IAutoComplete* ac; IUnknown *acSource; @@ -44,7 +45,7 @@ if (r == REGDB_E_CLASSNOTREG) { win_skip("CLSID_AutoComplete is not registered\n"); - return FALSE; + return NULL; } ok(SUCCEEDED(r), "no IID_IAutoComplete (0x%08x)\n", r); @@ -54,7 +55,7 @@ if (r == REGDB_E_CLASSNOTREG) { win_skip("CLSID_ACLMulti is not registered\n"); - return FALSE; + return NULL; } ok(SUCCEEDED(r), "no IID_IACList (0x%08x)\n", r); @@ -62,9 +63,13 @@ r = IAutoComplete_Init(ac, hEdit, acSource, NULL, NULL); ok(SUCCEEDED(r), "Init failed (0x%08x)\n", r); - return TRUE; + IUnknown_Release(acSource); + + return ac; } -static void test_killfocus(void) { + +static void test_killfocus(void) +{ /* Test if WM_KILLFOCUS messages are handled properly by checking if * the parent receives an EN_KILLFOCUS message. */ SetFocus(hEdit); @@ -72,7 +77,9 @@ SetFocus(0); ok(killfocus_count == 1, "Expected one EN_KILLFOCUS message, got: %d\n", killfocus_count); } -static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { + +static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ switch(msg) { case WM_CREATE: /* create edit control */ @@ -87,7 +94,9 @@ } return DefWindowProcA(hWnd, msg, wParam, lParam); } -static void createMainWnd(void) { + +static void createMainWnd(void) +{ WNDCLASSA wc; wc.style = CS_HREDRAW | CS_VREDRAW; wc.cbClsExtra = 0; @@ -104,9 +113,12 @@ hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 130, 105, NULL, NULL, GetModuleHandleA(NULL), 0); } -START_TEST(autocomplete) { + +START_TEST(autocomplete) +{ HRESULT r; MSG msg; + IAutoComplete* ac; r = CoInitialize(NULL); ok(SUCCEEDED(r), "CoInitialize failed (0x%08x). Tests aborted.\n", r); @@ -118,7 +130,8 @@ if(!ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n")) return; - if (!test_init()) + ac = test_init(); + if (!ac) goto cleanup; test_killfocus(); @@ -128,6 +141,8 @@ DispatchMessageA(&msg); } + IAutoComplete_Release(ac); + cleanup: DestroyWindow(hEdit); DestroyWindow(hMainWnd); Modified: trunk/rostests/winetests/shell32/progman_dde.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/progman…
============================================================================== --- trunk/rostests/winetests/shell32/progman_dde.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/progman_dde.c [iso-8859-1] Thu Mar 4 21:55:58 2010 @@ -102,6 +102,30 @@ return TRUE; } +static BOOL full_title(void) +{ + CABINETSTATE cs; + + memset(&cs, 0, sizeof(cs)); + if (pReadCabinetState) + { + pReadCabinetState(&cs, sizeof(cs)); + } + else + { + HKEY key; + DWORD size; + + win_skip("ReadCabinetState is not available, reading registry directly\n"); + RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CabinetState", &key); + size = sizeof(cs); + RegQueryValueExA(key, "Settings", NULL, NULL, (LPBYTE)&cs, &size); + RegCloseKey(key); + } + + return (cs.fFullPathTitle == -1); +} + static char ProgramsDir[MAX_PATH]; static char Group1Title[MAX_PATH] = "Group1"; @@ -114,8 +138,6 @@ char startup[MAX_PATH]; char commonprograms[MAX_PATH]; char programs[MAX_PATH]; - - CABINETSTATE cs; if (pSHGetSpecialFolderPathA) { @@ -153,9 +175,7 @@ else lstrcpyA(ProgramsDir, programs); - memset(&cs, 0, sizeof(cs)); - pReadCabinetState(&cs, sizeof(cs)); - if (cs.fFullPathTitle == -1) + if (full_title()) { lstrcpyA(Group1Title, ProgramsDir); lstrcatA(Group1Title, "\\Group1"); Modified: trunk/rostests/winetests/shell32/shelllink.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shellli…
============================================================================== --- trunk/rostests/winetests/shell32/shelllink.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shelllink.c [iso-8859-1] Thu Mar 4 21:55:58 2010 @@ -207,6 +207,7 @@ } if (ret) ok(lstrcmpi(buffer,str)==0, "GetIDList returned '%s'\n", buffer); + pILFree(tmp_pidl); } pidl=path_to_pidl(mypath); @@ -214,6 +215,8 @@ if (pidl) { + LPITEMIDLIST second_pidl; + r = IShellLinkA_SetIDList(sl, pidl); ok(SUCCEEDED(r), "SetIDList failed (0x%08x)\n", r); @@ -223,7 +226,14 @@ ok(tmp_pidl && pILIsEqual(pidl, tmp_pidl), "GetIDList returned an incorrect pidl\n"); - /* tmp_pidl is owned by IShellLink so we don't free it */ + r = IShellLinkA_GetIDList(sl, &second_pidl); + ok(SUCCEEDED(r), "GetIDList failed (0x%08x)\n", r); + ok(second_pidl && pILIsEqual(pidl, second_pidl), + "GetIDList returned an incorrect pidl\n"); + ok(second_pidl != tmp_pidl, "pidls are the same\n"); + + pILFree(second_pidl); + pILFree(tmp_pidl); pILFree(pidl); strcpy(buffer,"garbage"); Modified: trunk/rostests/winetests/shell32/shellpath.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shellpa…
============================================================================== --- trunk/rostests/winetests/shell32/shellpath.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shellpath.c [iso-8859-1] Thu Mar 4 21:55:58 2010 @@ -675,7 +675,7 @@ */ static void testSystemDir(void) { - char systemShellPath[MAX_PATH], systemDir[MAX_PATH] = { 0 }; + char systemShellPath[MAX_PATH], systemDir[MAX_PATH], systemDirx86[MAX_PATH]; if (!pSHGetSpecialFolderPathA) return; @@ -689,13 +689,13 @@ systemDir, systemShellPath); } - if (!pGetSystemWow64DirectoryA || !pGetSystemWow64DirectoryA(systemDir, sizeof(systemDir))) - GetSystemDirectoryA(systemDir, sizeof(systemDir)); - myPathRemoveBackslashA(systemDir); + if (!pGetSystemWow64DirectoryA || !pGetSystemWow64DirectoryA(systemDirx86, sizeof(systemDirx86))) + GetSystemDirectoryA(systemDirx86, sizeof(systemDirx86)); + myPathRemoveBackslashA(systemDirx86); if (pSHGetSpecialFolderPathA(NULL, systemShellPath, CSIDL_SYSTEMX86, FALSE)) { myPathRemoveBackslashA(systemShellPath); - ok(!lstrcmpiA(systemDir, systemShellPath), + ok(!lstrcmpiA(systemDirx86, systemShellPath) || broken(!lstrcmpiA(systemDir, systemShellPath)), "GetSystemDirectory returns %s SHGetSpecialFolderPath returns %s\n", systemDir, systemShellPath); } Modified: trunk/rostests/winetests/shell32/shlfileop.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shlfile…
============================================================================== --- trunk/rostests/winetests/shell32/shlfileop.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shlfileop.c [iso-8859-1] Thu Mar 4 21:55:58 2010 @@ -46,6 +46,8 @@ ok(retval == ret ||\ broken(retval == ret_prewin32),\ "Expected %d, got %d\n", ret, retval) + +static BOOL old_shell32 = FALSE; static CHAR CURR_DIR[MAX_PATH]; static const WCHAR UNICODE_PATH[] = {'c',':','\\',0x00ae,'\0','\0'}; @@ -764,6 +766,8 @@ /* pTo already exist */ shfo.pFrom = "test1.txt\0"; shfo.pTo = "test2.txt\0"; + if (old_shell32) + shfo.fFlags |= FOF_NOCONFIRMMKDIR; retval = SHFileOperationA(&shfo); if (retval == ERROR_SUCCESS) { @@ -816,6 +820,12 @@ DWORD retval; LPSTR ptr; BOOL on_nt4 = FALSE; + + if (old_shell32) + { + win_skip("Too many differences for old shell32\n"); + return; + } shfo.hwnd = NULL; shfo.wFunc = FO_COPY; @@ -1710,6 +1720,21 @@ ok(DeleteFileA("ab.txt"), "Expected file to exist\n"); ok(RemoveDirectoryA("one"), "Expected dir to exist\n"); ok(RemoveDirectoryA("two"), "Expected dir to exist\n"); + + /* pTo is an empty string */ + CreateDirectoryA("dir", NULL); + createTestFile("dir\\abcdefgh.abc"); + shfo.pFrom = "dir\\abcdefgh.abc\0"; + shfo.pTo = "\0"; + shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI; + retval = SHFileOperation(&shfo); + ok(retval == ERROR_SUCCESS || + broken(retval == DE_OPCANCELLED), /* NT4 */ + "Expected ERROR_SUCCESS, got %d\n", retval); + if (retval == ERROR_SUCCESS) + ok(DeleteFileA("abcdefgh.abc"), "Expected file to exist\n"); + ok(DeleteFileA("dir\\abcdefgh.abc"), "Expected file to exist\n"); + ok(RemoveDirectoryA("dir"), "Expected dir to exist\n"); } /* tests the FO_MOVE action */ @@ -1751,6 +1776,8 @@ set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0"); + if (old_shell32) + shfo2.fFlags |= FOF_NOCONFIRMMKDIR; ok(!SHFileOperationA(&shfo2), "Move many files\n"); ok(DeleteFileA("test6.txt"), "The file is not moved - many files are " "specified as a target\n"); @@ -1765,12 +1792,23 @@ retval = SHFileOperationA(&shfo2); if (dir_exists("test6.txt")) { - /* Vista and W2K8 (broken or new behavior ?) */ - ok(retval == DE_DESTSAMETREE, "Expected DE_DESTSAMETREE, got %d\n", retval); - ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not moved\n"); - RemoveDirectoryA("test6.txt"); - ok(DeleteFileA("test7.txt\\test2.txt"), "The file is not moved\n"); - RemoveDirectoryA("test7.txt"); + if (retval == ERROR_SUCCESS) + { + /* Old shell32 */ + DeleteFileA("test6.txt\\test1.txt"); + DeleteFileA("test6.txt\\test2.txt"); + RemoveDirectoryA("test6.txt\\test4.txt"); + RemoveDirectoryA("test6.txt"); + } + else + { + /* Vista and W2K8 (broken or new behavior ?) */ + ok(retval == DE_DESTSAMETREE, "Expected DE_DESTSAMETREE, got %d\n", retval); + ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not moved\n"); + RemoveDirectoryA("test6.txt"); + ok(DeleteFileA("test7.txt\\test2.txt"), "The file is not moved\n"); + RemoveDirectoryA("test7.txt"); + } } else { @@ -1788,9 +1826,12 @@ set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0"); + if (old_shell32) + shfo.fFlags |= FOF_NOCONFIRMMKDIR; retval = SHFileOperationA(&shfo); if (dir_exists("test6.txt")) { + /* Old shell32 */ /* Vista and W2K8 (broken or new behavior ?) */ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval); ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not moved. Many files are specified\n"); @@ -1839,8 +1880,14 @@ else { ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval); + if (old_shell32) + { + DeleteFile("a.txt\\a.txt"); + RemoveDirectoryA("a.txt"); + } + else + ok(DeleteFile("a.txt"), "Expected a.txt to exist\n"); ok(!file_exists("test1.txt"), "Expected test1.txt to not exist\n"); - ok(DeleteFile("a.txt"), "Expected a.txt to exist\n"); } ok(!file_exists("b.txt"), "Expected b.txt to not exist\n"); @@ -1850,6 +1897,7 @@ retval = SHFileOperationA(&shfo); if (dir_exists("test1.txt")) { + /* Old shell32 */ /* Vista and W2K8 (broken or new behavior ?) */ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval); ok(DeleteFileA("test1.txt\\test2.txt"), "Expected test1.txt\\test2.txt to exist\n"); @@ -1882,6 +1930,7 @@ retval = SHFileOperationA(&shfo); if (dir_exists("d.txt")) { + /* Old shell32 */ /* Vista and W2K8 (broken or new behavior ?) */ ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval); ok(DeleteFileA("d.txt\\test2.txt"), "Expected d.txt\\test2.txt to exist\n"); @@ -1903,13 +1952,23 @@ retval = SHFileOperationA(&shfo); if (dir_exists("d.txt")) { - /* Vista and W2K8 (broken or new behavior ?) */ - ok(retval == DE_SAMEFILE, - "Expected DE_SAMEFILE, got %d\n", retval); - ok(DeleteFileA("d.txt\\test2.txt"), "Expected d.txt\\test2.txt to exist\n"); - ok(!file_exists("d.txt\\test3.txt"), "Expected d.txt\\test3.txt to not exist\n"); - RemoveDirectoryA("d.txt"); - createTestFile("test2.txt"); + if (old_shell32) + { + DeleteFileA("d.txt\\test2.txt"); + DeleteFileA("d.txt\\test3.txt"); + RemoveDirectoryA("d.txt"); + createTestFile("test2.txt"); + } + else + { + /* Vista and W2K8 (broken or new behavior ?) */ + ok(retval == DE_SAMEFILE, + "Expected DE_SAMEFILE, got %d\n", retval); + ok(DeleteFileA("d.txt\\test2.txt"), "Expected d.txt\\test2.txt to exist\n"); + ok(!file_exists("d.txt\\test3.txt"), "Expected d.txt\\test3.txt to not exist\n"); + RemoveDirectoryA("d.txt"); + createTestFile("test2.txt"); + } } else { @@ -1947,7 +2006,13 @@ { ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval); ok(!file_exists("test2.txt"), "Expected test2.txt to not exist\n"); - ok(file_exists("test3.txt"), "Expected test3.txt to exist\n"); + if (old_shell32) + { + DeleteFileA("test3.txt\\test3.txt"); + RemoveDirectoryA("test3.txt"); + } + else + ok(file_exists("test3.txt"), "Expected test3.txt to exist\n"); } } @@ -2224,6 +2289,55 @@ ok(!file_existsW(UNICODE_PATH), "The directory should have been removed\n"); } +extern HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags); + +static void +test_shlmenu(void) { + HRESULT hres; + hres = Shell_MergeMenus (0, 0, 0x42, 0x4242, 0x424242, 0); + ok (hres == 0x4242, "expected 0x4242 but got %x\n", hres); + hres = Shell_MergeMenus ((HMENU)42, 0, 0x42, 0x4242, 0x424242, 0); + ok (hres == 0x4242, "expected 0x4242 but got %x\n", hres); +} + +/* Check for old shell32 (4.0.x) */ +static BOOL is_old_shell32(void) +{ + SHFILEOPSTRUCTA shfo; + CHAR from[5*MAX_PATH]; + CHAR to[5*MAX_PATH]; + DWORD retval; + + shfo.hwnd = NULL; + shfo.wFunc = FO_COPY; + shfo.pFrom = from; + shfo.pTo = to; + /* FOF_NOCONFIRMMKDIR is needed for old shell32 */ + shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI | FOF_MULTIDESTFILES | FOF_NOCONFIRMMKDIR; + shfo.hNameMappings = NULL; + shfo.lpszProgressTitle = NULL; + + set_curr_dir_path(from, "test1.txt\0test2.txt\0test3.txt\0"); + set_curr_dir_path(to, "test6.txt\0test7.txt\0"); + retval = SHFileOperationA(&shfo); + + /* Delete extra files on old shell32 and Vista+*/ + DeleteFileA("test6.txt\\test1.txt"); + /* Delete extra files on old shell32 */ + DeleteFileA("test6.txt\\test2.txt"); + DeleteFileA("test6.txt\\test3.txt"); + /* Delete extra directory on old shell32 and Vista+ */ + RemoveDirectoryA("test6.txt"); + /* Delete extra files/directories on Vista+*/ + DeleteFileA("test7.txt\\test2.txt"); + RemoveDirectoryA("test7.txt"); + + if (retval == ERROR_SUCCESS) + return TRUE; + + return FALSE; +} + START_TEST(shlfileop) { InitFunctionPointers(); @@ -2231,6 +2345,12 @@ clean_after_shfo_tests(); init_shfo_tests(); + old_shell32 = is_old_shell32(); + if (old_shell32) + win_skip("Need to cater for old shell32 (4.0.x) on Win95\n"); + clean_after_shfo_tests(); + + init_shfo_tests(); test_get_file_info(); test_get_file_info_iconlist(); clean_after_shfo_tests(); @@ -2263,4 +2383,6 @@ clean_after_shfo_tests(); test_unicode(); + + test_shlmenu(); }
14 years, 9 months
1
0
0
0
[cwittich] 45841: [IPHLPAPI_WINETEST] sync iphlpapi_winetest to wine 1.1.39
by cwittich@svn.reactos.org
Author: cwittich Date: Thu Mar 4 21:55:41 2010 New Revision: 45841 URL:
http://svn.reactos.org/svn/reactos?rev=45841&view=rev
Log: [IPHLPAPI_WINETEST] sync iphlpapi_winetest to wine 1.1.39 Modified: trunk/rostests/winetests/iphlpapi/iphlpapi.c Modified: trunk/rostests/winetests/iphlpapi/iphlpapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/iphlpapi/iphlpa…
============================================================================== --- trunk/rostests/winetests/iphlpapi/iphlpapi.c [iso-8859-1] (original) +++ trunk/rostests/winetests/iphlpapi/iphlpapi.c [iso-8859-1] Thu Mar 4 21:55:41 2010 @@ -775,11 +775,12 @@ IpReleaseAddress IpRenewAddress */ -static void testWin98Functions(void) +static DWORD CALLBACK testWin98Functions(void *p) { testGetInterfaceInfo(); testGetAdaptersInfo(); testGetNetworkParams(); + return 0; } static void testGetPerAdapterInfo(void) @@ -839,6 +840,7 @@ ret = gGetAdaptersAddresses(AF_UNSPEC, 0, NULL, NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", ret); + size = 0; ret = gGetAdaptersAddresses(AF_UNSPEC, 0, NULL, NULL, &size); ok(ret == ERROR_BUFFER_OVERFLOW, "expected ERROR_BUFFER_OVERFLOW, got %u\n", ret); if (ret != ERROR_BUFFER_OVERFLOW) return; @@ -849,16 +851,16 @@ while (!ret && winetest_debug > 1 && aa) { - trace("Length: %u\n", aa->Length); - trace("IfIndex: %u\n", aa->IfIndex); + trace("Length: %u\n", S(U(*aa)).Length); + trace("IfIndex: %u\n", S(U(*aa)).IfIndex); trace("Next: %p\n", aa->Next); trace("AdapterName: %s\n", aa->AdapterName); trace("FirstUnicastAddress: %p\n", aa->FirstUnicastAddress); ua = aa->FirstUnicastAddress; while (ua) { - trace("\tLength: %u\n", ua->Length); - trace("\tFlags: 0x%08x\n", ua->Flags); + trace("\tLength: %u\n", S(U(*ua)).Length); + trace("\tFlags: 0x%08x\n", S(U(*ua)).Flags); trace("\tNext: %p\n", ua->Next); trace("\tAddress.lpSockaddr: %p\n", ua->Address.lpSockaddr); trace("\tAddress.iSockaddrLength: %d\n", ua->Address.iSockaddrLength); @@ -894,9 +896,16 @@ loadIPHlpApi(); if (hLibrary) { + HANDLE thread; + testWin98OnlyFunctions(); testWinNT4Functions(); - testWin98Functions(); + + /* run testGetXXXX in two threads at once to make sure we don't crash in that case */ + thread = CreateThread(NULL, 0, testWin98Functions, NULL, 0, NULL); + testWin98Functions(NULL); + WaitForSingleObject(thread, INFINITE); + testWin2KFunctions(); test_GetAdaptersAddresses(); freeIPHlpApi();
14 years, 9 months
1
0
0
0
[cwittich] 45840: [WINTRUST_WINETEST] sync wintrust_winetest to wine 1.1.39
by cwittich@svn.reactos.org
Author: cwittich Date: Thu Mar 4 21:46:06 2010 New Revision: 45840 URL:
http://svn.reactos.org/svn/reactos?rev=45840&view=rev
Log: [WINTRUST_WINETEST] sync wintrust_winetest to wine 1.1.39 Modified: trunk/rostests/winetests/wintrust/crypt.c trunk/rostests/winetests/wintrust/softpub.c Modified: trunk/rostests/winetests/wintrust/crypt.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wintrust/crypt.…
============================================================================== --- trunk/rostests/winetests/wintrust/crypt.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wintrust/crypt.c [iso-8859-1] Thu Mar 4 21:46:06 2010 @@ -515,6 +515,8 @@ ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n"); ok(error == ERROR_BAD_FORMAT, "got %u expected ERROR_BAD_FORMAT\n", GetLastError()); } + if (hcatinfo != NULL) + pCryptCATAdminReleaseCatalogContext(hcatadmin, hcatinfo, 0); SetLastError(0xdeadbeef); hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 1); Modified: trunk/rostests/winetests/wintrust/softpub.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wintrust/softpu…
============================================================================== --- trunk/rostests/winetests/wintrust/softpub.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wintrust/softpub.c [iso-8859-1] Thu Mar 4 21:46:06 2010 @@ -179,8 +179,12 @@ ok(data.pasSigners[0].pasCertChain != NULL, "Expected pasCertChain to be allocated\n"); if (data.pasSigners[0].pasCertChain) + { ok(data.pasSigners[0].pasCertChain[0].pCert == cert, "Unexpected cert\n"); + CertFreeCertificateContext( + data.pasSigners[0].pasCertChain[0].pCert); + } CertFreeCertificateContext(cert); } else @@ -266,6 +270,8 @@ PROVDATA_SIP provDataSIP = { 0 }; static const GUID unknown = { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47, 0x00,0xC0,0x4F,0xC2,0x95,0xEE } }; + static GUID bogusGuid = { 0xdeadbeef, 0xbaad, 0xf00d, { 0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00 } }; ret = funcs->pfnObjectTrust(&data); ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); @@ -316,6 +322,30 @@ ok(provDataSIP.pSip != NULL, "Expected a SIP\n"); ok(provDataSIP.psSipSubjectInfo != NULL, "Expected a subject info\n"); + } + /* Specifying the GUID results in that GUID being the subject GUID */ + fileInfo.pgKnownSubject = &bogusGuid; + ret = funcs->pfnObjectTrust(&data); + ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); + ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == + TRUST_E_NOSIGNATURE || + data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == + TRUST_E_SUBJECT_FORM_UNKNOWN || + data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == + TRUST_E_PROVIDER_UNKNOWN, + "Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN or TRUST_E_PROVIDER_UNKNOWN, got %08x\n", + data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]); + if (data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == + TRUST_E_NOSIGNATURE) + { + ok(!memcmp(&provDataSIP.gSubject, &bogusGuid, sizeof(bogusGuid)), + "unexpected subject GUID\n"); + } + /* Specifying a bogus GUID pointer crashes */ + if (0) + { + fileInfo.pgKnownSubject = (GUID *)0xdeadbeef; + ret = funcs->pfnObjectTrust(&data); } funcs->pfnFree(data.padwTrustStepErrors); } @@ -407,6 +437,9 @@ (CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST), "Expected CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST, got %08x\n", data.pasSigners[0].pasCertChain[0].dwConfidence); + CertFreeCertificateContext( + data.pasSigners[0].pasCertChain[0].pCert); + CertFreeCertificateChain(data.pasSigners[0].pChainContext); CertFreeCertificateContext(cert); } }
14 years, 9 months
1
0
0
0
[cwittich] 45839: [WINDOWSCODECS] sync windowscodecs to wine 1.1.39
by cwittich@svn.reactos.org
Author: cwittich Date: Thu Mar 4 21:42:21 2010 New Revision: 45839 URL:
http://svn.reactos.org/svn/reactos?rev=45839&view=rev
Log: [WINDOWSCODECS] sync windowscodecs to wine 1.1.39 Modified: trunk/reactos/dll/win32/windowscodecs/pngformat.c Modified: trunk/reactos/dll/win32/windowscodecs/pngformat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/pn…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/pngformat.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/pngformat.c [iso-8859-1] Thu Mar 4 21:42:21 2010 @@ -51,6 +51,7 @@ MAKE_FUNCPTR(png_error); MAKE_FUNCPTR(png_get_bit_depth); MAKE_FUNCPTR(png_get_color_type); +MAKE_FUNCPTR(png_get_error_ptr); MAKE_FUNCPTR(png_get_image_height); MAKE_FUNCPTR(png_get_image_width); MAKE_FUNCPTR(png_get_io_ptr); @@ -58,8 +59,9 @@ MAKE_FUNCPTR(png_get_PLTE); MAKE_FUNCPTR(png_get_tRNS); MAKE_FUNCPTR(png_set_bgr); +MAKE_FUNCPTR(png_set_error_fn); +MAKE_FUNCPTR(png_set_expand_gray_1_2_4_to_8); MAKE_FUNCPTR(png_set_filler); -MAKE_FUNCPTR(png_set_gray_1_2_4_to_8); MAKE_FUNCPTR(png_set_gray_to_rgb); MAKE_FUNCPTR(png_set_IHDR); MAKE_FUNCPTR(png_set_pHYs); @@ -92,6 +94,7 @@ LOAD_FUNCPTR(png_error); LOAD_FUNCPTR(png_get_bit_depth); LOAD_FUNCPTR(png_get_color_type); + LOAD_FUNCPTR(png_get_error_ptr); LOAD_FUNCPTR(png_get_image_height); LOAD_FUNCPTR(png_get_image_width); LOAD_FUNCPTR(png_get_io_ptr); @@ -99,8 +102,9 @@ LOAD_FUNCPTR(png_get_PLTE); LOAD_FUNCPTR(png_get_tRNS); LOAD_FUNCPTR(png_set_bgr); + LOAD_FUNCPTR(png_set_error_fn); + LOAD_FUNCPTR(png_set_expand_gray_1_2_4_to_8); LOAD_FUNCPTR(png_set_filler); - LOAD_FUNCPTR(png_set_gray_1_2_4_to_8); LOAD_FUNCPTR(png_set_gray_to_rgb); LOAD_FUNCPTR(png_set_IHDR); LOAD_FUNCPTR(png_set_pHYs); @@ -118,6 +122,23 @@ #undef LOAD_FUNCPTR } return libpng_handle; +} + +static void user_error_fn(png_structp png_ptr, png_const_charp error_message) +{ + jmp_buf *pjmpbuf; + + /* This uses setjmp/longjmp just like the default. We can't use the + * default because there's no way to access the jmp buffer in the png_struct + * that works in 1.2 and 1.4 and allows us to dynamically load libpng. */ + WARN("PNG error: %s\n", debugstr_a(error_message)); + pjmpbuf = ppng_get_error_ptr(png_ptr); + longjmp(*pjmpbuf, 1); +} + +static void user_warning_fn(png_structp png_ptr, png_const_charp warning_message) +{ + WARN("PNG warning: %s\n", debugstr_a(warning_message)); } typedef struct { @@ -226,6 +247,8 @@ int num_trans; png_uint_32 transparency; png_color_16p trans_values; + jmp_buf jmpbuf; + TRACE("(%p,%p,%x)\n", iface, pIStream, cacheOptions); /* initialize libpng */ @@ -249,13 +272,14 @@ } /* set up setjmp/longjmp error handling */ - if (setjmp(png_jmpbuf(This->png_ptr))) + if (setjmp(jmpbuf)) { ppng_destroy_read_struct(&This->png_ptr, &This->info_ptr, &This->end_info); HeapFree(GetProcessHeap(), 0, row_pointers); This->png_ptr = NULL; return E_FAIL; } + ppng_set_error_fn(This->png_ptr, &jmpbuf, user_error_fn, user_warning_fn); /* seek to the start of the stream */ seek.QuadPart = 0; @@ -282,7 +306,7 @@ { if (bit_depth < 8) { - ppng_set_gray_1_2_4_to_8(This->png_ptr); + ppng_set_expand_gray_1_2_4_to_8(This->png_ptr); bit_depth = 8; } ppng_set_gray_to_rgb(This->png_ptr); @@ -849,6 +873,7 @@ PngEncoder *This = encoder_from_frame(iface); png_byte **row_pointers=NULL; UINT i; + jmp_buf jmpbuf; TRACE("(%p,%u,%u,%u,%p)\n", iface, lineCount, cbStride, cbBufferSize, pbPixels); if (!This->frame_initialized || !This->width || !This->height || !This->format) @@ -858,11 +883,12 @@ return E_INVALIDARG; /* set up setjmp/longjmp error handling */ - if (setjmp(png_jmpbuf(This->png_ptr))) + if (setjmp(jmpbuf)) { HeapFree(GetProcessHeap(), 0, row_pointers); return E_FAIL; } + ppng_set_error_fn(This->png_ptr, &jmpbuf, user_error_fn, user_warning_fn); if (!This->info_written) { @@ -978,16 +1004,18 @@ static HRESULT WINAPI PngFrameEncode_Commit(IWICBitmapFrameEncode *iface) { PngEncoder *This = encoder_from_frame(iface); + jmp_buf jmpbuf; TRACE("(%p)\n", iface); if (!This->info_written || This->lines_written != This->height || This->frame_committed) return WINCODEC_ERR_WRONGSTATE; /* set up setjmp/longjmp error handling */ - if (setjmp(png_jmpbuf(This->png_ptr))) + if (setjmp(jmpbuf)) { return E_FAIL; } + ppng_set_error_fn(This->png_ptr, &jmpbuf, user_error_fn, user_warning_fn); ppng_write_end(This->png_ptr, This->info_ptr); @@ -1093,6 +1121,7 @@ IStream *pIStream, WICBitmapEncoderCacheOption cacheOption) { PngEncoder *This = (PngEncoder*)iface; + jmp_buf jmpbuf; TRACE("(%p,%p,%u)\n", iface, pIStream, cacheOption); @@ -1116,7 +1145,7 @@ This->stream = pIStream; /* set up setjmp/longjmp error handling */ - if (setjmp(png_jmpbuf(This->png_ptr))) + if (setjmp(jmpbuf)) { ppng_destroy_write_struct(&This->png_ptr, &This->info_ptr); This->png_ptr = NULL; @@ -1124,6 +1153,7 @@ This->stream = NULL; return E_FAIL; } + ppng_set_error_fn(This->png_ptr, &jmpbuf, user_error_fn, user_warning_fn); /* set up custom i/o handling */ ppng_set_write_fn(This->png_ptr, This, user_write_data, user_flush);
14 years, 9 months
1
0
0
0
[cwittich] 45838: [WINTRUST] sync wintrust to wine 1.1.39
by cwittich@svn.reactos.org
Author: cwittich Date: Thu Mar 4 21:39:41 2010 New Revision: 45838 URL:
http://svn.reactos.org/svn/reactos?rev=45838&view=rev
Log: [WINTRUST] sync wintrust to wine 1.1.39 Modified: trunk/reactos/dll/win32/wintrust/asn.c trunk/reactos/dll/win32/wintrust/crypt.c trunk/reactos/dll/win32/wintrust/softpub.c trunk/reactos/dll/win32/wintrust/wintrust_main.c Modified: trunk/reactos/dll/win32/wintrust/asn.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wintrust/asn.c?r…
============================================================================== --- trunk/reactos/dll/win32/wintrust/asn.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wintrust/asn.c [iso-8859-1] Thu Mar 4 21:39:41 2010 @@ -1469,6 +1469,11 @@ */ #define ALIGN_DWORD_PTR(x) (((x) + sizeof(DWORD_PTR) - 1) & ~(sizeof(DWORD_PTR) - 1)) +#define FINALMEMBERSIZE(s, member) (sizeof(s) - offsetof(s, member)) +#define MEMBERSIZE(s, member, nextmember) \ + (offsetof(s, nextmember) - offsetof(s, member)) + + /* Decodes the items in a sequence, where the items are described in items, * the encoded data are in pbEncoded with length cbEncoded. Decodes into * pvStructInfo. nextData is a pointer to the memory location at which the @@ -1520,8 +1525,13 @@ : NULL, &items[i].size); if (ret) { - /* Account for alignment padding */ - items[i].size = ALIGN_DWORD_PTR(items[i].size); + if (items[i].size < items[i].minSize) + items[i].size = items[i].minSize; + else if (items[i].size > items[i].minSize) + { + /* Account for alignment padding */ + items[i].size = ALIGN_DWORD_PTR(items[i].size); + } TRACE("item %d size: %d\n", i, items[i].size); if (nextData && items[i].hasPointer && items[i].size > items[i].minSize) @@ -2179,62 +2189,24 @@ return ret; } -static BOOL CRYPT_AsnDecodeInteger(const BYTE *pbEncoded, - DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo) -{ - BOOL ret; - DWORD bytesNeeded, dataLen; - - if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen))) - { - BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]); - - bytesNeeded = dataLen + sizeof(CRYPT_INTEGER_BLOB); - if (!pvStructInfo) - *pcbStructInfo = bytesNeeded; - else if (*pcbStructInfo < bytesNeeded) - { - *pcbStructInfo = bytesNeeded; - SetLastError(ERROR_MORE_DATA); - ret = FALSE; - } - else - { - CRYPT_INTEGER_BLOB *blob = pvStructInfo; - - *pcbStructInfo = bytesNeeded; - blob->cbData = dataLen; - assert(blob->pbData); - if (blob->cbData) - { - DWORD i; - - for (i = 0; i < blob->cbData; i++) - { - blob->pbData[i] = *(pbEncoded + 1 + lenBytes + - dataLen - i - 1); - } - } - } - } - return ret; -} - /* Ignores tag. Only allows integers 4 bytes or smaller in size. */ static BOOL WINAPI CRYPT_AsnDecodeInt(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo) { BOOL ret; - BYTE buf[sizeof(CRYPT_INTEGER_BLOB) + sizeof(int)]; - CRYPT_INTEGER_BLOB *blob = (CRYPT_INTEGER_BLOB *)buf; - DWORD size = sizeof(buf); - - blob->pbData = buf + sizeof(CRYPT_INTEGER_BLOB); - ret = CRYPT_AsnDecodeInteger(pbEncoded, cbEncoded, 0, buf, &size); - if (ret) - { - if (!pvStructInfo) + DWORD dataLen; + + if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen))) + { + BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]); + + if (dataLen > sizeof(int)) + { + SetLastError(CRYPT_E_ASN1_LARGE); + ret = FALSE; + } + else if (!pvStructInfo) *pcbStructInfo = sizeof(int); else if (*pcbStructInfo < sizeof(int)) { @@ -2248,23 +2220,21 @@ DWORD i; *pcbStructInfo = sizeof(int); - if (blob->pbData[blob->cbData - 1] & 0x80) + if (dataLen && pbEncoded[1 + lenBytes] & 0x80) { /* initialize to a negative value to sign-extend */ val = -1; } else val = 0; - for (i = 0; i < blob->cbData; i++) + for (i = 0; i < dataLen; i++) { val <<= 8; - val |= blob->pbData[blob->cbData - i - 1]; + val |= pbEncoded[1 + lenBytes + i]; } memcpy(pvStructInfo, &val, sizeof(int)); } } - else if (GetLastError() == ERROR_MORE_DATA) - SetLastError(CRYPT_E_ASN1_LARGE); return ret; } @@ -2284,7 +2254,7 @@ CRYPT_AsnDecodeBMPString, sizeof(LPWSTR), FALSE, TRUE, offsetof(CAT_MEMBERINFO, pwszSubjGuid), 0 }, { ASN_INTEGER, offsetof(CAT_MEMBERINFO, dwCertVersion), - CRYPT_AsnDecodeInt, sizeof(DWORD), + CRYPT_AsnDecodeInt, FINALMEMBERSIZE(CAT_MEMBERINFO, dwCertVersion), FALSE, FALSE, 0, 0 }, }; @@ -2317,7 +2287,8 @@ CRYPT_AsnDecodeBMPString, sizeof(LPWSTR), FALSE, TRUE, offsetof(CAT_NAMEVALUE, pwszTag), 0 }, { ASN_INTEGER, offsetof(CAT_NAMEVALUE, fdwFlags), - CRYPT_AsnDecodeInt, sizeof(DWORD), FALSE, FALSE, 0, 0 }, + CRYPT_AsnDecodeInt, MEMBERSIZE(CAT_NAMEVALUE, fdwFlags, Value), + FALSE, FALSE, 0, 0 }, { ASN_OCTETSTRING, offsetof(CAT_NAMEVALUE, Value), CRYPT_AsnDecodeOctets, sizeof(CRYPT_DER_BLOB), FALSE, TRUE, offsetof(CAT_NAMEVALUE, Value.pbData), 0 }, @@ -2391,9 +2362,11 @@ { struct AsnDecodeSequenceItem items[] = { { ASN_BOOL, offsetof(SPC_FINANCIAL_CRITERIA, fFinancialInfoAvailable), - CRYPT_AsnDecodeBool, sizeof(BOOL), FALSE, FALSE, 0, 0 }, + CRYPT_AsnDecodeBool, MEMBERSIZE(SPC_FINANCIAL_CRITERIA, + fFinancialInfoAvailable, fMeetsCriteria), FALSE, FALSE, 0, 0 }, { ASN_BOOL, offsetof(SPC_FINANCIAL_CRITERIA, fMeetsCriteria), - CRYPT_AsnDecodeBool, sizeof(BOOL), FALSE, FALSE, 0, 0 }, + CRYPT_AsnDecodeBool, FINALMEMBERSIZE(SPC_FINANCIAL_CRITERIA, + fMeetsCriteria), FALSE, FALSE, 0, 0 }, }; ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, Modified: trunk/reactos/dll/win32/wintrust/crypt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wintrust/crypt.c…
============================================================================== --- trunk/reactos/dll/win32/wintrust/crypt.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wintrust/crypt.c [iso-8859-1] Thu Mar 4 21:39:41 2010 @@ -1028,7 +1028,18 @@ /* app hasn't passed buffer, just get the length */ ret = ImageGetCertificateHeader(pSubjectInfo->hFile, dwIndex, &cert); if (ret) - *pcbSignedDataMsg = cert.dwLength; + { + switch (cert.wCertificateType) + { + case WIN_CERT_TYPE_X509: + case WIN_CERT_TYPE_PKCS_SIGNED_DATA: + *pcbSignedDataMsg = cert.dwLength; + break; + default: + WARN("unknown certificate type %d\n", cert.wCertificateType); + ret = FALSE; + } + } } else { @@ -1065,9 +1076,10 @@ *pdwEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING; break; default: - FIXME("don't know what to do for encoding type %d\n", + WARN("don't know what to do for encoding type %d\n", pCert->wCertificateType); *pdwEncodingType = 0; + ret = FALSE; } } } Modified: trunk/reactos/dll/win32/wintrust/softpub.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wintrust/softpub…
============================================================================== --- trunk/reactos/dll/win32/wintrust/softpub.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wintrust/softpub.c [iso-8859-1] Thu Mar 4 21:39:41 2010 @@ -75,9 +75,9 @@ /* Assumes data->pWintrustData->u.pFile exists. Makes sure a file handle is * open for the file. */ -static BOOL SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data) -{ - BOOL ret = TRUE; +static DWORD SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data) +{ + DWORD err = ERROR_SUCCESS; /* PSDK implies that all values should be initialized to NULL, so callers * typically have hFile as NULL rather than INVALID_HANDLE_VALUE. Check @@ -92,65 +92,64 @@ if (data->pWintrustData->u.pFile->hFile != INVALID_HANDLE_VALUE) data->fOpenedFile = TRUE; else - ret = FALSE; - } - if (ret) + err = GetLastError(); + } + if (!err) GetFileTime(data->pWintrustData->u.pFile->hFile, &data->sftSystemTime, NULL, NULL); - TRACE("returning %d\n", ret); - return ret; + TRACE("returning %d\n", err); + return err; } /* Assumes data->pWintrustData->u.pFile exists. Sets data->pPDSip->gSubject to * the file's subject GUID. */ -static BOOL SOFTPUB_GetFileSubject(CRYPT_PROVIDER_DATA *data) -{ - BOOL ret; +static DWORD SOFTPUB_GetFileSubject(CRYPT_PROVIDER_DATA *data) +{ + DWORD err = ERROR_SUCCESS; if (!WVT_ISINSTRUCT(WINTRUST_FILE_INFO, data->pWintrustData->u.pFile->cbStruct, pgKnownSubject) || !data->pWintrustData->u.pFile->pgKnownSubject) { - ret = CryptSIPRetrieveSubjectGuid( + if (!CryptSIPRetrieveSubjectGuid( data->pWintrustData->u.pFile->pcwszFilePath, data->pWintrustData->u.pFile->hFile, - &data->u.pPDSip->gSubject); - } - else - { + &data->u.pPDSip->gSubject)) + err = GetLastError(); + } + else data->u.pPDSip->gSubject = *data->pWintrustData->u.pFile->pgKnownSubject; - ret = TRUE; - } - TRACE("returning %d\n", ret); - return ret; + TRACE("returning %d\n", err); + return err; } /* Assumes data->u.pPDSip exists, and its gSubject member set. * Allocates data->u.pPDSip->pSip and loads it, if possible. */ -static BOOL SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data) -{ - BOOL ret; +static DWORD SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data) +{ + DWORD err = ERROR_SUCCESS; data->u.pPDSip->pSip = data->psPfns->pfnAlloc(sizeof(SIP_DISPATCH_INFO)); if (data->u.pPDSip->pSip) - ret = CryptSIPLoad(&data->u.pPDSip->gSubject, 0, data->u.pPDSip->pSip); - else - { - SetLastError(ERROR_OUTOFMEMORY); - ret = FALSE; - } - TRACE("returning %d\n", ret); - return ret; + { + if (!CryptSIPLoad(&data->u.pPDSip->gSubject, 0, data->u.pPDSip->pSip)) + err = GetLastError(); + } + else + err = ERROR_OUTOFMEMORY; + TRACE("returning %d\n", err); + return err; } /* Assumes data->u.pPDSip has been loaded, and data->u.pPDSip->pSip allocated. * Calls data->u.pPDSip->pSip->pfGet to construct data->hMsg. */ -static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file, +static DWORD SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file, LPCWSTR filePath) { + DWORD err = ERROR_SUCCESS; BOOL ret; LPBYTE buf = NULL; DWORD size = 0; @@ -158,10 +157,7 @@ data->u.pPDSip->psSipSubjectInfo = data->psPfns->pfnAlloc(sizeof(SIP_SUBJECTINFO)); if (!data->u.pPDSip->psSipSubjectInfo) - { - SetLastError(ERROR_OUTOFMEMORY); - return FALSE; - } + return ERROR_OUTOFMEMORY; data->u.pPDSip->psSipSubjectInfo->cbSize = sizeof(SIP_SUBJECTINFO); data->u.pPDSip->psSipSubjectInfo->pgSubjectType = &data->u.pPDSip->gSubject; @@ -171,17 +167,11 @@ ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo, &data->dwEncoding, 0, &size, 0); if (!ret) - { - SetLastError(TRUST_E_NOSIGNATURE); - return FALSE; - } + return TRUST_E_NOSIGNATURE; buf = data->psPfns->pfnAlloc(size); if (!buf) - { - SetLastError(ERROR_OUTOFMEMORY); - return FALSE; - } + return ERROR_OUTOFMEMORY; ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo, &data->dwEncoding, 0, &size, buf); @@ -190,88 +180,111 @@ data->hMsg = CryptMsgOpenToDecode(data->dwEncoding, 0, 0, data->hProv, NULL, NULL); if (data->hMsg) + { ret = CryptMsgUpdate(data->hMsg, buf, size, TRUE); - } + if (!ret) + err = GetLastError(); + } + } + else + err = GetLastError(); data->psPfns->pfnFree(buf); - TRACE("returning %d\n", ret); - return ret; -} - -static BOOL SOFTPUB_CreateStoreFromMessage(CRYPT_PROVIDER_DATA *data) -{ - BOOL ret = FALSE; + TRACE("returning %d\n", err); + return err; +} + +static DWORD SOFTPUB_CreateStoreFromMessage(CRYPT_PROVIDER_DATA *data) +{ + DWORD err = ERROR_SUCCESS; HCERTSTORE store; store = CertOpenStore(CERT_STORE_PROV_MSG, data->dwEncoding, data->hProv, CERT_STORE_NO_CRYPT_RELEASE_FLAG, data->hMsg); if (store) { - ret = data->psPfns->pfnAddStore2Chain(data, store); + if (!data->psPfns->pfnAddStore2Chain(data, store)) + err = GetLastError(); CertCloseStore(store, 0); } - TRACE("returning %d\n", ret); - return ret; + else + err = GetLastError(); + TRACE("returning %d\n", err); + return err; } static DWORD SOFTPUB_DecodeInnerContent(CRYPT_PROVIDER_DATA *data) { BOOL ret; - DWORD size; + DWORD size, err = ERROR_SUCCESS; LPSTR oid = NULL; LPBYTE buf = NULL; ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, NULL, &size); if (!ret) - goto error; + { + err = GetLastError(); + goto error; + } oid = data->psPfns->pfnAlloc(size); if (!oid) { - SetLastError(ERROR_OUTOFMEMORY); - ret = FALSE; + err = ERROR_OUTOFMEMORY; goto error; } ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, oid, &size); if (!ret) - goto error; + { + err = GetLastError(); + goto error; + } ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, NULL, &size); if (!ret) - goto error; + { + err = GetLastError(); + goto error; + } buf = data->psPfns->pfnAlloc(size); if (!buf) { - SetLastError(ERROR_OUTOFMEMORY); - ret = FALSE; + err = ERROR_OUTOFMEMORY; goto error; } ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, buf, &size); if (!ret) - goto error; + { + err = GetLastError(); + goto error; + } ret = CryptDecodeObject(data->dwEncoding, oid, buf, size, 0, NULL, &size); if (!ret) - goto error; + { + err = GetLastError(); + goto error; + } data->u.pPDSip->psIndirectData = data->psPfns->pfnAlloc(size); if (!data->u.pPDSip->psIndirectData) { - SetLastError(ERROR_OUTOFMEMORY); - ret = FALSE; + err = ERROR_OUTOFMEMORY; goto error; } ret = CryptDecodeObject(data->dwEncoding, oid, buf, size, 0, data->u.pPDSip->psIndirectData, &size); + if (!ret) + err = GetLastError(); error: - TRACE("returning %d\n", ret); + TRACE("returning %d\n", err); data->psPfns->pfnFree(oid); data->psPfns->pfnFree(buf); - return ret; -} - -static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data) -{ - BOOL ret; + return err; +} + +static DWORD SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data) +{ + DWORD err = ERROR_SUCCESS; if (data->pWintrustData->u.pCert && WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(WINTRUST_CERT_INFO, @@ -281,6 +294,7 @@ { CRYPT_PROVIDER_SGNR signer = { sizeof(signer), { 0 } }; DWORD i; + BOOL ret; /* Add a signer with nothing but the time to verify, so we can * add a cert to it @@ -308,55 +322,57 @@ ret = data->psPfns->pfnAddStore2Chain(data, data->pWintrustData->u.pCert->pahStores[i]); } - } - else - { - /* Do nothing!? See the tests */ - ret = TRUE; - } - } - else - { - SetLastError(ERROR_INVALID_PARAMETER); - ret = FALSE; - } - return ret; -} - -static BOOL SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data) -{ - BOOL ret; + if (!ret) + err = GetLastError(); + } + } + else + err = ERROR_INVALID_PARAMETER; + return err; +} + +static DWORD SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data) +{ + DWORD err = ERROR_SUCCESS; if (!data->pWintrustData->u.pFile) { - SetLastError(ERROR_INVALID_PARAMETER); - ret = FALSE; - goto error; - } - ret = SOFTPUB_OpenFile(data); - if (!ret) - goto error; - ret = SOFTPUB_GetFileSubject(data); - if (!ret) - goto error; - ret = SOFTPUB_GetSIP(data); - if (!ret) - goto error; - ret = SOFTPUB_GetMessageFromFile(data, data->pWintrustData->u.pFile->hFile, + err = ERROR_INVALID_PARAMETER; + goto error; + } + err = SOFTPUB_OpenFile(data); + if (err) + goto error; + err = SOFTPUB_GetFileSubject(data); + if (err) + goto error; + err = SOFTPUB_GetSIP(data); + if (err) + goto error; + err = SOFTPUB_GetMessageFromFile(data, data->pWintrustData->u.pFile->hFile, data->pWintrustData->u.pFile->pcwszFilePath); - if (!ret) - goto error; - ret = SOFTPUB_CreateStoreFromMessage(data); - if (!ret) - goto error; - ret = SOFTPUB_DecodeInnerContent(data); + if (err) + goto error; + err = SOFTPUB_CreateStoreFromMessage(data); + if (err) + goto error; + err = SOFTPUB_DecodeInnerContent(data); + error: - return ret; -} - -static BOOL SOFTPUB_LoadCatalogMessage(CRYPT_PROVIDER_DATA *data) -{ - BOOL ret; + if (err && data->fOpenedFile && data->pWintrustData->u.pFile) + { + /* The caller won't expect the file to be open on failure, so close it. + */ + CloseHandle(data->pWintrustData->u.pFile->hFile); + data->pWintrustData->u.pFile->hFile = INVALID_HANDLE_VALUE; + data->fOpenedFile = FALSE; + } + return err; +} + +static DWORD SOFTPUB_LoadCatalogMessage(CRYPT_PROVIDER_DATA *data) +{ + DWORD err; HANDLE catalog = INVALID_HANDLE_VALUE; if (!data->pWintrustData->u.pCatalog) @@ -368,32 +384,34 @@ GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (catalog == INVALID_HANDLE_VALUE) - return FALSE; - ret = CryptSIPRetrieveSubjectGuid( + return GetLastError(); + if (!CryptSIPRetrieveSubjectGuid( data->pWintrustData->u.pCatalog->pcwszCatalogFilePath, catalog, - &data->u.pPDSip->gSubject); - if (!ret) - goto error; - ret = SOFTPUB_GetSIP(data); - if (!ret) - goto error; - ret = SOFTPUB_GetMessageFromFile(data, catalog, + &data->u.pPDSip->gSubject)) + { + err = GetLastError(); + goto error; + } + err = SOFTPUB_GetSIP(data); + if (err) + goto error; + err = SOFTPUB_GetMessageFromFile(data, catalog, data->pWintrustData->u.pCatalog->pcwszCatalogFilePath); - if (!ret) - goto error; - ret = SOFTPUB_CreateStoreFromMessage(data); - if (!ret) - goto error; - ret = SOFTPUB_DecodeInnerContent(data); + if (err) + goto error; + err = SOFTPUB_CreateStoreFromMessage(data); + if (err) + goto error; + err = SOFTPUB_DecodeInnerContent(data); /* FIXME: this loads the catalog file, but doesn't validate the member. */ error: CloseHandle(catalog); - return ret; + return err; } HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data) { - BOOL ret; + DWORD err = ERROR_SUCCESS; TRACE("(%p)\n", data); @@ -403,26 +421,24 @@ switch (data->pWintrustData->dwUnionChoice) { case WTD_CHOICE_CERT: - ret = SOFTPUB_LoadCertMessage(data); + err = SOFTPUB_LoadCertMessage(data); break; case WTD_CHOICE_FILE: - ret = SOFTPUB_LoadFileMessage(data); + err = SOFTPUB_LoadFileMessage(data); break; case WTD_CHOICE_CATALOG: - ret = SOFTPUB_LoadCatalogMessage(data); + err = SOFTPUB_LoadCatalogMessage(data); break; default: FIXME("unimplemented for %d\n", data->pWintrustData->dwUnionChoice); - SetLastError(ERROR_INVALID_PARAMETER); - ret = FALSE; - } - - if (!ret) - data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] = - GetLastError(); - TRACE("returning %d (%08x)\n", ret ? S_OK : S_FALSE, + err = ERROR_INVALID_PARAMETER; + } + + if (err) + data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] = err; + TRACE("returning %d (%08x)\n", !err ? S_OK : S_FALSE, data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]); - return ret ? S_OK : S_FALSE; + return !err ? S_OK : S_FALSE; } static CMSG_SIGNER_INFO *WINTRUST_GetSigner(CRYPT_PROVIDER_DATA *data, @@ -453,9 +469,9 @@ return signerInfo; } -static BOOL WINTRUST_SaveSigner(CRYPT_PROVIDER_DATA *data, DWORD signerIdx) -{ - BOOL ret; +static DWORD WINTRUST_SaveSigner(CRYPT_PROVIDER_DATA *data, DWORD signerIdx) +{ + DWORD err; CMSG_SIGNER_INFO *signerInfo = WINTRUST_GetSigner(data, signerIdx); if (signerInfo) @@ -464,11 +480,14 @@ sgnr.psSigner = signerInfo; sgnr.sftVerifyAsOf = data->sftSystemTime; - ret = data->psPfns->pfnAddSgnr2Chain(data, FALSE, signerIdx, &sgnr); - } - else - ret = FALSE; - return ret; + if (!data->psPfns->pfnAddSgnr2Chain(data, FALSE, signerIdx, &sgnr)) + err = GetLastError(); + else + err = ERROR_SUCCESS; + } + else + err = GetLastError(); + return err; } static CERT_INFO *WINTRUST_GetSignerCertInfo(CRYPT_PROVIDER_DATA *data, @@ -499,9 +518,9 @@ return certInfo; } -static BOOL WINTRUST_VerifySigner(CRYPT_PROVIDER_DATA *data, DWORD signerIdx) -{ - BOOL ret; +static DWORD WINTRUST_VerifySigner(CRYPT_PROVIDER_DATA *data, DWORD signerIdx) +{ + DWORD err; CERT_INFO *certInfo = WINTRUST_GetSignerCertInfo(data, signerIdx); if (certInfo) @@ -514,30 +533,29 @@ CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA para = { sizeof(para), 0, signerIdx, CMSG_VERIFY_SIGNER_CERT, (LPVOID)subject }; - ret = CryptMsgControl(data->hMsg, 0, CMSG_CTRL_VERIFY_SIGNATURE_EX, - ¶); - if (!ret) - SetLastError(TRUST_E_CERT_SIGNATURE); + if (!CryptMsgControl(data->hMsg, 0, CMSG_CTRL_VERIFY_SIGNATURE_EX, + ¶)) + err = TRUST_E_CERT_SIGNATURE; else + { data->psPfns->pfnAddCert2Chain(data, signerIdx, FALSE, 0, subject); + err = ERROR_SUCCESS; + } CertFreeCertificateContext(subject); } else - { - SetLastError(TRUST_E_NO_SIGNER_CERT); - ret = FALSE; - } + err = TRUST_E_NO_SIGNER_CERT; data->psPfns->pfnFree(certInfo); } else - ret = FALSE; - return ret; + err = GetLastError(); + return err; } HRESULT WINAPI SoftpubLoadSignature(CRYPT_PROVIDER_DATA *data) { - BOOL ret; + DWORD err; TRACE("(%p)\n", data); @@ -549,27 +567,26 @@ DWORD signerCount, size; size = sizeof(signerCount); - ret = CryptMsgGetParam(data->hMsg, CMSG_SIGNER_COUNT_PARAM, 0, - &signerCount, &size); - if (ret) + if (CryptMsgGetParam(data->hMsg, CMSG_SIGNER_COUNT_PARAM, 0, + &signerCount, &size)) { DWORD i; - for (i = 0; ret && i < signerCount; i++) + err = ERROR_SUCCESS; + for (i = 0; !err && i < signerCount; i++) { - if ((ret = WINTRUST_SaveSigner(data, i))) - ret = WINTRUST_VerifySigner(data, i); + if (!(err = WINTRUST_SaveSigner(data, i))) + err = WINTRUST_VerifySigner(data, i); } } else - SetLastError(TRUST_E_NOSIGNATURE); - } - else - ret = TRUE; - if (!ret) - data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_SIGPROV] = - GetLastError(); - return ret ? S_OK : S_FALSE; + err = TRUST_E_NOSIGNATURE; + } + else + err = ERROR_SUCCESS; + if (err) + data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_SIGPROV] = err; + return !err ? S_OK : S_FALSE; } static DWORD WINTRUST_TrustStatusToConfidence(DWORD errorStatus) @@ -672,24 +689,22 @@ return error; } -static BOOL WINTRUST_CopyChain(CRYPT_PROVIDER_DATA *data, DWORD signerIdx) -{ - BOOL ret; +static DWORD WINTRUST_CopyChain(CRYPT_PROVIDER_DATA *data, DWORD signerIdx) +{ + DWORD err, i; PCERT_SIMPLE_CHAIN simpleChain = data->pasSigners[signerIdx].pChainContext->rgpChain[0]; - DWORD i; data->pasSigners[signerIdx].pasCertChain[0].dwConfidence = WINTRUST_TrustStatusToConfidence( simpleChain->rgpElement[0]->TrustStatus.dwErrorStatus); data->pasSigners[signerIdx].pasCertChain[0].pChainElement = simpleChain->rgpElement[0]; - ret = TRUE; - for (i = 1; ret && i < simpleChain->cElement; i++) - { - ret = data->psPfns->pfnAddCert2Chain(data, signerIdx, FALSE, 0, - simpleChain->rgpElement[i]->pCertContext); - if (ret) + err = ERROR_SUCCESS; + for (i = 1; !err && i < simpleChain->cElement; i++) + { + if (data->psPfns->pfnAddCert2Chain(data, signerIdx, FALSE, 0, + simpleChain->rgpElement[i]->pCertContext)) { data->pasSigners[signerIdx].pasCertChain[i].pChainElement = simpleChain->rgpElement[i]; @@ -697,12 +712,14 @@ WINTRUST_TrustStatusToConfidence( simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus); } + else + err = GetLastError(); } data->pasSigners[signerIdx].pasCertChain[simpleChain->cElement - 1].dwError = WINTRUST_TrustStatusToError( simpleChain->rgpElement[simpleChain->cElement - 1]-> TrustStatus.dwErrorStatus); - return ret; + return err; } static void WINTRUST_CreateChainPolicyCreateInfo( @@ -731,11 +748,11 @@ info->pvReserved = NULL; } -static BOOL WINTRUST_CreateChainForSigner(CRYPT_PROVIDER_DATA *data, +static DWORD WINTRUST_CreateChainForSigner(CRYPT_PROVIDER_DATA *data, DWORD signer, PWTD_GENERIC_CHAIN_POLICY_CREATE_INFO createInfo, PCERT_CHAIN_PARA chainPara) { - BOOL ret = TRUE; + DWORD err = ERROR_SUCCESS; HCERTSTORE store = NULL; if (data->chStores) @@ -749,53 +766,64 @@ for (i = 0; i < data->chStores; i++) CertAddStoreToCollection(store, data->pahStores[i], 0, 0); } - } - /* Expect the end certificate for each signer to be the only cert in the - * chain: - */ - if (data->pasSigners[signer].csCertChain) - { - /* Create a certificate chain for each signer */ - ret = CertGetCertificateChain(createInfo->hChainEngine, - data->pasSigners[signer].pasCertChain[0].pCert, - &data->pasSigners[signer].sftVerifyAsOf, store, - chainPara, createInfo->dwFlags, createInfo->pvReserved, - &data->pasSigners[signer].pChainContext); - if (ret) - { - if (data->pasSigners[signer].pChainContext->cChain != 1) + else + err = GetLastError(); + } + if (!err) + { + /* Expect the end certificate for each signer to be the only cert in + * the chain: + */ + if (data->pasSigners[signer].csCertChain) + { + BOOL ret; + + /* Create a certificate chain for each signer */ + ret = CertGetCertificateChain(createInfo->hChainEngine, + data->pasSigners[signer].pasCertChain[0].pCert, + &data->pasSigners[signer].sftVerifyAsOf, store, + chainPara, createInfo->dwFlags, createInfo->pvReserved, + &data->pasSigners[signer].pChainContext); + if (ret) { - FIXME("unimplemented for more than 1 simple chain\n"); - ret = FALSE; + if (data->pasSigners[signer].pChainContext->cChain != 1) + { + FIXME("unimplemented for more than 1 simple chain\n"); + err = E_NOTIMPL; + } + else + { + if (!(err = WINTRUST_CopyChain(data, signer))) + { + if (data->psPfns->pfnCertCheckPolicy) + { + ret = data->psPfns->pfnCertCheckPolicy(data, signer, + FALSE, 0); + if (!ret) + err = GetLastError(); + } + else + TRACE( + "no cert check policy, skipping policy check\n"); + } + } } else - { - if ((ret = WINTRUST_CopyChain(data, signer))) - { - if (data->psPfns->pfnCertCheckPolicy) - ret = data->psPfns->pfnCertCheckPolicy(data, signer, - FALSE, 0); - else - TRACE("no cert check policy, skipping policy check\n"); - } - } - } - } - CertCloseStore(store, 0); - return ret; + err = GetLastError(); + } + CertCloseStore(store, 0); + } + return err; } HRESULT WINAPI WintrustCertificateTrust(CRYPT_PROVIDER_DATA *data) { - BOOL ret; + DWORD err; TRACE("(%p)\n", data); if (!data->csSigners) - { - ret = FALSE; - SetLastError(TRUST_E_NOSIGNATURE); - } + err = TRUST_E_NOSIGNATURE; else { DWORD i; @@ -803,17 +831,16 @@ CERT_CHAIN_PARA chainPara; WINTRUST_CreateChainPolicyCreateInfo(data, &createInfo, &chainPara); - ret = TRUE; - for (i = 0; i < data->csSigners; i++) - ret = WINTRUST_CreateChainForSigner(data, i, &createInfo, + err = ERROR_SUCCESS; + for (i = 0; !err && i < data->csSigners; i++) + err = WINTRUST_CreateChainForSigner(data, i, &createInfo, &chainPara); } - if (!ret) - data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_CERTPROV] = - GetLastError(); - TRACE("returning %d (%08x)\n", ret ? S_OK : S_FALSE, + if (err) + data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_CERTPROV] = err; + TRACE("returning %d (%08x)\n", !err ? S_OK : S_FALSE, data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_CERTPROV]); - return ret ? S_OK : S_FALSE; + return !err ? S_OK : S_FALSE; } HRESULT WINAPI GenericChainCertificateTrust(CRYPT_PROVIDER_DATA *data) @@ -1078,7 +1105,8 @@ CryptMsgClose(data->hMsg); - if (data->fOpenedFile) + if (data->fOpenedFile && + data->pWintrustData->dwUnionChoice == WTD_CHOICE_FILE) CloseHandle(data->pWintrustData->u.pFile->hFile); return S_OK; Modified: trunk/reactos/dll/win32/wintrust/wintrust_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wintrust/wintrus…
============================================================================== --- trunk/reactos/dll/win32/wintrust/wintrust_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wintrust/wintrust_main.c [iso-8859-1] Thu Mar 4 21:39:41 2010 @@ -77,11 +77,118 @@ */ BOOL WINAPI TrustIsCertificateSelfSigned( PCCERT_CONTEXT cert ) { + PCERT_EXTENSION ext; + DWORD size; BOOL ret; TRACE("%p\n", cert); - ret = CertCompareCertificateName(cert->dwCertEncodingType, - &cert->pCertInfo->Subject, &cert->pCertInfo->Issuer); + if ((ext = CertFindExtension(szOID_AUTHORITY_KEY_IDENTIFIER2, + cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension))) + { + CERT_AUTHORITY_KEY_ID2_INFO *info; + + ret = CryptDecodeObjectEx(cert->dwCertEncodingType, + X509_AUTHORITY_KEY_ID2, ext->Value.pbData, ext->Value.cbData, + CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG, NULL, + &info, &size); + if (ret) + { + if (info->AuthorityCertIssuer.cAltEntry && + info->AuthorityCertSerialNumber.cbData) + { + PCERT_ALT_NAME_ENTRY directoryName = NULL; + DWORD i; + + for (i = 0; !directoryName && + i < info->AuthorityCertIssuer.cAltEntry; i++) + if (info->AuthorityCertIssuer.rgAltEntry[i].dwAltNameChoice + == CERT_ALT_NAME_DIRECTORY_NAME) + directoryName = + &info->AuthorityCertIssuer.rgAltEntry[i]; + if (directoryName) + { + ret = CertCompareCertificateName(cert->dwCertEncodingType, + &directoryName->u.DirectoryName, &cert->pCertInfo->Issuer) + && CertCompareIntegerBlob(&info->AuthorityCertSerialNumber, + &cert->pCertInfo->SerialNumber); + } + else + { + FIXME("no supported name type in authority key id2\n"); + ret = FALSE; + } + } + else if (info->KeyId.cbData) + { + ret = CertGetCertificateContextProperty(cert, + CERT_KEY_IDENTIFIER_PROP_ID, NULL, &size); + if (ret && size == info->KeyId.cbData) + { + LPBYTE buf = CryptMemAlloc(size); + + if (buf) + { + CertGetCertificateContextProperty(cert, + CERT_KEY_IDENTIFIER_PROP_ID, buf, &size); + ret = !memcmp(buf, info->KeyId.pbData, size); + CryptMemFree(buf); + } + else + ret = FALSE; + } + else + ret = FALSE; + } + LocalFree(info); + } + } + else if ((ext = CertFindExtension(szOID_AUTHORITY_KEY_IDENTIFIER, + cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension))) + { + CERT_AUTHORITY_KEY_ID_INFO *info; + + ret = CryptDecodeObjectEx(cert->dwCertEncodingType, + X509_AUTHORITY_KEY_ID, ext->Value.pbData, ext->Value.cbData, + CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG, NULL, + &info, &size); + if (ret) + { + if (info->CertIssuer.cbData && info->CertSerialNumber.cbData) + { + ret = CertCompareCertificateName(cert->dwCertEncodingType, + &info->CertIssuer, &cert->pCertInfo->Issuer) && + CertCompareIntegerBlob(&info->CertSerialNumber, + &cert->pCertInfo->SerialNumber); + } + else if (info->KeyId.cbData) + { + ret = CertGetCertificateContextProperty(cert, + CERT_KEY_IDENTIFIER_PROP_ID, NULL, &size); + if (ret && size == info->KeyId.cbData) + { + LPBYTE buf = CryptMemAlloc(size); + + if (buf) + { + CertGetCertificateContextProperty(cert, + CERT_KEY_IDENTIFIER_PROP_ID, buf, &size); + ret = !memcmp(buf, info->KeyId.pbData, size); + CryptMemFree(buf); + } + else + ret = FALSE; + } + else + ret = FALSE; + } + else + ret = FALSE; + LocalFree(info); + } + } + else + ret = CertCompareCertificateName(cert->dwCertEncodingType, + &cert->pCertInfo->Subject, &cert->pCertInfo->Issuer); return ret; }
14 years, 9 months
1
0
0
0
← Newer
1
...
76
77
78
79
80
81
82
...
90
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Results per page:
10
25
50
100
200