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@ VPATH = @srcdir@
MODULE = cmd.exe MODULE = cmd.exe
APPMODE = -mconsole -municode APPMODE = -mconsole -municode
EXTRADEFS = -DUNICODE EXTRADEFS = -DWINE_NO_UNICODE_MACROS
IMPORTS = shell32 user32 advapi32 kernel32 IMPORTS = shell32 user32 advapi32 kernel32
C_SRCS = \ 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))) && for(i=0; (i<sizeof(extension_batch)/(WCMD_BATCH_EXT_SIZE * sizeof(WCHAR))) &&
(h == INVALID_HANDLE_VALUE); i++) { (h == INVALID_HANDLE_VALUE); i++) {
strcpyW (string, file); strcpyW (string, file);
CharLower (string); CharLowerW (string);
if (strstrW (string, extension_batch[i]) == NULL) strcatW (string, extension_batch[i]); 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); NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
} }
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
strcpyW (string, file); strcpyW (string, file);
CharLower (string); CharLowerW (string);
if (strstrW (string, extension_exe) == NULL) strcatW (string, extension_exe); 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); WCMD_run_program (command, 0);
} else { } else {
SetLastError (ERROR_FILE_NOT_FOUND); SetLastError (ERROR_FILE_NOT_FOUND);
@ -425,9 +425,8 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
env[(end-start)] = 0x00; env[(end-start)] = 0x00;
/* If env var not found, return empty string */ /* If env var not found, return empty string */
if ((GetEnvironmentVariable(env, fullpath, MAX_PATH) == 0) || if ((GetEnvironmentVariableW(env, fullpath, MAX_PATH) == 0) ||
(SearchPath(fullpath, outputparam, NULL, (SearchPathW(fullpath, outputparam, NULL, MAX_PATH, outputparam, NULL) == 0)) {
MAX_PATH, outputparam, NULL) == 0)) {
finaloutput[0] = 0x00; finaloutput[0] = 0x00;
outputparam[0] = 0x00; outputparam[0] = 0x00;
skipFileParsing = TRUE; skipFileParsing = TRUE;
@ -437,7 +436,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
/* After this, we need full information on the file, /* After this, we need full information on the file,
which is valid not to exist. */ which is valid not to exist. */
if (!skipFileParsing) { if (!skipFileParsing) {
if (GetFullPathName(outputparam, MAX_PATH, fullfilename, NULL) == 0) if (GetFullPathNameW(outputparam, MAX_PATH, fullfilename, NULL) == 0)
return; return;
exists = GetFileAttributesExW(fullfilename, GetFileExInfoStandard, exists = GetFileAttributesExW(fullfilename, GetFileExInfoStandard,
@ -480,11 +479,11 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
/* Format the time */ /* Format the time */
FileTimeToSystemTime(&fileInfo.ftLastWriteTime, &systime); FileTimeToSystemTime(&fileInfo.ftLastWriteTime, &systime);
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systime, GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systime,
NULL, thisoutput, MAX_PATH); NULL, thisoutput, MAX_PATH);
strcatW(thisoutput, space); strcatW(thisoutput, space);
datelen = strlenW(thisoutput); datelen = strlenW(thisoutput);
GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &systime, GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &systime,
NULL, (thisoutput+datelen), MAX_PATH-datelen); NULL, (thisoutput+datelen), MAX_PATH-datelen);
strcatW(finaloutput, thisoutput); strcatW(finaloutput, thisoutput);
} }
@ -499,7 +498,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
doneModifier = TRUE; doneModifier = TRUE;
if (finaloutput[0] != 0x00) strcatW(finaloutput, space); if (finaloutput[0] != 0x00) strcatW(finaloutput, space);
wsprintf(thisoutput, fmt, fullsize); wsprintfW(thisoutput, fmt, fullsize);
strcatW(finaloutput, thisoutput); strcatW(finaloutput, thisoutput);
} }
@ -507,8 +506,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
if (memchrW(firstModifier, 's', modifierLen) != NULL) { if (memchrW(firstModifier, 's', modifierLen) != NULL) {
if (finaloutput[0] != 0x00) strcatW(finaloutput, space); if (finaloutput[0] != 0x00) strcatW(finaloutput, space);
/* Don't flag as doneModifier - %~s on its own is processed later */ /* Don't flag as doneModifier - %~s on its own is processed later */
GetShortPathName(outputparam, outputparam, GetShortPathNameW(outputparam, outputparam, sizeof(outputparam)/sizeof(outputparam[0]));
sizeof(outputparam)/sizeof(outputparam[0]));
} }
/* 5. Handle 'f' : Fully qualified path (File doesn't have to exist) */ /* 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; DWORD count = 0;
/* Load the translated 'Are you sure', plus valid answers */ /* Load the translated 'Are you sure', plus valid answers */
LoadString (hinst, WCMD_CONFIRM, msgbuffer, sizeof(msgbuffer)/sizeof(WCHAR)); LoadStringW(hinst, WCMD_CONFIRM, msgbuffer, sizeof(msgbuffer)/sizeof(WCHAR));
LoadString (hinst, WCMD_YES, Ybuffer, sizeof(Ybuffer)/sizeof(WCHAR)); LoadStringW(hinst, WCMD_YES, Ybuffer, sizeof(Ybuffer)/sizeof(WCHAR));
LoadString (hinst, WCMD_NO, Nbuffer, sizeof(Nbuffer)/sizeof(WCHAR)); LoadStringW(hinst, WCMD_NO, Nbuffer, sizeof(Nbuffer)/sizeof(WCHAR));
LoadString (hinst, WCMD_ALL, Abuffer, sizeof(Abuffer)/sizeof(WCHAR)); LoadStringW(hinst, WCMD_ALL, Abuffer, sizeof(Abuffer)/sizeof(WCHAR));
/* Loop waiting on a Y or N */ /* Loop waiting on a Y or N */
while (answer[0] != Ybuffer[0] && answer[0] != Nbuffer[0]) { while (answer[0] != Ybuffer[0] && answer[0] != Nbuffer[0]) {
@ -142,7 +142,7 @@ void WCMD_clear_screen (void) {
topLeft.X = 0; topLeft.X = 0;
topLeft.Y = 0; topLeft.Y = 0;
FillConsoleOutputCharacter(hStdOut, ' ', screenSize, topLeft, &screenSize); FillConsoleOutputCharacterW(hStdOut, ' ', screenSize, topLeft, &screenSize);
SetConsoleCursorPosition(hStdOut, topLeft); SetConsoleCursorPosition(hStdOut, topLeft);
} }
} }
@ -168,7 +168,7 @@ void WCMD_change_tty (void) {
void WCMD_copy (void) { void WCMD_copy (void) {
WIN32_FIND_DATA fd; WIN32_FIND_DATAW fd;
HANDLE hff; HANDLE hff;
BOOL force, status; BOOL force, status;
WCHAR outpath[MAX_PATH], srcpath[MAX_PATH], copycmd[4]; WCHAR outpath[MAX_PATH], srcpath[MAX_PATH], copycmd[4];
@ -190,12 +190,12 @@ void WCMD_copy (void) {
/* Convert source into full spec */ /* Convert source into full spec */
WINE_TRACE("Copy source (supplied): '%s'\n", wine_dbgstr_w(param1)); 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] == '\\') if (srcpath[strlenW(srcpath) - 1] == '\\')
srcpath[strlenW(srcpath) - 1] = '\0'; srcpath[strlenW(srcpath) - 1] = '\0';
if ((strchrW(srcpath,'*') == NULL) && (strchrW(srcpath,'?') == NULL)) { if ((strchrW(srcpath,'*') == NULL) && (strchrW(srcpath,'?') == NULL)) {
attribs = GetFileAttributes(srcpath); attribs = GetFileAttributesW(srcpath);
} else { } else {
attribs = 0; attribs = 0;
} }
@ -221,10 +221,10 @@ void WCMD_copy (void) {
strcpyW(param2, dotW); strcpyW(param2, dotW);
} }
GetFullPathName (param2, sizeof(outpath)/sizeof(WCHAR), outpath, NULL); GetFullPathNameW(param2, sizeof(outpath)/sizeof(WCHAR), outpath, NULL);
if (outpath[strlenW(outpath) - 1] == '\\') if (outpath[strlenW(outpath) - 1] == '\\')
outpath[strlenW(outpath) - 1] = '\0'; outpath[strlenW(outpath) - 1] = '\0';
attribs = GetFileAttributes(outpath); attribs = GetFileAttributesW(outpath);
if (attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY)) { if (attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY)) {
strcatW (outpath, slashW); strcatW (outpath, slashW);
copyToDir = TRUE; copyToDir = TRUE;
@ -245,7 +245,7 @@ void WCMD_copy (void) {
/* If COPYCMD is set, then we force the overwrite with /Y and ask for /* 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 * confirmation with /-Y. If COPYCMD is neither of those, then we use the
* default behavior. */ * 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 (len && len < (sizeof(copycmd)/sizeof(WCHAR))) {
if (!lstrcmpiW (copycmd, parmY)) if (!lstrcmpiW (copycmd, parmY))
force = TRUE; force = TRUE;
@ -256,7 +256,7 @@ void WCMD_copy (void) {
/* Loop through all source files */ /* Loop through all source files */
WINE_TRACE("Searching for: '%s'\n", wine_dbgstr_w(srcspec)); WINE_TRACE("Searching for: '%s'\n", wine_dbgstr_w(srcspec));
hff = FindFirstFile (srcspec, &fd); hff = FindFirstFileW(srcspec, &fd);
if (hff != INVALID_HANDLE_VALUE) { if (hff != INVALID_HANDLE_VALUE) {
do { do {
WCHAR outname[MAX_PATH]; WCHAR outname[MAX_PATH];
@ -281,10 +281,10 @@ void WCMD_copy (void) {
/* Prompt before overwriting */ /* Prompt before overwriting */
else if (!overwrite) { else if (!overwrite) {
attribs = GetFileAttributes(outname); attribs = GetFileAttributesW(outname);
if (attribs != INVALID_FILE_ATTRIBUTES) { if (attribs != INVALID_FILE_ATTRIBUTES) {
WCHAR buffer[MAXSTRING]; WCHAR buffer[MAXSTRING];
wsprintf(buffer, WCMD_LoadMessage(WCMD_OVERWRITE), outname); wsprintfW(buffer, WCMD_LoadMessage(WCMD_OVERWRITE), outname);
overwrite = WCMD_ask_confirm(buffer, FALSE, NULL); overwrite = WCMD_ask_confirm(buffer, FALSE, NULL);
} }
else overwrite = TRUE; else overwrite = TRUE;
@ -292,11 +292,11 @@ void WCMD_copy (void) {
/* Do the copy as appropriate */ /* Do the copy as appropriate */
if (overwrite) { if (overwrite) {
status = CopyFile (srcname, outname, FALSE); status = CopyFileW(srcname, outname, FALSE);
if (!status) WCMD_print_error (); if (!status) WCMD_print_error ();
} }
} while (FindNextFile(hff, &fd) != 0); } while (FindNextFileW(hff, &fd) != 0);
FindClose (hff); FindClose (hff);
} else { } else {
status = ERROR_FILE_NOT_FOUND; 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] == '\\') while ((len = strlenW(new_path)) && new_path[len - 1] == '\\')
new_path[len - 1] = 0; new_path[len - 1] = 0;
while (!CreateDirectory(new_path,NULL)) while (!CreateDirectoryW(new_path,NULL))
{ {
WCHAR *slash; WCHAR *slash;
DWORD last_error = GetLastError(); DWORD last_error = GetLastError();
@ -401,7 +401,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
if (argN && argN[0] != '/') { if (argN && argN[0] != '/') {
WIN32_FIND_DATA fd; WIN32_FIND_DATAW fd;
HANDLE hff; HANDLE hff;
WCHAR fpath[MAX_PATH]; WCHAR fpath[MAX_PATH];
WCHAR *p; WCHAR *p;
@ -424,7 +424,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
WCHAR ext[MAX_PATH]; WCHAR ext[MAX_PATH];
/* Convert path into actual directory spec */ /* 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); WCMD_splitpath(fpath, drive, dir, fname, ext);
/* Only prompt for * and *.*, not *a, a*, *.a* etc */ /* Only prompt for * and *.*, not *a, a*, *.a* etc */
@ -438,7 +438,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
found = TRUE; found = TRUE;
/* Ask for confirmation */ /* Ask for confirmation */
wsprintf(question, fmt, fpath); wsprintfW(question, fmt, fpath);
ok = WCMD_ask_confirm(question, TRUE, NULL); ok = WCMD_ask_confirm(question, TRUE, NULL);
/* Abort if answer is 'N' */ /* Abort if answer is 'N' */
@ -447,7 +447,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
} }
/* First, try to delete in the current directory */ /* First, try to delete in the current directory */
hff = FindFirstFile (argCopy, &fd); hff = FindFirstFileW(argCopy, &fd);
if (hff == INVALID_HANDLE_VALUE) { if (hff == INVALID_HANDLE_VALUE) {
handleParm = FALSE; handleParm = FALSE;
} else { } else {
@ -542,7 +542,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
WCHAR question[MAXSTRING]; WCHAR question[MAXSTRING];
/* Ask for confirmation */ /* Ask for confirmation */
wsprintf(question, WCMD_LoadMessage(WCMD_DELPROMPT), fpath); wsprintfW(question, WCMD_LoadMessage(WCMD_DELPROMPT), fpath);
ok = WCMD_ask_confirm(question, FALSE, NULL); 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 file is read only, and /F supplied, delete it */
if (fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY && if (fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY &&
strstrW (quals, parmF) != NULL) { strstrW (quals, parmF) != NULL) {
SetFileAttributes(fpath, fd.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY); SetFileAttributesW(fpath, fd.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY);
} }
/* Now do the delete */ /* 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); FindClose (hff);
} }
@ -576,7 +576,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
WCHAR ext[MAX_PATH]; WCHAR ext[MAX_PATH];
/* Convert path into actual directory spec */ /* 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); WCMD_splitpath(thisDir, drive, dir, fname, ext);
strcpyW(thisDir, drive); strcpyW(thisDir, drive);
@ -589,7 +589,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
thisDir[cPos] = '*'; thisDir[cPos] = '*';
thisDir[cPos+1] = 0x00; thisDir[cPos+1] = 0x00;
hff = FindFirstFile (thisDir, &fd); hff = FindFirstFileW(thisDir, &fd);
/* Remove residual '*' */ /* Remove residual '*' */
thisDir[cPos] = 0x00; thisDir[cPos] = 0x00;
@ -624,7 +624,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
(strlenW(subParm)+1) * sizeof(WCHAR)); (strlenW(subParm)+1) * sizeof(WCHAR));
strcpyW(nextDir->dirName, subParm); strcpyW(nextDir->dirName, subParm);
} }
} while (FindNextFile(hff, &fd) != 0); } while (FindNextFileW(hff, &fd) != 0);
FindClose (hff); FindClose (hff);
/* Go through each subdir doing the delete */ /* 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) { void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
WIN32_FIND_DATA fd; WIN32_FIND_DATAW fd;
HANDLE hff; HANDLE hff;
int i; int i;
const WCHAR inW[] = {'i', 'n', ' ', '\0'}; 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 */ and once we have the complete set, we expect a DO */
WINE_TRACE("Looking for 'do' in %p\n", *cmdList); WINE_TRACE("Looking for 'do' in %p\n", *cmdList);
if ((*cmdList == NULL) || 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)) { (*cmdList)->command, 3, doW, -1) != 2)) {
WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR)); WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR));
return; return;
@ -855,7 +855,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
if (!useNumbers && !doFileset) { if (!useNumbers && !doFileset) {
if (strpbrkW (item, wildcards)) { if (strpbrkW (item, wildcards)) {
hff = FindFirstFile (item, &fd); hff = FindFirstFileW(item, &fd);
if (hff != INVALID_HANDLE_VALUE) { if (hff != INVALID_HANDLE_VALUE) {
do { do {
BOOL isDirectory = FALSE; BOOL isDirectory = FALSE;
@ -873,7 +873,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
fd.cFileName, FALSE, TRUE); fd.cFileName, FALSE, TRUE);
} }
} while (FindNextFile(hff, &fd) != 0); } while (FindNextFileW(hff, &fd) != 0);
FindClose (hff); FindClose (hff);
} }
} else { } else {
@ -906,20 +906,20 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
itemStart[strlenW(itemStart)-1] = 0x00; itemStart[strlenW(itemStart)-1] = 0x00;
/* Get temp filename */ /* Get temp filename */
GetTempPath (sizeof(temp_path)/sizeof(WCHAR), temp_path); GetTempPathW(sizeof(temp_path)/sizeof(WCHAR), temp_path);
GetTempFileName (temp_path, cmdW, 0, temp_file); GetTempFileNameW(temp_path, cmdW, 0, temp_file);
/* Execute program and redirect output */ /* 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); WCMD_execute (itemStart, temp_cmd, NULL, NULL, NULL);
/* Open the file, read line by line and process */ /* 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); NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
} else { } else {
/* Open the file, read line by line and process */ /* 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); NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
} }
@ -958,7 +958,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
/* Delete the temporary file */ /* Delete the temporary file */
if (*itemStart == '`' || *itemStart == '\'') { if (*itemStart == '`' || *itemStart == '\'') {
DeleteFile (temp_file); DeleteFileW(temp_file);
} }
/* Filesets - A string literal */ /* 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? */ /* End of the command - does 'ELSE ' follow as the next command? */
} else { } else {
if (isIF && CompareString (LOCALE_USER_DEFAULT, if (isIF && CompareStringW(LOCALE_USER_DEFAULT,
NORM_IGNORECASE | SORT_STRINGSORT, NORM_IGNORECASE | SORT_STRINGSORT,
(*cmdList)->command, 5, ifElse, -1) == 2) { (*cmdList)->command, 5, ifElse, -1) == 2) {
@ -1133,7 +1133,7 @@ void WCMD_give_help (WCHAR *command) {
} }
else { else {
for (i=0; i<=WCMD_EXIT; i++) { 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) { param1, -1, inbuilt[i], -1) == 2) {
WCMD_output_asis (WCMD_LoadMessage(i)); WCMD_output_asis (WCMD_LoadMessage(i));
return; return;
@ -1292,13 +1292,13 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) {
WCMD_parameter (p, 2+negate, &command); WCMD_parameter (p, 2+negate, &command);
} }
else if (!lstrcmpiW (condition, existW)) { 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; test = 1;
} }
WCMD_parameter (p, 2+negate, &command); WCMD_parameter (p, 2+negate, &command);
} }
else if (!lstrcmpiW (condition, defdW)) { 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; test = 1;
} }
WCMD_parameter (p, 2+negate, &command); WCMD_parameter (p, 2+negate, &command);
@ -1327,7 +1327,7 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) {
void WCMD_move (void) { void WCMD_move (void) {
int status; int status;
WIN32_FIND_DATA fd; WIN32_FIND_DATAW fd;
HANDLE hff; HANDLE hff;
WCHAR input[MAX_PATH]; WCHAR input[MAX_PATH];
WCHAR output[MAX_PATH]; WCHAR output[MAX_PATH];
@ -1348,15 +1348,15 @@ void WCMD_move (void) {
/* If 2nd parm is directory, then use original filename */ /* If 2nd parm is directory, then use original filename */
/* Convert partial path to full path */ /* Convert partial path to full path */
GetFullPathName (param1, sizeof(input)/sizeof(WCHAR), input, NULL); GetFullPathNameW(param1, sizeof(input)/sizeof(WCHAR), input, NULL);
GetFullPathName (param2, sizeof(output)/sizeof(WCHAR), output, NULL); GetFullPathNameW(param2, sizeof(output)/sizeof(WCHAR), output, NULL);
WINE_TRACE("Move from '%s'('%s') to '%s'\n", wine_dbgstr_w(input), WINE_TRACE("Move from '%s'('%s') to '%s'\n", wine_dbgstr_w(input),
wine_dbgstr_w(param1), wine_dbgstr_w(output)); wine_dbgstr_w(param1), wine_dbgstr_w(output));
/* Split into components */ /* Split into components */
WCMD_splitpath(input, drive, dir, fname, ext); WCMD_splitpath(input, drive, dir, fname, ext);
hff = FindFirstFile (input, &fd); hff = FindFirstFileW(input, &fd);
while (hff != INVALID_HANDLE_VALUE) { while (hff != INVALID_HANDLE_VALUE) {
WCHAR dest[MAX_PATH]; WCHAR dest[MAX_PATH];
WCHAR src[MAX_PATH]; WCHAR src[MAX_PATH];
@ -1369,7 +1369,7 @@ void WCMD_move (void) {
strcatW(src, dir); strcatW(src, dir);
/* See if dest is an existing directory */ /* See if dest is an existing directory */
attribs = GetFileAttributes(output); attribs = GetFileAttributesW(output);
if (attribs != INVALID_FILE_ATTRIBUTES && if (attribs != INVALID_FILE_ATTRIBUTES &&
(attribs & FILE_ATTRIBUTE_DIRECTORY)) { (attribs & FILE_ATTRIBUTE_DIRECTORY)) {
strcpyW(dest, output); strcpyW(dest, output);
@ -1385,7 +1385,7 @@ void WCMD_move (void) {
WINE_TRACE("Dest '%s'\n", wine_dbgstr_w(dest)); WINE_TRACE("Dest '%s'\n", wine_dbgstr_w(dest));
/* Check if file is read only, otherwise move it */ /* Check if file is read only, otherwise move it */
attribs = GetFileAttributes(src); attribs = GetFileAttributesW(src);
if ((attribs != INVALID_FILE_ATTRIBUTES) && if ((attribs != INVALID_FILE_ATTRIBUTES) &&
(attribs & FILE_ATTRIBUTE_READONLY)) { (attribs & FILE_ATTRIBUTE_READONLY)) {
SetLastError(ERROR_ACCESS_DENIED); SetLastError(ERROR_ACCESS_DENIED);
@ -1394,7 +1394,7 @@ void WCMD_move (void) {
BOOL ok = TRUE; BOOL ok = TRUE;
/* If destination exists, prompt unless /Y supplied */ /* If destination exists, prompt unless /Y supplied */
if (GetFileAttributes(dest) != INVALID_FILE_ATTRIBUTES) { if (GetFileAttributesW(dest) != INVALID_FILE_ATTRIBUTES) {
BOOL force = FALSE; BOOL force = FALSE;
WCHAR copycmd[MAXSTRING]; WCHAR copycmd[MAXSTRING];
int len; int len;
@ -1406,7 +1406,7 @@ void WCMD_move (void) {
force = TRUE; force = TRUE;
else { else {
const WCHAR copyCmdW[] = {'C','O','P','Y','C','M','D','\0'}; 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)) force = (len && len < (sizeof(copycmd)/sizeof(WCHAR))
&& ! lstrcmpiW (copycmd, parmY)); && ! lstrcmpiW (copycmd, parmY));
} }
@ -1419,12 +1419,12 @@ void WCMD_move (void) {
strcpyW(yesChar, WCMD_LoadMessage(WCMD_YES)); strcpyW(yesChar, WCMD_LoadMessage(WCMD_YES));
/* Ask for confirmation */ /* Ask for confirmation */
wsprintf(question, WCMD_LoadMessage(WCMD_OVERWRITE), dest); wsprintfW(question, WCMD_LoadMessage(WCMD_OVERWRITE), dest);
ok = WCMD_ask_confirm(question, FALSE, NULL); ok = WCMD_ask_confirm(question, FALSE, NULL);
/* So delete the destination prior to the move */ /* So delete the destination prior to the move */
if (ok) { if (ok) {
if (!DeleteFile (dest)) { if (!DeleteFileW(dest)) {
WCMD_print_error (); WCMD_print_error ();
errorlevel = 1; errorlevel = 1;
ok = FALSE; ok = FALSE;
@ -1434,7 +1434,7 @@ void WCMD_move (void) {
} }
if (ok) { if (ok) {
status = MoveFile (src, dest); status = MoveFileW(src, dest);
} else { } else {
status = 1; /* Anything other than 0 to prevent error msg below */ status = 1; /* Anything other than 0 to prevent error msg below */
} }
@ -1446,7 +1446,7 @@ void WCMD_move (void) {
} }
/* Step on to next match */ /* Step on to next match */
if (FindNextFile(hff, &fd) == 0) { if (FindNextFileW(hff, &fd) == 0) {
FindClose(hff); FindClose(hff);
hff = INVALID_HANDLE_VALUE; hff = INVALID_HANDLE_VALUE;
break; break;
@ -1495,12 +1495,12 @@ void WCMD_remove_dir (WCHAR *command) {
/* If subdirectory search not supplied, just try to remove /* If subdirectory search not supplied, just try to remove
and report error if it fails (eg if it contains a file) */ and report error if it fails (eg if it contains a file) */
if (strstrW (quals, parmS) == NULL) { 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 */ /* Otherwise use ShFileOp to recursively remove a directory */
} else { } else {
SHFILEOPSTRUCT lpDir; SHFILEOPSTRUCTW lpDir;
/* Ask first */ /* Ask first */
if (strstrW (quals, parmQ) == NULL) { if (strstrW (quals, parmQ) == NULL) {
@ -1509,7 +1509,7 @@ void WCMD_remove_dir (WCHAR *command) {
static const WCHAR fmt[] = {'%','s',' ','\0'}; static const WCHAR fmt[] = {'%','s',' ','\0'};
/* Ask for confirmation */ /* Ask for confirmation */
wsprintf(question, fmt, thisArg); wsprintfW(question, fmt, thisArg);
ok = WCMD_ask_confirm(question, TRUE, NULL); ok = WCMD_ask_confirm(question, TRUE, NULL);
/* Abort if answer is 'N' */ /* Abort if answer is 'N' */
@ -1522,7 +1522,7 @@ void WCMD_remove_dir (WCHAR *command) {
lpDir.pFrom = thisArg; lpDir.pFrom = thisArg;
lpDir.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI; lpDir.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI;
lpDir.wFunc = FO_DELETE; 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; int status;
HANDLE hff; HANDLE hff;
WIN32_FIND_DATA fd; WIN32_FIND_DATAW fd;
WCHAR input[MAX_PATH]; WCHAR input[MAX_PATH];
WCHAR *dotDst = NULL; WCHAR *dotDst = NULL;
WCHAR drive[10]; WCHAR drive[10];
@ -1572,7 +1572,7 @@ void WCMD_rename (void) {
} }
/* Convert partial path to full path */ /* 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_TRACE("Rename from '%s'('%s') to '%s'\n", wine_dbgstr_w(input),
wine_dbgstr_w(param1), wine_dbgstr_w(param2)); wine_dbgstr_w(param1), wine_dbgstr_w(param2));
dotDst = strchrW(param2, '.'); dotDst = strchrW(param2, '.');
@ -1580,7 +1580,7 @@ void WCMD_rename (void) {
/* Split into components */ /* Split into components */
WCMD_splitpath(input, drive, dir, fname, ext); WCMD_splitpath(input, drive, dir, fname, ext);
hff = FindFirstFile (input, &fd); hff = FindFirstFileW(input, &fd);
while (hff != INVALID_HANDLE_VALUE) { while (hff != INVALID_HANDLE_VALUE) {
WCHAR dest[MAX_PATH]; WCHAR dest[MAX_PATH];
WCHAR src[MAX_PATH]; WCHAR src[MAX_PATH];
@ -1624,13 +1624,13 @@ void WCMD_rename (void) {
WINE_TRACE("Dest '%s'\n", wine_dbgstr_w(dest)); WINE_TRACE("Dest '%s'\n", wine_dbgstr_w(dest));
/* Check if file is read only, otherwise move it */ /* Check if file is read only, otherwise move it */
attribs = GetFileAttributes(src); attribs = GetFileAttributesW(src);
if ((attribs != INVALID_FILE_ATTRIBUTES) && if ((attribs != INVALID_FILE_ATTRIBUTES) &&
(attribs & FILE_ATTRIBUTE_READONLY)) { (attribs & FILE_ATTRIBUTE_READONLY)) {
SetLastError(ERROR_ACCESS_DENIED); SetLastError(ERROR_ACCESS_DENIED);
status = 0; status = 0;
} else { } else {
status = MoveFile (src, dest); status = MoveFileW(src, dest);
} }
if (!status) { if (!status) {
@ -1639,7 +1639,7 @@ void WCMD_rename (void) {
} }
/* Step on to next match */ /* Step on to next match */
if (FindNextFile(hff, &fd) == 0) { if (FindNextFileW(hff, &fd) == 0) {
FindClose(hff); FindClose(hff);
hff = INVALID_HANDLE_VALUE; hff = INVALID_HANDLE_VALUE;
break; break;
@ -1705,7 +1705,7 @@ void WCMD_setlocal (const WCHAR *s) {
saved_environment = env_copy; saved_environment = env_copy;
/* Save the current drive letter */ /* Save the current drive letter */
GetCurrentDirectory (MAX_PATH, cwd); GetCurrentDirectoryW(MAX_PATH, cwd);
env_copy->u.cwd = cwd[0]; env_copy->u.cwd = cwd[0];
} }
else else
@ -1766,15 +1766,15 @@ void WCMD_endlocal (void) {
} }
/* Restore current drive letter */ /* Restore current drive letter */
if (IsCharAlpha(temp->u.cwd)) { if (IsCharAlphaW(temp->u.cwd)) {
WCHAR envvar[4]; WCHAR envvar[4];
WCHAR cwd[MAX_PATH]; WCHAR cwd[MAX_PATH];
static const WCHAR fmt[] = {'=','%','c',':','\0'}; static const WCHAR fmt[] = {'=','%','c',':','\0'};
wsprintf(envvar, fmt, temp->u.cwd); wsprintfW(envvar, fmt, temp->u.cwd);
if (GetEnvironmentVariable(envvar, cwd, MAX_PATH)) { if (GetEnvironmentVariableW(envvar, cwd, MAX_PATH)) {
WINE_TRACE("Resetting cwd to %s\n", wine_dbgstr_w(cwd)); 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; DWORD count;
HANDLE hff; HANDLE hff;
WIN32_FIND_DATA fd; WIN32_FIND_DATAW fd;
WCHAR flags[9] = {' ',' ',' ',' ',' ',' ',' ',' ','\0'}; WCHAR flags[9] = {' ',' ',' ',' ',' ',' ',' ',' ','\0'};
WCHAR *name = param1; WCHAR *name = param1;
DWORD attrib_set=0; DWORD attrib_set=0;
@ -1821,11 +1821,11 @@ void WCMD_setshow_attrib (void) {
if (strlenW(name) == 0) { if (strlenW(name) == 0) {
static const WCHAR slashStarW[] = {'\\','*','\0'}; static const WCHAR slashStarW[] = {'\\','*','\0'};
GetCurrentDirectory (sizeof(param2)/sizeof(WCHAR), name); GetCurrentDirectoryW(sizeof(param2)/sizeof(WCHAR), name);
strcatW (name, slashStarW); strcatW (name, slashStarW);
} }
hff = FindFirstFile (name, &fd); hff = FindFirstFileW(name, &fd);
if (hff == INVALID_HANDLE_VALUE) { if (hff == INVALID_HANDLE_VALUE) {
WCMD_output (WCMD_LoadMessage(WCMD_FILENOTFOUND), name); WCMD_output (WCMD_LoadMessage(WCMD_FILENOTFOUND), name);
} }
@ -1860,7 +1860,7 @@ void WCMD_setshow_attrib (void) {
WCMD_output (fmt, flags, fd.cFileName); WCMD_output (fmt, flags, fd.cFileName);
for (count=0; count < 8; count++) flags[count] = ' '; for (count=0; count < 8; count++) flags[count] = ' ';
} }
} while (FindNextFile(hff, &fd) != 0); } while (FindNextFileW(hff, &fd) != 0);
} }
FindClose (hff); FindClose (hff);
} }
@ -1877,21 +1877,21 @@ void WCMD_setshow_default (WCHAR *command) {
WCHAR string[1024]; WCHAR string[1024];
WCHAR cwd[1024]; WCHAR cwd[1024];
WCHAR *pos; WCHAR *pos;
WIN32_FIND_DATA fd; WIN32_FIND_DATAW fd;
HANDLE hff; HANDLE hff;
static const WCHAR parmD[] = {'/','D','\0'}; static const WCHAR parmD[] = {'/','D','\0'};
WINE_TRACE("Request change to directory '%s'\n", wine_dbgstr_w(command)); 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 */ /* 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, NORM_IGNORECASE | SORT_STRINGSORT,
command, 2, parmD, -1) == 2) { command, 2, parmD, -1) == 2) {
command += 2; command += 2;
while (*command && *command==' ') command++; while (*command && *command==' ') command++;
} }
GetCurrentDirectory (sizeof(cwd)/sizeof(WCHAR), cwd); GetCurrentDirectoryW(sizeof(cwd)/sizeof(WCHAR), cwd);
if (strlenW(command) == 0) { if (strlenW(command) == 0) {
strcatW (cwd, newline); strcatW (cwd, newline);
WCMD_output (cwd); WCMD_output (cwd);
@ -1908,7 +1908,7 @@ void WCMD_setshow_default (WCHAR *command) {
/* Search for appropriate directory */ /* Search for appropriate directory */
WINE_TRACE("Looking for directory '%s'\n", wine_dbgstr_w(string)); WINE_TRACE("Looking for directory '%s'\n", wine_dbgstr_w(string));
hff = FindFirstFile (string, &fd); hff = FindFirstFileW(string, &fd);
while (hff != INVALID_HANDLE_VALUE) { while (hff != INVALID_HANDLE_VALUE) {
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
WCHAR fpath[MAX_PATH]; WCHAR fpath[MAX_PATH];
@ -1919,11 +1919,11 @@ void WCMD_setshow_default (WCHAR *command) {
static const WCHAR fmt[] = {'%','s','%','s','%','s','\0'}; static const WCHAR fmt[] = {'%','s','%','s','%','s','\0'};
/* Convert path into actual directory spec */ /* 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); WCMD_splitpath(fpath, drive, dir, fname, ext);
/* Rebuild path */ /* Rebuild path */
wsprintf(string, fmt, drive, dir, fd.cFileName); wsprintfW(string, fmt, drive, dir, fd.cFileName);
FindClose(hff); FindClose(hff);
hff = INVALID_HANDLE_VALUE; hff = INVALID_HANDLE_VALUE;
@ -1931,7 +1931,7 @@ void WCMD_setshow_default (WCHAR *command) {
} }
/* Step on to next match */ /* Step on to next match */
if (FindNextFile(hff, &fd) == 0) { if (FindNextFileW(hff, &fd) == 0) {
FindClose(hff); FindClose(hff);
hff = INVALID_HANDLE_VALUE; hff = INVALID_HANDLE_VALUE;
break; break;
@ -1941,7 +1941,7 @@ void WCMD_setshow_default (WCHAR *command) {
/* Change to that directory */ /* Change to that directory */
WINE_TRACE("Really changing to directory '%s'\n", wine_dbgstr_w(string)); WINE_TRACE("Really changing to directory '%s'\n", wine_dbgstr_w(string));
status = SetCurrentDirectory (string); status = SetCurrentDirectoryW(string);
if (!status) { if (!status) {
errorlevel = 1; errorlevel = 1;
WCMD_print_error (); WCMD_print_error ();
@ -1955,7 +1955,7 @@ void WCMD_setshow_default (WCHAR *command) {
CD x:\directory /D (or pushd c:\directory) not supplied */ CD x:\directory /D (or pushd c:\directory) not supplied */
if ((strstrW(quals, parmD) == NULL) && if ((strstrW(quals, parmD) == NULL) &&
(param1[1] == ':') && (toupper(param1[0]) != toupper(cwd[0]))) { (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 change of directory, even if path was restored due to missing
/D (allows changing drive letter when not resident on that /D (allows changing drive letter when not resident on that
drive */ drive */
if ((string[1] == ':') && IsCharAlpha (string[0])) { if ((string[1] == ':') && IsCharAlphaW(string[0])) {
WCHAR env[4]; WCHAR env[4];
strcpyW(env, equalW); strcpyW(env, equalW);
memcpy(env+1, string, 2 * sizeof(WCHAR)); memcpy(env+1, string, 2 * sizeof(WCHAR));
env[3] = 0x00; env[3] = 0x00;
WINE_TRACE("Setting '%s' to '%s'\n", wine_dbgstr_w(env), wine_dbgstr_w(string)); 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'}; static const WCHAR parmT[] = {'/','T','\0'};
if (strlenW(param1) == 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))) { curdate, sizeof(curdate)/sizeof(WCHAR))) {
WCMD_output (WCMD_LoadMessage(WCMD_CURRENTDATE), curdate); WCMD_output (WCMD_LoadMessage(WCMD_CURRENTDATE), curdate);
if (strstrW (quals, parmT) == NULL) { if (strstrW (quals, parmT) == NULL) {
@ -2016,7 +2016,7 @@ static int WCMD_compare( const void *a, const void *b )
{ {
int r; int r;
const WCHAR * const *str_a = a, * const *str_b = b; 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 ); *str_a, -1, *str_b, -1 );
if( r == CSTR_LESS_THAN ) return -1; if( r == CSTR_LESS_THAN ) return -1;
if( r == CSTR_GREATER_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 */ /* print it */
for( i=0; i<count; i++ ) { for( i=0; i<count; i++ ) {
if (!stub || CompareString (LOCALE_USER_DEFAULT, if (!stub || CompareStringW(LOCALE_USER_DEFAULT,
NORM_IGNORECASE | SORT_STRINGSORT, NORM_IGNORECASE | SORT_STRINGSORT,
str[i], stublen, stub, -1) == 2) { str[i], stublen, stub, -1) == 2) {
/* Don't display special internal variables */ /* Don't display special internal variables */
@ -2087,13 +2087,13 @@ void WCMD_setshow_env (WCHAR *s) {
errorlevel = 0; errorlevel = 0;
if (param1[0] == 0x00 && quals[0] == 0x00) { if (param1[0] == 0x00 && quals[0] == 0x00) {
env = GetEnvironmentStrings (); env = GetEnvironmentStringsW();
WCMD_setshow_sortenv( env, NULL ); WCMD_setshow_sortenv( env, NULL );
return; return;
} }
/* See if /P supplied, and if so echo the prompt, and read in a reply */ /* 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, NORM_IGNORECASE | SORT_STRINGSORT,
s, 2, parmP, -1) == 2) { s, 2, parmP, -1) == 2) {
WCHAR string[MAXSTRING]; 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! */ 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_TRACE("set /p: Setting var '%s' to '%s'\n", wine_dbgstr_w(s),
wine_dbgstr_w(string)); wine_dbgstr_w(string));
status = SetEnvironmentVariable (s, string); status = SetEnvironmentVariableW(s, string);
} }
} else { } else {
@ -2132,7 +2132,7 @@ void WCMD_setshow_env (WCHAR *s) {
WCMD_opt_s_strip_quotes(s); WCMD_opt_s_strip_quotes(s);
p = strchrW (s, '='); p = strchrW (s, '=');
if (p == NULL) { if (p == NULL) {
env = GetEnvironmentStrings (); env = GetEnvironmentStringsW();
if (WCMD_setshow_sortenv( env, s ) == 0) { if (WCMD_setshow_sortenv( env, s ) == 0) {
WCMD_output (WCMD_LoadMessage(WCMD_MISSINGENV), s); WCMD_output (WCMD_LoadMessage(WCMD_MISSINGENV), s);
errorlevel = 1; errorlevel = 1;
@ -2142,7 +2142,7 @@ void WCMD_setshow_env (WCHAR *s) {
*p++ = '\0'; *p++ = '\0';
if (strlenW(p) == 0) p = NULL; if (strlenW(p) == 0) p = NULL;
status = SetEnvironmentVariable (s, p); status = SetEnvironmentVariableW(s, p);
gle = GetLastError(); gle = GetLastError();
if ((!status) & (gle == ERROR_ENVVAR_NOT_FOUND)) { if ((!status) & (gle == ERROR_ENVVAR_NOT_FOUND)) {
errorlevel = 1; errorlevel = 1;
@ -2164,7 +2164,7 @@ void WCMD_setshow_path (WCHAR *command) {
static const WCHAR pathEqW[] = {'P','A','T','H','=','\0'}; static const WCHAR pathEqW[] = {'P','A','T','H','=','\0'};
if (strlenW(param1) == 0) { if (strlenW(param1) == 0) {
status = GetEnvironmentVariable (pathW, string, sizeof(string)/sizeof(WCHAR)); status = GetEnvironmentVariableW(pathW, string, sizeof(string)/sizeof(WCHAR));
if (status != 0) { if (status != 0) {
WCMD_output_asis ( pathEqW); WCMD_output_asis ( pathEqW);
WCMD_output_asis ( string); WCMD_output_asis ( string);
@ -2176,7 +2176,7 @@ void WCMD_setshow_path (WCHAR *command) {
} }
else { else {
if (*command == '=') command++; /* Skip leading '=' */ if (*command == '=') command++; /* Skip leading '=' */
status = SetEnvironmentVariable (pathW, command); status = SetEnvironmentVariableW(pathW, command);
if (!status) WCMD_print_error(); 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'}; static const WCHAR promptW[] = {'P','R','O','M','P','T','\0'};
if (strlenW(param1) == 0) { if (strlenW(param1) == 0) {
SetEnvironmentVariable (promptW, NULL); SetEnvironmentVariableW(promptW, NULL);
} }
else { else {
s = param1; s = param1;
while ((*s == '=') || (*s == ' ')) s++; while ((*s == '=') || (*s == ' ')) s++;
if (strlenW(s) == 0) { 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) { if (strlenW(param1) == 0) {
GetLocalTime(&st); GetLocalTime(&st);
if (GetTimeFormat (LOCALE_USER_DEFAULT, 0, &st, NULL, if (GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL,
curtime, sizeof(curtime)/sizeof(WCHAR))) { curtime, sizeof(curtime)/sizeof(WCHAR))) {
WCMD_output (WCMD_LoadMessage(WCMD_CURRENTTIME), curtime); WCMD_output (WCMD_LoadMessage(WCMD_CURRENTTIME), curtime);
if (strstrW (quals, parmT) == NULL) { if (strstrW (quals, parmT) == NULL) {
@ -2279,7 +2279,7 @@ void WCMD_shift (WCHAR *command) {
* Set the console title * Set the console title
*/ */
void WCMD_title (WCHAR *command) { void WCMD_title (WCHAR *command) {
SetConsoleTitle(command); SetConsoleTitleW(command);
} }
/**************************************************************************** /****************************************************************************
@ -2313,7 +2313,7 @@ void WCMD_type (WCHAR *command) {
if (!argN) break; if (!argN) break;
WINE_TRACE("type: Processing arg '%s'\n", wine_dbgstr_w(thisArg)); 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); FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
WCMD_print_error (); WCMD_print_error ();
@ -2360,7 +2360,7 @@ void WCMD_more (WCHAR *command) {
/* Prefix the NLS more with '-- ', then load the text */ /* Prefix the NLS more with '-- ', then load the text */
errorlevel = 0; errorlevel = 0;
strcpyW(moreStr, moreStart); strcpyW(moreStr, moreStart);
LoadString (hinst, WCMD_MORESTR, &moreStr[3], LoadStringW(hinst, WCMD_MORESTR, &moreStr[3],
(sizeof(moreStr)/sizeof(WCHAR))-3); (sizeof(moreStr)/sizeof(WCHAR))-3);
if (param1[0] == 0x00) { 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 more are satisfied by the next line from the input (file). To
avoid this, ensure stdin is to the console */ avoid this, ensure stdin is to the console */
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE); 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_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0); FILE_ATTRIBUTE_NORMAL, 0);
WINE_TRACE("No parms - working probably in pipe mode\n"); 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 /* 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... */ once you get in this bit unless due to a pipe, its going to end badly... */
useinput = TRUE; useinput = TRUE;
wsprintf(moreStrPage, moreFmt, moreStr); wsprintfW(moreStrPage, moreFmt, moreStr);
WCMD_enter_paged_mode(moreStrPage); WCMD_enter_paged_mode(moreStrPage);
while (WCMD_ReadFile (hstdin, buffer, (sizeof(buffer)/sizeof(WCHAR))-1, &count, NULL)) { while (WCMD_ReadFile (hstdin, buffer, (sizeof(buffer)/sizeof(WCHAR))-1, &count, NULL)) {
@ -2410,7 +2410,7 @@ void WCMD_more (WCHAR *command) {
if (needsPause) { if (needsPause) {
/* Wait */ /* Wait */
wsprintf(moreStrPage, moreFmt2, moreStr, 100); wsprintfW(moreStrPage, moreFmt2, moreStr, 100);
WCMD_leave_paged_mode(); WCMD_leave_paged_mode();
WCMD_output_asis(moreStrPage); WCMD_output_asis(moreStrPage);
WCMD_ReadFile (GetStdHandle(STD_INPUT_HANDLE), buffer, 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)); 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); FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
WCMD_print_error (); WCMD_print_error ();
@ -2432,7 +2432,7 @@ void WCMD_more (WCHAR *command) {
WIN32_FILE_ATTRIBUTE_DATA fileInfo; WIN32_FILE_ATTRIBUTE_DATA fileInfo;
/* Get the file size */ /* Get the file size */
GetFileAttributesEx(thisArg, GetFileExInfoStandard, (void*)&fileInfo); GetFileAttributesExW(thisArg, GetFileExInfoStandard, (void*)&fileInfo);
fileLen = (((ULONG64)fileInfo.nFileSizeHigh) << 32) + fileInfo.nFileSizeLow; fileLen = (((ULONG64)fileInfo.nFileSizeHigh) << 32) + fileInfo.nFileSizeLow;
needsPause = TRUE; needsPause = TRUE;
@ -2442,7 +2442,7 @@ void WCMD_more (WCHAR *command) {
curPos += count; curPos += count;
/* Update % count (would be used in WCMD_output_asis as prompt) */ /* 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); WCMD_output_asis (buffer);
} }
@ -2508,12 +2508,12 @@ int WCMD_volume (int mode, WCHAR *path) {
BOOL status; BOOL status;
if (strlenW(path) == 0) { if (strlenW(path) == 0) {
status = GetCurrentDirectory (sizeof(curdir)/sizeof(WCHAR), curdir); status = GetCurrentDirectoryW(sizeof(curdir)/sizeof(WCHAR), curdir);
if (!status) { if (!status) {
WCMD_print_error (); WCMD_print_error ();
return 0; return 0;
} }
status = GetVolumeInformation (NULL, label, sizeof(label)/sizeof(WCHAR), status = GetVolumeInformationW(NULL, label, sizeof(label)/sizeof(WCHAR),
&serial, NULL, NULL, NULL, 0); &serial, NULL, NULL, NULL, 0);
} }
else { else {
@ -2522,8 +2522,8 @@ int WCMD_volume (int mode, WCHAR *path) {
WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR)); WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR));
return 0; return 0;
} }
wsprintf (curdir, fmt, path); wsprintfW (curdir, fmt, path);
status = GetVolumeInformation (curdir, label, sizeof(label)/sizeof(WCHAR), status = GetVolumeInformationW(curdir, label, sizeof(label)/sizeof(WCHAR),
&serial, NULL, &serial, NULL,
NULL, NULL, 0); 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 (string[count-2] == '\r') string[count-2] = '\0'; /* Under Windoze we get CRLF! */
} }
if (strlenW(path) != 0) { if (strlenW(path) != 0) {
if (!SetVolumeLabel (curdir, string)) WCMD_print_error (); if (!SetVolumeLabelW(curdir, string)) WCMD_print_error ();
} }
else { else {
if (!SetVolumeLabel (NULL, string)) WCMD_print_error (); if (!SetVolumeLabelW(NULL, string)) WCMD_print_error ();
} }
} }
return 1; return 1;
@ -2597,8 +2597,8 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
if (newValue) accessOptions |= KEY_WRITE; if (newValue) accessOptions |= KEY_WRITE;
/* Open a key to HKEY_CLASSES_ROOT for enumerating */ /* Open a key to HKEY_CLASSES_ROOT for enumerating */
if (RegOpenKeyEx(HKEY_CLASSES_ROOT, nullW, 0, if (RegOpenKeyExW(HKEY_CLASSES_ROOT, nullW, 0,
accessOptions, &key) != ERROR_SUCCESS) { accessOptions, &key) != ERROR_SUCCESS) {
WINE_FIXME("Unexpected failure opening HKCR key: %d\n", GetLastError()); WINE_FIXME("Unexpected failure opening HKCR key: %d\n", GetLastError());
return; return;
} }
@ -2614,9 +2614,7 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
/* Find the next value */ /* Find the next value */
nameLen = MAXSTRING; nameLen = MAXSTRING;
rc = RegEnumKeyEx(key, index++, rc = RegEnumKeyExW(key, index++, keyName, &nameLen, NULL, NULL, NULL, NULL);
keyName, &nameLen,
NULL, NULL, NULL, NULL);
if (rc == ERROR_SUCCESS) { if (rc == ERROR_SUCCESS) {
@ -2629,12 +2627,10 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
strcpyW(subkey, keyName); strcpyW(subkey, keyName);
if (!assoc) strcatW(subkey, shOpCmdW); if (!assoc) strcatW(subkey, shOpCmdW);
if (RegOpenKeyEx(key, subkey, 0, if (RegOpenKeyExW(key, subkey, 0, accessOptions, &readKey) == ERROR_SUCCESS) {
accessOptions, &readKey) == ERROR_SUCCESS) {
valueLen = sizeof(keyValue)/sizeof(WCHAR); valueLen = sizeof(keyValue)/sizeof(WCHAR);
rc = RegQueryValueEx(readKey, NULL, NULL, NULL, rc = RegQueryValueExW(readKey, NULL, NULL, NULL, (LPBYTE)keyValue, &valueLen);
(LPBYTE)keyValue, &valueLen);
WCMD_output_asis(keyName); WCMD_output_asis(keyName);
WCMD_output_asis(equalW); WCMD_output_asis(equalW);
/* If no default value found, leave line empty after '=' */ /* If no default value found, leave line empty after '=' */
@ -2664,11 +2660,9 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
strcpyW(subkey, keyValue); strcpyW(subkey, keyValue);
if (!assoc) strcatW(subkey, shOpCmdW); if (!assoc) strcatW(subkey, shOpCmdW);
if (RegOpenKeyEx(key, subkey, 0, if (RegOpenKeyExW(key, subkey, 0, accessOptions, &readKey) == ERROR_SUCCESS) {
accessOptions, &readKey) == ERROR_SUCCESS) {
rc = RegQueryValueEx(readKey, NULL, NULL, NULL, rc = RegQueryValueExW(readKey, NULL, NULL, NULL, (LPBYTE)keyValue, &valueLen);
(LPBYTE)keyValue, &valueLen);
WCMD_output_asis(command); WCMD_output_asis(command);
WCMD_output_asis(equalW); WCMD_output_asis(equalW);
/* If no default value found, leave line empty after '=' */ /* 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' */ /* Load the translated 'File association not found' */
if (assoc) { if (assoc) {
LoadString (hinst, WCMD_NOASSOC, msgbuffer, sizeof(msgbuffer)/sizeof(WCHAR)); LoadStringW(hinst, WCMD_NOASSOC, msgbuffer, sizeof(msgbuffer)/sizeof(WCHAR));
} else { } 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); WCMD_output_asis(outbuffer);
errorlevel = 2; errorlevel = 2;
} }
@ -2707,7 +2701,7 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
/* If nothing after '=' then clear value - only valid for ASSOC */ /* If nothing after '=' then clear value - only valid for ASSOC */
if (*newValue == 0x00) { if (*newValue == 0x00) {
if (assoc) rc = RegDeleteKey(key, command); if (assoc) rc = RegDeleteKeyW(key, command);
if (assoc && rc == ERROR_SUCCESS) { if (assoc && rc == ERROR_SUCCESS) {
WINE_TRACE("HKCR Key '%s' deleted\n", wine_dbgstr_w(command)); 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' */ /* Load the translated 'File association not found' */
if (assoc) { if (assoc) {
LoadString (hinst, WCMD_NOASSOC, msgbuffer, LoadStringW(hinst, WCMD_NOASSOC, msgbuffer,
sizeof(msgbuffer)/sizeof(WCHAR)); sizeof(msgbuffer)/sizeof(WCHAR));
} else { } else {
LoadString (hinst, WCMD_NOFTYPE, msgbuffer, LoadStringW(hinst, WCMD_NOFTYPE, msgbuffer,
sizeof(msgbuffer)/sizeof(WCHAR)); sizeof(msgbuffer)/sizeof(WCHAR));
} }
wsprintf(outbuffer, msgbuffer, keyValue); wsprintfW(outbuffer, msgbuffer, keyValue);
WCMD_output_asis(outbuffer); WCMD_output_asis(outbuffer);
errorlevel = 2; errorlevel = 2;
} }
/* It really is a set value = contents */ /* It really is a set value = contents */
} else { } 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); accessOptions, NULL, &readKey, NULL);
if (rc == ERROR_SUCCESS) { if (rc == ERROR_SUCCESS) {
rc = RegSetValueEx(readKey, NULL, 0, REG_SZ, rc = RegSetValueExW(readKey, NULL, 0, REG_SZ,
(LPBYTE)newValue, strlenW(newValue)); (LPBYTE)newValue, strlenW(newValue));
RegCloseKey(readKey); 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) static int WCMD_dir_sort (const void *a, const void *b)
{ {
WIN32_FIND_DATA *filea = (WIN32_FIND_DATA *)a; WIN32_FIND_DATAW *filea = (WIN32_FIND_DATAW *)a;
WIN32_FIND_DATA *fileb = (WIN32_FIND_DATA *)b; WIN32_FIND_DATAW *fileb = (WIN32_FIND_DATAW *)b;
int result = 0; int result = 0;
/* If /OG or /O-G supplied, dirs go at the top or bottom, ignoring the /* 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; *owner = 0x00;
/* Find out how much space we need for the owner security descriptor */ /* 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(); rc = GetLastError();
if(rc == ERROR_INSUFFICIENT_BUFFER && sizeNeeded > 0) { if(rc == ERROR_INSUFFICIENT_BUFFER && sizeNeeded > 0) {
@ -227,7 +227,7 @@ static void WCMD_getfileowner(WCHAR *filename, WCHAR *owner, int ownerlen) {
if(!secBuffer) return; if(!secBuffer) return;
/* Get the owners security descriptor */ /* Get the owners security descriptor */
if(!GetFileSecurity(filename, OWNER_SECURITY_INFORMATION, secBuffer, if(!GetFileSecurityW(filename, OWNER_SECURITY_INFORMATION, secBuffer,
sizeNeeded, &sizeNeeded)) { sizeNeeded, &sizeNeeded)) {
HeapFree(GetProcessHeap(),0,secBuffer); HeapFree(GetProcessHeap(),0,secBuffer);
return; return;
@ -240,7 +240,7 @@ static void WCMD_getfileowner(WCHAR *filename, WCHAR *owner, int ownerlen) {
} }
/* Convert to a username */ /* 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'}; static const WCHAR fmt[] = {'%','s','%','c','%','s','\0'};
snprintfW(owner, ownerlen, fmt, domain, '\\', name); 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 string[1024], datestring[32], timestring[32];
WCHAR real_path[MAX_PATH]; WCHAR real_path[MAX_PATH];
WIN32_FIND_DATA *fd; WIN32_FIND_DATAW *fd;
FILETIME ft; FILETIME ft;
SYSTEMTIME st; SYSTEMTIME st;
HANDLE hff; 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 same directory. Note issuing a directory header with no contents
mirrors what windows does */ mirrors what windows does */
parms = inputparms; 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) { while (parms && strcmpW(inputparms->dirName, parms->dirName) == 0) {
concurrentDirs++; concurrentDirs++;
@ -304,7 +304,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* Load all files into an in memory structure */ /* Load all files into an in memory structure */
WINE_TRACE("Looking for matches to '%s'\n", wine_dbgstr_w(real_path)); 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) { if (hff != INVALID_HANDLE_VALUE) {
do { do {
/* Skip any which are filtered out by attribute */ /* 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; 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) { if (fd == NULL) {
FindClose (hff); FindClose (hff);
WINE_ERR("Out of memory\n"); WINE_ERR("Out of memory\n");
errorlevel = 1; errorlevel = 1;
return parms->next; return parms->next;
} }
} while (FindNextFile(hff, (fd+entry_count)) != 0); } while (FindNextFileW(hff, (fd+entry_count)) != 0);
FindClose (hff); FindClose (hff);
} }
@ -353,7 +353,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if (entry_count > 0) { if (entry_count > 0) {
/* Sort the list of files */ /* 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 */ /* Work out the number of columns */
WINE_TRACE("%d entries, maxwidth=%d, widest=%d\n", entry_count, max_width, widest); 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); FileTimeToLocalFileTime (&(fd+i)->ftCreationTime, &ft);
} }
FileTimeToSystemTime (&ft, &st); FileTimeToSystemTime (&ft, &st);
GetDateFormat (0, DATE_SHORTDATE, &st, NULL, datestring, GetDateFormatW(0, DATE_SHORTDATE, &st, NULL, datestring,
sizeof(datestring)/sizeof(WCHAR)); sizeof(datestring)/sizeof(WCHAR));
GetTimeFormat (0, TIME_NOSECONDS, &st, GetTimeFormatW(0, TIME_NOSECONDS, &st,
NULL, timestring, sizeof(timestring)/sizeof(WCHAR)); NULL, timestring, sizeof(timestring)/sizeof(WCHAR));
if (wide) { if (wide) {
@ -520,14 +520,14 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if (recurse) { if (recurse) {
DIRECTORY_STACK *dirStack = NULL; DIRECTORY_STACK *dirStack = NULL;
DIRECTORY_STACK *lastEntry = NULL; DIRECTORY_STACK *lastEntry = NULL;
WIN32_FIND_DATA finddata; WIN32_FIND_DATAW finddata;
/* Build path to search */ /* Build path to search */
strcpyW(string, inputparms->dirName); strcpyW(string, inputparms->dirName);
strcatW(string, starW); strcatW(string, starW);
WINE_TRACE("Recursive, looking for '%s'\n", wine_dbgstr_w(string)); WINE_TRACE("Recursive, looking for '%s'\n", wine_dbgstr_w(string));
hff = FindFirstFile (string, &finddata); hff = FindFirstFileW(string, &finddata);
if (hff != INVALID_HANDLE_VALUE) { if (hff != INVALID_HANDLE_VALUE) {
do { do {
if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
@ -563,7 +563,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
parms = parms->next; parms = parms->next;
} }
} }
} while (FindNextFile(hff, &finddata) != 0); } while (FindNextFileW(hff, &finddata) != 0);
FindClose (hff); FindClose (hff);
while (dirStack != NULL) { while (dirStack != NULL) {
@ -601,7 +601,7 @@ static void WCMD_dir_trailer(WCHAR drive) {
WCHAR driveName[4] = {'c',':','\\','\0'}; WCHAR driveName[4] = {'c',':','\\','\0'};
driveName[0] = drive; 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), WINE_TRACE("Writing trailer for '%s' gave %d(%d)\n", wine_dbgstr_w(driveName),
status, GetLastError()); status, GetLastError());
@ -654,7 +654,7 @@ void WCMD_directory (WCHAR *cmd) {
errorlevel = 0; errorlevel = 0;
/* Prefill quals with (uppercased) DIRCMD env var */ /* 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; p = string;
while ( (*p = toupper(*p)) ) ++p; while ( (*p = toupper(*p)) ) ++p;
strcatW(string,quals); strcatW(string,quals);
@ -833,7 +833,7 @@ void WCMD_directory (WCHAR *cmd) {
argno = 0; argno = 0;
argsProcessed = 0; argsProcessed = 0;
argN = cmd; argN = cmd;
GetCurrentDirectory (MAX_PATH, cwd); GetCurrentDirectoryW(MAX_PATH, cwd);
strcatW(cwd, slashW); strcatW(cwd, slashW);
/* Loop through all args, calculating full effective directory */ /* Loop through all args, calculating full effective directory */
@ -850,10 +850,10 @@ void WCMD_directory (WCHAR *cmd) {
} else if (thisArg[1] == ':' && thisArg[2] != '\\') { } else if (thisArg[1] == ':' && thisArg[2] != '\\') {
WCHAR envvar[4]; WCHAR envvar[4];
static const WCHAR envFmt[] = {'=','%','c',':','\0'}; static const WCHAR envFmt[] = {'=','%','c',':','\0'};
wsprintf(envvar, envFmt, thisArg[0]); wsprintfW(envvar, envFmt, thisArg[0]);
if (!GetEnvironmentVariable(envvar, fullname, MAX_PATH)) { if (!GetEnvironmentVariableW(envvar, fullname, MAX_PATH)) {
static const WCHAR noEnvFmt[] = {'%','c',':','\0'}; static const WCHAR noEnvFmt[] = {'%','c',':','\0'};
wsprintf(fullname, noEnvFmt, thisArg[0]); wsprintfW(fullname, noEnvFmt, thisArg[0]);
} }
strcatW(fullname, slashW); strcatW(fullname, slashW);
strcatW(fullname, &thisArg[2]); strcatW(fullname, &thisArg[2]);
@ -866,7 +866,7 @@ void WCMD_directory (WCHAR *cmd) {
} }
WINE_TRACE("Using location '%s'\n", wine_dbgstr_w(fullname)); 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 * 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. * directory not the directory file itself.
*/ */
if ((strchrW(path, '*') == NULL) && (strchrW(path, '%') == NULL)) { if ((strchrW(path, '*') == NULL) && (strchrW(path, '%') == NULL)) {
status = GetFileAttributes (path); status = GetFileAttributesW(path);
if ((status != INVALID_FILE_ATTRIBUTES) && (status & FILE_ATTRIBUTE_DIRECTORY)) { if ((status != INVALID_FILE_ATTRIBUTES) && (status & FILE_ATTRIBUTE_DIRECTORY)) {
if (path[strlenW(path)-1] == '\\') { if (path[strlenW(path)-1] == '\\') {
strcatW (path, starW); strcatW (path, starW);

View File

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