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
105933f2
Commit
105933f2
authored
Dec 10, 2009
by
James Hawkins
Committed by
Alexandre Julliard
Dec 11, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Refactor the Installer.Products method into InstallerImpl_Products.
parent
9f09d47b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
40 deletions
+76
-40
automation.c
dlls/msi/automation.c
+76
-40
No files found.
dlls/msi/automation.c
View file @
105933f2
...
...
@@ -2135,6 +2135,80 @@ done:
return
hr
;
}
static
void
cleanup_products
(
IDispatch
*
dispatch
,
ULONG
count
)
{
UINT
i
;
ListData
*
ldata
=
private_data
((
AutomationObject
*
)
dispatch
);
for
(
i
=
0
;
i
<
count
-
1
;
i
++
)
VariantClear
(
&
ldata
->
pVars
[
i
]);
ldata
->
ulCount
=
0
;
msi_free
(
ldata
->
pVars
);
IDispatch_Release
(
dispatch
);
}
static
HRESULT
InstallerImpl_Products
(
WORD
wFlags
,
DISPPARAMS
*
pDispParams
,
VARIANT
*
pVarResult
,
EXCEPINFO
*
pExcepInfo
,
UINT
*
puArgErr
)
{
UINT
ret
;
HRESULT
hr
;
ULONG
idx
=
0
;
ListData
*
ldata
;
IDispatch
*
dispatch
;
WCHAR
product
[
GUID_SIZE
];
if
(
!
(
wFlags
&
DISPATCH_PROPERTYGET
))
return
DISP_E_MEMBERNOTFOUND
;
/* Find number of products. */
while
((
ret
=
MsiEnumProductsW
(
idx
,
product
))
==
ERROR_SUCCESS
)
idx
++
;
if
(
ret
!=
ERROR_NO_MORE_ITEMS
)
return
DISP_E_EXCEPTION
;
V_VT
(
pVarResult
)
=
VT_DISPATCH
;
hr
=
create_automation_object
(
0
,
NULL
,
(
LPVOID
*
)
&
dispatch
,
&
DIID_StringList
,
ListImpl_Invoke
,
ListImpl_Free
,
sizeof
(
ListData
));
if
(
FAILED
(
hr
))
return
hr
;
V_DISPATCH
(
pVarResult
)
=
dispatch
;
/* Save product strings. */
ldata
=
private_data
((
AutomationObject
*
)
dispatch
);
ldata
->
ulCount
=
0
;
ldata
->
pVars
=
msi_alloc_zero
(
sizeof
(
VARIANT
)
*
idx
);
if
(
!
ldata
->
pVars
)
{
IDispatch_Release
(
dispatch
);
return
E_OUTOFMEMORY
;
}
ldata
->
ulCount
=
idx
;
for
(
idx
=
0
;
idx
<
ldata
->
ulCount
;
idx
++
)
{
ret
=
MsiEnumProductsW
(
idx
,
product
);
if
(
ret
!=
ERROR_SUCCESS
)
{
cleanup_products
(
dispatch
,
idx
-
1
);
return
DISP_E_EXCEPTION
;
}
VariantInit
(
&
ldata
->
pVars
[
idx
]);
V_VT
(
&
ldata
->
pVars
[
idx
])
=
VT_BSTR
;
V_BSTR
(
&
ldata
->
pVars
[
idx
])
=
SysAllocString
(
product
);
}
return
S_OK
;
}
static
HRESULT
WINAPI
InstallerImpl_Invoke
(
AutomationObject
*
This
,
DISPID
dispIdMember
,
...
...
@@ -2231,46 +2305,8 @@ static HRESULT WINAPI InstallerImpl_Invoke(
pVarResult
,
pExcepInfo
,
puArgErr
);
case
DISPID_INSTALLER_PRODUCTS
:
if
(
wFlags
&
DISPATCH_PROPERTYGET
)
{
ListData
*
ldata
=
NULL
;
ULONG
idx
=
0
;
WCHAR
szProductBuf
[
GUID_SIZE
];
/* Find number of products */
while
((
ret
=
MsiEnumProductsW
(
idx
,
szProductBuf
))
==
ERROR_SUCCESS
)
idx
++
;
if
(
ret
!=
ERROR_NO_MORE_ITEMS
)
{
ERR
(
"MsiEnumProducts returned %d
\n
"
,
ret
);
return
DISP_E_EXCEPTION
;
}
V_VT
(
pVarResult
)
=
VT_DISPATCH
;
if
(
SUCCEEDED
(
hr
=
create_automation_object
(
0
,
NULL
,
(
LPVOID
*
)
&
pDispatch
,
&
DIID_StringList
,
ListImpl_Invoke
,
ListImpl_Free
,
sizeof
(
ListData
))))
{
V_DISPATCH
(
pVarResult
)
=
pDispatch
;
/* Save product strings */
ldata
=
private_data
((
AutomationObject
*
)
pDispatch
);
if
(
!
(
ldata
->
pVars
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
VARIANT
)
*
idx
)))
ERR
(
"Out of memory
\n
"
);
else
{
ldata
->
ulCount
=
idx
;
for
(
idx
=
0
;
idx
<
ldata
->
ulCount
;
idx
++
)
{
ret
=
MsiEnumProductsW
(
idx
,
szProductBuf
);
VariantInit
(
&
ldata
->
pVars
[
idx
]);
V_VT
(
&
ldata
->
pVars
[
idx
])
=
VT_BSTR
;
V_BSTR
(
&
ldata
->
pVars
[
idx
])
=
SysAllocString
(
szProductBuf
);
}
}
}
else
ERR
(
"Failed to create StringList object, hresult 0x%08x
\n
"
,
hr
);
}
else
return
DISP_E_MEMBERNOTFOUND
;
break
;
return
InstallerImpl_Products
(
wFlags
,
pDispParams
,
pVarResult
,
pExcepInfo
,
puArgErr
);
case
DISPID_INSTALLER_RELATEDPRODUCTS
:
if
(
wFlags
&
DISPATCH_PROPERTYGET
)
...
...
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