ReactOS 0.4.15-dev-8241-g63935f8
winetest.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <windows.h>
Include dependency graph for winetest.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAXTAGLEN   20
 

Enumerations

enum  report_type {
  R_STATUS = 0 , R_PROGRESS , R_STEP , R_DELTA ,
  R_TAG , R_DIR , R_OUT , R_WARNING ,
  R_ERROR , R_FATAL , R_ASK , R_TEXTMODE ,
  R_QUIET
}
 

Functions

void fatal (const char *msg)
 
void warning (const char *msg)
 
voidxmalloc (size_t len)
 
voidxrealloc (void *op, size_t len)
 
charxstrdup (const char *str)
 
void xprintf (const char *fmt,...)
 
charvstrmake (size_t *lenp, va_list ap)
 
charstrmake (size_t *lenp,...)
 
int goodtagchar (char c)
 
const charfindbadtagchar (const char *tag)
 
int send_file (const char *name)
 
int guiAskTag (void)
 
int report (enum report_type t,...)
 

Variables

chartag
 

Macro Definition Documentation

◆ MAXTAGLEN

#define MAXTAGLEN   20

Definition at line 62 of file winetest.h.

Enumeration Type Documentation

◆ report_type

Enumerator
R_STATUS 
R_PROGRESS 
R_STEP 
R_DELTA 
R_TAG 
R_DIR 
R_OUT 
R_WARNING 
R_ERROR 
R_FATAL 
R_ASK 
R_TEXTMODE 
R_QUIET 

Definition at line 46 of file winetest.h.

46 {
47 R_STATUS = 0,
49 R_STEP,
50 R_DELTA,
51 R_TAG,
52 R_DIR,
53 R_OUT,
55 R_ERROR,
56 R_FATAL,
57 R_ASK,
60};
@ R_ERROR
Definition: winetest.h:55
@ R_TEXTMODE
Definition: winetest.h:58
@ R_QUIET
Definition: winetest.h:59
@ R_DELTA
Definition: winetest.h:50
@ R_PROGRESS
Definition: winetest.h:48
@ R_ASK
Definition: winetest.h:57
@ R_STEP
Definition: winetest.h:49
@ R_WARNING
Definition: winetest.h:54
@ R_STATUS
Definition: winetest.h:47
@ R_OUT
Definition: winetest.h:53
@ R_DIR
Definition: winetest.h:52
@ R_FATAL
Definition: winetest.h:56
@ R_TAG
Definition: winetest.h:51

Function Documentation

◆ fatal()

void fatal ( const char msg)

◆ findbadtagchar()

const char * findbadtagchar ( const char tag)

Definition at line 124 of file util.c.

125{
126 while (*tag)
127 if (goodtagchar (*tag)) tag++;
128 else return tag;
129 return NULL;
130}
#define NULL
Definition: types.h:112
int goodtagchar(char c)
Definition: util.c:115
Definition: ecma_167.h:138

Referenced by WinMain().

◆ goodtagchar()

int goodtagchar ( char  c)

Definition at line 115 of file util.c.

116{
117 return (('a'<=c && c<='z') ||
118 ('A'<=c && c<='Z') ||
119 ('0'<=c && c<='9') ||
120 c=='-' || c=='.');
121}
const GLubyte * c
Definition: glext.h:8905

Referenced by EditTagProc(), and findbadtagchar().

◆ guiAskTag()

int guiAskTag ( void  )

Definition at line 353 of file gui.c.

354{
358}
static INT_PTR CALLBACK AskTagProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: gui.c:327
static HWND dialog
Definition: gui.c:33
#define IDD_TAG
Definition: resource.h:25
#define GetModuleHandle
Definition: winbase.h:3827
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DialogBox
Definition: winuser.h:5770

Referenced by WinMain().

◆ report()

int report ( enum report_type  t,
  ... 
)

Definition at line 454 of file gui.c.

