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
c959e386
Commit
c959e386
authored
May 31, 2012
by
Hans Leidekker
Committed by
Alexandre Julliard
May 31, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Don't terminate the string in msi_id2stringA.
This makes sure that the last string can be fully written when saving the string table.
parent
f86ab49b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
25 deletions
+9
-25
string.c
dlls/msi/string.c
+8
-24
db.c
dlls/msi/tests/db.c
+1
-1
No files found.
dlls/msi/string.c
View file @
c959e386
...
...
@@ -357,14 +357,12 @@ const WCHAR *msi_string_lookup_id( const string_table *st, UINT id )
* [in/out] sz - number of bytes available in the buffer on input
* number of bytes used on output
*
* The size includes the terminating nul character. Short buffers
* will be filled, but not nul terminated.
* Returned string is not nul terminated.
*/
static
UINT
msi_id2stringA
(
const
string_table
*
st
,
UINT
id
,
LPSTR
buffer
,
UINT
*
sz
)
{
UINT
len
;
UINT
len
,
lenW
;
const
WCHAR
*
str
;
int
n
;
TRACE
(
"Finding string %d of %d
\n
"
,
id
,
st
->
maxcount
);
...
...
@@ -372,26 +370,14 @@ static UINT msi_id2stringA( const string_table *st, UINT id, LPSTR buffer, UINT
if
(
!
str
)
return
ERROR_FUNCTION_FAILED
;
len
=
WideCharToMultiByte
(
st
->
codepage
,
0
,
str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
buffer
)
len
W
=
strlenW
(
str
);
len
=
WideCharToMultiByte
(
st
->
codepage
,
0
,
str
,
lenW
,
NULL
,
0
,
NULL
,
NULL
);
if
(
*
sz
<
len
)
{
*
sz
=
len
;
return
ERROR_SUCCESS
;
}
if
(
len
>
*
sz
)
{
n
=
strlenW
(
str
)
+
1
;
while
(
n
&&
(
len
>
*
sz
)
)
len
=
WideCharToMultiByte
(
st
->
codepage
,
0
,
str
,
--
n
,
NULL
,
0
,
NULL
,
NULL
);
return
ERROR_MORE_DATA
;
}
else
n
=
-
1
;
*
sz
=
WideCharToMultiByte
(
st
->
codepage
,
0
,
str
,
n
,
buffer
,
len
,
NULL
,
NULL
);
*
sz
=
WideCharToMultiByte
(
st
->
codepage
,
0
,
str
,
lenW
,
buffer
,
*
sz
,
NULL
,
NULL
);
return
ERROR_SUCCESS
;
}
...
...
@@ -588,7 +574,7 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *byt
data
=
msi_alloc
(
datasize
);
if
(
!
data
)
{
WARN
(
"Failed to alloc data %d bytes
\n
"
,
pool
size
);
WARN
(
"Failed to alloc data %d bytes
\n
"
,
data
size
);
goto
err
;
}
...
...
@@ -622,8 +608,6 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *byt
ERR
(
"failed to fetch string
\n
"
);
sz
=
0
;
}
if
(
sz
&&
(
sz
<
(
datasize
-
used
)
)
)
sz
--
;
if
(
sz
)
pool
[
n
*
2
+
1
]
=
st
->
strings
[
i
].
persistent_refcount
;
...
...
dlls/msi/tests/db.c
View file @
c959e386
...
...
@@ -9345,7 +9345,7 @@ static void test_createtable(void)
size
=
sizeof
(
buffer
);
res
=
MsiRecordGetString
(
hrec
,
1
,
buffer
,
&
size
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
todo_wine
ok
(
!
strcmp
(
buffer
,
"b"
),
"b != %s
\n
"
,
buffer
);
ok
(
!
strcmp
(
buffer
,
"b"
),
"b != %s
\n
"
,
buffer
);
res
=
MsiCloseHandle
(
hrec
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
...
...
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