ReactOS  0.4.14-dev-614-gbfd8a84
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)
 

Variables

static const WCHAR wWildcardFile [] = {'*',0}
 
static const WCHAR wWildcardChars [] = {'*','?',0}
 
static const WCHAR CONFIRM_MSG_PROP [] = {'W','I','N','E','_','C','O','N','F','I','R','M',0}
 

Macro Definition Documentation

◆ ERROR_SHELL_INTERNAL_FILE_NOT_FOUND

#define ERROR_SHELL_INTERNAL_FILE_NOT_FOUND   1026

Definition at line 53 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 938 of file shlfileop.cpp.

939 {
940  *pStrDest = NULL;
941 
942  // If the input is null, nothing to convert.
943  if (!strSrc)
944  return 0;
945 
946  // Measure the total size, depending on if it's a zero-terminated list.
947  int sizeA = 0;
948  if (isList)
949  {
950  PCSTR tmpSrc = strSrc;
951  int size;
952  do
953  {
954  size = lstrlenA(tmpSrc) + 1;
955  sizeA += size;
956  tmpSrc += size;
957  } while (size != 1);
958  }
959  else
960  {
961  sizeA = lstrlenA(strSrc) + 1;
962  }
963 
964  // Measure the needed allocation size.
965  int sizeW = MultiByteToWideChar(CP_ACP, 0, strSrc, sizeA, NULL, 0);
966  if (!sizeW)
967  return GetLastError();
968 
969  PWSTR strDest = (PWSTR) HeapAlloc(GetProcessHeap(), 0, sizeW * sizeof(WCHAR));
970  if (!strDest)
971  return ERROR_OUTOFMEMORY;
972 
973  int err = MultiByteToWideChar(CP_ACP, 0, strSrc, sizeA, strDest, sizeW);
974  if (!err)
975  {
976  HeapFree(GetProcessHeap(), 0, strDest);
977  return GetLastError();
978  }
979 
980  *pStrDest = strDest;
981  return 0;
982 }
uint16_t * PWSTR
Definition: typedefs.h:54
#define CP_ACP
Definition: compat.h:99
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR sizeW[]
Definition: editor.c:79
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
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 MultiByteToWideChar
Definition: compat.h:100
const char * PCSTR
Definition: typedefs.h:51
#define HeapFree(x, y, z)
Definition: compat.h:402
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by SHFileOperationA().

◆ _DestroyCallback()

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

Definition at line 2013 of file shlfileop.cpp.

2014 {
2016 
2017  SHFree(lp->pszOldPath);
2018  SHFree(lp->pszNewPath);
2019 
2020  return TRUE;
2021 }
#define TRUE
Definition: types.h:120
LPWSTR pszNewPath
Definition: shellapi.h:389
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
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 2267 of file shlfileop.cpp.

2268 {
2269  /* Find filename position */
2270  UINT cchBuf = wcslen(pwszBuf);
2271  WCHAR *pwszFilename = pwszBuf + cchBuf;
2272  size_t cchFilenameMax = MAX_PATH - cchBuf;
2273  if (!cchFilenameMax)
2274  return FALSE;
2275 
2276  if (bFolder) {
2277  *(pwszFilename++) = '\\';
2278  --cchFilenameMax;
2279  /* Find all files, FIXME: shouldn't be "*"? */
2280  StringCchCopyW(pwszFilename, cchFilenameMax, L"*");
2281  }
2282 
2283  WIN32_FIND_DATAW wfd;
2284  HANDLE hFind = FindFirstFileW(pwszBuf, &wfd);
2285  if (hFind == INVALID_HANDLE_VALUE)
2286  {
2287  ERR("FindFirstFileW %ls failed\n", pwszBuf);
2288  return FALSE;
2289  }
2290 
2291  do
2292  {
2293  if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
2294  {
2295  /* Don't process "." and ".." items */
2296  if (!wcscmp(wfd.cFileName, L".") || !wcscmp(wfd.cFileName, L".."))
2297  continue;
2298 
2299  StringCchCopyW(pwszFilename, cchFilenameMax, wfd.cFileName);
2300  _FileOpCount(op, pwszBuf, TRUE, ticks);
2301  }
2302  else
2303  {
2305  FileSize.u.LowPart = wfd.nFileSizeLow;
2306  FileSize.u.HighPart = wfd.nFileSizeHigh;
2307  op->totalSize.QuadPart += FileSize.QuadPart;
2308  }
2309  if (GetTickCount() - *ticks > (DWORD) 500)
2310  {
2311  // Check if the dialog has ended. If it has, we'll spin down.
2312  if (op->progress != NULL)
2313  op->bCancelled = op->progress->HasUserCancelled();
2314 
2315  if (op->bCancelled)
2316  break;
2317  *ticks = GetTickCount();
2318  }
2319  } while(FindNextFileW(hFind, &wfd));
2320 
2321  FindClose(hFind);
2322  return TRUE;
2323 }
struct _LARGE_INTEGER::@2220 u
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:399
static BOOL _FileOpCount(FILE_OPERATION *op, LPWSTR pwszBuf, BOOL bFolder, DWORD *ticks)
Definition: shlfileop.cpp:2267
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
smooth NULL
Definition: ftsmooth.c:416
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
#define ERR(fmt,...)
Definition: debug.h:109
_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
UINT op
Definition: effect.c:223
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LONGLONG QuadPart
Definition: typedefs.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 _FileOpCountManager().

◆ _FileOpCountManager()

DWORD WINAPI _FileOpCountManager ( FILE_OPERATION op,
const FILE_LIST flFrom 
)

Definition at line 2249 of file shlfileop.cpp.

2250 {
2251  DWORD ticks = GetTickCount();
2252  FILE_ENTRY *entryToCount;
2253 
2254  for (UINT i = 0; i < from->dwNumFiles; i++)
2255  {
2256  entryToCount = &from->feFiles[i];
2257 
2258  WCHAR theFileName[MAX_PATH];
2259  StringCchCopyW(theFileName, MAX_PATH, entryToCount->szFullPath);
2260  _FileOpCount(op, theFileName, IsAttribDir(entryToCount->attributes), &ticks);
2261  }
2262  return 0;
2263 }
LPWSTR szFullPath
Definition: shlfileop.cpp:60
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
DWORD attributes
Definition: shlfileop.cpp:57
static BOOL _FileOpCount(FILE_OPERATION *op, LPWSTR pwszBuf, BOOL bFolder, DWORD *ticks)
Definition: shlfileop.cpp:2267
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
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:26
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: shlfileop.cpp:55
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
unsigned int UINT
Definition: ndis.h:50
UINT op
Definition: effect.c:223
CardRegion * from
Definition: spigame.cpp:19

Referenced by SHFileOperationW().

◆ _SetOperationTexts()

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

Definition at line 513 of file shlfileop.cpp.

513  {
514  if (op->progress == NULL || src == NULL)
515  return;
516  LPWSTR fileSpecS, pathSpecS, fileSpecD, pathSpecD;
517  WCHAR szFolderS[50], szFolderD[50], szFinalString[260];
518 
519  DWORD_PTR args[2];
520 
521  fileSpecS = (pathSpecS = (LPWSTR) src);
522  fileSpecD = (pathSpecD = (LPWSTR) dest);
523 
524  // March across the string to get the file path and it's parent dir.
525  for (LPWSTR ptr = (LPWSTR) src; *ptr; ptr++) {
526  if (*ptr == '\\') {
527  pathSpecS = fileSpecS;
528  fileSpecS = ptr+1;
529  }
530  }
531  lstrcpynW(szFolderS, pathSpecS, min(50, fileSpecS - pathSpecS));
532  args[0] = (DWORD_PTR) szFolderS;
533 
534  switch (op->req->wFunc)
535  {
536  case FO_COPY:
537  case FO_MOVE:
538  if (dest == NULL)
539  return;
540  for (LPWSTR ptr = (LPWSTR) dest; *ptr; ptr++) {
541  if (*ptr == '\\') {
542  pathSpecD = fileSpecD;
543  fileSpecD = ptr + 1;
544  }
545  }
546  lstrcpynW(szFolderD, pathSpecD, min(50, fileSpecD - pathSpecD));
547  args[1] = (DWORD_PTR) szFolderD;
548  break;
549  case FO_DELETE:
550  break;
551  default:
552  return;
553  }
554 
556  op->szBuilderString, 0, 0, szFinalString, sizeof(szFinalString), (va_list*)args);
557 
558  op->progress->SetLine(1, fileSpecS, false, NULL);
559  op->progress->SetLine(2, szFinalString, false, NULL);
560 }
#define DWORD_PTR
Definition: treelist.c:76
#define FO_COPY
Definition: shellapi.h:134
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:405
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:402
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:405
#define FO_MOVE
Definition: shellapi.h:133
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
char * va_list
Definition: acmsvcex.h:78
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum src
Definition: glext.h:6340
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define min(a, b)
Definition: monoChain.cc:55
UINT op
Definition: effect.c:223
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 480 of file shlfileop.cpp.

480  {
481  if (op->progress == NULL)
482  return;
483  WCHAR szTitle[50], szPreflight[50];
484  UINT animation_id = NULL;
485 
486  switch (op->req->wFunc)
487  {
488  case FO_COPY:
490  LoadStringW(shell32_hInstance, IDS_FILEOOP_FROM_TO, op->szBuilderString, sizeof( op->szBuilderString)/sizeof(WCHAR));
491  animation_id = IDA_SHELL_COPY;
492  break;
493  case FO_DELETE:
495  LoadStringW(shell32_hInstance, IDS_FILEOOP_FROM, op->szBuilderString, sizeof( op->szBuilderString)/sizeof(WCHAR));
496  animation_id = IDA_SHELL_DELETE;
497  break;
498  case FO_MOVE:
500  LoadStringW(shell32_hInstance, IDS_FILEOOP_FROM_TO, op->szBuilderString, sizeof( op->szBuilderString)/sizeof(WCHAR));
501  animation_id = IDA_SHELL_COPY;
502  break;
503  default:
504  return;
505  }
506  LoadStringW(shell32_hInstance, IDS_FILEOOP_PREFLIGHT, szPreflight, sizeof(szPreflight)/sizeof(WCHAR));
507 
508  op->progress->SetTitle(szTitle);
509  op->progress->SetLine(1, szPreflight, false, NULL);
510  op->progress->SetAnimation(shell32_hInstance, animation_id);
511 }
#define IDS_FILEOOP_MOVING
Definition: shresdef.h:222
#define IDS_FILEOOP_FROM
Definition: shresdef.h:225
#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
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
#define IDA_SHELL_DELETE
Definition: shresdef.h:730
smooth NULL
Definition: ftsmooth.c:416
#define IDS_FILEOOP_DELETING
Definition: shresdef.h:223
__wchar_t WCHAR
Definition: xmlstorage.h:180
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define IDS_FILEOOP_COPYING
Definition: shresdef.h:221
#define IDA_SHELL_COPY
Definition: shresdef.h:726
#define IDS_FILEOOP_PREFLIGHT
Definition: shresdef.h:226
unsigned int UINT
Definition: ndis.h:50
UINT op
Definition: effect.c:223
#define FO_DELETE
Definition: shellapi.h:135
#define IDS_FILEOOP_FROM_TO
Definition: shresdef.h:224

Referenced by SHFileOperationW().

◆ add_file_to_entry()

static void add_file_to_entry ( FILE_ENTRY feFile,
LPCWSTR  szFile 
)
static

Definition at line 1064 of file shlfileop.cpp.

