ReactOS 0.4.15-dev-8119-g4fb2fdb
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 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 22 of file propbag.cpp.

◆ MODE_CAN_WRITE

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

Definition at line 24 of file propbag.cpp.

Typedef Documentation

◆ DESKVIEW_FLAGS

Definition at line 1048 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 1513 of file propbag.cpp.

1514{
1515 HRESULT hr = ::CreateBindCtx(0, ppbc);
1516 if (FAILED(hr))
1517 return hr;
1518
1519 IBindCtx *pbc = *ppbc;
1520
1521 BIND_OPTS opts = { sizeof(opts) };
1522 opts.grfMode = dwMode;
1523 hr = pbc->SetBindOptions(&opts);
1524 if (FAILED(hr))
1525 {
1526 pbc->Release();
1527 *ppbc = NULL;
1528 }
1529
1530 return hr;
1531}
#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, LPBC *ppbc)
Definition: bindctx.c:556
HRESULT hr
Definition: shlfolder.c:183

Referenced by CViewStatePropertyBag::_CreateBag().

◆ FreeViewStatePropertyBagCache()

EXTERN_C VOID FreeViewStatePropertyBagCache ( VOID  )

Definition at line 1929 of file propbag.cpp.

1930{
1932 g_pCachedBag.Release();
1934}
CRITICAL_SECTION g_csBagCacheLock
Definition: propbag.cpp:1311
CComPtr< CViewStatePropertyBag > g_pCachedBag
Definition: propbag.cpp:1308
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by DllMain().

◆ Is7BitClean()

static BOOL Is7BitClean ( LPCWSTR  psz)
static

Definition at line 638 of file propbag.cpp.

639{
640 if (!psz)
641 return TRUE;
642
643 while (*psz)
644 {
645 if (*psz > 0x7F)
646 return FALSE;
647 ++psz;
648 }
649 return TRUE;
650}
#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 1971 of file propbag.cpp.

1976{
1977 TRACE("%p 0x%x %p %p\n", punk, flags, &riid, ppvObj);
1978
1980 HRESULT hr = IUnknown_QueryService(punk, SID_STopLevelBrowser, IID_IShellBrowserService,
1981 (void **)&pService);
1982 if (FAILED(hr))
1983 {
1984 ERR("0x%X\n", hr);
1985 return hr;
1986 }
1987
1988 return pService->GetPropertyBag(flags, riid, ppvObj);
1989}
#define ERR(fmt,...)
Definition: debug.h:113
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1497
GLbitfield flags
Definition: glext.h:7161
REFIID riid
Definition: atlbase.h:39
#define TRACE(s)
Definition: solgame.cpp:4

◆ SHCreatePropertyBagOnMemory()

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

Definition at line 254 of file propbag.cpp.

255{
256 TRACE("0x%08X, %s, %p\n", dwMode, debugstr_guid(&riid), ppvObj);
257
258 *ppvObj = NULL;
259
260 CComPtr<CMemPropertyBag> pMemBag(new CMemPropertyBag(dwMode));
261
262 return pMemBag->QueryInterface(riid, ppvObj);
263}
#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 965 of file propbag.cpp.

971{
973 PWCHAR pchFileTitle;
974 WCHAR szBuff[MAX_PATH];
975
976 if (dwMode & STGM_CREATE)
977 {
981 {
982 pchFileTitle = PathFindFileNameW(lpFileName);
983 if (lstrcmpiW(pchFileTitle, L"desktop.ini") == 0)
984 {
985 StrCpyNW(szBuff, lpFileName, _countof(szBuff));
986 if (PathRemoveFileSpecW(szBuff))
987 PathMakeSystemFolderW(szBuff);
988 }
990 }
991 }
992
993 *ppvObj = NULL;
994
997
998 CComPtr<CIniPropertyBag> pIniPB(new CIniPropertyBag(dwMode));
999
1000 HRESULT hr = pIniPB->Init(lpFileName, pszSection);
1001 if (FAILED(hr))
1002 {
1003 ERR("0x%08X\n", hr);
1004 return hr;
1005 }
1006
1007 return pIniPB->QueryInterface(riid, ppvObj);
1008}
#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:4261
BOOL WINAPI PathMakeSystemFolderW(LPCWSTR lpszPath)
Definition: path.c:3120
BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath)
Definition: path.c:629
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1777
LPWSTR WINAPI StrCpyNW(LPWSTR dst, LPCWSTR src, int count)
Definition: string.c:536
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 L(x)
Definition: ntvdm.h:50
#define STGM_CREATE
Definition: objbase.h:926
#define _countof(array)
Definition: sndvol32.h:70
uint16_t * PWCHAR
Definition: typedefs.h:56
_In_ LPCSTR lpFileName
Definition: winbase.h:3071
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
__wchar_t WCHAR
Definition: xmlstorage.h:180

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 575 of file propbag.cpp.

