ReactOS 0.4.17-dev-357-ga8f14ff
propbag.cpp File Reference
#include "precomp.h"
#include <shlwapi.h>
#include <shlwapi_undoc.h>
#include <shlobj_undoc.h>
#include <shlguid_undoc.h>
#include <atlstr.h>
#include <atlsimpcoll.h>
#include <atlcomcli.h>
#include <atlconv.h>
#include <strsafe.h>
#include <cstdlib>
#include <new>
Include dependency graph for propbag.cpp:

Go to the source code of this file.

Classes

class  CBasePropertyBag
 
struct  CPropMapEqual
 
class  CMemPropertyBag
 
class  CRegPropertyBag
 
class  CIniPropertyBag
 
class  CDesktopUpgradePropertyBag
 
struct  tagOLD_STREAM_HEADER
 
class  CViewStatePropertyBag
 

Macros

#define _ATL_NO_EXCEPTIONS
 
#define MODE_CAN_READ(dwMode)    (((dwMode) & (STGM_READ | STGM_WRITE | STGM_READWRITE)) != STGM_WRITE)
 
#define MODE_CAN_WRITE(dwMode)    (((dwMode) & (STGM_READ | STGM_WRITE | STGM_READWRITE)) != STGM_READ)
 

Typedefs

typedef DWORDLONG DESKVIEW_FLAGS
 
typedef struct tagOLD_STREAM_HEADER OLD_STREAM_HEADER
 
typedef struct tagOLD_STREAM_HEADERPOLD_STREAM_HEADER
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
EXTERN_C HRESULT WINAPI SHCreatePropertyBagOnMemory (_In_ DWORD dwMode, _In_ REFIID riid, _Out_ void **ppvObj)
 
EXTERN_C HRESULT WINAPI SHCreatePropertyBagOnRegKey (_In_ HKEY hKey, _In_z_ LPCWSTR pszSubKey, _In_ DWORD dwMode, _In_ REFIID riid, _Out_ void **ppvObj)
 
EXTERN_C DWORD WINAPI SHGetIniStringW (_In_z_ LPCWSTR appName, _In_z_ LPCWSTR keyName, _Out_writes_to_(outLen, return+1) LPWSTR out, _In_ DWORD outLen, _In_z_ LPCWSTR filename)
 
static BOOL Is7BitClean (LPCWSTR psz)
 
EXTERN_C BOOL WINAPI SHSetIniStringW (_In_z_ LPCWSTR appName, _In_z_ LPCWSTR keyName, _In_opt_z_ LPCWSTR str, _In_z_ LPCWSTR filename)
 
EXTERN_C DWORD WINAPI SHGetIniStringUTF7W (_In_opt_z_ LPCWSTR lpAppName, _In_z_ LPCWSTR lpKeyName, _Out_writes_to_(nSize, return+1) _Post_z_ LPWSTR lpReturnedString, _In_ DWORD nSize, _In_z_ LPCWSTR lpFileName)
 
EXTERN_C BOOL WINAPI SHSetIniStringUTF7W (_In_z_ LPCWSTR lpAppName, _In_z_ LPCWSTR lpKeyName, _In_opt_z_ LPCWSTR lpString, _In_z_ LPCWSTR lpFileName)
 
EXTERN_C HRESULT WINAPI SHCreatePropertyBagOnProfileSection (_In_z_ LPCWSTR lpFileName, _In_opt_z_ LPCWSTR pszSection, _In_ DWORD dwMode, _In_ REFIID riid, _Out_ void **ppvObj)
 
HRESULT SHGetDesktopUpgradePropertyBag (REFIID riid, void **ppvObj)
 
static HRESULT BindCtx_CreateWithMode (DWORD dwMode, IBindCtx **ppbc)
 
static BOOL SHIsRemovableDrive (LPCITEMIDLIST pidl)
 
EXTERN_C HRESULT WINAPI SHGetViewStatePropertyBag (_In_opt_ PCIDLIST_ABSOLUTE pidl, _In_opt_ LPCWSTR bag_name, _In_ DWORD flags, _In_ REFIID riid, _Outptr_ void **ppv)
 
EXTERN_C VOID FreeViewStatePropertyBagCache (VOID)
 
