ReactOS  0.4.14-dev-614-gbfd8a84
data.c File Reference
#include "wine/test.h"
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <io.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <process.h>
#include <errno.h>
#include <direct.h>
Include dependency graph for data.c:

Go to the source code of this file.

Macros

#define initterm_test(start, end, expected)
 

Typedefs

typedef void(__cdecl_INITTERMFUN) (void)
 

Functions

void __cdecl __getmainargs (int *, char ***, char ***, int, int *)
 
static int *__cdeclp___p___argc (void)
 
static char ***__cdeclp___p___argv (void)
 
static void (__cdecl *p_initterm)(_INITTERMFUN *start
 
static int (__cdecl *p_get_pgmptr)(char **p)
 
static void __cdecl initcallback (void)
 
static void test_initterm (void)
 
static void test_initvar (HMODULE hmsvcrt)
 
static void test_get_pgmptr (void)
 
static void test___getmainargs (void)
 
static void test___getmainargs_parent (char *name)
 
 START_TEST (data)
 

Variables

static _INITTERMFUNend
 
static int callbacked
 

Macro Definition Documentation

◆ initterm_test

#define initterm_test (   start,
  end,
  expected 
)
Value:
callbacked = 0; \
p_initterm(start, end); \
ok(expected == callbacked,"_initterm: callbacks count mismatch: got %i, expected %i\n", callbacked, expected);
GLuint GLuint end
Definition: gl.h:1545
GLuint start
Definition: gl.h:1545
static int callbacked
Definition: data.c:44
BOOL expected
Definition: store.c:2063

Definition at line 51 of file data.c.

Typedef Documentation

◆ _INITTERMFUN

typedef void(__cdecl * _INITTERMFUN) (void)

Definition at line 39 of file data.c.

Function Documentation

◆ __getmainargs()

void __cdecl __getmainargs ( int ,
char ***  ,
char ***  ,
int  ,
int  
)

Definition at line 182 of file getargs.c.