455{
456 typedef int r_fun_t (va_list);
457
458 va_list ap;
459 int ret = 0;
460 static r_fun_t * const text_funcs[] =
464 static r_fun_t * const GUI_funcs[] =
468 static r_fun_t * const quiet_funcs[] =
470 qNoOp, qNoOp, qNoOp,
472 static r_fun_t * const * funcs = NULL;
473
474 switch (t) {
475 case R_TEXTMODE:
476 funcs = text_funcs;
477 return 0;
478 case R_QUIET:
479 funcs = quiet_funcs;
480 return 0;
481 default:
482 break;
483 }
484
485 if (!funcs) {
486 HANDLE DlgThread;
487 DWORD DlgThreadID;
488
489 funcs = text_funcs;
491 if (!initEvent)
492 report (R_STATUS, "Can't create event object: %d",
493 GetLastError ());
494 else {
495 DlgThread = CreateThread (NULL, 0, DlgThreadProc,
496 NULL, 0, &DlgThreadID);
497 if (!DlgThread)
498 report (R_STATUS, "Can't create GUI thread: %d",
499 GetLastError ());
500 else {
502 switch (ret) {
503 case WAIT_OBJECT_0:
504 funcs = GUI_funcs;
505 break;
506 case WAIT_TIMEOUT:
507 report (R_STATUS, "GUI creation timed out");
508 break;
509 case WAIT_FAILED:
510 report (R_STATUS, "Wait for GUI failed: %d",
511 GetLastError ());
512 break;
513 default:
514 report (R_STATUS, "Wait returned %d",
515 ret);
516 break;
517 }
518 }
519 }
520 }
521
522 va_start (ap, t);
523 if (t < sizeof text_funcs / sizeof text_funcs[0] &&
524 t < sizeof GUI_funcs / sizeof GUI_funcs[0]) ret = funcs[t](ap);
525 else report (R_WARNING, "unimplemented report type: %d", t);
526 va_end (ap);
527 return ret;
528}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define FALSE
Definition: types.h:117
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define INFINITE
Definition: serial.h:102
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble GLdouble t
Definition: gl.h:2047
static int guiError(va_list ap)
Definition: gui.c:263
static int guiFatal(va_list ap)
Definition: gui.c:281
static HANDLE initEvent
Definition: gui.c:29
static int textDir(va_list ap)
Definition: gui.c:190
static int guiWarning(va_list ap)
Definition: gui.c:244
static int textDelta(va_list ap)
Definition: gui.c:144
static int textAsk(va_list ap)
Definition: gui.c:289
static int textError(va_list ap)
Definition: gui.c:255
static int textFatal(va_list ap)
Definition: gui.c:274
int report(enum report_type t,...)
Definition: gui.c:454
static int guiProgress(va_list ap)
Definition: gui.c:96
static int qFatal(va_list ap)
Definition: gui.c:368
static int guiTag(va_list ap)
Definition: gui.c:182
static int textOut(va_list ap)
Definition: gui.c:213
static int guiDir(va_list ap)
Definition: gui.c:202
static int textProgress(va_list ap)
Definition: gui.c:87
static int guiStatus(va_list ap)
Definition: gui.c:74
static int textStep(va_list ap)
Definition: gui.c:117
static int textTag(va_list ap)
Definition: gui.c:173
static int guiOut(va_list ap)
Definition: gui.c:225
static int guiDelta(va_list ap)
Definition: gui.c:157
static int qNoOp(va_list ap)
Definition: gui.c:362
static DWORD WINAPI DlgThreadProc(LPVOID param)
Definition: gui.c:429
static int textStatus(va_list ap)
Definition: gui.c:63
static int textWarning(va_list ap)
Definition: gui.c:236
static int guiStep(va_list ap)
Definition: gui.c:129
static int qAsk(va_list ap)
Definition: gui.c:374
static int guiAsk(va_list ap)
Definition: gui.c:302
static struct __wine_debug_functions funcs
Definition: debug.c:59
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CreateEvent
Definition: winbase.h:3748
#define WAIT_OBJECT_0
Definition: winbase.h:406
#define WAIT_FAILED
Definition: winbase.h:413
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

Referenced by DlgProc(), DlgThreadProc(), and report().

◆ send_file()

int send_file ( const char name)

Definition at line 105 of file send.c.

