49#include <wine/unicode.h>
85 const WCHAR failedMsg[] = {
'F',
'a',
'i',
'l',
'e',
'd',
'!', 0};
102 static char *output_bufA =
NULL;
105#define MAX_WRITECONSOLE_SIZE 65535
121 WINE_FIXME(
"Out of memory - could not allocate 2 x 64K buffers\n");
138 output_bufW,
len, &nOut,
NULL);
145 DWORD convertedChars;
155 WINE_FIXME(
"Out of memory - could not allocate 2 x 64K buffers\n");
162 "?", &usedDefaultChar);
169 WINE_TRACE(
"Writing to console? (%d)\n", toConsole);
188 WINE_FIXME(
"FIXME: Cannot display message for error %d, status %d\n",
191 const WCHAR infostr[] = {
'%',
'1',
'\n', 0};
213 new_path[
len - 1] = 0;
228 if (!(slash =
wcsrchr(new_path,
'\\')) && ! (slash =
wcsrchr(new_path,
'/')))
234 len = slash - new_path;
241 new_path[
len] =
'\\';
254 WCHAR endChar = *endOfName;
257 const WCHAR readTextMode[] = {
'r',
't', 0};
265 if (inFile ==
NULL) {
267 *endOfName = endChar;
293 *endOfName = endChar;
299 *endOfName = endChar;
311 WCHAR *filenameStart = parms;
316 while (*parms && *parms !=
' ' && *parms !=
'/') {
323 filenameStart = parms+1;
328 if (filenameStart != parms) {
354 WCHAR *inputpath, *outputpath;
356 DWORD destAttribs, srcAttribs;
392 if (*destspec == 0x00) {
409 WINE_TRACE(
"Source attribs: %d\n", srcAttribs);
431 WINE_TRACE(
"Skipping file as modified date too old\n");
446 WINE_TRACE(
"Skipping file as dest newer or same date\n");
467 WINE_TRACE(
"Skipping file as matches exclude '%s'\n",
495 if (
toupper(answer[0]) == noChar[0])
497 else if (
toupper(answer[0]) != yesChar[0])
522 if (
toupper(answer[0]) == allChar[0])
524 else if (
toupper(answer[0]) == noChar[0])
526 else if (
toupper(answer[0]) != yesChar[0])
541 const WCHAR infostr[] = {
'%',
'1',
' ',
'-',
'>',
' ',
546 const WCHAR infostr[] = {
'%',
'1',
'\n', 0};
627 lstrcatW(inputpath, finddata->cFileName);
631 if (*destspec == 0x00) {
632 lstrcatW(outputpath, finddata->cFileName);
661 return c ==
' ' ||
c ==
'\t';
672 return c >=
'0' &&
c <=
'9';
684 for (; *
ptr !=
'\0' && *
ptr !=
'"' &&
687 in_quotes = !in_quotes;
691 if (in_quotes && *
ptr ==
'\0')
704 for (rp =
word, wp =
word; *rp !=
'\0'; rp++) {
718 const WCHAR EXCLUDE[] = {
'E',
'X',
'C',
'L',
'U',
'D',
'E',
':', 0};
746 if (suppliedsource[0] == 0x00) {
748 }
else if (supplieddestination[0] == 0x00) {
809 memset(&st, 0x00,
sizeof(st));
817 if (*
pos++ !=
'-') isError =
TRUE;
822 if (*
pos++ !=
'-') isError =
TRUE;
836 WCHAR datestring[32], timestring[32];
859 flags &= ~OPT_NOPROMPT;
881 if (!
skip && *rest && *rest !=
'/') {
893 if (supplieddestination[0] == 0x00)
927 lstrcpyW(suppliedsource, actualsource);
943 starPos =
wcschr(suppliedsource,
'*');
944 questPos =
wcschr(suppliedsource,
'?');
945 if (starPos || questPos) {
964 if (lastChar !=
'\\' && lastChar !=
':') {
978 lastDir =
wcsrchr(suppliedsource,
'\\');
982 stem[(lastDir-suppliedsource) + 1] = 0x00;
984 }
else if (suppliedsource[1] ==
':') {
1029 (supplieddestination[
lstrlenW(supplieddestination)-1] ==
'\\')) {
1035 char answer[10] =
"";
1043 while (answer[0] != fileChar[0] && answer[0] != dirChar[0]) {
1049 answer[0] =
toupper(answer[0]);
1052 if (answer[0] == dirChar[0]) {
1067 if (stem[
lstrlenW(stem)-1] !=
'\\') {
1102 const WCHAR PROMPTSTR1[] = {
'/',
'Y', 0};
1103 const WCHAR PROMPTSTR2[] = {
'/',
'y', 0};
1104 const WCHAR COPYCMD[] = {
'C',
'O',
'P',
'Y',
'C',
'M',
'D', 0};
1139 if (rc !=
RC_OK)
return rc;
1143 destinationspec, sourcespec,
flags);
1144 if (rc !=
RC_OK)
return rc;
1165 destinationstem, destinationspec,
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define MAX_WRITECONSOLE_SIZE
static WCHAR * XCOPY_LoadMessage(UINT id)
static BOOL XCOPY_ProcessExcludeFile(WCHAR *filename, WCHAR *endOfName)
static BOOL XCOPY_ProcessExcludeList(WCHAR *parms)
struct _EXCLUDELIST EXCLUDELIST
static FILETIME dateRange
static int XCOPY_ProcessDestParm(WCHAR *supplieddestination, WCHAR *stem, WCHAR *spec, WCHAR *srcspec, DWORD flags)
static int XCOPY_ProcessSourceParm(WCHAR *suppliedsource, WCHAR *stem, WCHAR *spec, DWORD flags)
static WCHAR copyFrom[MAX_PATH]
static int find_end_of_word(const WCHAR *word, WCHAR **end)
static WCHAR copyTo[MAX_PATH]
static BOOL XCOPY_CreateDirectory(const WCHAR *path)
static void XCOPY_FailMessage(DWORD err)
static const WCHAR wchr_star[]
static const WCHAR wchr_slash[]
static int XCOPY_DoCopy(WCHAR *srcstem, WCHAR *srcspec, WCHAR *deststem, WCHAR *destspec, DWORD flags)
static EXCLUDELIST * excludeList
static int WINAPIV XCOPY_wprintf(const WCHAR *format,...)
static const WCHAR wchr_dot[]
static void strip_quotes(WCHAR *word, WCHAR **end)
static const WCHAR wchr_dotdot[]
static BOOL is_whitespace(WCHAR c)
static int XCOPY_ParseCommandLine(WCHAR *suppliedsource, WCHAR *supplieddestination, DWORD *pflags)
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
#define ERROR_INVALID_PARAMETER
#define GetCurrentDirectoryW(x, y)
#define GetEnvironmentVariableW(x, y, z)
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
#define WideCharToMultiByte
static const WCHAR *const ext[]
static void cleanup(void)
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(VOID)
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
BOOL WINAPI GetFileTime(IN HANDLE hFile, OUT LPFILETIME lpCreationTime OPTIONAL, OUT LPFILETIME lpLastAccessTime OPTIONAL, OUT LPFILETIME lpLastWriteTime OPTIONAL)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI FindClose(HANDLE hFindFile)
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
LPWSTR WINAPI GetCommandLineW(VOID)
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
GLuint GLuint GLsizei count
GLuint GLsizei GLsizei * length
GLfloat GLfloat GLfloat GLfloat h
HLOCAL NTAPI LocalFree(HLOCAL hMem)
_Check_return_ _CRTIMP int __cdecl feof(_In_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_CRTIMP void __cdecl _wsplitpath(_In_z_ const wchar_t *_FullPath, _Pre_maybenull_ _Post_z_ wchar_t *_Drive, _Pre_maybenull_ _Post_z_ wchar_t *_Dir, _Pre_maybenull_ _Post_z_ wchar_t *_Filename, _Pre_maybenull_ _Post_z_ wchar_t *_Ext)
_Check_return_ _CRTIMP long __cdecl _wtol(_In_z_ const wchar_t *_Str)
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
#define ERROR_ALREADY_EXISTS
#define FILE_ATTRIBUTE_READONLY
#define FILE_ATTRIBUTE_HIDDEN
#define FILE_ATTRIBUTE_SYSTEM
#define FILE_ATTRIBUTE_ARCHIVE
#define FILE_ATTRIBUTE_DIRECTORY
#define LOCALE_USER_DEFAULT
static unsigned __int64 next
static void skip_whitespace()
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
struct _EXCLUDELIST * next
#define INVALID_FILE_ATTRIBUTES
#define STD_OUTPUT_HANDLE
DWORD WINAPI GetLastError(void)
#define FORMAT_MESSAGE_FROM_STRING
#define FORMAT_MESSAGE_FROM_SYSTEM
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
#define __ms_va_end(list)
#define __ms_va_start(list, arg)
#define ERROR_PATH_NOT_FOUND
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
DWORD WINAPI CharUpperBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)
wchar_t * fgetws(wchar_t *buf, int bufsize, FILE *file)