Re: "NUL" device is missing

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: KM (konstmor_at_nospam_yahoo.com)
Date: 05/14/04


Date: Fri, 14 May 2004 09:19:41 -0700

Chuck,

> I'm stuck using Visual C/C++ v6.0 right now w/o the option to move on up
to
> the Studio 2003 compiler. However, I will keep this in mind for future
use.
> I spent quite a bit of time last night reviewing the source code for the
> CRT and had reached the point where everything comes down to a call to the
> _output() function that does all of the dirty work. If it is one of the
> string printf() types of functions, then a dummy _iob [a.k.a. "FILE"
> structure] is worked up where it lookes like a valid file handle but
really
> points to the string buffer. I can see the counted vs. uncounted versions
> set a member in the structure to limit define the output buffer size.
> Still, it is the _output() function that does all of the work and I
haven't
> gone through and reviewe the source code for _output to see if it tests
> properly for NULL. I think that in VC6 it doesnn't as I've had errors
occur

It does not. The _output will call to funtions like write_string,
write_char, etc. to output strings/character/etc. to the stream.
In VC 6.0 the write_xxxx funcitons do not check if stream->base
(stream->ptr) is NULL.
VC 2003 does it.

> when passing in a NULL pointer to sprintf(). I'll look at it all in more
> detail today.
>
> It is encouraging to hear than an updated ANSI C standard does finally
> address this problem, though. I've got VS2003 .NET on hand and I will
> review the CRT source code from it, too, to see what the differences in
the
> implementation look like. Perhaps I can cook up my own flavor of
_output()
> to use with VC6 in my own code to back-port that functionality and thus
> remove the dependency on the NUL device.

KM



Relevant Pages

  • C# Equivalent to VBs WithEvents?
    ... Thanks for reviewing my question. ... a custom control and its source code is in VB. ... What is the replacement for WithEvents? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C# Equivalent to VBs WithEvents?
    ... > Thanks for reviewing my question. ... > a custom control and its source code is in VB. ... What is the replacement for WithEvents? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Algorithm
    ... >1: This is cryptography. ... If were to try to complete the crackme by ... >reviewing the source code, then I would have posted it in a cracking ...
    (sci.crypt)
  • re:Algorithm
    ... Lol you don't get to see my source code for 2 reasons. ... If were to try to complete the crackme by ... reviewing the source code, then I would have posted it in a cracking ... I posted it to see if anyone could crack my algorithm with ease. ...
    (sci.crypt)