[2/4] msvcirt: Implement ios::flags (try 5)
Iván Matellanes
matellanesivan at gmail.com
Thu Jul 16 06:12:35 CDT 2015
---
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 at 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 at 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 at ios@@QEAAXXZ");
SET(p_ios_lockbuf, "?lockbuf at ios@@QEAAXXZ");
SET(p_ios_unlockbuf, "?unlockbuf at ios@@QEAAXXZ");
+ SET(p_ios_flags_set, "?flags at ios@@QEAAJJ at Z");
+ SET(p_ios_flags_get, "?flags at ios@@QEBAJXZ");
} else {
p_operator_new = (void*)GetProcAddress(msvcrt, "??2 at YAPAXI@Z");
@@ -283,6 +287,8 @@ static BOOL init(void)
SET(p_ios_unlock, "?unlock at ios@@QAAXXZ");
SET(p_ios_lockbuf, "?lockbuf at ios@@QAAXXZ");
SET(p_ios_unlockbuf, "?unlockbuf at ios@@QAAXXZ");
+ SET(p_ios_flags_set, "?flags at ios@@QAEJJ at Z");
+ SET(p_ios_flags_get, "?flags at ios@@QBEJXZ");
}
SET(p_ios_static_lock, "?x_lockc at ios@@0U_CRT_CRITICAL_SECTION@@A");
SET(p_ios_lockc, "?lockc at 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]);
--
2.1.4
More information about the wine-patches
mailing list