EXTERN_C INT WINAPI SHGetPerScreenResName (_Out_writes_(cchBuffer) LPWSTR pszBuffer, _In_ INT cchBuffer, _In_ DWORD dwReserved)
 
EXTERN_C HRESULT WINAPI IUnknown_QueryServicePropertyBag (_In_ IUnknown *punk, _In_ long flags, _In_ REFIID riid, _Outptr_ void **ppvObj)
 

Variables

CComPtr< CViewStatePropertyBagg_pCachedBag
 
CRITICAL_SECTION g_csBagCacheLock
 

Macro Definition Documentation

◆ _ATL_NO_EXCEPTIONS

#define _ATL_NO_EXCEPTIONS

Definition at line 8 of file propbag.cpp.

◆ MODE_CAN_READ

#define MODE_CAN_READ (   dwMode)     (((dwMode) & (STGM_READ | STGM_WRITE | STGM_READWRITE)) != STGM_WRITE)

Definition at line 24 of file propbag.cpp.

◆ MODE_CAN_WRITE

#define MODE_CAN_WRITE (   dwMode)     (((dwMode) & (STGM_READ | STGM_WRITE | STGM_READWRITE)) != STGM_READ)

Definition at line 26 of file propbag.cpp.

Typedef Documentation

◆ DESKVIEW_FLAGS

Definition at line 1060 of file propbag.cpp.

◆ OLD_STREAM_HEADER

◆ POLD_STREAM_HEADER

Function Documentation

◆ BindCtx_CreateWithMode()

static HRESULT BindCtx_CreateWithMode ( DWORD  dwMode,
IBindCtx **  ppbc 
)
static

Definition at line 1527 of file propbag.cpp.

1528{
1529 HRESULT hr = ::CreateBindCtx(0, ppbc);
1530 if (FAILED(hr))
1531 return hr;
1532
1533 IBindCtx *pbc = *ppbc;
1534
1535 BIND_OPTS opts = { sizeof(opts) };
1536 opts.grfMode = dwMode;
1537 hr = pbc->SetBindOptions(&opts);
1538 if (FAILED(hr))
1539 {
1540 pbc->Release();
1541 *ppbc = NULL;
1542 }
1543
1544 return hr;
1545}
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
HRESULT SetBindOptions([in] BIND_OPTS *pbindopts)
ULONG Release()
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT WINAPI CreateBindCtx(DWORD reserved, IBindCtx **bind_context)
Definition: bindctx.c:491

Referenced by CViewStatePropertyBag::_CreateBag().

◆ FreeViewStatePropertyBagCache()

EXTERN_C VOID FreeViewStatePropertyBagCache ( VOID  )

Definition at line 1944 of file propbag.cpp.

1945{
1947 g_pCachedBag.Release();
1949}
CRITICAL_SECTION g_csBagCacheLock
Definition: propbag.cpp:1325
CComPtr< CViewStatePropertyBag > g_pCachedBag
Definition: propbag.cpp:1322
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by DllMain().

◆ Is7BitClean()

static BOOL Is7BitClean ( LPCWSTR  psz)
static

Definition at line 648 of file propbag.cpp.

649{
650 if (!psz)
651 return TRUE;
652
653 while (*psz)
654 {
655 if (*psz > 0x7F)
656 return FALSE;
657 ++psz;
658 }
659 return TRUE;
660}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

Referenced by SHSetIniStringW().

◆ IUnknown_QueryServicePropertyBag()

EXTERN_C HRESULT WINAPI IUnknown_QueryServicePropertyBag ( _In_ IUnknown punk,
_In_ long  flags,
_In_ REFIID  riid,
_Outptr_ void **  ppvObj 
)

Definition at line 1986 of file propbag.cpp.

1991{
1992 TRACE("%p 0x%x %p %p\n", punk, flags, &riid, ppvObj);
1993
1995 HRESULT hr = IUnknown_QueryService(punk, SID_STopLevelBrowser, IID_IShellBrowserService,
1996 (void **)&pService);
1997 if (FAILED(hr))
1998 {
1999 ERR("0x%X\n", hr);
2000 return hr;
2001 }
2002
2003 return pService->GetPropertyBag(flags, riid, ppvObj);
2004}
#define ERR(fmt,...)
Definition: precomp.h:57
HRESULT WINAPI IUnknown_QueryService(IUnknown *obj, REFGUID sid, REFIID iid, void **out)
Definition: main.c:181
GLbitfield flags
Definition: glext.h:7161
REFIID riid
Definition: atlbase.h:39
_In_opt_ IUnknown * punk
Definition: shlwapi.h:158
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by CDefView::LoadViewState(), and CDefView::SaveViewState().

