ReactOS  0.4.15-dev-3733-g974a0f0
shlfileop.cpp File Reference
#include "precomp.h"
Include dependency graph for shlfileop.cpp:

Go to the source code of this file.

Classes

struct  FILE_OPERATION
 
struct  FILE_ENTRY
 
struct  FILE_LIST
 
struct  confirm_msg_info
 
struct  SHELL_ConfirmIDstruc
 

Macros

#define IsAttrib(x, y)   ((INVALID_FILE_ATTRIBUTES != (x)) && ((x) & (y)))
 
#define IsAttribFile(x)   (!((x) & FILE_ATTRIBUTE_DIRECTORY))
 
#define IsAttribDir(x)   IsAttrib(x, FILE_ATTRIBUTE_DIRECTORY)
 
#define IsDotDir(x)   ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0))))
 
#define FO_MASK   0xF
 
#define NEW_FILENAME_ON_COPY_TRIES   100
 
#define ERROR_SHELL_INTERNAL_FILE_NOT_FOUND   1026
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static DWORD SHNotifyCreateDirectoryW (LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
 
static DWORD SHNotifyRemoveDirectoryW (LPCWSTR path)
 
static DWORD SHNotifyDeleteFileW (FILE_OPERATION *op, LPCWSTR path)
 
static DWORD SHNotifyMoveFileW (FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest, BOOL isdir)
 
static DWORD SHNotifyCopyFileW (FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest, BOOL bFailIfExists)
 
static DWORD SHFindAttrW (LPCWSTR pName, BOOL fileOnly)
 
static HRESULT copy_files (FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, FILE_LIST *flTo)
 
static DWORD move_files (FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, const FILE_LIST *flTo)
 
DWORD WINAPI _FileOpCountManager (FILE_OPERATION *op, const FILE_LIST *flFrom)
 
static BOOL _FileOpCount (FILE_OPERATION *op, LPWSTR pwszBuf, BOOL bFolder, DWORD *ticks)
 
static void confirm_msg_move_button (HWND hDlg, INT iId, INT *xPos, INT yOffset, BOOL bShow)
 
static INT_PTR ConfirmMsgBox_Paint (HWND hDlg)
 
static INT_PTR ConfirmMsgBox_Init (HWND hDlg, LPARAM lParam)
 
static INT_PTR CALLBACK ConfirmMsgBoxProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
int SHELL_ConfirmMsgBox (HWND hWnd, LPWSTR lpszText, LPWSTR lpszCaption, HICON hIcon, BOOL bYesToAll)
 
static BOOL SHELL_ConfirmIDs (int nKindOfDialog, SHELL_ConfirmIDstruc *ids)
 
static BOOL SHELL_ConfirmDialogW (HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
 
BOOL SHELL_ConfirmYesNoW (HWND hWnd, int nKindOfDialog, LPCWSTR szDir)
 
static DWORD SHELL32_AnsiToUnicodeBuf (LPCSTR aPath, LPWSTR *wPath, DWORD minChars)
 
static void SHELL32_FreeUnicodeBuf (LPWSTR wPath)
 
EXTERN_C HRESULT WINAPI SHIsFileAvailableOffline (LPCWSTR path, LPDWORD status)
 
BOOL SHELL_DeleteDirectoryW (FILE_OPERATION *op, LPCWSTR pszDir, BOOL bShowUI)
 
EXTERN_C BOOL WINAPI Win32CreateDirectoryW (LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
 
EXTERN_C BOOL WINAPI Win32RemoveDirectoryW (LPCWSTR path)
 
static void _SetOperationTitle (FILE_OPERATION *op)
 
static void _SetOperationTexts (FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest)
 
DWORD CALLBACK SHCopyProgressRoutine (LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER StreamSize, LARGE_INTEGER StreamBytesTransferred, DWORD dwStreamNumber, DWORD dwCallbackReason, HANDLE hSourceFile, HANDLE hDestinationFile, LPVOID lpData)
 
EXTERN_C DWORD WINAPI Win32DeleteFileW (LPCWSTR path)
 
int WINAPI SHCreateDirectory (HWND hWnd, LPCWSTR path)
 
int WINAPI SHCreateDirectoryExA (HWND hWnd, LPCSTR path, LPSECURITY_ATTRIBUTES sec)
 
int WINAPI SHCreateDirectoryExW (HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
 
static DWORD _ConvertAtoW (PCSTR strSrc, PCWSTR *pStrDest, BOOL isList)
 
int WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)
 
static void __inline grow_list (FILE_LIST *list)
 
static void add_file_to_entry (FILE_ENTRY *feFile, LPCWSTR szFile)
 
static LPWSTR wildcard_to_file (LPCWSTR szWildCard, LPCWSTR szFileName)
 
static void parse_wildcard_files (FILE_LIST *flList, LPCWSTR szFile, LPDWORD pdwListIndex)
 
static HRESULT parse_file_list (FILE_LIST *flList, LPCWSTR szFiles)
 
static void destroy_file_list (FILE_LIST *flList)
 
static CStringW try_find_new_name (LPCWSTR szDestPath)
 
static void copy_dir_to_dir (FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWSTR szDestPath)
 
static BOOL copy_file_to_file (FILE_OPERATION *op, const WCHAR *szFrom, const WCHAR *szTo)
 
static void copy_to_dir (FILE_OPERATION *op, const FILE_ENTRY *feFrom, const FILE_ENTRY *feTo)
 
static void create_dest_dirs (LPCWSTR szDestDir)
 
static BOOL confirm_delete_list (HWND hWnd, DWORD fFlags, BOOL fTrash, const FILE_LIST *flFrom)
 
static HRESULT delete_files (FILE_OPERATION *op, const FILE_LIST *flFrom)
 
static void move_dir_to_dir (FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWSTR szDestPath)
 
static void move_to_dir (FILE_OPERATION *op, const FILE_ENTRY *feFrom, const FILE_ENTRY *feTo)
 
static HRESULT rename_files (FILE_OPERATION *op, const FILE_LIST *flFrom, const FILE_LIST *flTo)
 
static void check_flags (FILEOP_FLAGS fFlags)
 
int WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp)
 
static int CALLBACK _DestroyCallback (void *p, void *pData)
 
void WINAPI SHFreeNameMappings (HANDLE hNameMapping)
 
EXTERN_C DWORD WINAPI SheGetDirA (DWORD drive, LPSTR buffer)
 
EXTERN_C DWORD WINAPI SheGetDirW (DWORD drive, LPWSTR buffer)
 
EXTERN_C DWORD WINAPI SheChangeDirA (LPSTR path)
 
EXTERN_C DWORD WINAPI SheChangeDirW (LPWSTR path)
 
EXTERN_C int WINAPI IsNetDrive (int drive)
 
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 SHPathPrepareForWriteA (HWND hwnd, IUnknown *modless, LPCSTR path, DWORD flags)
 

Macro Definition Documentation

◆ ERROR_SHELL_INTERNAL_FILE_NOT_FOUND

#define ERROR_SHELL_INTERNAL_FILE_NOT_FOUND   1026

Definition at line 50 of file shlfileop.cpp.

◆ FO_MASK

#define FO_MASK   0xF

Definition at line 34 of file shlfileop.cpp.

◆ IsAttrib

#define IsAttrib (   x,
  y 
)    ((INVALID_FILE_ATTRIBUTES != (x)) && ((x) & (y)))

Definition at line 29 of file shlfileop.cpp.

◆ IsAttribDir

#define IsAttribDir (   x)    IsAttrib(x, FILE_ATTRIBUTE_DIRECTORY)

Definition at line 31 of file shlfileop.cpp.

◆ IsAttribFile

#define IsAttribFile (   x)    (!((x) & FILE_ATTRIBUTE_DIRECTORY))

Definition at line 30 of file shlfileop.cpp.

◆ IsDotDir

#define IsDotDir (   x)    ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0))))

Definition at line 32 of file shlfileop.cpp.

◆ NEW_FILENAME_ON_COPY_TRIES

#define NEW_FILENAME_ON_COPY_TRIES   100

Definition at line 36 of file shlfileop.cpp.

Function Documentation

◆ _ConvertAtoW()

static DWORD _ConvertAtoW ( PCSTR  strSrc,
PCWSTR pStrDest,
BOOL  isList 
)
static

Definition at line 984 of file shlfileop.cpp.

985 {
986  *pStrDest = NULL;
987 
988  // If the input is null, nothing to convert.
989  if (!strSrc)
990  return 0;
991 
992  // Measure the total size, depending on if it's a zero-terminated list.
993  int sizeA = 0;
994  if (isList)
995  {
996  PCSTR tmpSrc = strSrc;
997  int size;
998  do
999  {
1000  size = lstrlenA(tmpSrc) + 1;
1001  sizeA += size;
1002  tmpSrc += size;
1003  } while (size != 1);
1004  }
1005  else
1006  {
1007  sizeA = lstrlenA(strSrc) + 1;
1008  }
1009 
1010  // Measure the needed allocation size.
1011  int sizeW = MultiByteToWideChar(CP_ACP, 0, strSrc, sizeA, NULL, 0);
1012  if (!sizeW)
1013  return GetLastError();
1014 
1015  PWSTR strDest = (PWSTR) HeapAlloc(GetProcessHeap(), 0, sizeW * sizeof(WCHAR));
1016  if (!strDest)
1017  return ERROR_OUTOFMEMORY;
1018 
1019  int err = MultiByteToWideChar(CP_ACP, 0, strSrc, sizeA, strDest, sizeW);
1020  if (!err)
1021  {
1022  HeapFree(GetProcessHeap(), 0, strDest);
1023  return GetLastError();
1024  }
1025 
1026  *pStrDest = strDest;
1027  return 0;
1028 }
uint16_t * PWSTR
Definition: typedefs.h:56
#define CP_ACP
Definition: compat.h:109
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
static const WCHAR sizeW[]
Definition: editor.c:79
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define err(...)
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
const char * PCSTR
Definition: typedefs.h:52
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by SHFileOperationA().

◆ _DestroyCallback()

static int CALLBACK _DestroyCallback ( void p,
void pData 
)
static

Definition at line 2047 of file shlfileop.cpp.

2048 {
2050 
2051  SHFree(lp->pszOldPath);
2052  SHFree(lp->pszNewPath);
2053 
2054  return TRUE;
2055 }
#define TRUE
Definition: types.h:120
LPWSTR pszNewPath
Definition: shellapi.h:389
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
LPWSTR pszOldPath
Definition: shellapi.h:388
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by SHFreeNameMappings().

◆ _FileOpCount()

static BOOL _FileOpCount ( FILE_OPERATION op,
LPWSTR  pwszBuf,
BOOL  bFolder,
DWORD ticks 
)
static

Definition at line 2301 of file shlfileop.cpp.

2302 {
2303  /* Find filename position */
2304  UINT cchBuf = wcslen(pwszBuf);
2305  WCHAR *pwszFilename = pwszBuf + cchBuf;
2306  size_t cchFilenameMax = MAX_PATH - cchBuf;
2307  if (!cchFilenameMax)
2308  return FALSE;
2309 
2310  if (bFolder) {
2311  *(pwszFilename++) = '\\';
2312  --cchFilenameMax;
2313  /* Find all files, FIXME: shouldn't be "*"? */
2314  StringCchCopyW(pwszFilename, cchFilenameMax, L"*");
2315  }
2316 
2317  WIN32_FIND_DATAW wfd;
2318  HANDLE hFind = FindFirstFileW(pwszBuf, &wfd);
2319  if (hFind == INVALID_HANDLE_VALUE)
2320  {
2321  ERR("FindFirstFileW %ls failed\n", pwszBuf);
2322  return FALSE;
2323  }
2324 
2325  do
2326  {
2327  if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
2328  {
2329  /* Don't process "." and ".." items */
2330  if (!wcscmp(wfd.cFileName, L".") || !wcscmp(wfd.cFileName, L".."))
2331  continue;
2332 
2333  StringCchCopyW(pwszFilename, cchFilenameMax, wfd.cFileName);
2334  _FileOpCount(op, pwszBuf, TRUE, ticks);
2335  }
2336  else
2337  {
2339  FileSize.u.LowPart = wfd.nFileSizeLow;
2340  FileSize.u.HighPart = wfd.nFileSizeHigh;
2341  op->totalSize.QuadPart += FileSize.QuadPart;
2342  }
2343  if (GetTickCount() - *ticks > (DWORD) 500)
2344  {
2345  // Check if the dialog has ended. If it has, we'll spin down.
2346  if (op->progress != NULL)
2347  op->bCancelled = op->progress->HasUserCancelled();
2348 
2349  if (op->bCancelled)
2350  break;
2351  *ticks = GetTickCount();
2352  }
2353  } while(FindNextFileW(hFind, &wfd));
2354 
2355  FindClose(hFind);
2356  return TRUE;
2357 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
#define TRUE
Definition: types.h:120
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
static BOOL _FileOpCount(FILE_OPERATION *op, LPWSTR pwszBuf, BOOL bFolder, DWORD *ticks)
Definition: shlfileop.cpp:2301
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT op
Definition: effect.c:236
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
#define ERR(fmt,...)
Definition: debug.h:110
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
struct _LARGE_INTEGER::@2237 u
LONGLONG QuadPart
Definition: typedefs.h:114
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by _FileOpCountManager().

◆ _FileOpCountManager()

DWORD WINAPI _FileOpCountManager ( FILE_OPERATION op,
const FILE_LIST flFrom 
)

Definition at line 2283 of file shlfileop.cpp.

2284 {
2285  DWORD ticks = GetTickCount();
2286  FILE_ENTRY *entryToCount;
2287 
2288  for (UINT i = 0; i < from->dwNumFiles; i++)
2289  {
2290  entryToCount = &from->feFiles[i];
2291 
2292  WCHAR theFileName[MAX_PATH];
2293  StringCchCopyW(theFileName, MAX_PATH, entryToCount->szFullPath);
2294  _FileOpCount(op, theFileName, IsAttribDir(entryToCount->attributes), &ticks);
2295  }
2296  return 0;
2297 }
LPWSTR szFullPath
Definition: shlfileop.cpp:57
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
DWORD attributes
Definition: shlfileop.cpp:54
static BOOL _FileOpCount(FILE_OPERATION *op, LPWSTR pwszBuf, BOOL bFolder, DWORD *ticks)
Definition: shlfileop.cpp:2301
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT op
Definition: effect.c:236
Definition: shlfileop.cpp:52
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
CardRegion * from
Definition: spigame.cpp:19

Referenced by SHFileOperationW().

◆ _SetOperationTexts()

static void _SetOperationTexts ( FILE_OPERATION op,
LPCWSTR  src,
LPCWSTR  dest 
)
static

Definition at line 508 of file shlfileop.cpp.

508  {
509  if (op->progress == NULL || src == NULL)
510  return;
511  LPWSTR fileSpecS, pathSpecS, fileSpecD, pathSpecD;
512  WCHAR szFolderS[50], szFolderD[50], szFinalString[260];
513 
514  DWORD_PTR args[2];
515 
516  fileSpecS = (pathSpecS = (LPWSTR) src);
517  fileSpecD = (pathSpecD = (LPWSTR) dest);
518 
519  // March across the string to get the file path and it's parent dir.
520  for (LPWSTR ptr = (LPWSTR) src; *ptr; ptr++) {
521  if (*ptr == '\\') {
522  pathSpecS = fileSpecS;
523  fileSpecS = ptr+1;
524  }
525  }
526  lstrcpynW(szFolderS, pathSpecS, min(50, fileSpecS - pathSpecS));
527  args[0] = (DWORD_PTR) szFolderS;
528 
529  switch (op->req->wFunc)
530  {
531  case FO_COPY:
532  case FO_MOVE:
533  if (dest == NULL)
534  return;
535  for (LPWSTR ptr = (LPWSTR) dest; *ptr; ptr++) {
536  if (*ptr == '\\') {
537  pathSpecD = fileSpecD;
538  fileSpecD = ptr + 1;
539  }
540  }
541  lstrcpynW(szFolderD, pathSpecD, min(50, fileSpecD - pathSpecD));
542  args[1] = (DWORD_PTR) szFolderD;
543  break;
544  case FO_DELETE:
545  break;
546  default:
547  return;
548  }
549 
551  op->szBuilderString, 0, 0, szFinalString, sizeof(szFinalString), (va_list*)args);
552 
553  op->progress->SetLine(1, fileSpecS, false, NULL);
554  op->progress->SetLine(2, szFinalString, false, NULL);
555 }
#define DWORD_PTR
Definition: treelist.c:76
#define FO_COPY
Definition: shellapi.h:134
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:421
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:418
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
Definition: match.c:390
#define lstrcpynW
Definition: compat.h:597
#define FO_MOVE
Definition: shellapi.h:133
static PVOID ptr
Definition: dispmode.c:27
char * va_list
Definition: acmsvcex.h:78
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT op
Definition: effect.c:236
GLenum src
Definition: glext.h:6340
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
static char * dest
Definition: rtl.c:135
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define FO_DELETE
Definition: shellapi.h:135

Referenced by SHNotifyCopyFileW(), SHNotifyDeleteFileW(), and SHNotifyMoveFileW().

◆ _SetOperationTitle()

static void _SetOperationTitle ( FILE_OPERATION op)
static

Definition at line 475 of file shlfileop.cpp.

475  {
476  if (op->progress == NULL)
477  return;
478  WCHAR szTitle[50], szPreflight[50];
479  UINT animation_id = NULL;
480 
481  switch (op->req->wFunc)
482  {
483  case FO_COPY:
485  LoadStringW(shell32_hInstance, IDS_FILEOOP_FROM_TO, op->szBuilderString, sizeof( op->szBuilderString)/sizeof(WCHAR));
486  animation_id = IDA_SHELL_COPY;
487  break;
488  case FO_DELETE:
490  LoadStringW(shell32_hInstance, IDS_FILEOOP_FROM, op->szBuilderString, sizeof( op->szBuilderString)/sizeof(WCHAR));
491  animation_id = IDA_SHELL_DELETE;
492  break;
493  case FO_MOVE:
495  LoadStringW(shell32_hInstance, IDS_FILEOOP_FROM_TO, op->szBuilderString, sizeof( op->szBuilderString)/sizeof(WCHAR));
496  animation_id = IDA_SHELL_COPY;
497  break;
498  default:
499  return;
500  }
501  LoadStringW(shell32_hInstance, IDS_FILEOOP_PREFLIGHT, szPreflight, sizeof(szPreflight)/sizeof(WCHAR));
502 
503  op->progress->SetTitle(szTitle);
504  op->progress->SetLine(1, szPreflight, false, NULL);
505  op->progress->SetAnimation(shell32_hInstance, animation_id);
506 }
#define IDS_FILEOOP_MOVING
Definition: shresdef.h:234
#define IDS_FILEOOP_FROM
Definition: shresdef.h:237
#define FO_COPY
Definition: shellapi.h:134
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define FO_MOVE
Definition: shellapi.h:133
#define IDA_SHELL_DELETE
Definition: shresdef.h:778
#define IDS_FILEOOP_DELETING
Definition: shresdef.h:235
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT op
Definition: effect.c:236
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define IDS_FILEOOP_COPYING
Definition: shresdef.h:233
#define IDA_SHELL_COPY
Definition: shresdef.h:774
#define IDS_FILEOOP_PREFLIGHT
Definition: shresdef.h:238
#define shell32_hInstance
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define FO_DELETE
Definition: shellapi.h:135
#define IDS_FILEOOP_FROM_TO
Definition: shresdef.h:236

Referenced by SHFileOperationW().

◆ add_file_to_entry()

static void add_file_to_entry ( FILE_ENTRY feFile,
LPCWSTR  szFile 
)
static

Definition at line 1114 of file shlfileop.cpp.

1115 {
1116  DWORD dwLen = lstrlenW(szFile) + 1;
1117  LPCWSTR ptr;
1118  LPCWSTR ptr2;
1119 
1120  feFile->szFullPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
1121  lstrcpyW(feFile->szFullPath, szFile);
1122 
1123  ptr = StrRChrW(szFile, NULL, '\\');
1124  ptr2 = StrRChrW(szFile, NULL, '/');
1125  if (!ptr || ptr < ptr2)
1126  ptr = ptr2;
1127  if (ptr)
1128  {
1129  dwLen = ptr - szFile + 1;
1130  feFile->szDirectory = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
1131  lstrcpynW(feFile->szDirectory, szFile, dwLen);
1132 
1133  dwLen = lstrlenW(feFile->szFullPath) - dwLen + 1;
1134  feFile->szFilename = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
1135  lstrcpyW(feFile->szFilename, ptr + 1); /* skip over backslash */
1136  }
1137  feFile->bFromWildcard = FALSE;
1138 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPWSTR szFullPath
Definition: shlfileop.cpp:57
#define lstrlenW
Definition: compat.h:609
#define lstrcpynW
Definition: compat.h:597
#define FALSE
Definition: types.h:117
static PVOID ptr
Definition: dispmode.c:27
LPWSTR szFilename
Definition: shlfileop.cpp:56
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL bFromWildcard
Definition: shlfileop.cpp:58
LPWSTR szDirectory
Definition: shlfileop.cpp:55
#define lstrcpyW
Definition: compat.h:608
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPWSTR WINAPI StrRChrW(LPCWSTR str, LPCWSTR end, WORD ch)
Definition: string.c:556

Referenced by parse_file_list(), and parse_wildcard_files().

◆ check_flags()

static void check_flags ( FILEOP_FLAGS  fFlags)
static

Definition at line 1844 of file shlfileop.cpp.

1845 {
1846  WORD wUnsupportedFlags = FOF_NO_CONNECTED_ELEMENTS |
1848 #ifdef __REACTOS__
1850 #else
1852 #endif
1853 
1854  if (fFlags & wUnsupportedFlags)
1855  FIXME("Unsupported flags: %04x\n", fFlags);
1856 }
#define FOF_NOCOPYSECURITYATTRIBS
Definition: shellapi.h:149
#define FOF_NO_CONNECTED_ELEMENTS
Definition: shellapi.h:151
#define FIXME(fmt,...)
Definition: debug.h:111
#define FOF_WANTMAPPINGHANDLE
Definition: shellapi.h:143
unsigned short WORD
Definition: ntddk_ex.h:93
#define FOF_NORECURSEREPARSE
Definition: shellapi.h:154
#define FOF_RENAMEONCOLLISION
Definition: shellapi.h:141

Referenced by SHFileOperationW().

◆ confirm_delete_list()

static BOOL confirm_delete_list ( HWND  hWnd,
DWORD  fFlags,
BOOL  fTrash,
const FILE_LIST flFrom 
)
static

Definition at line 1573 of file shlfileop.cpp.

1574 {
1575  if (flFrom->dwNumFiles > 1)
1576  {
1577  WCHAR tmp[8];
1578 
1579  wnsprintfW(tmp, sizeof(tmp)/sizeof(tmp[0]), L"%d", flFrom->dwNumFiles);
1581  }
1582  else
1583  {
1584  const FILE_ENTRY *fileEntry = &flFrom->feFiles[0];
1585 
1586  if (IsAttribFile(fileEntry->attributes))
1587  return SHELL_ConfirmDialogW(hWnd, (fTrash?ASK_TRASH_FILE:ASK_DELETE_FILE), fileEntry->szFullPath, NULL);
1588  else if (!(fFlags & FOF_FILESONLY && fileEntry->bFromWildcard))
1590  }
1591  return TRUE;
1592 }
LPWSTR szFullPath
Definition: shlfileop.cpp:57
#define TRUE
Definition: types.h:120
#define ASK_DELETE_FILE
Definition: shell32_main.h:112
#define ASK_TRASH_FILE
Definition: shell32_main.h:118
HWND hWnd
Definition: settings.c:17
#define ASK_TRASH_FOLDER
Definition: shell32_main.h:119
DWORD attributes
Definition: shlfileop.cpp:54
#define ASK_TRASH_MULTIPLE_ITEM
Definition: shell32_main.h:120
#define L(x)
Definition: ntvdm.h:50
DWORD dwNumFiles
Definition: shlfileop.cpp:67
#define ASK_DELETE_FOLDER
Definition: shell32_main.h:113
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ASK_DELETE_MULTIPLE_ITEM
Definition: shell32_main.h:114
#define FOF_FILESONLY
Definition: shellapi.h:145
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
Definition: shlfileop.cpp:293
BOOL bFromWildcard
Definition: shlfileop.cpp:58
int WINAPIV wnsprintfW(LPWSTR lpOut, int cchLimitIn, LPCWSTR lpFmt,...)
Definition: wsprintf.c:564
Definition: shlfileop.cpp:52
#define NULL
Definition: types.h:112
#define IsAttribFile(x)
Definition: shlfileop.cpp:30
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:65

Referenced by delete_files().

◆ confirm_msg_move_button()

static void confirm_msg_move_button ( HWND  hDlg,
INT  iId,
INT xPos,
INT  yOffset,
BOOL  bShow 
)
static

Definition at line 97 of file shlfileop.cpp.

98 {
99  HWND hButton = GetDlgItem(hDlg, iId);
100  RECT r;
101 
102  if (bShow)
103  {
104  POINT pt;
105  int width;
106 
107  GetWindowRect(hButton, &r);
108  width = r.right - r.left;
109  pt.x = r.left;
110  pt.y = r.top;
111  ScreenToClient(hDlg, &pt);
112  MoveWindow(hButton, *xPos - width, pt.y - yOffset, width, r.bottom - r.top, FALSE);
113  *xPos -= width + 5;
114  }
115  else
116  ShowWindow(hButton, SW_HIDE);
117 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define pt(x, y)
Definition: drawing.c:79
#define SW_HIDE
Definition: winuser.h:762
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define FALSE
Definition: types.h:117
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int yOffset
Definition: appswitch.c:59
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by ConfirmMsgBox_Init().

◆ ConfirmMsgBox_Init()

static INT_PTR ConfirmMsgBox_Init ( HWND  hDlg,
LPARAM  lParam 
)
static

Definition at line 144 of file shlfileop.cpp.

145 {
146  struct confirm_msg_info *info = (struct confirm_msg_info *)lParam;
147  INT xPos, yOffset;
148  int width, height;
149  HFONT hOldFont;
150  HDC hdc;
151  RECT r;
152 
153  SetWindowTextW(hDlg, info->lpszCaption);
155  SetPropW(hDlg, L"WINE_CONFIRM", info->lpszText);
157 
158  /* compute the text height and resize the dialog */
160  hdc = GetDC(hDlg);
161  yOffset = r.bottom;
164  SelectObject(hdc, hOldFont);
165  yOffset -= r.bottom;
166  yOffset = min(yOffset, 35); /* don't make the dialog too small */
167  ReleaseDC(hDlg, hdc);
168 
169  GetClientRect(hDlg, &r);
170  xPos = r.right - 7;
171  GetWindowRect(hDlg, &r);
172  width = r.right - r.left;
173  height = r.bottom - r.top - yOffset;
176 
177  confirm_msg_move_button(hDlg, IDCANCEL, &xPos, yOffset, info->bYesToAll);
178  confirm_msg_move_button(hDlg, IDNO, &xPos, yOffset, TRUE);
179  confirm_msg_move_button(hDlg, IDC_YESTOALL, &xPos, yOffset, info->bYesToAll);
180  confirm_msg_move_button(hDlg, IDYES, &xPos, yOffset, TRUE);
181 
182  return TRUE;
183 }
#define STM_SETICON
Definition: winuser.h:2079
GLint GLint GLsizei width
Definition: gl.h:1546
#define IDYES
Definition: winuser.h:829
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define DT_WORDBREAK
Definition: winuser.h:544
static void confirm_msg_move_button(HWND hDlg, INT iId, INT *xPos, INT yOffset, BOOL bShow)
Definition: shlfileop.cpp:97
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define DT_NOPREFIX
Definition: winuser.h:537
int32_t INT
Definition: typedefs.h:58
#define DT_PATH_ELLIPSIS
Definition: winuser.h:530
#define SM_CXSCREEN
Definition: winuser.h:953
#define L(x)
Definition: ntvdm.h:50
#define IDC_YESTOALL_MESSAGE
Definition: shresdef.h:401
#define FALSE
Definition: types.h:117
#define DT_CALCRECT
Definition: winuser.h:526
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_GETFONT
Definition: winuser.h:1638
#define SM_CYSCREEN
Definition: winuser.h:954
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int WINAPI GetSystemMetrics(_In_ int)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HDC hdc
Definition: main.c:9
#define IDC_YESTOALL_ICON
Definition: shresdef.h:400
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define IDC_YESTOALL
Definition: shresdef.h:399
#define min(a, b)
Definition: monoChain.cc:55
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int yOffset
Definition: appswitch.c:59
#define IDNO
Definition: winuser.h:830
#define IDCANCEL
Definition: winuser.h:825
LPARAM lParam
Definition: combotst.c:139
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by ConfirmMsgBoxProc().

◆ ConfirmMsgBox_Paint()

static INT_PTR ConfirmMsgBox_Paint ( HWND  hDlg)
static

Definition at line 122 of file shlfileop.cpp.

123 {
124  PAINTSTRUCT ps;
125  HFONT hOldFont;
126  RECT r;
127  HDC hdc;
128 
129  BeginPaint(hDlg, &ps);
130  hdc = ps.hdc;
132 
134  /* this will remap the rect to dialog coords */
137  DrawTextW(hdc, (LPWSTR)GetPropW(hDlg, L"WINE_CONFIRM"), -1, &r, DT_NOPREFIX | DT_PATH_ELLIPSIS | DT_WORDBREAK);
138  SelectObject(hdc, hOldFont);
139  EndPaint(hDlg, &ps);
140 
141  return TRUE;
142 }
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define DT_WORDBREAK
Definition: winuser.h:544
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define DT_NOPREFIX
Definition: winuser.h:537
#define DT_PATH_ELLIPSIS
Definition: winuser.h:530
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define L(x)
Definition: ntvdm.h:50
#define IDC_YESTOALL_MESSAGE
Definition: shresdef.h:401
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define TRANSPARENT
Definition: wingdi.h:950
#define WM_GETFONT
Definition: winuser.h:1638
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HDC hdc
Definition: main.c:9
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by ConfirmMsgBoxProc().

◆ ConfirmMsgBoxProc()

static INT_PTR CALLBACK ConfirmMsgBoxProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 185 of file shlfileop.cpp.

186 {
187  switch (uMsg)
188  {
189  case WM_INITDIALOG:
190  return ConfirmMsgBox_Init(hDlg, lParam);
191  case WM_PAINT:
192  return ConfirmMsgBox_Paint(hDlg);
193  case WM_COMMAND:
194  EndDialog(hDlg, wParam);
195  break;
196  case WM_CLOSE:
197  EndDialog(hDlg, IDCANCEL);
198  break;
199  }
200  return FALSE;
201 }
static INT_PTR ConfirmMsgBox_Paint(HWND hDlg)
Definition: shlfileop.cpp:122
static INT_PTR ConfirmMsgBox_Init(HWND hDlg, LPARAM lParam)
Definition: shlfileop.cpp:144
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define FALSE
Definition: types.h:117
#define WM_CLOSE
Definition: winuser.h:1608
#define WM_PAINT
Definition: winuser.h:1607
#define WM_COMMAND
Definition: winuser.h:1727
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139

Referenced by SHELL_ConfirmMsgBox().

◆ copy_dir_to_dir()

static void copy_dir_to_dir ( FILE_OPERATION op,
const FILE_ENTRY feFrom,
LPCWSTR  szDestPath 
)
static

Definition at line 1311 of file shlfileop.cpp.

1312 {
1313  WCHAR szFrom[MAX_PATH], szTo[MAX_PATH];
1314  FILE_LIST flFromNew, flToNew;
1315 
1316  if (IsDotDir(feFrom->szFilename))
1317  return;
1318 
1319  if (PathFileExistsW(szDestPath))
1320  PathCombineW(szTo, szDestPath, feFrom->szFilename);
1321  else
1322  lstrcpyW(szTo, szDestPath);
1323 
1324 #ifdef __REACTOS__
1325  if (PathFileExistsW(szTo))
1326  {
1327  if (op->req->fFlags & FOF_RENAMEONCOLLISION)
1328  {
1329  CStringW newPath = try_find_new_name(szTo);
1330  if (!newPath.IsEmpty())
1331  {
1332  StringCchCopyW(szTo, _countof(szTo), newPath);
1333  }
1334  }
1335  else if (!(op->req->fFlags & FOF_NOCONFIRMATION))
1336 #else
1337  if (!(op->req->fFlags & FOF_NOCONFIRMATION) && PathFileExistsW(szTo))
1338  {
1339  CStringW newPath;
1340  if (lstrcmp(feFrom->szDirectory, szDestPath) == 0 && !(newPath = try_find_new_name(szTo)).IsEmpty())
1341  {
1342  StringCchCopyW(szTo, _countof(szTo), newPath);
1343  }
1344  else
1345 #endif
1346  {
1347  if (!SHELL_ConfirmDialogW(op->req->hwnd, ASK_OVERWRITE_FOLDER, feFrom->szFilename, op))
1348  {
1349  /* Vista returns an ERROR_CANCELLED even if user pressed "No" */
1350  if (!op->bManyItems)
1351  op->bCancelled = TRUE;
1352  return;
1353  }
1354  }
1355  }
1356 
1357  szTo[lstrlenW(szTo) + 1] = '\0';
1359 
1360  PathCombineW(szFrom, feFrom->szFullPath, L"*.*");
1361  szFrom[lstrlenW(szFrom) + 1] = '\0';
1362 
1363  ZeroMemory(&flFromNew, sizeof(FILE_LIST));
1364  ZeroMemory(&flToNew, sizeof(FILE_LIST));
1365  parse_file_list(&flFromNew, szFrom);
1366  parse_file_list(&flToNew, szTo);
1367 
1368  copy_files(op, FALSE, &flFromNew, &flToNew);
1369 
1370  destroy_file_list(&flFromNew);
1371  destroy_file_list(&flToNew);
1372 }
static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles)
Definition: shlfileop.cpp:1196
LPWSTR szFullPath
Definition: shlfileop.cpp:57
#define TRUE
Definition: types.h:120
static CStringW try_find_new_name(LPCWSTR szDestPath)
Definition: shlfileop.cpp:1283
#define ZeroMemory
Definition: winbase.h:1664
static HRESULT copy_files(FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, FILE_LIST *flTo)
Definition: shlfileop.cpp:1446
#define lstrlenW
Definition: compat.h:609
#define L(x)
Definition: ntvdm.h:50
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:416
#define FALSE
Definition: types.h:117
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
static void destroy_file_list(FILE_LIST *flList)
Definition: shlfileop.cpp:1266
#define FOF_NOCONFIRMATION
Definition: shellapi.h:142
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
LPWSTR szFilename
Definition: shlfileop.cpp:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
UINT op
Definition: effect.c:236
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
Definition: shlfileop.cpp:293
#define lstrcmp
Definition: winbase.h:3730
LPWSTR szDirectory
Definition: shlfileop.cpp:55
#define FOF_RENAMEONCOLLISION
Definition: shellapi.h:141
bool IsEmpty() const
Definition: atlsimpstr.h:379
#define lstrcpyW
Definition: compat.h:608
#define NULL
Definition: types.h:112
#define ASK_OVERWRITE_FOLDER
Definition: shell32_main.h:122
#define IsDotDir(x)
Definition: shlfileop.cpp:32
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194

Referenced by copy_files(), and copy_to_dir().

◆ copy_file_to_file()

static BOOL copy_file_to_file ( FILE_OPERATION op,
const WCHAR szFrom,
const WCHAR szTo 
)
static

Definition at line 1374 of file shlfileop.cpp.

1375 {
1376 #ifdef __REACTOS__
1377  if (PathFileExistsW(szTo))
1378  {
1379  if (op->req->fFlags & FOF_RENAMEONCOLLISION)
1380  {
1381  CStringW newPath = try_find_new_name(szTo);
1382  if (!newPath.IsEmpty())
1383  {
1384  return SHNotifyCopyFileW(op, szFrom, newPath, FALSE) == 0;
1385  }
1386  }
1387  else if (!(op->req->fFlags & FOF_NOCONFIRMATION))
1388  {
1390  return FALSE;
1391  }
1392 #else
1393  if (!(op->req->fFlags & FOF_NOCONFIRMATION) && PathFileExistsW(szTo))
1394  {
1395  CStringW newPath;
1396  if (lstrcmp(szFrom, szTo) == 0 && !(newPath = try_find_new_name(szTo)).IsEmpty())
1397  {
1398  return SHNotifyCopyFileW(op, szFrom, newPath, FALSE) == 0;
1399  }
1400 
1402  return FALSE;
1403 #endif
1404  }
1405 
1406  return SHNotifyCopyFileW(op, szFrom, szTo, FALSE) == 0;
1407 }
static CStringW try_find_new_name(LPCWSTR szDestPath)
Definition: shlfileop.cpp:1283
#define FALSE
Definition: types.h:117
#define FOF_NOCONFIRMATION
Definition: shellapi.h:142
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
UINT op
Definition: effect.c:236
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
Definition: shlfileop.cpp:293
static DWORD SHNotifyCopyFileW(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest, BOOL bFailIfExists)
Definition: shlfileop.cpp:772
#define ASK_OVERWRITE_FILE
Definition: shell32_main.h:116
#define lstrcmp
Definition: winbase.h:3730
#define FOF_RENAMEONCOLLISION
Definition: shellapi.h:141
bool IsEmpty() const
Definition: atlsimpstr.h:379

Referenced by copy_files(), and copy_to_dir().

◆ copy_files()

static HRESULT copy_files ( FILE_OPERATION op,
BOOL  multiDest,
const FILE_LIST flFrom,
FILE_LIST flTo 
)
static

Definition at line 1446 of file shlfileop.cpp.

1447 {
1448  DWORD i;
1449  const FILE_ENTRY *entryToCopy;
1450  const FILE_ENTRY *fileDest = &flTo->feFiles[0];
1451 
1452  if (flFrom->bAnyDontExist)
1454 
1455  if (flTo->dwNumFiles == 0)
1456  {
1457  /* If the destination is empty, SHFileOperation should use the current directory */
1458  WCHAR curdir[MAX_PATH+1];
1459 
1460  GetCurrentDirectoryW(MAX_PATH, curdir);
1461  curdir[lstrlenW(curdir)+1] = 0;
1462 
1463  destroy_file_list(flTo);
1464  ZeroMemory(flTo, sizeof(FILE_LIST));
1465  parse_file_list(flTo, curdir);
1466  fileDest = &flTo->feFiles[0];
1467  }
1468 
1469  if (multiDest)
1470  {
1471  if (flFrom->bAnyFromWildcard)
1472  return ERROR_CANCELLED;
1473 
1474  if (flFrom->dwNumFiles != flTo->dwNumFiles)
1475  {
1476  if (flFrom->dwNumFiles != 1 && !IsAttribDir(fileDest->attributes))
1477  return ERROR_CANCELLED;
1478 
1479  /* Free all but the first entry. */
1480  for (i = 1; i < flTo->dwNumFiles; i++)
1481  {
1483  HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFilename);
1484  HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFullPath);
1485  }
1486 
1487  flTo->dwNumFiles = 1;
1488  }
1489  else if (IsAttribDir(fileDest->attributes))
1490  {
1491  for (i = 1; i < flTo->dwNumFiles; i++)
1492  if (!IsAttribDir(flTo->feFiles[i].attributes) ||
1493  !IsAttribDir(flFrom->feFiles[i].attributes))
1494  {
1495  return ERROR_CANCELLED;
1496  }
1497  }
1498  }
1499  else if (flFrom->dwNumFiles != 1)
1500  {
1501  if (flTo->dwNumFiles != 1 && !IsAttribDir(fileDest->attributes))
1502  return ERROR_CANCELLED;
1503 
1504  if (PathFileExistsW(fileDest->szFullPath) &&
1505  IsAttribFile(fileDest->attributes))
1506  {
1507  return ERROR_CANCELLED;
1508  }
1509 
1510  if (flTo->dwNumFiles == 1 && fileDest->bFromRelative &&
1511  !PathFileExistsW(fileDest->szFullPath))
1512  {
1513  return ERROR_CANCELLED;
1514  }
1515  }
1516 
1517  for (i = 0; i < flFrom->dwNumFiles; i++)
1518  {
1519  entryToCopy = &flFrom->feFiles[i];
1520 
1521  if ((multiDest) &&
1522  flTo->dwNumFiles > 1)
1523  {
1524  fileDest = &flTo->feFiles[i];
1525  }
1526 
1527  if (IsAttribDir(entryToCopy->attributes) &&
1528  !lstrcmpiW(entryToCopy->szFullPath, fileDest->szDirectory))
1529  {
1530  return ERROR_SUCCESS;
1531  }
1532 
1533  create_dest_dirs(fileDest->szDirectory);
1534 
1535  if (!lstrcmpiW(entryToCopy->szFullPath, fileDest->szFullPath))
1536  {
1537  if (IsAttribFile(entryToCopy->attributes))
1539  else
1540  return ERROR_SUCCESS;
1541  }
1542 
1543  if ((flFrom->dwNumFiles > 1 && flTo->dwNumFiles == 1) ||
1544  IsAttribDir(fileDest->attributes))
1545  {
1546  copy_to_dir(op, entryToCopy, fileDest);
1547  }
1548  else if (IsAttribDir(entryToCopy->attributes))
1549  {
1550  copy_dir_to_dir(op, entryToCopy, fileDest->szFullPath);
1551  }
1552  else
1553  {
1554  if (!copy_file_to_file(op, entryToCopy->szFullPath, fileDest->szFullPath))
1555  {
1556  op->req->fAnyOperationsAborted = TRUE;
1557  return ERROR_CANCELLED;
1558  }
1559  }
1560 
1561  if (op->progress != NULL)
1562  op->bCancelled |= op->progress->HasUserCancelled();
1563  /* Vista return code. XP would return e.g. ERROR_FILE_NOT_FOUND, ERROR_ALREADY_EXISTS */
1564  if (op->bCancelled)
1565  return ERROR_CANCELLED;
1566  }
1567 
1568  /* Vista return code. On XP if the used pressed "No" for the last item,
1569  * ERROR_ARENA_TRASHED would be returned */
1570  return ERROR_SUCCESS;
1571 }
static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles)
Definition: shlfileop.cpp:1196
#define ERROR_SUCCESS
Definition: deptool.c:10
LPWSTR szFullPath
Definition: shlfileop.cpp:57
#define TRUE
Definition: types.h:120
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
#define ERROR_NO_MORE_SEARCH_HANDLES
Definition: winerror.h:187
BOOL bAnyFromWildcard
Definition: shlfileop.cpp:68
#define ZeroMemory
Definition: winbase.h:1664
DWORD attributes
Definition: shlfileop.cpp:54
BOOL bFromRelative
Definition: shlfileop.cpp:59
#define lstrlenW
Definition: compat.h:609
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
DWORD dwNumFiles
Definition: shlfileop.cpp:67
static void destroy_file_list(FILE_LIST *flList)
Definition: shlfileop.cpp:1266
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
static void copy_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, const FILE_ENTRY *feTo)
Definition: shlfileop.cpp:1410
LPWSTR szFilename
Definition: shlfileop.cpp:56
#define GetProcessHeap()
Definition: compat.h:595
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT op
Definition: effect.c:236
static BOOL copy_file_to_file(FILE_OPERATION *op, const WCHAR *szFrom, const WCHAR *szTo)
Definition: shlfileop.cpp:1374
static void create_dest_dirs(LPCWSTR szDestDir)
Definition: shlfileop.cpp:1426
Definition: shlfileop.cpp:52
LPWSTR szDirectory
Definition: shlfileop.cpp:55
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ERROR_CANCELLED
Definition: winerror.h:726
#define NULL
Definition: types.h:112
#define ERROR_SHELL_INTERNAL_FILE_NOT_FOUND
Definition: shlfileop.cpp:50
#define IsAttribFile(x)
Definition: shlfileop.cpp:30
static void copy_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWSTR szDestPath)
Definition: shlfileop.cpp:1311
#define HeapFree(x, y, z)
Definition: compat.h:594
BOOL bAnyDontExist
Definition: shlfileop.cpp:70
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:65

