mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
[shell32.dll]
[FORMATTING] - Don't use tabs, use spaces. svn path=/branches/shell32_new-bringup/; revision=53538
This commit is contained in:
parent
b815342563
commit
71fb1022d3
|
@ -102,7 +102,7 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
|
||||||
argc++;
|
argc++;
|
||||||
/* skip the remaining spaces */
|
/* skip the remaining spaces */
|
||||||
while (*cs==0x0009 || *cs==0x0020)
|
while (*cs==0x0009 || *cs==0x0020)
|
||||||
{
|
{
|
||||||
cs++;
|
cs++;
|
||||||
}
|
}
|
||||||
if (*cs==0)
|
if (*cs==0)
|
||||||
|
@ -133,10 +133,10 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
|
||||||
*/
|
*/
|
||||||
argv = (LPWSTR *)LocalAlloc(LMEM_FIXED, argc*sizeof(LPWSTR)+(wcslen(lpCmdline)+1)*sizeof(WCHAR));
|
argv = (LPWSTR *)LocalAlloc(LMEM_FIXED, argc*sizeof(LPWSTR)+(wcslen(lpCmdline)+1)*sizeof(WCHAR));
|
||||||
|
|
||||||
if (!argv)
|
if (!argv)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cmdline=(LPWSTR)(argv+argc);
|
cmdline=(LPWSTR)(argv+argc);
|
||||||
wcscpy(cmdline, lpCmdline);
|
wcscpy(cmdline, lpCmdline);
|
||||||
|
|
||||||
argc=0;
|
argc=0;
|
||||||
|
@ -242,17 +242,17 @@ static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
|
||||||
SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
|
SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
|
||||||
ReadFile( hfile, magic, sizeof(magic), &len, NULL );
|
ReadFile( hfile, magic, sizeof(magic), &len, NULL );
|
||||||
|
|
||||||
if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
|
if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
|
||||||
{
|
{
|
||||||
SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
|
SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
|
||||||
ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
|
ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
|
||||||
CloseHandle( hfile );
|
CloseHandle( hfile );
|
||||||
|
|
||||||
/* DLL files are not executable and should return 0 */
|
/* DLL files are not executable and should return 0 */
|
||||||
if (nt.FileHeader.Characteristics & IMAGE_FILE_DLL)
|
if (nt.FileHeader.Characteristics & IMAGE_FILE_DLL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI)
|
if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI)
|
||||||
{
|
{
|
||||||
return IMAGE_NT_SIGNATURE |
|
return IMAGE_NT_SIGNATURE |
|
||||||
(nt.OptionalHeader.MajorSubsystemVersion << 24) |
|
(nt.OptionalHeader.MajorSubsystemVersion << 24) |
|
||||||
|
@ -267,7 +267,7 @@ static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
|
||||||
ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
|
ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
|
||||||
CloseHandle( hfile );
|
CloseHandle( hfile );
|
||||||
|
|
||||||
if (ne.ne_exetyp == 2)
|
if (ne.ne_exetyp == 2)
|
||||||
return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16);
|
return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* SHELL_IsShortcut [internal]
|
* SHELL_IsShortcut [internal]
|
||||||
*
|
*
|
||||||
* Decide if an item id list points to a shell shortcut
|
* Decide if an item id list points to a shell shortcut
|
||||||
*/
|
*/
|
||||||
|
@ -319,8 +319,8 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
||||||
int iIndex;
|
int iIndex;
|
||||||
DWORD_PTR ret = TRUE;
|
DWORD_PTR ret = TRUE;
|
||||||
DWORD dwAttributes = 0;
|
DWORD dwAttributes = 0;
|
||||||
CComPtr<IShellFolder> psfParent;
|
CComPtr<IShellFolder> psfParent;
|
||||||
CComPtr<IExtractIconW> pei;
|
CComPtr<IExtractIconW> pei;
|
||||||
LPITEMIDLIST pidlLast = NULL, pidl = NULL;
|
LPITEMIDLIST pidlLast = NULL, pidl = NULL;
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
BOOL IconNotYetLoaded=TRUE;
|
BOOL IconNotYetLoaded=TRUE;
|
||||||
|
@ -333,7 +333,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
||||||
if ( (flags & SHGFI_USEFILEATTRIBUTES) &&
|
if ( (flags & SHGFI_USEFILEATTRIBUTES) &&
|
||||||
(flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
|
(flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!path)
|
if (!path)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* windows initializes these values regardless of the flags */
|
/* windows initializes these values regardless of the flags */
|
||||||
|
@ -412,8 +412,8 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
||||||
{
|
{
|
||||||
psfi->dwAttributes = 0xffffffff;
|
psfi->dwAttributes = 0xffffffff;
|
||||||
}
|
}
|
||||||
if (psfParent != NULL)
|
if (psfParent != NULL)
|
||||||
psfParent->GetAttributesOf(1, (LPCITEMIDLIST*)&pidlLast,
|
psfParent->GetAttributesOf(1, (LPCITEMIDLIST*)&pidlLast,
|
||||||
&(psfi->dwAttributes) );
|
&(psfi->dwAttributes) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,7 +590,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
||||||
GetSystemMetrics( SM_CYICON),
|
GetSystemMetrics( SM_CYICON),
|
||||||
&psfi->hIcon, 0, 1, 0);
|
&psfi->hIcon, 0, 1, 0);
|
||||||
|
|
||||||
if (ret != 0 && ret != 0xFFFFFFFF)
|
if (ret != 0 && ret != 0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
IconNotYetLoaded=FALSE;
|
IconNotYetLoaded=FALSE;
|
||||||
psfi->iIcon = icon_idx;
|
psfi->iIcon = icon_idx;
|
||||||
|
@ -857,49 +857,49 @@ UINT_PTR WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
|
||||||
|
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case ABM_GETSTATE:
|
case ABM_GETSTATE:
|
||||||
return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
|
return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
|
||||||
|
|
||||||
case ABM_GETTASKBARPOS:
|
case ABM_GETTASKBARPOS:
|
||||||
GetWindowRect(data->hWnd, &rec);
|
GetWindowRect(data->hWnd, &rec);
|
||||||
data->rc=rec;
|
data->rc=rec;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ABM_ACTIVATE:
|
case ABM_ACTIVATE:
|
||||||
SetActiveWindow(data->hWnd);
|
SetActiveWindow(data->hWnd);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ABM_GETAUTOHIDEBAR:
|
case ABM_GETAUTOHIDEBAR:
|
||||||
return 0; /* pretend there is no autohide bar */
|
return 0; /* pretend there is no autohide bar */
|
||||||
|
|
||||||
case ABM_NEW:
|
case ABM_NEW:
|
||||||
/* cbSize, hWnd, and uCallbackMessage are used. All other ignored */
|
/* cbSize, hWnd, and uCallbackMessage are used. All other ignored */
|
||||||
SetWindowPos(data->hWnd,HWND_TOP,0,0,0,0,SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE);
|
SetWindowPos(data->hWnd,HWND_TOP,0,0,0,0,SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ABM_QUERYPOS:
|
case ABM_QUERYPOS:
|
||||||
GetWindowRect(data->hWnd, &(data->rc));
|
GetWindowRect(data->hWnd, &(data->rc));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ABM_REMOVE:
|
case ABM_REMOVE:
|
||||||
FIXME("ABM_REMOVE broken\n");
|
FIXME("ABM_REMOVE broken\n");
|
||||||
/* FIXME: this is wrong; should it be DestroyWindow instead? */
|
/* FIXME: this is wrong; should it be DestroyWindow instead? */
|
||||||
/*CloseHandle(data->hWnd);*/
|
/*CloseHandle(data->hWnd);*/
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ABM_SETAUTOHIDEBAR:
|
case ABM_SETAUTOHIDEBAR:
|
||||||
SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
|
SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
|
||||||
width,height,SWP_SHOWWINDOW);
|
width,height,SWP_SHOWWINDOW);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ABM_SETPOS:
|
case ABM_SETPOS:
|
||||||
data->uEdge=(ABE_RIGHT | ABE_LEFT);
|
data->uEdge=(ABE_RIGHT | ABE_LEFT);
|
||||||
SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
|
SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
|
||||||
width,height,SWP_SHOWWINDOW);
|
width,height,SWP_SHOWWINDOW);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ABM_WINDOWPOSCHANGED:
|
case ABM_WINDOWPOSCHANGED:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -932,7 +932,7 @@ EXTERN_C DWORD WINAPI SHHelpShortcuts_RunDLLW(DWORD dwArg1, DWORD dwArg2, DWORD
|
||||||
*/
|
*/
|
||||||
EXTERN_C HRESULT WINAPI SHLoadInProc (REFCLSID rclsid)
|
EXTERN_C HRESULT WINAPI SHLoadInProc (REFCLSID rclsid)
|
||||||
{
|
{
|
||||||
CComPtr<IUnknown> ptr;
|
CComPtr<IUnknown> ptr;
|
||||||
|
|
||||||
TRACE("%s\n", debugstr_guid(&rclsid));
|
TRACE("%s\n", debugstr_guid(&rclsid));
|
||||||
|
|
||||||
|
@ -1095,8 +1095,8 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
|
||||||
|
|
||||||
// We need the decimal point of the current locale to display the RAM size correctly
|
// We need the decimal point of the current locale to display the RAM size correctly
|
||||||
if (GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL,
|
if (GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL,
|
||||||
szDecimalSeparator,
|
szDecimalSeparator,
|
||||||
sizeof(szDecimalSeparator) / sizeof(WCHAR)) > 0)
|
sizeof(szDecimalSeparator) / sizeof(WCHAR)) > 0)
|
||||||
{
|
{
|
||||||
UCHAR uDecimals;
|
UCHAR uDecimals;
|
||||||
UINT uIntegral;
|
UINT uIntegral;
|
||||||
|
@ -1150,7 +1150,7 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
|
||||||
}; break;
|
}; break;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch(wParam)
|
switch(wParam)
|
||||||
{
|
{
|
||||||
case IDOK:
|
case IDOK:
|
||||||
|
@ -1179,7 +1179,7 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}; break;
|
}; break;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
EndDialog(hWnd, TRUE);
|
EndDialog(hWnd, TRUE);
|
||||||
|
@ -1292,32 +1292,32 @@ OBJECT_ENTRY(CLSID_StartMenu, CStartMenuCallback)
|
||||||
OBJECT_ENTRY(CLSID_MenuBandSite, CMenuBandSite)
|
OBJECT_ENTRY(CLSID_MenuBandSite, CMenuBandSite)
|
||||||
END_OBJECT_MAP()
|
END_OBJECT_MAP()
|
||||||
|
|
||||||
CShell32Module gModule;
|
CShell32Module gModule;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static const struct {
|
static const struct {
|
||||||
REFIID riid;
|
REFIID riid;
|
||||||
LPFNCREATEINSTANCE lpfnCI;
|
LPFNCREATEINSTANCE lpfnCI;
|
||||||
} InterfaceTable[] = {
|
} InterfaceTable[] = {
|
||||||
{CLSID_ShellFSFolder, &IFSFolder_Constructor},
|
{CLSID_ShellFSFolder, &IFSFolder_Constructor},
|
||||||
{CLSID_MyComputer, &ISF_MyComputer_Constructor},
|
{CLSID_MyComputer, &ISF_MyComputer_Constructor},
|
||||||
{CLSID_ShellDesktop, &ISF_Desktop_Constructor},
|
{CLSID_ShellDesktop, &ISF_Desktop_Constructor},
|
||||||
{CLSID_ShellItem, &IShellItem_Constructor},
|
{CLSID_ShellItem, &IShellItem_Constructor},
|
||||||
{CLSID_ShellLink, &IShellLink_Constructor},
|
{CLSID_ShellLink, &IShellLink_Constructor},
|
||||||
{CLSID_DragDropHelper, &IDropTargetHelper_Constructor},
|
{CLSID_DragDropHelper, &IDropTargetHelper_Constructor},
|
||||||
{CLSID_ControlPanel, &IControlPanel_Constructor},
|
{CLSID_ControlPanel, &IControlPanel_Constructor},
|
||||||
{CLSID_AutoComplete, &IAutoComplete_Constructor},
|
{CLSID_AutoComplete, &IAutoComplete_Constructor},
|
||||||
{CLSID_MyDocuments, &ISF_MyDocuments_Constructor},
|
{CLSID_MyDocuments, &ISF_MyDocuments_Constructor},
|
||||||
{CLSID_NetworkPlaces, &ISF_NetworkPlaces_Constructor},
|
{CLSID_NetworkPlaces, &ISF_NetworkPlaces_Constructor},
|
||||||
{CLSID_FontsFolderShortcut, &ISF_Fonts_Constructor},
|
{CLSID_FontsFolderShortcut, &ISF_Fonts_Constructor},
|
||||||
{CLSID_Printers, &ISF_Printers_Constructor},
|
{CLSID_Printers, &ISF_Printers_Constructor},
|
||||||
{CLSID_AdminFolderShortcut, &ISF_AdminTools_Constructor},
|
{CLSID_AdminFolderShortcut, &ISF_AdminTools_Constructor},
|
||||||
{CLSID_RecycleBin, &RecycleBin_Constructor},
|
{CLSID_RecycleBin, &RecycleBin_Constructor},
|
||||||
{CLSID_OpenWithMenu, &SHEOW_Constructor},
|
{CLSID_OpenWithMenu, &SHEOW_Constructor},
|
||||||
{CLSID_NewMenu, &INewItem_Constructor},
|
{CLSID_NewMenu, &INewItem_Constructor},
|
||||||
{CLSID_StartMenu, &StartMenu_Constructor},
|
{CLSID_StartMenu, &StartMenu_Constructor},
|
||||||
{CLSID_MenuBandSite, &MenuBandSite_Constructor},
|
{CLSID_MenuBandSite, &MenuBandSite_Constructor},
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1380,7 +1380,7 @@ HIMAGELIST ShellBigIconList = 0;
|
||||||
|
|
||||||
void *operator new (size_t, void *buf)
|
void *operator new (size_t, void *buf)
|
||||||
{
|
{
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -1391,38 +1391,38 @@ void *operator new (size_t, void *buf)
|
||||||
*/
|
*/
|
||||||
STDAPI_(BOOL) DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID fImpLoad)
|
STDAPI_(BOOL) DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID fImpLoad)
|
||||||
{
|
{
|
||||||
TRACE("%p 0x%x %p\n", hInstance, dwReason, fImpLoad);
|
TRACE("%p 0x%x %p\n", hInstance, dwReason, fImpLoad);
|
||||||
if (dwReason == DLL_PROCESS_ATTACH)
|
if (dwReason == DLL_PROCESS_ATTACH)
|
||||||
{
|
{
|
||||||
/* HACK - the global constructors don't run, so I placement new them here */
|
/* HACK - the global constructors don't run, so I placement new them here */
|
||||||
new (&gModule) CShell32Module;
|
new (&gModule) CShell32Module;
|
||||||
new (&_AtlWinModule) CAtlWinModule;
|
new (&_AtlWinModule) CAtlWinModule;
|
||||||
new (&_AtlBaseModule) CAtlBaseModule;
|
new (&_AtlBaseModule) CAtlBaseModule;
|
||||||
new (&_AtlComModule) CAtlComModule;
|
new (&_AtlComModule) CAtlComModule;
|
||||||
|
|
||||||
shell32_hInstance = hInstance;
|
shell32_hInstance = hInstance;
|
||||||
gModule.Init(ObjectMap, hInstance, NULL);
|
gModule.Init(ObjectMap, hInstance, NULL);
|
||||||
|
|
||||||
DisableThreadLibraryCalls (hInstance);
|
DisableThreadLibraryCalls (hInstance);
|
||||||
|
|
||||||
/* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
|
/* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
|
||||||
GetModuleFileNameW(hInstance, swShell32Name, MAX_PATH);
|
GetModuleFileNameW(hInstance, swShell32Name, MAX_PATH);
|
||||||
swShell32Name[MAX_PATH - 1] = '\0';
|
swShell32Name[MAX_PATH - 1] = '\0';
|
||||||
|
|
||||||
InitCommonControlsEx(NULL);
|
InitCommonControlsEx(NULL);
|
||||||
|
|
||||||
SIC_Initialize();
|
SIC_Initialize();
|
||||||
InitChangeNotifications();
|
InitChangeNotifications();
|
||||||
InitIconOverlays();
|
InitIconOverlays();
|
||||||
}
|
}
|
||||||
else if (dwReason == DLL_PROCESS_DETACH)
|
else if (dwReason == DLL_PROCESS_DETACH)
|
||||||
{
|
{
|
||||||
shell32_hInstance = NULL;
|
shell32_hInstance = NULL;
|
||||||
SIC_Destroy();
|
SIC_Destroy();
|
||||||
FreeChangeNotifications();
|
FreeChangeNotifications();
|
||||||
gModule.Term();
|
gModule.Term();
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -1430,7 +1430,7 @@ STDAPI_(BOOL) DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID fImpLoad)
|
||||||
*/
|
*/
|
||||||
STDAPI DllCanUnloadNow()
|
STDAPI DllCanUnloadNow()
|
||||||
{
|
{
|
||||||
return gModule.DllCanUnloadNow();
|
return gModule.DllCanUnloadNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -1439,13 +1439,13 @@ STDAPI DllCanUnloadNow()
|
||||||
*/
|
*/
|
||||||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
||||||
{
|
{
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
|
|
||||||
TRACE("CLSID:%s,IID:%s\n", shdebugstr_guid(&rclsid), shdebugstr_guid(&riid));
|
TRACE("CLSID:%s,IID:%s\n", shdebugstr_guid(&rclsid), shdebugstr_guid(&riid));
|
||||||
|
|
||||||
hResult = gModule.DllGetClassObject(rclsid, riid, ppv);
|
hResult = gModule.DllGetClassObject(rclsid, riid, ppv);
|
||||||
TRACE("-- pointer to class factory: %p\n", *ppv);
|
TRACE("-- pointer to class factory: %p\n", *ppv);
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -1453,7 +1453,7 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
||||||
*/
|
*/
|
||||||
STDAPI DllRegisterServer()
|
STDAPI DllRegisterServer()
|
||||||
{
|
{
|
||||||
return gModule.DllRegisterServer(FALSE);
|
return gModule.DllRegisterServer(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -1461,7 +1461,7 @@ STDAPI DllRegisterServer()
|
||||||
*/
|
*/
|
||||||
STDAPI DllUnregisterServer()
|
STDAPI DllUnregisterServer()
|
||||||
{
|
{
|
||||||
return gModule.DllUnregisterServer(FALSE);
|
return gModule.DllUnregisterServer(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -145,7 +145,7 @@ static INT_PTR ConfirmMsgBox_Paint(HWND hDlg)
|
||||||
SelectObject(hdc, hOldFont);
|
SelectObject(hdc, hOldFont);
|
||||||
EndPaint(hDlg, &ps);
|
EndPaint(hDlg, &ps);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT_PTR ConfirmMsgBox_Init(HWND hDlg, LPARAM lParam)
|
static INT_PTR ConfirmMsgBox_Init(HWND hDlg, LPARAM lParam)
|
||||||
|
@ -224,89 +224,89 @@ typedef struct
|
||||||
{
|
{
|
||||||
HINSTANCE hIconInstance;
|
HINSTANCE hIconInstance;
|
||||||
UINT icon_resource_id;
|
UINT icon_resource_id;
|
||||||
UINT caption_resource_id, text_resource_id;
|
UINT caption_resource_id, text_resource_id;
|
||||||
} SHELL_ConfirmIDstruc;
|
} SHELL_ConfirmIDstruc;
|
||||||
|
|
||||||
static BOOL SHELL_ConfirmIDs(int nKindOfDialog, SHELL_ConfirmIDstruc *ids)
|
static BOOL SHELL_ConfirmIDs(int nKindOfDialog, SHELL_ConfirmIDstruc *ids)
|
||||||
{
|
{
|
||||||
ids->hIconInstance = shell32_hInstance;
|
ids->hIconInstance = shell32_hInstance;
|
||||||
switch (nKindOfDialog)
|
switch (nKindOfDialog)
|
||||||
{
|
{
|
||||||
case ASK_DELETE_FILE:
|
case ASK_DELETE_FILE:
|
||||||
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
|
||||||
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
|
||||||
ids->text_resource_id = IDS_DELETEITEM_TEXT;
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case ASK_DELETE_FOLDER:
|
|
||||||
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
||||||
ids->caption_resource_id = IDS_DELETEFOLDER_CAPTION;
|
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
||||||
ids->text_resource_id = IDS_DELETEITEM_TEXT;
|
ids->text_resource_id = IDS_DELETEITEM_TEXT;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ASK_DELETE_MULTIPLE_ITEM:
|
case ASK_DELETE_FOLDER:
|
||||||
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
||||||
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
ids->caption_resource_id = IDS_DELETEFOLDER_CAPTION;
|
||||||
ids->text_resource_id = IDS_DELETEMULTIPLE_TEXT;
|
ids->text_resource_id = IDS_DELETEITEM_TEXT;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ASK_TRASH_FILE:
|
case ASK_DELETE_MULTIPLE_ITEM:
|
||||||
ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
|
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
||||||
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
||||||
ids->text_resource_id = IDS_TRASHITEM_TEXT;
|
ids->text_resource_id = IDS_DELETEMULTIPLE_TEXT;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ASK_TRASH_FOLDER:
|
case ASK_TRASH_FILE:
|
||||||
ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
|
ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
|
||||||
ids->caption_resource_id = IDS_DELETEFOLDER_CAPTION;
|
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
||||||
ids->text_resource_id = IDS_TRASHFOLDER_TEXT;
|
ids->text_resource_id = IDS_TRASHITEM_TEXT;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ASK_TRASH_MULTIPLE_ITEM:
|
case ASK_TRASH_FOLDER:
|
||||||
ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
|
ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
|
||||||
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
ids->caption_resource_id = IDS_DELETEFOLDER_CAPTION;
|
||||||
ids->text_resource_id = IDS_TRASHMULTIPLE_TEXT;
|
ids->text_resource_id = IDS_TRASHFOLDER_TEXT;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ASK_CANT_TRASH_ITEM:
|
case ASK_TRASH_MULTIPLE_ITEM:
|
||||||
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
|
||||||
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
||||||
ids->text_resource_id = IDS_CANTTRASH_TEXT;
|
ids->text_resource_id = IDS_TRASHMULTIPLE_TEXT;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ASK_DELETE_SELECTED:
|
case ASK_CANT_TRASH_ITEM:
|
||||||
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
||||||
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
||||||
ids->text_resource_id = IDS_DELETESELECTED_TEXT;
|
ids->text_resource_id = IDS_CANTTRASH_TEXT;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case ASK_OVERWRITE_FILE:
|
case ASK_DELETE_SELECTED:
|
||||||
ids->hIconInstance = NULL;
|
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
||||||
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
|
||||||
ids->caption_resource_id = IDS_OVERWRITEFILE_CAPTION;
|
ids->text_resource_id = IDS_DELETESELECTED_TEXT;
|
||||||
ids->text_resource_id = IDS_OVERWRITEFILE_TEXT;
|
return TRUE;
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case ASK_OVERWRITE_FOLDER:
|
case ASK_OVERWRITE_FILE:
|
||||||
ids->hIconInstance = NULL;
|
ids->hIconInstance = NULL;
|
||||||
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
||||||
ids->caption_resource_id = IDS_OVERWRITEFILE_CAPTION;
|
ids->caption_resource_id = IDS_OVERWRITEFILE_CAPTION;
|
||||||
ids->text_resource_id = IDS_OVERWRITEFOLDER_TEXT;
|
ids->text_resource_id = IDS_OVERWRITEFILE_TEXT;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
default:
|
case ASK_OVERWRITE_FOLDER:
|
||||||
FIXME(" Unhandled nKindOfDialog %d stub\n", nKindOfDialog);
|
ids->hIconInstance = NULL;
|
||||||
}
|
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
|
||||||
return FALSE;
|
ids->caption_resource_id = IDS_OVERWRITEFILE_CAPTION;
|
||||||
|
ids->text_resource_id = IDS_OVERWRITEFOLDER_TEXT;
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
default:
|
||||||
|
FIXME(" Unhandled nKindOfDialog %d stub\n", nKindOfDialog);
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
|
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
|
||||||
{
|
{
|
||||||
WCHAR szCaption[255], szText[255], szBuffer[MAX_PATH + 256];
|
WCHAR szCaption[255], szText[255], szBuffer[MAX_PATH + 256];
|
||||||
SHELL_ConfirmIDstruc ids;
|
SHELL_ConfirmIDstruc ids;
|
||||||
DWORD_PTR args[1];
|
DWORD_PTR args[1];
|
||||||
HICON hIcon;
|
HICON hIcon;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
DbgPrint("[shell32, SHELL_ConfirmDialogW] Called\n");
|
DbgPrint("[shell32, SHELL_ConfirmDialogW] Called\n");
|
||||||
|
|
||||||
|
@ -316,12 +316,12 @@ static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FI
|
||||||
|
|
||||||
if (!SHELL_ConfirmIDs(nKindOfDialog, &ids)) return FALSE;
|
if (!SHELL_ConfirmIDs(nKindOfDialog, &ids)) return FALSE;
|
||||||
|
|
||||||
LoadStringW(shell32_hInstance, ids.caption_resource_id, szCaption, sizeof(szCaption)/sizeof(WCHAR));
|
LoadStringW(shell32_hInstance, ids.caption_resource_id, szCaption, sizeof(szCaption)/sizeof(WCHAR));
|
||||||
LoadStringW(shell32_hInstance, ids.text_resource_id, szText, sizeof(szText)/sizeof(WCHAR));
|
LoadStringW(shell32_hInstance, ids.text_resource_id, szText, sizeof(szText)/sizeof(WCHAR));
|
||||||
|
|
||||||
args[0] = (DWORD_PTR)szDir;
|
args[0] = (DWORD_PTR)szDir;
|
||||||
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
||||||
szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)args);
|
szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)args);
|
||||||
hIcon = LoadIconW(ids.hIconInstance, (LPWSTR)MAKEINTRESOURCE(ids.icon_resource_id));
|
hIcon = LoadIconW(ids.hIconInstance, (LPWSTR)MAKEINTRESOURCE(ids.icon_resource_id));
|
||||||
|
|
||||||
ret = SHELL_ConfirmMsgBox(hWnd, szBuffer, szCaption, hIcon, op && op->bManyItems);
|
ret = SHELL_ConfirmMsgBox(hWnd, szBuffer, szCaption, hIcon, op && op->bManyItems);
|
||||||
|
@ -347,23 +347,23 @@ BOOL SHELL_ConfirmYesNoW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir)
|
||||||
|
|
||||||
static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChars)
|
static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChars)
|
||||||
{
|
{
|
||||||
DWORD len = MultiByteToWideChar(CP_ACP, 0, aPath, -1, NULL, 0);
|
DWORD len = MultiByteToWideChar(CP_ACP, 0, aPath, -1, NULL, 0);
|
||||||
|
|
||||||
if (len < minChars)
|
if (len < minChars)
|
||||||
len = minChars;
|
len = minChars;
|
||||||
|
|
||||||
*wPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
*wPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||||
if (*wPath)
|
if (*wPath)
|
||||||
{
|
{
|
||||||
MultiByteToWideChar(CP_ACP, 0, aPath, -1, *wPath, len);
|
MultiByteToWideChar(CP_ACP, 0, aPath, -1, *wPath, len);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SHELL32_FreeUnicodeBuf(LPWSTR wPath)
|
static void SHELL32_FreeUnicodeBuf(LPWSTR wPath)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, wPath);
|
HeapFree(GetProcessHeap(), 0, wPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXTERN_C HRESULT WINAPI SHIsFileAvailableOffline(LPCWSTR path, LPDWORD status)
|
EXTERN_C HRESULT WINAPI SHIsFileAvailableOffline(LPCWSTR path, LPDWORD status)
|
||||||
|
@ -380,34 +380,34 @@ EXTERN_C HRESULT WINAPI SHIsFileAvailableOffline(LPCWSTR path, LPDWORD status)
|
||||||
*/
|
*/
|
||||||
BOOL SHELL_DeleteDirectoryW(HWND hwnd, LPCWSTR pszDir, BOOL bShowUI)
|
BOOL SHELL_DeleteDirectoryW(HWND hwnd, LPCWSTR pszDir, BOOL bShowUI)
|
||||||
{
|
{
|
||||||
BOOL ret = TRUE;
|
BOOL ret = TRUE;
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
WIN32_FIND_DATAW wfd;
|
WIN32_FIND_DATAW wfd;
|
||||||
WCHAR szTemp[MAX_PATH];
|
WCHAR szTemp[MAX_PATH];
|
||||||
|
|
||||||
/* Make sure the directory exists before eventually prompting the user */
|
/* Make sure the directory exists before eventually prompting the user */
|
||||||
PathCombineW(szTemp, pszDir, wWildcardFile);
|
PathCombineW(szTemp, pszDir, wWildcardFile);
|
||||||
hFind = FindFirstFileW(szTemp, &wfd);
|
hFind = FindFirstFileW(szTemp, &wfd);
|
||||||
if (hFind == INVALID_HANDLE_VALUE)
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!bShowUI || (ret = SHELL_ConfirmDialogW(hwnd, ASK_DELETE_FOLDER, pszDir, NULL)))
|
if (!bShowUI || (ret = SHELL_ConfirmDialogW(hwnd, ASK_DELETE_FOLDER, pszDir, NULL)))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (IsDotDir(wfd.cFileName))
|
if (IsDotDir(wfd.cFileName))
|
||||||
continue;
|
continue;
|
||||||
PathCombineW(szTemp, pszDir, wfd.cFileName);
|
PathCombineW(szTemp, pszDir, wfd.cFileName);
|
||||||
if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)
|
if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)
|
||||||
ret = SHELL_DeleteDirectoryW(hwnd, szTemp, FALSE);
|
ret = SHELL_DeleteDirectoryW(hwnd, szTemp, FALSE);
|
||||||
else
|
else
|
||||||
ret = (SHNotifyDeleteFileW(szTemp) == ERROR_SUCCESS);
|
ret = (SHNotifyDeleteFileW(szTemp) == ERROR_SUCCESS);
|
||||||
} while (ret && FindNextFileW(hFind, &wfd));
|
} while (ret && FindNextFileW(hFind, &wfd));
|
||||||
}
|
}
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
if (ret)
|
if (ret)
|
||||||
ret = (SHNotifyRemoveDirectoryW(pszDir) == ERROR_SUCCESS);
|
ret = (SHNotifyRemoveDirectoryW(pszDir) == ERROR_SUCCESS);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -424,21 +424,21 @@ BOOL SHELL_DeleteDirectoryW(HWND hwnd, LPCWSTR pszDir, BOOL bShowUI)
|
||||||
|
|
||||||
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
|
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
|
||||||
{
|
{
|
||||||
TRACE("(%s, %p)\n", debugstr_w(path), sec);
|
TRACE("(%s, %p)\n", debugstr_w(path), sec);
|
||||||
|
|
||||||
if (CreateDirectoryW(path, sec))
|
if (CreateDirectoryW(path, sec))
|
||||||
{
|
{
|
||||||
SHChangeNotify(SHCNE_MKDIR, SHCNF_PATHW, path, NULL);
|
SHChangeNotify(SHCNE_MKDIR, SHCNF_PATHW, path, NULL);
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
return GetLastError();
|
return GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
EXTERN_C BOOL WINAPI Win32CreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
|
EXTERN_C BOOL WINAPI Win32CreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
|
||||||
{
|
{
|
||||||
return (SHNotifyCreateDirectoryW(path, sec) == ERROR_SUCCESS);
|
return (SHNotifyCreateDirectoryW(path, sec) == ERROR_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -454,31 +454,31 @@ EXTERN_C BOOL WINAPI Win32CreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES s
|
||||||
*/
|
*/
|
||||||
static DWORD SHNotifyRemoveDirectoryW(LPCWSTR path)
|
static DWORD SHNotifyRemoveDirectoryW(LPCWSTR path)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
TRACE("(%s)\n", debugstr_w(path));
|
TRACE("(%s)\n", debugstr_w(path));
|
||||||
|
|
||||||
ret = RemoveDirectoryW(path);
|
ret = RemoveDirectoryW(path);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
/* Directory may be write protected */
|
/* Directory may be write protected */
|
||||||
DWORD dwAttr = GetFileAttributesW(path);
|
DWORD dwAttr = GetFileAttributesW(path);
|
||||||
if (IsAttrib(dwAttr, FILE_ATTRIBUTE_READONLY))
|
if (IsAttrib(dwAttr, FILE_ATTRIBUTE_READONLY))
|
||||||
if (SetFileAttributesW(path, dwAttr & ~FILE_ATTRIBUTE_READONLY))
|
if (SetFileAttributesW(path, dwAttr & ~FILE_ATTRIBUTE_READONLY))
|
||||||
ret = RemoveDirectoryW(path);
|
ret = RemoveDirectoryW(path);
|
||||||
}
|
}
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
SHChangeNotify(SHCNE_RMDIR, SHCNF_PATHW, path, NULL);
|
SHChangeNotify(SHCNE_RMDIR, SHCNF_PATHW, path, NULL);
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
return GetLastError();
|
return GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
EXTERN_C BOOL WINAPI Win32RemoveDirectoryW(LPCWSTR path)
|
EXTERN_C BOOL WINAPI Win32RemoveDirectoryW(LPCWSTR path)
|
||||||
{
|
{
|
||||||
return (SHNotifyRemoveDirectoryW(path) == ERROR_SUCCESS);
|
return (SHNotifyRemoveDirectoryW(path) == ERROR_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -494,32 +494,32 @@ EXTERN_C BOOL WINAPI Win32RemoveDirectoryW(LPCWSTR path)
|
||||||
*/
|
*/
|
||||||
static DWORD SHNotifyDeleteFileW(LPCWSTR path)
|
static DWORD SHNotifyDeleteFileW(LPCWSTR path)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
TRACE("(%s)\n", debugstr_w(path));
|
TRACE("(%s)\n", debugstr_w(path));
|
||||||
|
|
||||||
ret = DeleteFileW(path);
|
ret = DeleteFileW(path);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
/* File may be write protected or a system file */
|
/* File may be write protected or a system file */
|
||||||
DWORD dwAttr = GetFileAttributesW(path);
|
DWORD dwAttr = GetFileAttributesW(path);
|
||||||
if (IsAttrib(dwAttr, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM))
|
if (IsAttrib(dwAttr, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM))
|
||||||
if (SetFileAttributesW(path, dwAttr & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM)))
|
if (SetFileAttributesW(path, dwAttr & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM)))
|
||||||
ret = DeleteFileW(path);
|
ret = DeleteFileW(path);
|
||||||
}
|
}
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
SHChangeNotify(SHCNE_DELETE, SHCNF_PATHW, path, NULL);
|
SHChangeNotify(SHCNE_DELETE, SHCNF_PATHW, path, NULL);
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
return GetLastError();
|
return GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
EXTERN_C DWORD WINAPI Win32DeleteFileW(LPCWSTR path)
|
EXTERN_C DWORD WINAPI Win32DeleteFileW(LPCWSTR path)
|
||||||
{
|
{
|
||||||
return (SHNotifyDeleteFileW(path) == ERROR_SUCCESS);
|
return (SHNotifyDeleteFileW(path) == ERROR_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -536,9 +536,9 @@ EXTERN_C DWORD WINAPI Win32DeleteFileW(LPCWSTR path)
|
||||||
*/
|
*/
|
||||||
static DWORD SHNotifyMoveFileW(LPCWSTR src, LPCWSTR dest)
|
static DWORD SHNotifyMoveFileW(LPCWSTR src, LPCWSTR dest)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
TRACE("(%s %s)\n", debugstr_w(src), debugstr_w(dest));
|
TRACE("(%s %s)\n", debugstr_w(src), debugstr_w(dest));
|
||||||
|
|
||||||
ret = MoveFileExW(src, dest, MOVEFILE_REPLACE_EXISTING);
|
ret = MoveFileExW(src, dest, MOVEFILE_REPLACE_EXISTING);
|
||||||
|
|
||||||
|
@ -546,26 +546,26 @@ static DWORD SHNotifyMoveFileW(LPCWSTR src, LPCWSTR dest)
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = MoveFileW(src, dest);
|
ret = MoveFileW(src, dest);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
DWORD dwAttr;
|
DWORD dwAttr;
|
||||||
|
|
||||||
dwAttr = SHFindAttrW(dest, FALSE);
|
dwAttr = SHFindAttrW(dest, FALSE);
|
||||||
if (INVALID_FILE_ATTRIBUTES == dwAttr)
|
if (INVALID_FILE_ATTRIBUTES == dwAttr)
|
||||||
{
|
{
|
||||||
/* Source file may be write protected or a system file */
|
/* Source file may be write protected or a system file */
|
||||||
dwAttr = GetFileAttributesW(src);
|
dwAttr = GetFileAttributesW(src);
|
||||||
if (IsAttrib(dwAttr, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM))
|
if (IsAttrib(dwAttr, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM))
|
||||||
if (SetFileAttributesW(src, dwAttr & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM)))
|
if (SetFileAttributesW(src, dwAttr & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM)))
|
||||||
ret = MoveFileW(src, dest);
|
ret = MoveFileW(src, dest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_PATHW, src, dest);
|
SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_PATHW, src, dest);
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
return GetLastError();
|
return GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD WINAPI SHOperationProgressRoutine(LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER StreamSize, LARGE_INTEGER StreamBytesTransferred, DWORD dwStreamNumber, DWORD dwCallbackReason, HANDLE hSourceFile, HANDLE hDestinationFile, LPVOID lpData)
|
static DWORD WINAPI SHOperationProgressRoutine(LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER StreamSize, LARGE_INTEGER StreamBytesTransferred, DWORD dwStreamNumber, DWORD dwCallbackReason, HANDLE hSourceFile, HANDLE hDestinationFile, LPVOID lpData)
|
||||||
|
@ -641,52 +641,52 @@ static INT_PTR CALLBACK SHOperationDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam
|
||||||
|
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG)lParam);
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG)lParam);
|
||||||
|
|
||||||
/* get context */
|
/* get context */
|
||||||
Context = (FILE_OPERATION_CONTEXT*)lParam;
|
Context = (FILE_OPERATION_CONTEXT*)lParam;
|
||||||
|
|
||||||
/* store progress bar handle */
|
/* store progress bar handle */
|
||||||
Context->hDlgCtrl = GetDlgItem(hwndDlg, 14000);
|
Context->hDlgCtrl = GetDlgItem(hwndDlg, 14000);
|
||||||
|
|
||||||
/* store window handle */
|
/* store window handle */
|
||||||
Context->hwndDlg = hwndDlg;
|
Context->hwndDlg = hwndDlg;
|
||||||
|
|
||||||
/* set progress bar range */
|
/* set progress bar range */
|
||||||
(void)SendMessageW(Context->hDlgCtrl, (UINT) PBM_SETRANGE, 0, MAKELPARAM(0, 100));
|
(void)SendMessageW(Context->hDlgCtrl, (UINT) PBM_SETRANGE, 0, MAKELPARAM(0, 100));
|
||||||
|
|
||||||
/* start file queueing */
|
/* start file queueing */
|
||||||
SetTimer(hwndDlg, TIMER_ID, 1000, NULL);
|
SetTimer(hwndDlg, TIMER_ID, 1000, NULL);
|
||||||
//QueueFile(Context);
|
//QueueFile(Context);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
Context->op->bCancelled = TRUE;
|
Context->op->bCancelled = TRUE;
|
||||||
EndDialog(hwndDlg, Context->op->bCancelled);
|
EndDialog(hwndDlg, Context->op->bCancelled);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
if (LOWORD(wParam) == 14002)
|
if (LOWORD(wParam) == 14002)
|
||||||
{
|
{
|
||||||
Context->op->bCancelled = TRUE;
|
Context->op->bCancelled = TRUE;
|
||||||
EndDialog(hwndDlg, Context->op->bCancelled);
|
EndDialog(hwndDlg, Context->op->bCancelled);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}; break;
|
}; break;
|
||||||
|
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
if (wParam == TIMER_ID)
|
if (wParam == TIMER_ID)
|
||||||
{
|
{
|
||||||
QueueFile(Context);
|
QueueFile(Context);
|
||||||
KillTimer(hwndDlg, TIMER_ID);
|
KillTimer(hwndDlg, TIMER_ID);
|
||||||
}; break;
|
}; break;
|
||||||
|
|
||||||
case WM_FILE:
|
case WM_FILE:
|
||||||
if (!QueueFile(Context))
|
if (!QueueFile(Context))
|
||||||
EndDialog(hwndDlg, Context->op->bCancelled);
|
EndDialog(hwndDlg, Context->op->bCancelled);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -742,12 +742,12 @@ SHShowFileOperationDialog(FILE_OPERATION *op, FILE_LIST *flFrom, FILE_LIST *flTo
|
||||||
*/
|
*/
|
||||||
static DWORD SHNotifyCopyFileW(LPCWSTR src, LPCWSTR dest, BOOL bFailIfExists)
|
static DWORD SHNotifyCopyFileW(LPCWSTR src, LPCWSTR dest, BOOL bFailIfExists)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
DWORD attribs;
|
DWORD attribs;
|
||||||
|
|
||||||
DbgPrint("[shell32, SHNotifyCopyFileW] Called\n");
|
DbgPrint("[shell32, SHNotifyCopyFileW] Called\n");
|
||||||
|
|
||||||
TRACE("(%s %s %s)\n", debugstr_w(src), debugstr_w(dest), bFailIfExists ? "failIfExists" : "");
|
TRACE("(%s %s %s)\n", debugstr_w(src), debugstr_w(dest), bFailIfExists ? "failIfExists" : "");
|
||||||
|
|
||||||
/* Destination file may already exist with read only attribute */
|
/* Destination file may already exist with read only attribute */
|
||||||
attribs = GetFileAttributesW(dest);
|
attribs = GetFileAttributesW(dest);
|
||||||
|
@ -764,14 +764,14 @@ static DWORD SHNotifyCopyFileW(LPCWSTR src, LPCWSTR dest, BOOL bFailIfExists)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = CopyFileW(src, dest, bFailIfExists);
|
ret = CopyFileW(src, dest, bFailIfExists);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
SHChangeNotify(SHCNE_CREATE, SHCNF_PATHW, dest, NULL);
|
SHChangeNotify(SHCNE_CREATE, SHCNF_PATHW, dest, NULL);
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetLastError();
|
return GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -838,18 +838,18 @@ int WINAPI SHCreateDirectory(HWND hWnd, LPCWSTR path)
|
||||||
*/
|
*/
|
||||||
int WINAPI SHCreateDirectoryExA(HWND hWnd, LPCSTR path, LPSECURITY_ATTRIBUTES sec)
|
int WINAPI SHCreateDirectoryExA(HWND hWnd, LPCSTR path, LPSECURITY_ATTRIBUTES sec)
|
||||||
{
|
{
|
||||||
LPWSTR wPath;
|
LPWSTR wPath;
|
||||||
DWORD retCode;
|
DWORD retCode;
|
||||||
|
|
||||||
TRACE("(%s, %p)\n", debugstr_a(path), sec);
|
TRACE("(%s, %p)\n", debugstr_a(path), sec);
|
||||||
|
|
||||||
retCode = SHELL32_AnsiToUnicodeBuf(path, &wPath, 0);
|
retCode = SHELL32_AnsiToUnicodeBuf(path, &wPath, 0);
|
||||||
if (!retCode)
|
if (!retCode)
|
||||||
{
|
{
|
||||||
retCode = SHCreateDirectoryExW(hWnd, wPath, sec);
|
retCode = SHCreateDirectoryExW(hWnd, wPath, sec);
|
||||||
SHELL32_FreeUnicodeBuf(wPath);
|
SHELL32_FreeUnicodeBuf(wPath);
|
||||||
}
|
}
|
||||||
return retCode;
|
return retCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -859,50 +859,50 @@ int WINAPI SHCreateDirectoryExA(HWND hWnd, LPCSTR path, LPSECURITY_ATTRIBUTES se
|
||||||
*/
|
*/
|
||||||
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
|
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
|
||||||
{
|
{
|
||||||
int ret = ERROR_BAD_PATHNAME;
|
int ret = ERROR_BAD_PATHNAME;
|
||||||
TRACE("(%p, %s, %p)\n", hWnd, debugstr_w(path), sec);
|
TRACE("(%p, %s, %p)\n", hWnd, debugstr_w(path), sec);
|
||||||
|
|
||||||
if (PathIsRelativeW(path))
|
if (PathIsRelativeW(path))
|
||||||
{
|
{
|
||||||
SetLastError(ret);
|
SetLastError(ret);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = SHNotifyCreateDirectoryW(path, sec);
|
ret = SHNotifyCreateDirectoryW(path, sec);
|
||||||
/* Refuse to work on certain error codes before trying to create directories recursively */
|
/* Refuse to work on certain error codes before trying to create directories recursively */
|
||||||
if (ret != ERROR_SUCCESS &&
|
if (ret != ERROR_SUCCESS &&
|
||||||
ret != ERROR_FILE_EXISTS &&
|
ret != ERROR_FILE_EXISTS &&
|
||||||
ret != ERROR_ALREADY_EXISTS &&
|
ret != ERROR_ALREADY_EXISTS &&
|
||||||
ret != ERROR_FILENAME_EXCED_RANGE)
|
ret != ERROR_FILENAME_EXCED_RANGE)
|
||||||
{
|
{
|
||||||
WCHAR *pEnd, *pSlash, szTemp[MAX_PATH + 1]; /* extra for PathAddBackslash() */
|
WCHAR *pEnd, *pSlash, szTemp[MAX_PATH + 1]; /* extra for PathAddBackslash() */
|
||||||
|
|
||||||
lstrcpynW(szTemp, path, MAX_PATH);
|
lstrcpynW(szTemp, path, MAX_PATH);
|
||||||
pEnd = PathAddBackslashW(szTemp);
|
pEnd = PathAddBackslashW(szTemp);
|
||||||
pSlash = szTemp + 3;
|
pSlash = szTemp + 3;
|
||||||
|
|
||||||
while (*pSlash)
|
while (*pSlash)
|
||||||
{
|
{
|
||||||
while (*pSlash && *pSlash != '\\') pSlash++;
|
while (*pSlash && *pSlash != '\\') pSlash++;
|
||||||
if (*pSlash)
|
if (*pSlash)
|
||||||
{
|
{
|
||||||
*pSlash = 0; /* terminate path at separator */
|
*pSlash = 0; /* terminate path at separator */
|
||||||
|
|
||||||
ret = SHNotifyCreateDirectoryW(szTemp, pSlash + 1 == pEnd ? sec : NULL);
|
ret = SHNotifyCreateDirectoryW(szTemp, pSlash + 1 == pEnd ? sec : NULL);
|
||||||
}
|
}
|
||||||
*pSlash++ = '\\'; /* put the separator back */
|
*pSlash++ = '\\'; /* put the separator back */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret && hWnd && (ERROR_CANCELLED != ret))
|
if (ret && hWnd && (ERROR_CANCELLED != ret))
|
||||||
{
|
{
|
||||||
/* We failed and should show a dialog box */
|
/* We failed and should show a dialog box */
|
||||||
FIXME("Show system error message, creating path %s, failed with error %d\n", debugstr_w(path), ret);
|
FIXME("Show system error message, creating path %s, failed with error %d\n", debugstr_w(path), ret);
|
||||||
ret = ERROR_CANCELLED; /* Error has been already presented to user (not really yet!) */
|
ret = ERROR_CANCELLED; /* Error has been already presented to user (not really yet!) */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -922,25 +922,25 @@ int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES s
|
||||||
*/
|
*/
|
||||||
static DWORD SHFindAttrW(LPCWSTR pName, BOOL fileOnly)
|
static DWORD SHFindAttrW(LPCWSTR pName, BOOL fileOnly)
|
||||||
{
|
{
|
||||||
WIN32_FIND_DATAW wfd;
|
WIN32_FIND_DATAW wfd;
|
||||||
BOOL b_FileMask = fileOnly && (NULL != StrPBrkW(pName, wWildcardChars));
|
BOOL b_FileMask = fileOnly && (NULL != StrPBrkW(pName, wWildcardChars));
|
||||||
DWORD dwAttr = INVALID_FILE_ATTRIBUTES;
|
DWORD dwAttr = INVALID_FILE_ATTRIBUTES;
|
||||||
HANDLE hFind = FindFirstFileW(pName, &wfd);
|
HANDLE hFind = FindFirstFileW(pName, &wfd);
|
||||||
|
|
||||||
TRACE("%s %d\n", debugstr_w(pName), fileOnly);
|
TRACE("%s %d\n", debugstr_w(pName), fileOnly);
|
||||||
if (INVALID_HANDLE_VALUE != hFind)
|
if (INVALID_HANDLE_VALUE != hFind)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (b_FileMask && IsAttribDir(wfd.dwFileAttributes))
|
if (b_FileMask && IsAttribDir(wfd.dwFileAttributes))
|
||||||
continue;
|
continue;
|
||||||
dwAttr = wfd.dwFileAttributes;
|
dwAttr = wfd.dwFileAttributes;
|
||||||
break;
|
break;
|
||||||
} while (FindNextFileW(hFind, &wfd));
|
} while (FindNextFileW(hFind, &wfd));
|
||||||
|
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
return dwAttr;
|
return dwAttr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -954,28 +954,28 @@ static DWORD SHFindAttrW(LPCWSTR pName, BOOL fileOnly)
|
||||||
*/
|
*/
|
||||||
static DWORD SHNameTranslate(LPWSTR* wString, LPCWSTR* pWToFrom, BOOL more)
|
static DWORD SHNameTranslate(LPWSTR* wString, LPCWSTR* pWToFrom, BOOL more)
|
||||||
{
|
{
|
||||||
DWORD size = 0, aSize = 0;
|
DWORD size = 0, aSize = 0;
|
||||||
LPCSTR aString = (LPCSTR)*pWToFrom;
|
LPCSTR aString = (LPCSTR)*pWToFrom;
|
||||||
|
|
||||||
if (aString)
|
if (aString)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
size = lstrlenA(aString) + 1;
|
size = lstrlenA(aString) + 1;
|
||||||
aSize += size;
|
aSize += size;
|
||||||
aString += size;
|
aString += size;
|
||||||
} while ((size != 1) && more);
|
} while ((size != 1) && more);
|
||||||
|
|
||||||
/* The two sizes might be different in the case of multibyte chars */
|
/* The two sizes might be different in the case of multibyte chars */
|
||||||
size = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)*pWToFrom, aSize, *wString, 0);
|
size = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)*pWToFrom, aSize, *wString, 0);
|
||||||
if (*wString) /* only in the second loop */
|
if (*wString) /* only in the second loop */
|
||||||
{
|
{
|
||||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)*pWToFrom, aSize, *wString, size);
|
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)*pWToFrom, aSize, *wString, size);
|
||||||
*pWToFrom = *wString;
|
*pWToFrom = *wString;
|
||||||
*wString += size;
|
*wString += size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* SHFileOperationA [SHELL32.@]
|
* SHFileOperationA [SHELL32.@]
|
||||||
|
@ -995,43 +995,43 @@ static DWORD SHNameTranslate(LPWSTR* wString, LPCWSTR* pWToFrom, BOOL more)
|
||||||
*/
|
*/
|
||||||
int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
|
int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
|
||||||
{
|
{
|
||||||
SHFILEOPSTRUCTW nFileOp = *((LPSHFILEOPSTRUCTW)lpFileOp);
|
SHFILEOPSTRUCTW nFileOp = *((LPSHFILEOPSTRUCTW)lpFileOp);
|
||||||
int retCode = 0;
|
int retCode = 0;
|
||||||
DWORD size;
|
DWORD size;
|
||||||
LPWSTR ForFree = NULL, /* we change wString in SHNameTranslate and can't use it for freeing */
|
LPWSTR ForFree = NULL, /* we change wString in SHNameTranslate and can't use it for freeing */
|
||||||
wString = NULL; /* we change this in SHNameTranslate */
|
wString = NULL; /* we change this in SHNameTranslate */
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
if (FO_DELETE == (nFileOp.wFunc & FO_MASK))
|
if (FO_DELETE == (nFileOp.wFunc & FO_MASK))
|
||||||
nFileOp.pTo = NULL; /* we need a NULL or a valid pointer for translation */
|
nFileOp.pTo = NULL; /* we need a NULL or a valid pointer for translation */
|
||||||
if (!(nFileOp.fFlags & FOF_SIMPLEPROGRESS))
|
if (!(nFileOp.fFlags & FOF_SIMPLEPROGRESS))
|
||||||
nFileOp.lpszProgressTitle = NULL; /* we need a NULL or a valid pointer for translation */
|
nFileOp.lpszProgressTitle = NULL; /* we need a NULL or a valid pointer for translation */
|
||||||
while (1) /* every loop calculate size, second translate also, if we have storage for this */
|
while (1) /* every loop calculate size, second translate also, if we have storage for this */
|
||||||
{
|
{
|
||||||
size = SHNameTranslate(&wString, &nFileOp.lpszProgressTitle, FALSE); /* no loop */
|
size = SHNameTranslate(&wString, &nFileOp.lpszProgressTitle, FALSE); /* no loop */
|
||||||
size += SHNameTranslate(&wString, &nFileOp.pFrom, TRUE); /* internal loop */
|
size += SHNameTranslate(&wString, &nFileOp.pFrom, TRUE); /* internal loop */
|
||||||
size += SHNameTranslate(&wString, &nFileOp.pTo, TRUE); /* internal loop */
|
size += SHNameTranslate(&wString, &nFileOp.pTo, TRUE); /* internal loop */
|
||||||
|
|
||||||
if (ForFree)
|
if (ForFree)
|
||||||
{
|
{
|
||||||
retCode = SHFileOperationW(&nFileOp);
|
retCode = SHFileOperationW(&nFileOp);
|
||||||
HeapFree(GetProcessHeap(), 0, ForFree); /* we cannot use wString, it was changed */
|
HeapFree(GetProcessHeap(), 0, ForFree); /* we cannot use wString, it was changed */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wString = ForFree = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
|
wString = ForFree = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
|
||||||
if (ForFree) continue;
|
if (ForFree) continue;
|
||||||
retCode = ERROR_OUTOFMEMORY;
|
retCode = ERROR_OUTOFMEMORY;
|
||||||
nFileOp.fAnyOperationsAborted = TRUE;
|
nFileOp.fAnyOperationsAborted = TRUE;
|
||||||
SetLastError(retCode);
|
SetLastError(retCode);
|
||||||
return retCode;
|
return retCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lpFileOp->hNameMappings = nFileOp.hNameMappings;
|
lpFileOp->hNameMappings = nFileOp.hNameMappings;
|
||||||
lpFileOp->fAnyOperationsAborted = nFileOp.fAnyOperationsAborted;
|
lpFileOp->fAnyOperationsAborted = nFileOp.fAnyOperationsAborted;
|
||||||
return retCode;
|
return retCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __inline grow_list(FILE_LIST *list)
|
static void __inline grow_list(FILE_LIST *list)
|
||||||
|
@ -1097,21 +1097,21 @@ static void parse_wildcard_files(FILE_LIST *flList, LPCWSTR szFile, LPDWORD pdwL
|
||||||
for (res = TRUE; res; res = FindNextFileW(hFile, &wfd))
|
for (res = TRUE; res; res = FindNextFileW(hFile, &wfd))
|
||||||
{
|
{
|
||||||
if (IsDotDir(wfd.cFileName))
|
if (IsDotDir(wfd.cFileName))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (*pdwListIndex >= flList->num_alloc)
|
if (*pdwListIndex >= flList->num_alloc)
|
||||||
grow_list( flList );
|
grow_list( flList );
|
||||||
|
|
||||||
szFullPath = wildcard_to_file(szFile, wfd.cFileName);
|
szFullPath = wildcard_to_file(szFile, wfd.cFileName);
|
||||||
file = &flList->feFiles[(*pdwListIndex)++];
|
file = &flList->feFiles[(*pdwListIndex)++];
|
||||||
add_file_to_entry(file, szFullPath);
|
add_file_to_entry(file, szFullPath);
|
||||||
file->bFromWildcard = TRUE;
|
file->bFromWildcard = TRUE;
|
||||||
file->attributes = wfd.dwFileAttributes;
|
file->attributes = wfd.dwFileAttributes;
|
||||||
|
|
||||||
if (IsAttribDir(file->attributes))
|
if (IsAttribDir(file->attributes))
|
||||||
flList->bAnyDirectories = TRUE;
|
flList->bAnyDirectories = TRUE;
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, szFullPath);
|
HeapFree(GetProcessHeap(), 0, szFullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
FindClose(hFile);
|
FindClose(hFile);
|
||||||
|
@ -1221,7 +1221,7 @@ static void copy_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWST
|
||||||
lstrcpyW(szTo, szDestPath);
|
lstrcpyW(szTo, szDestPath);
|
||||||
|
|
||||||
if (!(op->req->fFlags & FOF_NOCONFIRMATION) && PathFileExistsW(szTo))
|
if (!(op->req->fFlags & FOF_NOCONFIRMATION) && PathFileExistsW(szTo))
|
||||||
{
|
{
|
||||||
if (!SHELL_ConfirmDialogW(op->req->hwnd, ASK_OVERWRITE_FOLDER, feFrom->szFilename, op))
|
if (!SHELL_ConfirmDialogW(op->req->hwnd, ASK_OVERWRITE_FOLDER, feFrom->szFilename, op))
|
||||||
{
|
{
|
||||||
/* Vista returns an ERROR_CANCELLED even if user pressed "No" */
|
/* Vista returns an ERROR_CANCELLED even if user pressed "No" */
|
||||||
|
@ -1711,19 +1711,19 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
|
||||||
*/
|
*/
|
||||||
void WINAPI SHFreeNameMappings(HANDLE hNameMapping)
|
void WINAPI SHFreeNameMappings(HANDLE hNameMapping)
|
||||||
{
|
{
|
||||||
if (hNameMapping)
|
if (hNameMapping)
|
||||||
{
|
{
|
||||||
int i = SHDSA_GetItemCount((HDSA)hNameMapping) - 1;
|
int i = SHDSA_GetItemCount((HDSA)hNameMapping) - 1;
|
||||||
|
|
||||||
for (; i>= 0; i--)
|
for (; i>= 0; i--)
|
||||||
{
|
{
|
||||||
LPSHNAMEMAPPINGW lp = (SHNAMEMAPPINGW *)DSA_GetItemPtr((HDSA)hNameMapping, i);
|
LPSHNAMEMAPPINGW lp = (SHNAMEMAPPINGW *)DSA_GetItemPtr((HDSA)hNameMapping, i);
|
||||||
|
|
||||||
SHFree(lp->pszOldPath);
|
SHFree(lp->pszOldPath);
|
||||||
SHFree(lp->pszNewPath);
|
SHFree(lp->pszNewPath);
|
||||||
}
|
}
|
||||||
DSA_Destroy((HDSA)hNameMapping);
|
DSA_Destroy((HDSA)hNameMapping);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -1779,7 +1779,7 @@ EXTERN_C DWORD WINAPI SheGetDirW(DWORD drive, LPWSTR buffer)
|
||||||
|
|
||||||
/* change current directory to the specified drive */
|
/* change current directory to the specified drive */
|
||||||
if (drive)
|
if (drive)
|
||||||
{
|
{
|
||||||
strcpy(drv_path, "A:");
|
strcpy(drv_path, "A:");
|
||||||
drv_path[0] += (char)drive-1;
|
drv_path[0] += (char)drive-1;
|
||||||
|
|
||||||
|
@ -1830,14 +1830,14 @@ EXTERN_C DWORD WINAPI SheChangeDirW(LPWSTR path)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* IsNetDrive [SHELL32.66]
|
* IsNetDrive [SHELL32.66]
|
||||||
*/
|
*/
|
||||||
EXTERN_C int WINAPI IsNetDrive(int drive)
|
EXTERN_C int WINAPI IsNetDrive(int drive)
|
||||||
{
|
{
|
||||||
char root[4];
|
char root[4];
|
||||||
strcpy(root, "A:\\");
|
strcpy(root, "A:\\");
|
||||||
root[0] += (char)drive;
|
root[0] += (char)drive;
|
||||||
return (GetDriveTypeA(root) == DRIVE_REMOTE);
|
return (GetDriveTypeA(root) == DRIVE_REMOTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1856,7 +1856,7 @@ EXTERN_C INT WINAPI RealDriveType(INT drive, BOOL bQueryNet)
|
||||||
*/
|
*/
|
||||||
EXTERN_C HRESULT WINAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *modless, LPCWSTR path, DWORD flags)
|
EXTERN_C HRESULT WINAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *modless, LPCWSTR path, DWORD flags)
|
||||||
{
|
{
|
||||||
DWORD res;
|
DWORD res;
|
||||||
DWORD err;
|
DWORD err;
|
||||||
LPCWSTR realpath;
|
LPCWSTR realpath;
|
||||||
int len;
|
int len;
|
||||||
|
|
Loading…
Reference in a new issue