1065 {
1066  DWORD dwLen = lstrlenW(szFile) + 1;
1067  LPCWSTR ptr;
1068  LPCWSTR ptr2;
1069 
1070  feFile->szFullPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
1071  lstrcpyW(feFile->szFullPath, szFile);
1072 
1073  ptr = StrRChrW(szFile, NULL, '\\');
1074  ptr2 = StrRChrW(szFile, NULL, '/');
1075  if (!ptr || ptr < ptr2)
1076  ptr = ptr2;
1077  if (ptr)
1078  {
1079  dwLen = ptr - szFile + 1;
1080  feFile->szDirectory = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
1081  lstrcpynW(feFile->szDirectory, szFile, dwLen);
1082 
1083  dwLen = lstrlenW(feFile->szFullPath) - dwLen + 1;
1084  feFile->szFilename = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
1085  lstrcpyW(feFile->szFilename, ptr + 1); /* skip over backslash */
1086  }
1087  feFile->bFromWildcard = FALSE;
1088 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPWSTR szFullPath
Definition: shlfileop.cpp:60
#define lstrlenW
Definition: compat.h:415
#define lstrcpynW
Definition: compat.h:405
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
LPWSTR szFilename
Definition: shlfileop.cpp:59
#define GetProcessHeap()
Definition: compat.h:403
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:61
LPWSTR szDirectory
Definition: shlfileop.cpp:58
#define lstrcpyW
Definition: compat.h:414
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 1799 of file shlfileop.cpp.

1800 {
1801  WORD wUnsupportedFlags = FOF_NO_CONNECTED_ELEMENTS |
1803 #ifdef __REACTOS__
1805 #else
1807 #endif
1808 
1809  if (fFlags & wUnsupportedFlags)
1810  FIXME("Unsupported flags: %04x\n", fFlags);
1811 }
#define FOF_NOCOPYSECURITYATTRIBS
Definition: shellapi.h:149
#define FOF_NO_CONNECTED_ELEMENTS
Definition: shellapi.h:151
#define FIXME(fmt,...)
Definition: debug.h:110
#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 1525 of file shlfileop.cpp.

1526 {
1527  if (flFrom->dwNumFiles > 1)
1528  {
1529  WCHAR tmp[8];
1530  const WCHAR format[] = {'%','d',0};
1531 
1532  wnsprintfW(tmp, sizeof(tmp)/sizeof(tmp[0]), format, flFrom->dwNumFiles);
1534  }
1535  else
1536  {
1537  const FILE_ENTRY *fileEntry = &flFrom->feFiles[0];
1538 
1539  if (IsAttribFile(fileEntry->attributes))
1540  return SHELL_ConfirmDialogW(hWnd, (fTrash?ASK_TRASH_FILE:ASK_DELETE_FILE), fileEntry->szFullPath, NULL);
1541  else if (!(fFlags & FOF_FILESONLY && fileEntry->bFromWildcard))
1543  }
1544  return TRUE;
1545 }
#define TRUE
Definition: types.h:120
LPWSTR szFullPath
Definition: shlfileop.cpp:60
#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:57
#define ASK_TRASH_MULTIPLE_ITEM
Definition: shell32_main.h:120
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
DWORD dwNumFiles
Definition: shlfileop.cpp:70
smooth NULL
Definition: ftsmooth.c:416
#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:298
BOOL bFromWildcard
Definition: shlfileop.cpp:61
int WINAPIV wnsprintfW(LPWSTR lpOut, int cchLimitIn, LPCWSTR lpFmt,...)
Definition: wsprintf.c:564
Definition: shlfileop.cpp:55
#define IsAttribFile(x)
Definition: shlfileop.cpp:30
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:68

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 102 of file shlfileop.cpp.

103 {
104  HWND hButton = GetDlgItem(hDlg, iId);
105  RECT r;
106 
107  if (bShow)
108  {
109  POINT pt;
110  int width;
111 
112  GetWindowRect(hButton, &r);
113  width = r.right - r.left;
114  pt.x = r.left;
115  pt.y = r.top;
116  ScreenToClient(hDlg, &pt);
117  MoveWindow(hButton, *xPos - width, pt.y - yOffset, width, r.bottom - r.top, FALSE);
118  *xPos -= width + 5;
119  }
120  else
121  ShowWindow(hButton, SW_HIDE);
122 }
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)
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 149 of file shlfileop.cpp.

150 {
151  struct confirm_msg_info *info = (struct confirm_msg_info *)lParam;
152  INT xPos, yOffset;
153  int width, height;
154  HFONT hOldFont;
155  HDC hdc;
156  RECT r;
157 
158  SetWindowTextW(hDlg, info->lpszCaption);
160  SetPropW(hDlg, CONFIRM_MSG_PROP, info->lpszText);
162 
163  /* compute the text height and resize the dialog */
165  hdc = GetDC(hDlg);
166  yOffset = r.bottom;
169  SelectObject(hdc, hOldFont);
170  yOffset -= r.bottom;
171  yOffset = min(yOffset, 35); /* don't make the dialog too small */
172  ReleaseDC(hDlg, hdc);
173 
174  GetClientRect(hDlg, &r);
175  xPos = r.right - 7;
176  GetWindowRect(hDlg, &r);
177  width = r.right - r.left;
178  height = r.bottom - r.top - yOffset;
181 
182  confirm_msg_move_button(hDlg, IDCANCEL, &xPos, yOffset, info->bYesToAll);
183  confirm_msg_move_button(hDlg, IDNO, &xPos, yOffset, TRUE);
184  confirm_msg_move_button(hDlg, IDC_YESTOALL, &xPos, yOffset, info->bYesToAll);
185  confirm_msg_move_button(hDlg, IDYES, &xPos, yOffset, TRUE);
186 
187  return TRUE;
188 }
static const WCHAR CONFIRM_MSG_PROP[]
Definition: shlfileop.cpp:90
#define STM_SETICON
Definition: winuser.h:2074
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
#define IDYES
Definition: winuser.h:829
HDC WINAPI GetDC(_In_opt_ HWND)
#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:102
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
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:56
#define DT_PATH_ELLIPSIS
Definition: winuser.h:530
#define SM_CXSCREEN
Definition: winuser.h:949
#define IDC_YESTOALL_MESSAGE
Definition: shresdef.h:367
#define DT_CALCRECT
Definition: winuser.h:526
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_GETFONT
Definition: winuser.h:1633
#define SM_CYSCREEN
Definition: winuser.h:950
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:366
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:365
#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 127 of file shlfileop.cpp.

128 {
129  PAINTSTRUCT ps;
130  HFONT hOldFont;
131  RECT r;
132  HDC hdc;
133 
134  BeginPaint(hDlg, &ps);
135  hdc = ps.hdc;
137 
139  /* this will remap the rect to dialog coords */
143  SelectObject(hdc, hOldFont);
144  EndPaint(hDlg, &ps);
145 
146  return TRUE;
147 }
static const WCHAR CONFIRM_MSG_PROP[]
Definition: shlfileop.cpp:90
#define TRUE
Definition: types.h:120
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
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:1497
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:1032
#define IDC_YESTOALL_MESSAGE
Definition: shresdef.h:367
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define TRANSPARENT
Definition: wingdi.h:949
#define WM_GETFONT
Definition: winuser.h:1633
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 190 of file shlfileop.cpp.

191 {
192  switch (uMsg)
193  {
194  case WM_INITDIALOG:
195  return ConfirmMsgBox_Init(hDlg, lParam);
196  case WM_PAINT:
197  return ConfirmMsgBox_Paint(hDlg);
198  case WM_COMMAND:
199  EndDialog(hDlg, wParam);
200  break;
201  case WM_CLOSE:
202  EndDialog(hDlg, IDCANCEL);
203  break;
204  }
205  return FALSE;
206 }
static INT_PTR ConfirmMsgBox_Paint(HWND hDlg)
Definition: shlfileop.cpp:127
static INT_PTR ConfirmMsgBox_Init(HWND hDlg, LPARAM lParam)
Definition: shlfileop.cpp:149
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define WM_CLOSE
Definition: winuser.h:1603
#define WM_PAINT
Definition: winuser.h:1602
#define WM_COMMAND
Definition: winuser.h:1722
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
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 1261 of file shlfileop.cpp.

1262 {
1263  WCHAR szFrom[MAX_PATH], szTo[MAX_PATH];
1264  FILE_LIST flFromNew, flToNew;
1265 
1266  static const WCHAR wildCardFiles[] = {'*','.','*',0};
1267 
1268  if (IsDotDir(feFrom->szFilename))
1269  return;
1270 
1271  if (PathFileExistsW(szDestPath))
1272  PathCombineW(szTo, szDestPath, feFrom->szFilename);
1273  else
1274  lstrcpyW(szTo, szDestPath);
1275 
1276 #ifdef __REACTOS__
1277  if (PathFileExistsW(szTo))
1278  {
1279  if (op->req->fFlags & FOF_RENAMEONCOLLISION)
1280  {
1281  CStringW newPath = try_find_new_name(szTo);
1282  if (!newPath.IsEmpty())
1283  {
1284  StringCchCopyW(szTo, _countof(szTo), newPath);
1285  }
1286  }
1287  else if (!(op->req->fFlags & FOF_NOCONFIRMATION))
1288 #else
1289  if (!(op->req->fFlags & FOF_NOCONFIRMATION) && PathFileExistsW(szTo))
1290  {
1291  CStringW newPath;
1292  if (lstrcmp(feFrom->szDirectory, szDestPath) == 0 && !(newPath = try_find_new_name(szTo)).IsEmpty())
1293  {
1294  StringCchCopyW(szTo, _countof(szTo), newPath);
1295  }
1296  else
1297 #endif
1298  {
1299  if (!SHELL_ConfirmDialogW(op->req->hwnd, ASK_OVERWRITE_FOLDER, feFrom->szFilename, op))
1300  {
1301  /* Vista returns an ERROR_CANCELLED even if user pressed "No" */
1302  if (!op->bManyItems)
1303  op->bCancelled = TRUE;
1304  return;
1305  }
1306  }
1307  }
1308 
1309  szTo[lstrlenW(szTo) + 1] = '\0';
1311 
1312  PathCombineW(szFrom, feFrom->szFullPath, wildCardFiles);
1313  szFrom[lstrlenW(szFrom) + 1] = '\0';
1314 
1315  ZeroMemory(&flFromNew, sizeof(FILE_LIST));
1316  ZeroMemory(&flToNew, sizeof(FILE_LIST));
1317  parse_file_list(&flFromNew, szFrom);
1318  parse_file_list(&flToNew, szTo);
1319 
1320  copy_files(op, FALSE, &flFromNew, &flToNew);
1321 
1322  destroy_file_list(&flFromNew);
1323  destroy_file_list(&flToNew);
1324 }
static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles)
Definition: shlfileop.cpp:1146
#define TRUE
Definition: types.h:120
LPWSTR szFullPath
Definition: shlfileop.cpp:60
#define _countof(array)
Definition: fontsub.cpp:30
static const WCHAR szFrom[]
Definition: http.c:101
static CStringW try_find_new_name(LPCWSTR szDestPath)
Definition: shlfileop.cpp:1233
#define ZeroMemory
Definition: winbase.h:1642
static HRESULT copy_files(FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, FILE_LIST *flTo)
Definition: shlfileop.cpp:1398
#define lstrlenW
Definition: compat.h:415
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:421
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:1216
#define FOF_NOCONFIRMATION
Definition: shellapi.h:142
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
LPWSTR szFilename
Definition: shlfileop.cpp:59
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
Definition: shlfileop.cpp:298
#define lstrcmp
Definition: winbase.h:3706
LPWSTR szDirectory
Definition: shlfileop.cpp:58
#define FOF_RENAMEONCOLLISION
Definition: shellapi.h:141
bool IsEmpty() const
Definition: atlsimpstr.h:379
#define lstrcpyW
Definition: compat.h:414
#define ASK_OVERWRITE_FOLDER
Definition: shell32_main.h:122
#define IsDotDir(x)
Definition: shlfileop.cpp:32
UINT op
Definition: effect.c:223
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:189

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 1326 of file shlfileop.cpp.