Referenced by copy_dir_to_dir(), and SHFileOperationW().

◆ copy_to_dir()

static void copy_to_dir ( FILE_OPERATION op,
const FILE_ENTRY feFrom,
const FILE_ENTRY feTo 
)
static

Definition at line 1410 of file shlfileop.cpp.

1411 {
1412  if (!PathFileExistsW(feTo->szFullPath))
1414 
1415  if (IsAttribFile(feFrom->attributes))
1416  {
1417  WCHAR szDestPath[MAX_PATH];
1418 
1419  PathCombineW(szDestPath, feTo->szFullPath, feFrom->szFilename);
1420  copy_file_to_file(op, feFrom->szFullPath, szDestPath);
1421  }
1422  else if (!(op->req->fFlags & FOF_FILESONLY && feFrom->bFromWildcard))
1423  copy_dir_to_dir(op, feFrom, feTo->szFullPath);
1424 }
LPWSTR szFullPath
Definition: shlfileop.cpp:57
DWORD attributes
Definition: shlfileop.cpp:54
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:416
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
LPWSTR szFilename
Definition: shlfileop.cpp:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define FOF_FILESONLY
Definition: shellapi.h:145
#define MAX_PATH
Definition: compat.h:34
UINT op
Definition: effect.c:236
static BOOL copy_file_to_file(FILE_OPERATION *op, const WCHAR *szFrom, const WCHAR *szTo)
Definition: shlfileop.cpp:1374
BOOL bFromWildcard
Definition: shlfileop.cpp:58
#define NULL
Definition: types.h:112
#define IsAttribFile(x)
Definition: shlfileop.cpp:30
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194
static void copy_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWSTR szDestPath)
Definition: shlfileop.cpp:1311

