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
bc3fa107
Commit
bc3fa107
authored
Nov 10, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Nov 11, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Add tests for IStorage_RenameElement.
parent
87ed7d9b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
0 deletions
+81
-0
storage32.c
dlls/ole32/tests/storage32.c
+81
-0
No files found.
dlls/ole32/tests/storage32.c
View file @
bc3fa107
...
...
@@ -1044,6 +1044,7 @@ static void test_substorage_share(void)
HRESULT
r
;
static
const
WCHAR
stgname
[]
=
{
'P'
,
'E'
,
'R'
,
'M'
,
'S'
,
'T'
,
'G'
,
0
};
static
const
WCHAR
stmname
[]
=
{
'C'
,
'O'
,
'N'
,
'T'
,
'E'
,
'N'
,
'T'
,
'S'
,
0
};
static
const
WCHAR
othername
[]
=
{
'N'
,
'E'
,
'W'
,
'N'
,
'A'
,
'M'
,
'E'
,
0
};
DeleteFileA
(
filenameA
);
...
...
@@ -1070,6 +1071,11 @@ static void test_substorage_share(void)
if
(
r
==
S_OK
)
IStorage_Release
(
stg3
);
/* cannot rename the storage while it's open */
r
=
IStorage_RenameElement
(
stg
,
stgname
,
othername
);
todo_wine
ok
(
r
==
STG_E_ACCESSDENIED
,
"IStorage->RenameElement should fail %08x
\n
"
,
r
);
if
(
SUCCEEDED
(
r
))
IStorage_RenameElement
(
stg
,
othername
,
stgname
);
#if 0
/* This crashes on Wine. */
...
...
@@ -1105,6 +1111,11 @@ static void test_substorage_share(void)
if
(
r
==
S_OK
)
IStorage_Release
(
stm2
);
/* cannot rename the stream while it's open */
r
=
IStorage_RenameElement
(
stg
,
stmname
,
othername
);
todo_wine
ok
(
r
==
STG_E_ACCESSDENIED
,
"IStorage->RenameElement should fail %08x
\n
"
,
r
);
if
(
SUCCEEDED
(
r
))
IStorage_RenameElement
(
stg
,
othername
,
stmname
);
/* destroying an object while it's open invalidates it */
r
=
IStorage_DestroyElement
(
stg
,
stmname
);
ok
(
r
==
S_OK
,
"IStorage->DestroyElement failed, hr=%08x
\n
"
,
r
);
...
...
@@ -2319,6 +2330,75 @@ cleanup:
DeleteFileW
(
file2_name
);
}
static
void
test_rename
(
void
)
{
IStorage
*
stg
,
*
stg2
;
IStream
*
stm
;
HRESULT
r
;
static
const
WCHAR
stgname
[]
=
{
'P'
,
'E'
,
'R'
,
'M'
,
'S'
,
'T'
,
'G'
,
0
};
static
const
WCHAR
stgname2
[]
=
{
'S'
,
'T'
,
'G'
,
0
};
static
const
WCHAR
stmname
[]
=
{
'C'
,
'O'
,
'N'
,
'T'
,
'E'
,
'N'
,
'T'
,
'S'
,
0
};
static
const
WCHAR
stmname2
[]
=
{
'E'
,
'N'
,
'T'
,
'S'
,
0
};
DeleteFileA
(
filenameA
);
/* create the file */
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgCreateDocfile failed
\n
"
);
/* create a substorage */
r
=
IStorage_CreateStorage
(
stg
,
stgname
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
0
,
&
stg2
);
ok
(
r
==
S_OK
,
"IStorage->CreateStorage failed, hr=%08x
\n
"
,
r
);
/* create a stream in the substorage */
r
=
IStorage_CreateStream
(
stg2
,
stmname
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
0
,
&
stm
);
ok
(
r
==
S_OK
,
"IStorage->CreateStream failed, hr=%08x
\n
"
,
r
);
IStream_Release
(
stm
);
/* rename the stream */
r
=
IStorage_RenameElement
(
stg2
,
stmname
,
stmname2
);
ok
(
r
==
S_OK
,
"IStorage->RenameElement failed, hr=%08x
\n
"
,
r
);
/* cannot open stream with old name */
r
=
IStorage_OpenStream
(
stg2
,
stmname
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stm
);
ok
(
r
==
STG_E_FILENOTFOUND
,
"IStorage_OpenStream should fail, hr=%08x
\n
"
,
r
);
if
(
SUCCEEDED
(
r
))
IStream_Release
(
stm
);
/* can open stream with new name */
r
=
IStorage_OpenStream
(
stg2
,
stmname2
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stm
);
ok
(
r
==
S_OK
,
"IStorage_OpenStream failed, hr=%08x
\n
"
,
r
);
if
(
SUCCEEDED
(
r
))
IStream_Release
(
stm
);
IStorage_Release
(
stg2
);
/* rename the storage */
IStorage_RenameElement
(
stg
,
stgname
,
stgname2
);
/* cannot open storage with old name */
r
=
IStorage_OpenStorage
(
stg
,
stgname
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
NULL
,
0
,
&
stg2
);
ok
(
r
==
STG_E_FILENOTFOUND
,
"IStorage_OpenStream should fail, hr=%08x
\n
"
,
r
);
if
(
SUCCEEDED
(
r
))
IStorage_Release
(
stg2
);
/* can open storage with new name */
r
=
IStorage_OpenStorage
(
stg
,
stgname2
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
NULL
,
0
,
&
stg2
);
ok
(
r
==
S_OK
,
"IStorage_OpenStream should fail, hr=%08x
\n
"
,
r
);
if
(
SUCCEEDED
(
r
))
{
/* opened storage still has the stream */
r
=
IStorage_OpenStream
(
stg2
,
stmname2
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stm
);
ok
(
r
==
S_OK
,
"IStorage_OpenStream failed, hr=%08x
\n
"
,
r
);
if
(
SUCCEEDED
(
r
))
IStream_Release
(
stm
);
IStorage_Release
(
stg2
);
}
IStorage_Release
(
stg
);
r
=
DeleteFileA
(
filenameA
);
ok
(
r
==
TRUE
,
"deleted file
\n
"
);
}
START_TEST
(
storage32
)
{
CHAR
temp
[
MAX_PATH
];
...
...
@@ -2354,4 +2434,5 @@ START_TEST(storage32)
test_copyto_snbexclusions
();
test_copyto_iidexclusions_storage
();
test_copyto_iidexclusions_stream
();
test_rename
();
}
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