183 {
184  int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
185  size_t len;
186  char* buffer;
187 
188  /* missing threading init */
189 
190  i = 0;
191  doexpand = expand_wildcards;
192  escapedQuote = FALSE;
193  anyLetter = FALSE;
194  slashesAdded = 0;
195  inQuotes = 0;
196  bufferIndex = 0;
197 
198  if (__argv && _environ)
199  {
200  *argv = __argv;
201  *env = _environ;
202  *argc = __argc;
203  return;
204  }
205 
206  __argc = 0;
207 
208  len = strlen(_acmdln);
209  buffer = malloc(sizeof(char) * len);
210 
211  // Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
212  while (TRUE)
213  {
214  // Arguments are delimited by white space, which is either a space or a tab.
215  if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes))
216  {
217  // Handle the case when empty spaces are in the end of the cmdline
218  if (anyLetter)
219  {
220  aexpand(strndup(buffer, bufferIndex), doexpand);
221  }
222  // Copy the last element from buffer and quit the loop
223  if (i >= len)
224  {
225  break;
226  }
227 
228  while (_acmdln[i] == ' ' || _acmdln[i] == '\t')
229  ++i;
230  anyLetter = FALSE;
231  bufferIndex = 0;
232  slashesAdded = 0;
233  escapedQuote = FALSE;
234  continue;
235  }
236 
237  anyLetter = TRUE;
238 
239  if (_acmdln[i] == '\\')
240  {
241  buffer[bufferIndex++] = _acmdln[i];
242  ++slashesAdded;
243  ++i;
244  escapedQuote = FALSE;
245  continue;
246  }
247 
248  if (_acmdln[i] == '\"')
249  {
250  if (slashesAdded > 0)
251  {
252  if (slashesAdded % 2 == 0)
253  {
254  // If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
255  // is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
256  // is interpreted as a string delimiter.
257  bufferIndex -= slashesAdded / 2;
258  }
259  else
260  {
261  // If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
262  // is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
263  // interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
264  // to be placed in argv.
265  bufferIndex -= slashesAdded / 2 + 1;
266  buffer[bufferIndex++] = '\"';
267  slashesAdded = 0;
268  escapedQuote = TRUE;
269  ++i;
270  continue;
271  }
272  slashesAdded = 0;
273  }
274  else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote)
275  {
276  buffer[bufferIndex++] = '\"';
277  ++i;
278  escapedQuote = TRUE;
279  continue;
280  }
281  slashesAdded = 0;
282  escapedQuote = FALSE;
283  inQuotes = !inQuotes;
284  doexpand = inQuotes ? FALSE : expand_wildcards;
285  ++i;
286  continue;
287  }
288 
289  buffer[bufferIndex++] = _acmdln[i];
290  slashesAdded = 0;
291  escapedQuote = FALSE;
292  ++i;
293  }
294 
295  /* Free the temporary buffer. */
296  free(buffer);
297 
298  *argc = __argc;
299  if (__argv == NULL)
300  {
301  __argv = (char**)malloc(sizeof(char*));
302  __argv[0] = 0;
303  }
304  *argv = __argv;
305  *env = _environ;
306 
307  _pgmptr = malloc(MAX_PATH * sizeof(char));
308  if (_pgmptr)
309  {
311  _pgmptr[0] = '\0';
312  else
313  _pgmptr[MAX_PATH - 1] = '\0';
314  }
315  else
316  {
317  _pgmptr = _strdup(__argv[0]);
318  }
319 
321 
322  // if (new_mode) _set_new_mode(*new_mode);
323 }
char ** _environ
Definition: environ.c:22
int __argc
Definition: getargs.c:21
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
char * _acmdln
Definition: environ.c:18
char ** __argv
Definition: getargs.c:18
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define free
Definition: debug_ros.c:5
BOOL WINAPI HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem)
Definition: heapmem.c:156
GLuint buffer
Definition: glext.h:5915
#define argv
Definition: mplay32.c:18
#define _strdup
Definition: debug_ros.c:7
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:548
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
Definition: glfuncs.h:248
GLuint bufferIndex
Definition: glext.h:7857
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
#define MAX_PATH
Definition: compat.h:26
int aexpand(char *name, int expand_wildcards)
Definition: getargs.c:132
GLenum GLsizei len
Definition: glext.h:6722
char * strndup(char const *name, size_t len)
Definition: getargs.c:25
char * _pgmptr
Definition: environ.c:27
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:168
#define malloc
Definition: debug_ros.c:4

Referenced by test___getmainargs().

◆ initcallback()

static void __cdecl initcallback ( void  )
static

Definition at line 46 of file data.c.

47 {
48  callbacked++;
49 }
static int callbacked
Definition: data.c:44

Referenced by test_initterm().

◆ int()

static int ( __cdecl p_get_pgmptr)
static

◆ p___p___argc()

static int* __cdecl* p___p___argc ( void  )
static

Referenced by START_TEST(), and test___getmainargs().

◆ p___p___argv()

static char*** __cdecl* p___p___argv ( void  )
static

Referenced by START_TEST(), and test___getmainargs().

◆ START_TEST()

START_TEST ( data  )

Definition at line 230 of file data.c.

231 {
232  HMODULE hmsvcrt;
233  int arg_c;
234  char** arg_v;
235 
236  hmsvcrt = GetModuleHandleA("msvcrt.dll");
237  if (!hmsvcrt)
238  hmsvcrt = GetModuleHandleA("msvcrtd.dll");
239  if (hmsvcrt)
240  {
241  p_initterm=(void*)GetProcAddress(hmsvcrt, "_initterm");
242  p_get_pgmptr=(void*)GetProcAddress(hmsvcrt, "_get_pgmptr");
243  p___p___argc=(void*)GetProcAddress(hmsvcrt, "__p___argc");
244  p___p___argv=(void*)GetProcAddress(hmsvcrt, "__p___argv");
245  }
246 
247  arg_c = winetest_get_mainargs(&arg_v);
248  if(arg_c >= 3) {
250  return;
251  }
252 
253  test_initterm();
254  test_initvar(hmsvcrt);
255  test_get_pgmptr();
256  test___getmainargs_parent(arg_v[0]);
257 }
static void test_get_pgmptr(void)
Definition: data.c:118
static void test_initterm(void)
Definition: data.c:56
static void test___getmainargs(void)
Definition: data.c:132
static int *__cdecl * p___p___argc(void)
static char ***__cdecl * p___p___argv(void)
int winetest_get_mainargs(char ***pargv)
static void test___getmainargs_parent(char *name)
Definition: data.c:194
static void test_initvar(HMODULE hmsvcrt)
Definition: data.c:77
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define GetProcAddress(x, y)
Definition: compat.h:418

