2 * COPYRIGHT: GNU GENERAL PUBLIC LICENSE VERSION 2
3 * PROJECT: ReiserFs file system driver for Windows NT/2000/XP/Vista.
6 * PROGRAMMER: Mark Piper, Matt Wu, Bo Brantén.
11 /* INCLUDES *****************************************************************/
15 /* GLOBALS ***************************************************************/
17 extern PRFSD_GLOBAL RfsdGlobal
;
19 /* DEFINITIONS *************************************************************/
22 #pragma alloc_text(PAGE, RfsdLog2)
23 #pragma alloc_text(PAGE, RfsdSysTime)
24 #pragma alloc_text(PAGE, RfsdInodeTime)
25 #pragma alloc_text(PAGE, RfsdOEMToUnicode)
26 #pragma alloc_text(PAGE, RfsdUnicodeToOEM)
47 RfsdSysTime (IN ULONG i_time
)
49 LARGE_INTEGER SysTime
;
53 RtlSecondsSince1970ToTime(i_time
, &SysTime
);
59 RfsdInodeTime (IN LARGE_INTEGER SysTime
)
65 RtlTimeToSecondsSince1970(&SysTime
, &RfsdTime
);
72 IN OUT PUNICODE_STRING Unicode
,
79 /* Count the length of the resulting Unicode. */
80 for (i
= 0; i
< Mbs
->Length
; i
+= mbc
) {
82 mbc
= PAGE_TABLE
->char2uni(
83 (PUCHAR
)&(Mbs
->Buffer
[i
]),
90 /* Invalid character. */
98 if (Unicode
->MaximumLength
< Length
) {
107 for (i
= 0; i
< Mbs
->Length
; i
+= mbc
) {
109 mbc
= PAGE_TABLE
->char2uni(
110 (PUCHAR
)&(Mbs
->Buffer
[i
]),
114 Unicode
->Buffer
[Unicode
->Length
/2] = uc
;
116 Unicode
->Length
+= 2;
125 IN OUT PANSI_STRING Mbs
,
126 IN PUNICODE_STRING Unicode
)
132 /* Count the length of the resulting mbc-8. */
133 for (i
= 0; i
< (Unicode
->Length
/ 2); i
++) {
135 RtlZeroMemory(mbs
, 0x10);
136 mbc
= PAGE_TABLE
->uni2char(
144 /* Invalid character. */
153 if (Mbs
->MaximumLength
< Length
) {
161 for (i
= 0; i
< (Unicode
->Length
/ 2); i
++) {
163 mbc
= PAGE_TABLE
->uni2char(
170 (PUCHAR
)&(Mbs
->Buffer
[Mbs
->Length
]),
175 Mbs
->Length
+= (USHORT
)mbc
;
183 RfsdOEMToUnicodeSize(
188 return RfsdMbsToUnicode(NULL
, Oem
);
191 return RtlOemStringToCountedUnicodeSize(Oem
);
196 IN OUT PUNICODE_STRING Unicode
,
204 Status
= RfsdMbsToUnicode(Unicode
, Oem
);
206 if (Status
== Unicode
->Length
) {
207 Status
= STATUS_SUCCESS
;
209 Status
= STATUS_UNSUCCESSFUL
;
216 Status
= RtlOemStringToUnicodeString(
221 if (!NT_SUCCESS(Status
))
233 RfsdUnicodeToOEMSize(
234 IN PUNICODE_STRING Unicode
239 return RfsdUnicodeToMbs(NULL
, Unicode
);
242 return RtlxUnicodeStringToOemSize(Unicode
);
247 IN OUT POEM_STRING Oem
,
248 IN PUNICODE_STRING Unicode
)
256 Status
= RfsdUnicodeToMbs(Oem
, Unicode
);
258 if (Status
== Oem
->Length
) {
259 Status
= STATUS_SUCCESS
;
261 Status
= STATUS_UNSUCCESSFUL
;
267 Status
= RtlUnicodeStringToOemString(
272 if (!NT_SUCCESS(Status
))