ReactOS 0.4.16-dev-853-g88d9285
corecrt_internal_stdio.h File Reference
#include <corecrt_internal.h>
#include <corecrt_internal_lowio.h>
#include <corecrt_internal_traits.h>
#include <io.h>
#include <mbstring.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for corecrt_internal_stdio.h:

Go to the source code of this file.

Classes

struct  __crt_stdio_stream_data
 
class  __crt_stdio_stream
 
struct  __acrt_stdio_char_traits< char >
 
struct  __acrt_stdio_char_traits< wchar_t >
 
struct  __acrt_stdio_stream_mode
 

Enumerations

enum  : long {
  _IOREAD = 0x0001 , _IOWRITE = 0x0002 , _IOUPDATE = 0x0004 , _IOEOF = 0x0008 ,
  _IOERROR = 0x0010 , _IOCTRLZ = 0x0020 , _IOBUFFER_CRT = 0x0040 , _IOBUFFER_USER = 0x0080 ,
  _IOBUFFER_SETVBUF = 0x0100 , _IOBUFFER_STBUF = 0x0200 , _IOBUFFER_NONE = 0x0400 , _IOCOMMIT = 0x0800 ,
  _IOSTRING = 0x1000 , _IOALLOCATED = 0x2000
}
 

Functions

_Check_return_opt_ int __cdecl _putch_nolock_internal (_In_ int _Ch, _Inout_ __crt_cached_ptd_host &_Ptd)
 
_Check_return_opt_ wint_t __cdecl _putwch_nolock_internal (_In_ wchar_t _Ch, _Inout_ __crt_cached_ptd_host &_Ptd)
 
