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
df24ec66
Commit
df24ec66
authored
Jun 02, 2009
by
Paul Vriens
Committed by
Alexandre Julliard
Jun 03, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32/tests: Run more tests on Win9x by using A-functions.
parent
08a6e0c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
68 deletions
+51
-68
storage32.c
dlls/ole32/tests/storage32.c
+51
-68
No files found.
dlls/ole32/tests/storage32.c
View file @
df24ec66
...
...
@@ -33,9 +33,8 @@ DEFINE_GUID( test_stg_cls, 0x88888888, 0x0425, 0x0000, 0,0,0,0,0,0,0,0);
#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
static
const
WCHAR
szPrefix
[]
=
{
's'
,
't'
,
'g'
,
0
};
static
const
WCHAR
szDot
[]
=
{
'.'
,
0
};
WCHAR
filename
[
MAX_PATH
];
static
CHAR
filenameA
[
MAX_PATH
];
static
WCHAR
filename
[
MAX_PATH
];
static
void
test_hglobal_storage_stat
(
void
)
{
...
...
@@ -74,10 +73,7 @@ static void test_create_storage_modes(void)
IStorage
*
stg
=
NULL
;
HRESULT
r
;
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
DeleteFileW
(
filename
);
DeleteFileA
(
filenameA
);
/* test with some invalid parameters */
r
=
StgCreateDocfile
(
NULL
,
0
,
0
,
&
stg
);
...
...
@@ -145,7 +141,7 @@ static void test_create_storage_modes(void)
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile wrong error
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_TRANSACTED
|
STGM_SHARE_DENY_WRITE
|
STGM_READ
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile wrong error
\n
"
);
ok
(
DeleteFile
W
(
filename
),
"failed to delete file
\n
"
);
ok
(
DeleteFile
A
(
filenameA
),
"failed to delete file
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
|
STGM_TRANSACTED
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgCreateDocfile failed
\n
"
);
...
...
@@ -162,13 +158,13 @@ static void test_create_storage_modes(void)
ok
(
r
==
S_OK
,
"StgCreateDocfile failed
\n
"
);
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
ok
(
DeleteFile
W
(
filename
),
"failed to delete file
\n
"
);
ok
(
DeleteFile
A
(
filenameA
),
"failed to delete file
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_READWRITE
|
STGM_TRANSACTED
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgCreateDocfile failed
\n
"
);
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
ok
(
DeleteFile
W
(
filename
),
"failed to delete file
\n
"
);
ok
(
DeleteFile
A
(
filenameA
),
"failed to delete file
\n
"
);
/* test the way excel uses StgCreateDocFile */
r
=
StgCreateDocfile
(
filename
,
STGM_TRANSACTED
|
STGM_CREATE
|
STGM_SHARE_DENY_WRITE
|
STGM_READWRITE
,
0
,
&
stg
);
...
...
@@ -177,7 +173,7 @@ static void test_create_storage_modes(void)
{
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
ok
(
DeleteFile
W
(
filename
),
"failed to delete file
\n
"
);
ok
(
DeleteFile
A
(
filenameA
),
"failed to delete file
\n
"
);
}
/* and the way windows media uses it ... */
...
...
@@ -187,7 +183,7 @@ static void test_create_storage_modes(void)
{
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
ok
(
DeleteFile
W
(
filename
),
"failed to delete file
\n
"
);
ok
(
DeleteFile
A
(
filenameA
),
"failed to delete file
\n
"
);
}
/* looks like we need STGM_TRANSACTED or STGM_CREATE */
...
...
@@ -197,7 +193,7 @@ static void test_create_storage_modes(void)
{
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
ok
(
DeleteFile
W
(
filename
),
"failed to delete file
\n
"
);
ok
(
DeleteFile
A
(
filenameA
),
"failed to delete file
\n
"
);
}
r
=
StgCreateDocfile
(
filename
,
STGM_TRANSACTED
|
STGM_CREATE
|
STGM_SHARE_DENY_WRITE
|
STGM_WRITE
,
0
,
&
stg
);
...
...
@@ -206,7 +202,7 @@ static void test_create_storage_modes(void)
{
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
ok
(
DeleteFile
W
(
filename
),
"failed to delete file
\n
"
);
ok
(
DeleteFile
A
(
filenameA
),
"failed to delete file
\n
"
);
}
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
&
stg
);
...
...
@@ -215,7 +211,7 @@ static void test_create_storage_modes(void)
{
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
ok
(
DeleteFile
W
(
filename
),
"failed to delete file
\n
"
);
ok
(
DeleteFile
A
(
filenameA
),
"failed to delete file
\n
"
);
}
/* test the way msi uses StgCreateDocfile */
...
...
@@ -223,7 +219,7 @@ static void test_create_storage_modes(void)
ok
(
r
==
S_OK
,
"StgCreateDocFile failed
\n
"
);
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
ok
(
DeleteFile
W
(
filename
),
"failed to delete file
\n
"
);
ok
(
DeleteFile
A
(
filenameA
),
"failed to delete file
\n
"
);
}
static
void
test_storage_stream
(
void
)
...
...
@@ -242,10 +238,7 @@ static void test_storage_stream(void)
ULARGE_INTEGER
p
;
unsigned
char
buffer
[
0x100
];
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
DeleteFileW
(
filename
);
DeleteFileA
(
filenameA
);
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
|
STGM_TRANSACTED
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgCreateDocfile failed
\n
"
);
...
...
@@ -343,15 +336,15 @@ static void test_storage_stream(void)
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"wrong ref count
\n
"
);
r
=
DeleteFile
W
(
filename
);
r
=
DeleteFile
A
(
filenameA
);
ok
(
r
,
"file should exist
\n
"
);
}
static
BOOL
touch_file
(
LPC
W
STR
filename
)
static
BOOL
touch_file
(
LPCSTR
filename
)
{
HANDLE
file
;
file
=
CreateFile
W
(
filename
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
file
=
CreateFile
A
(
filename
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
file
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
...
...
@@ -359,12 +352,12 @@ static BOOL touch_file(LPCWSTR filename)
return
TRUE
;
}
static
BOOL
is_zero_length
(
LPC
W
STR
filename
)
static
BOOL
is_zero_length
(
LPCSTR
filename
)
{
HANDLE
file
;
DWORD
len
;
file
=
CreateFile
W
(
filename
,
GENERIC_READ
,
0
,
NULL
,
file
=
CreateFile
A
(
filename
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
file
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
...
...
@@ -373,11 +366,11 @@ static BOOL is_zero_length(LPCWSTR filename)
return
len
==
0
;
}
static
BOOL
is_existing_file
(
LPC
W
STR
filename
)
static
BOOL
is_existing_file
(
LPCSTR
filename
)
{
HANDLE
file
;
file
=
CreateFile
W
(
filename
,
GENERIC_READ
,
0
,
NULL
,
file
=
CreateFile
A
(
filename
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
file
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
...
...
@@ -392,12 +385,9 @@ static void test_open_storage(void)
HRESULT
r
;
DWORD
stgm
;
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
/* try opening a zero length file - it should stay zero length */
DeleteFile
W
(
filename
);
touch_file
(
filename
);
DeleteFile
A
(
filenameA
);
touch_file
(
filename
A
);
stgm
=
STGM_NOSCRATCH
|
STGM_TRANSACTED
|
STGM_SHARE_DENY_WRITE
|
STGM_READWRITE
;
r
=
StgOpenStorage
(
filename
,
NULL
,
stgm
,
NULL
,
0
,
&
stg
);
ok
(
r
==
STG_E_FILEALREADYEXISTS
,
"StgOpenStorage didn't fail
\n
"
);
...
...
@@ -405,17 +395,17 @@ static void test_open_storage(void)
stgm
=
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
;
r
=
StgOpenStorage
(
filename
,
NULL
,
stgm
,
NULL
,
0
,
&
stg
);
ok
(
r
==
STG_E_FILEALREADYEXISTS
,
"StgOpenStorage didn't fail
\n
"
);
ok
(
is_zero_length
(
filename
),
"file length changed
\n
"
);
ok
(
is_zero_length
(
filename
A
),
"file length changed
\n
"
);
DeleteFile
W
(
filename
);
DeleteFile
A
(
filenameA
);
/* try opening a nonexistent file - it should not create it */
stgm
=
STGM_DIRECT
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
;
r
=
StgOpenStorage
(
filename
,
NULL
,
stgm
,
NULL
,
0
,
&
stg
);
ok
(
r
!=
S_OK
,
"StgOpenStorage failed: 0x%08x
\n
"
,
r
);
if
(
r
==
S_OK
)
IStorage_Release
(
stg
);
ok
(
!
is_existing_file
(
filename
),
"StgOpenStorage should not create a file
\n
"
);
DeleteFile
W
(
filename
);
ok
(
!
is_existing_file
(
filename
A
),
"StgOpenStorage should not create a file
\n
"
);
DeleteFile
A
(
filenameA
);
/* create the file */
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
|
STGM_TRANSACTED
,
0
,
&
stg
);
...
...
@@ -553,7 +543,7 @@ static void test_open_storage(void)
r
=
StgOpenStorage
(
filename
,
NULL
,
STGM_NOSNAPSHOT
|
STGM_PRIORITY
,
NULL
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"should fail
\n
"
);
r
=
DeleteFile
W
(
filename
);
r
=
DeleteFile
A
(
filenameA
);
ok
(
r
,
"file didn't exist
\n
"
);
}
...
...
@@ -564,10 +554,7 @@ static void test_storage_suminfo(void)
IPropertyStorage
*
ps
=
NULL
;
HRESULT
r
;
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
DeleteFileW
(
filename
);
DeleteFileA
(
filenameA
);
/* create the file */
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
...
...
@@ -665,7 +652,7 @@ static void test_storage_suminfo(void)
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"ref count wrong
\n
"
);
DeleteFile
W
(
filename
);
DeleteFile
A
(
filenameA
);
}
static
void
test_storage_refcount
(
void
)
...
...
@@ -680,10 +667,7 @@ static void test_storage_refcount(void)
STATSTG
stat
;
char
buffer
[
10
];
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
DeleteFileW
(
filename
);
DeleteFileA
(
filenameA
);
/* create the file */
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
...
...
@@ -763,7 +747,7 @@ static void test_storage_refcount(void)
r
=
IStorage_Stat
(
stg2
,
&
statstg
,
STATFLAG_DEFAULT
);
ok
(
r
==
S_OK
,
"Stat should have succeded instead of returning 0x%08x
\n
"
,
r
);
ok
(
!
lstrcmpW
(
statstg
.
pwcsName
,
stgname
),
ok
(
!
memcmp
(
statstg
.
pwcsName
,
stgname
,
sizeof
(
stgname
)
),
"Statstg pwcsName should have been the name the storage was created with
\n
"
);
ok
(
statstg
.
type
==
STGTY_STORAGE
,
"Statstg type should have been STGTY_STORAGE instead of %d
\n
"
,
statstg
.
type
);
ok
(
U
(
statstg
.
cbSize
).
LowPart
==
0
,
"Statstg cbSize.LowPart should have been 0 instead of %d
\n
"
,
U
(
statstg
.
cbSize
).
LowPart
);
...
...
@@ -789,7 +773,7 @@ static void test_storage_refcount(void)
}
IStorage_Release
(
stgprio
);
DeleteFile
W
(
filename
);
DeleteFile
A
(
filenameA
);
}
static
void
test_writeclassstg
(
void
)
...
...
@@ -798,10 +782,7 @@ static void test_writeclassstg(void)
HRESULT
r
;
CLSID
temp_cls
;
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
DeleteFileW
(
filename
);
DeleteFileA
(
filenameA
);
/* create the file */
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
...
...
@@ -836,7 +817,7 @@ static void test_writeclassstg(void)
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
DeleteFile
W
(
filename
);
DeleteFile
A
(
filenameA
);
}
static
void
test_streamenum
(
void
)
...
...
@@ -849,10 +830,7 @@ static void test_streamenum(void)
IEnumSTATSTG
*
ee
=
NULL
;
ULONG
count
;
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
DeleteFileW
(
filename
);
DeleteFileA
(
filenameA
);
/* create the file */
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
...
...
@@ -911,7 +889,7 @@ static void test_streamenum(void)
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
DeleteFile
W
(
filename
);
DeleteFile
A
(
filenameA
);
}
static
void
test_transact
(
void
)
...
...
@@ -922,10 +900,7 @@ static void test_transact(void)
static
const
WCHAR
stmname
[]
=
{
'C'
,
'O'
,
'N'
,
'T'
,
'E'
,
'N'
,
'T'
,
'S'
,
0
};
static
const
WCHAR
stmname2
[]
=
{
'F'
,
'O'
,
'O'
,
0
};
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
DeleteFileW
(
filename
);
DeleteFileA
(
filenameA
);
/* create the file */
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
...
...
@@ -996,7 +971,7 @@ static void test_transact(void)
IStorage_Release
(
stg
);
r
=
DeleteFile
W
(
filename
);
r
=
DeleteFile
A
(
filenameA
);
ok
(
r
==
TRUE
,
"deleted file
\n
"
);
}
...
...
@@ -1337,10 +1312,7 @@ static void test_simple(void)
DWORD
count
;
STATSTG
stat
;
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
DeleteFileW
(
filename
);
DeleteFileA
(
filenameA
);
r
=
StgCreateDocfile
(
filename
,
STGM_SIMPLE
|
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"got %08x
\n
"
,
r
);
...
...
@@ -1418,11 +1390,22 @@ static void test_simple(void)
IStorage_Release
(
stg
);
DeleteFile
W
(
filename
);
DeleteFile
A
(
filenameA
);
}
START_TEST
(
storage32
)
{
CHAR
temp
[
MAX_PATH
];
GetTempPathA
(
MAX_PATH
,
temp
);
if
(
!
GetTempFileNameA
(
temp
,
"stg"
,
0
,
filenameA
))
{
win_skip
(
"Could not create temp file, %u
\n
"
,
GetLastError
());
return
;
}
MultiByteToWideChar
(
CP_ACP
,
0
,
filenameA
,
-
1
,
filename
,
MAX_PATH
);
DeleteFileA
(
filenameA
);
test_hglobal_storage_stat
();
test_create_storage_modes
();
test_storage_stream
();
...
...
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