1 /* COPYRIGHT: See COPYING in the top level directory
2 * PROJECT: ReactOS hive maker
3 * FILE: tools/mkhive/rtl.c
4 * PURPOSE: Runtime Library
17 * If source is NULL the length of source is assumed to be 0.
21 IN OUT PANSI_STRING DestinationString
,
22 IN PCSTR SourceString
)
28 DestSize
= strlen(SourceString
);
29 DestinationString
->Length
= (USHORT
)DestSize
;
30 DestinationString
->MaximumLength
= (USHORT
)DestSize
+ sizeof(CHAR
);
34 DestinationString
->Length
= 0;
35 DestinationString
->MaximumLength
= 0;
38 DestinationString
->Buffer
= (PCHAR
)SourceString
;
45 * If source is NULL the length of source is assumed to be 0.
49 IN OUT PUNICODE_STRING DestinationString
,
50 IN PCWSTR SourceString
)
56 DestSize
= utf16_wcslen(SourceString
) * sizeof(WCHAR
);
57 DestinationString
->Length
= (USHORT
)DestSize
;
58 DestinationString
->MaximumLength
= (USHORT
)DestSize
+ sizeof(WCHAR
);
62 DestinationString
->Length
= 0;
63 DestinationString
->MaximumLength
= 0;
66 DestinationString
->Buffer
= (PWCHAR
)SourceString
;
70 RtlAnsiStringToUnicodeString(
71 IN OUT PUNICODE_STRING UniDest
,
72 IN PANSI_STRING AnsiSource
,
73 IN BOOLEAN AllocateDestinationString
)
79 Length
= AnsiSource
->Length
* sizeof(WCHAR
);
80 if (Length
> MAXUSHORT
) return STATUS_INVALID_PARAMETER_2
;
81 UniDest
->Length
= (USHORT
)Length
;
83 if (AllocateDestinationString
)
85 UniDest
->MaximumLength
= (USHORT
)Length
+ sizeof(WCHAR
);
86 UniDest
->Buffer
= (PWSTR
) malloc(UniDest
->MaximumLength
);
88 return STATUS_NO_MEMORY
;
90 else if (UniDest
->Length
>= UniDest
->MaximumLength
)
92 return STATUS_BUFFER_OVERFLOW
;
95 WideString
= (PUCHAR
)UniDest
->Buffer
;
96 for (i
= 0; i
<= AnsiSource
->Length
; i
++)
98 WideString
[2 * i
+ 0] = AnsiSource
->Buffer
[i
];
99 WideString
[2 * i
+ 1] = 0;
101 return STATUS_SUCCESS
;
105 RtlUpcaseUnicodeChar(
114 return (Source
- ('a' - 'A'));
118 return Source
+ (SHORT
)Offset
;
123 OUT PLARGE_INTEGER CurrentTime
)
125 CurrentTime
->QuadPart
= 0;
130 IN POOL_TYPE PoolType
,
131 IN SIZE_T NumberOfBytes
)
133 return (PVOID
) malloc(NumberOfBytes
);
150 va_start(ap
, Format
);
159 RtlAssert(PVOID FailedAssertion
,
166 DbgPrint("Assertion \'%s\' failed at %s line %d: %s\n",
167 (PCHAR
)FailedAssertion
,
174 DbgPrint("Assertion \'%s\' failed at %s line %d\n",
175 (PCHAR
)FailedAssertion
,