[2/2] msvcr90: Implement fread_s.

Kusanagi Kouichi slash at ac.auone-net.jp
Thu Dec 22 05:08:49 CST 2011


On 2011-12-21 17:34:49 +0100, Piotr Caban wrote:
> On 12/21/11 16:49, Kusanagi Kouichi wrote:
> >+  if (bufsize / size<  count)
> >+  {
> >+    _invalid_parameter(NULL, NULL, NULL, 0, 0);
> >+    fseek(fp, bufsize, SEEK_CUR);
> It's not correct to make a seek here. The file position changes
> you're observing is related to data being read to FILE buffer.
> 
> This is also not working in case of small file. invalid_parameter
> handler should only be invoked if data is to big to fit into the
> buffer.

OK, I need more test.

> >+    /* fread_s raises an exeption if a file was opened by fopen */
> Probably you did something wrong here. It's allowed to use fread_s
> and fopen (unless there was a broken version of msvcrt90).
> >+    /* fclose raises an exception if a file was opened by fopen_s */
> This doesn't seem right as well.

It might be my fault. I can mix them normally. But even if the test do only

fopen()
fread_s()

or

fopen_s()
fclose()

it still raises an exception.

> >+    ret = p__fclose_nolock(file);
> It should be easy to add a proper implementation of _fclose_nolock.

It would be easy for you.



More information about the wine-devel mailing list