ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2022
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
436 discussions
Start a n
N
ew thread
[reactos] 11/360: [WINESYNC] msi: Don't cache the base URL.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=34c2011c9f00f3c3e7879…
commit 34c2011c9f00f3c3e7879ccb23bbca23bf7fdb58 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:11:49 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:35 2022 +0100 [WINESYNC] msi: Don't cache the base URL. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 99aa0eb5d8777b790f1aa3c643217571274b744f by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/dialog.c | 2 +- dll/win32/msi/media.c | 40 ++++++++++++++++++++++++++++++---------- dll/win32/msi/msipriv.h | 3 +-- dll/win32/msi/package.c | 25 +++---------------------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c index 8cec1954ecb..32414f1c65b 100644 --- a/dll/win32/msi/dialog.c +++ b/dll/win32/msi/dialog.c @@ -4130,7 +4130,7 @@ static MSIPREVIEW *MSI_EnableUIPreview( MSIDATABASE *db ) MSIPREVIEW *preview = NULL; MSIPACKAGE *package; - package = MSI_CreatePackage( db, NULL ); + package = MSI_CreatePackage( db ); if (package) { preview = alloc_msiobject( MSIHANDLETYPE_PREVIEW, sizeof(MSIPREVIEW), MSI_ClosePreview ); diff --git a/dll/win32/msi/media.c b/dll/win32/msi/media.c index 0bb883b34a6..3d4a8c09eb6 100644 --- a/dll/win32/msi/media.c +++ b/dll/win32/msi/media.c @@ -678,6 +678,14 @@ static UINT get_drive_type(const WCHAR *path) return GetDriveTypeW(root); } +static WCHAR *get_base_url( MSIDATABASE *db ) +{ + WCHAR *p, *ret = NULL, *orig_db = msi_dup_property( db, szOriginalDatabase ); + if (UrlIsW( orig_db, URLIS_URL ) && (ret = strdupW( orig_db )) && (p = strrchrW( ret, '/'))) p[1] = 0; + msi_free( orig_db ); + return ret; +} + UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi) { static const WCHAR query[] = { @@ -685,7 +693,7 @@ UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi) 'W','H','E','R','E',' ','`','L','a','s','t','S','e','q','u','e','n','c','e','`',' ', '>','=',' ','%','i',' ','O','R','D','E','R',' ','B','Y',' ','`','D','i','s','k','I','d','`',0}; MSIRECORD *row; - LPWSTR source_dir, source; + WCHAR *source_dir, *source, *base_url = NULL; DWORD options; if (Sequence <= mi->last_sequence) /* already loaded */ @@ -721,9 +729,9 @@ UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi) source = source_dir; options |= MSISOURCETYPE_MEDIA; } - else if (package->BaseURL && UrlIsW(package->BaseURL, URLIS_URL)) + else if ((base_url = get_base_url(package->db))) { - source = package->BaseURL; + source = base_url; options |= MSISOURCETYPE_URL; } else @@ -739,8 +747,10 @@ UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi) msi_package_add_info(package, package->Context, options, INSTALLPROPERTY_LASTUSEDSOURCEW, source); - msi_free(source_dir); TRACE("sequence %u -> cabinet %s disk id %u\n", Sequence, debugstr_w(mi->cabinet), mi->disk_id); + + msi_free(base_url); + msi_free(source_dir); return ERROR_SUCCESS; } @@ -851,6 +861,8 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi ) if (mi->cabinet) { + WCHAR *base_url; + /* cabinet is internal, no checks needed */ if (mi->cabinet[0] == '#') return ERROR_SUCCESS; @@ -858,14 +870,21 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi ) /* package should be downloaded */ if (compressed && GetFileAttributesW( cabinet_file ) == INVALID_FILE_ATTRIBUTES && - package->BaseURL && UrlIsW( package->BaseURL, URLIS_URL )) + (base_url = get_base_url( package->db ))) { - WCHAR temppath[MAX_PATH], *p; + WCHAR temppath[MAX_PATH], *p, *url; - if ((rc = msi_download_file( cabinet_file, temppath )) != ERROR_SUCCESS) + msi_free( cabinet_file ); + if (!(url = msi_alloc( (strlenW( base_url ) + strlenW( mi->cabinet ) + 1) * sizeof(WCHAR) ))) { - ERR("failed to download %s (%u)\n", debugstr_w(cabinet_file), rc); - msi_free( cabinet_file ); + return ERROR_OUTOFMEMORY; + } + strcpyW( url, base_url ); + strcatW( url, mi->cabinet ); + if ((rc = msi_download_file( url, temppath )) != ERROR_SUCCESS) + { + ERR("failed to download %s (%u)\n", debugstr_w(url), rc); + msi_free( url ); return rc; } if ((p = strrchrW( temppath, '\\' ))) *p = 0; @@ -873,7 +892,8 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi ) PathAddBackslashW( mi->sourcedir ); msi_free( mi->cabinet ); mi->cabinet = strdupW( p + 1 ); - msi_free( cabinet_file ); + + msi_free( url ); return ERROR_SUCCESS; } } diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index a0423a60061..cc2b8bec790 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -424,7 +424,6 @@ typedef struct tagMSIPACKAGE struct list RunningActions; - LPWSTR BaseURL; LPWSTR PackagePath; LPWSTR ProductCode; LPWSTR localfile; @@ -861,7 +860,7 @@ extern UINT msi_view_get_row(MSIDATABASE *, MSIVIEW *, UINT, MSIRECORD **) DECLS extern UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel ) DECLSPEC_HIDDEN; /* package internals */ -extern MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *, LPCWSTR ) DECLSPEC_HIDDEN; +extern MSIPACKAGE *MSI_CreatePackage( MSIDATABASE * ) DECLSPEC_HIDDEN; extern UINT MSI_OpenPackageW( LPCWSTR szPackage, MSIPACKAGE **pPackage ) DECLSPEC_HIDDEN; extern UINT MSI_SetTargetPathW( MSIPACKAGE *, LPCWSTR, LPCWSTR ) DECLSPEC_HIDDEN; extern INT MSI_ProcessMessageVerbatim( MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD * ) DECLSPEC_HIDDEN; diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 87bd9f99861..49fe7900412 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -321,7 +321,6 @@ static void free_package_structures( MSIPACKAGE *package ) msi_free_patchinfo( patch ); } - msi_free( package->BaseURL ); msi_free( package->PackagePath ); msi_free( package->ProductCode ); msi_free( package->ActionFormat ); @@ -1056,7 +1055,7 @@ void msi_adjust_privilege_properties( MSIPACKAGE *package ) msi_set_property( package->db, szAdminUser, szOne, -1 ); } -MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url ) +MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) { static const WCHAR fmtW[] = {'%','u',0}; MSIPACKAGE *package; @@ -1077,7 +1076,6 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url ) package->LastActionResult = MSI_NULL_INTEGER; package->WordCount = 0; package->PackagePath = strdupW( db->path ); - package->BaseURL = strdupW( base_url ); create_temp_property_table( package ); msi_clone_properties( package->db ); @@ -1447,15 +1445,13 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage) MSIPACKAGE *package; MSIHANDLE handle; MSIRECORD *data_row, *info_row; - LPWSTR ptr, base_url = NULL; UINT r; WCHAR localfile[MAX_PATH], cachefile[MAX_PATH]; LPCWSTR file = szPackage; DWORD index = 0; MSISUMMARYINFO *si; BOOL delete_on_close = FALSE; - LPWSTR productname; - WCHAR *info_template; + WCHAR *info_template, *productname; TRACE("%s %p\n", debugstr_w(szPackage), pPackage); @@ -1487,13 +1483,6 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage) return r; file = cachefile; - - base_url = strdupW( szPackage ); - if (!base_url) - return ERROR_OUTOFMEMORY; - - ptr = strrchrW( base_url, '/' ); - if (ptr) *(ptr + 1) = '\0'; } r = get_local_package( file, localfile ); if (r != ERROR_SUCCESS || GetFileAttributesW( localfile ) == INVALID_FILE_ATTRIBUTES) @@ -1502,17 +1491,13 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage) r = msi_create_empty_local_file( localfile, dotmsi ); if (r != ERROR_SUCCESS) - { - msi_free ( base_url ); return r; - } if (!CopyFileW( file, localfile, FALSE )) { r = GetLastError(); WARN("unable to copy package %s to %s (%u)\n", debugstr_w(file), debugstr_w(localfile), r); DeleteFileW( localfile ); - msi_free ( base_url ); return r; } delete_on_close = TRUE; @@ -1525,13 +1510,9 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage) TRACE("opening package %s\n", debugstr_w( localfile )); r = MSI_OpenDatabaseW( localfile, MSIDBOPEN_TRANSACT, &db ); if (r != ERROR_SUCCESS) - { - msi_free ( base_url ); return r; - } } - package = MSI_CreatePackage( db, base_url ); - msi_free( base_url ); + package = MSI_CreatePackage( db ); msiobj_release( &db->hdr ); if (!package) return ERROR_INSTALL_PACKAGE_INVALID; package->localfile = strdupW( localfile );
2 years, 9 months
1
0
0
0
[reactos] 10/360: [WINESYNC] msi: Make MsiProcessMessage() RPC-compatible.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2e19edd6a07e2170fe9c6…
commit 2e19edd6a07e2170fe9c60e518e05f04c04c5c59 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:11:49 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:35 2022 +0100 [WINESYNC] msi: Make MsiProcessMessage() RPC-compatible. Instead of passing a remote MSIHANDLE and creating a set of remote_Record*() methods, we marshal the whole record as a wire struct. We do this for two reasons: firstly, because chances are whoever is reading the record is going to want to read the whole thing, so it's much less taxing on IPC to just pass the whole record once; and secondly, because records can be created on the client side or returned from the server side, and we don't want to have to write a lot of extra code to deal with both possibilities. The wire_record struct is designed so that we can simply pass the relevant part of an MSIRECORD to the server. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id bbf0f2da8211da73066fb36a444593ab0e8901f2 by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/msipriv.h | 2 ++ dll/win32/msi/package.c | 41 +++++++++++++++++++---------------------- dll/win32/msi/record.c | 43 +++++++++++++++++++++++++++++++++++++++++++ dll/win32/msi/winemsi.idl | 22 +++++++++++++++++++++- 4 files changed, 85 insertions(+), 23 deletions(-) diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index 5c74ef864f0..a0423a60061 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -39,6 +39,7 @@ #include "wine/debug.h" #include "msiserver.h" +#include "winemsi.h" static const BOOL is_64bit = sizeof(void *) > sizeof(int); BOOL is_wow64 DECLSPEC_HIDDEN; @@ -830,6 +831,7 @@ extern BOOL MSI_RecordsAreFieldsEqual(MSIRECORD *a, MSIRECORD *b, UINT field) DE extern UINT msi_record_set_string(MSIRECORD *, UINT, const WCHAR *, int) DECLSPEC_HIDDEN; extern const WCHAR *msi_record_get_string(const MSIRECORD *, UINT, int *) DECLSPEC_HIDDEN; extern void dump_record(MSIRECORD *) DECLSPEC_HIDDEN; +extern UINT unmarshal_record(const struct wire_record *in, MSIHANDLE *out) DECLSPEC_HIDDEN; /* stream internals */ extern void enum_stream_names( IStorage *stg ) DECLSPEC_HIDDEN; diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 483f6c4d597..87bd9f99861 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -2060,39 +2060,27 @@ INT WINAPI MsiProcessMessage( MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, MsiRecordGetInteger(hRecord, 1) != 2) return -1; + record = msihandle2msiinfo(hRecord, MSIHANDLETYPE_RECORD); + if (!record) + return ERROR_INVALID_HANDLE; + package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if( !package ) { MSIHANDLE remote; - HRESULT hr; if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; - hr = remote_ProcessMessage(remote, eMessageType, hRecord); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); + ret = remote_ProcessMessage(remote, eMessageType, (struct wire_record *)&record->count); - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + msiobj_release(&record->hdr); + return ret; } - record = msihandle2msiinfo( hRecord, MSIHANDLETYPE_RECORD ); - if( !record ) - goto out; - ret = MSI_ProcessMessage( package, eMessageType, record ); -out: msiobj_release( &package->hdr ); - if( record ) - msiobj_release( &record->hdr ); - return ret; } @@ -2488,10 +2476,19 @@ UINT __cdecl remote_SetProperty(MSIHANDLE hinst, LPCWSTR property, LPCWSTR value return MsiSetPropertyW(hinst, property, value); } -HRESULT __cdecl remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, MSIHANDLE record) +int __cdecl remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, struct wire_record *remote_rec) { - UINT r = MsiProcessMessage(hinst, message, record); - return HRESULT_FROM_WIN32(r); + MSIHANDLE rec; + int ret; + UINT r; + + if ((r = unmarshal_record(remote_rec, &rec))) + return r; + + ret = MsiProcessMessage(hinst, message, rec); + + MsiCloseHandle(rec); + return ret; } HRESULT __cdecl remote_DoAction(MSIHANDLE hinst, BSTR action) diff --git a/dll/win32/msi/record.c b/dll/win32/msi/record.c index 8254b17f096..7b53d86edfe 100644 --- a/dll/win32/msi/record.c +++ b/dll/win32/msi/record.c @@ -1054,3 +1054,46 @@ void dump_record(MSIRECORD *rec) } TRACE("]\n"); } + +UINT unmarshal_record(const struct wire_record *in, MSIHANDLE *out) +{ + MSIRECORD *rec; + unsigned int i; + UINT r; + + rec = MSI_CreateRecord(in->count); + if (!rec) return ERROR_OUTOFMEMORY; + + for (i = 0; i <= in->count; i++) + { + switch (in->fields[i].type) + { + case MSIFIELD_NULL: + break; + case MSIFIELD_INT: + r = MSI_RecordSetInteger(rec, i, in->fields[i].u.iVal); + break; + case MSIFIELD_WSTR: + r = MSI_RecordSetStringW(rec, i, in->fields[i].u.szwVal); + break; + case MSIFIELD_STREAM: + r = MSI_RecordSetIStream(rec, i, in->fields[i].u.stream); + break; + default: + ERR("invalid field type %d\n", in->fields[i].type); + break; + } + + if (r) + { + msiobj_release(&rec->hdr); + return r; + } + } + + *out = alloc_msihandle(&rec->hdr); + if (!*out) return ERROR_OUTOFMEMORY; + + msiobj_release(&rec->hdr); + return ERROR_SUCCESS; +} diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl index 7ea2e3cd57f..d97db4c0571 100644 --- a/dll/win32/msi/winemsi.idl +++ b/dll/win32/msi/winemsi.idl @@ -28,9 +28,29 @@ typedef int MSICONDITION; typedef int MSIRUNMODE; typedef int INSTALLSTATE; +#define MSIFIELD_NULL 0 +#define MSIFIELD_INT 1 +#define MSIFIELD_WSTR 3 +#define MSIFIELD_STREAM 4 cpp_quote("#endif") cpp_quote("#include \"msiquery.h\"") +struct wire_field { + unsigned int type; + [switch_is(type)] union { + [case(MSIFIELD_NULL)] ; + [case(MSIFIELD_INT)] int iVal; + [case(MSIFIELD_WSTR), string] LPWSTR szwVal; + [case(MSIFIELD_STREAM)] IStream *stream; + } u; + int len; +}; + +struct wire_record { + unsigned int count; + [size_is(count+1)] struct wire_field fields[]; +}; + [ uuid(56D58B64-8780-4c22-A8BC-8B0B29E4A9F8) ] @@ -44,7 +64,7 @@ interface IWineMsiRemote HRESULT remote_GetActiveDatabase( [in] MSIHANDLE hinst, [out] MSIHANDLE *handle ); UINT remote_GetProperty( [in] MSIHANDLE hinst, [in, string] LPCWSTR property, [out, string] LPWSTR *value, [out] DWORD *size ); UINT remote_SetProperty( [in] MSIHANDLE hinst, [in, string, unique] LPCWSTR property, [in, string, unique] LPCWSTR value ); - HRESULT remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] MSIHANDLE record ); + int remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] struct wire_record *record ); HRESULT remote_DoAction( [in] MSIHANDLE hinst, [in] BSTR action ); HRESULT remote_Sequence( [in] MSIHANDLE hinst, [in] BSTR table, [in] int sequence ); HRESULT remote_GetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
2 years, 9 months
1
0
0
0
[reactos] 09/360: [WINESYNC] msi: Store a record's associated query privately.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=78fc7f9ea88034030b822…
commit 78fc7f9ea88034030b822550cfe7f3c4da62a91e Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:11:48 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:35 2022 +0100 [WINESYNC] msi: Store a record's associated query privately. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 9d121203955da5c761cfb5c22b6428278e41f0c7 by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/msipriv.h | 4 +--- dll/win32/msi/msiquery.c | 5 +++-- dll/win32/msi/record.c | 48 ------------------------------------------------ 3 files changed, 4 insertions(+), 53 deletions(-) diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index ef0070ba1ae..5c74ef864f0 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -131,7 +131,6 @@ typedef struct tagMSIFIELD union { INT iVal; - INT_PTR pVal; LPWSTR szwVal; IStream *stream; } u; @@ -141,6 +140,7 @@ typedef struct tagMSIFIELD typedef struct tagMSIRECORD { MSIOBJECTHDR hdr; + MSIQUERY *query; UINT count; /* as passed to MsiCreateRecord */ MSIFIELD fields[1]; /* nb. array size is count+1 */ } MSIRECORD; @@ -813,13 +813,11 @@ extern UINT MSI_RecordGetIStream( MSIRECORD *, UINT, IStream **) DECLSPEC_HIDDEN extern const WCHAR *MSI_RecordGetString( const MSIRECORD *, UINT ) DECLSPEC_HIDDEN; extern MSIRECORD *MSI_CreateRecord( UINT ) DECLSPEC_HIDDEN; extern UINT MSI_RecordSetInteger( MSIRECORD *, UINT, int ) DECLSPEC_HIDDEN; -extern UINT MSI_RecordSetIntPtr( MSIRECORD *, UINT, INT_PTR ) DECLSPEC_HIDDEN; extern UINT MSI_RecordSetStringW( MSIRECORD *, UINT, LPCWSTR ) DECLSPEC_HIDDEN; extern BOOL MSI_RecordIsNull( MSIRECORD *, UINT ) DECLSPEC_HIDDEN; extern UINT MSI_RecordGetStringW( MSIRECORD * , UINT, LPWSTR, LPDWORD) DECLSPEC_HIDDEN; extern UINT MSI_RecordGetStringA( MSIRECORD *, UINT, LPSTR, LPDWORD) DECLSPEC_HIDDEN; extern int MSI_RecordGetInteger( MSIRECORD *, UINT ) DECLSPEC_HIDDEN; -extern INT_PTR MSI_RecordGetIntPtr( MSIRECORD *, UINT ) DECLSPEC_HIDDEN; extern UINT MSI_RecordReadStream( MSIRECORD *, UINT, char *, LPDWORD) DECLSPEC_HIDDEN; extern UINT MSI_RecordSetStream(MSIRECORD *, UINT, IStream *) DECLSPEC_HIDDEN; extern UINT MSI_RecordGetFieldCount( const MSIRECORD *rec ) DECLSPEC_HIDDEN; diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c index f8ed4ce6a87..1ba30763f71 100644 --- a/dll/win32/msi/msiquery.c +++ b/dll/win32/msi/msiquery.c @@ -374,7 +374,8 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec) if (r == ERROR_SUCCESS) { query->row ++; - MSI_RecordSetIntPtr(*prec, 0, (INT_PTR)query); + (*prec)->query = query; + MSI_RecordSetInteger(*prec, 0, 1); } return r; @@ -608,7 +609,7 @@ UINT MSI_ViewModify( MSIQUERY *query, MSIMODIFY mode, MSIRECORD *rec ) if ( !view || !view->ops->modify) return ERROR_FUNCTION_FAILED; - if ( mode == MSIMODIFY_UPDATE && MSI_RecordGetIntPtr( rec, 0 ) != (INT_PTR)query ) + if ( mode == MSIMODIFY_UPDATE && rec->query != query ) return ERROR_FUNCTION_FAILED; r = view->ops->modify( view, mode, rec, query->row ); diff --git a/dll/win32/msi/record.c b/dll/win32/msi/record.c index de45191786c..8254b17f096 100644 --- a/dll/win32/msi/record.c +++ b/dll/win32/msi/record.c @@ -46,7 +46,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); #define MSIFIELD_INT 1 #define MSIFIELD_WSTR 3 #define MSIFIELD_STREAM 4 -#define MSIFIELD_INTPTR 5 static void MSI_FreeField( MSIFIELD *field ) { @@ -54,7 +53,6 @@ static void MSI_FreeField( MSIFIELD *field ) { case MSIFIELD_NULL: case MSIFIELD_INT: - case MSIFIELD_INTPTR: break; case MSIFIELD_WSTR: msi_free( field->u.szwVal); @@ -190,9 +188,6 @@ UINT MSI_RecordCopyField( MSIRECORD *in_rec, UINT in_n, case MSIFIELD_INT: out->u.iVal = in->u.iVal; break; - case MSIFIELD_INTPTR: - out->u.pVal = in->u.pVal; - break; case MSIFIELD_WSTR: if ((str = msi_strdupW( in->u.szwVal, in->len ))) { @@ -216,32 +211,6 @@ UINT MSI_RecordCopyField( MSIRECORD *in_rec, UINT in_n, return r; } -INT_PTR MSI_RecordGetIntPtr( MSIRECORD *rec, UINT iField ) -{ - int ret; - - TRACE( "%p %d\n", rec, iField ); - - if( iField > rec->count ) - return MININT_PTR; - - switch( rec->fields[iField].type ) - { - case MSIFIELD_INT: - return rec->fields[iField].u.iVal; - case MSIFIELD_INTPTR: - return rec->fields[iField].u.pVal; - case MSIFIELD_WSTR: - if( string2intW( rec->fields[iField].u.szwVal, &ret ) ) - return ret; - return MININT_PTR; - default: - break; - } - - return MININT_PTR; -} - int MSI_RecordGetInteger( MSIRECORD *rec, UINT iField) { int ret = 0; @@ -255,8 +224,6 @@ int MSI_RecordGetInteger( MSIRECORD *rec, UINT iField) { case MSIFIELD_INT: return rec->fields[iField].u.iVal; - case MSIFIELD_INTPTR: - return rec->fields[iField].u.pVal; case MSIFIELD_WSTR: if( string2intW( rec->fields[iField].u.szwVal, &ret ) ) return ret; @@ -311,20 +278,6 @@ UINT WINAPI MsiRecordClearData( MSIHANDLE handle ) return ERROR_SUCCESS; } -UINT MSI_RecordSetIntPtr( MSIRECORD *rec, UINT iField, INT_PTR pVal ) -{ - TRACE("%p %u %ld\n", rec, iField, pVal); - - if( iField > rec->count ) - return ERROR_INVALID_PARAMETER; - - MSI_FreeField( &rec->fields[iField] ); - rec->fields[iField].type = MSIFIELD_INTPTR; - rec->fields[iField].u.pVal = pVal; - - return ERROR_SUCCESS; -} - UINT MSI_RecordSetInteger( MSIRECORD *rec, UINT iField, int iVal ) { TRACE("%p %u %d\n", rec, iField, iVal); @@ -1095,7 +1048,6 @@ void dump_record(MSIRECORD *rec) case MSIFIELD_NULL: TRACE("(null)"); break; case MSIFIELD_INT: TRACE("%d", rec->fields[i].u.iVal); break; case MSIFIELD_WSTR: TRACE("%s", debugstr_w(rec->fields[i].u.szwVal)); break; - case MSIFIELD_INTPTR: TRACE("%ld", rec->fields[i].u.pVal); break; case MSIFIELD_STREAM: TRACE("%p", rec->fields[i].u.stream); break; } if (i < rec->count) TRACE(", ");
2 years, 9 months
1
0
0
0
[reactos] 08/360: [WINESYNC] msi/tests: Test properties from custom actions.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=11702b643d4b8ea17114b…
commit 11702b643d4b8ea17114ba54bf889309b563f825 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:11:48 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:35 2022 +0100 [WINESYNC] msi/tests: Test properties from custom actions. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 5808f1ddd49930ad49aeab640fced8305db476ea by Zebediah Figura <z.figura12(a)gmail.com> --- modules/rostests/winetests/msi/custom.c | 192 +++++++++++++++++++++++++++++++ modules/rostests/winetests/msi/install.c | 2 + 2 files changed, 194 insertions(+) diff --git a/modules/rostests/winetests/msi/custom.c b/modules/rostests/winetests/msi/custom.c index feb80615191..9cf90dc25ad 100644 --- a/modules/rostests/winetests/msi/custom.c +++ b/modules/rostests/winetests/msi/custom.c @@ -51,6 +51,196 @@ static void ok_(MSIHANDLE hinst, int todo, const char *file, int line, int condi #define ok(hinst, condition, ...) ok_(hinst, 0, __FILE__, __LINE__, condition, __VA_ARGS__) #define todo_wine_ok(hinst, condition, ...) ok_(hinst, 1, __FILE__, __LINE__, condition, __VA_ARGS__) +static const char *dbgstr_w(WCHAR *str) +{ + static char buffer[300], *p; + + if (!str) return "(null)"; + + p = buffer; + *p++ = 'L'; + *p++ = '"'; + while ((*p++ = *str++)); + *p++ = '"'; + *p++ = 0; + + return buffer; +} + +static void check_prop(MSIHANDLE hinst, const char *prop, const char *expect) +{ + char buffer[10] = "x"; + DWORD sz = sizeof(buffer); + UINT r = MsiGetPropertyA(hinst, prop, buffer, &sz); + ok(hinst, !r, "'%s': got %u\n", prop, r); + ok(hinst, sz == strlen(buffer), "'%s': expected %u, got %u\n", prop, strlen(buffer), sz); + ok(hinst, !strcmp(buffer, expect), "expected '%s', got '%s'\n", expect, buffer); +} + +static void test_props(MSIHANDLE hinst) +{ + static const WCHAR booW[] = {'b','o','o',0}; + static const WCHAR xyzW[] = {'x','y','z',0}; + static const WCHAR xyW[] = {'x','y',0}; + char buffer[10]; + WCHAR bufferW[10]; + DWORD sz; + UINT r; + + /* test invalid values */ + r = MsiGetPropertyA(hinst, NULL, NULL, NULL); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + r = MsiGetPropertyA(hinst, "boo", NULL, NULL); + ok(hinst, !r, "got %u\n", r); + + r = MsiGetPropertyA(hinst, "boo", buffer, NULL ); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + sz = 0; + r = MsiGetPropertyA(hinst, "boo", NULL, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 0, "got size %u\n", sz); + + sz = 0; + strcpy(buffer,"x"); + r = MsiGetPropertyA(hinst, "boo", buffer, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !strcmp(buffer, "x"), "got \"%s\"\n", buffer); + ok(hinst, sz == 0, "got size %u\n", sz); + + sz = 1; + strcpy(buffer,"x"); + r = MsiGetPropertyA(hinst, "boo", buffer, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !buffer[0], "got \"%s\"\n", buffer); + ok(hinst, sz == 0, "got size %u\n", sz); + + /* set the property to something */ + r = MsiSetPropertyA(hinst, NULL, NULL); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + r = MsiSetPropertyA(hinst, "", NULL); + ok(hinst, !r, "got %u\n", r); + + r = MsiSetPropertyA(hinst, "", "asdf"); + ok(hinst, r == ERROR_FUNCTION_FAILED, "got %u\n", r); + + r = MsiSetPropertyA(hinst, "=", "asdf"); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "=", "asdf"); + + r = MsiSetPropertyA(hinst, " ", "asdf"); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, " ", "asdf"); + + r = MsiSetPropertyA(hinst, "'", "asdf"); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "'", "asdf"); + + r = MsiSetPropertyA(hinst, "boo", NULL); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "boo", ""); + + r = MsiSetPropertyA(hinst, "boo", ""); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "boo", ""); + + r = MsiSetPropertyA(hinst, "boo", "xyz"); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "boo", "xyz"); + + r = MsiGetPropertyA(hinst, "boo", NULL, NULL); + ok(hinst, !r, "got %u\n", r); + + r = MsiGetPropertyA(hinst, "boo", buffer, NULL ); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + /* Returned size is in bytes, not chars, but only for custom actions. + * Seems to be a casualty of RPC... */ + + sz = 0; + r = MsiGetPropertyA(hinst, "boo", NULL, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 6, "got size %u\n", sz); + + sz = 0; + strcpy(buffer,"q"); + r = MsiGetPropertyA(hinst, "boo", buffer, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer); + todo_wine_ok(hinst, sz == 6, "got size %u\n", sz); + + sz = 1; + strcpy(buffer,"x"); + r = MsiGetPropertyA(hinst, "boo", buffer, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !buffer[0], "got \"%s\"\n", buffer); + todo_wine_ok(hinst, sz == 6, "got size %u\n", sz); + + sz = 3; + strcpy(buffer,"x"); + r = MsiGetPropertyA(hinst, "boo", buffer, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !strcmp(buffer, "xy"), "got \"%s\"\n", buffer); + todo_wine_ok(hinst, sz == 6, "got size %u\n", sz); + + sz = 4; + strcpy(buffer,"x"); + r = MsiGetPropertyA(hinst, "boo", buffer, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !strcmp(buffer, "xyz"), "got \"%s\"\n", buffer); + ok(hinst, sz == 3, "got size %u\n", sz); + + sz = 0; + r = MsiGetPropertyW(hinst, booW, NULL, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 3, "got size %u\n", sz); + + sz = 0; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hinst, booW, bufferW, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !lstrcmpW(bufferW, booW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, sz == 3, "got size %u\n", sz); + + sz = 1; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hinst, booW, bufferW, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW)); + ok(hinst, sz == 3, "got size %u\n", sz); + + sz = 3; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hinst, booW, bufferW, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, sz == 3, "got size %u\n", sz); + + sz = 4; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hinst, booW, bufferW, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, sz == 3, "got size %u\n", sz); + + r = MsiSetPropertyA(hinst, "boo", NULL); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "boo", ""); + + sz = 0; + r = MsiGetPropertyA(hinst, "embednullprop", NULL, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 6, "got size %u\n", sz); + + sz = 4; + memset(buffer, 0xcc, sizeof(buffer)); + r = MsiGetPropertyA(hinst, "embednullprop", buffer, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, !memcmp(buffer, "a\0\0\0\xcc", 5), "wrong data\n"); +} /* Main test. Anything that doesn't depend on a specific install configuration * or have undesired side effects should go here. */ @@ -70,6 +260,8 @@ UINT WINAPI main_test(MSIHANDLE hinst) res = MsiGetDatabaseState(hinst); todo_wine_ok(hinst, res == MSIDBSTATE_ERROR, "expected MSIDBSTATE_ERROR, got %u\n", res); + test_props(hinst); + return ERROR_SUCCESS; } diff --git a/modules/rostests/winetests/msi/install.c b/modules/rostests/winetests/msi/install.c index 69095cd8f07..62fb81f9fc4 100644 --- a/modules/rostests/winetests/msi/install.c +++ b/modules/rostests/winetests/msi/install.c @@ -695,12 +695,14 @@ static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAtt static const CHAR ca1_install_exec_seq_dat[] = "Action\tCondition\tSequence\n" "s72\tS255\tI2\n" "InstallExecuteSequence\tAction\n" + "embednull\t\t600\n" "maintest\tMAIN_TEST\t700\n" "testretval\tTEST_RETVAL\t710\n"; static const CHAR ca1_custom_action_dat[] = "Action\tType\tSource\tTarget\n" "s72\ti2\tS64\tS0\n" "CustomAction\tAction\n" + "embednull\t51\tembednullprop\ta[~]b\n" "maintest\t1\tcustom.dll\tmain_test\n" "testretval\t1\tcustom.dll\ttest_retval\n";
2 years, 9 months
1
0
0
0
[reactos] 07/360: [WINESYNC] msi: Also null-terminate WCHAR strings.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=66669aedeae50e9956870…
commit 66669aedeae50e99568701e8ec4563ad5b8463e0 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:11:47 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:35 2022 +0100 [WINESYNC] msi: Also null-terminate WCHAR strings. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id f37e61817f0393132c75b2e5d86778d1a4ceab45 by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/install.c | 4 ++++ modules/rostests/winetests/msi/package.c | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c index 65840e28f47..814addc402f 100644 --- a/dll/win32/msi/install.c +++ b/dll/win32/msi/install.c @@ -180,7 +180,11 @@ UINT msi_strcpy_to_awstring( const WCHAR *str, int len, awstring *awbuf, DWORD * if (len < 0) len = strlenW( str ); if (awbuf->unicode && awbuf->str.w) + { memcpy( awbuf->str.w, str, min(len + 1, *sz) * sizeof(WCHAR) ); + if (*sz && len >= *sz) + awbuf->str.w[*sz - 1] = 0; + } else { int lenA = WideCharToMultiByte( CP_ACP, 0, str, len + 1, NULL, 0, NULL, NULL ); diff --git a/modules/rostests/winetests/msi/package.c b/modules/rostests/winetests/msi/package.c index 6414891059d..b85a3a810dc 100644 --- a/modules/rostests/winetests/msi/package.c +++ b/modules/rostests/winetests/msi/package.c @@ -2150,10 +2150,14 @@ static void check_prop(MSIHANDLE hpkg, const char *prop, const char *expect) static void test_props(void) { + static const WCHAR booW[] = {'b','o','o',0}; + static const WCHAR xyzW[] = {'x','y','z',0}; + static const WCHAR xyW[] = {'x','y',0}; MSIHANDLE hpkg, hdb; UINT r; DWORD sz; char buffer[0x100]; + WCHAR bufferW[10]; hdb = create_package_db(); @@ -2280,6 +2284,39 @@ static void test_props(void) ok(!strcmp(buffer,"xyz"), "got \"%s\"\n", buffer); ok(sz == 3, "got size %u\n", sz); + sz = 0; + r = MsiGetPropertyW(hpkg, booW, NULL, &sz); + ok(!r, "got %u\n", r); + ok(sz == 3, "got size %u\n", sz); + + sz = 0; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hpkg, booW, bufferW, &sz); + ok(r == ERROR_MORE_DATA, "got %u\n", r); + ok(!lstrcmpW(bufferW, booW), "got %s\n", wine_dbgstr_w(bufferW)); + ok(sz == 3, "got size %u\n", sz); + + sz = 1; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hpkg, booW, bufferW, &sz ); + ok(r == ERROR_MORE_DATA, "got %u\n", r); + ok(!bufferW[0], "got %s\n", wine_dbgstr_w(bufferW)); + ok(sz == 3, "got size %u\n", sz); + + sz = 3; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hpkg, booW, bufferW, &sz ); + ok(r == ERROR_MORE_DATA, "got %u\n", r); + ok(!lstrcmpW(bufferW, xyW), "got %s\n", wine_dbgstr_w(bufferW)); + ok(sz == 3, "got size %u\n", sz); + + sz = 4; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hpkg, booW, bufferW, &sz ); + ok(!r, "got %u\n", r); + ok(!lstrcmpW(bufferW, xyzW), "got %s\n", wine_dbgstr_w(bufferW)); + ok(sz == 3, "got size %u\n", sz); + /* properties are case-sensitive */ check_prop(hpkg, "BOO", "");
2 years, 9 months
1
0
0
0
[reactos] 06/360: [WINESYNC] msi/tests: Clean up property tests.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c20004294da2579ae8ce5…
commit c20004294da2579ae8ce5dd05d672addd82f8c68 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:11:47 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:34 2022 +0100 [WINESYNC] msi/tests: Clean up property tests. Remove many redundant tests, and print relevant values on failure. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id c6b84cee179ac538c3a596fe9e7d10aaacd56321 by Zebediah Figura <z.figura12(a)gmail.com> --- modules/rostests/winetests/msi/package.c | 220 ++++++++++--------------------- 1 file changed, 68 insertions(+), 152 deletions(-) diff --git a/modules/rostests/winetests/msi/package.c b/modules/rostests/winetests/msi/package.c index 2022953f9bd..6414891059d 100644 --- a/modules/rostests/winetests/msi/package.c +++ b/modules/rostests/winetests/msi/package.c @@ -2138,16 +2138,14 @@ static void test_condition(void) DeleteFileA(msifile); } -static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop) +static void check_prop(MSIHANDLE hpkg, const char *prop, const char *expect) { - UINT r; - DWORD sz; - char buffer[2]; - - sz = sizeof buffer; - strcpy(buffer,"x"); - r = MsiGetPropertyA( hpkg, prop, buffer, &sz ); - return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0; + char buffer[20] = "x"; + DWORD sz = sizeof(buffer); + UINT r = MsiGetPropertyA(hpkg, prop, buffer, &sz); + ok(!r, "'%s': got %u\n", prop, r); + ok(sz == lstrlenA(buffer), "'%s': expected %u, got %u\n", prop, lstrlenA(buffer), sz); + ok(!strcmp(buffer, expect), "expected '%s', got '%s'\n", expect, buffer); } static void test_props(void) @@ -2173,150 +2171,120 @@ static void test_props(void) /* test invalid values */ r = MsiGetPropertyA( 0, NULL, NULL, NULL ); - ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n"); + ok(r == ERROR_INVALID_PARAMETER, "got %u\n", r); r = MsiGetPropertyA( hpkg, NULL, NULL, NULL ); - ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n"); + ok(r == ERROR_INVALID_PARAMETER, "got %u\n", r); r = MsiGetPropertyA( hpkg, "boo", NULL, NULL ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); + ok(!r, "got %u\n", r); r = MsiGetPropertyA( hpkg, "boo", buffer, NULL ); - ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n"); + ok(r == ERROR_INVALID_PARAMETER, "got %u\n", r); /* test retrieving an empty/nonexistent property */ sz = sizeof buffer; r = MsiGetPropertyA( hpkg, "boo", NULL, &sz ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - ok( sz == 0, "wrong size returned\n"); + ok(!r, "got %u\n", r); + ok(sz == 0, "got size %d\n", sz); - check_prop_empty( hpkg, "boo"); sz = 0; strcpy(buffer,"x"); r = MsiGetPropertyA( hpkg, "boo", buffer, &sz ); - ok( r == ERROR_MORE_DATA, "wrong return val\n"); - ok( !strcmp(buffer,"x"), "buffer was changed\n"); - ok( sz == 0, "wrong size returned\n"); + ok(r == ERROR_MORE_DATA, "got %u\n", r); + ok(!strcmp(buffer,"x"), "got \"%s\"\n", buffer); + ok(sz == 0, "got size %u\n", sz); sz = 1; strcpy(buffer,"x"); r = MsiGetPropertyA( hpkg, "boo", buffer, &sz ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - ok( buffer[0] == 0, "buffer was not changed\n"); - ok( sz == 0, "wrong size returned\n"); + ok(!r, "got %u\n", r); + ok(!buffer[0], "got \"%s\"\n", buffer); + ok(sz == 0, "got size %u\n", sz); /* set the property to something */ r = MsiSetPropertyA( 0, NULL, NULL ); - ok( r == ERROR_INVALID_HANDLE, "wrong return val\n"); + ok(r == ERROR_INVALID_HANDLE, "got %u\n", r); r = MsiSetPropertyA( hpkg, NULL, NULL ); - ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n"); + ok(r == ERROR_INVALID_PARAMETER, "got %u\n", r); r = MsiSetPropertyA( hpkg, "", NULL ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); + ok(!r, "got %u\n", r); - /* try set and get some illegal property identifiers */ r = MsiSetPropertyA( hpkg, "", "asdf" ); - ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n"); + ok(r == ERROR_FUNCTION_FAILED, "got %u\n", r); r = MsiSetPropertyA( hpkg, "=", "asdf" ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); + ok(!r, "got %u\n", r); + check_prop(hpkg, "=", "asdf"); r = MsiSetPropertyA( hpkg, " ", "asdf" ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); + ok(!r, "got %u\n", r); + check_prop(hpkg, " ", "asdf"); r = MsiSetPropertyA( hpkg, "'", "asdf" ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - - sz = sizeof buffer; - buffer[0]=0; - r = MsiGetPropertyA( hpkg, "'", buffer, &sz ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - ok( !strcmp(buffer,"asdf"), "buffer was not changed\n"); + ok(!r, "got %u\n", r); + check_prop(hpkg, "'", "asdf"); /* set empty values */ r = MsiSetPropertyA( hpkg, "boo", NULL ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n"); + ok(!r, "got %u\n", r); + check_prop(hpkg, "boo", ""); r = MsiSetPropertyA( hpkg, "boo", "" ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n"); + ok(!r, "got %u\n", r); + check_prop(hpkg, "boo", ""); /* set a non-empty value */ r = MsiSetPropertyA( hpkg, "boo", "xyz" ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); + ok(!r, "got %u\n", r); + check_prop(hpkg, "boo", "xyz"); - sz = 1; - strcpy(buffer,"x"); - r = MsiGetPropertyA( hpkg, "boo", buffer, &sz ); - ok( r == ERROR_MORE_DATA, "wrong return val\n"); - ok( buffer[0] == 0, "buffer was not changed\n"); - ok( sz == 3, "wrong size returned\n"); + r = MsiGetPropertyA(hpkg, "boo", NULL, NULL); + ok(!r, "got %u\n", r); - sz = 4; + r = MsiGetPropertyA(hpkg, "boo", buffer, NULL); + ok(r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + sz = 0; + r = MsiGetPropertyA(hpkg, "boo", NULL, &sz); + ok(!r, "got %u\n", r); + ok(sz == 3, "got size %u\n", sz); + + sz = 0; + strcpy(buffer, "q"); + r = MsiGetPropertyA(hpkg, "boo", buffer, &sz); + ok(r == ERROR_MORE_DATA, "got %u\n", r); + ok(!strcmp(buffer, "q"), "got \"%s\"", buffer); + ok(sz == 3, "got size %u\n", sz); + + sz = 1; strcpy(buffer,"x"); r = MsiGetPropertyA( hpkg, "boo", buffer, &sz ); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - ok( !strcmp(buffer,"xyz"), "buffer was not changed\n"); - ok( sz == 3, "wrong size returned\n"); + ok(r == ERROR_MORE_DATA, "got %u\n", r); + ok(!buffer[0], "got \"%s\"\n", buffer); + ok(sz == 3, "got size %u\n", sz); sz = 3; strcpy(buffer,"x"); r = MsiGetPropertyA( hpkg, "boo", buffer, &sz ); - ok( r == ERROR_MORE_DATA, "wrong return val\n"); - ok( !strcmp(buffer,"xy"), "buffer was not changed\n"); - ok( sz == 3, "wrong size returned\n"); - - r = MsiSetPropertyA(hpkg, "SourceDir", "foo"); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - - sz = 4; - r = MsiGetPropertyA(hpkg, "SOURCEDIR", buffer, &sz); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - ok( !strcmp(buffer,""), "buffer wrong\n"); - ok( sz == 0, "wrong size returned\n"); + ok(r == ERROR_MORE_DATA, "got %u\n", r); + ok(!strcmp(buffer,"xy"), "got \"%s\"\n", buffer); + ok(sz == 3, "got size %u\n", sz); sz = 4; - r = MsiGetPropertyA(hpkg, "SOMERANDOMNAME", buffer, &sz); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - ok( !strcmp(buffer,""), "buffer wrong\n"); - ok( sz == 0, "wrong size returned\n"); - - sz = 4; - r = MsiGetPropertyA(hpkg, "SourceDir", buffer, &sz); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - ok( !strcmp(buffer,"foo"), "buffer wrong\n"); - ok( sz == 3, "wrong size returned\n"); - - r = MsiSetPropertyA(hpkg, "MetadataCompName", "Photoshop.dll"); - ok( r == ERROR_SUCCESS, "wrong return val\n"); - - sz = 0; - r = MsiGetPropertyA(hpkg, "MetadataCompName", NULL, &sz ); - ok( r == ERROR_SUCCESS, "return wrong\n"); - ok( sz == 13, "size wrong (%d)\n", sz); - - sz = 13; - r = MsiGetPropertyA(hpkg, "MetadataCompName", buffer, &sz ); - ok( r == ERROR_MORE_DATA, "return wrong\n"); - ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n"); - - r = MsiSetPropertyA(hpkg, "property", "value"); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = 6; - r = MsiGetPropertyA(hpkg, "property", buffer, &sz); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer); + strcpy(buffer,"x"); + r = MsiGetPropertyA( hpkg, "boo", buffer, &sz ); + ok(!r, "got %u\n", r); + ok(!strcmp(buffer,"xyz"), "got \"%s\"\n", buffer); + ok(sz == 3, "got size %u\n", sz); - r = MsiSetPropertyA(hpkg, "property", NULL); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + /* properties are case-sensitive */ + check_prop(hpkg, "BOO", ""); - sz = 6; - r = MsiGetPropertyA(hpkg, "property", buffer, &sz); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!buffer[0], "Expected empty string, got %s\n", buffer); + /* properties set in Property table should work */ + check_prop(hpkg, "MetadataCompName", "Photoshop.dll"); MsiCloseHandle( hpkg ); DeleteFileA(msifile); @@ -3779,57 +3747,6 @@ static void test_states(void) DeleteFileA(msifile4); } -static void test_getproperty(void) -{ - MSIHANDLE hPackage = 0; - char prop[100]; - static CHAR empty[] = ""; - DWORD size; - UINT r; - - r = package_from_db(create_package_db(), &hPackage); - if (r == ERROR_INSTALL_PACKAGE_REJECTED) - { - skip("Not enough rights to perform tests\n"); - DeleteFileA(msifile); - return; - } - ok( r == ERROR_SUCCESS, "Failed to create package %u\n", r ); - - /* set the property */ - r = MsiSetPropertyA(hPackage, "Name", "Value"); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - /* retrieve the size, NULL pointer */ - size = 0; - r = MsiGetPropertyA(hPackage, "Name", NULL, &size); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok( size == 5, "Expected 5, got %d\n", size); - - /* retrieve the size, empty string */ - size = 0; - r = MsiGetPropertyA(hPackage, "Name", empty, &size); - ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); - ok( size == 5, "Expected 5, got %d\n", size); - - /* don't change size */ - r = MsiGetPropertyA(hPackage, "Name", prop, &size); - ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); - ok( size == 5, "Expected 5, got %d\n", size); - ok( !lstrcmpA(prop, "Valu"), "Expected Valu, got %s\n", prop); - - /* increase the size by 1 */ - size++; - r = MsiGetPropertyA(hPackage, "Name", prop, &size); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok( size == 5, "Expected 5, got %d\n", size); - ok( !lstrcmpA(prop, "Value"), "Expected Value, got %s\n", prop); - - r = MsiCloseHandle( hPackage); - ok( r == ERROR_SUCCESS , "Failed to close package\n" ); - DeleteFileA(msifile); -} - static void test_removefiles(void) { MSIHANDLE hpkg; @@ -9723,7 +9640,6 @@ START_TEST(package) test_formatrecord2(); test_formatrecord_tables(); test_states(); - test_getproperty(); test_removefiles(); test_appsearch(); test_appsearch_complocator();
2 years, 9 months
1
0
0
0
[reactos] 05/360: [WINESYNC] msi: Make MsiSetProperty() RPC-compatible.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3431091c60dd1afe4ebb5…
commit 3431091c60dd1afe4ebb5472b1cf73df70e289d8 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:11:46 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:34 2022 +0100 [WINESYNC] msi: Make MsiSetProperty() RPC-compatible. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id a73182ca542c00d15becd1d9e09f1c213082999d by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/package.c | 31 +++---------------------------- dll/win32/msi/winemsi.idl | 2 +- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index afdeaaf2165..483f6c4d597 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -2210,35 +2210,11 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue if( !package ) { MSIHANDLE remote; - HRESULT hr; - BSTR name = NULL, value = NULL; if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; - name = SysAllocString( szName ); - value = SysAllocString( szValue ); - if ((!name && szName) || (!value && szValue)) - { - SysFreeString( name ); - SysFreeString( value ); - return ERROR_OUTOFMEMORY; - } - - hr = remote_SetProperty(remote, name, value); - - SysFreeString( name ); - SysFreeString( value ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + return remote_SetProperty(remote, szName, szValue); } ret = msi_set_property( package->db, szName, szValue, -1 ); @@ -2507,10 +2483,9 @@ UINT __cdecl remote_GetProperty(MSIHANDLE hinst, LPCWSTR property, LPWSTR *value return r; } -HRESULT __cdecl remote_SetProperty(MSIHANDLE hinst, BSTR property, BSTR value) +UINT __cdecl remote_SetProperty(MSIHANDLE hinst, LPCWSTR property, LPCWSTR value) { - UINT r = MsiSetPropertyW(hinst, property, value); - return HRESULT_FROM_WIN32(r); + return MsiSetPropertyW(hinst, property, value); } HRESULT __cdecl remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, MSIHANDLE record) diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl index 07a315b2171..7ea2e3cd57f 100644 --- a/dll/win32/msi/winemsi.idl +++ b/dll/win32/msi/winemsi.idl @@ -43,7 +43,7 @@ interface IWineMsiRemote HRESULT remote_GetActiveDatabase( [in] MSIHANDLE hinst, [out] MSIHANDLE *handle ); UINT remote_GetProperty( [in] MSIHANDLE hinst, [in, string] LPCWSTR property, [out, string] LPWSTR *value, [out] DWORD *size ); - HRESULT remote_SetProperty( [in] MSIHANDLE hinst, [in] BSTR property, [in] BSTR value ); + UINT remote_SetProperty( [in] MSIHANDLE hinst, [in, string, unique] LPCWSTR property, [in, string, unique] LPCWSTR value ); HRESULT remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] MSIHANDLE record ); HRESULT remote_DoAction( [in] MSIHANDLE hinst, [in] BSTR action ); HRESULT remote_Sequence( [in] MSIHANDLE hinst, [in] BSTR table, [in] int sequence );
2 years, 9 months
1
0
0
0
[reactos] 04/360: [WINESYNC] msi: Make MsiGetProperty() RPC-compatible.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=62ababd70dba7298de02f…
commit 62ababd70dba7298de02f6a20bcacafd0d087491 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:11:46 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:34 2022 +0100 [WINESYNC] msi: Make MsiGetProperty() RPC-compatible. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 2192c9a50a91d175f367534d2ed84fe24f4253aa by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/custom.c | 11 +++++++ dll/win32/msi/package.c | 73 ++++++++++++++++++++++------------------------- dll/win32/msi/winemsi.idl | 2 +- 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 680172bbcbd..7a05cb5d670 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -35,6 +35,7 @@ #include "msipriv.h" #include "winemsi.h" +#include "wine/heap.h" #include "wine/debug.h" #include "wine/unicode.h" #include "wine/exception.h" @@ -69,6 +70,16 @@ static CRITICAL_SECTION msi_custom_action_cs = { &msi_custom_action_cs_debug, -1 static struct list msi_pending_custom_actions = LIST_INIT( msi_pending_custom_actions ); +void __RPC_FAR * __RPC_USER MIDL_user_allocate(SIZE_T len) +{ + return heap_alloc(len); +} + +void __RPC_USER MIDL_user_free(void __RPC_FAR * ptr) +{ + heap_free(ptr); +} + UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action ) { UINT count; diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 78152dd7055..afdeaaf2165 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -29,7 +29,6 @@ #include "winnls.h" #include "shlwapi.h" #include "wingdi.h" -#include "wine/debug.h" #include "msi.h" #include "msiquery.h" #include "objidl.h" @@ -39,11 +38,14 @@ #include "winver.h" #include "urlmon.h" #include "shlobj.h" -#include "wine/unicode.h" #include "objbase.h" #include "msidefs.h" #include "sddl.h" +#include "wine/heap.h" +#include "wine/debug.h" +#include "wine/unicode.h" + #include "msipriv.h" #include "winemsi.h" #include "resource.h" @@ -2403,52 +2405,34 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name, package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE ); if (!package) { - HRESULT hr; - LPWSTR value = NULL; + LPWSTR value = NULL, buffer; MSIHANDLE remote; - BSTR bname; if (!(remote = msi_get_remote(handle))) return ERROR_INVALID_HANDLE; - bname = SysAllocString( name ); - if (!bname) - return ERROR_OUTOFMEMORY; - - hr = remote_GetProperty(remote, bname, NULL, &len); - if (FAILED(hr)) - goto done; + r = remote_GetProperty(remote, name, &value, &len); + if (r != ERROR_SUCCESS) + return r; - len++; - value = msi_alloc(len * sizeof(WCHAR)); - if (!value) + /* String might contain embedded nulls. + * Native returns the correct size but truncates the string. */ + buffer = heap_alloc_zero((len + 1) * sizeof(WCHAR)); + if (!buffer) { - r = ERROR_OUTOFMEMORY; - goto done; + midl_user_free(value); + return ERROR_OUTOFMEMORY; } + strcpyW(buffer, value); - hr = remote_GetProperty(remote, bname, value, &len); - if (FAILED(hr)) - goto done; - - r = msi_strcpy_to_awstring( value, len, szValueBuf, pchValueBuf ); + r = msi_strcpy_to_awstring(buffer, len, szValueBuf, pchValueBuf); /* Bug required by Adobe installers */ - if (!szValueBuf->unicode && !szValueBuf->str.a) + if (pchValueBuf && !szValueBuf->unicode && !szValueBuf->str.a) *pchValueBuf *= sizeof(WCHAR); -done: - SysFreeString(bname); - msi_free(value); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - + heap_free(buffer); + midl_user_free(value); return r; } @@ -2505,11 +2489,22 @@ HRESULT __cdecl remote_GetActiveDatabase(MSIHANDLE hinst, MSIHANDLE *handle) return S_OK; } -HRESULT __cdecl remote_GetProperty(MSIHANDLE hinst, BSTR property, BSTR value, DWORD *size) +UINT __cdecl remote_GetProperty(MSIHANDLE hinst, LPCWSTR property, LPWSTR *value, DWORD *size) { - UINT r = MsiGetPropertyW(hinst, property, value, size); - if (r != ERROR_SUCCESS) return HRESULT_FROM_WIN32(r); - return S_OK; + WCHAR empty[1]; + UINT r; + + *size = 0; + r = MsiGetPropertyW(hinst, property, empty, size); + if (r == ERROR_MORE_DATA) + { + ++*size; + *value = midl_user_allocate(*size * sizeof(WCHAR)); + if (!*value) + return ERROR_OUTOFMEMORY; + r = MsiGetPropertyW(hinst, property, *value, size); + } + return r; } HRESULT __cdecl remote_SetProperty(MSIHANDLE hinst, BSTR property, BSTR value) diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl index 560b3067822..07a315b2171 100644 --- a/dll/win32/msi/winemsi.idl +++ b/dll/win32/msi/winemsi.idl @@ -42,7 +42,7 @@ interface IWineMsiRemote HRESULT remote_DatabaseOpenView( [in] MSIHANDLE db, [in] LPCWSTR query, [out] MSIHANDLE *view ); HRESULT remote_GetActiveDatabase( [in] MSIHANDLE hinst, [out] MSIHANDLE *handle ); - HRESULT remote_GetProperty( [in] MSIHANDLE hinst, [in] BSTR property, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); + UINT remote_GetProperty( [in] MSIHANDLE hinst, [in, string] LPCWSTR property, [out, string] LPWSTR *value, [out] DWORD *size ); HRESULT remote_SetProperty( [in] MSIHANDLE hinst, [in] BSTR property, [in] BSTR value ); HRESULT remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] MSIHANDLE record ); HRESULT remote_DoAction( [in] MSIHANDLE hinst, [in] BSTR action );
2 years, 9 months
1
0
0
0
[reactos] 03/360: [WINESYNC] msi: Convert the IWineMsiRemote* remote interfaces to RPC stubs.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b74b77aa655faf2da1c7b…
commit b74b77aa655faf2da1c7bc457f09aa3abea3d70b Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:11:45 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:34 2022 +0100 [WINESYNC] msi: Convert the IWineMsiRemote* remote interfaces to RPC stubs. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 8bfb4e8b6209d02a18be3299717b1f38db7045fe by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/CMakeLists.txt | 8 +- dll/win32/msi/cond.y | 13 +- dll/win32/msi/custom.c | 117 ++---------------- dll/win32/msi/database.c | 122 +++---------------- dll/win32/msi/dialog.c | 5 +- dll/win32/msi/format.c | 11 +- dll/win32/msi/handle.c | 30 +++-- dll/win32/msi/install.c | 149 +++++++---------------- dll/win32/msi/msi.c | 17 ++- dll/win32/msi/msi_main.c | 7 -- dll/win32/msi/msipriv.h | 7 +- dll/win32/msi/msiquery.c | 41 +++---- dll/win32/msi/msiserver.idl | 64 ---------- dll/win32/msi/package.c | 281 ++++++++++--------------------------------- dll/win32/msi/suminfo.c | 14 +-- dll/win32/msi/winemsi.idl | 70 +++++++++++ 16 files changed, 264 insertions(+), 692 deletions(-) diff --git a/dll/win32/msi/CMakeLists.txt b/dll/win32/msi/CMakeLists.txt index 1b674400b6c..d3eb231a0fd 100644 --- a/dll/win32/msi/CMakeLists.txt +++ b/dll/win32/msi/CMakeLists.txt @@ -6,6 +6,7 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) add_definitions(-D__WINESRC__ -D__ROS_LONG64__ -DMSIRUNMODE=MSIRUNMODE_T) spec2def(msi.dll msi.spec ADD_IMPORTLIB) generate_idl_iids(msiserver.idl) +generate_idl_iids(winemsi.idl) list(APPEND SOURCE action.c @@ -55,6 +56,7 @@ list(APPEND PCH_SKIP_SOURCE ${BISON_cond_OUTPUTS} ${BISON_sql_OUTPUTS} ${CMAKE_CURRENT_BINARY_DIR}/msiserver_i.c + ${CMAKE_CURRENT_BINARY_DIR}/winemsi_i.c ${CMAKE_CURRENT_BINARY_DIR}/msi_stubs.c) add_library(msi MODULE @@ -71,9 +73,9 @@ if(MSVC) target_compile_options(msi PRIVATE /wd4090 /wd4133 /wd4146 /wd4312) endif() -add_idl_headers(msi_idlheader msiserver.idl) -add_typelib(msiserver.idl) -set_source_files_properties(msi.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/msiserver.tlb) +add_idl_headers(msi_idlheader msiserver.idl winemsi.idl) +add_typelib(msiserver.idl winemsi.idl) +set_source_files_properties(msi.rc PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/msiserver.tlb;${CMAKE_CURRENT_BINARY_DIR}/winemsi.tlb") set_module_type(msi win32dll) target_link_libraries(msi uuid ${PSEH_LIB} wine) add_dependencies(msi msi_idlheader) diff --git a/dll/win32/msi/cond.y b/dll/win32/msi/cond.y index 3a0d02879a8..6156750c04b 100644 --- a/dll/win32/msi/cond.y +++ b/dll/win32/msi/cond.y @@ -37,7 +37,7 @@ #include "oleauto.h" #include "msipriv.h" -#include "msiserver.h" +#include "winemsi.h" #include "wine/debug.h" #include "wine/unicode.h" #include "wine/list.h" @@ -850,25 +850,20 @@ MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szConditi package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE); if( !package ) { + MSIHANDLE remote; HRESULT hr; BSTR condition; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return MSICONDITION_ERROR; condition = SysAllocString( szCondition ); if (!condition) - { - IWineMsiRemotePackage_Release( remote_package ); return ERROR_OUTOFMEMORY; - } - hr = IWineMsiRemotePackage_EvaluateCondition( remote_package, condition ); + hr = remote_EvaluateCondition(remote, condition); SysFreeString( condition ); - IWineMsiRemotePackage_Release( remote_package ); if (FAILED(hr)) { diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index f9abcd2f8a6..680172bbcbd 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -34,7 +34,7 @@ #include "oleauto.h" #include "msipriv.h" -#include "msiserver.h" +#include "winemsi.h" #include "wine/debug.h" #include "wine/unicode.h" #include "wine/exception.h" @@ -495,40 +495,6 @@ static void handle_msi_break( LPCWSTR target ) DebugBreak(); } -static UINT get_action_info( const GUID *guid, INT *type, - BSTR *dll, BSTR *funcname, - IWineMsiRemotePackage **package ) -{ - IClassFactory *cf = NULL; - IWineMsiRemoteCustomAction *rca = NULL; - HRESULT r; - - r = DllGetClassObject( &CLSID_WineMsiRemoteCustomAction, - &IID_IClassFactory, (LPVOID *)&cf ); - if (FAILED(r)) - { - ERR("failed to get IClassFactory interface\n"); - return ERROR_FUNCTION_FAILED; - } - - r = IClassFactory_CreateInstance( cf, NULL, &IID_IWineMsiRemoteCustomAction, (LPVOID *)&rca ); - if (FAILED(r)) - { - ERR("failed to get IWineMsiRemoteCustomAction interface\n"); - return ERROR_FUNCTION_FAILED; - } - - r = IWineMsiRemoteCustomAction_GetActionInfo( rca, guid, type, dll, funcname, package ); - IWineMsiRemoteCustomAction_Release( rca ); - if (FAILED(r)) - { - ERR("GetActionInfo failed\n"); - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; -} - #ifdef __i386__ extern UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE handle ); __ASM_GLOBAL_FUNC( CUSTOMPROC_wrapper, @@ -555,17 +521,17 @@ static inline UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE static DWORD ACTION_CallDllFunction( const GUID *guid ) { MsiCustomActionEntryPoint fn; + MSIHANDLE remote_package = 0; MSIHANDLE hPackage; HANDLE hModule; LPSTR proc; UINT r = ERROR_FUNCTION_FAILED; BSTR dll = NULL, function = NULL; INT type; - IWineMsiRemotePackage *remote_package = NULL; TRACE("%s\n", debugstr_guid( guid )); - r = get_action_info( guid, &type, &dll, &function, &remote_package ); + r = remote_GetActionInfo( guid, &type, &dll, &function, &remote_package ); if (r != ERROR_SUCCESS) return r; @@ -581,7 +547,7 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) msi_free( proc ); if (fn) { - hPackage = alloc_msi_remote_handle( (IUnknown *)remote_package ); + hPackage = alloc_msi_remote_handle( remote_package ); if (hPackage) { TRACE("calling %s\n", debugstr_w( function ) ); @@ -602,14 +568,14 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) MsiCloseHandle( hPackage ); } else - ERR("failed to create handle for %p\n", remote_package ); + ERR("failed to create handle for %x\n", remote_package ); } else ERR("GetProcAddress(%s) failed\n", debugstr_w( function ) ); FreeLibrary(hModule); - IWineMsiRemotePackage_Release( remote_package ); + MsiCloseHandle(hPackage); SysFreeString( dll ); SysFreeString( function ); @@ -1388,50 +1354,8 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) LeaveCriticalSection( &msi_custom_action_cs ); } -typedef struct _msi_custom_remote_impl { - IWineMsiRemoteCustomAction IWineMsiRemoteCustomAction_iface; - LONG refs; -} msi_custom_remote_impl; - -static inline msi_custom_remote_impl *impl_from_IWineMsiRemoteCustomAction( IWineMsiRemoteCustomAction *iface ) -{ - return CONTAINING_RECORD(iface, msi_custom_remote_impl, IWineMsiRemoteCustomAction_iface); -} - -static HRESULT WINAPI mcr_QueryInterface( IWineMsiRemoteCustomAction *iface, - REFIID riid,LPVOID *ppobj) -{ - if( IsEqualCLSID( riid, &IID_IUnknown ) || - IsEqualCLSID( riid, &IID_IWineMsiRemoteCustomAction ) ) - { - IWineMsiRemoteCustomAction_AddRef( iface ); - *ppobj = iface; - return S_OK; - } - - return E_NOINTERFACE; -} - -static ULONG WINAPI mcr_AddRef( IWineMsiRemoteCustomAction *iface ) -{ - msi_custom_remote_impl* This = impl_from_IWineMsiRemoteCustomAction( iface ); - - return InterlockedIncrement( &This->refs ); -} - -static ULONG WINAPI mcr_Release( IWineMsiRemoteCustomAction *iface ) -{ - msi_custom_remote_impl* This = impl_from_IWineMsiRemoteCustomAction( iface ); - ULONG r; - - r = InterlockedDecrement( &This->refs ); - if (r == 0) - msi_free( This ); - return r; -} - -static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCGUID custom_action_guid, - INT *type, BSTR *dll, BSTR *func, IWineMsiRemotePackage **remote_package ) +HRESULT __cdecl remote_GetActionInfo( const GUID *custom_action_guid, + INT *type, BSTR *dll, BSTR *func, MSIHANDLE *remote_package ) { msi_custom_action_info *info; MSIHANDLE handle; @@ -1446,29 +1370,6 @@ static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCG *func = SysAllocString( info->target ); release_custom_action_data( info ); - return create_msi_remote_package( handle, remote_package ); -} - -static const IWineMsiRemoteCustomActionVtbl msi_custom_remote_vtbl = -{ - mcr_QueryInterface, - mcr_AddRef, - mcr_Release, - mcr_GetActionInfo, -}; - -HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj ) -{ - msi_custom_remote_impl* This; - - This = msi_alloc( sizeof *This ); - if (!This) - return E_OUTOFMEMORY; - - This->IWineMsiRemoteCustomAction_iface.lpVtbl = &msi_custom_remote_vtbl; - This->refs = 1; - - *ppObj = &This->IWineMsiRemoteCustomAction_iface; - + *remote_package = handle; return S_OK; } diff --git a/dll/win32/msi/database.c b/dll/win32/msi/database.c index fc62340acee..08b47c05068 100644 --- a/dll/win32/msi/database.c +++ b/dll/win32/msi/database.c @@ -880,13 +880,10 @@ UINT WINAPI MsiDatabaseImportW(MSIHANDLE handle, LPCWSTR szFolder, LPCWSTR szFil db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); if( !db ) { - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle ); + MSIHANDLE remote_database = msi_get_remote( handle ); if ( !remote_database ) return ERROR_INVALID_HANDLE; - IWineMsiRemoteDatabase_Release( remote_database ); WARN("MsiDatabaseImport not allowed during a custom action!\n"); return ERROR_SUCCESS; @@ -1206,13 +1203,10 @@ UINT WINAPI MsiDatabaseExportW( MSIHANDLE handle, LPCWSTR szTable, db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); if( !db ) { - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle ); + MSIHANDLE remote_database = msi_get_remote(handle); if ( !remote_database ) return ERROR_INVALID_HANDLE; - IWineMsiRemoteDatabase_Release( remote_database ); WARN("MsiDatabaseExport not allowed during a custom action!\n"); return ERROR_SUCCESS; @@ -2008,8 +2002,12 @@ MSIDBSTATE WINAPI MsiGetDatabaseState( MSIHANDLE handle ) db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); if( !db ) { + MSIHANDLE remote_database = msi_get_remote(handle); + if ( !remote_database ) + return MSIDBSTATE_ERROR; + WARN("MsiGetDatabaseState not allowed during a custom action!\n"); - return MSIDBSTATE_ERROR; + return MSIDBSTATE_READ; } if (db->mode != MSIDBOPEN_READONLY ) @@ -2019,116 +2017,26 @@ MSIDBSTATE WINAPI MsiGetDatabaseState( MSIHANDLE handle ) return ret; } -typedef struct _msi_remote_database_impl { - IWineMsiRemoteDatabase IWineMsiRemoteDatabase_iface; - MSIHANDLE database; - LONG refs; -} msi_remote_database_impl; - -static inline msi_remote_database_impl *impl_from_IWineMsiRemoteDatabase( IWineMsiRemoteDatabase *iface ) -{ - return CONTAINING_RECORD(iface, msi_remote_database_impl, IWineMsiRemoteDatabase_iface); -} - -static HRESULT WINAPI mrd_QueryInterface( IWineMsiRemoteDatabase *iface, - REFIID riid,LPVOID *ppobj) -{ - if( IsEqualCLSID( riid, &IID_IUnknown ) || - IsEqualCLSID( riid, &IID_IWineMsiRemoteDatabase ) ) - { - IWineMsiRemoteDatabase_AddRef( iface ); - *ppobj = iface; - return S_OK; - } - - return E_NOINTERFACE; -} - -static ULONG WINAPI mrd_AddRef( IWineMsiRemoteDatabase *iface ) -{ - msi_remote_database_impl* This = impl_from_IWineMsiRemoteDatabase( iface ); - - return InterlockedIncrement( &This->refs ); -} - -static ULONG WINAPI mrd_Release( IWineMsiRemoteDatabase *iface ) -{ - msi_remote_database_impl* This = impl_from_IWineMsiRemoteDatabase( iface ); - ULONG r; - - r = InterlockedDecrement( &This->refs ); - if (r == 0) - { - MsiCloseHandle( This->database ); - msi_free( This ); - } - return r; -} - -static HRESULT WINAPI mrd_IsTablePersistent( IWineMsiRemoteDatabase *iface, - LPCWSTR table, MSICONDITION *persistent ) +HRESULT __cdecl remote_DatabaseIsTablePersistent(MSIHANDLE db, LPCWSTR table, MSICONDITION *persistent) { - msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface ); - *persistent = MsiDatabaseIsTablePersistentW(This->database, table); + *persistent = MsiDatabaseIsTablePersistentW(db, table); return S_OK; } -static HRESULT WINAPI mrd_GetPrimaryKeys( IWineMsiRemoteDatabase *iface, - LPCWSTR table, MSIHANDLE *keys ) +HRESULT __cdecl remote_DatabaseGetPrimaryKeys(MSIHANDLE db, LPCWSTR table, MSIHANDLE *keys) { - msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface ); - UINT r = MsiDatabaseGetPrimaryKeysW(This->database, table, keys); + UINT r = MsiDatabaseGetPrimaryKeysW(db, table, keys); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrd_GetSummaryInformation( IWineMsiRemoteDatabase *iface, - UINT updatecount, MSIHANDLE *suminfo ) +HRESULT __cdecl remote_DatabaseGetSummaryInformation(MSIHANDLE db, UINT updatecount, MSIHANDLE *suminfo) { - msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface ); - UINT r = MsiGetSummaryInformationW(This->database, NULL, updatecount, suminfo); + UINT r = MsiGetSummaryInformationW(db, NULL, updatecount, suminfo); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrd_OpenView( IWineMsiRemoteDatabase *iface, - LPCWSTR query, MSIHANDLE *view ) +HRESULT __cdecl remote_DatabaseOpenView(MSIHANDLE db, LPCWSTR query, MSIHANDLE *view) { - msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface ); - UINT r = MsiDatabaseOpenViewW(This->database, query, view); + UINT r = MsiDatabaseOpenViewW(db, query, view); return HRESULT_FROM_WIN32(r); } - -static HRESULT WINAPI mrd_SetMsiHandle( IWineMsiRemoteDatabase *iface, MSIHANDLE handle ) -{ - msi_remote_database_impl* This = impl_from_IWineMsiRemoteDatabase( iface ); - This->database = handle; - return S_OK; -} - -static const IWineMsiRemoteDatabaseVtbl msi_remote_database_vtbl = -{ - mrd_QueryInterface, - mrd_AddRef, - mrd_Release, - mrd_IsTablePersistent, - mrd_GetPrimaryKeys, - mrd_GetSummaryInformation, - mrd_OpenView, - mrd_SetMsiHandle, -}; - -HRESULT create_msi_remote_database( IUnknown *pOuter, LPVOID *ppObj ) -{ - msi_remote_database_impl *This; - - This = msi_alloc( sizeof *This ); - if (!This) - return E_OUTOFMEMORY; - - This->IWineMsiRemoteDatabase_iface.lpVtbl = &msi_remote_database_vtbl; - This->database = 0; - This->refs = 1; - - *ppObj = &This->IWineMsiRemoteDatabase_iface; - - return S_OK; -} diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c index c5f1da508c2..8cec1954ecb 100644 --- a/dll/win32/msi/dialog.c +++ b/dll/win32/msi/dialog.c @@ -4155,15 +4155,12 @@ UINT WINAPI MsiEnableUIPreview( MSIHANDLE hdb, MSIHANDLE *phPreview ) db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); if (!db) { - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); + MSIHANDLE remote_database = msi_get_remote( hdb ); if (!remote_database) return ERROR_INVALID_HANDLE; *phPreview = 0; - IWineMsiRemoteDatabase_Release( remote_database ); WARN("MsiEnableUIPreview not allowed during a custom action!\n"); return ERROR_FUNCTION_FAILED; diff --git a/dll/win32/msi/format.c b/dll/win32/msi/format.c index 3bcd0b84ee6..f15c4ceb60c 100644 --- a/dll/win32/msi/format.c +++ b/dll/win32/msi/format.c @@ -34,7 +34,7 @@ #include "oleauto.h" #include "msipriv.h" -#include "msiserver.h" +#include "winemsi.h" #include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -911,15 +911,13 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord, if (!package) { HRESULT hr; - IWineMsiRemotePackage *remote_package; + MSIHANDLE remote; BSTR value = NULL; awstring wstr; - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (remote_package) + if ((remote = msi_get_remote(hInstall))) { - hr = IWineMsiRemotePackage_FormatRecord( remote_package, hRecord, - &value ); + hr = remote_FormatRecord(remote, hRecord, &value); if (FAILED(hr)) goto done; @@ -928,7 +926,6 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord, r = msi_strcpy_to_awstring( value, SysStringLen(value), &wstr, sz ); done: - IWineMsiRemotePackage_Release( remote_package ); SysFreeString( value ); if (FAILED(hr)) diff --git a/dll/win32/msi/handle.c b/dll/win32/msi/handle.c index 80c68739816..1002f9d969b 100644 --- a/dll/win32/msi/handle.c +++ b/dll/win32/msi/handle.c @@ -29,7 +29,9 @@ #include "wine/debug.h" #include "msi.h" #include "msiquery.h" + #include "msipriv.h" +#include "winemsi.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -58,7 +60,7 @@ typedef struct msi_handle_info_t BOOL remote; union { MSIOBJECTHDR *obj; - IUnknown *unk; + MSIHANDLE rem; } u; DWORD dwThreadId; } msi_handle_info; @@ -81,7 +83,7 @@ static MSIHANDLE alloc_handle_table_entry(void) /* find a slot */ for(i=0; i<msihandletable_size; i++) - if( !msihandletable[i].u.obj && !msihandletable[i].u.unk ) + if( !msihandletable[i].u.obj && !msihandletable[i].u.rem ) break; if( i==msihandletable_size ) { @@ -130,7 +132,7 @@ MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj ) return ret; } -MSIHANDLE alloc_msi_remote_handle( IUnknown *unk ) +MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote) { msi_handle_info *entry; MSIHANDLE ret; @@ -141,15 +143,14 @@ MSIHANDLE alloc_msi_remote_handle( IUnknown *unk ) if (ret) { entry = &msihandletable[ ret - 1 ]; - IUnknown_AddRef( unk ); - entry->u.unk = unk; + entry->u.rem = remote; entry->dwThreadId = GetCurrentThreadId(); entry->remote = TRUE; } LeaveCriticalSection( &MSI_handle_cs ); - TRACE("%p -> %d\n", unk, ret); + TRACE("%d -> %d\n", remote, ret); return ret; } @@ -179,9 +180,9 @@ out: return ret; } -IUnknown *msi_get_remote( MSIHANDLE handle ) +MSIHANDLE msi_get_remote( MSIHANDLE handle ) { - IUnknown *unk = NULL; + MSIHANDLE ret = 0; EnterCriticalSection( &MSI_handle_cs ); handle--; @@ -189,14 +190,12 @@ IUnknown *msi_get_remote( MSIHANDLE handle ) goto out; if( !msihandletable[handle].remote) goto out; - unk = msihandletable[handle].u.unk; - if( unk ) - IUnknown_AddRef( unk ); + ret = msihandletable[handle].u.rem; out: LeaveCriticalSection( &MSI_handle_cs ); - return unk; + return ret; } void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ) @@ -285,7 +284,7 @@ UINT WINAPI MsiCloseHandle(MSIHANDLE handle) if (msihandletable[handle].remote) { - IUnknown_Release( msihandletable[handle].u.unk ); + remote_CloseHandle( msihandletable[handle].u.rem ); } else { @@ -344,3 +343,8 @@ UINT WINAPI MsiCloseAllHandles(void) return n; } + +UINT __cdecl remote_CloseHandle(MSIHANDLE handle) +{ + return MsiCloseHandle(handle); +} diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c index 261a259f3f5..65840e28f47 100644 --- a/dll/win32/msi/install.c +++ b/dll/win32/msi/install.c @@ -34,7 +34,7 @@ #include "oleauto.h" #include "msipriv.h" -#include "msiserver.h" +#include "winemsi.h" #include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -74,25 +74,20 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction ) package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) { + MSIHANDLE remote; HRESULT hr; BSTR action; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; action = SysAllocString( szAction ); if (!action) - { - IWineMsiRemotePackage_Release( remote_package ); return ERROR_OUTOFMEMORY; - } - hr = IWineMsiRemotePackage_DoAction( remote_package, action ); + hr = remote_DoAction(remote, action); SysFreeString( action ); - IWineMsiRemotePackage_Release( remote_package ); if (FAILED(hr)) { @@ -143,25 +138,20 @@ UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) { + MSIHANDLE remote; HRESULT hr; BSTR table; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; table = SysAllocString( szTable ); if (!table) - { - IWineMsiRemotePackage_Release( remote_package ); return ERROR_OUTOFMEMORY; - } - hr = IWineMsiRemotePackage_Sequence( remote_package, table, iSequenceMode ); + hr = remote_Sequence(remote, table, iSequenceMode); SysFreeString( table ); - IWineMsiRemotePackage_Release( remote_package ); if (FAILED(hr)) { @@ -239,25 +229,21 @@ static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder, package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) { + MSIHANDLE remote; HRESULT hr; - IWineMsiRemotePackage *remote_package; LPWSTR value = NULL; BSTR folder; DWORD len; - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; folder = SysAllocString( szFolder ); if (!folder) - { - IWineMsiRemotePackage_Release( remote_package ); return ERROR_OUTOFMEMORY; - } len = 0; - hr = IWineMsiRemotePackage_GetTargetPath( remote_package, folder, NULL, &len ); + hr = remote_GetTargetPath(remote, folder, NULL, &len); if (FAILED(hr)) goto done; @@ -269,14 +255,13 @@ static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder, goto done; } - hr = IWineMsiRemotePackage_GetTargetPath( remote_package, folder, value, &len ); + hr = remote_GetTargetPath(remote, folder, value, &len); if (FAILED(hr)) goto done; r = msi_strcpy_to_awstring( value, len, szPathBuf, pcchPathBuf ); done: - IWineMsiRemotePackage_Release( remote_package ); SysFreeString( folder ); msi_free( value ); @@ -409,24 +394,20 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder, if (!package) { HRESULT hr; - IWineMsiRemotePackage *remote_package; LPWSTR value = NULL; + MSIHANDLE remote; BSTR folder; DWORD len; - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; folder = SysAllocString( szFolder ); if (!folder) - { - IWineMsiRemotePackage_Release( remote_package ); return ERROR_OUTOFMEMORY; - } len = 0; - hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder, NULL, &len ); + hr = remote_GetSourcePath(remote, folder, NULL, &len); if (FAILED(hr)) goto done; @@ -438,14 +419,13 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder, goto done; } - hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder, value, &len ); + hr = remote_GetSourcePath(remote, folder, value, &len); if (FAILED(hr)) goto done; r = msi_strcpy_to_awstring( value, len, szPathBuf, pcchPathBuf ); done: - IWineMsiRemotePackage_Release( remote_package ); SysFreeString( folder ); msi_free( value ); @@ -616,10 +596,9 @@ UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, { HRESULT hr; BSTR folder, path; - IWineMsiRemotePackage *remote_package; + MSIHANDLE remote; - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; folder = SysAllocString( szFolder ); @@ -628,15 +607,13 @@ UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, { SysFreeString(folder); SysFreeString(path); - IWineMsiRemotePackage_Release( remote_package ); return ERROR_OUTOFMEMORY; } - hr = IWineMsiRemotePackage_SetTargetPath( remote_package, folder, path ); + hr = remote_SetTargetPath(remote, folder, path); SysFreeString(folder); SysFreeString(path); - IWineMsiRemotePackage_Release( remote_package ); if (FAILED(hr)) { @@ -697,16 +674,14 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode) package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) { + MSIHANDLE remote; BOOL ret; HRESULT hr; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return FALSE; - hr = IWineMsiRemotePackage_GetMode(remote_package, iRunMode, &ret); - IWineMsiRemotePackage_Release(remote_package); + hr = remote_GetMode(remote, iRunMode, &ret); if (hr == S_OK) return ret; @@ -789,15 +764,13 @@ UINT WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode, BOOL fState) package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) { + MSIHANDLE remote; HRESULT hr; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return FALSE; - hr = IWineMsiRemotePackage_SetMode( remote_package, iRunMode, fState ); - IWineMsiRemotePackage_Release( remote_package ); + hr = remote_SetMode(remote, iRunMode, fState); if (FAILED(hr)) { @@ -980,25 +953,20 @@ UINT WINAPI MsiSetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) { + MSIHANDLE remote; HRESULT hr; BSTR feature; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; feature = SysAllocString(szFeature); if (!feature) - { - IWineMsiRemotePackage_Release(remote_package); return ERROR_OUTOFMEMORY; - } - hr = IWineMsiRemotePackage_SetFeatureState(remote_package, feature, iState); + hr = remote_SetFeatureState(remote, feature, iState); SysFreeString(feature); - IWineMsiRemotePackage_Release(remote_package); if (FAILED(hr)) { @@ -1131,26 +1099,20 @@ UINT WINAPI MsiGetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) { + MSIHANDLE remote; HRESULT hr; BSTR feature; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; feature = SysAllocString(szFeature); if (!feature) - { - IWineMsiRemotePackage_Release(remote_package); return ERROR_OUTOFMEMORY; - } - hr = IWineMsiRemotePackage_GetFeatureState(remote_package, feature, - piInstalled, piAction); + hr = remote_GetFeatureState(remote, feature, piInstalled, piAction); SysFreeString(feature); - IWineMsiRemotePackage_Release(remote_package); if (FAILED(hr)) { @@ -1263,26 +1225,20 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) { + MSIHANDLE remote; HRESULT hr; BSTR feature; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; feature = SysAllocString(szFeature); if (!feature) - { - IWineMsiRemotePackage_Release(remote_package); return ERROR_OUTOFMEMORY; - } - hr = IWineMsiRemotePackage_GetFeatureCost(remote_package, feature, - iCostTree, iState, piCost); + hr = remote_GetFeatureCost(remote, feature, iCostTree, iState, piCost); SysFreeString(feature); - IWineMsiRemotePackage_Release(remote_package); if (FAILED(hr)) { @@ -1521,25 +1477,20 @@ UINT WINAPI MsiSetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) { + MSIHANDLE remote; HRESULT hr; BSTR component; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; component = SysAllocString(szComponent); if (!component) - { - IWineMsiRemotePackage_Release(remote_package); return ERROR_OUTOFMEMORY; - } - hr = IWineMsiRemotePackage_SetComponentState(remote_package, component, iState); + hr = remote_SetComponentState(remote, component, iState); SysFreeString(component); - IWineMsiRemotePackage_Release(remote_package); if (FAILED(hr)) { @@ -1572,26 +1523,20 @@ UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) { + MSIHANDLE remote; HRESULT hr; BSTR component; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; component = SysAllocString(szComponent); if (!component) - { - IWineMsiRemotePackage_Release(remote_package); return ERROR_OUTOFMEMORY; - } - hr = IWineMsiRemotePackage_GetComponentState(remote_package, component, - piInstalled, piAction); + hr = remote_GetComponentState(remote, component, piInstalled, piAction); SysFreeString(component); - IWineMsiRemotePackage_Release(remote_package); if (FAILED(hr)) { @@ -1620,15 +1565,14 @@ LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall) package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) { + MSIHANDLE remote; HRESULT hr; LANGID lang; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; - hr = IWineMsiRemotePackage_GetLanguage(remote_package, &lang); + hr = remote_GetLanguage(remote, &lang); if (SUCCEEDED(hr)) return lang; @@ -1677,16 +1621,13 @@ UINT WINAPI MsiSetInstallLevel(MSIHANDLE hInstall, int iInstallLevel) package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) { + MSIHANDLE remote; HRESULT hr; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; - hr = IWineMsiRemotePackage_SetInstallLevel(remote_package, iInstallLevel); - - IWineMsiRemotePackage_Release(remote_package); + hr = remote_SetInstallLevel(remote, iInstallLevel); if (FAILED(hr)) { diff --git a/dll/win32/msi/msi.c b/dll/win32/msi/msi.c index 7e5e23fc51f..c0af7f52f62 100644 --- a/dll/win32/msi/msi.c +++ b/dll/win32/msi/msi.c @@ -31,8 +31,6 @@ #include "msi.h" #include "msidefs.h" #include "msiquery.h" -#include "msipriv.h" -#include "msiserver.h" #include "wincrypt.h" #include "winver.h" #include "winuser.h" @@ -42,6 +40,9 @@ #include "wintrust.h" #include "softpub.h" +#include "msipriv.h" +#include "winemsi.h" + #include "initguid.h" #include "msxml2.h" @@ -2004,20 +2005,18 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, LPCWSTR component, DWORD i if (!drive || !buflen || !cost || !temp) return ERROR_INVALID_PARAMETER; if (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE ))) { + MSIHANDLE remote; HRESULT hr; - IWineMsiRemotePackage *remote_package; BSTR bname = NULL; - if (!(remote_package = (IWineMsiRemotePackage *)msi_get_remote( handle ))) + if (!(remote = msi_get_remote(handle))) return ERROR_INVALID_HANDLE; if (component && !(bname = SysAllocString( component ))) - { - IWineMsiRemotePackage_Release( remote_package ); return ERROR_OUTOFMEMORY; - } - hr = IWineMsiRemotePackage_EnumComponentCosts( remote_package, bname, index, state, drive, buflen, cost, temp ); - IWineMsiRemotePackage_Release( remote_package ); + + hr = remote_EnumComponentCosts(remote, bname, index, state, drive, buflen, cost, temp); + SysFreeString( bname ); if (FAILED(hr)) { diff --git a/dll/win32/msi/msi_main.c b/dll/win32/msi/msi_main.c index 9f5b2c4a547..0e436b09e59 100644 --- a/dll/win32/msi/msi_main.c +++ b/dll/win32/msi/msi_main.c @@ -166,7 +166,6 @@ static const IClassFactoryVtbl MsiCF_Vtbl = }; static IClassFactoryImpl MsiServer_CF = { { &MsiCF_Vtbl }, create_msiserver }; -static IClassFactoryImpl WineMsiCustomRemote_CF = { { &MsiCF_Vtbl }, create_msi_custom_remote }; /****************************************************************** * DllGetClassObject [MSI.@] @@ -181,12 +180,6 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) return S_OK; } - if ( IsEqualCLSID (rclsid, &CLSID_WineMsiRemoteCustomAction) ) - { - *ppv = &WineMsiCustomRemote_CF; - return S_OK; - } - if( IsEqualCLSID (rclsid, &CLSID_MsiServerMessage) || IsEqualCLSID (rclsid, &CLSID_MsiServer) || IsEqualCLSID (rclsid, &CLSID_PSFactoryBuffer) || diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index f7e3cfe788a..ef0070ba1ae 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -734,15 +734,12 @@ typedef struct { UINT msi_strcpy_to_awstring(const WCHAR *, int, awstring *, DWORD *) DECLSPEC_HIDDEN; /* msi server interface */ -extern HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; -extern HRESULT create_msi_remote_package( MSIHANDLE handle, IWineMsiRemotePackage **package ) DECLSPEC_HIDDEN; -extern HRESULT create_msi_remote_database( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; -extern IUnknown *msi_get_remote(MSIHANDLE handle) DECLSPEC_HIDDEN; +extern MSIHANDLE msi_get_remote(MSIHANDLE handle) DECLSPEC_HIDDEN; /* handle functions */ extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type) DECLSPEC_HIDDEN; extern MSIHANDLE alloc_msihandle( MSIOBJECTHDR * ) DECLSPEC_HIDDEN; -extern MSIHANDLE alloc_msi_remote_handle( IUnknown *unk ) DECLSPEC_HIDDEN; +extern MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote) DECLSPEC_HIDDEN; extern void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ) DECLSPEC_HIDDEN; extern void msiobj_addref(MSIOBJECTHDR *) DECLSPEC_HIDDEN; extern int msiobj_release(MSIOBJECTHDR *) DECLSPEC_HIDDEN; diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c index d73e5febdc1..f8ed4ce6a87 100644 --- a/dll/win32/msi/msiquery.c +++ b/dll/win32/msi/msiquery.c @@ -31,11 +31,11 @@ #include "msiquery.h" #include "objbase.h" #include "objidl.h" -#include "msipriv.h" #include "winnls.h" +#include "msipriv.h" #include "query.h" -#include "msiserver.h" +#include "winemsi.h" #include "initguid.h" @@ -250,15 +250,13 @@ UINT WINAPI MsiDatabaseOpenViewW(MSIHANDLE hdb, db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); if( !db ) { + MSIHANDLE remote; HRESULT hr; - IWineMsiRemoteDatabase *remote_database; - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); - if ( !remote_database ) + if (!(remote = msi_get_remote(hdb))) return ERROR_INVALID_HANDLE; - hr = IWineMsiRemoteDatabase_OpenView( remote_database, szQuery, phView ); - IWineMsiRemoteDatabase_Release( remote_database ); + hr = remote_DatabaseOpenView(remote, szQuery, phView); if (FAILED(hr)) { @@ -758,13 +756,11 @@ UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb, db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); if( !db ) { - IWineMsiRemoteDatabase *remote_database; + MSIHANDLE remote; - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); - if ( !remote_database ) + if (!(remote = msi_get_remote(hdb))) return ERROR_INVALID_HANDLE; - IWineMsiRemoteDatabase_Release( remote_database ); WARN("MsiDatabaseApplyTransform not allowed during a custom action!\n"); return ERROR_SUCCESS; @@ -820,13 +816,11 @@ UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb ) db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); if( !db ) { - IWineMsiRemoteDatabase *remote_database; + MSIHANDLE remote; - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); - if ( !remote_database ) + if (!(remote = msi_get_remote(hdb))) return ERROR_INVALID_HANDLE; - IWineMsiRemoteDatabase_Release( remote_database ); WARN("not allowed during a custom action!\n"); return ERROR_SUCCESS; @@ -946,15 +940,13 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysW( MSIHANDLE hdb, db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); if( !db ) { + MSIHANDLE remote; HRESULT hr; - IWineMsiRemoteDatabase *remote_database; - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); - if ( !remote_database ) + if (!(remote = msi_get_remote(hdb))) return ERROR_INVALID_HANDLE; - hr = IWineMsiRemoteDatabase_GetPrimaryKeys( remote_database, table, phRec ); - IWineMsiRemoteDatabase_Release( remote_database ); + hr = remote_DatabaseGetPrimaryKeys(remote, table, phRec); if (FAILED(hr)) { @@ -1033,15 +1025,12 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentW( { HRESULT hr; MSICONDITION condition; - IWineMsiRemoteDatabase *remote_database; + MSIHANDLE remote; - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hDatabase ); - if ( !remote_database ) + if (!(remote = msi_get_remote(hDatabase))) return MSICONDITION_ERROR; - hr = IWineMsiRemoteDatabase_IsTablePersistent( remote_database, - szTableName, &condition ); - IWineMsiRemoteDatabase_Release( remote_database ); + hr = remote_DatabaseIsTablePersistent(remote, szTableName, &condition); if (FAILED(hr)) return MSICONDITION_ERROR; diff --git a/dll/win32/msi/msiserver.idl b/dll/win32/msi/msiserver.idl index 704f6ea9cfc..4eb33fe4d71 100644 --- a/dll/win32/msi/msiserver.idl +++ b/dll/win32/msi/msiserver.idl @@ -27,70 +27,6 @@ import "wtypes.idl"; import "objidl.idl"; import "oaidl.idl"; -cpp_quote("#if 0") -typedef unsigned long MSIHANDLE; -typedef int INSTALLMESSAGE; -typedef int MSICONDITION; -typedef int MSIRUNMODE; -typedef int INSTALLSTATE; -cpp_quote("#endif") - -[ - uuid(7BDE2046-D03B-4ffc-B84C-A098F38CFF0B), - oleautomation, - object -] -interface IWineMsiRemoteDatabase : IUnknown -{ - HRESULT IsTablePersistent( [in] LPCWSTR table, [out] MSICONDITION *persistent ); - HRESULT GetPrimaryKeys( [in] LPCWSTR table, [out] MSIHANDLE *keys ); - HRESULT GetSummaryInformation( [in] UINT updatecount, [out] MSIHANDLE *suminfo ); - HRESULT OpenView( [in] LPCWSTR query, [out] MSIHANDLE *view ); - HRESULT SetMsiHandle( [in] MSIHANDLE handle ); -} - -[ - uuid(902B3592-9D08-4dfd-A593-D07C52546421), - oleautomation, - object -] -interface IWineMsiRemotePackage : IUnknown -{ - HRESULT GetActiveDatabase( [out] MSIHANDLE *handle ); - HRESULT GetProperty( [in] BSTR property, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); - HRESULT SetProperty( [in] BSTR property, [in] BSTR value ); - HRESULT ProcessMessage( [in] INSTALLMESSAGE message, [in] MSIHANDLE record ); - HRESULT DoAction( [in] BSTR action ); - HRESULT Sequence( [in] BSTR table, [in] int sequence ); - HRESULT GetTargetPath( [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); - HRESULT SetTargetPath( [in] BSTR folder, [in] BSTR value ); - HRESULT GetSourcePath( [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); - HRESULT GetMode( [in] MSIRUNMODE mode, [out] BOOL *ret ); - HRESULT SetMode( [in] MSIRUNMODE mode, [in] BOOL state ); - HRESULT GetFeatureState( [in] BSTR feature, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action ); - HRESULT SetFeatureState( [in] BSTR feature, [in] INSTALLSTATE state ); - HRESULT GetComponentState( [in] BSTR component, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action ); - HRESULT SetComponentState( [in] BSTR component, [in] INSTALLSTATE state ); - HRESULT GetLanguage( [out] LANGID *language ); - HRESULT SetInstallLevel( [in] int level ); - HRESULT FormatRecord( [in] MSIHANDLE record, [out] BSTR *value ); - HRESULT EvaluateCondition( [in] BSTR condition ); - HRESULT GetFeatureCost( [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost ); - HRESULT EnumComponentCosts( [in] BSTR component, [in] DWORD index, [in] INSTALLSTATE state, - [out, size_is(*buflen)] BSTR drive, [in, out] DWORD *buflen, [out] INT *cost, [out] INT *temp ); -} - -[ - uuid(56D58B64-8780-4c22-A8BC-8B0B29E4A9F8), - oleautomation, - object -] -interface IWineMsiRemoteCustomAction : IUnknown -{ - HRESULT GetActionInfo( [in] LPCGUID guid, [out] INT *type, [out] BSTR *dllname, - [out] BSTR *function, [out] IWineMsiRemotePackage **package ); -} - [ uuid(000c101c-0000-0000-c000-000000000046), oleautomation, diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index d14dd8a33c9..78152dd7055 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -45,7 +45,7 @@ #include "sddl.h" #include "msipriv.h" -#include "msiserver.h" +#include "winemsi.h" #include "resource.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -1466,13 +1466,11 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage) db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); if( !db ) { - IWineMsiRemoteDatabase *remote_database; + MSIHANDLE remote; - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle ); - if ( !remote_database ) + if (!(remote = msi_get_remote(handle))) return ERROR_INVALID_HANDLE; - IWineMsiRemoteDatabase_Release( remote_database ); WARN("MsiOpenPackage not allowed during a custom action!\n"); return ERROR_FUNCTION_FAILED; @@ -1700,8 +1698,7 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall) { MSIPACKAGE *package; MSIHANDLE handle = 0; - IUnknown *remote_unk; - IWineMsiRemotePackage *remote_package; + MSIHANDLE remote; TRACE("(%d)\n",hInstall); @@ -1711,19 +1708,9 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall) handle = alloc_msihandle( &package->db->hdr ); msiobj_release( &package->hdr ); } - else if ((remote_unk = msi_get_remote(hInstall))) + else if ((remote = msi_get_remote(hInstall))) { - if (IUnknown_QueryInterface(remote_unk, &IID_IWineMsiRemotePackage, - (LPVOID *)&remote_package) == S_OK) - { - IWineMsiRemotePackage_GetActiveDatabase(remote_package, &handle); - IWineMsiRemotePackage_Release(remote_package); - } - else - { - WARN("remote handle %d is not a package\n", hInstall); - } - IUnknown_Release(remote_unk); + remote_GetActiveDatabase(remote, &handle); } return handle; @@ -2074,16 +2061,13 @@ INT WINAPI MsiProcessMessage( MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if( !package ) { + MSIHANDLE remote; HRESULT hr; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; - hr = IWineMsiRemotePackage_ProcessMessage( remote_package, eMessageType, hRecord ); - - IWineMsiRemotePackage_Release( remote_package ); + hr = remote_ProcessMessage(remote, eMessageType, hRecord); if (FAILED(hr)) { @@ -2223,12 +2207,11 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE); if( !package ) { + MSIHANDLE remote; HRESULT hr; BSTR name = NULL, value = NULL; - IWineMsiRemotePackage *remote_package; - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) + if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; name = SysAllocString( szName ); @@ -2237,15 +2220,13 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue { SysFreeString( name ); SysFreeString( value ); - IWineMsiRemotePackage_Release( remote_package ); return ERROR_OUTOFMEMORY; } - hr = IWineMsiRemotePackage_SetProperty( remote_package, name, value ); + hr = remote_SetProperty(remote, name, value); SysFreeString( name ); SysFreeString( value ); - IWineMsiRemotePackage_Release( remote_package ); if (FAILED(hr)) { @@ -2423,22 +2404,18 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name, if (!package) { HRESULT hr; - IWineMsiRemotePackage *remote_package; LPWSTR value = NULL; + MSIHANDLE remote; BSTR bname; - remote_package = (IWineMsiRemotePackage *)msi_get_remote( handle ); - if (!remote_package) + if (!(remote = msi_get_remote(handle))) return ERROR_INVALID_HANDLE; bname = SysAllocString( name ); if (!bname) - { - IWineMsiRemotePackage_Release( remote_package ); return ERROR_OUTOFMEMORY; - } - hr = IWineMsiRemotePackage_GetProperty( remote_package, bname, NULL, &len ); + hr = remote_GetProperty(remote, bname, NULL, &len); if (FAILED(hr)) goto done; @@ -2450,7 +2427,7 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name, goto done; } - hr = IWineMsiRemotePackage_GetProperty( remote_package, bname, value, &len ); + hr = remote_GetProperty(remote, bname, value, &len); if (FAILED(hr)) goto done; @@ -2461,7 +2438,6 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name, *pchValueBuf *= sizeof(WCHAR); done: - IWineMsiRemotePackage_Release(remote_package); SysFreeString(bname); msi_free(value); @@ -2522,280 +2498,149 @@ UINT WINAPI MsiGetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, return MSI_GetProperty( hInstall, szName, &val, pchValueBuf ); } -typedef struct _msi_remote_package_impl { - IWineMsiRemotePackage IWineMsiRemotePackage_iface; - MSIHANDLE package; - LONG refs; -} msi_remote_package_impl; - -static inline msi_remote_package_impl *impl_from_IWineMsiRemotePackage( IWineMsiRemotePackage *iface ) -{ - return CONTAINING_RECORD(iface, msi_remote_package_impl, IWineMsiRemotePackage_iface); -} - -static HRESULT WINAPI mrp_QueryInterface( IWineMsiRemotePackage *iface, - REFIID riid,LPVOID *ppobj) +HRESULT __cdecl remote_GetActiveDatabase(MSIHANDLE hinst, MSIHANDLE *handle) { - if( IsEqualCLSID( riid, &IID_IUnknown ) || - IsEqualCLSID( riid, &IID_IWineMsiRemotePackage ) ) - { - IWineMsiRemotePackage_AddRef( iface ); - *ppobj = iface; - return S_OK; - } - - return E_NOINTERFACE; -} - -static ULONG WINAPI mrp_AddRef( IWineMsiRemotePackage *iface ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); + *handle = MsiGetActiveDatabase(hinst); - return InterlockedIncrement( &This->refs ); -} - -static ULONG WINAPI mrp_Release( IWineMsiRemotePackage *iface ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - ULONG r; - - r = InterlockedDecrement( &This->refs ); - if (r == 0) - { - MsiCloseHandle( This->package ); - msi_free( This ); - } - return r; -} - -static HRESULT WINAPI mrp_GetActiveDatabase( IWineMsiRemotePackage *iface, MSIHANDLE *handle ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - IWineMsiRemoteDatabase *rdb = NULL; - HRESULT hr; - MSIHANDLE hdb; - - hr = create_msi_remote_database( NULL, (LPVOID *)&rdb ); - if (FAILED(hr) || !rdb) - { - ERR("Failed to create remote database\n"); - return hr; - } - - hdb = MsiGetActiveDatabase(This->package); - - hr = IWineMsiRemoteDatabase_SetMsiHandle( rdb, hdb ); - if (FAILED(hr)) - { - ERR("Failed to set the database handle\n"); - return hr; - } - - *handle = alloc_msi_remote_handle( (IUnknown *)rdb ); return S_OK; } -static HRESULT WINAPI mrp_GetProperty( IWineMsiRemotePackage *iface, BSTR property, BSTR value, DWORD *size ) +HRESULT __cdecl remote_GetProperty(MSIHANDLE hinst, BSTR property, BSTR value, DWORD *size) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetPropertyW(This->package, property, value, size); + UINT r = MsiGetPropertyW(hinst, property, value, size); if (r != ERROR_SUCCESS) return HRESULT_FROM_WIN32(r); return S_OK; } -static HRESULT WINAPI mrp_SetProperty( IWineMsiRemotePackage *iface, BSTR property, BSTR value ) +HRESULT __cdecl remote_SetProperty(MSIHANDLE hinst, BSTR property, BSTR value) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetPropertyW(This->package, property, value); + UINT r = MsiSetPropertyW(hinst, property, value); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_ProcessMessage( IWineMsiRemotePackage *iface, INSTALLMESSAGE message, MSIHANDLE record ) +HRESULT __cdecl remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, MSIHANDLE record) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiProcessMessage(This->package, message, record); + UINT r = MsiProcessMessage(hinst, message, record); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_DoAction( IWineMsiRemotePackage *iface, BSTR action ) +HRESULT __cdecl remote_DoAction(MSIHANDLE hinst, BSTR action) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiDoActionW(This->package, action); + UINT r = MsiDoActionW(hinst, action); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_Sequence( IWineMsiRemotePackage *iface, BSTR table, int sequence ) +HRESULT __cdecl remote_Sequence(MSIHANDLE hinst, BSTR table, int sequence) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSequenceW(This->package, table, sequence); + UINT r = MsiSequenceW(hinst, table, sequence); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_GetTargetPath( IWineMsiRemotePackage *iface, BSTR folder, BSTR value, DWORD *size ) +HRESULT __cdecl remote_GetTargetPath(MSIHANDLE hinst, BSTR folder, BSTR value, DWORD *size) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetTargetPathW(This->package, folder, value, size); + UINT r = MsiGetTargetPathW(hinst, folder, value, size); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_SetTargetPath( IWineMsiRemotePackage *iface, BSTR folder, BSTR value) +HRESULT __cdecl remote_SetTargetPath(MSIHANDLE hinst, BSTR folder, BSTR value) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetTargetPathW(This->package, folder, value); + UINT r = MsiSetTargetPathW(hinst, folder, value); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_GetSourcePath( IWineMsiRemotePackage *iface, BSTR folder, BSTR value, DWORD *size ) +HRESULT __cdecl remote_GetSourcePath(MSIHANDLE hinst, BSTR folder, BSTR value, DWORD *size) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetSourcePathW(This->package, folder, value, size); + UINT r = MsiGetSourcePathW(hinst, folder, value, size); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_GetMode( IWineMsiRemotePackage *iface, MSIRUNMODE mode, BOOL *ret ) +HRESULT __cdecl remote_GetMode(MSIHANDLE hinst, MSIRUNMODE mode, BOOL *ret) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - *ret = MsiGetMode(This->package, mode); + *ret = MsiGetMode(hinst, mode); return S_OK; } -static HRESULT WINAPI mrp_SetMode( IWineMsiRemotePackage *iface, MSIRUNMODE mode, BOOL state ) +HRESULT __cdecl remote_SetMode(MSIHANDLE hinst, MSIRUNMODE mode, BOOL state) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetMode(This->package, mode, state); + UINT r = MsiSetMode(hinst, mode, state); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_GetFeatureState( IWineMsiRemotePackage *iface, BSTR feature, - INSTALLSTATE *installed, INSTALLSTATE *action ) +HRESULT __cdecl remote_GetFeatureState(MSIHANDLE hinst, BSTR feature, + INSTALLSTATE *installed, INSTALLSTATE *action) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetFeatureStateW(This->package, feature, installed, action); + UINT r = MsiGetFeatureStateW(hinst, feature, installed, action); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_SetFeatureState( IWineMsiRemotePackage *iface, BSTR feature, INSTALLSTATE state ) +HRESULT __cdecl remote_SetFeatureState(MSIHANDLE hinst, BSTR feature, INSTALLSTATE state) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetFeatureStateW(This->package, feature, state); + UINT r = MsiSetFeatureStateW(hinst, feature, state); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_GetComponentState( IWineMsiRemotePackage *iface, BSTR component, - INSTALLSTATE *installed, INSTALLSTATE *action ) +HRESULT __cdecl remote_GetComponentState(MSIHANDLE hinst, BSTR component, + INSTALLSTATE *installed, INSTALLSTATE *action) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetComponentStateW(This->package, component, installed, action); + UINT r = MsiGetComponentStateW(hinst, component, installed, action); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_SetComponentState( IWineMsiRemotePackage *iface, BSTR component, INSTALLSTATE state ) +HRESULT __cdecl remote_SetComponentState(MSIHANDLE hinst, BSTR component, INSTALLSTATE state) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetComponentStateW(This->package, component, state); + UINT r = MsiSetComponentStateW(hinst, component, state); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_GetLanguage( IWineMsiRemotePackage *iface, LANGID *language ) +HRESULT __cdecl remote_GetLanguage(MSIHANDLE hinst, LANGID *language) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - *language = MsiGetLanguage(This->package); + *language = MsiGetLanguage(hinst); return S_OK; } -static HRESULT WINAPI mrp_SetInstallLevel( IWineMsiRemotePackage *iface, int level ) +HRESULT __cdecl remote_SetInstallLevel(MSIHANDLE hinst, int level) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetInstallLevel(This->package, level); + UINT r = MsiSetInstallLevel(hinst, level); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_FormatRecord( IWineMsiRemotePackage *iface, MSIHANDLE record, +HRESULT __cdecl remote_FormatRecord(MSIHANDLE hinst, MSIHANDLE record, BSTR *value) { DWORD size = 0; - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiFormatRecordW(This->package, record, NULL, &size); + UINT r = MsiFormatRecordW(hinst, record, NULL, &size); if (r == ERROR_SUCCESS) { *value = SysAllocStringLen(NULL, size); if (!*value) return E_OUTOFMEMORY; size++; - r = MsiFormatRecordW(This->package, record, *value, &size); + r = MsiFormatRecordW(hinst, record, *value, &size); } return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_EvaluateCondition( IWineMsiRemotePackage *iface, BSTR condition ) +HRESULT __cdecl remote_EvaluateCondition(MSIHANDLE hinst, BSTR condition) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiEvaluateConditionW(This->package, condition); + UINT r = MsiEvaluateConditionW(hinst, condition); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_GetFeatureCost( IWineMsiRemotePackage *iface, BSTR feature, - INT cost_tree, INSTALLSTATE state, INT *cost ) +HRESULT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, BSTR feature, + INT cost_tree, INSTALLSTATE state, INT *cost) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetFeatureCostW(This->package, feature, cost_tree, state, cost); + UINT r = MsiGetFeatureCostW(hinst, feature, cost_tree, state, cost); return HRESULT_FROM_WIN32(r); } -static HRESULT WINAPI mrp_EnumComponentCosts( IWineMsiRemotePackage *iface, BSTR component, +HRESULT __cdecl remote_EnumComponentCosts(MSIHANDLE hinst, BSTR component, DWORD index, INSTALLSTATE state, BSTR drive, - DWORD *buflen, INT *cost, INT *temp ) + DWORD *buflen, INT *cost, INT *temp) { - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiEnumComponentCostsW(This->package, component, index, state, drive, buflen, cost, temp); + UINT r = MsiEnumComponentCostsW(hinst, component, index, state, drive, buflen, cost, temp); return HRESULT_FROM_WIN32(r); } -static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl = -{ - mrp_QueryInterface, - mrp_AddRef, - mrp_Release, - mrp_GetActiveDatabase, - mrp_GetProperty, - mrp_SetProperty, - mrp_ProcessMessage, - mrp_DoAction, - mrp_Sequence, - mrp_GetTargetPath, - mrp_SetTargetPath, - mrp_GetSourcePath, - mrp_GetMode, - mrp_SetMode, - mrp_GetFeatureState, - mrp_SetFeatureState, - mrp_GetComponentState, - mrp_SetComponentState, - mrp_GetLanguage, - mrp_SetInstallLevel, - mrp_FormatRecord, - mrp_EvaluateCondition, - mrp_GetFeatureCost, - mrp_EnumComponentCosts -}; - -HRESULT create_msi_remote_package( MSIHANDLE handle, IWineMsiRemotePackage **ppObj ) -{ - msi_remote_package_impl* This; - - This = msi_alloc( sizeof *This ); - if (!This) - return E_OUTOFMEMORY; - - This->IWineMsiRemotePackage_iface.lpVtbl = &msi_remote_package_vtbl; - This->package = handle; - This->refs = 1; - - *ppObj = &This->IWineMsiRemotePackage_iface; - - return S_OK; -} - UINT msi_package_add_info(MSIPACKAGE *package, DWORD context, DWORD options, LPCWSTR property, LPWSTR value) { diff --git a/dll/win32/msi/suminfo.c b/dll/win32/msi/suminfo.c index 5312de9a857..eabd399c39b 100644 --- a/dll/win32/msi/suminfo.c +++ b/dll/win32/msi/suminfo.c @@ -34,10 +34,11 @@ #include "msi.h" #include "msiquery.h" #include "msidefs.h" -#include "msipriv.h" #include "objidl.h" #include "propvarutil.h" -#include "msiserver.h" + +#include "msipriv.h" +#include "winemsi.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -537,16 +538,13 @@ UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase, db = msihandle2msiinfo( hDatabase, MSIHANDLETYPE_DATABASE ); if( !db ) { + MSIHANDLE remote; HRESULT hr; - IWineMsiRemoteDatabase *remote_database; - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hDatabase ); - if ( !remote_database ) + if (!(remote = msi_get_remote(hDatabase))) return ERROR_INVALID_HANDLE; - hr = IWineMsiRemoteDatabase_GetSummaryInformation( remote_database, - uiUpdateCount, pHandle ); - IWineMsiRemoteDatabase_Release( remote_database ); + hr = remote_DatabaseGetSummaryInformation(remote, uiUpdateCount, pHandle); if (FAILED(hr)) { diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl new file mode 100644 index 00000000000..560b3067822 --- /dev/null +++ b/dll/win32/msi/winemsi.idl @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2007 James Hawkins + * Copyright (C) 2018 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma makedep header + +import "objidl.idl"; + +cpp_quote("#if 0") +typedef unsigned long MSIHANDLE; +typedef int INSTALLMESSAGE; +typedef int MSICONDITION; +typedef int MSIRUNMODE; +typedef int INSTALLSTATE; + +cpp_quote("#endif") +cpp_quote("#include \"msiquery.h\"") + +[ + uuid(56D58B64-8780-4c22-A8BC-8B0B29E4A9F8) +] +interface IWineMsiRemote +{ + HRESULT remote_DatabaseIsTablePersistent( [in] MSIHANDLE db, [in] LPCWSTR table, [out] MSICONDITION *persistent ); + HRESULT remote_DatabaseGetPrimaryKeys( [in] MSIHANDLE db, [in] LPCWSTR table, [out] MSIHANDLE *keys ); + HRESULT remote_DatabaseGetSummaryInformation( [in] MSIHANDLE db, [in] UINT updatecount, [out] MSIHANDLE *suminfo ); + HRESULT remote_DatabaseOpenView( [in] MSIHANDLE db, [in] LPCWSTR query, [out] MSIHANDLE *view ); + + HRESULT remote_GetActiveDatabase( [in] MSIHANDLE hinst, [out] MSIHANDLE *handle ); + HRESULT remote_GetProperty( [in] MSIHANDLE hinst, [in] BSTR property, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); + HRESULT remote_SetProperty( [in] MSIHANDLE hinst, [in] BSTR property, [in] BSTR value ); + HRESULT remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] MSIHANDLE record ); + HRESULT remote_DoAction( [in] MSIHANDLE hinst, [in] BSTR action ); + HRESULT remote_Sequence( [in] MSIHANDLE hinst, [in] BSTR table, [in] int sequence ); + HRESULT remote_GetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); + HRESULT remote_SetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [in] BSTR value ); + HRESULT remote_GetSourcePath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); + HRESULT remote_GetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [out] BOOL *ret ); + HRESULT remote_SetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [in] BOOL state ); + HRESULT remote_GetFeatureState( [in] MSIHANDLE hinst, [in] BSTR feature, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action ); + HRESULT remote_SetFeatureState( [in] MSIHANDLE hinst, [in] BSTR feature, [in] INSTALLSTATE state ); + HRESULT remote_GetComponentState( [in] MSIHANDLE hinst, [in] BSTR component, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action ); + HRESULT remote_SetComponentState( [in] MSIHANDLE hinst, [in] BSTR component, [in] INSTALLSTATE state ); + HRESULT remote_GetLanguage( [in] MSIHANDLE hinst, [out] LANGID *language ); + HRESULT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level ); + HRESULT remote_FormatRecord( [in] MSIHANDLE hinst, [in] MSIHANDLE record, [out] BSTR *value ); + HRESULT remote_EvaluateCondition( [in] MSIHANDLE hinst, [in] BSTR condition ); + HRESULT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost ); + HRESULT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in] BSTR component, [in] DWORD index, [in] INSTALLSTATE state, + [out, size_is(*buflen)] BSTR drive, [in, out] DWORD *buflen, [out] INT *cost, [out] INT *temp ); + + HRESULT remote_GetActionInfo( [in] LPCGUID guid, [out] INT *type, [out] BSTR *dllname, + [out] BSTR *function, [out] MSIHANDLE *package ); + UINT remote_CloseHandle( [in] MSIHANDLE handle ); +}
2 years, 9 months
1
0
0
0
[reactos] 02/360: [WINESYNC] msi: Allocate the remote handle on the server side.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f9131763ed848739a097c…
commit f9131763ed848739a097c34e6d85c510d197a0b3 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:11:44 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:34 2022 +0100 [WINESYNC] msi: Allocate the remote handle on the server side. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id b9b459810f646c48bdac981a066f0102acb9201c by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/custom.c | 17 ++++++++--------- dll/win32/msi/msipriv.h | 4 +++- dll/win32/msi/msiserver.idl | 3 +-- dll/win32/msi/package.c | 12 ++---------- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 8680b7214b3..f9abcd2f8a6 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -495,7 +495,7 @@ static void handle_msi_break( LPCWSTR target ) DebugBreak(); } -static UINT get_action_info( const GUID *guid, INT *type, MSIHANDLE *handle, +static UINT get_action_info( const GUID *guid, INT *type, BSTR *dll, BSTR *funcname, IWineMsiRemotePackage **package ) { @@ -518,7 +518,7 @@ static UINT get_action_info( const GUID *guid, INT *type, MSIHANDLE *handle, return ERROR_FUNCTION_FAILED; } - r = IWineMsiRemoteCustomAction_GetActionInfo( rca, guid, type, handle, dll, funcname, package ); + r = IWineMsiRemoteCustomAction_GetActionInfo( rca, guid, type, dll, funcname, package ); IWineMsiRemoteCustomAction_Release( rca ); if (FAILED(r)) { @@ -555,7 +555,7 @@ static inline UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE static DWORD ACTION_CallDllFunction( const GUID *guid ) { MsiCustomActionEntryPoint fn; - MSIHANDLE hPackage, handle; + MSIHANDLE hPackage; HANDLE hModule; LPSTR proc; UINT r = ERROR_FUNCTION_FAILED; @@ -565,7 +565,7 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) TRACE("%s\n", debugstr_guid( guid )); - r = get_action_info( guid, &type, &handle, &dll, &function, &remote_package ); + r = get_action_info( guid, &type, &dll, &function, &remote_package ); if (r != ERROR_SUCCESS) return r; @@ -584,7 +584,6 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) hPackage = alloc_msi_remote_handle( (IUnknown *)remote_package ); if (hPackage) { - IWineMsiRemotePackage_SetMsiHandle( remote_package, handle ); TRACE("calling %s\n", debugstr_w( function ) ); handle_msi_break( function ); @@ -613,7 +612,6 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) IWineMsiRemotePackage_Release( remote_package ); SysFreeString( dll ); SysFreeString( function ); - MsiCloseHandle( handle ); return r; } @@ -1433,21 +1431,22 @@ static ULONG WINAPI mcr_Release( IWineMsiRemoteCustomAction *iface ) } static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCGUID custom_action_guid, - INT *type, MSIHANDLE *handle, BSTR *dll, BSTR *func, IWineMsiRemotePackage **remote_package ) + INT *type, BSTR *dll, BSTR *func, IWineMsiRemotePackage **remote_package ) { msi_custom_action_info *info; + MSIHANDLE handle; info = find_action_by_guid( custom_action_guid ); if (!info) return E_FAIL; *type = info->type; - *handle = alloc_msihandle( &info->package->hdr ); + handle = alloc_msihandle( &info->package->hdr ); *dll = SysAllocString( info->source ); *func = SysAllocString( info->target ); release_custom_action_data( info ); - return create_msi_remote_package( NULL, (LPVOID *)remote_package ); + return create_msi_remote_package( handle, remote_package ); } static const IWineMsiRemoteCustomActionVtbl msi_custom_remote_vtbl = diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index c0a02780b81..f7e3cfe788a 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -38,6 +38,8 @@ #include "wine/list.h" #include "wine/debug.h" +#include "msiserver.h" + static const BOOL is_64bit = sizeof(void *) > sizeof(int); BOOL is_wow64 DECLSPEC_HIDDEN; @@ -733,7 +735,7 @@ UINT msi_strcpy_to_awstring(const WCHAR *, int, awstring *, DWORD *) DECLSPEC_HI /* msi server interface */ extern HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; -extern HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; +extern HRESULT create_msi_remote_package( MSIHANDLE handle, IWineMsiRemotePackage **package ) DECLSPEC_HIDDEN; extern HRESULT create_msi_remote_database( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; extern IUnknown *msi_get_remote(MSIHANDLE handle) DECLSPEC_HIDDEN; diff --git a/dll/win32/msi/msiserver.idl b/dll/win32/msi/msiserver.idl index e7346905074..704f6ea9cfc 100644 --- a/dll/win32/msi/msiserver.idl +++ b/dll/win32/msi/msiserver.idl @@ -56,7 +56,6 @@ interface IWineMsiRemoteDatabase : IUnknown ] interface IWineMsiRemotePackage : IUnknown { - HRESULT SetMsiHandle( [in] MSIHANDLE handle ); HRESULT GetActiveDatabase( [out] MSIHANDLE *handle ); HRESULT GetProperty( [in] BSTR property, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); HRESULT SetProperty( [in] BSTR property, [in] BSTR value ); @@ -88,7 +87,7 @@ interface IWineMsiRemotePackage : IUnknown ] interface IWineMsiRemoteCustomAction : IUnknown { - HRESULT GetActionInfo( [in] LPCGUID guid, [out] INT *type, [out] MSIHANDLE *handle, [out] BSTR *dllname, + HRESULT GetActionInfo( [in] LPCGUID guid, [out] INT *type, [out] BSTR *dllname, [out] BSTR *function, [out] IWineMsiRemotePackage **package ); } diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index f65e2eea4cf..d14dd8a33c9 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -2568,13 +2568,6 @@ static ULONG WINAPI mrp_Release( IWineMsiRemotePackage *iface ) return r; } -static HRESULT WINAPI mrp_SetMsiHandle( IWineMsiRemotePackage *iface, MSIHANDLE handle ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - This->package = handle; - return S_OK; -} - static HRESULT WINAPI mrp_GetActiveDatabase( IWineMsiRemotePackage *iface, MSIHANDLE *handle ) { msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); @@ -2763,7 +2756,6 @@ static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl = mrp_QueryInterface, mrp_AddRef, mrp_Release, - mrp_SetMsiHandle, mrp_GetActiveDatabase, mrp_GetProperty, mrp_SetProperty, @@ -2787,7 +2779,7 @@ static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl = mrp_EnumComponentCosts }; -HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj ) +HRESULT create_msi_remote_package( MSIHANDLE handle, IWineMsiRemotePackage **ppObj ) { msi_remote_package_impl* This; @@ -2796,7 +2788,7 @@ HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj ) return E_OUTOFMEMORY; This->IWineMsiRemotePackage_iface.lpVtbl = &msi_remote_package_vtbl; - This->package = 0; + This->package = handle; This->refs = 1; *ppObj = &This->IWineMsiRemotePackage_iface;
2 years, 9 months
1
0
0
0
← Newer
1
...
37
38
39
40
41
42
43
44
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Results per page:
10
25
50
100
200