cmd: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Alexandre Julliard 2019-05-03 12:28:33 +02:00
parent 71e7e73fc0
commit 43c430a6d8
6 changed files with 403 additions and 404 deletions

View File

@ -1,7 +1,8 @@
MODULE = cmd.exe
APPMODE = -mconsole -municode
IMPORTS = shell32 user32 advapi32
EXTRADLLFLAGS = -mconsole -municode -mno-cygwin
C_SRCS = \
batch.c \
builtins.c \

View File

@ -76,7 +76,7 @@ void WCMD_batch (WCHAR *file, WCHAR *command, BOOL called, WCHAR *startLabel, HA
/* If processing a call :label, 'goto' the label in question */
if (startLabel) {
strcpyW(param1, startLabel);
lstrcpyW(param1, startLabel);
WCMD_goto(NULL);
}
@ -162,7 +162,7 @@ WCHAR *WCMD_parameter_with_delims (WCHAR *s, int n, WCHAR **start,
while (TRUE) {
/* Absorb repeated word delimiters until we get to the next token (or the end!) */
while (*p && (strchrW(delims, *p) != NULL))
while (*p && (wcschr(delims, *p) != NULL))
p++;
if (*p == '\0') return param;
@ -176,7 +176,7 @@ WCHAR *WCMD_parameter_with_delims (WCHAR *s, int n, WCHAR **start,
/* Loop character by character, but just need to special case quotes */
while (*p) {
/* Once we have found a delimiter, break */
if (strchrW(delims, *p) != NULL) break;
if (wcschr(delims, *p) != NULL) break;
/* Very odd special case - Seems as if a ( acts as a delimiter which is
not swallowed but is effective only when it comes between the program
@ -319,7 +319,7 @@ void WCMD_splitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHA
} else if (drv)
*drv = '\0';
end = path + strlenW(path);
end = path + lstrlenW(path);
/* search for begin of file extension */
for(p=end; p>path && *--p!='\\' && *p!='/'; )
@ -471,21 +471,21 @@ void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute)
whereas if you start applying other modifiers to it, you get the filename
the batch label is in */
if (*lastModifier == '0' && modifierLen > 1) {
strcpyW(outputparam, context->batchfileW);
lstrcpyW(outputparam, context->batchfileW);
} else if ((*lastModifier >= '0' && *lastModifier <= '9')) {
strcpyW(outputparam,
lstrcpyW(outputparam,
WCMD_parameter (context -> command,
*lastModifier-'0' + context -> shift_count[*lastModifier-'0'],
NULL, FALSE, TRUE));
} else {
int foridx = FOR_VAR_IDX(*lastModifier);
strcpyW(outputparam, forloopcontext.variable[foridx]);
lstrcpyW(outputparam, forloopcontext.variable[foridx]);
}
/* 1. Handle '~' : Strip surrounding quotes */
if (outputparam[0]=='"' &&
memchrW(firstModifier, '~', modifierLen) != NULL) {
int len = strlenW(outputparam);
wmemchr(firstModifier, '~', modifierLen) != NULL) {
int len = lstrlenW(outputparam);
if (outputparam[len-1] == '"') {
outputparam[len-1]=0x00;
len = len - 1;
@ -494,11 +494,11 @@ void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute)
}
/* 2. Handle the special case of a $ */
if (memchrW(firstModifier, '$', modifierLen) != NULL) {
if (wmemchr(firstModifier, '$', modifierLen) != NULL) {
/* Special Case: Search envar specified in $[envvar] for outputparam
Note both $ and : are guaranteed otherwise check above would fail */
WCHAR *begin = strchrW(firstModifier, '$') + 1;
WCHAR *end = strchrW(firstModifier, ':');
WCHAR *begin = wcschr(firstModifier, '$') + 1;
WCHAR *end = wcschr(firstModifier, ':');
WCHAR env[MAX_PATH];
DWORD size;
@ -535,13 +535,13 @@ void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute)
}
/* 2. Handle 'a' : Output attributes (File doesn't have to exist) */
if (memchrW(firstModifier, 'a', modifierLen) != NULL) {
if (wmemchr(firstModifier, 'a', modifierLen) != NULL) {
WCHAR defaults[] = {'-','-','-','-','-','-','-','-','-','\0'};
doneModifier = TRUE;
if (exists) {
strcpyW(thisoutput, defaults);
lstrcpyW(thisoutput, defaults);
if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
thisoutput[0]='d';
if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
@ -557,12 +557,12 @@ void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute)
/* FIXME: What are 6 and 7? */
if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
thisoutput[8]='l';
strcatW(finaloutput, thisoutput);
lstrcatW(finaloutput, thisoutput);
}
}
/* 3. Handle 't' : Date+time (File doesn't have to exist) */
if (memchrW(firstModifier, 't', modifierLen) != NULL) {
if (wmemchr(firstModifier, 't', modifierLen) != NULL) {
SYSTEMTIME systime;
int datelen;
@ -570,22 +570,22 @@ void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute)
doneModifier = TRUE;
if (exists) {
if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
/* Format the time */
FileTimeToSystemTime(&fileInfo.ftLastWriteTime, &systime);
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systime,
NULL, thisoutput, MAX_PATH);
strcatW(thisoutput, spaceW);
datelen = strlenW(thisoutput);
lstrcatW(thisoutput, spaceW);
datelen = lstrlenW(thisoutput);
GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &systime,
NULL, (thisoutput+datelen), MAX_PATH-datelen);
strcatW(finaloutput, thisoutput);
lstrcatW(finaloutput, thisoutput);
}
}
/* 4. Handle 'z' : File length (File doesn't have to exist) */
if (memchrW(firstModifier, 'z', modifierLen) != NULL) {
if (wmemchr(firstModifier, 'z', modifierLen) != NULL) {
/* FIXME: Output full 64 bit size (sprintf does not support I64 here) */
ULONG/*64*/ fullsize = /*(fileInfo.nFileSizeHigh << 32) +*/
fileInfo.nFileSizeLow;
@ -593,33 +593,33 @@ void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute)
doneModifier = TRUE;
if (exists) {
if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
wsprintfW(thisoutput, fmt, fullsize);
strcatW(finaloutput, thisoutput);
lstrcatW(finaloutput, thisoutput);
}
}
/* 4. Handle 's' : Use short paths (File doesn't have to exist) */
if (memchrW(firstModifier, 's', modifierLen) != NULL) {
if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);
if (wmemchr(firstModifier, 's', modifierLen) != NULL) {
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
/* Convert fullfilename's path to a short path - Save filename away as
only path is valid, name may not exist which causes GetShortPathName
to fail if it is provided */
if (filepart) {
strcpyW(thisoutput, filepart);
lstrcpyW(thisoutput, filepart);
*filepart = 0x00;
GetShortPathNameW(fullfilename, fullfilename, ARRAY_SIZE(fullfilename));
strcatW(fullfilename, thisoutput);
lstrcatW(fullfilename, thisoutput);
}
}
/* 5. Handle 'f' : Fully qualified path (File doesn't have to exist) */
/* Note this overrides d,p,n,x */
if (memchrW(firstModifier, 'f', modifierLen) != NULL) {
if (wmemchr(firstModifier, 'f', modifierLen) != NULL) {
doneModifier = TRUE;
if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);
strcatW(finaloutput, fullfilename);
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
lstrcatW(finaloutput, fullfilename);
} else {
WCHAR drive[10];
@ -633,65 +633,65 @@ void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute)
WCMD_splitpath(fullfilename, drive, dir, fname, ext);
/* 5. Handle 'd' : Drive Letter */
if (memchrW(firstModifier, 'd', modifierLen) != NULL) {
if (wmemchr(firstModifier, 'd', modifierLen) != NULL) {
if (addSpace) {
strcatW(finaloutput, spaceW);
lstrcatW(finaloutput, spaceW);
addSpace = FALSE;
}
strcatW(finaloutput, drive);
lstrcatW(finaloutput, drive);
doneModifier = TRUE;
doneFileModifier = TRUE;
}
/* 6. Handle 'p' : Path */
if (memchrW(firstModifier, 'p', modifierLen) != NULL) {
if (wmemchr(firstModifier, 'p', modifierLen) != NULL) {
if (addSpace) {
strcatW(finaloutput, spaceW);
lstrcatW(finaloutput, spaceW);
addSpace = FALSE;
}
strcatW(finaloutput, dir);
lstrcatW(finaloutput, dir);
doneModifier = TRUE;
doneFileModifier = TRUE;
}
/* 7. Handle 'n' : Name */
if (memchrW(firstModifier, 'n', modifierLen) != NULL) {
if (wmemchr(firstModifier, 'n', modifierLen) != NULL) {
if (addSpace) {
strcatW(finaloutput, spaceW);
lstrcatW(finaloutput, spaceW);
addSpace = FALSE;
}
strcatW(finaloutput, fname);
lstrcatW(finaloutput, fname);
doneModifier = TRUE;
doneFileModifier = TRUE;
}
/* 8. Handle 'x' : Ext */
if (memchrW(firstModifier, 'x', modifierLen) != NULL) {
if (wmemchr(firstModifier, 'x', modifierLen) != NULL) {
if (addSpace) {
strcatW(finaloutput, spaceW);
lstrcatW(finaloutput, spaceW);
addSpace = FALSE;
}
strcatW(finaloutput, ext);
lstrcatW(finaloutput, ext);
doneModifier = TRUE;
doneFileModifier = TRUE;
}
/* If 's' but no other parameter, dump the whole thing */
if (!doneFileModifier &&
memchrW(firstModifier, 's', modifierLen) != NULL) {
wmemchr(firstModifier, 's', modifierLen) != NULL) {
doneModifier = TRUE;
if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);
strcatW(finaloutput, fullfilename);
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
lstrcatW(finaloutput, fullfilename);
}
}
}
/* If No other modifier processed, just add in parameter */
if (!doneModifier) strcpyW(finaloutput, outputparam);
if (!doneModifier) lstrcpyW(finaloutput, outputparam);
/* Finish by inserting the replacement into the string */
WCMD_strsubstW(*start, lastModifier+1, finaloutput, -1);
@ -714,7 +714,7 @@ void WCMD_call (WCHAR *command) {
WCHAR gotoLabel[MAX_PATH];
strcpyW(gotoLabel, param1);
lstrcpyW(gotoLabel, param1);
if (context) {

File diff suppressed because it is too large Load Diff

View File

@ -59,7 +59,7 @@ static WCHAR * WCMD_strrev (WCHAR *buff) {
int r, i;
WCHAR b;
r = strlenW (buff);
r = lstrlenW (buff);
for (i=0; i<r/2; i++) {
b = buff[i];
buff[i] = buff[r-i-1];
@ -221,7 +221,7 @@ static void WCMD_getfileowner(WCHAR *filename, WCHAR *owner, int ownerlen) {
/* Convert to a username */
if (LookupAccountSidW(NULL, pSID, name, &nameLen, domain, &domainLen, &nameuse)) {
static const WCHAR fmt[] = {'%','s','%','c','%','s','\0'};
snprintfW(owner, ownerlen, fmt, domain, '\\', name);
swprintf(owner, ownerlen, fmt, domain, '\\', name);
}
heap_free(secBuffer);
}
@ -274,12 +274,12 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
mirrors what windows does */
parms = inputparms;
fd = heap_xalloc(sizeof(WIN32_FIND_DATAW));
while (parms && strcmpW(inputparms->dirName, parms->dirName) == 0) {
while (parms && lstrcmpW(inputparms->dirName, parms->dirName) == 0) {
concurrentDirs++;
/* Work out the full path + filename */
strcpyW(real_path, parms->dirName);
strcatW(real_path, parms->fileName);
lstrcpyW(real_path, parms->dirName);
lstrcatW(real_path, parms->fileName);
/* Load all files into an in memory structure */
WINE_TRACE("Looking for matches to '%s'\n", wine_dbgstr_w(real_path));
@ -293,7 +293,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* Keep running track of longest filename for wide output */
if (wide || orderByCol) {
int tmpLen = strlenW(fd[entry_count-1].cFileName) + 3;
int tmpLen = lstrlenW(fd[entry_count-1].cFileName) + 3;
if (fd[entry_count-1].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) tmpLen = tmpLen + 2;
if (tmpLen > widest) widest = tmpLen;
}
@ -310,8 +310,8 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
}
/* Work out the actual current directory name without a trailing \ */
strcpyW(real_path, parms->dirName);
real_path[strlenW(parms->dirName)-1] = 0x00;
lstrcpyW(real_path, parms->dirName);
real_path[lstrlenW(parms->dirName)-1] = 0x00;
/* Output the results */
if (!bare) {
@ -368,8 +368,8 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* /Q gets file ownership information */
if (usernames) {
strcpyW (string, inputparms->dirName);
strcatW (string, fd[i].cFileName);
lstrcpyW (string, inputparms->dirName);
lstrcatW (string, fd[i].cFileName);
WCMD_getfileowner(string, username, ARRAY_SIZE(username));
}
@ -391,11 +391,11 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
static const WCHAR fmt[] = {'[','%','1',']','\0'};
WCMD_output (fmt, fd[i].cFileName);
dir_count++;
tmp_width = tmp_width + strlenW(fd[i].cFileName) + 2;
tmp_width = tmp_width + lstrlenW(fd[i].cFileName) + 2;
} else {
static const WCHAR fmt[] = {'%','1','\0'};
WCMD_output (fmt, fd[i].cFileName);
tmp_width = tmp_width + strlenW(fd[i].cFileName) ;
tmp_width = tmp_width + lstrlenW(fd[i].cFileName) ;
file_count++;
file_size.u.LowPart = fd[i].nFileSizeLow;
file_size.u.HighPart = fd[i].nFileSizeHigh;
@ -419,8 +419,8 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if (usernames) WCMD_output (fmt3, username);
WCMD_output(fmt4,fd[i].cFileName);
} else {
if (!((strcmpW(fd[i].cFileName, dotW) == 0) ||
(strcmpW(fd[i].cFileName, dotdotW) == 0))) {
if (!((lstrcmpW(fd[i].cFileName, dotW) == 0) ||
(lstrcmpW(fd[i].cFileName, dotdotW) == 0))) {
WCMD_output (fmt5, recurse?inputparms->dirName:nullW, fd[i].cFileName);
} else {
addNewLine = FALSE;
@ -484,16 +484,16 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
WIN32_FIND_DATAW finddata;
/* Build path to search */
strcpyW(string, inputparms->dirName);
strcatW(string, starW);
lstrcpyW(string, inputparms->dirName);
lstrcatW(string, starW);
WINE_TRACE("Recursive, looking for '%s'\n", wine_dbgstr_w(string));
hff = FindFirstFileW(string, &finddata);
if (hff != INVALID_HANDLE_VALUE) {
do {
if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
(strcmpW(finddata.cFileName, dotdotW) != 0) &&
(strcmpW(finddata.cFileName, dotW) != 0)) {
(lstrcmpW(finddata.cFileName, dotdotW) != 0) &&
(lstrcmpW(finddata.cFileName, dotW) != 0)) {
DIRECTORY_STACK *thisDir;
int dirsToCopy = concurrentDirs;
@ -504,9 +504,9 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
dirsToCopy--;
/* Work out search parameter in sub dir */
strcpyW (string, inputparms->dirName);
strcatW (string, finddata.cFileName);
strcatW (string, slashW);
lstrcpyW (string, inputparms->dirName);
lstrcatW (string, finddata.cFileName);
lstrcatW (string, slashW);
WINE_TRACE("Recursive, Adding to search list '%s'\n", wine_dbgstr_w(string));
/* Allocate memory, add to list */
@ -613,8 +613,8 @@ void WCMD_directory (WCHAR *args)
if (GetEnvironmentVariableW(dircmdW, string, ARRAY_SIZE(string))) {
p = string;
while ( (*p = toupper(*p)) ) ++p;
strcatW(string,quals);
strcpyW(quals, string);
lstrcatW(string,quals);
lstrcpyW(quals, string);
}
byte_total = 0;
@ -789,7 +789,7 @@ void WCMD_directory (WCHAR *args)
argno = 0;
argN = args;
GetCurrentDirectoryW(MAX_PATH, cwd);
strcatW(cwd, slashW);
lstrcatW(cwd, slashW);
/* Loop through all args, calculating full effective directory */
fullParms = NULL;
@ -801,7 +801,7 @@ void WCMD_directory (WCHAR *args)
WINE_TRACE("Found parm '%s'\n", wine_dbgstr_w(thisArg));
if (thisArg[1] == ':' && thisArg[2] == '\\') {
strcpyW(fullname, thisArg);
lstrcpyW(fullname, thisArg);
} else if (thisArg[1] == ':' && thisArg[2] != '\\') {
WCHAR envvar[4];
static const WCHAR envFmt[] = {'=','%','c',':','\0'};
@ -810,14 +810,14 @@ void WCMD_directory (WCHAR *args)
static const WCHAR noEnvFmt[] = {'%','c',':','\0'};
wsprintfW(fullname, noEnvFmt, thisArg[0]);
}
strcatW(fullname, slashW);
strcatW(fullname, &thisArg[2]);
lstrcatW(fullname, slashW);
lstrcatW(fullname, &thisArg[2]);
} else if (thisArg[0] == '\\') {
memcpy(fullname, cwd, 2 * sizeof(WCHAR));
strcpyW(fullname+2, thisArg);
lstrcpyW(fullname+2, thisArg);
} else {
strcpyW(fullname, cwd);
strcatW(fullname, thisArg);
lstrcpyW(fullname, cwd);
lstrcatW(fullname, thisArg);
}
WINE_TRACE("Using location '%s'\n", wine_dbgstr_w(fullname));
@ -828,16 +828,16 @@ void WCMD_directory (WCHAR *args)
* path references a directory, we need to list the *contents* of that
* directory not the directory file itself.
*/
if ((strchrW(path, '*') == NULL) && (strchrW(path, '%') == NULL)) {
if ((wcschr(path, '*') == NULL) && (wcschr(path, '%') == NULL)) {
status = GetFileAttributesW(path);
if ((status != INVALID_FILE_ATTRIBUTES) && (status & FILE_ATTRIBUTE_DIRECTORY)) {
if (!ends_with_backslash( path )) strcatW( path, slashW );
strcatW (path, starW);
if (!ends_with_backslash( path )) lstrcatW( path, slashW );
lstrcatW (path, starW);
}
} else {
/* Special case wildcard search with no extension (ie parameters ending in '.') as
GetFullPathName strips off the additional '.' */
if (fullname[strlenW(fullname)-1] == '.') strcatW(path, dotW);
if (fullname[lstrlenW(fullname)-1] == '.') lstrcatW(path, dotW);
}
WINE_TRACE("Using path '%s'\n", wine_dbgstr_w(path));
@ -853,13 +853,13 @@ void WCMD_directory (WCHAR *args)
wine_dbgstr_w(drive), wine_dbgstr_w(dir),
wine_dbgstr_w(fname), wine_dbgstr_w(ext));
thisEntry->dirName = heap_xalloc(sizeof(WCHAR) * (strlenW(drive)+strlenW(dir)+1));
strcpyW(thisEntry->dirName, drive);
strcatW(thisEntry->dirName, dir);
thisEntry->dirName = heap_xalloc(sizeof(WCHAR) * (lstrlenW(drive)+lstrlenW(dir)+1));
lstrcpyW(thisEntry->dirName, drive);
lstrcatW(thisEntry->dirName, dir);
thisEntry->fileName = heap_xalloc(sizeof(WCHAR) * (strlenW(fname)+strlenW(ext)+1));
strcpyW(thisEntry->fileName, fname);
strcatW(thisEntry->fileName, ext);
thisEntry->fileName = heap_xalloc(sizeof(WCHAR) * (lstrlenW(fname)+lstrlenW(ext)+1));
lstrcpyW(thisEntry->fileName, fname);
lstrcatW(thisEntry->fileName, ext);
}
}

View File

@ -28,8 +28,8 @@
#include <stdarg.h>
#include <stdio.h>
#include <ctype.h>
#include <wchar.h>
#include <wine/heap.h>
#include <wine/unicode.h>
/* msdn specified max for Win XP */
#define MAXSTRING 8192
@ -137,7 +137,7 @@ static inline WCHAR *heap_strdupW(const WCHAR *str)
if(str) {
size_t size;
size = (strlenW(str)+1)*sizeof(WCHAR);
size = (lstrlenW(str)+1)*sizeof(WCHAR);
ret = heap_xalloc(size);
memcpy(ret, str, size);
}
@ -147,7 +147,7 @@ static inline WCHAR *heap_strdupW(const WCHAR *str)
static inline BOOL ends_with_backslash( const WCHAR *path )
{
return path[0] && path[strlenW(path) - 1] == '\\';
return path[0] && path[lstrlenW(path) - 1] == '\\';
}
/* Data structure to hold context when executing batch files */

View File

@ -25,7 +25,6 @@
* - Lots of functionality missing from builtins
*/
#include "config.h"
#include <time.h>
#include "wcmd.h"
#include "shellapi.h"
@ -271,7 +270,7 @@ static void WCMD_output_asis_handle (DWORD std_handle, const WCHAR *message) {
numChars = 0;
if (++line_count >= max_height - 1) {
line_count = 0;
WCMD_output_asis_len(pagedMessage, strlenW(pagedMessage), handle);
WCMD_output_asis_len(pagedMessage, lstrlenW(pagedMessage), handle);
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), string, ARRAY_SIZE(string), &count);
}
} while (((message = ptr) != NULL) && (*ptr));
@ -346,7 +345,7 @@ static void WCMD_show_prompt (BOOL newLine) {
len = GetEnvironmentVariableW(envPrompt, prompt_string, ARRAY_SIZE(prompt_string));
if ((len == 0) || (len >= ARRAY_SIZE(prompt_string))) {
static const WCHAR dfltPrompt[] = {'$','P','$','G','\0'};
strcpyW (prompt_string, dfltPrompt);
lstrcpyW (prompt_string, dfltPrompt);
}
p = prompt_string;
q = out_string;
@ -403,7 +402,7 @@ static void WCMD_show_prompt (BOOL newLine) {
case 'P':
status = GetCurrentDirectoryW(ARRAY_SIZE(curdir), curdir);
if (status) {
strcatW (q, curdir);
lstrcatW (q, curdir);
while (*q) q++;
}
break;
@ -418,7 +417,7 @@ static void WCMD_show_prompt (BOOL newLine) {
while (*q) q++;
break;
case 'V':
strcatW (q, version_string);
lstrcatW (q, version_string);
while (*q) q++;
break;
case '_':
@ -462,7 +461,7 @@ void WCMD_strsubstW(WCHAR *start, const WCHAR *next, const WCHAR *insert, int le
if (len < 0)
len=insert ? lstrlenW(insert) : 0;
if (start+len != next)
memmove(start+len, next, (strlenW(next) + 1) * sizeof(*next));
memmove(start+len, next, (lstrlenW(next) + 1) * sizeof(*next));
if (insert)
memcpy(start, insert, len * sizeof(*insert));
}
@ -529,7 +528,7 @@ static inline BOOL WCMD_is_magic_envvar(const WCHAR *s, const WCHAR *magicvar)
if (s[0] != '%')
return FALSE; /* Didn't begin with % */
len = strlenW(s);
len = lstrlenW(s);
if (len < 2 || s[len-1] != '%')
return FALSE; /* Didn't end with another % */
@ -573,7 +572,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar)
/* Find the end of the environment variable, and extract name */
Delims[0] = startchar;
endOfVar = strpbrkW(start+1, Delims);
endOfVar = wcspbrk(start+1, Delims);
if (endOfVar == NULL || *endOfVar==' ') {
@ -593,13 +592,13 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar)
/* If ':' found, process remaining up until '%' (or stop at ':' if
a missing '%' */
if (*endOfVar==':') {
WCHAR *endOfVar2 = strchrW(endOfVar+1, startchar);
WCHAR *endOfVar2 = wcschr(endOfVar+1, startchar);
if (endOfVar2 != NULL) endOfVar = endOfVar2;
}
memcpy(thisVar, start, ((endOfVar - start) + 1) * sizeof(WCHAR));
thisVar[(endOfVar - start)+1] = 0x00;
colonpos = strchrW(thisVar+1, ':');
colonpos = wcschr(thisVar+1, ':');
/* If there's complex substitution, just need %var% for now
to get the expanded data to play with */
@ -624,22 +623,22 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar)
if (WCMD_is_magic_envvar(thisVar, ErrorLvl)) {
static const WCHAR fmt[] = {'%','d','\0'};
wsprintfW(thisVarContents, fmt, errorlevel);
len = strlenW(thisVarContents);
len = lstrlenW(thisVarContents);
} else if (WCMD_is_magic_envvar(thisVar, Date)) {
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL,
NULL, thisVarContents, MAXSTRING);
len = strlenW(thisVarContents);
len = lstrlenW(thisVarContents);
} else if (WCMD_is_magic_envvar(thisVar, Time)) {
GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL,
NULL, thisVarContents, MAXSTRING);
len = strlenW(thisVarContents);
len = lstrlenW(thisVarContents);
} else if (WCMD_is_magic_envvar(thisVar, Cd)) {
GetCurrentDirectoryW(MAXSTRING, thisVarContents);
len = strlenW(thisVarContents);
len = lstrlenW(thisVarContents);
} else if (WCMD_is_magic_envvar(thisVar, Random)) {
static const WCHAR fmt[] = {'%','d','\0'};
wsprintfW(thisVarContents, fmt, rand() % 32768);
len = strlenW(thisVarContents);
len = lstrlenW(thisVarContents);
} else {
len = ExpandEnvironmentStringsW(thisVar, thisVarContents, ARRAY_SIZE(thisVarContents));
@ -668,7 +667,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar)
if (colonpos == NULL) {
WCMD_strsubstW(start, endOfVar + 1, NULL, 0);
} else {
len = strlenW(thisVar);
len = lstrlenW(thisVar);
thisVar[len-1] = 0x00;
/* If %:...% supplied, : is retained */
if (colonpos == thisVar+1) {
@ -706,11 +705,11 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar)
if (savedchar == '~') {
int substrposition, substrlength = 0;
WCHAR *commapos = strchrW(colonpos+2, ',');
WCHAR *commapos = wcschr(colonpos+2, ',');
WCHAR *startCopy;
substrposition = atolW(colonpos+2);
if (commapos) substrlength = atolW(commapos+1);
substrposition = wcstol(colonpos+2, NULL, 10);
if (commapos) substrlength = wcstol(commapos+1, NULL, 10);
/* Check bounds */
if (substrposition >= 0) {
@ -735,7 +734,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar)
/* search and replace manipulation */
} else {
WCHAR *equalspos = strstrW(colonpos, equalW);
WCHAR *equalspos = wcsstr(colonpos, equalW);
WCHAR *replacewith = equalspos+1;
WCHAR *found = NULL;
WCHAR *searchIn;
@ -745,29 +744,29 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar)
s = heap_strdupW(endOfVar + 1);
/* Null terminate both strings */
thisVar[strlenW(thisVar)-1] = 0x00;
thisVar[lstrlenW(thisVar)-1] = 0x00;
*equalspos = 0x00;
/* Since we need to be case insensitive, copy the 2 buffers */
searchIn = heap_strdupW(thisVarContents);
CharUpperBuffW(searchIn, strlenW(thisVarContents));
CharUpperBuffW(searchIn, lstrlenW(thisVarContents));
searchFor = heap_strdupW(colonpos+1);
CharUpperBuffW(searchFor, strlenW(colonpos+1));
CharUpperBuffW(searchFor, lstrlenW(colonpos+1));
/* Handle wildcard case */
if (*(colonpos+1) == '*') {
/* Search for string to replace */
found = strstrW(searchIn, searchFor+1);
found = wcsstr(searchIn, searchFor+1);
if (found) {
/* Do replacement */
strcpyW(start, replacewith);
strcatW(start, thisVarContents + (found-searchIn) + strlenW(searchFor+1));
strcatW(start, s);
lstrcpyW(start, replacewith);
lstrcatW(start, thisVarContents + (found-searchIn) + lstrlenW(searchFor+1));
lstrcatW(start, s);
} else {
/* Copy as is */
strcpyW(start, thisVarContents);
strcatW(start, s);
lstrcpyW(start, thisVarContents);
lstrcatW(start, s);
}
} else {
@ -776,18 +775,18 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar)
WCHAR *outputposn = start;
*start = 0x00;
while ((found = strstrW(lastFound, searchFor))) {
while ((found = wcsstr(lastFound, searchFor))) {
lstrcpynW(outputposn,
thisVarContents + (lastFound-searchIn),
(found - lastFound)+1);
outputposn = outputposn + (found - lastFound);
strcatW(outputposn, replacewith);
outputposn = outputposn + strlenW(replacewith);
lastFound = found + strlenW(searchFor);
lstrcatW(outputposn, replacewith);
outputposn = outputposn + lstrlenW(replacewith);
lastFound = found + lstrlenW(searchFor);
}
strcatW(outputposn,
lstrcatW(outputposn,
thisVarContents + (lastFound-searchIn));
strcatW(outputposn, s);
lstrcatW(outputposn, s);
}
heap_free(s);
heap_free(searchIn);
@ -832,8 +831,8 @@ static void handleExpansion(WCHAR *cmd, BOOL atExecute, BOOL delayed) {
}
/* Find the next environment variable delimiter */
normalp = strchrW(p, '%');
if (delayed) delayedp = strchrW(p, '!');
normalp = wcschr(p, '%');
if (delayed) delayedp = wcschr(p, '!');
if (!normalp) p = delayedp;
else if (!delayedp) p = normalp;
else p = min(p,delayedp);
@ -868,7 +867,7 @@ static void handleExpansion(WCHAR *cmd, BOOL atExecute, BOOL delayed) {
WCHAR *startOfParms = NULL;
WCHAR *thisParm = WCMD_parameter(context -> command, 0, &startOfParms, TRUE, TRUE);
if (startOfParms != NULL) {
startOfParms += strlenW(thisParm);
startOfParms += lstrlenW(thisParm);
while (*startOfParms==' ' || *startOfParms == '\t') startOfParms++;
WCMD_strsubstW(p, p+2, startOfParms, -1);
} else
@ -889,8 +888,8 @@ static void handleExpansion(WCHAR *cmd, BOOL atExecute, BOOL delayed) {
}
/* Find the next environment variable delimiter */
normalp = strchrW(p, '%');
if (delayed) delayedp = strchrW(p, '!');
normalp = wcschr(p, '%');
if (delayed) delayedp = wcschr(p, '!');
if (!normalp) p = delayedp;
else if (!delayedp) p = normalp;
else p = min(p,delayedp);
@ -919,7 +918,7 @@ static void WCMD_parse (const WCHAR *s, WCHAR *q, WCHAR *p1, WCHAR *p2)
case '/':
*q++ = *s++;
while ((*s != '\0') && (*s != ' ') && *s != '/') {
*q++ = toupperW (*s++);
*q++ = towupper (*s++);
}
*q = '\0';
break;
@ -1057,30 +1056,30 @@ void WCMD_run_program (WCHAR *command, BOOL called)
if (!firstParam) return;
/* Calculate the search path and stem to search for */
if (strpbrkW (firstParam, delims) == NULL) { /* No explicit path given, search path */
if (wcspbrk (firstParam, delims) == NULL) { /* No explicit path given, search path */
static const WCHAR curDir[] = {'.',';','\0'};
strcpyW(pathtosearch, curDir);
lstrcpyW(pathtosearch, curDir);
len = GetEnvironmentVariableW(envPath, &pathtosearch[2], ARRAY_SIZE(pathtosearch)-2);
if ((len == 0) || (len >= ARRAY_SIZE(pathtosearch) - 2)) {
static const WCHAR curDir[] = {'.','\0'};
strcpyW (pathtosearch, curDir);
lstrcpyW (pathtosearch, curDir);
}
if (strchrW(firstParam, '.') != NULL) extensionsupplied = TRUE;
if (strlenW(firstParam) >= MAX_PATH)
if (wcschr(firstParam, '.') != NULL) extensionsupplied = TRUE;
if (lstrlenW(firstParam) >= MAX_PATH)
{
WCMD_output_asis_stderr(WCMD_LoadMessage(WCMD_LINETOOLONG));
return;
}
strcpyW(stemofsearch, firstParam);
lstrcpyW(stemofsearch, firstParam);
} else {
/* Convert eg. ..\fred to include a directory by removing file part */
GetFullPathNameW(firstParam, ARRAY_SIZE(pathtosearch), pathtosearch, NULL);
lastSlash = strrchrW(pathtosearch, '\\');
if (lastSlash && strchrW(lastSlash, '.') != NULL) extensionsupplied = TRUE;
strcpyW(stemofsearch, lastSlash+1);
lastSlash = wcsrchr(pathtosearch, '\\');
if (lastSlash && wcschr(lastSlash, '.') != NULL) extensionsupplied = TRUE;
lstrcpyW(stemofsearch, lastSlash+1);
/* Reduce pathtosearch to a path with trailing '\' to support c:\a.bat and
c:\windows\a.bat syntax */
@ -1090,7 +1089,7 @@ void WCMD_run_program (WCHAR *command, BOOL called)
/* Now extract PATHEXT */
len = GetEnvironmentVariableW(envPathExt, pathext, ARRAY_SIZE(pathext));
if ((len == 0) || (len >= ARRAY_SIZE(pathext))) {
strcpyW (pathext, dfltPathExt);
lstrcpyW (pathext, dfltPathExt);
}
/* Loop through the search path, dir by dir */
@ -1118,28 +1117,28 @@ void WCMD_run_program (WCHAR *command, BOOL called)
thisDir[(pos-pathposn)] = 0x00;
pathposn = pos+1;
} else { /* Reached string end */
strcpyW(thisDir, pathposn);
lstrcpyW(thisDir, pathposn);
pathposn = NULL;
}
/* Remove quotes */
length = strlenW(thisDir);
length = lstrlenW(thisDir);
if (thisDir[length - 1] == '"')
thisDir[length - 1] = 0;
if (*thisDir != '"')
strcpyW(temp, thisDir);
lstrcpyW(temp, thisDir);
else
strcpyW(temp, thisDir + 1);
lstrcpyW(temp, thisDir + 1);
/* Since you can have eg. ..\.. on the path, need to expand
to full information */
GetFullPathNameW(temp, MAX_PATH, thisDir, NULL);
/* 1. If extension supplied, see if that file exists */
strcatW(thisDir, slashW);
strcatW(thisDir, stemofsearch);
pos = &thisDir[strlenW(thisDir)]; /* Pos = end of name */
lstrcatW(thisDir, slashW);
lstrcatW(thisDir, stemofsearch);
pos = &thisDir[lstrlenW(thisDir)]; /* Pos = end of name */
/* 1. If extension supplied, see if that file exists */
if (extensionsupplied) {
@ -1154,7 +1153,7 @@ void WCMD_run_program (WCHAR *command, BOOL called)
WIN32_FIND_DATAW finddata;
static const WCHAR allFiles[] = {'.','*','\0'};
strcatW(thisDir,allFiles);
lstrcatW(thisDir,allFiles);
h = FindFirstFileW(thisDir, &finddata);
FindClose(h);
if (h != INVALID_HANDLE_VALUE) {
@ -1163,14 +1162,14 @@ void WCMD_run_program (WCHAR *command, BOOL called)
/* 3. Yes - Try each path ext */
while (thisExt) {
WCHAR *nextExt = strchrW(thisExt, ';');
WCHAR *nextExt = wcschr(thisExt, ';');
if (nextExt) {
memcpy(pos, thisExt, (nextExt-thisExt) * sizeof(WCHAR));
pos[(nextExt-thisExt)] = 0x00;
thisExt = nextExt+1;
} else {
strcpyW(pos, thisExt);
lstrcpyW(pos, thisExt);
thisExt = NULL;
}
@ -1189,14 +1188,14 @@ void WCMD_run_program (WCHAR *command, BOOL called)
SHFILEINFOW psfi;
DWORD console;
HINSTANCE hinst;
WCHAR *ext = strrchrW( thisDir, '.' );
WCHAR *ext = wcsrchr( thisDir, '.' );
static const WCHAR batExt[] = {'.','b','a','t','\0'};
static const WCHAR cmdExt[] = {'.','c','m','d','\0'};
WINE_TRACE("Found as %s\n", wine_dbgstr_w(thisDir));
/* Special case BAT and CMD */
if (ext && (!strcmpiW(ext, batExt) || !strcmpiW(ext, cmdExt))) {
if (ext && (!wcsicmp(ext, batExt) || !wcsicmp(ext, cmdExt))) {
BOOL oldinteractive = interactive;
interactive = FALSE;
WCMD_batch (thisDir, command, called, NULL, INVALID_HANDLE_VALUE);
@ -1301,7 +1300,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
/* Move copy of the command onto the heap so it can be expanded */
new_cmd = heap_xalloc(MAXSTRING * sizeof(WCHAR));
strcpyW(new_cmd, command);
lstrcpyW(new_cmd, command);
cmd = new_cmd;
/* Move copy of the redirects onto the heap so it can be expanded */
@ -1357,7 +1356,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
wsprintfW (new_redir, redirOut, redirects, (*cmdList)->nextcommand->pipeFile);
WINE_TRACE("Redirects now %s\n", wine_dbgstr_w(new_redir));
} else {
strcpyW(new_redir, redirects);
lstrcpyW(new_redir, redirects);
}
/* Expand variables in command line mode only (batch mode will
@ -1381,8 +1380,8 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
/* According to MSDN CreateProcess docs, special env vars record
the current directory on each drive, in the form =C:
so see if one specified, and if so go back to it */
strcpyW(envvar, equalW);
strcatW(envvar, cmd);
lstrcpyW(envvar, equalW);
lstrcatW(envvar, cmd);
if (GetEnvironmentVariableW(envvar, dir, MAX_PATH) == 0) {
static const WCHAR fmt[] = {'%','s','\\','\0'};
wsprintfW(cmd, fmt, cmd);
@ -1424,7 +1423,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
(*cmdList)->pipeFile[0] = 0x00;
/* Otherwise STDIN could come from a '<' redirect */
} else if ((pos = strchrW(new_redir,'<')) != NULL) {
} else if ((pos = wcschr(new_redir,'<')) != NULL) {
h = CreateFileW(WCMD_parameter(++pos, 0, NULL, FALSE, FALSE), GENERIC_READ, FILE_SHARE_READ,
&sa, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) {
@ -1437,7 +1436,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
}
/* Scan the whole command looking for > and 2> */
while (redir != NULL && ((pos = strchrW(redir,'>')) != NULL)) {
while (redir != NULL && ((pos = wcschr(redir,'>')) != NULL)) {
int handle = 0;
if (pos > redir && (*(pos-1)=='2'))
@ -1586,7 +1585,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
WCMD_setshow_time ();
break;
case WCMD_TITLE:
if (strlenW(&whichcmd[count]) > 0)
if (lstrlenW(&whichcmd[count]) > 0)
WCMD_title(&whichcmd[count+1]);
break;
case WCMD_TYPE:
@ -1668,7 +1667,7 @@ WCHAR *WCMD_LoadMessage(UINT id) {
if (!LoadStringW(GetModuleHandleW(NULL), id, msg, ARRAY_SIZE(msg))) {
WINE_FIXME("LoadString failed with %d\n", GetLastError());
strcpyW(msg, failedMsg);
lstrcpyW(msg, failedMsg);
}
return msg;
}
@ -1858,7 +1857,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
/* If initial command read in, use that, otherwise get input from handle */
if (optionalcmd != NULL) {
strcpyW(extraSpace, optionalcmd);
lstrcpyW(extraSpace, optionalcmd);
} else if (readFrom == INVALID_HANDLE_VALUE) {
WINE_FIXME("No command nor handle supplied\n");
} else {
@ -1868,7 +1867,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
curPos = extraSpace;
/* Handle truncated input - issue warning */
if (strlenW(extraSpace) == MAXSTRING -1) {
if (lstrlenW(extraSpace) == MAXSTRING -1) {
WCMD_output_asis_stderr(WCMD_LoadMessage(WCMD_TRUNCATEDLINE));
WCMD_output_asis_stderr(extraSpace);
WCMD_output_asis_stderr(newlineW);
@ -1886,7 +1885,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
static const WCHAR echoCol[] = {'e','c','h','o',':'};
static const WCHAR echoSlash[] = {'e','c','h','o','/'};
const DWORD len = ARRAY_SIZE(echoDot);
DWORD curr_size = strlenW(curPos);
DWORD curr_size = lstrlenW(curPos);
DWORD min_len = (curr_size < len ? curr_size : len);
WCMD_show_prompt(TRUE);
WCMD_output_asis(curPos);
@ -2422,7 +2421,7 @@ int wmain (int argc, WCHAR *argvW[])
if (!GetEnvironmentVariableW(comspecW, comspec, ARRAY_SIZE(comspec)))
{
GetSystemDirectoryW(comspec, ARRAY_SIZE(comspec) - ARRAY_SIZE(cmdW));
strcatW(comspec, cmdW);
lstrcatW(comspec, cmdW);
SetEnvironmentVariableW(comspecW, comspec);
}
@ -2433,11 +2432,10 @@ int wmain (int argc, WCHAR *argvW[])
GetVersionExW(&osv);
/* Pre initialize some messages */
strcpyW(anykey, WCMD_LoadMessage(WCMD_ANYKEY));
sprintf(osver, "%d.%d.%d (%s)", osv.dwMajorVersion, osv.dwMinorVersion,
osv.dwBuildNumber, PACKAGE_VERSION);
lstrcpyW(anykey, WCMD_LoadMessage(WCMD_ANYKEY));
sprintf(osver, "%d.%d.%d", osv.dwMajorVersion, osv.dwMinorVersion, osv.dwBuildNumber);
cmd = WCMD_format_string(WCMD_LoadMessage(WCMD_VERSION), osver);
strcpyW(version_string, cmd);
lstrcpyW(version_string, cmd);
LocalFree(cmd);
cmd = NULL;
@ -2461,29 +2459,29 @@ int wmain (int argc, WCHAR *argvW[])
}
c=argPos[1];
if (tolowerW(c)=='c') {
if (towlower(c)=='c') {
opt_c = TRUE;
} else if (tolowerW(c)=='q') {
} else if (towlower(c)=='q') {
opt_q = TRUE;
} else if (tolowerW(c)=='k') {
} else if (towlower(c)=='k') {
opt_k = TRUE;
} else if (tolowerW(c)=='s') {
} else if (towlower(c)=='s') {
opt_s = TRUE;
} else if (tolowerW(c)=='a') {
} else if (towlower(c)=='a') {
unicodeOutput = FALSE;
} else if (tolowerW(c)=='u') {
} else if (towlower(c)=='u') {
unicodeOutput = TRUE;
} else if (tolowerW(c)=='v' && argPos[2]==':') {
delayedsubst = strncmpiW(&argPos[3], offW, 3);
} else if (towlower(c)=='v' && argPos[2]==':') {
delayedsubst = wcsnicmp(&argPos[3], offW, 3);
if (delayedsubst) WINE_TRACE("Delayed substitution is on\n");
} else if (tolowerW(c)=='t' && argPos[2]==':') {
opt_t=strtoulW(&argPos[3], NULL, 16);
} else if (tolowerW(c)=='x' || tolowerW(c)=='y') {
} else if (towlower(c)=='t' && argPos[2]==':') {
opt_t=wcstoul(&argPos[3], NULL, 16);
} else if (towlower(c)=='x' || towlower(c)=='y') {
/* Ignored for compatibility with Windows */
}
if (argPos[2]==0 || argPos[2]==' ' || argPos[2]=='\t' ||
tolowerW(c)=='v') {
towlower(c)=='v') {
args++;
WCMD_parameter(cmdLine, args, &argPos, TRUE, TRUE);
}
@ -2524,19 +2522,19 @@ int wmain (int argc, WCHAR *argvW[])
if (!opt_s) {
/* 1. Confirm there is at least one quote */
q1 = strchrW(argPos, '"');
q1 = wcschr(argPos, '"');
if (!q1) opt_s=1;
}
if (!opt_s) {
/* 2. Confirm there is a second quote */
q2 = strchrW(q1+1, '"');
q2 = wcschr(q1+1, '"');
if (!q2) opt_s=1;
}
if (!opt_s) {
/* 3. Ensure there are no more quotes */
if (strchrW(q2+1, '"')) opt_s=1;
if (wcschr(q2+1, '"')) opt_s=1;
}
/* check first parameter for a space and invalid characters. There must not be any
@ -2568,16 +2566,16 @@ int wmain (int argc, WCHAR *argvW[])
/* Now extract PATHEXT */
len = GetEnvironmentVariableW(envPathExt, pathext, ARRAY_SIZE(pathext));
if ((len == 0) || (len >= ARRAY_SIZE(pathext))) {
strcpyW (pathext, dfltPathExt);
lstrcpyW (pathext, dfltPathExt);
}
/* If the supplied parameter has any directory information, look there */
WINE_TRACE("First parameter is '%s'\n", wine_dbgstr_w(thisArg));
if (strchrW(thisArg, '\\') != NULL) {
if (wcschr(thisArg, '\\') != NULL) {
GetFullPathNameW(thisArg, ARRAY_SIZE(string), string, NULL);
WINE_TRACE("Full path name '%s'\n", wine_dbgstr_w(string));
p = string + strlenW(string);
p = string + lstrlenW(string);
/* Does file exist with this name? */
if (GetFileAttributesW(string) != INVALID_FILE_ATTRIBUTES) {
@ -2588,14 +2586,14 @@ int wmain (int argc, WCHAR *argvW[])
/* No - try with each of the PATHEXT extensions */
while (!found && thisExt) {
WCHAR *nextExt = strchrW(thisExt, ';');
WCHAR *nextExt = wcschr(thisExt, ';');
if (nextExt) {
memcpy(p, thisExt, (nextExt-thisExt) * sizeof(WCHAR));
p[(nextExt-thisExt)] = 0x00;
thisExt = nextExt+1;
} else {
strcpyW(p, thisExt);
lstrcpyW(p, thisExt);
thisExt = NULL;
}
@ -2618,7 +2616,7 @@ int wmain (int argc, WCHAR *argvW[])
/* No - try with each of the PATHEXT extensions */
while (!found && thisExt) {
WCHAR *nextExt = strchrW(thisExt, ';');
WCHAR *nextExt = wcschr(thisExt, ';');
if (nextExt) {
*nextExt = 0;
@ -2716,7 +2714,7 @@ int wmain (int argc, WCHAR *argvW[])
size = ARRAY_SIZE(strvalue);
RegQueryValueExW(key, dfltColorW, NULL, NULL,
(LPBYTE)strvalue, &size);
value = strtoulW(strvalue, NULL, 10);
value = wcstoul(strvalue, NULL, 10);
}
}
RegCloseKey(key);
@ -2737,7 +2735,7 @@ int wmain (int argc, WCHAR *argvW[])
size = ARRAY_SIZE(strvalue);
RegQueryValueExW(key, dfltColorW, NULL, NULL,
(LPBYTE)strvalue, &size);
value = strtoulW(strvalue, NULL, 10);
value = wcstoul(strvalue, NULL, 10);
}
}
RegCloseKey(key);