Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4c20cc6f
Commit
4c20cc6f
authored
Mar 19, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
Mar 19, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- test cases for summary information
- fix memory leaks
parent
99d026fb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
227 additions
and
4 deletions
+227
-4
suminfo.c
dlls/msi/suminfo.c
+14
-3
.cvsignore
dlls/msi/tests/.cvsignore
+1
-0
Makefile.in
dlls/msi/tests/Makefile.in
+2
-1
suminfo.c
dlls/msi/tests/suminfo.c
+210
-0
No files found.
dlls/msi/suminfo.c
View file @
4c20cc6f
...
...
@@ -98,9 +98,20 @@ typedef struct tagMSISUMMARYINFO
static
const
WCHAR
szSumInfo
[]
=
{
5
,
'S'
,
'u'
,
'm'
,
'm'
,
'a'
,
'r'
,
'y'
,
'I'
,
'n'
,
'f'
,
'o'
,
'r'
,
'm'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
void
free_prop
(
PROPVARIANT
*
prop
)
{
if
(
prop
->
vt
==
VT_LPSTR
)
HeapFree
(
GetProcessHeap
(),
0
,
prop
->
u
.
pszVal
);
prop
->
vt
=
VT_EMPTY
;
}
static
void
MSI_CloseSummaryInfo
(
MSIOBJECTHDR
*
arg
)
{
MSISUMMARYINFO
*
si
=
(
MSISUMMARYINFO
*
)
arg
;
DWORD
i
;
for
(
i
=
0
;
i
<
MSI_MAX_PROPS
;
i
++
)
free_prop
(
&
si
->
property
[
i
]
);
msiobj_release
(
&
si
->
db
->
hdr
);
}
...
...
@@ -142,7 +153,7 @@ static UINT get_property_count( PROPVARIANT *property )
if
(
!
property
)
return
n
;
for
(
i
=
0
;
i
<
MSI_MAX_PROPS
;
i
++
)
for
(
i
=
0
;
i
<
MSI_MAX_PROPS
;
i
++
)
if
(
property
[
i
].
vt
!=
VT_EMPTY
)
n
++
;
return
n
;
...
...
@@ -645,11 +656,12 @@ static UINT set_prop( MSIHANDLE handle, UINT uiProperty, UINT uiDataType,
goto
end
;
}
si
->
update_count
--
;
prop
->
vt
=
type
;
}
else
if
(
prop
->
vt
!=
type
)
goto
end
;
free_prop
(
prop
);
prop
->
vt
=
type
;
switch
(
type
)
{
case
VT_I4
:
...
...
@@ -662,7 +674,6 @@ static UINT set_prop( MSIHANDLE handle, UINT uiProperty, UINT uiDataType,
memcpy
(
&
prop
->
u
.
filetime
,
pftValue
,
sizeof
prop
->
u
.
filetime
);
break
;
case
VT_LPSTR
:
HeapFree
(
GetProcessHeap
(),
0
,
prop
->
u
.
pszVal
);
if
(
str
->
unicode
)
{
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
str
->
str
.
w
,
-
1
,
...
...
dlls/msi/tests/.cvsignore
View file @
4c20cc6f
Makefile
db.ok
record.ok
suminfo.ok
testlist.c
dlls/msi/tests/Makefile.in
View file @
4c20cc6f
...
...
@@ -7,7 +7,8 @@ IMPORTS = msi kernel32
CTESTS
=
\
db.c
\
record.c
record.c
\
suminfo.c
@MAKE_TEST_RULES@
...
...
dlls/msi/tests/suminfo.c
0 → 100644
View file @
4c20cc6f
/*
* Copyright (C) 2005 Mike McCormack for CodeWeavers
*
* A test program for MSI database files.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define COBJMACROS
#include <stdio.h>
#include <windows.h>
#include <msi.h>
#include <msiquery.h>
#include "wine/test.h"
/*
* The following are defined in Windows SDK's msidefs.h
* but that file doesn't exist in the msvc6 header set.
*
* Some are already defined in PropIdl.h - undefine them
*/
#undef PID_DICTIONARY
#undef PID_CODEPAGE
#undef PID_SUBJECT
#undef PID_SECURITY
#define PID_DICTIONARY 0
#define PID_CODEPAGE 1
#define PID_TITLE 2
#define PID_SUBJECT 3
#define PID_AUTHOR 4
#define PID_KEYWORDS 5
#define PID_COMMENTS 6
#define PID_TEMPLATE 7
#define PID_LASTAUTHOR 8
#define PID_REVNUMBER 9
#define PID_EDITTINE 10
#define PID_LASTPRINTED 11
#define PID_CREATE_DTM 12
#define PID_LASTSAVE_DTM 13
#define PID_PAGECOUNT 14
#define PID_WORDCOUNT 15
#define PID_CHARCOUNT 16
#define PID_THUMBNAIL 17
#define PID_APPNAME 18
#define PID_SECURITY 19
#define PID_MSIVERSION PID_PAGECOUNT
#define PID_MSISOURCE PID_WORDCOUNT
#define PID_MSIRESTRICT PID_CHARCOUNT
START_TEST
(
suminfo
)
{
const
char
*
msifile
=
"winetest.msi"
;
MSIHANDLE
hdb
=
0
,
hsuminfo
;
UINT
r
,
count
,
type
;
INT
val
;
FILETIME
ft
;
DeleteFile
(
msifile
);
/* just MsiOpenDatabase should not create a file */
r
=
MsiOpenDatabase
(
msifile
,
MSIDBOPEN_CREATE
,
&
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiOpenDatabase failed
\n
"
);
r
=
MsiGetSummaryInformation
(
hdb
,
NULL
,
0
,
NULL
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"MsiGetSummaryInformation wrong error
\n
"
);
r
=
MsiGetSummaryInformation
(
hdb
,
NULL
,
0
,
&
hsuminfo
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiGetSummaryInformation failed
\n
"
);
r
=
MsiSummaryInfoGetPropertyCount
(
0
,
NULL
);
ok
(
r
==
ERROR_INVALID_HANDLE
,
"getpropcount failed
\n
"
);
r
=
MsiSummaryInfoGetPropertyCount
(
hsuminfo
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"getpropcount failed
\n
"
);
count
=
-
1
;
r
=
MsiSummaryInfoGetPropertyCount
(
hsuminfo
,
&
count
);
ok
(
r
==
ERROR_SUCCESS
,
"getpropcount failed
\n
"
);
ok
(
count
==
0
,
"count should be zero
\n
"
);
r
=
MsiSummaryInfoGetProperty
(
hsuminfo
,
0
,
NULL
,
NULL
,
NULL
,
0
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"getpropcount failed
\n
"
);
type
=
-
1
;
r
=
MsiSummaryInfoGetProperty
(
hsuminfo
,
0
,
&
type
,
NULL
,
NULL
,
0
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"getpropcount failed
\n
"
);
ok
(
type
==
0
,
"wrong type
\n
"
);
type
=
-
1
;
val
=
1234
;
r
=
MsiSummaryInfoGetProperty
(
hsuminfo
,
0
,
&
type
,
&
val
,
NULL
,
0
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"getpropcount failed
\n
"
);
ok
(
type
==
0
,
"wrong type
\n
"
);
ok
(
val
==
1234
,
"wrong val
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_TITLE
,
VT_LPSTR
,
0
,
NULL
,
"Mike"
);
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_TITLE
,
VT_LPSTR
,
1
,
NULL
,
"JungAh"
);
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_TITLE
,
VT_LPSTR
,
1
,
&
ft
,
"Mike"
);
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_CODEPAGE
,
VT_I2
,
1
,
&
ft
,
"JungAh"
);
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiCloseHandle
(
hsuminfo
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiCloseHandle failed
\n
"
);
/* try again with the update count set */
r
=
MsiGetSummaryInformation
(
hdb
,
NULL
,
1
,
&
hsuminfo
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiGetSummaryInformation failed
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
0
,
VT_LPSTR
,
1
,
NULL
,
NULL
);
ok
(
r
==
ERROR_DATATYPE_MISMATCH
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_CODEPAGE
,
VT_LPSTR
,
1
,
NULL
,
NULL
);
ok
(
r
==
ERROR_DATATYPE_MISMATCH
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_TITLE
,
VT_I4
,
0
,
NULL
,
"Mike"
);
ok
(
r
==
ERROR_DATATYPE_MISMATCH
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_AUTHOR
,
VT_I4
,
0
,
NULL
,
"JungAh"
);
ok
(
r
==
ERROR_DATATYPE_MISMATCH
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_KEYWORDS
,
VT_I2
,
0
,
NULL
,
"Mike"
);
ok
(
r
==
ERROR_DATATYPE_MISMATCH
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_COMMENTS
,
VT_FILETIME
,
0
,
NULL
,
"JungAh"
);
ok
(
r
==
ERROR_DATATYPE_MISMATCH
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_TEMPLATE
,
VT_I2
,
0
,
NULL
,
"Mike"
);
ok
(
r
==
ERROR_DATATYPE_MISMATCH
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_LASTAUTHOR
,
VT_LPSTR
,
0
,
NULL
,
NULL
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_LASTSAVE_DTM
,
VT_FILETIME
,
0
,
NULL
,
NULL
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_LASTAUTHOR
,
VT_LPWSTR
,
0
,
NULL
,
"h
\0
i
\0\0
"
);
ok
(
r
==
ERROR_DATATYPE_MISMATCH
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_REVNUMBER
,
VT_I4
,
0
,
NULL
,
"Jungah"
);
ok
(
r
==
ERROR_DATATYPE_MISMATCH
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_PAGECOUNT
,
VT_LPSTR
,
1
,
NULL
,
NULL
);
ok
(
r
==
ERROR_DATATYPE_MISMATCH
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_TITLE
,
VT_LPSTR
,
0
,
NULL
,
"Mike"
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiSummaryInfoSetProperty failed
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_TITLE
,
VT_LPSTR
,
0
,
NULL
,
"JungAh"
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiSummaryInfoSetProperty failed
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_CODEPAGE
,
VT_I2
,
1
,
&
ft
,
"Mike"
);
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiCloseHandle
(
hsuminfo
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiCloseHandle failed
\n
"
);
/* try again with a higher update count */
r
=
MsiGetSummaryInformation
(
hdb
,
NULL
,
10
,
&
hsuminfo
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiGetSummaryInformation failed
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_TITLE
,
VT_LPSTR
,
0
,
NULL
,
"JungAh"
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiSummaryInfoSetProperty failed
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_CODEPAGE
,
VT_LPSTR
,
1
,
NULL
,
NULL
);
ok
(
r
==
ERROR_DATATYPE_MISMATCH
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_CODEPAGE
,
VT_I2
,
1
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_CODEPAGE
,
VT_I2
,
1
,
&
ft
,
"Mike"
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoSetProperty
(
hsuminfo
,
PID_AUTHOR
,
VT_LPSTR
,
1
,
&
ft
,
"Mike"
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiSummaryInfoSetProperty wrong error
\n
"
);
r
=
MsiSummaryInfoPersist
(
hsuminfo
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiSummaryInfoPersist failed
\n
"
);
MsiDatabaseCommit
(
hdb
);
r
=
MsiCloseHandle
(
hsuminfo
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiCloseHandle failed
\n
"
);
r
=
MsiCloseHandle
(
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiCloseHandle failed
\n
"
);
r
=
DeleteFile
(
msifile
);
ok
(
r
,
"DeleteFile failed
\n
"
);
}
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