Referenced by copy_files().

◆ create_dest_dirs()

static void create_dest_dirs ( LPCWSTR  szDestDir)
static

Definition at line 1426 of file shlfileop.cpp.

1427 {
1428  WCHAR dir[MAX_PATH];
1429  LPCWSTR ptr = StrChrW(szDestDir, '\\');
1430 
1431  /* make sure all directories up to last one are created */
1432  while (ptr && (ptr = StrChrW(ptr + 1, '\\')))
1433  {
1434  lstrcpynW(dir, szDestDir, ptr - szDestDir + 1);
1435 
1436  if (!PathFileExistsW(dir))
1438  }
1439 
1440  /* create last directory */
1441  if (!PathFileExistsW(szDestDir))
1442  SHNotifyCreateDirectoryW(szDestDir, NULL);
1443 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define lstrcpynW
Definition: compat.h:597
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:416
static PVOID ptr
Definition: dispmode.c:27
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
unsigned int dir
Definition: maze.c:112
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468
#define NULL
Definition: types.h:112

Referenced by copy_files(), and move_files().

◆ delete_files()

static HRESULT delete_files ( FILE_OPERATION op,
const FILE_LIST flFrom 
)
static

Definition at line 1595 of file shlfileop.cpp.

1596 {
1597  const FILE_ENTRY *fileEntry;
1598  DWORD i;
1599  BOOL bPathExists;
1600  BOOL bTrash;
1601 
1602  if (!flFrom->dwNumFiles)
1603  return ERROR_SUCCESS;
1604 
1605  /* Windows also checks only the first item */
1606  bTrash = (op->req->fFlags & FOF_ALLOWUNDO)
1607  && TRASH_CanTrashFile(flFrom->feFiles[0].szFullPath);
1608 
1609  if (!(op->req->fFlags & FOF_NOCONFIRMATION) || (!bTrash && op->req->fFlags & FOF_WANTNUKEWARNING))
1610  if (!confirm_delete_list(op->req->hwnd, op->req->fFlags, bTrash, flFrom))
1611  {
1612  op->req->fAnyOperationsAborted = TRUE;
1613  return 0;
1614  }
1615 
1616  /* Check files. Do not delete one if one file does not exists */
1617  for (i = 0; i < flFrom->dwNumFiles; i++)
1618  {
1619  fileEntry = &flFrom->feFiles[i];
1620 
1621  if (fileEntry->attributes == (ULONG)-1)
1622  {
1623  // This is a windows 2003 server specific value which has been removed.
1624  // Later versions of windows return ERROR_FILE_NOT_FOUND.
1626  }
1627  }
1628 
1629  for (i = 0; i < flFrom->dwNumFiles; i++)
1630  {
1631  bPathExists = TRUE;
1632  fileEntry = &flFrom->feFiles[i];
1633 
1634  if (!IsAttribFile(fileEntry->attributes) &&
1635  (op->req->fFlags & FOF_FILESONLY && fileEntry->bFromWildcard))
1636  continue;
1637 
1638  if (bTrash)
1639  {
1640  BOOL bDelete;
1641  if (TRASH_TrashFile(fileEntry->szFullPath))
1642  {
1644  continue;
1645  }
1646 
1647  /* Note: Windows silently deletes the file in such a situation, we show a dialog */
1648  if (!(op->req->fFlags & FOF_NOCONFIRMATION) || (op->req->fFlags & FOF_WANTNUKEWARNING))
1649  bDelete = SHELL_ConfirmDialogW(op->req->hwnd, ASK_CANT_TRASH_ITEM, fileEntry->szFullPath, NULL);
1650  else
1651  bDelete = TRUE;
1652 
1653  if (!bDelete)
1654  {
1655  op->req->fAnyOperationsAborted = TRUE;
1656  break;
1657  }
1658  }
1659 
1660  /* delete the file or directory */
1661  if (IsAttribFile(fileEntry->attributes))
1662  {
1663  bPathExists = (ERROR_SUCCESS == SHNotifyDeleteFileW(op, fileEntry->szFullPath));
1664  }
1665  else
1666  bPathExists = SHELL_DeleteDirectoryW(op, fileEntry->szFullPath, FALSE);
1667 
1668  if (!bPathExists)
1669  {
1670  DWORD err = GetLastError();
1671 
1672  if (ERROR_FILE_NOT_FOUND == err)
1673  {
1674  // This is a windows 2003 server specific value which ahs been removed.
1675  // Later versions of windows return ERROR_FILE_NOT_FOUND.
1677  }
1678  else
1679  {
1680  return err;
1681  }
1682  }
1683 
1684  if (op->progress != NULL)
1685  op->bCancelled |= op->progress->HasUserCancelled();
1686  /* Should fire on progress dialog only */
1687  if (op->bCancelled)
1688  return ERROR_CANCELLED;
1689  }
1690 
1691  return ERROR_SUCCESS;
1692 }
#define ASK_CANT_TRASH_ITEM
Definition: shell32_main.h:121
#define ERROR_SUCCESS
Definition: deptool.c:10
LPWSTR szFullPath
Definition: shlfileop.cpp:57
#define TRUE
Definition: types.h:120
#define FOF_ALLOWUNDO
Definition: shellapi.h:144
#define FOF_WANTNUKEWARNING
Definition: shellapi.h:152
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
DWORD attributes
Definition: shlfileop.cpp:54
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD dwNumFiles
Definition: shlfileop.cpp:67
#define FOF_NOCONFIRMATION
Definition: shellapi.h:142
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define FOF_FILESONLY
Definition: shellapi.h:145
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT op
Definition: effect.c:236
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
Definition: shlfileop.cpp:293
BOOL bFromWildcard
Definition: shlfileop.cpp:58
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
#define err(...)
static DWORD SHNotifyDeleteFileW(FILE_OPERATION *op, LPCWSTR path)
Definition: shlfileop.cpp:605
Definition: shlfileop.cpp:52
#define SHCNF_PATHW
Definition: shlobj.h:1764
static BOOL confirm_delete_list(HWND hWnd, DWORD fFlags, BOOL fTrash, const FILE_LIST *flFrom)
Definition: shlfileop.cpp:1573
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ERROR_CANCELLED
Definition: winerror.h:726
#define SHCNE_DELETE
Definition: shlobj.h:1731
BOOL TRASH_TrashFile(LPCWSTR wszPath)
#define NULL
Definition: types.h:112
BOOL SHELL_DeleteDirectoryW(FILE_OPERATION *op, LPCWSTR pszDir, BOOL bShowUI)
Definition: shlfileop.cpp:369
#define ERROR_SHELL_INTERNAL_FILE_NOT_FOUND
Definition: shlfileop.cpp:50
unsigned int ULONG
Definition: retypes.h:1
BOOL TRASH_CanTrashFile(LPCWSTR wszPath)
#define IsAttribFile(x)
Definition: shlfileop.cpp:30
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:65

Referenced by SHFileOperationW().

◆ destroy_file_list()

static void destroy_file_list ( FILE_LIST flList)
static

Definition at line 1266 of file shlfileop.cpp.

1267 {
1268  DWORD i;
1269 
1270  if (!flList || !flList->feFiles)
1271  return;
1272 
1273  for (i = 0; i < flList->dwNumFiles; i++)
1274  {
1275  HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szDirectory);
1276  HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szFilename);
1277  HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szFullPath);
1278  }
1279 
1280  HeapFree(GetProcessHeap(), 0, flList->feFiles);
1281 }
LPWSTR szFullPath
Definition: shlfileop.cpp:57
DWORD dwNumFiles
Definition: shlfileop.cpp:67
LPWSTR szFilename
Definition: shlfileop.cpp:56
#define GetProcessHeap()
Definition: compat.h:595
unsigned long DWORD
Definition: ntddk_ex.h:95
LPWSTR szDirectory
Definition: shlfileop.cpp:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define HeapFree(x, y, z)
Definition: compat.h:594
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:65

