Commit 0a3a741a authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

xcopy: Add support for /H (Hidden/System).

parent 432d81d7
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#define OPT_SHORTNAME 0x00000200 #define OPT_SHORTNAME 0x00000200
#define OPT_MUSTEXIST 0x00000400 #define OPT_MUSTEXIST 0x00000400
#define OPT_REPLACEREAD 0x00000800 #define OPT_REPLACEREAD 0x00000800
#define OPT_COPYHIDSYS 0x00001000
#define MAXSTRING 8192 #define MAXSTRING 8192
...@@ -157,6 +158,7 @@ int main (int argc, char *argv[]) ...@@ -157,6 +158,7 @@ int main (int argc, char *argv[])
case 'N': flags |= OPT_SHORTNAME; break; case 'N': flags |= OPT_SHORTNAME; break;
case 'U': flags |= OPT_MUSTEXIST; break; case 'U': flags |= OPT_MUSTEXIST; break;
case 'R': flags |= OPT_REPLACEREAD; break; case 'R': flags |= OPT_REPLACEREAD; break;
case 'H': flags |= OPT_COPYHIDSYS; break;
case '-': if (toupper(argvW[0][2])=='Y') case '-': if (toupper(argvW[0][2])=='Y')
flags &= ~OPT_NOPROMPT; break; flags &= ~OPT_NOPROMPT; break;
default: default:
...@@ -390,7 +392,7 @@ static int XCOPY_DoCopy(WCHAR *srcstem, WCHAR *srcspec, ...@@ -390,7 +392,7 @@ static int XCOPY_DoCopy(WCHAR *srcstem, WCHAR *srcspec,
BOOL findres = TRUE; BOOL findres = TRUE;
WCHAR *inputpath, *outputpath; WCHAR *inputpath, *outputpath;
BOOL copiedFile = FALSE; BOOL copiedFile = FALSE;
DWORD destAttribs; DWORD destAttribs, srcAttribs;
BOOL skipFile; BOOL skipFile;
/* Allocate some working memory on heap to minimize footprint */ /* Allocate some working memory on heap to minimize footprint */
...@@ -440,9 +442,20 @@ static int XCOPY_DoCopy(WCHAR *srcstem, WCHAR *srcspec, ...@@ -440,9 +442,20 @@ static int XCOPY_DoCopy(WCHAR *srcstem, WCHAR *srcspec,
wine_dbgstr_w(copyTo)); wine_dbgstr_w(copyTo));
if (!copiedFile && !(flags & OPT_SIMULATE)) XCOPY_CreateDirectory(deststem); if (!copiedFile && !(flags & OPT_SIMULATE)) XCOPY_CreateDirectory(deststem);
/* See if allowed to copy it */
srcAttribs = GetFileAttributesW(copyFrom);
if ((srcAttribs & FILE_ATTRIBUTE_HIDDEN) ||
(srcAttribs & FILE_ATTRIBUTE_SYSTEM)) {
if (!(flags & OPT_COPYHIDSYS)) {
skipFile = TRUE;
}
}
/* See if file exists */ /* See if file exists */
destAttribs = GetFileAttributesW(copyTo); destAttribs = GetFileAttributesW(copyTo);
if (destAttribs != INVALID_FILE_ATTRIBUTES && !(flags & OPT_NOPROMPT)) { if (!skipFile &&
destAttribs != INVALID_FILE_ATTRIBUTES && !(flags & OPT_NOPROMPT)) {
DWORD count; DWORD count;
char answer[10]; char answer[10];
BOOL answered = FALSE; BOOL answered = FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment