ReactOS 0.4.15-dev-8109-gd7be748
MultiByteToWideChar.c File Reference
#include "precomp.h"
#include <versionhelpers.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 16 of file MultiByteToWideChar.c.

◆ MAX_BUFFER

#define MAX_BUFFER   10

Definition at line 23 of file MultiByteToWideChar.c.

Typedef Documentation

◆ ENTRY

typedef struct ENTRY ENTRY

Function Documentation

◆ START_TEST()

START_TEST ( MultiByteToWideChar  )

Definition at line 295 of file MultiByteToWideChar.c.

296{
298 size_t i;
299
300 vi.dwOSVersionInfoSize = sizeof(vi);
301 if (RtlGetVersion(&vi) < 0)
302 {
303 skip("Failed to get OS version!\n");
304 return;
305 }
306
307 OsVersion = (vi.dwMajorVersion << 8) | vi.dwMinorVersion;
308
309 /* NOTE: We use Win10's MultiByteToWideChar behaviour due to security reason. */
310 if (IsReactOS())
311 OsVersion = 0xa00;
312
313 for (i = 0; i < _countof(Entries); ++i)
314 {
316 }
317}
static ULONG OsVersion
static const ENTRY Entries[]
static void TestEntry(const ENTRY *pEntry)
#define skip(...)
Definition: atltest.h:64
NTSTATUS NTAPI RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
Definition: version.c:158
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
if(dx< 0)
Definition: linetemp.h:194
struct msdos_volume_info vi
Definition: mkdosfs.c:440
#define _countof(array)
Definition: sndvol32.h:70

◆ TestEntry()

static void TestEntry ( const ENTRY pEntry)
static

Definition at line 226 of file MultiByteToWideChar.c.

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

Referenced by DriverEntry(), DriverIoControl(), DrvEvaluateBifObject(), DrvEvaluateDsmObject(), DrvEvaluateGtmObject(), DrvEvaluatePclObject(), DrvEvaluatePrtObject(), DrvEvaluateStmObject(), FindTest(), ListTests(), START_TEST(), and Test_SingleInstruction().

Variable Documentation

◆ Entries

◆ OsVersion

ULONG OsVersion
static

Definition at line 12 of file MultiByteToWideChar.c.

Referenced by RtlInitializeCriticalSectionEx(), START_TEST(), and TestEntry().

◆ SJIS_Japanese

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

Definition at line 21 of file MultiByteToWideChar.c.

◆ UTF8_Japanese

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

Definition at line 19 of file MultiByteToWideChar.c.