Referenced by copy_dir_to_dir(), copy_files(), move_dir_to_dir(), and SHFileOperationW().

◆ grow_list()

static void __inline grow_list ( FILE_LIST list)
static

Definition at line 1104 of file shlfileop.cpp.

1105 {
1107  list->num_alloc * 2 * sizeof(*newx) );
1108  list->feFiles = newx;
1109  list->num_alloc *= 2;
1110 }
#define GetProcessHeap()
Definition: compat.h:595
Definition: shlfileop.cpp:52
#define HeapReAlloc
Definition: compat.h:593
#define list
Definition: rosglue.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

Referenced by parse_file_list(), and parse_wildcard_files().

◆ IsNetDrive()

EXTERN_C int WINAPI IsNetDrive ( int  drive)

Definition at line 2183 of file shlfileop.cpp.

2184 {
2185  char root[4];
2186  strcpy(root, "A:\\");
2187  root[0] += (char)drive;
2188  return (GetDriveTypeA(root) == DRIVE_REMOTE);
2189 }
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
#define DRIVE_REMOTE
Definition: winbase.h:250
unsigned char
Definition: typeof.h:29
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by PathIsNetworkPathA(), and PathIsNetworkPathW().

◆ move_dir_to_dir()

static void move_dir_to_dir ( FILE_OPERATION op,
const FILE_ENTRY feFrom,
LPCWSTR  szDestPath 
)
static

Definition at line 1694 of file shlfileop.cpp.

1695 {
1696  WCHAR szFrom[MAX_PATH], szTo[MAX_PATH];
1697  FILE_LIST flFromNew, flToNew;
1698 
1699  if (IsDotDir(feFrom->szFilename))
1700  return;
1701 
1702  SHNotifyCreateDirectoryW(szDestPath, NULL);
1703 
1704  PathCombineW(szFrom, feFrom->szFullPath, L"*.*");
1705  szFrom[lstrlenW(szFrom) + 1] = '\0';
1706 
1707  lstrcpyW(szTo, szDestPath);
1708  szTo[lstrlenW(szDestPath) + 1] = '\0';
1709 
1710  ZeroMemory(&flFromNew, sizeof(FILE_LIST));
1711  ZeroMemory(&flToNew, sizeof(FILE_LIST));
1712  parse_file_list(&flFromNew, szFrom);
1713  parse_file_list(&flToNew, szTo);
1714 
1715  move_files(op, FALSE, &flFromNew, &flToNew);
1716 
1717  destroy_file_list(&flFromNew);
1718  destroy_file_list(&flToNew);
1719 
1720  if (PathIsDirectoryEmptyW(feFrom->szFullPath))
1722 }
static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles)
Definition: shlfileop.cpp:1196
LPWSTR szFullPath
Definition: shlfileop.cpp:57
#define ZeroMemory
Definition: winbase.h:1664
#define lstrlenW
Definition: compat.h:609
#define L(x)
Definition: ntvdm.h:50
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:416
#define FALSE
Definition: types.h:117
EXTERN_C BOOL WINAPI Win32RemoveDirectoryW(LPCWSTR path)
Definition: shlfileop.cpp:470
static void destroy_file_list(FILE_LIST *flList)
Definition: shlfileop.cpp:1266
static DWORD move_files(FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, const FILE_LIST *flTo)
Definition: shlfileop.cpp:1738
LPWSTR szFilename
Definition: shlfileop.cpp:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
UINT op
Definition: effect.c:236
BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath)
Definition: path.c:3930
#define lstrcpyW
Definition: compat.h:608
#define NULL
Definition: types.h:112
#define IsDotDir(x)
Definition: shlfileop.cpp:32
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194

Referenced by move_to_dir().

◆ move_files()

static DWORD move_files ( FILE_OPERATION op,
BOOL  multiDest,
const FILE_LIST flFrom,
const FILE_LIST flTo 
)
static

Definition at line 1738 of file shlfileop.cpp.

1739 {
1740  DWORD i;
1741  INT mismatched = 0;
1742 
1743  const FILE_ENTRY *entryToMove;
1744  const FILE_ENTRY *fileDest;
1745 
1746  if (!flFrom->dwNumFiles)
1747  return ERROR_SUCCESS;
1748 
1749  if (!flTo->dwNumFiles)
1750  return ERROR_FILE_NOT_FOUND;
1751 
1752  if (!(multiDest) &&
1753  flTo->dwNumFiles > 1 && flFrom->dwNumFiles > 1)
1754  {
1755  return ERROR_CANCELLED;
1756  }
1757 
1758  if (!(multiDest) &&
1759  !flFrom->bAnyDirectories &&
1760  flFrom->dwNumFiles > flTo->dwNumFiles &&
1761  !(flTo->bAnyDirectories && flTo->dwNumFiles == 1))
1762  {
1763  return ERROR_CANCELLED;
1764  }
1765 
1766  if (!PathFileExistsW(flTo->feFiles[0].szDirectory))
1767  return ERROR_CANCELLED;
1768 
1769  if (multiDest)
1770  mismatched = flFrom->dwNumFiles - flTo->dwNumFiles;
1771 
1772  fileDest = &flTo->feFiles[0];
1773  for (i = 0; i < flFrom->dwNumFiles; i++)
1774  {
1775  entryToMove = &flFrom->feFiles[i];
1776 
1777  if (!PathFileExistsW(fileDest->szDirectory))
1778  return ERROR_CANCELLED;
1779 
1780  if (multiDest)
1781  {
1782  if (i >= flTo->dwNumFiles)
1783  break;
1784  fileDest = &flTo->feFiles[i];
1785  if (mismatched && !fileDest->bExists)
1786  {
1788  flTo->feFiles[i].bExists = TRUE;
1790  }
1791  }
1792 
1793  if (fileDest->bExists && IsAttribDir(fileDest->attributes))
1794  move_to_dir(op, entryToMove, fileDest);
1795  else
1796  SHNotifyMoveFileW(op, entryToMove->szFullPath, fileDest->szFullPath, IsAttribDir(entryToMove->attributes));
1797 
1798  if (op->progress != NULL)
1799  op->bCancelled |= op->progress->HasUserCancelled();
1800  /* Should fire on progress dialog only */
1801  if (op->bCancelled)
1802  return ERROR_CANCELLED;
1803 
1804  }
1805 
1806  if (mismatched > 0)
1807  {
1808  if (flFrom->bAnyDirectories)
1809  return DE_DESTSAMETREE;
1810  else
1811  return DE_SAMEFILE;
1812  }
1813 
1814  return ERROR_SUCCESS;
1815 }
#define ERROR_SUCCESS
Definition: deptool.c:10
LPWSTR szFullPath
Definition: shlfileop.cpp:57
#define TRUE
Definition: types.h:120
DWORD attributes
Definition: shlfileop.cpp:54
static DWORD SHNotifyMoveFileW(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest, BOOL isdir)
Definition: shlfileop.cpp:716
int32_t INT
Definition: typedefs.h:58
BOOL bExists
Definition: shlfileop.cpp:60
BOOL bAnyDirectories
Definition: shlfileop.cpp:69
DWORD dwNumFiles
Definition: shlfileop.cpp:67
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT op
Definition: effect.c:236
#define DE_DESTSAMETREE
Definition: shlfileop.c:48
static void create_dest_dirs(LPCWSTR szDestDir)
Definition: shlfileop.cpp:1426
Definition: shlfileop.cpp:52
LPWSTR szDirectory
Definition: shlfileop.cpp:55
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ERROR_CANCELLED
Definition: winerror.h:726
#define NULL
Definition: types.h:112
#define DE_SAMEFILE
Definition: shlfileop.c:42
static void move_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, const FILE_ENTRY *feTo)
Definition: shlfileop.cpp:1725
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:65

