shlfileop.cpp (257e7307) | shlfileop.cpp (16f64a95) |
---|---|
1/* 2 * SHFileOperation 3 * 4 * Copyright 2000 Juergen Schmied 5 * Copyright 2002 Andriy Palamarchuk 6 * Copyright 2004 Dietrich Teickner (from Odin) 7 * Copyright 2004 Rolf Kalbermatter 8 * Copyright 2019 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> --- 1798 unchanged lines hidden (view full) --- 1807#endif 1808 1809 if (fFlags & wUnsupportedFlags) 1810 FIXME("Unsupported flags: %04x\n", fFlags); 1811} 1812 1813#ifdef __REACTOS__ 1814 | 1/* 2 * SHFileOperation 3 * 4 * Copyright 2000 Juergen Schmied 5 * Copyright 2002 Andriy Palamarchuk 6 * Copyright 2004 Dietrich Teickner (from Odin) 7 * Copyright 2004 Rolf Kalbermatter 8 * Copyright 2019 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> --- 1798 unchanged lines hidden (view full) --- 1807#endif 1808 1809 if (fFlags & wUnsupportedFlags) 1810 FIXME("Unsupported flags: %04x\n", fFlags); 1811} 1812 1813#ifdef __REACTOS__ 1814 |
1815/* Error codes could be pre-Win32 */ 1816#define DE_SAMEFILE 0x71 1817#define DE_MANYSRC1DEST 0x72 1818#define DE_DIFFDIR 0x73 1819#define DE_OPCANCELLED 0x75 1820#define DE_DESTSUBTREE 0x76 1821#define DE_INVALIDFILES 0x7C 1822#define DE_DESTSAMETREE 0x7D 1823#define DE_FLDDESTISFILE 0x7E 1824#define DE_FILEDESTISFLD 0x80 1825 | |
1826static DWORD 1827validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flTo) 1828{ 1829 DWORD i, k, dwNumDest; | 1815static DWORD 1816validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flTo) 1817{ 1818 DWORD i, k, dwNumDest; |
1830 WCHAR szFrom[MAX_PATH], szTo[MAX_PATH], szText[MAX_PATH]; | 1819 WCHAR szFrom[MAX_PATH], szTo[MAX_PATH]; 1820 CStringW strTitle, strText; |
1831 const FILE_ENTRY *feFrom; 1832 const FILE_ENTRY *feTo; 1833 UINT wFunc = lpFileOp->wFunc; 1834 HWND hwnd = lpFileOp->hwnd; 1835 1836 dwNumDest = flTo->dwNumFiles; 1837 1838 if (wFunc != FO_COPY && wFunc != FO_MOVE) 1839 return ERROR_SUCCESS; 1840 1841 for (k = 0; k < dwNumDest; ++k) 1842 { 1843 feTo = &flTo->feFiles[k]; 1844 for (i = 0; i < flFrom->dwNumFiles; ++i) 1845 { 1846 feFrom = &flFrom->feFiles[i]; 1847 StringCbCopyW(szFrom, sizeof(szFrom), feFrom->szFullPath); | 1821 const FILE_ENTRY *feFrom; 1822 const FILE_ENTRY *feTo; 1823 UINT wFunc = lpFileOp->wFunc; 1824 HWND hwnd = lpFileOp->hwnd; 1825 1826 dwNumDest = flTo->dwNumFiles; 1827 1828 if (wFunc != FO_COPY && wFunc != FO_MOVE) 1829 return ERROR_SUCCESS; 1830 1831 for (k = 0; k < dwNumDest; ++k) 1832 { 1833 feTo = &flTo->feFiles[k]; 1834 for (i = 0; i < flFrom->dwNumFiles; ++i) 1835 { 1836 feFrom = &flFrom->feFiles[i]; 1837 StringCbCopyW(szFrom, sizeof(szFrom), feFrom->szFullPath); |
1848 | |
1849 StringCbCopyW(szTo, sizeof(szTo), feTo->szFullPath); 1850 if (IsAttribDir(feTo->attributes)) 1851 { 1852 PathAppendW(szTo, feFrom->szFilename); 1853 } 1854 1855 // same path? 1856 if (lstrcmpiW(szFrom, szTo) == 0 && 1857 (wFunc == FO_MOVE || !(lpFileOp->fFlags & FOF_RENAMEONCOLLISION))) 1858 { 1859 if (!(lpFileOp->fFlags & (FOF_NOERRORUI | FOF_SILENT))) 1860 { 1861 if (wFunc == FO_MOVE) 1862 { | 1838 StringCbCopyW(szTo, sizeof(szTo), feTo->szFullPath); 1839 if (IsAttribDir(feTo->attributes)) 1840 { 1841 PathAppendW(szTo, feFrom->szFilename); 1842 } 1843 1844 // same path? 1845 if (lstrcmpiW(szFrom, szTo) == 0 && 1846 (wFunc == FO_MOVE || !(lpFileOp->fFlags & FOF_RENAMEONCOLLISION))) 1847 { 1848 if (!(lpFileOp->fFlags & (FOF_NOERRORUI | FOF_SILENT))) 1849 { 1850 if (wFunc == FO_MOVE) 1851 { |
1863 CStringW strTitle(MAKEINTRESOURCEW(IDS_MOVEERRORTITLE)); 1864 CStringW strText(MAKEINTRESOURCEW(IDS_MOVEERRORSAME)); 1865 StringCchPrintfW(szText, sizeof(szText), strText, feFrom->szFilename); 1866 MessageBoxW(hwnd, szText, strTitle, MB_ICONERROR); | 1852 strTitle.LoadStringW(IDS_MOVEERRORTITLE); 1853 if (IsAttribDir(feFrom->attributes)) 1854 strText.Format(IDS_MOVEERRORSAMEFOLDER, feFrom->szFilename); 1855 else 1856 strText.Format(IDS_MOVEERRORSAME, feFrom->szFilename); |
1867 } 1868 else 1869 { | 1857 } 1858 else 1859 { |
1870 CStringW strTitle(MAKEINTRESOURCEW(IDS_COPYERRORTITLE)); 1871 CStringW strText(MAKEINTRESOURCEW(IDS_COPYERRORSAME)); 1872 StringCchPrintfW(szText, sizeof(szText), strText, feFrom->szFilename); 1873 MessageBoxW(hwnd, szText, strTitle, MB_ICONERROR); | 1860 strTitle.LoadStringW(IDS_COPYERRORTITLE); 1861 strText.Format(IDS_COPYERRORSAME, feFrom->szFilename); 1862 return ERROR_SUCCESS; |
1874 } | 1863 } |
1864 MessageBoxW(hwnd, strText, strTitle, MB_ICONERROR); 1865 return DE_SAMEFILE; |
|
1875 } 1876 return DE_OPCANCELLED; 1877 } 1878 1879 // subfolder? 1880 if (IsAttribDir(feFrom->attributes)) 1881 { 1882 size_t cchFrom = PathAddBackslashW(szFrom) - szFrom; --- 6 unchanged lines hidden (view full) --- 1889 szTo[cchFrom] = ch; 1890 1891 if (compare == 0) 1892 { 1893 if (!(lpFileOp->fFlags & (FOF_NOERRORUI | FOF_SILENT))) 1894 { 1895 if (wFunc == FO_MOVE) 1896 { | 1866 } 1867 return DE_OPCANCELLED; 1868 } 1869 1870 // subfolder? 1871 if (IsAttribDir(feFrom->attributes)) 1872 { 1873 size_t cchFrom = PathAddBackslashW(szFrom) - szFrom; --- 6 unchanged lines hidden (view full) --- 1880 szTo[cchFrom] = ch; 1881 1882 if (compare == 0) 1883 { 1884 if (!(lpFileOp->fFlags & (FOF_NOERRORUI | FOF_SILENT))) 1885 { 1886 if (wFunc == FO_MOVE) 1887 { |
1897 CStringW strTitle(MAKEINTRESOURCEW(IDS_MOVEERRORTITLE)); 1898 CStringW strText(MAKEINTRESOURCEW(IDS_MOVEERRORSUBF)); 1899 StringCchPrintfW(szText, sizeof(szText), strText, feFrom->szFilename); 1900 MessageBoxW(hwnd, szText, strTitle, MB_ICONERROR); | 1888 strTitle.LoadStringW(IDS_MOVEERRORTITLE); 1889 strText.Format(IDS_MOVEERRORSUBFOLDER, feFrom->szFilename); |
1901 } 1902 else 1903 { | 1890 } 1891 else 1892 { |
1904 CStringW strTitle(MAKEINTRESOURCEW(IDS_COPYERRORTITLE)); 1905 CStringW strText(MAKEINTRESOURCEW(IDS_COPYERRORSUBF)); 1906 StringCchPrintfW(szText, sizeof(szText), strText, feFrom->szFilename); 1907 MessageBoxW(hwnd, szText, strTitle, MB_ICONERROR); | 1893 strTitle.LoadStringW(IDS_COPYERRORTITLE); 1894 strText.Format(IDS_COPYERRORSUBFOLDER, feFrom->szFilename); |
1908 } | 1895 } |
1896 MessageBoxW(hwnd, strText, strTitle, MB_ICONERROR); 1897 return DE_DESTSUBTREE; |
|
1909 } | 1898 } |
1910 return ERROR_SUCCESS; | 1899 return DE_OPCANCELLED; |
1911 } 1912 } 1913 } 1914 } 1915 } 1916 1917 return ERROR_SUCCESS; 1918} --- 405 unchanged lines hidden --- | 1900 } 1901 } 1902 } 1903 } 1904 } 1905 1906 return ERROR_SUCCESS; 1907} --- 405 unchanged lines hidden --- |