◆ test___getmainargs()

static void test___getmainargs ( void  )
static

Definition at line 132 of file data.c.

133 {
134  int argc, new_argc, mode;
135  char **argv, **new_argv, **envp;
136  char tmppath[MAX_PATH], filepath[MAX_PATH];
137  FILE *f;
138 
139  ok(GetTempPathA(MAX_PATH, tmppath) != 0, "GetTempPath failed\n");
140 
141  mode = 0;
142  __getmainargs(&argc, &argv, &envp, 0, &mode);
143  ok(argc == 4, "argc = %d\n", argc);
144  ok(!strcmp(argv[1], "data"), "argv[1] = %s\n", argv[1]);
145  sprintf(filepath, "%s*\\*", tmppath);
146  ok(!strcmp(argv[2], filepath), "argv[2] = %s\n", argv[2]);
147  sprintf(filepath, "%swine_test/*", tmppath);
148  ok(!strcmp(argv[3], filepath), "argv[3] = %s\n", argv[3]);
149  ok(!argv[4], "argv[4] != NULL\n");
150 
151  if(p___p___argc && p___p___argv) {
152  new_argc = *p___p___argc();
153  new_argv = *p___p___argv();
154  ok(new_argc == 4, "*__p___argc() = %d\n", new_argc);
155  ok(new_argv == argv, "*__p___argv() = %p, expected %p\n", new_argv, argv);
156  }
157  else skip("__p___argc or __p___argv is not available\n");
158 
159  mode = 0;
160  __getmainargs(&argc, &argv, &envp, 1, &mode);
161  ok(argc == 5, "argc = %d\n", argc);
162  ok(!strcmp(argv[1], "data"), "argv[1] = %s\n", argv[1]);
163  sprintf(filepath, "%s*\\*", tmppath);
164  ok(!strcmp(argv[2], filepath), "argv[2] = %s\n", argv[2]);
165  sprintf(filepath, "%swine_test/a", tmppath);
166  if(argv[3][strlen(argv[3])-1] == 'a') {
167  ok(!strcmp(argv[3], filepath), "argv[3] = %s\n", argv[3]);
168  sprintf(filepath, "%swine_test/test", tmppath);
169  ok(!strcmp(argv[4], filepath), "argv[4] = %s\n", argv[4]);
170  }else {
171  ok(!strcmp(argv[4], filepath), "argv[4] = %s\n", argv[4]);
172  sprintf(filepath, "%swine_test/test", tmppath);
173  ok(!strcmp(argv[3], filepath), "argv[3] = %s\n", argv[3]);
174  }
175  ok(!argv[5], "argv[5] != NULL\n");
176 
177  if(p___p___argc && p___p___argv) {
178  new_argc = *p___p___argc();
179  new_argv = *p___p___argv();
180  ok(new_argc == argc, "*__p___argc() = %d, expected %d\n", new_argc, argc);
181  ok(new_argv == argv, "*__p___argv() = %p, expected %p\n", new_argv, argv);
182  }
183 
184  sprintf(filepath, "%swine_test/b", tmppath);
185  f = fopen(filepath, "w");
186  ok(f != NULL, "fopen(%s) failed: %d\n", filepath, errno);
187  fclose(f);
188  mode = 0;
189  __getmainargs(&new_argc, &new_argv, &envp, 1, &mode);
190  ok(new_argc == argc+1, "new_argc = %d, expected %d\n", new_argc, argc+1);
191  _unlink(filepath);
192 }
static int argc
Definition: ServiceArgs.c:12
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int errno
#define argv
Definition: mplay32.c:18
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static int *__cdecl * p___p___argc(void)
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP int __cdecl _unlink(_In_z_ const char *_Filename)
static char ***__cdecl * p___p___argv(void)
GLfloat f
Definition: glext.h:7540
#define MAX_PATH
Definition: compat.h:26
void __cdecl __getmainargs(int *, char ***, char ***, int, int *)
Definition: getargs.c:182
_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)
GLenum mode
Definition: glext.h:6217
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
#define f
Definition: ke_i.h:83
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by START_TEST().

