ReactOS 0.4.15-dev-7931-gfd331f1
Debug.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Zip Shell Extension
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Zip extraction
5 * COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
6 */
7
8#include "precomp.h"
9
10static bool GetInterfaceName(const WCHAR* InterfaceString, WCHAR* buf, size_t size)
11{
12 WCHAR LocalBuf[100];
13 DWORD dwType = 0, dwDataSize = size * sizeof(WCHAR);
14
15 if (!SUCCEEDED(StringCchPrintfW(LocalBuf, _countof(LocalBuf), L"Interface\\%s", InterfaceString)))
16 return false;
17
18 return SHRegGetValueW(HKEY_CLASSES_ROOT, LocalBuf, NULL, RRF_RT_REG_SZ, &dwType, buf, &dwDataSize) == ERROR_SUCCESS;
19}
20
22{
23 static WCHAR buf[2][300];
24 static int idx = 0;
25
26 idx ^= 1;
27
28 LPOLESTR tmp;
29 HRESULT hr = ProgIDFromCLSID(iid, &tmp);
30 if (SUCCEEDED(hr))
31 {
32 wcscpy(buf[idx], tmp);
33 CoTaskMemFree(tmp);
34 return buf[idx];
35 }
38 {
39 return buf[idx];
40 }
42
43 return buf[idx];
44}
WCHAR * guid2string(REFCLSID iid)
Definition: Debug.cpp:21
static bool GetInterfaceName(const WCHAR *InterfaceString, WCHAR *buf, size_t size)
Definition: Debug.cpp:10
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
unsigned int idx
Definition: utils.c:41
HRESULT WINAPI DECLSPEC_HOTPATCH ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID)
Definition: compobj.c:2530
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
#define RRF_RT_REG_SZ
Definition: driver.c:575
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static LPOLESTR
Definition: stg_prop.c:27
#define L(x)
Definition: ntvdm.h:50
#define REFCLSID
Definition: guiddef.h:117
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
HRESULT hr
Definition: shlfolder.c:183
LSTATUS WINAPI SHRegGetValueW(_In_ HKEY hkey, _In_opt_ LPCWSTR pszSubKey, _In_opt_ LPCWSTR pszValue, _In_ SRRF srrfFlags, _Out_opt_ LPDWORD pdwType, _Out_writes_bytes_to_opt_(*pcbData, *pcbData) LPVOID pvData, _Inout_opt_ LPDWORD pcbData)
#define _countof(array)
Definition: sndvol32.h:68
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
__wchar_t WCHAR
Definition: xmlstorage.h:180