ReactOS  0.4.15-dev-1070-ge1a01de
MultiByteToWideChar.c File Reference
#include "precomp.h"
Include dependency graph for MultiByteToWideChar.c:

Go to the source code of this file.

Classes

struct  ENTRY
 

Macros

#define CP932   932 /* Japanese Shift_JIS (SJIS) codepage */
 
#define MAX_BUFFER   10
 

Typedefs

typedef struct ENTRY ENTRY
 

Functions

static void TestEntry (const ENTRY *pEntry)
 
 START_TEST (MultiByteToWideChar)
 

Variables

static ULONG OsVersion
 
static const char UTF8_Japanese [] = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E"
 
static const char SJIS_Japanese [] = "\x93\xFA\x96\x7B\x8C\xEA"
 
static const ENTRY Entries []
 

Macro Definition Documentation

◆ CP932

#define CP932   932 /* Japanese Shift_JIS (SJIS) codepage */

Definition at line 18 of file MultiByteToWideChar.c.

◆ MAX_BUFFER

#define MAX_BUFFER   10

Definition at line 25 of file MultiByteToWideChar.c.

Typedef Documentation

◆ ENTRY

typedef struct ENTRY ENTRY

Function Documentation

◆ START_TEST()

START_TEST ( MultiByteToWideChar  )

Definition at line 297 of file MultiByteToWideChar.c.

298 {
300  size_t i;
301 
302  vi.dwOSVersionInfoSize = sizeof(vi);
303  if (RtlGetVersion(&vi) < 0)
304  {
305  skip("Failed to get OS version!\n");
306  return;
307  }
308 
309  OsVersion = (vi.dwMajorVersion << 8) | vi.dwMinorVersion;
310 
311  for (i = 0; i < _countof(Entries); ++i)
312  {
313  TestEntry(&Entries[i]);
314  }
315 }
static ULONG OsVersion
NTSTATUS NTAPI RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
Definition: version.c:158
struct msdos_volume_info vi
Definition: mkdosfs.c:435
static void TestEntry(const ENTRY *pEntry)
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
#define _countof(array)
Definition: sndvol32.h:68
#define for
Definition: utility.h:88
#define skip(...)
Definition: atltest.h:64
static const ENTRY Entries[]

◆ TestEntry()

static void TestEntry ( const ENTRY pEntry)
static

Definition at line 228 of file MultiByteToWideChar.c.

229 {
230  int ret, i;
232  DWORD Error;
233 
234  if ((OsVersion < pEntry->VersionRange[0]) ||
235  (OsVersion > pEntry->VersionRange[1]))
236  {
237  skip("Skipping entry from line %u (Version range %lx-%lx, current %lx)\n",
238  pEntry->LineNo,
239  pEntry->VersionRange[0],
240  pEntry->VersionRange[1],
241  OsVersion);
242  return;
243  }
244 
245  FillMemory(Buffer, sizeof(Buffer), 0x7F);
246  SetLastError(0xBEAF);
247 
248  if (pEntry->DestLen == 0)
249  {
250  /* dest is NULL */
251  ret = MultiByteToWideChar(pEntry->CodePage, pEntry->Flags, pEntry->Src,
252  pEntry->SrcLen, NULL, 0);
253  }
254  else
255  {
256  ok(pEntry->DestLen >= pEntry->CheckLen - 1,
257  "Line %d: DestLen was shorter than (CheckLen - 1)\n", pEntry->LineNo);
258 
259  if (pEntry->SamePointer)
260  {
261  /* src ptr == dest ptr */
262  ret = MultiByteToWideChar(pEntry->CodePage, pEntry->Flags,
263  (const char *)Buffer, pEntry->SrcLen,
264  Buffer, pEntry->DestLen);
265  }
266  else
267  {
268  /* src ptr != dest ptr */
269  ret = MultiByteToWideChar(pEntry->CodePage, pEntry->Flags,
270  pEntry->Src, pEntry->SrcLen,
271  Buffer, pEntry->DestLen);
272  }
273  }
274 
275  Error = GetLastError();
276 
277  /* check ret */
278  ok(ret == pEntry->Return, "Line %d: ret expected %d, got %d\n",
279  pEntry->LineNo, pEntry->Return, ret);
280 
281  /* check error code */
282  ok(Error == pEntry->Error,
283  "Line %d: Wrong last error. Expected %lu, got %lu\n",
284  pEntry->LineNo, pEntry->Error, Error);
285 
286  if (pEntry->DestLen)
287  {
288  /* check buffer */
289  for (i = 0; i < pEntry->CheckLen; ++i)
290  {
291  ok(Buffer[i] == pEntry->CheckDest[i], "Line %d: Buffer[%d] expected %d, got %d\n",
292  pEntry->LineNo, i, pEntry->CheckDest[i], Buffer[i]);
293  }
294  }
295 }
static ULONG OsVersion
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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
WCHAR CheckDest[MAX_BUFFER]
Definition: bufpool.h:45
ULONG VersionRange[2]
const char * Src
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
BOOL Error
Definition: chkdsk.c:66
#define SetLastError(x)
Definition: compat.h:500
int CodePage
int ret
#define ok(value,...)
Definition: atltest.h:57
BOOL SamePointer
#define MultiByteToWideChar
Definition: compat.h:110
#define skip(...)
Definition: atltest.h:64
#define MAX_BUFFER

Referenced by DriverEntry(), DriverIoControl(), FindTest(), ListTests(), and START_TEST().

Variable Documentation

◆ Entries

const ENTRY Entries[]
static

Definition at line 44 of file MultiByteToWideChar.c.

Referenced by START_TEST().

◆ OsVersion

ULONG OsVersion
static

Definition at line 11 of file MultiByteToWideChar.c.

Referenced by START_TEST(), and TestEntry().

◆ SJIS_Japanese

const char SJIS_Japanese[] = "\x93\xFA\x96\x7B\x8C\xEA"
static

Definition at line 23 of file MultiByteToWideChar.c.

◆ UTF8_Japanese

const char UTF8_Japanese[] = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E"
static

Definition at line 21 of file MultiByteToWideChar.c.