Commit Graph

5 Commits

Author SHA1 Message Date
Philip Withnall
5942cd7984 gio: Add SPDX license headers automatically
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.

This commit was entirely generated using the command:
```
git ls-files gio/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-05-18 09:18:52 +01:00
Emmanuel Fleury
f9b4a557b1 Fix signedness warning in gio/gwin32packageparser.c
gio/gwin32packageparser.c: In function 'WIN32_FROM_HRESULT':
gio/gwin32packageparser.c:99:30: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'long int'
   if ((hresult & 0xFFFF0000) == MAKE_HRESULT (SEVERITY_ERROR, FACILITY_WIN32, 0) ||
                              ^~
2021-11-17 14:40:28 +01:00
Jonathan Boeing
032eceb9a1 gwin32packageparser: Fix read past end of buffer
g_win32_package_parser_enum_packages() reads beyond the end of a buffer
when doing a memcpy.  With app verifier enabled on Windows, it causes
the application to crash on startup.

This change limits the memcpy to the size of the source string.

Fixes: #2454
2021-08-04 09:19:30 -07:00
Philip Withnall
9acebef777 gwin32: Use gsize internally in g_wcsdup()
This allows it to handle strings up to length `G_MAXSIZE` — previously
it would overflow with such strings.

Update the several copies of it identically.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2319
2021-02-04 16:17:21 +00:00
Руслан Ижбулатов
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