581{
582 TRACE("%p, %s, 0x%08X, %s, %p\n", hKey, debugstr_w(pszSubKey), dwMode,
583 debugstr_guid(&riid), ppvObj);
584
585 *ppvObj = NULL;
586
587 CComPtr<CRegPropertyBag> pRegBag(new CRegPropertyBag(dwMode));
588
589 HRESULT hr = pRegBag->Init(hKey, pszSubKey);
590 if (FAILED(hr))
591 return hr;
592
593 return pRegBag->QueryInterface(riid, ppvObj);
594}
FxAutoRegKey hKey
#define debugstr_w
Definition: kernel32.h:32

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

◆ SHGetDesktopUpgradePropertyBag()

HRESULT SHGetDesktopUpgradePropertyBag ( REFIID  riid,
void **  ppvObj 
)

Definition at line 1197 of file propbag.cpp.

1198{
1199 *ppvObj = NULL;
1201 return pPropBag->QueryInterface(riid, ppvObj);
1202}

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 722 of file propbag.cpp.

728{
729 if (*lpKeyName == L'@') // UTF-7
730 return SHGetIniStringW(lpAppName, lpKeyName + 1, lpReturnedString, nSize, lpFileName);
731
732 return GetPrivateProfileStringW(lpAppName, lpKeyName, L"", lpReturnedString, nSize, lpFileName);
733}
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:602
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2084

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 602 of file propbag.cpp.

608{
609 TRACE("(%s,%s,%p,%08x,%s)\n", debugstr_w(appName), debugstr_w(keyName),
610 out, outLen, debugstr_w(filename));
611
612 if (outLen == 0)
613 return 0;
614
615 // Try ".W"-appended section name. See also SHSetIniStringW
616 CStringW szSection(appName);
617 szSection += L".W";
618 CStringW pszWideBuff;
619 const INT cchWideMax = 4 * MAX_PATH; // UTF-7 needs 4 times length buffer.
620 GetPrivateProfileStringW(szSection, keyName, NULL,
621 pszWideBuff.GetBuffer(cchWideMax), cchWideMax, filename);
622 pszWideBuff.ReleaseBuffer();
623
624 if (pszWideBuff.IsEmpty()) // It's empty or not found
625 {
626 // Try the normal section name
627 return GetPrivateProfileStringW(appName, keyName, NULL, out, outLen, filename);
628 }
629
630 // Okay, now ".W" version is valid. Its value is a UTF-7 string in UTF-16
631 CW2A wide2utf7(pszWideBuff);
632 MultiByteToWideChar(CP_UTF7, 0, wide2utf7, -1, out, outLen);
633 out[outLen - 1] = UNICODE_NULL;
634
635 return lstrlenW(out);
636}
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
static FILE * out
Definition: regtests2xml.c:44
int32_t INT
Definition: typedefs.h:58
#define CP_UTF7
Definition: winnls.h:235

Referenced by SHGetIniStringUTF7W().

◆ SHGetPerScreenResName()

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

Definition at line 1942 of file propbag.cpp.

