glib/gio/gwin32packageparser.h
Руслан Ижбулатов e9b09911f6 gio: Add g_win32_package_parser_enum_packages()
This function enumerates all user-accessible UWP packages
and calls the user-provided callback for each package.

This can be used to make GLib aware of the UWP applications
installed in the system.

The function works by using IPackageManager/IPackage UWP interfaces
and XmlLite COM library to parse package manifests.

The function requires COM, and initializes it to a single-thread
appartment model. To ensure this doesn't break anything, either
only use it in a separate thread (COM is initialized on a per-thread
basis), or make sure that the main thread also uses the same COM
model (it's OK to initialize COM multiple times, as long as the same
model is used and as long as init/uninit calls are paired correctly).
2020-12-23 01:43:38 +00:00

48 lines
1.9 KiB
C
Executable File

/* GIO - GLib Input, Output and Streaming Library
*
* Copyright (C) 2020 Руслан Ижбулатов <lrn1986@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __G_WIN32_PACKAGE_PARSER_H__
#define __G_WIN32_PACKAGE_PARSER_H__
#include <gio/gio.h>
#ifdef G_PLATFORM_WIN32
typedef struct _GWin32PackageExtGroup GWin32PackageExtGroup;
struct _GWin32PackageExtGroup
{
GPtrArray *verbs;
GPtrArray *extensions;
};
typedef gboolean (*GWin32PackageParserCallback)(gpointer user_data,
const gunichar2 *full_package_name,
const gunichar2 *package_name,
const gunichar2 *app_user_model_id,
gboolean show_in_applist,
GPtrArray *supported_extgroups,
GPtrArray *supported_protocols);
gboolean g_win32_package_parser_enum_packages (GWin32PackageParserCallback callback,
gpointer user_data,
GError **error);
#endif /* G_PLATFORM_WIN32 */
#endif /* __G_WIN32_PACKAGE_PARSER_H__ */