From 584213c5ffeca09b3fe24bd5e92f73fd057ac642 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 3 Jun 2022 17:49:15 -0500 Subject: Add RegReadUnexpandedString to get an unexpanded REG_EXPAND_SZ value. --- src/libs/dutil/WixToolset.DUtil/inc/regutil.h | 44 ++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'src/libs/dutil/WixToolset.DUtil/inc/regutil.h') diff --git a/src/libs/dutil/WixToolset.DUtil/inc/regutil.h b/src/libs/dutil/WixToolset.DUtil/inc/regutil.h index 76d2d7cb..f5b40291 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/regutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/regutil.h @@ -99,6 +99,15 @@ typedef LSTATUS (APIENTRY *PFN_REGDELETEVALUEW)( __in HKEY hKey, __in_opt LPCWSTR lpValueName ); +typedef LSTATUS(APIENTRY *PFN_REGGETVALUEW)( + __in HKEY hkey, + __in_opt LPCWSTR lpSubKey, + __in_opt LPCWSTR lpValue, + __in DWORD dwFlags, + __out_opt LPDWORD pdwType, + __out_bcount_part_opt(*pcbData, *pcbData) __out_data_source(REGISTRY) PVOID pvData, + __inout_opt LPDWORD pcbData + ); /******************************************************************** RegInitialize - initializes regutil @@ -126,9 +135,17 @@ void DAPI RegFunctionOverride( __in_opt PFN_REGQUERYINFOKEYW pfnRegQueryInfoKeyW, __in_opt PFN_REGQUERYVALUEEXW pfnRegQueryValueExW, __in_opt PFN_REGSETVALUEEXW pfnRegSetValueExW, - __in_opt PFN_REGDELETEVALUEW pfnRegDeleteValueW + __in_opt PFN_REGDELETEVALUEW pfnRegDeleteValueW, + __in_opt PFN_REGGETVALUEW pfnRegGetValueW ); +/******************************************************************** + RegFunctionForceFallback - ignore functions only available in newer versions of Windows. + Typically used for unit testing. + +*********************************************************************/ +void DAPI RegFunctionForceFallback(); + /******************************************************************** RegCreate - creates a registry key. @@ -219,6 +236,20 @@ HRESULT DAPI RegGetType( __out DWORD *pdwType ); +/******************************************************************** + RegReadBinary - reads a registry key value. + If fExpand is TRUE and the value is REG_EXPAND_SZ then it will be expanded. + NOTE: caller is responsible for freeing *ppbBuffer +*********************************************************************/ +HRESULT DAPI RegReadValue( + __in HKEY hk, + __in_z_opt LPCWSTR wzName, + __in BOOL fExpand, + __deref_out_bcount_opt(*pcbBuffer) BYTE** ppbBuffer, + __inout SIZE_T* pcbBuffer, + __out DWORD* pdwType + ); + /******************************************************************** RegReadBinary - reads a registry key binary value. NOTE: caller is responsible for freeing *ppbBuffer @@ -240,6 +271,17 @@ HRESULT DAPI RegReadString( __deref_out_z LPWSTR* psczValue ); +/******************************************************************** + RegReadUnexpandedString - reads a registry key value as a string without expanding it. + +*********************************************************************/ +HRESULT DAPI RegReadUnexpandedString( + __in HKEY hk, + __in_z_opt LPCWSTR wzName, + __inout BOOL* pfNeedsExpansion, + __deref_out_z LPWSTR* psczValue + ); + /******************************************************************** RegReadStringArray - reads a registry key value REG_MULTI_SZ value as a string array. -- cgit v1.2.3-55-g6feb