_Check_return_opt_ wint_t __cdecl _fputwc_nolock_internal (_In_ wchar_t _Character, _Inout_ FILE *_Stream, _Inout_ __crt_cached_ptd_host &_Ptd)
 
 _Success_ (return !=EOF) _Check_return_opt_ extern "C" int __cdecl _fputc_nolock_internal(_In_ int _Character
 
_Check_return_opt_ size_t __cdecl _fwrite_nolock_internal (_In_reads_bytes_(_ElementSize *_ElementCount) void const *_Buffer, _In_ size_t _ElementSize, _In_ size_t _ElementCount, _Inout_ FILE *_Stream, _Inout_ __crt_cached_ptd_host &_Ptd)
 
_Check_return_ __int64 __cdecl _ftelli64_nolock_internal (_Inout_ FILE *_Stream, _Inout_ __crt_cached_ptd_host &_Ptd)
 
__crt_stdio_stream __cdecl __acrt_stdio_allocate_stream () throw ()
 
void __cdecl __acrt_stdio_free_stream (__crt_stdio_stream _Stream) throw ()
 
template<typename Action >
auto __acrt_lock_stream_and_call (FILE *const stream, Action &&action) -> decltype(action()) throw ()
 
bool __acrt_stdio_is_initialized ()
 
 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0 (_Success_(return !=0) char *, __RETURN_POLICY_SAME, _ACRTIMP, gets, _Pre_notnull_ _Post_z_ _Out_writes_z_(((size_t) -1)), char, _Buffer) __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0_CGETS(_Success_(return !=0) char *
 
 _At_ (_Buffer, _Pre_notnull_ _In_reads_(1)) _At_(_Buffer+1
 
_Pre_notnull_ _Out_writes_ (1)) _At_(_Buffer+2
 
_Pre_notnull_ _Pre_notnull_ _Post_z_ _Out_writes_to_ (_Buffer[0], _Buffer[1]))
 
_Pre_notnull_ _Pre_notnull_ _Post_z_ _Buffer __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0 (_Success_(return !=0) wchar_t *, __RETURN_POLICY_SAME, _ACRTIMP, _getws, _Pre_notnull_ _Post_z_, wchar_t, _Buffer) __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0_CGETS(_Post_satisfies_(return
 
bool __acrt_stdio_parse_mode_plus (__acrt_stdio_stream_mode &result, bool &seen_plus) throw ()
 
bool __acrt_stdio_parse_mode_b (__acrt_stdio_stream_mode &result) throw ()
 
bool __acrt_stdio_parse_mode_t (__acrt_stdio_stream_mode &result) throw ()
 
bool __acrt_stdio_parse_mode_c (__acrt_stdio_stream_mode &result, bool &seen_commit_mode) throw ()
 
bool __acrt_stdio_parse_mode_n (__acrt_stdio_stream_mode &result, bool &seen_commit_mode) throw ()
 
bool __acrt_stdio_parse_mode_S (__acrt_stdio_stream_mode &result, bool &seen_scan_mode) throw ()
 
bool __acrt_stdio_parse_mode_R (__acrt_stdio_stream_mode &result, bool &seen_scan_mode) throw ()
 
bool __acrt_stdio_parse_mode_T (__acrt_stdio_stream_mode &result) throw ()
 
bool __acrt_stdio_parse_mode_D (__acrt_stdio_stream_mode &result) throw ()
 
bool __acrt_stdio_parse_mode_N (__acrt_stdio_stream_mode &result) throw ()
 
bool __acrt_stdio_parse_mode_x (__acrt_stdio_stream_mode &result) throw ()
 
template<typename Character >
__acrt_stdio_stream_mode __cdecl __acrt_stdio_parse_mode (Character const *const mode) throw ()
 
bool __cdecl __crt_stdio_path_requires_backslash (char const *const first) throw ()
 
bool __cdecl __crt_stdio_path_requires_backslash (wchar_t const *const first) throw ()
 
void __cdecl __acrt_stdio_reset_buffer (__crt_stdio_stream const stream) throw ()
 

Variables

_Inout_ FILE_Stream
 
_Inout_ FILE _Inout_ __crt_cached_ptd_host & _Ptd
 
int _nstream
 
__crt_stdio_stream_data ** __piob
 
 _DCRTIMP
 
 _cgets
 
_Pre_notnull_ _Pre_notnull_ _Post_z_ char
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : long
Enumerator
_IOREAD 
_IOWRITE 
_IOUPDATE 
_IOEOF 
_IOERROR 
_IOCTRLZ 
_IOBUFFER_CRT 
_IOBUFFER_USER 
_IOBUFFER_SETVBUF 
_IOBUFFER_STBUF 
_IOBUFFER_NONE 
_IOCOMMIT 
_IOSTRING 
_IOALLOCATED 

Definition at line 30 of file corecrt_internal_stdio.h.

31{
32 // Mode bits: These bits control the stream mode. A stream may be in one
33 // of three modes: read mode, write mode, or update (read/write) mode. At
34 // least one of these bits will be set for any open stream.
35 //
36 // If the stream is open in read mode or write mode, then only the _IOREAD
37 // or _IOWRITE bit will be set.
38 //
39 // If the stream is open in update (read/write) mode, then the _IOUPDATE bit
40 // will be set. Further state must also be tracked for update mode streams.
41 // Read and write operations cannot be mixed willy-nilly: in most cases, a
42 // flush or reposition must take place in order to transition between reading
43 // and writing. So, for update mode streams, if the next operation must be
44 // a read, the _IOREAD bit is set, and if the next operation must be a write,
45 // the _IOWRITE bit is set.
46 _IOREAD = 0x0001,
47 _IOWRITE = 0x0002,
48 _IOUPDATE = 0x0004,
49
50 // Stream state bits: These bits track the state of the stream. The _IOEOF
51 // and _IOERROR flags track the end-of-file and error states, respectively,
52 // which are reported by feof() and ferror(). The _IOCTRLZ flag is when the
53 // last read ended because a Ctrl+Z was read; it corresponds to the lowio
54 // FEOFLAG state.
55 _IOEOF = 0x0008,
56 _IOERROR = 0x0010,
57 _IOCTRLZ = 0x0020,
58
59 // Buffering state bits: These track the buffering mode of the stream:
60 //
61 // (*) CRT: The buffer was allocated by the CRT via the usual mechanism
62 // (typically via __acrt_stdio_allocate_buffer_nolock, and of
63 // size _INTERNAL_BUFSIZ).
64 //
65 // (*) USER: The buffer was allocated by the user and was configured via
66 // the setvbuf() function.
67 //
68 // (*) SETVBUF: The buffer was set via the setvbuf() function. This flag
69 // may be combined with either the CRT or USER flag, depending
70 // on who owns the buffer (based on how setvbuf() was called).
71 //
72 // (*) STBUF: The buffer was set via a call to the
73 // __acrt_stdio_begin_temporary_buffering_nolock() function,
74 // which provides a temporary buffer for console I/O operations
75 // to improve the performance of bulk read or write operations.
76 //
77 // (*) NONE: Buffering is disabled, either because it was explicitly
78 // disabled or because the CRT attempted to allocate a buffer
79 // but allocation failed. When this flag is set, the internal
80 // two-byte character buffer is used.
81 //
82 // Note that these flags are related to, but distinct from, the public stdio
83 // buffering flags that are used with setvbuf (_IOFBF, _IOLBF, and _IONBF).
84 // Specifically, note that those flags are never or'ed into the flags for a
85 // stream.
86 _IOBUFFER_CRT = 0x0040,
87 _IOBUFFER_USER = 0x0080,
88 _IOBUFFER_SETVBUF = 0x0100,
89 _IOBUFFER_STBUF = 0x0200,
90 _IOBUFFER_NONE = 0x0400,
91
92 // Commit-on-flush state bit: When this flag is set, every flush operation
93 // on the stream also commits the file to disk.
94 _IOCOMMIT = 0x0800,
95
96 // String state bit: When this flag is set, it indicates that the stream is
97 // backed by a string, not a file. String-backed streams are not exposed to
98 // user code; they are created internally to support formatted I/O to string
99 // buffers (e.g. the sprintf and sscanf families of functions). If a stream
100 // is backed by a string, its lock is not initialized and no synchronization
101 // is required.
102 _IOSTRING = 0x1000,
103
104 // Allocation state bit: When this flag is set it indicates that the stream
105 // is currently allocated and in-use. If this flag is not set, it indicates
106 // that the stream is free and available for use.
107 _IOALLOCATED = 0x2000,
108};
@ _IOBUFFER_CRT
@ _IOBUFFER_USER
@ _IOBUFFER_SETVBUF
@ _IOBUFFER_STBUF
@ _IOBUFFER_NONE

Function Documentation

◆ __acrt_lock_stream_and_call()

template<typename Action >
auto __acrt_lock_stream_and_call ( FILE *const  stream,
Action &&  action 
) -> decltype(action())
throw (
)

Definition at line 294 of file corecrt_internal_stdio.h.

296{
297 return __crt_seh_guarded_call<decltype(action())>()(
298 [stream]() { _lock_file(stream); },
299 action,
300 [stream]() { _unlock_file(stream); });
301}
const WCHAR * action
Definition: action.c:7509
_CRTIMP void __cdecl _unlock_file(_Inout_ FILE *_File)
_CRTIMP void __cdecl _lock_file(_Inout_ FILE *_File)
Definition: parse.h:23

Referenced by _fputs_internal(), _fputws_internal(), _fwrite_internal(), _puts_internal(), _putws_internal(), _setvbuf_internal(), common_flush_all(), common_vfprintf(), common_vfscanf(), and fflush().

◆ __acrt_stdio_allocate_stream()

__crt_stdio_stream __cdecl __acrt_stdio_allocate_stream ( )
throw (
)

Definition at line 71 of file stream.cpp.

72{
74
76 __try
77 {
79 if (!stream.valid())
80 __leave;
81
82 stream->_cnt = 0;
83 stream->_tmpfname = nullptr;
84 stream->_ptr = nullptr;
85 stream->_base = nullptr;
86 stream->_file = -1;
87 }
89 {
91 }
93
94 return stream;
95}
void __cdecl __acrt_unlock(_In_ __acrt_lock_id lock)
Definition: locks.cpp:57
@ __acrt_stdio_index_lock
__acrt_lock(__acrt_heap_lock)
#define __try
Definition: pseh2_64.h:172
#define __leave
Definition: pseh2_64.h:176
#define __endtry
Definition: pseh2_64.h:175
#define __finally
Definition: pseh2_64.h:174
static __crt_stdio_stream __cdecl find_or_allocate_unused_stream_nolock()
Definition: stream.cpp:12

Referenced by _Success_(), common_fdopen(), and common_fsopen().

◆ __acrt_stdio_free_stream()

void __cdecl __acrt_stdio_free_stream ( __crt_stdio_stream  _Stream)
throw (
)

Definition at line 97 of file stream.cpp.

98{
99 stream->_ptr = nullptr;
100 stream->_base = nullptr;
101 stream->_cnt = 0;
102 stream->_file = -1;
103 stream->_charbuf = 0;
104 stream->_bufsiz = 0;
105 stream->_tmpfname = nullptr;
106 stream.deallocate();
107}

Referenced by _fclose_internal(), _fclose_nolock_internal(), _Success_(), and common_fsopen().

◆ __acrt_stdio_is_initialized()

bool __acrt_stdio_is_initialized ( )
inline

Definition at line 321 of file corecrt_internal_stdio.h.

321 {
322 return __piob != 0;
323}
__crt_stdio_stream_data ** __piob

Referenced by __acrt_uninitialize().

◆ __acrt_stdio_parse_mode()

template<typename Character >
__acrt_stdio_stream_mode __cdecl __acrt_stdio_parse_mode ( Character const *const  mode)
throw (
)

Definition at line 659 of file corecrt_internal_stdio.h.

662{
663 typedef __acrt_stdio_char_traits<Character> stdio_traits;
664
665 // Note that we value initialize the result, so the success flag is false
666 // by default. This ensures that any premature return will return failure.
668 result._stdio_mode = _commode;
669
670 // Advance past any leading spaces:
671 Character const* it = mode;
672 while (*it == ' ')
673 ++it;
674
675 // Read the first character. It must be one of 'r', 'w' , or 'a':
676 switch (*it)
677 {
678 case 'r':
679 result._lowio_mode = _O_RDONLY;
680 result._stdio_mode = _IOREAD;
681 break;
682
683 case 'w':
684 result._lowio_mode = _O_WRONLY | _O_CREAT | _O_TRUNC;
685 result._stdio_mode = _IOWRITE;
686 break;
687
688 case 'a':
689 result._lowio_mode = _O_WRONLY | _O_CREAT | _O_APPEND;
690 result._stdio_mode = _IOWRITE;
691 break;
692
693 default:
694 _VALIDATE_RETURN(("Invalid file open mode", 0), EINVAL, result);
695 }
696
697 // Advance past the first character:
698 ++it;
699
700 // There can be up to seven more optional mode characters:
701 // [1] A single '+' character
702 // [2] One of 't' or 'b' (indicating text or binary, respectively)
703 // [3] One of 'c' or 'n' (enable or disable auto-commit to disk on flush)
704 // [4] One of 'S' or 'R' (optimize for sequential or random access)
705 // [5] 'T' (indicating the file is short-lived)
706 // [6] 'D' (indicating the file is temporary)
707 // [7] 'N' (indicating the file should not be inherited by child processes)
708 // [8] 'x' (indicating the file must be created and it is an error if it already exists)
709 bool seen_commit_mode = false;
710 bool seen_plus = false;
711 bool seen_scan_mode = false;
712 bool seen_encoding_flag = false;
713 for (bool continue_loop = true; continue_loop && *it != '\0'; it += (continue_loop ? 1 : 0))
714 {
715 switch (*it)
716 {
717 case '+': continue_loop = __acrt_stdio_parse_mode_plus(result, seen_plus); break;
718 case 'b': continue_loop = __acrt_stdio_parse_mode_b (result); break;
719 case 't': continue_loop = __acrt_stdio_parse_mode_t (result); break;
720 case 'c': continue_loop = __acrt_stdio_parse_mode_c (result, seen_commit_mode); break;
721 case 'n': continue_loop = __acrt_stdio_parse_mode_n (result, seen_commit_mode); break;
722 case 'S': continue_loop = __acrt_stdio_parse_mode_S (result, seen_scan_mode ); break;
723 case 'R': continue_loop = __acrt_stdio_parse_mode_R (result, seen_scan_mode ); break;
724 case 'T': continue_loop = __acrt_stdio_parse_mode_T (result); break;
725 case 'D': continue_loop = __acrt_stdio_parse_mode_D (result); break;
726 case 'N': continue_loop = __acrt_stdio_parse_mode_N (result); break;
727 case 'x': continue_loop = __acrt_stdio_parse_mode_x (result); break;
728
729 // If we encounter any spaces, skip them:
730 case ' ':
731 break;
732
733 // If we encounter a comma, it begins the encoding specification; we
734 // break out of the loop immediately and parse the encoding flag next:
735 case ',':
736 seen_encoding_flag = true;
737 continue_loop = false;
738 break;
739
740 default:
741 _VALIDATE_RETURN(("Invalid file open mode", 0), EINVAL, result);
742 }
743 }
744
745 // Advance past the comma that terminated the loop:
746 if (seen_encoding_flag)
747 ++it;
748
749 while (*it == ' ')
750 ++it;
751
752 // If we did not encounter the encoding introducer (a comma), make sure we
753 // actually reached the end of the mode string. We are done:
754 if (!seen_encoding_flag)
755 {
756 _VALIDATE_RETURN(*it == '\0', EINVAL, result);
757 result._success = true;
758 return result;
759 }
760
761 // Otherwise, we saw the beginning of an encoding; parse it:
762 static Character const ccs[] = { 'c', 'c', 's' };
763 static Character const utf8_encoding[] = { 'U', 'T', 'F', '-', '8' };
764 static Character const utf16_encoding[] = { 'U', 'T', 'F', '-', '1', '6', 'L', 'E' };
765 static Character const unicode_encoding[] = { 'U', 'N', 'I', 'C', 'O', 'D', 'E' };
766
767 // Make sure it begins with "ccs" (all lowercase)...
768 if (stdio_traits::tcsncmp(it, ccs, _countof(ccs)) != 0)
769 _VALIDATE_RETURN(("Invalid file open mode", 0), EINVAL, result);
770
771 it += _countof(ccs); // Advance past the "ccs"
772
773 while (*it == ' ')
774 ++it;
775
776 if (*it != '=')
777 _VALIDATE_RETURN(("Invalid file open mode", 0), EINVAL, result);
778
779 ++it; // Advance past the "="
780
781 while (*it == ' ')
782 ++it;
783
784 if (stdio_traits::tcsnicmp(it, utf8_encoding, _countof(utf8_encoding)) == 0)
785 {
786 it += _countof(utf8_encoding);
787 result._lowio_mode |= _O_U8TEXT;
788 }
789 else if (stdio_traits::tcsnicmp(it, utf16_encoding, _countof(utf16_encoding)) == 0)
790 {
791 it += _countof(utf16_encoding);
792 result._lowio_mode |= _O_U16TEXT;
793 }
794 else if (stdio_traits::tcsnicmp(it, unicode_encoding, _countof(unicode_encoding)) == 0)
795 {
796 it += _countof(unicode_encoding);
797 result._lowio_mode |= _O_WTEXT;
798 }
799 else
800 {
801 _VALIDATE_RETURN(("Invalid file open mode", 0), EINVAL, result);
802 }
803
804 // Finally, skip any trailing spaces...
805 while (*it == ' ')
806 ++it;
807
808 // ...and ensure there are no characters left:
809 _VALIDATE_RETURN(*it == '\0', EINVAL, result);
810
811 result._success = true;
812 return result;
813}
#define EINVAL
Definition: acclib.h:90
bool __acrt_stdio_parse_mode_t(__acrt_stdio_stream_mode &result)
bool __acrt_stdio_parse_mode_T(__acrt_stdio_stream_mode &result)
bool __acrt_stdio_parse_mode_R(__acrt_stdio_stream_mode &result, bool &seen_scan_mode)
bool __acrt_stdio_parse_mode_c(__acrt_stdio_stream_mode &result, bool &seen_commit_mode)
bool __acrt_stdio_parse_mode_N(__acrt_stdio_stream_mode &result)
bool __acrt_stdio_parse_mode_b(__acrt_stdio_stream_mode &result)
bool __acrt_stdio_parse_mode_x(__acrt_stdio_stream_mode &result)
bool __acrt_stdio_parse_mode_n(__acrt_stdio_stream_mode &result, bool &seen_commit_mode)
bool __acrt_stdio_parse_mode_plus(__acrt_stdio_stream_mode &result, bool &seen_plus)
bool __acrt_stdio_parse_mode_D(__acrt_stdio_stream_mode &result)
bool __acrt_stdio_parse_mode_S(__acrt_stdio_stream_mode &result, bool &seen_scan_mode)
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
#define _O_APPEND
Definition: cabinet.h:41
#define _O_RDONLY
Definition: cabinet.h:37
#define _O_TRUNC
Definition: cabinet.h:47
#define _O_CREAT
Definition: cabinet.h:46
#define _O_WRONLY
Definition: cabinet.h:38
GLenum mode
Definition: glext.h:6217
GLuint64EXT * result
Definition: glext.h:11304
#define _O_WTEXT
Definition: fcntl.h:20
#define _O_U8TEXT
Definition: fcntl.h:22
#define _O_U16TEXT
Definition: fcntl.h:21
_CRTIMP int _commode
Definition: environ.c:31
#define _countof(array)
Definition: sndvol32.h:70

Referenced by common_fdopen(), and common_openfile().

◆ __acrt_stdio_parse_mode_b()

bool __acrt_stdio_parse_mode_b ( __acrt_stdio_stream_mode result)
throw (
)
inline

Definition at line 552 of file corecrt_internal_stdio.h.

553{
554 if (result._lowio_mode & (_O_TEXT | _O_BINARY)) {
555 return false;
556 }
557
558 result._lowio_mode |= _O_BINARY;
559 return true;
560}
#define _O_BINARY
Definition: cabinet.h:51
#define _O_TEXT
Definition: cabinet.h:50

Referenced by __acrt_stdio_parse_mode().

◆ __acrt_stdio_parse_mode_c()

bool __acrt_stdio_parse_mode_c ( __acrt_stdio_stream_mode result,
bool seen_commit_mode 
)
throw (
)
inline

Definition at line 572 of file corecrt_internal_stdio.h.

573{
574 if (seen_commit_mode) {
575 return false;
576 }
577
578 seen_commit_mode = true;
579 result._stdio_mode |= _IOCOMMIT;
580 return true;
581}

Referenced by __acrt_stdio_parse_mode().

◆ __acrt_stdio_parse_mode_D()

bool __acrt_stdio_parse_mode_D ( __acrt_stdio_stream_mode result)
throw (
)
inline

Definition at line 626 of file corecrt_internal_stdio.h.

627{
628 if (result._lowio_mode & _O_TEMPORARY) {
629 return false;
630 }
631
632 result._lowio_mode |= _O_TEMPORARY;
633 return true;
634}
#define _O_TEMPORARY
Definition: cabinet.h:44

Referenced by __acrt_stdio_parse_mode().

◆ __acrt_stdio_parse_mode_N()

bool __acrt_stdio_parse_mode_N ( __acrt_stdio_stream_mode result)
throw (
)
inline

Definition at line 636 of file corecrt_internal_stdio.h.

637{
638 result._lowio_mode |= _O_NOINHERIT;
639 return true;
640}
#define _O_NOINHERIT
Definition: cabinet.h:45

Referenced by __acrt_stdio_parse_mode().

◆ __acrt_stdio_parse_mode_n()

bool __acrt_stdio_parse_mode_n ( __acrt_stdio_stream_mode result,
bool seen_commit_mode 
)
throw (
)
inline

Definition at line 583 of file corecrt_internal_stdio.h.

584{
585 if (seen_commit_mode) {
586 return false;
587 }
588
589 seen_commit_mode = true;
590 result._stdio_mode &= ~_IOCOMMIT;
591 return true;
592}

Referenced by __acrt_stdio_parse_mode().

◆ __acrt_stdio_parse_mode_plus()

bool __acrt_stdio_parse_mode_plus ( __acrt_stdio_stream_mode result,
bool seen_plus 
)
throw (
)
inline

Definition at line 533 of file corecrt_internal_stdio.h.

534{
535 if (seen_plus) {
536 return false;
537 }
538
539 seen_plus = true;
540
541 if (result._lowio_mode & _O_RDWR) {
542 return false;
543 }
544
545 result._lowio_mode |= _O_RDWR;
546 result._lowio_mode &= ~(_O_RDONLY | _O_WRONLY);
547 result._stdio_mode |= _IOUPDATE;
548 result._stdio_mode &= ~(_IOREAD | _IOWRITE);
549 return true;
550}
#define _O_RDWR
Definition: cabinet.h:39

Referenced by __acrt_stdio_parse_mode().

◆ __acrt_stdio_parse_mode_R()

bool __acrt_stdio_parse_mode_R ( __acrt_stdio_stream_mode result,
bool seen_scan_mode 
)
throw (
)
inline

Definition at line 605 of file corecrt_internal_stdio.h.

606{
607 if (seen_scan_mode) {
608 return false;
609 }
610
611 seen_scan_mode = true;
612 result._lowio_mode |= _O_RANDOM;
613 return true;
614}
#define _O_RANDOM
Definition: cabinet.h:42

Referenced by __acrt_stdio_parse_mode().

◆ __acrt_stdio_parse_mode_S()

bool __acrt_stdio_parse_mode_S ( __acrt_stdio_stream_mode result,
bool seen_scan_mode 
)
throw (
)
inline

Definition at line 594 of file corecrt_internal_stdio.h.

595{
596 if (seen_scan_mode) {
597 return false;
598 }
599
600 seen_scan_mode = true;
601 result._lowio_mode |= _O_SEQUENTIAL;
602 return true;
603}
#define _O_SEQUENTIAL
Definition: cabinet.h:43

Referenced by __acrt_stdio_parse_mode().

◆ __acrt_stdio_parse_mode_t()

bool __acrt_stdio_parse_mode_t ( __acrt_stdio_stream_mode result)
throw (
)
inline

Definition at line 562 of file corecrt_internal_stdio.h.

563{
564 if (result._lowio_mode & (_O_TEXT | _O_BINARY)) {
565 return false;
566 }
567
568 result._lowio_mode |= _O_TEXT;
569 return true;
570}

Referenced by __acrt_stdio_parse_mode().

◆ __acrt_stdio_parse_mode_T()

bool __acrt_stdio_parse_mode_T ( __acrt_stdio_stream_mode result)
throw (
)
inline

Definition at line 616 of file corecrt_internal_stdio.h.

617{
618 if (result._lowio_mode & _O_SHORT_LIVED) {
619 return false;
620 }
621
622 result._lowio_mode |= _O_SHORT_LIVED;
623 return true;
624}
#define _O_SHORT_LIVED
Definition: cabinet.h:49

Referenced by __acrt_stdio_parse_mode().

◆ __acrt_stdio_parse_mode_x()

bool __acrt_stdio_parse_mode_x ( __acrt_stdio_stream_mode result)
throw (
)
inline

Definition at line 642 of file corecrt_internal_stdio.h.

643{
644 if (!(result._lowio_mode & _O_TRUNC)) {
645 // 'x' only permitted with 'w'
646 return false;
647 }
648
649 result._lowio_mode |= _O_EXCL;
650 return true;
651}
#define _O_EXCL
Definition: cabinet.h:48

Referenced by __acrt_stdio_parse_mode().

◆ __acrt_stdio_reset_buffer()

void __cdecl __acrt_stdio_reset_buffer ( __crt_stdio_stream const  stream)
throw (
)
inline

Definition at line 856 of file corecrt_internal_stdio.h.

857{
858 stream->_ptr = stream->_base;
859 stream->_cnt = 0;
860}

Referenced by __acrt_stdio_flush_nolock(), _fread_nolock_s(), _rewind_internal(), and common_fseek_nolock().

◆ __crt_stdio_path_requires_backslash() [1/2]

bool __cdecl __crt_stdio_path_requires_backslash ( char const *const  first)
throw (
)
inline

Definition at line 822 of file corecrt_internal_stdio.h.

823{
824 char const* const last = first + strlen(first);
825 if (first == last)
826 return false;
827
828 if (*(last - 1) == '\\')
829 {
830 return reinterpret_cast<unsigned char const*>(last - 1)
831 != _mbsrchr(reinterpret_cast<unsigned char const*>(first), '\\');
832 }
833
834 if (*(last - 1) == '/')
835 return false;
836
837 return true;
838}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
const GLint * first
Definition: glext.h:5794
_Check_return_ _CRTIMP _CONST_RETURN unsigned char *__cdecl _mbsrchr(_In_z_ const unsigned char *_Str, _In_ unsigned int _Ch)
static UINT UINT last
Definition: font.c:45
#define const
Definition: zconf.h:233

Referenced by get_executable_path(), and throw().

◆ __crt_stdio_path_requires_backslash() [2/2]

bool __cdecl __crt_stdio_path_requires_backslash ( wchar_t const *const  first)
throw (
)
inline

Definition at line 840 of file corecrt_internal_stdio.h.

841{
842 wchar_t const* const last = first + wcslen(first);
843 if (first == last)
844 return false;
845
846 if (*(last - 1) == L'\\')
847 return false;
848
849 if (*(last - 1) == L'/')
850 return false;
851
852 return true;
853}
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define L(x)
Definition: ntvdm.h:50

◆ __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0() [1/2]

__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0 ( _Success_(return !=0) char ,
__RETURN_POLICY_SAME  ,
_ACRTIMP  ,
gets  ,
_Pre_notnull_ _Post_z_   _Out_writes_z_((size_t) -1),
char  ,
_Buffer   
)
pure virtual

◆ __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0() [2/2]

_Pre_notnull_ _Pre_notnull_ _Post_z_ _Buffer __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0 ( _Success_(return !=0) wchar_t ,
__RETURN_POLICY_SAME  ,
_ACRTIMP  ,
_getws  ,
_Pre_notnull_  _Post_z_,
wchar_t  ,
_Buffer   
)

◆ _At_()

_At_ ( _Buffer  ,
_Pre_notnull_   _In_reads_
)

◆ _fputwc_nolock_internal()

_Check_return_opt_ wint_t __cdecl _fputwc_nolock_internal ( _In_ wchar_t  _Character,
_Inout_ FILE _Stream,
_Inout_ __crt_cached_ptd_host &  _Ptd 
)

◆ _ftelli64_nolock_internal()

_Check_return_ __int64 __cdecl _ftelli64_nolock_internal ( _Inout_ FILE _Stream,
_Inout_ __crt_cached_ptd_host &  _Ptd 
)

Referenced by common_fseek_nolock().

◆ _fwrite_nolock_internal()

_Check_return_opt_ size_t __cdecl _fwrite_nolock_internal ( _In_reads_bytes_(_ElementSize *_ElementCount) void const _Buffer,
_In_ size_t  _ElementSize,
_In_ size_t  _ElementCount,
_Inout_ FILE _Stream,
_Inout_ __crt_cached_ptd_host &  _Ptd 
)

Referenced by _fputs_internal(), and _puts_internal().

◆ _Out_writes_()

_Pre_notnull_ _Out_writes_ ( )

◆ _Out_writes_to_()

_Pre_notnull_ _Pre_notnull_ _Post_z_ _Out_writes_to_ ( _Buffer  [0],
_Buffer  [1] 
)

◆ _putch_nolock_internal()

_Check_return_opt_ int __cdecl _putch_nolock_internal ( _In_ int  _Ch,
_Inout_ __crt_cached_ptd_host &  _Ptd 
)

◆ _putwch_nolock_internal()

_Check_return_opt_ wint_t __cdecl _putwch_nolock_internal ( _In_ wchar_t  _Ch,
_Inout_ __crt_cached_ptd_host &  _Ptd 
)

◆ _Success_()

_Success_ ( return = EOF)

Definition at line 1028 of file fsctrl.c.

3189{
3191
3192 PVPB Vpb = Vcb->Vpb;
3193 PVPB OldVpb;
3194
3195 BOOLEAN Remount = FALSE;
3196
3197 PAGED_CODE();
3198
3199 UNREFERENCED_PARAMETER( IrpContext );
3200
3201 //
3202 // Check whether we are looking for a device only Mvcb.
3203 //
3204
3205 for (Link = CdData.VcbQueue.Flink;
3206 Link != &CdData.VcbQueue;
3207 Link = Link->Flink) {
3208
3209 *OldVcb = CONTAINING_RECORD( Link, VCB, VcbLinks );
3210
3211 //
3212 // Skip ourselves.
3213 //
3214
3215 if (Vcb == *OldVcb) { continue; }
3216
3217 //
3218 // Look at the Vpb and state of the previous Vcb.
3219 //
3220
3221 OldVpb = (*OldVcb)->Vpb;
3222
3223 if ((OldVpb != Vpb) &&
3224 (OldVpb->RealDevice == Vpb->RealDevice) &&
3225 ((*OldVcb)->VcbCondition == VcbNotMounted)) {
3226
3227 //
3228 // If the current disk is a raw disk then it can match a previous music or
3229 // raw disk.
3230 //
3231
3232 if (FlagOn( Vcb->VcbState, VCB_STATE_AUDIO_DISK)) {
3233
3234 if (FlagOn( (*OldVcb)->VcbState, VCB_STATE_AUDIO_DISK )) {
3235
3236 //
3237 // If we have both TOC then fail the remount if the lengths
3238 // are different or they don't match.
3239 //
3240
3241 if ((Vcb->TocLength != (*OldVcb)->TocLength) ||
3242 ((Vcb->TocLength != 0) &&
3243 !RtlEqualMemory( Vcb->CdromToc,
3244 (*OldVcb)->CdromToc,
3245 Vcb->TocLength ))) {
3246
3247 continue;
3248 }
3249
3250 Remount = TRUE;
3251 break;
3252 }
3253
3254 //
3255 // The current disk is not a raw disk. Go ahead and compare
3256 // serial numbers, volume label and TOC.
3257 //
3258
3259 }
3260 else if ((OldVpb->SerialNumber == Vpb->SerialNumber) &&
3261 (Vcb->TocLength == (*OldVcb)->TocLength) &&
3262 ((Vcb->TocLength == 0) || RtlEqualMemory( Vcb->CdromToc,
3263 (*OldVcb)->CdromToc,
3264 Vcb->TocLength )) &&
3265 (Vpb->VolumeLabelLength == OldVpb->VolumeLabelLength) &&
3266 (RtlEqualMemory( OldVpb->VolumeLabel,
3267 Vpb->VolumeLabel,
3268 Vpb->VolumeLabelLength ))) {
3269 //
3270 // Remember the old Vcb. Then set the return value to
3271 // TRUE and break.
3272 //
3273
3274 Remount = TRUE;
3275 break;
3276 }
3277 }
3278 }
3279
3280 return Remount;
3281}
#define PAGED_CODE()
unsigned char BOOLEAN
CD_DATA CdData
Definition: cddata.c:42
#define VCB_STATE_AUDIO_DISK
Definition: cdstruc.h:712
@ VcbNotMounted
Definition: cdstruc.h:490
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1676
#define RtlEqualMemory(dst, src, len)
Definition: kdvm.h:18
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
#define Vcb
Definition: cdprocs.h:1415
LIST_ENTRY VcbQueue
Definition: cdstruc.h:334
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: cdstruc.h:498
Definition: iotypes.h:189
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH/sizeof(WCHAR)]
Definition: iotypes.h:198
USHORT VolumeLabelLength
Definition: iotypes.h:193
ULONG SerialNumber
Definition: iotypes.h:196
struct _DEVICE_OBJECT * RealDevice
Definition: iotypes.h:195
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
static int Link(const char **args)
Definition: vfdcmd.c:2414

Variable Documentation

◆ __piob

◆ _cgets

_cgets

Definition at line 340 of file corecrt_internal_stdio.h.

◆ _DCRTIMP

_DCRTIMP

Definition at line 340 of file corecrt_internal_stdio.h.

◆ _nstream

◆ _Ptd

_Inout_ FILE _Inout_ __crt_cached_ptd_host& _Ptd

Definition at line 143 of file corecrt_internal_stdio.h.

◆ _Stream

_Inout_ FILE* _Stream

Definition at line 142 of file corecrt_internal_stdio.h.

◆ char