1327 {
1328 #ifdef __REACTOS__
1329  if (PathFileExistsW(szTo))
1330  {
1331  if (op->req->fFlags & FOF_RENAMEONCOLLISION)
1332  {
1333  CStringW newPath = try_find_new_name(szTo);
1334  if (!newPath.IsEmpty())
1335  {
1336  return SHNotifyCopyFileW(op, szFrom, newPath, FALSE) == 0;
1337  }
1338  }
1339  else if (!(op->req->fFlags & FOF_NOCONFIRMATION))
1340  {
1342  return FALSE;
1343  }
1344 #else
1345  if (!(op->req->fFlags & FOF_NOCONFIRMATION) && PathFileExistsW(szTo))
1346  {
1347  CStringW newPath;
1348  if (lstrcmp(szFrom, szTo) == 0 && !(newPath = try_find_new_name(szTo)).IsEmpty())
1349  {
1350  return SHNotifyCopyFileW(op, szFrom, newPath, FALSE) == 0;
1351  }
1352 
1354  return FALSE;
1355 #endif
1356  }
1357 
1358  return SHNotifyCopyFileW(op, szFrom, szTo, FALSE) == 0;
1359 }
static const WCHAR szFrom[]
Definition: http.c:101
static CStringW try_find_new_name(LPCWSTR szDestPath)
Definition: shlfileop.cpp:1233
#define FOF_NOCONFIRMATION
Definition: shellapi.h:142
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:389
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
Definition: shlfileop.cpp:298
static DWORD SHNotifyCopyFileW(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest, BOOL bFailIfExists)
Definition: shlfileop.cpp:730
#define ASK_OVERWRITE_FILE
Definition: shell32_main.h:116
#define lstrcmp
Definition: winbase.h:3706
#define FOF_RENAMEONCOLLISION
Definition: shellapi.h:141
bool IsEmpty() const
Definition: atlsimpstr.h:379
UINT op
Definition: effect.c:223

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 1398 of file shlfileop.cpp.

1399 {
1400  DWORD i;
1401  const FILE_ENTRY *entryToCopy;
1402  const FILE_ENTRY *fileDest = &flTo->feFiles[0];
1403 
1404  if (flFrom->bAnyDontExist)
1406 
1407  if (flTo->dwNumFiles == 0)
1408  {
1409  /* If the destination is empty, SHFileOperation should use the current directory */
1410  WCHAR curdir[MAX_PATH+1];
1411 
1412  GetCurrentDirectoryW(MAX_PATH, curdir);
1413  curdir[lstrlenW(curdir)+1] = 0;
1414 
1415  destroy_file_list(flTo);
1416  ZeroMemory(flTo, sizeof(FILE_LIST));
1417  parse_file_list(flTo, curdir);
1418  fileDest = &flTo->feFiles[0];
1419  }
1420 
1421  if (multiDest)
1422  {
1423  if (flFrom->bAnyFromWildcard)
1424  return ERROR_CANCELLED;
1425 
1426  if (flFrom->dwNumFiles != flTo->dwNumFiles)
1427  {
1428  if (flFrom->dwNumFiles != 1 && !IsAttribDir(fileDest->attributes))
1429  return ERROR_CANCELLED;
1430 
1431  /* Free all but the first entry. */
1432  for (i = 1; i < flTo->dwNumFiles; i++)
1433  {
1435  HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFilename);
1436  HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFullPath);
1437  }
1438 
1439  flTo->dwNumFiles = 1;
1440  }
1441  else if (IsAttribDir(fileDest->attributes))
1442  {
1443  for (i = 1; i < flTo->dwNumFiles; i++)
1444  if (!IsAttribDir(flTo->feFiles[i].attributes) ||
1445  !IsAttribDir(flFrom->feFiles[i].attributes))
1446  {
1447  return ERROR_CANCELLED;
1448  }
1449  }
1450  }
1451  else if (flFrom->dwNumFiles != 1)
1452  {
1453  if (flTo->dwNumFiles != 1 && !IsAttribDir(fileDest->attributes))
1454  return ERROR_CANCELLED;
1455 
1456  if (PathFileExistsW(fileDest->szFullPath) &&
1457  IsAttribFile(fileDest->attributes))
1458  {
1459  return ERROR_CANCELLED;
1460  }
1461 
1462  if (flTo->dwNumFiles == 1 && fileDest->bFromRelative &&
1463  !PathFileExistsW(fileDest->szFullPath))
1464  {
1465  return ERROR_CANCELLED;
1466  }
1467  }
1468 
1469  for (i = 0; i < flFrom->dwNumFiles; i++)
1470  {
1471  entryToCopy = &flFrom->feFiles[i];
1472 
1473  if ((multiDest) &&
1474  flTo->dwNumFiles > 1)
1475  {
1476  fileDest = &flTo->feFiles[i];
1477  }
1478 
1479  if (IsAttribDir(entryToCopy->attributes) &&
1480  !lstrcmpiW(entryToCopy->szFullPath, fileDest->szDirectory))
1481  {
1482  return ERROR_SUCCESS;
1483  }
1484 
1485  create_dest_dirs(fileDest->szDirectory);
1486 
1487  if (!lstrcmpiW(entryToCopy->szFullPath, fileDest->szFullPath))
1488  {
1489  if (IsAttribFile(entryToCopy->attributes))
1491  else
1492  return ERROR_SUCCESS;
1493  }
1494 
1495  if ((flFrom->dwNumFiles > 1 && flTo->dwNumFiles == 1) ||
1496  IsAttribDir(fileDest->attributes))
1497  {
1498  copy_to_dir(op, entryToCopy, fileDest);
1499  }
1500  else if (IsAttribDir(entryToCopy->attributes))
1501  {
1502  copy_dir_to_dir(op, entryToCopy, fileDest->szFullPath);
1503  }
1504  else
1505  {
1506  if (!copy_file_to_file(op, entryToCopy->szFullPath, fileDest->szFullPath))
1507  {
1508  op->req->fAnyOperationsAborted = TRUE;
1509  return ERROR_CANCELLED;
1510  }
1511  }
1512 
1513  if (op->progress != NULL)
1514  op->bCancelled |= op->progress->HasUserCancelled();
1515  /* Vista return code. XP would return e.g. ERROR_FILE_NOT_FOUND, ERROR_ALREADY_EXISTS */
1516  if (op->bCancelled)
1517  return ERROR_CANCELLED;
1518  }
1519 
1520  /* Vista return code. On XP if the used pressed "No" for the last item,
1521  * ERROR_ARENA_TRASHED would be returned */
1522  return ERROR_SUCCESS;
1523 }
static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles)
Definition: shlfileop.cpp:1146
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
LPWSTR szFullPath
Definition: shlfileop.cpp:60
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:421
#define ERROR_NO_MORE_SEARCH_HANDLES
Definition: winerror.h:187
BOOL bAnyFromWildcard
Definition: shlfileop.cpp:71
#define ZeroMemory
Definition: winbase.h:1642
DWORD attributes
Definition: shlfileop.cpp:57
BOOL bFromRelative
Definition: shlfileop.cpp:62
#define lstrlenW
Definition: compat.h:415
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
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
DWORD dwNumFiles
Definition: shlfileop.cpp:70
static void destroy_file_list(FILE_LIST *flList)
Definition: shlfileop.cpp:1216
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
static void copy_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, const FILE_ENTRY *feTo)
Definition: shlfileop.cpp:1362
LPWSTR szFilename
Definition: shlfileop.cpp:59
#define GetProcessHeap()
Definition: compat.h:403
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL copy_file_to_file(FILE_OPERATION *op, const WCHAR *szFrom, const WCHAR *szTo)
Definition: shlfileop.cpp:1326
static void create_dest_dirs(LPCWSTR szDestDir)
Definition: shlfileop.cpp:1378
Definition: shlfileop.cpp:55
LPWSTR szDirectory
Definition: shlfileop.cpp:58
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
#define ERROR_CANCELLED
Definition: winerror.h:726
#define ERROR_SHELL_INTERNAL_FILE_NOT_FOUND
Definition: shlfileop.cpp:53
UINT op
Definition: effect.c:223
#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:1261
#define HeapFree(x, y, z)
Definition: compat.h:402
BOOL bAnyDontExist
Definition: shlfileop.cpp:73
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:68

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 1362 of file shlfileop.cpp.

1363 {
1364  if (!PathFileExistsW(feTo->szFullPath))
1366 
1367  if (IsAttribFile(feFrom->attributes))
1368  {
1369  WCHAR szDestPath[MAX_PATH];
1370 
1371  PathCombineW(szDestPath, feTo->szFullPath, feFrom->szFilename);
1372  copy_file_to_file(op, feFrom->szFullPath, szDestPath);
1373  }
1374  else if (!(op->req->fFlags & FOF_FILESONLY && feFrom->bFromWildcard))
1375  copy_dir_to_dir(op, feFrom, feTo->szFullPath);
1376 }
LPWSTR szFullPath
Definition: shlfileop.cpp:60
DWORD attributes
Definition: shlfileop.cpp:57
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:421
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
LPWSTR szFilename
Definition: shlfileop.cpp:59
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define FOF_FILESONLY
Definition: shellapi.h:145
#define MAX_PATH
Definition: compat.h:26
static BOOL copy_file_to_file(FILE_OPERATION *op, const WCHAR *szFrom, const WCHAR *szTo)
Definition: shlfileop.cpp:1326
BOOL bFromWildcard
Definition: shlfileop.cpp:61
UINT op
Definition: effect.c:223
#define IsAttribFile(x)
Definition: shlfileop.cpp:30
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:189
static void copy_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWSTR szDestPath)
Definition: shlfileop.cpp:1261

Referenced by copy_files().

◆ create_dest_dirs()

static void create_dest_dirs ( LPCWSTR  szDestDir)
static

Definition at line 1378 of file shlfileop.cpp.

