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
5f832b27
Commit
5f832b27
authored
Aug 28, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Aug 28, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Fix writing of long strings to the database.
parent
b9d6ec3b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
16 deletions
+37
-16
msipriv.h
dlls/msi/msipriv.h
+1
-1
string.c
dlls/msi/string.c
+17
-7
table.c
dlls/msi/table.c
+19
-6
db.c
dlls/msi/tests/db.c
+0
-2
No files found.
dlls/msi/msipriv.h
View file @
5f832b27
...
...
@@ -328,7 +328,7 @@ extern string_table *msi_init_stringtable( int entries, UINT codepage );
extern
VOID
msi_destroy_stringtable
(
string_table
*
st
);
extern
UINT
msi_string_count
(
string_table
*
st
);
extern
UINT
msi_id_refcount
(
string_table
*
st
,
UINT
i
);
extern
UINT
msi_string_totalsize
(
string_table
*
st
,
UINT
*
last
);
extern
UINT
msi_string_totalsize
(
string_table
*
st
,
UINT
*
datasize
,
UINT
*
poolsize
);
extern
UINT
msi_strcmp
(
string_table
*
st
,
UINT
lval
,
UINT
rval
,
UINT
*
res
);
extern
const
WCHAR
*
msi_string_lookup_id
(
string_table
*
st
,
UINT
id
);
extern
UINT
msi_string_get_codepage
(
string_table
*
st
);
...
...
dlls/msi/string.c
View file @
5f832b27
...
...
@@ -435,13 +435,17 @@ UINT msi_id_refcount( string_table *st, UINT i )
return
st
->
strings
[
i
].
refcount
;
}
UINT
msi_string_totalsize
(
string_table
*
st
,
UINT
*
total
)
UINT
msi_string_totalsize
(
string_table
*
st
,
UINT
*
datasize
,
UINT
*
poolsize
)
{
UINT
size
=
0
,
i
,
len
;
UINT
i
,
len
,
max
,
holesize
;
if
(
st
->
strings
[
0
].
str
||
st
->
strings
[
0
].
refcount
)
ERR
(
"oops. element 0 has a string
\n
"
);
*
total
=
0
;
*
poolsize
=
4
;
*
datasize
=
0
;
max
=
1
;
holesize
=
0
;
for
(
i
=
1
;
i
<
st
->
maxcount
;
i
++
)
{
if
(
st
->
strings
[
i
].
str
)
...
...
@@ -451,12 +455,18 @@ UINT msi_string_totalsize( string_table *st, UINT *total )
st
->
strings
[
i
].
str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
len
)
len
--
;
size
+=
len
;
*
total
=
(
i
+
1
);
(
*
datasize
)
+=
len
;
if
(
len
>
0xffff
)
(
*
poolsize
)
+=
4
;
max
=
i
+
1
;
(
*
poolsize
)
+=
holesize
+
4
;
holesize
=
0
;
}
else
holesize
+=
4
;
}
TRACE
(
"
%u/%u strings %u bytes codepage %x
\n
"
,
*
total
,
st
->
maxcount
,
size
,
st
->
codepage
);
return
size
;
TRACE
(
"
data %u pool %u codepage %x
\n
"
,
*
datasize
,
*
pool
size
,
st
->
codepage
);
return
max
;
}
UINT
msi_string_get_codepage
(
string_table
*
st
)
...
...
dlls/msi/table.c
View file @
5f832b27
...
...
@@ -765,7 +765,7 @@ end:
static
UINT
save_string_table
(
MSIDATABASE
*
db
)
{
UINT
i
,
count
,
datasize
,
poolsize
,
sz
,
used
,
r
,
codepage
;
UINT
i
,
count
,
datasize
=
0
,
poolsize
=
0
,
sz
,
used
,
r
,
codepage
,
n
;
UINT
ret
=
ERROR_FUNCTION_FAILED
;
static
const
WCHAR
szStringData
[]
=
{
'_'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
'D'
,
'a'
,
't'
,
'a'
,
0
};
...
...
@@ -777,8 +777,9 @@ static UINT save_string_table( MSIDATABASE *db )
TRACE
(
"
\n
"
);
/* construct the new table in memory first */
datasize
=
msi_string_totalsize
(
db
->
strings
,
&
count
);
poolsize
=
(
count
+
1
)
*
2
*
sizeof
(
USHORT
);
count
=
msi_string_totalsize
(
db
->
strings
,
&
datasize
,
&
poolsize
);
TRACE
(
"%u %u %u
\n
"
,
count
,
datasize
,
poolsize
);
pool
=
msi_alloc
(
poolsize
);
if
(
!
pool
)
...
...
@@ -797,6 +798,7 @@ static UINT save_string_table( MSIDATABASE *db )
codepage
=
msi_string_get_codepage
(
db
->
strings
);
pool
[
0
]
=
codepage
&
0xffff
;
pool
[
1
]
=
(
codepage
>>
16
);
n
=
1
;
for
(
i
=
1
;
i
<
count
;
i
++
)
{
sz
=
datasize
-
used
;
...
...
@@ -808,9 +810,20 @@ static UINT save_string_table( MSIDATABASE *db )
}
if
(
sz
&&
(
sz
<
(
datasize
-
used
)
)
)
sz
--
;
TRACE
(
"adding %u bytes %s
\n
"
,
sz
,
debugstr_a
(
data
+
used
)
);
pool
[
i
*
2
]
=
sz
;
pool
[
i
*
2
+
1
]
=
msi_id_refcount
(
db
->
strings
,
i
);
pool
[
n
*
2
+
1
]
=
msi_id_refcount
(
db
->
strings
,
i
);
if
(
sz
<
0x10000
)
{
pool
[
n
*
2
]
=
sz
;
n
++
;
}
else
{
pool
[
n
*
2
]
=
0
;
pool
[
n
*
2
+
2
]
=
sz
&
0xffff
;
pool
[
n
*
2
+
3
]
=
(
sz
>>
16
);
n
+=
2
;
}
used
+=
sz
;
if
(
used
>
datasize
)
{
...
...
dlls/msi/tests/db.c
View file @
5f832b27
...
...
@@ -940,9 +940,7 @@ static void test_longstrings(void)
r
=
MsiRecordGetString
(
hrec
,
2
,
NULL
,
&
len
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewFetch failed
\n
"
);
todo_wine
{
ok
(
len
==
STRING_LENGTH
,
"string length wrong
\n
"
);
}
MsiCloseHandle
(
hrec
);
MsiCloseHandle
(
hdb
);
...
...
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