ReactOS  0.4.14-dev-115-g4576127
misc.c File Reference
#include "ext2fs.h"
Include dependency graph for misc.c:

Go to the source code of this file.

Functions

ULONG Ext2Log2 (ULONG Value)
 
LARGE_INTEGER Ext2NtTime (IN ULONG i_time)
 
ULONG Ext2LinuxTime (IN LARGE_INTEGER SysTime)
 
ULONG Ext2MbsToUnicode (struct nls_table *PageTable, IN OUT PUNICODE_STRING Unicode, IN PANSI_STRING Mbs)
 
ULONG Ext2UnicodeToMbs (struct nls_table *PageTable, IN OUT PANSI_STRING Mbs, IN PUNICODE_STRING Unicode)
 
ULONG Ext2OEMToUnicodeSize (IN PEXT2_VCB Vcb, IN PANSI_STRING Oem)
 
NTSTATUS Ext2OEMToUnicode (IN PEXT2_VCB Vcb, IN OUT PUNICODE_STRING Unicode, IN POEM_STRING Oem)
 
ULONG Ext2UnicodeToOEMSize (IN PEXT2_VCB Vcb, IN PUNICODE_STRING Unicode)
 
NTSTATUS Ext2UnicodeToOEM (IN PEXT2_VCB Vcb, IN OUT POEM_STRING Oem, IN PUNICODE_STRING Unicode)
 
VOID Ext2Sleep (ULONG ms)
 
int Ext2LinuxError (NTSTATUS Status)
 
NTSTATUS Ext2WinntError (int rc)
 
BOOLEAN Ext2IsDot (PUNICODE_STRING name)
 
BOOLEAN Ext2IsDotDot (PUNICODE_STRING name)
 

Variables

PEXT2_GLOBAL Ext2Global
 

Function Documentation

◆ Ext2IsDot()

BOOLEAN Ext2IsDot ( PUNICODE_STRING  name)

Definition at line 524 of file misc.c.

525 {
526  return (name->Length == 2 && name->Buffer[0] == L'.');
527 }
static const WCHAR L[]
Definition: oid.c:1250
Definition: name.c:36

Referenced by Ext2SearchMcbWithoutLock().

◆ Ext2IsDotDot()

BOOLEAN Ext2IsDotDot ( PUNICODE_STRING  name)

Definition at line 529 of file misc.c.

530 {
531  return (name->Length == 4 && name->Buffer[0] == L'.' &&
532  name->Buffer[1] == L'.');
533 }
static const WCHAR L[]
Definition: oid.c:1250
Definition: name.c:36

Referenced by Ext2SearchMcbWithoutLock().

◆ Ext2LinuxError()

int Ext2LinuxError ( NTSTATUS  Status)

Definition at line 304 of file misc.c.