Referenced by move_dir_to_dir(), and SHFileOperationW().

◆ move_to_dir()

static void move_to_dir ( FILE_OPERATION op,
const FILE_ENTRY feFrom,
const FILE_ENTRY feTo 
)
static

Definition at line 1725 of file shlfileop.cpp.

1726 {
1727  WCHAR szDestPath[MAX_PATH];
1728 
1729  PathCombineW(szDestPath, feTo->szFullPath, feFrom->szFilename);
1730 
1731  if (IsAttribFile(feFrom->attributes))
1732  SHNotifyMoveFileW(op, feFrom->szFullPath, szDestPath, FALSE);
1733  else if (!(op->req->fFlags & FOF_FILESONLY && feFrom->bFromWildcard))
1734  move_dir_to_dir(op, feFrom, szDestPath);
1735 }
LPWSTR szFullPath
Definition: shlfileop.cpp:57
DWORD attributes
Definition: shlfileop.cpp:54
static DWORD SHNotifyMoveFileW(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest, BOOL isdir)
Definition: shlfileop.cpp:716
#define FALSE
Definition: types.h:117
LPWSTR szFilename
Definition: shlfileop.cpp:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define FOF_FILESONLY
Definition: shellapi.h:145
#define MAX_PATH
Definition: compat.h:34
UINT op
Definition: effect.c:236
BOOL bFromWildcard
Definition: shlfileop.cpp:58
static void move_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWSTR szDestPath)
Definition: shlfileop.cpp:1694
#define IsAttribFile(x)
Definition: shlfileop.cpp:30
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194

Referenced by move_files().

◆ parse_file_list()

static HRESULT parse_file_list ( FILE_LIST flList,
LPCWSTR  szFiles 
)
static

Definition at line 1196 of file shlfileop.cpp.

1197 {
1198  LPCWSTR ptr = szFiles;
1199  WCHAR szCurFile[MAX_PATH];
1200  DWORD i = 0;
1201 
1202  if (!szFiles)
1203  return ERROR_INVALID_PARAMETER;
1204 
1205  flList->bAnyFromWildcard = FALSE;
1206  flList->bAnyDirectories = FALSE;
1207  flList->bAnyDontExist = FALSE;
1208  flList->num_alloc = 32;
1209  flList->dwNumFiles = 0;
1210 
1211  /* empty list */
1212  if (!szFiles[0])
1213  return ERROR_ACCESS_DENIED;
1214 
1216  flList->num_alloc * sizeof(FILE_ENTRY));
1217 
1218  while (*ptr)
1219  {
1220  if (i >= flList->num_alloc) grow_list( flList );
1221 
1222  /* change relative to absolute path */
1223  if (PathIsRelativeW(ptr))
1224  {
1225  GetCurrentDirectoryW(MAX_PATH, szCurFile);
1226  PathCombineW(szCurFile, szCurFile, ptr);
1227  flList->feFiles[i].bFromRelative = TRUE;
1228  }
1229  else
1230  {
1231  lstrcpyW(szCurFile, ptr);
1232  flList->feFiles[i].bFromRelative = FALSE;
1233  }
1234 
1235  /* parse wildcard files if they are in the filename */
1236  if (StrPBrkW(szCurFile, L"*?"))
1237  {
1238  parse_wildcard_files(flList, szCurFile, &i);
1239  flList->bAnyFromWildcard = TRUE;
1240  i--;
1241  }
1242  else
1243  {
1244  FILE_ENTRY *file = &flList->feFiles[i];
1245  add_file_to_entry(file, szCurFile);
1246  file->attributes = GetFileAttributesW( file->szFullPath );
1247  file->bExists = (file->attributes != INVALID_FILE_ATTRIBUTES);
1248 
1249  if (!file->bExists)
1250  flList->bAnyDontExist = TRUE;
1251 
1252  if (IsAttribDir(file->attributes))
1253  flList->bAnyDirectories = TRUE;
1254  }
1255 
1256  /* advance to the next string */
1257  ptr += lstrlenW(ptr) + 1;
1258  i++;
1259  }
1260  flList->dwNumFiles = i;
1261 
1262  return S_OK;
1263 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
LPWSTR WINAPI StrPBrkW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
Definition: string.c:1276
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1578
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
BOOL bAnyFromWildcard
Definition: shlfileop.cpp:68
const TCHAR * szFiles[]
Definition: CImage.cpp:17
BOOL bFromRelative
Definition: shlfileop.cpp:59
#define lstrlenW
Definition: compat.h:609
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
DWORD num_alloc
Definition: shlfileop.cpp:66
BOOL bAnyDirectories
Definition: shlfileop.cpp:69
static PVOID ptr
Definition: dispmode.c:27
DWORD dwNumFiles
Definition: shlfileop.cpp:67
static void parse_wildcard_files(FILE_LIST *flList, LPCWSTR szFile, LPDWORD pdwListIndex)
Definition: shlfileop.cpp:1162
static void __inline grow_list(FILE_LIST *list)
Definition: shlfileop.cpp:1104
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static void add_file_to_entry(FILE_ENTRY *feFile, LPCWSTR szFile)
Definition: shlfileop.cpp:1114
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
Definition: shlfileop.cpp:52
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
#define S_OK
Definition: intsafe.h:52
#define lstrcpyW
Definition: compat.h:608
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194
BOOL bAnyDontExist
Definition: shlfileop.cpp:70
Definition: fci.c:126
struct _FILE_ENTRY FILE_ENTRY
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:65

Referenced by copy_dir_to_dir(), copy_files(), move_dir_to_dir(), and SHFileOperationW().

◆ parse_wildcard_files()

static void parse_wildcard_files ( FILE_LIST flList,
LPCWSTR  szFile,
LPDWORD  pdwListIndex 
)
static

Definition at line 1162 of file shlfileop.cpp.

1163 {
1164  WIN32_FIND_DATAW wfd;
1165  HANDLE hFile = FindFirstFileW(szFile, &wfd);
1166  FILE_ENTRY *file;
1167  LPWSTR szFullPath;
1168  BOOL res;
1169 
1170  if (hFile == INVALID_HANDLE_VALUE) return;
1171 
1172  for (res = TRUE; res; res = FindNextFileW(hFile, &wfd))
1173  {
1174  if (IsDotDir(wfd.cFileName))
1175  continue;
1176 
1177  if (*pdwListIndex >= flList->num_alloc)
1178  grow_list( flList );
1179 
1180  szFullPath = wildcard_to_file(szFile, wfd.cFileName);
1181  file = &flList->feFiles[(*pdwListIndex)++];
1182  add_file_to_entry(file, szFullPath);
1183  file->bFromWildcard = TRUE;
1184  file->attributes = wfd.dwFileAttributes;
1185 
1186  if (IsAttribDir(file->attributes))
1187  flList->bAnyDirectories = TRUE;
1188 
1189  HeapFree(GetProcessHeap(), 0, szFullPath);
1190  }
1191 
1192  FindClose(hFile);
1193 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
#define TRUE
Definition: types.h:120
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD num_alloc
Definition: shlfileop.cpp:66
BOOL bAnyDirectories
Definition: shlfileop.cpp:69
static void __inline grow_list(FILE_LIST *list)
Definition: shlfileop.cpp:1104
#define GetProcessHeap()
Definition: compat.h:595
static void add_file_to_entry(FILE_ENTRY *feFile, LPCWSTR szFile)
Definition: shlfileop.cpp:1114
const char file[]
Definition: icontest.c:11
_In_ HANDLE hFile
Definition: mswsock.h:90
Definition: shlfileop.cpp:52
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
#define IsDotDir(x)
Definition: shlfileop.cpp:32
GLuint res
Definition: glext.h:9613
static LPWSTR wildcard_to_file(LPCWSTR szWildCard, LPCWSTR szFileName)
Definition: shlfileop.cpp:1140
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
Definition: fci.c:126
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:65

Referenced by parse_file_list().

◆ RealDriveType()

EXTERN_C INT WINAPI RealDriveType ( INT  drive,
BOOL  bQueryNet 
)

Definition at line 2195 of file shlfileop.cpp.

2196 {
2197  char root[] = "A:\\";
2198  root[0] += (char)drive;
2199  return GetDriveTypeA(root);
2200 }
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
unsigned char
Definition: typeof.h:29

◆ rename_files()

static HRESULT rename_files ( FILE_OPERATION op,
const FILE_LIST flFrom,
const FILE_LIST flTo 
)
static

Definition at line 1818 of file shlfileop.cpp.

1819 {
1820  const FILE_ENTRY *feFrom;
1821  const FILE_ENTRY *feTo;
1822 
1823  if (flFrom->dwNumFiles != 1)
1824  return ERROR_GEN_FAILURE;
1825 
1826  if (flTo->dwNumFiles != 1)
1827  return ERROR_CANCELLED;
1828 
1829  feFrom = &flFrom->feFiles[0];
1830  feTo= &flTo->feFiles[0];
1831 
1832  /* fail if destination doesn't exist */
1833  if (!feFrom->bExists)
1835 
1836  /* fail if destination already exists */
1837  if (feTo->bExists)
1838  return ERROR_ALREADY_EXISTS;
1839 
1840  return SHNotifyMoveFileW(op, feFrom->szFullPath, feTo->szFullPath, IsAttribDir(feFrom->attributes));
1841 }
LPWSTR szFullPath
Definition: shlfileop.cpp:57
DWORD attributes
Definition: shlfileop.cpp:54
static DWORD SHNotifyMoveFileW(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest, BOOL isdir)
Definition: shlfileop.cpp:716
BOOL bExists
Definition: shlfileop.cpp:60
DWORD dwNumFiles
Definition: shlfileop.cpp:67
UINT op
Definition: effect.c:236
Definition: shlfileop.cpp:52
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
#define ERROR_CANCELLED
Definition: winerror.h:726
#define ERROR_SHELL_INTERNAL_FILE_NOT_FOUND
Definition: shlfileop.cpp:50
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:65

Referenced by SHFileOperationW().

◆ SHCopyProgressRoutine()

DWORD CALLBACK SHCopyProgressRoutine ( LARGE_INTEGER  TotalFileSize,
LARGE_INTEGER  TotalBytesTransferred,
LARGE_INTEGER  StreamSize,
LARGE_INTEGER  StreamBytesTransferred,
DWORD  dwStreamNumber,
DWORD  dwCallbackReason,
HANDLE  hSourceFile,
HANDLE  hDestinationFile,
LPVOID  lpData 
)

Definition at line 558 of file shlfileop.cpp.

568  {
569  FILE_OPERATION *op = (FILE_OPERATION *) lpData;
570 
571  if (op->progress) {
572  /*
573  * This is called at the start of each file. To keop less state,
574  * I'm adding the file to the completed size here, and the re-subtracting
575  * it when drawing the progress bar.
576  */
577  if (dwCallbackReason & CALLBACK_STREAM_SWITCH)
578  op->completedSize.QuadPart += TotalFileSize.QuadPart;
579 
580  op->progress->SetProgress64(op->completedSize.QuadPart -
581  TotalFileSize.QuadPart +
582  TotalBytesTransferred.QuadPart
583  , op->totalSize.QuadPart);
584 
585 
586  op->bCancelled = op->progress->HasUserCancelled();
587  }
588 
589  return 0;
590 }
#define CALLBACK_STREAM_SWITCH
Definition: winbase.h:151
UINT op
Definition: effect.c:236
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by SHNotifyCopyFileW(), SHNotifyDeleteFileW(), and SHNotifyMoveFileW().

◆ SHCreateDirectory()

int WINAPI SHCreateDirectory ( HWND  hWnd,
LPCWSTR  path 
)

Definition at line 834 of file shlfileop.cpp.

835 {
837 }
HWND hWnd
Definition: settings.c:17
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:892
#define NULL
Definition: types.h:112

Referenced by CNewMenu::CreateNewFolder(), and CDefaultContextMenu::DoCreateNewFolder().

◆ SHCreateDirectoryExA()

int WINAPI SHCreateDirectoryExA ( HWND  hWnd,
LPCSTR  path,
LPSECURITY_ATTRIBUTES  sec 
)

Definition at line 871 of file shlfileop.cpp.

872 {
873  LPWSTR wPath;
874  DWORD retCode;
875 
876  TRACE("(%s, %p)\n", debugstr_a(path), sec);
877 
878  retCode = SHELL32_AnsiToUnicodeBuf(path, &wPath, 0);
879  if (!retCode)
880  {
881  retCode = SHCreateDirectoryExW(hWnd, wPath, sec);
882  SHELL32_FreeUnicodeBuf(wPath);
883  }
884  return retCode;
885 }
static void SHELL32_FreeUnicodeBuf(LPWSTR wPath)
Definition: shlfileop.cpp:352
static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChars)
Definition: shlfileop.cpp:336
HWND hWnd
Definition: settings.c:17
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:892
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by test_sh_create_dir().

◆ SHCreateDirectoryExW()

int WINAPI SHCreateDirectoryExW ( HWND  hWnd,
LPCWSTR  path,
LPSECURITY_ATTRIBUTES  sec 
)

Definition at line 892 of file shlfileop.cpp.