◆ test___getmainargs_parent()

static void test___getmainargs_parent ( char name)
static

Definition at line 194 of file data.c.

195 {
196  char cmdline[3*MAX_PATH];
197  char tmppath[MAX_PATH], filepath[MAX_PATH];
200  FILE *f;
201  int ret;
202 
203  ok(GetTempPathA(MAX_PATH, tmppath) != 0, "GetTempPath failed\n");
204  sprintf(cmdline, "%s data %s*\\* %swine_test/*", name, tmppath, tmppath);
205 
206  sprintf(filepath, "%swine_test", tmppath);
207  ret = _mkdir(filepath);
208  ok(!ret, "_mkdir failed: %d\n", errno);
209  sprintf(filepath, "%swine_test\\a", tmppath);
210  f = fopen(filepath, "w");
211  ok(f != NULL, "fopen(%s) failed: %d\n", filepath, errno);
212  fclose(f);
213  sprintf(filepath, "%swine_test\\test", tmppath);
214  f = fopen(filepath, "w");
215  ok(f != NULL, "fopen(%s) failed: %d\n", filepath, errno);
216  fclose(f);
217 
218  memset(&startup, 0, sizeof(startup));
219  startup.cb = sizeof(startup);
222 
223  _unlink(filepath);
224  sprintf(filepath, "%swine_test\\a", tmppath);
225  _unlink(filepath);
226  sprintf(filepath, "%swine_test", tmppath);
227  _rmdir(filepath);
228 }
#define TRUE
Definition: types.h:120
int startup(int argc, const char *argv[])
Definition: startup.c:430
#define CREATE_DEFAULT_ERROR_MODE
Definition: winbase.h:194
static HANDLE proc()
Definition: pdb.c:32
TCHAR * cmdline
Definition: stretchblt.cpp:32
int errno
#define NORMAL_PRIORITY_CLASS
Definition: winbase.h:181
#define sprintf(buf, format,...)
Definition: sprintf.c:55
_Check_return_ _CRTIMP int __cdecl _rmdir(_In_z_ const char *_Path)
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP int __cdecl _unlink(_In_z_ const char *_Filename)
GLfloat f
Definition: glext.h:7540
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)
Definition: proc.c:4742
#define MAX_PATH
Definition: compat.h:26
int ret
_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)
void winetest_wait_child_process(HANDLE process)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
#define f
Definition: ke_i.h:83
#define ok(value,...)
Definition: atltest.h:57
_Check_return_ _CRTIMP int __cdecl _mkdir(_In_z_ const char *_Path)
Definition: name.c:38
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_get_pgmptr()

static void test_get_pgmptr ( void  )
static

Definition at line 118 of file data.c.

119 {
120  char *pgm = NULL;
121  int res;
122 
123  if (!p_get_pgmptr)
124  return;
125 
126  res = p_get_pgmptr(&pgm);
127 
128  ok( res == 0, "Wrong _get_pgmptr return value %d expected 0\n", res);
129  ok( pgm != NULL, "_get_pgmptr returned a NULL pointer\n" );
130 }
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613

Referenced by START_TEST().

◆ test_initterm()

static void test_initterm ( void  )
static

Definition at line 56 of file data.c.