1379 {
1380  WCHAR dir[MAX_PATH];
1381  LPCWSTR ptr = StrChrW(szDestDir, '\\');
1382 
1383  /* make sure all directories up to last one are created */
1384  while (ptr && (ptr = StrChrW(ptr + 1, '\\')))
1385  {
1386  lstrcpynW(dir, szDestDir, ptr - szDestDir + 1);
1387 
1388  if (!PathFileExistsW(dir))
1390  }
1391 
1392  /* create last directory */
1393  if (!PathFileExistsW(szDestDir))
1394  SHNotifyCreateDirectoryW(szDestDir, NULL);
1395 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define lstrcpynW
Definition: compat.h:405
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:421
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
unsigned int dir
Definition: maze.c:112
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468

Referenced by copy_files(), and move_files().

◆ delete_files()

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

Definition at line 1548 of file shlfileop.cpp.

1549 {
1550  const FILE_ENTRY *fileEntry;
1551  DWORD i;
1552  BOOL bPathExists;
1553  BOOL bTrash;
1554 
1555  if (!flFrom->dwNumFiles)
1556  return ERROR_SUCCESS;
1557 
1558  /* Windows also checks only the first item */
1559  bTrash = (op->req->fFlags & FOF_ALLOWUNDO)
1560  && TRASH_CanTrashFile(flFrom->feFiles[0].szFullPath);
1561 
1562  if (!(op->req->fFlags & FOF_NOCONFIRMATION) || (!bTrash && op->req->fFlags & FOF_WANTNUKEWARNING))
1563  if (!confirm_delete_list(op->req->hwnd, op->req->fFlags, bTrash, flFrom))
1564  {
1565  op->req->fAnyOperationsAborted = TRUE;
1566  return 0;
1567  }
1568 
1569  /* Check files. Do not delete one if one file does not exists */
1570  for (i = 0; i < flFrom->dwNumFiles; i++)
1571  {
1572  fileEntry = &flFrom->feFiles[i];
1573 
1574  if (fileEntry->attributes == (ULONG)-1)
1575  {
1576  // This is a windows 2003 server specific value which has been removed.
1577  // Later versions of windows return ERROR_FILE_NOT_FOUND.
1579  }
1580  }
1581 
1582  for (i = 0; i < flFrom->dwNumFiles; i++)
1583  {
1584  bPathExists = TRUE;
1585  fileEntry = &flFrom->feFiles[i];
1586 
1587  if (!IsAttribFile(fileEntry->attributes) &&
1588  (op->req->fFlags & FOF_FILESONLY && fileEntry->bFromWildcard))
1589  continue;
1590 
1591  if (bTrash)
1592  {
1593  BOOL bDelete;
1594  if (TRASH_TrashFile(fileEntry->szFullPath))
1595  {
1597  continue;
1598  }
1599 
1600  /* Note: Windows silently deletes the file in such a situation, we show a dialog */
1601  if (!(op->req->fFlags & FOF_NOCONFIRMATION) || (op->req->fFlags & FOF_WANTNUKEWARNING))
1602  bDelete = SHELL_ConfirmDialogW(op->req->hwnd, ASK_CANT_TRASH_ITEM, fileEntry->szFullPath, NULL);
1603  else
1604  bDelete = TRUE;
1605 
1606  if (!bDelete)
1607  {
1608  op->req->fAnyOperationsAborted = TRUE;
1609  break;
1610  }
1611  }
1612 
1613  /* delete the file or directory */
1614  if (IsAttribFile(fileEntry->attributes))
1615  {
1616  bPathExists = (ERROR_SUCCESS == SHNotifyDeleteFileW(op, fileEntry->szFullPath));
1617  }
1618  else
1619  bPathExists = SHELL_DeleteDirectoryW(op, fileEntry->szFullPath, FALSE);
1620 
1621  if (!bPathExists)
1622  {
1623  DWORD err = GetLastError();
1624 
1625  if (ERROR_FILE_NOT_FOUND == err)
1626  {
1627  // This is a windows 2003 server specific value which ahs been removed.
1628  // Later versions of windows return ERROR_FILE_NOT_FOUND.
1630  }
1631  else
1632  {
1633  return err;
1634  }
1635  }
1636 
1637  if (op->progress != NULL)
1638  op->bCancelled |= op->progress->HasUserCancelled();
1639  /* Should fire on progress dialog only */
1640  if (op->bCancelled)
1641  return ERROR_CANCELLED;
1642  }
1643 
1644  return ERROR_SUCCESS;
1645 }
#define ASK_CANT_TRASH_ITEM
Definition: shell32_main.h:121
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
LPWSTR szFullPath
Definition: shlfileop.cpp:60
#define FOF_ALLOWUNDO
Definition: shellapi.h:144
#define FOF_WANTNUKEWARNING
Definition: shellapi.h:152
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD attributes
Definition: shlfileop.cpp:57
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 BOOL
Definition: ntddk_ex.h:94
DWORD dwNumFiles
Definition: shlfileop.cpp:70
#define FOF_NOCONFIRMATION
Definition: shellapi.h:142
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define FOF_FILESONLY
Definition: shellapi.h:145
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
Definition: shlfileop.cpp:298
BOOL bFromWildcard
Definition: shlfileop.cpp:61
#define err(...)
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
Definition: changenotify.c:340
static DWORD SHNotifyDeleteFileW(FILE_OPERATION *op, LPCWSTR path)
Definition: shlfileop.cpp:610
Definition: shlfileop.cpp:55
#define SHCNF_PATHW
Definition: shlobj.h:1755
static BOOL confirm_delete_list(HWND hWnd, DWORD fFlags, BOOL fTrash, const FILE_LIST *flFrom)
Definition: shlfileop.cpp:1525
#define ERROR_CANCELLED
Definition: winerror.h:726
#define SHCNE_DELETE
Definition: shlobj.h:1722
BOOL TRASH_TrashFile(LPCWSTR wszPath)
BOOL SHELL_DeleteDirectoryW(FILE_OPERATION *op, LPCWSTR pszDir, BOOL bShowUI)
Definition: shlfileop.cpp:374
#define ERROR_SHELL_INTERNAL_FILE_NOT_FOUND
Definition: shlfileop.cpp:53
unsigned int ULONG
Definition: retypes.h:1
BOOL TRASH_CanTrashFile(LPCWSTR wszPath)
UINT op
Definition: effect.c:223
#define IsAttribFile(x)
Definition: shlfileop.cpp:30
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:68

Referenced by SHFileOperationW().

◆ destroy_file_list()

static void destroy_file_list ( FILE_LIST flList)
static

Definition at line 1216 of file shlfileop.cpp.

1217 {
1218  DWORD i;
1219 
1220  if (!flList || !flList->feFiles)
1221  return;
1222 
1223  for (i = 0; i < flList->dwNumFiles; i++)
1224  {
1225  HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szDirectory);
1226  HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szFilename);
1227  HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szFullPath);
1228  }
1229 
1230  HeapFree(GetProcessHeap(), 0, flList->feFiles);
1231 }
LPWSTR szFullPath
Definition: shlfileop.cpp:60
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
DWORD dwNumFiles
Definition: shlfileop.cpp:70
LPWSTR szFilename
Definition: shlfileop.cpp:59
#define GetProcessHeap()
Definition: compat.h:403
unsigned long DWORD
Definition: ntddk_ex.h:95
LPWSTR szDirectory
Definition: shlfileop.cpp:58
#define HeapFree(x, y, z)
Definition: compat.h:402
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:68

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 1054 of file shlfileop.cpp.

1055 {
1057  list->num_alloc * 2 * sizeof(*newx) );
1058  list->feFiles = newx;
1059  list->num_alloc *= 2;
1060 }
#define GetProcessHeap()
Definition: compat.h:403
Definition: shlfileop.cpp:55
#define HeapReAlloc
Definition: compat.h:401
#define list
Definition: rosglue.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by parse_file_list(), and parse_wildcard_files().

◆ IsNetDrive()

EXTERN_C int WINAPI IsNetDrive ( int  drive)

Definition at line 2149 of file shlfileop.cpp.

2150 {
2151  char root[4];
2152  strcpy(root, "A:\\");
2153  root[0] += (char)drive;
2154  return (GetDriveTypeA(root) == DRIVE_REMOTE);
2155 }
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 1647 of file shlfileop.cpp.

1648 {
1649  WCHAR szFrom[MAX_PATH], szTo[MAX_PATH];
1650  FILE_LIST flFromNew, flToNew;
1651 
1652  static const WCHAR wildCardFiles[] = {'*','.','*',0};
1653 
1654  if (IsDotDir(feFrom->szFilename))
1655  return;
1656 
1657  SHNotifyCreateDirectoryW(szDestPath, NULL);
1658 
1659  PathCombineW(szFrom, feFrom->szFullPath, wildCardFiles);
1660  szFrom[lstrlenW(szFrom) + 1] = '\0';
1661 
1662  lstrcpyW(szTo, szDestPath);
1663  szTo[lstrlenW(szDestPath) + 1] = '\0';
1664 
1665  ZeroMemory(&flFromNew, sizeof(FILE_LIST));
1666  ZeroMemory(&flToNew, sizeof(FILE_LIST));
1667  parse_file_list(&flFromNew, szFrom);
1668  parse_file_list(&flToNew, szTo);
1669 
1670  move_files(op, FALSE, &flFromNew, &flToNew);
1671 
1672  destroy_file_list(&flFromNew);
1673  destroy_file_list(&flToNew);
1674 
1675  if (PathIsDirectoryEmptyW(feFrom->szFullPath))
1677 }
static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles)
Definition: shlfileop.cpp:1146
LPWSTR szFullPath
Definition: shlfileop.cpp:60
static const WCHAR szFrom[]
Definition: http.c:101
#define ZeroMemory
Definition: winbase.h:1642
#define lstrlenW
Definition: compat.h:415
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:421
EXTERN_C BOOL WINAPI Win32RemoveDirectoryW(LPCWSTR path)
Definition: shlfileop.cpp:475
static void destroy_file_list(FILE_LIST *flList)
Definition: shlfileop.cpp:1216
static DWORD move_files(FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, const FILE_LIST *flTo)
Definition: shlfileop.cpp:1693
smooth NULL
Definition: ftsmooth.c:416
LPWSTR szFilename
Definition: shlfileop.cpp:59
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath)
Definition: path.c:3910
#define lstrcpyW
Definition: compat.h:414
#define IsDotDir(x)
Definition: shlfileop.cpp:32
UINT op
Definition: effect.c:223
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:189

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 1693 of file shlfileop.cpp.

1694 {
1695  DWORD i;
1696  INT mismatched = 0;
1697 
1698  const FILE_ENTRY *entryToMove;
1699  const FILE_ENTRY *fileDest;
1700 
1701  if (!flFrom->dwNumFiles)
1702  return ERROR_SUCCESS;
1703 
1704  if (!flTo->dwNumFiles)
1705  return ERROR_FILE_NOT_FOUND;
1706 
1707  if (!(multiDest) &&
1708  flTo->dwNumFiles > 1 && flFrom->dwNumFiles > 1)
1709  {
1710  return ERROR_CANCELLED;
1711  }
1712 
1713  if (!(multiDest) &&
1714  !flFrom->bAnyDirectories &&
1715  flFrom->dwNumFiles > flTo->dwNumFiles &&
1716  !(flTo->bAnyDirectories && flTo->dwNumFiles == 1))
1717  {
1718  return ERROR_CANCELLED;
1719  }
1720 
1721  if (!PathFileExistsW(flTo->feFiles[0].szDirectory))
1722  return ERROR_CANCELLED;
1723 
1724  if (multiDest)
1725  mismatched = flFrom->dwNumFiles - flTo->dwNumFiles;
1726 
1727  fileDest = &flTo->feFiles[0];
1728  for (i = 0; i < flFrom->dwNumFiles; i++)
1729  {
1730  entryToMove = &flFrom->feFiles[i];
1731 
1732  if (!PathFileExistsW(fileDest->szDirectory))
1733  return ERROR_CANCELLED;
1734 
1735  if (multiDest)
1736  {
1737  if (i >= flTo->dwNumFiles)
1738  break;
1739  fileDest = &flTo->feFiles[i];
1740  if (mismatched && !fileDest->bExists)
1741  {
1743  flTo->feFiles[i].bExists = TRUE;
1745  }
1746  }
1747 
1748  if (fileDest->bExists && IsAttribDir(fileDest->attributes))
1749  move_to_dir(op, entryToMove, fileDest);
1750  else
1751  SHNotifyMoveFileW(op, entryToMove->szFullPath, fileDest->szFullPath, IsAttribDir(entryToMove->attributes));
1752 
1753  if (op->progress != NULL)
1754  op->bCancelled |= op->progress->HasUserCancelled();
1755  /* Should fire on progress dialog only */
1756  if (op->bCancelled)
1757  return ERROR_CANCELLED;
1758 
1759  }
1760 
1761  if (mismatched > 0)
1762  {
1763  if (flFrom->bAnyDirectories)
1764  return DE_DESTSAMETREE;
1765  else
1766  return DE_SAMEFILE;
1767  }
1768 
1769  return ERROR_SUCCESS;
1770 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
LPWSTR szFullPath
Definition: shlfileop.cpp:60
DWORD attributes
Definition: shlfileop.cpp:57
static DWORD SHNotifyMoveFileW(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest, BOOL isdir)
Definition: shlfileop.cpp:679
int32_t INT
Definition: typedefs.h:56
BOOL bExists
Definition: shlfileop.cpp:63
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
BOOL bAnyDirectories
Definition: shlfileop.cpp:72
DWORD dwNumFiles
Definition: shlfileop.cpp:70
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
#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
#define DE_DESTSAMETREE
Definition: shlfileop.c:48
static void create_dest_dirs(LPCWSTR szDestDir)
Definition: shlfileop.cpp:1378
Definition: shlfileop.cpp:55
LPWSTR szDirectory
Definition: shlfileop.cpp:58
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
#define ERROR_CANCELLED
Definition: winerror.h:726
#define DE_SAMEFILE
Definition: shlfileop.c:42
UINT op
Definition: effect.c:223
static void move_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, const FILE_ENTRY *feTo)
Definition: shlfileop.cpp:1680
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:68

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 1680 of file shlfileop.cpp.

