Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
038438ad
Commit
038438ad
authored
Mar 19, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 19, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrrun: Implemented AtEndOfStream() property.
parent
18c350ae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
10 deletions
+48
-10
filesystem.c
dlls/scrrun/filesystem.c
+24
-2
filesystem.c
dlls/scrrun/tests/filesystem.c
+24
-8
No files found.
dlls/scrrun/filesystem.c
View file @
038438ad
...
...
@@ -111,6 +111,7 @@ struct textstream {
IOMode
mode
;
BOOL
unicode
;
BOOL
first_write
;
LARGE_INTEGER
size
;
HANDLE
file
;
};
...
...
@@ -332,8 +333,24 @@ static HRESULT WINAPI textstream_get_Column(ITextStream *iface, LONG *column)
static
HRESULT
WINAPI
textstream_get_AtEndOfStream
(
ITextStream
*
iface
,
VARIANT_BOOL
*
eos
)
{
struct
textstream
*
This
=
impl_from_ITextStream
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
eos
);
return
E_NOTIMPL
;
LARGE_INTEGER
pos
,
dist
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
eos
);
if
(
!
eos
)
return
E_POINTER
;
if
(
textstream_check_iomode
(
This
,
IORead
))
{
*
eos
=
VARIANT_TRUE
;
return
CTL_E_BADFILEMODE
;
}
dist
.
QuadPart
=
0
;
if
(
!
SetFilePointerEx
(
This
->
file
,
dist
,
&
pos
,
FILE_CURRENT
))
return
E_FAIL
;
*
eos
=
This
->
size
.
QuadPart
==
pos
.
QuadPart
?
VARIANT_TRUE
:
VARIANT_FALSE
;
return
S_OK
;
}
static
HRESULT
WINAPI
textstream_get_AtEndOfLine
(
ITextStream
*
iface
,
VARIANT_BOOL
*
eol
)
...
...
@@ -548,6 +565,11 @@ static HRESULT create_textstream(const WCHAR *filename, DWORD disposition, IOMod
return
hr
;
}
if
(
mode
==
ForReading
)
GetFileSizeEx
(
stream
->
file
,
&
stream
->
size
);
else
stream
->
size
.
QuadPart
=
0
;
*
ret
=
&
stream
->
ITextStream_iface
;
return
S_OK
;
}
...
...
dlls/scrrun/tests/filesystem.c
View file @
038438ad
...
...
@@ -154,9 +154,11 @@ static void test_textstream(void)
static
const
WCHAR
testfileW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'f'
,
'i'
,
'l'
,
'e'
,
'.'
,
't'
,
'x'
,
't'
,
0
};
ITextStream
*
stream
;
VARIANT_BOOL
b
;
DWORD
written
;
HANDLE
file
;
HRESULT
hr
;
BSTR
name
,
data
;
BOOL
ret
;
file
=
CreateFileW
(
testfileW
,
GENERIC_READ
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
CloseHandle
(
file
);
...
...
@@ -199,12 +201,14 @@ static void test_textstream(void)
hr
=
ITextStream_Write
(
stream
,
name
);
ok
(
hr
==
CTL_E_BADFILEMODE
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextStream_get_AtEndOfStream
(
stream
,
NULL
);
ok
(
hr
==
E_POINTER
,
"got 0x%08x
\n
"
,
hr
);
b
=
10
;
hr
=
ITextStream_get_AtEndOfStream
(
stream
,
&
b
);
todo_wine
{
ok
(
hr
==
S_FALSE
||
broken
(
hr
==
S_OK
),
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
S_FALSE
),
"got 0x%08x
\n
"
,
hr
);
ok
(
b
==
VARIANT_TRUE
,
"got 0x%x
\n
"
,
b
);
}
ITextStream_Release
(
stream
);
hr
=
IFileSystem3_OpenTextFile
(
fs3
,
name
,
ForWriting
,
VARIANT_FALSE
,
TristateFalse
,
&
stream
);
...
...
@@ -212,10 +216,9 @@ todo_wine {
b
=
10
;
hr
=
ITextStream_get_AtEndOfStream
(
stream
,
&
b
);
todo_wine
{
ok
(
hr
==
CTL_E_BADFILEMODE
,
"got 0x%08x
\n
"
,
hr
);
ok
(
b
==
VARIANT_TRUE
||
broken
(
b
==
10
),
"got 0x%x
\n
"
,
b
);
}
b
=
10
;
hr
=
ITextStream_get_AtEndOfLine
(
stream
,
&
b
);
todo_wine
{
...
...
@@ -235,14 +238,12 @@ todo_wine {
hr
=
IFileSystem3_OpenTextFile
(
fs3
,
name
,
ForAppending
,
VARIANT_FALSE
,
TristateFalse
,
&
stream
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
SysFreeString
(
name
);
b
=
10
;
hr
=
ITextStream_get_AtEndOfStream
(
stream
,
&
b
);
todo_wine
{
ok
(
hr
==
CTL_E_BADFILEMODE
,
"got 0x%08x
\n
"
,
hr
);
ok
(
b
==
VARIANT_TRUE
||
broken
(
b
==
10
),
"got 0x%x
\n
"
,
b
);
}
b
=
10
;
hr
=
ITextStream_get_AtEndOfLine
(
stream
,
&
b
);
todo_wine
{
...
...
@@ -260,6 +261,21 @@ todo_wine {
ITextStream_Release
(
stream
);
/* now with non-empty file */
file
=
CreateFileW
(
testfileW
,
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ret
=
WriteFile
(
file
,
testfileW
,
sizeof
(
testfileW
),
&
written
,
NULL
);
ok
(
ret
&&
written
==
sizeof
(
testfileW
),
"got %d
\n
"
,
ret
);
CloseHandle
(
file
);
hr
=
IFileSystem3_OpenTextFile
(
fs3
,
name
,
ForReading
,
VARIANT_FALSE
,
TristateFalse
,
&
stream
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
b
=
10
;
hr
=
ITextStream_get_AtEndOfStream
(
stream
,
&
b
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
b
==
VARIANT_FALSE
,
"got 0x%x
\n
"
,
b
);
ITextStream_Release
(
stream
);
SysFreeString
(
name
);
DeleteFileW
(
testfileW
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment