ReactOS  0.4.14-dev-57-g333b8f1
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,
48  R_PROGRESS,
49  R_STEP,
50  R_DELTA,
51  R_TAG,
52  R_DIR,
53  R_OUT,
54  R_WARNING,
55  R_ERROR,
56  R_FATAL,
57  R_ASK,
58  R_TEXTMODE,
59  R_QUIET
60 };
Definition: winetest.h:51
Definition: winetest.h:52
Definition: winetest.h:57
Definition: winetest.h:53

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 }
Definition: ecma_167.h:138
int goodtagchar(char c)
Definition: util.c:115
smooth NULL
Definition: ftsmooth.c:416
char * tag
Definition: main.c:59

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 {
355  return DialogBox (GetModuleHandle (NULL),
357  dialog, AskTagProc);
358 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DialogBox
Definition: winuser.h:5662
smooth NULL
Definition: ftsmooth.c:416
#define IDD_TAG
Definition: resource.h:25
#define GetModuleHandle
Definition: winbase.h:3644
static INT_PTR CALLBACK AskTagProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: gui.c:327
static HWND dialog
Definition: gui.c:33

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[] =
466  guiTag, guiDir, guiOut,
468  static r_fun_t * const quiet_funcs[] =
469  {qNoOp, qNoOp, qNoOp, qNoOp,
470  qNoOp, qNoOp, qNoOp,
471  qNoOp, qNoOp, qFatal, qAsk};
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 }
#define CreateEvent
Definition: winbase.h:3565
static int guiStatus(va_list ap)
Definition: gui.c:74
static int textFatal(va_list ap)
Definition: gui.c:274
static int qAsk(va_list ap)
Definition: gui.c:374
static int guiOut(va_list ap)
Definition: gui.c:225
static int textWarning(va_list ap)
Definition: gui.c:236
static int guiDir(va_list ap)
Definition: gui.c:202
int report(enum report_type t,...)
Definition: gui.c:454
static int guiWarning(va_list ap)
Definition: gui.c:244
GLdouble GLdouble t
Definition: gl.h:2047
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static int guiError(va_list ap)
Definition: gui.c:263
static HANDLE initEvent
Definition: gui.c:29
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define va_end(ap)
Definition: acmsvcex.h:90
static int textOut(va_list ap)
Definition: gui.c:213
static int qFatal(va_list ap)
Definition: gui.c:368
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:136
smooth NULL
Definition: ftsmooth.c:416
char * va_list
Definition: acmsvcex.h:78
static int guiFatal(va_list ap)
Definition: gui.c:281
static int textDir(va_list ap)
Definition: gui.c:190
static int guiAsk(va_list ap)
Definition: gui.c:302
static int guiProgress(va_list ap)
Definition: gui.c:96
#define WAIT_OBJECT_0
Definition: winbase.h:387
static int textProgress(va_list ap)
Definition: gui.c:87
static struct __wine_debug_functions funcs
Definition: debug.c:59
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WAIT_FAILED
Definition: winbase.h:394
static int textDelta(va_list ap)
Definition: gui.c:144
#define WAIT_TIMEOUT
Definition: dderror.h:14
int ret
static int textStatus(va_list ap)
Definition: gui.c:63
static int textTag(va_list ap)
Definition: gui.c:173
static int textAsk(va_list ap)
Definition: gui.c:289
static int guiDelta(va_list ap)
Definition: gui.c:157
#define va_start(ap, A)
Definition: acmsvcex.h:91
static int textStep(va_list ap)
Definition: gui.c:117
static int guiTag(va_list ap)
Definition: gui.c:182
static int guiStep(va_list ap)
Definition: gui.c:129
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
static int qNoOp(va_list ap)
Definition: gui.c:362
static DWORD WINAPI DlgThreadProc(LPVOID param)
Definition: gui.c:429
#define INFINITE
Definition: serial.h:102
static int textError(va_list ap)
Definition: gui.c:255

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) {
141  report (R_WARNING,
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",
155  errno, WSAGetLastError ());
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",
171  errno, WSAGetLastError ());
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",
180  errno, WSAGetLastError ());
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",
189  errno, WSAGetLastError ());
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",
200  errno, WSAGetLastError ());
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 }
#define SOCKET_ERROR
Definition: winsock.h:333
static int send_buf(SOCKET s, const char *buf, size_t length)
Definition: send.c:74
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
struct outqueuenode * head
Definition: adnsresfilter.c:66
static int send_str(SOCKET s,...)
Definition: send.c:88
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define free
Definition: debug_ros.c:5
GLuint buffer
Definition: glext.h:5915
int errno
_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)
const WCHAR * str
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
static void report(const DATA_BLOB *pDataIn, const DATA_BLOB *pOptionalEntropy, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD dwFlags)
Definition: protectdata.c:769
char * strmake(size_t *lenp,...)
Definition: util.c:82
#define SEEK_SET
Definition: jmemansi.c:26
GLfloat f
Definition: glext.h:7540
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
#define INVALID_SOCKET
Definition: winsock.h:332
#define BUFLEN
static int close_http(SOCKET s)
Definition: send.c:65
int ret
GLdouble s
Definition: gl.h:2039
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
static SOCKET open_http(const char *server)
Definition: send.c:28
#define f
Definition: ke_i.h:83
Definition: name.c:36
_Check_return_ _CRTIMP long __cdecl ftell(_Inout_ FILE *_File)
#define SEEK_END
Definition: cabinet.c:27
UINT_PTR SOCKET
Definition: winsock.h:47
#define SEP
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23

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 }
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
static void report(const DATA_BLOB *pDataIn, const DATA_BLOB *pOptionalEntropy, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD dwFlags)
Definition: protectdata.c:769
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
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 }
const char * fmt
Definition: wsprintf.c:30
static char * vstrfmtmake(size_t *lenp, const char *fmt, va_list ap)
Definition: util.c:50
#define va_arg(ap, T)
Definition: acmsvcex.h:89
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
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 }
static void report(const DATA_BLOB *pDataIn, const DATA_BLOB *pOptionalEntropy, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD dwFlags)
Definition: protectdata.c:769
GLenum GLsizei len
Definition: glext.h:6722
#define malloc
Definition: debug_ros.c:4
GLfloat GLfloat p
Definition: glext.h:8902

