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
4ccdbc58
Commit
4ccdbc58
authored
May 18, 2007
by
Misha Koshelev
Committed by
Alexandre Julliard
May 18, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: automation: Generalize list implementation.
Same structures and functions can be used for both StringList and RecordList.
parent
2521111b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
37 deletions
+40
-37
automation.c
dlls/msi/automation.c
+36
-33
msiserver.idl
dlls/msi/msiserver.idl
+2
-2
msiserver_dispids.h
dlls/msi/msiserver_dispids.h
+2
-2
No files found.
dlls/msi/automation.c
View file @
4ccdbc58
...
...
@@ -84,9 +84,9 @@ interface AutomationObject {
*/
typedef
struct
{
int
i
Count
;
LPWSTR
*
pszString
s
;
}
String
ListData
;
ULONG
ul
Count
;
VARIANT
*
pVar
s
;
}
ListData
;
typedef
struct
{
/* The parent Installer object */
...
...
@@ -635,7 +635,7 @@ static HRESULT WINAPI RecordImpl_Invoke(
return
S_OK
;
}
static
HRESULT
WINAPI
String
ListImpl_Invoke
(
static
HRESULT
WINAPI
ListImpl_Invoke
(
AutomationObject
*
This
,
DISPID
dispIdMember
,
REFIID
riid
,
...
...
@@ -646,7 +646,7 @@ static HRESULT WINAPI StringListImpl_Invoke(
EXCEPINFO
*
pExcepInfo
,
UINT
*
puArgErr
)
{
StringListData
*
data
=
(
String
ListData
*
)
private_data
(
This
);
ListData
*
data
=
(
ListData
*
)
private_data
(
This
);
HRESULT
hr
;
VARIANTARG
varg0
;
...
...
@@ -654,22 +654,21 @@ static HRESULT WINAPI StringListImpl_Invoke(
switch
(
dispIdMember
)
{
case
DISPID_
STRING
LIST_ITEM
:
case
DISPID_LIST_ITEM
:
if
(
wFlags
&
DISPATCH_PROPERTYGET
)
{
hr
=
DispGetParam
(
pDispParams
,
0
,
VT_I4
,
&
varg0
,
puArgErr
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
V_I4
(
&
varg0
)
<
0
||
V_I4
(
&
varg0
)
>=
data
->
i
Count
)
if
(
V_I4
(
&
varg0
)
<
0
||
V_I4
(
&
varg0
)
>=
data
->
ul
Count
)
return
DISP_E_BADINDEX
;
V_VT
(
pVarResult
)
=
VT_BSTR
;
V_BSTR
(
pVarResult
)
=
SysAllocString
(
data
->
pszStrings
[
V_I4
(
&
varg0
)]);
VariantCopy
(
pVarResult
,
&
data
->
pVars
[
V_I4
(
&
varg0
)]);
}
else
return
DISP_E_MEMBERNOTFOUND
;
break
;
case
DISPID_
STRING
LIST_COUNT
:
case
DISPID_LIST_COUNT
:
if
(
wFlags
&
DISPATCH_PROPERTYGET
)
{
V_VT
(
pVarResult
)
=
VT_I4
;
V_I4
(
pVarResult
)
=
data
->
i
Count
;
V_I4
(
pVarResult
)
=
data
->
ul
Count
;
}
else
return
DISP_E_MEMBERNOTFOUND
;
break
;
...
...
@@ -683,14 +682,14 @@ static HRESULT WINAPI StringListImpl_Invoke(
return
S_OK
;
}
static
void
WINAPI
String
ListImpl_Free
(
AutomationObject
*
This
)
static
void
WINAPI
ListImpl_Free
(
AutomationObject
*
This
)
{
String
ListData
*
data
=
private_data
(
This
);
int
idx
;
ListData
*
data
=
private_data
(
This
);
ULONG
idx
;
for
(
idx
=
0
;
idx
<
data
->
i
Count
;
idx
++
)
SysFreeString
(
data
->
pszString
s
[
idx
]);
HeapFree
(
GetProcessHeap
(),
0
,
data
->
p
szString
s
);
for
(
idx
=
0
;
idx
<
data
->
ul
Count
;
idx
++
)
VariantClear
(
&
data
->
pVar
s
[
idx
]);
HeapFree
(
GetProcessHeap
(),
0
,
data
->
p
Var
s
);
}
static
HRESULT
WINAPI
ViewImpl_Invoke
(
...
...
@@ -1388,8 +1387,8 @@ static HRESULT WINAPI InstallerImpl_Invoke(
case
DISPID_INSTALLER_PRODUCTS
:
if
(
wFlags
&
DISPATCH_PROPERTYGET
)
{
StringListData
*
s
ldata
=
NULL
;
int
idx
=
0
;
ListData
*
ldata
=
NULL
;
ULONG
idx
=
0
;
WCHAR
szProductBuf
[
GUID_SIZE
];
/* Find number of products */
...
...
@@ -1401,22 +1400,24 @@ static HRESULT WINAPI InstallerImpl_Invoke(
}
V_VT
(
pVarResult
)
=
VT_DISPATCH
;
if
(
SUCCEEDED
(
hr
=
create_automation_object
(
0
,
NULL
,
(
LPVOID
*
)
&
pDispatch
,
&
DIID_StringList
,
StringListImpl_Invoke
,
StringListImpl_Free
,
sizeof
(
String
ListData
))))
if
(
SUCCEEDED
(
hr
=
create_automation_object
(
0
,
NULL
,
(
LPVOID
*
)
&
pDispatch
,
&
DIID_StringList
,
ListImpl_Invoke
,
ListImpl_Free
,
sizeof
(
ListData
))))
{
IDispatch_AddRef
(
pDispatch
);
V_DISPATCH
(
pVarResult
)
=
pDispatch
;
/* Save product strings */
sldata
=
(
String
ListData
*
)
private_data
((
AutomationObject
*
)
pDispatch
);
if
(
!
(
sldata
->
pszStrings
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
LPWSTR
)
*
sldata
->
iCount
)))
ldata
=
(
ListData
*
)
private_data
((
AutomationObject
*
)
pDispatch
);
if
(
!
(
ldata
->
pVars
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
VARIANT
)
*
idx
)))
ERR
(
"Out of memory
\n
"
);
else
{
sldata
->
i
Count
=
idx
;
for
(
idx
=
0
;
idx
<
sldata
->
i
Count
;
idx
++
)
ldata
->
ul
Count
=
idx
;
for
(
idx
=
0
;
idx
<
ldata
->
ul
Count
;
idx
++
)
{
ret
=
MsiEnumProductsW
(
idx
,
szProductBuf
);
sldata
->
pszStrings
[
idx
]
=
SysAllocString
(
szProductBuf
);
VariantInit
(
&
ldata
->
pVars
[
idx
]);
V_VT
(
&
ldata
->
pVars
[
idx
])
=
VT_BSTR
;
V_BSTR
(
&
ldata
->
pVars
[
idx
])
=
SysAllocString
(
szProductBuf
);
}
}
}
...
...
@@ -1429,8 +1430,8 @@ static HRESULT WINAPI InstallerImpl_Invoke(
case
DISPID_INSTALLER_RELATEDPRODUCTS
:
if
(
wFlags
&
DISPATCH_PROPERTYGET
)
{
StringListData
*
s
ldata
=
NULL
;
int
idx
=
0
;
ListData
*
ldata
=
NULL
;
ULONG
idx
=
0
;
WCHAR
szProductBuf
[
GUID_SIZE
];
hr
=
DispGetParam
(
pDispParams
,
0
,
VT_BSTR
,
&
varg0
,
puArgErr
);
...
...
@@ -1446,22 +1447,24 @@ static HRESULT WINAPI InstallerImpl_Invoke(
}
V_VT
(
pVarResult
)
=
VT_DISPATCH
;
if
(
SUCCEEDED
(
hr
=
create_automation_object
(
0
,
NULL
,
(
LPVOID
*
)
&
pDispatch
,
&
DIID_StringList
,
StringListImpl_Invoke
,
StringListImpl_Free
,
sizeof
(
String
ListData
))))
if
(
SUCCEEDED
(
hr
=
create_automation_object
(
0
,
NULL
,
(
LPVOID
*
)
&
pDispatch
,
&
DIID_StringList
,
ListImpl_Invoke
,
ListImpl_Free
,
sizeof
(
ListData
))))
{
IDispatch_AddRef
(
pDispatch
);
V_DISPATCH
(
pVarResult
)
=
pDispatch
;
/* Save product strings */
sldata
=
(
String
ListData
*
)
private_data
((
AutomationObject
*
)
pDispatch
);
if
(
!
(
sldata
->
pszStrings
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
LPWSTR
)
*
sldata
->
iCount
)))
ldata
=
(
ListData
*
)
private_data
((
AutomationObject
*
)
pDispatch
);
if
(
!
(
ldata
->
pVars
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
VARIANT
)
*
idx
)))
ERR
(
"Out of memory
\n
"
);
else
{
sldata
->
i
Count
=
idx
;
for
(
idx
=
0
;
idx
<
sldata
->
i
Count
;
idx
++
)
ldata
->
ul
Count
=
idx
;
for
(
idx
=
0
;
idx
<
ldata
->
ul
Count
;
idx
++
)
{
ret
=
MsiEnumRelatedProductsW
(
V_BSTR
(
&
varg0
),
0
,
idx
,
szProductBuf
);
sldata
->
pszStrings
[
idx
]
=
SysAllocString
(
szProductBuf
);
VariantInit
(
&
ldata
->
pVars
[
idx
]);
V_VT
(
&
ldata
->
pVars
[
idx
])
=
VT_BSTR
;
V_BSTR
(
&
ldata
->
pVars
[
idx
])
=
SysAllocString
(
szProductBuf
);
}
}
}
...
...
dlls/msi/msiserver.idl
View file @
4ccdbc58
...
...
@@ -114,9 +114,9 @@ library WindowsInstaller
{
properties:
methods:
[id(DISPID_
STRING
LIST_ITEM), propget]
[id(DISPID_LIST_ITEM), propget]
BSTR Item(long Index);
[id(DISPID_
STRING
LIST_COUNT), propget]
[id(DISPID_LIST_COUNT), propget]
long Count();
}
...
...
dlls/msi/msiserver_dispids.h
View file @
4ccdbc58
...
...
@@ -29,8 +29,8 @@
#define DISPID_RECORD_STRINGDATA 1
#define DISPID_RECORD_INTEGERDATA 2
#define DISPID_
STRING
LIST_ITEM 0
#define DISPID_
STRING
LIST_COUNT 1
#define DISPID_LIST_ITEM 0
#define DISPID_LIST_COUNT 1
#define DISPID_VIEW_EXECUTE 1
#define DISPID_VIEW_FETCH 2
...
...
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