ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2017
----- 2025 -----
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
526 discussions
Start a n
N
ew thread
[akhaldi] 74891: [COMDLG32] Sync with Wine Staging 2.9. CORE-13362 6d3243c comdlg32: Postpone setting ofn->lpstrFileTitle to work around an application bug. 3c33ebd comdlg32: Use existing symbol fo...
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 01:52:26 2017 New Revision: 74891 URL:
http://svn.reactos.org/svn/reactos?rev=74891&view=rev
Log: [COMDLG32] Sync with Wine Staging 2.9. CORE-13362 6d3243c comdlg32: Postpone setting ofn->lpstrFileTitle to work around an application bug. 3c33ebd comdlg32: Use existing symbol for Help button id. 5d9ab56 comdlg32: Select the correct font before querying the extents. e77771c comdlg32: Set the radiobuttons' font if they're part of a visual group. 0099452 comdlg32: Use pixel sizes throughout. 6df0198 comdlg32: Scale the control size limits with dpi. 6891b5a comdlg32: Don't ask for icon information since it's unused. a44a608 comdlg32: Take nMaxFile into account when converting A->W. b47de18 comdlg32: Use GetPropW() to get to file dialog data. c23a91c comdlg32: Consolidate file dialog initialization to avoid duplication. aef8433 comdlg32: Expand initial directory path for file open dialog. Modified: trunk/reactos/dll/win32/comdlg32/colordlg.c trunk/reactos/dll/win32/comdlg32/filedlg.c trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c trunk/reactos/dll/win32/comdlg32/filedlgbrowser.h trunk/reactos/dll/win32/comdlg32/itemdlg.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/comdlg32/colordlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/colordl…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/colordlg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/colordlg.c [iso-8859-1] Sun Jun 4 01:52:26 2017 @@ -853,7 +853,7 @@ SetPropW( hDlg, szColourDialogProp, lpp ); if (!(lpp->lpcc->Flags & CC_SHOWHELP)) - ShowWindow( GetDlgItem(hDlg,0x40e), SW_HIDE); + ShowWindow(GetDlgItem(hDlg, pshHelp), SW_HIDE); lpp->msetrgb = RegisterWindowMessageA(SETRGBSTRINGA); #if 0 @@ -1029,7 +1029,7 @@ CC_PaintTriangle(lpp); break; - case 0x40e: /* Help! */ /* The Beatles, 1965 ;-) */ + case pshHelp: /* Help! */ /* The Beatles, 1965 ;-) */ i = RegisterWindowMessageA(HELPMSGSTRINGA); if (lpp->lpcc->hwndOwner) SendMessageA(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc); Modified: trunk/reactos/dll/win32/comdlg32/filedlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/filedlg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/filedlg.c [iso-8859-1] Sun Jun 4 01:52:26 2017 @@ -133,7 +133,6 @@ #define CBSetExtendedUI(hwnd,flag) \ SendMessageW(hwnd, CB_SETEXTENDEDUI, (WPARAM)(flag), 0) -const char FileOpenDlgInfosStr[] = "FileOpenDlgInfos"; /* windows property description string */ static const char LookInInfosStr[] = "LookInInfos"; /* LOOKIN combo box property */ static SIZE MemDialogSize = { 0, 0}; /* keep size of the (resizable) dialog */ @@ -143,6 +142,13 @@ 'E','x','p','l','o','r','e','r','\\','C','o','m','D','l','g','3','2','\\', 'L','a','s','t','V','i','s','i','t','e','d','M','R','U',0}; static const WCHAR MRUListW[] = {'M','R','U','L','i','s','t',0}; + +static const WCHAR filedlg_info_propnameW[] = {'F','i','l','e','O','p','e','n','D','l','g','I','n','f','o','s',0}; + +FileOpenDlgInfos *get_filedlg_infoptr(HWND hwnd) +{ + return GetPropW(hwnd, filedlg_info_propnameW); +} /*********************************************************************** * Prototypes @@ -289,248 +295,187 @@ return lRes; } -/*********************************************************************** - * GetFileDialog95A +static WCHAR *heap_strdupAtoW(const char *str) +{ + WCHAR *ret; + INT len; + + if (!str) + return NULL; + + len = MultiByteToWideChar(CP_ACP, 0, str, -1, 0, 0); + ret = MemAlloc(len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + + return ret; +} + +static void init_filedlg_infoW(OPENFILENAMEW *ofn, FileOpenDlgInfos *info) +{ + INITCOMMONCONTROLSEX icc; + + /* Initialize ComboBoxEx32 */ + icc.dwSize = sizeof(icc); + icc.dwICC = ICC_USEREX_CLASSES; + InitCommonControlsEx(&icc); + + /* Initialize CommDlgExtendedError() */ + COMDLG32_SetCommDlgExtendedError(0); + + memset(info, 0, sizeof(*info)); + + /* Pass in the original ofn */ + info->ofnInfos = ofn; + + info->title = ofn->lpstrTitle; + info->defext = ofn->lpstrDefExt; + info->filter = ofn->lpstrFilter; + info->customfilter = ofn->lpstrCustomFilter; + + if (ofn->lpstrFile) + { + info->filename = MemAlloc(ofn->nMaxFile * sizeof(WCHAR)); + lstrcpynW(info->filename, ofn->lpstrFile, ofn->nMaxFile); + } + + if (ofn->lpstrInitialDir) + { + DWORD len = ExpandEnvironmentStringsW(ofn->lpstrInitialDir, NULL, 0); + if (len) + { + info->initdir = MemAlloc(len * sizeof(WCHAR)); + ExpandEnvironmentStringsW(ofn->lpstrInitialDir, info->initdir, len); + } + } + + info->unicode = TRUE; +} + +static void init_filedlg_infoA(OPENFILENAMEA *ofn, FileOpenDlgInfos *info) +{ + OPENFILENAMEW ofnW; + int len; + + ofnW = *(OPENFILENAMEW *)ofn; + + ofnW.lpstrInitialDir = heap_strdupAtoW(ofn->lpstrInitialDir); + ofnW.lpstrDefExt = heap_strdupAtoW(ofn->lpstrDefExt); + ofnW.lpstrTitle = heap_strdupAtoW(ofn->lpstrTitle); + + if (ofn->lpstrFile) + { + len = MultiByteToWideChar(CP_ACP, 0, ofn->lpstrFile, ofn->nMaxFile, NULL, 0); + ofnW.lpstrFile = MemAlloc(len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, ofn->lpstrFile, ofn->nMaxFile, ofnW.lpstrFile, len); + ofnW.nMaxFile = len; + } + + if (ofn->lpstrFilter) + { + LPCSTR s; + int n; + + /* filter is a list... title\0ext\0......\0\0 */ + s = ofn->lpstrFilter; + while (*s) s = s+strlen(s)+1; + s++; + n = s - ofn->lpstrFilter; + len = MultiByteToWideChar(CP_ACP, 0, ofn->lpstrFilter, n, NULL, 0); + ofnW.lpstrFilter = MemAlloc(len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, ofn->lpstrFilter, n, (WCHAR *)ofnW.lpstrFilter, len); + } + + /* convert lpstrCustomFilter */ + if (ofn->lpstrCustomFilter) + { + int n, len; + LPCSTR s; + + /* customfilter contains a pair of strings... title\0ext\0 */ + s = ofn->lpstrCustomFilter; + if (*s) s = s+strlen(s)+1; + if (*s) s = s+strlen(s)+1; + n = s - ofn->lpstrCustomFilter; + len = MultiByteToWideChar(CP_ACP, 0, ofn->lpstrCustomFilter, n, NULL, 0); + ofnW.lpstrCustomFilter = MemAlloc(len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, ofn->lpstrCustomFilter, n, ofnW.lpstrCustomFilter, len); + } + + init_filedlg_infoW(&ofnW, info); + + /* fixup A-specific fields */ + info->ofnInfos = (OPENFILENAMEW *)ofn; + info->unicode = FALSE; + + /* free what was duplicated */ + MemFree((WCHAR *)ofnW.lpstrInitialDir); + MemFree((WCHAR *)ofnW.lpstrFile); +} + +/*********************************************************************** + * GetFileDialog95 * * Call GetFileName95 with this structure and clean the memory. - * - * IN : The OPENFILENAMEA initialisation structure passed to - * GetOpenFileNameA win api function (see filedlg.c) - */ -static BOOL GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType) -{ - BOOL ret; - FileOpenDlgInfos fodInfos; - LPSTR lpstrSavDir = NULL; - LPWSTR title = NULL; - LPWSTR defext = NULL; - LPWSTR filter = NULL; - LPWSTR customfilter = NULL; - INITCOMMONCONTROLSEX icc; - - /* Initialize ComboBoxEx32 */ - icc.dwSize = sizeof(icc); - icc.dwICC = ICC_USEREX_CLASSES; - InitCommonControlsEx(&icc); - - /* Initialize CommDlgExtendedError() */ - COMDLG32_SetCommDlgExtendedError(0); - - /* Initialize FileOpenDlgInfos structure */ - ZeroMemory(&fodInfos, sizeof(FileOpenDlgInfos)); - - /* Pass in the original ofn */ - fodInfos.ofnInfos = (LPOPENFILENAMEW)ofn; - - /* save current directory */ - if (ofn->Flags & OFN_NOCHANGEDIR) - { - lpstrSavDir = MemAlloc(MAX_PATH); - GetCurrentDirectoryA(MAX_PATH, lpstrSavDir); - } - - fodInfos.unicode = FALSE; - - /* convert all the input strings to unicode */ - if(ofn->lpstrInitialDir) - { - DWORD len = MultiByteToWideChar( CP_ACP, 0, ofn->lpstrInitialDir, -1, NULL, 0 ); - fodInfos.initdir = MemAlloc((len+1)*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrInitialDir, -1, fodInfos.initdir, len); - } - else - fodInfos.initdir = NULL; - - if(ofn->lpstrFile) - { - fodInfos.filename = MemAlloc(ofn->nMaxFile*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrFile, -1, fodInfos.filename, ofn->nMaxFile); - } - else - fodInfos.filename = NULL; - - if(ofn->lpstrDefExt) - { - DWORD len = MultiByteToWideChar( CP_ACP, 0, ofn->lpstrDefExt, -1, NULL, 0 ); - defext = MemAlloc((len+1)*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrDefExt, -1, defext, len); - } - fodInfos.defext = defext; - - if(ofn->lpstrTitle) - { - DWORD len = MultiByteToWideChar( CP_ACP, 0, ofn->lpstrTitle, -1, NULL, 0 ); - title = MemAlloc((len+1)*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrTitle, -1, title, len); - } - fodInfos.title = title; - - if (ofn->lpstrFilter) - { - LPCSTR s; - int n, len; - - /* filter is a list... title\0ext\0......\0\0 */ - s = ofn->lpstrFilter; - while (*s) s = s+strlen(s)+1; - s++; - n = s - ofn->lpstrFilter; - len = MultiByteToWideChar( CP_ACP, 0, ofn->lpstrFilter, n, NULL, 0 ); - filter = MemAlloc(len*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrFilter, n, filter, len ); - } - fodInfos.filter = filter; - - /* convert lpstrCustomFilter */ - if (ofn->lpstrCustomFilter) - { - LPCSTR s; - int n, len; - - /* customfilter contains a pair of strings... title\0ext\0 */ - s = ofn->lpstrCustomFilter; - if (*s) s = s+strlen(s)+1; - if (*s) s = s+strlen(s)+1; - n = s - ofn->lpstrCustomFilter; - len = MultiByteToWideChar( CP_ACP, 0, ofn->lpstrCustomFilter, n, NULL, 0 ); - customfilter = MemAlloc(len*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrCustomFilter, n, customfilter, len ); - } - fodInfos.customfilter = customfilter; - - /* Initialize the dialog property */ - fodInfos.DlgInfos.dwDlgProp = 0; - fodInfos.DlgInfos.hwndCustomDlg = NULL; - - switch(iDlgType) - { - case OPEN_DIALOG : - ret = GetFileName95(&fodInfos); - break; - case SAVE_DIALOG : - fodInfos.DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; - ret = GetFileName95(&fodInfos); - break; - default : - ret = FALSE; - } - - /* set the lpstrFileTitle */ - if (ret && ofn->lpstrFile && ofn->lpstrFileTitle) - { - LPSTR lpstrFileTitle = PathFindFileNameA(ofn->lpstrFile); - lstrcpynA(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle); - } - - if (lpstrSavDir) - { - SetCurrentDirectoryA(lpstrSavDir); - MemFree(lpstrSavDir); - } - - MemFree(title); - MemFree(defext); - MemFree(filter); - MemFree(customfilter); - MemFree(fodInfos.initdir); - MemFree(fodInfos.filename); - - TRACE("selected file: %s\n",ofn->lpstrFile); - - return ret; -} - -/*********************************************************************** - * GetFileDialog95W - * - * Copy the OPENFILENAMEW structure in a FileOpenDlgInfos structure. - * Call GetFileName95 with this structure and clean the memory. - * - */ -static BOOL GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType) -{ - BOOL ret; - FileOpenDlgInfos fodInfos; - LPWSTR lpstrSavDir = NULL; - INITCOMMONCONTROLSEX icc; - - /* Initialize ComboBoxEx32 */ - icc.dwSize = sizeof(icc); - icc.dwICC = ICC_USEREX_CLASSES; - InitCommonControlsEx(&icc); - - /* Initialize CommDlgExtendedError() */ - COMDLG32_SetCommDlgExtendedError(0); - - /* Initialize FileOpenDlgInfos structure */ - ZeroMemory(&fodInfos, sizeof(FileOpenDlgInfos)); - - /* Pass in the original ofn */ - fodInfos.ofnInfos = ofn; - - fodInfos.title = ofn->lpstrTitle; - fodInfos.defext = ofn->lpstrDefExt; - fodInfos.filter = ofn->lpstrFilter; - fodInfos.customfilter = ofn->lpstrCustomFilter; - - /* convert string arguments, save others */ - if(ofn->lpstrFile) - { - fodInfos.filename = MemAlloc(ofn->nMaxFile*sizeof(WCHAR)); - lstrcpynW(fodInfos.filename,ofn->lpstrFile,ofn->nMaxFile); - } - else - fodInfos.filename = NULL; - - if(ofn->lpstrInitialDir) - { - /* fodInfos.initdir = strdupW(ofn->lpstrInitialDir); */ - DWORD len = lstrlenW(ofn->lpstrInitialDir)+1; - fodInfos.initdir = MemAlloc(len*sizeof(WCHAR)); - memcpy(fodInfos.initdir,ofn->lpstrInitialDir,len*sizeof(WCHAR)); - } - else - fodInfos.initdir = NULL; - - /* save current directory */ - if (ofn->Flags & OFN_NOCHANGEDIR) - { - lpstrSavDir = MemAlloc(MAX_PATH*sizeof(WCHAR)); - GetCurrentDirectoryW(MAX_PATH, lpstrSavDir); - } - - fodInfos.unicode = TRUE; - - switch(iDlgType) - { - case OPEN_DIALOG : - ret = GetFileName95(&fodInfos); - break; - case SAVE_DIALOG : - fodInfos.DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; - ret = GetFileName95(&fodInfos); - break; - default : - ret = FALSE; - } - - /* set the lpstrFileTitle */ - if (ret && ofn->lpstrFile && ofn->lpstrFileTitle) - { - LPWSTR lpstrFileTitle = PathFindFileNameW(ofn->lpstrFile); - lstrcpynW(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle); - } - - if (lpstrSavDir) - { - SetCurrentDirectoryW(lpstrSavDir); - MemFree(lpstrSavDir); - } - - /* restore saved IN arguments and convert OUT arguments back */ - MemFree(fodInfos.filename); - MemFree(fodInfos.initdir); - return ret; + */ +static BOOL GetFileDialog95(FileOpenDlgInfos *info, UINT dlg_type) +{ + WCHAR *current_dir = NULL; + BOOL ret; + + /* save current directory */ + if (info->ofnInfos->Flags & OFN_NOCHANGEDIR) + { + current_dir = MemAlloc(MAX_PATH * sizeof(WCHAR)); + GetCurrentDirectoryW(MAX_PATH, current_dir); + } + + switch (dlg_type) + { + case OPEN_DIALOG: + ret = GetFileName95(info); + break; + case SAVE_DIALOG: + info->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; + ret = GetFileName95(info); + break; + default: + ret = FALSE; + } + + /* set the lpstrFileTitle */ + if (ret && info->ofnInfos->lpstrFile && info->ofnInfos->lpstrFileTitle) + { + if (info->unicode) + { + LPOPENFILENAMEW ofn = info->ofnInfos; + WCHAR *file_title = PathFindFileNameW(ofn->lpstrFile); + lstrcpynW(ofn->lpstrFileTitle, file_title, ofn->nMaxFileTitle); + } + else + { + LPOPENFILENAMEA ofn = (LPOPENFILENAMEA)info->ofnInfos; + char *file_title = PathFindFileNameA(ofn->lpstrFile); + lstrcpynA(ofn->lpstrFileTitle, file_title, ofn->nMaxFileTitle); + } + } + + if (current_dir) + { + SetCurrentDirectoryW(current_dir); + MemFree(current_dir); + } + + if (!info->unicode) + { + MemFree((WCHAR *)info->defext); + MemFree((WCHAR *)info->title); + MemFree((WCHAR *)info->filter); + MemFree((WCHAR *)info->customfilter); + } + + MemFree(info->filename); + MemFree(info->initdir); + return ret; } /****************************************************************************** @@ -895,8 +840,8 @@ LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndParentDlg); LRESULT hook_result = 0; - FileOpenDlgInfos *fodInfos = GetPropA(hwndParentDlg,FileOpenDlgInfosStr); TRACE("%p 0x%04x\n",hwndParentDlg, uCode); @@ -935,7 +880,7 @@ { UINT len, total; WCHAR *p, *buffer; - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("CDM_GETFILEPATH:\n"); @@ -975,7 +920,7 @@ */ static INT_PTR FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); WCHAR lpstrPath[MAX_PATH]; INT_PTR retval; @@ -1058,7 +1003,7 @@ */ static LRESULT FILEDLG95_OnWMGetMMI( HWND hwnd, LPMINMAXINFO mmiptr) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); if( !(fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)) return FALSE; if( fodInfos->initial_size.x || fodInfos->initial_size.y) { @@ -1086,7 +1031,7 @@ FileOpenDlgInfos *fodInfos; if( wParam != SIZE_RESTORED) return FALSE; - fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(hwnd); if( !(fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)) return FALSE; /* get the new dialog rectangle */ GetWindowRect( hwnd, &rc); @@ -1247,9 +1192,7 @@ if (SUCCEEDED(OleInitialize(NULL))) fodInfos->ole_initialized = TRUE; - /* Adds the FileOpenDlgInfos in the property list of the dialog - so it will be easily accessible through a GetPropA(...) */ - SetPropA(hwnd, FileOpenDlgInfosStr, fodInfos); + SetPropW(hwnd, filedlg_info_propnameW, fodInfos); FILEDLG95_InitControls(hwnd); @@ -1359,10 +1302,10 @@ case WM_DESTROY: { - FileOpenDlgInfos * fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos * fodInfos = get_filedlg_infoptr(hwnd); if (fodInfos && fodInfos->ofnInfos->Flags & OFN_ENABLESIZING) MemDialogSize = fodInfos->sizedlg; - RemovePropA(hwnd, FileOpenDlgInfosStr); + RemovePropW(hwnd, filedlg_info_propnameW); return FALSE; } case WM_NOTIFY: @@ -1452,7 +1395,7 @@ SHFILEINFOA shFileInfo; ITEMIDLIST *desktopPidl; - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("%p\n", fodInfos); @@ -1879,9 +1822,9 @@ */ static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); WORD wNotifyCode = HIWORD(wParam); /* notification code */ WORD wID = LOWORD(wParam); /* item, control, or accelerator identifier */ - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); switch(wID) { @@ -1942,7 +1885,7 @@ */ static LRESULT FILEDLG95_OnWMGetIShellBrowser(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("\n"); @@ -2000,9 +1943,9 @@ */ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCount, UINT sizeUsed) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); WCHAR lpstrPathSpec[MAX_PATH] = {0}; UINT nCount, nSizePath; - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); TRACE("\n"); @@ -2429,6 +2372,7 @@ */ BOOL FILEDLG95_OnOpen(HWND hwnd) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); LPWSTR lpstrFileList; UINT nFileCount = 0; UINT sizeUsed = 0; @@ -2436,7 +2380,6 @@ WCHAR lpstrPathAndFile[MAX_PATH]; LPSHELLFOLDER lpsf = NULL; int nOpenAction; - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); TRACE("hwnd=%p\n", hwnd); @@ -2798,7 +2741,7 @@ */ static LRESULT FILEDLG95_SHELL_Init(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("\n"); @@ -2833,7 +2776,7 @@ */ static BOOL FILEDLG95_SHELL_ExecuteCommand(HWND hwnd, LPCSTR lpVerb) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); IContextMenu * pcm; TRACE("(%p,%p)\n", hwnd, lpVerb); @@ -2864,7 +2807,7 @@ */ static BOOL FILEDLG95_SHELL_UpFolder(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("\n"); @@ -2887,7 +2830,7 @@ */ static BOOL FILEDLG95_SHELL_BrowseToDesktop(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); LPITEMIDLIST pidl; HRESULT hres; @@ -2907,7 +2850,7 @@ */ static void FILEDLG95_SHELL_Clean(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("\n"); @@ -2933,7 +2876,7 @@ */ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); int nFilters = 0; /* number of filters */ int nFilterIndexCB; @@ -3048,7 +2991,7 @@ */ static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); switch(wNotifyCode) { @@ -3115,7 +3058,7 @@ */ static void FILEDLG95_FILETYPE_Clean(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); int iPos; int iCount = CBGetCount(fodInfos->DlgInfos.hwndFileTypeCB); @@ -3341,7 +3284,7 @@ */ static BOOL FILEDLG95_LOOKIN_OnCommand(HWND hwnd, WORD wNotifyCode) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("%p\n", fodInfos); @@ -3417,8 +3360,7 @@ 0, &sfi, sizeof(sfi), - SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX - | SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_ATTRIBUTES | SHGFI_ATTR_SPECIFIED); + SHGFI_DISPLAYNAME | SHGFI_PIDL | SHGFI_ATTRIBUTES | SHGFI_ATTR_SPECIFIED); TRACE("-- Add %s attr=%08x\n", debugstr_w(sfi.szDisplayName), sfi.dwAttributes); @@ -3587,7 +3529,7 @@ */ static void FILEDLG95_LOOKIN_Clean(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); LookInInfos *liInfos = GetPropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr); int iPos; int iCount = CBGetCount(fodInfos->DlgInfos.hwndLookInCB); @@ -3637,7 +3579,7 @@ */ void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd) { - FileOpenDlgInfos *fodInfos; + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); LPITEMIDLIST pidl; LPWSTR lpstrAllFiles, lpstrTmp; UINT nFiles = 0, nFileToOpen, nFileSelected, nAllFilesLength = 0, nThisFileLength, nAllFilesMaxLength; @@ -3646,7 +3588,6 @@ FORMATETC formatetc = get_def_format(); TRACE("\n"); - fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); if (FAILED(IDataObject_GetData(fodInfos->Shell.FOIDataObject, &formatetc, &medium))) return; @@ -3746,7 +3687,7 @@ */ static int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPWSTR * lpstrFileList, UINT * sizeUsed) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); UINT nFileCount = 0; /* number of files */ UINT nStrLen = 0; /* length of string in edit control */ LPWSTR lpstrEdit; /* buffer for string from edit control */ @@ -3980,8 +3921,8 @@ */ static BOOL BrowseSelectedFolder(HWND hwnd) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); BOOL bBrowseSelFolder = FALSE; - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); TRACE("\n"); @@ -4046,8 +3987,7 @@ * FALSE on cancel, error, close or filename-does-not-fit-in-buffer. * */ -BOOL WINAPI GetOpenFileNameA( - LPOPENFILENAMEA ofn) /* [in/out] address of init structure */ +BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn) { TRACE("flags %08x\n", ofn->Flags); @@ -4064,7 +4004,12 @@ if (is_win16_looks(ofn->Flags)) return GetFileName31A(ofn, OPEN_DIALOG); else - return GetFileDialog95A(ofn, OPEN_DIALOG); + { + FileOpenDlgInfos info; + + init_filedlg_infoA(ofn, &info); + return GetFileDialog95(&info, OPEN_DIALOG); + } } /*********************************************************************** @@ -4077,8 +4022,7 @@ * FALSE on cancel, error, close or filename-does-not-fit-in-buffer. * */ -BOOL WINAPI GetOpenFileNameW( - LPOPENFILENAMEW ofn) /* [in/out] address of init structure */ +BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn) { TRACE("flags %08x\n", ofn->Flags); @@ -4095,7 +4039,12 @@ if (is_win16_looks(ofn->Flags)) return GetFileName31W(ofn, OPEN_DIALOG); else - return GetFileDialog95W(ofn, OPEN_DIALOG); + { + FileOpenDlgInfos info; + + init_filedlg_infoW(ofn, &info); + return GetFileDialog95(&info, OPEN_DIALOG); + } } @@ -4109,8 +4058,7 @@ * FALSE on cancel, error, close or filename-does-not-fit-in-buffer. * */ -BOOL WINAPI GetSaveFileNameA( - LPOPENFILENAMEA ofn) /* [in/out] address of init structure */ +BOOL WINAPI GetSaveFileNameA(OPENFILENAMEA *ofn) { if (!valid_struct_size( ofn->lStructSize )) { @@ -4121,7 +4069,12 @@ if (is_win16_looks(ofn->Flags)) return GetFileName31A(ofn, SAVE_DIALOG); else - return GetFileDialog95A(ofn, SAVE_DIALOG); + { + FileOpenDlgInfos info; + + init_filedlg_infoA(ofn, &info); + return GetFileDialog95(&info, SAVE_DIALOG); + } } /*********************************************************************** @@ -4146,7 +4099,12 @@ if (is_win16_looks(ofn->Flags)) return GetFileName31W(ofn, SAVE_DIALOG); else - return GetFileDialog95W(ofn, SAVE_DIALOG); + { + FileOpenDlgInfos info; + + init_filedlg_infoW(ofn, &info); + return GetFileDialog95(&info, SAVE_DIALOG); + } } /*********************************************************************** Modified: trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/filedlgbrowser.c [iso-8859-1] Sun Jun 4 01:52:26 2017 @@ -169,8 +169,8 @@ */ IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndOwner); IShellBrowserImpl *sb; - FileOpenDlgInfos *fodInfos = GetPropA(hwndOwner,FileOpenDlgInfosStr); sb = COMDLG32_SHAlloc(sizeof(IShellBrowserImpl)); @@ -330,7 +330,7 @@ TRACE("(%p)(pidl=%p,flags=0x%08x)\n", This, pidl, wFlags); COMDLG32_DumpSBSPFlags(wFlags); - fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(This->hwndOwner); /* Format the pidl according to its parameter's category */ if(wFlags & SBSP_RELATIVE) @@ -539,7 +539,7 @@ TRACE("(%p)\n", This); - fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(This->hwndOwner); if(!(*ppshv = fodInfos->Shell.FOIShellView)) { @@ -743,7 +743,7 @@ TRACE("(%p)\n", This); - fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(This->hwndOwner); /* If the selected object is not a folder, send an IDOK command to parent window */ if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1))) @@ -781,7 +781,7 @@ { FileOpenDlgInfos *fodInfos; - fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(This->hwndOwner); TRACE("(%p do=%p view=%p)\n", This, fodInfos->Shell.FOIDataObject, fodInfos->Shell.FOIShellView); /* release old selections */ @@ -824,7 +824,7 @@ break; case CDBOSC_KILLFOCUS: { - FileOpenDlgInfos *fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(This->hwndOwner); if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) { WCHAR szSave[16]; @@ -850,7 +850,7 @@ static LRESULT send_includeitem_notification(HWND hwndParentDlg, LPCITEMIDLIST pidl) { LRESULT hook_result = 0; - FileOpenDlgInfos *fodInfos = GetPropA(hwndParentDlg, FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndParentDlg); if(!fodInfos) return 0; @@ -900,7 +900,7 @@ TRACE("(%p)\n", This); - fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(This->hwndOwner); ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK; IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); Modified: trunk/reactos/dll/win32/comdlg32/filedlgbrowser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/filedlg…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/filedlgbrowser.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/filedlgbrowser.h [iso-8859-1] Sun Jun 4 01:52:26 2017 @@ -136,7 +136,7 @@ /************************************************************************** * External Prototypes */ -extern const char FileOpenDlgInfosStr[] DECLSPEC_HIDDEN; +extern FileOpenDlgInfos *get_filedlg_infoptr(HWND hwnd) DECLSPEC_HIDDEN; extern IShellFolder* GetShellFolderFromPidl(LPITEMIDLIST pidlAbs) DECLSPEC_HIDDEN; extern LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl) DECLSPEC_HIDDEN; Modified: trunk/reactos/dll/win32/comdlg32/itemdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/itemdlg…
============================================================================== --- trunk/reactos/dll/win32/comdlg32/itemdlg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comdlg32/itemdlg.c [iso-8859-1] Sun Jun 4 01:52:26 2017 @@ -138,7 +138,7 @@ LPWSTR custom_filenamelabel; UINT cctrl_width, cctrl_def_height, cctrls_cols; - UINT cctrl_indent; + UINT cctrl_indent, dpi_x, dpi_y; HWND cctrls_hwnd; struct list cctrls; UINT_PTR cctrl_next_dlgid; @@ -864,6 +864,7 @@ RECT rc; HDC hdc; WCHAR *c; + HFONT font; TRACE("\n"); @@ -873,7 +874,10 @@ SendMessageW(hctrl, WM_GETTEXT, len+1, (LPARAM)text); hdc = GetDC(hctrl); + font = (HFONT)SendMessageW(hctrl, WM_GETFONT, 0, 0); + font = SelectObject(hdc, font); GetTextExtentPoint32W(hdc, text, lstrlenW(text), &size); + SelectObject(hdc, font); ReleaseDC(hctrl, hdc); if(len && multiline) @@ -936,7 +940,7 @@ { RECT rc; UINT total_height; - UINT max_width; + UINT max_width, size; customctrl *sub_ctrl; switch(ctrl->type) @@ -945,7 +949,8 @@ case IDLG_CCTRL_COMBOBOX: case IDLG_CCTRL_CHECKBUTTON: case IDLG_CCTRL_TEXT: - ctrl_resize(ctrl->hwnd, 160, 160, TRUE); + size = MulDiv(160, This->dpi_x, USER_DEFAULT_SCREEN_DPI); + ctrl_resize(ctrl->hwnd, size, size, TRUE); GetWindowRect(ctrl->hwnd, &rc); SetWindowPos(ctrl->wrapper_hwnd, NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, SWP_NOZORDER|SWP_NOMOVE); @@ -987,7 +992,8 @@ LIST_FOR_EACH_ENTRY(item, &ctrl->sub_items, cctrl_item, entry) { - ctrl_resize(item->hwnd, 160, 160, TRUE); + size = MulDiv(160, This->dpi_x, USER_DEFAULT_SCREEN_DPI); + ctrl_resize(item->hwnd, size, size, TRUE); SetWindowPos(item->hwnd, NULL, 0, total_height, 0, 0, SWP_NOZORDER|SWP_NOSIZE); @@ -1202,8 +1208,8 @@ UINT cur_col_pos, cur_row_pos; customctrl *ctrl; BOOL fits_height; - static const UINT cspacing = 90; /* Columns are spaced with 90px */ - static const UINT rspacing = 4; /* Rows are spaced with 4 px. */ + UINT cspacing = MulDiv(90, This->dpi_x, USER_DEFAULT_SCREEN_DPI); /* Columns are spaced with 90px */ + UINT rspacing = MulDiv(4, This->dpi_y, USER_DEFAULT_SCREEN_DPI); /* Rows are spaced with 4 px. */ /* Given the new width of the container, this function determines the * needed height of the container and places the controls according to @@ -1316,13 +1322,34 @@ return container_height; } +static void ctrl_set_font(customctrl *ctrl, HFONT font) +{ + customctrl *sub_ctrl; + cctrl_item* item; + + SendMessageW(ctrl->hwnd, WM_SETFONT, (WPARAM)font, TRUE); + + LIST_FOR_EACH_ENTRY(sub_ctrl, &ctrl->sub_cctrls, customctrl, sub_cctrls_entry) + { + ctrl_set_font(sub_ctrl, font); + } + + if (ctrl->type == IDLG_CCTRL_RADIOBUTTONLIST) + { + LIST_FOR_EACH_ENTRY(item, &ctrl->sub_items, cctrl_item, entry) + { + SendMessageW(item->hwnd, WM_SETFONT, (WPARAM)font, TRUE); + } + } +} + static void ctrl_container_reparent(FileDialogImpl *This, HWND parent) { LONG wndstyle; if(parent) { - customctrl *ctrl, *sub_ctrl; + customctrl *ctrl; HFONT font; wndstyle = GetWindowLongW(This->cctrls_hwnd, GWL_STYLE); @@ -1340,23 +1367,7 @@ LIST_FOR_EACH_ENTRY(ctrl, &This->cctrls, customctrl, entry) { - if(font) SendMessageW(ctrl->hwnd, WM_SETFONT, (WPARAM)font, TRUE); - - /* If this is a VisualGroup */ - LIST_FOR_EACH_ENTRY(sub_ctrl, &ctrl->sub_cctrls, customctrl, sub_cctrls_entry) - { - if(font) SendMessageW(sub_ctrl->hwnd, WM_SETFONT, (WPARAM)font, TRUE); - } - - if (ctrl->type == IDLG_CCTRL_RADIOBUTTONLIST) - { - cctrl_item* item; - LIST_FOR_EACH_ENTRY(item, &ctrl->sub_items, cctrl_item, entry) - { - if (font) SendMessageW(item->hwnd, WM_SETFONT, (WPARAM)font, TRUE); - } - } - + if(font) ctrl_set_font(ctrl, font); customctrl_resize(This, ctrl); } } @@ -1482,19 +1493,11 @@ static HRESULT init_custom_controls(FileDialogImpl *This) { WNDCLASSW wc; + HDC hdc; static const WCHAR ctrl_container_classname[] = {'i','d','l','g','_','c','o','n','t','a','i','n','e','r','_','p','a','n','e',0}; InitCommonControlsEx(NULL); - - This->cctrl_width = 160; /* Controls have a fixed width */ - This->cctrl_indent = 100; - This->cctrl_def_height = 23; - This->cctrls_cols = 0; - - This->cctrl_next_dlgid = 0x2000; - list_init(&This->cctrls); - This->cctrl_active_vg = NULL; if( !GetClassInfoW(COMDLG32_hInstance, ctrl_container_classname, &wc) ) { @@ -1518,6 +1521,20 @@ COMDLG32_hInstance, This); if(!This->cctrls_hwnd) return E_FAIL; + + hdc = GetDC(This->cctrls_hwnd); + This->dpi_x = GetDeviceCaps(hdc, LOGPIXELSX); + This->dpi_y = GetDeviceCaps(hdc, LOGPIXELSY); + ReleaseDC(This->cctrls_hwnd, hdc); + + This->cctrl_width = MulDiv(160, This->dpi_x, USER_DEFAULT_SCREEN_DPI); /* Controls have a fixed width */ + This->cctrl_indent = MulDiv(100, This->dpi_x, USER_DEFAULT_SCREEN_DPI); + This->cctrl_def_height = MulDiv(23, This->dpi_y, USER_DEFAULT_SCREEN_DPI); + This->cctrls_cols = 0; + + This->cctrl_next_dlgid = 0x2000; + list_init(&This->cctrls); + This->cctrl_active_vg = NULL; SetWindowLongW(This->cctrls_hwnd, GWL_STYLE, WS_TABSTOP); @@ -1920,6 +1937,8 @@ HWND hitem; LPCWSTR custom_okbutton; cctrl_item* item; + UINT min_width = MulDiv(50, This->dpi_x, USER_DEFAULT_SCREEN_DPI); + UINT max_width = MulDiv(250, This->dpi_x, USER_DEFAULT_SCREEN_DPI); if(This->custom_title) SetWindowTextW(This->dlg_hwnd, This->custom_title); @@ -1933,21 +1952,21 @@ (hitem = GetDlgItem(This->dlg_hwnd, IDOK))) { SetWindowTextW(hitem, custom_okbutton); - ctrl_resize(hitem, 50, 250, FALSE); + ctrl_resize(hitem, min_width, max_width, FALSE); } if(This->custom_cancelbutton && (hitem = GetDlgItem(This->dlg_hwnd, IDCANCEL))) { SetWindowTextW(hitem, This->custom_cancelbutton); - ctrl_resize(hitem, 50, 250, FALSE); + ctrl_resize(hitem, min_width, max_width, FALSE); } if(This->custom_filenamelabel && (hitem = GetDlgItem(This->dlg_hwnd, IDC_FILENAMESTATIC))) { SetWindowTextW(hitem, This->custom_filenamelabel); - ctrl_resize(hitem, 50, 250, FALSE); + ctrl_resize(hitem, min_width, max_width, FALSE); } } 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] Sun Jun 4 01:52:26 2017 @@ -55,7 +55,7 @@ reactos/dll/win32/clusapi # Synced to WineStaging-1.9.11 reactos/dll/win32/comcat # Synced to WineStaging-1.9.11 reactos/dll/win32/comctl32 # Synced to WineStaging-2.2 -reactos/dll/win32/comdlg32 # Synced to WineStaging-2.2 +reactos/dll/win32/comdlg32 # Synced to WineStaging-2.9 reactos/dll/win32/compstui # Synced to WineStaging-2.2 reactos/dll/win32/credui # Synced to WineStaging-2.9 reactos/dll/win32/crypt32 # Synced to WineStaging-2.9
7 years, 10 months
1
0
0
0
[akhaldi] 74890: [UXTHEME_WINETEST] Sync with Wine Staging 2.9. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 01:52:19 2017 New Revision: 74890 URL:
http://svn.reactos.org/svn/reactos?rev=74890&view=rev
Log: [UXTHEME_WINETEST] Sync with Wine Staging 2.9. CORE-13362 Modified: trunk/rostests/winetests/uxtheme/system.c Modified: trunk/rostests/winetests/uxtheme/system.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/uxtheme/system.…
============================================================================== --- trunk/rostests/winetests/uxtheme/system.c [iso-8859-1] (original) +++ trunk/rostests/winetests/uxtheme/system.c [iso-8859-1] Sun Jun 4 01:52:19 2017 @@ -527,14 +527,42 @@ ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes); } +static void test_buffer_dc_props(HDC hdc, const RECT *rect) +{ + static const XFORM ident = { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f }; + XFORM xform; + POINT org; + RECT box; + BOOL ret; + + ret = GetWorldTransform(hdc, &xform); + ok(ret, "Failed to get world transform\n"); + ok(!memcmp(&xform, &ident, sizeof(xform)), "Unexpected world transform\n"); + + ret = GetViewportOrgEx(hdc, &org); + ok(ret, "Failed to get vport origin\n"); + ok(org.x == 0 && org.y == 0, "Unexpected vport origin\n"); + + ret = GetWindowOrgEx(hdc, &org); + ok(ret, "Failed to get vport origin\n"); + ok(org.x == rect->left && org.y == rect->top, "Unexpected window origin\n"); + + ret = GetClipBox(hdc, &box); + ok(ret, "Failed to get clip box\n"); + ok(box.left == rect->left && box.top == rect->top, "Unexpected clip box\n"); + + ok(GetGraphicsMode(hdc) == GM_COMPATIBLE, "wrong graphics mode\n"); +} + static void test_buffered_paint(void) { + HDC target, src, hdc, screen_dc; BP_PAINTPARAMS params = { 0 }; BP_BUFFERFORMAT format; - HDC target, src, hdc; HPAINTBUFFER buffer; RECT rect, rect2; RGBQUAD *bits; + HBITMAP hbm; HRESULT hr; int row; @@ -673,6 +701,31 @@ hr = pGetBufferedPaintBits(NULL, NULL, &row); ok(hr == E_POINTER, "Unexpected return code %#x\n", hr); + + screen_dc = GetDC(0); + + hdc = CreateCompatibleDC(screen_dc); + ok(hdc != NULL, "Failed to create a DC\n"); + hbm = CreateCompatibleBitmap(screen_dc, 64, 64); + ok(hbm != NULL, "Failed to create a bitmap\n"); + SelectObject(hdc, hbm); + + ReleaseDC(0, screen_dc); + + SetRect(&rect, 1, 2, 34, 56); + + buffer = pBeginBufferedPaint(hdc, &rect, BPBF_COMPATIBLEBITMAP, NULL, &src); + test_buffer_dc_props(src, &rect); + hr = pEndBufferedPaint(buffer, FALSE); + ok(hr == S_OK, "Unexpected return code %#x\n", hr); + + DeleteObject(hbm); + DeleteDC(hdc); + + buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP, NULL, &src); + test_buffer_dc_props(src, &rect); + hr = pEndBufferedPaint(buffer, FALSE); + ok(hr == S_OK, "Unexpected return code %#x\n", hr); /* access buffer bits */ for (format = BPBF_COMPATIBLEBITMAP; format <= BPBF_TOPDOWNMONODIB; format++) @@ -703,37 +756,16 @@ { init_funcs(); - /* No real functional tests will be done (yet). The current tests + /* No real functional theme API tests will be done (yet). The current tests * only show input/return behaviour */ - /* IsThemeActive, IsAppThemed and IsThemePartDefined*/ - trace("Starting test_IsThemed()\n"); test_IsThemed(); - - /* GetWindowTheme */ - trace("Starting test_GetWindowTheme()\n"); test_GetWindowTheme(); - - /* SetWindowTheme */ - trace("Starting test_SetWindowTheme()\n"); test_SetWindowTheme(); - - /* OpenThemeData, a bit more functional now */ - trace("Starting test_OpenThemeData()\n"); test_OpenThemeData(); - - /* OpenThemeDataEx */ - trace("Starting test_OpenThemeDataEx()\n"); test_OpenThemeDataEx(); - - /* GetCurrentThemeName */ - trace("Starting test_GetCurrentThemeName()\n"); test_GetCurrentThemeName(); - - /* CloseThemeData */ - trace("Starting test_CloseThemeData()\n"); test_CloseThemeData(); - test_buffered_paint(); }
7 years, 10 months
1
0
0
0
[akhaldi] 74889: [SHELL32_WINETEST] Sync with Wine Staging 2.9. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 01:52:12 2017 New Revision: 74889 URL:
http://svn.reactos.org/svn/reactos?rev=74889&view=rev
Log: [SHELL32_WINETEST] Sync with Wine Staging 2.9. CORE-13362 Modified: trunk/rostests/winetests/shell32/CMakeLists.txt trunk/rostests/winetests/shell32/ebrowser.c trunk/rostests/winetests/shell32/shelldispatch.c trunk/rostests/winetests/shell32/shelllink.c trunk/rostests/winetests/shell32/shellole.c trunk/rostests/winetests/shell32/shellpath.c trunk/rostests/winetests/shell32/shfldr_special.c trunk/rostests/winetests/shell32/shlfileop.c trunk/rostests/winetests/shell32/shlfolder.c trunk/rostests/winetests/shell32/shlview.c Modified: trunk/rostests/winetests/shell32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/CMakeLi…
============================================================================== --- trunk/rostests/winetests/shell32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/CMakeLists.txt [iso-8859-1] Sun Jun 4 01:52:12 2017 @@ -27,7 +27,7 @@ add_executable(shell32_winetest ${SOURCE}) target_link_libraries(shell32_winetest uuid) set_module_type(shell32_winetest win32cui) -add_importlibs(shell32_winetest shell32 ole32 oleaut32 user32 advapi32 msvcrt kernel32) +add_importlibs(shell32_winetest shell32 ole32 oleaut32 user32 gdi32 advapi32 msvcrt kernel32) if(MSVC) add_importlibs(shell32_winetest ntdll) Modified: trunk/rostests/winetests/shell32/ebrowser.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/ebrowse…
============================================================================== --- trunk/rostests/winetests/shell32/ebrowser.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/ebrowser.c [iso-8859-1] Sun Jun 4 01:52:12 2017 @@ -71,6 +71,10 @@ DEFINE_GUID(IID_UnknownInterface18, 0x1fc45c07, 0x9e35, 0x4276, 0xad,0x7f, 0x08,0x60,0x3a,0xa0,0xf6,0x0f); DEFINE_GUID(IID_UnknownInterface19, 0xacd9b67a, 0xceab, 0x4c6c, 0x90,0xa1, 0xe8,0x57,0xc6,0x59,0xe3,0x9d); DEFINE_GUID(IID_UnknownInterface20, 0xd0fe6f62, 0xdea4, 0x46c9, 0x9d,0xae, 0x36,0xcb,0x13,0x99,0x78,0xfa); +DEFINE_GUID(IID_UnknownInterface21, 0x732c1ccd, 0xbc5c, 0x4065, 0x88,0xcb, 0xfb,0x5b,0xce,0xa7,0x1f,0x66); +DEFINE_GUID(IID_UnknownInterface22, 0xc13b3d3a, 0x10d6, 0x43f5, 0x98,0xdb, 0xb7,0xdd,0xd9,0x87,0xb3,0x3d); +DEFINE_GUID(IID_UnknownInterface23, 0x2e228ba3, 0xea25, 0x4378, 0x97,0xb6, 0xd5,0x74,0xfa,0xeb,0xa3,0x56); +DEFINE_GUID(IID_UnknownInterface24, 0xd56a2092, 0x7dbf, 0x4144, 0xa1,0x10, 0xc2,0x96,0x3a,0x70,0x98,0x32); static HWND hwnd; @@ -571,7 +575,7 @@ test_qinterface(IID_IUnknown, S_OK); test_qinterface(IID_IExplorerBrowser, S_OK); test_qinterface(IID_IShellBrowser, S_OK); - todo_wine test_qinterface(IID_IOleWindow, S_OK); + test_qinterface(IID_IOleWindow, S_OK); test_qinterface(IID_ICommDlgBrowser, S_OK); test_qinterface(IID_ICommDlgBrowser2, S_OK); test_qinterface(IID_ICommDlgBrowser3, S_OK); @@ -960,6 +964,13 @@ { &IID_UnknownInterface16, &IID_UnknownInterface16, 0, NULL }, { &IID_UnknownInterface17, &IID_UnknownInterface17, 0, NULL }, { &IID_UnknownInterface17, &IID_UnknownInterface19, 0, NULL }, + /* Win 10 */ + { &IID_UnknownInterface21, &IID_UnknownInterface21, 0, NULL }, + { &IID_UnknownInterface21, &IID_IFileDialog, 0, NULL }, + { &IID_UnknownInterface22, &IID_UnknownInterface22, 0, NULL }, + { &IID_UnknownInterface23, &IID_UnknownInterface23, 0, NULL }, + { &IID_UnknownInterface24, &IID_UnknownInterface24, 0, NULL }, + { &IID_UnknownInterface24, &IID_IFileDialog, 0, NULL }, /* Other services requested in Vista, Windows 2008 but not in Windows 7 */ { &IID_IBrowserSettings_Vista, &IID_IBrowserSettings_Vista, 0, NULL }, Modified: trunk/rostests/winetests/shell32/shelldispatch.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shelldi…
============================================================================== --- trunk/rostests/winetests/shell32/shelldispatch.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shelldispatch.c [iso-8859-1] Sun Jun 4 01:52:12 2017 @@ -27,6 +27,8 @@ #include "shlwapi.h" #include "wine/test.h" +#include "initguid.h" + #define EXPECT_HR(hr,hr_exp) \ ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) @@ -36,6 +38,9 @@ static HRESULT (WINAPI *pSHGetNameFromIDList)(PCIDLIST_ABSOLUTE,SIGDN,PWSTR*); static HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *); static DWORD (WINAPI *pGetLongPathNameW)(LPCWSTR, LPWSTR, DWORD); + +/* Updated Windows 7 has a new IShellDispatch6 in its typelib */ +DEFINE_GUID(IID_IWin7ShellDispatch6, 0x34936ba1, 0x67ad, 0x4c41, 0x99,0xb8, 0x8c,0x12,0xdf,0xf1,0xe9,0x74); static void init_function_pointers(void) { @@ -52,6 +57,48 @@ static void test_namespace(void) { + static const ShellSpecialFolderConstants special_folders[] = + { + ssfDESKTOP, + ssfPROGRAMS, + ssfCONTROLS, + ssfPRINTERS, + ssfPERSONAL, + ssfFAVORITES, + ssfSTARTUP, + ssfRECENT, + ssfSENDTO, + ssfBITBUCKET, + ssfSTARTMENU, + ssfDESKTOPDIRECTORY, + ssfDRIVES, + ssfNETWORK, + ssfNETHOOD, + ssfFONTS, + ssfTEMPLATES, + ssfCOMMONSTARTMENU, + ssfCOMMONPROGRAMS, + ssfCOMMONSTARTUP, + ssfCOMMONDESKTOPDIR, + ssfAPPDATA, + ssfPRINTHOOD, + ssfLOCALAPPDATA, + ssfALTSTARTUP, + ssfCOMMONALTSTARTUP, + ssfCOMMONFAVORITES, + ssfINTERNETCACHE, + ssfCOOKIES, + ssfHISTORY, + ssfCOMMONAPPDATA, + ssfWINDOWS, + ssfSYSTEM, + ssfPROGRAMFILES, + ssfMYPICTURES, + ssfPROFILE, + ssfSYSTEMx86, + ssfPROGRAMFILESx86, + }; + static const WCHAR backslashW[] = {'\\',0}; static const WCHAR clsidW[] = { ':',':','{','6','4','5','F','F','0','4','0','-','5','0','8','1','-', @@ -67,7 +114,7 @@ FolderItem *item; VARIANT var; BSTR title, item_path; - int len; + int len, i; r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, &IID_IShellDispatch, (LPVOID*)&sd); @@ -85,6 +132,21 @@ r = IShellDispatch_NameSpace(sd, var, &folder); ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r); ok(folder == NULL, "expected NULL, got %p\n", folder); + + /* test valid folder ids */ + for (i = 0; i < sizeof(special_folders)/sizeof(special_folders[0]); i++) + { + V_VT(&var) = VT_I4; + V_I4(&var) = special_folders[i]; + folder = (void*)0xdeadbeef; + r = IShellDispatch_NameSpace(sd, var, &folder); + if (special_folders[i] == ssfALTSTARTUP || special_folders[i] == ssfCOMMONALTSTARTUP) + ok(r == S_OK || broken(r == S_FALSE) /* winxp */, "Failed to get folder for index %#x, got %08x\n", special_folders[i], r); + else + ok(r == S_OK, "Failed to get folder for index %#x, got %08x\n", special_folders[i], r); + if (folder) + Folder_Release(folder); + } V_VT(&var) = VT_I4; V_I4(&var) = -1; @@ -93,6 +155,8 @@ todo_wine { ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r); ok(folder == NULL, "got %p\n", folder); + if (r == S_OK) + Folder_Release(folder); } V_VT(&var) = VT_I4; V_I4(&var) = ssfPROGRAMFILES; @@ -345,7 +409,7 @@ ok(r == S_OK, "Folder::Items failed: %08x\n", r); ok(!!items, "items is null\n"); r = FolderItems_QueryInterface(items, &IID_FolderItems2, (void**)&items2); - ok(r == S_OK || broken(E_NOINTERFACE) /* xp and later */, "FolderItems::QueryInterface failed: %08x\n", r); + ok(r == S_OK || broken(r == E_NOINTERFACE) /* xp and later */, "FolderItems::QueryInterface failed: %08x\n", r); ok(!!items2 || broken(!items2) /* xp and later */, "items2 is null\n"); r = FolderItems_QueryInterface(items, &IID_FolderItems3, (void**)&items3); ok(r == S_OK, "FolderItems::QueryInterface failed: %08x\n", r); @@ -356,9 +420,7 @@ r = FolderItems_get_Count(items, NULL); r = FolderItems_get_Count(items, &lcount); -todo_wine ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r); -todo_wine ok(!lcount, "expected 0 files, got %d\n", lcount); V_VT(&var) = VT_I4; @@ -529,6 +591,7 @@ &IID_IShellDispatch5, &IID_IShellDispatch4, &IID_IShellDispatch2, + &IID_IWin7ShellDispatch6, &IID_NULL }; IShellFolderViewDual *viewdual; 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] Sun Jun 4 01:52:12 2017 @@ -27,9 +27,12 @@ #include "shobjidl.h" #include "shlobj.h" #include "shellapi.h" +#include "commoncontrols.h" #include "wine/test.h" #include "shell32_test.h" + +#include <reactos/undocshell.h> #ifndef SLDF_HAS_LOGO3ID # define SLDF_HAS_LOGO3ID 0x00000800 /* not available in the Vista SDK */ @@ -43,6 +46,7 @@ static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD); static DWORD (WINAPI *pGetShortPathNameA)(LPCSTR, LPSTR, DWORD); static UINT (WINAPI *pSHExtractIconsW)(LPCWSTR, int, int, int, HICON *, UINT *, UINT, UINT); +static BOOL (WINAPI *pIsProcessDPIAware)(void); static const GUID _IID_IShellLinkDataList = { 0x45e2b4ae, 0xb1c3, 0x11d0, @@ -1150,11 +1154,257 @@ IShellLinkW_Release(linkW); } +static void test_ExtractIcon(void) +{ + static const WCHAR nameW[] = {'\\','e','x','t','r','a','c','t','i','c','o','n','_','t','e','s','t','.','t','x','t',0}; + static const WCHAR shell32W[] = {'s','h','e','l','l','3','2','.','d','l','l',0}; + WCHAR pathW[MAX_PATH]; + HICON hicon, hicon2; + char path[MAX_PATH]; + HANDLE file; + int r; + ICONINFO info; + BITMAP bm; + + /* specified instance handle */ + hicon = ExtractIconA(GetModuleHandleA("shell32.dll"), NULL, 0); +todo_wine + ok(hicon == NULL, "Got icon %p\n", hicon); + hicon2 = ExtractIconA(GetModuleHandleA("shell32.dll"), "shell32.dll", -1); + ok(hicon2 != NULL, "Got icon %p\n", hicon2); + + /* existing index */ + hicon = ExtractIconA(NULL, "shell32.dll", 0); + ok(hicon != NULL && HandleToLong(hicon) != -1, "Got icon %p\n", hicon); + DestroyIcon(hicon); + + /* returns number of resources */ + hicon = ExtractIconA(NULL, "shell32.dll", -1); + ok(HandleToLong(hicon) > 1 && hicon == hicon2, "Got icon %p\n", hicon); + + /* invalid index, valid dll name */ + hicon = ExtractIconA(NULL, "shell32.dll", 3000); + ok(hicon == NULL, "Got icon %p\n", hicon); + + /* Create a temporary non-executable file */ + GetTempPathA(sizeof(path), path); + strcat(path, "\\extracticon_test.txt"); + file = CreateFileA(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "Failed to create a test file\n"); + CloseHandle(file); + + hicon = ExtractIconA(NULL, path, 0); +todo_wine + ok(hicon == NULL, "Got icon %p\n", hicon); + + hicon = ExtractIconA(NULL, path, -1); + ok(hicon == NULL, "Got icon %p\n", hicon); + + hicon = ExtractIconA(NULL, path, 1); +todo_wine + ok(hicon == NULL, "Got icon %p\n", hicon); + + r = DeleteFileA(path); + ok(r, "failed to delete file %s (%d)\n", path, GetLastError()); + + /* same for W variant */ +if (0) +{ + /* specified instance handle, crashes on XP, 2k3 */ + hicon = ExtractIconW(GetModuleHandleA("shell32.dll"), NULL, 0); + ok(hicon == NULL, "Got icon %p\n", hicon); +} + hicon2 = ExtractIconW(GetModuleHandleA("shell32.dll"), shell32W, -1); + ok(hicon2 != NULL, "Got icon %p\n", hicon2); + + /* existing index */ + hicon = ExtractIconW(NULL, shell32W, 0); + ok(hicon != NULL && HandleToLong(hicon) != -1, "Got icon %p\n", hicon); + GetIconInfo(hicon, &info); + GetObjectW(info.hbmColor, sizeof(bm), &bm); + ok(bm.bmWidth == GetSystemMetrics(SM_CXICON), "got %d\n", bm.bmWidth); + ok(bm.bmHeight == GetSystemMetrics(SM_CYICON), "got %d\n", bm.bmHeight); + DestroyIcon(hicon); + + /* returns number of resources */ + hicon = ExtractIconW(NULL, shell32W, -1); + ok(HandleToLong(hicon) > 1 && hicon == hicon2, "Got icon %p\n", hicon); + + /* invalid index, valid dll name */ + hicon = ExtractIconW(NULL, shell32W, 3000); + ok(hicon == NULL, "Got icon %p\n", hicon); + + /* Create a temporary non-executable file */ + GetTempPathW(sizeof(pathW)/sizeof(pathW[0]), pathW); + lstrcatW(pathW, nameW); + file = CreateFileW(pathW, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "Failed to create a test file\n"); + CloseHandle(file); + + hicon = ExtractIconW(NULL, pathW, 0); +todo_wine + ok(hicon == NULL, "Got icon %p\n", hicon); + + hicon = ExtractIconW(NULL, pathW, -1); + ok(hicon == NULL, "Got icon %p\n", hicon); + + hicon = ExtractIconW(NULL, pathW, 1); +todo_wine + ok(hicon == NULL, "Got icon %p\n", hicon); + + r = DeleteFileW(pathW); + ok(r, "failed to delete file %s (%d)\n", path, GetLastError()); +} + +static void test_ExtractAssociatedIcon(void) +{ + char pathA[MAX_PATH]; + HICON hicon; + WORD index; + + /* empty path */ + index = 0; + *pathA = 0; + hicon = ExtractAssociatedIconA(NULL, pathA, &index); +todo_wine { + ok(hicon != NULL, "Got icon %p\n", hicon); + ok(!*pathA, "Unexpected path %s\n", pathA); + ok(index == 0, "Unexpected index %u\n", index); +} + DestroyIcon(hicon); + + /* by index */ + index = 0; + strcpy(pathA, "shell32.dll"); + hicon = ExtractAssociatedIconA(NULL, pathA, &index); + ok(hicon != NULL, "Got icon %p\n", hicon); + ok(!strcmp(pathA, "shell32.dll"), "Unexpected path %s\n", pathA); + ok(index == 0, "Unexpected index %u\n", index); + DestroyIcon(hicon); + + /* valid dll name, invalid index */ + index = 5000; + strcpy(pathA, "user32.dll"); + hicon = ExtractAssociatedIconA(NULL, pathA, &index); + CharLowerBuffA(pathA, strlen(pathA)); +todo_wine { + ok(hicon != NULL, "Got icon %p\n", hicon); + ok(!!strstr(pathA, "shell32.dll"), "Unexpected path %s\n", pathA); +} + ok(index != 5000, "Unexpected index %u\n", index); + DestroyIcon(hicon); + + /* associated icon */ + index = 0xcaca; + strcpy(pathA, "dummy.exe"); + hicon = ExtractAssociatedIconA(NULL, pathA, &index); + CharLowerBuffA(pathA, strlen(pathA)); +todo_wine { + ok(hicon != NULL, "Got icon %p\n", hicon); + ok(!!strstr(pathA, "shell32.dll"), "Unexpected path %s\n", pathA); +} + ok(index != 0xcaca, "Unexpected index %u\n", index); + DestroyIcon(hicon); +} + +static int get_shell_icon_size(void) +{ + char buf[10]; + DWORD value = 32, size = sizeof(buf), type; + HKEY key; + + if (!RegOpenKeyA( HKEY_CURRENT_USER, "Control Panel\\Desktop\\WindowMetrics", &key )) + { + if (!RegQueryValueExA( key, "Shell Icon Size", NULL, &type, (BYTE *)buf, &size ) && type == REG_SZ) + value = atoi( buf ); + RegCloseKey( key ); + } + return value; +} + +static void test_SHGetImageList(void) +{ + HRESULT hr; + IImageList *list, *list2; + BOOL ret; + HIMAGELIST lg, sm; + ULONG start_refs, refs; + int i, width, height, expect; + BOOL dpi_aware = pIsProcessDPIAware && pIsProcessDPIAware(); + + hr = SHGetImageList( SHIL_LARGE, &IID_IImageList, (void **)&list ); + ok( hr == S_OK, "got %08x\n", hr ); + start_refs = IImageList_AddRef( list ); + IImageList_Release( list ); + + hr = SHGetImageList( SHIL_LARGE, &IID_IImageList, (void **)&list2 ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( list == list2, "lists differ\n" ); + refs = IImageList_AddRef( list ); + IImageList_Release( list ); + ok( refs == start_refs + 1, "got %d, start_refs %d\n", refs, start_refs ); + IImageList_Release( list2 ); + + hr = SHGetImageList( SHIL_SMALL, &IID_IImageList, (void **)&list2 ); + ok( hr == S_OK, "got %08x\n", hr ); + + ret = Shell_GetImageLists( &lg, &sm ); + ok( ret, "got %d\n", ret ); + ok( lg == (HIMAGELIST)list, "mismatch\n" ); + ok( sm == (HIMAGELIST)list2, "mismatch\n" ); + + /* Shell_GetImageLists doesn't take a reference */ + refs = IImageList_AddRef( list ); + IImageList_Release( list ); + ok( refs == start_refs, "got %d, start_refs %d\n", refs, start_refs ); + + IImageList_Release( list2 ); + IImageList_Release( list ); + + /* Test the icon sizes */ + for (i = 0; i <= SHIL_LAST; i++) + { + hr = SHGetImageList( i, &IID_IImageList, (void **)&list ); + ok( hr == S_OK || + broken( i == SHIL_JUMBO && hr == E_INVALIDARG ), /* XP and 2003 */ + "%d: got %08x\n", i, hr ); + if (FAILED(hr)) continue; + IImageList_GetIconSize( list, &width, &height ); + switch (i) + { + case SHIL_LARGE: + if (dpi_aware) expect = GetSystemMetrics( SM_CXICON ); + else expect = get_shell_icon_size(); + break; + case SHIL_SMALL: + if (dpi_aware) expect = GetSystemMetrics( SM_CXICON ) / 2; + else expect = GetSystemMetrics( SM_CXSMICON ); + break; + case SHIL_EXTRALARGE: + expect = (GetSystemMetrics( SM_CXICON ) * 3) / 2; + break; + case SHIL_SYSSMALL: + expect = GetSystemMetrics( SM_CXSMICON ); + break; + case SHIL_JUMBO: + expect = 256; + break; + } + todo_wine_if(i == SHIL_SYSSMALL && dpi_aware && expect != GetSystemMetrics( SM_CXICON ) / 2) + { + ok( width == expect, "%d: got %d expect %d\n", i, width, expect ); + ok( height == expect, "%d: got %d expect %d\n", i, height, expect ); + } + IImageList_Release( list ); + } +} + START_TEST(shelllink) { HRESULT r; HMODULE hmod = GetModuleHandleA("shell32.dll"); HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); + HMODULE huser32 = GetModuleHandleA("user32.dll"); pILFree = (void *)GetProcAddress(hmod, (LPSTR)155); pILIsEqual = (void *)GetProcAddress(hmod, (LPSTR)21); @@ -1164,6 +1414,7 @@ pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA"); pGetShortPathNameA = (void *)GetProcAddress(hkernel32, "GetShortPathNameA"); pSHExtractIconsW = (void *)GetProcAddress(hmod, "SHExtractIconsW"); + pIsProcessDPIAware = (void *)GetProcAddress(huser32, "IsProcessDPIAware"); r = CoInitialize(NULL); ok(r == S_OK, "CoInitialize failed (0x%08x)\n", r); @@ -1178,6 +1429,9 @@ test_SHGetStockIconInfo(); test_SHExtractIcons(); test_propertystore(); + test_ExtractIcon(); + test_ExtractAssociatedIcon(); + test_SHGetImageList(); CoUninitialize(); } Modified: trunk/rostests/winetests/shell32/shellole.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shellol…
============================================================================== --- trunk/rostests/winetests/shell32/shellole.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shellole.c [iso-8859-1] Sun Jun 4 01:52:12 2017 @@ -866,7 +866,7 @@ if (!pSHCreateSessionKey) { - skip("SHCreateSessionKey is not implemented\n"); + win_skip("SHCreateSessionKey is not implemented\n"); return; } @@ -889,12 +889,38 @@ RegCloseKey(hkey2); } +static void test_dragdrophelper(void) +{ + IDragSourceHelper *dragsource; + IDropTargetHelper *target; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_DragDropHelper, NULL, CLSCTX_INPROC_SERVER, &IID_IDropTargetHelper, (void **)&target); + ok(hr == S_OK, "Failed to create IDropTargetHelper, %#x\n", hr); + + hr = IDropTargetHelper_QueryInterface(target, &IID_IDragSourceHelper, (void **)&dragsource); + ok(hr == S_OK, "QI failed, %#x\n", hr); + IDragSourceHelper_Release(dragsource); + + IDropTargetHelper_Release(target); +} + START_TEST(shellole) { + HRESULT hr; + init(); + + hr = CoInitialize(NULL); + ok(hr == S_OK, "CoInitialize failed (0x%08x)\n", hr); + if (hr != S_OK) + return; test_SHPropStg_functions(); test_SHCreateQueryCancelAutoPlayMoniker(); test_DragQueryFile(); test_SHCreateSessionKey(); -} + test_dragdrophelper(); + + CoUninitialize(); +} 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] Sun Jun 4 01:52:12 2017 @@ -808,7 +808,7 @@ memset(&startup, 0, sizeof(startup)); startup.cb = sizeof(startup); startup.dwFlags = STARTF_USESHOWWINDOW; - startup.dwFlags = SW_SHOWNORMAL; + startup.wShowWindow = SW_SHOWNORMAL; CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info); winetest_wait_child_process( info.hProcess ); @@ -823,7 +823,7 @@ memset(&startup, 0, sizeof(startup)); startup.cb = sizeof(startup); startup.dwFlags = STARTF_USESHOWWINDOW; - startup.dwFlags = SW_SHOWNORMAL; + startup.wShowWindow = SW_SHOWNORMAL; CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, @@ -860,12 +860,13 @@ ok(path == NULL, "got %p\n", path); path = NULL; - hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, &path); + hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, KF_FLAG_DEFAULT_PATH, NULL, &path); ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(path != NULL, "expected path != NULL\n"); + CoTaskMemFree(path); path = NULL; - hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, KF_FLAG_DEFAULT_PATH, NULL, &path); + hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, &path); ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(path != NULL, "expected path != NULL\n"); @@ -2038,9 +2039,11 @@ static void test_knownFolders(void) { static const WCHAR sWindows[] = {'W','i','n','d','o','w','s',0}; + static const WCHAR sWindows2[] = {'w','i','n','d','o','w','s',0}; static const WCHAR sExample[] = {'E','x','a','m','p','l','e',0}; static const WCHAR sExample2[] = {'E','x','a','m','p','l','e','2',0}; static const WCHAR sSubFolder[] = {'S','u','b','F','o','l','d','e','r',0}; + static const WCHAR sNoSuch[] = {'N','o','S','u','c','h',0}; static const WCHAR sBackslash[] = {'\\',0}; static const KNOWNFOLDERID newFolderId = {0x01234567, 0x89AB, 0xCDEF, {0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x01} }; static const KNOWNFOLDERID subFolderId = {0xFEDCBA98, 0x7654, 0x3210, {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF} }; @@ -2142,7 +2145,6 @@ } hr = IKnownFolderManager_GetFolderByName(mgr, sWindows, &folder); - todo_wine ok(hr == S_OK, "failed to get known folder: 0x%08x\n", hr); if(SUCCEEDED(hr)) { @@ -2153,6 +2155,23 @@ hr = IKnownFolder_Release(folder); ok(hr == S_OK, "failed to release KnownFolder instance: 0x%08x\n", hr); } + + hr = IKnownFolderManager_GetFolderByName(mgr, sWindows2, &folder); + ok(hr == S_OK, "failed to get known folder: 0x%08x\n", hr); + if(SUCCEEDED(hr)) + { + hr = IKnownFolder_GetId(folder, &folderId); + ok(hr == S_OK, "failed to get folder id: 0x%08x\n", hr); + ok(IsEqualGUID(&folderId, &FOLDERID_Windows)==TRUE, "invalid KNOWNFOLDERID returned\n"); + + hr = IKnownFolder_Release(folder); + ok(hr == S_OK, "failed to release KnownFolder instance: 0x%08x\n", hr); + } + + folder = (IKnownFolder *)0xdeadbeef; + hr = IKnownFolderManager_GetFolderByName(mgr, sNoSuch, &folder); + ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got 0x%08x\n", hr); + ok(folder == NULL, "got %p\n", folder); for(i=0; i<sizeof(known_folder_found)/sizeof(known_folder_found[0]); ++i) known_folder_found[i] = FALSE; Modified: trunk/rostests/winetests/shell32/shfldr_special.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shfldr_…
============================================================================== --- trunk/rostests/winetests/shell32/shfldr_special.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shfldr_special.c [iso-8859-1] Sun Jun 4 01:52:12 2017 @@ -166,7 +166,7 @@ details.str.u.pOleStr = NULL; hr = IShellFolder2_GetDetailsOf(folder, NULL, 0, &details); - ok(hr == S_OK || broken(E_NOTIMPL) /* W2K */, "got 0x%08x\n", hr); + ok(hr == S_OK || broken(hr == E_NOTIMPL) /* W2K */, "got 0x%08x\n", hr); if (SHELL_OsIsUnicode()) SHFree(details.str.u.pOleStr); /* test every column if method is implemented */ 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] Sun Jun 4 01:52:12 2017 @@ -21,12 +21,16 @@ #include <stdarg.h> #include <stdio.h> +#define COBJMACROS #define WINE_NOWINSOCK #include <windows.h> #include "shellapi.h" #include "shlobj.h" +#include "commoncontrols.h" #include "wine/test.h" + +#include <reactos/undocshell.h> #ifndef FOF_NORECURSION #define FOF_NORECURSION 0x1000 @@ -315,6 +319,37 @@ ok(shfi.iIcon != 0xdeadbeef, "iIcon was expected to change\n"); } +static void check_icon_size( HICON icon, DWORD flags ) +{ + ICONINFO info; + BITMAP bm; + SIZE list_size, metrics_size; + IImageList *list; + + GetIconInfo( icon, &info ); + GetObjectW( info.hbmColor, sizeof(bm), &bm ); + + SHGetImageList( (flags & SHGFI_SMALLICON) ? SHIL_SMALL : SHIL_LARGE, + &IID_IImageList, (void **)&list ); + IImageList_GetIconSize( list, &list_size.cx, &list_size.cy ); + IImageList_Release( list ); + + metrics_size.cx = GetSystemMetrics( (flags & SHGFI_SMALLICON) ? SM_CXSMICON : SM_CXICON ); + metrics_size.cy = GetSystemMetrics( (flags & SHGFI_SMALLICON) ? SM_CYSMICON : SM_CYICON ); + + + if (flags & SHGFI_SHELLICONSIZE) + { + ok( bm.bmWidth == list_size.cx, "got %d expected %d\n", bm.bmWidth, list_size.cx ); + ok( bm.bmHeight == list_size.cy, "got %d expected %d\n", bm.bmHeight, list_size.cy ); + } + else + { + ok( bm.bmWidth == metrics_size.cx, "got %d expected %d\n", bm.bmWidth, metrics_size.cx ); + ok( bm.bmHeight == metrics_size.cy, "got %d expected %d\n", bm.bmHeight, metrics_size.cy ); + } +} + static void test_get_file_info_iconlist(void) { /* Test retrieving a handle to the system image list, and @@ -325,6 +360,8 @@ LPITEMIDLIST pidList; SHFILEINFOA shInfoa; SHFILEINFOW shInfow; + IImageList *small_list, *large_list; + ULONG start_refs, refs; hr = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidList); if (FAILED(hr)) { @@ -332,11 +369,22 @@ return; } + SHGetImageList( SHIL_LARGE, &IID_IImageList, (void **)&large_list ); + SHGetImageList( SHIL_SMALL, &IID_IImageList, (void **)&small_list ); + + start_refs = IImageList_AddRef( small_list ); + IImageList_Release( small_list ); + memset(&shInfoa, 0xcf, sizeof(shInfoa)); hSysImageList = (HIMAGELIST) SHGetFileInfoA((const char *)pidList, 0, &shInfoa, sizeof(shInfoa), SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_PIDL); - ok((hSysImageList != INVALID_HANDLE_VALUE) && (hSysImageList > (HIMAGELIST) 0xffff), "Can't get handle for CSIDL_DESKTOP imagelist\n"); + ok(hSysImageList == (HIMAGELIST)small_list, "got %p expect %p\n", hSysImageList, small_list); + refs = IImageList_AddRef( small_list ); + IImageList_Release( small_list ); + ok( refs == start_refs + 1 || + broken( refs == start_refs ), /* XP and 2003 */ + "got %d, start_refs %d\n", refs, start_refs ); todo_wine ok(shInfoa.hIcon == 0, "SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear hIcon\n"); todo_wine ok(shInfoa.szTypeName[0] == 0, "SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear szTypeName[0]\n"); ok(shInfoa.iIcon != 0xcfcfcfcf, "SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) should set iIcon\n"); @@ -344,7 +392,7 @@ shInfoa.dwAttributes == 0 || /* Vista */ broken(shInfoa.dwAttributes != 0xcfcfcfcf), /* NT4 doesn't clear but sets this field */ "SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL), unexpected dwAttributes\n"); - CloseHandle(hSysImageList); + /* Don't release hSysImageList here (and in similar places below) because of the broken reference behaviour of XP and 2003. */ if (!pSHGetFileInfoW) { @@ -362,20 +410,19 @@ win_skip("SHGetFileInfoW is not implemented\n"); return; } - ok((hSysImageList != INVALID_HANDLE_VALUE) && (hSysImageList > (HIMAGELIST) 0xffff), "Can't get handle for CSIDL_DESKTOP imagelist\n"); + ok(hSysImageList == (HIMAGELIST)small_list, "got %p expect %p\n", hSysImageList, small_list); todo_wine ok(shInfow.hIcon == 0, "SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear hIcon\n"); ok(shInfow.szTypeName[0] == 0, "SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear szTypeName[0]\n"); ok(shInfow.iIcon != 0xcfcfcfcf, "SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) should set iIcon\n"); ok(shInfow.dwAttributes == 0xcfcfcfcf || shInfoa.dwAttributes == 0, /* Vista */ "SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) unexpected dwAttributes\n"); - CloseHandle(hSysImageList); /* Various suposidly invalid flag testing */ memset(&shInfow, 0xcf, sizeof(shInfow)); - hr = pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), + hSysImageList = (HIMAGELIST)pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON); - ok(hr != 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON Failed\n"); + ok(hSysImageList == (HIMAGELIST)small_list, "got %p expect %p\n", hSysImageList, small_list); ok(shInfow.iIcon!=0xcfcfcfcf, "Icon Index Missing\n"); ok(shInfow.dwAttributes==0xcfcfcfcf || shInfoa.dwAttributes==0, /* Vista */ @@ -386,8 +433,8 @@ SHGFI_ICON|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON); ok(hr != 0, " SHGFI_ICON|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON Failed\n"); ok(shInfow.iIcon!=0xcfcfcfcf, "Icon Index Missing\n"); - ok(shInfow.hIcon!=(HICON)0xcfcfcfcf && shInfow.hIcon!=0,"hIcon invalid\n"); - if (shInfow.hIcon!=(HICON)0xcfcfcfcf) DestroyIcon(shInfow.hIcon); + check_icon_size( shInfow.hIcon, SHGFI_SMALLICON ); + DestroyIcon(shInfow.hIcon); todo_wine ok(shInfow.dwAttributes==0,"dwAttributes not set\n"); memset(&shInfow, 0xcf, sizeof(shInfow)); @@ -395,14 +442,14 @@ SHGFI_ICON|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_LARGEICON); ok(hr != 0, "SHGFI_ICON|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_LARGEICON Failed\n"); ok(shInfow.iIcon!=0xcfcfcfcf, "Icon Index Missing\n"); - ok(shInfow.hIcon!=(HICON)0xcfcfcfcf && shInfow.hIcon!=0,"hIcon invalid\n"); - if (shInfow.hIcon != (HICON)0xcfcfcfcf) DestroyIcon(shInfow.hIcon); + check_icon_size( shInfow.hIcon, SHGFI_LARGEICON ); + DestroyIcon( shInfow.hIcon ); todo_wine ok(shInfow.dwAttributes==0,"dwAttributes not set\n"); memset(&shInfow, 0xcf, sizeof(shInfow)); - hr = pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), + hSysImageList = (HIMAGELIST)pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_LARGEICON); - ok(hr != 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_LARGEICON Failed\n"); + ok(hSysImageList == (HIMAGELIST)large_list, "got %p expect %p\n", hSysImageList, small_list); ok(shInfow.iIcon!=0xcfcfcfcf, "Icon Index Missing\n"); ok(shInfow.dwAttributes==0xcfcfcfcf || shInfoa.dwAttributes==0, /* Vista */ @@ -430,18 +477,18 @@ ok(shInfow.dwAttributes==0xcfcfcfcf,"dwAttributes modified\n"); memset(&shInfow, 0xcf, sizeof(shInfow)); - hr = pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), + hSysImageList = (HIMAGELIST)pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON| SHGFI_ATTRIBUTES); - ok(hr != 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_ATTRIBUTES Failed\n"); + ok(hSysImageList == (HIMAGELIST)small_list, "got %p expect %p\n", hSysImageList, small_list); ok(shInfow.iIcon!=0xcfcfcfcf, "Icon Index Missing\n"); ok(shInfow.dwAttributes!=0xcfcfcfcf,"dwAttributes not set\n"); memset(&shInfow, 0xcf, sizeof(shInfow)); - hr = pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), + hSysImageList = (HIMAGELIST)pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON| SHGFI_EXETYPE); - todo_wine ok(hr != 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_EXETYPE Failed\n"); + todo_wine ok(hSysImageList == (HIMAGELIST)small_list, "got %p expect %p\n", hSysImageList, small_list); ok(shInfow.iIcon!=0xcfcfcfcf, "Icon Index Missing\n"); ok(shInfow.dwAttributes==0xcfcfcfcf || shInfoa.dwAttributes==0, /* Vista */ @@ -462,17 +509,18 @@ ok(shInfow.dwAttributes!=0xcfcfcfcf,"dwAttributes not set\n"); memset(&shInfow, 0xcf, sizeof(shInfow)); - hr = pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), + hSysImageList = (HIMAGELIST)pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL| SHGFI_ATTRIBUTES); + ok(hSysImageList == (HIMAGELIST)large_list, "got %p expect %p\n", hSysImageList, large_list); ok(hr != 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_ATTRIBUTES Failed\n"); ok(shInfow.iIcon!=0xcfcfcfcf, "Icon Index Missing\n"); ok(shInfow.dwAttributes!=0xcfcfcfcf,"dwAttributes not set\n"); memset(&shInfow, 0xcf, sizeof(shInfow)); - hr = pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), + hSysImageList = (HIMAGELIST)pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_EXETYPE); - todo_wine ok(hr != 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_EXETYPE Failed\n"); + todo_wine ok(hSysImageList == (HIMAGELIST)large_list, "got %p expect %p\n", hSysImageList, large_list); ok(shInfow.iIcon!=0xcfcfcfcf, "Icon Index Missing\n"); ok(shInfow.dwAttributes==0xcfcfcfcf || shInfoa.dwAttributes==0, /* Vista */ @@ -492,7 +540,25 @@ todo_wine ok(shInfow.iIcon==0xcfcfcfcf, "Icon Index Modified\n"); ok(shInfow.dwAttributes!=0xcfcfcfcf,"dwAttributes not set\n"); + memset(&shInfow, 0xcf, sizeof(shInfow)); + hSysImageList = (HIMAGELIST)pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), + SHGFI_SYSICONINDEX|SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_SHELLICONSIZE|SHGFI_ICON); + ok(hSysImageList == (HIMAGELIST)small_list, "got %p expect %p\n", hSysImageList, small_list); + ok(shInfow.iIcon!=0xcfcfcfcf, "Icon Index Missing\n"); + check_icon_size( shInfow.hIcon, SHGFI_SMALLICON | SHGFI_SHELLICONSIZE ); + DestroyIcon( shInfow.hIcon ); + + memset(&shInfow, 0xcf, sizeof(shInfow)); + hSysImageList = (HIMAGELIST)pSHGetFileInfoW((const WCHAR *)pidList, 0, &shInfow, sizeof(shInfow), + SHGFI_SYSICONINDEX|SHGFI_PIDL|SHGFI_SHELLICONSIZE|SHGFI_ICON); + ok(hSysImageList == (HIMAGELIST)large_list, "got %p expect %p\n", hSysImageList, small_list); + ok(shInfow.iIcon!=0xcfcfcfcf, "Icon Index Missing\n"); + check_icon_size( shInfow.hIcon, SHGFI_LARGEICON | SHGFI_SHELLICONSIZE ); + DestroyIcon( shInfow.hIcon ); + ILFree(pidList); + IImageList_Release( small_list ); + IImageList_Release( large_list ); } @@ -817,9 +883,10 @@ retval = SHFileOperationA(&shfo); ok(retval == ERROR_CANCELLED || retval == DE_DIFFDIR || /* Vista */ + retval == DE_FILEDESTISFLD || /* Vista, running from c: */ broken(retval == DE_OPCANCELLED) || /* Win9x */ broken(retval == 65652), /* NT4 */ - "Expected ERROR_CANCELLED or DE_DIFFDIR\n"); + "Expected ERROR_CANCELLED or DE_DIFFDIR, got %u\n", retval); ok(file_exists("test1.txt"), "Expected test1.txt to exist\n"); /* pFrom is empty */ @@ -2516,6 +2583,11 @@ skip("Unicode tests skipped on non-unicode system\n"); return; } + if (GetLastError()==ERROR_ACCESS_DENIED) + { + skip("test needs admin rights\n"); + return; + } CloseHandle(file); /* Try to delete a file with unicode filename */ @@ -2574,6 +2646,7 @@ ok(GetLastError() == ERROR_SUCCESS || broken(GetLastError() == ERROR_INVALID_HANDLE), /* WinXp, win2k3 */ "Expected ERROR_SUCCESS, got %d\n", GetLastError()); + DeleteFileW(UNICODE_PATH_TO); /* Check last error after a failed file operation. */ DeleteFileW(UNICODE_PATH); Modified: trunk/rostests/winetests/shell32/shlfolder.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shlfold…
============================================================================== --- trunk/rostests/winetests/shell32/shlfolder.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shlfolder.c [iso-8859-1] Sun Jun 4 01:52:12 2017 @@ -73,9 +73,8 @@ static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); static UINT (WINAPI *pGetSystemWow64DirectoryW)(LPWSTR, UINT); static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFIID,void**); -static HRESULT (WINAPI *pSHCreateShellFolderView)(const SFV_CREATE *pcsfv, IShellView **ppsv); -static HRESULT (WINAPI *pSHCreateShellFolderViewEx)(LPCSFV psvcbi, IShellView **ppv); static HRESULT (WINAPI *pSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*); +static BOOL (WINAPI *pSHGetPathFromIDListEx)(PCIDLIST_ABSOLUTE,WCHAR*,DWORD,GPFIDL_FLAGS); static WCHAR *make_wstr(const char *str) { @@ -133,8 +132,7 @@ MAKEFUNC(SHGetIDListFromObject); MAKEFUNC(SHGetItemFromObject); MAKEFUNC(SHCreateDefaultContextMenu); - MAKEFUNC(SHCreateShellFolderView); - MAKEFUNC(SHCreateShellFolderViewEx); + MAKEFUNC(SHGetPathFromIDListEx); #undef MAKEFUNC #define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord))) @@ -452,7 +450,7 @@ flags = ~0u; hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags); ok(hr == S_OK, "GetAttributesOf returns %08x\n", hr); - ok((flags & ~SFGAO_HASSUBFOLDER) == full_attrs[i], "%d: got %08x expected %08x\n", i, flags, full_attrs[i]); + ok((flags & ~(SFGAO_HASSUBFOLDER|SFGAO_COMPRESSED)) == full_attrs[i], "%d: got %08x expected %08x\n", i, flags, full_attrs[i]); } for (i=0;i<5;i++) @@ -1347,10 +1345,34 @@ result = pSHGetPathFromIDListW(pidlTestFile, wszPath); ok(result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError()); + ok(0 == lstrcmpW(wszFileName, wszPath), "SHGetPathFromIDListW returned incorrect path for file placed on desktop\n"); + + if (pSHGetPathFromIDListEx) + { + result = pSHGetPathFromIDListEx(pidlEmpty, wszPath, MAX_PATH, SFGAO_FILESYSTEM); + ok(result, "SHGetPathFromIDListEx failed: %u\n", GetLastError()); + ok(!lstrcmpiW(wszDesktop, wszPath), "Unexpected SHGetPathFromIDListEx result %s, expected %s\n", + wine_dbgstr_w(wszPath), wine_dbgstr_w(wszDesktop)); + + result = pSHGetPathFromIDListEx(pidlTestFile, wszPath, MAX_PATH, SFGAO_FILESYSTEM); + ok(result, "SHGetPathFromIDListEx failed: %u\n", GetLastError()); + ok(!lstrcmpiW(wszFileName, wszPath), "Unexpected SHGetPathFromIDListEx result %s, expected %s\n", + wine_dbgstr_w(wszPath), wine_dbgstr_w(wszFileName)); + + SetLastError(0xdeadbeef); + memset(wszPath, 0x55, sizeof(wszPath)); + result = pSHGetPathFromIDListEx(pidlTestFile, wszPath, 5, SFGAO_FILESYSTEM); + ok(!result, "SHGetPathFromIDListEx returned: %x(%u)\n", result, GetLastError()); + + SetLastError(0xdeadbeef); + memset(wszPath, 0x55, sizeof(wszPath)); + result = pSHGetPathFromIDListEx(pidlEmpty, wszPath, 5, SFGAO_FILESYSTEM); + ok(!result, "SHGetPathFromIDListEx returned: %x(%u)\n", result, GetLastError()); + } + else + win_skip("SHGetPathFromIDListEx not available\n"); + IMalloc_Free(ppM, pidlTestFile); - if (!result) return; - ok(0 == lstrcmpW(wszFileName, wszPath), "SHGetPathFromIDListW returned incorrect path for file placed on desktop\n"); - /* Test if we can get the path from the start menu "program files" PIDL. */ hr = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidlPrograms); @@ -1358,7 +1380,7 @@ SetLastError(0xdeadbeef); result = pSHGetPathFromIDListW(pidlPrograms, wszPath); - IMalloc_Free(ppM, pidlPrograms); + IMalloc_Free(ppM, pidlPrograms); ok(result, "SHGetPathFromIDListW failed\n"); } @@ -1588,7 +1610,8 @@ if (hr != S_OK) return; hr = IShellFolder_GetDisplayNameOf(pShellFolder, NULL, SHGDN_FORPARSING, &strret); - ok(hr == S_OK, "IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n", hr); + ok(hr == S_OK || broken(hr == E_INVALIDARG) /* win10 */, + "IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n", hr); if (hr != S_OK) { IShellFolder_Release(pShellFolder); return; @@ -3773,10 +3796,10 @@ hr = IShellFolder_BindToObject(pdesktopsf, pidl_testdir, NULL, (REFIID)&IID_IShellFolder, (void**)&psf); ok(hr == S_OK, "Got 0x%08x\n", hr); - if(SUCCEEDED(hr)) - pILFree(pidl_testdir); + pILFree(pidl_testdir); } IShellFolder_Release(pdesktopsf); + if (FAILED(hr)) return; hr = IShellFolder_EnumObjects(psf, NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &peidl); ok(hr == S_OK, "Got %08x\n", hr); @@ -5150,123 +5173,6 @@ IShellFolder_Release(desktop); ILFree(pidl); Cleanup(); -} - -static void test_SHCreateShellFolderView(void) -{ - HRESULT hr; - IShellView *psv; - SFV_CREATE sfvc; - IShellFolder *desktop; - ULONG refCount; - - if (!pSHCreateShellFolderView) - { - win_skip("SHCreateShellFolderView missing.\n"); - return; - } - - hr = SHGetDesktopFolder(&desktop); - ok(hr == S_OK, "got (0x%08x)\n", hr); - - if (0) - { - /* crash on win7 */ - pSHCreateShellFolderView(NULL, NULL); - } - - psv = (void *)0xdeadbeef; - hr = pSHCreateShellFolderView(NULL, &psv); - ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); - ok(psv == NULL, "psv = %p\n", psv); - - memset(&sfvc, 0, sizeof(sfvc)); - psv = (void *)0xdeadbeef; - hr = pSHCreateShellFolderView(&sfvc, &psv); - ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); - ok(psv == NULL, "psv = %p\n", psv); - - memset(&sfvc, 0, sizeof(sfvc)); - sfvc.cbSize = sizeof(sfvc) - 1; - psv = (void *)0xdeadbeef; - hr = pSHCreateShellFolderView(&sfvc, &psv); - ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); - ok(psv == NULL, "psv = %p\n", psv); - - memset(&sfvc, 0, sizeof(sfvc)); - sfvc.cbSize = sizeof(sfvc) + 1; - psv = (void *)0xdeadbeef; - hr = pSHCreateShellFolderView(&sfvc, &psv); - ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); - ok(psv == NULL, "psv = %p\n", psv); - - memset(&sfvc, 0, sizeof(sfvc)); - sfvc.cbSize = sizeof(sfvc); - sfvc.pshf = desktop; - psv = NULL; - hr = pSHCreateShellFolderView(&sfvc, &psv); - ok(hr == S_OK, "Got 0x%08x\n", hr); - ok(psv != NULL, "psv = %p\n", psv); - if (psv) - { - refCount = IShellView_Release(psv); - ok(refCount == 0, "refCount = %u\n", refCount); - } - - IShellFolder_Release(desktop); -} - -static void test_SHCreateShellFolderViewEx(void) -{ - HRESULT hr; - IShellView *psv; - CSFV csfv; - IShellFolder *desktop; - ULONG refCount; - - if (!pSHCreateShellFolderViewEx) - { - win_skip("SHCreateShellFolderViewEx missing.\n"); - return; - } - - hr = SHGetDesktopFolder(&desktop); - ok(hr == S_OK, "got (0x%08x)\n", hr); - - if (0) - { - /* crash on win7 */ - pSHCreateShellFolderViewEx(NULL, NULL); - pSHCreateShellFolderViewEx(NULL, &psv); - pSHCreateShellFolderViewEx(&csfv, NULL); - } - - memset(&csfv, 0, sizeof(csfv)); - csfv.pshf = desktop; - psv = NULL; - hr = pSHCreateShellFolderViewEx(&csfv, &psv); - ok(hr == S_OK, "Got 0x%08x\n", hr); - ok(psv != NULL, "psv = %p\n", psv); - if (psv) - { - refCount = IShellView_Release(psv); - ok(refCount == 0, "refCount = %u\n", refCount); - } - - memset(&csfv, 0, sizeof(csfv)); - csfv.cbSize = sizeof(csfv); - csfv.pshf = desktop; - psv = NULL; - hr = pSHCreateShellFolderViewEx(&csfv, &psv); - ok(hr == S_OK, "Got 0x%08x\n", hr); - ok(psv != NULL, "psv = %p\n", psv); - if (psv) - { - refCount = IShellView_Release(psv); - ok(refCount == 0, "refCount = %u\n", refCount); - } - - IShellFolder_Release(desktop); } static void test_DataObject(void) @@ -5364,8 +5270,6 @@ test_ShellItemGetAttributes(); test_ShellItemArrayGetAttributes(); test_SHCreateDefaultContextMenu(); - test_SHCreateShellFolderView(); - test_SHCreateShellFolderViewEx(); test_DataObject(); OleUninitialize(); Modified: trunk/rostests/winetests/shell32/shlview.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shlview…
============================================================================== --- trunk/rostests/winetests/shell32/shlview.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shlview.c [iso-8859-1] Sun Jun 4 01:52:12 2017 @@ -53,10 +53,8 @@ { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; - - trace("listview: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam); msg.message = message; msg.flags = sent|wparam|lparam; @@ -635,12 +633,18 @@ HRESULT hr; RECT r = {0}; ULONG ref1, ref2; + IUnknown *unk; hr = SHGetDesktopFolder(&desktop); ok(hr == S_OK, "got (0x%08x)\n", hr); hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view); ok(hr == S_OK, "got (0x%08x)\n", hr); + + hr = IShellView_QueryInterface(view, &IID_CDefView, (void **)&unk); + ok(hr == S_OK, "got (0x%08x)\n", hr); + ok(unk == (IUnknown *)view, "got %p\n", unk); + IUnknown_Release(unk); if (0) { @@ -1331,6 +1335,147 @@ IShellFolder_Release(psf_desktop); } +static void test_SHCreateShellFolderView(void) +{ + IShellFolder *desktop; + IShellView *psv; + SFV_CREATE sfvc; + ULONG refCount; + IUnknown *unk; + HRESULT hr; + + hr = SHGetDesktopFolder(&desktop); + ok(hr == S_OK, "got (0x%08x)\n", hr); + + if (0) + { + /* crash on win7 */ + SHCreateShellFolderView(NULL, NULL); + } + + psv = (void *)0xdeadbeef; + hr = SHCreateShellFolderView(NULL, &psv); + ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); + ok(psv == NULL, "psv = %p\n", psv); + + memset(&sfvc, 0, sizeof(sfvc)); + psv = (void *)0xdeadbeef; + hr = SHCreateShellFolderView(&sfvc, &psv); + ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); + ok(psv == NULL, "psv = %p\n", psv); + + memset(&sfvc, 0, sizeof(sfvc)); + sfvc.cbSize = sizeof(sfvc) - 1; + psv = (void *)0xdeadbeef; + hr = SHCreateShellFolderView(&sfvc, &psv); + ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); + ok(psv == NULL, "psv = %p\n", psv); + + memset(&sfvc, 0, sizeof(sfvc)); + sfvc.cbSize = sizeof(sfvc) + 1; + psv = (void *)0xdeadbeef; + hr = SHCreateShellFolderView(&sfvc, &psv); + ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); + ok(psv == NULL, "psv = %p\n", psv); + +if (0) +{ + /* Crashes on NULL 'pshf' on XP/2k3 */ + memset(&sfvc, 0, sizeof(sfvc)); + sfvc.cbSize = sizeof(sfvc); + psv = (void *)0xdeadbeef; + hr = SHCreateShellFolderView(&sfvc, &psv); + ok(hr == E_UNEXPECTED, "Got 0x%08x\n", hr); + ok(psv == NULL, "psv = %p\n", psv); +} + memset(&sfvc, 0, sizeof(sfvc)); + sfvc.cbSize = sizeof(sfvc) - 1; + sfvc.pshf = desktop; + psv = (void *)0xdeadbeef; + hr = SHCreateShellFolderView(&sfvc, &psv); + ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); + ok(psv == NULL, "psv = %p\n", psv); + + memset(&sfvc, 0, sizeof(sfvc)); + sfvc.cbSize = sizeof(sfvc); + sfvc.pshf = desktop; + psv = NULL; + hr = SHCreateShellFolderView(&sfvc, &psv); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(psv != NULL, "psv = %p\n", psv); + + hr = IShellView_QueryInterface(psv, &IID_CDefView, (void **)&unk); + ok(hr == S_OK, "got (0x%08x)\n", hr); + ok(unk == (IUnknown *)psv, "got %p\n", unk); + IUnknown_Release(unk); + + refCount = IShellView_Release(psv); + ok(refCount == 0, "refCount = %u\n", refCount); + + IShellFolder_Release(desktop); +} + +static void test_SHCreateShellFolderViewEx(void) +{ + IShellFolder *desktop; + IShellView *psv; + ULONG refCount; + IUnknown *unk; + HRESULT hr; + CSFV csfv; + + hr = SHGetDesktopFolder(&desktop); + ok(hr == S_OK, "got (0x%08x)\n", hr); + + if (0) + { + /* crash on win7 */ + SHCreateShellFolderViewEx(NULL, NULL); + SHCreateShellFolderViewEx(NULL, &psv); + SHCreateShellFolderViewEx(&csfv, NULL); + } + + memset(&csfv, 0, sizeof(csfv)); + csfv.pshf = desktop; + psv = NULL; + hr = SHCreateShellFolderViewEx(&csfv, &psv); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(psv != NULL, "psv = %p\n", psv); + + hr = IShellView_QueryInterface(psv, &IID_CDefView, (void **)&unk); + ok(hr == S_OK, "got (0x%08x)\n", hr); + ok(unk == (IUnknown *)psv, "got %p\n", unk); + IUnknown_Release(unk); + + refCount = IShellView_Release(psv); + ok(refCount == 0, "refCount = %u\n", refCount); + +if (0) +{ + /* Crashes on null shellfolder, on XP/2k3 */ + memset(&csfv, 0, sizeof(csfv)); + csfv.pshf = NULL; + psv = (void *)0xdeadbeef; + hr = SHCreateShellFolderViewEx(&csfv, &psv); + ok(hr == E_UNEXPECTED, "Got 0x%08x\n", hr); + ok(psv == NULL, "psv = %p\n", psv); +} + memset(&csfv, 0, sizeof(csfv)); + csfv.cbSize = sizeof(csfv); + csfv.pshf = desktop; + psv = NULL; + hr = SHCreateShellFolderViewEx(&csfv, &psv); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(psv != NULL, "psv = %p\n", psv); + if (psv) + { + refCount = IShellView_Release(psv); + ok(refCount == 0, "refCount = %u\n", refCount); + } + + IShellFolder_Release(desktop); +} + START_TEST(shlview) { OleInitialize(NULL); @@ -1344,6 +1489,8 @@ test_IOleWindow(); test_GetSetCurrentViewMode(); test_IOleCommandTarget(); + test_SHCreateShellFolderView(); + test_SHCreateShellFolderViewEx(); OleUninitialize(); }
7 years, 10 months
1
0
0
0
[akhaldi] 74888: [PSDK] Add missing GPFIDL_FLAGS.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 01:51:57 2017 New Revision: 74888 URL:
http://svn.reactos.org/svn/reactos?rev=74888&view=rev
Log: [PSDK] Add missing GPFIDL_FLAGS. Modified: trunk/reactos/sdk/include/psdk/shlobj.h Modified: trunk/reactos/sdk/include/psdk/shlobj.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/shlobj.h?…
============================================================================== --- trunk/reactos/sdk/include/psdk/shlobj.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/shlobj.h [iso-8859-1] Sun Jun 4 01:51:57 2017 @@ -83,6 +83,8 @@ #define HPSXA_DEFINED DECLARE_HANDLE(HPSXA); #endif + +typedef int GPFIDL_FLAGS; UINT WINAPI
7 years, 10 months
1
0
0
0
[akhaldi] 74887: [PSDK] Add missing IID_CDefView.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 01:51:51 2017 New Revision: 74887 URL:
http://svn.reactos.org/svn/reactos?rev=74887&view=rev
Log: [PSDK] Add missing IID_CDefView. Modified: trunk/reactos/sdk/include/psdk/shlguid.h Modified: trunk/reactos/sdk/include/psdk/shlguid.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/shlguid.h…
============================================================================== --- trunk/reactos/sdk/include/psdk/shlguid.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/shlguid.h [iso-8859-1] Sun Jun 4 01:51:51 2017 @@ -84,6 +84,7 @@ DEFINE_GUID(IID_IACList, 0x77A130B0,0x94FD,0x11D0,0xA5,0x44,0x00,0xC0,0x4F,0xD7,0xD0,0x62); DEFINE_GUID(IID_IACList2, 0x470141A0,0x5186,0x11D2,0xBB,0xB6,0x00,0x60,0x97,0x7B,0x46,0x4C); DEFINE_GUID(IID_IObjMgr, 0x00BB2761,0x6A77,0x11D0,0xA5,0x35,0x00,0xC0,0x4F,0xD7,0xD0,0x62); +DEFINE_GUID(IID_CDefView, 0x4434ff80,0xef4c,0x11ce,0xae,0x65,0x08,0x00,0x2b,0x2e,0x12,0x62); DEFINE_GUID(IID_ICurrentWorkingDirectory, 0x91956D21,0x9276,0x11D1,0x92,0x1A,0x00,0x60,0x97,0xDF,0x5B,0xD4); DEFINE_GUID(IID_IProgressDialog, 0xEBBC7C04,0x315E,0x11D2,0xB6,0x2F,0x00,0x60,0x97,0xDF,0x5B,0xD4);
7 years, 10 months
1
0
0
0
[akhaldi] 74886: [SETUPAPI_WINETEST] Sync with Wine Staging 2.9. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 01:51:43 2017 New Revision: 74886 URL:
http://svn.reactos.org/svn/reactos?rev=74886&view=rev
Log: [SETUPAPI_WINETEST] Sync with Wine Staging 2.9. CORE-13362 Modified: trunk/rostests/winetests/setupapi/devinst.c trunk/rostests/winetests/setupapi/install.c trunk/rostests/winetests/setupapi/misc.c trunk/rostests/winetests/setupapi/query.c trunk/rostests/winetests/setupapi/setupcab.c Modified: trunk/rostests/winetests/setupapi/devinst.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/devins…
============================================================================== --- trunk/rostests/winetests/setupapi/devinst.c [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/devinst.c [iso-8859-1] Sun Jun 4 01:51:43 2017 @@ -58,6 +58,8 @@ static BOOL (WINAPI *pSetupDiSetDeviceRegistryPropertyW)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, const BYTE *, DWORD); static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyA)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD); static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyW)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD); +static BOOL (WINAPI *pSetupDiRemoveDevice)(HDEVINFO, PSP_DEVINFO_DATA); +static BOOL (WINAPI *pSetupDiRemoveDeviceInterface)(HDEVINFO, PSP_DEVICE_INTERFACE_DATA); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); /* This is a unique guid for testing purposes */ @@ -92,74 +94,11 @@ pSetupDiSetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiSetDeviceRegistryPropertyW"); pSetupDiGetDeviceRegistryPropertyA = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyA"); pSetupDiGetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyW"); + pSetupDiRemoveDeviceInterface = (void *)GetProcAddress(hSetupAPI, "SetupDiRemoveDeviceInterface"); + pSetupDiRemoveDevice = (void *)GetProcAddress(hSetupAPI, "SetupDiRemoveDevice"); pIsWow64Process = (void *)GetProcAddress(hKernel32, "IsWow64Process"); } -static void change_reg_permissions(const WCHAR *regkey) -{ - HKEY hkey; - SID_IDENTIFIER_AUTHORITY ident = { SECURITY_WORLD_SID_AUTHORITY }; - SECURITY_DESCRIPTOR sd; - PSID EveryoneSid; - PACL pacl = NULL; - - RegOpenKeyExW(HKEY_LOCAL_MACHINE, regkey, 0, WRITE_DAC, &hkey); - - /* Initialize the 'Everyone' sid */ - AllocateAndInitializeSid(&ident, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &EveryoneSid); - - pacl = HeapAlloc(GetProcessHeap(), 0, 256); - InitializeAcl(pacl, 256, ACL_REVISION); - - /* Add 'Full Control' for 'Everyone' */ - AddAccessAllowedAce(pacl, ACL_REVISION, KEY_ALL_ACCESS, EveryoneSid); - - InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); - - SetSecurityDescriptorDacl(&sd, TRUE, pacl, FALSE); - - /* Set the new security on the registry key */ - RegSetKeySecurity(hkey, DACL_SECURITY_INFORMATION, &sd); - - RegCloseKey(hkey); - - HeapFree(GetProcessHeap(), 0, pacl); - if (EveryoneSid) - FreeSid(EveryoneSid); -} - -static BOOL remove_device(void) -{ - HDEVINFO set; - SP_DEVINFO_DATA devInfo = { sizeof(devInfo), { 0 } }; - BOOL ret, retval; - - SetLastError(0xdeadbeef); - set = pSetupDiGetClassDevsA(&guid, NULL, 0, 0); - ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsA failed: %08x\n", - GetLastError()); - - SetLastError(0xdeadbeef); - ret = pSetupDiEnumDeviceInfo(set, 0, &devInfo); - ok(ret, "SetupDiEnumDeviceInfo failed: %08x\n", GetLastError()); - - SetLastError(0xdeadbeef); - retval = pSetupDiCallClassInstaller(DIF_REMOVE, set, &devInfo); - if(is_wow64) - todo_wine ok(!retval && GetLastError() == ERROR_IN_WOW64, - "SetupDiCallClassInstaller(DIF_REMOVE...) succeeded: %08x\n", GetLastError()); - else - todo_wine ok(retval, - "SetupDiCallClassInstaller(DIF_REMOVE...) failed: %08x\n", GetLastError()); - - SetLastError(0xdeadbeef); - ret = pSetupDiDestroyDeviceInfoList(set); - ok(ret, "SetupDiDestroyDeviceInfoList failed: %08x\n", GetLastError()); - - return retval; -} - -/* RegDeleteTreeW from dlls/advapi32/registry.c */ static LSTATUS devinst_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey) { LONG ret; @@ -226,35 +165,7 @@ return ret; } -static void clean_devclass_key(void) -{ - static const WCHAR devclass[] = {'S','y','s','t','e','m','\\', - 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', - 'C','o','n','t','r','o','l','\\','D','e','v','i','c','e','C','l','a','s','s','e','s','\\', - '{','6','a','5','5','b','5','a','4','-','3','f','6','5','-', - '1','1','d','b','-','b','7','0','4','-', - '0','0','1','1','9','5','5','c','2','b','d','b','}',0}; - HKEY key; - DWORD subkeys; - - /* Check if we have subkeys as Windows 2000 doesn't delete - * the keys under the DeviceClasses key after a SetupDiDestroyDeviceInfoList. - */ - RegOpenKeyW(HKEY_LOCAL_MACHINE, devclass, &key); - RegQueryInfoKeyW(key, NULL, NULL, NULL, &subkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (subkeys > 0) - { - trace("We are most likely on Windows 2000\n"); - devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, devclass); - } - else - { - ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, devclass), - "Couldn't delete deviceclass key\n"); - } -} - -static void test_SetupDiCreateDeviceInfoListEx(void) +static void test_SetupDiCreateDeviceInfoListEx(void) { HDEVINFO devlist; BOOL ret; @@ -342,7 +253,7 @@ RegCloseKey(hkey); } else - trace("failed to open classes key\n"); + trace("failed to open classes key %u\n", GetLastError()); } static void create_inf_file(LPCSTR filename) @@ -423,12 +334,6 @@ { BOOL ret; HDEVINFO set; - HKEY key; - LONG res; - static const WCHAR bogus[] = {'S','y','s','t','e','m','\\', - 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', - 'E','n','u','m','\\','R','o','o','t','\\', - 'L','E','G','A','C','Y','_','B','O','G','U','S',0}; SetLastError(0xdeadbeef); ret = pSetupDiCreateDeviceInfoA(NULL, NULL, NULL, NULL, NULL, 0, NULL); @@ -451,19 +356,6 @@ DWORD i; static GUID deadbeef = {0xdeadbeef, 0xdead, 0xbeef, {0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}}; - HKEY key; - static const WCHAR bogus0000[] = {'S','y','s','t','e','m','\\', - 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', - 'E','n','u','m','\\','R','o','o','t','\\', - 'L','E','G','A','C','Y','_','B','O','G','U','S','\\','0','0','0','0',0}; - - /* So we know we have a clean start */ - if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus0000, &key)) - { - trace("Expected LEGACY_BOGUS\\0000 key to not exist, will be removed now\n"); - change_reg_permissions(bogus0000); - ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, bogus0000), "Could not delete LEGACY_BOGUS\\0000 key\n"); - } /* No GUID given */ SetLastError(0xdeadbeef); @@ -471,30 +363,14 @@ NULL, NULL, 0, NULL); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError()); - /* Even though NT4 fails it still adds some stuff to the registry that - * can't be deleted via normal setupapi functions. As the registry is written - * by a different user (SYSTEM) we have to do some magic to get rid of the key - */ - if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus0000, &key)) - { - trace("NT4 created a bogus key on failure, will be removed now\n"); - change_reg_permissions(bogus0000); - ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, bogus0000), - "Could not delete LEGACY_BOGUS\\0000 key\n"); - } + /* We can't add device information to the set with a different GUID */ SetLastError(0xdeadbeef); ret = pSetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &deadbeef, NULL, NULL, 0, NULL); ok(!ret && GetLastError() == ERROR_CLASS_MISMATCH, "Expected ERROR_CLASS_MISMATCH, got %08x\n", GetLastError()); - if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus0000, &key)) - { - trace("NT4 created a bogus key on failure, will be removed now\n"); - change_reg_permissions(bogus0000); - ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, bogus0000), - "Could not delete LEGACY_BOGUS\\0000 key\n"); - } + /* Finally, with all three required parameters, this succeeds: */ ret = pSetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, NULL); @@ -526,44 +402,10 @@ ok(i == 3, "Expected 3 devices, got %d\n", i); ok(GetLastError() == ERROR_NO_MORE_ITEMS, "SetupDiEnumDeviceInfo failed: %08x\n", GetLastError()); + + ret = pSetupDiRemoveDevice(set, &devInfo); + todo_wine ok(ret, "got %u\n", GetLastError()); pSetupDiDestroyDeviceInfoList(set); - } - - /* The bogus registry key shouldn't be there after this test. The only - * reasons this key would still be present: - * - * - We are running on Wine which has to be fixed - * - We have leftovers from old tests - */ - res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key); - todo_wine - ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n"); - if (res == ERROR_SUCCESS) - { - DWORD subkeys; - - /* Check if we have subkeys */ - RegQueryInfoKeyA(key, NULL, NULL, NULL, &subkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (subkeys > 0) - { - int i; - - /* Leftovers from old tests */ - trace("Going to remove %d devices\n", subkeys); - for (i = 0; i < subkeys; i++) - { - BOOL ret; - - ret = remove_device(); - ok(ret, "Expected a device to be removed\n"); - } - } - else - { - /* Wine doesn't delete the bogus key itself currently */ - trace("We are most likely on Wine\n"); - RegDeleteKeyW(HKEY_LOCAL_MACHINE, bogus); - } } } @@ -627,12 +469,18 @@ /* NT4 returns 'Root' and W2K and above 'ROOT' */ ok(!lstrcmpiA(instanceID, "ROOT\\LEGACY_BOGUS\\0001"), "Unexpected instance ID %s\n", instanceID); + + ret = pSetupDiRemoveDevice(set, &devInfo); + todo_wine ok(ret, "got %u\n", GetLastError()); pSetupDiDestroyDeviceInfoList(set); } } static void testRegisterDeviceInfo(void) { + static const WCHAR bogus[] = {'S','y','s','t','e','m','\\', + 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', + 'E','n','u','m','\\','U','S','B','\\','B','O','G','U','S',0}; BOOL ret; HDEVINFO set; @@ -659,22 +507,20 @@ ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, NULL); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + ret = pSetupDiCreateDeviceInfoA(set, "USB\\BOGUS\\0000", &guid, NULL, NULL, 0, &devInfo); - ok(ret || GetLastError() == ERROR_DEVINST_ALREADY_EXISTS, - "SetupDiCreateDeviceInfoA failed: %d\n", GetLastError()); - if (ret) - { - /* If it already existed, registering it again will fail */ - ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, - NULL); - ok(ret, "SetupDiCreateDeviceInfoA failed: %d\n", GetLastError()); - } - /* FIXME: On Win2K+ systems, this is now persisted to registry in - * HKLM\System\CCS\Enum\USB\Bogus\0000. - * FIXME: the key also becomes undeletable. How to get rid of it? - */ + ok(ret, "SetupDiCreateDeviceInfoA failed: %08x\n", GetLastError()); + + ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, NULL); + ok(ret, "SetupDiRegisterDeviceInfo failed: %d\n", GetLastError()); + + ret = pSetupDiRemoveDevice(set, &devInfo); + todo_wine ok(ret, "got %u\n", GetLastError()); pSetupDiDestroyDeviceInfoList(set); + + /* remove once Wine is fixed */ + devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus); } } @@ -682,17 +528,6 @@ { BOOL ret; HDEVINFO set; - HKEY key; - static const WCHAR bogus[] = {'S','y','s','t','e','m','\\', - 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', - 'E','n','u','m','\\','R','o','o','t','\\', - 'L','E','G','A','C','Y','_','B','O','G','U','S',0}; - static const WCHAR devclass[] = {'S','y','s','t','e','m','\\', - 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', - 'C','o','n','t','r','o','l','\\','D','e','v','i','c','e','C','l','a','s','s','e','s','\\', - '{','6','a','5','5','b','5','a','4','-','3','f','6','5','-', - '1','1','d','b','-','b','7','0','4','-', - '0','0','1','1','9','5','5','c','2','b','d','b','}',0}; if (!pSetupDiCreateDeviceInterfaceA || !pSetupDiEnumDeviceInterfaces) { @@ -754,32 +589,26 @@ ok(i == 2, "expected 2 interfaces, got %d\n", i); ok(GetLastError() == ERROR_NO_MORE_ITEMS, "SetupDiEnumDeviceInterfaces failed: %08x\n", GetLastError()); + + for (i = 0; i < 2; i++) + { + ret = pSetupDiEnumDeviceInterfaces(set, &devInfo, &guid, i, &interfaceData); + ok(ret, "SetupDiEnumDeviceInterfaces failed: %08x\n", GetLastError()); + + ret = pSetupDiRemoveDeviceInterface(set, &interfaceData); + todo_wine ok(ret, "SetupDiRemoveDeviceInterface failed: %08x\n", GetLastError()); + } + + ret = pSetupDiRemoveDevice(set, &devInfo); + todo_wine ok(ret, "got %u\n", GetLastError()); + ret = pSetupDiDestroyDeviceInfoList(set); ok(ret, "SetupDiDestroyDeviceInfoList failed: %08x\n", GetLastError()); - - /* Cleanup */ - /* FIXME: On Wine we still have the bogus entry in Enum\Root and - * subkeys, as well as the deviceclass key with subkeys. - * Only clean the deviceclass key once Wine if fixed. - */ - if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key)) - { - /* Wine doesn't delete the information currently */ - trace("We are most likely on Wine\n"); - devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus); - devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, devclass); - } - else - { - clean_devclass_key(); - } } } static void testGetDeviceInterfaceDetail(void) { - BOOL ret; - HDEVINFO set; static const WCHAR bogus[] = {'S','y','s','t','e','m','\\', 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', 'E','n','u','m','\\','R','o','o','t','\\', @@ -790,6 +619,8 @@ '{','6','a','5','5','b','5','a','4','-','3','f','6','5','-', '1','1','d','b','-','b','7','0','4','-', '0','0','1','1','9','5','5','c','2','b','d','b','}',0}; + BOOL ret; + HDEVINFO set; if (!pSetupDiCreateDeviceInterfaceA || !pSetupDiGetDeviceInterfaceDetailA) { @@ -808,7 +639,6 @@ SP_DEVICE_INTERFACE_DATA interfaceData = { sizeof(interfaceData), { 0 } }; DWORD size = 0; - HKEY key; SetLastError(0xdeadbeef); ret = pSetupDiGetDeviceInterfaceDetailA(set, NULL, NULL, 0, NULL, @@ -884,24 +714,20 @@ HeapFree(GetProcessHeap(), 0, buf); } + + ret = pSetupDiEnumDeviceInterfaces(set, &devInfo, &guid, 0, &interfaceData); + ok(ret, "SetupDiEnumDeviceInterfaces failed: %08x\n", GetLastError()); + + ret = pSetupDiRemoveDeviceInterface(set, &interfaceData); + todo_wine ok(ret, "SetupDiRemoveDeviceInterface failed: %08x\n", GetLastError()); + + ret = pSetupDiRemoveDevice(set, &devInfo); + todo_wine ok(ret, "got %u\n", GetLastError()); pSetupDiDestroyDeviceInfoList(set); - /* Cleanup */ - /* FIXME: On Wine we still have the bogus entry in Enum\Root and - * subkeys, as well as the deviceclass key with subkeys. - * Only do the RegDeleteKey, once Wine is fixed. - */ - if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key)) - { - /* Wine doesn't delete the information currently */ - trace("We are most likely on Wine\n"); - devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus); - devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, devclass); - } - else - { - clean_devclass_key(); - } + /* remove once Wine is fixed */ + devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus); + devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, devclass); } } @@ -920,7 +746,6 @@ BOOL ret; HDEVINFO set; HKEY key = NULL; - BOOL classKeyCreated; SetLastError(0xdeadbeef); key = pSetupDiCreateDevRegKeyW(NULL, NULL, 0, 0, 0, NULL, NULL); @@ -1012,7 +837,6 @@ "SetupDiCreateDevRegKey failed: %08x\n", GetLastError()); if (key != INVALID_HANDLE_VALUE) { - classKeyCreated = TRUE; RegCloseKey(key); /* The class key should have been created */ ok(!RegOpenKeyW(HKEY_LOCAL_MACHINE, classKey, &key), @@ -1030,55 +854,39 @@ DIREG_DRV, KEY_READ); ok(key != INVALID_HANDLE_VALUE, "SetupDiOpenDevRegKey failed: %08x\n", GetLastError()); - pSetupDiDestroyDeviceInfoList(set); + RegCloseKey(key); } - else - classKeyCreated = FALSE; - - /* Cleanup */ - ret = remove_device(); - if(!is_wow64) - todo_wine ok(ret, "Expected the device to be removed: %08x\n", GetLastError()); - - /* FIXME: Only do the RegDeleteKey, once Wine is fixed */ - if (!ret) - { - /* Wine doesn't delete the information currently */ - trace("We are most likely on Wine\n"); - devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus); - devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, classKey); - } - else if (classKeyCreated) - { - /* There should only be a class key entry, so a simple - * RegDeleteKey should work - * - * This could fail if it's the first time for this new test - * after running the old tests. - */ - ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey), - "Couldn't delete classkey\n"); - } + + ret = pSetupDiRemoveDevice(set, &devInfo); + todo_wine ok(ret, "got %u\n", GetLastError()); + pSetupDiDestroyDeviceInfoList(set); + + /* remove once Wine is fixed */ + devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus); + devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, classKey); } } static void testRegisterAndGetDetail(void) { - HDEVINFO set; - BOOL ret; - SP_DEVINFO_DATA devInfo = { sizeof(SP_DEVINFO_DATA), { 0 } }; - SP_DEVICE_INTERFACE_DATA interfaceData = { sizeof(interfaceData), { 0 } }; - DWORD dwSize = 0; + static const WCHAR classKey[] = {'S','y','s','t','e','m','\\', + 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', + 'C','o','n','t','r','o','l','\\','C','l','a','s','s','\\', + '{','6','a','5','5','b','5','a','4','-','3','f','6','5','-', + '1','1','d','b','-','b','7','0','4','-', + '0','0','1','1','9','5','5','c','2','b','d','b','}',0}; static const WCHAR bogus[] = {'S','y','s','t','e','m','\\', 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', 'E','n','u','m','\\','R','o','o','t','\\', 'L','E','G','A','C','Y','_','B','O','G','U','S',0}; - static const WCHAR devclass[] = {'S','y','s','t','e','m','\\', - 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', - 'C','o','n','t','r','o','l','\\','D','e','v','i','c','e','C','l','a','s','s','e','s','\\', - '{','6','a','5','5','b','5','a','4','-','3','f','6','5','-', - '1','1','d','b','-','b','7','0','4','-', - '0','0','1','1','9','5','5','c','2','b','d','b','}',0}; + HDEVINFO set, set2; + BOOL ret; + SP_DEVINFO_DATA devInfo = { sizeof(SP_DEVINFO_DATA), { 0 } }; + SP_DEVICE_INTERFACE_DATA interfaceData = { sizeof(interfaceData), { 0 } }; + SP_DEVICE_INTERFACE_DATA interfaceData2 = { sizeof(interfaceData2), { 0 } }; + DWORD dwSize = 0; + HKEY key; + LONG res; if (!pSetupDiCreateDeviceInterfaceA || !pSetupDiEnumDeviceInterfaces || !pSetupDiGetDeviceInterfaceDetailA) @@ -1092,6 +900,10 @@ ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsA failed: %08x\n", GetLastError()); + res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key); + ok(res != ERROR_SUCCESS, "Expected key to not exist\n"); + RegCloseKey(key); + SetLastError(0xdeadbeef); ret = pSetupDiCreateDeviceInfoA(set, "LEGACY_BOGUS", &guid, NULL, 0, DICD_GENERATE_ID, &devInfo); @@ -1103,25 +915,23 @@ ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, NULL); ok(ret, "SetupDiRegisterDeviceInfo failed: %08x\n", GetLastError()); - pSetupDiDestroyDeviceInfoList(set); - - SetLastError(0xdeadbeef); - set = pSetupDiGetClassDevsA(&guid, NULL, 0, DIGCF_DEVICEINTERFACE); - ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsA failed: %08x\n", + SetLastError(0xdeadbeef); + set2 = pSetupDiGetClassDevsA(&guid, NULL, 0, DIGCF_DEVICEINTERFACE); + ok(set2 != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsA failed: %08x\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pSetupDiEnumDeviceInterfaces(set, NULL, &guid, 0, &interfaceData); + ret = pSetupDiEnumDeviceInterfaces(set2, NULL, &guid, 0, &interfaceData2); ok(ret, "SetupDiEnumDeviceInterfaces failed: %08x\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pSetupDiGetDeviceInterfaceDetailA(set, &interfaceData, NULL, 0, &dwSize, NULL); + ret = pSetupDiGetDeviceInterfaceDetailA(set2, &interfaceData2, NULL, 0, &dwSize, NULL); ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got %08x\n", GetLastError()); if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { static const char path[] = "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}"; - static const char path_wow64[] = + static const char path_w10[] = "\\\\?\\root#legacy_bogus#0001#{6a55b5a4-3f65-11db-b704-0011955c2bdb}"; static const char path_w2k[] = "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\"; @@ -1132,42 +942,29 @@ { detail->cbSize = sizeof(*detail); SetLastError(0xdeadbeef); - ret = pSetupDiGetDeviceInterfaceDetailA(set, &interfaceData, + ret = pSetupDiGetDeviceInterfaceDetailA(set2, &interfaceData2, detail, dwSize, &dwSize, NULL); ok(ret, "SetupDiGetDeviceInterfaceDetailA failed: %08x\n", GetLastError()); - /* FIXME: This one only worked because old data wasn't removed properly. As soon - * as all the tests are cleaned up correctly this has to be (or should be) fixed - */ - if(is_wow64) - ok(!lstrcmpiA(path_wow64, detail->DevicePath), - "Unexpected path %s\n", detail->DevicePath); - else - todo_wine ok(!lstrcmpiA(path, detail->DevicePath) || - !lstrcmpiA(path_w2k, detail->DevicePath), - "Unexpected path %s\n", detail->DevicePath); + ok(!lstrcmpiA(path, detail->DevicePath) || + !lstrcmpiA(path_w10, detail->DevicePath) || + !lstrcmpiA(path_w2k, detail->DevicePath), + "Unexpected path %s\n", detail->DevicePath); HeapFree(GetProcessHeap(), 0, detail); } } + ret = pSetupDiRemoveDeviceInterface(set, &interfaceData); + todo_wine ok(ret, "SetupDiRemoveDeviceInterface failed: %08x\n", GetLastError()); + + ret = pSetupDiRemoveDevice(set, &devInfo); + todo_wine ok(ret, "got %u\n", GetLastError()); + pSetupDiDestroyDeviceInfoList(set); - - /* Cleanup */ - ret = remove_device(); - if(!is_wow64) - todo_wine ok(ret, "Expected the device to be removed: %08x\n", GetLastError()); - - /* FIXME: Only do the RegDeleteKey, once Wine is fixed */ - if (!ret) - { - /* Wine doesn't delete the information currently */ - trace("We are most likely on Wine\n"); - devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus); - devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, devclass); - } - else - { - clean_devclass_key(); - } + pSetupDiDestroyDeviceInfoList(set2); + + /* remove once Wine is fixed */ + devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus); + devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, classKey); } static void testDeviceRegistryPropertyA(void) @@ -1260,6 +1057,10 @@ todo_wine ok(!ret && GetLastError() == ERROR_INVALID_DATA, "Expected ERROR_INVALID_DATA, got %08x\n", GetLastError()); + ret = pSetupDiGetDeviceRegistryPropertyA(set, &devInfo, SPDRP_HARDWAREID, + NULL, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INVALID_DATA, + "Expected ERROR_INVALID_DATA, got %08x\n", GetLastError()); pSetupDiDestroyDeviceInfoList(set); res = RegOpenKeyA(HKEY_LOCAL_MACHINE, bogus, &key); @@ -1269,7 +1070,6 @@ if (res == ERROR_SUCCESS) { /* Wine doesn't delete the information currently */ - trace("We are most likely on Wine\n"); RegDeleteKeyA(HKEY_LOCAL_MACHINE, bogus); } } @@ -1366,6 +1166,10 @@ todo_wine ok(!ret && GetLastError() == ERROR_INVALID_DATA, "Expected ERROR_INVALID_DATA, got %08x\n", GetLastError()); + ret = pSetupDiGetDeviceRegistryPropertyW(set, &devInfo, SPDRP_HARDWAREID, + NULL, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INVALID_DATA, + "Expected ERROR_INVALID_DATA, got %08x\n", GetLastError()); pSetupDiDestroyDeviceInfoList(set); res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key); @@ -1375,7 +1179,6 @@ if (res == ERROR_SUCCESS) { /* Wine doesn't delete the information currently */ - trace("We are most likely on Wine\n"); RegDeleteKeyW(HKEY_LOCAL_MACHINE, bogus); } } @@ -1462,7 +1265,7 @@ for(i=0; i < sizeof(signatures)/sizeof(char*); i++) { - trace("testing signarture %s\n", signatures[i]); + trace("testing signature %s\n", signatures[i]); h = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if(h == INVALID_HANDLE_VALUE) @@ -1580,7 +1383,16 @@ START_TEST(devinst) { + HKEY hkey; + init_function_pointers(); + + if ((hkey = SetupDiOpenClassRegKey(NULL, KEY_ALL_ACCESS)) == INVALID_HANDLE_VALUE) + { + skip("needs admin rights\n"); + return; + } + RegCloseKey(hkey); if (pIsWow64Process) pIsWow64Process(GetCurrentProcess(), &is_wow64); Modified: trunk/rostests/winetests/setupapi/install.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/instal…
============================================================================== --- trunk/rostests/winetests/setupapi/install.c [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/install.c [iso-8859-1] Sun Jun 4 01:51:43 2017 @@ -454,6 +454,14 @@ goto cleanup; } + snprintf(path, MAX_PATH, "%s\\TestDir", commonprogs); + if (!CreateDirectoryA(path, NULL) && GetLastError() == ERROR_ACCESS_DENIED) + { + skip("need admin rights\n"); + return; + } + RemoveDirectoryA(path); + create_inf_file(inffile, inf); sprintf(path, "%s\\%s", CURR_DIR, inffile); run_cmdline("DefaultInstall", 128, path); Modified: trunk/rostests/winetests/setupapi/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/misc.c…
============================================================================== --- trunk/rostests/winetests/setupapi/misc.c [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/misc.c [iso-8859-1] Sun Jun 4 01:51:43 2017 @@ -231,6 +231,11 @@ strcat(path, tmpfile); SetLastError(0xdeadbeef); res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, NULL, 0, NULL, NULL); + if (!res && GetLastError() == ERROR_ACCESS_DENIED) + { + skip("SetupCopyOEMInfA() failed on insufficient permissions\n"); + return; + } ok(res == TRUE, "Expected TRUE, got %d\n", res); ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); ok(file_exists(path), "Expected source inf to exist\n"); @@ -792,7 +797,7 @@ ret = SetupOpenLog(FALSE); if (!ret && GetLastError() == ERROR_ACCESS_DENIED) { - win_skip("SetupOpenLog() failed on insufficient permissions\n"); + skip("SetupOpenLog() failed on insufficient permissions\n"); return; } ok(ret, "SetupOpenLog failed, error %d\n", GetLastError()); Modified: trunk/rostests/winetests/setupapi/query.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/query.…
============================================================================== --- trunk/rostests/winetests/setupapi/query.c [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/query.c [iso-8859-1] Sun Jun 4 01:51:43 2017 @@ -99,13 +99,16 @@ "[CopyAlways.Windir.Files]\n" "WindowsCodecs.dll\n"; -static void create_inf_file(LPSTR filename, const char *data, DWORD size) -{ +static BOOL create_inf_file(LPSTR filename, const char *data, DWORD size) +{ + BOOL ret; DWORD dwNumberOfBytesWritten; HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - WriteFile(hf, data, size, &dwNumberOfBytesWritten, NULL); + if (hf == INVALID_HANDLE_VALUE) return FALSE; + ret = WriteFile(hf, data, size, &dwNumberOfBytesWritten, NULL); CloseHandle(hf); + return ret; } static BOOL check_info_filename(PSP_INF_INFORMATION info, LPSTR test) @@ -258,7 +261,13 @@ lstrcpyA(inf_two, WIN_DIR); lstrcatA(inf_two, "\\system32\\"); lstrcatA(inf_two, "test.inf"); - create_inf_file(inf_two, inf_data1, sizeof(inf_data1) - 1); + ret = create_inf_file(inf_two, inf_data1, sizeof(inf_data1) - 1); + if (!ret && GetLastError() == ERROR_ACCESS_DENIED) + { + skip("need admin rights\n"); + goto done; + } + ok(ret, "can't create inf file %u\n", GetLastError()); HeapFree(GetProcessHeap(), 0, info); info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size); @@ -291,8 +300,8 @@ ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n"); ok(check_info_filename(info, revfile), "Expected returned filename to be equal\n"); +done: HeapFree(GetProcessHeap(), 0, info); - DeleteFileA(inf_filename); DeleteFileA(inf_one); DeleteFileA(inf_two); Modified: trunk/rostests/winetests/setupapi/setupcab.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/setupc…
============================================================================== --- trunk/rostests/winetests/setupapi/setupcab.c [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/setupcab.c [iso-8859-1] Sun Jun 4 01:51:43 2017 @@ -299,30 +299,49 @@ static const char *expected_files[] = {"tristram", "wine", "shandy"}; +struct contextA +{ + int count; + const char *cabinet; + const char *target; +}; + static UINT CALLBACK simple_callbackA(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2) { static int index; - int *file_count = Context; + struct contextA *ctx = Context; switch (Notification) { case SPFILENOTIFY_CABINETINFO: + { + CABINET_INFO_A *info = (CABINET_INFO_A *)Param1; + + ok(!strcmp(info->CabinetFile, ""), + "Expected empty CabinetFile, got \"%s\"\n", info->CabinetFile); + index = 0; return NO_ERROR; + } case SPFILENOTIFY_FILEINCABINET: { FILE_IN_CABINET_INFO_A *info = (FILE_IN_CABINET_INFO_A *)Param1; - - (*file_count)++; + const char *cabinet_file = (const char *)Param2; + + ctx->count++; if (index < sizeof(expected_files)/sizeof(char *)) { ok(!strcmp(expected_files[index], info->NameInCabinet), "[%d] Expected file \"%s\", got \"%s\"\n", index, expected_files[index], info->NameInCabinet); - index++; - return FILEOP_SKIP; + ok(!strcmp(ctx->cabinet, cabinet_file), + "[%d] Expected cabinet \"%s\", got \"%s\"\n", + index, ctx->cabinet, cabinet_file); + + strcpy(info->FullTargetName, ctx->target); + return FILEOP_DOIT; } else { @@ -330,6 +349,23 @@ return FILEOP_ABORT; } } + case SPFILENOTIFY_FILEEXTRACTED: + { + FILEPATHS_A *info = (FILEPATHS_A *)Param1; + + ok(!strcmp(ctx->cabinet, info->Source), + "[%d] Expected cabinet \"%s\", got \"%s\"\n", + index, ctx->cabinet, info->Source); + ok(!strcmp(ctx->target, info->Target), + "[%d] Expected target \"%s\", got \"%s\"\n", + index, ctx->target, info->Target); + ok(info->Win32Error == 0, + "[%d] Expected Win32Error 0, got %u\n", + index, info->Win32Error); + + index++; + return NO_ERROR; + } default: return NO_ERROR; } @@ -339,19 +375,25 @@ { BOOL ret; char source[MAX_PATH], temp[MAX_PATH]; - int enum_count = 0; + char target[MAX_PATH]; + struct contextA ctx; GetTempPathA(sizeof(temp), temp); GetTempFileNameA(temp, "doc", 0, source); + GetTempFileNameA(temp, "doc", 0, target); create_source_fileA(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi)); - ret = SetupIterateCabinetA(source, 0, simple_callbackA, &enum_count); + ctx.count = 0; + ctx.cabinet = source; + ctx.target = target; + ret = SetupIterateCabinetA(source, 0, simple_callbackA, &ctx); ok(ret == 1, "Expected SetupIterateCabinetA to return 1, got %d\n", ret); - ok(enum_count == sizeof(expected_files)/sizeof(char *), - "Unexpectedly enumerated %d files\n", enum_count); + ok(ctx.count == sizeof(expected_files)/sizeof(char *), + "Unexpectedly enumerated %d files\n", ctx.count); DeleteFileA(source); + DeleteFileA(target); } static const WCHAR tristramW[] = {'t','r','i','s','t','r','a','m',0}; @@ -359,30 +401,50 @@ static const WCHAR shandyW[] = {'s','h','a','n','d','y',0}; static const WCHAR *expected_filesW[] = {tristramW, wineW, shandyW}; +struct contextW +{ + int count; + const WCHAR *cabinet; + const WCHAR *target; +}; + static UINT CALLBACK simple_callbackW(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2) { + static const WCHAR emptyW[] = {0}; static int index; - int *file_count = Context; + struct contextW *ctx = Context; switch (Notification) { case SPFILENOTIFY_CABINETINFO: + { + CABINET_INFO_W *info = (CABINET_INFO_W *)Param1; + + ok(!lstrcmpW(info->CabinetFile, emptyW), + "Expected empty CabinetFile, got %s\n", wine_dbgstr_w(info->CabinetFile)); + index = 0; return NO_ERROR; + } case SPFILENOTIFY_FILEINCABINET: { FILE_IN_CABINET_INFO_W *info = (FILE_IN_CABINET_INFO_W *)Param1; - - (*file_count)++; + const WCHAR *cabinet_file = (const WCHAR *)Param2; + + ctx->count++; if (index < sizeof(expected_filesW)/sizeof(WCHAR *)) { ok(!lstrcmpW(expected_filesW[index], info->NameInCabinet), "[%d] Expected file %s, got %s\n", index, wine_dbgstr_w(expected_filesW[index]), wine_dbgstr_w(info->NameInCabinet)); - index++; - return FILEOP_SKIP; + ok(!lstrcmpW(ctx->cabinet, cabinet_file), + "[%d] Expected cabinet %s, got %s\n", + index, wine_dbgstr_w(ctx->cabinet), wine_dbgstr_w(cabinet_file)); + + lstrcpyW(info->FullTargetName, ctx->target); + return FILEOP_DOIT; } else { @@ -390,6 +452,23 @@ return FILEOP_ABORT; } } + case SPFILENOTIFY_FILEEXTRACTED: + { + FILEPATHS_W *info = (FILEPATHS_W *)Param1; + + ok(!lstrcmpW(ctx->cabinet, info->Source), + "[%d] Expected cabinet %s, got %s\n", + index, wine_dbgstr_w(ctx->cabinet), wine_dbgstr_w(info->Source)); + ok(!lstrcmpW(ctx->target, info->Target), + "[%d] Expected target %s, got %s\n", + index, wine_dbgstr_w(ctx->target), wine_dbgstr_w(info->Target)); + ok(info->Win32Error == 0, + "[%d] Expected Win32Error 0, got %u\n", + index, info->Win32Error); + + index++; + return NO_ERROR; + } default: return NO_ERROR; } @@ -399,7 +478,8 @@ { BOOL ret; WCHAR source[MAX_PATH], temp[MAX_PATH]; - int enum_count = 0; + WCHAR target[MAX_PATH]; + struct contextW ctx; ret = SetupIterateCabinetW(NULL, 0, NULL, NULL); if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) @@ -410,15 +490,20 @@ GetTempPathW(sizeof(temp)/sizeof(WCHAR), temp); GetTempFileNameW(temp, docW, 0, source); + GetTempFileNameW(temp, docW, 0, target); create_source_fileW(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi)); - ret = SetupIterateCabinetW(source, 0, simple_callbackW, &enum_count); + ctx.count = 0; + ctx.cabinet = source; + ctx.target = target; + ret = SetupIterateCabinetW(source, 0, simple_callbackW, &ctx); ok(ret == 1, "Expected SetupIterateCabinetW to return 1, got %d\n", ret); - ok(enum_count == sizeof(expected_files)/sizeof(WCHAR *), - "Unexpectedly enumerated %d files\n", enum_count); + ok(ctx.count == sizeof(expected_files)/sizeof(WCHAR *), + "Unexpectedly enumerated %d files\n", ctx.count); DeleteFileW(source); + DeleteFileW(target); } START_TEST(setupcab)
7 years, 10 months
1
0
0
0
[akhaldi] 74885: [SERVICES_WINETEST] Sync with Wine Staging 2.9. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 01:51:25 2017 New Revision: 74885 URL:
http://svn.reactos.org/svn/reactos?rev=74885&view=rev
Log: [SERVICES_WINETEST] Sync with Wine Staging 2.9. CORE-13362 Modified: trunk/rostests/winetests/services/CMakeLists.txt trunk/rostests/winetests/services/service.c Modified: trunk/rostests/winetests/services/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/services/CMakeL…
============================================================================== --- trunk/rostests/winetests/services/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/services/CMakeLists.txt [iso-8859-1] Sun Jun 4 01:51:25 2017 @@ -1,5 +1,5 @@ add_executable(services_winetest service.c testlist.c) set_module_type(services_winetest win32cui) -add_importlibs(services_winetest advapi32 msvcrt kernel32) +add_importlibs(services_winetest user32 advapi32 msvcrt kernel32) add_rostests_file(TARGET services_winetest) Modified: trunk/rostests/winetests/services/service.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/services/servic…
============================================================================== --- trunk/rostests/winetests/services/service.c [iso-8859-1] (original) +++ trunk/rostests/winetests/services/service.c [iso-8859-1] Sun Jun 4 01:51:25 2017 @@ -16,8 +16,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <windows.h> +#include <stdarg.h> + +#include <windef.h> +#include <winsvc.h> #include <stdio.h> +#include <winbase.h> +#include <winuser.h> #include "wine/test.h" @@ -59,6 +64,67 @@ va_end(valist); send_msg(cnd ? "OK" : "FAIL", buf); +} + +static void test_winstation(void) +{ + HWINSTA winstation; + USEROBJECTFLAGS flags; + BOOL r; + + winstation = GetProcessWindowStation(); + service_ok(winstation != NULL, "winstation = NULL\n"); + + r = GetUserObjectInformationA(winstation, UOI_FLAGS, &flags, sizeof(flags), NULL); + service_ok(r, "GetUserObjectInformation(UOI_NAME) failed: %u\n", GetLastError()); + service_ok(!(flags.dwFlags & WSF_VISIBLE), "winstation has flags %x\n", flags.dwFlags); +} + +/* + * Test creating window in a service process. Although services run in non-interactive, + * they may create windows that will never be visible. + */ +static void test_create_window(void) +{ + DWORD style; + ATOM class; + HWND hwnd; + BOOL r; + + static WNDCLASSEXA wndclass = { + sizeof(WNDCLASSEXA), + 0, + DefWindowProcA, + 0, 0, NULL, NULL, NULL, NULL, NULL, + "service_test", + NULL + }; + + hwnd = GetDesktopWindow(); + service_ok(IsWindow(hwnd), "GetDesktopWindow returned invalid window %p\n", hwnd); + + class = RegisterClassExA(&wndclass); + service_ok(class, "RegisterClassFailed\n"); + + hwnd = CreateWindowA("service_test", "service_test", + WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, + 515, 530, NULL, NULL, NULL, NULL); + service_ok(hwnd != NULL, "CreateWindow failed: %u\n", GetLastError()); + + style = GetWindowLongW(hwnd, GWL_STYLE); + service_ok(!(style & WS_VISIBLE), "style = %x, expected invisible\n", style); + + r = ShowWindow(hwnd, SW_SHOW); + service_ok(!r, "ShowWindow returned %x\n", r); + + style = GetWindowLongW(hwnd, GWL_STYLE); + service_ok(style & WS_VISIBLE, "style = %x, expected visible\n", style); + + r = ShowWindow(hwnd, SW_SHOW); + service_ok(r, "ShowWindow returned %x\n", r); + + r = DestroyWindow(hwnd); + service_ok(r, "DestroyWindow failed: %08x\n", GetLastError()); } static DWORD WINAPI service_handler(DWORD ctrl, DWORD event_type, void *event_data, void *context) @@ -83,6 +149,8 @@ SetEvent(service_stop_event); return NO_ERROR; case 128: + test_winstation(); + test_create_window(); service_event("CUSTOM"); return 0xdeadbeef; default:
7 years, 10 months
1
0
0
0
[akhaldi] 74884: [SECUR32_WINETEST] Sync with Wine Staging 2.9. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 01:51:16 2017 New Revision: 74884 URL:
http://svn.reactos.org/svn/reactos?rev=74884&view=rev
Log: [SECUR32_WINETEST] Sync with Wine Staging 2.9. CORE-13362 Modified: trunk/rostests/winetests/secur32/ntlm.c trunk/rostests/winetests/secur32/schannel.c trunk/rostests/winetests/secur32/secur32.c Modified: trunk/rostests/winetests/secur32/ntlm.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/secur32/ntlm.c?…
============================================================================== --- trunk/rostests/winetests/secur32/ntlm.c [iso-8859-1] (original) +++ trunk/rostests/winetests/secur32/ntlm.c [iso-8859-1] Sun Jun 4 01:51:16 2017 @@ -574,7 +574,7 @@ { SECURITY_STATUS sec_status; PSecPkgInfoA pkg_info = NULL; - SspiData client; + SspiData client = {{0}}; SEC_WINNT_AUTH_IDENTITY_A id; ULONG req_attr, ctxt_attr; TimeStamp ttl; @@ -794,7 +794,7 @@ SECURITY_STATUS sec_status; PSecPkgInfoA pkg_info = NULL; BOOL first = TRUE; - SspiData client, server; + SspiData client = {{0}}, server = {{0}}; SEC_WINNT_AUTH_IDENTITY_A id; SecPkgContext_Sizes ctxt_sizes; @@ -923,7 +923,7 @@ SECURITY_STATUS sec_status; PSecPkgInfoA pkg_info = NULL; BOOL first = TRUE; - SspiData client, server; + SspiData client = {{0}}, server = {{0}}; SEC_WINNT_AUTH_IDENTITY_A id; static char sec_pkg_name[] = "NTLM"; SecBufferDesc crypt; @@ -971,6 +971,10 @@ { client_stat = runClient(&client, first, SECURITY_NETWORK_DREP); + ok(client_stat == SEC_E_OK || client_stat == SEC_I_CONTINUE_NEEDED, + "Running the client returned %s, more tests will fail.\n", + getSecError(client_stat)); + communicate(&client, &server); server_stat = runFakeServer(&server, first, SECURITY_NETWORK_DREP); @@ -978,6 +982,12 @@ communicate(&server, &client); trace("Looping\n"); first = FALSE; + } + + if(client_stat != SEC_E_OK) + { + skip("Authentication failed, skipping test.\n"); + goto end; } /******************************************** @@ -1340,8 +1350,8 @@ SEC_WINNT_AUTH_IDENTITY_A id; PSecPkgInfoA pkg_info = NULL; CredHandle cred; - CtxtHandle ctxt1; - CtxtHandle ctxt2; + CtxtHandle ctxt1 = {0}; + CtxtHandle ctxt2 = {0}; SecBufferDesc buffer_desc; SecBuffer buffers[1]; ULONG ctxt_attr; @@ -1400,7 +1410,7 @@ SECURITY_STATUS status; PSecPkgInfoA info; CredHandle cred; - CtxtHandle ctx; + CtxtHandle ctx = {0}; SecBufferDesc buffer_desc; SecBuffer buffers[1]; char user[256]; Modified: trunk/rostests/winetests/secur32/schannel.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/secur32/schanne…
============================================================================== --- trunk/rostests/winetests/secur32/schannel.c [iso-8859-1] (original) +++ trunk/rostests/winetests/secur32/schannel.c [iso-8859-1] Sun Jun 4 01:51:16 2017 @@ -29,18 +29,7 @@ #include "wine/test.h" -static HMODULE secdll; - -static ACQUIRE_CREDENTIALS_HANDLE_FN_A pAcquireCredentialsHandleA; -static ENUMERATE_SECURITY_PACKAGES_FN_A pEnumerateSecurityPackagesA; -static FREE_CONTEXT_BUFFER_FN pFreeContextBuffer; -static FREE_CREDENTIALS_HANDLE_FN pFreeCredentialsHandle; -static QUERY_CREDENTIALS_ATTRIBUTES_FN_A pQueryCredentialsAttributesA; -static INITIALIZE_SECURITY_CONTEXT_FN_A pInitializeSecurityContextA; static QUERY_CONTEXT_ATTRIBUTES_FN_A pQueryContextAttributesA; -static DELETE_SECURITY_CONTEXT_FN pDeleteSecurityContext; -static DECRYPT_MESSAGE_FN pDecryptMessage; -static ENCRYPT_MESSAGE_FN pEncryptMessage; static const BYTE bigCert[] = { 0x30, 0x7a, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06, 0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, @@ -106,31 +95,6 @@ 0xa8, 0x76, 0x57, 0x92, 0x36 }; static CHAR unisp_name_a[] = UNISP_NAME_A; - -static void InitFunctionPtrs(void) -{ - secdll = LoadLibraryA("secur32.dll"); - if(!secdll) - secdll = LoadLibraryA("security.dll"); - -#define GET_PROC(h, func) p ## func = (void*)GetProcAddress(h, #func) - - if(secdll) - { - GET_PROC(secdll, AcquireCredentialsHandleA); - GET_PROC(secdll, EnumerateSecurityPackagesA); - GET_PROC(secdll, FreeContextBuffer); - GET_PROC(secdll, FreeCredentialsHandle); - GET_PROC(secdll, QueryCredentialsAttributesA); - GET_PROC(secdll, InitializeSecurityContextA); - GET_PROC(secdll, QueryContextAttributesA); - GET_PROC(secdll, DeleteSecurityContext); - GET_PROC(secdll, DecryptMessage); - GET_PROC(secdll, EncryptMessage); - } - -#undef GET_PROC -} static const char *algid_to_str(ALG_ID alg) { @@ -212,7 +176,7 @@ SecPkgCred_CipherStrengths strength = {-1,-1}; SECURITY_STATUS st; - st = pQueryCredentialsAttributesA(handle, SECPKG_ATTR_CIPHER_STRENGTHS, &strength); + st = QueryCredentialsAttributesA(handle, SECPKG_ATTR_CIPHER_STRENGTHS, &strength); ok(st == SEC_E_OK, "QueryCredentialsAttributesA failed: %u\n", GetLastError()); ok(strength.dwMinimumCipherStrength, "dwMinimumCipherStrength not changed\n"); ok(strength.dwMaximumCipherStrength, "dwMaximumCipherStrength not changed\n"); @@ -224,7 +188,7 @@ SecPkgCred_SupportedProtocols protocols; SECURITY_STATUS status; - status = pQueryCredentialsAttributesA(handle, SECPKG_ATTR_SUPPORTED_PROTOCOLS, &protocols); + status = QueryCredentialsAttributesA(handle, SECPKG_ATTR_SUPPORTED_PROTOCOLS, &protocols); ok(status == SEC_E_OK, "QueryCredentialsAttributes failed: %08x\n", status); if(exprots) @@ -250,7 +214,7 @@ SECURITY_STATUS status; unsigned i; - status = pQueryCredentialsAttributesA(handle, SECPKG_ATTR_SUPPORTED_ALGS, &algs); + status = QueryCredentialsAttributesA(handle, SECPKG_ATTR_SUPPORTED_ALGS, &algs); todo_wine ok(status == SEC_E_OK, "QueryCredentialsAttributes failed: %08x\n", status); if(status != SEC_E_OK) return; @@ -259,7 +223,7 @@ for(i=0; i < algs.cSupportedAlgs; i++) trace(" %s\n", algid_to_str(algs.palgSupportedAlgs[i])); - pFreeContextBuffer(algs.palgSupportedAlgs); + FreeContextBuffer(algs.palgSupportedAlgs); } static void test_cread_attrs(void) @@ -268,31 +232,31 @@ SECURITY_STATUS status; CredHandle cred; - status = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + status = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, NULL, NULL, NULL, &cred, NULL); ok(status == SEC_E_OK, "AcquireCredentialsHandleA failed: %x\n", status); test_supported_protocols(&cred, 0); test_supported_algs(&cred); - status = pQueryCredentialsAttributesA(&cred, SECPKG_ATTR_SUPPORTED_PROTOCOLS, NULL); + status = QueryCredentialsAttributesA(&cred, SECPKG_ATTR_SUPPORTED_PROTOCOLS, NULL); ok(status == SEC_E_INTERNAL_ERROR, "QueryCredentialsAttributes failed: %08x, expected SEC_E_INTERNAL_ERROR\n", status); - status = pQueryCredentialsAttributesA(&cred, SECPKG_ATTR_SUPPORTED_ALGS, NULL); + status = QueryCredentialsAttributesA(&cred, SECPKG_ATTR_SUPPORTED_ALGS, NULL); ok(status == SEC_E_INTERNAL_ERROR, "QueryCredentialsAttributes failed: %08x, expected SEC_E_INTERNAL_ERROR\n", status); - pFreeCredentialsHandle(&cred); + FreeCredentialsHandle(&cred); init_cred(&schannel_cred); schannel_cred.grbitEnabledProtocols = SP_PROT_TLS1_CLIENT; - status = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + status = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schannel_cred, NULL, NULL, &cred, NULL); ok(status == SEC_E_OK, "AcquireCredentialsHandleA failed: %x\n", status); test_supported_protocols(&cred, SP_PROT_TLS1_CLIENT); test_supported_algs(&cred); - pFreeCredentialsHandle(&cred); + FreeCredentialsHandle(&cred); } static void testAcquireSecurityContext(void) @@ -312,15 +276,8 @@ HCRYPTKEY key; CRYPT_KEY_PROV_INFO keyProvInfo; - if (!pAcquireCredentialsHandleA || - !pEnumerateSecurityPackagesA || !pFreeContextBuffer || - !pFreeCredentialsHandle) - { - win_skip("Needed functions are not available\n"); - return; - } - - if (SUCCEEDED(pEnumerateSecurityPackagesA(&i, &package_info))) + + if (SUCCEEDED(EnumerateSecurityPackagesA(&i, &package_info))) { while(i--) { @@ -330,7 +287,7 @@ break; } } - pFreeContextBuffer(package_info); + FreeContextBuffer(package_info); } if (!has_schannel) { @@ -361,55 +318,55 @@ return; } - st = pAcquireCredentialsHandleA(NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, + st = AcquireCredentialsHandleA(NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); ok(st == SEC_E_SECPKG_NOT_FOUND, "Expected SEC_E_SECPKG_NOT_FOUND, got %08x\n", st); if (0) { /* Crashes on Win2K */ - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, 0, NULL, NULL, NULL, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, 0, NULL, NULL, NULL, NULL, NULL, NULL); ok(st == SEC_E_NO_CREDENTIALS, "Expected SEC_E_NO_CREDENTIALS, got %08x\n", st); /* Crashes on WinNT */ - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_BOTH, NULL, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_BOTH, NULL, NULL, NULL, NULL, NULL, NULL); ok(st == SEC_E_NO_CREDENTIALS, "Expected SEC_E_NO_CREDENTIALS, got %08x\n", st); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, NULL, NULL, NULL, NULL, NULL); ok(st == SEC_E_NO_CREDENTIALS, "Expected SEC_E_NO_CREDENTIALS, got %08x\n", st); /* Crashes */ - pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, NULL, NULL, NULL, NULL, NULL); } - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, NULL, NULL, NULL, &cred, NULL); ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st); if(st == SEC_E_OK) - pFreeCredentialsHandle(&cred); + FreeCredentialsHandle(&cred); memset(&cred, 0, sizeof(cred)); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, NULL, NULL, NULL, &cred, &exp); ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st); /* expriy is indeterminate in win2k3 */ trace("expiry: %08x%08x\n", exp.HighPart, exp.LowPart); - st = pQueryCredentialsAttributesA(&cred, SECPKG_CRED_ATTR_NAMES, &names); + st = QueryCredentialsAttributesA(&cred, SECPKG_CRED_ATTR_NAMES, &names); ok(st == SEC_E_NO_CREDENTIALS || st == SEC_E_UNSUPPORTED_FUNCTION /* before Vista */, "expected SEC_E_NO_CREDENTIALS, got %08x\n", st); - pFreeCredentialsHandle(&cred); + FreeCredentialsHandle(&cred); /* Bad version in SCHANNEL_CRED */ memset(&schanCred, 0, sizeof(schanCred)); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, NULL, NULL); ok(st == SEC_E_INTERNAL_ERROR || st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */ || st == SEC_E_INVALID_TOKEN /* WinNT */, "st = %08x\n", st); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, NULL, NULL); ok(st == SEC_E_INTERNAL_ERROR || st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */ || @@ -417,12 +374,12 @@ /* No cert in SCHANNEL_CRED succeeds for outbound.. */ schanCred.dwVersion = SCHANNEL_CRED_VERSION; - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st); - pFreeCredentialsHandle(&cred); + FreeCredentialsHandle(&cred); /* but fails for inbound. */ - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_NO_CREDENTIALS || st == SEC_E_OK /* Vista/win2k8 */, @@ -432,7 +389,7 @@ { /* Crashes with bad paCred pointer */ schanCred.cCreds = 1; - pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, NULL, NULL); } @@ -441,12 +398,12 @@ */ schanCred.cCreds = 1; schanCred.paCred = &certs[0]; - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, NULL, NULL); ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_NO_CREDENTIALS || st == SEC_E_INVALID_TOKEN /* WinNT */, "st = %08x\n", st); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, NULL, NULL); ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_NO_CREDENTIALS || @@ -457,13 +414,13 @@ */ schanCred.cCreds = 1; schanCred.paCred = &certs[1]; - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_NO_CREDENTIALS || st == SEC_E_INTERNAL_ERROR, /* win2k */ "Expected SEC_E_UNKNOWN_CREDENTIALS, SEC_E_NO_CREDENTIALS " "or SEC_E_INTERNAL_ERROR, got %08x\n", st); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, NULL, NULL); ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_NO_CREDENTIALS || st == SEC_E_INTERNAL_ERROR, /* win2k */ @@ -475,11 +432,11 @@ CERT_KEY_PROV_INFO_PROP_ID, 0, &keyProvInfo); schanCred.dwVersion = SCH_CRED_V3; ok(ret, "CertSetCertificateContextProperty failed: %08x\n", GetLastError()); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_INTERNAL_ERROR /* WinNT */, "Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_INTERNAL_ERROR, got %08x\n", st); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_INTERNAL_ERROR /* WinNT */, "Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_INTERNAL_ERROR, got %08x\n", st); @@ -498,29 +455,29 @@ if (0) { /* Crashes */ - pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, NULL, NULL); /* Crashes on WinNT */ /* Good cert with private key, bogus version */ schanCred.dwVersion = SCH_CRED_V1; - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_INTERNAL_ERROR || st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */, "Expected SEC_E_INTERNAL_ERROR or SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_INTERNAL_ERROR || st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */, "Expected SEC_E_INTERNAL_ERROR or SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st); schanCred.dwVersion = SCH_CRED_V2; - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_INTERNAL_ERROR || st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */, "Expected SEC_E_INTERNAL_ERROR or SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_INTERNAL_ERROR || st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */, @@ -529,38 +486,38 @@ /* Succeeds on V3 or higher */ schanCred.dwVersion = SCH_CRED_V3; - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st); - pFreeCredentialsHandle(&cred); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + FreeCredentialsHandle(&cred); + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_OK || st == SEC_E_UNKNOWN_CREDENTIALS, /* win2k3 */ "AcquireCredentialsHandleA failed: %08x\n", st); - pFreeCredentialsHandle(&cred); + FreeCredentialsHandle(&cred); schanCred.dwVersion = SCHANNEL_CRED_VERSION; - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st); - pFreeCredentialsHandle(&cred); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + FreeCredentialsHandle(&cred); + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_OK || st == SEC_E_UNKNOWN_CREDENTIALS, /* win2k3 */ "AcquireCredentialsHandleA failed: %08x\n", st); if (st == SEC_E_OK) test_strength(&cred); - pFreeCredentialsHandle(&cred); + FreeCredentialsHandle(&cred); /* How about more than one cert? */ schanCred.cCreds = 2; schanCred.paCred = certs; - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_NO_CREDENTIALS /* Vista/win2k8 */ || st == SEC_E_INVALID_TOKEN /* WinNT */, "st = %08x\n", st); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_NO_CREDENTIALS || @@ -568,12 +525,12 @@ tmp = certs[0]; certs[0] = certs[1]; certs[1] = tmp; - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_NO_CREDENTIALS || st == SEC_E_INVALID_TOKEN /* WinNT */, "st = %08x\n", st); - st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, + st = AcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_UNKNOWN_CREDENTIALS, "Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st); @@ -679,6 +636,36 @@ return received; } +static void test_InitializeSecurityContext(void) +{ + SCHANNEL_CRED cred; + CredHandle cred_handle; + CtxtHandle context; + SECURITY_STATUS status; + SecBuffer out_buffer = {1000, SECBUFFER_TOKEN, NULL}; + SecBuffer in_buffer = {0, SECBUFFER_EMPTY, NULL}; + SecBufferDesc out_buffers = {SECBUFFER_VERSION, 1, &out_buffer}; + SecBufferDesc in_buffers = {SECBUFFER_VERSION, 1, &in_buffer}; + ULONG attrs; + + init_cred(&cred); + cred.grbitEnabledProtocols = SP_PROT_TLS1_CLIENT; + cred.dwFlags = SCH_CRED_NO_DEFAULT_CREDS|SCH_CRED_MANUAL_CRED_VALIDATION; + status = AcquireCredentialsHandleA(NULL, (SEC_CHAR *)UNISP_NAME_A, SECPKG_CRED_OUTBOUND, NULL, + &cred, NULL, NULL, &cred_handle, NULL); + ok(status == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", status); + if (status != SEC_E_OK) return; + + status = InitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost", + ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM|ISC_REQ_ALLOCATE_MEMORY, + 0, 0, &in_buffers, 0, &context, &out_buffers, &attrs, NULL); + ok(status == SEC_I_CONTINUE_NEEDED, "Expected SEC_I_CONTINUE_NEEDED, got %08x\n", status); + + FreeContextBuffer(out_buffer.pvBuffer); + DeleteSecurityContext(&context); + FreeCredentialsHandle(&cred_handle); +} + static void test_communication(void) { int ret; @@ -697,6 +684,7 @@ SecPkgCredentials_NamesA names; SecPkgContext_StreamSizes sizes; SecPkgContext_ConnectionInfo conn_info; + SecPkgContext_KeyInfoA key_info; CERT_CONTEXT *cert; SecBufferDesc buffers[2]; @@ -705,11 +693,9 @@ unsigned char *data; unsigned data_size; - if (!pAcquireCredentialsHandleA || !pFreeCredentialsHandle || - !pInitializeSecurityContextA || !pDeleteSecurityContext || - !pQueryContextAttributesA || !pDecryptMessage || !pEncryptMessage) - { - skip("Required secur32 functions not available\n"); + if (!pQueryContextAttributesA) + { + win_skip("Required secur32 functions not available\n"); return; } @@ -750,7 +736,7 @@ cred.grbitEnabledProtocols = SP_PROT_TLS1_CLIENT; cred.dwFlags = SCH_CRED_NO_DEFAULT_CREDS|SCH_CRED_MANUAL_CRED_VALIDATION; - status = pAcquireCredentialsHandleA(NULL, (SEC_CHAR *)UNISP_NAME_A, SECPKG_CRED_OUTBOUND, NULL, + status = AcquireCredentialsHandleA(NULL, (SEC_CHAR *)UNISP_NAME_A, SECPKG_CRED_OUTBOUND, NULL, &cred, NULL, NULL, &cred_handle, NULL); ok(status == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", status); if (status != SEC_E_OK) return; @@ -760,7 +746,7 @@ init_buffers(&buffers[1], 4, buf_size); buffers[0].pBuffers[0].BufferType = SECBUFFER_TOKEN; - status = pInitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, NULL, 0, &context, &buffers[0], &attrs, NULL); ok(status == SEC_I_CONTINUE_NEEDED, "Expected SEC_I_CONTINUE_NEEDED, got %08x\n", status); @@ -769,7 +755,7 @@ buffers[1].pBuffers[0].BufferType = SECBUFFER_TOKEN; buffers[0].pBuffers[0].cbBuffer = 1; memset(buffers[1].pBuffers[0].pvBuffer, 0xfa, buf_size); - status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL); todo_wine @@ -781,14 +767,14 @@ buffers[1].pBuffers[0].BufferType = SECBUFFER_TOKEN; buffers[0].pBuffers[0].cbBuffer = 1; memset(buffers[1].pBuffers[0].pvBuffer, 0, buf_size); - status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL); ok(status == SEC_E_INVALID_TOKEN, "Expected SEC_E_INVALID_TOKEN, got %08x\n", status); ok(buffers[0].pBuffers[0].cbBuffer == 0, "Output buffer size was not set to 0.\n"); buffers[0].pBuffers[0].cbBuffer = 0; - status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL); todo_wine @@ -796,14 +782,14 @@ "Expected SEC_E_INSUFFICIENT_MEMORY or SEC_E_INVALID_TOKEN, got %08x\n", status); ok(buffers[0].pBuffers[0].cbBuffer == 0, "Output buffer size was not set to 0.\n"); - status = pInitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, NULL, 0, &context, NULL, &attrs, NULL); todo_wine ok(status == SEC_E_INVALID_TOKEN, "Expected SEC_E_INVALID_TOKEN, got %08x\n", status); buffers[0].pBuffers[0].cbBuffer = buf_size; - status = pInitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, NULL, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, NULL, 0, &context, &buffers[0], &attrs, NULL); ok(status == SEC_I_CONTINUE_NEEDED, "Expected SEC_I_CONTINUE_NEEDED, got %08x\n", status); @@ -812,7 +798,7 @@ send(sock, buf->pvBuffer, buf->cbBuffer, 0); buf->cbBuffer = buf_size; - status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, NULL, 0, NULL, &buffers[0], &attrs, NULL); ok(status == SEC_E_INCOMPLETE_MESSAGE, "Got unexpected status %#x.\n", status); @@ -822,7 +808,7 @@ buffers[1].cBuffers = 4; buffers[1].pBuffers[0].cbBuffer = 0; - status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL); ok(status == SEC_E_INCOMPLETE_MESSAGE, "Got unexpected status %#x.\n", status); @@ -836,23 +822,25 @@ return; buffers[1].pBuffers[0].cbBuffer = 4; - status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL); - ok(status == SEC_E_INCOMPLETE_MESSAGE, "Got unexpected status %#x.\n", status); + ok(status == SEC_E_INCOMPLETE_MESSAGE || status == SEC_E_INVALID_TOKEN, + "Got unexpected status %#x.\n", status); ok(buffers[0].pBuffers[0].cbBuffer == buf_size, "Output buffer size changed.\n"); ok(buffers[0].pBuffers[0].BufferType == SECBUFFER_TOKEN, "Output buffer type changed.\n"); buffers[1].pBuffers[0].cbBuffer = 5; - status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL); - ok(status == SEC_E_INCOMPLETE_MESSAGE, "Got unexpected status %#x.\n", status); + ok(status == SEC_E_INCOMPLETE_MESSAGE || status == SEC_E_INVALID_TOKEN, + "Got unexpected status %#x.\n", status); ok(buffers[0].pBuffers[0].cbBuffer == buf_size, "Output buffer size changed.\n"); ok(buffers[0].pBuffers[0].BufferType == SECBUFFER_TOKEN, "Output buffer type changed.\n"); buffers[1].pBuffers[0].cbBuffer = ret; - status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL); buffers[1].pBuffers[0].cbBuffer = buf_size; @@ -869,7 +857,7 @@ buf->BufferType = SECBUFFER_TOKEN; - status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", + status = InitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL); buffers[1].pBuffers[0].cbBuffer = buf_size; @@ -883,13 +871,55 @@ return; } - status = pQueryCredentialsAttributesA(&cred_handle, SECPKG_CRED_ATTR_NAMES, &names); + status = QueryCredentialsAttributesA(&cred_handle, SECPKG_CRED_ATTR_NAMES, &names); ok(status == SEC_E_NO_CREDENTIALS || status == SEC_E_UNSUPPORTED_FUNCTION /* before Vista */, "expected SEC_E_NO_CREDENTIALS, got %08x\n", status); status = pQueryContextAttributesA(&context, SECPKG_ATTR_REMOTE_CERT_CONTEXT, (void*)&cert); ok(status == SEC_E_OK, "QueryContextAttributesW(SECPKG_ATTR_REMOTE_CERT_CONTEXT) failed: %08x\n", status); if(status == SEC_E_OK) { + SecPkgContext_Bindings bindings = {0xdeadbeef, (void*)0xdeadbeef}; + test_remote_cert(cert); + + status = pQueryContextAttributesA(&context, SECPKG_ATTR_ENDPOINT_BINDINGS, &bindings); + ok(status == SEC_E_OK || broken(status == SEC_E_UNSUPPORTED_FUNCTION), + "QueryContextAttributesW(SECPKG_ATTR_ENDPOINT_BINDINGS) failed: %08x\n", status); + if(status == SEC_E_OK) { + static const char prefix[] = "tls-server-end-point:"; + const char *p; + BYTE hash[64]; + DWORD hash_size; + + ok(bindings.BindingsLength == sizeof(*bindings.Bindings) + sizeof(prefix)-1 + 32 /* hash size */, + "bindings.BindingsLength = %u\n", bindings.BindingsLength); + ok(!bindings.Bindings->dwInitiatorAddrType, "dwInitiatorAddrType = %x\n", bindings.Bindings->dwInitiatorAddrType); + ok(!bindings.Bindings->cbInitiatorLength, "cbInitiatorLength = %x\n", bindings.Bindings->cbInitiatorLength); + ok(!bindings.Bindings->dwInitiatorOffset, "dwInitiatorOffset = %x\n", bindings.Bindings->dwInitiatorOffset); + ok(!bindings.Bindings->dwAcceptorAddrType, "dwAcceptorAddrType = %x\n", bindings.Bindings->dwAcceptorAddrType); + ok(!bindings.Bindings->cbAcceptorLength, "cbAcceptorLength = %x\n", bindings.Bindings->cbAcceptorLength); + ok(!bindings.Bindings->dwAcceptorOffset, "dwAcceptorOffset = %x\n", bindings.Bindings->dwAcceptorOffset); + ok(sizeof(*bindings.Bindings) + bindings.Bindings->cbApplicationDataLength == bindings.BindingsLength, + "cbApplicationDataLength = %x\n", bindings.Bindings->cbApplicationDataLength); + ok(bindings.Bindings->dwApplicationDataOffset == sizeof(*bindings.Bindings), + "dwApplicationDataOffset = %x\n", bindings.Bindings->dwApplicationDataOffset); + p = (const char*)(bindings.Bindings+1); + ok(!memcmp(p, prefix, sizeof(prefix)-1), "missing prefix\n"); + p += sizeof(prefix)-1; + + hash_size = sizeof(hash); + ret = CryptHashCertificate(0, CALG_SHA_256, 0, cert->pbCertEncoded, cert->cbCertEncoded, hash, &hash_size); + if(ret) { + ok(hash_size == 32, "hash_size = %u\n", hash_size); + ok(!memcmp(hash, p, hash_size), "unexpected hash part\n"); + }else { + win_skip("SHA 256 hash not supported.\n"); + } + + FreeContextBuffer(bindings.Bindings); + }else { + win_skip("SECPKG_ATTR_ENDPOINT_BINDINGS not supported\n"); + } + CertFreeCertificateContext(cert); } @@ -898,6 +928,18 @@ if(status == SEC_E_OK) { ok(conn_info.dwCipherStrength >= 128, "conn_info.dwCipherStrength = %d\n", conn_info.dwCipherStrength); ok(conn_info.dwHashStrength >= 128, "conn_info.dwHashStrength = %d\n", conn_info.dwHashStrength); + } + + status = pQueryContextAttributesA(&context, SECPKG_ATTR_KEY_INFO, &key_info); + ok(status == SEC_E_OK, "QueryContextAttributesW(SECPKG_ATTR_KEY_INFO) failed: %08x\n", status); + if(status == SEC_E_OK) { + ok(broken(key_info.SignatureAlgorithm == 0 /* WinXP,2003 */) || + key_info.SignatureAlgorithm == CALG_RSA_SIGN, + "key_info.SignatureAlgorithm = %04x\n", key_info.SignatureAlgorithm); + ok(broken(key_info.SignatureAlgorithm == 0 /* WinXP,2003 */) || + !strcmp(key_info.sSignatureAlgorithmName, "RSA"), + "key_info.sSignatureAlgorithmName = %s\n", key_info.sSignatureAlgorithmName); + ok(key_info.KeySize >= 128, "key_info.KeySize = %d\n", key_info.KeySize); } status = pQueryContextAttributesA(&context, SECPKG_ATTR_STREAM_SIZES, &sizes); @@ -920,7 +962,7 @@ buf->pvBuffer = data + sizes.cbHeader + sizeof(http_request) -1; buf->cbBuffer = sizes.cbTrailer; - status = pEncryptMessage(&context, 0, &buffers[0], 0); + status = EncryptMessage(&context, 0, &buffers[0], 0); ok(status == SEC_E_OK, "EncryptMessage failed: %08x\n", status); if (status != SEC_E_OK) return; @@ -934,29 +976,29 @@ /* Too few buffers */ --buffers[0].cBuffers; - status = pDecryptMessage(&context, &buffers[0], 0, NULL); + status = DecryptMessage(&context, &buffers[0], 0, NULL); ok(status == SEC_E_INVALID_TOKEN, "Expected SEC_E_INVALID_TOKEN, got %08x\n", status); /* No data buffer */ ++buffers[0].cBuffers; - status = pDecryptMessage(&context, &buffers[0], 0, NULL); + status = DecryptMessage(&context, &buffers[0], 0, NULL); ok(status == SEC_E_INVALID_TOKEN, "Expected SEC_E_INVALID_TOKEN, got %08x\n", status); /* Two data buffers */ buffers[0].pBuffers[0].BufferType = SECBUFFER_DATA; buffers[0].pBuffers[1].BufferType = SECBUFFER_DATA; - status = pDecryptMessage(&context, &buffers[0], 0, NULL); + status = DecryptMessage(&context, &buffers[0], 0, NULL); ok(status == SEC_E_INVALID_TOKEN, "Expected SEC_E_INVALID_TOKEN, got %08x\n", status); /* Too few empty buffers */ buffers[0].pBuffers[1].BufferType = SECBUFFER_EXTRA; - status = pDecryptMessage(&context, &buffers[0], 0, NULL); + status = DecryptMessage(&context, &buffers[0], 0, NULL); ok(status == SEC_E_INVALID_TOKEN, "Expected SEC_E_INVALID_TOKEN, got %08x\n", status); /* Incomplete data */ buffers[0].pBuffers[1].BufferType = SECBUFFER_EMPTY; buffers[0].pBuffers[0].cbBuffer = (data[3]<<8) | data[4]; - status = pDecryptMessage(&context, &buffers[0], 0, NULL); + status = DecryptMessage(&context, &buffers[0], 0, NULL); ok(status == SEC_E_INCOMPLETE_MESSAGE, "Expected SEC_E_INCOMPLETE_MESSAGE, got %08x\n", status); ok(buffers[0].pBuffers[0].BufferType == SECBUFFER_MISSING, "Expected first buffer to be SECBUFFER_MISSING\n"); ok(buffers[0].pBuffers[0].cbBuffer == 5, "Expected first buffer to be a five bytes\n"); @@ -964,7 +1006,7 @@ buffers[0].pBuffers[0].cbBuffer = data_size; buffers[0].pBuffers[0].BufferType = SECBUFFER_DATA; buffers[0].pBuffers[1].BufferType = SECBUFFER_EMPTY; - status = pDecryptMessage(&context, &buffers[0], 0, NULL); + status = DecryptMessage(&context, &buffers[0], 0, NULL); ok(status == SEC_E_OK, "DecryptMessage failed: %08x\n", status); if (status == SEC_E_OK) { @@ -976,8 +1018,8 @@ data[buffers[0].pBuffers[1].cbBuffer] = 0; } - pDeleteSecurityContext(&context); - pFreeCredentialsHandle(&cred_handle); + DeleteSecurityContext(&context); + FreeCredentialsHandle(&cred_handle); free_buffers(&buffers[0]); free_buffers(&buffers[1]); @@ -987,12 +1029,10 @@ START_TEST(schannel) { - InitFunctionPtrs(); + pQueryContextAttributesA = (void*)GetProcAddress(GetModuleHandleA("secur32.dll"), "QueryContextAttributesA"); test_cread_attrs(); testAcquireSecurityContext(); + test_InitializeSecurityContext(); test_communication(); - - if(secdll) - FreeLibrary(secdll); -} +} Modified: trunk/rostests/winetests/secur32/secur32.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/secur32/secur32…
============================================================================== --- trunk/rostests/winetests/secur32/secur32.c [iso-8859-1] (original) +++ trunk/rostests/winetests/secur32/secur32.c [iso-8859-1] Sun Jun 4 01:51:16 2017 @@ -22,6 +22,7 @@ #include <windef.h> #include <winbase.h> #include <winnls.h> +#include <wincred.h> #define SECURITY_WIN32 #include <security.h> #include <schannel.h> @@ -38,6 +39,8 @@ (PSEC_WINNT_AUTH_IDENTITY_OPAQUE); static void (SEC_ENTRY *pSspiLocalFree) (void *); +static SECURITY_STATUS (SEC_ENTRY *pSspiPrepareForCredWrite) + (PSEC_WINNT_AUTH_IDENTITY_OPAQUE, PCWSTR, PULONG, PCWSTR *, PCWSTR *, PUCHAR *, PULONG); static void (SEC_ENTRY *pSspiZeroAuthIdentity) (PSEC_WINNT_AUTH_IDENTITY_OPAQUE); @@ -312,6 +315,60 @@ pSspiLocalFree( (void *)username_ptr ); pSspiLocalFree( (void *)password_ptr ); + pSspiFreeAuthIdentity( id ); +} + +static void test_SspiPrepareForCredWrite(void) +{ + static const WCHAR usernameW[] = + {'u','s','e','r','n','a','m','e',0}; + static const WCHAR domainnameW[] = + {'d','o','m','a','i','n','n','a','m','e',0}; + static const WCHAR passwordW[] = + {'p','a','s','s','w','o','r','d',0}; + static const WCHAR targetW[] = + {'d','o','m','a','i','n','n','a','m','e','\\','u','s','e','r','n','a','m','e',0}; + static const WCHAR target2W[] = + {'d','o','m','a','i','n','n','a','m','e','2','\\','u','s','e','r','n','a','m','e','2',0}; + const WCHAR *target, *username; + PSEC_WINNT_AUTH_IDENTITY_OPAQUE id; + SECURITY_STATUS status; + ULONG type, size; + UCHAR *blob; + + if (!pSspiPrepareForCredWrite) + { + win_skip( "SspiPrepareForCredWrite not exported by secur32.dll\n" ); + return; + } + + status = pSspiEncodeStringsAsAuthIdentity( usernameW, domainnameW, passwordW, &id ); + ok( status == SEC_E_OK, "got %08x\n", status ); + + type = size = 0; + status = pSspiPrepareForCredWrite( id, NULL, &type, &target, &username, &blob, &size ); + ok( status == SEC_E_OK, "got %08x\n", status ); + ok( type == CRED_TYPE_DOMAIN_PASSWORD, "got %u\n", type ); + ok( !lstrcmpW( target, targetW ), "got %s\n", wine_dbgstr_w(target) ); + ok( !lstrcmpW( username, targetW ), "got %s\n", wine_dbgstr_w(username) ); + ok( !memcmp( blob, passwordW, sizeof(passwordW) - sizeof(WCHAR) ), "wrong data\n" ); + ok( size == sizeof(passwordW) - sizeof(WCHAR), "got %u\n", size ); + pSspiLocalFree( (void *)target ); + pSspiLocalFree( (void *)username ); + pSspiLocalFree( blob ); + + type = size = 0; + status = pSspiPrepareForCredWrite( id, target2W, &type, &target, &username, &blob, &size ); + ok( status == SEC_E_OK, "got %08x\n", status ); + ok( type == CRED_TYPE_DOMAIN_PASSWORD, "got %u\n", type ); + ok( !lstrcmpW( target, target2W ), "got %s\n", wine_dbgstr_w(target) ); + ok( !lstrcmpW( username, targetW ), "got %s\n", wine_dbgstr_w(username) ); + ok( !memcmp( blob, passwordW, sizeof(passwordW) - sizeof(WCHAR) ), "wrong data\n" ); + ok( size == sizeof(passwordW) - sizeof(WCHAR), "got %u\n", size ); + pSspiLocalFree( (void *)target ); + pSspiLocalFree( (void *)username ); + pSspiLocalFree( blob ); + pSspiFreeAuthIdentity( id ); } @@ -377,6 +434,7 @@ pSspiEncodeStringsAsAuthIdentity = (void *)GetProcAddress(secdll, "SspiEncodeStringsAsAuthIdentity"); pSspiFreeAuthIdentity = (void *)GetProcAddress(secdll, "SspiFreeAuthIdentity"); pSspiLocalFree = (void *)GetProcAddress(secdll, "SspiLocalFree"); + pSspiPrepareForCredWrite = (void *)GetProcAddress(secdll, "SspiPrepareForCredWrite"); pSspiZeroAuthIdentity = (void *)GetProcAddress(secdll, "SspiZeroAuthIdentity"); pGetComputerObjectNameA = (PVOID)GetProcAddress(secdll, "GetComputerObjectNameA"); pGetComputerObjectNameW = (PVOID)GetProcAddress(secdll, "GetComputerObjectNameW"); @@ -384,7 +442,7 @@ pGetUserNameExW = (PVOID)GetProcAddress(secdll, "GetUserNameExW"); pInitSecurityInterfaceA = (PVOID)GetProcAddress(secdll, "InitSecurityInterfaceA"); pInitSecurityInterfaceW = (PVOID)GetProcAddress(secdll, "InitSecurityInterfaceW"); - + if (pGetComputerObjectNameA) testGetComputerObjectNameA(); else @@ -407,6 +465,7 @@ test_InitSecurityInterface(); test_SspiEncodeStringsAsAuthIdentity(); + test_SspiPrepareForCredWrite(); FreeLibrary(secdll); }
7 years, 10 months
1
0
0
0
[akhaldi] 74883: [PSDK] Update sspi.h. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 01:51:07 2017 New Revision: 74883 URL:
http://svn.reactos.org/svn/reactos?rev=74883&view=rev
Log: [PSDK] Update sspi.h. CORE-13362 Modified: trunk/reactos/sdk/include/psdk/sspi.h Modified: trunk/reactos/sdk/include/psdk/sspi.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/sspi.h?re…
============================================================================== --- trunk/reactos/sdk/include/psdk/sspi.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/sspi.h [iso-8859-1] Sun Jun 4 01:51:07 2017 @@ -217,6 +217,17 @@ (PCredHandle, ULONG, PVOID); #define QUERY_CREDENTIALS_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CREDENTIALS_ATTRIBUTES_FN_) +typedef struct _SEC_CHANNEL_BINDINGS { + ULONG dwInitiatorAddrType; + ULONG cbInitiatorLength; + ULONG dwInitiatorOffset; + ULONG dwAcceptorAddrType; + ULONG cbAcceptorLength; + ULONG dwAcceptorOffset; + ULONG cbApplicationDataLength; + ULONG dwApplicationDataOffset; +} SEC_CHANNEL_BINDINGS, *PSEC_CHANNEL_BINDINGS; + /* values for QueryCredentialsAttributes ulAttribute */ #define SECPKG_CRED_ATTR_NAMES 1 @@ -514,6 +525,20 @@ #define SECPKG_ATTR_ACCESS_TOKEN 18 #define SECPKG_ATTR_TARGET 19 #define SECPKG_ATTR_AUTHENTICATION_ID 20 +#define SECPKG_ATTR_LOGOFF_TIME 21 +#define SECPKG_ATTR_NEGO_KEYS 22 +#define SECPKG_ATTR_PROMPTING_NEEDED 24 +#define SECPKG_ATTR_UNIQUE_BINDINGS 25 +#define SECPKG_ATTR_ENDPOINT_BINDINGS 26 +#define SECPKG_ATTR_CLIENT_SPECIFIED_TARGET 27 +#define SECPKG_ATTR_LAST_CLIENT_TOKEN_STATUS 30 +#define SECPKG_ATTR_NEGO_PKG_INFO 31 +#define SECPKG_ATTR_NEGO_STATUS 32 +#define SECPKG_ATTR_CONTEXT_DELETED 33 + +#define SECPKG_ATTR_SUBJECT_SECURITY_ATTRIBUTES 128 +#define SECPKG_ATTR_NEGO_INFO_FLAG_NO_KERBEROS 0x1 +#define SECPKG_ATTR_NEGO_INFO_FLAG_NO_NTLM 0x2 /* types for QueryContextAttributes/SetContextAttributes */ @@ -717,6 +742,12 @@ ULONG TargetLength; char *Target; } SecPkgContext_Target, *PSecPkgContext_Target; + +typedef struct _SecPkgContext_Bindings +{ + ULONG BindingsLength; + SEC_CHANNEL_BINDINGS *Bindings; +} SecPkgContext_Bindings, *PSecPkgContext_Bindings; _Check_return_ SECURITY_STATUS
7 years, 10 months
1
0
0
0
[akhaldi] 74882: [MSVCRT_WINETEST] Sync with Wine Staging 2.9. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 01:50:58 2017 New Revision: 74882 URL:
http://svn.reactos.org/svn/reactos?rev=74882&view=rev
Log: [MSVCRT_WINETEST] Sync with Wine Staging 2.9. CORE-13362 Modified: trunk/rostests/winetests/msvcrt/cpp.c trunk/rostests/winetests/msvcrt/file.c trunk/rostests/winetests/msvcrt/misc.c trunk/rostests/winetests/msvcrt/printf.c trunk/rostests/winetests/msvcrt/scanf.c trunk/rostests/winetests/msvcrt/string.c Modified: trunk/rostests/winetests/msvcrt/cpp.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/cpp.c?re…
============================================================================== --- trunk/rostests/winetests/msvcrt/cpp.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/cpp.c [iso-8859-1] Sun Jun 4 01:50:58 2017 @@ -969,7 +969,11 @@ void *child_class_sig0 = &child_class_sig0_vtbl[1]; void *virtual_base_class_vtbl[2] = {&virtual_base_class_rtti.object_locator}; int virtual_base_class_vbtbl[2] = {0, 0x100}; - void *virtual_base_class[2] = {&virtual_base_class_vtbl[1], virtual_base_class_vbtbl}; + struct { + void *virtual_base[2]; + char data[0x110-sizeof(void*)]; + void *vbthis; + } virtual_base_class = { {&virtual_base_class_vtbl[1], virtual_base_class_vbtbl} }; static const char* e_name = "name"; type_info *ti,*bti; @@ -1082,7 +1086,7 @@ ok(casted == (char*)&child_class+4, "failed cast to child class (%p %p)\n", casted, &child_class); casted = p__RTDynamicCast(&virtual_base_class, 0, &virtual_base_class_rtti.type_info[0], &virtual_base_class_rtti.type_info[1], 0); - ok(casted == (char*)&virtual_base_class+0x110+sizeof(void*), "failed cast to child class (%p %p)\n", casted, &virtual_base_class); + ok(casted == &virtual_base_class.vbthis, "failed cast to child class (%p %p)\n", casted, &virtual_base_class); } struct _demangle { Modified: trunk/rostests/winetests/msvcrt/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/file.c?r…
============================================================================== --- trunk/rostests/winetests/msvcrt/file.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/file.c [iso-8859-1] Sun Jun 4 01:50:58 2017 @@ -49,6 +49,8 @@ static int (__cdecl *p_fopen_s)(FILE**, const char*, const char*); static int (__cdecl *p__wfopen_s)(FILE**, const wchar_t*, const wchar_t*); +static errno_t (__cdecl *p__get_fmode)(int*); +static errno_t (__cdecl *p__set_fmode)(int); static const char* get_base_name(const char *path) { @@ -71,6 +73,8 @@ p_fopen_s = (void*)GetProcAddress(hmod, "fopen_s"); p__wfopen_s = (void*)GetProcAddress(hmod, "_wfopen_s"); __pioinfo = (void*)GetProcAddress(hmod, "__pioinfo"); + p__get_fmode = (void*)GetProcAddress(hmod, "_get_fmode"); + p__set_fmode = (void*)GetProcAddress(hmod, "_set_fmode"); } static void test_filbuf( void ) @@ -2386,6 +2390,59 @@ DeleteFileA( "fdopen.tst" ); } +static void test__creat(void) +{ + int fd, pos, count, readonly, old_fmode = 0, have_fmode; + char buf[6], testdata[4] = {'a', '\n', 'b', '\n'}; + + have_fmode = p__get_fmode && p__set_fmode && !p__get_fmode(&old_fmode); + if (!have_fmode) + win_skip("_fmode can't be set, skipping mode tests\n"); + + if (have_fmode) + p__set_fmode(_O_TEXT); + fd = _creat("_creat.tst", 0); + ok(fd > 0, "_creat failed\n"); + _write(fd, testdata, 4); + if (have_fmode) { + pos = _tell(fd); + ok(pos == 6, "expected pos 6 (text mode), got %d\n", pos); + } + ok(_lseek(fd, SEEK_SET, 0) == 0, "_lseek failed\n"); + count = _read(fd, buf, 6); + ok(count == 4, "_read returned %d, expected 4\n", count); + count = count > 0 ? count > 4 ? 4 : count : 0; + ok(memcmp(buf, testdata, count) == 0, "_read returned wrong contents\n"); + _close(fd); + readonly = GetFileAttributesA("_creat.tst") & FILE_ATTRIBUTE_READONLY; + ok(readonly, "expected read-only file\n"); + SetFileAttributesA("_creat.tst", FILE_ATTRIBUTE_NORMAL); + DeleteFileA("_creat.tst"); + + if (have_fmode) + p__set_fmode(_O_BINARY); + fd = _creat("_creat.tst", _S_IREAD | _S_IWRITE); + ok(fd > 0, "_creat failed\n"); + _write(fd, testdata, 4); + if (have_fmode) { + pos = _tell(fd); + ok(pos == 4, "expected pos 4 (binary mode), got %d\n", pos); + } + ok(_lseek(fd, SEEK_SET, 0) == 0, "_lseek failed\n"); + count = _read(fd, buf, 6); + ok(count == 4, "_read returned %d, expected 4\n", count); + count = count > 0 ? count > 4 ? 4 : count : 0; + ok(memcmp(buf, testdata, count) == 0, "_read returned wrong contents\n"); + _close(fd); + readonly = GetFileAttributesA("_creat.tst") & FILE_ATTRIBUTE_READONLY; + ok(!readonly, "expected rw file\n"); + SetFileAttributesA("_creat.tst", FILE_ATTRIBUTE_NORMAL); + DeleteFileA("_creat.tst"); + + if (have_fmode) + p__set_fmode(old_fmode); +} + START_TEST(file) { int arg_c; @@ -2453,6 +2510,7 @@ test__open_osfhandle(); test_write_flush(); test_close(); + test__creat(); /* Wait for the (_P_NOWAIT) spawned processes to finish to make sure the report * file contains lines in the correct order Modified: trunk/rostests/winetests/msvcrt/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/misc.c?r…
============================================================================== --- trunk/rostests/winetests/msvcrt/misc.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/misc.c [iso-8859-1] Sun Jun 4 01:50:58 2017 @@ -58,6 +58,8 @@ static double (__cdecl *p_atan)(double); static double (__cdecl *p_exp)(double); static double (__cdecl *p_tanh)(double); +static void *(__cdecl *p_lfind_s)(const void*, const void*, unsigned int*, + size_t, int (__cdecl *)(void*, const void*, const void*), void*); static void init(void) { @@ -75,6 +77,7 @@ p_atan = (void *)GetProcAddress(hmod, "atan"); p_exp = (void *)GetProcAddress(hmod, "exp"); p_tanh = (void *)GetProcAddress(hmod, "tanh"); + p_lfind_s = (void *)GetProcAddress(hmod, "_lfind_s"); } static void test_rand_s(void) @@ -558,7 +561,7 @@ DWORD ret; /* _beginthread: handle is not closed on ExitThread and _endthreadex */ - hThread = (HANDLE)_beginthread(test_thread_func, 0, (void*)0); + hThread = (HANDLE)_beginthread(test_thread_func, 0, NULL); ok(hThread != INVALID_HANDLE_VALUE, "_beginthread failed (%d)\n", errno); WaitForSingleObject(hThread, INFINITE); ret = CloseHandle(hThread); @@ -594,6 +597,74 @@ ok(ret == WAIT_OBJECT_0, "ret = %d\n", ret); ret = CloseHandle(hThread); ok(ret, "ret = %d\n", ret); +} + +static int __cdecl _lfind_s_comp(void *ctx, const void *l, const void *r) +{ + *(int *)ctx = 0xdeadc0de; + return *(int *)l - *(int *)r; +} + +static void test__lfind_s(void) +{ + static const int tests[] = {9000, 8001, 7002, 6003, 1003, 5004, 4005, 3006, 2007}; + unsigned int num; + void *found; + int ctx; + int key; + + if (!p_lfind_s) + { + win_skip("_lfind_s is not available\n"); + return; + } + + key = 1234; + num = sizeof(tests)/sizeof(tests[0]); + + errno = 0xdeadbeef; + found = p_lfind_s(NULL, tests, &num, sizeof(int), _lfind_s_comp, NULL); + ok(errno == EINVAL, "errno = %d\n", errno); + ok(!found, "Expected NULL, got %p\n", found); + + errno = 0xdeadbeef; + found = p_lfind_s(&key, NULL, &num, sizeof(int), _lfind_s_comp, NULL); + ok(errno == EINVAL, "errno = %d\n", errno); + ok(!found, "Expected NULL, got %p\n", found); + + errno = 0xdeadbeef; + found = p_lfind_s(&key, tests, &num, 0, _lfind_s_comp, NULL); + ok(errno == EINVAL, "errno = %d\n", errno); + ok(!found, "Expected NULL, got %p\n", found); + + errno = 0xdeadbeef; + found = p_lfind_s(&key, tests, &num, sizeof(int), NULL, NULL); + ok(errno == EINVAL, "errno = %d\n", errno); + ok(!found, "Expected NULL, got %p\n", found); + + ctx = -1; + key = 9000; + errno = 0xdeadbeef; + found = p_lfind_s(&key, tests, &num, sizeof(int), _lfind_s_comp, &ctx); + ok(errno == 0xdeadbeef, "errno = %d\n", errno); + ok(found == tests, "Expected %p, got %p\n", tests, found); + ok(ctx == 0xdeadc0de, "Expected 0xdeadc0de, got %x\n", ctx); + + ctx = -1; + key = 2007; + errno = 0xdeadbeef; + found = p_lfind_s(&key, tests, &num, sizeof(int), _lfind_s_comp, &ctx); + ok(errno == 0xdeadbeef, "errno = %d\n", errno); + ok(found == tests+8, "Expected %p, got %p\n", tests+8, found); + ok(ctx == 0xdeadc0de, "Expected 0xdeadc0de, got %x\n", ctx); + + ctx = -1; + key = 1234; + errno = 0xdeadbeef; + found = p_lfind_s(&key, tests, &num, sizeof(int), _lfind_s_comp, &ctx); + ok(errno == 0xdeadbeef, "errno = %d\n", errno); + ok(!found, "Expected NULL, got %p\n", found); + ok(ctx == 0xdeadc0de, "Expected 0xdeadc0de, got %x\n", ctx); } START_TEST(misc) @@ -625,4 +696,5 @@ test_qsort_s(); test_math_functions(); test_thread_handle_close(); -} + test__lfind_s(); +} Modified: trunk/rostests/winetests/msvcrt/printf.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/printf.c…
============================================================================== --- trunk/rostests/winetests/msvcrt/printf.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/printf.c [iso-8859-1] Sun Jun 4 01:50:58 2017 @@ -27,6 +27,7 @@ #include <stdio.h> #include <errno.h> +#include <locale.h> #include "windef.h" #include "winbase.h" @@ -768,6 +769,39 @@ r = sprintf(buffer, format, INFINITY); ok(r==10, "r = %d\n", r); ok(!strcmp(buffer, "0000001.#J"), "failed: \"%s\"\n", buffer); + + format = "%c"; + r = sprintf(buffer, format, 'a'); + ok(r==1, "r = %d\n", r); + ok(!strcmp(buffer, "a"), "failed: \"%s\"\n", buffer); + r = sprintf(buffer, format, 0xa082); + ok(r==1, "r = %d\n", r); + ok(!strcmp(buffer, "\x82"), "failed: \"%s\"\n", buffer); + + format = "%C"; + r = sprintf(buffer, format, 'a'); + ok(r==1, "r = %d\n", r); + ok(!strcmp(buffer, "a"), "failed: \"%s\"\n", buffer); + r = sprintf(buffer, format, 0x3042); + ok(r==0, "r = %d\n", r); + ok(!strcmp(buffer, ""), "failed: \"%s\"\n", buffer); + + if(!setlocale(LC_ALL, "Japanese_Japan.932")) { + win_skip("Japanese_Japan.932 locale not available\n"); + return; + } + + format = "%c"; + r = sprintf(buffer, format, 0xa082); + ok(r==1, "r = %d\n", r); + ok(!strcmp(buffer, "\x82"), "failed: \"%s\"\n", buffer); + + format = "%C"; + r = sprintf(buffer, format, 0x3042); + ok(r==2, "r = %d\n", r); + ok(!strcmp(buffer, "\x82\xa0"), "failed: \"%s\"\n", buffer); + + setlocale(LC_ALL, "C"); } static void test_swprintf( void ) @@ -911,7 +945,7 @@ { char *str; int dec=100, sign=100; - + /* Numbers less than 1.0 with different precisions */ str = _fcvt(0.0001, 1, &dec, &sign ); ok( 0 == strcmp(str,""), "bad return '%s'\n", str); Modified: trunk/rostests/winetests/msvcrt/scanf.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/scanf.c?…
============================================================================== --- trunk/rostests/winetests/msvcrt/scanf.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/scanf.c [iso-8859-1] Sun Jun 4 01:50:58 2017 @@ -251,6 +251,10 @@ ok(ret == 2, "got %d\n", ret); ok(!strcmp(buffer, "test"), "buf %s\n", buffer); ok(!strcmp(buffer1, "value\xda"), "buf %s\n", buffer1); + + ret = sscanf("\x81\x82test", "\x81%\x82%s", buffer); + ok(ret == 1, "got %d\n", ret); + ok(!strcmp(buffer, "test"), "buf = %s\n", buffer); } static void test_sscanf_s(void) @@ -299,6 +303,8 @@ wchar_t buffer[100]; int result, ret; static const WCHAR formatd[] = {'%','d',0}; + const WCHAR format2[] = {'a',0x1234,'%',0x1234,'%','c',0}; + WCHAR c; /* check WEOF */ /* WEOF is an unsigned short -1 but swscanf returns int @@ -308,6 +314,14 @@ /* msvcrt returns 0 but should return -1 (later versions do) */ ok( ret == (short)WEOF || broken(ret == 0), "swscanf returns %x instead of %x\n", ret, WEOF ); + + buffer[0] = 'a'; + buffer[1] = 0x1234; + buffer[2] = 0x1234; + buffer[3] = 'b'; + ret = swscanf(buffer, format2, &c); + ok(ret == 1, "swscanf returned %d\n", ret); + ok(c == 'b', "c = %x\n", c); } START_TEST(scanf) Modified: trunk/rostests/winetests/msvcrt/string.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/string.c…
============================================================================== --- trunk/rostests/winetests/msvcrt/string.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/string.c [iso-8859-1] Sun Jun 4 01:50:58 2017 @@ -2827,11 +2827,21 @@ static void test__wcstoi64(void) { static const WCHAR digit[] = { '9', 0 }; + static const WCHAR space[] = { ' ', 0 }; static const WCHAR stock[] = { 0x3231, 0 }; /* PARENTHESIZED IDEOGRAPH STOCK */ + static const WCHAR cjk_1[] = { 0x4e00, 0 }; /* CJK Ideograph, First */ static const WCHAR tamil[] = { 0x0bef, 0 }; /* TAMIL DIGIT NINE */ static const WCHAR thai[] = { 0x0e59, 0 }; /* THAI DIGIT NINE */ static const WCHAR fullwidth[] = { 0xff19, 0 }; /* FULLWIDTH DIGIT NINE */ + static const WCHAR superscript1[] = { 0xb9, 0 }; /* SUPERSCRIPT ONE */ + static const WCHAR minus_0x91[] = { '-', 0x0e50, 'x', 0xff19, '1', 0 }; + static const WCHAR plus_071[] = { '+', 0x0e50, 0xff17, '1', 0 }; static const WCHAR hex[] = { 0xff19, 'f', 0x0e59, 0xff46, 0 }; + static const WCHAR zeros[] = { + 0x660, 0x6f0, 0x966, 0x9e6, 0xa66, 0xae6, 0xb66, 0xc66, 0xce6, + 0xd66, 0xe50, 0xed0, 0xf20, 0x1040, 0x17e0, 0x1810, 0xff10 + }; + int i; __int64 res; unsigned __int64 ures; @@ -2844,21 +2854,33 @@ res = p_wcstoi64(digit, NULL, 10); ok(res == 9, "res != 9\n"); + res = p_wcstoi64(space, &endpos, 0); + ok(endpos == space, "endpos != space\n"); res = p_wcstoi64(stock, &endpos, 10); ok(res == 0, "res != 0\n"); ok(endpos == stock, "Incorrect endpos (%p-%p)\n", stock, endpos); + res = p_wcstoi64(cjk_1, NULL, 0); + ok(res == 0, "res != 0\n"); res = p_wcstoi64(tamil, &endpos, 10); ok(res == 0, "res != 0\n"); ok(endpos == tamil, "Incorrect endpos (%p-%p)\n", tamil, endpos); res = p_wcstoi64(thai, NULL, 10); - todo_wine ok(res == 9, "res != 9\n"); + ok(res == 9, "res != 9\n"); res = p_wcstoi64(fullwidth, NULL, 10); - todo_wine ok(res == 9, "res != 9\n"); + ok(res == 9, "res != 9\n"); + res = p_wcstoi64(superscript1, NULL, 10); + ok(res == 0, "res != 0\n"); res = p_wcstoi64(hex, NULL, 16); - todo_wine ok(res == 0x9f9, "res != 0x9f9\n"); + ok(res == 0x9f9, "res != 0x9f9\n"); + res = p_wcstoi64(minus_0x91, NULL, 0); + ok(res == -0x91, "res != -0x91\n"); + res = p_wcstoi64(plus_071, NULL, 0); + ok(res == 071, "res != 071\n"); ures = p_wcstoui64(digit, NULL, 10); ok(ures == 9, "ures != 9\n"); + ures = p_wcstoui64(space, &endpos, 0); + ok(endpos == space, "endpos != space\n"); ures = p_wcstoui64(stock, &endpos, 10); ok(ures == 0, "ures != 0\n"); ok(endpos == stock, "Incorrect endpos (%p-%p)\n", stock, endpos); @@ -2866,11 +2888,25 @@ ok(ures == 0, "ures != 0\n"); ok(endpos == tamil, "Incorrect endpos (%p-%p)\n", tamil, endpos); ures = p_wcstoui64(thai, NULL, 10); - todo_wine ok(ures == 9, "ures != 9\n"); + ok(ures == 9, "ures != 9\n"); ures = p_wcstoui64(fullwidth, NULL, 10); - todo_wine ok(ures == 9, "ures != 9\n"); + ok(ures == 9, "ures != 9\n"); + ures = p_wcstoui64(superscript1, NULL, 10); + ok(ures == 0, "ures != 0\n"); ures = p_wcstoui64(hex, NULL, 16); - todo_wine ok(ures == 0x9f9, "ures != 0x9f9\n"); + ok(ures == 0x9f9, "ures != 0x9f9\n"); + ures = p_wcstoui64(plus_071, NULL, 0); + ok(ures == 071, "ures != 071\n"); + + /* Test various unicode digits */ + for (i = 0; i < sizeof(zeros) / sizeof(zeros[0]); ++i) { + WCHAR tmp[] = {zeros[i] + 4, zeros[i], zeros[i] + 5, 0}; + res = p_wcstoi64(tmp, NULL, 0); + ok(res == 405, "with zero = U+%04X: got %d, expected 405\n", zeros[i], (int)res); + tmp[1] = zeros[i] + 10; + res = p_wcstoi64(tmp, NULL, 16); + ok(res == 4, "with zero = U+%04X: got %d, expected 4\n", zeros[i], (int)res); + } return; }
7 years, 10 months
1
0
0
0
← Newer
1
...
34
35
36
37
38
39
40
...
53
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
Results per page:
10
25
50
100
200