cmd: Use the explicit name for all A/W function.

This commit is contained in:
Alexandre Julliard 2009-12-09 18:52:40 +01:00
parent c09ac7a41f
commit 79b00726f2
5 changed files with 249 additions and 257 deletions

View File

@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = cmd.exe
APPMODE = -mconsole -municode
EXTRADEFS = -DUNICODE
EXTRADEFS = -DWINE_NO_UNICODE_MACROS
IMPORTS = shell32 user32 advapi32 kernel32
C_SRCS = \

View File

@ -61,16 +61,16 @@ void WCMD_batch (WCHAR *file, WCHAR *command, int called, WCHAR *startLabel, HAN
for(i=0; (i<sizeof(extension_batch)/(WCMD_BATCH_EXT_SIZE * sizeof(WCHAR))) &&
(h == INVALID_HANDLE_VALUE); i++) {
strcpyW (string, file);
CharLower (string);
CharLowerW (string);
if (strstrW (string, extension_batch[i]) == NULL) strcatW (string, extension_batch[i]);
h = CreateFile (string, GENERIC_READ, FILE_SHARE_READ,
h = CreateFileW (string, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
}
if (h == INVALID_HANDLE_VALUE) {
strcpyW (string, file);
CharLower (string);
CharLowerW (string);
if (strstrW (string, extension_exe) == NULL) strcatW (string, extension_exe);
if (GetFileAttributes (string) != INVALID_FILE_ATTRIBUTES) {
if (GetFileAttributesW (string) != INVALID_FILE_ATTRIBUTES) {
WCMD_run_program (command, 0);
} else {
SetLastError (ERROR_FILE_NOT_FOUND);
@ -425,9 +425,8 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
env[(end-start)] = 0x00;
/* If env var not found, return empty string */
if ((GetEnvironmentVariable(env, fullpath, MAX_PATH) == 0) ||
(SearchPath(fullpath, outputparam, NULL,
MAX_PATH, outputparam, NULL) == 0)) {
if ((GetEnvironmentVariableW(env, fullpath, MAX_PATH) == 0) ||
(SearchPathW(fullpath, outputparam, NULL, MAX_PATH, outputparam, NULL) == 0)) {
finaloutput[0] = 0x00;
outputparam[0] = 0x00;
skipFileParsing = TRUE;
@ -437,7 +436,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
/* After this, we need full information on the file,
which is valid not to exist. */
if (!skipFileParsing) {
if (GetFullPathName(outputparam, MAX_PATH, fullfilename, NULL) == 0)
if (GetFullPathNameW(outputparam, MAX_PATH, fullfilename, NULL) == 0)
return;
exists = GetFileAttributesExW(fullfilename, GetFileExInfoStandard,
@ -480,11 +479,11 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
/* Format the time */
FileTimeToSystemTime(&fileInfo.ftLastWriteTime, &systime);
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systime,
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systime,
NULL, thisoutput, MAX_PATH);
strcatW(thisoutput, space);
datelen = strlenW(thisoutput);
GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &systime,
GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &systime,
NULL, (thisoutput+datelen), MAX_PATH-datelen);
strcatW(finaloutput, thisoutput);
}
@ -499,7 +498,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
doneModifier = TRUE;
if (finaloutput[0] != 0x00) strcatW(finaloutput, space);
wsprintf(thisoutput, fmt, fullsize);
wsprintfW(thisoutput, fmt, fullsize);
strcatW(finaloutput, thisoutput);
}
@ -507,8 +506,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
if (memchrW(firstModifier, 's', modifierLen) != NULL) {
if (finaloutput[0] != 0x00) strcatW(finaloutput, space);
/* Don't flag as doneModifier - %~s on its own is processed later */
GetShortPathName(outputparam, outputparam,
sizeof(outputparam)/sizeof(outputparam[0]));
GetShortPathNameW(outputparam, outputparam, sizeof(outputparam)/sizeof(outputparam[0]));
}
/* 5. Handle 'f' : Fully qualified path (File doesn't have to exist) */

View File

@ -87,10 +87,10 @@ static BOOL WCMD_ask_confirm (WCHAR *message, BOOL showSureText, BOOL *optionAll
DWORD count = 0;
/* Load the translated 'Are you sure', plus valid answers */
LoadString (hinst, WCMD_CONFIRM, msgbuffer, sizeof(msgbuffer)/sizeof(WCHAR));
LoadString (hinst, WCMD_YES, Ybuffer, sizeof(Ybuffer)/sizeof(WCHAR));
LoadString (hinst, WCMD_NO, Nbuffer, sizeof(Nbuffer)/sizeof(WCHAR));
LoadString (hinst, WCMD_ALL, Abuffer, sizeof(Abuffer)/sizeof(WCHAR));
LoadStringW(hinst, WCMD_CONFIRM, msgbuffer, sizeof(msgbuffer)/sizeof(WCHAR));
LoadStringW(hinst, WCMD_YES, Ybuffer, sizeof(Ybuffer)/sizeof(WCHAR));
LoadStringW(hinst, WCMD_NO, Nbuffer, sizeof(Nbuffer)/sizeof(WCHAR));
LoadStringW(hinst, WCMD_ALL, Abuffer, sizeof(Abuffer)/sizeof(WCHAR));
/* Loop waiting on a Y or N */
while (answer[0] != Ybuffer[0] && answer[0] != Nbuffer[0]) {
@ -142,7 +142,7 @@ void WCMD_clear_screen (void) {
topLeft.X = 0;
topLeft.Y = 0;
FillConsoleOutputCharacter(hStdOut, ' ', screenSize, topLeft, &screenSize);
FillConsoleOutputCharacterW(hStdOut, ' ', screenSize, topLeft, &screenSize);
SetConsoleCursorPosition(hStdOut, topLeft);
}
}
@ -168,7 +168,7 @@ void WCMD_change_tty (void) {
void WCMD_copy (void) {
WIN32_FIND_DATA fd;
WIN32_FIND_DATAW fd;
HANDLE hff;
BOOL force, status;
WCHAR outpath[MAX_PATH], srcpath[MAX_PATH], copycmd[4];
@ -190,12 +190,12 @@ void WCMD_copy (void) {
/* Convert source into full spec */
WINE_TRACE("Copy source (supplied): '%s'\n", wine_dbgstr_w(param1));
GetFullPathName (param1, sizeof(srcpath)/sizeof(WCHAR), srcpath, NULL);
GetFullPathNameW(param1, sizeof(srcpath)/sizeof(WCHAR), srcpath, NULL);
if (srcpath[strlenW(srcpath) - 1] == '\\')
srcpath[strlenW(srcpath) - 1] = '\0';
if ((strchrW(srcpath,'*') == NULL) && (strchrW(srcpath,'?') == NULL)) {
attribs = GetFileAttributes(srcpath);
attribs = GetFileAttributesW(srcpath);
} else {
attribs = 0;
}
@ -221,10 +221,10 @@ void WCMD_copy (void) {
strcpyW(param2, dotW);
}
GetFullPathName (param2, sizeof(outpath)/sizeof(WCHAR), outpath, NULL);
GetFullPathNameW(param2, sizeof(outpath)/sizeof(WCHAR), outpath, NULL);
if (outpath[strlenW(outpath) - 1] == '\\')
outpath[strlenW(outpath) - 1] = '\0';
attribs = GetFileAttributes(outpath);
attribs = GetFileAttributesW(outpath);
if (attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY)) {
strcatW (outpath, slashW);
copyToDir = TRUE;
@ -245,7 +245,7 @@ void WCMD_copy (void) {
/* If COPYCMD is set, then we force the overwrite with /Y and ask for
* confirmation with /-Y. If COPYCMD is neither of those, then we use the
* default behavior. */
len = GetEnvironmentVariable (copyCmdW, copycmd, sizeof(copycmd)/sizeof(WCHAR));
len = GetEnvironmentVariableW(copyCmdW, copycmd, sizeof(copycmd)/sizeof(WCHAR));
if (len && len < (sizeof(copycmd)/sizeof(WCHAR))) {
if (!lstrcmpiW (copycmd, parmY))
force = TRUE;
@ -256,7 +256,7 @@ void WCMD_copy (void) {
/* Loop through all source files */
WINE_TRACE("Searching for: '%s'\n", wine_dbgstr_w(srcspec));
hff = FindFirstFile (srcspec, &fd);
hff = FindFirstFileW(srcspec, &fd);
if (hff != INVALID_HANDLE_VALUE) {
do {
WCHAR outname[MAX_PATH];
@ -281,10 +281,10 @@ void WCMD_copy (void) {
/* Prompt before overwriting */
else if (!overwrite) {
attribs = GetFileAttributes(outname);
attribs = GetFileAttributesW(outname);
if (attribs != INVALID_FILE_ATTRIBUTES) {
WCHAR buffer[MAXSTRING];
wsprintf(buffer, WCMD_LoadMessage(WCMD_OVERWRITE), outname);
wsprintfW(buffer, WCMD_LoadMessage(WCMD_OVERWRITE), outname);
overwrite = WCMD_ask_confirm(buffer, FALSE, NULL);
}
else overwrite = TRUE;
@ -292,11 +292,11 @@ void WCMD_copy (void) {
/* Do the copy as appropriate */
if (overwrite) {
status = CopyFile (srcname, outname, FALSE);
status = CopyFileW(srcname, outname, FALSE);
if (!status) WCMD_print_error ();
}
} while (FindNextFile(hff, &fd) != 0);
} while (FindNextFileW(hff, &fd) != 0);
FindClose (hff);
} else {
status = ERROR_FILE_NOT_FOUND;
@ -325,7 +325,7 @@ static BOOL create_full_path(WCHAR* path)
while ((len = strlenW(new_path)) && new_path[len - 1] == '\\')
new_path[len - 1] = 0;
while (!CreateDirectory(new_path,NULL))
while (!CreateDirectoryW(new_path,NULL))
{
WCHAR *slash;
DWORD last_error = GetLastError();
@ -401,7 +401,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
if (argN && argN[0] != '/') {
WIN32_FIND_DATA fd;
WIN32_FIND_DATAW fd;
HANDLE hff;
WCHAR fpath[MAX_PATH];
WCHAR *p;
@ -424,7 +424,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
WCHAR ext[MAX_PATH];
/* Convert path into actual directory spec */
GetFullPathName (argCopy, sizeof(fpath)/sizeof(WCHAR), fpath, NULL);
GetFullPathNameW(argCopy, sizeof(fpath)/sizeof(WCHAR), fpath, NULL);
WCMD_splitpath(fpath, drive, dir, fname, ext);
/* Only prompt for * and *.*, not *a, a*, *.a* etc */
@ -438,7 +438,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
found = TRUE;
/* Ask for confirmation */
wsprintf(question, fmt, fpath);
wsprintfW(question, fmt, fpath);
ok = WCMD_ask_confirm(question, TRUE, NULL);
/* Abort if answer is 'N' */
@ -447,7 +447,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
}
/* First, try to delete in the current directory */
hff = FindFirstFile (argCopy, &fd);
hff = FindFirstFileW(argCopy, &fd);
if (hff == INVALID_HANDLE_VALUE) {
handleParm = FALSE;
} else {
@ -542,7 +542,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
WCHAR question[MAXSTRING];
/* Ask for confirmation */
wsprintf(question, WCMD_LoadMessage(WCMD_DELPROMPT), fpath);
wsprintfW(question, WCMD_LoadMessage(WCMD_DELPROMPT), fpath);
ok = WCMD_ask_confirm(question, FALSE, NULL);
}
@ -552,15 +552,15 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
/* If file is read only, and /F supplied, delete it */
if (fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY &&
strstrW (quals, parmF) != NULL) {
SetFileAttributes(fpath, fd.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY);
SetFileAttributesW(fpath, fd.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY);
}
/* Now do the delete */
if (!DeleteFile (fpath)) WCMD_print_error ();
if (!DeleteFileW(fpath)) WCMD_print_error ();
}
}
} while (FindNextFile(hff, &fd) != 0);
} while (FindNextFileW(hff, &fd) != 0);
FindClose (hff);
}
@ -576,7 +576,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
WCHAR ext[MAX_PATH];
/* Convert path into actual directory spec */
GetFullPathName (argCopy, sizeof(thisDir)/sizeof(WCHAR), thisDir, NULL);
GetFullPathNameW(argCopy, sizeof(thisDir)/sizeof(WCHAR), thisDir, NULL);
WCMD_splitpath(thisDir, drive, dir, fname, ext);
strcpyW(thisDir, drive);
@ -589,7 +589,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
thisDir[cPos] = '*';
thisDir[cPos+1] = 0x00;
hff = FindFirstFile (thisDir, &fd);
hff = FindFirstFileW(thisDir, &fd);
/* Remove residual '*' */
thisDir[cPos] = 0x00;
@ -624,7 +624,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
(strlenW(subParm)+1) * sizeof(WCHAR));
strcpyW(nextDir->dirName, subParm);
}
} while (FindNextFile(hff, &fd) != 0);
} while (FindNextFileW(hff, &fd) != 0);
FindClose (hff);
/* Go through each subdir doing the delete */
@ -710,7 +710,7 @@ void WCMD_echo (const WCHAR *command) {
void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
WIN32_FIND_DATA fd;
WIN32_FIND_DATAW fd;
HANDLE hff;
int i;
const WCHAR inW[] = {'i', 'n', ' ', '\0'};
@ -816,7 +816,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
and once we have the complete set, we expect a DO */
WINE_TRACE("Looking for 'do' in %p\n", *cmdList);
if ((*cmdList == NULL) ||
(CompareString (LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
(CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
(*cmdList)->command, 3, doW, -1) != 2)) {
WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR));
return;
@ -855,7 +855,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
if (!useNumbers && !doFileset) {
if (strpbrkW (item, wildcards)) {
hff = FindFirstFile (item, &fd);
hff = FindFirstFileW(item, &fd);
if (hff != INVALID_HANDLE_VALUE) {
do {
BOOL isDirectory = FALSE;
@ -873,7 +873,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
fd.cFileName, FALSE, TRUE);
}
} while (FindNextFile(hff, &fd) != 0);
} while (FindNextFileW(hff, &fd) != 0);
FindClose (hff);
}
} else {
@ -906,20 +906,20 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
itemStart[strlenW(itemStart)-1] = 0x00;
/* Get temp filename */
GetTempPath (sizeof(temp_path)/sizeof(WCHAR), temp_path);
GetTempFileName (temp_path, cmdW, 0, temp_file);
GetTempPathW(sizeof(temp_path)/sizeof(WCHAR), temp_path);
GetTempFileNameW(temp_path, cmdW, 0, temp_file);
/* Execute program and redirect output */
wsprintf (temp_cmd, redirOut, (itemStart+1), temp_file);
wsprintfW(temp_cmd, redirOut, (itemStart+1), temp_file);
WCMD_execute (itemStart, temp_cmd, NULL, NULL, NULL);
/* Open the file, read line by line and process */
input = CreateFile (temp_file, GENERIC_READ, FILE_SHARE_READ,
input = CreateFileW(temp_file, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
} else {
/* Open the file, read line by line and process */
input = CreateFile (item, GENERIC_READ, FILE_SHARE_READ,
input = CreateFileW(item, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
}
@ -958,7 +958,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
/* Delete the temporary file */
if (*itemStart == '`' || *itemStart == '\'') {
DeleteFile (temp_file);
DeleteFileW(temp_file);
}
/* Filesets - A string literal */
@ -1089,7 +1089,7 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
/* End of the command - does 'ELSE ' follow as the next command? */
} else {
if (isIF && CompareString (LOCALE_USER_DEFAULT,
if (isIF && CompareStringW(LOCALE_USER_DEFAULT,
NORM_IGNORECASE | SORT_STRINGSORT,
(*cmdList)->command, 5, ifElse, -1) == 2) {
@ -1133,7 +1133,7 @@ void WCMD_give_help (WCHAR *command) {
}
else {
for (i=0; i<=WCMD_EXIT; i++) {
if (CompareString (LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
param1, -1, inbuilt[i], -1) == 2) {
WCMD_output_asis (WCMD_LoadMessage(i));
return;
@ -1292,13 +1292,13 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) {
WCMD_parameter (p, 2+negate, &command);
}
else if (!lstrcmpiW (condition, existW)) {
if (GetFileAttributes(WCMD_parameter (p, 1+negate, NULL)) != INVALID_FILE_ATTRIBUTES) {
if (GetFileAttributesW(WCMD_parameter (p, 1+negate, NULL)) != INVALID_FILE_ATTRIBUTES) {
test = 1;
}
WCMD_parameter (p, 2+negate, &command);
}
else if (!lstrcmpiW (condition, defdW)) {
if (GetEnvironmentVariable(WCMD_parameter (p, 1+negate, NULL), NULL, 0) > 0) {
if (GetEnvironmentVariableW(WCMD_parameter (p, 1+negate, NULL), NULL, 0) > 0) {
test = 1;
}
WCMD_parameter (p, 2+negate, &command);
@ -1327,7 +1327,7 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) {
void WCMD_move (void) {
int status;
WIN32_FIND_DATA fd;
WIN32_FIND_DATAW fd;
HANDLE hff;
WCHAR input[MAX_PATH];
WCHAR output[MAX_PATH];
@ -1348,15 +1348,15 @@ void WCMD_move (void) {
/* If 2nd parm is directory, then use original filename */
/* Convert partial path to full path */
GetFullPathName (param1, sizeof(input)/sizeof(WCHAR), input, NULL);
GetFullPathName (param2, sizeof(output)/sizeof(WCHAR), output, NULL);
GetFullPathNameW(param1, sizeof(input)/sizeof(WCHAR), input, NULL);
GetFullPathNameW(param2, sizeof(output)/sizeof(WCHAR), output, NULL);
WINE_TRACE("Move from '%s'('%s') to '%s'\n", wine_dbgstr_w(input),
wine_dbgstr_w(param1), wine_dbgstr_w(output));
/* Split into components */
WCMD_splitpath(input, drive, dir, fname, ext);
hff = FindFirstFile (input, &fd);
hff = FindFirstFileW(input, &fd);
while (hff != INVALID_HANDLE_VALUE) {
WCHAR dest[MAX_PATH];
WCHAR src[MAX_PATH];
@ -1369,7 +1369,7 @@ void WCMD_move (void) {
strcatW(src, dir);
/* See if dest is an existing directory */
attribs = GetFileAttributes(output);
attribs = GetFileAttributesW(output);
if (attribs != INVALID_FILE_ATTRIBUTES &&
(attribs & FILE_ATTRIBUTE_DIRECTORY)) {
strcpyW(dest, output);
@ -1385,7 +1385,7 @@ void WCMD_move (void) {
WINE_TRACE("Dest '%s'\n", wine_dbgstr_w(dest));
/* Check if file is read only, otherwise move it */
attribs = GetFileAttributes(src);
attribs = GetFileAttributesW(src);
if ((attribs != INVALID_FILE_ATTRIBUTES) &&
(attribs & FILE_ATTRIBUTE_READONLY)) {
SetLastError(ERROR_ACCESS_DENIED);
@ -1394,7 +1394,7 @@ void WCMD_move (void) {
BOOL ok = TRUE;
/* If destination exists, prompt unless /Y supplied */
if (GetFileAttributes(dest) != INVALID_FILE_ATTRIBUTES) {
if (GetFileAttributesW(dest) != INVALID_FILE_ATTRIBUTES) {
BOOL force = FALSE;
WCHAR copycmd[MAXSTRING];
int len;
@ -1406,7 +1406,7 @@ void WCMD_move (void) {
force = TRUE;
else {
const WCHAR copyCmdW[] = {'C','O','P','Y','C','M','D','\0'};
len = GetEnvironmentVariable (copyCmdW, copycmd, sizeof(copycmd)/sizeof(WCHAR));
len = GetEnvironmentVariableW(copyCmdW, copycmd, sizeof(copycmd)/sizeof(WCHAR));
force = (len && len < (sizeof(copycmd)/sizeof(WCHAR))
&& ! lstrcmpiW (copycmd, parmY));
}
@ -1419,12 +1419,12 @@ void WCMD_move (void) {
strcpyW(yesChar, WCMD_LoadMessage(WCMD_YES));
/* Ask for confirmation */
wsprintf(question, WCMD_LoadMessage(WCMD_OVERWRITE), dest);
wsprintfW(question, WCMD_LoadMessage(WCMD_OVERWRITE), dest);
ok = WCMD_ask_confirm(question, FALSE, NULL);
/* So delete the destination prior to the move */
if (ok) {
if (!DeleteFile (dest)) {
if (!DeleteFileW(dest)) {
WCMD_print_error ();
errorlevel = 1;
ok = FALSE;
@ -1434,7 +1434,7 @@ void WCMD_move (void) {
}
if (ok) {
status = MoveFile (src, dest);
status = MoveFileW(src, dest);
} else {
status = 1; /* Anything other than 0 to prevent error msg below */
}
@ -1446,7 +1446,7 @@ void WCMD_move (void) {
}
/* Step on to next match */
if (FindNextFile(hff, &fd) == 0) {
if (FindNextFileW(hff, &fd) == 0) {
FindClose(hff);
hff = INVALID_HANDLE_VALUE;
break;
@ -1495,12 +1495,12 @@ void WCMD_remove_dir (WCHAR *command) {
/* If subdirectory search not supplied, just try to remove
and report error if it fails (eg if it contains a file) */
if (strstrW (quals, parmS) == NULL) {
if (!RemoveDirectory (thisArg)) WCMD_print_error ();
if (!RemoveDirectoryW(thisArg)) WCMD_print_error ();
/* Otherwise use ShFileOp to recursively remove a directory */
} else {
SHFILEOPSTRUCT lpDir;
SHFILEOPSTRUCTW lpDir;
/* Ask first */
if (strstrW (quals, parmQ) == NULL) {
@ -1509,7 +1509,7 @@ void WCMD_remove_dir (WCHAR *command) {
static const WCHAR fmt[] = {'%','s',' ','\0'};
/* Ask for confirmation */
wsprintf(question, fmt, thisArg);
wsprintfW(question, fmt, thisArg);
ok = WCMD_ask_confirm(question, TRUE, NULL);
/* Abort if answer is 'N' */
@ -1522,7 +1522,7 @@ void WCMD_remove_dir (WCHAR *command) {
lpDir.pFrom = thisArg;
lpDir.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI;
lpDir.wFunc = FO_DELETE;
if (SHFileOperation(&lpDir)) WCMD_print_error ();
if (SHFileOperationW(&lpDir)) WCMD_print_error ();
}
}
}
@ -1545,7 +1545,7 @@ void WCMD_rename (void) {
int status;
HANDLE hff;
WIN32_FIND_DATA fd;
WIN32_FIND_DATAW fd;
WCHAR input[MAX_PATH];
WCHAR *dotDst = NULL;
WCHAR drive[10];
@ -1572,7 +1572,7 @@ void WCMD_rename (void) {
}
/* Convert partial path to full path */
GetFullPathName (param1, sizeof(input)/sizeof(WCHAR), input, NULL);
GetFullPathNameW(param1, sizeof(input)/sizeof(WCHAR), input, NULL);
WINE_TRACE("Rename from '%s'('%s') to '%s'\n", wine_dbgstr_w(input),
wine_dbgstr_w(param1), wine_dbgstr_w(param2));
dotDst = strchrW(param2, '.');
@ -1580,7 +1580,7 @@ void WCMD_rename (void) {
/* Split into components */
WCMD_splitpath(input, drive, dir, fname, ext);
hff = FindFirstFile (input, &fd);
hff = FindFirstFileW(input, &fd);
while (hff != INVALID_HANDLE_VALUE) {
WCHAR dest[MAX_PATH];
WCHAR src[MAX_PATH];
@ -1624,13 +1624,13 @@ void WCMD_rename (void) {
WINE_TRACE("Dest '%s'\n", wine_dbgstr_w(dest));
/* Check if file is read only, otherwise move it */
attribs = GetFileAttributes(src);
attribs = GetFileAttributesW(src);
if ((attribs != INVALID_FILE_ATTRIBUTES) &&
(attribs & FILE_ATTRIBUTE_READONLY)) {
SetLastError(ERROR_ACCESS_DENIED);
status = 0;
} else {
status = MoveFile (src, dest);
status = MoveFileW(src, dest);
}
if (!status) {
@ -1639,7 +1639,7 @@ void WCMD_rename (void) {
}
/* Step on to next match */
if (FindNextFile(hff, &fd) == 0) {
if (FindNextFileW(hff, &fd) == 0) {
FindClose(hff);
hff = INVALID_HANDLE_VALUE;
break;
@ -1705,7 +1705,7 @@ void WCMD_setlocal (const WCHAR *s) {
saved_environment = env_copy;
/* Save the current drive letter */
GetCurrentDirectory (MAX_PATH, cwd);
GetCurrentDirectoryW(MAX_PATH, cwd);
env_copy->u.cwd = cwd[0];
}
else
@ -1766,15 +1766,15 @@ void WCMD_endlocal (void) {
}
/* Restore current drive letter */
if (IsCharAlpha(temp->u.cwd)) {
if (IsCharAlphaW(temp->u.cwd)) {
WCHAR envvar[4];
WCHAR cwd[MAX_PATH];
static const WCHAR fmt[] = {'=','%','c',':','\0'};
wsprintf(envvar, fmt, temp->u.cwd);
if (GetEnvironmentVariable(envvar, cwd, MAX_PATH)) {
wsprintfW(envvar, fmt, temp->u.cwd);
if (GetEnvironmentVariableW(envvar, cwd, MAX_PATH)) {
WINE_TRACE("Resetting cwd to %s\n", wine_dbgstr_w(cwd));
SetCurrentDirectory(cwd);
SetCurrentDirectoryW(cwd);
}
}
@ -1793,7 +1793,7 @@ void WCMD_setshow_attrib (void) {
DWORD count;
HANDLE hff;
WIN32_FIND_DATA fd;
WIN32_FIND_DATAW fd;
WCHAR flags[9] = {' ',' ',' ',' ',' ',' ',' ',' ','\0'};
WCHAR *name = param1;
DWORD attrib_set=0;
@ -1821,11 +1821,11 @@ void WCMD_setshow_attrib (void) {
if (strlenW(name) == 0) {
static const WCHAR slashStarW[] = {'\\','*','\0'};
GetCurrentDirectory (sizeof(param2)/sizeof(WCHAR), name);
GetCurrentDirectoryW(sizeof(param2)/sizeof(WCHAR), name);
strcatW (name, slashStarW);
}
hff = FindFirstFile (name, &fd);
hff = FindFirstFileW(name, &fd);
if (hff == INVALID_HANDLE_VALUE) {
WCMD_output (WCMD_LoadMessage(WCMD_FILENOTFOUND), name);
}
@ -1860,7 +1860,7 @@ void WCMD_setshow_attrib (void) {
WCMD_output (fmt, flags, fd.cFileName);
for (count=0; count < 8; count++) flags[count] = ' ';
}
} while (FindNextFile(hff, &fd) != 0);
} while (FindNextFileW(hff, &fd) != 0);
}
FindClose (hff);
}
@ -1877,21 +1877,21 @@ void WCMD_setshow_default (WCHAR *command) {
WCHAR string[1024];
WCHAR cwd[1024];
WCHAR *pos;
WIN32_FIND_DATA fd;
WIN32_FIND_DATAW fd;
HANDLE hff;
static const WCHAR parmD[] = {'/','D','\0'};
WINE_TRACE("Request change to directory '%s'\n", wine_dbgstr_w(command));
/* Skip /D and trailing whitespace if on the front of the command line */
if (CompareString (LOCALE_USER_DEFAULT,
if (CompareStringW(LOCALE_USER_DEFAULT,
NORM_IGNORECASE | SORT_STRINGSORT,
command, 2, parmD, -1) == 2) {
command += 2;
while (*command && *command==' ') command++;
}
GetCurrentDirectory (sizeof(cwd)/sizeof(WCHAR), cwd);
GetCurrentDirectoryW(sizeof(cwd)/sizeof(WCHAR), cwd);
if (strlenW(command) == 0) {
strcatW (cwd, newline);
WCMD_output (cwd);
@ -1908,7 +1908,7 @@ void WCMD_setshow_default (WCHAR *command) {
/* Search for appropriate directory */
WINE_TRACE("Looking for directory '%s'\n", wine_dbgstr_w(string));
hff = FindFirstFile (string, &fd);
hff = FindFirstFileW(string, &fd);
while (hff != INVALID_HANDLE_VALUE) {
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
WCHAR fpath[MAX_PATH];
@ -1919,11 +1919,11 @@ void WCMD_setshow_default (WCHAR *command) {
static const WCHAR fmt[] = {'%','s','%','s','%','s','\0'};
/* Convert path into actual directory spec */
GetFullPathName (string, sizeof(fpath)/sizeof(WCHAR), fpath, NULL);
GetFullPathNameW(string, sizeof(fpath)/sizeof(WCHAR), fpath, NULL);
WCMD_splitpath(fpath, drive, dir, fname, ext);
/* Rebuild path */
wsprintf(string, fmt, drive, dir, fd.cFileName);
wsprintfW(string, fmt, drive, dir, fd.cFileName);
FindClose(hff);
hff = INVALID_HANDLE_VALUE;
@ -1931,7 +1931,7 @@ void WCMD_setshow_default (WCHAR *command) {
}
/* Step on to next match */
if (FindNextFile(hff, &fd) == 0) {
if (FindNextFileW(hff, &fd) == 0) {
FindClose(hff);
hff = INVALID_HANDLE_VALUE;
break;
@ -1941,7 +1941,7 @@ void WCMD_setshow_default (WCHAR *command) {
/* Change to that directory */
WINE_TRACE("Really changing to directory '%s'\n", wine_dbgstr_w(string));
status = SetCurrentDirectory (string);
status = SetCurrentDirectoryW(string);
if (!status) {
errorlevel = 1;
WCMD_print_error ();
@ -1955,7 +1955,7 @@ void WCMD_setshow_default (WCHAR *command) {
CD x:\directory /D (or pushd c:\directory) not supplied */
if ((strstrW(quals, parmD) == NULL) &&
(param1[1] == ':') && (toupper(param1[0]) != toupper(cwd[0]))) {
SetCurrentDirectory(cwd);
SetCurrentDirectoryW(cwd);
}
}
@ -1963,13 +1963,13 @@ void WCMD_setshow_default (WCHAR *command) {
change of directory, even if path was restored due to missing
/D (allows changing drive letter when not resident on that
drive */
if ((string[1] == ':') && IsCharAlpha (string[0])) {
if ((string[1] == ':') && IsCharAlphaW(string[0])) {
WCHAR env[4];
strcpyW(env, equalW);
memcpy(env+1, string, 2 * sizeof(WCHAR));
env[3] = 0x00;
WINE_TRACE("Setting '%s' to '%s'\n", wine_dbgstr_w(env), wine_dbgstr_w(string));
SetEnvironmentVariable(env, string);
SetEnvironmentVariableW(env, string);
}
}
@ -1990,7 +1990,7 @@ void WCMD_setshow_date (void) {
static const WCHAR parmT[] = {'/','T','\0'};
if (strlenW(param1) == 0) {
if (GetDateFormat (LOCALE_USER_DEFAULT, 0, NULL, NULL,
if (GetDateFormatW(LOCALE_USER_DEFAULT, 0, NULL, NULL,
curdate, sizeof(curdate)/sizeof(WCHAR))) {
WCMD_output (WCMD_LoadMessage(WCMD_CURRENTDATE), curdate);
if (strstrW (quals, parmT) == NULL) {
@ -2016,7 +2016,7 @@ static int WCMD_compare( const void *a, const void *b )
{
int r;
const WCHAR * const *str_a = a, * const *str_b = b;
r = CompareString( LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
r = CompareStringW( LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
*str_a, -1, *str_b, -1 );
if( r == CSTR_LESS_THAN ) return -1;
if( r == CSTR_GREATER_THAN ) return 1;
@ -2056,7 +2056,7 @@ static int WCMD_setshow_sortenv(const WCHAR *s, const WCHAR *stub)
/* print it */
for( i=0; i<count; i++ ) {
if (!stub || CompareString (LOCALE_USER_DEFAULT,
if (!stub || CompareStringW(LOCALE_USER_DEFAULT,
NORM_IGNORECASE | SORT_STRINGSORT,
str[i], stublen, stub, -1) == 2) {
/* Don't display special internal variables */
@ -2087,13 +2087,13 @@ void WCMD_setshow_env (WCHAR *s) {
errorlevel = 0;
if (param1[0] == 0x00 && quals[0] == 0x00) {
env = GetEnvironmentStrings ();
env = GetEnvironmentStringsW();
WCMD_setshow_sortenv( env, NULL );
return;
}
/* See if /P supplied, and if so echo the prompt, and read in a reply */
if (CompareString (LOCALE_USER_DEFAULT,
if (CompareStringW(LOCALE_USER_DEFAULT,
NORM_IGNORECASE | SORT_STRINGSORT,
s, 2, parmP, -1) == 2) {
WCHAR string[MAXSTRING];
@ -2122,7 +2122,7 @@ void WCMD_setshow_env (WCHAR *s) {
if (string[count-2] == '\r') string[count-2] = '\0'; /* Under Windoze we get CRLF! */
WINE_TRACE("set /p: Setting var '%s' to '%s'\n", wine_dbgstr_w(s),
wine_dbgstr_w(string));
status = SetEnvironmentVariable (s, string);
status = SetEnvironmentVariableW(s, string);
}
} else {
@ -2132,7 +2132,7 @@ void WCMD_setshow_env (WCHAR *s) {
WCMD_opt_s_strip_quotes(s);
p = strchrW (s, '=');
if (p == NULL) {
env = GetEnvironmentStrings ();
env = GetEnvironmentStringsW();
if (WCMD_setshow_sortenv( env, s ) == 0) {
WCMD_output (WCMD_LoadMessage(WCMD_MISSINGENV), s);
errorlevel = 1;
@ -2142,7 +2142,7 @@ void WCMD_setshow_env (WCHAR *s) {
*p++ = '\0';
if (strlenW(p) == 0) p = NULL;
status = SetEnvironmentVariable (s, p);
status = SetEnvironmentVariableW(s, p);
gle = GetLastError();
if ((!status) & (gle == ERROR_ENVVAR_NOT_FOUND)) {
errorlevel = 1;
@ -2164,7 +2164,7 @@ void WCMD_setshow_path (WCHAR *command) {
static const WCHAR pathEqW[] = {'P','A','T','H','=','\0'};
if (strlenW(param1) == 0) {
status = GetEnvironmentVariable (pathW, string, sizeof(string)/sizeof(WCHAR));
status = GetEnvironmentVariableW(pathW, string, sizeof(string)/sizeof(WCHAR));
if (status != 0) {
WCMD_output_asis ( pathEqW);
WCMD_output_asis ( string);
@ -2176,7 +2176,7 @@ void WCMD_setshow_path (WCHAR *command) {
}
else {
if (*command == '=') command++; /* Skip leading '=' */
status = SetEnvironmentVariable (pathW, command);
status = SetEnvironmentVariableW(pathW, command);
if (!status) WCMD_print_error();
}
}
@ -2193,15 +2193,15 @@ void WCMD_setshow_prompt (void) {
static const WCHAR promptW[] = {'P','R','O','M','P','T','\0'};
if (strlenW(param1) == 0) {
SetEnvironmentVariable (promptW, NULL);
SetEnvironmentVariableW(promptW, NULL);
}
else {
s = param1;
while ((*s == '=') || (*s == ' ')) s++;
if (strlenW(s) == 0) {
SetEnvironmentVariable (promptW, NULL);
SetEnvironmentVariableW(promptW, NULL);
}
else SetEnvironmentVariable (promptW, s);
else SetEnvironmentVariableW(promptW, s);
}
}
@ -2221,7 +2221,7 @@ void WCMD_setshow_time (void) {
if (strlenW(param1) == 0) {
GetLocalTime(&st);
if (GetTimeFormat (LOCALE_USER_DEFAULT, 0, &st, NULL,
if (GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL,
curtime, sizeof(curtime)/sizeof(WCHAR))) {
WCMD_output (WCMD_LoadMessage(WCMD_CURRENTTIME), curtime);
if (strstrW (quals, parmT) == NULL) {
@ -2279,7 +2279,7 @@ void WCMD_shift (WCHAR *command) {
* Set the console title
*/
void WCMD_title (WCHAR *command) {
SetConsoleTitle(command);
SetConsoleTitleW(command);
}
/****************************************************************************
@ -2313,7 +2313,7 @@ void WCMD_type (WCHAR *command) {
if (!argN) break;
WINE_TRACE("type: Processing arg '%s'\n", wine_dbgstr_w(thisArg));
h = CreateFile (thisArg, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
h = CreateFileW(thisArg, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) {
WCMD_print_error ();
@ -2360,7 +2360,7 @@ void WCMD_more (WCHAR *command) {
/* Prefix the NLS more with '-- ', then load the text */
errorlevel = 0;
strcpyW(moreStr, moreStart);
LoadString (hinst, WCMD_MORESTR, &moreStr[3],
LoadStringW(hinst, WCMD_MORESTR, &moreStr[3],
(sizeof(moreStr)/sizeof(WCHAR))-3);
if (param1[0] == 0x00) {
@ -2370,7 +2370,7 @@ void WCMD_more (WCHAR *command) {
more are satisfied by the next line from the input (file). To
avoid this, ensure stdin is to the console */
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
HANDLE hConIn = CreateFile(conInW, GENERIC_READ | GENERIC_WRITE,
HANDLE hConIn = CreateFileW(conInW, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
WINE_TRACE("No parms - working probably in pipe mode\n");
@ -2379,7 +2379,7 @@ void WCMD_more (WCHAR *command) {
/* Warning: No easy way of ending the stream (ctrl+z on windows) so
once you get in this bit unless due to a pipe, its going to end badly... */
useinput = TRUE;
wsprintf(moreStrPage, moreFmt, moreStr);
wsprintfW(moreStrPage, moreFmt, moreStr);
WCMD_enter_paged_mode(moreStrPage);
while (WCMD_ReadFile (hstdin, buffer, (sizeof(buffer)/sizeof(WCHAR))-1, &count, NULL)) {
@ -2410,7 +2410,7 @@ void WCMD_more (WCHAR *command) {
if (needsPause) {
/* Wait */
wsprintf(moreStrPage, moreFmt2, moreStr, 100);
wsprintfW(moreStrPage, moreFmt2, moreStr, 100);
WCMD_leave_paged_mode();
WCMD_output_asis(moreStrPage);
WCMD_ReadFile (GetStdHandle(STD_INPUT_HANDLE), buffer,
@ -2420,7 +2420,7 @@ void WCMD_more (WCHAR *command) {
WINE_TRACE("more: Processing arg '%s'\n", wine_dbgstr_w(thisArg));
h = CreateFile (thisArg, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
h = CreateFileW(thisArg, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) {
WCMD_print_error ();
@ -2432,7 +2432,7 @@ void WCMD_more (WCHAR *command) {
WIN32_FILE_ATTRIBUTE_DATA fileInfo;
/* Get the file size */
GetFileAttributesEx(thisArg, GetFileExInfoStandard, (void*)&fileInfo);
GetFileAttributesExW(thisArg, GetFileExInfoStandard, (void*)&fileInfo);
fileLen = (((ULONG64)fileInfo.nFileSizeHigh) << 32) + fileInfo.nFileSizeLow;
needsPause = TRUE;
@ -2442,7 +2442,7 @@ void WCMD_more (WCHAR *command) {
curPos += count;
/* Update % count (would be used in WCMD_output_asis as prompt) */
wsprintf(moreStrPage, moreFmt2, moreStr, (int) min(99, (curPos * 100)/fileLen));
wsprintfW(moreStrPage, moreFmt2, moreStr, (int) min(99, (curPos * 100)/fileLen));
WCMD_output_asis (buffer);
}
@ -2508,12 +2508,12 @@ int WCMD_volume (int mode, WCHAR *path) {
BOOL status;
if (strlenW(path) == 0) {
status = GetCurrentDirectory (sizeof(curdir)/sizeof(WCHAR), curdir);
status = GetCurrentDirectoryW(sizeof(curdir)/sizeof(WCHAR), curdir);
if (!status) {
WCMD_print_error ();
return 0;
}
status = GetVolumeInformation (NULL, label, sizeof(label)/sizeof(WCHAR),
status = GetVolumeInformationW(NULL, label, sizeof(label)/sizeof(WCHAR),
&serial, NULL, NULL, NULL, 0);
}
else {
@ -2522,8 +2522,8 @@ int WCMD_volume (int mode, WCHAR *path) {
WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR));
return 0;
}
wsprintf (curdir, fmt, path);
status = GetVolumeInformation (curdir, label, sizeof(label)/sizeof(WCHAR),
wsprintfW (curdir, fmt, path);
status = GetVolumeInformationW(curdir, label, sizeof(label)/sizeof(WCHAR),
&serial, NULL,
NULL, NULL, 0);
}
@ -2542,10 +2542,10 @@ int WCMD_volume (int mode, WCHAR *path) {
if (string[count-2] == '\r') string[count-2] = '\0'; /* Under Windoze we get CRLF! */
}
if (strlenW(path) != 0) {
if (!SetVolumeLabel (curdir, string)) WCMD_print_error ();
if (!SetVolumeLabelW(curdir, string)) WCMD_print_error ();
}
else {
if (!SetVolumeLabel (NULL, string)) WCMD_print_error ();
if (!SetVolumeLabelW(NULL, string)) WCMD_print_error ();
}
}
return 1;
@ -2597,8 +2597,8 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
if (newValue) accessOptions |= KEY_WRITE;
/* Open a key to HKEY_CLASSES_ROOT for enumerating */
if (RegOpenKeyEx(HKEY_CLASSES_ROOT, nullW, 0,
accessOptions, &key) != ERROR_SUCCESS) {
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, nullW, 0,
accessOptions, &key) != ERROR_SUCCESS) {
WINE_FIXME("Unexpected failure opening HKCR key: %d\n", GetLastError());
return;
}
@ -2614,9 +2614,7 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
/* Find the next value */
nameLen = MAXSTRING;
rc = RegEnumKeyEx(key, index++,
keyName, &nameLen,
NULL, NULL, NULL, NULL);
rc = RegEnumKeyExW(key, index++, keyName, &nameLen, NULL, NULL, NULL, NULL);
if (rc == ERROR_SUCCESS) {
@ -2629,12 +2627,10 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
strcpyW(subkey, keyName);
if (!assoc) strcatW(subkey, shOpCmdW);
if (RegOpenKeyEx(key, subkey, 0,
accessOptions, &readKey) == ERROR_SUCCESS) {
if (RegOpenKeyExW(key, subkey, 0, accessOptions, &readKey) == ERROR_SUCCESS) {
valueLen = sizeof(keyValue)/sizeof(WCHAR);
rc = RegQueryValueEx(readKey, NULL, NULL, NULL,
(LPBYTE)keyValue, &valueLen);
rc = RegQueryValueExW(readKey, NULL, NULL, NULL, (LPBYTE)keyValue, &valueLen);
WCMD_output_asis(keyName);
WCMD_output_asis(equalW);
/* If no default value found, leave line empty after '=' */
@ -2664,11 +2660,9 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
strcpyW(subkey, keyValue);
if (!assoc) strcatW(subkey, shOpCmdW);
if (RegOpenKeyEx(key, subkey, 0,
accessOptions, &readKey) == ERROR_SUCCESS) {
if (RegOpenKeyExW(key, subkey, 0, accessOptions, &readKey) == ERROR_SUCCESS) {
rc = RegQueryValueEx(readKey, NULL, NULL, NULL,
(LPBYTE)keyValue, &valueLen);
rc = RegQueryValueExW(readKey, NULL, NULL, NULL, (LPBYTE)keyValue, &valueLen);
WCMD_output_asis(command);
WCMD_output_asis(equalW);
/* If no default value found, leave line empty after '=' */
@ -2682,11 +2676,11 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
/* Load the translated 'File association not found' */
if (assoc) {
LoadString (hinst, WCMD_NOASSOC, msgbuffer, sizeof(msgbuffer)/sizeof(WCHAR));
LoadStringW(hinst, WCMD_NOASSOC, msgbuffer, sizeof(msgbuffer)/sizeof(WCHAR));
} else {
LoadString (hinst, WCMD_NOFTYPE, msgbuffer, sizeof(msgbuffer)/sizeof(WCHAR));
LoadStringW(hinst, WCMD_NOFTYPE, msgbuffer, sizeof(msgbuffer)/sizeof(WCHAR));
}
wsprintf(outbuffer, msgbuffer, keyValue);
wsprintfW(outbuffer, msgbuffer, keyValue);
WCMD_output_asis(outbuffer);
errorlevel = 2;
}
@ -2707,7 +2701,7 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
/* If nothing after '=' then clear value - only valid for ASSOC */
if (*newValue == 0x00) {
if (assoc) rc = RegDeleteKey(key, command);
if (assoc) rc = RegDeleteKeyW(key, command);
if (assoc && rc == ERROR_SUCCESS) {
WINE_TRACE("HKCR Key '%s' deleted\n", wine_dbgstr_w(command));
@ -2721,23 +2715,23 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
/* Load the translated 'File association not found' */
if (assoc) {
LoadString (hinst, WCMD_NOASSOC, msgbuffer,
LoadStringW(hinst, WCMD_NOASSOC, msgbuffer,
sizeof(msgbuffer)/sizeof(WCHAR));
} else {
LoadString (hinst, WCMD_NOFTYPE, msgbuffer,
LoadStringW(hinst, WCMD_NOFTYPE, msgbuffer,
sizeof(msgbuffer)/sizeof(WCHAR));
}
wsprintf(outbuffer, msgbuffer, keyValue);
wsprintfW(outbuffer, msgbuffer, keyValue);
WCMD_output_asis(outbuffer);
errorlevel = 2;
}
/* It really is a set value = contents */
} else {
rc = RegCreateKeyEx(key, subkey, 0, NULL, REG_OPTION_NON_VOLATILE,
rc = RegCreateKeyExW(key, subkey, 0, NULL, REG_OPTION_NON_VOLATILE,
accessOptions, NULL, &readKey, NULL);
if (rc == ERROR_SUCCESS) {
rc = RegSetValueEx(readKey, NULL, 0, REG_SZ,
rc = RegSetValueExW(readKey, NULL, 0, REG_SZ,
(LPBYTE)newValue, strlenW(newValue));
RegCloseKey(readKey);
}

View File

@ -123,8 +123,8 @@ static WCHAR * WCMD_filesize64 (ULONGLONG n) {
*/
static int WCMD_dir_sort (const void *a, const void *b)
{
WIN32_FIND_DATA *filea = (WIN32_FIND_DATA *)a;
WIN32_FIND_DATA *fileb = (WIN32_FIND_DATA *)b;
WIN32_FIND_DATAW *filea = (WIN32_FIND_DATAW *)a;
WIN32_FIND_DATAW *fileb = (WIN32_FIND_DATAW *)b;
int result = 0;
/* If /OG or /O-G supplied, dirs go at the top or bottom, ignoring the
@ -211,7 +211,7 @@ static void WCMD_getfileowner(WCHAR *filename, WCHAR *owner, int ownerlen) {
*owner = 0x00;
/* Find out how much space we need for the owner security descriptor */
GetFileSecurity(filename, OWNER_SECURITY_INFORMATION, 0, 0, &sizeNeeded);
GetFileSecurityW(filename, OWNER_SECURITY_INFORMATION, 0, 0, &sizeNeeded);
rc = GetLastError();
if(rc == ERROR_INSUFFICIENT_BUFFER && sizeNeeded > 0) {
@ -227,7 +227,7 @@ static void WCMD_getfileowner(WCHAR *filename, WCHAR *owner, int ownerlen) {
if(!secBuffer) return;
/* Get the owners security descriptor */
if(!GetFileSecurity(filename, OWNER_SECURITY_INFORMATION, secBuffer,
if(!GetFileSecurityW(filename, OWNER_SECURITY_INFORMATION, secBuffer,
sizeNeeded, &sizeNeeded)) {
HeapFree(GetProcessHeap(),0,secBuffer);
return;
@ -240,7 +240,7 @@ static void WCMD_getfileowner(WCHAR *filename, WCHAR *owner, int ownerlen) {
}
/* Convert to a username */
if (LookupAccountSid(NULL, pSID, name, &nameLen, domain, &domainLen, &nameuse)) {
if (LookupAccountSidW(NULL, pSID, name, &nameLen, domain, &domainLen, &nameuse)) {
static const WCHAR fmt[] = {'%','s','%','c','%','s','\0'};
snprintfW(owner, ownerlen, fmt, domain, '\\', name);
}
@ -262,7 +262,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
WCHAR string[1024], datestring[32], timestring[32];
WCHAR real_path[MAX_PATH];
WIN32_FIND_DATA *fd;
WIN32_FIND_DATAW *fd;
FILETIME ft;
SYSTEMTIME st;
HANDLE hff;
@ -294,7 +294,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
same directory. Note issuing a directory header with no contents
mirrors what windows does */
parms = inputparms;
fd = HeapAlloc(GetProcessHeap(),0,sizeof(WIN32_FIND_DATA));
fd = HeapAlloc(GetProcessHeap(),0,sizeof(WIN32_FIND_DATAW));
while (parms && strcmpW(inputparms->dirName, parms->dirName) == 0) {
concurrentDirs++;
@ -304,7 +304,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* Load all files into an in memory structure */
WINE_TRACE("Looking for matches to '%s'\n", wine_dbgstr_w(real_path));
hff = FindFirstFile (real_path, (fd+entry_count));
hff = FindFirstFileW(real_path, (fd+entry_count));
if (hff != INVALID_HANDLE_VALUE) {
do {
/* Skip any which are filtered out by attribute */
@ -319,14 +319,14 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if (tmpLen > widest) widest = tmpLen;
}
fd = HeapReAlloc(GetProcessHeap(),0,fd,(entry_count+1)*sizeof(WIN32_FIND_DATA));
fd = HeapReAlloc(GetProcessHeap(),0,fd,(entry_count+1)*sizeof(WIN32_FIND_DATAW));
if (fd == NULL) {
FindClose (hff);
WINE_ERR("Out of memory\n");
errorlevel = 1;
return parms->next;
}
} while (FindNextFile(hff, (fd+entry_count)) != 0);
} while (FindNextFileW(hff, (fd+entry_count)) != 0);
FindClose (hff);
}
@ -353,7 +353,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if (entry_count > 0) {
/* Sort the list of files */
qsort (fd, entry_count, sizeof(WIN32_FIND_DATA), WCMD_dir_sort);
qsort (fd, entry_count, sizeof(WIN32_FIND_DATAW), WCMD_dir_sort);
/* Work out the number of columns */
WINE_TRACE("%d entries, maxwidth=%d, widest=%d\n", entry_count, max_width, widest);
@ -402,9 +402,9 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
FileTimeToLocalFileTime (&(fd+i)->ftCreationTime, &ft);
}
FileTimeToSystemTime (&ft, &st);
GetDateFormat (0, DATE_SHORTDATE, &st, NULL, datestring,
GetDateFormatW(0, DATE_SHORTDATE, &st, NULL, datestring,
sizeof(datestring)/sizeof(WCHAR));
GetTimeFormat (0, TIME_NOSECONDS, &st,
GetTimeFormatW(0, TIME_NOSECONDS, &st,
NULL, timestring, sizeof(timestring)/sizeof(WCHAR));
if (wide) {
@ -520,14 +520,14 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if (recurse) {
DIRECTORY_STACK *dirStack = NULL;
DIRECTORY_STACK *lastEntry = NULL;
WIN32_FIND_DATA finddata;
WIN32_FIND_DATAW finddata;
/* Build path to search */
strcpyW(string, inputparms->dirName);
strcatW(string, starW);
WINE_TRACE("Recursive, looking for '%s'\n", wine_dbgstr_w(string));
hff = FindFirstFile (string, &finddata);
hff = FindFirstFileW(string, &finddata);
if (hff != INVALID_HANDLE_VALUE) {
do {
if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
@ -563,7 +563,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
parms = parms->next;
}
}
} while (FindNextFile(hff, &finddata) != 0);
} while (FindNextFileW(hff, &finddata) != 0);
FindClose (hff);
while (dirStack != NULL) {
@ -601,7 +601,7 @@ static void WCMD_dir_trailer(WCHAR drive) {
WCHAR driveName[4] = {'c',':','\\','\0'};
driveName[0] = drive;
status = GetDiskFreeSpaceEx (driveName, &avail, &total, &freebytes);
status = GetDiskFreeSpaceExW(driveName, &avail, &total, &freebytes);
WINE_TRACE("Writing trailer for '%s' gave %d(%d)\n", wine_dbgstr_w(driveName),
status, GetLastError());
@ -654,7 +654,7 @@ void WCMD_directory (WCHAR *cmd) {
errorlevel = 0;
/* Prefill quals with (uppercased) DIRCMD env var */
if (GetEnvironmentVariable (dircmdW, string, sizeof(string)/sizeof(WCHAR))) {
if (GetEnvironmentVariableW(dircmdW, string, sizeof(string)/sizeof(WCHAR))) {
p = string;
while ( (*p = toupper(*p)) ) ++p;
strcatW(string,quals);
@ -833,7 +833,7 @@ void WCMD_directory (WCHAR *cmd) {
argno = 0;
argsProcessed = 0;
argN = cmd;
GetCurrentDirectory (MAX_PATH, cwd);
GetCurrentDirectoryW(MAX_PATH, cwd);
strcatW(cwd, slashW);
/* Loop through all args, calculating full effective directory */
@ -850,10 +850,10 @@ void WCMD_directory (WCHAR *cmd) {
} else if (thisArg[1] == ':' && thisArg[2] != '\\') {
WCHAR envvar[4];
static const WCHAR envFmt[] = {'=','%','c',':','\0'};
wsprintf(envvar, envFmt, thisArg[0]);
if (!GetEnvironmentVariable(envvar, fullname, MAX_PATH)) {
wsprintfW(envvar, envFmt, thisArg[0]);
if (!GetEnvironmentVariableW(envvar, fullname, MAX_PATH)) {
static const WCHAR noEnvFmt[] = {'%','c',':','\0'};
wsprintf(fullname, noEnvFmt, thisArg[0]);
wsprintfW(fullname, noEnvFmt, thisArg[0]);
}
strcatW(fullname, slashW);
strcatW(fullname, &thisArg[2]);
@ -866,7 +866,7 @@ void WCMD_directory (WCHAR *cmd) {
}
WINE_TRACE("Using location '%s'\n", wine_dbgstr_w(fullname));
status = GetFullPathName (fullname, sizeof(path)/sizeof(WCHAR), path, NULL);
status = GetFullPathNameW(fullname, sizeof(path)/sizeof(WCHAR), path, NULL);
/*
* If the path supplied does not include a wildcard, and the endpoint of the
@ -874,7 +874,7 @@ void WCMD_directory (WCHAR *cmd) {
* directory not the directory file itself.
*/
if ((strchrW(path, '*') == NULL) && (strchrW(path, '%') == NULL)) {
status = GetFileAttributes (path);
status = GetFileAttributesW(path);
if ((status != INVALID_FILE_ATTRIBUTES) && (status & FILE_ATTRIBUTE_DIRECTORY)) {
if (path[strlenW(path)-1] == '\\') {
strcatW (path, starW);

View File

@ -269,7 +269,7 @@ void WCMD_output_asis (const WCHAR *message) {
}
} while (((message = ptr) != NULL) && (*ptr));
} else {
WCMD_output_asis_len(message, lstrlen(message),
WCMD_output_asis_len(message, lstrlenW(message),
GetStdHandle(STD_OUTPUT_HANDLE));
}
}
@ -286,18 +286,18 @@ void WCMD_print_error (void) {
int status;
error_code = GetLastError ();
status = FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, error_code, 0, (LPTSTR) &lpMsgBuf, 0, NULL);
status = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, error_code, 0, (LPWSTR) &lpMsgBuf, 0, NULL);
if (!status) {
WINE_FIXME ("Cannot display message for error %d, status %d\n",
error_code, GetLastError());
return;
}
WCMD_output_asis_len(lpMsgBuf, lstrlen(lpMsgBuf),
WCMD_output_asis_len(lpMsgBuf, lstrlenW(lpMsgBuf),
GetStdHandle(STD_ERROR_HANDLE));
LocalFree (lpMsgBuf);
WCMD_output_asis_len (newline, lstrlen(newline),
WCMD_output_asis_len (newline, lstrlenW(newline),
GetStdHandle(STD_ERROR_HANDLE));
return;
}
@ -317,7 +317,7 @@ static void WCMD_show_prompt (void) {
DWORD len;
static const WCHAR envPrompt[] = {'P','R','O','M','P','T','\0'};
len = GetEnvironmentVariable (envPrompt, prompt_string,
len = GetEnvironmentVariableW(envPrompt, prompt_string,
sizeof(prompt_string)/sizeof(WCHAR));
if ((len == 0) || (len >= (sizeof(prompt_string)/sizeof(WCHAR)))) {
const WCHAR dfltPrompt[] = {'$','P','$','G','\0'};
@ -347,7 +347,7 @@ static void WCMD_show_prompt (void) {
*q++ = '(';
break;
case 'D':
GetDateFormat (LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, q, MAX_PATH);
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, q, MAX_PATH);
while (*q) q++;
break;
case 'E':
@ -366,13 +366,13 @@ static void WCMD_show_prompt (void) {
*q++ = '<';
break;
case 'N':
status = GetCurrentDirectory (sizeof(curdir)/sizeof(WCHAR), curdir);
status = GetCurrentDirectoryW(sizeof(curdir)/sizeof(WCHAR), curdir);
if (status) {
*q++ = curdir[0];
}
break;
case 'P':
status = GetCurrentDirectory (sizeof(curdir)/sizeof(WCHAR), curdir);
status = GetCurrentDirectoryW(sizeof(curdir)/sizeof(WCHAR), curdir);
if (status) {
strcatW (q, curdir);
while (*q) q++;
@ -385,7 +385,7 @@ static void WCMD_show_prompt (void) {
*q++ = ' ';
break;
case 'T':
GetTimeFormat (LOCALE_USER_DEFAULT, 0, NULL, NULL, q, MAX_PATH);
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, NULL, NULL, q, MAX_PATH);
while (*q) q++;
break;
case 'V':
@ -542,54 +542,54 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR *forVar, WCHAR *forVal) {
/* Expand to contents, if unchanged, return */
/* Handle DATE, TIME, ERRORLEVEL and CD replacements allowing */
/* override if existing env var called that name */
if ((CompareString (LOCALE_USER_DEFAULT,
if ((CompareStringW(LOCALE_USER_DEFAULT,
NORM_IGNORECASE | SORT_STRINGSORT,
thisVar, 12, ErrorLvlP, -1) == 2) &&
(GetEnvironmentVariable(ErrorLvl, thisVarContents, 1) == 0) &&
(GetEnvironmentVariableW(ErrorLvl, thisVarContents, 1) == 0) &&
(GetLastError() == ERROR_ENVVAR_NOT_FOUND)) {
static const WCHAR fmt[] = {'%','d','\0'};
wsprintf(thisVarContents, fmt, errorlevel);
wsprintfW(thisVarContents, fmt, errorlevel);
len = strlenW(thisVarContents);
} else if ((CompareString (LOCALE_USER_DEFAULT,
} else if ((CompareStringW(LOCALE_USER_DEFAULT,
NORM_IGNORECASE | SORT_STRINGSORT,
thisVar, 6, DateP, -1) == 2) &&
(GetEnvironmentVariable(Date, thisVarContents, 1) == 0) &&
(GetEnvironmentVariableW(Date, thisVarContents, 1) == 0) &&
(GetLastError() == ERROR_ENVVAR_NOT_FOUND)) {
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL,
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL,
NULL, thisVarContents, MAXSTRING);
len = strlenW(thisVarContents);
} else if ((CompareString (LOCALE_USER_DEFAULT,
} else if ((CompareStringW(LOCALE_USER_DEFAULT,
NORM_IGNORECASE | SORT_STRINGSORT,
thisVar, 6, TimeP, -1) == 2) &&
(GetEnvironmentVariable(Time, thisVarContents, 1) == 0) &&
(GetEnvironmentVariableW(Time, thisVarContents, 1) == 0) &&
(GetLastError() == ERROR_ENVVAR_NOT_FOUND)) {
GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL,
GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL,
NULL, thisVarContents, MAXSTRING);
len = strlenW(thisVarContents);
} else if ((CompareString (LOCALE_USER_DEFAULT,
} else if ((CompareStringW(LOCALE_USER_DEFAULT,
NORM_IGNORECASE | SORT_STRINGSORT,
thisVar, 4, CdP, -1) == 2) &&
(GetEnvironmentVariable(Cd, thisVarContents, 1) == 0) &&
(GetEnvironmentVariableW(Cd, thisVarContents, 1) == 0) &&
(GetLastError() == ERROR_ENVVAR_NOT_FOUND)) {
GetCurrentDirectory (MAXSTRING, thisVarContents);
GetCurrentDirectoryW(MAXSTRING, thisVarContents);
len = strlenW(thisVarContents);
} else if ((CompareString (LOCALE_USER_DEFAULT,
} else if ((CompareStringW(LOCALE_USER_DEFAULT,
NORM_IGNORECASE | SORT_STRINGSORT,
thisVar, 8, RandomP, -1) == 2) &&
(GetEnvironmentVariable(Random, thisVarContents, 1) == 0) &&
(GetEnvironmentVariableW(Random, thisVarContents, 1) == 0) &&
(GetLastError() == ERROR_ENVVAR_NOT_FOUND)) {
static const WCHAR fmt[] = {'%','d','\0'};
wsprintf(thisVarContents, fmt, rand() % 32768);
wsprintfW(thisVarContents, fmt, rand() % 32768);
len = strlenW(thisVarContents);
/* Look for a matching 'for' variable */
} else if (forVar &&
(CompareString (LOCALE_USER_DEFAULT,
(CompareStringW(LOCALE_USER_DEFAULT,
SORT_STRINGSORT,
thisVar,
(colonpos - thisVar) - 1,
@ -599,7 +599,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR *forVar, WCHAR *forVal) {
} else {
len = ExpandEnvironmentStrings(thisVar, thisVarContents,
len = ExpandEnvironmentStringsW(thisVar, thisVarContents,
sizeof(thisVarContents)/sizeof(WCHAR));
}
@ -709,9 +709,9 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR *forVar, WCHAR *forVal) {
/* Since we need to be case insensitive, copy the 2 buffers */
searchIn = WCMD_strdupW(thisVarContents);
CharUpperBuff(searchIn, strlenW(thisVarContents));
CharUpperBuffW(searchIn, strlenW(thisVarContents));
searchFor = WCMD_strdupW(colonpos+1);
CharUpperBuff(searchFor, strlenW(colonpos+1));
CharUpperBuffW(searchFor, strlenW(colonpos+1));
/* Handle wildcard case */
if (*(colonpos+1) == '*') {
@ -809,7 +809,7 @@ static void handleExpansion(WCHAR *cmd, BOOL justFors, WCHAR *forVariable, WCHAR
WCMD_strsubstW(p, p+2, NULL, 0);
} else if (forVariable &&
(CompareString (LOCALE_USER_DEFAULT,
(CompareStringW(LOCALE_USER_DEFAULT,
SORT_STRINGSORT,
p,
strlenW(forVariable),
@ -886,14 +886,14 @@ static void WCMD_parse (WCHAR *s, WCHAR *q, WCHAR *p1, WCHAR *p2)
}
}
static void init_msvcrt_io_block(STARTUPINFO* st)
static void init_msvcrt_io_block(STARTUPINFOW* st)
{
STARTUPINFO st_p;
STARTUPINFOW st_p;
/* fetch the parent MSVCRT info block if any, so that the child can use the
* same handles as its grand-father
*/
st_p.cb = sizeof(STARTUPINFO);
GetStartupInfo(&st_p);
st_p.cb = sizeof(STARTUPINFOW);
GetStartupInfoW(&st_p);
st->cbReserved2 = st_p.cbReserved2;
st->lpReserved2 = st_p.lpReserved2;
if (st_p.cbReserved2 && st_p.lpReserved2)
@ -984,7 +984,7 @@ void WCMD_run_program (WCHAR *command, int called) {
if (strpbrkW (param1, delims) == NULL) { /* No explicit path given, search path */
static const WCHAR curDir[] = {'.',';','\0'};
strcpyW(pathtosearch, curDir);
len = GetEnvironmentVariable (envPath, &pathtosearch[2], (sizeof(pathtosearch)/sizeof(WCHAR))-2);
len = GetEnvironmentVariableW(envPath, &pathtosearch[2], (sizeof(pathtosearch)/sizeof(WCHAR))-2);
if ((len == 0) || (len >= (sizeof(pathtosearch)/sizeof(WCHAR)) - 2)) {
static const WCHAR curDir[] = {'.','\0'};
strcpyW (pathtosearch, curDir);
@ -1001,7 +1001,7 @@ void WCMD_run_program (WCHAR *command, int called) {
} else {
/* Convert eg. ..\fred to include a directory by removing file part */
GetFullPathName(param1, sizeof(pathtosearch)/sizeof(WCHAR), pathtosearch, NULL);
GetFullPathNameW(param1, sizeof(pathtosearch)/sizeof(WCHAR), pathtosearch, NULL);
lastSlash = strrchrW(pathtosearch, '\\');
if (lastSlash && strchrW(lastSlash, '.') != NULL) extensionsupplied = TRUE;
strcpyW(stemofsearch, lastSlash+1);
@ -1012,7 +1012,7 @@ void WCMD_run_program (WCHAR *command, int called) {
}
/* Now extract PATHEXT */
len = GetEnvironmentVariable (envPathExt, pathext, sizeof(pathext)/sizeof(WCHAR));
len = GetEnvironmentVariableW(envPathExt, pathext, sizeof(pathext)/sizeof(WCHAR));
if ((len == 0) || (len >= (sizeof(pathext)/sizeof(WCHAR)))) {
static const WCHAR dfltPathExt[] = {'.','b','a','t',';',
'.','c','o','m',';',
@ -1047,7 +1047,7 @@ void WCMD_run_program (WCHAR *command, int called) {
/* Since you can have eg. ..\.. on the path, need to expand
to full information */
strcpyW(temp, thisDir);
GetFullPathName(temp, MAX_PATH, thisDir, NULL);
GetFullPathNameW(temp, MAX_PATH, thisDir, NULL);
/* 1. If extension supplied, see if that file exists */
strcatW(thisDir, slashW);
@ -1056,7 +1056,7 @@ void WCMD_run_program (WCHAR *command, int called) {
/* 1. If extension supplied, see if that file exists */
if (extensionsupplied) {
if (GetFileAttributes(thisDir) != INVALID_FILE_ATTRIBUTES) {
if (GetFileAttributesW(thisDir) != INVALID_FILE_ATTRIBUTES) {
found = TRUE;
}
}
@ -1064,11 +1064,11 @@ void WCMD_run_program (WCHAR *command, int called) {
/* 2. Any .* matches? */
if (!found) {
HANDLE h;
WIN32_FIND_DATA finddata;
WIN32_FIND_DATAW finddata;
static const WCHAR allFiles[] = {'.','*','\0'};
strcatW(thisDir,allFiles);
h = FindFirstFile(thisDir, &finddata);
h = FindFirstFileW(thisDir, &finddata);
FindClose(h);
if (h != INVALID_HANDLE_VALUE) {
@ -1087,7 +1087,7 @@ void WCMD_run_program (WCHAR *command, int called) {
thisExt = NULL;
}
if (GetFileAttributes(thisDir) != INVALID_FILE_ATTRIBUTES) {
if (GetFileAttributesW(thisDir) != INVALID_FILE_ATTRIBUTES) {
found = TRUE;
thisExt = NULL;
}
@ -1109,9 +1109,9 @@ void WCMD_run_program (WCHAR *command, int called) {
/* Once found, launch it */
if (found || assumeInternal) {
STARTUPINFO st;
STARTUPINFOW st;
PROCESS_INFORMATION pe;
SHFILEINFO psfi;
SHFILEINFOW psfi;
DWORD console;
HINSTANCE hinst;
WCHAR *ext = strrchrW( thisDir, '.' );
@ -1131,19 +1131,19 @@ void WCMD_run_program (WCHAR *command, int called) {
/* thisDir contains the file to be launched, but with what?
eg. a.exe will require a.exe to be launched, a.html may be iexplore */
hinst = FindExecutable (thisDir, NULL, temp);
hinst = FindExecutableW (thisDir, NULL, temp);
if ((INT_PTR)hinst < 32)
console = 0;
else
console = SHGetFileInfo (temp, 0, &psfi, sizeof(psfi), SHGFI_EXETYPE);
console = SHGetFileInfoW(temp, 0, &psfi, sizeof(psfi), SHGFI_EXETYPE);
ZeroMemory (&st, sizeof(STARTUPINFO));
st.cb = sizeof(STARTUPINFO);
ZeroMemory (&st, sizeof(STARTUPINFOW));
st.cb = sizeof(STARTUPINFOW);
init_msvcrt_io_block(&st);
/* Launch the process and if a CUI wait on it to complete
Note: Launching internal wine processes cannot specify a full path to exe */
status = CreateProcess (assumeInternal?NULL : thisDir,
status = CreateProcessW(assumeInternal?NULL : thisDir,
command, NULL, NULL, TRUE, 0, NULL, NULL, &st, &pe);
if ((opt_c || opt_k) && !opt_s && !status
&& GetLastError()==ERROR_FILE_NOT_FOUND && command[0]=='\"') {
@ -1228,8 +1228,8 @@ void WCMD_execute (WCHAR *command, WCHAR *redirects,
piped = TRUE;
/* Generate a unique temporary filename */
GetTempPath (sizeof(temp_path)/sizeof(WCHAR), temp_path);
GetTempFileName (temp_path, cmdW, 0, (*cmdList)->nextcommand->pipeFile);
GetTempPathW(sizeof(temp_path)/sizeof(WCHAR), temp_path);
GetTempFileNameW(temp_path, cmdW, 0, (*cmdList)->nextcommand->pipeFile);
WINE_TRACE("Using temporary file of %s\n",
wine_dbgstr_w((*cmdList)->nextcommand->pipeFile));
}
@ -1255,7 +1255,7 @@ void WCMD_execute (WCHAR *command, WCHAR *redirects,
/* If piped output, send stdout to the pipe by appending >filename to redirects */
if (piped) {
static const WCHAR redirOut[] = {'%','s',' ','>',' ','%','s','\0'};
wsprintf (new_redir, redirOut, redirects, (*cmdList)->nextcommand->pipeFile);
wsprintfW (new_redir, redirOut, redirects, (*cmdList)->nextcommand->pipeFile);
WINE_TRACE("Redirects now %s\n", wine_dbgstr_w(new_redir));
} else {
strcpyW(new_redir, redirects);
@ -1278,7 +1278,7 @@ void WCMD_execute (WCHAR *command, WCHAR *redirects,
* Changing default drive has to be handled as a special case.
*/
if ((cmd[1] == ':') && IsCharAlpha (cmd[0]) && (strlenW(cmd) == 2)) {
if ((cmd[1] == ':') && IsCharAlphaW(cmd[0]) && (strlenW(cmd) == 2)) {
WCHAR envvar[5];
WCHAR dir[MAX_PATH];
@ -1287,13 +1287,13 @@ void WCMD_execute (WCHAR *command, WCHAR *redirects,
so see if one specified, and if so go back to it */
strcpyW(envvar, equalsW);
strcatW(envvar, cmd);
if (GetEnvironmentVariable(envvar, dir, MAX_PATH) == 0) {
if (GetEnvironmentVariableW(envvar, dir, MAX_PATH) == 0) {
static const WCHAR fmt[] = {'%','s','\\','\0'};
wsprintf(cmd, fmt, cmd);
wsprintfW(cmd, fmt, cmd);
WINE_TRACE("No special directory settings, using dir of %s\n", wine_dbgstr_w(cmd));
}
WINE_TRACE("Got directory %s as %s\n", wine_dbgstr_w(envvar), wine_dbgstr_w(cmd));
status = SetCurrentDirectory (cmd);
status = SetCurrentDirectoryW(cmd);
if (!status) WCMD_print_error ();
HeapFree( GetProcessHeap(), 0, cmd );
HeapFree( GetProcessHeap(), 0, new_redir );
@ -1311,7 +1311,7 @@ void WCMD_execute (WCHAR *command, WCHAR *redirects,
/* STDIN could come from a preceding pipe, so delete on close if it does */
if (cmdList && (*cmdList)->pipeFile[0] != 0x00) {
WINE_TRACE("Input coming from %s\n", wine_dbgstr_w((*cmdList)->pipeFile));
h = CreateFile ((*cmdList)->pipeFile, GENERIC_READ,
h = CreateFileW((*cmdList)->pipeFile, GENERIC_READ,
FILE_SHARE_READ, &sa, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL);
if (h == INVALID_HANDLE_VALUE) {
@ -1327,7 +1327,7 @@ void WCMD_execute (WCHAR *command, WCHAR *redirects,
/* Otherwise STDIN could come from a '<' redirect */
} else if ((p = strchrW(new_redir,'<')) != NULL) {
h = CreateFile (WCMD_parameter (++p, 0, NULL), GENERIC_READ, FILE_SHARE_READ, &sa, OPEN_EXISTING,
h = CreateFileW(WCMD_parameter (++p, 0, NULL), GENERIC_READ, FILE_SHARE_READ, &sa, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) {
WCMD_print_error ();
@ -1374,7 +1374,7 @@ void WCMD_execute (WCHAR *command, WCHAR *redirects,
} else {
WCHAR *param = WCMD_parameter (p, 0, NULL);
h = CreateFile (param, GENERIC_WRITE, 0, &sa, creationDisposition,
h = CreateFileW(param, GENERIC_WRITE, 0, &sa, creationDisposition,
FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) {
WCMD_print_error ();
@ -1405,11 +1405,11 @@ void WCMD_execute (WCHAR *command, WCHAR *redirects,
*/
count = 0;
while (IsCharAlphaNumeric(whichcmd[count])) {
while (IsCharAlphaNumericW(whichcmd[count])) {
count++;
}
for (i=0; i<=WCMD_EXIT; i++) {
if (CompareString (LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
whichcmd, count, inbuilt[i], -1) == 2) break;
}
p = WCMD_strtrim_leading_spaces (&whichcmd[count]);
@ -1566,7 +1566,7 @@ WCHAR *WCMD_LoadMessage(UINT id) {
static WCHAR msg[2048];
static const WCHAR failedMsg[] = {'F','a','i','l','e','d','!','\0'};
if (!LoadString(GetModuleHandle(NULL), id, msg, sizeof(msg)/sizeof(WCHAR))) {
if (!LoadStringW(GetModuleHandleW(NULL), id, msg, sizeof(msg)/sizeof(WCHAR))) {
WINE_FIXME("LoadString failed with %d\n", GetLastError());
strcpyW(msg, failedMsg);
}
@ -1795,12 +1795,12 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF
const WCHAR forDO[] = {'d','o',' ','\0'};
/* If command starts with 'rem', ignore any &&, ( etc */
if (CompareString (LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
curPos, 4, remCmd, -1) == 2) {
inRem = TRUE;
/* If command starts with 'for', handle ('s mid line after IN or DO */
} else if (CompareString (LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
} else if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
curPos, 4, forCmd, -1) == 2) {
inFor = TRUE;
@ -1810,11 +1810,11 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF
FIXME: Silly syntax like "if 1(==1( (
echo they equal
)" will be parsed wrong */
} else if (CompareString (LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
} else if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
curPos, 3, ifCmd, -1) == 2) {
inIf = TRUE;
} else if (CompareString (LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
} else if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
curPos, 5, ifElse, -1) == 2) {
inElse = TRUE;
lastWasElse = TRUE;
@ -1828,7 +1828,7 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF
whitespace, followed by DO, ie closeBracket inserts a NULL entry, curLen
is then 0, and all whitespace is skipped */
} else if (inFor &&
(CompareString (LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
(CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
curPos, 3, forDO, -1) == 2)) {
WINE_TRACE("Found DO\n");
lastWasDo = TRUE;
@ -1846,7 +1846,7 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF
WINE_TRACE("Found 'FOR', comparing next parm: '%s'\n", wine_dbgstr_w(curPos));
if (CompareString (LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
curPos, 3, forIN, -1) == 2) {
WINE_TRACE("Found IN\n");
lastWasIn = TRUE;
@ -2197,7 +2197,7 @@ int wmain (int argc, WCHAR *argvW[])
/* Pre initialize some messages */
strcpy(ansiVersion, PACKAGE_VERSION);
MultiByteToWideChar(CP_ACP, 0, ansiVersion, -1, string, 1024);
wsprintf(version_string, WCMD_LoadMessage(WCMD_VERSION), string);
wsprintfW(version_string, WCMD_LoadMessage(WCMD_VERSION), string);
strcpyW(anykey, WCMD_LoadMessage(WCMD_ANYKEY));
args = argc;
@ -2412,7 +2412,7 @@ int wmain (int argc, WCHAR *argvW[])
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_LINE_INPUT |
ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
SetConsoleTitle(WCMD_LoadMessage(WCMD_CONSTITLE));
SetConsoleTitleW(WCMD_LoadMessage(WCMD_CONSTITLE));
/* Note: cmd.exe /c dir does not get a new color, /k dir does */
if (opt_t) {
@ -2435,20 +2435,20 @@ int wmain (int argc, WCHAR *argvW[])
'C','o','m','m','a','n','d',' ','P','r','o','c','e','s','s','o','r','\0'};
static const WCHAR dfltColorW[] = {'D','e','f','a','u','l','t','C','o','l','o','r','\0'};
if (RegOpenKeyEx(HKEY_CURRENT_USER, regKeyW,
if (RegOpenKeyExW(HKEY_CURRENT_USER, regKeyW,
0, KEY_READ, &key) == ERROR_SUCCESS) {
WCHAR strvalue[4];
/* See if DWORD or REG_SZ */
if (RegQueryValueEx(key, dfltColorW, NULL, &type,
if (RegQueryValueExW(key, dfltColorW, NULL, &type,
NULL, NULL) == ERROR_SUCCESS) {
if (type == REG_DWORD) {
size = sizeof(DWORD);
RegQueryValueEx(key, dfltColorW, NULL, NULL,
RegQueryValueExW(key, dfltColorW, NULL, NULL,
(LPBYTE)&value, &size);
} else if (type == REG_SZ) {
size = sizeof(strvalue)/sizeof(WCHAR);
RegQueryValueEx(key, dfltColorW, NULL, NULL,
RegQueryValueExW(key, dfltColorW, NULL, NULL,
(LPBYTE)strvalue, &size);
value = strtoulW(strvalue, NULL, 10);
}
@ -2456,20 +2456,20 @@ int wmain (int argc, WCHAR *argvW[])
RegCloseKey(key);
}
if (value == 0 && RegOpenKeyEx(HKEY_LOCAL_MACHINE, regKeyW,
if (value == 0 && RegOpenKeyExW(HKEY_LOCAL_MACHINE, regKeyW,
0, KEY_READ, &key) == ERROR_SUCCESS) {
WCHAR strvalue[4];
/* See if DWORD or REG_SZ */
if (RegQueryValueEx(key, dfltColorW, NULL, &type,
if (RegQueryValueExW(key, dfltColorW, NULL, &type,
NULL, NULL) == ERROR_SUCCESS) {
if (type == REG_DWORD) {
size = sizeof(DWORD);
RegQueryValueEx(key, dfltColorW, NULL, NULL,
RegQueryValueExW(key, dfltColorW, NULL, NULL,
(LPBYTE)&value, &size);
} else if (type == REG_SZ) {
size = sizeof(strvalue)/sizeof(WCHAR);
RegQueryValueEx(key, dfltColorW, NULL, NULL,
RegQueryValueExW(key, dfltColorW, NULL, NULL,
(LPBYTE)strvalue, &size);
value = strtoulW(strvalue, NULL, 10);
}
@ -2487,11 +2487,11 @@ int wmain (int argc, WCHAR *argvW[])
}
/* Save cwd into appropriate env var */
GetCurrentDirectory(1024, string);
if (IsCharAlpha(string[0]) && string[1] == ':') {
GetCurrentDirectoryW(1024, string);
if (IsCharAlphaW(string[0]) && string[1] == ':') {
static const WCHAR fmt[] = {'=','%','c',':','\0'};
wsprintf(envvar, fmt, string[0]);
SetEnvironmentVariable(envvar, string);
wsprintfW(envvar, fmt, string[0]);
SetEnvironmentVariableW(envvar, string);
WINE_TRACE("Set %s to %s\n", wine_dbgstr_w(envvar), wine_dbgstr_w(string));
}
@ -2508,8 +2508,8 @@ int wmain (int argc, WCHAR *argvW[])
* If there is an AUTOEXEC.BAT file, try to execute it.
*/
GetFullPathName (autoexec, sizeof(string)/sizeof(WCHAR), string, NULL);
h = CreateFile (string, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
GetFullPathNameW (autoexec, sizeof(string)/sizeof(WCHAR), string, NULL);
h = CreateFileW(string, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h != INVALID_HANDLE_VALUE) {
CloseHandle (h);
#if 0