◆ SHCreatePropertyBagOnMemory()

EXTERN_C HRESULT WINAPI SHCreatePropertyBagOnMemory ( _In_ DWORD  dwMode,
_In_ REFIID  riid,
_Out_ void **  ppvObj 
)

Definition at line 260 of file propbag.cpp.

261{
262 TRACE("0x%08X, %s, %p\n", dwMode, debugstr_guid(&riid), ppvObj);
263
264 *ppvObj = NULL;
265
266 CComPtr<CMemPropertyBag> pMemBag(new(std::nothrow) CMemPropertyBag(dwMode));
267 if (!pMemBag)
268 return E_OUTOFMEMORY;
269
270 return pMemBag->QueryInterface(riid, ppvObj);
271}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_guid
Definition: kernel32.h:35

Referenced by SHCreatePropertyBag(), and SHPropertyBag_OnMemory().

◆ SHCreatePropertyBagOnProfileSection()

EXTERN_C HRESULT WINAPI SHCreatePropertyBagOnProfileSection ( _In_z_ LPCWSTR  lpFileName,
_In_opt_z_ LPCWSTR  pszSection,
_In_ DWORD  dwMode,
_In_ REFIID  riid,
_Out_ void **  ppvObj 
)

Definition at line 975 of file propbag.cpp.

981{
983 PWCHAR pchFileTitle;
984 WCHAR szBuff[MAX_PATH];
985
986 if (dwMode & STGM_CREATE)
987 {
991 {
992 pchFileTitle = PathFindFileNameW(lpFileName);
993 if (lstrcmpiW(pchFileTitle, L"desktop.ini") == 0)
994 {
995 StrCpyNW(szBuff, lpFileName, _countof(szBuff));
996 if (PathRemoveFileSpecW(szBuff))
997 PathMakeSystemFolderW(szBuff);
998 }
1000 }
1001 }
1002
1003 *ppvObj = NULL;
1004
1007
1008 CComPtr<CIniPropertyBag> pIniPB(new(std::nothrow) CIniPropertyBag(dwMode));
1009 if (!pIniPB)
1010 return E_OUTOFMEMORY;
1011
1012 HRESULT hr = pIniPB->Init(lpFileName, pszSection);
1013 if (FAILED(hr))
1014 {
1015 ERR("0x%08X\n", hr);
1016 return hr;
1017 }
1018
1019 return pIniPB->QueryInterface(riid, ppvObj);
1020}
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1677
BOOL WINAPI PathRemoveFileSpecW(WCHAR *path)
Definition: path.c:1121
BOOL WINAPI PathFileExistsW(const WCHAR *path)
Definition: path.c:2583
WCHAR *WINAPI StrCpyNW(WCHAR *dst, const WCHAR *src, int count)
Definition: string.c:470
BOOL WINAPI PathMakeSystemFolderW(LPCWSTR lpszPath)
Definition: path.c:1150
#define L(x)
Definition: resources.c:13
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define CREATE_NEW
Definition: disk.h:69
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
_In_ HANDLE hFile
Definition: mswsock.h:90
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define STGM_CREATE
Definition: objbase.h:945
short WCHAR
Definition: pedump.c:58
#define _countof(array)
Definition: sndvol32.h:70
uint16_t * PWCHAR
Definition: typedefs.h:56
_In_ LPCSTR lpFileName
Definition: winbase.h:2800
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210

Referenced by SHPropertyBag_OnIniFile().

◆ SHCreatePropertyBagOnRegKey()

EXTERN_C HRESULT WINAPI SHCreatePropertyBagOnRegKey ( _In_ HKEY  hKey,
_In_z_ LPCWSTR  pszSubKey,
_In_ DWORD  dwMode,
_In_ REFIID  riid,
_Out_ void **  ppvObj 
)

Definition at line 583 of file propbag.cpp.