◆ 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 }
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
_Check_return_opt_ _CRTIMP int __cdecl vprintf(_In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
#define DPFLTR_ERROR_LEVEL
Definition: shimdbg.c:14
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
Definition: dsound.c:943

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
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
void * xmalloc(int size)
Definition: uimain.c:747
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
GLfloat GLfloat p
Definition: glext.h:8902

Variable Documentation

◆ tag

Definition at line 59 of file main.c.

Referenced by _test_elem_tag(), _TIFFCreateAnonField(), _TIFFVGetField(), _TIFFVSetField(), add_expand_text(), ber_parse_header(), check_tiff_format(), check_type1_format(), count_tags(), CRYPT_AsnEncodeAltNameEntry(), CRYPT_AsnEncodeStringCoerce(), CRYPT_AsnEncodeUnicodeStringCoerce(), d3dx9_base_effect_init(), Decompose_Curve(), do_one_pass(), dump_tiff(), dxbc_add_section(), dxbc_parse(), findbadtagchar(), FT_Outline_Decompose(), FT_Stroker_ParseOutline(), get_font_size(), get_GSUB_Indic2(), get_reparse_tag(), get_reparse_tag_fcb(), XMLStorage::Buffer::get_tag(), getDataType(), HTMLElement_Create(), HTMLElementCollection_tags(), is_elem_tag(), jsstr_init(), ldap_parse_page_controlW(), licence_process(), nfs_encode_compound(), parse_data_type(), parseabbrevs(), PredictorVGetField(), PredictorVSetField(), PropertyStorage_ReadProperty(), read_pfb_tag(), SdbFindNextTag(), SdbpGetString(), SdbpSetDWORDAttr(), SdbpSetQWORDAttr(), SdbpSetStringAttr(), SdbpSetStringAttrFromAnsiString(), sec_parse_crypt_info(), sec_process_mcs_data(), SeiBuildShimRefArray(), set_reparse_point2(), sfnt_open_font(), T1_Get_Private_Dict(), T1_New_Parser(), tag_to_vt(), test_color_formats(), test_elem_from_point(), test_GetColorProfileElementTag(), test_IsColorProfileTagPresent(), test_primary_secondary(), test_primary_secondary8(), test_Sdb(), test_secondary(), test_secondary8(), test_tiff_color_formats(), test_write_ex(), TIFFFindField(), TIFFWriteDirectoryTagData(), tt_face_load_hmtx(), UDFReadTagged(), UDFSetUpTag(), UniataAhciBeginTransaction(), UniataAhciEndTransaction(), UniataAhciSendCommand(), usp10_script_add_language(), usp10_script_add_language_list(), usp10_script_cache_add_script(), usp10_script_cache_add_script_list(), and ValidateShim().