diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 6b9a8208d66..079c57bc091 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -8789,9 +8789,27 @@ DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg, 12) basic_istream_char* __thiscall basic_istream_char_seekg(basic_istream_char *this, streamoff off, int dir) { basic_ios_char *base = basic_istream_char_get_basic_ios(this); +#if _MSVCP_VER >= 110 + IOSB_iostate state; TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), dir); + state = ios_base_rdstate(&base->base); + ios_base_clear(&base->base, state & ~IOSTATE_eofbit); + + if(basic_istream_char_sentry_create(this, TRUE)) { + basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base); + fpos_int ret; + + basic_streambuf_char_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in); + + if(ret.off==-1 && ret.pos==0 && ret.state==0) + basic_ios_char_setstate(base, IOSTATE_failbit); + } + basic_istream_char_sentry_destroy(this); +#else + TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), dir); + if(!ios_base_fail(&base->base)) { basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base); fpos_int ret; @@ -8805,7 +8823,7 @@ basic_istream_char* __thiscall basic_istream_char_seekg(basic_istream_char *this return this; }else basic_ios_char_clear(base, IOSTATE_goodbit); - +#endif return this; } @@ -8815,9 +8833,27 @@ DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg_fpos, 28) basic_istream_char* __thiscall basic_istream_char_seekg_fpos(basic_istream_char *this, fpos_int pos) { basic_ios_char *base = basic_istream_char_get_basic_ios(this); +#if _MSVCP_VER >= 110 + IOSB_iostate state; TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos)); + state = ios_base_rdstate(&base->base); + ios_base_clear(&base->base, state & ~IOSTATE_eofbit); + + if(basic_istream_char_sentry_create(this, TRUE)) { + basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base); + fpos_int ret; + + basic_streambuf_char_pubseekpos(strbuf, &ret, pos, OPENMODE_in); + + if(ret.off==-1 && ret.pos==0 && ret.state==0) + basic_ios_char_setstate(base, IOSTATE_failbit); + } + basic_istream_char_sentry_destroy(this); +#else + TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos)); + if(!ios_base_fail(&base->base)) { basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base); fpos_int ret; @@ -8831,7 +8867,7 @@ basic_istream_char* __thiscall basic_istream_char_seekg_fpos(basic_istream_char return this; }else basic_ios_char_clear(base, IOSTATE_goodbit); - +#endif return this; } @@ -10328,9 +10364,27 @@ DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg, 12) basic_istream_wchar* __thiscall basic_istream_wchar_seekg(basic_istream_wchar *this, streamoff off, int dir) { basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this); +#if _MSVCP_VER >= 110 + IOSB_iostate state; TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), dir); + state = ios_base_rdstate(&base->base); + ios_base_clear(&base->base, state & ~IOSTATE_eofbit); + + if(basic_istream_wchar_sentry_create(this, TRUE)) { + basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base); + fpos_int ret; + + basic_streambuf_wchar_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in); + + if(ret.off==-1 && ret.pos==0 && ret.state==0) + basic_ios_wchar_setstate(base, IOSTATE_failbit); + } + basic_istream_wchar_sentry_destroy(this); +#else + TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), dir); + if(!ios_base_fail(&base->base)) { basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base); fpos_int ret; @@ -10344,7 +10398,7 @@ basic_istream_wchar* __thiscall basic_istream_wchar_seekg(basic_istream_wchar *t return this; }else basic_ios_wchar_clear(base, IOSTATE_goodbit); - +#endif return this; } @@ -10356,9 +10410,27 @@ DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg_fpos, 28) basic_istream_wchar* __thiscall basic_istream_wchar_seekg_fpos(basic_istream_wchar *this, fpos_int pos) { basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this); +#if _MSVCP_VER >= 110 + IOSB_iostate state; TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos)); + state = ios_base_rdstate(&base->base); + ios_base_clear(&base->base, state & ~IOSTATE_eofbit); + + if(basic_istream_wchar_sentry_create(this, TRUE)) { + basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base); + fpos_int ret; + + basic_streambuf_wchar_pubseekpos(strbuf, &ret, pos, OPENMODE_in); + + if(ret.off==-1 && ret.pos==0 && ret.state==0) + basic_ios_wchar_setstate(base, IOSTATE_failbit); + } + basic_istream_wchar_sentry_destroy(this); +#else + TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos)); + if(!ios_base_fail(&base->base)) { basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base); fpos_int ret; @@ -10372,7 +10444,7 @@ basic_istream_wchar* __thiscall basic_istream_wchar_seekg_fpos(basic_istream_wch return this; }else basic_ios_wchar_clear(base, IOSTATE_goodbit); - +#endif return this; }