589{
590 TRACE("%p, %s, 0x%08X, %s, %p\n", hKey, debugstr_w(pszSubKey), dwMode,
591 debugstr_guid(&riid), ppvObj);
592
593 *ppvObj = NULL;
594
595 CComPtr<CRegPropertyBag> pRegBag(new(std::nothrow) CRegPropertyBag(dwMode));
596 if (!pRegBag)
597 return E_OUTOFMEMORY;
598
599 HRESULT hr = pRegBag->Init(hKey, pszSubKey);
600 if (FAILED(hr))
601 return hr;
602
603 return pRegBag->QueryInterface(riid, ppvObj);
604}
FxAutoRegKey hKey
#define debugstr_w
Definition: kernel32.h:32
_In_opt_ LPCSTR pszSubKey
Definition: shlwapi.h:783

Referenced by CViewStatePropertyBag::_CreateBag(), and CViewStatePropertyBag::_FindNearestInheritBag().

◆ SHGetDesktopUpgradePropertyBag()

HRESULT SHGetDesktopUpgradePropertyBag ( REFIID  riid,
void **  ppvObj 
)

Definition at line 1209 of file propbag.cpp.

1210{
1211 *ppvObj = NULL;
1213 if (!pPropBag)
1214 return E_OUTOFMEMORY;
1215 return pPropBag->QueryInterface(riid, ppvObj);
1216}

Referenced by CViewStatePropertyBag::_EnsureUpgradeBag().

◆ SHGetIniStringUTF7W()

EXTERN_C DWORD WINAPI SHGetIniStringUTF7W ( _In_opt_z_ LPCWSTR  lpAppName,
_In_z_ LPCWSTR  lpKeyName,
_Out_writes_to_(nSize, return+1) _Post_z_ LPWSTR  lpReturnedString,
_In_ DWORD  nSize,
_In_z_ LPCWSTR  lpFileName 
)

Definition at line 732 of file propbag.cpp.

738{
739 if (*lpKeyName == L'@') // UTF-7
740 return SHGetIniStringW(lpAppName, lpKeyName + 1, lpReturnedString, nSize, lpFileName);
741
742 return GetPrivateProfileStringW(lpAppName, lpKeyName, L"", lpReturnedString, nSize, lpFileName);
743}
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
EXTERN_C DWORD WINAPI SHGetIniStringW(_In_z_ LPCWSTR appName, _In_z_ LPCWSTR keyName, _Out_writes_to_(outLen, return+1) LPWSTR out, _In_ DWORD outLen, _In_z_ LPCWSTR filename)
Definition: propbag.cpp:612
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:1811

Referenced by CIniPropertyBag::Read().

◆ SHGetIniStringW()

EXTERN_C DWORD WINAPI SHGetIniStringW ( _In_z_ LPCWSTR  appName,
_In_z_ LPCWSTR  keyName,
_Out_writes_to_(outLen, return+1) LPWSTR  out,
_In_ DWORD  outLen,
_In_z_ LPCWSTR  filename 
)

Definition at line 612 of file propbag.cpp.

618{
619 TRACE("(%s,%s,%p,%08x,%s)\n", debugstr_w(appName), debugstr_w(keyName),
620 out, outLen, debugstr_w(filename));
621
622 if (outLen == 0)
623 return 0;
624
625 // Try ".W"-appended section name. See also SHSetIniStringW
626 CStringW szSection(appName);
627 szSection += L".W";
628 CStringW pszWideBuff;
629 const INT cchWideMax = 4 * MAX_PATH; // UTF-7 needs 4 times length buffer.
630 GetPrivateProfileStringW(szSection, keyName, NULL,
631 pszWideBuff.GetBuffer(cchWideMax), cchWideMax, filename);
632 pszWideBuff.ReleaseBuffer();
633
634 if (pszWideBuff.IsEmpty()) // It's empty or not found
635 {
636 // Try the normal section name
637 return GetPrivateProfileStringW(appName, keyName, NULL, out, outLen, filename);
638 }
639
640 // Okay, now ".W" version is valid. Its value is a UTF-7 string in UTF-16
641 CW2A wide2utf7(pszWideBuff);
642 MultiByteToWideChar(CP_UTF7, 0, wide2utf7, -1, out, outLen);
643 out[outLen - 1] = UNICODE_NULL;
644
645 return lstrlenW(out);
646}
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:387
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
const char * filename
Definition: ioapi.h:137
const char * appName(const char *argv0)
Definition: loadlib.c:89
#define UNICODE_NULL
int32_t INT
Definition: typedefs.h:58
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define CP_UTF7
Definition: winnls.h:263