106{
107 SOCKET s;
108 FILE *f;
109#define BUFLEN 8192
110 char buffer[BUFLEN+1];
111 size_t bytes_read, total, filesize;
112 char *str;
113 int ret;
114
115 /* RFC 2616 */
116#define SEP "--8<--cut-here--8<--"
117 static const char head[] = "POST /submit HTTP/1.0\r\n"
118 "Host: test.winehq.org\r\n"
119 "User-Agent: Winetest Shell\r\n"
120 "Content-Type: multipart/form-data; boundary=\"" SEP "\"\r\n"
121 "Content-Length: %u\r\n\r\n";
122 static const char body1[] = "--" SEP "\r\n"
123 "Content-Disposition: form-data; name=\"reportfile\"; filename=\"%s\"\r\n"
124 "Content-Type: application/octet-stream\r\n\r\n";
125 static const char body2[] = "\r\n--" SEP "\r\n"
126 "Content-Disposition: form-data; name=\"submit\"\r\n\r\n"
127 "Upload File\r\n"
128 "--" SEP "--\r\n";
129
130 s = open_http ("test.winehq.org");
131 if (s == INVALID_SOCKET) return 1;
132
133 f = fopen (name, "rb");
134 if (!f) {
135 report (R_WARNING, "Can't open file '%s': %d", name, errno);
136 goto abort1;
137 }
138 fseek (f, 0, SEEK_END);
139 filesize = ftell (f);
140 if (filesize > 1.5*1024*1024) {
142 "File too big (%.1f MB > 1.5 MB); submitting partial report.",
143 filesize/1024.0/1024);
144 filesize = 1.5*1024*1024;
145 }
146 fseek (f, 0, SEEK_SET);
147
148 report (R_STATUS, "Sending header");
149 str = strmake (&total, body1, name);
150 ret = send_str (s, head, filesize + total + sizeof body2 - 1) ||
151 send_buf (s, str, total);
152 free (str);
153 if (ret) {
154 report (R_WARNING, "Error sending header: %d, %d",
156 goto abort2;
157 }
158
159 report (R_STATUS, "Sending %u bytes of data", filesize);
160 report (R_PROGRESS, 2, filesize);
161 total = 0;
162 while (total < filesize && (bytes_read = fread (buffer, 1, BUFLEN/2, f))) {
163 if ((signed)bytes_read == -1) {
164 report (R_WARNING, "Error reading log file: %d", errno);
165 goto abort2;
166 }
167 total += bytes_read;
168 if (total > filesize) bytes_read -= total - filesize;
169 if (send_buf (s, buffer, bytes_read)) {
170 report (R_WARNING, "Error sending body: %d, %d",
172 goto abort2;
173 }
174 report (R_DELTA, bytes_read, "Network transfer: In progress");
175 }
176 fclose (f);
177
178 if (send_buf (s, body2, sizeof body2 - 1)) {
179 report (R_WARNING, "Error sending trailer: %d, %d",
181 goto abort1;
182 }
183 report (R_DELTA, 0, "Network transfer: Done");
184
185 total = 0;
186 while ((bytes_read = recv (s, buffer+total, BUFLEN-total, 0))) {
187 if ((signed)bytes_read == SOCKET_ERROR) {
188 report (R_WARNING, "Error receiving reply: %d, %d",
190 goto abort1;
191 }
192 total += bytes_read;
193 if (total == BUFLEN) {
194 report (R_WARNING, "Buffer overflow");
195 goto abort1;
196 }
197 }
198 if (close_http (s)) {
199 report (R_WARNING, "Error closing connection: %d, %d",
201 return 1;
202 }
203
204 str = strmake (&bytes_read, "Received %s (%d bytes).\n",
205 name, filesize);
206 ret = memcmp (str, buffer + total - bytes_read, bytes_read);
207 free (str);
208 if (ret) {
209 buffer[total] = 0;
210 str = strstr (buffer, "\r\n\r\n");
211 if (!str) str = buffer;
212 else str = str + 4;
213 report (R_ERROR, "Can't submit logfile '%s'. "
214 "Server response: %s", name, str);
215 }
216 return ret;
217
218 abort2:
219 fclose (f);
220 abort1:
221 close_http (s);
222 return 1;
223}
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
struct outqueuenode * head
Definition: adnsresfilter.c:66
#define SEEK_END
Definition: cabinet.c:29
#define free
Definition: debug_ros.c:5
static void report(const DATA_BLOB *pDataIn, const DATA_BLOB *pOptionalEntropy, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD dwFlags)
Definition: protectdata.c:769
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23
size_t total
GLdouble s
Definition: gl.h:2039
GLuint buffer
Definition: glext.h:5915
GLfloat f
Definition: glext.h:7540
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP long __cdecl ftell(_Inout_ FILE *_File)
#define SEEK_SET
Definition: jmemansi.c:26
#define f
Definition: ke_i.h:83
static int send_buf(SOCKET s, const char *buf, size_t length)
Definition: send.c:74
static int send_str(SOCKET s,...)
Definition: send.c:88
static int close_http(SOCKET s)
Definition: send.c:65
static SOCKET open_http(const char *server)
Definition: send.c:28
#define SEP
#define BUFLEN
char * strmake(size_t *lenp,...)
Definition: util.c:82
const WCHAR * str
#define errno
Definition: errno.h:18
Definition: name.c:39
int PASCAL FAR WSAGetLastError(void)
Definition: dllmain.c:112
#define INVALID_SOCKET
Definition: winsock.h:332
UINT_PTR SOCKET
Definition: winsock.h:47
#define SOCKET_ERROR
Definition: winsock.h:333

Referenced by WinMain().

◆ strmake()

char * strmake ( size_t lenp,
  ... 
)

Definition at line 82 of file util.c.

83{
84 va_list ap;
85 char *p;
86
87 va_start (ap, lenp);
88 p = vstrmake (lenp, ap);
89 if (!p) report (R_FATAL, "Out of memory.");
90 va_end (ap);
91 return p;
92}
GLfloat GLfloat p
Definition: glext.h:8902
char * vstrmake(size_t *lenp, va_list ap)
Definition: util.c:74

Referenced by extract_test(), get_subtests(), run_test(), and send_file().

◆ vstrmake()

char * vstrmake ( size_t lenp,
va_list  ap 
)

Definition at line 74 of file util.c.

75{
76 const char *fmt;
77
78 fmt = va_arg (ap, const char*);
79 return vstrfmtmake (lenp, fmt, ap);
80}
#define va_arg(ap, T)
Definition: acmsvcex.h:89
static char * vstrfmtmake(size_t *lenp, const char *fmt, va_list ap)
Definition: util.c:50
Definition: dsound.c:943

Referenced by guiAsk(), guiDelta(), guiDir(), guiError(), guiOut(), guiStatus(), guiStep(), guiWarning(), send_str(), strmake(), textAsk(), textDelta(), textDir(), textOut(), textStatus(), and textStep().

◆ warning()

void warning ( const char msg)

◆ xmalloc()

void * xmalloc ( size_t  len)

Definition at line 27 of file util.c.

28{
29 void *p = malloc (len);
30
31 if (!p) report (R_FATAL, "Out of memory.");
32 return p;
33}
#define malloc
Definition: debug_ros.c:4
GLenum GLsizei len
Definition: glext.h:6722

◆ xprintf()

void xprintf ( const char fmt,
  ... 
)

Definition at line 16 of file shimdbg.c.

17{
18 va_list ap;
19
20 va_start(ap, fmt);
21 vprintf(fmt, ap);
23 va_end(ap);
24}
_Check_return_opt_ _CRTIMP int __cdecl vprintf(_In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
#define DPFLTR_ERROR_LEVEL
Definition: shimdbg.c:14

Referenced by CallApphelp(), CallApphelpWithImage(), DumpRegistryData(), extract_test_proc(), HandleDumpAttributes(), HandleImageArg(), hexdump(), InitApphelp(), main(), MapFile(), print_version(), run_test(), run_tests(), test_normal_imports(), and test_ordinal_imports().

◆ xrealloc()

void * xrealloc ( void op,
size_t  len 
)

Definition at line 736 of file uimain.c.

737{
738 if (size < 1)
739 {
740 size = 1;
741 }
742 return realloc(in, size);
743}
#define realloc
Definition: debug_ros.c:6
GLsizeiptr size
Definition: glext.h:5919
GLuint in
Definition: glext.h:9616

◆ xstrdup()

char * xstrdup ( const char str)

Definition at line 768 of file uimain.c.

769{
770 int len;
771 char * p;
772
773 if (s == 0)
774 {
775 return 0;
776 }
777 len = strlen(s);
778 p = (char *) xmalloc(len + 1);
779 strcpy(p, s);
780 return p;
781}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
void * xmalloc(int size)
Definition: uimain.c:747

Variable Documentation

◆ tag

char* tag
extern

Definition at line 59 of file main.c.