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
e5f2ed4c
Commit
e5f2ed4c
authored
Jan 26, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
Jan 26, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix MsiRecordSetString for NULL strings and update test case.
parent
bcaca0a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
11 deletions
+32
-11
record.c
dlls/msi/record.c
+28
-11
record.c
dlls/msi/tests/record.c
+4
-0
No files found.
dlls/msi/record.c
View file @
e5f2ed4c
...
@@ -454,12 +454,20 @@ UINT MSI_RecordSetStringA( MSIRECORD *rec, unsigned int iField, LPCSTR szValue )
...
@@ -454,12 +454,20 @@ UINT MSI_RecordSetStringA( MSIRECORD *rec, unsigned int iField, LPCSTR szValue )
if
(
iField
>
rec
->
count
)
if
(
iField
>
rec
->
count
)
return
ERROR_INVALID_FIELD
;
return
ERROR_INVALID_FIELD
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szValue
,
-
1
,
NULL
,
0
);
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
szValue
,
-
1
,
str
,
len
);
MSI_FreeField
(
&
rec
->
fields
[
iField
]
);
MSI_FreeField
(
&
rec
->
fields
[
iField
]
);
rec
->
fields
[
iField
].
type
=
MSIFIELD_WSTR
;
if
(
szValue
)
rec
->
fields
[
iField
].
u
.
szwVal
=
str
;
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szValue
,
-
1
,
NULL
,
0
);
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
szValue
,
-
1
,
str
,
len
);
rec
->
fields
[
iField
].
type
=
MSIFIELD_WSTR
;
rec
->
fields
[
iField
].
u
.
szwVal
=
str
;
}
else
{
rec
->
fields
[
iField
].
type
=
MSIFIELD_NULL
;
rec
->
fields
[
iField
].
u
.
szwVal
=
NULL
;
}
return
0
;
return
0
;
}
}
...
@@ -491,13 +499,22 @@ UINT MSI_RecordSetStringW( MSIRECORD *rec, unsigned int iField, LPCWSTR szValue
...
@@ -491,13 +499,22 @@ UINT MSI_RecordSetStringW( MSIRECORD *rec, unsigned int iField, LPCWSTR szValue
if
(
iField
>
rec
->
count
)
if
(
iField
>
rec
->
count
)
return
ERROR_INVALID_FIELD
;
return
ERROR_INVALID_FIELD
;
len
=
lstrlenW
(
szValue
)
+
1
;
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
lstrcpyW
(
str
,
szValue
);
MSI_FreeField
(
&
rec
->
fields
[
iField
]
);
MSI_FreeField
(
&
rec
->
fields
[
iField
]
);
rec
->
fields
[
iField
].
type
=
MSIFIELD_WSTR
;
rec
->
fields
[
iField
].
u
.
szwVal
=
str
;
if
(
szValue
)
{
len
=
lstrlenW
(
szValue
)
+
1
;
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
lstrcpyW
(
str
,
szValue
);
rec
->
fields
[
iField
].
type
=
MSIFIELD_WSTR
;
rec
->
fields
[
iField
].
u
.
szwVal
=
str
;
}
else
{
rec
->
fields
[
iField
].
type
=
MSIFIELD_NULL
;
rec
->
fields
[
iField
].
u
.
szwVal
=
NULL
;
}
return
0
;
return
0
;
}
}
...
...
dlls/msi/tests/record.c
View file @
e5f2ed4c
...
@@ -119,6 +119,10 @@ void test_msirecord(void)
...
@@ -119,6 +119,10 @@ void test_msirecord(void)
ok
(
r
==
1
,
"failed to get integer
\n
"
);
ok
(
r
==
1
,
"failed to get integer
\n
"
);
/* same record, but add a string to it */
/* same record, but add a string to it */
r
=
MsiRecordSetString
(
h
,
0
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to set null string at 0
\n
"
);
r
=
MsiRecordIsNull
(
h
,
0
);
ok
(
r
==
TRUE
,
"null string not null field
\n
"
);
r
=
MsiRecordSetString
(
h
,
0
,
str
);
r
=
MsiRecordSetString
(
h
,
0
,
str
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to set string at 0
\n
"
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to set string at 0
\n
"
);
r
=
MsiRecordGetInteger
(
h
,
0
);
r
=
MsiRecordGetInteger
(
h
,
0
);
...
...
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