1681 {
1682  WCHAR szDestPath[MAX_PATH];
1683 
1684  PathCombineW(szDestPath, feTo->szFullPath, feFrom->szFilename);
1685 
1686  if (IsAttribFile(feFrom->attributes))
1687  SHNotifyMoveFileW(op, feFrom->szFullPath, szDestPath, FALSE);
1688  else if (!(op->req->fFlags & FOF_FILESONLY && feFrom->bFromWildcard))
1689  move_dir_to_dir(op, feFrom, szDestPath);
1690 }
LPWSTR szFullPath
Definition: shlfileop.cpp:60
DWORD attributes
Definition: shlfileop.cpp:57
static DWORD SHNotifyMoveFileW(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest, BOOL isdir)
Definition: shlfileop.cpp:679
LPWSTR szFilename
Definition: shlfileop.cpp:59
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define FOF_FILESONLY
Definition: shellapi.h:145
#define MAX_PATH
Definition: compat.h:26
BOOL bFromWildcard
Definition: shlfileop.cpp:61
static void move_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWSTR szDestPath)
Definition: shlfileop.cpp:1647
UINT op
Definition: effect.c:223
#define IsAttribFile(x)
Definition: shlfileop.cpp:30
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:189

Referenced by move_files().

◆ parse_file_list()

static HRESULT parse_file_list ( FILE_LIST flList,
LPCWSTR  szFiles 
)
static

Definition at line 1146 of file shlfileop.cpp.

1147 {
1148  LPCWSTR ptr = szFiles;
1149  WCHAR szCurFile[MAX_PATH];
1150  DWORD i = 0;
1151 
1152  if (!szFiles)
1153  return ERROR_INVALID_PARAMETER;
1154 
1155  flList->bAnyFromWildcard = FALSE;
1156  flList->bAnyDirectories = FALSE;
1157  flList->bAnyDontExist = FALSE;
1158  flList->num_alloc = 32;
1159  flList->dwNumFiles = 0;
1160 
1161  /* empty list */
1162  if (!szFiles[0])
1163  return ERROR_ACCESS_DENIED;
1164 
1166  flList->num_alloc * sizeof(FILE_ENTRY));
1167 
1168  while (*ptr)
1169  {
1170  if (i >= flList->num_alloc) grow_list( flList );
1171 
1172  /* change relative to absolute path */
1173  if (PathIsRelativeW(ptr))
1174  {
1175  GetCurrentDirectoryW(MAX_PATH, szCurFile);
1176  PathCombineW(szCurFile, szCurFile, ptr);
1177  flList->feFiles[i].bFromRelative = TRUE;
1178  }
1179  else
1180  {
1181  lstrcpyW(szCurFile, ptr);
1182  flList->feFiles[i].bFromRelative = FALSE;
1183  }
1184 
1185  /* parse wildcard files if they are in the filename */
1186  if (StrPBrkW(szCurFile, wWildcardChars))
1187  {
1188  parse_wildcard_files(flList, szCurFile, &i);
1189  flList->bAnyFromWildcard = TRUE;
1190  i--;
1191  }
1192  else
1193  {
1194  FILE_ENTRY *file = &flList->feFiles[i];
1195  add_file_to_entry(file, szCurFile);
1196  file->attributes = GetFileAttributesW( file->szFullPath );
1197  file->bExists = (file->attributes != INVALID_FILE_ATTRIBUTES);
1198 
1199  if (!file->bExists)
1200  flList->bAnyDontExist = TRUE;
1201 
1202  if (IsAttribDir(file->attributes))
1203  flList->bAnyDirectories = TRUE;
1204  }
1205 
1206  /* advance to the next string */
1207  ptr += lstrlenW(ptr) + 1;
1208  i++;
1209  }
1210  flList->dwNumFiles = i;
1211 
1212  return S_OK;
1213 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
LPWSTR WINAPI StrPBrkW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
Definition: string.c:1276
#define TRUE
Definition: types.h:120
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1558
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:421
BOOL bAnyFromWildcard
Definition: shlfileop.cpp:71
const TCHAR * szFiles[]
Definition: CImage.cpp:17
BOOL bFromRelative
Definition: shlfileop.cpp:62
#define lstrlenW
Definition: compat.h:415
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_ACCESS_DENIED
Definition: compat.h:87
static const WCHAR wWildcardChars[]
Definition: shlfileop.cpp:39
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
DWORD num_alloc
Definition: shlfileop.cpp:69
BOOL bAnyDirectories
Definition: shlfileop.cpp:72
static PVOID ptr
Definition: dispmode.c:27
DWORD dwNumFiles
Definition: shlfileop.cpp:70
static void parse_wildcard_files(FILE_LIST *flList, LPCWSTR szFile, LPDWORD pdwListIndex)
Definition: shlfileop.cpp:1112
static void __inline grow_list(FILE_LIST *list)
Definition: shlfileop.cpp:1054
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static void add_file_to_entry(FILE_ENTRY *feFile, LPCWSTR szFile)
Definition: shlfileop.cpp:1064
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
Definition: shlfileop.cpp:55
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:414
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:189
BOOL bAnyDontExist
Definition: shlfileop.cpp:73
Definition: fci.c:126
struct _FILE_ENTRY FILE_ENTRY
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:68

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 1112 of file shlfileop.cpp.

1113 {
1114  WIN32_FIND_DATAW wfd;
1115  HANDLE hFile = FindFirstFileW(szFile, &wfd);
1116  FILE_ENTRY *file;
1117  LPWSTR szFullPath;
1118  BOOL res;
1119 
1120  if (hFile == INVALID_HANDLE_VALUE) return;
1121 
1122  for (res = TRUE; res; res = FindNextFileW(hFile, &wfd))
1123  {
1124  if (IsDotDir(wfd.cFileName))
1125  continue;
1126 
1127  if (*pdwListIndex >= flList->num_alloc)
1128  grow_list( flList );
1129 
1130  szFullPath = wildcard_to_file(szFile, wfd.cFileName);
1131  file = &flList->feFiles[(*pdwListIndex)++];
1132  add_file_to_entry(file, szFullPath);
1133  file->bFromWildcard = TRUE;
1134  file->attributes = wfd.dwFileAttributes;
1135 
1136  if (IsAttribDir(file->attributes))
1137  flList->bAnyDirectories = TRUE;
1138 
1139  HeapFree(GetProcessHeap(), 0, szFullPath);
1140  }
1141 
1142  FindClose(hFile);
1143 }
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:399
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD num_alloc
Definition: shlfileop.cpp:69
BOOL bAnyDirectories
Definition: shlfileop.cpp:72
static void __inline grow_list(FILE_LIST *list)
Definition: shlfileop.cpp:1054
#define GetProcessHeap()
Definition: compat.h:403
static void add_file_to_entry(FILE_ENTRY *feFile, LPCWSTR szFile)
Definition: shlfileop.cpp:1064
const char file[]
Definition: icontest.c:11
_In_ HANDLE hFile
Definition: mswsock.h:90
Definition: shlfileop.cpp:55
#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:1090
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402
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:68

Referenced by parse_file_list().

◆ RealDriveType()

EXTERN_C INT WINAPI RealDriveType ( INT  drive,
BOOL  bQueryNet 
)

Definition at line 2161 of file shlfileop.cpp.

2162 {
2163  char root[] = "A:\\";
2164  root[0] += (char)drive;
2165  return GetDriveTypeA(root);
2166 }
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 1773 of file shlfileop.cpp.

1774 {
1775  const FILE_ENTRY *feFrom;
1776  const FILE_ENTRY *feTo;
1777 
1778  if (flFrom->dwNumFiles != 1)
1779  return ERROR_GEN_FAILURE;
1780 
1781  if (flTo->dwNumFiles != 1)
1782  return ERROR_CANCELLED;
1783 
1784  feFrom = &flFrom->feFiles[0];
1785  feTo= &flTo->feFiles[0];
1786 
1787  /* fail if destination doesn't exist */
1788  if (!feFrom->bExists)
1790 
1791  /* fail if destination already exists */
1792  if (feTo->bExists)
1793  return ERROR_ALREADY_EXISTS;
1794 
1795  return SHNotifyMoveFileW(op, feFrom->szFullPath, feTo->szFullPath, IsAttribDir(feFrom->attributes));
1796 }
LPWSTR szFullPath
Definition: shlfileop.cpp:60
DWORD attributes
Definition: shlfileop.cpp:57
static DWORD SHNotifyMoveFileW(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest, BOOL isdir)
Definition: shlfileop.cpp:679
BOOL bExists
Definition: shlfileop.cpp:63
DWORD dwNumFiles
Definition: shlfileop.cpp:70
Definition: shlfileop.cpp:55
#define IsAttribDir(x)
Definition: shlfileop.cpp:31
#define ERROR_CANCELLED
Definition: winerror.h:726
#define ERROR_SHELL_INTERNAL_FILE_NOT_FOUND
Definition: shlfileop.cpp:53
UINT op
Definition: effect.c:223
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
FILE_ENTRY * feFiles
Definition: shlfileop.cpp:68

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 563 of file shlfileop.cpp.

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

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

◆ SHCreateDirectory()

int WINAPI SHCreateDirectory ( HWND  hWnd,
LPCWSTR  path 
)

Definition at line 788 of file shlfileop.cpp.

789 {
791 }
HWND hWnd
Definition: settings.c:17
smooth NULL
Definition: ftsmooth.c:416
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:846

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

◆ SHCreateDirectoryExA()

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

Definition at line 825 of file shlfileop.cpp.

826 {
827  LPWSTR wPath;
828  DWORD retCode;
829 
830  TRACE("(%s, %p)\n", debugstr_a(path), sec);
831 
832  retCode = SHELL32_AnsiToUnicodeBuf(path, &wPath, 0);
833  if (!retCode)
834  {
835  retCode = SHCreateDirectoryExW(hWnd, wPath, sec);
836  SHELL32_FreeUnicodeBuf(wPath);
837  }
838  return retCode;
839 }
static void SHELL32_FreeUnicodeBuf(LPWSTR wPath)
Definition: shlfileop.cpp:357
static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChars)
Definition: shlfileop.cpp:341
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:846
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 846 of file shlfileop.cpp.

847 {
848  int ret = ERROR_BAD_PATHNAME;
849  TRACE("(%p, %s, %p)\n", hWnd, debugstr_w(path), sec);
850 
851  if (PathIsRelativeW(path))
852  {
853  SetLastError(ret);
854  }
855  else
856  {
858  /* Refuse to work on certain error codes before trying to create directories recursively */
859  if (ret != ERROR_SUCCESS &&
860  ret != ERROR_FILE_EXISTS &&
863  {
864  WCHAR *pEnd, *pSlash, szTemp[MAX_PATH + 1]; /* extra for PathAddBackslash() */
865 
866  lstrcpynW(szTemp, path, MAX_PATH);
867  pEnd = PathAddBackslashW(szTemp);
868  pSlash = szTemp + 3;
869 
870  while (*pSlash)
871  {
872  while (*pSlash && *pSlash != '\\') pSlash++;
873  if (*pSlash)
874  {
875  *pSlash = 0; /* terminate path at separator */
876 
877  ret = SHNotifyCreateDirectoryW(szTemp, pSlash + 1 == pEnd ? sec : NULL);
878  }
879  *pSlash++ = '\\'; /* put the separator back */
880  }
881  }
882 
883  if (ret && hWnd && (ERROR_CANCELLED != ret && ERROR_ALREADY_EXISTS != ret))
884  {
888  }
889  }
890 
891  return ret;
892 }
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1558
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hWnd
Definition: settings.c:17
#define lstrcpynW
Definition: compat.h:405
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define IDS_CREATEFOLDER_DENIED
Definition: shresdef.h:112
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:421
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
int ShellMessageBoxW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType,...)
Definition: shellord.c:337
#define SetLastError(x)
Definition: compat.h:417
int ret
#define IDS_CREATEFOLDER_CAPTION
Definition: shresdef.h:113
#define ERROR_CANCELLED
Definition: winerror.h:726
#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 2124 of file shlfileop.cpp.

