Skip to content
This repository was archived by the owner on May 24, 2026. It is now read-only.

Commit d48ad1c

Browse files
committed
Try to fix access violation exception
1 parent b699e5a commit d48ad1c

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

msi-interop/handle_table.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "handle_table.h"
22
#include <glib.h>
33
#include <gsf/gsf-utils.h>
4+
#include "libmsi.h"
45

56
typedef struct {
67
GObject *obj;
@@ -247,5 +248,9 @@ static void
247248
handle_table_auto_init(void)
248249
{
249250
gsf_init();
251+
g_type_ensure(libmsi_database_get_type());
252+
g_type_ensure(libmsi_query_get_type());
253+
g_type_ensure(libmsi_record_get_type());
254+
g_type_ensure(libmsi_summary_info_get_type());
250255
handle_table_init();
251256
}

msi-interop/query.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *phRecord)
164164
if (!query)
165165
return ERROR_INVALID_HANDLE;
166166

167+
if (!query->view || !query->view->ops || !query->database) {
168+
g_object_unref(query);
169+
return ERROR_FUNCTION_FAILED;
170+
}
171+
167172
GError *error = NULL;
168173
LibmsiRecord *rec = libmsi_query_fetch(query, &error);
169174
g_object_unref(query);

msi-interop/string_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#include <stddef.h>
55
#include "msi_interop.h"
66

7+
#ifndef _WIN32
78
typedef unsigned short WCHAR;
9+
#endif
810

911
char *utf16_to_utf8(const WCHAR *utf16);
1012

0 commit comments

Comments
 (0)