Referenced by SHGetIniStringUTF7W().

◆ SHGetPerScreenResName()

EXTERN_C INT WINAPI SHGetPerScreenResName ( _Out_writes_(cchBuffer) LPWSTR  pszBuffer,
_In_ INT  cchBuffer,
_In_ DWORD  dwReserved 
)

Definition at line 1957 of file propbag.cpp.

1961{
1962 if (dwReserved)
1963 return 0;
1964
1965 HDC hDC = ::GetDC(NULL);
1966 INT cxWidth = ::GetDeviceCaps(hDC, HORZRES);
1967 INT cyHeight = ::GetDeviceCaps(hDC, VERTRES);
1968 INT cMonitors = ::GetSystemMetrics(SM_CMONITORS);
1970
1971 StringCchPrintfW(pszBuffer, cchBuffer, L"%dx%d(%d)", cxWidth, cyHeight, cMonitors);
1972 return lstrlenW(pszBuffer);
1973}
static HDC hDC
Definition: 3dtext.c:33
static DWORD cchBuffer
Definition: fusion.c:85
static HDC
Definition: imagelist.c:88
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define HORZRES
Definition: wingdi.h:716
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define VERTRES
Definition: wingdi.h:717
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
#define SM_CMONITORS
Definition: winuser.h:1051
int WINAPI GetSystemMetrics(_In_ int)

Referenced by CDefView::SaveViewState(), and SHPropertyBag_PerScreenRes().

◆ SHGetViewStatePropertyBag()

EXTERN_C HRESULT WINAPI SHGetViewStatePropertyBag ( _In_opt_ PCIDLIST_ABSOLUTE  pidl,
_In_opt_ LPCWSTR  bag_name,
_In_ DWORD  flags,
_In_ REFIID  riid,
_Outptr_ void **  ppv 
)

Definition at line 1896 of file propbag.cpp.

1902{
1903 HRESULT hr;
1904
1905 TRACE("%p %s 0x%X %p %p\n", pidl, debugstr_w(bag_name), flags, &riid, ppv);
1906
1907 *ppv = NULL;
1908
1910
1911 if (g_pCachedBag && g_pCachedBag->IsSameBag(pidl, bag_name, flags))
1912 {
1913 hr = g_pCachedBag->QueryInterface(riid, ppv);
1915 return hr;
1916 }
1917
1918 if (SHIsRemovableDrive(pidl))
1919 {
1920 TRACE("pidl %p is removable\n", pidl);
1922 return E_FAIL;
1923 }
1924
1925 CComPtr<CViewStatePropertyBag> pBag(new(std::nothrow) CViewStatePropertyBag());
1926 if (!pBag)
1927 {
1929 return E_OUTOFMEMORY;
1930 }
1931
1932 hr = pBag->Init(pidl, bag_name, flags);
1933 if (FAILED(hr))
1934 {
1935 ERR("0x%08X\n", hr);
1937 return hr;
1938 }
1939 g_pCachedBag = pBag;
1941 return pBag->QueryInterface(riid, ppv);
1942}
#define E_FAIL
Definition: ddrawi.h:102
REFIID LPVOID * ppv
Definition: atlbase.h:39
static BOOL SHIsRemovableDrive(LPCITEMIDLIST pidl)
Definition: propbag.cpp:1852

Referenced by CDesktopBrowser::GetPropertyBag(), and CShellBrowser::GetPropertyBag().

◆ SHIsRemovableDrive()

static BOOL SHIsRemovableDrive ( LPCITEMIDLIST  pidl)
static

Definition at line 1852 of file propbag.cpp.

1853{
1854 STRRET strret;
1856 WCHAR szBuff[MAX_PATH];
1857 LPCITEMIDLIST ppidlLast;
1858 INT iDrive, nType;
1859 HRESULT hr;
1860
1861 hr = SHBindToParent(pidl, IID_IShellFolder, (void **)&psf, &ppidlLast);
1862 if (FAILED(hr))
1863 return FALSE;
1864
1865 hr = psf->GetDisplayNameOf(ppidlLast, SHGDN_FORPARSING, &strret);
1866 if (FAILED(hr))
1867 return FALSE;
1868
1869 hr = StrRetToBufW(&strret, ppidlLast, szBuff, _countof(szBuff));
1870 if (FAILED(hr))
1871 return FALSE;
1872
1873 iDrive = PathGetDriveNumberW(szBuff);
1874 if (iDrive < 0)
1875 return FALSE;
1876
1877 nType = RealDriveType(iDrive, FALSE);
1878 return (nType == DRIVE_REMOVABLE || nType == DRIVE_CDROM);
1879}
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:1786
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:248
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1504
EXTERN_C INT WINAPI RealDriveType(INT drive, BOOL bQueryNet)
Definition: shlfileop.cpp:2354
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define DRIVE_CDROM
Definition: winbase.h:279
#define DRIVE_REMOVABLE
Definition: winbase.h:276

Referenced by SHGetViewStatePropertyBag().

◆ SHSetIniStringUTF7W()

EXTERN_C BOOL WINAPI SHSetIniStringUTF7W ( _In_z_ LPCWSTR  lpAppName,
_In_z_ LPCWSTR  lpKeyName,
_In_opt_z_ LPCWSTR  lpString,
_In_z_ LPCWSTR  lpFileName 
)

Definition at line 758 of file propbag.cpp.

763{
764 if (*lpKeyName == L'@') // UTF-7
765 return SHSetIniStringW(lpAppName, lpKeyName + 1, lpString, lpFileName);
766
767 return WritePrivateProfileStringW(lpAppName, lpKeyName, lpString, lpFileName);
768}
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
EXTERN_C BOOL WINAPI SHSetIniStringW(_In_z_ LPCWSTR appName, _In_z_ LPCWSTR keyName, _In_opt_z_ LPCWSTR str, _In_z_ LPCWSTR filename)
Definition: propbag.cpp:668

Referenced by CIniPropertyBag::Write().

◆ SHSetIniStringW()

EXTERN_C BOOL WINAPI SHSetIniStringW ( _In_z_ LPCWSTR  appName,
_In_z_ LPCWSTR  keyName,
_In_opt_z_ LPCWSTR  str,
_In_z_ LPCWSTR  filename 
)

Definition at line 668 of file propbag.cpp.

673{
674 TRACE("(%s, %p, %s, %s)\n", debugstr_w(appName), keyName, debugstr_w(str),
676
677 // Write a normal profile string. If str was NULL, then key will be deleted
679 return FALSE;
680
681 if (Is7BitClean(str))
682 {
683 // Delete ".A" version
684 CStringW szSection(appName);
685 szSection += L".A";
686 WritePrivateProfileStringW(szSection, keyName, NULL, filename);
687
688 // Delete ".W" version
689 szSection = appName;
690 szSection += L".W";
691 WritePrivateProfileStringW(szSection, keyName, NULL, filename);
692
693 return TRUE;
694 }
695
696 // Now str is not 7-bit clean. It needs UTF-7 encoding in UTF-16.
697 // We write ".A" and ".W"-appended sections
698 CW2A wide2utf7(str, CP_UTF7);
699 CA2W utf72wide(wide2utf7, CP_ACP);
700
701 BOOL ret = TRUE;
702
703 // Write ".A" version
704 CStringW szSection(appName);
705 szSection += L".A";
706 if (!WritePrivateProfileStringW(szSection, keyName, str, filename))
707 ret = FALSE;
708
709 // Write ".W" version
710 szSection = appName;
711 szSection += L".W";
712 if (!WritePrivateProfileStringW(szSection, keyName, utf72wide, filename))
713 ret = FALSE;
714
715 return ret;
716}
#define CP_ACP
Definition: compat.h:109
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL Is7BitClean(LPCWSTR psz)
Definition: propbag.cpp:648
const WCHAR * str

Referenced by SHSetIniStringUTF7W().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ g_csBagCacheLock

CRITICAL_SECTION g_csBagCacheLock

Definition at line 1325 of file propbag.cpp.

Referenced by DllMain(), FreeViewStatePropertyBagCache(), and SHGetViewStatePropertyBag().

◆ g_pCachedBag

Definition at line 1322 of file propbag.cpp.

Referenced by FreeViewStatePropertyBagCache(), and SHGetViewStatePropertyBag().