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
181705cb
Commit
181705cb
authored
Nov 28, 2004
by
Mike McCormack
Committed by
Alexandre Julliard
Nov 28, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Don't limit the size of the property that can be retrieved by
MsiGetProperty. - Make MsiGetProperty A/W implementations more consistent.
parent
1635947f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
87 deletions
+88
-87
msipriv.h
dlls/msi/msipriv.h
+1
-0
package.c
dlls/msi/package.c
+87
-87
No files found.
dlls/msi/msipriv.h
View file @
181705cb
...
...
@@ -278,6 +278,7 @@ extern UINT MSI_RecordSetInteger( MSIRECORD *, unsigned int, int );
extern
UINT
MSI_RecordSetStringW
(
MSIRECORD
*
,
unsigned
int
,
LPCWSTR
);
extern
BOOL
MSI_RecordIsNull
(
MSIRECORD
*
,
unsigned
int
);
extern
UINT
MSI_RecordGetStringW
(
MSIRECORD
*
,
unsigned
int
,
LPWSTR
,
DWORD
*
);
extern
UINT
MSI_RecordGetStringA
(
MSIRECORD
*
,
unsigned
int
,
LPSTR
,
DWORD
*
);
extern
int
MSI_RecordGetInteger
(
MSIRECORD
*
,
unsigned
int
);
extern
UINT
MSI_RecordReadStream
(
MSIRECORD
*
,
unsigned
int
,
char
*
,
DWORD
*
);
extern
unsigned
int
MSI_RecordGetFieldCount
(
MSIRECORD
*
rec
);
...
...
dlls/msi/package.c
View file @
181705cb
...
...
@@ -708,125 +708,118 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
return
ret
;
}
UINT
WINAPI
MsiGetPropertyA
(
MSIHANDLE
hInstall
,
LPCSTR
szName
,
LPSTR
szValueBuf
,
DWORD
*
pchValueBuf
)
static
UINT
MSI_GetPropertyRow
(
MSIPACKAGE
*
package
,
LPCWSTR
szName
,
MSIRECORD
**
row
)
{
LPWSTR
szwName
=
NULL
,
szwValueBuf
=
NULL
;
UINT
hr
=
ERROR_INSTALL_FAILURE
;
if
(
0
==
hInstall
)
{
return
ERROR_INVALID_HANDLE
;
}
if
(
NULL
==
szName
)
{
return
ERROR_INVALID_PARAMETER
;
}
if
(
NULL
!=
szValueBuf
&&
NULL
==
pchValueBuf
)
{
return
ERROR_INVALID_PARAMETER
;
}
MSIQUERY
*
view
;
UINT
rc
,
sz
;
static
const
WCHAR
select
[]
=
{
's'
,
'e'
,
'l'
,
'e'
,
'c'
,
't'
,
' '
,
'V'
,
'a'
,
'l'
,
'u'
,
'e'
,
' '
,
'f'
,
'r'
,
'o'
,
'm'
,
' '
,
'_'
,
'P'
,
'r'
,
'o'
,
'p'
,
'e'
,
'r'
,
't'
,
'y'
,
' '
,
'w'
,
'h'
,
'e'
,
'r'
,
'e'
,
' '
,
'_'
,
'P'
,
'r'
,
'o'
,
'p'
,
'e'
,
'r'
,
't'
,
'y'
,
'='
,
'`'
,
'%'
,
's'
,
'`'
,
0
};
LPWSTR
query
;
TRACE
(
"%lu %s %lu
\n
"
,
hInstall
,
debugstr_a
(
szName
),
*
pchValueBuf
);
if
(
!
szName
)
return
ERROR_INVALID_PARAMETER
;
if
(
szName
)
{
UINT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szName
,
-
1
,
NULL
,
0
);
szwName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
!
szwName
)
goto
end
;
MultiByteToWideChar
(
CP_ACP
,
0
,
szName
,
-
1
,
szwName
,
len
);
}
else
{
return
ERROR_INVALID_PARAMETER
;
}
if
(
szValueBuf
)
{
szwValueBuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
*
pchValueBuf
)
*
sizeof
(
WCHAR
)
);
if
(
!
szwValueBuf
)
goto
end
;
}
sz
=
sizeof
select
+
strlenW
(
szName
)
*
sizeof
(
WCHAR
);
query
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
sprintfW
(
query
,
select
,
szName
);
if
(
*
pchValueBuf
>
0
)
rc
=
MSI_DatabaseOpenViewW
(
package
->
db
,
query
,
&
view
);
HeapFree
(
GetProcessHeap
(),
0
,
query
);
if
(
rc
==
ERROR_SUCCESS
)
{
/* be sure to blank the string first */
szValueBuf
[
0
]
=
0
;
}
hr
=
MsiGetPropertyW
(
hInstall
,
szwName
,
szwValueBuf
,
pchValueBuf
);
rc
=
MSI_ViewExecute
(
view
,
0
);
if
(
rc
==
ERROR_SUCCESS
)
rc
=
MSI_ViewFetch
(
view
,
row
);
if
(
*
pchValueBuf
>
0
)
{
WideCharToMultiByte
(
CP_ACP
,
0
,
szwValueBuf
,
-
1
,
szValueBuf
,
*
pchValueBuf
,
NULL
,
NULL
);
MSI_ViewClose
(
view
);
msiobj_release
(
&
view
->
hdr
);
}
end:
if
(
szwName
)
HeapFree
(
GetProcessHeap
(),
0
,
szwName
);
if
(
szwValueBuf
)
HeapFree
(
GetProcessHeap
(),
0
,
szwValueBuf
);
return
hr
;
return
rc
;
}
UINT
MSI_GetPropertyW
(
MSIPACKAGE
*
package
,
LPCWSTR
szName
,
LPWSTR
szValueBuf
,
DWORD
*
pchValueBuf
)
{
MSIQUERY
*
view
;
MSIRECORD
*
row
;
UINT
rc
;
WCHAR
Query
[
1024
]
=
{
's'
,
'e'
,
'l'
,
'e'
,
'c'
,
't'
,
' '
,
'V'
,
'a'
,
'l'
,
'u'
,
'e'
,
' '
,
'f'
,
'r'
,
'o'
,
'm'
,
' '
,
'_'
,
'P'
,
'r'
,
'o'
,
'p'
,
'e'
,
'r'
,
't'
,
'y'
,
' '
,
'w'
,
'h'
,
'e'
,
'r'
,
'e'
,
' '
,
'_'
,
'P'
,
'r'
,
'o'
,
'p'
,
'e'
,
'r'
,
't'
,
'y'
,
'='
,
'`'
,
0
};
static
const
WCHAR
szEnd
[]
=
{
'`'
,
0
};
if
(
NULL
==
szName
)
{
return
ERROR_INVALID_PARAMETER
;
rc
=
MSI_GetPropertyRow
(
package
,
szName
,
&
row
);
if
(
rc
==
ERROR_SUCCESS
)
{
rc
=
MSI_RecordGetStringW
(
row
,
1
,
szValueBuf
,
pchValueBuf
);
msiobj_release
(
&
row
->
hdr
);
}
strcatW
(
Query
,
szName
);
strcatW
(
Query
,
szEnd
);
rc
=
MSI_DatabaseOpenViewW
(
package
->
db
,
Query
,
&
view
);
if
(
rc
==
ERROR_SUCCESS
)
TRACE
(
"returning %s for property %s
\n
"
,
debugstr_w
(
szValueBuf
),
debugstr_w
(
szName
));
else
{
DWORD
sz
;
WCHAR
value
[
0x100
];
/* even on unsuccessful lookup native msi blanks this string */
if
(
*
pchValueBuf
>
0
)
szValueBuf
[
0
]
=
0
;
rc
=
MSI_ViewExecute
(
view
,
0
);
if
(
rc
!=
ERROR_SUCCESS
)
{
MSI_ViewClose
(
view
);
msiobj_release
(
&
view
->
hdr
);
return
rc
;
}
*
pchValueBuf
=
0
;
TRACE
(
"property not found
\n
"
);
}
rc
=
MSI_ViewFetch
(
view
,
&
row
);
if
(
rc
==
ERROR_SUCCESS
)
{
sz
=
0x100
;
rc
=
MSI_RecordGetStringW
(
row
,
1
,
value
,
&
sz
);
strncpyW
(
szValueBuf
,
value
,
min
(
sz
+
1
,
*
pchValueBuf
));
*
pchValueBuf
=
sz
+
1
;
msiobj_release
(
&
row
->
hdr
);
}
MSI_ViewClose
(
view
);
msiobj_release
(
&
view
->
hdr
);
return
rc
;
}
UINT
MSI_GetPropertyA
(
MSIPACKAGE
*
package
,
LPCSTR
szName
,
LPSTR
szValueBuf
,
DWORD
*
pchValueBuf
)
{
MSIRECORD
*
row
;
UINT
rc
,
len
;
LPWSTR
szwName
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szName
,
-
1
,
NULL
,
0
);
szwName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
!
szwName
)
return
ERROR_NOT_ENOUGH_MEMORY
;
MultiByteToWideChar
(
CP_ACP
,
0
,
szName
,
-
1
,
szwName
,
len
);
rc
=
MSI_GetPropertyRow
(
package
,
szwName
,
&
row
);
if
(
rc
==
ERROR_SUCCESS
)
{
rc
=
MSI_RecordGetStringA
(
row
,
1
,
szValueBuf
,
pchValueBuf
);
msiobj_release
(
&
row
->
hdr
);
}
if
(
rc
==
ERROR_SUCCESS
)
TRACE
(
"returning %s for property %s
\n
"
,
debugstr_
w
(
szValueBuf
),
debugstr_
w
(
szName
));
TRACE
(
"returning %s for property %s
\n
"
,
debugstr_
a
(
szValueBuf
),
debugstr_
a
(
szName
));
else
{
*
pchValueBuf
=
0
;
TRACE
(
"property not found
\n
"
);
}
HeapFree
(
GetProcessHeap
(),
0
,
szwName
);
return
rc
;
}
UINT
WINAPI
MsiGetPropertyA
(
MSIHANDLE
hInstall
,
LPCSTR
szName
,
LPSTR
szValueBuf
,
DWORD
*
pchValueBuf
)
{
MSIPACKAGE
*
package
;
UINT
ret
;
TRACE
(
"%lu %s %lu
\n
"
,
hInstall
,
debugstr_a
(
szName
),
*
pchValueBuf
);
if
(
0
==
hInstall
)
return
ERROR_INVALID_HANDLE
;
if
(
NULL
==
szName
)
return
ERROR_INVALID_PARAMETER
;
if
(
NULL
!=
szValueBuf
&&
NULL
==
pchValueBuf
)
return
ERROR_INVALID_PARAMETER
;
package
=
msihandle2msiinfo
(
hInstall
,
MSIHANDLETYPE_PACKAGE
);
if
(
!
package
)
return
ERROR_INVALID_HANDLE
;
ret
=
MSI_GetPropertyA
(
package
,
szName
,
szValueBuf
,
pchValueBuf
);
msiobj_release
(
&
package
->
hdr
);
return
ret
;
}
UINT
WINAPI
MsiGetPropertyW
(
MSIHANDLE
hInstall
,
LPCWSTR
szName
,
LPWSTR
szValueBuf
,
DWORD
*
pchValueBuf
)
...
...
@@ -834,8 +827,15 @@ UINT WINAPI MsiGetPropertyW(MSIHANDLE hInstall, LPCWSTR szName,
MSIPACKAGE
*
package
;
UINT
ret
;
if
(
0
==
hInstall
)
return
ERROR_INVALID_HANDLE
;
if
(
NULL
==
szName
)
return
ERROR_INVALID_PARAMETER
;
if
(
NULL
!=
szValueBuf
&&
NULL
==
pchValueBuf
)
return
ERROR_INVALID_PARAMETER
;
package
=
msihandle2msiinfo
(
hInstall
,
MSIHANDLETYPE_PACKAGE
);
if
(
!
package
)
if
(
!
package
)
return
ERROR_INVALID_HANDLE
;
ret
=
MSI_GetPropertyW
(
package
,
szName
,
szValueBuf
,
pchValueBuf
);
msiobj_release
(
&
package
->
hdr
);
...
...
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