305 {
306  switch (Status) {
308  return (-EACCES);
309 
311  return (-EFAULT);
312 
314  return (-ETOOSMALL);
315 
317  return (-EINVAL);
318 
321  return (-EOPNOTSUPP);
322 
325  return (-EADDRNOTAVAIL);
326 
328  case STATUS_NO_SUCH_FILE:
331  case STATUS_NETWORK_BUSY:
334  return (-ENETDOWN);
335 
339  return (-ENETUNREACH);
340 
344  return (-ECONNABORTED);
345 
347  case STATUS_LINK_FAILED:
351  return (-ECONNRESET);
352 
354  return (-ENOMEM);
355 
357  case STATUS_NO_MEMORY:
365  return (-ENOBUFS);
366 
368  return (-ENOTCONN);
369 
371  return (-ESHUTDOWN);
372 
373  case STATUS_TIMEOUT:
374  case STATUS_IO_TIMEOUT:
375  case STATUS_LINK_TIMEOUT:
376  return (-ETIMEDOUT);
377 
380  return (-ECONNREFUSED);
381 
383  return (-EHOSTUNREACH);
384 
385  case STATUS_CANT_WAIT:
386  case STATUS_PENDING:
387  return (-EAGAIN);
388 
390  return (-EIO);
391 
392  case STATUS_CANCELLED:
394  return (-EINTR);
395 
398  return (-EMSGSIZE);
399 
401  return (-EADDRINUSE);
402  }
403 
404  if (NT_SUCCESS (Status))
405  return 0;
406 
407  return (-EINVAL);
408 }
#define STATUS_WORKING_SET_QUOTA
Definition: ntstatus.h:383
#define STATUS_INVALID_CONNECTION
Definition: ntstatus.h:542
#define STATUS_CONNECTION_REFUSED
Definition: ntstatus.h:684
#define STATUS_CONNECTION_RESET
Definition: ntstatus.h:643
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_TOO_MANY_ADDRESSES
Definition: ntstatus.h:639
#define STATUS_QUOTA_EXCEEDED
Definition: ntstatus.h:290
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:398
#define STATUS_REMOTE_RESOURCES
Definition: ntstatus.h:539
#define ECONNABORTED
Definition: errno.h:114
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
Definition: arc.h:38
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
Definition: arc.h:39
#define EINTR
Definition: acclib.h:80
#define EOPNOTSUPP
Definition: errno.h:104
#define ENOBUFS
Definition: errno.h:116
Definition: arc.h:48
#define STATUS_PAGEFILE_QUOTA
Definition: ntstatus.h:230
#define STATUS_HOST_UNREACHABLE
Definition: ntstatus.h:691
#define STATUS_ADDRESS_ALREADY_EXISTS
Definition: ntstatus.h:640
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define ECONNREFUSED
Definition: errno.h:122
#define STATUS_TOO_MANY_PAGING_FILES
Definition: ntstatus.h:373
#define STATUS_LINK_TIMEOUT
Definition: ntstatus.h:541
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
#define ENETUNREACH
Definition: errno.h:112
#define STATUS_REMOTE_DISCONNECT
Definition: ntstatus.h:538
#define ECONNRESET
Definition: errno.h:115
#define STATUS_BAD_NETWORK_PATH
Definition: ntstatus.h:412
Definition: arc.h:35
#define ETOOSMALL
Definition: errno.h:149
#define STATUS_INVALID_BUFFER_SIZE
Definition: ntstatus.h:636
#define STATUS_CONNECTION_DISCONNECTED
Definition: ntstatus.h:642
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define ENOTCONN
Definition: errno.h:118
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
#define STATUS_NETWORK_BUSY
Definition: ntstatus.h:413
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define EADDRNOTAVAIL
Definition: errno.h:110
#define STATUS_CONNECTION_ABORTED
Definition: ntstatus.h:695
Definition: arc.h:34
#define STATUS_COMMITMENT_LIMIT
Definition: ntstatus.h:523
#define STATUS_TRANSACTION_ABORTED
Definition: ntstatus.h:645
#define EADDRINUSE
Definition: errno.h:109
#define STATUS_REQUEST_ABORTED
Definition: udferr_usr.h:183
Status
Definition: gdiplustypes.h:24
#define STATUS_INVALID_ADDRESS_COMPONENT
Definition: ntstatus.h:637
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ESHUTDOWN
Definition: errno.h:119
#define STATUS_INVALID_ADDRESS
Definition: ntstatus.h:543
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define STATUS_NO_SUCH_FILE
Definition: udferr_usr.h:137
#define STATUS_PROTOCOL_UNREACHABLE
Definition: ntstatus.h:692
Definition: arc.h:40
#define STATUS_IO_TIMEOUT
Definition: udferr_usr.h:163
#define ENETDOWN
Definition: errno.h:111
#define STATUS_REMOTE_NOT_LISTENING
Definition: ntstatus.h:410
#define STATUS_LOCAL_DISCONNECT
Definition: ntstatus.h:537
#define STATUS_UNEXPECTED_NETWORK_ERROR
Definition: ntstatus.h:418
#define EHOSTUNREACH
Definition: errno.h:124
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
#define EMSGSIZE
Definition: errno.h:97
#define ETIMEDOUT
Definition: errno.h:121
#define STATUS_LINK_FAILED
Definition: ntstatus.h:540
#define STATUS_PORT_UNREACHABLE
Definition: ntstatus.h:693
#define STATUS_INVALID_NETWORK_RESPONSE
Definition: ntstatus.h:417
#define STATUS_CONFLICTING_ADDRESSES
Definition: ntstatus.h:247
#define STATUS_NETWORK_UNREACHABLE
Definition: ntstatus.h:690
#define STATUS_CANT_WAIT
Definition: ntstatus.h:438
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:65

Referenced by ext3_bread(), and ext4_new_meta_blocks().

◆ Ext2LinuxTime()

ULONG Ext2LinuxTime ( IN LARGE_INTEGER  SysTime)

Definition at line 51 of file misc.c.

