From f9e6b0df11d19d396df4832bf3486777822c2977 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Thu, 19 Mar 2015 12:24:05 +0000 Subject: [PATCH] [COMDLG32] Sync with Wine Staging 1.7.37. CORE-9246 svn path=/trunk/; revision=66803 --- reactos/dll/win32/comdlg32/filedlg.c | 85 ++++++++------------- reactos/dll/win32/comdlg32/filedlgbrowser.c | 2 +- reactos/dll/win32/comdlg32/printdlg.c | 20 ++--- reactos/media/doc/README.WINE | 2 +- 4 files changed, 46 insertions(+), 63 deletions(-) diff --git a/reactos/dll/win32/comdlg32/filedlg.c b/reactos/dll/win32/comdlg32/filedlg.c index 7c0ae147d93..543832aed61 100644 --- a/reactos/dll/win32/comdlg32/filedlg.c +++ b/reactos/dll/win32/comdlg32/filedlg.c @@ -1556,41 +1556,37 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) /* 2. (All platforms) If initdir is not null, then use it */ if (!handledPath && fodInfos->initdir && *fodInfos->initdir) { - /* Work out the proper path as supplied one might be relative */ - /* (Here because supplying '.' as dir browses to My Computer) */ - if (!handledPath) { - WCHAR tmpBuf[MAX_PATH]; - WCHAR tmpBuf2[MAX_PATH]; - WCHAR *nameBit; - DWORD result; + /* Work out the proper path as supplied one might be relative */ + /* (Here because supplying '.' as dir browses to My Computer) */ + WCHAR tmpBuf[MAX_PATH]; + WCHAR tmpBuf2[MAX_PATH]; + WCHAR *nameBit; + DWORD result; - lstrcpyW(tmpBuf, fodInfos->initdir); - if( PathFileExistsW(tmpBuf) ) { - /* initdir does not have to be a directory. If a file is - * specified, the dir part is taken */ - if( PathIsDirectoryW(tmpBuf)) { - if (tmpBuf[lstrlenW(tmpBuf)-1] != '\\') { - lstrcatW(tmpBuf, szwSlash); - } - lstrcatW(tmpBuf, szwStar); - } - result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit); - if (result) { - *nameBit = 0x00; - MemFree(fodInfos->initdir); - fodInfos->initdir = MemAlloc((lstrlenW(tmpBuf2) + 1)*sizeof(WCHAR)); - lstrcpyW(fodInfos->initdir, tmpBuf2); - handledPath = TRUE; - TRACE("Value in InitDir changed to %s\n", debugstr_w(fodInfos->initdir)); - } - } - else if (fodInfos->initdir) - { - MemFree(fodInfos->initdir); - fodInfos->initdir = NULL; - TRACE("Value in InitDir is not an existing path, changed to (nil)\n"); - } - } + lstrcpyW(tmpBuf, fodInfos->initdir); + if (PathFileExistsW(tmpBuf)) { + /* initdir does not have to be a directory. If a file is + * specified, the dir part is taken */ + if (PathIsDirectoryW(tmpBuf)) { + PathAddBackslashW(tmpBuf); + lstrcatW(tmpBuf, szwStar); + } + result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit); + if (result) { + *nameBit = 0x00; + MemFree(fodInfos->initdir); + fodInfos->initdir = MemAlloc((lstrlenW(tmpBuf2) + 1) * sizeof(WCHAR)); + lstrcpyW(fodInfos->initdir, tmpBuf2); + handledPath = TRUE; + TRACE("Value in InitDir changed to %s\n", debugstr_w(fodInfos->initdir)); + } + } + else if (fodInfos->initdir) + { + MemFree(fodInfos->initdir); + fodInfos->initdir = NULL; + TRACE("Value in InitDir is not an existing path, changed to (nil)\n"); + } } if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir)) @@ -3240,7 +3236,6 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct) int iIndentation; TEXTMETRICW tm; LPSFOLDER tmpFolder; - LookInInfos *liInfos = GetPropA(pDIStruct->hwndItem,LookInInfosStr); UINT shgfi_flags = SHGFI_PIDL | SHGFI_OPENICON | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME; UINT icon_width, icon_height; @@ -3263,16 +3258,8 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct) shgfi_flags |= SHGFI_SMALLICON; } - if(pDIStruct->itemID == liInfos->uSelectedItem) - { - ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem, - 0, &sfi, sizeof (sfi), shgfi_flags ); - } - else - { - ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem, - 0, &sfi, sizeof (sfi), shgfi_flags ); - } + ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem, + 0, &sfi, sizeof (sfi), shgfi_flags ); /* Is this item selected ? */ if(pDIStruct->itemState & ODS_SELECTED) @@ -3290,16 +3277,10 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct) /* Do not indent item if drawing in the edit of the combo */ if(pDIStruct->itemState & ODS_COMBOBOXEDIT) - { iIndentation = 0; - ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem, - 0, &sfi, sizeof (sfi), shgfi_flags ); - - } else - { iIndentation = tmpFolder->m_iIndent; - } + /* Draw text and icon */ /* Initialise the icon display area */ diff --git a/reactos/dll/win32/comdlg32/filedlgbrowser.c b/reactos/dll/win32/comdlg32/filedlgbrowser.c index 61416e4054e..71cb5105c5e 100644 --- a/reactos/dll/win32/comdlg32/filedlgbrowser.c +++ b/reactos/dll/win32/comdlg32/filedlgbrowser.c @@ -919,7 +919,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBr return S_OK; /* Check if there is a mask to apply if not */ - if(!fodInfos->ShellInfos.lpstrCurrentFilter || !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter)) + if(!fodInfos->ShellInfos.lpstrCurrentFilter || !fodInfos->ShellInfos.lpstrCurrentFilter[0]) return S_OK; if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &str))) diff --git a/reactos/dll/win32/comdlg32/printdlg.c b/reactos/dll/win32/comdlg32/printdlg.c index a114d6d13c4..b3ed2b59862 100644 --- a/reactos/dll/win32/comdlg32/printdlg.c +++ b/reactos/dll/win32/comdlg32/printdlg.c @@ -816,8 +816,7 @@ static BOOL PRINTDLG_SetUpPaperComboBoxA(HWND hDlg, Names = HeapAlloc(GetProcessHeap(),0, NrOfEntries*sizeof(char)*NamesSize); Words = HeapAlloc(GetProcessHeap(),0, NrOfEntries*sizeof(WORD)); - NrOfEntries = DeviceCapabilitiesA(PrinterName, PortName, - fwCapability_Names, Names, dm); + DeviceCapabilitiesA(PrinterName, PortName, fwCapability_Names, Names, dm); NrOfEntries = DeviceCapabilitiesA(PrinterName, PortName, fwCapability_Words, (LPSTR)Words, dm); @@ -927,8 +926,7 @@ static BOOL PRINTDLG_SetUpPaperComboBoxW(HWND hDlg, Names = HeapAlloc(GetProcessHeap(),0, NrOfEntries*sizeof(WCHAR)*NamesSize); Words = HeapAlloc(GetProcessHeap(),0, NrOfEntries*sizeof(WORD)); - NrOfEntries = DeviceCapabilitiesW(PrinterName, PortName, - fwCapability_Names, Names, dm); + DeviceCapabilitiesW(PrinterName, PortName, fwCapability_Names, Names, dm); NrOfEntries = DeviceCapabilitiesW(PrinterName, PortName, fwCapability_Words, Words, dm); @@ -1776,10 +1774,12 @@ static LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam, case cmb2: /* Papersize */ { DWORD Sel = SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0); - if(Sel != CB_ERR) + if(Sel != CB_ERR) { lpdm->u1.s1.dmPaperSize = SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, Sel, 0); + GetDlgItemTextA(hDlg, cmb2, (char *)lpdm->dmFormName, CCHFORMNAME); + } } break; @@ -1932,10 +1932,12 @@ static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam, case cmb2: /* Papersize */ { DWORD Sel = SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0); - if(Sel != CB_ERR) + if(Sel != CB_ERR) { lpdm->u1.s1.dmPaperSize = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, Sel, 0); + GetDlgItemTextW(hDlg, cmb2, lpdm->dmFormName, CCHFORMNAME); + } } break; @@ -3791,16 +3793,16 @@ static void *pagesetup_get_template(pagesetup_data *data) { if(data->unicode) res = FindResourceW(data->u.dlgw->hInstance, - data->u.dlgw->lpPageSetupTemplateName, MAKEINTRESOURCEW(RT_DIALOG)); + data->u.dlgw->lpPageSetupTemplateName, (LPWSTR)RT_DIALOG); else res = FindResourceA(data->u.dlga->hInstance, - data->u.dlga->lpPageSetupTemplateName, MAKEINTRESOURCEA(RT_DIALOG)); + data->u.dlga->lpPageSetupTemplateName, (LPSTR)RT_DIALOG); tmpl_handle = LoadResource(data->u.dlgw->hInstance, res); } else { res = FindResourceW(COMDLG32_hInstance, MAKEINTRESOURCEW(PAGESETUPDLGORD), - MAKEINTRESOURCEW(RT_DIALOG)); + (LPWSTR)RT_DIALOG); tmpl_handle = LoadResource(COMDLG32_hInstance, res); } return LockResource(tmpl_handle); diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 93181728061..5c23e571c77 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -62,7 +62,7 @@ reactos/dll/win32/cabinet # Synced to WineStaging-1.7.37 reactos/dll/win32/clusapi # Synced to Wine-1.7.27 reactos/dll/win32/comcat # Synced to Wine-1.7.27 reactos/dll/win32/comctl32 # Synced to WineStaging-1.7.37 -reactos/dll/win32/comdlg32 # Synced to Wine-1.7.27 +reactos/dll/win32/comdlg32 # Synced to WineStaging-1.7.37 reactos/dll/win32/compstui # Synced to Wine-1.7.27 reactos/dll/win32/credui # Synced to Wine-1.7.27 reactos/dll/win32/crypt32 # Synced to Wine-1.7.27