57 {
58  int i;
59  static _INITTERMFUN callbacks[4];
60 
61  if (!p_initterm)
62  return;
63 
64  for (i = 0; i < 4; i++)
65  {
67  }
68 
69  initterm_test(&callbacks[0], &callbacks[1], 1);
70  initterm_test(&callbacks[0], &callbacks[2], 2);
71  initterm_test(&callbacks[0], &callbacks[3], 3);
72 
73  callbacks[1] = NULL;
74  initterm_test(&callbacks[0], &callbacks[3], 2);
75 }
#define initterm_test(start, end, expected)
Definition: data.c:51
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
void(__cdecl * _INITTERMFUN)(void)
Definition: data.c:39
static void __cdecl initcallback(void)
Definition: data.c:46
static int callbacks
Definition: xmllint.c:873

Referenced by START_TEST().

◆ test_initvar()

static void test_initvar ( HMODULE  hmsvcrt)
static

Definition at line 77 of file data.c.

78 {
79  OSVERSIONINFOA osvi = { sizeof(OSVERSIONINFOA) };
80  int *pp_winver = (int*)GetProcAddress(hmsvcrt, "_winver");
81  int *pp_winmajor = (int*)GetProcAddress(hmsvcrt, "_winmajor");
82  int *pp_winminor = (int*)GetProcAddress(hmsvcrt, "_winminor");
83  int *pp_osver = (int*)GetProcAddress(hmsvcrt, "_osver");
84  int *pp_osplatform = (int*)GetProcAddress(hmsvcrt, "_osplatform");
85  unsigned int winver, winmajor, winminor, osver, osplatform;
86 
87  if( !( pp_winmajor && pp_winminor && pp_winver)) {
88  win_skip("_winver variables are not available\n");
89  return;
90  }
91  winver = *pp_winver;
92  winminor = *pp_winminor;
93  winmajor = *pp_winmajor;
95  ok( winminor == osvi.dwMinorVersion, "Wrong value for _winminor %02x expected %02x\n",
96  winminor, osvi.dwMinorVersion);
97  ok( winmajor == osvi.dwMajorVersion, "Wrong value for _winmajor %02x expected %02x\n",
98  winmajor, osvi.dwMajorVersion);
99  ok( winver == ((osvi.dwMajorVersion << 8) | osvi.dwMinorVersion),
100  "Wrong value for _winver %02x expected %02x\n",
101  winver, ((osvi.dwMajorVersion << 8) | osvi.dwMinorVersion));
102  if( !pp_osver || !pp_osplatform ) {
103  win_skip("_osver variables are not available\n");
104  return;
105  }
106  osver = *pp_osver;
107  osplatform = *pp_osplatform;
108  ok( osver == (osvi.dwBuildNumber & 0xffff) ||
109  ((osvi.dwBuildNumber >> 24) == osvi.dwMajorVersion &&
110  ((osvi.dwBuildNumber >> 16) & 0xff) == osvi.dwMinorVersion), /* 95/98/ME */
111  "Wrong value for _osver %04x expected %04x\n",
112  osver, osvi.dwBuildNumber);
113  ok(osplatform == osvi.dwPlatformId,
114  "Wrong value for _osplatform %x expected %x\n",
115  osplatform, osvi.dwPlatformId);
116 }
ULONG dwMajorVersion
Definition: rtltypes.h:234
OSVERSIONINFO osvi
Definition: ver.c:28
BOOL WINAPI GetVersionExA(IN LPOSVERSIONINFOA lpVersionInformation)
Definition: version.c:69
ULONG dwBuildNumber
Definition: rtltypes.h:236
ULONG dwMinorVersion
Definition: rtltypes.h:235
struct _OSVERSIONINFOA OSVERSIONINFOA
ULONG dwPlatformId
Definition: rtltypes.h:237
#define ok(value,...)
Definition: atltest.h:57
#define GetProcAddress(x, y)
Definition: compat.h:418
#define win_skip
Definition: test.h:150

Referenced by START_TEST().

◆ void()

static void ( __cdecl p_initterm)
static

Referenced by get_host_winver().

Variable Documentation

◆ callbacked

int callbacked
static

Definition at line 44 of file data.c.

Referenced by initcallback().

◆ end

Definition at line 40 of file data.c.