[4/4] msvcirt: Implement ios::unsetf (try 5)
Iván Matellanes
matellanesivan at gmail.com
Thu Jul 16 06:12:45 CDT 2015
---
dlls/msvcirt/msvcirt.c | 10 ++++++++--
dlls/msvcirt/tests/msvcirt.c | 11 +++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c
index f0ae115..a0d670f 100644
--- a/dlls/msvcirt/msvcirt.c
+++ b/dlls/msvcirt/msvcirt.c
@@ -1176,8 +1176,14 @@ void __cdecl ios_unlockc(void)
DEFINE_THISCALL_WRAPPER(ios_unsetf, 8)
LONG __thiscall ios_unsetf(ios *this, LONG flags)
{
- FIXME("(%p %x) stub\n", this, flags);
- return 0;
+ LONG prev = this->flags;
+
+ TRACE("(%p %x)\n", this, flags);
+
+ ios_lock(this);
+ this->flags &= ~flags;
+ ios_unlock(this);
+ return prev;
}
/* ?width at ios@@QAEHH at Z */
diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c
index 05fb84c..1b730b9 100644
--- a/dlls/msvcirt/tests/msvcirt.c
+++ b/dlls/msvcirt/tests/msvcirt.c
@@ -141,6 +141,7 @@ static LONG (*__thiscall p_ios_flags_set)(ios*, LONG);
static LONG (*__thiscall p_ios_flags_get)(const ios*);
static LONG (*__thiscall p_ios_setf)(ios*, LONG);
static LONG (*__thiscall p_ios_setf_mask)(ios*, LONG, LONG);
+static LONG (*__thiscall p_ios_unsetf)(ios*, LONG);
/* Emulate a __thiscall */
#ifdef __i386__
@@ -253,6 +254,7 @@ static BOOL init(void)
SET(p_ios_flags_get, "?flags at ios@@QEBAJXZ");
SET(p_ios_setf, "?setf at ios@@QEAAJJ at Z");
SET(p_ios_setf_mask, "?setf at ios@@QEAAJJJ at Z");
+ SET(p_ios_unsetf, "?unsetf at ios@@QEAAJJ at Z");
} else {
p_operator_new = (void*)GetProcAddress(msvcrt, "??2 at YAPAXI@Z");
@@ -295,6 +297,7 @@ static BOOL init(void)
SET(p_ios_flags_get, "?flags at ios@@QBEJXZ");
SET(p_ios_setf, "?setf at ios@@QAEJJ at Z");
SET(p_ios_setf_mask, "?setf at ios@@QAEJJJ at Z");
+ SET(p_ios_unsetf, "?unsetf at ios@@QAEJJ at Z");
}
SET(p_ios_static_lock, "?x_lockc at ios@@0U_CRT_CRITICAL_SECTION@@A");
SET(p_ios_lockc, "?lockc at ios@@KAXXZ");
@@ -1020,6 +1023,14 @@ static void test_ios(void)
ret = (LONG) call_func3(p_ios_setf_mask, &ios_obj, 0x111, 0x105);
ok(ret == 0x8444, "expected %x got %x\n", 0x8444, ret);
ok(ios_obj.flags == 0x8541, "expected %x got %x\n", 0x8541, ios_obj.flags);
+
+ /* unsetf */
+ ret = (LONG) call_func2(p_ios_unsetf, &ios_obj, 0x1111);
+ ok(ret == 0x8541, "expected %x got %x\n", 0x8541, ret);
+ ok(ios_obj.flags == 0x8440, "expected %x got %x\n", 0x8440, ios_obj.flags);
+ ret = (LONG) call_func2(p_ios_unsetf, &ios_obj, 0x8008);
+ ok(ret == 0x8440, "expected %x got %x\n", 0x8440, ret);
+ ok(ios_obj.flags == 0x440, "expected %x got %x\n", 0x440, ios_obj.flags);
ios_obj.do_lock = -1;
SetEvent(lock_arg.release[0]);
--
2.1.4
More information about the wine-patches
mailing list