52 {
53  ULONG Ext2Time = 0;
54 
55  if (!RtlTimeToSecondsSince1970(&SysTime, &Ext2Time)) {
58  RtlTimeToSecondsSince1970(&NtTime, &Ext2Time);
59  }
60 
61  return Ext2Time;
62 }
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
BOOLEAN NTAPI RtlTimeToSecondsSince1970(PLARGE_INTEGER Time, PULONG ElapsedSeconds)
_In_ PLARGE_INTEGER NtTime
Definition: fatprocs.h:1905
unsigned int ULONG
Definition: retypes.h:1

Referenced by Ext2Cleanup(), Ext2CreateInode(), Ext2DeleteFile(), Ext2FlushFile(), Ext2SetFileInformation(), Ext2SupersedeOrOverWriteFile(), and ext3_current_time().

◆ Ext2Log2()

ULONG Ext2Log2 ( ULONG  Value)

Definition at line 25 of file misc.c.

26 {
27  ULONG Order = 0;
28 
29  ASSERT(Value > 0);
30 
31  while (Value) {
32  Order++;
33  Value >>= 1;
34  }
35 
36  return (Order - 1);
37 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
unsigned int ULONG
Definition: retypes.h:1

Referenced by Ext2InitializeVcb().

◆ Ext2MbsToUnicode()

ULONG Ext2MbsToUnicode ( struct nls_table PageTable,
IN OUT PUNICODE_STRING  Unicode,
IN PANSI_STRING  Mbs 
)

Definition at line 66 of file misc.c.

70 {
71  ULONG Length = 0;
72  int i, mbc = 0;
73  WCHAR uc;
74 
75  /* Count the length of the resulting Unicode. */
76  for (i = 0; i < Mbs->Length; i += mbc) {
77 
78  mbc = PageTable->char2uni(
79  (PUCHAR)&(Mbs->Buffer[i]),
80  Mbs->Length - i,
81  &uc
82  );
83 
84  if (mbc <= 0) {
85 
86  /* invalid character. */
87  if (mbc == 0 && Length > 0) {
88  break;
89  }
90  return 0;
91  }
92 
93  Length += 2;
94  }
95 
96  if (Unicode) {
97  if (Unicode->MaximumLength < Length) {
98 
99  DbgBreak();
100  return 0;
101  }
102 
103  Unicode->Length = 0;
104  mbc = 0;
105 
106  for (i = 0; i < Mbs->Length; i += mbc) {
107 
108  mbc = PageTable->char2uni(
109  (PUCHAR)&(Mbs->Buffer[i]),
110  Mbs->Length - i,
111  &uc
112  );
113  Unicode->Buffer[Unicode->Length/2] = uc;
114  Unicode->Length += 2;
115  }
116  }
117 
118  return Length;
119 }
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
unsigned char * PUCHAR
Definition: retypes.h:3
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
char mbc
unsigned int ULONG
Definition: retypes.h:1
#define DbgBreak()
Definition: ext2fs.h:46

Referenced by Ext2OEMToUnicode(), and Ext2OEMToUnicodeSize().

◆ Ext2NtTime()

LARGE_INTEGER Ext2NtTime ( IN ULONG  i_time)

Definition at line 40 of file misc.c.

41 {
42  LARGE_INTEGER SysTime;
43 
44  SysTime.QuadPart = 0;
45  RtlSecondsSince1970ToTime(i_time, &SysTime);
46 
47  return SysTime;
48 }
NTSYSAPI VOID NTAPI RtlSecondsSince1970ToTime(_In_ ULONG SecondsSince1970, _Out_ PLARGE_INTEGER Time)
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by Ext2Cleanup(), Ext2FlushFile(), Ext2InitializeVcb(), Ext2LookupFile(), Ext2ProcessEntry(), Ext2RefreshSuper(), and Ext2SetFileInformation().

◆ Ext2OEMToUnicode()

NTSTATUS Ext2OEMToUnicode ( IN PEXT2_VCB  Vcb,
IN OUT PUNICODE_STRING  Unicode,
IN POEM_STRING  Oem 
)

Definition at line 206 of file misc.c.

211 {
213 
214 
215  if (Vcb->Codepage.PageTable) {
216  Status = Ext2MbsToUnicode(Vcb->Codepage.PageTable,
217  Unicode, Oem);
218 
219  if (Status >0 && Status == Unicode->Length) {
221  goto errorout;
222  }
223  }
224 
226  Unicode, Oem, FALSE );
227 
228  if (!NT_SUCCESS(Status)) {
229  DbgBreak();
230  goto errorout;
231  }
232 
233 errorout:
234 
235  return Status;
236 }
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG Ext2MbsToUnicode(struct nls_table *PageTable, IN OUT PUNICODE_STRING Unicode, IN PANSI_STRING Mbs)
Definition: misc.c:66
#define Vcb
Definition: cdprocs.h:1425
NTSYSAPI NTSTATUS NTAPI RtlOemStringToUnicodeString(PUNICODE_STRING DestinationString, PCOEM_STRING SourceString, BOOLEAN AllocateDestinationString)
Status
Definition: gdiplustypes.h:24
#define DbgBreak()
Definition: ext2fs.h:46
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by Ext2FillEntry(), Ext2FollowLink(), Ext2GetReparsePoint(), Ext2InitializeLabel(), and Ext2QueryDirectory().