1946{
1947 if (dwReserved)
1948 return 0;
1949
1950 HDC hDC = ::GetDC(NULL);
1951 INT cxWidth = ::GetDeviceCaps(hDC, HORZRES);
1952 INT cyHeight = ::GetDeviceCaps(hDC, VERTRES);
1953 INT cMonitors = ::GetSystemMetrics(SM_CMONITORS);
1955
1956 StringCchPrintfW(pszBuffer, cchBuffer, L"%dx%d(%d)", cxWidth, cyHeight, cMonitors);
1957 return lstrlenW(pszBuffer);
1958}
static HDC hDC
Definition: 3dtext.c:33
static DWORD cchBuffer
Definition: fusion.c:85
static HDC
Definition: imagelist.c:92
_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:1040
int WINAPI GetSystemMetrics(_In_ int)

Referenced by 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 1882 of file propbag.cpp.

1888{
1889 HRESULT hr;
1890
1891 TRACE("%p %s 0x%X %p %p\n", pidl, debugstr_w(bag_name), flags, &riid, ppv);
1892
1893 *ppv = NULL;
1894
1896
1897 if (g_pCachedBag && g_pCachedBag->IsSameBag(pidl, bag_name, flags))
1898 {
1899 hr = g_pCachedBag->QueryInterface(riid, ppv);
1901 return hr;
1902 }
1903
1904 if (SHIsRemovableDrive(pidl))
1905 {
1906 TRACE("pidl %p is removable\n", pidl);
1908 return E_FAIL;
1909 }
1910
1912
1913 hr = pBag->Init(pidl, bag_name, flags);
1914 if (FAILED(hr))
1915 {
1916 ERR("0x%08X\n", hr);
1918 return hr;
1919 }
1920
1921 g_pCachedBag.Attach(pBag);
1922
1923 hr = g_pCachedBag->QueryInterface(riid, ppv);
1924
1926 return hr;
1927}
#define E_FAIL
Definition: ddrawi.h:102
REFIID LPVOID * ppv
Definition: atlbase.h:39
static BOOL SHIsRemovableDrive(LPCITEMIDLIST pidl)
Definition: propbag.cpp:1838

◆ SHIsRemovableDrive()

static BOOL SHIsRemovableDrive ( LPCITEMIDLIST  pidl)
static

Definition at line 1838 of file propbag.cpp.

1839{
1840 STRRET strret;
1842 WCHAR szBuff[MAX_PATH];
1843 LPCITEMIDLIST ppidlLast;
1844 INT iDrive, nType;
1845 HRESULT hr;
1846
1847 hr = SHBindToParent(pidl, IID_IShellFolder, (void **)&psf, &ppidlLast);
1848 if (FAILED(hr))
1849 return FALSE;
1850
1851 hr = psf->GetDisplayNameOf(ppidlLast, SHGDN_FORPARSING, &strret);
1852 if (FAILED(hr))
1853 return FALSE;
1854
1855 hr = StrRetToBufW(&strret, ppidlLast, szBuff, _countof(szBuff));
1856 if (FAILED(hr))
1857 return FALSE;
1858
1859 iDrive = PathGetDriveNumberW(szBuff);
1860 if (iDrive < 0)
1861 return FALSE;
1862
1863 nType = RealDriveType(iDrive, FALSE);
1864 return (nType == DRIVE_REMOVABLE || nType == DRIVE_CDROM);
1865}
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:553
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1530
#define DRIVE_CDROM
Definition: machpc98.h:119
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1348
EXTERN_C INT WINAPI RealDriveType(INT drive, BOOL bQueryNet)
Definition: shlfileop.cpp:2224
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define DRIVE_REMOVABLE
Definition: winbase.h:251

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 748 of file propbag.cpp.

753{
754 if (*lpKeyName == L'@') // UTF-7
755 return SHSetIniStringW(lpAppName, lpKeyName + 1, lpString, lpFileName);
756
757 return WritePrivateProfileStringW(lpAppName, lpKeyName, lpString, lpFileName);
758}
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:658

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 658 of file propbag.cpp.

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

Referenced by SHSetIniStringUTF7W().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ g_csBagCacheLock

CRITICAL_SECTION g_csBagCacheLock

Definition at line 1311 of file propbag.cpp.

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

◆ g_pCachedBag

Definition at line 1308 of file propbag.cpp.

Referenced by FreeViewStatePropertyBagCache(), and SHGetViewStatePropertyBag().