Module: wine Branch: master Commit: 6f89103b72138215ec83755fde73b631c4e8fc8a URL: http://source.winehq.org/git/wine.git/?a=commit;h=6f89103b72138215ec83755fde...
Author: Iván Matellanes matellanesivan@gmail.com Date: Thu Jul 16 13:12:35 2015 +0200
msvcirt: Implement ios::flags.
---
dlls/msvcirt/msvcirt.c | 12 ++++++++---- dlls/msvcirt/tests/msvcirt.c | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c index e46f574..0a9dc34 100644 --- a/dlls/msvcirt/msvcirt.c +++ b/dlls/msvcirt/msvcirt.c @@ -937,8 +937,12 @@ char __thiscall ios_fill_get(const ios *this) DEFINE_THISCALL_WRAPPER(ios_flags_set, 8) LONG __thiscall ios_flags_set(ios *this, LONG flags) { - FIXME("(%p %x) stub\n", this, flags); - return 0; + LONG prev = this->flags; + + TRACE("(%p %x)\n", this, flags); + + this->flags = flags; + return prev; }
/* ?flags@ios@@QBEJXZ */ @@ -946,8 +950,8 @@ LONG __thiscall ios_flags_set(ios *this, LONG flags) DEFINE_THISCALL_WRAPPER(ios_flags_get, 4) LONG __thiscall ios_flags_get(const ios *this) { - FIXME("(%p) stub\n", this); - return 0; + TRACE("(%p)\n", this); + return this->flags; }
/* ?good@ios@@QBEHXZ */ diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c index 523fb45..faddae1 100644 --- a/dlls/msvcirt/tests/msvcirt.c +++ b/dlls/msvcirt/tests/msvcirt.c @@ -137,6 +137,8 @@ static void (*__cdecl p_ios_unlockbuf)(ios*); static CRITICAL_SECTION *p_ios_static_lock; static void (*__cdecl p_ios_lockc)(void); static void (*__cdecl p_ios_unlockc)(void); +static LONG (*__thiscall p_ios_flags_set)(ios*, LONG); +static LONG (*__thiscall p_ios_flags_get)(const ios*);
/* Emulate a __thiscall */ #ifdef __i386__ @@ -245,6 +247,8 @@ static BOOL init(void) SET(p_ios_unlock, "?unlock@ios@@QEAAXXZ"); SET(p_ios_lockbuf, "?lockbuf@ios@@QEAAXXZ"); SET(p_ios_unlockbuf, "?unlockbuf@ios@@QEAAXXZ"); + SET(p_ios_flags_set, "?flags@ios@@QEAAJJ@Z"); + SET(p_ios_flags_get, "?flags@ios@@QEBAJXZ"); } else { p_operator_new = (void*)GetProcAddress(msvcrt, "??2@YAPAXI@Z");
@@ -283,6 +287,8 @@ static BOOL init(void) SET(p_ios_unlock, "?unlock@ios@@QAAXXZ"); SET(p_ios_lockbuf, "?lockbuf@ios@@QAAXXZ"); SET(p_ios_unlockbuf, "?unlockbuf@ios@@QAAXXZ"); + SET(p_ios_flags_set, "?flags@ios@@QAEJJ@Z"); + SET(p_ios_flags_get, "?flags@ios@@QBEJXZ"); } SET(p_ios_static_lock, "?x_lockc@ios@@0U_CRT_CRITICAL_SECTION@@A"); SET(p_ios_lockc, "?lockc@ios@@KAXXZ"); @@ -859,6 +865,7 @@ static void test_ios(void) struct ios_lock_arg lock_arg; HANDLE thread; BOOL locked; + LONG ret;
memset(&ios_obj, 0xab, sizeof(ios)); memset(&ios_obj2, 0xab, sizeof(ios)); @@ -984,6 +991,17 @@ static void test_ios(void) locked = TryEnterCriticalSection(p_ios_static_lock); ok(locked == 0, "the static critical section was not locked before\n");
+ /* flags */ + ios_obj.flags = 0x8000; + ret = (LONG) call_func1(p_ios_flags_get, &ios_obj); + ok(ret == 0x8000, "expected %x got %x\n", 0x8000, ret); + ret = (LONG) call_func2(p_ios_flags_set, &ios_obj, 0x444); + ok(ret == 0x8000, "expected %x got %x\n", 0x8000, ret); + ok(ios_obj.flags == 0x444, "expected %x got %x\n", 0x444, ios_obj.flags); + ret = (LONG) call_func2(p_ios_flags_set, &ios_obj, 0); + ok(ret == 0x444, "expected %x got %x\n", 0x444, ret); + ok(ios_obj.flags == 0, "expected %x got %x\n", 0, ios_obj.flags); + SetEvent(lock_arg.release[0]); SetEvent(lock_arg.release[1]); SetEvent(lock_arg.release[2]);