◆ Ext2OEMToUnicodeSize()

ULONG Ext2OEMToUnicodeSize ( IN PEXT2_VCB  Vcb,
IN PANSI_STRING  Oem 
)

Definition at line 183 of file misc.c.

187 {
188  ULONG Length = 0;
189 
190  if (Vcb->Codepage.PageTable) {
191  Length = Ext2MbsToUnicode(Vcb->Codepage.PageTable, NULL, Oem);
192  if (Length > 0) {
193  goto errorout;
194  }
195  }
196 
198 
199 errorout:
200 
201  return Length;
202 }
smooth NULL
Definition: ftsmooth.c:416
ULONG Ext2MbsToUnicode(struct nls_table *PageTable, IN OUT PUNICODE_STRING Unicode, IN PANSI_STRING Mbs)
Definition: misc.c:66
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned int ULONG
Definition: retypes.h:1
#define RtlOemStringToCountedUnicodeSize(STRING)

Referenced by Ext2FillEntry(), Ext2FollowLink(), Ext2GetReparsePoint(), and Ext2QueryDirectory().

◆ Ext2Sleep()

VOID Ext2Sleep ( ULONG  ms)

Definition at line 297 of file misc.c.

298 {
300  Timeout.QuadPart = (LONGLONG)ms*1000*(-10); /* ms/1000 sec*/
302 }
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
int64_t LONGLONG
Definition: typedefs.h:66
static ULONG Timeout
Definition: ping.c:61

Referenced by Ext2AddMcbExtent(), Ext2AddMcbMetaExts(), Ext2AddVcbExtent(), Ext2ExpandBlock(), Ext2ExpandLast(), Ext2GetBlock(), Ext2QueueCloseRequest(), Ext2RemoveMcbExtent(), Ext2RemoveMcbMetaExts(), Ext2RemoveVcbExtent(), Ext2TruncateBlock(), get_block_bh_mdl(), and get_block_bh_pin().

◆ Ext2UnicodeToMbs()

ULONG Ext2UnicodeToMbs ( struct nls_table PageTable,
IN OUT PANSI_STRING  Mbs,
IN PUNICODE_STRING  Unicode 
)

Definition at line 122 of file misc.c.

126 {
127  ULONG Length = 0;
128  UCHAR mbs[0x10];
129  int i, mbc;
130 
131  /* Count the length of the resulting mbc-8. */
132  for (i = 0; i < (Unicode->Length / 2); i++) {
133 
134  RtlZeroMemory(mbs, 0x10);
135  mbc = PageTable->uni2char(
136  Unicode->Buffer[i],
137  mbs,
138  0x10
139  );
140 
141  if (mbc <= 0) {
142 
143  /* Invalid character. */
144  return 0;
145  }
146 
147  Length += mbc;
148  }
149 
150  if (Mbs) {
151 
152  if (Mbs->MaximumLength < Length) {
153 
154  DbgBreak();
155  return 0;
156  }
157 
158  Mbs->Length = 0;
159 
160  for (i = 0; i < (Unicode->Length / 2); i++) {
161 
162  mbc = PageTable->uni2char(
163  Unicode->Buffer[i],
164  mbs,
165  0x10
166  );
167 
169  (PUCHAR)&(Mbs->Buffer[Mbs->Length]),
170  &mbs[0],
171  mbc
172  );
173 
174  Mbs->Length += (USHORT)mbc;
175  }
176  }
177 
178  return Length;
179 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
unsigned char * PUCHAR
Definition: retypes.h:3
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_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned short USHORT
Definition: pedump.c:61
char mbc
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define DbgBreak()
Definition: ext2fs.h:46
char mbs[5]

