diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
commit | 5a3b54c78ce63d899f76dbb3db72e4894b40bd53 (patch) | |
tree | 50693d13eeefc4d683bdf5417f0861b0ef274a0c /osdep/windows_utils.c | |
parent | Adding debian version 0.37.0-1. (diff) | |
download | mpv-5a3b54c78ce63d899f76dbb3db72e4894b40bd53.tar.xz mpv-5a3b54c78ce63d899f76dbb3db72e4894b40bd53.zip |
Merging upstream version 0.38.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | osdep/windows_utils.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/osdep/windows_utils.c b/osdep/windows_utils.c index 8cedf93..91eef62 100644 --- a/osdep/windows_utils.c +++ b/osdep/windows_utils.c @@ -24,9 +24,12 @@ #include <audioclient.h> #include <d3d9.h> #include <dxgi1_2.h> +#include <ole2.h> +#include <shobjidl.h> #include "common/common.h" #include "windows_utils.h" +#include "mpv_talloc.h" char *mp_GUID_to_str_buf(char *buf, size_t buf_size, const GUID *guid) { @@ -227,3 +230,22 @@ error: *server = *client = INVALID_HANDLE_VALUE; return false; } + +wchar_t *mp_w32_get_shell_link_target(wchar_t *path) +{ + IShellLink *psl = NULL; + IPersistFile *ppf = NULL; + wchar_t *buf = talloc_array(NULL, wchar_t, MAX_PATH + 1); + + if (FAILED(CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLinkW, (void**)&psl)) || + FAILED(IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (void**)&ppf)) || + FAILED(IPersistFile_Load(ppf, path, STGM_READ)) || + FAILED(IShellLinkW_GetPath(psl, buf, MAX_PATH, NULL, 0))) + { + TA_FREEP(&buf); + } + + SAFE_RELEASE(psl); + SAFE_RELEASE(ppf); + return buf; +} |