38 static const char escaped_space[] = {
'@',
's',
'p',
'a',
'c',
'e',
'@'};
39 static const char escaped_tab[] = {
'@',
't',
'a',
'b',
'@'};
44 if (
data[
i] ==
'\n') eol_count++;
51 if (
data[
i-1] !=
'\r')
57 && !
memcmp(
data +
i, escaped_space,
sizeof(escaped_space))) {
59 i +=
sizeof(escaped_space) - 1;
61 && !
memcmp(
data +
i, escaped_tab,
sizeof(escaped_tab))) {
63 i +=
sizeof(escaped_tab) - 1;
77 *new_size =
strlen(new_data);
162static const char *
compare_line(
const char *out_line,
const char *out_end,
const char *exp_line,
165 const char *out_ptr = out_line, *exp_ptr = exp_line;
168 static const char pwd_cmd[] = {
'@',
'p',
'w',
'd',
'@'};
169 static const char drive_cmd[] = {
'@',
'd',
'r',
'i',
'v',
'e',
'@'};
170 static const char path_cmd[] = {
'@',
'p',
'a',
't',
'h',
'@'};
171 static const char shortpath_cmd[] = {
'@',
's',
'h',
'o',
'r',
't',
'p',
'a',
't',
'h',
'@'};
172 static const char space_cmd[] = {
'@',
's',
'p',
'a',
'c',
'e',
'@'};
173 static const char spaces_cmd[] = {
'@',
's',
'p',
'a',
'c',
'e',
's',
'@'};
174 static const char tab_cmd[] = {
'@',
't',
'a',
'b',
'@'};
175 static const char or_broken_cmd[] = {
'@',
'o',
'r',
'_',
'b',
'r',
'o',
'k',
'e',
'n',
'@'};
177 while(exp_ptr < exp_end) {
178 if(*exp_ptr ==
'@') {
179 if(exp_ptr+
sizeof(pwd_cmd) <= exp_end
180 && !
memcmp(exp_ptr, pwd_cmd,
sizeof(pwd_cmd))) {
181 exp_ptr +=
sizeof(pwd_cmd);
190 }
else if(exp_ptr+
sizeof(drive_cmd) <= exp_end
191 && !
memcmp(exp_ptr, drive_cmd,
sizeof(drive_cmd))) {
192 exp_ptr +=
sizeof(drive_cmd);
201 }
else if(exp_ptr+
sizeof(path_cmd) <= exp_end
202 && !
memcmp(exp_ptr, path_cmd,
sizeof(path_cmd))) {
203 exp_ptr +=
sizeof(path_cmd);
212 }
else if(exp_ptr+
sizeof(shortpath_cmd) <= exp_end
213 && !
memcmp(exp_ptr, shortpath_cmd,
sizeof(shortpath_cmd))) {
214 exp_ptr +=
sizeof(shortpath_cmd);
223 }
else if(exp_ptr+
sizeof(space_cmd) <= exp_end
224 && !
memcmp(exp_ptr, space_cmd,
sizeof(space_cmd))) {
225 exp_ptr +=
sizeof(space_cmd);
226 if(out_ptr < out_end && *out_ptr ==
' ') {
232 }
else if(exp_ptr+
sizeof(spaces_cmd) <= exp_end
233 && !
memcmp(exp_ptr, spaces_cmd,
sizeof(spaces_cmd))) {
234 exp_ptr +=
sizeof(spaces_cmd);
235 if(out_ptr < out_end && *out_ptr ==
' ') {
236 while (out_ptr < out_end && *out_ptr ==
' ') out_ptr++;
241 }
else if(exp_ptr+
sizeof(tab_cmd) <= exp_end
242 && !
memcmp(exp_ptr, tab_cmd,
sizeof(tab_cmd))) {
243 exp_ptr +=
sizeof(tab_cmd);
244 if(out_ptr < out_end && *out_ptr ==
'\t') {
250 }
else if(exp_ptr+
sizeof(or_broken_cmd) <= exp_end
251 && !
memcmp(exp_ptr, or_broken_cmd,
sizeof(or_broken_cmd))) {
252 if(out_ptr == out_end)
256 }
else if(out_ptr == out_end || *out_ptr != *exp_ptr)
258 }
else if(out_ptr == out_end || *out_ptr != *exp_ptr) {
266 while(exp_ptr+
sizeof(or_broken_cmd) <= exp_end &&
memcmp(exp_ptr, or_broken_cmd,
sizeof(or_broken_cmd)))
268 exp_ptr +=
sizeof(or_broken_cmd);
269 if (exp_ptr > exp_end)
return err;
279 if(exp_ptr != exp_end)
281 else if(out_ptr != out_end)
289 const char *out_ptr = out_data, *exp_ptr =
exp_data, *out_nl, *exp_nl, *
err =
NULL;
291 static const char todo_wine_cmd[] = {
'@',
't',
'o',
'd',
'o',
'_',
'w',
'i',
'n',
'e',
'@'};
292 static const char resync_cmd[] = {
'-',
'-',
'-'};
298 for(exp_nl = exp_ptr; exp_nl <
exp_data+exp_size && *exp_nl !=
'\r' && *exp_nl !=
'\n'; exp_nl++);
299 for(out_nl = out_ptr; out_nl < out_data+
out_size && *out_nl !=
'\r' && *out_nl !=
'\n'; out_nl++);
301 is_todo_wine = (exp_ptr+
sizeof(todo_wine_cmd) <= exp_nl &&
302 !
memcmp(exp_ptr, todo_wine_cmd,
sizeof(todo_wine_cmd)));
304 exp_ptr +=
sizeof(todo_wine_cmd);
308 is_exp_resync=(exp_ptr+
sizeof(resync_cmd) <= exp_nl &&
309 !
memcmp(exp_ptr, resync_cmd,
sizeof(resync_cmd)));
310 is_out_resync=(out_ptr+
sizeof(resync_cmd) <= out_nl &&
311 !
memcmp(out_ptr, resync_cmd,
sizeof(resync_cmd)));
315 ok(0,
"unexpected end of line %d (got '%.*s', wanted '%.*s')\n",
316 line, (
int)(out_nl-out_ptr), out_ptr, (
int)(exp_nl-exp_ptr), exp_ptr);
317 else if(
err == exp_nl)
318 ok(0,
"excess characters on line %d (got '%.*s', wanted '%.*s')\n",
319 line, (
int)(out_nl-out_ptr), out_ptr, (
int)(exp_nl-exp_ptr), exp_ptr);
320 else if (!
err && is_todo_wine && is_out_resync && is_exp_resync)
326 ok(!
err,
"unexpected char 0x%x position %d in line %d (got '%.*s', wanted '%.*s')\n",
327 (
err ? *
err : 0), (
err ? (
int)(
err-out_ptr) : -1),
line, (
int)(out_nl-out_ptr), out_ptr, (
int)(exp_nl-exp_ptr), exp_ptr);
330 if (is_exp_resync &&
err && is_todo_wine)
332 exp_ptr -=
sizeof(todo_wine_cmd);
336 else if (!is_exp_resync || !
err ||
337 (is_exp_resync && is_out_resync &&
err))
340 if(exp_nl+1 <
exp_data+exp_size && exp_nl[0] ==
'\r' && exp_nl[1] ==
'\n')
344 if (!is_out_resync || !
err)
347 if(out_nl+1 < out_data+
out_size && out_nl[0] ==
'\r' && out_nl[1] ==
'\n')
352 ok(exp_ptr >=
exp_data+exp_size,
"unexpected end of output in line %d, missing %s\n",
line, exp_ptr);
353 ok(out_ptr >= out_data+
out_size,
"too long output, got additional %s\n", out_ptr);
358 const char *out_data, *actual_cmd_data;
362 if(!actual_cmd_size || !actual_cmd_data)
365 if(!
run_cmd(actual_cmd_data, actual_cmd_size))
428 const char *cmd_data, *out_data;
451 char cmd[] =
"cmd /c exit 0";
453 memset(&si, 0,
sizeof(si));
469 win_skip(
"cmd not installed, skipping cmd tests\n");
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
static struct sockaddr_in sa
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
static void cleanup(void)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
DWORD WINAPI GetShortPathNameA(IN LPCSTR lpszLongPath, OUT LPSTR lpszShortPath, IN DWORD cchBuffer)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
BOOL WINAPI EnumResourceNamesA(HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfun, LONG_PTR lparam)
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
int WINAPI lstrlenA(LPCSTR lpString)
#define memcpy(s1, s2, n)
#define sprintf(buf, format,...)
static const DWORD drive_len
static DWORD load_resource(const char *name, const char *type, const char **ret)
static DWORD map_file(const char *file_name, const char **ret)
static BOOL run_cmd(const char *cmd_data, DWORD cmd_size)
static char workdir[MAX_PATH]
static int cmd_available(void)
static const char * convert_input_data(const char *data, DWORD size, DWORD *new_size)
static void run_from_file(const char *file_name)
static BOOL WINAPI test_enum_proc(HMODULE module, LPCSTR type, LPSTR name, LONG_PTR param)
static DWORD shortpath_len
static void test_output(const char *out_data, DWORD out_size, const char *exp_data, DWORD exp_size)
static const char * compare_line(const char *out_line, const char *out_end, const char *exp_line, const char *exp_end)
static char shortpath[MAX_PATH]
static void test_size(void)
#define todo_wine_if(is_todo)
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID ULONG out_size
#define FILE_ATTRIBUTE_READONLY
#define LOCALE_SYSTEM_DEFAULT
int winetest_get_mainargs(char ***pargv)
struct ChNotifyTest * exp_data
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
DWORD WINAPI GetLastError(void)
#define STARTF_USESTDHANDLES