ReactOS 0.4.15-dev-8419-g7f0e8a3
CGlobalFolderSettings Class Reference

#include <globalfoldersettings.h>

Inheritance diagram for CGlobalFolderSettings:
Collaboration diagram for CGlobalFolderSettings:

Public Member Functions

 CGlobalFolderSettings ()
 
 ~CGlobalFolderSettings ()
 
STDMETHOD() Get (struct DEFFOLDERSETTINGS *pFDS, UINT cb) override
 
STDMETHOD() Set (const struct DEFFOLDERSETTINGS *pFDS, UINT cb, UINT unknown) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 

Static Public Member Functions

static HRESULT ResetBrowserSettings ()
 
static HRESULT SaveBrowserSettings (const SBFOLDERSETTINGS &sbfs)
 
static HRESULT Load (DEFFOLDERSETTINGS &dfs)
 
static HRESULT Save (const DEFFOLDERSETTINGS *pFDS)
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 

Additional Inherited Members

- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 37 of file globalfoldersettings.h.

Constructor & Destructor Documentation

◆ CGlobalFolderSettings()

CGlobalFolderSettings::CGlobalFolderSettings ( )

Definition at line 69 of file globalfoldersettings.cpp.

70{
71}

◆ ~CGlobalFolderSettings()

CGlobalFolderSettings::~CGlobalFolderSettings ( )

Definition at line 73 of file globalfoldersettings.cpp.

74{
75}

Member Function Documentation

◆ Get()

HRESULT STDMETHODCALLTYPE CGlobalFolderSettings::Get ( struct DEFFOLDERSETTINGS pFDS,
UINT  cb 
)
override

Definition at line 143 of file globalfoldersettings.cpp.

144{
145 if (cb != sizeof(DEFFOLDERSETTINGS) || !pFDS)
146 return E_INVALIDARG;
147 return Load(*pFDS);
148}
static HRESULT Load(DEFFOLDERSETTINGS &dfs)
#define E_INVALIDARG
Definition: ddrawi.h:101
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33

◆ Load()

HRESULT CGlobalFolderSettings::Load ( DEFFOLDERSETTINGS dfs)
static

Definition at line 90 of file globalfoldersettings.cpp.

91{
92 HKEY hStreamsKey = SHGetShellKey(SHKEY_Key_Explorer, L"Streams", FALSE);
93 if (hStreamsKey)
94 {
95 DWORD cb = sizeof(DEFFOLDERSETTINGS);
97 SRRF_RT_REG_BINARY, NULL, &dfs, &cb);
98 RegCloseKey(hStreamsKey);
100 {
102 {
104 }
106 {
107 dfs.vid = DEFAULT_VID;
108 }
109 if (cb <= FIELD_OFFSET(DEFFOLDERSETTINGS, ViewPriority))
110 {
112 }
113 dfs.ViewPriority = VIEW_PRIORITY_STALECACHEHIT;
114 EnsureValid(dfs);
115 return S_OK;
116 }
117 }
119 return S_FALSE;
120}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
HKEY WINAPI SHGetShellKey(DWORD flags, LPCWSTR sub_key, BOOL create)
Definition: ordinal.c:4585
unsigned long DWORD
Definition: ntddk_ex.h:95
static void EnsureValid(FOLDERSETTINGS &fs)
#define DEFAULT_VID
static void InitializeDefaults(DEFFOLDERSETTINGS &dfs)
#define CURRENT_VERSION
#define DEFBROWSERSTREAM
#define S_OK
Definition: intsafe.h:52
@ SHKEY_Key_Explorer
Definition: ordinal.c:2806
#define L(x)
Definition: ntvdm.h:50
#define err(...)
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 SRRF_RT_REG_BINARY
Definition: shlwapi.h:244
SHELLVIEWID vid
Definition: shlobj_undoc.h:158
FOLDERSETTINGS FolderSettings
Definition: shlobj_undoc.h:157
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
#define S_FALSE
Definition: winerror.h:2357

Referenced by Get(), and SBFOLDERSETTINGS::Load().

◆ ResetBrowserSettings()

HRESULT CGlobalFolderSettings::ResetBrowserSettings ( )
static

Definition at line 77 of file globalfoldersettings.cpp.

78{
79 return Save(NULL);
80}
static HRESULT Save(const DEFFOLDERSETTINGS *pFDS)

Referenced by CShellBrowser::ApplyBrowserDefaultFolderSettings().

◆ Save()

HRESULT CGlobalFolderSettings::Save ( const DEFFOLDERSETTINGS pFDS)
static

Definition at line 122 of file globalfoldersettings.cpp.

123{
124 HKEY hStreamsKey = SHGetShellKey(SHKEY_Key_Explorer, L"Streams", TRUE);
125 if (!hStreamsKey)
126 return E_FAIL;
127
129 if (!pFDS)
130 {
133 }
134 else
135 {
136 DWORD cb = sizeof(DEFFOLDERSETTINGS);
138 }
139 RegCloseKey(hStreamsKey);
140 return hr;
141}
#define E_FAIL
Definition: ddrawi.h:102
#define TRUE
Definition: types.h:120
DWORD WINAPI SHDeleteValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue)
Definition: reg.c:1762
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define REG_BINARY
Definition: nt_native.h:1496
HRESULT HResultFromWin32(DWORD hr)
Definition: shellutils.h:70
HRESULT hr
Definition: shlfolder.c:183

Referenced by ResetBrowserSettings(), SaveBrowserSettings(), and Set().

◆ SaveBrowserSettings()

HRESULT CGlobalFolderSettings::SaveBrowserSettings ( const SBFOLDERSETTINGS sbfs)
static

Definition at line 82 of file globalfoldersettings.cpp.

83{
86 CopyTo(sbfs, dfs);
87 return Save(&dfs);
88}
static void CopyTo(const S &Src, D &Dst)

Referenced by CShellBrowser::ApplyBrowserDefaultFolderSettings().

◆ Set()

HRESULT STDMETHODCALLTYPE CGlobalFolderSettings::Set ( const struct DEFFOLDERSETTINGS pFDS,
UINT  cb,
UINT  unknown 
)
override

Definition at line 150 of file globalfoldersettings.cpp.

151{
152 // NULL pFDS means reset
153 if (cb != sizeof(DEFFOLDERSETTINGS) && pFDS)
154 return E_INVALIDARG;
155 return Save(pFDS);
156}

The documentation for this class was generated from the following files: