ReactOS  0.4.14-dev-114-gc8cbd56
rtl.c File Reference
#include <stdlib.h>
#include <stdarg.h>
#include "mkhive.h"
#include <bitmap.c>
Include dependency graph for rtl.c:

Go to the source code of this file.

Functions

VOID NTAPI RtlInitUnicodeString (IN OUT PUNICODE_STRING DestinationString, IN PCWSTR SourceString)
 
LONG NTAPI RtlCompareUnicodeString (IN PCUNICODE_STRING String1, IN PCUNICODE_STRING String2, IN BOOLEAN CaseInSensitive)
 
WCHAR NTAPI RtlUpcaseUnicodeChar (IN WCHAR Source)
 
VOID NTAPI KeQuerySystemTime (OUT PLARGE_INTEGER CurrentTime)
 
PVOID NTAPI ExAllocatePool (IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
 
VOID NTAPI ExFreePool (IN PVOID p)
 
ULONG __cdecl DbgPrint (IN CHAR *Format, IN ...)
 
VOID NTAPI RtlAssert (IN PVOID FailedAssertion, IN PVOID FileName, IN ULONG LineNumber, IN PCHAR Message OPTIONAL)
 
VOID NTAPI KeBugCheckEx (IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, IN ULONG_PTR BugCheckParameter3, IN ULONG_PTR BugCheckParameter4)
 
unsigned char BitScanForward (ULONG *Index, unsigned long Mask)
 
unsigned char BitScanReverse (ULONG *const Index, unsigned long Mask)
 

Function Documentation

◆ BitScanForward()

unsigned char BitScanForward ( ULONG Index,
unsigned long  Mask 
)

Definition at line 177 of file rtl.c.

178 {
179  *Index = 0;
180  while (Mask && ((Mask & 1) == 0))
181  {
182  Mask >>= 1;
183  ++(*Index);
184  }
185  return Mask ? 1 : 0;
186 }
static const UCHAR Index[8]
Definition: usbohci.c:18

◆ BitScanReverse()

unsigned char BitScanReverse ( ULONG *const  Index,
unsigned long  Mask 
)

Definition at line 188 of file rtl.c.

189 {
190  *Index = 0;
191  while (Mask && ((Mask & (1 << 31)) == 0))
192  {
193  Mask <<= 1;
194  ++(*Index);
195  }
196  return Mask ? 1 : 0;
197 }
static const UCHAR Index[8]
Definition: usbohci.c:18

◆ DbgPrint()

ULONG __cdecl DbgPrint ( IN CHAR Format,
IN ...   
)

Definition at line 120 of file rtl.c.

123 {
124  va_list ap;
125  va_start(ap, Format);
126  vprintf(Format, ap);
127  va_end(ap);
128 
129  return 0;
130 }
#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 va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32

Referenced by RtlAssert().

◆ ExAllocatePool()

PVOID NTAPI ExAllocatePool ( IN POOL_TYPE  PoolType,
IN SIZE_T  NumberOfBytes 
)

Definition at line 104 of file rtl.c.

107 {
108  return (PVOID) malloc(NumberOfBytes);
109 }
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:998
#define malloc
Definition: debug_ros.c:4

◆ ExFreePool()

VOID NTAPI ExFreePool ( IN PVOID  p)

Definition at line 112 of file rtl.c.

114 {
115  free(p);
116 }
#define free
Definition: debug_ros.c:5
GLfloat GLfloat p
Definition: glext.h:8902

◆ KeBugCheckEx()

VOID NTAPI KeBugCheckEx ( IN ULONG  BugCheckCode,
IN ULONG_PTR  BugCheckParameter1,
IN ULONG_PTR  BugCheckParameter2,
IN ULONG_PTR  BugCheckParameter3,
IN ULONG_PTR  BugCheckParameter4 
)

Definition at line 161 of file rtl.c.

167 {
168  printf("*** STOP: 0x%08X (0x%p,0x%p,0x%p,0x%p)",
169  BugCheckCode,
170  (PVOID)BugCheckParameter1,
171  (PVOID)BugCheckParameter2,
172  (PVOID)BugCheckParameter3,
173  (PVOID)BugCheckParameter4);
174  ASSERT(FALSE);
175 }
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define printf
Definition: config.h:203

◆ KeQuerySystemTime()

VOID NTAPI KeQuerySystemTime ( OUT PLARGE_INTEGER  CurrentTime)

Definition at line 97 of file rtl.c.

99 {
100  CurrentTime->QuadPart = 0;
101 }

◆ RtlAssert()

VOID NTAPI RtlAssert ( IN PVOID  FailedAssertion,
IN PVOID  FileName,
IN ULONG  LineNumber,
IN PCHAR Message  OPTIONAL 
)

Definition at line 134 of file rtl.c.

138 {
139  if (Message != NULL)
140  {
141  DbgPrint("Assertion \'%s\' failed at %s line %u: %s\n",
142  (PCHAR)FailedAssertion,
143  (PCHAR)FileName,
144  LineNumber,
145  Message);
146  }
147  else
148  {
149  DbgPrint("Assertion \'%s\' failed at %s line %u\n",
150  (PCHAR)FailedAssertion,
151  (PCHAR)FileName,
152  LineNumber);
153  }
154 
155  //DbgBreakPoint();
156 }
signed char * PCHAR
Definition: retypes.h:7
ULONG __cdecl DbgPrint(IN CHAR *Format, IN ...)
Definition: rtl.c:120
smooth NULL
Definition: ftsmooth.c:416
CHAR Message[80]
Definition: alive.c:5
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1206

◆ RtlCompareUnicodeString()

LONG NTAPI RtlCompareUnicodeString ( IN PCUNICODE_STRING  String1,
IN PCUNICODE_STRING  String2,
IN BOOLEAN  CaseInSensitive 
)

Definition at line 49 of file rtl.c.

53 {
54  USHORT i;
55  WCHAR c1, c2;
56 
57  for (i = 0; i <= String1->Length / sizeof(WCHAR) && i <= String2->Length / sizeof(WCHAR); i++)
58  {
59  if (CaseInSensitive)
60  {
61  c1 = RtlUpcaseUnicodeChar(String1->Buffer[i]);
62  c2 = RtlUpcaseUnicodeChar(String2->Buffer[i]);
63  }
64  else
65  {
66  c1 = String1->Buffer[i];
67  c2 = String2->Buffer[i];
68  }
69 
70  if (c1 < c2)
71  return -1;
72  else if (c1 > c2)
73  return 1;
74  }
75 
76  return 0;
77 }
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
_In_ const STRING _In_ BOOLEAN CaseInSensitive
Definition: rtlfuncs.h:2292
WCHAR NTAPI RtlUpcaseUnicodeChar(IN WCHAR Source)
Definition: rtl.c:80
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned short USHORT
Definition: pedump.c:61
_In_ const STRING * String2
Definition: rtlfuncs.h:2261

◆ RtlInitUnicodeString()

VOID NTAPI RtlInitUnicodeString ( IN OUT PUNICODE_STRING  DestinationString,
IN PCWSTR  SourceString 
)

Definition at line 27 of file rtl.c.

30 {
31  SIZE_T DestSize;
32 
33  if(SourceString)
34  {
35  DestSize = strlenW(SourceString) * sizeof(WCHAR);
36  DestinationString->Length = (USHORT)DestSize;
37  DestinationString->MaximumLength = (USHORT)DestSize + sizeof(WCHAR);
38  }
39  else
40  {
43  }
44 
46 }
static USHORT
Definition: rtl.c:96
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
unsigned short Length
Definition: sprintf.c:451
uint16_t * PWCHAR
Definition: typedefs.h:54
void * Buffer
Definition: sprintf.c:453
_Out_ _Inout_ POEM_STRING DestinationString
Definition: rtlfuncs.h:1869
__wchar_t WCHAR
Definition: xmlstorage.h:180
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1869
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned short MaximumLength
Definition: sprintf.c:452

Referenced by WdmlibRtlIsNtDdiVersionAvailable().

◆ RtlUpcaseUnicodeChar()

WCHAR NTAPI RtlUpcaseUnicodeChar ( IN WCHAR  Source)

Definition at line 80 of file rtl.c.

82 {
83  USHORT Offset;
84 
85  if (Source < 'a')
86  return Source;
87 
88  if (Source <= 'z')
89  return (Source - ('a' - 'A'));
90 
91  Offset = 0;
92 
93  return Source + (SHORT)Offset;
94 }
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
short SHORT
Definition: pedump.c:59
unsigned short USHORT
Definition: pedump.c:61
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167

Referenced by RtlCompareUnicodeString().