893 {
894  int ret = ERROR_BAD_PATHNAME;
895  TRACE("(%p, %s, %p)\n", hWnd, debugstr_w(path), sec);
896 
897  if (PathIsRelativeW(path))
898  {
899  SetLastError(ret);
900  }
901  else
902  {
904  /* Refuse to work on certain error codes before trying to create directories recursively */
905  if (ret != ERROR_SUCCESS &&
906  ret != ERROR_FILE_EXISTS &&
909  {
910  WCHAR *pEnd, *pSlash, szTemp[MAX_PATH + 1]; /* extra for PathAddBackslash() */
911 
912  lstrcpynW(szTemp, path, MAX_PATH);
913  pEnd = PathAddBackslashW(szTemp);
914  pSlash = szTemp + 3;
915 
916  while (*pSlash)
917  {
918  while (*pSlash && *pSlash != '\\') pSlash++;
919  if (*pSlash)
920  {
921  *pSlash = 0; /* terminate path at separator */
922 
923  ret = SHNotifyCreateDirectoryW(szTemp, pSlash + 1 == pEnd ? sec : NULL);
924  }
925  *pSlash++ = '\\'; /* put the separator back */
926  }
927  }
928 
929  if (ret && hWnd && (ERROR_CANCELLED != ret && ERROR_ALREADY_EXISTS != ret))
930  {
934  }
935  }
936 
937  return ret;
938 }
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1578
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hWnd
Definition: settings.c:17
#define lstrcpynW
Definition: compat.h:597
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define IDS_CREATEFOLDER_DENIED
Definition: shresdef.h:120
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:416
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define SetLastError(x)
Definition: compat.h:611
int ret
#define IDS_CREATEFOLDER_CAPTION
Definition: shresdef.h:121
#define shell32_hInstance
#define ERROR_CANCELLED
Definition: winerror.h:726
#define ShellMessageBoxW
Definition: precomp.h:63
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define ERROR_BAD_PATHNAME
Definition: winerror.h:233
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:263

Referenced by create_target_directory(), SHCreateDirectory(), SHCreateDirectoryExA(), SHGetFolderPathAndSubDirW(), SHPathPrepareForWriteW(), test_unicode(), and wWinMain().

◆ SheChangeDirA()

EXTERN_C DWORD WINAPI SheChangeDirA ( LPSTR  path)

Definition at line 2158 of file shlfileop.cpp.

2159 {
2161  return 0;
2162  else
2163  return GetLastError();
2164 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205

◆ SheChangeDirW()

EXTERN_C DWORD WINAPI SheChangeDirW ( LPWSTR  path)

Definition at line 2172 of file shlfileop.cpp.

2173 {
2175  return 0;
2176  else
2177  return GetLastError();
2178 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2248

◆ SheGetDirA()

EXTERN_C DWORD WINAPI SheGetDirA ( DWORD  drive,
LPSTR  buffer 
)

Definition at line 2085 of file shlfileop.cpp.

2086 {
2087  WCHAR org_path[MAX_PATH];
2088  DWORD ret;
2089  char drv_path[3];
2090 
2091  /* change current directory to the specified drive */
2092  if (drive) {
2093  strcpy(drv_path, "A:");
2094  drv_path[0] += (char)drive-1;
2095 
2096  GetCurrentDirectoryW(MAX_PATH, org_path);
2097 
2098  SetCurrentDirectoryA(drv_path);
2099  }
2100 
2101  /* query current directory path of the specified drive */
2103 
2104  /* back to the original drive */
2105  if (drive)
2106  SetCurrentDirectoryW(org_path);
2107 
2108  if (!ret)
2109  return GetLastError();
2110 
2111  return 0;
2112 }
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
GLuint buffer
Definition: glext.h:5915
unsigned char
Definition: typeof.h:29
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2248
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

◆ SheGetDirW()

EXTERN_C DWORD WINAPI SheGetDirW ( DWORD  drive,
LPWSTR  buffer 
)

Definition at line 2122 of file shlfileop.cpp.

2123 {
2124  WCHAR org_path[MAX_PATH];
2125  DWORD ret;
2126  char drv_path[3];
2127 
2128  /* change current directory to the specified drive */
2129  if (drive)
2130  {
2131  strcpy(drv_path, "A:");
2132  drv_path[0] += (char)drive-1;
2133 
2134  GetCurrentDirectoryW(MAX_PATH, org_path);
2135 
2136  SetCurrentDirectoryA(drv_path);
2137  }
2138 
2139  /* query current directory path of the specified drive */
2141 
2142  /* back to the original drive */
2143  if (drive)
2144  SetCurrentDirectoryW(org_path);
2145 
2146  if (!ret)
2147  return GetLastError();
2148 
2149  return 0;
2150 }
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
GLuint buffer
Definition: glext.h:5915
unsigned char
Definition: typeof.h:29
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2248
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

◆ SHELL32_AnsiToUnicodeBuf()

static DWORD SHELL32_AnsiToUnicodeBuf ( LPCSTR  aPath,
LPWSTR wPath,
DWORD  minChars 
)
static

Definition at line 336 of file shlfileop.cpp.

337 {
338  DWORD len = MultiByteToWideChar(CP_ACP, 0, aPath, -1, NULL, 0);
339 
340  if (len < minChars)
341  len = minChars;
342 
343  *wPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
344  if (*wPath)
345  {
346  MultiByteToWideChar(CP_ACP, 0, aPath, -1, *wPath, len);
347  return NO_ERROR;
348  }
349  return E_OUTOFMEMORY;
350 }
#define CP_ACP
Definition: compat.h:109
#define NO_ERROR
Definition: dderror.h:5
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by SHCreateDirectoryExA().

◆ SHELL32_FreeUnicodeBuf()

static void SHELL32_FreeUnicodeBuf ( LPWSTR  wPath)
static

Definition at line 352 of file shlfileop.cpp.

353 {
354  HeapFree(GetProcessHeap(), 0, wPath);
355 }
#define GetProcessHeap()
Definition: compat.h:595
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by SHCreateDirectoryExA().

◆ SHELL_ConfirmDialogW()

static BOOL SHELL_ConfirmDialogW ( HWND  hWnd,
int  nKindOfDialog,
LPCWSTR  szDir,
FILE_OPERATION op 
)
static

Definition at line 293 of file shlfileop.cpp.

294 {
295  WCHAR szCaption[255], szText[255], szBuffer[MAX_PATH + 256];
297  DWORD_PTR args[1];
298  HICON hIcon;
299  int ret;
300 
301  assert(nKindOfDialog >= 0 && nKindOfDialog < 32);
302  if (op && (op->dwYesToAllMask & (1 << nKindOfDialog)))
303  return TRUE;
304 
305  if (!SHELL_ConfirmIDs(nKindOfDialog, &ids)) return FALSE;
306 
307  LoadStringW(shell32_hInstance, ids.caption_resource_id, szCaption, sizeof(szCaption)/sizeof(WCHAR));
308  LoadStringW(shell32_hInstance, ids.text_resource_id, szText, sizeof(szText)/sizeof(WCHAR));
309 
310  args[0] = (DWORD_PTR)szDir;
312  szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)args);
313  hIcon = LoadIconW(ids.hIconInstance, (LPWSTR)MAKEINTRESOURCE(ids.icon_resource_id));
314 
315  ret = SHELL_ConfirmMsgBox(hWnd, szBuffer, szCaption, hIcon, op && op->bManyItems);
316  if (op)
317  {
318  if (ret == IDC_YESTOALL)
319  {
320  op->dwYesToAllMask |= (1 << nKindOfDialog);
321  ret = IDYES;
322  }
323  if (ret == IDCANCEL)
324  op->bCancelled = TRUE;
325  if (ret != IDYES)
326  op->req->fAnyOperationsAborted = TRUE;
327  }
328  return ret == IDYES;
329 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
#define DWORD_PTR
Definition: treelist.c:76
#define IDYES
Definition: winuser.h:829
#define TRUE
Definition: types.h:120
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:421
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:418
HWND hWnd
Definition: settings.c:17
#define assert(x)
Definition: debug.h:53
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
Definition: match.c:390
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
GLuint * ids
Definition: glext.h:5907
#define FALSE
Definition: types.h:117
static const WCHAR szText[]
Definition: dialog.c:139
char * va_list
Definition: acmsvcex.h:78
static BOOL SHELL_ConfirmIDs(int nKindOfDialog, SHELL_ConfirmIDstruc *ids)
Definition: shlfileop.cpp:222
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
UINT op
Definition: effect.c:236
int ret
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define shell32_hInstance
#define IDC_YESTOALL
Definition: shresdef.h:399
HICON hIcon
Definition: msconfig.c:44
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
int SHELL_ConfirmMsgBox(HWND hWnd, LPWSTR lpszText, LPWSTR lpszCaption, HICON hIcon, BOOL bYesToAll)
Definition: shlfileop.cpp:203

Referenced by confirm_delete_list(), copy_dir_to_dir(), copy_file_to_file(), delete_files(), SHELL_ConfirmYesNoW(), and SHELL_DeleteDirectoryW().

◆ SHELL_ConfirmIDs()

static BOOL SHELL_ConfirmIDs ( int  nKindOfDialog,
SHELL_ConfirmIDstruc ids 
)
static

Definition at line 222 of file shlfileop.cpp.

223 {
224  ids->hIconInstance = shell32_hInstance;
225  switch (nKindOfDialog)
226  {
227  case ASK_DELETE_FILE:
228  ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
229  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
230  ids->text_resource_id = IDS_DELETEITEM_TEXT;
231  return TRUE;
232 
233  case ASK_DELETE_FOLDER:
234  ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
235  ids->caption_resource_id = IDS_DELETEFOLDER_CAPTION;
236  ids->text_resource_id = IDS_DELETEITEM_TEXT;
237  return TRUE;
238 
240  ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
241  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
242  ids->text_resource_id = IDS_DELETEMULTIPLE_TEXT;
243  return TRUE;
244 
245  case ASK_TRASH_FILE:
246  ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
247  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
248  ids->text_resource_id = IDS_TRASHITEM_TEXT;
249  return TRUE;
250 
251  case ASK_TRASH_FOLDER:
252  ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
253  ids->caption_resource_id = IDS_DELETEFOLDER_CAPTION;
254  ids->text_resource_id = IDS_TRASHFOLDER_TEXT;
255  return TRUE;
256 
258  ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
259  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
260  ids->text_resource_id = IDS_TRASHMULTIPLE_TEXT;
261  return TRUE;
262 
263  case ASK_CANT_TRASH_ITEM:
264  ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
265  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
266  ids->text_resource_id = IDS_CANTTRASH_TEXT;
267  return TRUE;
268 
269  case ASK_DELETE_SELECTED:
270  ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
271  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
272  ids->text_resource_id = IDS_DELETESELECTED_TEXT;
273  return TRUE;
274 
275  case ASK_OVERWRITE_FILE:
276  ids->icon_resource_id = IDI_SHELL_FOLDER_MOVE2;
277  ids->caption_resource_id = IDS_OVERWRITEFILE_CAPTION;
278  ids->text_resource_id = IDS_OVERWRITEFILE_TEXT;
279  return TRUE;
280 
282  ids->icon_resource_id = IDI_SHELL_FOLDER_MOVE2;
283  ids->caption_resource_id = IDS_OVERWRITEFILE_CAPTION;
284  ids->text_resource_id = IDS_OVERWRITEFOLDER_TEXT;
285  return TRUE;
286 
287  default:
288  FIXME(" Unhandled nKindOfDialog %d stub\n", nKindOfDialog);
289  }
290  return FALSE;
291 }
#define ASK_CANT_TRASH_ITEM
Definition: shell32_main.h:121
#define IDI_SHELL_CONFIRM_DELETE
Definition: shresdef.h:597
#define TRUE
Definition: types.h:120
#define ASK_DELETE_FILE
Definition: shell32_main.h:112
#define IDS_OVERWRITEFILE_CAPTION
Definition: shresdef.h:126
#define ASK_TRASH_FILE
Definition: shell32_main.h:118
#define IDS_DELETEITEM_CAPTION
Definition: shresdef.h:122
#define ASK_DELETE_SELECTED
Definition: shell32_main.h:117
#define IDS_OVERWRITEFOLDER_TEXT
Definition: shresdef.h:133
#define ASK_TRASH_FOLDER
Definition: shell32_main.h:119
#define ASK_TRASH_MULTIPLE_ITEM
Definition: shell32_main.h:120
#define IDI_SHELL_FOLDER_MOVE2
Definition: shresdef.h:670
#define IDS_DELETEFOLDER_CAPTION
Definition: shresdef.h:123
GLuint * ids
Definition: glext.h:5907
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
#define ASK_DELETE_FOLDER
Definition: shell32_main.h:113
#define IDS_DELETEITEM_TEXT
Definition: shresdef.h:124
#define ASK_DELETE_MULTIPLE_ITEM
Definition: shell32_main.h:114
#define IDI_SHELL_TRASH_FILE
Definition: shresdef.h:582
#define IDS_TRASHFOLDER_TEXT
Definition: shresdef.h:129
#define ASK_OVERWRITE_FILE
Definition: shell32_main.h:116
#define IDS_OVERWRITEFILE_TEXT
Definition: resource.h:64
#define IDS_DELETEMULTIPLE_TEXT
Definition: shresdef.h:125
#define shell32_hInstance
#define IDS_DELETESELECTED_TEXT
Definition: shresdef.h:128
#define ASK_OVERWRITE_FOLDER
Definition: shell32_main.h:122
#define IDS_TRASHMULTIPLE_TEXT
Definition: shresdef.h:131
#define IDS_TRASHITEM_TEXT
Definition: shresdef.h:130
#define IDS_CANTTRASH_TEXT
Definition: shresdef.h:132

Referenced by SHELL_ConfirmDialogW().

◆ SHELL_ConfirmMsgBox()

int SHELL_ConfirmMsgBox ( HWND  hWnd,
LPWSTR  lpszText,
LPWSTR  lpszCaption,
HICON  hIcon,
BOOL  bYesToAll 
)

Definition at line 203 of file shlfileop.cpp.

204 {
205  struct confirm_msg_info info;
206 
207  info.lpszText = lpszText;
208  info.lpszCaption = lpszCaption;
209  info.hIcon = hIcon;
210  info.bYesToAll = bYesToAll;
212 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDD_YESTOALL_MSGBOX
Definition: shresdef.h:398
HWND hWnd
Definition: settings.c:17
LONG_PTR LPARAM
Definition: windef.h:208
static INT_PTR CALLBACK ConfirmMsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: shlfileop.cpp:185
#define shell32_hInstance
HICON hIcon
Definition: msconfig.c:44
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LPWSTR lpszCaption
Definition: shlfileop.cpp:90

Referenced by SHELL_ConfirmDialogW().

◆ SHELL_ConfirmYesNoW()

BOOL SHELL_ConfirmYesNoW ( HWND  hWnd,
int  nKindOfDialog,
LPCWSTR  szDir 
)

Definition at line 331 of file shlfileop.cpp.

332 {
333  return SHELL_ConfirmDialogW(hWnd, nKindOfDialog, szDir, NULL);
334 }
HWND hWnd
Definition: settings.c:17
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
Definition: shlfileop.cpp:293
#define NULL
Definition: types.h:112

◆ SHELL_DeleteDirectoryW()

BOOL SHELL_DeleteDirectoryW ( FILE_OPERATION op,
LPCWSTR  pszDir,
BOOL  bShowUI 
)

Definition at line 369 of file shlfileop.cpp.

370 {
371  BOOL ret = TRUE;
372  HANDLE hFind;
373  WIN32_FIND_DATAW wfd;
374  WCHAR szTemp[MAX_PATH];
375 
376  /* Make sure the directory exists before eventually prompting the user */
377  PathCombineW(szTemp, pszDir, L"*");
378  hFind = FindFirstFileW(szTemp, &wfd);
379  if (hFind == INVALID_HANDLE_VALUE)
380  return FALSE;
381 
382  if (!bShowUI || (ret = SHELL_ConfirmDialogW(op->req->hwnd, ASK_DELETE_FOLDER, pszDir, NULL)))
383  {
384  do
385  {
386  if (IsDotDir(wfd.cFileName))
387  continue;
388  PathCombineW(szTemp, pszDir, wfd.cFileName);
389  if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)
390  ret = SHELL_DeleteDirectoryW(op, szTemp, FALSE);
391  else
392  ret = (SHNotifyDeleteFileW(op, szTemp) == ERROR_SUCCESS);
393 
394  if (op->progress != NULL)
395  op->bCancelled |= op->progress->HasUserCancelled();
396  } while (ret && FindNextFileW(hFind, &wfd) && !op->bCancelled);
397  }
398  FindClose(hFind);
399  if (ret)
401  return ret;
402 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ASK_DELETE_FOLDER
Definition: shell32_main.h:113
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ LPCSTR pszDir
Definition: shellapi.h:582
#define MAX_PATH
Definition: compat.h:34
UINT op
Definition: effect.c:236
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
Definition: shlfileop.cpp:293
static DWORD SHNotifyRemoveDirectoryW(LPCWSTR path)
Definition: shlfileop.cpp:446
int ret
static DWORD SHNotifyDeleteFileW(FILE_OPERATION *op, LPCWSTR path)
Definition: shlfileop.cpp:605
#define NULL
Definition: types.h:112
#define IsDotDir(x)
Definition: shlfileop.cpp:32
BOOL SHELL_DeleteDirectoryW(FILE_OPERATION *op, LPCWSTR pszDir, BOOL bShowUI)
Definition: shlfileop.cpp:369
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by delete_files().

◆ SHFileOperationA()

int WINAPI SHFileOperationA ( LPSHFILEOPSTRUCTA  lpFileOp)

Definition at line 1046 of file shlfileop.cpp.

1047 {
1048  int errCode, retCode;
1049  SHFILEOPSTRUCTW nFileOp = { 0 };
1050 
1051  // Convert A information to W
1052  nFileOp.hwnd = lpFileOp->hwnd;
1053  nFileOp.wFunc = lpFileOp->wFunc;
1054  nFileOp.fFlags = lpFileOp->fFlags;
1055 
1056  errCode = _ConvertAtoW(lpFileOp->pFrom, &nFileOp.pFrom, TRUE);
1057  if (errCode != 0)
1058  goto cleanup;
1059 
1060  if (FO_DELETE != (nFileOp.wFunc & FO_MASK))
1061  {
1062  errCode = _ConvertAtoW(lpFileOp->pTo, &nFileOp.pTo, TRUE);
1063  if (errCode != 0)
1064  goto cleanup;
1065  }
1066 
1067  if (nFileOp.fFlags & FOF_SIMPLEPROGRESS)
1068  {
1069  errCode = _ConvertAtoW(lpFileOp->lpszProgressTitle, &nFileOp.lpszProgressTitle, FALSE);
1070  if (errCode != 0)
1071  goto cleanup;
1072  }
1073 
1074  // Call the actual function
1075  retCode = SHFileOperationW(&nFileOp);
1076  if (retCode)
1077  {
1078  ERR("SHFileOperationW failed with 0x%x\n", retCode);
1079  }
1080 
1081  // Cleanup
1082 cleanup:
1083  if (nFileOp.pFrom)
1084  HeapFree(GetProcessHeap(), 0, (PVOID) nFileOp.pFrom);
1085  if (nFileOp.pTo)
1086  HeapFree(GetProcessHeap(), 0, (PVOID) nFileOp.pTo);
1087  if (nFileOp.lpszProgressTitle)
1089 
1090  if (errCode != 0)
1091  {
1092  lpFileOp->fAnyOperationsAborted = TRUE;
1093  SetLastError(errCode);
1094 
1095  return errCode;
1096  }
1097 
1098  // Thankfully, starting with NT4 the name mappings are always unicode, so no need to convert.
1099  lpFileOp->hNameMappings = nFileOp.hNameMappings;
1100  lpFileOp->fAnyOperationsAborted = nFileOp.fAnyOperationsAborted;
1101  return retCode;
1102 }
PVOID hNameMappings
Definition: shellapi.h:359
#define TRUE
Definition: types.h:120
FILEOP_FLAGS fFlags
Definition: shellapi.h:347
#define FO_MASK
Definition: shlfileop.cpp:34
FILEOP_FLAGS fFlags
Definition: shellapi.h:357
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:1959
BOOL fAnyOperationsAborted
Definition: shellapi.h:358
#define FALSE
Definition: types.h:117
LPCSTR lpszProgressTitle
Definition: shellapi.h:350
LPCWSTR lpszProgressTitle
Definition: shellapi.h:360
#define GetProcessHeap()
Definition: compat.h:595
#define SetLastError(x)
Definition: compat.h:611
#define FOF_SIMPLEPROGRESS
Definition: shellapi.h:146
BOOL fAnyOperationsAborted
Definition: shellapi.h:348
PVOID hNameMappings
Definition: shellapi.h:349
LPCWSTR pFrom
Definition: shellapi.h:355
#define ERR(fmt,...)
Definition: debug.h:110
static DWORD _ConvertAtoW(PCSTR strSrc, PCWSTR *pStrDest, BOOL isList)
Definition: shlfileop.cpp:984
char * cleanup(char *str)
Definition: wpickclick.c:99
#define FO_DELETE
Definition: shellapi.h:135
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by delete_cab_files(), delete_pfmsitest_files(), is_old_shell32(), loadShell32(), test_click_make_new_folder_button(), test_copy(), test_delete(), test_move(), and test_rename().

◆ SHFileOperationW()

int WINAPI SHFileOperationW ( LPSHFILEOPSTRUCTW  lpFileOp)

Definition at line 1959 of file shlfileop.cpp.

1960 {
1962  FILE_LIST flFrom, flTo;
1963  int ret = 0;
1964 
1965  if (!lpFileOp)
1966  return ERROR_INVALID_PARAMETER;
1967 
1968  ret = CoInitialize(NULL);
1969  if (FAILED(ret))
1970  return ret;
1971 
1972  lpFileOp->fAnyOperationsAborted = FALSE;
1973  check_flags(lpFileOp->fFlags);
1974 
1975  ZeroMemory(&flFrom, sizeof(FILE_LIST));
1976  ZeroMemory(&flTo, sizeof(FILE_LIST));
1977 
1978  if ((ret = parse_file_list(&flFrom, lpFileOp->pFrom)))
1979  return ret;
1980 
1981  if (lpFileOp->wFunc != FO_DELETE)
1982  parse_file_list(&flTo, lpFileOp->pTo);
1983 
1984  ZeroMemory(&op, sizeof(op));
1985  op.req = lpFileOp;
1986  op.totalSize.QuadPart = 0ull;
1987  op.completedSize.QuadPart = 0ull;
1988  op.bManyItems = (flFrom.dwNumFiles > 1);
1989 
1990 #ifdef __REACTOS__
1991  ret = validate_operation(lpFileOp, &flFrom, &flTo);
1992  if (ret)
1993  goto cleanup;
1994 #endif
1995  if (lpFileOp->wFunc != FO_RENAME && !(lpFileOp->fFlags & FOF_SILENT)) {
1996  ret = CoCreateInstance(CLSID_ProgressDialog,
1997  NULL,
1998  CLSCTX_INPROC_SERVER,
1999  IID_PPV_ARG(IProgressDialog, &op.progress));
2000  if (FAILED(ret))
2001  goto cleanup;
2002 
2003  op.progress->StartProgressDialog(op.req->hwnd, NULL, PROGDLG_NORMAL & PROGDLG_AUTOTIME, NULL);
2005  _FileOpCountManager(&op, &flFrom);
2006  }
2007 
2008  switch (lpFileOp->wFunc)
2009  {
2010  case FO_COPY:
2011  ret = copy_files(&op, op.req->fFlags & FOF_MULTIDESTFILES, &flFrom, &flTo);
2012  break;
2013  case FO_DELETE:
2014  ret = delete_files(&op, &flFrom);
2015  break;
2016  case FO_MOVE:
2017  ret = move_files(&op, op.req->fFlags & FOF_MULTIDESTFILES, &flFrom, &flTo);
2018  break;
2019  case FO_RENAME:
2020  ret = rename_files(&op, &flFrom, &flTo);
2021  break;
2022  default:
2024  break;
2025  }
2026 
2027  if (op.progress) {
2028  op.progress->StopProgressDialog();
2029  op.progress->Release();
2030  }
2031 
2032 cleanup:
2033  destroy_file_list(&flFrom);
2034 
2035  if (lpFileOp->wFunc != FO_DELETE)
2036  destroy_file_list(&flTo);
2037 
2038  if (ret == ERROR_CANCELLED)
2039  lpFileOp->fAnyOperationsAborted = TRUE;
2040 
2041  CoUninitialize();
2042 
2043  return ret;
2044 }
static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles)
Definition: shlfileop.cpp:1196
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static HRESULT rename_files(FILE_OPERATION *op, const FILE_LIST *flFrom, const FILE_LIST *flTo)
Definition: shlfileop.cpp:1818
DWORD WINAPI _FileOpCountManager(FILE_OPERATION *op, const FILE_LIST *flFrom)
Definition: shlfileop.cpp:2283
#define TRUE
Definition: types.h:120
#define FO_COPY
Definition: shellapi.h:134
#define FOF_SILENT
Definition: shellapi.h:140
static HRESULT delete_files(FILE_OPERATION *op, const FILE_LIST *flFrom)
Definition: shlfileop.cpp:1595
#define ZeroMemory
Definition: winbase.h:1664
static HRESULT copy_files(FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, FILE_LIST *flTo)
Definition: shlfileop.cpp:1446
FILEOP_FLAGS fFlags
Definition: shellapi.h:357
#define FO_RENAME
Definition: shellapi.h:136
#define IID_PPV_ARG(Itype, ppType)
static void _SetOperationTitle(FILE_OPERATION *op)
Definition: shlfileop.cpp:475
#define FO_MOVE
Definition: shellapi.h:133
BOOL fAnyOperationsAborted
Definition: shellapi.h:358
static void check_flags(FILEOP_FLAGS fFlags)
Definition: shlfileop.cpp:1844
#define FALSE
Definition: types.h:117
DWORD dwNumFiles
Definition: shlfileop.cpp:67
static void destroy_file_list(FILE_LIST *flList)
Definition: shlfileop.cpp:1266
static DWORD move_files(FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, const FILE_LIST *flTo)
Definition: shlfileop.cpp:1738
UINT op
Definition: effect.c:236
#define PROGDLG_AUTOTIME
Definition: shlobj.h:893
#define PROGDLG_NORMAL
Definition: shlobj.h:891
LPCWSTR pFrom
Definition: shellapi.h:355
int ret
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define ERROR_CANCELLED
Definition: winerror.h:726
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define NULL
Definition: types.h:112
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
char * cleanup(char *str)
Definition: wpickclick.c:99
#define FOF_MULTIDESTFILES
Definition: shellapi.h:138
#define FO_DELETE
Definition: shellapi.h:135

Referenced by CFSDropTarget::_CopyItems(), CRecyclerDropTarget::_DoDeleteDataObject(), CFSDropTarget::_DoDrop(), cache_container_delete_dir(), ChildWndProc(), CCopyToMenu::DoRealCopy(), CMoveToMenu::DoRealMove(), CMyDocsDropHandler::Drop(), RecycleBin5_RecycleBin5_Restore(), SHFileOperationA(), SHFileOperationWrapW(), and test_unicode().

◆ SHFindAttrW()

static DWORD SHFindAttrW ( LPCWSTR  pName,
BOOL  fileOnly 
)
static

Definition at line 955 of file shlfileop.cpp.

956 {
957  WIN32_FIND_DATAW wfd;
958  BOOL b_FileMask = fileOnly && (NULL != StrPBrkW(pName, L"*?"));
960  HANDLE hFind = FindFirstFileW(pName, &wfd);
961 
962  TRACE("%s %d\n", debugstr_w(pName), fileOnly);
963  if (INVALID_HANDLE_VALUE != hFind)
964  {
965  do
966  {
967  if (b_FileMask && IsAttribDir(wfd.dwFileAttributes))
968  continue;
969  dwAttr = wfd.dwFileAttributes;
970  break;
971  } while (FindNextFileW(hFind, &wfd));
972 
973  FindClose(hFind);
974  }
975  return dwAttr;
976 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
LPWSTR WINAPI StrPBrkW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
Definition: string.c:1276
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define L(x)
Definition: ntvdm.h:50
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static LPSTR pName
Definition: security.c:75
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
#define NULL
Definition: types.h:112
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by SHNotifyMoveFileW().

◆ SHFreeNameMappings()

void WINAPI SHFreeNameMappings ( HANDLE  hNameMapping)

Definition at line 2069 of file shlfileop.cpp.

2070 {
2071  if (hNameMapping)
2072  {
2073  DSA_DestroyCallback((HDSA) hNameMapping, _DestroyCallback, NULL);
2074  }
2075 }
Definition: dsa.c:44
static int CALLBACK _DestroyCallback(void *p, void *pData)
Definition: shlfileop.cpp:2047
void WINAPI DSA_DestroyCallback(HDSA hdsa, PFNDSAENUMCALLBACK enumProc, LPVOID lParam)
Definition: dsa.c:432
#define NULL
Definition: types.h:112

◆ SHIsFileAvailableOffline()

EXTERN_C HRESULT WINAPI SHIsFileAvailableOffline ( LPCWSTR  path,
LPDWORD  status 
)

Definition at line 357 of file shlfileop.cpp.

358 {
359  FIXME("(%s, %p) stub\n", debugstr_w(path), status);
360  return E_FAIL;
361 }
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: ps.c:97

◆ SHNotifyCopyFileW()

static DWORD SHNotifyCopyFileW ( FILE_OPERATION op,
LPCWSTR  src,
LPCWSTR  dest,
BOOL  bFailIfExists 
)
static

Definition at line 772 of file shlfileop.cpp.

773 {
774  BOOL ret;
775  DWORD attribs;
776 
777  TRACE("(%s %s %s)\n", debugstr_w(src), debugstr_w(dest), bFailIfExists ? "failIfExists" : "");
778 
780 
781  /* Destination file may already exist with read only attribute */
785 
787  {
790  {
791  TRACE("[shell32, SHNotifyCopyFileW] STILL SHIT\n");
792  }
793  }
794 
795  ret = CopyFileExW(src, dest, SHCopyProgressRoutine, op, &op->bCancelled, bFailIfExists);
796  if (ret)
797  {
799  return ERROR_SUCCESS;
800  }
801 
802 #ifdef __REACTOS__
803  return CheckForError(op, GetLastError(), src);
804 #else
805  return GetLastError();
806 #endif
807 }
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794
#define ERROR_SUCCESS
Definition: deptool.c:10
const GLint * attribs
Definition: glext.h:10538
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT op
Definition: effect.c:236
int ret
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
BOOL WINAPI CopyFileExW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN LPPROGRESS_ROUTINE lpProgressRoutine OPTIONAL, IN LPVOID lpData OPTIONAL, IN LPBOOL pbCancel OPTIONAL, IN DWORD dwCopyFlags)
Definition: copy.c:318
GLenum src
Definition: glext.h:6340
DWORD CALLBACK SHCopyProgressRoutine(LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER StreamSize, LARGE_INTEGER StreamBytesTransferred, DWORD dwStreamNumber, DWORD dwCallbackReason, HANDLE hSourceFile, HANDLE hDestinationFile, LPVOID lpData)
Definition: shlfileop.cpp:558
#define SHCNF_PATHW
Definition: shlobj.h:1764
#define NULL
Definition: types.h:112
#define IsAttrib(x, y)
Definition: shlfileop.cpp:29
static char * dest
Definition: rtl.c:135
#define SHCNE_CREATE
Definition: shlobj.h:1730
static void _SetOperationTexts(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest)
Definition: shlfileop.cpp:508

Referenced by copy_file_to_file().

◆ SHNotifyCreateDirectoryW()

static DWORD SHNotifyCreateDirectoryW ( LPCWSTR  path,
LPSECURITY_ATTRIBUTES  sec 
)
static

Definition at line 416 of file shlfileop.cpp.

417 {
418  TRACE("(%s, %p)\n", debugstr_w(path), sec);
419 
420  if (CreateDirectoryW(path, sec))
421  {
423  return ERROR_SUCCESS;
424  }
425  return GetLastError();
426 }
#define SHCNE_MKDIR
Definition: shlobj.h:1732
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
#define SHCNF_PATHW
Definition: shlobj.h:1764
#define NULL
Definition: types.h:112

Referenced by copy_dir_to_dir(), copy_to_dir(), create_dest_dirs(), move_dir_to_dir(), SHCreateDirectoryExW(), and Win32CreateDirectoryW().

◆ SHNotifyDeleteFileW()

static DWORD SHNotifyDeleteFileW ( FILE_OPERATION op,
LPCWSTR  path 
)
static

Definition at line 605 of file shlfileop.cpp.

606 {
607  BOOL ret;
608 
609  TRACE("(%s)\n", debugstr_w(path));
610 
612 
614  FileSize.QuadPart = 0;
615 
616  WIN32_FIND_DATAW wfd;
617  HANDLE hFile = FindFirstFileW(path, &wfd);
618  if (hFile != INVALID_HANDLE_VALUE && IsAttribFile(wfd.dwFileAttributes)) {
619  ULARGE_INTEGER tmp;
620  tmp.u.LowPart = wfd.nFileSizeLow;
621  tmp.u.HighPart = wfd.nFileSizeHigh;
622  FileSize.QuadPart = tmp.QuadPart;
623  }
624  FindClose(hFile);
625 
626  ret = DeleteFileW(path);
627  if (!ret)
628  {
629  /* File may be write protected or a system file */
630  DWORD dwAttr = GetFileAttributesW(path);
633  ret = DeleteFileW(path);
634  }
635  if (ret)
636  {
637  // Bit of a hack to make the progress bar move. We don't have progress inside the file, so inform when done.
640  return ERROR_SUCCESS;
641  }
642  return GetLastError();
643 }
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define CALLBACK_STREAM_SWITCH
Definition: winbase.h:151
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
struct _ULARGE_INTEGER::@3884 u
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
#define TRACE(s)
Definition: solgame.cpp:4
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT op
Definition: effect.c:236
int ret
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
_In_ HANDLE hFile
Definition: mswsock.h:90
DWORD CALLBACK SHCopyProgressRoutine(LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER StreamSize, LARGE_INTEGER StreamBytesTransferred, DWORD dwStreamNumber, DWORD dwCallbackReason, HANDLE hSourceFile, HANDLE hDestinationFile, LPVOID lpData)
Definition: shlfileop.cpp:558
#define SHCNF_PATHW
Definition: shlobj.h:1764
#define SHCNE_DELETE
Definition: shlobj.h:1731
#define NULL
Definition: types.h:112
#define IsAttrib(x, y)
Definition: shlfileop.cpp:29
static void _SetOperationTexts(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest)
Definition: shlfileop.cpp:508
#define IsAttribFile(x)
Definition: shlfileop.cpp:30
LONGLONG QuadPart
Definition: typedefs.h:114
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by delete_files(), SHELL_DeleteDirectoryW(), and Win32DeleteFileW().

◆ SHNotifyMoveFileW()

static DWORD SHNotifyMoveFileW ( FILE_OPERATION op,
LPCWSTR  src,
LPCWSTR  dest,
BOOL  isdir 
)
static

Definition at line 716 of file shlfileop.cpp.

717 {
718  BOOL ret;
719 
720  TRACE("(%s %s)\n", debugstr_w(src), debugstr_w(dest));
721 
723 
725 
726  /* MOVEFILE_REPLACE_EXISTING fails with dirs, so try MoveFile */
727  if (!ret)
728  ret = MoveFileW(src, dest);
729 
730  if (!ret)
731  {
732  DWORD dwAttr;
733 
734  dwAttr = SHFindAttrW(dest, FALSE);
735  if (INVALID_FILE_ATTRIBUTES == dwAttr)
736  {
737  /* Source file may be write protected or a system file */
738  dwAttr = GetFileAttributesW(src);
741  ret = MoveFileW(src, dest);
742  }
743  }
744  if (ret)
745  {
748  return ERROR_SUCCESS;
749  }
750 
751 #ifdef __REACTOS__
752  return CheckForError(op, GetLastError(), src);
753 #else
754  return GetLastError();
755 #endif
756 }
#define SHCNE_MKDIR
Definition: shlobj.h:1732
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794
#define SHCNE_RMDIR
Definition: shlobj.h:1733
#define ERROR_SUCCESS
Definition: deptool.c:10
#define MOVEFILE_REPLACE_EXISTING
Definition: filesup.h:28
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1044
#define TRACE(s)
Definition: solgame.cpp:4
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT op
Definition: effect.c:236
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
int ret
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
GLenum src
Definition: glext.h:6340
DWORD CALLBACK SHCopyProgressRoutine(LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER StreamSize, LARGE_INTEGER StreamBytesTransferred, DWORD dwStreamNumber, DWORD dwCallbackReason, HANDLE hSourceFile, HANDLE hDestinationFile, LPVOID lpData)
Definition: shlfileop.cpp:558
#define SHCNF_PATHW
Definition: shlobj.h:1764
static DWORD SHFindAttrW(LPCWSTR pName, BOOL fileOnly)
Definition: shlfileop.cpp:955
#define SHCNE_DELETE
Definition: shlobj.h:1731
#define NULL
Definition: types.h:112
BOOL WINAPI MoveFileWithProgressW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN LPPROGRESS_ROUTINE lpProgressRoutine, IN LPVOID lpData, IN DWORD dwFlags)
Definition: move.c:667
#define IsAttrib(x, y)
Definition: shlfileop.cpp:29
static char * dest
Definition: rtl.c:135
#define SHCNE_CREATE
Definition: shlobj.h:1730
static void _SetOperationTexts(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest)
Definition: shlfileop.cpp:508

Referenced by move_files(), move_to_dir(), and rename_files().

◆ SHNotifyRemoveDirectoryW()

static DWORD SHNotifyRemoveDirectoryW ( LPCWSTR  path)
static

Definition at line 446 of file shlfileop.cpp.

447 {
448  BOOL ret;
449  TRACE("(%s)\n", debugstr_w(path));
450 
452  if (!ret)
453  {
454  /* Directory may be write protected */
455  DWORD dwAttr = GetFileAttributesW(path);
456  if (IsAttrib(dwAttr, FILE_ATTRIBUTE_READONLY))
459  }
460  if (ret)
461  {
463  return ERROR_SUCCESS;
464  }
465  return GetLastError();
466 }
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794
#define SHCNE_RMDIR
Definition: shlobj.h:1733
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
#define TRACE(s)
Definition: solgame.cpp:4
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
#define SHCNF_PATHW
Definition: shlobj.h:1764
#define NULL
Definition: types.h:112
#define IsAttrib(x, y)
Definition: shlfileop.cpp:29

Referenced by SHELL_DeleteDirectoryW(), and Win32RemoveDirectoryW().

◆ SHPathPrepareForWriteA()

EXTERN_C HRESULT WINAPI SHPathPrepareForWriteA ( HWND  hwnd,
IUnknown modless,
LPCSTR  path,
DWORD  flags 
)

Definition at line 2268 of file shlfileop.cpp.

2269 {
2270  WCHAR wpath[MAX_PATH];
2271  MultiByteToWideChar( CP_ACP, 0, path, -1, wpath, MAX_PATH);
2272  return SHPathPrepareForWriteW(hwnd, modless, wpath, flags);
2273 }
#define CP_ACP
Definition: compat.h:109
EXTERN_C HRESULT WINAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *modless, LPCWSTR path, DWORD flags)
Definition: shlfileop.cpp:2205
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
GLbitfield flags
Definition: glext.h:7161
#define MultiByteToWideChar
Definition: compat.h:110
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022

