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
d2e1e5bf
Commit
d2e1e5bf
authored
Mar 24, 2008
by
Reece Dunn
Committed by
Alexandre Julliard
Mar 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Added SHCreateStreamOnFileA tests.
parent
be0799fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
0 deletions
+135
-0
Makefile.in
dlls/shlwapi/tests/Makefile.in
+1
-0
istream.c
dlls/shlwapi/tests/istream.c
+134
-0
No files found.
dlls/shlwapi/tests/Makefile.in
View file @
d2e1e5bf
...
...
@@ -10,6 +10,7 @@ CTESTS = \
clist.c
\
clsid.c
\
generated.c
\
istream.c
\
ordinal.c
\
path.c
\
shreg.c
\
...
...
dlls/shlwapi/tests/istream.c
0 → 100644
View file @
d2e1e5bf
/* Unit test suite for SHLWAPI ShCreateStreamOnFile functions.
*
* Copyright 2008 Reece H. Dunn
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include <stdarg.h>
#include <stdio.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "shlwapi.h"
/* Function pointers for the SHCreateStreamOnFile functions */
static
HMODULE
hShlwapi
;
static
HRESULT
(
WINAPI
*
pSHCreateStreamOnFileA
)(
LPCSTR
file
,
DWORD
mode
,
IStream
**
stream
);
static
void
test_SHCreateStreamOnFileA
(
DWORD
mode
)
{
IStream
*
stream
;
HRESULT
ret
;
ULONG
refcount
;
static
const
char
*
test_file
=
"c:
\\
test.txt"
;
printf
(
"SHCreateStreamOnFileA: testing mode %d
\n
"
,
mode
);
/* invalid arguments */
stream
=
NULL
;
ret
=
(
*
pSHCreateStreamOnFileA
)(
NULL
,
mode
,
&
stream
);
todo_wine
ok
(
ret
==
HRESULT_FROM_WIN32
(
ERROR_PATH_NOT_FOUND
),
"SHCreateStreamOnFileA: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), got 0x%08x
\n
"
,
ret
);
ok
(
stream
==
NULL
,
"SHCreateStreamOnFileA: expected a NULL IStream object, got %p
\n
"
,
stream
);
#if 0 /* This test crashes on WinXP SP2 */
ret = (*pSHCreateStreamOnFileA)(test_file, mode, NULL);
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
#endif
stream
=
NULL
;
ret
=
(
*
pSHCreateStreamOnFileA
)(
test_file
,
mode
|
STGM_CONVERT
,
&
stream
);
ok
(
ret
==
E_INVALIDARG
,
"SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x
\n
"
,
ret
);
ok
(
stream
==
NULL
,
"SHCreateStreamOnFileA: expected a NULL IStream object, got %p
\n
"
,
stream
);
stream
=
NULL
;
ret
=
(
*
pSHCreateStreamOnFileA
)(
test_file
,
mode
|
STGM_DELETEONRELEASE
,
&
stream
);
ok
(
ret
==
E_INVALIDARG
,
"SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x
\n
"
,
ret
);
ok
(
stream
==
NULL
,
"SHCreateStreamOnFileA: expected a NULL IStream object, got %p
\n
"
,
stream
);
/* file does not exist */
stream
=
NULL
;
ret
=
(
*
pSHCreateStreamOnFileA
)(
test_file
,
mode
|
STGM_FAILIFTHERE
,
&
stream
);
todo_wine
ok
(
ret
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"SHCreateStreamOnFileA: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x
\n
"
,
ret
);
ok
(
stream
==
NULL
,
"SHCreateStreamOnFileA: expected a NULL IStream object, got %p
\n
"
,
stream
);
stream
=
NULL
;
ret
=
(
*
pSHCreateStreamOnFileA
)(
test_file
,
mode
|
STGM_CREATE
,
&
stream
);
todo_wine
ok
(
ret
==
S_OK
,
"SHCreateStreamOnFileA: expected S_OK, got 0x%08x
\n
"
,
ret
);
todo_wine
ok
(
stream
!=
NULL
,
"SHCreateStreamOnFileA: expected a valid IStream object, got NULL
\n
"
);
if
(
stream
)
{
refcount
=
IStream_Release
(
stream
);
ok
(
refcount
==
0
,
"SHCreateStreamOnFileA: expected 0, got %d
\n
"
,
refcount
);
}
/* NOTE: don't delete the file, as it will be used for the file exists tests. */
/* file exists */
stream
=
NULL
;
ret
=
(
*
pSHCreateStreamOnFileA
)(
test_file
,
mode
|
STGM_FAILIFTHERE
,
&
stream
);
todo_wine
ok
(
ret
==
S_OK
,
"SHCreateStreamOnFileA: expected S_OK, got 0x%08x
\n
"
,
ret
);
todo_wine
ok
(
stream
!=
NULL
,
"SHCreateStreamOnFileA: expected a valid IStream object, got NULL
\n
"
);
if
(
stream
)
{
refcount
=
IStream_Release
(
stream
);
ok
(
refcount
==
0
,
"SHCreateStreamOnFileA: expected 0, got %d
\n
"
,
refcount
);
}
stream
=
NULL
;
ret
=
(
*
pSHCreateStreamOnFileA
)(
test_file
,
mode
|
STGM_CREATE
,
&
stream
);
todo_wine
ok
(
ret
==
S_OK
,
"SHCreateStreamOnFileA: expected S_OK, got 0x%08x
\n
"
,
ret
);
todo_wine
ok
(
stream
!=
NULL
,
"SHCreateStreamOnFileA: expected a valid IStream object, got NULL
\n
"
);
if
(
stream
)
{
refcount
=
IStream_Release
(
stream
);
ok
(
refcount
==
0
,
"SHCreateStreamOnFileA: expected 0, got %d
\n
"
,
refcount
);
ok
(
DeleteFileA
(
test_file
),
"SHCreateStreamOnFileA: could not delete file '%s', got error %d
\n
"
,
test_file
,
GetLastError
());
}
}
START_TEST
(
istream
)
{
hShlwapi
=
GetModuleHandleA
(
"shlwapi.dll"
);
pSHCreateStreamOnFileA
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"SHCreateStreamOnFileA"
);
if
(
!
pSHCreateStreamOnFileA
)
printf
(
"SHCreateStreamOnFileA not found... skipping tests.
\n
"
);
else
{
test_SHCreateStreamOnFileA
(
STGM_READ
);
test_SHCreateStreamOnFileA
(
STGM_WRITE
);
test_SHCreateStreamOnFileA
(
STGM_READWRITE
);
}
}
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