Referenced by Ext2UnicodeToOEM(), and Ext2UnicodeToOEMSize().

◆ Ext2UnicodeToOEM()

NTSTATUS Ext2UnicodeToOEM ( IN PEXT2_VCB  Vcb,
IN OUT POEM_STRING  Oem,
IN PUNICODE_STRING  Unicode 
)

Definition at line 261 of file misc.c.

265 {
267 
268  if (Vcb->Codepage.PageTable) {
269 
270  Status = Ext2UnicodeToMbs(Vcb->Codepage.PageTable,
271  Oem, Unicode);
272  if (Status > 0 && Status == Oem->Length) {
274  } else {
276  DbgBreak();
277  }
278 
279  goto errorout;
280  }
281 
283  Oem, Unicode, FALSE );
284 
285  if (!NT_SUCCESS(Status))
286  {
287  DbgBreak();
288  goto errorout;
289  }
290 
291 errorout:
292 
293  return Status;
294 }
ULONG Ext2UnicodeToMbs(struct nls_table *PageTable, IN OUT PANSI_STRING Mbs, IN PUNICODE_STRING Unicode)
Definition: misc.c:122
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define Vcb
Definition: cdprocs.h:1425
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
Status
Definition: gdiplustypes.h:24
#define DbgBreak()
Definition: ext2fs.h:46
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by Ext2BuildEntry(), Ext2SetReparsePoint(), and Ext2SetVolumeInformation().

◆ Ext2UnicodeToOEMSize()

ULONG Ext2UnicodeToOEMSize ( IN PEXT2_VCB  Vcb,
IN PUNICODE_STRING  Unicode 
)

Definition at line 239 of file misc.c.

243 {
244  ULONG Length = 0;
245 
246  if (Vcb->Codepage.PageTable) {
247  Length = Ext2UnicodeToMbs(Vcb->Codepage.PageTable,
248  NULL, Unicode);
249  if (Length > 0) {
250  return Length;
251  }
252 
253  DbgBreak();
254  }
255 
256  return RtlxUnicodeStringToOemSize(Unicode);
257 }
ULONG Ext2UnicodeToMbs(struct nls_table *PageTable, IN OUT PANSI_STRING Mbs, IN PUNICODE_STRING Unicode)
Definition: misc.c:122
smooth NULL
Definition: ftsmooth.c:416
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSYSAPI ULONG NTAPI RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString)
Definition: unicode.c:1080
unsigned int ULONG
Definition: retypes.h:1
#define DbgBreak()
Definition: ext2fs.h:46

Referenced by Ext2BuildEntry(), and Ext2SetReparsePoint().

◆ Ext2WinntError()

NTSTATUS Ext2WinntError ( int  rc)

Definition at line 410 of file misc.c.