2125 {
2127  return 0;
2128  else
2129  return GetLastError();
2130 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205

◆ SheChangeDirW()

EXTERN_C DWORD WINAPI SheChangeDirW ( LPWSTR  path)

Definition at line 2138 of file shlfileop.cpp.

2139 {
2141  return 0;
2142  else
2143  return GetLastError();
2144 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2248

◆ SheGetDirA()

EXTERN_C DWORD WINAPI SheGetDirA ( DWORD  drive,
LPSTR  buffer 
)

Definition at line 2051 of file shlfileop.cpp.

2052 {
2053  WCHAR org_path[MAX_PATH];
2054  DWORD ret;
2055  char drv_path[3];
2056 
2057  /* change current directory to the specified drive */
2058  if (drive) {
2059  strcpy(drv_path, "A:");
2060  drv_path[0] += (char)drive-1;
2061 
2062  GetCurrentDirectoryW(MAX_PATH, org_path);
2063 
2064  SetCurrentDirectoryA(drv_path);
2065  }
2066 
2067  /* query current directory path of the specified drive */
2069 
2070  /* back to the original drive */
2071  if (drive)
2072  SetCurrentDirectoryW(org_path);
2073 
2074  if (!ret)
2075  return GetLastError();
2076 
2077  return 0;
2078 }
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:421
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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:26
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 2088 of file shlfileop.cpp.

2089 {
2090  WCHAR org_path[MAX_PATH];
2091  DWORD ret;
2092  char drv_path[3];
2093 
2094  /* change current directory to the specified drive */
2095  if (drive)
2096  {
2097  strcpy(drv_path, "A:");
2098  drv_path[0] += (char)drive-1;
2099 
2100  GetCurrentDirectoryW(MAX_PATH, org_path);
2101 
2102  SetCurrentDirectoryA(drv_path);
2103  }
2104 
2105  /* query current directory path of the specified drive */
2107 
2108  /* back to the original drive */
2109  if (drive)
2110  SetCurrentDirectoryW(org_path);
2111 
2112  if (!ret)
2113  return GetLastError();
2114 
2115  return 0;
2116 }
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:421
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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:26
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 341 of file shlfileop.cpp.

342 {
343  DWORD len = MultiByteToWideChar(CP_ACP, 0, aPath, -1, NULL, 0);
344 
345  if (len < minChars)
346  len = minChars;
347 
348  *wPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
349  if (*wPath)
350  {
351  MultiByteToWideChar(CP_ACP, 0, aPath, -1, *wPath, len);
352  return NO_ERROR;
353  }
354  return E_OUTOFMEMORY;
355 }
#define CP_ACP
Definition: compat.h:99
#define NO_ERROR
Definition: dderror.h:5
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
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 MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by SHCreateDirectoryExA().

◆ SHELL32_FreeUnicodeBuf()

static void SHELL32_FreeUnicodeBuf ( LPWSTR  wPath)
static

Definition at line 357 of file shlfileop.cpp.

358 {
359  HeapFree(GetProcessHeap(), 0, wPath);
360 }
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by SHCreateDirectoryExA().

◆ SHELL_ConfirmDialogW()

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

Definition at line 298 of file shlfileop.cpp.

299 {
300  WCHAR szCaption[255], szText[255], szBuffer[MAX_PATH + 256];
302  DWORD_PTR args[1];
303  HICON hIcon;
304  int ret;
305 
306  assert(nKindOfDialog >= 0 && nKindOfDialog < 32);
307  if (op && (op->dwYesToAllMask & (1 << nKindOfDialog)))
308  return TRUE;
309 
310  if (!SHELL_ConfirmIDs(nKindOfDialog, &ids)) return FALSE;
311 
312  LoadStringW(shell32_hInstance, ids.caption_resource_id, szCaption, sizeof(szCaption)/sizeof(WCHAR));
313  LoadStringW(shell32_hInstance, ids.text_resource_id, szText, sizeof(szText)/sizeof(WCHAR));
314 
315  args[0] = (DWORD_PTR)szDir;
317  szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)args);
318  hIcon = LoadIconW(ids.hIconInstance, (LPWSTR)MAKEINTRESOURCE(ids.icon_resource_id));
319 
320  ret = SHELL_ConfirmMsgBox(hWnd, szBuffer, szCaption, hIcon, op && op->bManyItems);
321  if (op)
322  {
323  if (ret == IDC_YESTOALL)
324  {
325  op->dwYesToAllMask |= (1 << nKindOfDialog);
326  ret = IDYES;
327  }
328  if (ret == IDCANCEL)
329  op->bCancelled = TRUE;
330  if (ret != IDYES)
331  op->req->fAnyOperationsAborted = TRUE;
332  }
333  return ret == IDYES;
334 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
#define DWORD_PTR
Definition: treelist.c:76
#define IDYES
Definition: winuser.h:829
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:405
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:402
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
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
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:227
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
int ret
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define IDC_YESTOALL
Definition: shresdef.h:365
HICON hIcon
Definition: msconfig.c:44
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
UINT op
Definition: effect.c:223
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:208

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 227 of file shlfileop.cpp.

228 {
229  ids->hIconInstance = shell32_hInstance;
230  switch (nKindOfDialog)
231  {
232  case ASK_DELETE_FILE:
233  ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
234  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
235  ids->text_resource_id = IDS_DELETEITEM_TEXT;
236  return TRUE;
237 
238  case ASK_DELETE_FOLDER:
239  ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
240  ids->caption_resource_id = IDS_DELETEFOLDER_CAPTION;
241  ids->text_resource_id = IDS_DELETEITEM_TEXT;
242  return TRUE;
243 
245  ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
246  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
247  ids->text_resource_id = IDS_DELETEMULTIPLE_TEXT;
248  return TRUE;
249 
250  case ASK_TRASH_FILE:
251  ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
252  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
253  ids->text_resource_id = IDS_TRASHITEM_TEXT;
254  return TRUE;
255 
256  case ASK_TRASH_FOLDER:
257  ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
258  ids->caption_resource_id = IDS_DELETEFOLDER_CAPTION;
259  ids->text_resource_id = IDS_TRASHFOLDER_TEXT;
260  return TRUE;
261 
263  ids->icon_resource_id = IDI_SHELL_TRASH_FILE;
264  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
265  ids->text_resource_id = IDS_TRASHMULTIPLE_TEXT;
266  return TRUE;
267 
268  case ASK_CANT_TRASH_ITEM:
269  ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
270  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
271  ids->text_resource_id = IDS_CANTTRASH_TEXT;
272  return TRUE;
273 
274  case ASK_DELETE_SELECTED:
275  ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
276  ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
277  ids->text_resource_id = IDS_DELETESELECTED_TEXT;
278  return TRUE;
279 
280  case ASK_OVERWRITE_FILE:
281  ids->icon_resource_id = IDI_SHELL_FOLDER_MOVE2;
282  ids->caption_resource_id = IDS_OVERWRITEFILE_CAPTION;
283  ids->text_resource_id = IDS_OVERWRITEFILE_TEXT;
284  return TRUE;
285 
287  ids->icon_resource_id = IDI_SHELL_FOLDER_MOVE2;
288  ids->caption_resource_id = IDS_OVERWRITEFILE_CAPTION;
289  ids->text_resource_id = IDS_OVERWRITEFOLDER_TEXT;
290  return TRUE;
291 
292  default:
293  FIXME(" Unhandled nKindOfDialog %d stub\n", nKindOfDialog);
294  }
295  return FALSE;
296 }
#define ASK_CANT_TRASH_ITEM
Definition: shell32_main.h:121
#define TRUE
Definition: types.h:120
#define IDI_SHELL_CONFIRM_DELETE
Definition: shresdef.h:549
#define ASK_DELETE_FILE
Definition: shell32_main.h:112
#define IDS_OVERWRITEFILE_CAPTION
Definition: shresdef.h:118
#define ASK_TRASH_FILE
Definition: shell32_main.h:118
#define IDS_DELETEITEM_CAPTION
Definition: shresdef.h:114
#define ASK_DELETE_SELECTED
Definition: shell32_main.h:117
#define IDS_OVERWRITEFOLDER_TEXT
Definition: shresdef.h:125
#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:622
#define IDS_DELETEFOLDER_CAPTION
Definition: shresdef.h:115
GLuint * ids
Definition: glext.h:5907
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
#define FIXME(fmt,...)
Definition: debug.h:110
#define ASK_DELETE_FOLDER
Definition: shell32_main.h:113
#define IDS_DELETEITEM_TEXT
Definition: shresdef.h:116
#define ASK_DELETE_MULTIPLE_ITEM
Definition: shell32_main.h:114
#define IDI_SHELL_TRASH_FILE
Definition: shresdef.h:534
#define IDS_TRASHFOLDER_TEXT
Definition: shresdef.h:121
#define ASK_OVERWRITE_FILE
Definition: shell32_main.h:116
#define IDS_OVERWRITEFILE_TEXT
Definition: resource.h:54
#define IDS_DELETEMULTIPLE_TEXT
Definition: shresdef.h:117
#define IDS_DELETESELECTED_TEXT
Definition: shresdef.h:120
#define ASK_OVERWRITE_FOLDER
Definition: shell32_main.h:122
#define IDS_TRASHMULTIPLE_TEXT
Definition: shresdef.h:123
#define IDS_TRASHITEM_TEXT
Definition: shresdef.h:122
#define IDS_CANTTRASH_TEXT
Definition: shresdef.h:124

Referenced by SHELL_ConfirmDialogW().

◆ SHELL_ConfirmMsgBox()

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

Definition at line 208 of file shlfileop.cpp.

209 {
210  struct confirm_msg_info info;
211 
212  info.lpszText = lpszText;
213  info.lpszCaption = lpszCaption;
214  info.hIcon = hIcon;
215  info.bYesToAll = bYesToAll;
217 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDD_YESTOALL_MSGBOX
Definition: shresdef.h:364
HWND hWnd
Definition: settings.c:17
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
LONG_PTR LPARAM
Definition: windef.h:208
static INT_PTR CALLBACK ConfirmMsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: shlfileop.cpp:190
HICON hIcon
Definition: msconfig.c:44
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LPWSTR lpszCaption
Definition: shlfileop.cpp:95

Referenced by SHELL_ConfirmDialogW().

◆ SHELL_ConfirmYesNoW()

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

Definition at line 336 of file shlfileop.cpp.

337 {
338  return SHELL_ConfirmDialogW(hWnd, nKindOfDialog, szDir, NULL);
339 }
HWND hWnd
Definition: settings.c:17
smooth NULL
Definition: ftsmooth.c:416
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
Definition: shlfileop.cpp:298

◆ SHELL_DeleteDirectoryW()

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

Definition at line 374 of file shlfileop.cpp.

375 {
376  BOOL ret = TRUE;
377  HANDLE hFind;
378  WIN32_FIND_DATAW wfd;
379  WCHAR szTemp[MAX_PATH];
380 
381  /* Make sure the directory exists before eventually prompting the user */
383  hFind = FindFirstFileW(szTemp, &wfd);
384  if (hFind == INVALID_HANDLE_VALUE)
385  return FALSE;
386 
387  if (!bShowUI || (ret = SHELL_ConfirmDialogW(op->req->hwnd, ASK_DELETE_FOLDER, pszDir, NULL)))
388  {
389  do
390  {
391  if (IsDotDir(wfd.cFileName))
392  continue;
393  PathCombineW(szTemp, pszDir, wfd.cFileName);
394  if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)
395  ret = SHELL_DeleteDirectoryW(op, szTemp, FALSE);
396  else
397  ret = (SHNotifyDeleteFileW(op, szTemp) == ERROR_SUCCESS);
398 
399  if (op->progress != NULL)
400  op->bCancelled |= op->progress->HasUserCancelled();
401  } while (ret && FindNextFileW(hFind, &wfd) && !op->bCancelled);
402  }
403  FindClose(hFind);
404  if (ret)
406  return ret;
407 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define ASK_DELETE_FOLDER
Definition: shell32_main.h:113
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
static const WCHAR wWildcardFile[]
Definition: shlfileop.cpp:38
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ LPCSTR pszDir
Definition: shellapi.h:580
#define MAX_PATH
Definition: compat.h:26
static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
Definition: shlfileop.cpp:298
static DWORD SHNotifyRemoveDirectoryW(LPCWSTR path)
Definition: shlfileop.cpp:451
int ret
static DWORD SHNotifyDeleteFileW(FILE_OPERATION *op, LPCWSTR path)
Definition: shlfileop.cpp:610
#define IsDotDir(x)
Definition: shlfileop.cpp:32
BOOL SHELL_DeleteDirectoryW(FILE_OPERATION *op, LPCWSTR pszDir, BOOL bShowUI)
Definition: shlfileop.cpp:374
UINT op
Definition: effect.c:223
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:189
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 1000 of file shlfileop.cpp.

1001 {
1002  int errCode, retCode;
1003  SHFILEOPSTRUCTW nFileOp = { 0 };
1004 
1005  // Convert A information to W
1006  nFileOp.hwnd = lpFileOp->hwnd;
1007  nFileOp.wFunc = lpFileOp->wFunc;
1008  nFileOp.fFlags = lpFileOp->fFlags;
1009 
1010  errCode = _ConvertAtoW(lpFileOp->pFrom, &nFileOp.pFrom, TRUE);
1011  if (errCode != 0)
1012  goto cleanup;
1013 
1014  if (FO_DELETE != (nFileOp.wFunc & FO_MASK))
1015  {
1016  errCode = _ConvertAtoW(lpFileOp->pTo, &nFileOp.pTo, TRUE);
1017  if (errCode != 0)
1018  goto cleanup;
1019  }
1020 
1021  if (nFileOp.fFlags & FOF_SIMPLEPROGRESS)
1022  {
1023  errCode = _ConvertAtoW(lpFileOp->lpszProgressTitle, &nFileOp.lpszProgressTitle, FALSE);
1024  if (errCode != 0)
1025  goto cleanup;
1026  }
1027 
1028  // Call the actual function
1029  retCode = SHFileOperationW(&nFileOp);
1030 
1031  // Cleanup
1032 cleanup:
1033  if (nFileOp.pFrom)
1034  HeapFree(GetProcessHeap(), 0, (PVOID) nFileOp.pFrom);
1035  if (nFileOp.pTo)
1036  HeapFree(GetProcessHeap(), 0, (PVOID) nFileOp.pTo);
1037  if (nFileOp.lpszProgressTitle)
1039 
1040  if (errCode != 0)
1041  {
1042  lpFileOp->fAnyOperationsAborted = TRUE;
1043  SetLastError(errCode);
1044 
1045  return errCode;
1046  }
1047 
1048  // Thankfully, starting with NT4 the name mappings are always unicode, so no need to convert.
1049  lpFileOp->hNameMappings = nFileOp.hNameMappings;
1050  lpFileOp->fAnyOperationsAborted = nFileOp.fAnyOperationsAborted;
1051  return retCode;
1052 }
#define TRUE
Definition: types.h:120
PVOID hNameMappings
Definition: shellapi.h:359
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:1925
BOOL fAnyOperationsAborted
Definition: shellapi.h:358
LPCSTR lpszProgressTitle
Definition: shellapi.h:350
LPCWSTR lpszProgressTitle
Definition: shellapi.h:360
#define GetProcessHeap()
Definition: compat.h:403
#define SetLastError(x)
Definition: compat.h:417
#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
static DWORD _ConvertAtoW(PCSTR strSrc, PCWSTR *pStrDest, BOOL isList)
Definition: shlfileop.cpp:938
char * cleanup(char *str)
Definition: wpickclick.c:99
#define FO_DELETE
Definition: shellapi.h:135
#define HeapFree(x, y, z)
Definition: compat.h:402

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 1925 of file shlfileop.cpp.

1926 {
1928  FILE_LIST flFrom, flTo;
1929  int ret = 0;
1930 
1931  if (!lpFileOp)
1932  return ERROR_INVALID_PARAMETER;
1933 
1934  ret = CoInitialize(NULL);
1935  if (FAILED(ret))
1936  return ret;
1937 
1938  lpFileOp->fAnyOperationsAborted = FALSE;
1939  check_flags(lpFileOp->fFlags);
1940 
1941  ZeroMemory(&flFrom, sizeof(FILE_LIST));
1942  ZeroMemory(&flTo, sizeof(FILE_LIST));
1943 
1944  if ((ret = parse_file_list(&flFrom, lpFileOp->pFrom)))
1945  return ret;
1946 
1947  if (lpFileOp->wFunc != FO_DELETE)
1948  parse_file_list(&flTo, lpFileOp->pTo);
1949 
1950  ZeroMemory(&op, sizeof(op));
1951  op.req = lpFileOp;
1952  op.totalSize.QuadPart = 0ull;
1953  op.completedSize.QuadPart = 0ull;
1954  op.bManyItems = (flFrom.dwNumFiles > 1);
1955 
1956 #ifdef __REACTOS__
1957  ret = validate_operation(lpFileOp, &flFrom, &flTo);
1958  if (ret)
1959  goto cleanup;
1960 #endif
1961  if (lpFileOp->wFunc != FO_RENAME && !(lpFileOp->fFlags & FOF_SILENT)) {
1962  ret = CoCreateInstance(CLSID_ProgressDialog,
1963  NULL,
1964  CLSCTX_INPROC_SERVER,
1965  IID_PPV_ARG(IProgressDialog, &op.progress));
1966  if (FAILED(ret))
1967  goto cleanup;
1968 
1969  op.progress->StartProgressDialog(op.req->hwnd, NULL, PROGDLG_NORMAL & PROGDLG_AUTOTIME, NULL);
1971  _FileOpCountManager(&op, &flFrom);
1972  }
1973 
1974  switch (lpFileOp->wFunc)
1975  {
1976  case FO_COPY:
1977  ret = copy_files(&op, op.req->fFlags & FOF_MULTIDESTFILES, &flFrom, &flTo);
1978  break;
1979  case FO_DELETE:
1980  ret = delete_files(&op, &flFrom);
1981  break;
1982  case FO_MOVE:
1983  ret = move_files(&op, op.req->fFlags & FOF_MULTIDESTFILES, &flFrom, &flTo);
1984  break;
1985  case FO_RENAME:
1986  ret = rename_files(&op, &flFrom, &flTo);
1987  break;
1988  default:
1990  break;
1991  }
1992 
1993  if (op.progress) {
1994  op.progress->StopProgressDialog();
1995  op.progress->Release();
1996  }
1997 
1998 cleanup:
1999  destroy_file_list(&flFrom);
2000 
2001  if (lpFileOp->wFunc != FO_DELETE)
2002  destroy_file_list(&flTo);
2003 
2004  if (ret == ERROR_CANCELLED)
2005  lpFileOp->fAnyOperationsAborted = TRUE;
2006 
2007  CoUninitialize();
2008 
2009  return ret;
2010 }
static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles)
Definition: shlfileop.cpp:1146
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static HRESULT rename_files(FILE_OPERATION *op, const FILE_LIST *flFrom, const FILE_LIST *flTo)
Definition: shlfileop.cpp:1773
#define TRUE
Definition: types.h:120
DWORD WINAPI _FileOpCountManager(FILE_OPERATION *op, const FILE_LIST *flFrom)
Definition: shlfileop.cpp:2249
#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:1548
#define ZeroMemory
Definition: winbase.h:1642
static HRESULT copy_files(FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, FILE_LIST *flTo)
Definition: shlfileop.cpp:1398
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:480
#define FO_MOVE
Definition: shellapi.h:133
BOOL fAnyOperationsAborted
Definition: shellapi.h:358
static void check_flags(FILEOP_FLAGS fFlags)
Definition: shlfileop.cpp:1799
DWORD dwNumFiles
Definition: shlfileop.cpp:70
static void destroy_file_list(FILE_LIST *flList)
Definition: shlfileop.cpp:1216
static DWORD move_files(FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, const FILE_LIST *flTo)
Definition: shlfileop.cpp:1693
smooth NULL
Definition: ftsmooth.c:416
#define PROGDLG_AUTOTIME
Definition: shlobj.h:884
#define PROGDLG_NORMAL
Definition: shlobj.h:882
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
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
char * cleanup(char *str)
Definition: wpickclick.c:99
UINT op
Definition: effect.c:223
#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(), RecycleBin5_RecycleBin5_Restore(), SHFileOperationA(), SHFileOperationWrapW(), and test_unicode().

◆ SHFindAttrW()

static DWORD SHFindAttrW ( LPCWSTR  pName,
BOOL  fileOnly 
)
static

Definition at line 909 of file shlfileop.cpp.

910 {
911  WIN32_FIND_DATAW wfd;
912  BOOL b_FileMask = fileOnly && (NULL != StrPBrkW(pName, wWildcardChars));
914  HANDLE hFind = FindFirstFileW(pName, &wfd);
915 
916  TRACE("%s %d\n", debugstr_w(pName), fileOnly);
917  if (INVALID_HANDLE_VALUE != hFind)
918  {
919  do
920  {
921  if (b_FileMask && IsAttribDir(wfd.dwFileAttributes))
922  continue;
923  dwAttr = wfd.dwFileAttributes;
924  break;
925  } while (FindNextFileW(hFind, &wfd));
926 
927  FindClose(hFind);
928  }
929  return dwAttr;
930 }
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:399
unsigned int BOOL
Definition: ntddk_ex.h:94
static const WCHAR wWildcardChars[]
Definition: shlfileop.cpp:39
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#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
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 2035 of file shlfileop.cpp.

2036 {
2037  if (hNameMapping)
2038  {
2039  DSA_DestroyCallback((HDSA) hNameMapping, _DestroyCallback, NULL);
2040  }
2041 }
Definition: dsa.c:44
smooth NULL
Definition: ftsmooth.c:416
static int CALLBACK _DestroyCallback(void *p, void *pData)
Definition: shlfileop.cpp:2013
void WINAPI DSA_DestroyCallback(HDSA hdsa, PFNDSAENUMCALLBACK enumProc, LPVOID lParam)
Definition: dsa.c:432

◆ SHIsFileAvailableOffline()

EXTERN_C HRESULT WINAPI SHIsFileAvailableOffline ( LPCWSTR  path,
LPDWORD  status 
)

Definition at line 362 of file shlfileop.cpp.

363 {
364  FIXME("(%s, %p) stub\n", debugstr_w(path), status);
365  return E_FAIL;
366 }
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
Definition: ps.c:97

◆ SHNotifyCopyFileW()

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

Definition at line 730 of file shlfileop.cpp.

731 {
732  BOOL ret;
733  DWORD attribs;
734 
735  TRACE("(%s %s %s)\n", debugstr_w(src), debugstr_w(dest), bFailIfExists ? "failIfExists" : "");
736 
738 
739  /* Destination file may already exist with read only attribute */
743 
745  {
748  {
749  TRACE("[shell32, SHNotifyCopyFileW] STILL SHIT\n");
750  }
751  }
752 
753  ret = CopyFileExW(src, dest, SHCopyProgressRoutine, op, &op->bCancelled, bFailIfExists);
754  if (ret)
755  {
757  return ERROR_SUCCESS;
758  }
759 
760  return GetLastError();
761 }
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:944
#define ERROR_SUCCESS
Definition: deptool.c:10
const GLint * attribs
Definition: glext.h:10538
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#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
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
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
Definition: changenotify.c:340
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:563
#define SHCNF_PATHW
Definition: shlobj.h:1755
#define IsAttrib(x, y)
Definition: shlfileop.cpp:29
UINT op
Definition: effect.c:223
static char * dest
Definition: rtl.c:135
#define SHCNE_CREATE
Definition: shlobj.h:1721
static void _SetOperationTexts(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest)
Definition: shlfileop.cpp:513

Referenced by copy_file_to_file().

◆ SHNotifyCreateDirectoryW()

static DWORD SHNotifyCreateDirectoryW ( LPCWSTR  path,
LPSECURITY_ATTRIBUTES  sec 
)
static

Definition at line 421 of file shlfileop.cpp.

422 {
423  TRACE("(%s, %p)\n", debugstr_w(path), sec);
424 
425  if (CreateDirectoryW(path, sec))
426  {
428  return ERROR_SUCCESS;
429  }
430  return GetLastError();
431 }
#define SHCNE_MKDIR
Definition: shlobj.h:1723
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:1059
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
Definition: changenotify.c:340
#define SHCNF_PATHW
Definition: shlobj.h:1755

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 610 of file shlfileop.cpp.

611 {
612  BOOL ret;
613 
614  TRACE("(%s)\n", debugstr_w(path));
615 
617 
619  FileSize.QuadPart = 0;
620 
621  WIN32_FIND_DATAW wfd;
622  HANDLE hFile = FindFirstFileW(path, &wfd);
623  if (hFile != INVALID_HANDLE_VALUE && IsAttribFile(wfd.dwFileAttributes)) {
624  ULARGE_INTEGER tmp;
625  tmp.u.LowPart = wfd.nFileSizeLow;
626  tmp.u.HighPart = wfd.nFileSizeHigh;
627  FileSize.QuadPart = tmp.QuadPart;
628  }
629  FindClose(hFile);
630 
631  ret = DeleteFileW(path);
632  if (!ret)
633  {
634  /* File may be write protected or a system file */
635  DWORD dwAttr = GetFileAttributesW(path);
638  ret = DeleteFileW(path);
639  }
640  if (ret)
641  {
642  // Bit of a hack to make the progress bar move. We don't have progress inside the file, so inform when done.
645  return ERROR_SUCCESS;
646  }
647  return GetLastError();
648 }
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:944
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define CALLBACK_STREAM_SWITCH
Definition: winbase.h:151
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
smooth NULL
Definition: ftsmooth.c:416
#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
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
Definition: changenotify.c:340
_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:563
#define SHCNF_PATHW
Definition: shlobj.h:1755
#define SHCNE_DELETE
Definition: shlobj.h:1722
#define IsAttrib(x, y)
Definition: shlfileop.cpp:29
UINT op
Definition: effect.c:223
static void _SetOperationTexts(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest)
Definition: shlfileop.cpp:513
#define IsAttribFile(x)
Definition: shlfileop.cpp:30
struct _ULARGE_INTEGER::@3769 u
LONGLONG QuadPart
Definition: typedefs.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 delete_files(), SHELL_DeleteDirectoryW(), and Win32DeleteFileW().

◆ SHNotifyMoveFileW()

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

Definition at line 679 of file shlfileop.cpp.

680 {
681  BOOL ret;
682 
683  TRACE("(%s %s)\n", debugstr_w(src), debugstr_w(dest));
684 
686 
688 
689  /* MOVEFILE_REPLACE_EXISTING fails with dirs, so try MoveFile */
690  if (!ret)
691  ret = MoveFileW(src, dest);
692 
693  if (!ret)
694  {
695  DWORD dwAttr;
696 
697  dwAttr = SHFindAttrW(dest, FALSE);
698  if (INVALID_FILE_ATTRIBUTES == dwAttr)
699  {
700  /* Source file may be write protected or a system file */
701  dwAttr = GetFileAttributesW(src);
704  ret = MoveFileW(src, dest);
705  }
706  }
707  if (ret)
708  {
711  return ERROR_SUCCESS;
712  }
713  return GetLastError();
714 }
#define SHCNE_MKDIR
Definition: shlobj.h:1723
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:944
#define SHCNE_RMDIR
Definition: shlobj.h:1724
#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:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1044
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
int ret
GLenum src
Definition: glext.h:6340
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
Definition: changenotify.c:340
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:563
#define SHCNF_PATHW
Definition: shlobj.h:1755
static DWORD SHFindAttrW(LPCWSTR pName, BOOL fileOnly)
Definition: shlfileop.cpp:909
#define SHCNE_DELETE
Definition: shlobj.h:1722
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
UINT op
Definition: effect.c:223
static char * dest
Definition: rtl.c:135
#define SHCNE_CREATE
Definition: shlobj.h:1721
static void _SetOperationTexts(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest)
Definition: shlfileop.cpp:513

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

◆ SHNotifyRemoveDirectoryW()

static DWORD SHNotifyRemoveDirectoryW ( LPCWSTR  path)
static

Definition at line 451 of file shlfileop.cpp.

452 {
453  BOOL ret;
454  TRACE("(%s)\n", debugstr_w(path));
455 
457  if (!ret)
458  {
459  /* Directory may be write protected */
460  DWORD dwAttr = GetFileAttributesW(path);
461  if (IsAttrib(dwAttr, FILE_ATTRIBUTE_READONLY))
464  }
465  if (ret)
466  {
468  return ERROR_SUCCESS;
469  }
470  return GetLastError();
471 }
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:944
#define SHCNE_RMDIR
Definition: shlobj.h:1724
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
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
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
Definition: changenotify.c:340
#define SHCNF_PATHW
Definition: shlobj.h:1755
#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 2234 of file shlfileop.cpp.

2235 {
2236  WCHAR wpath[MAX_PATH];
2237  MultiByteToWideChar( CP_ACP, 0, path, -1, wpath, MAX_PATH);
2238  return SHPathPrepareForWriteW(hwnd, modless, wpath, flags);
2239 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CP_ACP
Definition: compat.h:99
EXTERN_C HRESULT WINAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *modless, LPCWSTR path, DWORD flags)
Definition: shlfileop.cpp:2171
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
GLbitfield flags
Definition: glext.h:7161
#define MultiByteToWideChar
Definition: compat.h:100

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

◆ SHPathPrepareForWriteW()

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

Definition at line 2171 of file shlfileop.cpp.

2172 {
2173  DWORD res;
2174  DWORD err;
2175  LPCWSTR realpath;
2176  int len;
2177  WCHAR* last_slash;
2178  WCHAR* temppath=NULL;
2179 
2180  TRACE("%p %p %s 0x%08x\n", hwnd, modless, debugstr_w(path), flags);
2181 
2183  FIXME("unimplemented flags 0x%08x\n", flags);
2184 
2185  /* cut off filename if necessary */
2187  {
2188  last_slash = StrRChrW(path, NULL, '\\');
2189  if (last_slash == NULL)
2190  len = 1;
2191  else
2192  len = last_slash - path + 1;
2193  temppath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
2194  if (!temppath)
2195  return E_OUTOFMEMORY;
2196  StrCpyNW(temppath, path, len);
2197  realpath = temppath;
2198  }
2199  else
2200  {
2201  realpath = path;
2202  }
2203 
2204  /* try to create the directory if asked to */
2206  {
2207  if (flags & SHPPFW_ASKDIRCREATE)
2208  FIXME("treating SHPPFW_ASKDIRCREATE as SHPPFW_DIRCREATE\n");
2209 
2210  SHCreateDirectoryExW(0, realpath, NULL);
2211  }
2212 
2213  /* check if we can access the directory */
2214  res = GetFileAttributesW(realpath);
2215 
2216  HeapFree(GetProcessHeap(), 0, temppath);
2217 
2219  {
2220  err = GetLastError();
2221  if (err == ERROR_FILE_NOT_FOUND)
2223  return HRESULT_FROM_WIN32(err);
2224  }
2225  else if (res & FILE_ATTRIBUTE_DIRECTORY)
2226  return S_OK;
2227  else
2229 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#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:1059
#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:802
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#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:403
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:59
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:846
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
LPWSTR WINAPI StrRChrW(LPCWSTR str, LPCWSTR end, WORD ch)
Definition: string.c:556
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by SHPathPrepareForWriteA(), and test_sh_path_prepare().

◆ try_find_new_name()

static CStringW try_find_new_name ( LPCWSTR  szDestPath)
static

Definition at line 1233 of file shlfileop.cpp.

1234 {
1235  CStringW mask(szDestPath);
1236  CStringW ext(PathFindExtensionW(szDestPath));
1237 
1238  // cut off extension before inserting a "new file" mask
1239  if (!ext.IsEmpty())
1240  {
1241  mask = mask.Left(mask.GetLength() - ext.GetLength());
1242  }
1243  mask += L" (%d)" + ext;
1244 
1245  CStringW newName;
1246 
1247  // trying to find new file name
1248  for (int i = 1; i < NEW_FILENAME_ON_COPY_TRIES; i++)
1249  {
1250  newName.Format(mask, i);
1251 
1252  if (!PathFileExistsW(newName))
1253  {
1254  return newName;
1255  }
1256  }
1257 
1258  return CStringW();
1259 }
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:668
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
GLenum GLint GLuint mask
Definition: glext.h:6028
char ext[3]
Definition: mkdosfs.c:358
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:442
static const WCHAR L[]
Definition: oid.c:1250
#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 1090 of file shlfileop.cpp.

1091 {
1092  LPCWSTR ptr;
1093  LPCWSTR ptr2;
1094  LPWSTR szFullPath;
1095  DWORD dwDirLen, dwFullLen;
1096 
1097  ptr = StrRChrW(szWildCard, NULL, '\\');
1098  ptr2 = StrRChrW(szWildCard, NULL, '/');
1099  if (!ptr || ptr < ptr2)
1100  ptr = ptr2;
1101  dwDirLen = ptr - szWildCard + 1;
1102 
1103  dwFullLen = dwDirLen + lstrlenW(szFileName) + 1;
1104  szFullPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwFullLen * sizeof(WCHAR));
1105 
1106  lstrcpynW(szFullPath, szWildCard, dwDirLen + 1);
1107  lstrcatW(szFullPath, szFileName);
1108 
1109  return szFullPath;
1110 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define lstrlenW
Definition: compat.h:415
#define lstrcpynW
Definition: compat.h:405
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
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 435 of file shlfileop.cpp.

436 {
437  return (SHNotifyCreateDirectoryW(path, sec) == ERROR_SUCCESS);
438 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:421

◆ Win32DeleteFileW()

EXTERN_C DWORD WINAPI Win32DeleteFileW ( LPCWSTR  path)

Definition at line 661 of file shlfileop.cpp.

662 {
664 }
#define ERROR_SUCCESS
Definition: deptool.c:10
smooth NULL
Definition: ftsmooth.c:416
static DWORD SHNotifyDeleteFileW(FILE_OPERATION *op, LPCWSTR path)
Definition: shlfileop.cpp:610

◆ Win32RemoveDirectoryW()

EXTERN_C BOOL WINAPI Win32RemoveDirectoryW ( LPCWSTR  path)

Definition at line 475 of file shlfileop.cpp.

476 {
478 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static DWORD SHNotifyRemoveDirectoryW(LPCWSTR path)
Definition: shlfileop.cpp:451

Referenced by move_dir_to_dir().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ CONFIRM_MSG_PROP

const WCHAR CONFIRM_MSG_PROP[] = {'W','I','N','E','_','C','O','N','F','I','R','M',0}
static

Definition at line 90 of file shlfileop.cpp.

Referenced by ConfirmMsgBox_Init(), and ConfirmMsgBox_Paint().

◆ wWildcardChars

const WCHAR wWildcardChars[] = {'*','?',0}
static

Definition at line 39 of file shlfileop.cpp.

Referenced by parse_file_list(), and SHFindAttrW().

◆ wWildcardFile

const WCHAR wWildcardFile[] = {'*',0}
static

Definition at line 38 of file shlfileop.cpp.

Referenced by SHELL_DeleteDirectoryW().