Referenced by CZipExtract::ExtractSingle(), and test_sh_path_prepare().

◆ SHPathPrepareForWriteW()

EXTERN_C HRESULT WINAPI SHPathPrepareForWriteW ( HWND  hwnd,
IUnknown modless,
LPCWSTR  path,
DWORD  flags 
)

Definition at line 2205 of file shlfileop.cpp.

2206 {
2207  DWORD res;
2208  DWORD err;
2209  LPCWSTR realpath;
2210  int len;
2211  WCHAR* last_slash;
2212  WCHAR* temppath=NULL;
2213 
2214  TRACE("%p %p %s 0x%08x\n", hwnd, modless, debugstr_w(path), flags);
2215 
2217  FIXME("unimplemented flags 0x%08x\n", flags);
2218 
2219  /* cut off filename if necessary */
2221  {
2222  last_slash = StrRChrW(path, NULL, '\\');
2223  if (last_slash == NULL)
2224  len = 1;
2225  else
2226  len = last_slash - path + 1;
2227  temppath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
2228  if (!temppath)
2229  return E_OUTOFMEMORY;
2230  StrCpyNW(temppath, path, len);
2231  realpath = temppath;
2232  }
2233  else
2234  {
2235  realpath = path;
2236  }
2237 
2238  /* try to create the directory if asked to */
2240  {
2241  if (flags & SHPPFW_ASKDIRCREATE)
2242  FIXME("treating SHPPFW_ASKDIRCREATE as SHPPFW_DIRCREATE\n");
2243 
2244  SHCreateDirectoryExW(0, realpath, NULL);
2245  }
2246 
2247  /* check if we can access the directory */
2248  res = GetFileAttributesW(realpath);
2249 
2250  HeapFree(GetProcessHeap(), 0, temppath);
2251 
2253  {
2254  err = GetLastError();
2255  if (err == ERROR_FILE_NOT_FOUND)
2257  return HRESULT_FROM_WIN32(err);
2258  }
2259  else if (res & FILE_ATTRIBUTE_DIRECTORY)
2260  return S_OK;
2261  else
2263 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GLsizei const GLchar ** path
Definition: glext.h:7234
LPWSTR WINAPI StrCpyNW(LPWSTR dst, LPCWSTR src, int count)
Definition: string.c:536
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ERROR_DIRECTORY
Definition: winerror.h:295
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define SHPPFW_DIRCREATE
Definition: shlobj.h:303
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SHPPFW_ASKDIRCREATE
Definition: shlobj.h:305
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
#define err(...)
#define S_OK
Definition: intsafe.h:52
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:892
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
#define SHPPFW_IGNOREFILENAME
Definition: shlobj.h:306
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPWSTR WINAPI StrRChrW(LPCWSTR str, LPCWSTR end, WORD ch)
Definition: string.c:556
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by SHPathPrepareForWriteA(), and test_sh_path_prepare().

◆ try_find_new_name()

static CStringW try_find_new_name ( LPCWSTR  szDestPath)
static

Definition at line 1283 of file shlfileop.cpp.

1284 {
1285  CStringW mask(szDestPath);
1286  CStringW ext(PathFindExtensionW(szDestPath));
1287 
1288  // cut off extension before inserting a "new file" mask
1289  if (!ext.IsEmpty())
1290  {
1291  mask = mask.Left(mask.GetLength() - ext.GetLength());
1292  }
1293  mask += L" (%d)" + ext;
1294 
1295  CStringW newName;
1296 
1297  // trying to find new file name
1298  for (int i = 1; i < NEW_FILENAME_ON_COPY_TRIES; i++)
1299  {
1300  newName.Format(mask, i);
1301 
1302  if (!PathFileExistsW(newName))
1303  {
1304  return newName;
1305  }
1306  }
1307 
1308  return CStringW();
1309 }
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:753
#define L(x)
Definition: ntvdm.h:50
GLenum GLint GLuint mask
Definition: glext.h:6028
char ext[3]
Definition: mkdosfs.c:358
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NEW_FILENAME_ON_COPY_TRIES
Definition: shlfileop.cpp:36
CAtlStringW CStringW
Definition: atlstr.h:130

Referenced by copy_dir_to_dir(), and copy_file_to_file().

◆ wildcard_to_file()

static LPWSTR wildcard_to_file ( LPCWSTR  szWildCard,
LPCWSTR  szFileName 
)
static

Definition at line 1140 of file shlfileop.cpp.

1141 {
1142  LPCWSTR ptr;
1143  LPCWSTR ptr2;
1144  LPWSTR szFullPath;
1145  DWORD dwDirLen, dwFullLen;
1146 
1147  ptr = StrRChrW(szWildCard, NULL, '\\');
1148  ptr2 = StrRChrW(szWildCard, NULL, '/');
1149  if (!ptr || ptr < ptr2)
1150  ptr = ptr2;
1151  dwDirLen = ptr - szWildCard + 1;
1152 
1153  dwFullLen = dwDirLen + lstrlenW(szFileName) + 1;
1154  szFullPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwFullLen * sizeof(WCHAR));
1155 
1156  lstrcpynW(szFullPath, szWildCard, dwDirLen + 1);
1157  lstrcatW(szFullPath, szFileName);
1158 
1159  return szFullPath;
1160 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define lstrlenW
Definition: compat.h:609
#define lstrcpynW
Definition: compat.h:597
static PVOID ptr
Definition: dispmode.c:27
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPWSTR WINAPI StrRChrW(LPCWSTR str, LPCWSTR end, WORD ch)
Definition: string.c:556

Referenced by parse_wildcard_files().

◆ Win32CreateDirectoryW()

EXTERN_C BOOL WINAPI Win32CreateDirectoryW ( LPCWSTR  path,
LPSECURITY_ATTRIBUTES  sec 
)

Definition at line 430 of file shlfileop.cpp.

431 {
432  return (SHNotifyCreateDirectoryW(path, sec) == ERROR_SUCCESS);
433 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:416

◆ Win32DeleteFileW()

EXTERN_C DWORD WINAPI Win32DeleteFileW ( LPCWSTR  path)

Definition at line 656 of file shlfileop.cpp.

657 {
659 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static DWORD SHNotifyDeleteFileW(FILE_OPERATION *op, LPCWSTR path)
Definition: shlfileop.cpp:605
#define NULL
Definition: types.h:112

◆ Win32RemoveDirectoryW()

EXTERN_C BOOL WINAPI Win32RemoveDirectoryW ( LPCWSTR  path)

Definition at line 470 of file shlfileop.cpp.

471 {
473 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static DWORD SHNotifyRemoveDirectoryW(LPCWSTR path)
Definition: shlfileop.cpp:446

Referenced by move_dir_to_dir().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )