Alistair Leslie-Hughes : scrrun: Implement ITextStream Close.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jun 19 07:19:13 CDT 2015
Module: wine
Branch: master
Commit: 0a19048795f8084c448bab6d87c2d8170b8b0ba3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0a19048795f8084c448bab6d87c2d8170b8b0ba3
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Tue Jun 16 15:38:08 2015 +1000
scrrun: Implement ITextStream Close.
---
dlls/scrrun/filesystem.c | 12 ++++++++++--
dlls/scrrun/tests/filesystem.c | 12 ++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c
index d490d93..3de38d2 100644
--- a/dlls/scrrun/filesystem.c
+++ b/dlls/scrrun/filesystem.c
@@ -633,8 +633,16 @@ static HRESULT WINAPI textstream_SkipLine(ITextStream *iface)
static HRESULT WINAPI textstream_Close(ITextStream *iface)
{
struct textstream *This = impl_from_ITextStream(iface);
- FIXME("(%p): stub\n", This);
- return E_NOTIMPL;
+ HRESULT hr = S_OK;
+
+ TRACE("(%p)\n", This);
+
+ if(!CloseHandle(This->file))
+ hr = S_FALSE;
+
+ This->file = NULL;
+
+ return hr;
}
static const ITextStreamVtbl textstreamvtbl = {
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c
index b22e006..28242ce 100644
--- a/dlls/scrrun/tests/filesystem.c
+++ b/dlls/scrrun/tests/filesystem.c
@@ -35,6 +35,9 @@
static IFileSystem3 *fs3;
+/* w2k and 2k3 error code. */
+#define E_VAR_NOT_SET 0x800a005b
+
static inline ULONG get_refcount(IUnknown *iface)
{
IUnknown_AddRef(iface);
@@ -1378,6 +1381,15 @@ static void test_CreateTextFile(void)
hr = ITextStream_Read(stream, 1, &str);
ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr);
+ hr = ITextStream_Close(stream);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = ITextStream_Read(stream, 1, &str);
+ ok(hr == CTL_E_BADFILEMODE || hr == E_VAR_NOT_SET, "got 0x%08x\n", hr);
+
+ hr = ITextStream_Close(stream);
+ ok(hr == S_FALSE || hr == E_VAR_NOT_SET, "got 0x%08x\n", hr);
+
ITextStream_Release(stream);
/* check it's created */
More information about the wine-cvs
mailing list