https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f4be6dc36fbb9fee46064…
commit f4be6dc36fbb9fee4606493183f0a32a0a5e7135
Author: Mikhail <mishakeys20(a)gmail.com>
AuthorDate: Sun Sep 29 13:24:15 2024 -0400
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Sep 29 10:24:15 2024 -0700
[MSIEXEC][MSI] Sync msiexec and msi to wine-9.8 (#6897)
* [MSIEXEC] Sync msiexec to wine-9.8
* [WINESYNC] msi: Disable FS redirection for temporary file in cabinet_copy_file().
wine commit id a58c6251870dfb7d214464e709bbbc9ca649b900 by Paul Gofman
<pgofman(a)codeweavers.com>
* [WINESYNC] msi/tests: Correct a couple of failure messages in test_msirecord.
wine commit id 2fde0a3f5c233b0ea1637f409998ce4ee85d28a7 by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Use the wcsdup function instead of reimplementing it.
wine commit id 7cc7a6defc08d4de7574b7a75d574c3ab1f32db8 by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Use _O_* constants from fcntl.h instead of redefining them.
wine commit id b07c95e79cdf6ae26c5170daa481ad160e0ce76a by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Remove wrappers around CRT memory allocation functions.
wine commit id d920aa81ad0c4618c27ebd7e9863618e988328e0 by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Initialize all members of WINTRUST_DATA.
The pSignatureSettings field was not unitilized so it got a random value from
the stack causing a later crash when it was dereferenced in Wintrust
(SoftPubloadSignature).
wine commit id 904bedb3e96bc68101652e151db102532399abe8 by Philip K. Gisslow
<ripxorip(a)gmail.com>
* [WINESYNC] msi: Fix memory leak on realloc failure in create_diff_row_query
(cppcheck).
wine commit id 3e231d0f36a56ce991c7edbb6ae7845094e8417e by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Fix memory leak on realloc failure in msi_get_window_text
(cppcheck).
wine commit id 6c1dd0f2c5669e084eb1f84571c38761a97c0970 by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Fix memory leak on realloc failure in search_directory (cppcheck).
wine commit id d394df4a30feb685927908fce2887bf5496b5d66 by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] ntdll: Default to Windows 10.
wine commit id 69154f0329aec4fb64886a0689da198b5323dcde by Hans Leidekker
<hans(a)codeweavers.com>
* [MSI] Fix build
* [WINESYNC] Update winesync file
* [WINESYNC] msi/tests: Avoid test failures when running with insufficient rights.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=51040
wine commit id 79ec3d9fb8551e84e9ff71dcf18861430246278a by Hans Leidekker
<hans(a)codeweavers.com>
* [WINESYNC] msi: Install and patch global assemblies in InstallFinalize.
Installing global assemblies requires assembly caches to be initialized and
this is no longer the case after the PE conversion (builtin fusion no longer
loads if the dll is not present on disk).
The next patch changes msi to perform late initialization of the assembly
caches so that native fusion can be loaded once it's installed by .NET
installers. However, there's no guarantee that all necessary files and
registry keys are installed before the InstallFiles and PatchFiles actions
are executed. Therefore this patch moves the parts of these actions handling
global assemblies to InstallFinalize.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=51345
wine commit id 2c450fd6215c0da4685143f97ece8b6db0f54a0b by Hans Leidekker
<hans(a)codeweavers.com>
* [WINESYNC] msi: Perform late initialization of the assembly caches.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=51345
wine commit id d9d700f3328f00ec419571df0e02cef208fa1e7b by Hans Leidekker
<hans(a)codeweavers.com>
* [WINESYNC] msi: Remove msi_ prefix from static functions.
wine commit id 3611398b7575177b91e8162a84ebca977c50c2f5 by Hans Leidekker
<hans(a)codeweavers.com>
* [WINESYNC] msi: Get rid of unnecessary typedefs.
wine commit id 258012742512a4072265fcc47826c52319bd37ab by Hans Leidekker
<hans(a)codeweavers.com>
* [WINESYNC] msi: Handle memory allocation failure in get_link_file (cppcheck).
wine commit id 687c4f5c8dc65def6fc066d5d802d7448db70d7f by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Annotate memory allocation functions with __WINE_(DEALLOC|MALLOC).
wine commit id 9df04bfdb03a3017f532e70a047ee83290dbc257 by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi/tests: Fix the ok() formats so they match the size of their
arguments.
wine commit id b6fb1b8983af7644b78bb0ba5fb9d18a1f0822f1 by Francois Gouget
<fgouget(a)codeweavers.com>
* [WINESYNC] msi/tests: Ok_() takes printf-style arguments.
This lets the compiler check that the format and argument sizes match.
wine commit id a80b183af74194a06af3281ee272590a7134b7f1 by Francois Gouget
<fgouget(a)codeweavers.com>
* [WINESYNC] msi: Return ERROR_OUTOFMEMORY if calloc fails in TransformView_Create
(scan-build).
Instead of ERROR_SUCCESS.
wine commit id daa20d9d636057d7009ff3652a8577b423d23fcf by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Make TransformView_Create static.
wine commit id 1da5618cbac1214082bfb897dc81804d14fc6e9e by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Fix memory leak in ready_media (scan-build).
base_url was never freed, and can simply be enlarged instead of copying
it to a new buffer.
wine commit id c39f785b34692ee994b2449cc17a96815517e9bf by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Fix memory leak on error path in MSI_ProcessMessage (scan-build).
wine commit id d06b3fd5274b056c720e2fb42eb189052d99404d by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Release record instead of free.
../dlls/msi/dialog.c:4476:11: warning: attempt to call free on non-heap object
'hdr' [-Wfree-nonheap-object]
free( &rec->hdr );
^
wine commit id 7b3690dd7399cd64123554c8a6fc7e35dcbebbe1 by Daniel Lehman
<dlehman25(a)gmail.com>
* [WINESYNC] include: Remove redundant __WINE_USE_MSVCRT checks.
wine commit id 93630ce14ebf16333fda8481b5ede6f587eb32ca by Alexandre Julliard
<julliard(a)winehq.org>
* [WINESYNC] msi: Fix memory leak on error path in MSI_OpenPackageW (scan-build).
wine commit id 4db2ffa60e16e06b4f6ef89fcc4c73229f4446b1 by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Fix double free on error paths in TransformView_Create
(scan-build).
If TransformView_Create returns an error, it should not return a pointer
that table_load_transform will try to free.
wine commit id 0653409e0631582d89edaab0ac516994710dae1a by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Fix memory leaks in HANDLE_CustomType23 (scan-build).
wine commit id 993f4d48d23477e70e92256890c77687a1c4ba08 by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Reject shorter/longer lines in MsiDatabaseImportA.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54532
Signed-off-by: David Kahurani <k.kahurani(a)gmail.com>
wine commit id e1ddc58a259d80f16bf1e62f23428775e1b070a0 by David Kahurani
<k.kahurani(a)gmail.com>
* [WINESYNC] msi: Convert newlines to alternate representation when exporting.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54532
Signed-off-by: David Kahurani <k.kahurani(a)gmail.com>
wine commit id 60e4f8a261ae9044aafa9c4eec2a3f2aec6481b5 by David Kahurani
<k.kahurani(a)gmail.com>
* [WINESYNC] msi: Remove DECLSPEC_HIDDEN usage.
wine commit id 51049c95a242f1553562a442142e813e37cee233 by Alistair Leslie-Hughes
<leslie_alistair(a)hotmail.com>
* [MSI] remove DECLSPEC_HIDDEN
* [WINESYNC] msi: Fully initialize the control structure in dialog_line_control().
Fixes: 76606eaea034c51a73190aac92e75d8b20e82164
Fixes: 174b7b51ac9e57c6cfa8f48e62bbf468ae3b1f24
wine commit id 735584076efafc29673e0c9418a64343634f9aa5 by Jinoh Kang
<jinoh.kang.kr(a)gmail.com>
* [WINESYNC] msi: Make insertion order of line controls consistent with other
controls.
Fixes: 2c5bd49297f79d9941a256d8ec61e0eb2bf9bf9c
wine commit id 3eceda2f2a77754f0bf93ea33018e8ef49e82669 by Jinoh Kang
<jinoh.kang.kr(a)gmail.com>
* [WINESYNC] msi: Don't open code dialog_add_control() in dialog_line_control().
Commit b1cc87cb656 ("msi: The line control has a height of exactly 2
device units.", 2007-12-16) open-coded the body of
(msi_)dialog_add_control() inside dialog_line_control() modulo the
height override.
Except the fixed height, line controls have nothing special compared to
other controls. Thus, there is little merit in open-coding it.
Also, dialog_line_control() has bit-rotted over time; it already missed
a few changes that were done to any other controls.
Fix this by just using dialog_add_control(). Also, add a special case
logic just for line controls.
wine commit id 1fca47b724b3835ac0267f58c5b3486fc222fc71 by Jinoh Kang
<jinoh.kang.kr(a)gmail.com>
* [WINESYNC] msi: Use nameless unions/structs.
wine commit id 8de0a9dc740d3ed1e3cf9460852db7e609122f3b by Alexandre Julliard
<julliard(a)winehq.org>
* [MSI] disable nameless structs
* [WINESYNC] msi/tests: Use nameless unions/structs.
wine commit id 490aee03e45222aa9d7e3e7fd6ff80064dc3778d by Alexandre Julliard
<julliard(a)winehq.org>
* [WINESYNC] makedep: Use #pragma makedep testdll for TESTDLL resources.
wine commit id 81da9ff0f8dea4932a3afdc4c447c1c9242bb596 by Rémi Bernon
<rbernon(a)codeweavers.com>
* [WINESYNC] msi: Use CreateFileW() for handling path from cabinet_open() instead.
wine commit id 085e95cd5eceb36c3e21cb7d42adab5a6af38a38 by Jactry Zeng
<jzeng(a)codeweavers.com>
* [WINESYNC] msiexec: Use CRT allocation functions.
wine commit id 0f44b3bdcb3d91701a9a8ef1ad07f3e88c08a666 by Alex Henrie
<alexhenrie24(a)gmail.com>
* [WINESYNC] msi: Remove DECLSPEC_HIDDEN usage.
wine commit id 91e81083458374706bbace11114f4ad5e473ac07 by Alistair Leslie-Hughes
<leslie_alistair(a)hotmail.com>
* [WINESYNC] msi: Store Context as MSIINSTALLCONTEXT in MSIPACKAGE.
Avoids casting to enum pointer in msi_locate_product call.
wine commit id 2daa8c9f95b35983c885f5f7efe9e1b48e91f679 by Jacek Caban
<jacek(a)codeweavers.com>
* [WINESYNC] msi/tests: Initialize pathkey in test_installprops.
It could be used uninitialized on early no access return.
wine commit id 93668319dd63add97036fbb79b5745c699117313 by Jacek Caban
<jacek(a)codeweavers.com>
* [WINESYNC] regsvr32: Use message boxes by default for output.
regsvr32 is in GUI subsystem and shouldn't interact with console.
Keeping unix I/O output in silent mode.
Removing -c option as not existing in native.
Signed-off-by: Eric Pouech <epouech(a)codeweavers.com>
wine commit id ac8da35b87005e45947b8164a4132f3bbb4ec2cc by Eric Pouech
<epouech(a)codeweavers.com>
* [MSI]: Reduce diff
* [WINESYNC] msiexec: No longer use console/file output APIs.
Regular GUI apps don't.
Signed-off-by: Eric Pouech <epouech(a)codeweavers.com>
wine commit id e048f71ecbb103ae7c1876092cb8244b24a73cb7 by Eric Pouech
<epouech(a)codeweavers.com>
* [WINESYNC] msi: Fix a memory leak (Coverity).
wine commit id 4afca1787febb012d0cdd2c007dd32beba35178d by Zhiyi Zhang
<zzhang(a)codeweavers.com>
* [WINESYNC] msi: Don't write past end of string when selecting parent
directory.
wine commit id bbce5d014db7f023b133d6d09e6846e027586f7d by Fabian Maurer
<dark.shadow4(a)web.de>
* [WINESYNC] msi: Avoid leaking stream on DB update.
MSI_RecordGetIStream adds a reference to the stream. This
reference should be negated as we are done setting the stream.
Signed-off-by: David Kahurani <k.kahurani(a)gmail.com>
wine commit id 386dbe1059ba08485696760c267ef06dbed95bad by David Kahurani
<k.kahurani(a)gmail.com>
* [WINESYNC] msi/tests: Expand costing tests.
wine commit id 674efeb1f7445935cf4f49dd1285727055664ab9 by Zebediah Figura
<zfigura(a)codeweavers.com>
* [WINESYNC] msi: Round costs up to 4096 bytes instead of clamping.
wine commit id 9725a2286acdb791de316295d9bcb11411a3fd56 by Zebediah Figura
<zfigura(a)codeweavers.com>
* [WINESYNC] msi: Store component cost in 512-byte units.
This avoids overflow when component costs exceed 4 GB.
wine commit id d7bbe884ef29215f4db2027f450fb959314f5383 by Zebediah Figura
<zfigura(a)codeweavers.com>
* [MSI] store component cost in 512-byte units
* [WINESYNC] msi: Multiply by 512 in dialog_vcl_add_drives().
The main motivation here is to avoid overflow, and multiplying in one place seems
simpler.
wine commit id 4a227c62a59a55aff9bacf1473c7f478f5c83294 by Zebediah Figura
<zfigura(a)codeweavers.com>
* [MSI] reduce diff
* [WINESYNC] msi: Create the custom action server as an elevated process.
Dragon Naturally Speaking 12.5 manually validates that the custom action server
is elevated.
One might imagine that the right approach here is to add a manifest to msiexec;
however, msiexec does not always trigger a UAC prompt on Windows.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=51143
wine commit id 366398cc53c76028c8dfe8d8a16c78a6a10ce962 by Zebediah Figura
<z.figura12(a)gmail.com>
* [WINESYNC] msi/tests: Delete the temp .msi file in all failure cases.
wine commit id 43fb0ecd0717ad1a6aa0702ed68368ee35d3ecda by Alexandre Julliard
<julliard(a)winehq.org>
* [WINESYNC] msi/tests: Use the helpers from utils.h in more modules.
wine commit id b3f11ceb7a0ddcf5fe742377f99c947b0b56a051 by Hans Leidekker
<hans(a)codeweavers.com>
* [MSITEST] include util header
* [WINESYNC] msi/tests: Try restarting tests elevated.
Wine starts processes non-elevated since e92ba2de43d7afbe0704b11b29f7c30f44dfaeca
which means that many tests are skipped now.
wine commit id a6eb51f0e595b2e5ddc521fb61b10d72849dd0f2 by Hans Leidekker
<hans(a)codeweavers.com>
* [MSITEST] try restarting for tests elevated
* [WINESYNC] msi/tests: Get rid of workarounds for old Windows versions.
wine commit id 738ec8285583248a84349939734ed600a47ba73d by Hans Leidekker
<hans(a)codeweavers.com>
* [MSI] fix patch failed
* [WINESYNC] msi: Install global assemblies before running deferred custom actions.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=56493
wine commit id 7f0ca9c284d15d03f14a8fefefac834990d622cd by Hans Leidekker
<hans(a)codeweavers.com>
* [WINESYNC] msi: Install global assemblies after install custom actions and before
commit custom actions.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=56609
wine commit id 27f5470ff4c20121b9eacd702c888400191c7d9e by Hans Leidekker
<hans(a)codeweavers.com>
* [WINESYNC]: msi is now in sync with wine-staging wine-9.8
* [MSI] Fix build
* [WINESYNC] Update WINESYNC doc
* [MSI] Remove nonameless* defines
* [MSIEXEC] Fix build
* [MSIEXEC] Fix build
* [MSI] Fix vcl_get_cost
---
base/system/msiexec/msiexec.c | 100 +-
.../system/msiexec/msiexec_internal.h | 27 +-
base/system/msiexec/service.c | 16 +-
dll/win32/msi/action.c | 690 ++--
dll/win32/msi/alter.c | 28 +-
dll/win32/msi/appsearch.c | 135 +-
dll/win32/msi/assembly.c | 147 +-
dll/win32/msi/automation.c | 236 +-
dll/win32/msi/classes.c | 90 +-
dll/win32/msi/cond.y | 18 +-
dll/win32/msi/create.c | 26 +-
dll/win32/msi/custom.c | 277 +-
dll/win32/msi/database.c | 362 +-
dll/win32/msi/delete.c | 26 +-
dll/win32/msi/dialog.c | 1252 +++---
dll/win32/msi/distinct.c | 52 +-
dll/win32/msi/drop.c | 20 +-
dll/win32/msi/files.c | 243 +-
dll/win32/msi/font.c | 69 +-
dll/win32/msi/format.c | 188 +-
dll/win32/msi/handle.c | 150 +-
dll/win32/msi/insert.c | 34 +-
dll/win32/msi/install.c | 57 +-
dll/win32/msi/media.c | 178 +-
dll/win32/msi/msi.c | 366 +-
dll/win32/msi/msi_main.c | 19 +-
dll/win32/msi/msipriv.h | 623 +--
dll/win32/msi/msiquery.c | 44 +-
dll/win32/msi/package.c | 392 +-
dll/win32/msi/patch.c | 152 +-
dll/win32/msi/precomp.h | 2 -
dll/win32/msi/query.h | 45 +-
dll/win32/msi/record.c | 24 +-
dll/win32/msi/registry.c | 147 +-
dll/win32/msi/script.c | 41 +-
dll/win32/msi/select.c | 42 +-
dll/win32/msi/source.c | 131 +-
dll/win32/msi/sql.y | 2 +-
dll/win32/msi/storages.c | 54 +-
dll/win32/msi/streams.c | 50 +-
dll/win32/msi/string.c | 46 +-
dll/win32/msi/suminfo.c | 95 +-
dll/win32/msi/table.c | 463 ++-
dll/win32/msi/tokenize.c | 12 +-
dll/win32/msi/update.c | 24 +-
dll/win32/msi/upgrade.c | 8 +-
dll/win32/msi/where.c | 113 +-
media/doc/WINESYNC.txt | 4 +-
modules/rostests/winetests/msi/action.c | 387 +-
modules/rostests/winetests/msi/automation.c | 135 +-
modules/rostests/winetests/msi/custom.c | 314 +-
modules/rostests/winetests/msi/db.c | 103 +-
modules/rostests/winetests/msi/install.c | 226 +-
modules/rostests/winetests/msi/msi.c | 4168 +++++++-------------
modules/rostests/winetests/msi/package.c | 400 +-
modules/rostests/winetests/msi/patch.c | 189 +-
modules/rostests/winetests/msi/record.c | 6 +-
modules/rostests/winetests/msi/selfreg.c | 4 +
modules/rostests/winetests/msi/source.c | 1493 +++----
modules/rostests/winetests/msi/suminfo.c | 32 +-
modules/rostests/winetests/msi/utils.h | 3 +-
sdk/include/psdk/msi.h | 6 +-
sdk/tools/winesync/msi.cfg | 2 +-
...-msi__Do_not_sign_extend_after_multiplying.diff | 26 -
...ustom_action_server_as_an_elevated_process.diff | 61 -
65 files changed, 6310 insertions(+), 8565 deletions(-)
diff --git a/base/system/msiexec/msiexec.c b/base/system/msiexec/msiexec.c
index 4fca2655131..24c24792450 100644
--- a/base/system/msiexec/msiexec.c
+++ b/base/system/msiexec/msiexec.c
@@ -26,10 +26,9 @@
#include <msi.h>
#include <winsvc.h>
#include <objbase.h>
-#include <stdio.h>
#include "wine/debug.h"
-#include "wine/heap.h"
+#include "msiexec_internal.h"
#include "initguid.h"
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
@@ -40,6 +39,7 @@ typedef HRESULT (WINAPI *DLLREGISTERSERVER)(void);
typedef HRESULT (WINAPI *DLLUNREGISTERSERVER)(void);
DWORD DoService(void);
+static BOOL silent;
struct string_list
{
@@ -47,6 +47,21 @@ struct string_list
WCHAR str[1];
};
+void report_error(const char* msg, ...)
+{
+ char buffer[2048];
+ va_list va_args;
+
+ va_start(va_args, msg);
+ vsnprintf(buffer, sizeof(buffer), msg, va_args);
+ va_end(va_args);
+
+ if (silent)
+ MESSAGE("%s", buffer);
+ else
+ MsiMessageBoxA(NULL, buffer, "MsiExec", 0, GetUserDefaultLangID(),
0);
+}
+
static void ShowUsage(int ExitCode)
{
WCHAR msiexec_version[40];
@@ -73,8 +88,8 @@ static void ShowUsage(int ExitCode)
No typo: The LPWSTR parameter must be a LPWSTR * for this mode */
len = LoadStringW(hmsi, 10, (LPWSTR) &msi_res, 0);
- msi_res = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
- msiexec_help = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) +
sizeof(msiexec_version));
+ msi_res = malloc((len + 1) * sizeof(WCHAR));
+ msiexec_help = malloc((len + 1) * sizeof(WCHAR) + sizeof(msiexec_version));
if (msi_res && msiexec_help) {
*msi_res = 0;
LoadStringW(hmsi, 10, msi_res, len + 1);
@@ -82,8 +97,8 @@ static void ShowUsage(int ExitCode)
swprintf(msiexec_help, len + 1 + ARRAY_SIZE(msiexec_version), msi_res,
msiexec_version);
MsiMessageBoxW(0, msiexec_help, NULL, 0, GetUserDefaultLangID(), 0);
}
- HeapFree(GetProcessHeap(), 0, msi_res);
- HeapFree(GetProcessHeap(), 0, msiexec_help);
+ free(msi_res);
+ free(msiexec_help);
ExitProcess(ExitCode);
}
@@ -101,7 +116,7 @@ static VOID StringListAppend(struct string_list **list, LPCWSTR str)
{
struct string_list *entry;
- entry = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(struct string_list,
str[lstrlenW(str) + 1]));
+ entry = malloc(FIELD_OFFSET(struct string_list, str[wcslen(str) + 1]));
if(!entry)
{
WINE_ERR("Out of memory!\n");
@@ -134,7 +149,7 @@ static LPWSTR build_properties(struct string_list *property_list)
for(list = property_list; list; list = list->next)
len += lstrlenW(list->str) + 3;
- ret = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
+ ret = malloc(len * sizeof(WCHAR));
/* add a space before each string, and quote the value */
p = ret;
@@ -178,7 +193,7 @@ static LPWSTR build_transforms(struct string_list *transform_list)
for(list = transform_list; list; list = list->next)
len += lstrlenW(list->str) + 1;
- ret = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
+ ret = malloc(len * sizeof(WCHAR));
/* add all the transforms with a semicolon between each one */
p = ret;
@@ -218,10 +233,10 @@ static BOOL msi_strequal(LPCWSTR str1, LPCSTR str2)
return FALSE;
if( lstrlenW(str1) != (len-1) )
return FALSE;
- strW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len);
+ strW = malloc(sizeof(WCHAR) * len);
MultiByteToWideChar( CP_ACP, 0, str2, -1, strW, len);
ret = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, str1, len, strW, len);
- HeapFree(GetProcessHeap(), 0, strW);
+ free(strW);
return (ret == CSTR_EQUAL);
}
@@ -246,10 +261,10 @@ static BOOL msi_strprefix(LPCWSTR str1, LPCSTR str2)
return FALSE;
if( lstrlenW(str1) < (len-1) )
return FALSE;
- strW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len);
+ strW = malloc(sizeof(WCHAR) * len);
MultiByteToWideChar( CP_ACP, 0, str2, -1, strW, len);
ret = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, str1, len-1, strW, len-1);
- HeapFree(GetProcessHeap(), 0, strW);
+ free(strW);
return (ret == CSTR_EQUAL);
}
@@ -270,14 +285,14 @@ static VOID *LoadProc(LPCWSTR DllName, LPCSTR ProcName, HMODULE*
DllHandle)
*DllHandle = LoadLibraryExW(DllName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if(!*DllHandle)
{
- fprintf(stderr, "Unable to load dll %s\n", wine_dbgstr_w(DllName));
+ report_error("Unable to load dll %s\n", wine_dbgstr_w(DllName));
ExitProcess(1);
}
proc = (VOID *) GetProcAddress(*DllHandle, ProcName);
if(!proc)
{
- fprintf(stderr, "Dll %s does not implement function %s\n",
- wine_dbgstr_w(DllName), ProcName);
+ report_error("Dll %s does not implement function %s\n",
+ wine_dbgstr_w(DllName), ProcName);
FreeLibrary(*DllHandle);
ExitProcess(1);
}
@@ -296,10 +311,10 @@ static DWORD DoDllRegisterServer(LPCWSTR DllName)
hr = pfDllRegisterServer();
if(FAILED(hr))
{
- fprintf(stderr, "Failed to register dll %s\n", wine_dbgstr_w(DllName));
+ report_error("Failed to register dll %s\n", wine_dbgstr_w(DllName));
return 1;
}
- printf("Successfully registered dll %s\n", wine_dbgstr_w(DllName));
+ MESSAGE("Successfully registered dll %s\n", wine_dbgstr_w(DllName));
if(DllHandle)
FreeLibrary(DllHandle);
return 0;
@@ -316,10 +331,10 @@ static DWORD DoDllUnregisterServer(LPCWSTR DllName)
hr = pfDllUnregisterServer();
if(FAILED(hr))
{
- fprintf(stderr, "Failed to unregister dll %s\n", wine_dbgstr_w(DllName));
+ report_error("Failed to unregister dll %s\n", wine_dbgstr_w(DllName));
return 1;
}
- printf("Successfully unregistered dll %s\n", wine_dbgstr_w(DllName));
+ MESSAGE("Successfully unregistered dll %s\n", wine_dbgstr_w(DllName));
if(DllHandle)
FreeLibrary(DllHandle);
return 0;
@@ -333,7 +348,7 @@ static DWORD DoRegServer(void)
if (!(scm = OpenSCManagerW(NULL, SERVICES_ACTIVE_DATABASEW,
SC_MANAGER_CREATE_SERVICE)))
{
- fprintf(stderr, "Failed to open the service control manager.\n");
+ report_error("Failed to open the service control manager.\n");
return 1;
}
len = GetSystemDirectoryW(path, MAX_PATH);
@@ -346,7 +361,7 @@ static DWORD DoRegServer(void)
}
else if (GetLastError() != ERROR_SERVICE_EXISTS)
{
- fprintf(stderr, "Failed to create MSI service\n");
+ report_error("Failed to create MSI service\n");
ret = 1;
}
CloseServiceHandle(scm);
@@ -360,21 +375,21 @@ static DWORD DoUnregServer(void)
if (!(scm = OpenSCManagerW(NULL, SERVICES_ACTIVE_DATABASEW, SC_MANAGER_CONNECT)))
{
- fprintf(stderr, "Failed to open service control manager\n");
+ report_error("Failed to open service control manager\n");
return 1;
}
if ((service = OpenServiceW(scm, L"MSIServer", DELETE)))
{
if (!DeleteService(service))
{
- fprintf(stderr, "Failed to delete MSI service\n");
+ report_error("Failed to delete MSI service\n");
ret = 1;
}
CloseServiceHandle(service);
}
else if (GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST)
{
- fprintf(stderr, "Failed to open MSI service\n");
+ report_error("Failed to open MSI service\n");
ret = 1;
}
CloseServiceHandle(scm);
@@ -388,7 +403,7 @@ static DWORD client_pid;
static DWORD CALLBACK custom_action_thread(void *arg)
{
GUID guid = *(GUID *)arg;
- heap_free(arg);
+ free(arg);
return __wine_msi_call_dll_function(client_pid, &guid);
}
@@ -429,7 +444,7 @@ static int custom_action_server(const WCHAR *arg)
return 0;
}
- thread_guid = heap_alloc(sizeof(GUID));
+ thread_guid = malloc(sizeof(GUID));
memcpy(thread_guid, &guid, sizeof(GUID));
thread = CreateThread(NULL, 0, custom_action_thread, thread_guid, 0, NULL);
@@ -533,13 +548,13 @@ static void process_args( WCHAR *cmdline, int *pargc, WCHAR ***pargv
)
*pargv = NULL;
count = chomp( cmdline, NULL );
- if (!(p = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(cmdline) + count + 1) *
sizeof(WCHAR) )))
+ if (!(p = malloc( (wcslen(cmdline) + count + 1) * sizeof(WCHAR) )))
return;
count = chomp( cmdline, p );
- if (!(argv = HeapAlloc( GetProcessHeap(), 0, (count + 1) * sizeof(WCHAR *) )))
+ if (!(argv = malloc( (count + 1) * sizeof(WCHAR *) )))
{
- HeapFree( GetProcessHeap(), 0, p );
+ free( p );
return;
}
for (i = 0; i < count; i++)
@@ -569,7 +584,7 @@ static BOOL process_args_from_reg( const WCHAR *ident, int *pargc,
WCHAR ***parg
if(r == ERROR_SUCCESS && type == REG_SZ)
{
int len = lstrlenW( *pargv[0] );
- if (!(buf = HeapAlloc( GetProcessHeap(), 0, sz + (len + 1) * sizeof(WCHAR) )))
+ if (!(buf = malloc( (len + 1) * sizeof(WCHAR) )))
{
RegCloseKey( hkey );
return FALSE;
@@ -582,7 +597,7 @@ static BOOL process_args_from_reg( const WCHAR *ident, int *pargc,
WCHAR ***parg
process_args(buf, pargc, pargv);
ret = TRUE;
}
- HeapFree(GetProcessHeap(), 0, buf);
+ free(buf);
}
RegCloseKey(hkey);
return ret;
@@ -594,7 +609,7 @@ static WCHAR *get_path_with_extension(const WCHAR *package_name)
unsigned int p;
WCHAR *path;
- if (!(path = heap_alloc(lstrlenW(package_name) * sizeof(WCHAR) + sizeof(ext))))
+ if (!(path = malloc(wcslen(package_name) * sizeof(WCHAR) + sizeof(ext))))
{
WINE_ERR("No memory.\n");
return NULL;
@@ -606,7 +621,7 @@ static WCHAR *get_path_with_extension(const WCHAR *package_name)
--p;
if (path[p] == '.')
{
- heap_free(path);
+ free(path);
return NULL;
}
lstrcatW(path, ext);
@@ -766,7 +781,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine
RepairMode |= REINSTALLMODE_PACKAGE;
break;
default:
- fprintf(stderr, "Unknown option \"%c\" in Repair mode\n",
argvW[i][j]);
+ report_error("Unknown option \"%c\" in Repair mode\n",
argvW[i][j]);
break;
}
}
@@ -816,7 +831,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine
AdvertiseMode = ADVERTISEFLAGS_MACHINEASSIGN;
break;
default:
- fprintf(stderr, "Unknown option \"%c\" in Advertise mode\n",
argvW[i][j]);
+ report_error("Unknown option \"%c\" in Advertise mode\n",
argvW[i][j]);
break;
}
}
@@ -948,8 +963,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine
LogFileName = argvW[i];
if(MsiEnableLogW(LogMode, LogFileName, LogAttributes) != ERROR_SUCCESS)
{
- fprintf(stderr, "Logging in %s (0x%08x, %u) failed\n",
- wine_dbgstr_w(LogFileName), LogMode, LogAttributes);
+ report_error("Logging in %s (0x%08lx, %lu) failed\n",
+ wine_dbgstr_w(LogFileName), LogMode, LogAttributes);
ExitProcess(1);
}
}
@@ -967,6 +982,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine
if(lstrlenW(argvW[i]) == 2 || msi_strequal(argvW[i]+2, "n") ||
msi_strequal(argvW[i] + 2, "uiet"))
{
+ silent = TRUE;
InstallUILevel = INSTALLUILEVEL_NONE;
}
else if(msi_strequal(argvW[i]+2, "r"))
@@ -1003,8 +1019,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine
}
else
{
- fprintf(stderr, "Unknown option \"%s\" for UI level\n",
- wine_dbgstr_w(argvW[i]+2));
+ report_error("Unknown option \"%s\" for UI level\n",
+ wine_dbgstr_w(argvW[i]+2));
}
}
else if(msi_option_equal(argvW[i], "passive"))
@@ -1071,7 +1087,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine
&& (path = get_path_with_extension(PackageName)))
{
ReturnCode = MsiInstallProductW(path, Properties);
- heap_free(path);
+ free(path);
}
}
}
@@ -1085,7 +1101,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine
&& (path = get_path_with_extension(PackageName)))
{
ReturnCode = MsiReinstallProductW(path, RepairMode);
- heap_free(path);
+ free(path);
}
}
}
diff --git a/modules/rostests/winetests/msi/selfreg.c
b/base/system/msiexec/msiexec_internal.h
similarity index 63%
copy from modules/rostests/winetests/msi/selfreg.c
copy to base/system/msiexec/msiexec_internal.h
index 668e742e9ba..ac58c6baf94 100644
--- a/modules/rostests/winetests/msi/selfreg.c
+++ b/base/system/msiexec/msiexec_internal.h
@@ -1,7 +1,7 @@
/*
- * DLL for testing self-registration
+ * msiexec.exe internal definitions
*
- * Copyright 2018 Zebediah Figura
+ * Copyright 2023 Eric Pouech for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,21 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include <stdarg.h>
-#include <windef.h>
-#include <winbase.h>
-#include <winreg.h>
-
-HRESULT WINAPI DllRegisterServer(void)
-{
- HKEY key;
- RegCreateKeyA(HKEY_CLASSES_ROOT, "selfreg_test", &key);
- RegCloseKey(key);
- return S_OK;
-}
-
-HRESULT WINAPI DllUnregisterServer(void)
-{
- RegDeleteKeyA(HKEY_CLASSES_ROOT, "selfreg_test");
- return S_OK;
-}
+#ifdef __WINE_CRT_PRINTF_ATTR
+extern void report_error(const char* msg, ...) __WINE_CRT_PRINTF_ATTR(1, 2);
+#else
+extern void report_error(const char* msg, ...);
+#endif
diff --git a/base/system/msiexec/service.c b/base/system/msiexec/service.c
index d48912a8e5f..ee81da1bfcd 100644
--- a/base/system/msiexec/service.c
+++ b/base/system/msiexec/service.c
@@ -20,11 +20,11 @@
#define WIN32_LEAN_AND_MEAN
-#include <stdio.h>
#include <windows.h>
#include <winsvc.h>
#include "wine/debug.h"
+#include "msiexec_internal.h"
WINE_DEFAULT_DEBUG_CHANNEL(msiexec);
@@ -73,7 +73,7 @@ static BOOL UpdateSCMStatus(DWORD dwCurrentState, DWORD
dwWin32ExitCode,
if (!SetServiceStatus(hstatus, &status))
{
- fprintf(stderr, "Failed to set service status\n");
+ report_error("Failed to set service status\n");
KillService();
return FALSE;
}
@@ -83,7 +83,7 @@ static BOOL UpdateSCMStatus(DWORD dwCurrentState, DWORD
dwWin32ExitCode,
static void WINAPI ServiceCtrlHandler(DWORD code)
{
- WINE_TRACE("%u\n", code);
+ WINE_TRACE("%ld\n", code);
switch (code)
{
@@ -93,7 +93,7 @@ static void WINAPI ServiceCtrlHandler(DWORD code)
KillService();
break;
default:
- fprintf(stderr, "Unhandled service control code: %u\n", code);
+ report_error("Unhandled service control code: %ld\n", code);
UpdateSCMStatus(SERVICE_RUNNING, NO_ERROR, 0);
break;
}
@@ -113,7 +113,7 @@ static BOOL StartServiceThread(void)
thread = CreateThread(0, 0, ServiceExecutionThread, 0, 0, &id);
if (!thread)
{
- fprintf(stderr, "Failed to create thread\n");
+ report_error("Failed to create thread\n");
return FALSE;
}
@@ -125,7 +125,7 @@ static void WINAPI ServiceMain(DWORD argc, LPSTR *argv)
hstatus = RegisterServiceCtrlHandlerA("MSIServer", ServiceCtrlHandler);
if (!hstatus)
{
- fprintf(stderr, "Failed to register service ctrl handler\n");
+ report_error("Failed to register service ctrl handler\n");
return;
}
@@ -134,7 +134,7 @@ static void WINAPI ServiceMain(DWORD argc, LPSTR *argv)
kill_event = CreateEventW(0, TRUE, FALSE, 0);
if (!kill_event)
{
- fprintf(stderr, "Failed to create event\n");
+ report_error("Failed to create event\n");
KillService();
UpdateSCMStatus(SERVICE_STOPPED, NO_ERROR, 0);
return;
@@ -166,7 +166,7 @@ DWORD DoService(void)
if (!StartServiceCtrlDispatcherA(service))
{
- fprintf(stderr, "Failed to start MSIServer service\n");
+ report_error("Failed to start MSIServer service\n");
return 1;
}
diff --git a/dll/win32/msi/action.c b/dll/win32/msi/action.c
index 403643fa5c8..8548a537fe3 100644
--- a/dll/win32/msi/action.c
+++ b/dll/win32/msi/action.c
@@ -76,8 +76,7 @@ static INT ui_actionstart(MSIPACKAGE *package, LPCWSTR action, LPCWSTR
descripti
return rc;
}
-static void ui_actioninfo(MSIPACKAGE *package, LPCWSTR action, BOOL start,
- INT rc)
+static void ui_actioninfo(MSIPACKAGE *package, const WCHAR *action, BOOL start, INT rc)
{
MSIRECORD *row;
WCHAR *template;
@@ -87,7 +86,7 @@ static void ui_actioninfo(MSIPACKAGE *package, LPCWSTR action, BOOL
start,
row = MSI_CreateRecord(2);
if (!row)
{
- msi_free(template);
+ free(template);
return;
}
MSI_RecordSetStringW(row, 0, template);
@@ -95,7 +94,7 @@ static void ui_actioninfo(MSIPACKAGE *package, LPCWSTR action, BOOL
start,
MSI_RecordSetInteger(row, 2, start ? package->LastActionResult : rc);
MSI_ProcessMessage(package, INSTALLMESSAGE_INFO, row);
msiobj_release(&row->hdr);
- msi_free(template);
+ free(template);
if (!start) package->LastActionResult = rc;
}
@@ -237,7 +236,7 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR
szCommandLine,
while (ptr[len - 1] == ' ') len--;
- prop = msi_alloc( (len + 1) * sizeof(WCHAR) );
+ prop = malloc( (len + 1) * sizeof(WCHAR) );
memcpy( prop, ptr, len * sizeof(WCHAR) );
prop[len] = 0;
if (!preserve_case) wcsupr( prop );
@@ -246,13 +245,13 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR
szCommandLine,
while (*ptr2 == ' ') ptr2++;
num_quotes = 0;
- val = msi_alloc( (lstrlenW( ptr2 ) + 1) * sizeof(WCHAR) );
+ val = malloc( (wcslen( ptr2 ) + 1) * sizeof(WCHAR) );
len = parse_prop( ptr2, val, &num_quotes );
if (num_quotes % 2)
{
WARN("unbalanced quotes\n");
- msi_free( val );
- msi_free( prop );
+ free( val );
+ free( prop );
return ERROR_INVALID_COMMAND_LINE;
}
remove_quotes( val );
@@ -262,8 +261,8 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR
szCommandLine,
if (r == ERROR_SUCCESS && !wcscmp( prop, L"SourceDir" ))
msi_reset_source_folders( package );
- msi_free( val );
- msi_free( prop );
+ free( val );
+ free( prop );
ptr = ptr2 + len;
}
@@ -320,8 +319,7 @@ WCHAR **msi_split_string( const WCHAR *str, WCHAR sep )
}
/* allocate space for an array of substring pointers and the substrings */
- ret = msi_alloc( (count+1) * sizeof (LPWSTR) +
- (lstrlenW(str)+1) * sizeof(WCHAR) );
+ ret = malloc( (count + 1) * sizeof(WCHAR *) + (wcslen(str) + 1) * sizeof(WCHAR) );
if (!ret)
return ret;
@@ -361,13 +359,13 @@ UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace)
if (!(p = wcsrchr( db, '\\' )) && !(p = wcsrchr( db, '/'
)))
{
- msi_free(db);
+ free(db);
return ERROR_SUCCESS;
}
len = p - db + 2;
- source = msi_alloc( len * sizeof(WCHAR) );
+ source = malloc( len * sizeof(WCHAR) );
lstrcpynW( source, db, len );
- msi_free( db );
+ free( db );
check = msi_dup_property( package->db, L"SourceDir" );
if (!check || replace)
@@ -376,14 +374,14 @@ UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace)
if (r == ERROR_SUCCESS)
msi_reset_source_folders( package );
}
- msi_free( check );
+ free( check );
check = msi_dup_property( package->db, L"SOURCEDIR" );
if (!check || replace)
msi_set_property( package->db, L"SOURCEDIR", source, -1 );
- msi_free( check );
- msi_free( source );
+ free( check );
+ free( source );
return ERROR_SUCCESS;
}
@@ -781,7 +779,7 @@ static UINT load_component( MSIRECORD *row, LPVOID param )
MSIPACKAGE *package = param;
MSICOMPONENT *comp;
- comp = msi_alloc_zero( sizeof(MSICOMPONENT) );
+ comp = calloc( 1, sizeof(MSICOMPONENT) );
if (!comp)
return ERROR_FUNCTION_FAILED;
@@ -823,16 +821,11 @@ UINT msi_load_all_components( MSIPACKAGE *package )
return r;
}
-typedef struct {
- MSIPACKAGE *package;
- MSIFEATURE *feature;
-} _ilfs;
-
static UINT add_feature_component( MSIFEATURE *feature, MSICOMPONENT *comp )
{
ComponentList *cl;
- cl = msi_alloc( sizeof (*cl) );
+ cl = malloc( sizeof(*cl) );
if ( !cl )
return ERROR_NOT_ENOUGH_MEMORY;
cl->component = comp;
@@ -845,7 +838,7 @@ static UINT add_feature_child( MSIFEATURE *parent, MSIFEATURE *child
)
{
FeatureList *fl;
- fl = msi_alloc( sizeof(*fl) );
+ fl = malloc( sizeof(*fl) );
if ( !fl )
return ERROR_NOT_ENOUGH_MEMORY;
fl->feature = child;
@@ -854,22 +847,28 @@ static UINT add_feature_child( MSIFEATURE *parent, MSIFEATURE *child
)
return ERROR_SUCCESS;
}
+struct package_feature
+{
+ MSIPACKAGE *package;
+ MSIFEATURE *feature;
+};
+
static UINT iterate_load_featurecomponents(MSIRECORD *row, LPVOID param)
{
- _ilfs* ilfs = param;
+ struct package_feature *package_feature = param;
LPCWSTR component;
MSICOMPONENT *comp;
component = MSI_RecordGetString(row,1);
/* check to see if the component is already loaded */
- comp = msi_get_loaded_component( ilfs->package, component );
+ comp = msi_get_loaded_component( package_feature->package, component );
if (!comp)
{
WARN("ignoring unknown component %s\n", debugstr_w(component));
return ERROR_SUCCESS;
}
- add_feature_component( ilfs->feature, comp );
+ add_feature_component( package_feature->feature, comp );
comp->Enabled = TRUE;
return ERROR_SUCCESS;
@@ -880,12 +879,12 @@ static UINT load_feature(MSIRECORD *row, LPVOID param)
MSIPACKAGE *package = param;
MSIFEATURE *feature;
MSIQUERY *view;
- _ilfs ilfs;
+ struct package_feature package_feature;
UINT rc;
/* fill in the data */
- feature = msi_alloc_zero( sizeof (MSIFEATURE) );
+ feature = calloc( 1, sizeof(MSIFEATURE) );
if (!feature)
return ERROR_NOT_ENOUGH_MEMORY;
@@ -920,10 +919,10 @@ static UINT load_feature(MSIRECORD *row, LPVOID param)
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
- ilfs.package = package;
- ilfs.feature = feature;
+ package_feature.package = package;
+ package_feature.feature = feature;
- rc = MSI_IterateRecords(view, NULL, iterate_load_featurecomponents , &ilfs);
+ rc = MSI_IterateRecords(view, NULL, iterate_load_featurecomponents,
&package_feature);
msiobj_release(&view->hdr);
return rc;
}
@@ -1037,7 +1036,7 @@ static UINT load_file(MSIRECORD *row, LPVOID param)
/* fill in the data */
- file = msi_alloc_zero( sizeof (MSIFILE) );
+ file = calloc( 1, sizeof(MSIFILE) );
if (!file)
return ERROR_NOT_ENOUGH_MEMORY;
@@ -1049,8 +1048,8 @@ static UINT load_file(MSIRECORD *row, LPVOID param)
if (!file->Component)
{
WARN("Component not found: %s\n", debugstr_w(component));
- msi_free(file->File);
- msi_free(file);
+ free(file->File);
+ free(file);
return ERROR_SUCCESS;
}
@@ -1058,7 +1057,7 @@ static UINT load_file(MSIRECORD *row, LPVOID param)
msi_reduce_to_long_filename( file->FileName );
file->ShortName = msi_dup_record_field( row, 3 );
- file->LongName = strdupW( folder_split_path(file->ShortName, '|'));
+ file->LongName = wcsdup( folder_split_path(file->ShortName, '|') );
file->FileSize = MSI_RecordGetInteger( row, 4 );
file->Version = msi_dup_record_field( row, 5 );
@@ -1159,7 +1158,7 @@ static UINT load_patch(MSIRECORD *row, LPVOID param)
MSIFILEPATCH *patch;
const WCHAR *file_key;
- patch = msi_alloc_zero( sizeof (MSIFILEPATCH) );
+ patch = calloc( 1, sizeof(MSIFILEPATCH) );
if (!patch)
return ERROR_NOT_ENOUGH_MEMORY;
@@ -1168,7 +1167,7 @@ static UINT load_patch(MSIRECORD *row, LPVOID param)
if (!patch->File)
{
ERR("Failed to find target for patch in File table\n");
- msi_free(patch);
+ free(patch);
return ERROR_FUNCTION_FAILED;
}
@@ -1280,7 +1279,7 @@ static UINT load_folder( MSIRECORD *row, LPVOID param )
LPWSTR p, tgt_short, tgt_long, src_short, src_long;
MSIFOLDER *folder;
- if (!(folder = msi_alloc_zero( sizeof(*folder) ))) return ERROR_NOT_ENOUGH_MEMORY;
+ if (!(folder = calloc( 1, sizeof(*folder) ))) return ERROR_NOT_ENOUGH_MEMORY;
list_init( &folder->children );
folder->Directory = msi_dup_record_field( row, 1 );
folder->Parent = msi_dup_record_field( row, 2 );
@@ -1314,10 +1313,10 @@ static UINT load_folder( MSIRECORD *row, LPVOID param )
src_long = src_short;
/* FIXME: use the target short path too */
- folder->TargetDefault = strdupW(tgt_long);
- folder->SourceShortPath = strdupW(src_short);
- folder->SourceLongPath = strdupW(src_long);
- msi_free(p);
+ folder->TargetDefault = wcsdup(tgt_long);
+ folder->SourceShortPath = wcsdup(src_short);
+ folder->SourceLongPath = wcsdup(src_long);
+ free(p);
TRACE("TargetDefault = %s\n",debugstr_w( folder->TargetDefault ));
TRACE("SourceLong = %s\n", debugstr_w( folder->SourceLongPath ));
@@ -1333,7 +1332,7 @@ static UINT add_folder_child( MSIFOLDER *parent, MSIFOLDER *child
)
{
FolderList *fl;
- if (!(fl = msi_alloc( sizeof(*fl) ))) return ERROR_NOT_ENOUGH_MEMORY;
+ if (!(fl = malloc( sizeof(*fl) ))) return ERROR_NOT_ENOUGH_MEMORY;
fl->folder = child;
list_add_tail( &parent->children, &fl->entry );
return ERROR_SUCCESS;
@@ -1562,7 +1561,7 @@ static BOOL process_state_property(MSIPACKAGE* package, int level,
}
}
}
- msi_free(override);
+ free(override);
return TRUE;
}
@@ -1967,16 +1966,16 @@ static WCHAR *create_temp_dir( MSIDATABASE *db )
{
GetTempPathW( MAX_PATH, tmp );
}
- if (!(db->tempfolder = strdupW( tmp ))) return NULL;
+ if (!(db->tempfolder = wcsdup( tmp ))) return NULL;
}
- if ((ret = msi_alloc( (lstrlenW( db->tempfolder ) + 20) * sizeof(WCHAR) )))
+ if ((ret = malloc( (wcslen( db->tempfolder ) + 20) * sizeof(WCHAR) )))
{
for (;;)
{
if (!GetTempFileNameW( db->tempfolder, L"msi", ++id, ret ))
{
- msi_free( ret );
+ free( ret );
return NULL;
}
if (CreateDirectoryW( ret, NULL )) break;
@@ -2019,7 +2018,7 @@ WCHAR * WINAPIV msi_build_directory_name( DWORD count, ... )
}
va_end( va );
- dir = msi_alloc( sz * sizeof(WCHAR) );
+ dir = malloc( sz * sizeof(WCHAR) );
dir[0] = 0;
va_start( va, count );
@@ -2041,7 +2040,7 @@ BOOL msi_is_global_assembly( MSICOMPONENT *comp )
static void set_target_path( MSIPACKAGE *package, MSIFILE *file )
{
- msi_free( file->TargetPath );
+ free( file->TargetPath );
if (msi_is_global_assembly( file->Component ))
{
MSIASSEMBLY *assembly = file->Component->assembly;
@@ -2076,10 +2075,9 @@ static UINT calculate_file_cost( MSIPACKAGE *package )
set_target_path( package, file );
- if ((comp->assembly && !comp->assembly->installed) ||
- msi_get_file_attributes( package, file->TargetPath ) ==
INVALID_FILE_ATTRIBUTES)
+ if (msi_get_file_attributes( package, file->TargetPath ) ==
INVALID_FILE_ATTRIBUTES)
{
- comp->Cost += file->FileSize;
+ comp->cost += cost_from_size( file->FileSize );
continue;
}
file_size = msi_get_disk_file_size( package, file->TargetPath );
@@ -2091,24 +2089,24 @@ static UINT calculate_file_cost( MSIPACKAGE *package )
{
if (msi_compare_file_versions( file_version, file->Version ) < 0)
{
- comp->Cost += file->FileSize - file_size;
+ comp->cost += cost_from_size( file->FileSize - file_size );
}
- msi_free( file_version );
+ free( file_version );
continue;
}
else if ((font_version = msi_get_font_file_version( package,
file->TargetPath )))
{
if (msi_compare_font_versions( font_version, file->Version ) < 0)
{
- comp->Cost += file->FileSize - file_size;
+ comp->cost += cost_from_size( file->FileSize - file_size );
}
- msi_free( font_version );
+ free( font_version );
continue;
}
}
if (file_size != file->FileSize)
{
- comp->Cost += file->FileSize - file_size;
+ comp->cost += cost_from_size( file->FileSize - file_size );
}
}
@@ -2121,7 +2119,7 @@ WCHAR *msi_normalize_path( const WCHAR *in )
WCHAR *q, *ret;
int n, len = lstrlenW( in ) + 2;
- if (!(q = ret = msi_alloc( len * sizeof(WCHAR) ))) return NULL;
+ if (!(q = ret = malloc( len * sizeof(WCHAR) ))) return NULL;
len = 0;
while (1)
@@ -2168,7 +2166,7 @@ static WCHAR *get_install_location( MSIPACKAGE *package )
if (MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL,
&hkey, FALSE )) return NULL;
if ((path = msi_reg_get_val_str( hkey, L"InstallLocation" )) &&
!path[0])
{
- msi_free( path );
+ free( path );
path = NULL;
}
RegCloseKey( hkey );
@@ -2206,9 +2204,9 @@ void msi_resolve_target_folder( MSIPACKAGE *package, const WCHAR
*name, BOOL loa
normalized_path = msi_normalize_path( path );
msi_set_property( package->db, folder->Directory, normalized_path, -1 );
- msi_free( path );
+ free( path );
- msi_free( folder->ResolvedTarget );
+ free( folder->ResolvedTarget );
folder->ResolvedTarget = normalized_path;
LIST_FOR_EACH_ENTRY( fl, &folder->children, FolderList, entry )
@@ -2226,7 +2224,7 @@ static ULONGLONG get_volume_space_required( MSIPACKAGE *package )
LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
{
- if (comp->Action == INSTALLSTATE_LOCAL) ret += comp->Cost;
+ if (comp->Action == INSTALLSTATE_LOCAL) ret += comp->cost;
}
return ret;
}
@@ -2279,7 +2277,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
/* set default run level if not set */
level = msi_dup_property( package->db, L"INSTALLLEVEL" );
if (!level) msi_set_property( package->db, L"INSTALLLEVEL",
L"1", -1 );
- msi_free(level);
+ free(level);
if ((rc = MSI_SetFeatureStates( package ))) return rc;
@@ -2306,23 +2304,23 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
}
required = get_volume_space_required( package );
#ifdef __REACTOS__
- swprintf( buf, ARRAY_SIZE(buf), L"%I64u", required / 512 );
+ swprintf( buf, ARRAY_SIZE(buf), L"%I64u", required );
#else
- swprintf( buf, ARRAY_SIZE(buf), L"%lu", required / 512 );
+ swprintf( buf, ARRAY_SIZE(buf), L"%lu", required );
#endif
msi_set_property( package->db,
L"PrimaryVolumeSpaceRequired", buf, -1 );
#ifdef __REACTOS__
- swprintf( buf, ARRAY_SIZE(buf), L"%I64u", (free.QuadPart -
required) / 512 );
+ swprintf( buf, ARRAY_SIZE(buf), L"%I64u", (free.QuadPart / 512)
- required );
#else
- swprintf( buf, ARRAY_SIZE(buf), L"%lu", (free.QuadPart -
required) / 512 );
+ swprintf( buf, ARRAY_SIZE(buf), L"%lu", (free.QuadPart / 512) -
required );
#endif
msi_set_property( package->db,
L"PrimaryVolumeSpaceRemaining", buf, -1 );
msi_set_property( package->db, L"PrimaryVolumePath",
primary_folder, 2 );
}
- msi_free( primary_folder );
+ free( primary_folder );
}
- msi_free( primary_key );
+ free( primary_key );
}
/* FIXME: check volume disk space */
@@ -2340,7 +2338,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value,
DWORD len, DW
{
*size = sizeof(WCHAR);
*type = REG_SZ;
- if ((data = msi_alloc( *size ))) *(WCHAR *)data = 0;
+ if ((data = malloc( *size ))) *(WCHAR *)data = 0;
return data;
}
if (value[0]=='#' && value[1]!='#' &&
value[1]!='%')
@@ -2362,7 +2360,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value,
DWORD len, DW
else
*size = lstrlenW(ptr)/2;
- data = msi_alloc(*size);
+ data = malloc(*size);
byte[0] = '0';
byte[1] = 'x';
@@ -2387,7 +2385,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value,
DWORD len, DW
data[count] = (BYTE)strtol(byte,NULL,0);
count ++;
}
- msi_free(deformated);
+ free(deformated);
TRACE( "data %lu bytes(%u)\n", *size, count );
}
@@ -2400,7 +2398,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value,
DWORD len, DW
*type=REG_DWORD;
*size = sizeof(DWORD);
- data = msi_alloc(*size);
+ data = malloc(*size);
p = deformated;
if (*p == '-')
p++;
@@ -2417,7 +2415,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value,
DWORD len, DW
*(DWORD *)data = d;
TRACE( "DWORD %lu\n", *(DWORD *)data);
- msi_free(deformated);
+ free(deformated);
}
}
else
@@ -2499,7 +2497,7 @@ static HKEY open_key( const MSICOMPONENT *comp, HKEY root, const
WCHAR *path, BO
access |= get_registry_view( comp );
- if (!(subkey = strdupW( path ))) return NULL;
+ if (!(subkey = wcsdup( path ))) return NULL;
p = subkey;
if ((q = wcschr( p, '\\' ))) *q = 0;
if (create)
@@ -2509,7 +2507,7 @@ static HKEY open_key( const MSICOMPONENT *comp, HKEY root, const
WCHAR *path, BO
if (res)
{
TRACE( "failed to open key %s (%ld)\n", debugstr_w(subkey), res );
- msi_free( subkey );
+ free( subkey );
return NULL;
}
if (q && q[1])
@@ -2518,7 +2516,7 @@ static HKEY open_key( const MSICOMPONENT *comp, HKEY root, const
WCHAR *path, BO
RegCloseKey( hkey );
}
else ret = hkey;
- msi_free( subkey );
+ free( subkey );
return ret;
}
@@ -2540,14 +2538,14 @@ static WCHAR **split_multi_string_values( const WCHAR *str, DWORD
len, DWORD *co
p += lstrlenW( p ) + 1;
(*count)++;
}
- if (!(ret = msi_alloc( *count * sizeof(WCHAR *) ))) return NULL;
+ if (!(ret = malloc( *count * sizeof(WCHAR *) ))) return NULL;
p = str;
while ((p - str) < len)
{
- if (!(ret[i] = strdupW( p )))
+ if (!(ret[i] = wcsdup( p )))
{
- for (; i >= 0; i--) msi_free( ret[i] );
- msi_free( ret );
+ for (; i >= 0; i--) free( ret[i] );
+ free( ret );
return NULL;
}
p += lstrlenW( p ) + 1;
@@ -2566,7 +2564,7 @@ static WCHAR *flatten_multi_string_values( WCHAR **left, DWORD
left_count,
for (i = 0; i < left_count; i++) *size += (lstrlenW( left[i] ) + 1) *
sizeof(WCHAR);
for (i = 0; i < right_count; i++) *size += (lstrlenW( right[i] ) + 1) *
sizeof(WCHAR);
- if (!(ret = p = msi_alloc( *size ))) return NULL;
+ if (!(ret = p = malloc( *size ))) return NULL;
for (i = 0; i < left_count; i++)
{
@@ -2594,7 +2592,7 @@ static DWORD remove_duplicate_values( WCHAR **old, DWORD
old_count,
{
if (old[j] && !wcscmp( new[i], old[j] ))
{
- msi_free( old[j] );
+ free( old[j] );
for (k = j; k < old_count - 1; k++) { old[k] = old[k + 1]; }
old[k] = NULL;
ret--;
@@ -2673,10 +2671,10 @@ static BYTE *build_multi_string_value( BYTE *old_value, DWORD
old_size,
old = split_multi_string_values( old_ptr, old_len, &old_count );
}
ret = (BYTE *)join_multi_string_values( op, old, old_count, new, new_count, size );
- for (i = 0; i < old_count; i++) msi_free( old[i] );
- for (i = 0; i < new_count; i++) msi_free( new[i] );
- msi_free( old );
- msi_free( new );
+ for (i = 0; i < old_count; i++) free( old[i] );
+ for (i = 0; i < new_count; i++) free( new[i] );
+ free( old );
+ free( new );
return ret;
}
@@ -2684,7 +2682,7 @@ static BYTE *reg_get_value( HKEY hkey, const WCHAR *name, DWORD
*type, DWORD *si
{
BYTE *ret;
if (RegQueryValueExW( hkey, name, NULL, NULL, NULL, size )) return NULL;
- if (!(ret = msi_alloc( *size ))) return NULL;
+ if (!(ret = malloc( *size ))) return NULL;
RegQueryValueExW( hkey, name, NULL, type, ret, size );
return ret;
}
@@ -2735,23 +2733,23 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID
param)
return ERROR_SUCCESS;
deformat_string(package, key , &deformated);
- uikey = msi_alloc( (lstrlenW(deformated) + lstrlenW(szRoot) + 1) * sizeof(WCHAR) );
+ uikey = malloc( (wcslen(deformated) + wcslen(szRoot) + 1) * sizeof(WCHAR) );
lstrcpyW(uikey,szRoot);
lstrcatW(uikey,deformated);
if (!(hkey = open_key( comp, root_key, deformated, TRUE, KEY_QUERY_VALUE |
KEY_SET_VALUE )))
{
ERR("Could not create key %s\n", debugstr_w(deformated));
- msi_free(uikey);
- msi_free(deformated);
+ free(uikey);
+ free(deformated);
return ERROR_FUNCTION_FAILED;
}
- msi_free( deformated );
+ free( deformated );
str = msi_record_get_string( row, 5, NULL );
len = deformat_string( package, str, &deformated );
new_value = parse_value( package, deformated, len, &type, &new_size );
- msi_free( deformated );
+ free( deformated );
deformat_string(package, name, &deformated);
if (!is_special_entry( name ))
@@ -2762,12 +2760,12 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID
param)
BYTE *new;
if (old_value && old_type != REG_MULTI_SZ)
{
- msi_free( old_value );
+ free( old_value );
old_value = NULL;
old_size = 0;
}
new = build_multi_string_value( old_value, old_size, new_value, new_size,
&new_size );
- msi_free( new_value );
+ free( new_value );
new_value = new;
}
if (!check_first)
@@ -2795,10 +2793,10 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID
param)
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr );
- msi_free(new_value);
- msi_free(old_value);
- msi_free(deformated);
- msi_free(uikey);
+ free(new_value);
+ free(old_value);
+ free(deformated);
+ free(uikey);
return ERROR_SUCCESS;
}
@@ -2842,7 +2840,7 @@ static void delete_key( const MSICOMPONENT *comp, HKEY root, const
WCHAR *path )
WCHAR *subkey, *p;
HKEY hkey;
- if (!(subkey = strdupW( path ))) return;
+ if (!(subkey = wcsdup( path ))) return;
do
{
if ((p = wcsrchr( subkey, '\\' )))
@@ -2867,7 +2865,7 @@ static void delete_key( const MSICOMPONENT *comp, HKEY root, const
WCHAR *path )
break;
}
} while (p);
- msi_free( subkey );
+ free( subkey );
}
static void delete_value( const MSICOMPONENT *comp, HKEY root, const WCHAR *path, const
WCHAR *value )
@@ -2948,7 +2946,7 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row,
LPVOID para
deformat_string( package, key_str, &deformated_key );
size = lstrlenW( deformated_key ) + lstrlenW( root_key_str ) + 1;
- ui_key_str = msi_alloc( size * sizeof(WCHAR) );
+ ui_key_str = malloc( size * sizeof(WCHAR) );
lstrcpyW( ui_key_str, root_key_str );
lstrcatW( ui_key_str, deformated_key );
@@ -2956,7 +2954,7 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row,
LPVOID para
if (delete_key) delete_tree( comp, hkey_root, deformated_key );
else delete_value( comp, hkey_root, deformated_key, deformated_name );
- msi_free( deformated_key );
+ free( deformated_key );
uirow = MSI_CreateRecord( 2 );
MSI_RecordSetStringW( uirow, 1, ui_key_str );
@@ -2964,8 +2962,8 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row,
LPVOID para
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr );
- msi_free( ui_key_str );
- msi_free( deformated_name );
+ free( ui_key_str );
+ free( deformated_name );
return ERROR_SUCCESS;
}
@@ -3011,7 +3009,7 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row,
LPVOID param
deformat_string( package, key_str, &deformated_key );
size = lstrlenW( deformated_key ) + lstrlenW( root_key_str ) + 1;
- ui_key_str = msi_alloc( size * sizeof(WCHAR) );
+ ui_key_str = malloc( size * sizeof(WCHAR) );
lstrcpyW( ui_key_str, root_key_str );
lstrcatW( ui_key_str, deformated_key );
@@ -3019,7 +3017,7 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row,
LPVOID param
if (delete_key) delete_tree( comp, hkey_root, deformated_key );
else delete_value( comp, hkey_root, deformated_key, deformated_name );
- msi_free( deformated_key );
+ free( deformated_key );
uirow = MSI_CreateRecord( 2 );
MSI_RecordSetStringW( uirow, 1, ui_key_str );
@@ -3027,8 +3025,8 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row,
LPVOID param
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr );
- msi_free( ui_key_str );
- msi_free( deformated_name );
+ free( ui_key_str );
+ free( deformated_name );
return ERROR_SUCCESS;
}
@@ -3118,7 +3116,7 @@ static UINT ITERATE_LaunchConditions(MSIRECORD *row, LPVOID param)
message = MSI_RecordGetString(row, 2);
deformat_string(package, message, &deformated);
MessageBoxW(NULL, deformated, L"Install Failed", MB_OK);
- msi_free(deformated);
+ free(deformated);
}
return ERROR_INSTALL_FAILURE;
@@ -3147,7 +3145,7 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT
*cmp )
{
if (!cmp->KeyPath)
- return strdupW( msi_get_target_folder( package, cmp->Directory ) );
+ return wcsdup( msi_get_target_folder( package, cmp->Directory ) );
if (cmp->Attributes & msidbComponentAttributesRegistryKeyPath)
{
@@ -3170,15 +3168,15 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT
*cmp )
if (deformated_name)
len+=lstrlenW(deformated_name);
- buffer = msi_alloc( len *sizeof(WCHAR));
+ buffer = malloc(len * sizeof(WCHAR));
if (deformated_name)
swprintf(buffer, len, L"%02d:\\%s\\%s", root, deformated,
deformated_name);
else
swprintf(buffer, len, L"%02d:\\%s\\", root, deformated);
- msi_free(deformated);
- msi_free(deformated_name);
+ free(deformated);
+ free(deformated_name);
msiobj_release(&row->hdr);
return buffer;
@@ -3193,7 +3191,7 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT
*cmp )
MSIFILE *file = msi_get_loaded_file( package, cmp->KeyPath );
if (file)
- return strdupW( file->TargetPath );
+ return wcsdup( file->TargetPath );
}
return NULL;
}
@@ -3298,7 +3296,7 @@ static WCHAR *build_full_keypath( MSIPACKAGE *package, MSICOMPONENT
*comp )
if (comp->assembly)
{
DWORD len = lstrlenW( L"<\\" ) + lstrlenW(
comp->assembly->display_name );
- WCHAR *keypath = msi_alloc( (len + 1) * sizeof(WCHAR) );
+ WCHAR *keypath = malloc( (len + 1) * sizeof(WCHAR) );
if (keypath)
{
@@ -3336,7 +3334,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
continue;
squash_guid( comp->ComponentId, squashed_cc );
- msi_free( comp->FullKeypath );
+ free( comp->FullKeypath );
comp->FullKeypath = build_full_keypath( package, comp );
refcount_component( package, comp );
@@ -3391,7 +3389,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
sourcepath = msi_resolve_file_source(package, file);
ptr = sourcepath + lstrlenW(base);
lstrcpyW(ptr2, ptr);
- msi_free(sourcepath);
+ free(sourcepath);
msi_reg_set_val_str( hkey, squashed_pc, source );
}
@@ -3439,19 +3437,19 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
return ERROR_SUCCESS;
}
-typedef struct {
+struct typelib
+{
CLSID clsid;
LPWSTR source;
-
LPWSTR path;
ITypeLib *ptLib;
-} typelib_struct;
+};
static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType,
LPWSTR lpszName, LONG_PTR lParam)
{
TLIBATTR *attr;
- typelib_struct *tl_struct = (typelib_struct*) lParam;
+ struct typelib *tl_struct = (struct typelib *)lParam;
int sz;
HRESULT res;
@@ -3464,10 +3462,10 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule,
LPCWSTR lpszType,
sz = lstrlenW(tl_struct->source)+4;
if ((INT_PTR)lpszName == 1)
- tl_struct->path = strdupW(tl_struct->source);
+ tl_struct->path = wcsdup(tl_struct->source);
else
{
- tl_struct->path = msi_alloc(sz * sizeof(WCHAR));
+ tl_struct->path = malloc(sz * sizeof(WCHAR));
#ifdef __REACTOS__
swprintf(tl_struct->path, sz, L"%s\\%d", tl_struct->source,
(WORD)(INT_PTR)lpszName);
#else
@@ -3479,7 +3477,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule,
LPCWSTR lpszType,
res = LoadTypeLib(tl_struct->path,&tl_struct->ptLib);
if (FAILED(res))
{
- msi_free(tl_struct->path);
+ free(tl_struct->path);
tl_struct->path = NULL;
return TRUE;
@@ -3492,7 +3490,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule,
LPCWSTR lpszType,
return FALSE;
}
- msi_free(tl_struct->path);
+ free(tl_struct->path);
tl_struct->path = NULL;
ITypeLib_ReleaseTLibAttr(tl_struct->ptLib, attr);
@@ -3501,7 +3499,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule,
LPCWSTR lpszType,
return TRUE;
}
-static HMODULE msi_load_library( MSIPACKAGE *package, const WCHAR *filename, DWORD flags
)
+static HMODULE load_library( MSIPACKAGE *package, const WCHAR *filename, DWORD flags )
{
HMODULE module;
msi_disable_fs_redirection( package );
@@ -3510,7 +3508,7 @@ static HMODULE msi_load_library( MSIPACKAGE *package, const WCHAR
*filename, DWO
return module;
}
-static HRESULT msi_load_typelib( MSIPACKAGE *package, const WCHAR *filename, REGKIND
kind, ITypeLib **lib )
+static HRESULT load_typelib( MSIPACKAGE *package, const WCHAR *filename, REGKIND kind,
ITypeLib **lib )
{
HRESULT hr;
msi_disable_fs_redirection( package );
@@ -3525,7 +3523,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID
param)
LPCWSTR component;
MSICOMPONENT *comp;
MSIFILE *file;
- typelib_struct tl_struct;
+ struct typelib tl_struct;
ITypeLib *tlib;
HMODULE module;
HRESULT hr;
@@ -3549,13 +3547,13 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID
param)
}
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, row);
- module = msi_load_library( package, file->TargetPath, LOAD_LIBRARY_AS_DATAFILE
);
+ module = load_library( package, file->TargetPath, LOAD_LIBRARY_AS_DATAFILE );
if (module)
{
LPCWSTR guid;
guid = MSI_RecordGetString(row,1);
CLSIDFromString( guid, &tl_struct.clsid);
- tl_struct.source = strdupW( file->TargetPath );
+ tl_struct.source = wcsdup( file->TargetPath );
tl_struct.path = NULL;
EnumResourceNamesW(module, L"TYPELIB", Typelib_EnumResNameProc,
@@ -3577,16 +3575,16 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID
param)
TRACE("Registered %s\n", debugstr_w(tl_struct.path));
ITypeLib_Release(tl_struct.ptLib);
- msi_free(tl_struct.path);
+ free(tl_struct.path);
}
else ERR("Failed to load type library %s\n",
debugstr_w(tl_struct.source));
FreeLibrary(module);
- msi_free(tl_struct.source);
+ free(tl_struct.source);
}
else
{
- hr = msi_load_typelib( package, file->TargetPath, REGKIND_REGISTER, &tlib
);
+ hr = load_typelib( package, file->TargetPath, REGKIND_REGISTER, &tlib );
if (FAILED(hr))
{
ERR( "failed to load type library: %#lx\n", hr );
@@ -3680,7 +3678,7 @@ static UINT ACTION_UnregisterTypeLibraries( MSIPACKAGE *package )
static WCHAR *get_link_file( MSIPACKAGE *package, MSIRECORD *row )
{
LPCWSTR directory, extension, link_folder;
- LPWSTR link_file, filename;
+ WCHAR *link_file = NULL, *filename, *new_filename;
directory = MSI_RecordGetString( row, 2 );
link_folder = msi_get_target_folder( package, directory );
@@ -3693,18 +3691,22 @@ static WCHAR *get_link_file( MSIPACKAGE *package, MSIRECORD *row
)
msi_create_full_path( package, link_folder );
filename = msi_dup_record_field( row, 3 );
+ if (!filename) return NULL;
msi_reduce_to_long_filename( filename );
extension = wcsrchr( filename, '.' );
if (!extension || wcsicmp( extension, L".lnk" ))
{
int len = lstrlenW( filename );
- filename = msi_realloc( filename, len * sizeof(WCHAR) + sizeof(L".lnk")
);
+ new_filename = realloc( filename, len * sizeof(WCHAR) + sizeof(L".lnk")
);
+ if (!new_filename) goto done;
+ filename = new_filename;
memcpy( filename + len, L".lnk", sizeof(L".lnk") );
}
link_file = msi_build_directory_name( 2, link_folder, filename );
- msi_free( filename );
+done:
+ free( filename );
return link_file;
}
@@ -3718,13 +3720,13 @@ WCHAR *msi_build_icon_path( MSIPACKAGE *package, const WCHAR
*icon_name )
{
WCHAR *appdata = msi_dup_property( package->db, L"AppDataFolder"
);
folder = msi_build_directory_name( 2, appdata, L"Microsoft\\" );
- msi_free( appdata );
+ free( appdata );
}
dest = msi_build_directory_name( 3, folder, L"Installer\\",
package->ProductCode );
msi_create_full_path( package, dest );
path = msi_build_directory_name( 2, dest, icon_name );
- msi_free( folder );
- msi_free( dest );
+ free( folder );
+ free( dest );
return path;
}
@@ -3773,14 +3775,14 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID
param)
deformat_string( package, target, &path );
TRACE("target path is %s\n", debugstr_w(path));
IShellLinkW_SetPath( sl, path );
- msi_free( path );
+ free( path );
}
else
{
FIXME("poorly handled shortcut format, advertised shortcut\n");
path = resolve_keypath( package, comp );
IShellLinkW_SetPath( sl, path );
- msi_free( path );
+ free( path );
}
if (!MSI_RecordIsNull(row,6))
@@ -3788,7 +3790,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
LPCWSTR arguments = MSI_RecordGetString(row, 6);
deformat_string(package, arguments, &deformated);
IShellLinkW_SetArguments(sl,deformated);
- msi_free(deformated);
+ free(deformated);
}
if (!MSI_RecordIsNull(row,7))
@@ -3813,7 +3815,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
index = 0;
IShellLinkW_SetIconLocation(sl, path, index);
- msi_free(path);
+ free(path);
}
if (!MSI_RecordIsNull(row,11))
@@ -3833,7 +3835,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
IPersistFile_Save(pf, link_file, FALSE);
msi_revert_fs_redirection( package );
- msi_free(link_file);
+ free(link_file);
err:
if (pf)
@@ -3889,7 +3891,7 @@ static UINT ITERATE_RemoveShortcuts( MSIRECORD *row, LPVOID param
)
link_file = get_link_file( package, row );
TRACE("Removing shortcut file %s\n", debugstr_w( link_file ));
if (!msi_delete_file( package, link_file )) WARN( "failed to remove shortcut
file %lu\n", GetLastError() );
- msi_free( link_file );
+ free( link_file );
return ERROR_SUCCESS;
}
@@ -3936,7 +3938,7 @@ static UINT ITERATE_PublishIcon(MSIRECORD *row, LPVOID param)
if (handle == INVALID_HANDLE_VALUE)
{
ERR("Unable to create file %s\n", debugstr_w(icon_path));
- msi_free( icon_path );
+ free( icon_path );
return ERROR_SUCCESS;
}
@@ -3954,13 +3956,13 @@ static UINT ITERATE_PublishIcon(MSIRECORD *row, LPVOID param)
WriteFile( handle, buffer, sz, &count, NULL );
} while (sz == 1024);
- msi_free( icon_path );
+ free( icon_path );
CloseHandle( handle );
return ERROR_SUCCESS;
}
-static UINT msi_publish_icons(MSIPACKAGE *package)
+static UINT publish_icons(MSIPACKAGE *package)
{
MSIQUERY *view;
UINT r;
@@ -3976,7 +3978,7 @@ static UINT msi_publish_icons(MSIPACKAGE *package)
return ERROR_SUCCESS;
}
-static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey)
+static UINT publish_sourcelist(MSIPACKAGE *package, HKEY hkey)
{
UINT r;
HKEY source;
@@ -4030,14 +4032,14 @@ static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY
hkey)
return ERROR_SUCCESS;
}
-static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey)
+static UINT publish_product_properties(MSIPACKAGE *package, HKEY hkey)
{
WCHAR *buffer, *ptr, *guids, packcode[SQUASHED_GUID_SIZE];
DWORD langid;
buffer = msi_dup_property(package->db, INSTALLPROPERTY_PRODUCTNAMEW);
msi_reg_set_val_str(hkey, INSTALLPROPERTY_PRODUCTNAMEW, buffer);
- msi_free(buffer);
+ free(buffer);
langid = msi_get_property_int(package->db, L"ProductLanguage", 0);
msi_reg_set_val_dword(hkey, INSTALLPROPERTY_LANGUAGEW, langid);
@@ -4050,8 +4052,8 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY
hkey)
{
LPWSTR path = msi_build_icon_path(package, buffer);
msi_reg_set_val_str(hkey, INSTALLPROPERTY_PRODUCTICONW, path);
- msi_free(path);
- msi_free(buffer);
+ free(path);
+ free(buffer);
}
buffer = msi_dup_property(package->db, L"ProductVersion");
@@ -4059,7 +4061,7 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY
hkey)
{
DWORD verdword = msi_version_str_to_dword(buffer);
msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONW, verdword);
- msi_free(buffer);
+ free(buffer);
}
msi_reg_set_val_dword(hkey, L"Assignment", 0);
@@ -4070,13 +4072,13 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package,
HKEY hkey)
if (!(guids = msi_get_package_code(package->db))) return ERROR_OUTOFMEMORY;
if ((ptr = wcschr(guids, ';'))) *ptr = 0;
squash_guid(guids, packcode);
- msi_free( guids);
+ free(guids);
msi_reg_set_val_str(hkey, INSTALLPROPERTY_PACKAGECODEW, packcode);
return ERROR_SUCCESS;
}
-static UINT msi_publish_upgrade_code(MSIPACKAGE *package)
+static UINT publish_upgrade_code(MSIPACKAGE *package)
{
UINT r;
HKEY hkey;
@@ -4094,17 +4096,17 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package)
if (r != ERROR_SUCCESS)
{
WARN("failed to open upgrade code key\n");
- msi_free(upgrade);
+ free(upgrade);
return ERROR_SUCCESS;
}
squash_guid(package->ProductCode, squashed_pc);
msi_reg_set_val_str(hkey, squashed_pc, NULL);
RegCloseKey(hkey);
- msi_free(upgrade);
+ free(upgrade);
return ERROR_SUCCESS;
}
-static BOOL msi_check_publish(MSIPACKAGE *package)
+static BOOL check_publish(MSIPACKAGE *package)
{
MSIFEATURE *feature;
@@ -4118,7 +4120,7 @@ static BOOL msi_check_publish(MSIPACKAGE *package)
return FALSE;
}
-static BOOL msi_check_unpublish(MSIPACKAGE *package)
+static BOOL check_unpublish(MSIPACKAGE *package)
{
MSIFEATURE *feature;
@@ -4132,7 +4134,7 @@ static BOOL msi_check_unpublish(MSIPACKAGE *package)
return TRUE;
}
-static UINT msi_publish_patches( MSIPACKAGE *package )
+static UINT publish_patches( MSIPACKAGE *package )
{
WCHAR patch_squashed[GUID_SIZE];
HKEY patches_key = NULL, product_patches_key = NULL, product_key;
@@ -4163,7 +4165,7 @@ static UINT msi_publish_patches( MSIPACKAGE *package )
len += lstrlenW( patch_squashed ) + 1;
}
- p = all_patches = msi_alloc( (len + 1) * sizeof(WCHAR) );
+ p = all_patches = malloc( (len + 1) * sizeof(WCHAR) );
if (!all_patches)
goto done;
@@ -4230,7 +4232,7 @@ done:
RegCloseKey( product_patches_key );
RegCloseKey( patches_key );
RegCloseKey( product_key );
- msi_free( all_patches );
+ free( all_patches );
return r;
}
@@ -4246,7 +4248,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
if (!list_empty(&package->patches))
{
- rc = msi_publish_patches(package);
+ rc = publish_patches(package);
if (rc != ERROR_SUCCESS)
goto end;
}
@@ -4268,19 +4270,19 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
WCHAR packed[SQUASHED_GUID_SIZE];
squash_guid(guid, packed);
- msi_free(guid);
+ free(guid);
if (!wcscmp(packed, package_code))
{
TRACE("re-publishing product - new package\n");
republish = TRUE;
}
}
- msi_free(package_code);
+ free(package_code);
}
}
/* FIXME: also need to publish if the product is in advertise mode */
- if (!republish && !msi_check_publish(package))
+ if (!republish && !check_publish(package))
{
if (hukey)
RegCloseKey(hukey);
@@ -4300,19 +4302,19 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
if (rc != ERROR_SUCCESS)
goto end;
- rc = msi_publish_upgrade_code(package);
+ rc = publish_upgrade_code(package);
if (rc != ERROR_SUCCESS)
goto end;
- rc = msi_publish_product_properties(package, hukey);
+ rc = publish_product_properties(package, hukey);
if (rc != ERROR_SUCCESS)
goto end;
- rc = msi_publish_sourcelist(package, hukey);
+ rc = publish_sourcelist(package, hukey);
if (rc != ERROR_SUCCESS)
goto end;
- rc = msi_publish_icons(package);
+ rc = publish_icons(package);
end:
uirow = MSI_CreateRecord( 1 );
@@ -4339,7 +4341,7 @@ static WCHAR *get_ini_file_name( MSIPACKAGE *package, MSIRECORD *row
)
dirprop = MSI_RecordGetString( row, 3 );
if (dirprop)
{
- folder = strdupW( msi_get_target_folder( package, dirprop ) );
+ folder = wcsdup( msi_get_target_folder( package, dirprop ) );
if (!folder) folder = msi_dup_property( package->db, dirprop );
}
else
@@ -4348,14 +4350,14 @@ static WCHAR *get_ini_file_name( MSIPACKAGE *package, MSIRECORD
*row )
if (!folder)
{
ERR("Unable to resolve folder %s\n", debugstr_w(dirprop));
- msi_free( filename );
+ free( filename );
return NULL;
}
ret = msi_build_directory_name( 2, folder, ptr );
- msi_free( filename );
- msi_free( folder );
+ free( filename );
+ free( folder );
return ret;
}
@@ -4426,10 +4428,10 @@ static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param)
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr );
- msi_free(fullname);
- msi_free(deformated_key);
- msi_free(deformated_value);
- msi_free(deformated_section);
+ free(fullname);
+ free(deformated_key);
+ free(deformated_value);
+ free(deformated_section);
return ERROR_SUCCESS;
}
@@ -4492,7 +4494,7 @@ static UINT ITERATE_RemoveIniValuesOnUninstall( MSIRECORD *row,
LPVOID param )
{
WARN( "unable to remove key %lu\n", GetLastError() );
}
- msi_free( filename );
+ free( filename );
}
else
FIXME("Unsupported action %d\n", action);
@@ -4506,9 +4508,9 @@ static UINT ITERATE_RemoveIniValuesOnUninstall( MSIRECORD *row,
LPVOID param )
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr );
- msi_free( deformated_key );
- msi_free( deformated_value );
- msi_free( deformated_section );
+ free( deformated_key );
+ free( deformated_value );
+ free( deformated_section );
return ERROR_SUCCESS;
}
@@ -4554,7 +4556,7 @@ static UINT ITERATE_RemoveIniValuesOnInstall( MSIRECORD *row, LPVOID
param )
{
WARN( "unable to remove key %lu\n", GetLastError() );
}
- msi_free( filename );
+ free( filename );
}
else
FIXME("Unsupported action %d\n", action);
@@ -4567,9 +4569,9 @@ static UINT ITERATE_RemoveIniValuesOnInstall( MSIRECORD *row, LPVOID
param )
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr );
- msi_free( deformated_key );
- msi_free( deformated_value );
- msi_free( deformated_section );
+ free( deformated_key );
+ free( deformated_value );
+ free( deformated_section );
return ERROR_SUCCESS;
}
@@ -4602,18 +4604,13 @@ static UINT ACTION_RemoveIniValues( MSIPACKAGE *package )
static void register_dll( const WCHAR *dll, BOOL unregister )
{
-#ifdef __REACTOS__
static const WCHAR regW[] = L"regsvr32.exe /s \"%s\"";
static const WCHAR unregW[] = L"regsvr32.exe /s /u \"%s\"";
-#else /* __REACTOS__ */
- static const WCHAR regW[] = L"regsvr32.exe \"%s\"";
- static const WCHAR unregW[] = L"regsvr32.exe /u \"%s\"";
-#endif /* __REACTOS__ */
PROCESS_INFORMATION pi;
STARTUPINFOW si;
WCHAR *cmd;
- if (!(cmd = msi_alloc( lstrlenW(dll) * sizeof(WCHAR) + sizeof(unregW) ))) return;
+ if (!(cmd = malloc( wcslen(dll) * sizeof(WCHAR) + sizeof(unregW) ))) return;
if (unregister) swprintf( cmd, lstrlenW(dll) + ARRAY_SIZE(unregW), unregW, dll );
else swprintf( cmd, lstrlenW(dll) + ARRAY_SIZE(unregW), regW, dll );
@@ -4625,7 +4622,7 @@ static void register_dll( const WCHAR *dll, BOOL unregister )
msi_dialog_check_messages( pi.hProcess );
CloseHandle( pi.hProcess );
}
- msi_free( cmd );
+ free( cmd );
}
static UINT ITERATE_SelfRegModules(MSIRECORD *row, LPVOID param)
@@ -4737,7 +4734,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL,
L"PublishFeatures");
- if (!msi_check_publish(package))
+ if (!check_publish(package))
return ERROR_SUCCESS;
rc = MSIREG_OpenFeaturesKey(package->ProductCode, NULL, package->Context,
@@ -4776,7 +4773,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
if (feature->Feature_Parent)
size += lstrlenW( feature->Feature_Parent )+2;
- data = msi_alloc(size * sizeof(WCHAR));
+ data = malloc(size * sizeof(WCHAR));
data[0] = 0;
LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
@@ -4802,7 +4799,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
}
msi_reg_set_val_str( userdata, feature->Feature, data );
- msi_free(data);
+ free(data);
size = 0;
if (feature->Feature_Parent)
@@ -4816,14 +4813,14 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
else
{
size += 2*sizeof(WCHAR);
- data = msi_alloc(size);
+ data = malloc(size);
data[0] = 0x6;
data[1] = 0;
if (feature->Feature_Parent)
lstrcpyW( &data[1], feature->Feature_Parent );
RegSetValueExW(hkey,feature->Feature,0,REG_SZ,
(LPBYTE)data,size);
- msi_free(data);
+ free(data);
}
/* the UI chunk */
@@ -4840,7 +4837,7 @@ end:
return rc;
}
-static UINT msi_unpublish_feature(MSIPACKAGE *package, MSIFEATURE *feature)
+static UINT unpublish_feature(MSIPACKAGE *package, MSIFEATURE *feature)
{
UINT r;
HKEY hkey;
@@ -4879,18 +4876,18 @@ static UINT ACTION_UnpublishFeatures(MSIPACKAGE *package)
if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL,
L"UnpublishFeatures");
- if (!msi_check_unpublish(package))
+ if (!check_unpublish(package))
return ERROR_SUCCESS;
LIST_FOR_EACH_ENTRY(feature, &package->features, MSIFEATURE, entry)
{
- msi_unpublish_feature(package, feature);
+ unpublish_feature(package, feature);
}
return ERROR_SUCCESS;
}
-static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey)
+static UINT publish_install_properties(MSIPACKAGE *package, HKEY hkey)
{
static const WCHAR *propval[] =
{
@@ -4921,7 +4918,7 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY
hkey)
key = *p++;
val = msi_dup_property(package->db, prop);
msi_reg_set_val_str(hkey, key, val);
- msi_free(val);
+ free(val);
}
msi_reg_set_val_dword(hkey, L"WindowsInstaller", 1);
@@ -4950,7 +4947,7 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY
hkey)
size = deformat_string(package, fmt, &buffer) * sizeof(WCHAR);
RegSetValueExW(hkey, L"ModifyPath", 0, REG_EXPAND_SZ, (LPBYTE)buffer,
size);
RegSetValueExW(hkey, L"UninstallString", 0, REG_EXPAND_SZ,
(LPBYTE)buffer, size);
- msi_free(buffer);
+ free(buffer);
}
/* FIXME: Write real Estimated Size when we have it */
@@ -4972,7 +4969,7 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY
hkey)
msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONW, verdword);
msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONMAJORW, verdword >>
24);
msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONMINORW, (verdword >> 16)
& 0xFF);
- msi_free(buffer);
+ free(buffer);
}
return ERROR_SUCCESS;
@@ -4989,8 +4986,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
return msi_schedule_action(package, SCRIPT_INSTALL,
L"RegisterProduct");
/* FIXME: also need to publish if the product is in advertise mode */
- if (!msi_get_property_int( package->db, L"ProductToBeRegistered", 0 )
- && !msi_check_publish(package))
+ if (!msi_get_property_int( package->db, L"ProductToBeRegistered", 0 )
&& !check_publish(package))
return ERROR_SUCCESS;
rc = MSIREG_OpenUninstallKey(package->ProductCode, package->platform,
&hkey, TRUE);
@@ -5001,11 +4997,11 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
if (rc != ERROR_SUCCESS)
goto done;
- rc = msi_publish_install_properties(package, hkey);
+ rc = publish_install_properties(package, hkey);
if (rc != ERROR_SUCCESS)
goto done;
- rc = msi_publish_install_properties(package, props);
+ rc = publish_install_properties(package, props);
if (rc != ERROR_SUCCESS)
goto done;
@@ -5019,7 +5015,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
msi_reg_set_val_str( upgrade_key, squashed_pc, NULL );
RegCloseKey( upgrade_key );
}
- msi_free( upgrade_code );
+ free( upgrade_code );
}
msi_reg_set_val_str( props, INSTALLPROPERTY_LOCALPACKAGEW, package->localfile );
package->delete_on_close = FALSE;
@@ -5055,12 +5051,12 @@ static UINT ITERATE_UnpublishIcon( MSIRECORD *row, LPVOID param
)
*p = 0;
msi_remove_directory( package, icon_path );
}
- msi_free( icon_path );
+ free( icon_path );
}
return ERROR_SUCCESS;
}
-static UINT msi_unpublish_icons( MSIPACKAGE *package )
+static UINT unpublish_icons( MSIPACKAGE *package )
{
MSIQUERY *view;
UINT r;
@@ -5111,7 +5107,7 @@ static void remove_product_upgrade_code( MSIPACKAGE *package )
if (!res && !count) MSIREG_DeleteClassesUpgradeCodesKey( code );
}
- msi_free( code );
+ free( code );
}
static UINT ACTION_UnpublishProduct(MSIPACKAGE *package)
@@ -5142,7 +5138,7 @@ static UINT ACTION_UnpublishProduct(MSIPACKAGE *package)
TRACE("removing local package %s\n", debugstr_w(package->localfile));
package->delete_on_close = TRUE;
- msi_unpublish_icons( package );
+ unpublish_icons( package );
return ERROR_SUCCESS;
}
@@ -5163,12 +5159,52 @@ static BOOL is_full_uninstall( MSIPACKAGE *package )
static UINT ACTION_InstallFinalize(MSIPACKAGE *package)
{
UINT rc;
+ MSIFILE *file;
+ MSIFILEPATCH *patch;
/* first do the same as an InstallExecute */
rc = execute_script(package, SCRIPT_INSTALL);
if (rc != ERROR_SUCCESS)
return rc;
+ /* install global assemblies */
+ LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
+ {
+ MSICOMPONENT *comp = file->Component;
+
+ if (!msi_is_global_assembly( comp ) || (file->state != msifs_missing
&& file->state != msifs_overwrite))
+ continue;
+
+ rc = msi_install_assembly( package, comp );
+ if (rc != ERROR_SUCCESS)
+ {
+ ERR("Failed to install assembly\n");
+ return ERROR_INSTALL_FAILURE;
+ }
+ file->state = msifs_installed;
+ }
+
+ /* patch global assemblies */
+ LIST_FOR_EACH_ENTRY( patch, &package->filepatches, MSIFILEPATCH, entry )
+ {
+ MSICOMPONENT *comp = patch->File->Component;
+
+ if (!msi_is_global_assembly( comp ) || !patch->path) continue;
+
+ rc = msi_patch_assembly( package, comp->assembly, patch );
+ if (rc && !(patch->Attributes & msidbPatchAttributesNonVital))
+ {
+ ERR("Failed to apply patch to file: %s\n",
debugstr_w(patch->File->File));
+ return rc;
+ }
+
+ if ((rc = msi_install_assembly( package, comp )))
+ {
+ ERR("Failed to install patched assembly\n");
+ return rc;
+ }
+ }
+
/* then handle commit actions */
rc = execute_script(package, SCRIPT_COMMIT);
if (rc != ERROR_SUCCESS)
@@ -5233,26 +5269,30 @@ static UINT ACTION_ResolveSource(MSIPACKAGE* package)
INSTALLPROPERTY_DISKPROMPTW,NULL,&size);
if (rc == ERROR_MORE_DATA)
{
- prompt = msi_alloc(size * sizeof(WCHAR));
+ prompt = malloc(size * sizeof(WCHAR));
MsiSourceListGetInfoW(package->ProductCode, NULL,
package->Context, MSICODE_PRODUCT,
INSTALLPROPERTY_DISKPROMPTW,prompt,&size);
}
else
- prompt = strdupW(package->db->path);
+ prompt = wcsdup(package->db->path);
record = MSI_CreateRecord(2);
MSI_RecordSetInteger(record, 1, MSIERR_INSERTDISK);
MSI_RecordSetStringW(record, 2, prompt);
- msi_free(prompt);
+ free(prompt);
while(attrib == INVALID_FILE_ATTRIBUTES)
{
MSI_RecordSetStringW(record, 0, NULL);
rc = MSI_ProcessMessage(package, INSTALLMESSAGE_ERROR, record);
if (rc == IDCANCEL)
+ {
+ msiobj_release(&record->hdr);
return ERROR_INSTALL_USEREXIT;
+ }
attrib = GetFileAttributesW(package->db->path);
}
+ msiobj_release(&record->hdr);
rc = ERROR_SUCCESS;
}
else
@@ -5285,7 +5325,7 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package)
if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, L"RegisterUser");
- if (msi_check_unpublish(package))
+ if (check_unpublish(package))
{
MSIREG_DeleteUserDataProductKey(package->ProductCode, package->Context);
goto end;
@@ -5304,7 +5344,7 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package)
{
buffer = msi_dup_property( package->db, szPropKeys[i] );
msi_reg_set_val_str( hkey, szRegKeys[i], buffer );
- msi_free( buffer );
+ free( buffer );
}
end:
@@ -5313,7 +5353,7 @@ end:
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr );
- msi_free(productid);
+ free(productid);
RegCloseKey(hkey);
return rc;
}
@@ -5363,7 +5403,7 @@ static UINT ACTION_ExecuteAction(MSIPACKAGE *package)
}
info_template = msi_get_error_message(package->db,
MSIERR_INFO_LOGGINGSTART);
MSI_RecordSetStringW(uirow_info, 0, info_template);
- msi_free(info_template);
+ free(info_template);
MSI_ProcessMessage(package, INSTALLMESSAGE_INFO|MB_ICONHAND, uirow_info);
msiobj_release(&uirow_info->hdr);
}
@@ -5445,8 +5485,8 @@ static UINT ACTION_ExecuteAction(MSIPACKAGE *package)
msiobj_release(&uirow->hdr);
end:
- msi_free(productname);
- msi_free(action);
+ free(productname);
+ free(action);
return rc;
}
@@ -5485,7 +5525,7 @@ WCHAR *msi_create_component_advertise_string( MSIPACKAGE *package,
MSICOMPONENT
debugstr_w(component_85));
sz = 20 + lstrlenW( feature ) + 20 + 3;
- ret = msi_alloc_zero( sz * sizeof(WCHAR) );
+ ret = calloc( 1, sz * sizeof(WCHAR) );
if (ret) swprintf( ret, sz, L"%s%s%c%s", productid_85, feature, component ?
'>' : '<', component_85 );
return ret;
}
@@ -5533,10 +5573,10 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID
param)
text = MSI_RecordGetString( rec, 4 );
if (text)
{
- p = msi_alloc( (lstrlenW( advertise ) + lstrlenW( text ) + 1) * sizeof(WCHAR)
);
+ p = malloc( (wcslen( advertise ) + wcslen( text ) + 1) * sizeof(WCHAR) );
lstrcpyW( p, advertise );
lstrcatW( p, text );
- msi_free( advertise );
+ free( advertise );
advertise = p;
}
existing = msi_reg_get_val_str( hkey, qualifier );
@@ -5550,7 +5590,7 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
if (wcscmp( advertise, p )) sz += len;
}
}
- if (!(output = msi_alloc( (sz + 1) * sizeof(WCHAR) )))
+ if (!(output = malloc( (sz + 1) * sizeof(WCHAR) )))
{
rc = ERROR_OUTOFMEMORY;
goto end;
@@ -5575,9 +5615,9 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
end:
RegCloseKey(hkey);
- msi_free( output );
- msi_free( advertise );
- msi_free( existing );
+ free( output );
+ free( advertise );
+ free( existing );
/* the UI chunk */
uirow = MSI_CreateRecord( 2 );
@@ -5758,7 +5798,7 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
else
{
int len = lstrlenW(file->TargetPath) + lstrlenW(args) + 2;
- if (!(image_path = msi_alloc(len * sizeof(WCHAR))))
+ if (!(image_path = malloc(len * sizeof(WCHAR))))
{
ret = ERROR_OUTOFMEMORY;
goto done;
@@ -5788,18 +5828,18 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
WARN( "failed to set service description %lu\n", GetLastError()
);
}
- if (image_path != file->TargetPath) msi_free(image_path);
+ if (image_path != file->TargetPath) free(image_path);
done:
if (service) CloseServiceHandle(service);
if (hscm) CloseServiceHandle(hscm);
- msi_free(name);
- msi_free(disp);
- msi_free(sd.lpDescription);
- msi_free(load_order);
- msi_free(serv_name);
- msi_free(pass);
- msi_free(depends);
- msi_free(args);
+ free(name);
+ free(disp);
+ free(sd.lpDescription);
+ free(load_order);
+ free(serv_name);
+ free(pass);
+ free(depends);
+ free(args);
return ret;
}
@@ -5822,7 +5862,7 @@ static UINT ACTION_InstallServices( MSIPACKAGE *package )
}
/* converts arg1[~]arg2[~]arg3 to a list of ptrs to the strings */
-static LPCWSTR *msi_service_args_to_vector(LPWSTR args, DWORD *numargs)
+static const WCHAR **service_args_to_vector(WCHAR *args, DWORD *numargs)
{
LPCWSTR *vector, *temp_vector;
LPWSTR p, q;
@@ -5834,7 +5874,7 @@ static LPCWSTR *msi_service_args_to_vector(LPWSTR args, DWORD
*numargs)
if (!args)
return NULL;
- vector = msi_alloc(sizeof(LPWSTR));
+ vector = malloc(sizeof(WCHAR *));
if (!vector)
return NULL;
@@ -5848,10 +5888,10 @@ static LPCWSTR *msi_service_args_to_vector(LPWSTR args, DWORD
*numargs)
{
*q = '\0';
- temp_vector = msi_realloc(vector, (*numargs + 1) * sizeof(LPWSTR));
+ temp_vector = realloc(vector, (*numargs + 1) * sizeof(WCHAR *));
if (!temp_vector)
{
- msi_free(vector);
+ free(vector);
return NULL;
}
vector = temp_vector;
@@ -5889,7 +5929,7 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param)
!(comp->Action == INSTALLSTATE_ABSENT && (event &
msidbServiceControlEventUninstallStart)))
{
TRACE("not starting %s\n", debugstr_w(name));
- msi_free( name );
+ free(name);
return ERROR_SUCCESS;
}
@@ -5907,7 +5947,7 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param)
if (!GetServiceDisplayNameW( scm, name, NULL, &len ) &&
GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
- if ((display_name = msi_alloc( ++len * sizeof(WCHAR ))))
+ if ((display_name = malloc(++len * sizeof(WCHAR))))
GetServiceDisplayNameW( scm, name, display_name, &len );
}
@@ -5918,7 +5958,7 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param)
goto done;
}
- vector = msi_service_args_to_vector(args, &numargs);
+ vector = service_args_to_vector(args, &numargs);
if (!StartServiceW(service, numargs, vector) &&
GetLastError() != ERROR_SERVICE_ALREADY_RUNNING)
@@ -5966,10 +6006,10 @@ done:
if (service) CloseServiceHandle(service);
if (scm) CloseServiceHandle(scm);
- msi_free(name);
- msi_free(args);
- msi_free(vector);
- msi_free(display_name);
+ free(name);
+ free(args);
+ free(vector);
+ free(display_name);
return r;
}
@@ -6005,7 +6045,7 @@ static BOOL stop_service_dependents(SC_HANDLE scm, SC_HANDLE
service)
if (GetLastError() != ERROR_MORE_DATA)
return FALSE;
- dependencies = msi_alloc(needed);
+ dependencies = malloc(needed);
if (!dependencies)
return FALSE;
@@ -6029,7 +6069,7 @@ static BOOL stop_service_dependents(SC_HANDLE scm, SC_HANDLE
service)
ret = TRUE;
done:
- msi_free(dependencies);
+ free(dependencies);
return ret;
}
@@ -6098,7 +6138,7 @@ static UINT ITERATE_StopService( MSIRECORD *rec, LPVOID param )
!(comp->Action == INSTALLSTATE_ABSENT && (event &
msidbServiceControlEventUninstallStop)))
{
TRACE("not stopping %s\n", debugstr_w(name));
- msi_free( name );
+ free( name );
return ERROR_SUCCESS;
}
@@ -6113,7 +6153,7 @@ static UINT ITERATE_StopService( MSIRECORD *rec, LPVOID param )
if (!GetServiceDisplayNameW( scm, name, NULL, &len ) &&
GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
- if ((display_name = msi_alloc( ++len * sizeof(WCHAR ))))
+ if ((display_name = malloc( ++len * sizeof(WCHAR ))))
GetServiceDisplayNameW( scm, name, display_name, &len );
}
CloseServiceHandle( scm );
@@ -6127,8 +6167,8 @@ done:
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr );
- msi_free( name );
- msi_free( display_name );
+ free( name );
+ free( display_name );
return ERROR_SUCCESS;
}
@@ -6170,7 +6210,7 @@ static UINT ITERATE_DeleteService( MSIRECORD *rec, LPVOID param )
!(comp->Action == INSTALLSTATE_ABSENT && (event &
msidbServiceControlEventUninstallDelete)))
{
TRACE("service %s not scheduled for removal\n", debugstr_w(name));
- msi_free( name );
+ free( name );
return ERROR_SUCCESS;
}
stop_service( name );
@@ -6186,7 +6226,7 @@ static UINT ITERATE_DeleteService( MSIRECORD *rec, LPVOID param )
if (!GetServiceDisplayNameW( scm, name, NULL, &len ) &&
GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
- if ((display_name = msi_alloc( ++len * sizeof(WCHAR ))))
+ if ((display_name = malloc( ++len * sizeof(WCHAR ))))
GetServiceDisplayNameW( scm, name, display_name, &len );
}
@@ -6209,8 +6249,8 @@ done:
if (service) CloseServiceHandle( service );
if (scm) CloseServiceHandle( scm );
- msi_free( name );
- msi_free( display_name );
+ free( name );
+ free( display_name );
return ERROR_SUCCESS;
}
@@ -6274,7 +6314,7 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param
)
len += lstrlenW(L"Setup=%s") + lstrlenW(setup_file->FileName);
len += lstrlenW(L"FileUsage=1") + 2; /* \0\0 */
- driver = msi_alloc(len * sizeof(WCHAR));
+ driver = malloc(len * sizeof(WCHAR));
if (!driver)
return ERROR_OUTOFMEMORY;
@@ -6300,7 +6340,7 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param
)
const WCHAR *dir = msi_get_target_folder( package,
driver_file->Component->Directory );
driver_file->TargetPath = msi_build_directory_name( 2, dir,
driver_file->FileName );
}
- driver_path = strdupW(driver_file->TargetPath);
+ driver_path = wcsdup(driver_file->TargetPath);
ptr = wcsrchr(driver_path, '\\');
if (ptr) *ptr = '\0';
@@ -6318,8 +6358,8 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param
)
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr );
- msi_free(driver);
- msi_free(driver_path);
+ free(driver);
+ free(driver_path);
return r;
}
@@ -6365,7 +6405,7 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID
param )
if (setup_file)
len += lstrlenW(L"Setup=%s") + lstrlenW(setup_file->FileName);
- translator = msi_alloc(len * sizeof(WCHAR));
+ translator = malloc(len * sizeof(WCHAR));
if (!translator)
return ERROR_OUTOFMEMORY;
@@ -6383,7 +6423,7 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID
param )
}
*ptr = '\0';
- translator_path = strdupW(translator_file->TargetPath);
+ translator_path = wcsdup(translator_file->TargetPath);
ptr = wcsrchr(translator_path, '\\');
if (ptr) *ptr = '\0';
@@ -6401,8 +6441,8 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID
param )
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr );
- msi_free(translator);
- msi_free(translator_path);
+ free(translator);
+ free(translator_path);
return r;
}
@@ -6439,7 +6479,7 @@ static UINT ITERATE_InstallODBCDataSource( MSIRECORD *rec, LPVOID
param )
else if (registration == msidbODBCDataSourceRegistrationPerUser) request =
ODBC_ADD_DSN;
len = lstrlenW(L"DSN=%s") + lstrlenW(desc) + 2; /* \0\0 */
- attrs = msi_alloc(len * sizeof(WCHAR));
+ attrs = malloc(len * sizeof(WCHAR));
if (!attrs)
return ERROR_OUTOFMEMORY;
@@ -6456,7 +6496,7 @@ static UINT ITERATE_InstallODBCDataSource( MSIRECORD *rec, LPVOID
param )
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr );
- msi_free(attrs);
+ free(attrs);
return r;
}
@@ -6605,7 +6645,7 @@ static UINT ITERATE_RemoveODBCDataSource( MSIRECORD *rec, LPVOID
param )
else if (registration == msidbODBCDataSourceRegistrationPerUser) request =
ODBC_REMOVE_DSN;
len = lstrlenW( L"DSN=%s" ) + lstrlenW( desc ) + 2; /* \0\0 */
- attrs = msi_alloc( len * sizeof(WCHAR) );
+ attrs = malloc( len * sizeof(WCHAR) );
if (!attrs)
return ERROR_OUTOFMEMORY;
@@ -6618,7 +6658,7 @@ static UINT ITERATE_RemoveODBCDataSource( MSIRECORD *rec, LPVOID
param )
{
WARN("Failed to remove ODBC data source\n");
}
- msi_free( attrs );
+ free( attrs );
uirow = MSI_CreateRecord( 3 );
MSI_RecordSetStringW( uirow, 1, desc );
@@ -6869,7 +6909,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID
param )
goto done;
}
size = (lstrlenW(value) + 1) * sizeof(WCHAR);
- newval = strdupW(value);
+ newval = wcsdup(value);
if (!newval)
{
res = ERROR_OUTOFMEMORY;
@@ -6887,9 +6927,9 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID
param )
goto done;
}
- if (!(p = q = data = msi_alloc( size )))
+ if (!(p = q = data = malloc( size )))
{
- msi_free(deformatted);
+ free(deformatted);
RegCloseKey(env);
return ERROR_OUTOFMEMORY;
}
@@ -6928,7 +6968,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID
param )
}
size = (len_value + 1 + lstrlenW( data ) + 1) * sizeof(WCHAR);
- if (!(p = newval = msi_alloc( size )))
+ if (!(p = newval = malloc( size )))
{
res = ERROR_OUTOFMEMORY;
goto done;
@@ -6968,9 +7008,9 @@ done:
msiobj_release( &uirow->hdr );
if (env) RegCloseKey(env);
- msi_free(deformatted);
- msi_free(data);
- msi_free(newval);
+ free(deformatted);
+ free(data);
+ free(newval);
return res;
}
@@ -7076,7 +7116,7 @@ static UINT ITERATE_RemoveEnvironmentString( MSIRECORD *rec, LPVOID
param )
if (res != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ))
goto done;
- if (!(new_value = msi_alloc( size ))) goto done;
+ if (!(new_value = malloc( size ))) goto done;
res = RegQueryValueExW( env, name, NULL, &type, (BYTE *)new_value, &size );
if (res != ERROR_SUCCESS)
@@ -7123,8 +7163,8 @@ done:
msiobj_release( &uirow->hdr );
if (env) RegCloseKey( env );
- msi_free( deformatted );
- msi_free( new_value );
+ free( deformatted );
+ free( new_value );
return r;
}
@@ -7153,7 +7193,7 @@ UINT msi_validate_product_id( MSIPACKAGE *package )
id = msi_dup_property( package->db, L"ProductID" );
if (id)
{
- msi_free( id );
+ free( id );
return ERROR_SUCCESS;
}
template = msi_dup_property( package->db, L"PIDTemplate" );
@@ -7167,8 +7207,8 @@ UINT msi_validate_product_id( MSIPACKAGE *package )
r = msi_set_property( package->db, L"ProductID", key, -1 );
#endif
}
- msi_free( template );
- msi_free( key );
+ free( template );
+ free( key );
return r;
}
@@ -7264,19 +7304,19 @@ static UINT ITERATE_RemoveExistingProducts( MSIRECORD *rec, LPVOID
param )
else
len += ARRAY_SIZE( L"ALL" );
- if (!(cmd = msi_alloc( len * sizeof(WCHAR) )))
+ if (!(cmd = malloc( len * sizeof(WCHAR) )))
{
- msi_free( product );
- msi_free( features );
+ free( product );
+ free( features );
return ERROR_OUTOFMEMORY;
}
swprintf( cmd, len, L"msiexec /qn /i %s REMOVE=%s", product, features ?
features : L"ALL" );
- msi_free( product );
- msi_free( features );
+ free( product );
+ free( features );
memset( &si, 0, sizeof(STARTUPINFOW) );
ret = CreateProcessW( NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &info
);
- msi_free( cmd );
+ free( cmd );
if (!ret) return GetLastError();
CloseHandle( info.hThread );
@@ -7362,21 +7402,11 @@ static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package )
return ERROR_SUCCESS;
}
-static BOOL msi_bind_image( MSIPACKAGE *package, const char *filename, const char *path
)
+static void bind_image( MSIPACKAGE *package, const char *filename, const char *path )
{
- BOOL ret;
msi_disable_fs_redirection( package );
- ret = BindImage( filename, path, NULL );
+ if (!BindImage( filename, path, NULL )) WARN( "failed to bind image %lu\n",
GetLastError() );
msi_revert_fs_redirection( package );
- return ret;
-}
-
-static void bind_image( MSIPACKAGE *package, const char *filename, const char *path )
-{
- if (!msi_bind_image( package, filename, path ))
- {
- WARN( "failed to bind image %lu\n", GetLastError() );
- }
}
static UINT ITERATE_BindImage( MSIRECORD *rec, LPVOID param )
@@ -7406,13 +7436,13 @@ static UINT ITERATE_BindImage( MSIRECORD *rec, LPVOID param )
if ((pathA = strdupWtoA( pathW )))
{
bind_image( package, filenameA, pathA );
- msi_free( pathA );
+ free( pathA );
}
- msi_free( pathW );
+ free( pathW );
}
}
- msi_free( path_list );
- msi_free( filenameA );
+ free( path_list );
+ free( filenameA );
return ERROR_SUCCESS;
}
@@ -7431,7 +7461,7 @@ static UINT ACTION_BindImage( MSIPACKAGE *package )
return ERROR_SUCCESS;
}
-static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, LPCSTR action, LPCWSTR
table )
+static UINT unimplemented_action_stub( MSIPACKAGE *package, LPCSTR action, LPCWSTR table
)
{
MSIQUERY *view;
DWORD count = 0;
@@ -7451,27 +7481,27 @@ static UINT msi_unimplemented_action_stub( MSIPACKAGE *package,
LPCSTR action, L
static UINT ACTION_IsolateComponents( MSIPACKAGE *package )
{
- return msi_unimplemented_action_stub( package, "IsolateComponents",
L"IsolateComponent" );
+ return unimplemented_action_stub( package, "IsolateComponents",
L"IsolateComponent" );
}
static UINT ACTION_RMCCPSearch( MSIPACKAGE *package )
{
- return msi_unimplemented_action_stub( package, "RMCCPSearch",
L"CCPSearch" );
+ return unimplemented_action_stub( package, "RMCCPSearch",
L"CCPSearch" );
}
static UINT ACTION_RegisterComPlus( MSIPACKAGE *package )
{
- return msi_unimplemented_action_stub( package, "RegisterComPlus",
L"Complus" );
+ return unimplemented_action_stub( package, "RegisterComPlus",
L"Complus" );
}
static UINT ACTION_UnregisterComPlus( MSIPACKAGE *package )
{
- return msi_unimplemented_action_stub( package, "UnregisterComPlus",
L"Complus" );
+ return unimplemented_action_stub( package, "UnregisterComPlus",
L"Complus" );
}
static UINT ACTION_InstallSFPCatalogFile( MSIPACKAGE *package )
{
- return msi_unimplemented_action_stub( package, "InstallSFPCatalogFile",
L"SFPCatalog" );
+ return unimplemented_action_stub( package, "InstallSFPCatalogFile",
L"SFPCatalog" );
}
static const struct
@@ -7720,7 +7750,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR
szPackagePath,
LPWSTR p, dir;
LPCWSTR file;
- dir = strdupW(szPackagePath);
+ dir = wcsdup(szPackagePath);
p = wcsrchr(dir, '\\');
if (p)
{
@@ -7729,24 +7759,24 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR
szPackagePath,
}
else
{
- msi_free(dir);
- dir = msi_alloc(MAX_PATH * sizeof(WCHAR));
+ free(dir);
+ dir = malloc(MAX_PATH * sizeof(WCHAR));
GetCurrentDirectoryW(MAX_PATH, dir);
lstrcatW(dir, L"\\");
file = szPackagePath;
}
- msi_free( package->PackagePath );
- package->PackagePath = msi_alloc((lstrlenW(dir) + lstrlenW(file) + 1) *
sizeof(WCHAR));
+ free(package->PackagePath);
+ package->PackagePath = malloc((wcslen(dir) + wcslen(file) + 1) *
sizeof(WCHAR));
if (!package->PackagePath)
{
- msi_free(dir);
+ free(dir);
return ERROR_OUTOFMEMORY;
}
lstrcpyW(package->PackagePath, dir);
lstrcatW(package->PackagePath, file);
- msi_free(dir);
+ free(dir);
msi_set_sourcedir_props(package, FALSE);
}
@@ -7774,10 +7804,10 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR
szPackagePath,
if (wcsicmp( productcode, package->ProductCode ))
{
TRACE( "product code changed %s -> %s\n",
debugstr_w(package->ProductCode), debugstr_w(productcode) );
- msi_free( package->ProductCode );
+ free( package->ProductCode );
package->ProductCode = productcode;
}
- else msi_free( productcode );
+ else free( productcode );
if (msi_get_property_int( package->db, L"DISABLEROLLBACK", 0 ))
{
@@ -7813,8 +7843,8 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR
szPackagePath,
WARN("installation failed, running rollback script\n");
execute_script( package, SCRIPT_ROLLBACK );
}
- msi_free( reinstall );
- msi_free( action );
+ free( reinstall );
+ free( action );
if (rc == ERROR_SUCCESS && package->need_reboot_at_end)
return ERROR_SUCCESS_REBOOT_REQUIRED;
diff --git a/dll/win32/msi/alter.c b/dll/win32/msi/alter.c
index 7d272118537..0b2b3cf5bc9 100644
--- a/dll/win32/msi/alter.c
+++ b/dll/win32/msi/alter.c
@@ -34,18 +34,18 @@
WINE_DEFAULT_DEBUG_CHANNEL(msidb);
-typedef struct tagMSIALTERVIEW
+struct alter_view
{
MSIVIEW view;
MSIDATABASE *db;
MSIVIEW *table;
column_info *colinfo;
INT hold;
-} MSIALTERVIEW;
+};
static UINT ALTER_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val )
{
- MSIALTERVIEW *av = (MSIALTERVIEW*)view;
+ struct alter_view *av = (struct alter_view *)view;
TRACE("%p %d %d %p\n", av, row, col, val );
@@ -54,7 +54,7 @@ static UINT ALTER_fetch_int( struct tagMSIVIEW *view, UINT row, UINT
col, UINT *
static UINT ALTER_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IStream
**stm)
{
- MSIALTERVIEW *av = (MSIALTERVIEW*)view;
+ struct alter_view *av = (struct alter_view *)view;
TRACE("%p %d %d %p\n", av, row, col, stm );
@@ -63,7 +63,7 @@ static UINT ALTER_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT
col, ISt
static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record )
{
- MSIALTERVIEW *av = (MSIALTERVIEW*)view;
+ struct alter_view *av = (struct alter_view *)view;
UINT ref;
TRACE("%p %p\n", av, record);
@@ -86,7 +86,7 @@ static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record
)
static UINT ALTER_close( struct tagMSIVIEW *view )
{
- MSIALTERVIEW *av = (MSIALTERVIEW*)view;
+ struct alter_view *av = (struct alter_view *)view;
TRACE("%p\n", av );
@@ -95,7 +95,7 @@ static UINT ALTER_close( struct tagMSIVIEW *view )
static UINT ALTER_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols )
{
- MSIALTERVIEW *av = (MSIALTERVIEW*)view;
+ struct alter_view *av = (struct alter_view *)view;
TRACE("%p %p %p\n", av, rows, cols );
@@ -105,7 +105,7 @@ static UINT ALTER_get_dimensions( struct tagMSIVIEW *view, UINT *rows,
UINT *col
static UINT ALTER_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name,
UINT *type, BOOL *temporary, LPCWSTR *table_name )
{
- MSIALTERVIEW *av = (MSIALTERVIEW*)view;
+ struct alter_view *av = (struct alter_view *)view;
TRACE("%p %d %p %p %p %p\n", av, n, name, type, temporary, table_name );
@@ -115,7 +115,7 @@ static UINT ALTER_get_column_info( struct tagMSIVIEW *view, UINT n,
LPCWSTR *nam
static UINT ALTER_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
MSIRECORD *rec, UINT row )
{
- MSIALTERVIEW *av = (MSIALTERVIEW*)view;
+ struct alter_view *av = (struct alter_view *)view;
TRACE("%p %d %p\n", av, eModifyMode, rec );
@@ -124,12 +124,12 @@ static UINT ALTER_modify( struct tagMSIVIEW *view, MSIMODIFY
eModifyMode,
static UINT ALTER_delete( struct tagMSIVIEW *view )
{
- MSIALTERVIEW *av = (MSIALTERVIEW*)view;
+ struct alter_view *av = (struct alter_view *)view;
TRACE("%p\n", av );
if (av->table)
av->table->ops->delete( av->table );
- msi_free( av );
+ free( av );
return ERROR_SUCCESS;
}
@@ -159,19 +159,19 @@ static const MSIVIEWOPS alter_ops =
UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_info
*colinfo, int hold )
{
- MSIALTERVIEW *av;
+ struct alter_view *av;
UINT r;
TRACE("%p %p %s %d\n", view, colinfo, debugstr_w(name), hold );
- av = msi_alloc_zero( sizeof *av );
+ av = calloc( 1, sizeof *av );
if( !av )
return ERROR_FUNCTION_FAILED;
r = TABLE_CreateView( db, name, &av->table );
if (r != ERROR_SUCCESS)
{
- msi_free( av );
+ free( av );
return r;
}
diff --git a/dll/win32/msi/appsearch.c b/dll/win32/msi/appsearch.c
index 77b12156ca8..381e74317fe 100644
--- a/dll/win32/msi/appsearch.c
+++ b/dll/win32/msi/appsearch.c
@@ -34,7 +34,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(msi);
-typedef struct tagMSISIGNATURE
+struct signature
{
LPCWSTR Name; /* NOT owned by this structure */
LPWSTR File;
@@ -47,7 +47,7 @@ typedef struct tagMSISIGNATURE
FILETIME MinTime;
FILETIME MaxTime;
LPWSTR Languages;
-}MSISIGNATURE;
+};
void msi_parse_version_string(LPCWSTR verStr, PDWORD ms, PDWORD ls)
{
@@ -80,7 +80,7 @@ void msi_parse_version_string(LPCWSTR verStr, PDWORD ms, PDWORD ls)
* Returns ERROR_SUCCESS upon success (where not finding the record counts as
* success), something else on error.
*/
-static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR *name )
+static UINT get_signature( MSIPACKAGE *package, struct signature *sig, const WCHAR *name
)
{
WCHAR *minVersion, *maxVersion, *p;
MSIRECORD *row;
@@ -109,13 +109,13 @@ static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig,
const WCHAR *
if (minVersion)
{
msi_parse_version_string( minVersion, &sig->MinVersionMS,
&sig->MinVersionLS );
- msi_free( minVersion );
+ free( minVersion );
}
maxVersion = msi_dup_record_field(row,4);
if (maxVersion)
{
msi_parse_version_string( maxVersion, &sig->MaxVersionMS,
&sig->MaxVersionLS );
- msi_free( maxVersion );
+ free( maxVersion );
}
sig->MinSize = MSI_RecordGetInteger(row,5);
if (sig->MinSize == MSI_NULL_INTEGER)
@@ -148,13 +148,13 @@ static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig,
const WCHAR *
}
/* Frees any memory allocated in sig */
-static void free_signature( MSISIGNATURE *sig )
+static void free_signature( struct signature *sig )
{
- msi_free(sig->File);
- msi_free(sig->Languages);
+ free(sig->File);
+ free(sig->Languages);
}
-static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig )
+static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, struct signature *sig )
{
VS_FIXEDFILEINFO *info;
DWORD attr;
@@ -169,7 +169,7 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path,
MSISIGNATURE *sig )
attr = msi_get_file_attributes( package, path );
if (attr != INVALID_FILE_ATTRIBUTES && (attr &
FILE_ATTRIBUTE_DIRECTORY))
- return strdupW(path);
+ return wcsdup(path);
return NULL;
}
@@ -180,9 +180,9 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path,
MSISIGNATURE *sig )
size = msi_get_file_version_info( package, path, 0, NULL );
if (!size)
- return strdupW(path);
+ return wcsdup(path);
- buffer = msi_alloc(size);
+ buffer = malloc(size);
if (!buffer)
return NULL;
@@ -213,14 +213,14 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path,
MSISIGNATURE *sig )
goto done;
}
- val = strdupW(path);
+ val = wcsdup(path);
done:
- msi_free(buffer);
+ free(buffer);
return val;
}
-static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig
)
+static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, struct signature
*sig )
{
MSIRECORD *row, *rec;
LPCWSTR signature, guid;
@@ -276,7 +276,7 @@ static UINT search_components( MSIPACKAGE *package, WCHAR **appValue,
MSISIGNATU
else
PathAddBackslashW(path);
- *appValue = strdupW(path);
+ *appValue = wcsdup(path);
}
else if (sigpresent)
{
@@ -285,7 +285,7 @@ static UINT search_components( MSIPACKAGE *package, WCHAR **appValue,
MSISIGNATU
attr = msi_get_file_attributes( package, path );
if (attr != INVALID_FILE_ATTRIBUTES && !(attr &
FILE_ATTRIBUTE_DIRECTORY))
- *appValue = strdupW(path);
+ *appValue = wcsdup(path);
}
done:
@@ -305,13 +305,13 @@ static void convert_reg_value( DWORD regType, const BYTE *value,
DWORD sz, WCHAR
if (*(LPCWSTR)value == '#')
{
/* escape leading pound with another */
- *appValue = msi_alloc(sz + sizeof(WCHAR));
+ *appValue = malloc(sz + sizeof(WCHAR));
(*appValue)[0] = '#';
lstrcpyW(*appValue + 1, (LPCWSTR)value);
}
else
{
- *appValue = msi_alloc(sz);
+ *appValue = malloc(sz);
lstrcpyW(*appValue, (LPCWSTR)value);
}
break;
@@ -319,17 +319,17 @@ static void convert_reg_value( DWORD regType, const BYTE *value,
DWORD sz, WCHAR
/* 7 chars for digits, 1 for NULL, 1 for #, and 1 for sign
* char if needed
*/
- *appValue = msi_alloc(10 * sizeof(WCHAR));
+ *appValue = malloc(10 * sizeof(WCHAR));
swprintf(*appValue, 10, L"#%d", *(const DWORD *)value);
break;
case REG_EXPAND_SZ:
sz = ExpandEnvironmentStringsW((LPCWSTR)value, NULL, 0);
- *appValue = msi_alloc(sz * sizeof(WCHAR));
+ *appValue = malloc(sz * sizeof(WCHAR));
ExpandEnvironmentStringsW((LPCWSTR)value, *appValue, sz);
break;
case REG_BINARY:
/* #x<nibbles>\0 */
- *appValue = msi_alloc((sz * 2 + 3) * sizeof(WCHAR));
+ *appValue = malloc((sz * 2 + 3) * sizeof(WCHAR));
lstrcpyW(*appValue, L"#x");
ptr = *appValue + lstrlenW(L"#x");
for (i = 0; i < sz; i++, ptr += 2)
@@ -341,9 +341,9 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD
sz, WCHAR
}
}
-static UINT search_directory( MSIPACKAGE *, MSISIGNATURE *, const WCHAR *, int, WCHAR **
);
+static UINT search_directory( MSIPACKAGE *, struct signature *, const WCHAR *, int, WCHAR
** );
-static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig )
+static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, struct signature *sig )
{
const WCHAR *keyPath, *valueName;
WCHAR *deformatted = NULL, *ptr = NULL, *end;
@@ -401,7 +401,7 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue,
MSISIGNATURE *sig
goto end;
}
- msi_free(deformatted);
+ free(deformatted);
deformat_string(package, valueName, &deformatted);
rc = RegQueryValueExW(key, deformatted, NULL, NULL, NULL, &sz);
@@ -413,7 +413,7 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue,
MSISIGNATURE *sig
/* FIXME: sanity-check sz before allocating (is there an upper-limit
* on the value of a property?)
*/
- value = msi_alloc( sz );
+ value = malloc(sz);
rc = RegQueryValueExW(key, deformatted, NULL, ®Type, value, &sz);
if (rc)
{
@@ -431,9 +431,9 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue,
MSISIGNATURE *sig
sz = ExpandEnvironmentStringsW((LPCWSTR)value, NULL, 0);
if (sz)
{
- LPWSTR buf = msi_alloc(sz * sizeof(WCHAR));
+ WCHAR *buf = malloc(sz * sizeof(WCHAR));
ExpandEnvironmentStringsW((LPCWSTR)value, buf, sz);
- msi_free(value);
+ free(value);
value = (LPBYTE)buf;
}
}
@@ -460,9 +460,9 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue,
MSISIGNATURE *sig
type, debugstr_w(keyPath), debugstr_w(valueName));
}
end:
- msi_free( value );
+ free( value );
RegCloseKey( key );
- msi_free( deformatted );
+ free( deformatted );
msiobj_release(&row->hdr);
return ERROR_SUCCESS;
@@ -474,7 +474,7 @@ static LPWSTR get_ini_field(LPWSTR buf, int field)
int i = 1;
if (field == 0)
- return strdupW(buf);
+ return wcsdup(buf);
beg = buf;
while ((end = wcschr(beg, ',')) && i < field)
@@ -491,10 +491,10 @@ static LPWSTR get_ini_field(LPWSTR buf, int field)
end = beg + lstrlenW(beg);
*end = '\0';
- return strdupW(beg);
+ return wcsdup(beg);
}
-static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig )
+static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue, struct signature *sig )
{
MSIRECORD *row;
LPWSTR fileName, section, key;
@@ -539,9 +539,9 @@ static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue,
MSISIGNATURE *sig
}
}
- msi_free(fileName);
- msi_free(section);
- msi_free(key);
+ free(fileName);
+ free(section);
+ free(key);
msiobj_release(&row->hdr);
@@ -578,27 +578,27 @@ static void expand_any_path( MSIPACKAGE *package, WCHAR *src, WCHAR
*dst, size_t
deformat_string(package, ptr, &deformatted);
if (!deformatted || lstrlenW(deformatted) > len - 1)
{
- msi_free(deformatted);
+ free(deformatted);
return;
}
lstrcpyW(dst, deformatted);
dst[lstrlenW(deformatted)] = '\0';
- msi_free(deformatted);
+ free(deformatted);
}
static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids )
{
UINT i, count = 1;
- WCHAR *str = strdupW( languages ), *p, *q;
+ WCHAR *str = wcsdup( languages ), *p, *q;
LANGID *ret;
if (!str) return NULL;
for (p = q = str; (q = wcschr( q, ',' )); q++) count++;
- if (!(ret = msi_alloc( count * sizeof(LANGID) )))
+ if (!(ret = malloc( count * sizeof(LANGID) )))
{
- msi_free( str );
+ free( str );
return NULL;
}
i = 0;
@@ -611,7 +611,7 @@ static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids
)
p = q + 1;
i++;
}
- msi_free( str );
+ free( str );
*num_ids = count;
return ret;
}
@@ -643,7 +643,7 @@ static BOOL match_languages( const void *version, const WCHAR
*languages )
}
done:
- msi_free( ids );
+ free( ids );
return found;
}
@@ -652,7 +652,7 @@ done:
* Return ERROR_SUCCESS in case of success (whether or not the file matches),
* something else if an install-halting error occurs.
*/
-static UINT file_version_matches( MSIPACKAGE *package, const MSISIGNATURE *sig, const
WCHAR *filePath,
+static UINT file_version_matches( MSIPACKAGE *package, const struct signature *sig, const
WCHAR *filePath,
BOOL *matches )
{
UINT len;
@@ -663,7 +663,7 @@ static UINT file_version_matches( MSIPACKAGE *package, const
MSISIGNATURE *sig,
*matches = FALSE;
if (!size) return ERROR_SUCCESS;
- if (!(version = msi_alloc( size ))) return ERROR_OUTOFMEMORY;
+ if (!(version = malloc( size ))) return ERROR_OUTOFMEMORY;
if (msi_get_file_version_info( package, filePath, size, version ))
VerQueryValueW( version, L"\\", (void **)&info, &len );
@@ -702,7 +702,7 @@ static UINT file_version_matches( MSIPACKAGE *package, const
MSISIGNATURE *sig,
}
else *matches = TRUE;
}
- msi_free( version );
+ free( version );
return ERROR_SUCCESS;
}
@@ -712,7 +712,7 @@ static UINT file_version_matches( MSIPACKAGE *package, const
MSISIGNATURE *sig,
* Return ERROR_SUCCESS in case of success (whether or not the file matches),
* something else if an install-halting error occurs.
*/
-static UINT file_matches_sig( MSIPACKAGE *package, const MSISIGNATURE *sig, const
WIN32_FIND_DATAW *findData,
+static UINT file_matches_sig( MSIPACKAGE *package, const struct signature *sig, const
WIN32_FIND_DATAW *findData,
const WCHAR *fullFilePath, BOOL *matches )
{
UINT rc = ERROR_SUCCESS;
@@ -757,7 +757,7 @@ static UINT file_matches_sig( MSIPACKAGE *package, const MSISIGNATURE
*sig, cons
* Returns ERROR_SUCCESS on success (which may include non-critical errors),
* something else on failures which should halt the install.
*/
-static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE
*sig, const WCHAR *dir,
+static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, struct
signature *sig, const WCHAR *dir,
int depth )
{
HANDLE hFind;
@@ -779,7 +779,7 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR
**appValue, MSI
* isn't backslash-terminated.
*/
len = dirLen + max(fileLen, lstrlenW(L"*.*")) + 2;
- buf = msi_alloc(len * sizeof(WCHAR));
+ buf = malloc(len * sizeof(WCHAR));
if (!buf)
return ERROR_OUTOFMEMORY;
@@ -839,7 +839,7 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR
**appValue, MSI
}
if (*appValue != buf)
- msi_free(buf);
+ free(buf);
return rc;
}
@@ -851,7 +851,7 @@ static UINT check_directory( MSIPACKAGE *package, const WCHAR *dir,
WCHAR **appV
if (attr != INVALID_FILE_ATTRIBUTES && (attr &
FILE_ATTRIBUTE_DIRECTORY))
{
TRACE("directory exists, returning %s\n", debugstr_w(dir));
- *appValue = strdupW(dir);
+ *appValue = wcsdup(dir);
}
return ERROR_SUCCESS;
@@ -871,11 +871,11 @@ static BOOL is_full_path( const WCHAR *path )
return ret;
}
-static UINT search_directory( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR *path,
int depth, WCHAR **appValue )
+static UINT search_directory( MSIPACKAGE *package, struct signature *sig, const WCHAR
*path, int depth, WCHAR **appValue )
{
UINT rc;
DWORD attr;
- LPWSTR val = NULL;
+ WCHAR *val = NULL, *new_val;
TRACE("%p, %p, %s, %d, %p\n", package, sig, debugstr_w(path), depth,
appValue);
@@ -920,11 +920,18 @@ static UINT search_directory( MSIPACKAGE *package, MSISIGNATURE
*sig, const WCHA
if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY)
&&
val && val[lstrlenW(val) - 1] != '\\')
{
- val = msi_realloc(val, (lstrlenW(val) + 2) * sizeof(WCHAR));
- if (!val)
+ new_val = realloc(val, (wcslen(val) + 2) * sizeof(WCHAR));
+ if (!new_val)
+ {
+ free(val);
+ val = NULL;
rc = ERROR_OUTOFMEMORY;
+ }
else
+ {
+ val = new_val;
PathAddBackslashW(val);
+ }
}
*appValue = val;
@@ -933,9 +940,9 @@ static UINT search_directory( MSIPACKAGE *package, MSISIGNATURE *sig,
const WCHA
return rc;
}
-static UINT search_sig_name( MSIPACKAGE *, const WCHAR *, MSISIGNATURE *, WCHAR ** );
+static UINT search_sig_name( MSIPACKAGE *, const WCHAR *, struct signature *, WCHAR **
);
-static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig )
+static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, struct signature *sig )
{
LPWSTR parent = NULL;
LPCWSTR parentName;
@@ -961,7 +968,7 @@ static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue,
MSISIGNATURE *sig
parentName = MSI_RecordGetString(row, 2);
if (parentName)
{
- MSISIGNATURE parentSig;
+ struct signature parentSig;
search_sig_name( package, parentName, &parentSig, &parent );
free_signature( &parentSig );
@@ -1004,13 +1011,13 @@ static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue,
MSISIGNATURE *sig
rc = search_directory( package, sig, path, depth, appValue );
- msi_free(parent);
+ free(parent);
msiobj_release(&row->hdr);
TRACE("returning %d\n", rc);
return rc;
}
-static UINT search_sig_name( MSIPACKAGE *package, const WCHAR *sigName, MSISIGNATURE
*sig, WCHAR **appValue )
+static UINT search_sig_name( MSIPACKAGE *package, const WCHAR *sigName, struct signature
*sig, WCHAR **appValue )
{
UINT rc;
@@ -1038,7 +1045,7 @@ static UINT ITERATE_AppSearch(MSIRECORD *row, LPVOID param)
MSIPACKAGE *package = param;
LPCWSTR propName, sigName;
LPWSTR value = NULL;
- MSISIGNATURE sig;
+ struct signature sig;
MSIRECORD *uirow;
UINT r;
@@ -1055,7 +1062,7 @@ static UINT ITERATE_AppSearch(MSIRECORD *row, LPVOID param)
if (r == ERROR_SUCCESS && !wcscmp( propName, L"SourceDir" ))
msi_reset_source_folders( package );
- msi_free(value);
+ free(value);
}
free_signature( &sig );
@@ -1095,7 +1102,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param)
MSIPACKAGE *package = param;
LPCWSTR signature;
LPWSTR value = NULL;
- MSISIGNATURE sig;
+ struct signature sig;
UINT r = ERROR_SUCCESS;
signature = MSI_RecordGetString(row, 1);
@@ -1107,7 +1114,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param)
{
TRACE("Found signature %s\n", debugstr_w(signature));
msi_set_property( package->db, L"CCP_Success", L"1", -1
);
- msi_free(value);
+ free(value);
r = ERROR_NO_MORE_ITEMS;
}
diff --git a/dll/win32/msi/assembly.c b/dll/win32/msi/assembly.c
index 9f75a9c0281..47e8071502c 100644
--- a/dll/win32/msi/assembly.c
+++ b/dll/win32/msi/assembly.c
@@ -30,55 +30,52 @@
WINE_DEFAULT_DEBUG_CHANNEL(msi);
-static BOOL load_fusion_dlls( MSIPACKAGE *package )
+static void load_fusion_dlls( MSIPACKAGE *package )
{
HRESULT (WINAPI *pLoadLibraryShim)( const WCHAR *, const WCHAR *, void *, HMODULE *
);
WCHAR path[MAX_PATH];
DWORD len = GetSystemDirectoryW( path, MAX_PATH );
lstrcpyW( path + len, L"\\mscoree.dll" );
- if (package->hmscoree || !(package->hmscoree = LoadLibraryW( path ))) return
TRUE;
+ if (!package->hmscoree && !(package->hmscoree = LoadLibraryW( path )))
return;
if (!(pLoadLibraryShim = (void *)GetProcAddress( package->hmscoree,
"LoadLibraryShim" )))
{
FreeLibrary( package->hmscoree );
package->hmscoree = NULL;
- return TRUE;
+ return;
}
- pLoadLibraryShim( L"fusion.dll", L"v1.0.3705", NULL,
&package->hfusion10 );
- pLoadLibraryShim( L"fusion.dll", L"v1.1.4322", NULL,
&package->hfusion11 );
- pLoadLibraryShim( L"fusion.dll", L"v2.0.50727", NULL,
&package->hfusion20 );
- pLoadLibraryShim( L"fusion.dll", L"v4.0.30319", NULL,
&package->hfusion40 );
-
- return TRUE;
+ if (!package->hfusion10) pLoadLibraryShim( L"fusion.dll",
L"v1.0.3705", NULL, &package->hfusion10 );
+ if (!package->hfusion11) pLoadLibraryShim( L"fusion.dll",
L"v1.1.4322", NULL, &package->hfusion11 );
+ if (!package->hfusion20) pLoadLibraryShim( L"fusion.dll",
L"v2.0.50727", NULL, &package->hfusion20 );
+ if (!package->hfusion40) pLoadLibraryShim( L"fusion.dll",
L"v4.0.30319", NULL, &package->hfusion40 );
}
-BOOL msi_init_assembly_caches( MSIPACKAGE *package )
+static BOOL init_assembly_caches( MSIPACKAGE *package )
{
HRESULT (WINAPI *pCreateAssemblyCache)( IAssemblyCache **, DWORD );
- if (package->cache_sxs) return TRUE;
- if (CreateAssemblyCache( &package->cache_sxs, 0 ) != S_OK) return FALSE;
+ if (!package->cache_sxs && CreateAssemblyCache(
&package->cache_sxs, 0 ) != S_OK) return FALSE;
- if (!load_fusion_dlls( package )) return FALSE;
+ load_fusion_dlls( package );
package->pGetFileVersion = (void *)GetProcAddress( package->hmscoree,
"GetFileVersion" ); /* missing from v1.0.3705 */
- if (package->hfusion10)
+ if (package->hfusion10 && !package->cache_net[CLR_VERSION_V10])
{
pCreateAssemblyCache = (void *)GetProcAddress( package->hfusion10,
"CreateAssemblyCache" );
pCreateAssemblyCache( &package->cache_net[CLR_VERSION_V10], 0 );
}
- if (package->hfusion11)
+ if (package->hfusion11 && !package->cache_net[CLR_VERSION_V11])
{
pCreateAssemblyCache = (void *)GetProcAddress( package->hfusion11,
"CreateAssemblyCache" );
pCreateAssemblyCache( &package->cache_net[CLR_VERSION_V11], 0 );
}
- if (package->hfusion20)
+ if (package->hfusion20 && !package->cache_net[CLR_VERSION_V20])
{
pCreateAssemblyCache = (void *)GetProcAddress( package->hfusion20,
"CreateAssemblyCache" );
pCreateAssemblyCache( &package->cache_net[CLR_VERSION_V20], 0 );
}
- if (package->hfusion40)
+ if (package->hfusion40 && !package->cache_net[CLR_VERSION_V40])
{
pCreateAssemblyCache = (void *)GetProcAddress( package->hfusion40,
"CreateAssemblyCache" );
pCreateAssemblyCache( &package->cache_net[CLR_VERSION_V40], 0 );
@@ -164,7 +161,7 @@ static UINT get_assembly_name_attribute( MSIRECORD *rec, LPVOID param
)
const WCHAR *value = MSI_RecordGetString( rec, 3 );
int len = lstrlenW( L"%s=\"%s\"" ) + lstrlenW( attr ) + lstrlenW(
value );
- if (!(name->attrs[name->index] = msi_alloc( len * sizeof(WCHAR) )))
+ if (!(name->attrs[name->index] = malloc( len * sizeof(WCHAR) )))
return ERROR_OUTOFMEMORY;
if (!wcsicmp( attr, L"name" )) lstrcpyW( name->attrs[name->index++],
value );
@@ -190,7 +187,7 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR
*comp, MSI
MSI_IterateRecords( view, &name.count, NULL, NULL );
if (!name.count) goto done;
- name.attrs = msi_alloc( name.count * sizeof(WCHAR *) );
+ name.attrs = malloc( name.count * sizeof(WCHAR *) );
if (!name.attrs) goto done;
MSI_IterateRecords( view, NULL, get_assembly_name_attribute, &name );
@@ -198,7 +195,7 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR
*comp, MSI
len = 0;
for (i = 0; i < name.count; i++) len += lstrlenW( name.attrs[i] ) + 1;
- display_name = msi_alloc( (len + 1) * sizeof(WCHAR) );
+ display_name = malloc( (len + 1) * sizeof(WCHAR) );
if (display_name)
{
display_name[0] = 0;
@@ -213,49 +210,31 @@ done:
msiobj_release( &view->hdr );
if (name.attrs)
{
- for (i = 0; i < name.count; i++) msi_free( name.attrs[i] );
- msi_free( name.attrs );
+ for (i = 0; i < name.count; i++) free( name.attrs[i] );
+ free( name.attrs );
}
return display_name;
}
-static BOOL is_assembly_installed( IAssemblyCache *cache, const WCHAR *display_name )
-{
- HRESULT hr;
- ASSEMBLY_INFO info;
-
- if (!cache) return FALSE;
-
- memset( &info, 0, sizeof(info) );
- info.cbAssemblyInfo = sizeof(info);
- hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, display_name, &info );
- if (hr == S_OK /* sxs version */ || hr == E_NOT_SUFFICIENT_BUFFER)
- {
- return (info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED);
- }
- TRACE( "QueryAssemblyInfo returned %#lx\n", hr );
- return FALSE;
-}
-
WCHAR *msi_get_assembly_path( MSIPACKAGE *package, const WCHAR *displayname )
{
HRESULT hr;
ASSEMBLY_INFO info;
- IAssemblyCache *cache = package->cache_net[CLR_VERSION_V40];
+ IAssemblyCache *cache;
- if (!cache) return NULL;
+ if (!init_assembly_caches( package ) || !(cache =
package->cache_net[CLR_VERSION_V40])) return NULL;
memset( &info, 0, sizeof(info) );
info.cbAssemblyInfo = sizeof(info);
hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, displayname, &info );
if (hr != E_NOT_SUFFICIENT_BUFFER) return NULL;
- if (!(info.pszCurrentAssemblyPathBuf = msi_alloc( info.cchBuf * sizeof(WCHAR) )))
return NULL;
+ if (!(info.pszCurrentAssemblyPathBuf = malloc( info.cchBuf * sizeof(WCHAR) ))) return
NULL;
hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, displayname, &info );
if (FAILED( hr ))
{
- msi_free( info.pszCurrentAssemblyPathBuf );
+ free( info.pszCurrentAssemblyPathBuf );
return NULL;
}
TRACE("returning %s\n", debugstr_w(info.pszCurrentAssemblyPathBuf));
@@ -270,13 +249,14 @@ IAssemblyEnum *msi_create_assembly_enum( MSIPACKAGE *package, const
WCHAR *displ
WCHAR *str;
DWORD len = 0;
- if (!package->pCreateAssemblyNameObject || !package->pCreateAssemblyEnum)
return NULL;
+ if (!init_assembly_caches( package ) || !package->pCreateAssemblyNameObject ||
!package->pCreateAssemblyEnum)
+ return NULL;
hr = package->pCreateAssemblyNameObject( &name, displayname,
CANOF_PARSE_DISPLAY_NAME, NULL );
if (FAILED( hr )) return NULL;
hr = IAssemblyName_GetName( name, &len, NULL );
- if (hr != E_NOT_SUFFICIENT_BUFFER || !(str = msi_alloc( len * sizeof(WCHAR) )))
+ if (hr != E_NOT_SUFFICIENT_BUFFER || !(str = malloc( len * sizeof(WCHAR) )))
{
IAssemblyName_Release( name );
return NULL;
@@ -286,12 +266,12 @@ IAssemblyEnum *msi_create_assembly_enum( MSIPACKAGE *package, const
WCHAR *displ
IAssemblyName_Release( name );
if (FAILED( hr ))
{
- msi_free( str );
+ free( str );
return NULL;
}
hr = package->pCreateAssemblyNameObject( &name, str, 0, NULL );
- msi_free( str );
+ free( str );
if (FAILED( hr )) return NULL;
hr = package->pCreateAssemblyEnum( &ret, NULL, name, ASM_CACHE_GAC, NULL );
@@ -309,31 +289,24 @@ static const WCHAR *clr_version[] =
L"v4.0.30319"
};
-static const WCHAR *get_clr_version_str( enum clr_version version )
-{
- if (version >= ARRAY_SIZE( clr_version )) return L"unknown";
- return clr_version[version];
-}
-
-/* assembly caches must be initialized */
MSIASSEMBLY *msi_load_assembly( MSIPACKAGE *package, MSICOMPONENT *comp )
{
MSIRECORD *rec;
MSIASSEMBLY *a;
if (!(rec = get_assembly_record( package, comp->Component ))) return NULL;
- if (!(a = msi_alloc_zero( sizeof(MSIASSEMBLY) )))
+ if (!(a = calloc( 1, sizeof(MSIASSEMBLY) )))
{
msiobj_release( &rec->hdr );
return NULL;
}
- a->feature = strdupW( MSI_RecordGetString( rec, 2 ) );
+ a->feature = wcsdup( MSI_RecordGetString( rec, 2 ) );
TRACE("feature %s\n", debugstr_w(a->feature));
- a->manifest = strdupW( MSI_RecordGetString( rec, 3 ) );
+ a->manifest = wcsdup( MSI_RecordGetString( rec, 3 ) );
TRACE("manifest %s\n", debugstr_w(a->manifest));
- a->application = strdupW( MSI_RecordGetString( rec, 4 ) );
+ a->application = wcsdup( MSI_RecordGetString( rec, 4 ) );
TRACE("application %s\n", debugstr_w(a->application));
a->attributes = MSI_RecordGetInteger( rec, 5 );
@@ -343,42 +316,14 @@ MSIASSEMBLY *msi_load_assembly( MSIPACKAGE *package, MSICOMPONENT
*comp )
{
WARN("can't get display name\n");
msiobj_release( &rec->hdr );
- msi_free( a->feature );
- msi_free( a->manifest );
- msi_free( a->application );
- msi_free( a );
+ free( a->feature );
+ free( a->manifest );
+ free( a->application );
+ free( a );
return NULL;
}
TRACE("display name %s\n", debugstr_w(a->display_name));
- if (a->application)
- {
- /* We can't check the manifest here because the target path may still
change.
- So we assume that the assembly is not installed and lean on the InstallFiles
- action to determine which files need to be installed.
- */
- a->installed = FALSE;
- }
- else
- {
- if (a->attributes == msidbAssemblyAttributesWin32)
- a->installed = is_assembly_installed( package->cache_sxs,
a->display_name );
- else
- {
- UINT i;
- for (i = 0; i < CLR_VERSION_MAX; i++)
- {
- a->clr_version[i] = is_assembly_installed( package->cache_net[i],
a->display_name );
- if (a->clr_version[i])
- {
- TRACE("runtime version %s\n",
debugstr_w(get_clr_version_str( i )));
- a->installed = TRUE;
- break;
- }
- }
- }
- }
- TRACE("assembly is %s\n", a->installed ? "installed" :
"not installed");
msiobj_release( &rec->hdr );
return a;
}
@@ -394,7 +339,7 @@ static enum clr_version get_clr_version( MSIPACKAGE *package, const
WCHAR *filen
hr = package->pGetFileVersion( filename, NULL, 0, &len );
if (hr != E_NOT_SUFFICIENT_BUFFER) return CLR_VERSION_V11;
- if ((strW = msi_alloc( len * sizeof(WCHAR) )))
+ if ((strW = malloc( len * sizeof(WCHAR) )))
{
hr = package->pGetFileVersion( filename, strW, len, &len );
if (hr == S_OK)
@@ -403,7 +348,7 @@ static enum clr_version get_clr_version( MSIPACKAGE *package, const
WCHAR *filen
for (i = 0; i < CLR_VERSION_MAX; i++)
if (!wcscmp( strW, clr_version[i] )) version = i;
}
- msi_free( strW );
+ free( strW );
}
return version;
}
@@ -416,6 +361,8 @@ UINT msi_install_assembly( MSIPACKAGE *package, MSICOMPONENT *comp )
MSIASSEMBLY *assembly = comp->assembly;
MSIFEATURE *feature = NULL;
+ if (!init_assembly_caches( package )) return ERROR_FUNCTION_FAILED;
+
if (comp->assembly->feature)
feature = msi_get_loaded_feature( package, comp->assembly->feature );
@@ -449,7 +396,6 @@ UINT msi_install_assembly( MSIPACKAGE *package, MSICOMPONENT *comp )
return ERROR_FUNCTION_FAILED;
}
if (feature) feature->Action = INSTALLSTATE_LOCAL;
- assembly->installed = TRUE;
return ERROR_SUCCESS;
}
@@ -460,6 +406,8 @@ UINT msi_uninstall_assembly( MSIPACKAGE *package, MSICOMPONENT *comp
)
MSIASSEMBLY *assembly = comp->assembly;
MSIFEATURE *feature = NULL;
+ if (!init_assembly_caches( package )) return ERROR_FUNCTION_FAILED;
+
if (comp->assembly->feature)
feature = msi_get_loaded_feature( package, comp->assembly->feature );
@@ -491,7 +439,6 @@ UINT msi_uninstall_assembly( MSIPACKAGE *package, MSICOMPONENT *comp
)
}
}
if (feature) feature->Action = INSTALLSTATE_ABSENT;
- assembly->installed = FALSE;
return ERROR_SUCCESS;
}
@@ -500,7 +447,7 @@ static WCHAR *build_local_assembly_path( const WCHAR *filename )
UINT i;
WCHAR *ret;
- if (!(ret = msi_alloc( (lstrlenW( filename ) + 1) * sizeof(WCHAR) )))
+ if (!(ret = malloc( (wcslen( filename ) + 1) * sizeof(WCHAR) )))
return NULL;
for (i = 0; filename[i]; i++)
@@ -543,12 +490,12 @@ static LONG open_local_assembly_key( UINT context, BOOL win32, const
WCHAR *file
if ((res = open_assemblies_key( context, win32, &root )))
{
- msi_free( path );
+ free( path );
return res;
}
res = RegCreateKeyW( root, path, hkey );
RegCloseKey( root );
- msi_free( path );
+ free( path );
return res;
}
@@ -563,12 +510,12 @@ static LONG delete_local_assembly_key( UINT context, BOOL win32,
const WCHAR *fi
if ((res = open_assemblies_key( context, win32, &root )))
{
- msi_free( path );
+ free( path );
return res;
}
res = RegDeleteKeyW( root, path );
RegCloseKey( root );
- msi_free( path );
+ free( path );
return res;
}
diff --git a/dll/win32/msi/automation.c b/dll/win32/msi/automation.c
index f8fd8cc1449..36891cc62da 100644
--- a/dll/win32/msi/automation.c
+++ b/dll/win32/msi/automation.c
@@ -41,33 +41,30 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
#define REG_INDEX_CLASSES_ROOT 0
#define REG_INDEX_DYN_DATA 6
-typedef struct AutomationObject AutomationObject;
+struct automation_object;
-/* function that is called from AutomationObject::Invoke, specific to this type of object
*/
-typedef HRESULT (*auto_invoke_func)(AutomationObject* This,
- DISPID dispIdMember, REFIID riid, LCID lcid, WORD flags, DISPPARAMS* pDispParams,
- VARIANT* result, EXCEPINFO* ei, UINT* arg_err);
-/* function that is called from AutomationObject::Release when the object is being
freed
- to free any private data structures (or NULL) */
-typedef void (*auto_free_func)(AutomationObject* This);
-
-typedef struct {
+struct tid_id
+{
REFIID riid;
- auto_invoke_func fn_invoke;
- auto_free_func fn_free;
-} tid_id_t;
-
+ /* function that is called from AutomationObject::Invoke, specific to this type of
object */
+ HRESULT (*fn_invoke)(struct automation_object *, DISPID, REFIID, LCID, WORD,
DISPPARAMS *, VARIANT *,
+ EXCEPINFO *, UINT *);
+ /* function that is called from AutomationObject::Release when the object is being
freed
+ to free any private data structures (or NULL) */
+ void (*fn_free)(struct automation_object *);
+};
-static HRESULT
database_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
-static HRESULT
installer_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
-static HRESULT
record_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
-static HRESULT
session_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
-static HRESULT
list_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
-static void list_free(AutomationObject*);
-static HRESULT
summaryinfo_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
-static HRESULT
view_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
+static HRESULT database_invoke(struct
automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
+static HRESULT installer_invoke(struct
automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
+static HRESULT record_invoke(struct
automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
+static HRESULT session_invoke(struct
automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
+static HRESULT list_invoke(struct
automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
+static void list_free(struct automation_object*);
+static HRESULT summaryinfo_invoke(struct
automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
+static HRESULT view_invoke(struct
automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
-static tid_id_t tid_ids[] = {
+static struct tid_id tid_ids[] =
+{
{ &DIID_Database, database_invoke },
{ &DIID_Installer, installer_invoke },
{ &DIID_Record, record_invoke },
@@ -137,10 +134,11 @@ void release_typelib(void)
}
/*
- * AutomationObject - "base" class for all automation objects. For each
interface, we implement Invoke function
- * called from AutomationObject::Invoke.
+ * struct automation_object - "base" class for all automation objects. For each
interface, we implement Invoke
+ * function called from AutomationObject::Invoke.
*/
-struct AutomationObject {
+struct automation_object
+{
IDispatch IDispatch_iface;
IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
LONG ref;
@@ -152,46 +150,49 @@ struct AutomationObject {
MSIHANDLE msiHandle;
};
-typedef struct {
- AutomationObject autoobj;
+struct list_object
+{
+ struct automation_object autoobj;
int count;
VARIANT *data;
-} ListObject;
+};
static HRESULT create_database(MSIHANDLE, IDispatch**);
-static HRESULT create_list_enumerator(ListObject*, void**);
+static HRESULT create_list_enumerator(struct list_object *, void **);
static HRESULT create_summaryinfo(MSIHANDLE, IDispatch**);
static HRESULT create_view(MSIHANDLE, IDispatch**);
-/* ListEnumerator - IEnumVARIANT implementation for MSI automation lists */
-typedef struct {
+/* struct list_enumerator - IEnumVARIANT implementation for MSI automation lists */
+struct list_enumerator
+{
IEnumVARIANT IEnumVARIANT_iface;
LONG ref;
- /* Current position and pointer to AutomationObject that stores actual data */
+ /* Current position and pointer to struct automation_object that stores actual data
*/
ULONG pos;
- ListObject *list;
-} ListEnumerator;
+ struct list_object *list;
+};
-typedef struct {
- AutomationObject autoobj;
+struct session_object
+{
+ struct automation_object autoobj;
IDispatch *installer;
-} SessionObject;
+};
-static inline AutomationObject *impl_from_IProvideMultipleClassInfo(
IProvideMultipleClassInfo *iface )
+static inline struct automation_object *impl_from_IProvideMultipleClassInfo(
IProvideMultipleClassInfo *iface )
{
- return CONTAINING_RECORD(iface, AutomationObject, IProvideMultipleClassInfo_iface);
+ return CONTAINING_RECORD(iface, struct automation_object,
IProvideMultipleClassInfo_iface);
}
-static inline AutomationObject *impl_from_IDispatch( IDispatch *iface )
+static inline struct automation_object *impl_from_IDispatch( IDispatch *iface )
{
- return CONTAINING_RECORD(iface, AutomationObject, IDispatch_iface);
+ return CONTAINING_RECORD(iface, struct automation_object, IDispatch_iface);
}
/* AutomationObject methods */
static HRESULT WINAPI AutomationObject_QueryInterface(IDispatch* iface, REFIID riid,
void** ppvObject)
{
- AutomationObject *This = impl_from_IDispatch(iface);
+ struct automation_object *This = impl_from_IDispatch(iface);
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid),
ppvObject);
@@ -221,7 +222,7 @@ static HRESULT WINAPI AutomationObject_QueryInterface(IDispatch*
iface, REFIID r
static ULONG WINAPI AutomationObject_AddRef(IDispatch* iface)
{
- AutomationObject *This = impl_from_IDispatch(iface);
+ struct automation_object *This = impl_from_IDispatch(iface);
TRACE("(%p/%p)\n", iface, This);
@@ -230,7 +231,7 @@ static ULONG WINAPI AutomationObject_AddRef(IDispatch* iface)
static ULONG WINAPI AutomationObject_Release(IDispatch* iface)
{
- AutomationObject *This = impl_from_IDispatch(iface);
+ struct automation_object *This = impl_from_IDispatch(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p/%p)\n", iface, This);
@@ -239,7 +240,7 @@ static ULONG WINAPI AutomationObject_Release(IDispatch* iface)
{
if (tid_ids[This->tid].fn_free) tid_ids[This->tid].fn_free(This);
MsiCloseHandle(This->msiHandle);
- msi_free(This);
+ free(This);
}
return ref;
@@ -249,7 +250,7 @@ static HRESULT WINAPI AutomationObject_GetTypeInfoCount(
IDispatch* iface,
UINT* pctinfo)
{
- AutomationObject *This = impl_from_IDispatch(iface);
+ struct automation_object *This = impl_from_IDispatch(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, pctinfo);
*pctinfo = 1;
@@ -262,7 +263,7 @@ static HRESULT WINAPI AutomationObject_GetTypeInfo(
LCID lcid,
ITypeInfo** ppTInfo)
{
- AutomationObject *This = impl_from_IDispatch(iface);
+ struct automation_object *This = impl_from_IDispatch(iface);
HRESULT hr;
TRACE( "(%p/%p)->(%u, %ld, %p)\n", iface, This, iTInfo, lcid, ppTInfo
);
@@ -283,7 +284,7 @@ static HRESULT WINAPI AutomationObject_GetIDsOfNames(
LCID lcid,
DISPID* rgDispId)
{
- AutomationObject *This = impl_from_IDispatch(iface);
+ struct automation_object *This = impl_from_IDispatch(iface);
ITypeInfo *ti;
HRESULT hr;
@@ -324,7 +325,7 @@ static HRESULT WINAPI AutomationObject_Invoke(
EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
- AutomationObject *This = impl_from_IDispatch(iface);
+ struct automation_object *This = impl_from_IDispatch(iface);
HRESULT hr;
unsigned int uArgErr;
VARIANT varResultDummy;
@@ -437,25 +438,25 @@ static HRESULT WINAPI ProvideMultipleClassInfo_QueryInterface(
REFIID riid,
VOID** ppvoid)
{
- AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface);
+ struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface);
return IDispatch_QueryInterface(&This->IDispatch_iface, riid, ppvoid);
}
static ULONG WINAPI ProvideMultipleClassInfo_AddRef(IProvideMultipleClassInfo* iface)
{
- AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface);
+ struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface);
return IDispatch_AddRef(&This->IDispatch_iface);
}
static ULONG WINAPI ProvideMultipleClassInfo_Release(IProvideMultipleClassInfo* iface)
{
- AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface);
+ struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface);
return IDispatch_Release(&This->IDispatch_iface);
}
static HRESULT WINAPI ProvideMultipleClassInfo_GetClassInfo(IProvideMultipleClassInfo*
iface, ITypeInfo** ppTI)
{
- AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface);
+ struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%p)\n", iface, This, ppTI);
@@ -469,7 +470,7 @@ static HRESULT WINAPI
ProvideMultipleClassInfo_GetClassInfo(IProvideMultipleClas
static HRESULT WINAPI ProvideMultipleClassInfo_GetGUID(IProvideMultipleClassInfo* iface,
DWORD dwGuidKind, GUID* pGUID)
{
- AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface);
+ struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface);
TRACE("(%p/%p)->(%lu, %s)\n", iface, This, dwGuidKind,
debugstr_guid(pGUID));
if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID)
@@ -482,7 +483,7 @@ static HRESULT WINAPI
ProvideMultipleClassInfo_GetGUID(IProvideMultipleClassInfo
static HRESULT WINAPI
ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo* iface, ULONG*
pcti)
{
- AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface);
+ struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, pcti);
*pcti = 1;
@@ -498,7 +499,7 @@ static HRESULT WINAPI
ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleCl
IID* piidPrimary,
IID* piidSource)
{
- AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface);
+ struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface);
TRACE("(%p/%p)->(%lu, %#lx, %p, %p, %p, %p, %p)\n", iface, This, iti,
dwFlags, ti, pdwTIFlags, pcdispidReserved,
piidPrimary, piidSource);
@@ -541,7 +542,7 @@ static const IProvideMultipleClassInfoVtbl
ProvideMultipleClassInfoVtbl =
ProvideMultipleClassInfo_GetInfoOfIndex
};
-static void init_automation_object(AutomationObject *This, MSIHANDLE msiHandle, tid_t
tid)
+static void init_automation_object(struct automation_object *This, MSIHANDLE msiHandle,
tid_t tid)
{
TRACE("%p, %lu, %s\n", This, msiHandle,
debugstr_guid(get_riid_from_tid(tid)));
@@ -556,15 +557,15 @@ static void init_automation_object(AutomationObject *This, MSIHANDLE
msiHandle,
* ListEnumerator methods
*/
-static inline ListEnumerator *impl_from_IEnumVARIANT(IEnumVARIANT* iface)
+static inline struct list_enumerator *impl_from_IEnumVARIANT(IEnumVARIANT* iface)
{
- return CONTAINING_RECORD(iface, ListEnumerator, IEnumVARIANT_iface);
+ return CONTAINING_RECORD(iface, struct list_enumerator, IEnumVARIANT_iface);
}
static HRESULT WINAPI ListEnumerator_QueryInterface(IEnumVARIANT* iface, REFIID riid,
void** ppvObject)
{
- ListEnumerator *This = impl_from_IEnumVARIANT(iface);
+ struct list_enumerator *This = impl_from_IEnumVARIANT(iface);
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid),
ppvObject);
@@ -590,7 +591,7 @@ static HRESULT WINAPI ListEnumerator_QueryInterface(IEnumVARIANT*
iface, REFIID
static ULONG WINAPI ListEnumerator_AddRef(IEnumVARIANT* iface)
{
- ListEnumerator *This = impl_from_IEnumVARIANT(iface);
+ struct list_enumerator *This = impl_from_IEnumVARIANT(iface);
TRACE("(%p/%p)\n", iface, This);
@@ -599,7 +600,7 @@ static ULONG WINAPI ListEnumerator_AddRef(IEnumVARIANT* iface)
static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface)
{
- ListEnumerator *This = impl_from_IEnumVARIANT(iface);
+ struct list_enumerator *This = impl_from_IEnumVARIANT(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p/%p)\n", iface, This);
@@ -607,7 +608,7 @@ static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface)
if (!ref)
{
if (This->list)
IDispatch_Release(&This->list->autoobj.IDispatch_iface);
- msi_free(This);
+ free(This);
}
return ref;
@@ -616,7 +617,7 @@ static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface)
static HRESULT WINAPI ListEnumerator_Next(IEnumVARIANT* iface, ULONG celt, VARIANT*
rgVar,
ULONG* fetched)
{
- ListEnumerator *This = impl_from_IEnumVARIANT(iface);
+ struct list_enumerator *This = impl_from_IEnumVARIANT(iface);
ULONG i, local;
TRACE("%p, %lu, %p, %p\n", iface, celt, rgVar, fetched);
@@ -640,7 +641,7 @@ static HRESULT WINAPI ListEnumerator_Next(IEnumVARIANT* iface, ULONG
celt, VARIA
static HRESULT WINAPI ListEnumerator_Skip(IEnumVARIANT* iface, ULONG celt)
{
- ListEnumerator *This = impl_from_IEnumVARIANT(iface);
+ struct list_enumerator *This = impl_from_IEnumVARIANT(iface);
TRACE("%p, %lu\n", iface, celt);
@@ -656,7 +657,7 @@ static HRESULT WINAPI ListEnumerator_Skip(IEnumVARIANT* iface, ULONG
celt)
static HRESULT WINAPI ListEnumerator_Reset(IEnumVARIANT* iface)
{
- ListEnumerator *This = impl_from_IEnumVARIANT(iface);
+ struct list_enumerator *This = impl_from_IEnumVARIANT(iface);
TRACE("(%p)\n", iface);
@@ -666,7 +667,7 @@ static HRESULT WINAPI ListEnumerator_Reset(IEnumVARIANT* iface)
static HRESULT WINAPI ListEnumerator_Clone(IEnumVARIANT* iface, IEnumVARIANT **ppEnum)
{
- ListEnumerator *This = impl_from_IEnumVARIANT(iface);
+ struct list_enumerator *This = impl_from_IEnumVARIANT(iface);
HRESULT hr;
TRACE("(%p,%p)\n", iface, ppEnum);
@@ -697,13 +698,13 @@ static const struct IEnumVARIANTVtbl ListEnumerator_Vtbl =
};
/* Create a list enumerator, placing the result in the pointer ppObj. */
-static HRESULT create_list_enumerator(ListObject *list, void **ppObj)
+static HRESULT create_list_enumerator(struct list_object *list, void **ppObj)
{
- ListEnumerator *object;
+ struct list_enumerator *object;
TRACE("(%p, %p)\n", list, ppObj);
- object = msi_alloc(sizeof(ListEnumerator));
+ object = malloc(sizeof(*object));
/* Set all the VTable references */
object->IEnumVARIANT_iface.lpVtbl = &ListEnumerator_Vtbl;
@@ -752,7 +753,7 @@ static HRESULT DispGetParam_CopyOnly(
}
static HRESULT summaryinfo_invoke(
- AutomationObject* This,
+ struct automation_object *This,
DISPID dispIdMember,
REFIID riid,
LCID lcid,
@@ -807,7 +808,7 @@ static HRESULT summaryinfo_invoke(
break;
case VT_LPSTR:
- if (!(str = msi_alloc(++size * sizeof(WCHAR))))
+ if (!(str = malloc(++size * sizeof(WCHAR))))
ERR("Out of memory\n");
else if ((ret = MsiSummaryInfoGetPropertyW(This->msiHandle,
V_I4(&varg0), &type, NULL,
NULL, str, &size))
!= ERROR_SUCCESS)
@@ -817,7 +818,7 @@ static HRESULT summaryinfo_invoke(
V_VT(pVarResult) = VT_BSTR;
V_BSTR(pVarResult) = SysAllocString(str);
}
- msi_free(str);
+ free(str);
break;
case VT_FILETIME:
@@ -904,7 +905,7 @@ static HRESULT summaryinfo_invoke(
}
static HRESULT record_invoke(
- AutomationObject* This,
+ struct automation_object *This,
DISPID dispIdMember,
REFIID riid,
LCID lcid,
@@ -941,11 +942,11 @@ static HRESULT record_invoke(
V_BSTR(pVarResult) = NULL;
if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0),
NULL, &dwLen)) == ERROR_SUCCESS)
{
- if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR))))
+ if (!(szString = malloc((++dwLen) * sizeof(WCHAR))))
ERR("Out of memory\n");
else if ((ret = MsiRecordGetStringW(This->msiHandle,
V_I4(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
V_BSTR(pVarResult) = SysAllocString(szString);
- msi_free(szString);
+ free(szString);
}
if (ret != ERROR_SUCCESS)
ERR("MsiRecordGetString returned %d\n", ret);
@@ -996,9 +997,9 @@ static HRESULT record_invoke(
static HRESULT create_record(MSIHANDLE msiHandle, IDispatch **disp)
{
- AutomationObject *record;
+ struct automation_object *record;
- record = msi_alloc(sizeof(*record));
+ record = malloc(sizeof(*record));
if (!record) return E_OUTOFMEMORY;
init_automation_object(record, msiHandle, Record_tid);
@@ -1009,7 +1010,7 @@ static HRESULT create_record(MSIHANDLE msiHandle, IDispatch
**disp)
}
static HRESULT list_invoke(
- AutomationObject* This,
+ struct automation_object *This,
DISPID dispIdMember,
REFIID riid,
LCID lcid,
@@ -1019,7 +1020,7 @@ static HRESULT list_invoke(
EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
- ListObject *list = CONTAINING_RECORD(This, ListObject, autoobj);
+ struct list_object *list = CONTAINING_RECORD(This, struct list_object, autoobj);
IUnknown *pUnk = NULL;
HRESULT hr;
@@ -1065,14 +1066,14 @@ static HRESULT list_invoke(
return S_OK;
}
-static void list_free(AutomationObject *This)
+static void list_free(struct automation_object *This)
{
- ListObject *list = CONTAINING_RECORD(This, ListObject, autoobj);
+ struct list_object *list = CONTAINING_RECORD(This, struct list_object, autoobj);
int i;
for (i = 0; i < list->count; i++)
VariantClear(&list->data[i]);
- msi_free(list->data);
+ free(list->data);
}
static HRESULT get_products_count(const WCHAR *product, int *len)
@@ -1105,11 +1106,11 @@ static HRESULT get_products_count(const WCHAR *product, int
*len)
static HRESULT create_list(const WCHAR *product, IDispatch **dispatch)
{
- ListObject *list;
+ struct list_object *list;
HRESULT hr;
int i;
- list = msi_alloc_zero(sizeof(ListObject));
+ list = calloc(1, sizeof(*list));
if (!list) return E_OUTOFMEMORY;
init_automation_object(&list->autoobj, 0, StringList_tid);
@@ -1123,7 +1124,7 @@ static HRESULT create_list(const WCHAR *product, IDispatch
**dispatch)
return hr;
}
- list->data = msi_alloc(list->count*sizeof(VARIANT));
+ list->data = malloc(list->count * sizeof(VARIANT));
if (!list->data)
{
IDispatch_Release(*dispatch);
@@ -1151,7 +1152,7 @@ static HRESULT create_list(const WCHAR *product, IDispatch
**dispatch)
}
static HRESULT view_invoke(
- AutomationObject* This,
+ struct automation_object *This,
DISPID dispIdMember,
REFIID riid,
LCID lcid,
@@ -1176,7 +1177,7 @@ static HRESULT view_invoke(
{
hr = DispGetParam(pDispParams, 0, VT_DISPATCH, &varg0, puArgErr);
if (SUCCEEDED(hr) && V_DISPATCH(&varg0) != NULL)
- MsiViewExecute(This->msiHandle, ((AutomationObject
*)V_DISPATCH(&varg0))->msiHandle);
+ MsiViewExecute(This->msiHandle, ((struct automation_object
*)V_DISPATCH(&varg0))->msiHandle);
else
MsiViewExecute(This->msiHandle, 0);
}
@@ -1211,7 +1212,8 @@ static HRESULT view_invoke(
hr = DispGetParam(pDispParams, 1, VT_DISPATCH, &varg1, puArgErr);
if (FAILED(hr)) return hr;
if (!V_DISPATCH(&varg1)) return DISP_E_EXCEPTION;
- if ((ret = MsiViewModify(This->msiHandle, V_I4(&varg0),
((AutomationObject *)V_DISPATCH(&varg1))->msiHandle)) != ERROR_SUCCESS)
+ if ((ret = MsiViewModify(This->msiHandle, V_I4(&varg0),
+ ((struct automation_object
*)V_DISPATCH(&varg1))->msiHandle)) != ERROR_SUCCESS)
{
VariantClear(&varg1);
ERR("MsiViewModify returned %d\n", ret);
@@ -1255,7 +1257,7 @@ static HRESULT DatabaseImpl_LastErrorRecord(WORD wFlags,
}
HRESULT database_invoke(
- AutomationObject* This,
+ struct automation_object *This,
DISPID dispIdMember,
REFIID riid,
LCID lcid,
@@ -1340,7 +1342,7 @@ HRESULT database_invoke(
}
static HRESULT session_invoke(
- AutomationObject* This,
+ struct automation_object *This,
DISPID dispIdMember,
REFIID riid,
LCID lcid,
@@ -1350,7 +1352,7 @@ static HRESULT session_invoke(
EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
- SessionObject *session = CONTAINING_RECORD(This, SessionObject, autoobj);
+ struct session_object *session = CONTAINING_RECORD(This, struct session_object,
autoobj);
WCHAR *szString;
DWORD dwLen = 0;
MSIHANDLE msiHandle;
@@ -1382,11 +1384,11 @@ static HRESULT session_invoke(
V_BSTR(pVarResult) = NULL;
if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), NULL,
&dwLen)) == ERROR_SUCCESS)
{
- if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR))))
+ if (!(szString = malloc((++dwLen) * sizeof(WCHAR))))
ERR("Out of memory\n");
else if ((ret = MsiGetPropertyW(This->msiHandle,
V_BSTR(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
V_BSTR(pVarResult) = SysAllocString(szString);
- msi_free(szString);
+ free(szString);
}
if (ret != ERROR_SUCCESS)
ERR("MsiGetProperty returned %d\n", ret);
@@ -1521,7 +1523,7 @@ static HRESULT session_invoke(
V_VT(pVarResult) = VT_I4;
V_I4(pVarResult) =
- MsiProcessMessage(This->msiHandle, V_I4(&varg0),
((AutomationObject *)V_DISPATCH(&varg1))->msiHandle);
+ MsiProcessMessage(This->msiHandle, V_I4(&varg0), ((struct
automation_object *)V_DISPATCH(&varg1))->msiHandle);
break;
case DISPID_SESSION_SETINSTALLLEVEL:
@@ -1619,7 +1621,7 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD
dwType, LPBYT
case REG_EXPAND_SZ:
if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString,
dwNewSize)))
ERR("ExpandEnvironmentStrings returned error %lu\n",
GetLastError());
- else if (!(szNewString = msi_alloc(dwNewSize * sizeof(WCHAR))))
+ else if (!(szNewString = malloc(dwNewSize * sizeof(WCHAR))))
ERR("Out of memory\n");
else if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString,
dwNewSize)))
ERR("ExpandEnvironmentStrings returned error %lu\n",
GetLastError());
@@ -1628,7 +1630,7 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD
dwType, LPBYT
V_VT(pVarResult) = VT_BSTR;
V_BSTR(pVarResult) = SysAllocStringLen(szNewString, dwNewSize);
}
- msi_free(szNewString);
+ free(szNewString);
break;
case REG_DWORD:
@@ -1682,7 +1684,7 @@ static HRESULT InstallerImpl_CreateRecord(WORD wFlags,
return create_record(hrec, &V_DISPATCH(pVarResult));
}
-static HRESULT InstallerImpl_OpenPackage(AutomationObject* This,
+static HRESULT InstallerImpl_OpenPackage(struct automation_object *This,
WORD wFlags,
DISPPARAMS* pDispParams,
VARIANT* pVarResult,
@@ -2047,7 +2049,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags,
goto done;
}
- szString = msi_alloc(size);
+ szString = malloc(size);
if (!szString)
{
hr = E_OUTOFMEMORY;
@@ -2058,14 +2060,14 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags,
&type, (LPBYTE)szString, &size);
if (ret != ERROR_SUCCESS)
{
- msi_free(szString);
+ free(szString);
hr = DISP_E_BADINDEX;
goto done;
}
variant_from_registry_value(pVarResult, type,
(LPBYTE)szString, size);
- msi_free(szString);
+ free(szString);
break;
/* Try to make it into VT_I4, can use VariantChangeType for this. */
@@ -2093,7 +2095,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags,
if (ret != ERROR_SUCCESS)
goto done;
- szString = msi_alloc(++size * sizeof(WCHAR));
+ szString = malloc(++size * sizeof(WCHAR));
if (!szString)
{
hr = E_OUTOFMEMORY;
@@ -2115,7 +2117,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags,
V_BSTR(pVarResult) = SysAllocString(szString);
}
- msi_free(szString);
+ free(szString);
}
done:
@@ -2245,7 +2247,7 @@ static HRESULT InstallerImpl_ProductInfo(WORD wFlags,
goto done;
}
- str = msi_alloc(++size * sizeof(WCHAR));
+ str = malloc(++size * sizeof(WCHAR));
if (!str)
{
hr = E_OUTOFMEMORY;
@@ -2263,7 +2265,7 @@ static HRESULT InstallerImpl_ProductInfo(WORD wFlags,
hr = S_OK;
done:
- msi_free(str);
+ free(str);
VariantClear(&varg0);
VariantClear(&varg1);
return hr;
@@ -2319,7 +2321,7 @@ static HRESULT InstallerImpl_RelatedProducts(WORD flags,
}
static HRESULT installer_invoke(
- AutomationObject* This,
+ struct automation_object *This,
DISPID dispIdMember,
REFIID riid,
LCID lcid,
@@ -2420,14 +2422,14 @@ static HRESULT installer_invoke(
HRESULT create_msiserver(IUnknown *outer, void **ppObj)
{
- AutomationObject *installer;
+ struct automation_object *installer;
TRACE("(%p %p)\n", outer, ppObj);
if (outer)
return CLASS_E_NOAGGREGATION;
- installer = msi_alloc(sizeof(AutomationObject));
+ installer = malloc(sizeof(*installer));
if (!installer) return E_OUTOFMEMORY;
init_automation_object(installer, 0, Installer_tid);
@@ -2439,9 +2441,9 @@ HRESULT create_msiserver(IUnknown *outer, void **ppObj)
HRESULT create_session(MSIHANDLE msiHandle, IDispatch *installer, IDispatch **disp)
{
- SessionObject *session;
+ struct session_object *session;
- session = msi_alloc(sizeof(SessionObject));
+ session = malloc(sizeof(*session));
if (!session) return E_OUTOFMEMORY;
init_automation_object(&session->autoobj, msiHandle, Session_tid);
@@ -2454,11 +2456,11 @@ HRESULT create_session(MSIHANDLE msiHandle, IDispatch *installer,
IDispatch **di
static HRESULT create_database(MSIHANDLE msiHandle, IDispatch **dispatch)
{
- AutomationObject *database;
+ struct automation_object *database;
TRACE("%lu %p\n", msiHandle, dispatch);
- database = msi_alloc(sizeof(AutomationObject));
+ database = malloc(sizeof(*database));
if (!database) return E_OUTOFMEMORY;
init_automation_object(database, msiHandle, Database_tid);
@@ -2470,11 +2472,11 @@ static HRESULT create_database(MSIHANDLE msiHandle, IDispatch
**dispatch)
static HRESULT create_view(MSIHANDLE msiHandle, IDispatch **dispatch)
{
- AutomationObject *view;
+ struct automation_object *view;
TRACE("%lu %p\n", msiHandle, dispatch);
- view = msi_alloc(sizeof(AutomationObject));
+ view = malloc(sizeof(*view));
if (!view) return E_OUTOFMEMORY;
init_automation_object(view, msiHandle, View_tid);
@@ -2486,9 +2488,9 @@ static HRESULT create_view(MSIHANDLE msiHandle, IDispatch
**dispatch)
static HRESULT create_summaryinfo(MSIHANDLE msiHandle, IDispatch **disp)
{
- AutomationObject *info;
+ struct automation_object *info;
- info = msi_alloc(sizeof(*info));
+ info = malloc(sizeof(*info));
if (!info) return E_OUTOFMEMORY;
init_automation_object(info, msiHandle, SummaryInfo_tid);
diff --git a/dll/win32/msi/classes.c b/dll/win32/msi/classes.c
index b2c94fa0ff5..ca0e59170e6 100644
--- a/dll/win32/msi/classes.c
+++ b/dll/win32/msi/classes.c
@@ -49,7 +49,7 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */
- appid = msi_alloc_zero( sizeof(MSIAPPID) );
+ appid = calloc( 1, sizeof(MSIAPPID) );
if (!appid)
return NULL;
@@ -108,7 +108,7 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */
- progid = msi_alloc_zero( sizeof(MSIPROGID) );
+ progid = calloc( 1, sizeof(MSIPROGID) );
if (!progid)
return NULL;
@@ -137,9 +137,9 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
FilePath = msi_build_icon_path(package, FileName);
- progid->IconPath = msi_alloc( (lstrlenW(FilePath) + 10) * sizeof(WCHAR) );
+ progid->IconPath = malloc( (wcslen(FilePath) + 10) * sizeof(WCHAR) );
swprintf( progid->IconPath, lstrlenW(FilePath) + 10, L"%s,%d",
FilePath, icon_index );
- msi_free(FilePath);
+ free(FilePath);
}
else
{
@@ -203,7 +203,7 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */
- cls = msi_alloc_zero( sizeof(MSICLASS) );
+ cls = calloc( 1, sizeof(MSICLASS) );
if (!cls)
return NULL;
@@ -235,9 +235,9 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
FilePath = msi_build_icon_path(package, FileName);
- cls->IconPath = msi_alloc( (lstrlenW(FilePath) + 5) * sizeof(WCHAR) );
+ cls->IconPath = malloc( (wcslen(FilePath) + 5) * sizeof(WCHAR) );
swprintf( cls->IconPath, lstrlenW(FilePath) + 5, L"%s,%d", FilePath,
icon_index );
- msi_free(FilePath);
+ free(FilePath);
}
else
{
@@ -254,14 +254,14 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
switch(i)
{
case 1:
- cls->DefInprocHandler = strdupW(L"ole2.dll");
+ cls->DefInprocHandler = wcsdup(L"ole2.dll");
break;
case 2:
- cls->DefInprocHandler32 = strdupW(L"ole32.dll");
+ cls->DefInprocHandler32 = wcsdup(L"ole32.dll");
break;
case 3:
- cls->DefInprocHandler = strdupW(L"ole2.dll");
- cls->DefInprocHandler32 = strdupW(L"ole32.dll");
+ cls->DefInprocHandler = wcsdup(L"ole2.dll");
+ cls->DefInprocHandler32 = wcsdup(L"ole32.dll");
break;
}
}
@@ -324,7 +324,7 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */
- mt = msi_alloc_zero( sizeof(MSIMIME) );
+ mt = calloc( 1, sizeof(MSIMIME) );
if (!mt)
return mt;
@@ -333,7 +333,7 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
extension = MSI_RecordGetString( row, 2 );
mt->Extension = load_given_extension( package, extension );
- mt->suffix = strdupW( extension );
+ mt->suffix = wcsdup( extension );
mt->clsid = msi_dup_record_field( row, 3 );
mt->Class = load_given_class( package, mt->clsid );
@@ -377,7 +377,7 @@ static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD
*row )
/* fill in the data */
- ext = msi_alloc_zero( sizeof(MSIEXTENSION) );
+ ext = calloc( 1, sizeof(MSIEXTENSION) );
if (!ext)
return NULL;
@@ -454,7 +454,7 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param)
/* fill in the data */
- verb = msi_alloc_zero( sizeof(MSIVERB) );
+ verb = calloc( 1, sizeof(MSIVERB) );
if (!verb)
return ERROR_OUTOFMEMORY;
@@ -768,7 +768,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
if (cls->Argument)
size += lstrlenW(cls->Argument)+1;
- argument = msi_alloc( size * sizeof(WCHAR) );
+ argument = malloc( size * sizeof(WCHAR) );
lstrcpyW( argument, file->TargetPath );
if (cls->Argument)
@@ -778,7 +778,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
}
msi_reg_set_val_str( hkey3, NULL, argument );
- msi_free(argument);
+ free(argument);
RegCloseKey(hkey3);
@@ -829,12 +829,12 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
ptr2 = wcschr(ptr,';');
if (ptr2)
*ptr2 = 0;
- keyname = msi_alloc( (lstrlenW(L"FileType\\%s\\%d") +
lstrlenW(cls->clsid) + 4) * sizeof(WCHAR));
+ keyname = malloc( sizeof(L"FileType\\%s\\%d") +
(wcslen(cls->clsid) + 3) * sizeof(WCHAR) );
swprintf( keyname, lstrlenW(L"FileType\\%s\\%d") +
lstrlenW(cls->clsid) + 4,
L"FileType\\%s\\%d", cls->clsid, index );
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, ptr );
- msi_free(keyname);
+ free( keyname );
if (ptr2)
ptr = ptr2+1;
@@ -926,13 +926,13 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package )
}
if (cls->FileTypeMask)
{
- filetype = msi_alloc( (lstrlenW( L"FileType\\" ) + lstrlenW(
cls->clsid ) + 1) * sizeof(WCHAR) );
+ filetype = malloc( sizeof( L"FileType\\" ) + wcslen( cls->clsid
) * sizeof(WCHAR) );
if (filetype)
{
lstrcpyW( filetype, L"FileType\\" );
lstrcatW( filetype, cls->clsid );
res = RegDeleteTreeW( HKEY_CLASSES_ROOT, filetype );
- msi_free( filetype );
+ free( filetype );
if (res != ERROR_SUCCESS)
WARN("failed to delete file type %ld\n", res);
@@ -1140,14 +1140,14 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
size += lstrlenW(verb->Argument);
size += 4;
- command = msi_alloc(size * sizeof (WCHAR));
+ command = malloc(size * sizeof(WCHAR));
if (verb->Argument)
swprintf(command, size, L"\"%s\" %s",
component->FullKeypath, verb->Argument);
else
swprintf(command, size, L"\"%s\"",
component->FullKeypath);
msi_reg_set_val_str( key, NULL, command );
- msi_free(command);
+ free(command);
advertise = msi_create_component_advertise_string(package, component,
extension->Feature->Feature);
... 32779 lines suppressed ...