ReactOS  0.4.11-dev-433-g473ca91
strlen.c File Reference
#include <apitest.h>
#include <stdio.h>
#include <tchar.h>
#include <pseh/pseh2.h>
#include <ntstatus.h>
Include dependency graph for strlen.c:

Go to the source code of this file.

Macros

#define EFLAGS_DF   0x400L
 

Typedefs

typedef * PNTSTATUS
 
typedef size_t(* PFN_STRLEN )(const char *)
 

Functions

typedef _Return_type_success_ (return >=0) long NTSTATUS
 
void Test_strlen (PFN_STRLEN pstrlen)
 
 START_TEST (strlen)
 

Macro Definition Documentation

#define EFLAGS_DF   0x400L

Definition at line 26 of file strlen.c.

Referenced by KiInitializeCpu(), and Test_strlen().

Typedef Documentation

typedef size_t(* PFN_STRLEN)(const char *)

Definition at line 28 of file strlen.c.

typedef * PNTSTATUS

Definition at line 14 of file strlen.c.

Function Documentation

typedef _Return_type_success_ ( return >=  0)
START_TEST ( strlen  )

Definition at line 66 of file strlen.c.

67 {
69 #ifdef __GNUC__
70  Test_strlen(GCC_builtin_strlen);
71 #endif // __GNUC__
72 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
void Test_strlen(PFN_STRLEN pstrlen)
Definition: strlen.c:31
void Test_strlen ( PFN_STRLEN  pstrlen)

Definition at line 31 of file strlen.c.

Referenced by START_TEST().

32 {
33  size_t len;
34 #if defined(_M_IX86) || defined(_M_AMD64)
35  volatile uintptr_t eflags;
36  char *teststr = "a\0bcdefghijk";
37 #endif
38 
39  /* basic parameter tests */
40  StartSeh()
41  len = pstrlen(NULL);
43  (void)len;
44 
45  ok_int((int)pstrlen("test"), 4);
46 
47 #if defined(_M_IX86) || defined(_M_AMD64)
48  eflags = __readeflags();
49  __writeeflags(eflags | EFLAGS_DF);
50  len = pstrlen(teststr + 4);
51  eflags = __readeflags();
52  ok((eflags & EFLAGS_DF) != 0, "Direction flag in ELFAGS was changed.");
53 
54  /* Only test this for the exported versions, intrinsics might do it
55  differently. It's up to us to not do fishy stuff! Also crtdll does
56  not do it like this. */
57 #ifndef TEST_CRTDLL
58  if (pstrlen == strlen)
59  {
60  ok(len == 8, "Should not have gone backwards (got len %i)", (int)len);
61  }
62 #endif // TEST_CRTDLL
63 #endif
64 }
LOCAL struct eflags eflags[]
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ok_int(x, y)
Definition: sprintf.c:21
#define test
Definition: rosglue.h:37
#define StartSeh()
Definition: _sntprintf.h:16
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1560
unsigned int uintptr_t
Definition: crtdefs.h:300
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
Definition: intrin_x86.h:1555
GLenum GLsizei len
Definition: glext.h:6722
#define EFLAGS_DF
Definition: strlen.c:26
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17