411 {
412  switch (rc) {
413 
414  case 0:
415  return STATUS_SUCCESS;
416 
417  case -EPERM:
418  case -EACCES:
419  return STATUS_ACCESS_DENIED;
420 
421  case -ENOENT:
423 
424  case -EFAULT:
426 
427  case -ETOOSMALL:
429 
430  case -EBADMSG:
431  case -EBADF:
432  case -EINVAL:
433  case -EFBIG:
435 
436  case -EBUSY:
437  return STATUS_DEVICE_BUSY;
438 
439  case -ENOSYS:
440  return STATUS_NOT_IMPLEMENTED;
441 
442  case -ENOSPC:
443  return STATUS_DISK_FULL;
444 
445  case -EOPNOTSUPP:
446  return STATUS_NOT_SUPPORTED;
447 
448  case -EDEADLK:
450 
451  case -EEXIST:
453 
454  case -EIO:
456 
457  case -ENOTDIR:
458  return STATUS_NOT_A_DIRECTORY;
459 
460  case -EISDIR:
462 
463  case -ENOTEMPTY:
465 
466  case -ENODEV:
467  return STATUS_NO_SUCH_DEVICE;
468 
469  case -ENXIO:
470  return STATUS_INVALID_ADDRESS;
471 
472  case -EADDRNOTAVAIL:
473  return STATUS_INVALID_ADDRESS;
474 
475  case -ENETDOWN:
477 
478  case -ENETUNREACH:
480 
481  case -ECONNABORTED:
483 
484  case -ECONNRESET:
486 
487  case -ENOMEM:
489 
490  case -ENOBUFS:
491  return STATUS_NO_MEMORY;
492 
493  case -ENOTCONN:
495 
496  case -ESHUTDOWN:
498 
499  case -ETIMEDOUT:
500  return STATUS_TIMEOUT;
501 
502  case -ECONNREFUSED:
504 
505  case -EHOSTUNREACH:
507 
508  case -EAGAIN:
509  return STATUS_CANT_WAIT;
510 
511  case -EINTR:
512  return STATUS_CANCELLED;
513 
514  case -EMSGSIZE:
516 
517  case -EADDRINUSE:
519  }
520 
521  return STATUS_UNSUCCESSFUL;
522 }
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define STATUS_INVALID_CONNECTION
Definition: ntstatus.h:542
#define STATUS_CONNECTION_REFUSED
Definition: ntstatus.h:684
#define STATUS_FILE_IS_A_DIRECTORY
Definition: udferr_usr.h:164
#define STATUS_CONNECTION_RESET
Definition: ntstatus.h:643
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define ECONNABORTED
Definition: errno.h:114
#define EFBIG
Definition: errno.h:33
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define STATUS_DIRECTORY_NOT_EMPTY
Definition: udferr_usr.h:167
Definition: arc.h:38
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
Definition: arc.h:39
#define EINTR
Definition: acclib.h:80
#define EOPNOTSUPP
Definition: errno.h:104
#define EDEADLK
Definition: errno.h:39
Definition: arc.h:37
#define ENOBUFS
Definition: errno.h:116
Definition: arc.h:52
Definition: arc.h:36
Definition: arc.h:48
#define STATUS_HOST_UNREACHABLE
Definition: ntstatus.h:691
#define EEXIST
Definition: acclib.h:88
#define STATUS_ADDRESS_ALREADY_EXISTS
Definition: ntstatus.h:640
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define ECONNREFUSED
Definition: errno.h:122
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
#define ENETUNREACH
Definition: errno.h:112
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
#define ECONNRESET
Definition: errno.h:115
#define ENOTEMPTY
Definition: errno.h:47
Definition: arc.h:49
Definition: arc.h:35
Definition: arc.h:50
#define ETOOSMALL
Definition: errno.h:149
#define STATUS_INVALID_BUFFER_SIZE
Definition: ntstatus.h:636
#define ENOSYS
Definition: errno.h:45
#define STATUS_CONNECTION_DISCONNECTED
Definition: ntstatus.h:642
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define ENOTCONN
Definition: errno.h:118
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define EADDRNOTAVAIL
Definition: errno.h:110
#define STATUS_CONNECTION_ABORTED
Definition: ntstatus.h:695
Definition: arc.h:34
#define STATUS_POSSIBLE_DEADLOCK
Definition: ntstatus.h:623
#define EADDRINUSE
Definition: errno.h:109
Definition: arc.h:45
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ESHUTDOWN
Definition: errno.h:119
#define STATUS_INVALID_ADDRESS
Definition: ntstatus.h:543
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
Definition: arc.h:46
#define EBADMSG
Definition: errno.h:80
Definition: arc.h:40
Definition: arc.h:41
#define ENETDOWN
Definition: errno.h:111
#define STATUS_UNEXPECTED_IO_ERROR
Definition: ntstatus.h:455
#define STATUS_UNEXPECTED_NETWORK_ERROR
Definition: ntstatus.h:418
#define EHOSTUNREACH
Definition: errno.h:124
#define STATUS_DISK_FULL
Definition: udferr_usr.h:155
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
#define EMSGSIZE
Definition: errno.h:97
#define ETIMEDOUT
Definition: errno.h:121
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define STATUS_NETWORK_UNREACHABLE
Definition: ntstatus.h:690
#define EPERM
Definition: acclib.h:78
#define STATUS_CANT_WAIT
Definition: ntstatus.h:438

Referenced by Ext2AddDotEntries(), Ext2AddEntry(), Ext2DoExtentExpand(), Ext2FreeInode(), Ext2MapExtent(), Ext2NewBlock(), Ext2NewInode(), Ext2OverwriteEa(), Ext2QueryEa(), Ext2QueryFileInformation(), Ext2RemoveEntry(), and Ext2SetEa().

Variable Documentation

◆ Ext2Global

PEXT2_GLOBAL Ext2Global

Definition at line 16 of file init.c.