2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS hive maker
4 * FILE: tools/mkhive/rtl.c
5 * PURPOSE: Runtime Library
11 /* gcc defaults to cdecl */
24 * If source is NULL the length of source is assumed to be 0.
28 IN OUT PUNICODE_STRING DestinationString
,
29 IN PCWSTR SourceString
)
35 DestSize
= strlenW(SourceString
) * sizeof(WCHAR
);
36 DestinationString
->Length
= (USHORT
)DestSize
;
37 DestinationString
->MaximumLength
= (USHORT
)DestSize
+ sizeof(WCHAR
);
41 DestinationString
->Length
= 0;
42 DestinationString
->MaximumLength
= 0;
45 DestinationString
->Buffer
= (PWCHAR
)SourceString
;
49 RtlCompareUnicodeString(
50 IN PCUNICODE_STRING String1
,
51 IN PCUNICODE_STRING String2
,
52 IN BOOLEAN CaseInSensitive
)
57 for (i
= 0; i
<= String1
->Length
/ sizeof(WCHAR
) && i
<= String2
->Length
/ sizeof(WCHAR
); i
++)
61 c1
= RtlUpcaseUnicodeChar(String1
->Buffer
[i
]);
62 c2
= RtlUpcaseUnicodeChar(String2
->Buffer
[i
]);
66 c1
= String1
->Buffer
[i
];
67 c2
= String2
->Buffer
[i
];
89 return (Source
- ('a' - 'A'));
93 return Source
+ (SHORT
)Offset
;
98 OUT PLARGE_INTEGER CurrentTime
)
100 CurrentTime
->QuadPart
= 0;
105 IN POOL_TYPE PoolType
,
106 IN SIZE_T NumberOfBytes
)
108 return (PVOID
) malloc(NumberOfBytes
);
125 va_start(ap
, Format
);
134 RtlAssert(PVOID FailedAssertion
,
141 DbgPrint("Assertion \'%s\' failed at %s line %d: %s\n",
142 (PCHAR
)FailedAssertion
,
149 DbgPrint("Assertion \'%s\' failed at %s line %d\n",
150 (PCHAR
)FailedAssertion
,
162 IN ULONG BugCheckCode
,
163 IN ULONG_PTR BugCheckParameter1
,
164 IN ULONG_PTR BugCheckParameter2
,
165 IN ULONG_PTR BugCheckParameter3
,
166 IN ULONG_PTR BugCheckParameter4
)
169 printf("*** STOP: 0x%08X (0x%p,0x%p,0x%p,0x%p)",
171 (PVOID
)BugCheckParameter1
,
172 (PVOID
)BugCheckParameter2
,
173 (PVOID
)BugCheckParameter3
,
174 (PVOID
)BugCheckParameter4
);
178 unsigned char BitScanForward(ULONG
* Index
, unsigned long Mask
)
181 while (Mask
&& ((Mask
& 1) == 0))
189 unsigned char BitScanReverse(ULONG
* const Index
, unsigned long Mask
)
192 while (Mask
&& ((Mask
& (1 << 31)) == 0))