ReactOS 0.4.16-dev-570-g1868985
string.c File Reference
#include "config.h"
#include "wine/port.h"
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "shlwapi.h"
#include "wingdi.h"
#include "winuser.h"
#include "shlobj.h"
#include "mlang.h"
#include "ddeml.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "resource.h"
Include dependency graph for string.c:

Go to the source code of this file.

Classes

struct  tagSHLWAPI_BYTEFORMATS
 

Macros

#define NONAMELESSUNION
 
#define NO_SHLWAPI_REG
 
#define NO_SHLWAPI_STREAM
 
#define KB   ((ULONGLONG)1024)
 
#define MB   (KB*KB)
 
#define GB   (KB*KB*KB)
 
#define TB   (KB*KB*KB*KB)
 
#define PB   (KB*KB*KB*KB*KB)
 

Typedefs

typedef struct tagSHLWAPI_BYTEFORMATS SHLWAPI_BYTEFORMATS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static HRESULT _SHStrDupAA (LPCSTR, LPSTR *)
 
static HRESULT _SHStrDupAW (LPCWSTR, LPSTR *)
 
static void FillNumberFmt (NUMBERFMTW *fmt, LPWSTR decimal_buffer, int decimal_bufwlen, LPWSTR thousand_buffer, int thousand_bufwlen)
 
static int FormatInt (LONGLONG qdwValue, LPWSTR pszBuf, int cchBuf)
 
static int FormatDouble (double value, int decimals, LPWSTR pszBuf, int cchBuf)
 
static BOOL SHLWAPI_ChrCmpHelperA (WORD ch1, WORD ch2, DWORD dwFlags)
 
static BOOL WINAPI SHLWAPI_ChrCmpA (WORD ch1, WORD ch2)
 
BOOL WINAPI ChrCmpIA (WORD ch1, WORD ch2)
 
BOOL WINAPI ChrCmpIW (WCHAR ch1, WCHAR ch2)
 
LPSTR WINAPI StrChrA (LPCSTR lpszStr, WORD ch)
 
LPWSTR WINAPI StrChrW (LPCWSTR lpszStr, WCHAR ch)
 
LPSTR WINAPI StrChrIA (LPCSTR lpszStr, WORD ch)
 
LPWSTR WINAPI StrChrIW (LPCWSTR lpszStr, WCHAR ch)
 
LPWSTR WINAPI StrChrNW (LPCWSTR lpszStr, WCHAR ch, UINT cchMax)
 
int WINAPI StrCmpIW (LPCWSTR lpszStr, LPCWSTR lpszComp)
 
INT WINAPI StrCmpNA (LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
 
INT WINAPI StrCmpNW (LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
 
int WINAPI StrCmpNIA (LPCSTR lpszStr, LPCSTR lpszComp, int iLen)
 
INT WINAPI StrCmpNIW (LPCWSTR lpszStr, LPCWSTR lpszComp, int iLen)
 
int WINAPI StrCmpW (LPCWSTR lpszStr, LPCWSTR lpszComp)
 
LPWSTR WINAPI StrCatW (LPWSTR lpszStr, LPCWSTR lpszSrc)
 
DWORD WINAPI StrCatChainW (LPWSTR lpszStr, DWORD cchMax, DWORD ichAt, LPCWSTR lpszCat)
 
LPWSTR WINAPI StrCpyW (LPWSTR lpszStr, LPCWSTR lpszSrc)
 
LPWSTR WINAPI StrCpyNW (LPWSTR dst, LPCWSTR src, int count)
 
static LPSTR SHLWAPI_StrStrHelperA (LPCSTR lpszStr, LPCSTR lpszSearch, INT(WINAPI *pStrCmpFn)(LPCSTR, LPCSTR, INT))
 
LPSTR WINAPI StrStrA (LPCSTR lpszStr, LPCSTR lpszSearch)
 
LPWSTR WINAPI StrStrW (LPCWSTR lpszStr, LPCWSTR lpszSearch)
 
LPSTR WINAPI StrRStrIA (LPCSTR lpszStr, LPCSTR lpszEnd, LPCSTR lpszSearch)
 
LPWSTR WINAPI StrRStrIW (LPCWSTR lpszStr, LPCWSTR lpszEnd, LPCWSTR lpszSearch)
 
LPSTR WINAPI StrStrIA (LPCSTR lpszStr, LPCSTR lpszSearch)
 
LPWSTR WINAPI StrStrIW (LPCWSTR lpszStr, LPCWSTR lpszSearch)
 
LPWSTR WINAPI StrStrNW (LPCWSTR lpFirst, LPCWSTR lpSrch, UINT cchMax)
 
LPWSTR WINAPI StrStrNIW (LPCWSTR lpFirst, LPCWSTR lpSrch, UINT cchMax)
 
int WINAPI StrToIntA (LPCSTR lpszStr)
 
int WINAPI StrToIntW (LPCWSTR lpszStr)
 
BOOL WINAPI StrToIntExA (LPCSTR lpszStr, DWORD dwFlags, int *lpiRet)
 
BOOL WINAPI StrToInt64ExA (LPCSTR lpszStr, DWORD dwFlags, LONGLONG *lpiRet)
 
BOOL WINAPI StrToIntExW (LPCWSTR lpszStr, DWORD dwFlags, int *lpiRet)
 
BOOL WINAPI StrToInt64ExW (LPCWSTR lpszStr, DWORD dwFlags, LONGLONG *lpiRet)
 
LPSTR WINAPI StrDupA (LPCSTR lpszStr)
 
LPWSTR WINAPI StrDupW (LPCWSTR lpszStr)
 
static int SHLWAPI_StrSpnHelperA (LPCSTR lpszStr, LPCSTR lpszMatch, LPSTR(WINAPI *pStrChrFn)(LPCSTR, WORD), BOOL bInvert)
 
int WINAPI StrSpnA (LPCSTR lpszStr, LPCSTR lpszMatch)
 
int WINAPI StrSpnW (LPCWSTR lpszStr, LPCWSTR lpszMatch)
 
int WINAPI StrCSpnA (LPCSTR lpszStr, LPCSTR lpszMatch)
 
int WINAPI StrCSpnW (LPCWSTR lpszStr, LPCWSTR lpszMatch)
 
int WINAPI StrCSpnIA (LPCSTR lpszStr, LPCSTR lpszMatch)
 
int WINAPI StrCSpnIW (LPCWSTR lpszStr, LPCWSTR lpszMatch)
 
LPSTR WINAPI StrPBrkA (LPCSTR lpszStr, LPCSTR lpszMatch)
 
LPWSTR WINAPI StrPBrkW (LPCWSTR lpszStr, LPCWSTR lpszMatch)
 
static LPSTR SHLWAPI_StrRChrHelperA (LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch, BOOL(WINAPI *pChrCmpFn)(WORD, WORD))
 
LPSTR WINAPI StrRChrA (LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
 
LPWSTR WINAPI StrRChrW (LPCWSTR str, LPCWSTR end, WORD ch)
 
LPSTR WINAPI StrRChrIA (LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
 
LPWSTR WINAPI StrRChrIW (LPCWSTR str, LPCWSTR end, WORD ch)
 
LPSTR WINAPI StrCatBuffA (LPSTR lpszStr, LPCSTR lpszCat, INT cchMax)
 
LPWSTR WINAPI StrCatBuffW (LPWSTR lpszStr, LPCWSTR lpszCat, INT cchMax)
 
HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, UINT len)
 
HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
 
HRESULT WINAPI StrRetToStrA (LPSTRRET lpStrRet, const ITEMIDLIST *pidl, LPSTR *ppszName)
 
HRESULT WINAPI StrRetToStrW (LPSTRRET lpStrRet, const ITEMIDLIST *pidl, LPWSTR *ppszName)
 
static HRESULT _SHStrDupAToBSTR (LPCSTR src, BSTR *pBstrOut)
 
HRESULT WINAPI StrRetToBSTR (STRRET *lpStrRet, LPCITEMIDLIST pidl, BSTR *pBstrOut)
 
LPSTR WINAPI StrFormatKBSizeA (LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
 
LPWSTR WINAPI StrFormatKBSizeW (LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
 
LPSTR WINAPI StrNCatA (LPSTR lpszStr, LPCSTR lpszCat, INT cchMax)
 
LPWSTR WINAPI StrNCatW (LPWSTR lpszStr, LPCWSTR lpszCat, INT cchMax)
 
BOOL WINAPI StrTrimA (LPSTR lpszStr, LPCSTR lpszTrim)
 
BOOL WINAPI StrTrimW (LPWSTR lpszStr, LPCWSTR lpszTrim)
 
HRESULT WINAPI SHStrDupA (LPCSTR lpszStr, LPWSTR *lppszDest)
 
HRESULT WINAPI SHStrDupW (LPCWSTR src, LPWSTR *dest)
 
static LPWSTR SHLWAPI_WriteReverseNum (LPWSTR lpszOut, DWORD dwNum)
 
static int SHLWAPI_FormatSignificant (LPWSTR lpszNum, int dwDigits)
 
static int SHLWAPI_WriteTimeClass (LPWSTR lpszOut, DWORD dwValue, UINT uClassStringId, int iDigits)
 
INT WINAPI StrFromTimeIntervalA (LPSTR lpszStr, UINT cchMax, DWORD dwMS, int iDigits)
 
INT WINAPI StrFromTimeIntervalW (LPWSTR lpszStr, UINT cchMax, DWORD dwMS, int iDigits)
 
BOOL WINAPI StrIsIntlEqualA (BOOL bCase, LPCSTR lpszStr, LPCSTR lpszComp, int iLen)
 
BOOL WINAPI StrIsIntlEqualW (BOOL bCase, LPCWSTR lpszStr, LPCWSTR lpszComp, int iLen)
 
LPSTR WINAPI StrCpyNXA (LPSTR lpszDest, LPCSTR lpszSrc, int iLen)
 
LPWSTR WINAPI StrCpyNXW (LPWSTR lpszDest, LPCWSTR lpszSrc, int iLen)
 
INT WINAPI StrCmpLogicalW (LPCWSTR lpszStr, LPCWSTR lpszComp)
 
LPWSTR WINAPI StrFormatByteSizeW (LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
 
LPSTR WINAPI StrFormatByteSize64A (LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
 
LPSTR WINAPI StrFormatByteSizeA (DWORD dwBytes, LPSTR lpszDest, UINT cchMax)
 
DWORD WINAPI SHTruncateString (LPSTR lpStr, DWORD size)
 
char WINAPI SHStripMneumonicA (LPCSTR lpszStr)
 
WCHAR WINAPI SHStripMneumonicW (LPCWSTR lpszStr)
 
DWORD WINAPI SHAnsiToUnicodeCP (DWORD dwCp, LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
 
DWORD WINAPI SHAnsiToUnicode (LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
 
DWORD WINAPI SHUnicodeToAnsiCP (UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr, int dstlen)
 
INT WINAPI SHUnicodeToAnsi (LPCWSTR lpSrcStr, LPSTR lpDstStr, INT iLen)
 
DWORD WINAPI SHAnsiToAnsi (LPCSTR lpszSrc, LPSTR lpszDst, int iLen)
 
DWORD WINAPI SHUnicodeToUnicode (LPCWSTR lpszSrc, LPWSTR lpszDst, int iLen)
 
BOOL WINAPI DoesStringRoundTripA (LPCSTR lpSrcStr, LPSTR lpDst, INT iLen)
 
BOOL WINAPI DoesStringRoundTripW (LPCWSTR lpSrcStr, LPSTR lpDst, INT iLen)
 
HRESULT WINAPI SHLoadIndirectString (LPCWSTR src, LPWSTR dst, UINT dst_len, void **reserved)
 
BOOL WINAPI IsCharSpaceA (CHAR c)
 
BOOL WINAPI IsCharSpaceW (WCHAR wc)
 

Variables

HINSTANCE shlwapi_hInstance
 

Macro Definition Documentation

◆ GB

#define GB   (KB*KB*KB)

◆ KB

#define KB   ((ULONGLONG)1024)

◆ MB

#define MB   (KB*KB)

◆ NO_SHLWAPI_REG

#define NO_SHLWAPI_REG

Definition at line 34 of file string.c.

◆ NO_SHLWAPI_STREAM

#define NO_SHLWAPI_STREAM

Definition at line 35 of file string.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 30 of file string.c.

◆ PB

#define PB   (KB*KB*KB*KB*KB)

◆ TB

#define TB   (KB*KB*KB*KB)

Typedef Documentation

◆ SHLWAPI_BYTEFORMATS

Function Documentation

◆ _SHStrDupAA()

static HRESULT _SHStrDupAA ( LPCSTR  src,
LPSTR dest 
)
static

Definition at line 1923 of file string.c.

1924{
1925 HRESULT hr;
1926 int len = 0;
1927
1928 if (src) {
1929 len = lstrlenA(src) + 1;
1931 } else {
1932 *dest = NULL;
1933 }
1934
1935 if (*dest) {
1936 lstrcpynA(*dest,src, len);
1937 hr = S_OK;
1938 } else {
1939 hr = E_OUTOFMEMORY;
1940 }
1941
1942 TRACE("%s->(%p)\n", debugstr_a(src), *dest);
1943 return hr;
1944}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
#define lstrcpynA
Definition: compat.h:751
GLenum src
Definition: glext.h:6340
GLenum GLsizei len
Definition: glext.h:6722
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define S_OK
Definition: intsafe.h:52
#define debugstr_a
Definition: kernel32.h:31
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static char * dest
Definition: rtl.c:135
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by StrRetToStrA().

◆ _SHStrDupAToBSTR()

static HRESULT _SHStrDupAToBSTR ( LPCSTR  src,
BSTR pBstrOut 
)
static

Definition at line 1664 of file string.c.

1665{
1666 *pBstrOut = NULL;
1667
1668 if (src)
1669 {
1670 INT len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
1671 WCHAR* szTemp = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1672
1673 if (szTemp)
1674 {
1675 MultiByteToWideChar(CP_ACP, 0, src, -1, szTemp, len);
1676 *pBstrOut = SysAllocString(szTemp);
1677 HeapFree(GetProcessHeap(), 0, szTemp);
1678
1679 if (*pBstrOut)
1680 return S_OK;
1681 }
1682 }
1683 return E_OUTOFMEMORY;
1684}
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
int32_t INT
Definition: typedefs.h:58
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by StrRetToBSTR().

◆ _SHStrDupAW()

static HRESULT _SHStrDupAW ( LPCWSTR  src,
LPSTR dest 
)
static

Definition at line 1990 of file string.c.

1991{
1992 HRESULT hr;
1993 int len = 0;
1994
1995 if (src) {
1996 len = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL);
1998 } else {
1999 *dest = NULL;
2000 }
2001
2002 if (*dest) {
2004 hr = S_OK;
2005 } else {
2006 hr = E_OUTOFMEMORY;
2007 }
2008
2009 TRACE("%s->(%p)\n", debugstr_w(src), *dest);
2010 return hr;
2011}
#define WideCharToMultiByte
Definition: compat.h:111
#define debugstr_w
Definition: kernel32.h:32

Referenced by StrRetToStrA().

◆ ChrCmpIA()

BOOL WINAPI ChrCmpIA ( WORD  ch1,
WORD  ch2 
)

Definition at line 205 of file string.c.

206{
207 TRACE("(%d,%d)\n", ch1, ch2);
208
209 return SHLWAPI_ChrCmpHelperA(ch1, ch2, NORM_IGNORECASE);
210}
static BOOL SHLWAPI_ChrCmpHelperA(WORD ch1, WORD ch2, DWORD dwFlags)
Definition: string.c:157
#define NORM_IGNORECASE
Definition: winnls.h:178

Referenced by StrChrIA(), StrRChrIA(), and StrRStrIA().

◆ ChrCmpIW()

BOOL WINAPI ChrCmpIW ( WCHAR  ch1,
WCHAR  ch2 
)

Definition at line 217 of file string.c.

218{
219 return CompareStringW(GetThreadLocale(), NORM_IGNORECASE, &ch1, 1, &ch2, 1) - CSTR_EQUAL;
220}
LCID WINAPI GetThreadLocale(void)
Definition: locale.c:2801
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: locale.c:4014
#define CSTR_EQUAL
Definition: winnls.h:458

Referenced by CAutoComplete::DoAutoAppend(), StrCmpLogicalW(), StrRChrIW(), StrRStrIW(), and URL_GuessScheme().

◆ DoesStringRoundTripA()

BOOL WINAPI DoesStringRoundTripA ( LPCSTR  lpSrcStr,
LPSTR  lpDst,
INT  iLen 
)

Definition at line 2854 of file string.c.

2855{
2856 lstrcpynA(lpDst, lpSrcStr, iLen);
2857 return TRUE;
2858}
#define TRUE
Definition: types.h:120

◆ DoesStringRoundTripW()

BOOL WINAPI DoesStringRoundTripW ( LPCWSTR  lpSrcStr,
LPSTR  lpDst,
INT  iLen 
)

Definition at line 2874 of file string.c.

2875{
2876 WCHAR szBuff[MAX_PATH];
2877
2878 SHUnicodeToAnsi(lpSrcStr, lpDst, iLen);
2879 SHAnsiToUnicode(lpDst, szBuff, MAX_PATH);
2880 return !strcmpW(lpSrcStr, szBuff);
2881}
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI SHAnsiToUnicode(LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
Definition: string.c:2673
INT WINAPI SHUnicodeToAnsi(LPCWSTR lpSrcStr, LPSTR lpDstStr, INT iLen)
Definition: string.c:2797
#define strcmpW(s1, s2)
Definition: unicode.h:44

◆ FillNumberFmt()

static void FillNumberFmt ( NUMBERFMTW fmt,
LPWSTR  decimal_buffer,
int  decimal_bufwlen,
LPWSTR  thousand_buffer,
int  thousand_bufwlen 
)
static

Definition at line 55 of file string.c.

57{
58 WCHAR grouping[64];
59 WCHAR *c;
60
61 GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ILZERO|LOCALE_RETURN_NUMBER, (LPWSTR)&fmt->LeadingZero, sizeof(fmt->LeadingZero)/sizeof(WCHAR));
62 GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER|LOCALE_RETURN_NUMBER, (LPWSTR)&fmt->LeadingZero, sizeof(fmt->NegativeOrder)/sizeof(WCHAR));
63 fmt->NumDigits = 0;
64 GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, decimal_buffer, decimal_bufwlen);
65 GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, thousand_buffer, thousand_bufwlen);
66 fmt->lpThousandSep = thousand_buffer;
67 fmt->lpDecimalSep = decimal_buffer;
68
69 /*
70 * Converting grouping string to number as described on
71 * http://blogs.msdn.com/oldnewthing/archive/2006/04/18/578251.aspx
72 */
73 fmt->Grouping = 0;
74 GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, grouping, sizeof(grouping)/sizeof(WCHAR));
75 for (c = grouping; *c; c++)
76 if (*c >= '0' && *c < '9')
77 {
78 fmt->Grouping *= 10;
79 fmt->Grouping += *c - '0';
80 }
81
82 if (fmt->Grouping % 10 == 0)
83 fmt->Grouping /= 10;
84 else
85 fmt->Grouping *= 10;
86}
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1666
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
#define LOCALE_USER_DEFAULT
Definition: dsound.c:943
#define LOCALE_SGROUPING
Definition: winnls.h:46
#define LOCALE_SDECIMAL
Definition: winnls.h:44
#define LOCALE_STHOUSAND
Definition: winnls.h:45
#define LOCALE_INEGNUMBER
Definition: winnls.h:49
#define LOCALE_ILZERO
Definition: winnls.h:48
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FormatDouble(), and FormatInt().

◆ FormatDouble()

static int FormatDouble ( double  value,
int  decimals,
LPWSTR  pszBuf,
int  cchBuf 
)
static

Definition at line 129 of file string.c.

130{
131 static const WCHAR flfmt[] = {'%','f',0};
132 WCHAR buf[64];
134 WCHAR decimal[8], thousand[8];
135
136 snprintfW(buf, 64, flfmt, value);
137
138 FillNumberFmt(&fmt, decimal, sizeof decimal / sizeof (WCHAR),
139 thousand, sizeof thousand / sizeof (WCHAR));
140 fmt.NumDigits = decimals;
141 return GetNumberFormatW(LOCALE_USER_DEFAULT, 0, buf, &fmt, pszBuf, cchBuf);
142}
static void FillNumberFmt(NUMBERFMTW *fmt, LPWSTR decimal_buffer, int decimal_bufwlen, LPWSTR thousand_buffer, int thousand_bufwlen)
Definition: string.c:55
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags, LPCWSTR lpszValue, const NUMBERFMTW *lpFormat, LPWSTR lpNumberStr, int cchOut)
Definition: lcformat.c:1212
#define snprintfW
Definition: unicode.h:66
Definition: pdh_main.c:94

Referenced by StrFormatByteSizeW().

◆ FormatInt()

static int FormatInt ( LONGLONG  qdwValue,
LPWSTR  pszBuf,
int  cchBuf 
)
static

Definition at line 96 of file string.c.

97{
99 WCHAR decimal[8], thousand[8];
100 WCHAR buf[24];
101 WCHAR *c;
102 BOOL neg = (qdwValue < 0);
103
104 FillNumberFmt(&fmt, decimal, sizeof decimal / sizeof (WCHAR),
105 thousand, sizeof thousand / sizeof (WCHAR));
106
107 c = &buf[24];
108 *(--c) = 0;
109 do
110 {
111 *(--c) = '0' + (qdwValue%10);
112 qdwValue /= 10;
113 } while (qdwValue > 0);
114 if (neg)
115 *(--c) = '-';
116
117 return GetNumberFormatW(LOCALE_USER_DEFAULT, 0, c, &fmt, pszBuf, cchBuf);
118}
unsigned int BOOL
Definition: ntddk_ex.h:94

Referenced by StrFormatKBSizeW().

◆ IsCharSpaceA()

BOOL WINAPI IsCharSpaceA ( CHAR  c)

Definition at line 2952 of file string.c.

2953{
2954 WORD CharType;
2955 return GetStringTypeA(GetSystemDefaultLCID(), CT_CTYPE1, &c, 1, &CharType) && (CharType & C1_SPACE);
2956}
BOOL WINAPI GetStringTypeA(LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype)
Definition: locale.c:3209
LCID WINAPI GetSystemDefaultLCID(void)
Definition: locale.c:1230
unsigned short WORD
Definition: ntddk_ex.h:93
#define C1_SPACE
Definition: unicode.h:34
#define CT_CTYPE1
Definition: winnls.h:239

◆ IsCharSpaceW()

BOOL WINAPI IsCharSpaceW ( WCHAR  wc)

Definition at line 2970 of file string.c.

2971{
2972 WORD CharType;
2973
2974 return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_SPACE);
2975}
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: locale.c:3095

◆ SHAnsiToAnsi()

DWORD WINAPI SHAnsiToAnsi ( LPCSTR  lpszSrc,
LPSTR  lpszDst,
int  iLen 
)

Definition at line 2816 of file string.c.

2817{
2818 LPSTR lpszRet;
2819
2820 TRACE("(%s,%p,0x%08x)\n", debugstr_a(lpszSrc), lpszDst, iLen);
2821
2822 lpszRet = StrCpyNXA(lpszDst, lpszSrc, iLen);
2823 return lpszRet - lpszDst + 1;
2824}
LPSTR WINAPI StrCpyNXA(LPSTR lpszDest, LPCSTR lpszSrc, int iLen)
Definition: string.c:2263
char * LPSTR
Definition: xmlstorage.h:182

◆ SHAnsiToUnicode()

◆ SHAnsiToUnicodeCP()

DWORD WINAPI SHAnsiToUnicodeCP ( DWORD  dwCp,
LPCSTR  lpSrcStr,
LPWSTR  lpDstStr,
int  iLen 
)

Definition at line 2648 of file string.c.

2649{
2650 DWORD dwRet;
2651
2652 dwRet = MultiByteToWideChar(dwCp, 0, lpSrcStr, -1, lpDstStr, iLen);
2653 TRACE("%s->%s,ret=%d\n", debugstr_a(lpSrcStr), debugstr_w(lpDstStr), dwRet);
2654 return dwRet;
2655}
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by SHAnsiToUnicode().

◆ SHLoadIndirectString()

HRESULT WINAPI SHLoadIndirectString ( LPCWSTR  src,
LPWSTR  dst,
UINT  dst_len,
void **  reserved 
)

Definition at line 2890 of file string.c.

2891{
2892 WCHAR *dllname = NULL;
2893 HMODULE hmod = NULL;
2894 HRESULT hr = E_FAIL;
2895#ifdef __REACTOS__
2896 WCHAR szExpanded[512];
2897#endif
2898
2899 TRACE("(%s %p %08x %p)\n", debugstr_w(src), dst, dst_len, reserved);
2900
2901 if(src[0] == '@')
2902 {
2903 WCHAR *index_str;
2904 int index;
2905
2906#ifdef __REACTOS__
2907 if (wcschr(src, '%') != NULL)
2908 {
2909 ExpandEnvironmentStringsW(src, szExpanded, ARRAY_SIZE(szExpanded));
2910 src = szExpanded;
2911 }
2912#endif
2913 dst[0] = 0;
2914 dllname = StrDupW(src + 1);
2915 index_str = strchrW(dllname, ',');
2916
2917 if(!index_str) goto end;
2918
2919 *index_str = 0;
2920 index_str++;
2921 index = atoiW(index_str);
2922
2923#ifdef __REACTOS__
2925#else
2926 hmod = LoadLibraryW(dllname);
2927#endif
2928 if(!hmod) goto end;
2929
2930 if(index < 0)
2931 {
2932 if(LoadStringW(hmod, -index, dst, dst_len))
2933 hr = S_OK;
2934 }
2935 else
2936 FIXME("can't handle non-negative indices (%d)\n", index);
2937 }
2938 else
2939 {
2940 if(dst != src)
2941 lstrcpynW(dst, src, dst_len);
2942 hr = S_OK;
2943 }
2944
2945 TRACE("returning %s\n", debugstr_w(dst));
2946end:
2947 if(hmod) FreeLibrary(hmod);
2948 LocalFree(dllname);
2949 return hr;
2950}
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_FAIL
Definition: ddrawi.h:102
#define wcschr
Definition: compat.h:17
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
#define lstrcpynW
Definition: compat.h:738
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
LPWSTR WINAPI StrDupW(LPCWSTR lpszStr)
Definition: string.c:1093
r reserved
Definition: btrfs.c:3006
GLuint GLuint end
Definition: gl.h:1545
GLuint index
Definition: glext.h:6031
GLenum GLenum dst
Definition: glext.h:6340
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
#define atoiW(s)
Definition: unicode.h:60
#define strchrW(s, c)
Definition: unicode.h:40
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:368
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)

Referenced by AllSysInfo(), execute_test(), and SHLoadRegUIStringW().

◆ SHLWAPI_ChrCmpA()

static BOOL WINAPI SHLWAPI_ChrCmpA ( WORD  ch1,
WORD  ch2 
)
static

Definition at line 187 of file string.c.

188{
189 return SHLWAPI_ChrCmpHelperA(ch1, ch2, 0);
190}

Referenced by StrChrA(), and StrRChrA().

◆ SHLWAPI_ChrCmpHelperA()

static BOOL SHLWAPI_ChrCmpHelperA ( WORD  ch1,
WORD  ch2,
DWORD  dwFlags 
)
static

Definition at line 157 of file string.c.

158{
159 char str1[3], str2[3];
160
161 str1[0] = LOBYTE(ch1);
162 if (IsDBCSLeadByte(str1[0]))
163 {
164 str1[1] = HIBYTE(ch1);
165 str1[2] = '\0';
166 }
167 else
168 str1[1] = '\0';
169
170 str2[0] = LOBYTE(ch2);
171 if (IsDBCSLeadByte(str2[0]))
172 {
173 str2[1] = HIBYTE(ch2);
174 str2[2] = '\0';
175 }
176 else
177 str2[1] = '\0';
178
179 return CompareStringA(GetThreadLocale(), dwFlags, str1, -1, str2, -1) - CSTR_EQUAL;
180}
BOOL WINAPI IsDBCSLeadByte(BYTE testchar)
Definition: locale.c:2124
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
Definition: locale.c:4083
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by ChrCmpIA(), and SHLWAPI_ChrCmpA().

◆ SHLWAPI_FormatSignificant()

static int SHLWAPI_FormatSignificant ( LPWSTR  lpszNum,
int  dwDigits 
)
inlinestatic

Definition at line 2066 of file string.c.

2067{
2068 /* Zero non significant digits, return remaining significant digits */
2069 while (*lpszNum)
2070 {
2071 lpszNum++;
2072 if (--dwDigits == 0)
2073 {
2074 while (*lpszNum)
2075 *lpszNum++ = '0';
2076 return 0;
2077 }
2078 }
2079 return dwDigits;
2080}

Referenced by SHLWAPI_WriteTimeClass().

◆ SHLWAPI_StrRChrHelperA()

static LPSTR SHLWAPI_StrRChrHelperA ( LPCSTR  lpszStr,
LPCSTR  lpszEnd,
WORD  ch,
BOOL(WINAPI *pChrCmpFn)(WORD, WORD  
)
static

Definition at line 1295 of file string.c.

1298{
1299 LPCSTR lpszRet = NULL;
1300
1301 if (lpszStr)
1302 {
1303 WORD ch2;
1304
1305 if (!lpszEnd)
1306 lpszEnd = lpszStr + lstrlenA(lpszStr);
1307
1308 while (*lpszStr && lpszStr <= lpszEnd)
1309 {
1310 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
1311
1312 if (!pChrCmpFn(ch, ch2))
1313 lpszRet = lpszStr;
1314 lpszStr = CharNextA(lpszStr);
1315 }
1316 }
1317 return (LPSTR)lpszRet;
1318}
LPSTR WINAPI CharNextA(_In_ LPCSTR)
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by StrRChrA(), and StrRChrIA().

◆ SHLWAPI_StrSpnHelperA()

static int SHLWAPI_StrSpnHelperA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch,
LPSTR(WINAPI *pStrChrFn)(LPCSTR, WORD ,
BOOL  bInvert 
)
static

Definition at line 1122 of file string.c.

1125{
1126 LPCSTR lpszRead = lpszStr;
1127 if (lpszStr && *lpszStr && lpszMatch)
1128 {
1129 while (*lpszRead)
1130 {
1131 LPCSTR lpszTest = pStrChrFn(lpszMatch, *lpszRead);
1132
1133 if (!bInvert && !lpszTest)
1134 break;
1135 if (bInvert && lpszTest)
1136 break;
1137 lpszRead = CharNextA(lpszRead);
1138 };
1139 }
1140 return lpszRead - lpszStr;
1141}
static BOOL bInvert
Definition: win.c:51

Referenced by StrCSpnA(), StrCSpnIA(), and StrSpnA().

◆ SHLWAPI_StrStrHelperA()

static LPSTR SHLWAPI_StrStrHelperA ( LPCSTR  lpszStr,
LPCSTR  lpszSearch,
INT(WINAPI *pStrCmpFn)(LPCSTR, LPCSTR, INT  
)
static

Definition at line 561 of file string.c.

563{
564 size_t iLen;
565 LPCSTR end;
566
567 if (!lpszStr || !lpszSearch || !*lpszSearch)
568 return NULL;
569
570 iLen = strlen(lpszSearch);
571 end = lpszStr + strlen(lpszStr);
572
573 while (lpszStr + iLen <= end)
574 {
575 if (!pStrCmpFn(lpszStr, lpszSearch, iLen))
576 return (LPSTR)lpszStr;
577 lpszStr = CharNextA(lpszStr);
578 }
579 return NULL;
580}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269

Referenced by StrStrA(), and StrStrIA().

◆ SHLWAPI_WriteReverseNum()

static LPWSTR SHLWAPI_WriteReverseNum ( LPWSTR  lpszOut,
DWORD  dwNum 
)
inlinestatic

Definition at line 2046 of file string.c.

2047{
2048 *lpszOut-- = '\0';
2049
2050 /* Write a decimal number to a string, backwards */
2051 do
2052 {
2053 DWORD dwNextDigit = dwNum % 10;
2054 *lpszOut-- = '0' + dwNextDigit;
2055 dwNum = (dwNum - dwNextDigit) / 10;
2056 } while (dwNum > 0);
2057
2058 return lpszOut;
2059}

Referenced by SHLWAPI_WriteTimeClass().

◆ SHLWAPI_WriteTimeClass()

static int SHLWAPI_WriteTimeClass ( LPWSTR  lpszOut,
DWORD  dwValue,
UINT  uClassStringId,
int  iDigits 
)
static

Definition at line 2087 of file string.c.

2089{
2090 WCHAR szBuff[64], *szOut = szBuff + 32;
2091
2092 szOut = SHLWAPI_WriteReverseNum(szOut, dwValue);
2093 iDigits = SHLWAPI_FormatSignificant(szOut + 1, iDigits);
2094 *szOut = ' ';
2095 LoadStringW(shlwapi_hInstance, uClassStringId, szBuff + 32, 32);
2096 strcatW(lpszOut, szOut);
2097 return iDigits;
2098}
static int SHLWAPI_FormatSignificant(LPWSTR lpszNum, int dwDigits)
Definition: string.c:2066
static LPWSTR SHLWAPI_WriteReverseNum(LPWSTR lpszOut, DWORD dwNum)
Definition: string.c:2046
HINSTANCE shlwapi_hInstance
Definition: shlwapi_main.c:33
#define strcatW(d, s)
Definition: unicode.h:36

Referenced by StrFromTimeIntervalW().

◆ SHStrDupA()

HRESULT WINAPI SHStrDupA ( LPCSTR  lpszStr,
LPWSTR lppszDest 
)

Definition at line 1960 of file string.c.

1961{
1962 HRESULT hRet;
1963 int len = 0;
1964
1965 if (lpszStr)
1966 {
1967 len = MultiByteToWideChar(CP_ACP, 0, lpszStr, -1, NULL, 0) * sizeof(WCHAR);
1968 *lppszDest = CoTaskMemAlloc(len);
1969 }
1970 else
1971 *lppszDest = NULL;
1972
1973 if (*lppszDest)
1974 {
1975 MultiByteToWideChar(CP_ACP, 0, lpszStr, -1, *lppszDest, len/sizeof(WCHAR));
1976 hRet = S_OK;
1977 }
1978 else
1979 hRet = E_OUTOFMEMORY;
1980
1981 TRACE("%s->(%p)\n", debugstr_a(lpszStr), *lppszDest);
1982 return hRet;
1983}

Referenced by StrRetToStrW(), test_assoc_one(), and TestFilenameA().

◆ SHStrDupW()

◆ SHStripMneumonicA()

char WINAPI SHStripMneumonicA ( LPCSTR  lpszStr)

Definition at line 2581 of file string.c.

2582{
2583 LPSTR lpszIter, lpszTmp;
2584 char ch;
2585
2586 TRACE("(%s)\n", debugstr_a(lpszStr));
2587
2588 ch = *lpszStr;
2589
2590 if ((lpszIter = StrChrA(lpszStr, '&')))
2591 {
2592 lpszTmp = CharNextA(lpszIter);
2593 if (*lpszTmp)
2594 {
2595 if (*lpszTmp != '&')
2596 ch = *lpszTmp;
2597
2598 memmove( lpszIter, lpszTmp, strlen(lpszTmp) + 1 );
2599 }
2600 }
2601
2602 return ch;
2603}
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:266
#define memmove(s1, s2, n)
Definition: mkisofs.h:881

◆ SHStripMneumonicW()

WCHAR WINAPI SHStripMneumonicW ( LPCWSTR  lpszStr)

Definition at line 2610 of file string.c.

2611{
2612 LPWSTR lpszIter, lpszTmp;
2613 WCHAR ch;
2614
2615 TRACE("(%s)\n", debugstr_w(lpszStr));
2616
2617 ch = *lpszStr;
2618
2619 if ((lpszIter = StrChrW(lpszStr, '&')))
2620 {
2621 lpszTmp = lpszIter + 1;
2622 if (*lpszTmp)
2623 {
2624 if (*lpszTmp != '&')
2625 ch = *lpszTmp;
2626
2627 memmove( lpszIter, lpszTmp, (strlenW(lpszTmp) + 1) * sizeof(WCHAR) );
2628 }
2629 }
2630
2631 return ch;
2632}
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:257
#define strlenW(s)
Definition: unicode.h:34

◆ SHTruncateString()

DWORD WINAPI SHTruncateString ( LPSTR  lpStr,
DWORD  size 
)

Definition at line 2550 of file string.c.

2551{
2552 if (lpStr && size)
2553 {
2554 LPSTR lastByte = lpStr + size - 1;
2555
2556 while(lpStr < lastByte)
2557 lpStr += IsDBCSLeadByte(*lpStr) ? 2 : 1;
2558
2559 if(lpStr == lastByte && IsDBCSLeadByte(*lpStr))
2560 {
2561 *lpStr = '\0';
2562 size--;
2563 }
2564 return size;
2565 }
2566 return 0;
2567}
GLsizeiptr size
Definition: glext.h:5919

Referenced by SHUnicodeToAnsiCP().

◆ SHUnicodeToAnsi()

INT WINAPI SHUnicodeToAnsi ( LPCWSTR  lpSrcStr,
LPSTR  lpDstStr,
INT  iLen 
)

◆ SHUnicodeToAnsiCP()

DWORD WINAPI SHUnicodeToAnsiCP ( UINT  CodePage,
LPCWSTR  lpSrcStr,
LPSTR  lpDstStr,
int  dstlen 
)

Definition at line 2698 of file string.c.

2699{
2700 static const WCHAR emptyW[] = { '\0' };
2701 int len , reqLen;
2702 LPSTR mem;
2703
2704 if (!lpDstStr || !dstlen)
2705 return 0;
2706
2707 if (!lpSrcStr)
2708 lpSrcStr = emptyW;
2709
2710 *lpDstStr = '\0';
2711
2712 len = strlenW(lpSrcStr) + 1;
2713
2714 switch (CodePage)
2715 {
2716 case CP_WINUNICODE:
2717 CodePage = CP_UTF8; /* Fall through... */
2718 case 0x0000C350: /* FIXME: CP_ #define */
2719 case CP_UTF7:
2720 case CP_UTF8:
2721 {
2722 DWORD dwMode = 0;
2723 INT lenW = len - 1;
2724 INT needed = dstlen - 1;
2725 HRESULT hr;
2726
2727 /* try the user supplied buffer first */
2728 hr = ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &lenW, lpDstStr, &needed);
2729 if (hr == S_OK)
2730 {
2731 lpDstStr[needed] = '\0';
2732 return needed + 1;
2733 }
2734
2735 /* user buffer too small. exclude termination and copy as much as possible */
2736 lenW = len;
2737 hr = ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &lenW, NULL, &needed);
2738 needed++;
2739 mem = HeapAlloc(GetProcessHeap(), 0, needed);
2740 if (!mem)
2741 return 0;
2742
2743 hr = ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &len, mem, &needed);
2744 if (hr == S_OK)
2745 {
2746 reqLen = SHTruncateString(mem, dstlen);
2747 if (reqLen > 0) memcpy(lpDstStr, mem, reqLen-1);
2748 }
2750 return 0;
2751 }
2752 default:
2753 break;
2754 }
2755
2756 /* try the user supplied buffer first */
2757 reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, lpDstStr, dstlen, NULL, NULL);
2758
2759 if (!reqLen && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
2760 {
2761 reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, NULL, 0, NULL, NULL);
2762 if (reqLen)
2763 {
2764 mem = HeapAlloc(GetProcessHeap(), 0, reqLen);
2765 if (mem)
2766 {
2767 WideCharToMultiByte(CodePage, 0, lpSrcStr, len, mem, reqLen, NULL, NULL);
2768
2769 reqLen = SHTruncateString(mem, dstlen -1);
2770 reqLen++;
2771
2772 lstrcpynA(lpDstStr, mem, reqLen);
2774 lpDstStr[reqLen-1] = '\0';
2775 }
2776 }
2777 }
2778 return reqLen;
2779}
#define CP_WINUNICODE
Definition: ddeml.h:33
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
DWORD WINAPI SHTruncateString(LPSTR lpStr, DWORD size)
Definition: string.c:2550
static const WCHAR emptyW[]
Definition: navigate.c:40
static DWORD dstlen
Definition: directory.c:51
#define CP_UTF8
Definition: nls.h:20
Definition: mem.c:349
static CONVERTINETUNICODETOMULTIBYTE ConvertINetUnicodeToMultiByte
Definition: win_iconv.c:706
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CP_UTF7
Definition: winnls.h:237

Referenced by SHUnicodeToAnsi().

◆ SHUnicodeToUnicode()

DWORD WINAPI SHUnicodeToUnicode ( LPCWSTR  lpszSrc,
LPWSTR  lpszDst,
int  iLen 
)

Definition at line 2831 of file string.c.

2832{
2833 LPWSTR lpszRet;
2834
2835 TRACE("(%s,%p,0x%08x)\n", debugstr_w(lpszSrc), lpszDst, iLen);
2836
2837 lpszRet = StrCpyNXW(lpszDst, lpszSrc, iLen);
2838 return lpszRet - lpszDst + 1;
2839}
LPWSTR WINAPI StrCpyNXW(LPWSTR lpszDest, LPCWSTR lpszSrc, int iLen)
Definition: string.c:2282

◆ StrCatBuffA()

LPSTR WINAPI StrCatBuffA ( LPSTR  lpszStr,
LPCSTR  lpszCat,
INT  cchMax 
)

Definition at line 1419 of file string.c.

1420{
1421 INT iLen;
1422
1423 TRACE("(%p,%s,%d)\n", lpszStr, debugstr_a(lpszCat), cchMax);
1424
1425 if (!lpszStr)
1426 {
1427 WARN("Invalid lpszStr would crash under Win32!\n");
1428 return NULL;
1429 }
1430
1431 iLen = strlen(lpszStr);
1432 cchMax -= iLen;
1433
1434 if (cchMax > 0)
1435 StrCpyNA(lpszStr + iLen, lpszCat, cchMax);
1436 return lpszStr;
1437}
UINT cchMax
#define WARN(fmt,...)
Definition: precomp.h:61
#define StrCpyNA
Definition: shlwapi.h:1540

◆ StrCatBuffW()

LPWSTR WINAPI StrCatBuffW ( LPWSTR  lpszStr,
LPCWSTR  lpszCat,
INT  cchMax 
)

Definition at line 1444 of file string.c.

1445{
1446 INT iLen;
1447
1448 TRACE("(%p,%s,%d)\n", lpszStr, debugstr_w(lpszCat), cchMax);
1449
1450 if (!lpszStr)
1451 {
1452 WARN("Invalid lpszStr would crash under Win32!\n");
1453 return NULL;
1454 }
1455
1456 iLen = strlenW(lpszStr);
1457 cchMax -= iLen;
1458
1459 if (cchMax > 0)
1460 StrCpyNW(lpszStr + iLen, lpszCat, cchMax);
1461 return lpszStr;
1462}
LPWSTR WINAPI StrCpyNW(LPWSTR dst, LPCWSTR src, int count)
Definition: string.c:536

Referenced by SHAboutInfoW(), SHAddToRecentDocs(), and StrFormatByteSizeW().

◆ StrCatChainW()

DWORD WINAPI StrCatChainW ( LPWSTR  lpszStr,
DWORD  cchMax,
DWORD  ichAt,
LPCWSTR  lpszCat 
)

Definition at line 475 of file string.c.

476{
477 TRACE("(%s,%u,%d,%s)\n", debugstr_w(lpszStr), cchMax, ichAt, debugstr_w(lpszCat));
478
479 if (ichAt == -1)
480 ichAt = strlenW(lpszStr);
481
482 if (!cchMax)
483 return ichAt;
484
485 if (ichAt == cchMax)
486 ichAt--;
487
488 if (lpszCat && ichAt < cchMax)
489 {
490 lpszStr += ichAt;
491 while (ichAt < cchMax - 1 && *lpszCat)
492 {
493 *lpszStr++ = *lpszCat++;
494 ichAt++;
495 }
496 *lpszStr = 0;
497 }
498
499 return ichAt;
500}

◆ StrCatW()

LPWSTR WINAPI StrCatW ( LPWSTR  lpszStr,
LPCWSTR  lpszSrc 
)

Definition at line 452 of file string.c.

453{
454 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSrc));
455
456 if (lpszStr && lpszSrc)
457 strcatW(lpszStr, lpszSrc);
458 return lpszStr;
459}

Referenced by CRegistryFolder::FormatValueData().

◆ StrChrA()

LPSTR WINAPI StrChrA ( LPCSTR  lpszStr,
WORD  ch 
)

Definition at line 236 of file string.c.

237{
238 TRACE("(%s,%i)\n", debugstr_a(lpszStr), ch);
239
240 if (lpszStr)
241 {
242 while (*lpszStr)
243 {
244 if (!SHLWAPI_ChrCmpA(*lpszStr, ch))
245 return (LPSTR)lpszStr;
246 lpszStr = CharNextA(lpszStr);
247 }
248 }
249 return NULL;
250}
static BOOL WINAPI SHLWAPI_ChrCmpA(WORD ch1, WORD ch2)
Definition: string.c:187

◆ StrChrIA()

LPSTR WINAPI StrChrIA ( LPCSTR  lpszStr,
WORD  ch 
)

Definition at line 282 of file string.c.

283{
284 TRACE("(%s,%i)\n", debugstr_a(lpszStr), ch);
285
286 if (lpszStr)
287 {
288 while (*lpszStr)
289 {
290 if (!ChrCmpIA(*lpszStr, ch))
291 return (LPSTR)lpszStr;
292 lpszStr = CharNextA(lpszStr);
293 }
294 }
295 return NULL;
296}
BOOL WINAPI ChrCmpIA(WORD ch1, WORD ch2)
Definition: string.c:205

◆ StrChrIW()

LPWSTR WINAPI StrChrIW ( LPCWSTR  lpszStr,
WCHAR  ch 
)

Definition at line 303 of file string.c.

304{
305 TRACE("(%s,%i)\n", debugstr_w(lpszStr), ch);
306
307 if (lpszStr)
308 {
309 ch = toupperW(ch);
310 while (*lpszStr)
311 {
312 if (toupperW(*lpszStr) == ch)
313 return (LPWSTR)lpszStr;
314 lpszStr++;
315 }
316 lpszStr = NULL;
317 }
318 return (LPWSTR)lpszStr;
319}
#define toupperW(n)
Definition: unicode.h:51

◆ StrChrNW()

LPWSTR WINAPI StrChrNW ( LPCWSTR  lpszStr,
WCHAR  ch,
UINT  cchMax 
)

Definition at line 324 of file string.c.

325{
326 TRACE("(%s(%i),%i)\n", debugstr_wn(lpszStr,cchMax), cchMax, ch);
327
328 if (lpszStr)
329 {
330 while (*lpszStr && cchMax-- > 0)
331 {
332 if (*lpszStr == ch)
333 return (LPWSTR)lpszStr;
334 lpszStr++;
335 }
336 }
337 return NULL;
338}
#define debugstr_wn
Definition: kernel32.h:33

◆ StrChrW()

LPWSTR WINAPI StrChrW ( LPCWSTR  lpszStr,
WCHAR  ch 
)

Definition at line 257 of file string.c.

258{
259 LPWSTR lpszRet = NULL;
260
261 TRACE("(%s,%i)\n", debugstr_w(lpszStr), ch);
262
263 if (lpszStr)
264 lpszRet = strchrW(lpszStr, ch);
265 return lpszRet;
266}

◆ StrCmpIW()

◆ StrCmpLogicalW()

INT WINAPI StrCmpLogicalW ( LPCWSTR  lpszStr,
LPCWSTR  lpszComp 
)

Definition at line 2310 of file string.c.

2311{
2312 INT iDiff;
2313
2314 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszComp));
2315
2316 if (lpszStr && lpszComp)
2317 {
2318 while (*lpszStr)
2319 {
2320 if (!*lpszComp)
2321 return 1;
2322 else if (isdigitW(*lpszStr))
2323 {
2324 int iStr, iComp;
2325
2326 if (!isdigitW(*lpszComp))
2327 return -1;
2328
2329 /* Compare the numbers */
2330 StrToIntExW(lpszStr, 0, &iStr);
2331 StrToIntExW(lpszComp, 0, &iComp);
2332
2333 if (iStr < iComp)
2334 return -1;
2335 else if (iStr > iComp)
2336 return 1;
2337
2338 /* Skip */
2339 while (isdigitW(*lpszStr))
2340 lpszStr++;
2341 while (isdigitW(*lpszComp))
2342 lpszComp++;
2343 }
2344 else if (isdigitW(*lpszComp))
2345 return 1;
2346 else
2347 {
2348 iDiff = ChrCmpIW(*lpszStr,*lpszComp);
2349 if (iDiff > 0)
2350 return 1;
2351 else if (iDiff < 0)
2352 return -1;
2353
2354 lpszStr++;
2355 lpszComp++;
2356 }
2357 }
2358 if (*lpszComp)
2359 return -1;
2360 }
2361 return 0;
2362}
BOOL WINAPI ChrCmpIW(WCHAR ch1, WCHAR ch2)
Definition: string.c:217
BOOL WINAPI StrToIntExW(LPCWSTR lpszStr, DWORD dwFlags, int *lpiRet)
Definition: string.c:970
#define isdigitW(n)
Definition: unicode.h:56

Referenced by CompareFunc(), CCabFolder::CompareID(), CFSFolder::CompareUiStrings(), and SortListView().

◆ StrCmpNA()

INT WINAPI StrCmpNA ( LPCSTR  lpszStr,
LPCSTR  lpszComp,
INT  iLen 
)

Definition at line 373 of file string.c.

374{
375 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
376 return CompareStringA(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
377}

◆ StrCmpNIA()

int WINAPI StrCmpNIA ( LPCSTR  lpszStr,
LPCSTR  lpszComp,
int  iLen 
)

Definition at line 404 of file string.c.

405{
406 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
407 return CompareStringA(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
408}

◆ StrCmpNIW()

INT WINAPI StrCmpNIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszComp,
int  iLen 
)

Definition at line 415 of file string.c.

416{
417 TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen);
418 return CompareStringW(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
419}

◆ StrCmpNW()

INT WINAPI StrCmpNW ( LPCWSTR  lpszStr,
LPCWSTR  lpszComp,
INT  iLen 
)

Definition at line 384 of file string.c.

385{
386 TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen);
387 return CompareStringW(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen) - CSTR_EQUAL;
388}

◆ StrCmpW()

int WINAPI StrCmpW ( LPCWSTR  lpszStr,
LPCWSTR  lpszComp 
)

◆ StrCpyNW()

LPWSTR WINAPI StrCpyNW ( LPWSTR  dst,
LPCWSTR  src,
int  count 
)

Definition at line 536 of file string.c.

537{
538 LPWSTR d = dst;
539 LPCWSTR s = src;
540
541 TRACE("(%p,%s,%i)\n", dst, debugstr_w(src), count);
542
543 if (s)
544 {
545 while ((count > 1) && *s)
546 {
547 count--;
548 *d++ = *s++;
549 }
550 }
551 if (count) *d = 0;
552
553 return dst;
554}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
#define d
Definition: ke_i.h:81
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by CIniPropertyBag::_GetSectionAndName(), CZipExtract::Extract(), PathCreateFromUrlW(), SHCreatePropertyBagOnProfileSection(), Shell_ParseSpecialFolder(), ShellExec_RunDLL_Helper(), SHGlobalCounterCreateNamedW(), SHPathPrepareForWriteW(), StrCatBuffW(), StrNCatW(), and test_StrXXX_overflows().

◆ StrCpyNXA()

LPSTR WINAPI StrCpyNXA ( LPSTR  lpszDest,
LPCSTR  lpszSrc,
int  iLen 
)

Definition at line 2263 of file string.c.

2264{
2265 TRACE("(%p,%s,%i)\n", lpszDest, debugstr_a(lpszSrc), iLen);
2266
2267 if (lpszDest && lpszSrc && iLen > 0)
2268 {
2269 while ((iLen-- > 1) && *lpszSrc)
2270 *lpszDest++ = *lpszSrc++;
2271 if (iLen >= 0)
2272 *lpszDest = '\0';
2273 }
2274 return lpszDest;
2275}
WCHAR lpszDest[260]

Referenced by SHAnsiToAnsi().

◆ StrCpyNXW()

LPWSTR WINAPI StrCpyNXW ( LPWSTR  lpszDest,
LPCWSTR  lpszSrc,
int  iLen 
)

Definition at line 2282 of file string.c.

2283{
2284 TRACE("(%p,%s,%i)\n", lpszDest, debugstr_w(lpszSrc), iLen);
2285
2286 if (lpszDest && lpszSrc && iLen > 0)
2287 {
2288 while ((iLen-- > 1) && *lpszSrc)
2289 *lpszDest++ = *lpszSrc++;
2290 if (iLen >= 0)
2291 *lpszDest = '\0';
2292 }
2293 return lpszDest;
2294}

Referenced by SHUnicodeToUnicode().

◆ StrCpyW()

LPWSTR WINAPI StrCpyW ( LPWSTR  lpszStr,
LPCWSTR  lpszSrc 
)

Definition at line 514 of file string.c.

515{
516 TRACE("(%p,%s)\n", lpszStr, debugstr_w(lpszSrc));
517
518 if (lpszStr && lpszSrc)
519 strcpyW(lpszStr, lpszSrc);
520 return lpszStr;
521}
#define strcpyW(d, s)
Definition: unicode.h:35

Referenced by _ShowContextMenu(), PathCreateFromUrlW(), and test_StrCpyW().

◆ StrCSpnA()

int WINAPI StrCSpnA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 1189 of file string.c.

1190{
1191 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
1192
1193 return SHLWAPI_StrSpnHelperA(lpszStr, lpszMatch, StrChrA, TRUE);
1194}
static int SHLWAPI_StrSpnHelperA(LPCSTR lpszStr, LPCSTR lpszMatch, LPSTR(WINAPI *pStrChrFn)(LPCSTR, WORD), BOOL bInvert)
Definition: string.c:1122

◆ StrCSpnIA()

int WINAPI StrCSpnIA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 1221 of file string.c.

1222{
1223 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
1224
1225 return SHLWAPI_StrSpnHelperA(lpszStr, lpszMatch, StrChrIA, TRUE);
1226}
LPSTR WINAPI StrChrIA(LPCSTR lpszStr, WORD ch)
Definition: string.c:610

◆ StrCSpnIW()

int WINAPI StrCSpnIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 1233 of file string.c.

1234{
1235 LPCWSTR lpszRead = lpszStr;
1236
1237 TRACE("(%s,%s)\n",debugstr_w(lpszStr), debugstr_w(lpszMatch));
1238
1239 if (lpszStr && *lpszStr && lpszMatch)
1240 {
1241 while (*lpszRead)
1242 {
1243 if (StrChrIW(lpszMatch, *lpszRead)) break;
1244 lpszRead++;
1245 }
1246 }
1247 return lpszRead - lpszStr;
1248}
LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:631

◆ StrCSpnW()

int WINAPI StrCSpnW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 1201 of file string.c.

1202{
1203 if (!lpszStr || !lpszMatch) return 0;
1204 return strcspnW( lpszStr, lpszMatch );
1205}
#define strcspnW(d, s)
Definition: unicode.h:37

◆ StrDupA()

LPSTR WINAPI StrDupA ( LPCSTR  lpszStr)

Definition at line 1064 of file string.c.

1065{
1066 int iLen;
1067 LPSTR lpszRet;
1068
1069 TRACE("(%s)\n",debugstr_a(lpszStr));
1070
1071#ifdef __REACTOS__
1072 if (!lpszStr)
1073 return NULL;
1074#endif
1075 iLen = lpszStr ? strlen(lpszStr) + 1 : 1;
1076 lpszRet = LocalAlloc(LMEM_FIXED, iLen);
1077
1078 if (lpszRet)
1079 {
1080 if (lpszStr)
1081 memcpy(lpszRet, lpszStr, iLen);
1082 else
1083 *lpszRet = '\0';
1084 }
1085 return lpszRet;
1086}
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
#define LMEM_FIXED
Definition: winbase.h:394

Referenced by TEST_StrDupA(), and test_StrDupA().

◆ StrDupW()

LPWSTR WINAPI StrDupW ( LPCWSTR  lpszStr)

Definition at line 1093 of file string.c.

1094{
1095 int iLen;
1096 LPWSTR lpszRet;
1097
1098 TRACE("(%s)\n",debugstr_w(lpszStr));
1099
1100#ifdef __REACTOS__
1101 if (!lpszStr)
1102 return NULL;
1103#endif
1104 iLen = (lpszStr ? strlenW(lpszStr) + 1 : 1) * sizeof(WCHAR);
1105 lpszRet = LocalAlloc(LMEM_FIXED, iLen);
1106
1107 if (lpszRet)
1108 {
1109 if (lpszStr)
1110 memcpy(lpszRet, lpszStr, iLen);
1111 else
1112 *lpszRet = '\0';
1113 }
1114 return lpszRet;
1115}

Referenced by FileDialog_constructor(), IFileDialog2_fnSetCancelButtonLabel(), IFileDialog2_fnSetDefaultExtension(), IFileDialog2_fnSetFileNameLabel(), IFileDialog2_fnSetFileTypes(), IFileDialog2_fnSetOkButtonLabel(), IFileDialog2_fnSetTitle(), CViewStatePropertyBag::Init(), CIniPropertyBag::Init(), IStream_Create(), IStream_fnStat(), PathCreateFromUrlAlloc(), set_file_name(), SHELL_execute(), SHLoadIndirectString(), SHParseDisplayName(), TEST_StrDupW(), and test_StrXXX_overflows().

◆ StrFormatByteSize64A()

LPSTR WINAPI StrFormatByteSize64A ( LONGLONG  llBytes,
LPSTR  lpszDest,
UINT  cchMax 
)

Definition at line 2502 of file string.c.

2503{
2504 WCHAR wszBuff[32];
2505
2506 StrFormatByteSizeW(llBytes, wszBuff, sizeof(wszBuff)/sizeof(WCHAR));
2507
2508 if (lpszDest)
2509 WideCharToMultiByte(CP_ACP, 0, wszBuff, -1, lpszDest, cchMax, 0, 0);
2510 return lpszDest;
2511}
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2394

Referenced by CDrivesFolder::GetDetailsOf(), and StrFormatByteSizeA().

◆ StrFormatByteSizeA()

LPSTR WINAPI StrFormatByteSizeA ( DWORD  dwBytes,
LPSTR  lpszDest,
UINT  cchMax 
)

Definition at line 2530 of file string.c.

2531{
2532 TRACE("(%d,%p,%d)\n", dwBytes, lpszDest, cchMax);
2533
2534 return StrFormatByteSize64A(dwBytes, lpszDest, cchMax);
2535}
LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
Definition: string.c:2502

Referenced by CCabFolder::GetItemDetails().

◆ StrFormatByteSizeW()

LPWSTR WINAPI StrFormatByteSizeW ( LONGLONG  llBytes,
LPWSTR  lpszDest,
UINT  cchMax 
)

Definition at line 2394 of file string.c.

2395{
2396#define KB ((ULONGLONG)1024)
2397#define MB (KB*KB)
2398#define GB (KB*KB*KB)
2399#define TB (KB*KB*KB*KB)
2400#define PB (KB*KB*KB*KB*KB)
2401
2402 static const SHLWAPI_BYTEFORMATS bfFormats[] =
2403 {
2404#ifdef __REACTOS__
2405 { 10*KB, 10.24, 100.0, 2, IDS_KB_FORMAT }, /* 10 KB */
2406 { 100*KB, 102.4, 10.0, 1, IDS_KB_FORMAT }, /* 100 KB */
2407 { 1000*KB, 1024.0, 1.0, 0, IDS_KB_FORMAT }, /* 1000 KB */
2408 { 10*MB, 10485.76, 100.0, 2, IDS_MB_FORMAT }, /* 10 MB */
2409 { 100*MB, 104857.6, 10.0, 1, IDS_MB_FORMAT }, /* 100 MB */
2410 { 1000*MB, 1048576.0, 1.0, 0, IDS_MB_FORMAT }, /* 1000 MB */
2411 { 10*GB, 10737418.24, 100.0, 2, IDS_GB_FORMAT }, /* 10 GB */
2412 { 100*GB, 107374182.4, 10.0, 1, IDS_GB_FORMAT }, /* 100 GB */
2413 { 1000*GB, 1073741824.0, 1.0, 0, IDS_GB_FORMAT }, /* 1000 GB */
2414 { 10*TB, 10485.76, 100.0, 2, IDS_TB_FORMAT }, /* 10 TB */
2415 { 100*TB, 104857.6, 10.0, 1, IDS_TB_FORMAT }, /* 100 TB */
2416 { 1000*TB, 1048576.0, 1.0, 0, IDS_TB_FORMAT }, /* 1000 TB */
2417 { 10*PB, 10737418.24, 100.00, 2, IDS_PB_FORMAT }, /* 10 PB */
2418 { 100*PB, 107374182.4, 10.00, 1, IDS_PB_FORMAT }, /* 100 PB */
2419 { 1000*PB, 1073741824.0, 1.00, 0, IDS_PB_FORMAT }, /* 1000 PB */
2420 { 0, 10995116277.76, 100.00, 2, IDS_EB_FORMAT } /* EB's, catch all */
2421#else
2422 { 10*KB, 10.24, 100.0, 2, 'K' }, /* 10 KB */
2423 { 100*KB, 102.4, 10.0, 1, 'K' }, /* 100 KB */
2424 { 1000*KB, 1024.0, 1.0, 0, 'K' }, /* 1000 KB */
2425 { 10*MB, 10485.76, 100.0, 2, 'M' }, /* 10 MB */
2426 { 100*MB, 104857.6, 10.0, 1, 'M' }, /* 100 MB */
2427 { 1000*MB, 1048576.0, 1.0, 0, 'M' }, /* 1000 MB */
2428 { 10*GB, 10737418.24, 100.0, 2, 'G' }, /* 10 GB */
2429 { 100*GB, 107374182.4, 10.0, 1, 'G' }, /* 100 GB */
2430 { 1000*GB, 1073741824.0, 1.0, 0, 'G' }, /* 1000 GB */
2431 { 10*TB, 10485.76, 100.0, 2, 'T' }, /* 10 TB */
2432 { 100*TB, 104857.6, 10.0, 1, 'T' }, /* 100 TB */
2433 { 1000*TB, 1048576.0, 1.0, 0, 'T' }, /* 1000 TB */
2434 { 10*PB, 10737418.24, 100.00, 2, 'P' }, /* 10 PB */
2435 { 100*PB, 107374182.4, 10.00, 1, 'P' }, /* 100 PB */
2436 { 1000*PB, 1073741824.0, 1.00, 0, 'P' }, /* 1000 PB */
2437 { 0, 10995116277.76, 100.00, 2, 'E' } /* EB's, catch all */
2438#endif
2439 };
2440#ifdef __REACTOS__
2441 WCHAR szBuff[40], wszFormat[40];
2442#else
2443 WCHAR wszAdd[] = {' ','?','B',0};
2444#endif
2445 double dBytes;
2446 UINT i = 0;
2447
2448 TRACE("(0x%s,%p,%d)\n", wine_dbgstr_longlong(llBytes), lpszDest, cchMax);
2449
2450 if (!lpszDest || !cchMax)
2451 return lpszDest;
2452
2453 if (llBytes < 1024) /* 1K */
2454 {
2455 WCHAR wszBytesFormat[64];
2456 LoadStringW(shlwapi_hInstance, IDS_BYTES_FORMAT, wszBytesFormat, 64);
2457 snprintfW(lpszDest, cchMax, wszBytesFormat, (int)llBytes);
2458 return lpszDest;
2459 }
2460
2461 /* Note that if this loop completes without finding a match, i will be
2462 * pointing at the last entry, which is a catch all for > 1000 PB
2463 */
2464 while (i < sizeof(bfFormats) / sizeof(SHLWAPI_BYTEFORMATS) - 1)
2465 {
2466 if (llBytes < bfFormats[i].dLimit)
2467 break;
2468 i++;
2469 }
2470 /* Above 1 TB we encounter problems with FP accuracy. So for amounts above
2471 * this number we integer shift down by 1 MB first. The table above has
2472 * the divisors scaled down from the '< 10 TB' entry onwards, to account
2473 * for this. We also add a small fudge factor to get the correct result for
2474 * counts that lie exactly on a 1024 byte boundary.
2475 */
2476 if (i > 8)
2477 dBytes = (double)(llBytes >> 20) + 0.001; /* Scale down by 1 MB */
2478 else
2479 dBytes = (double)llBytes + 0.00001;
2480
2481 dBytes = floor(dBytes / bfFormats[i].dDivisor) / bfFormats[i].dNormaliser;
2482
2483#ifdef __REACTOS__
2484 if (!FormatDouble(dBytes, bfFormats[i].nDecimals, szBuff, ARRAYSIZE(szBuff)))
2485 return NULL;
2486 LoadStringW(shlwapi_hInstance, bfFormats[i].nFormatID, wszFormat, ARRAYSIZE(wszFormat));
2487 snprintfW(lpszDest, cchMax, wszFormat, szBuff);
2488#else
2489 if (!FormatDouble(dBytes, bfFormats[i].nDecimals, lpszDest, cchMax))
2490 return NULL;
2491 wszAdd[1] = bfFormats[i].wPrefix;
2492 StrCatBuffW(lpszDest, wszAdd, cchMax);
2493#endif
2494 return lpszDest;
2495}
#define IDS_BYTES_FORMAT
Definition: resource.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define KB
#define PB
LPWSTR WINAPI StrCatBuffW(LPWSTR lpszStr, LPCWSTR lpszCat, INT cchMax)
Definition: string.c:1444
#define TB
#define GB
#define MB
static int FormatDouble(double value, int decimals, LPWSTR pszBuf, int cchBuf)
Definition: string.c:129
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
unsigned int UINT
Definition: ndis.h:50

Referenced by AddUserProfile(), CAvailableApplicationInfo::CAvailableApplicationInfo(), dialog_vcl_add_drives(), FormatFileSizeWithBytes(), CZipFolder::GetDetailsOf(), CDrvDefExt::InitGeneralPage(), InitializeFormatDriveDlg(), InitializeRecycleBinDlg(), InsertDefaultClusterSizeForFs(), PerformancePageRefreshThread(), PrintDiskData(), PrintPartitionData(), CDownloaderProgress::SetProgress(), SH_FormatFileSizeWithBytes(), ShortSizeFormatW(), StrFormatByteSize64A(), UpdateLanStatusUiDlg(), and CDefView::UpdateStatusbar().

◆ StrFormatKBSizeA()

LPSTR WINAPI StrFormatKBSizeA ( LONGLONG  llBytes,
LPSTR  lpszDest,
UINT  cchMax 
)

Definition at line 1741 of file string.c.

1742{
1743 WCHAR wszBuf[256];
1744
1745 if (!StrFormatKBSizeW(llBytes, wszBuf, 256))
1746 return NULL;
1747 if (!WideCharToMultiByte(CP_ACP, 0, wszBuf, -1, lpszDest, cchMax, NULL, NULL))
1748 return NULL;
1749 return lpszDest;
1750}
LPWSTR WINAPI StrFormatKBSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:1757

Referenced by CFontExt::GetDetailsOf().

◆ StrFormatKBSizeW()

LPWSTR WINAPI StrFormatKBSizeW ( LONGLONG  llBytes,
LPWSTR  lpszDest,
UINT  cchMax 
)

Definition at line 1757 of file string.c.

1758{
1759 static const WCHAR kb[] = {' ','K','B',0};
1760 LONGLONG llKB = (llBytes + 1023) >> 10;
1761 int len;
1762
1763 TRACE("(0x%s,%p,%d)\n", wine_dbgstr_longlong(llBytes), lpszDest, cchMax);
1764
1765 if (!FormatInt(llKB, lpszDest, cchMax))
1766 return NULL;
1767
1769 if (cchMax - len < 4)
1770 return NULL;
1771 lstrcatW(lpszDest, kb);
1772 return lpszDest;
1773}
static int FormatInt(LONGLONG qdwValue, LPWSTR pszBuf, int cchBuf)
Definition: string.c:96
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
int64_t LONGLONG
Definition: typedefs.h:68

Referenced by _ILGetFileSize(), CFSFolder::FormatSize(), and StrFormatKBSizeA().

◆ StrFromTimeIntervalA()

INT WINAPI StrFromTimeIntervalA ( LPSTR  lpszStr,
UINT  cchMax,
DWORD  dwMS,
int  iDigits 
)

Definition at line 2131 of file string.c.

2133{
2134 INT iRet = 0;
2135
2136 TRACE("(%p,%d,%d,%d)\n", lpszStr, cchMax, dwMS, iDigits);
2137
2138 if (lpszStr && cchMax)
2139 {
2140 WCHAR szBuff[128];
2141 StrFromTimeIntervalW(szBuff, sizeof(szBuff)/sizeof(WCHAR), dwMS, iDigits);
2142 WideCharToMultiByte(CP_ACP,0,szBuff,-1,lpszStr,cchMax,0,0);
2143 }
2144 return iRet;
2145}
INT WINAPI StrFromTimeIntervalW(LPWSTR lpszStr, UINT cchMax, DWORD dwMS, int iDigits)
Definition: string.c:2153

Referenced by test_StrFromTimeIntervalA().

◆ StrFromTimeIntervalW()

INT WINAPI StrFromTimeIntervalW ( LPWSTR  lpszStr,
UINT  cchMax,
DWORD  dwMS,
int  iDigits 
)

Definition at line 2153 of file string.c.

2155{
2156 INT iRet = 0;
2157
2158 TRACE("(%p,%d,%d,%d)\n", lpszStr, cchMax, dwMS, iDigits);
2159
2160 if (lpszStr && cchMax)
2161 {
2162 WCHAR szCopy[128];
2163 DWORD dwHours, dwMinutes;
2164
2165 if (!iDigits || cchMax == 1)
2166 {
2167 *lpszStr = '\0';
2168 return 0;
2169 }
2170
2171 /* Calculate the time classes */
2172 dwMS = (dwMS + 500) / 1000;
2173 dwHours = dwMS / 3600;
2174 dwMS -= dwHours * 3600;
2175 dwMinutes = dwMS / 60;
2176 dwMS -= dwMinutes * 60;
2177
2178 szCopy[0] = '\0';
2179
2180 if (dwHours)
2181 iDigits = SHLWAPI_WriteTimeClass(szCopy, dwHours, IDS_TIME_INTERVAL_HOURS, iDigits);
2182
2183 if (dwMinutes && iDigits)
2184 iDigits = SHLWAPI_WriteTimeClass(szCopy, dwMinutes, IDS_TIME_INTERVAL_MINUTES, iDigits);
2185
2186 if (iDigits) /* Always write seconds if we have significant digits */
2187 SHLWAPI_WriteTimeClass(szCopy, dwMS, IDS_TIME_INTERVAL_SECONDS, iDigits);
2188
2189 lstrcpynW(lpszStr, szCopy, cchMax);
2190 iRet = strlenW(lpszStr);
2191 }
2192 return iRet;
2193}
#define IDS_TIME_INTERVAL_MINUTES
Definition: resource.h:28
#define IDS_TIME_INTERVAL_HOURS
Definition: resource.h:27
#define IDS_TIME_INTERVAL_SECONDS
Definition: resource.h:29
static int SHLWAPI_WriteTimeClass(LPWSTR lpszOut, DWORD dwValue, UINT uClassStringId, int iDigits)
Definition: string.c:2087

Referenced by dialog_proc(), and StrFromTimeIntervalA().

◆ StrIsIntlEqualA()

BOOL WINAPI StrIsIntlEqualA ( BOOL  bCase,
LPCSTR  lpszStr,
LPCSTR  lpszComp,
int  iLen 
)

Definition at line 2210 of file string.c.

2212{
2213 DWORD dwFlags;
2214
2215 TRACE("(%d,%s,%s,%d)\n", bCase,
2216 debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
2217
2218 /* FIXME: This flag is undocumented and unknown by our CompareString.
2219 * We need a define for it.
2220 */
2221 dwFlags = 0x10000000;
2222 if (!bCase) dwFlags |= NORM_IGNORECASE;
2223
2224 return (CompareStringA(GetThreadLocale(), dwFlags, lpszStr, iLen, lpszComp, iLen) == CSTR_EQUAL);
2225}

◆ StrIsIntlEqualW()

BOOL WINAPI StrIsIntlEqualW ( BOOL  bCase,
LPCWSTR  lpszStr,
LPCWSTR  lpszComp,
int  iLen 
)

Definition at line 2232 of file string.c.

2234{
2235 DWORD dwFlags;
2236
2237 TRACE("(%d,%s,%s,%d)\n", bCase,
2238 debugstr_w(lpszStr),debugstr_w(lpszComp), iLen);
2239
2240 /* FIXME: This flag is undocumented and unknown by our CompareString.
2241 * We need a define for it.
2242 */
2243 dwFlags = 0x10000000;
2244 if (!bCase) dwFlags |= NORM_IGNORECASE;
2245
2246 return (CompareStringW(GetThreadLocale(), dwFlags, lpszStr, iLen, lpszComp, iLen) == CSTR_EQUAL);
2247}

◆ StrNCatA()

LPSTR WINAPI StrNCatA ( LPSTR  lpszStr,
LPCSTR  lpszCat,
INT  cchMax 
)

Definition at line 1792 of file string.c.

1793{
1794 LPSTR lpszRet = lpszStr;
1795
1796 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszCat), cchMax);
1797
1798 if (!lpszStr)
1799 {
1800 WARN("Invalid lpszStr would crash under Win32!\n");
1801 return NULL;
1802 }
1803
1804 StrCpyNA(lpszStr + strlen(lpszStr), lpszCat, cchMax);
1805 return lpszRet;
1806}

◆ StrNCatW()

LPWSTR WINAPI StrNCatW ( LPWSTR  lpszStr,
LPCWSTR  lpszCat,
INT  cchMax 
)

Definition at line 1813 of file string.c.

1814{
1815 LPWSTR lpszRet = lpszStr;
1816
1817 TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszCat), cchMax);
1818
1819 if (!lpszStr)
1820 {
1821 WARN("Invalid lpszStr would crash under Win32\n");
1822 return NULL;
1823 }
1824
1825 StrCpyNW(lpszStr + strlenW(lpszStr), lpszCat, cchMax);
1826 return lpszRet;
1827}

◆ StrPBrkA()

LPSTR WINAPI StrPBrkA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 1263 of file string.c.

1264{
1265 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
1266
1267 if (lpszStr && lpszMatch && *lpszMatch)
1268 {
1269 while (*lpszStr)
1270 {
1271 if (StrChrA(lpszMatch, *lpszStr))
1272 return (LPSTR)lpszStr;
1273 lpszStr = CharNextA(lpszStr);
1274 }
1275 }
1276 return NULL;
1277}

◆ StrPBrkW()

LPWSTR WINAPI StrPBrkW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 1284 of file string.c.

1285{
1286 if (!lpszStr || !lpszMatch) return NULL;
1287 return strpbrkW( lpszStr, lpszMatch );
1288}
#define strpbrkW(str, accept)
Definition: unicode.h:49

Referenced by CheckEscapesW(), parse_file_list(), and SHFindAttrW().

◆ StrRChrA()

LPSTR WINAPI StrRChrA ( LPCSTR  lpszStr,
LPCSTR  lpszEnd,
WORD  ch 
)

Definition at line 1335 of file string.c.

1336{
1337 TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
1338
1339 return SHLWAPI_StrRChrHelperA(lpszStr, lpszEnd, ch, SHLWAPI_ChrCmpA);
1340}
static LPSTR SHLWAPI_StrRChrHelperA(LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch, BOOL(WINAPI *pChrCmpFn)(WORD, WORD))
Definition: string.c:1295

◆ StrRChrIA()

LPSTR WINAPI StrRChrIA ( LPCSTR  lpszStr,
LPCSTR  lpszEnd,
WORD  ch 
)

Definition at line 1376 of file string.c.

1377{
1378 TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
1379
1380 return SHLWAPI_StrRChrHelperA(lpszStr, lpszEnd, ch, ChrCmpIA);
1381}

◆ StrRChrIW()

LPWSTR WINAPI StrRChrIW ( LPCWSTR  str,
LPCWSTR  end,
WORD  ch 
)

Definition at line 1388 of file string.c.

1389{
1390 WCHAR *ret = NULL;
1391
1392 if (!str) return NULL;
1393 if (!end) end = str + strlenW(str);
1394 while (str < end)
1395 {
1396 if (!ChrCmpIW(*str, ch)) ret = (WCHAR *)str;
1397 str++;
1398 }
1399 return ret;
1400}
const WCHAR * str
int ret

◆ StrRChrW()

LPWSTR WINAPI StrRChrW ( LPCWSTR  str,
LPCWSTR  end,
WORD  ch 
)

Definition at line 1347 of file string.c.

1348{
1349 WCHAR *ret = NULL;
1350
1351 if (!str) return NULL;
1352 if (!end) end = str + strlenW(str);
1353 while (str < end)
1354 {
1355 if (*str == ch) ret = (WCHAR *)str;
1356 str++;
1357 }
1358 return ret;
1359}

◆ StrRetToBSTR()

HRESULT WINAPI StrRetToBSTR ( STRRET lpStrRet,
LPCITEMIDLIST  pidl,
BSTR pBstrOut 
)

Definition at line 1700 of file string.c.

1701{
1702 HRESULT hRet = E_FAIL;
1703
1704 switch (lpStrRet->uType)
1705 {
1706 case STRRET_WSTR:
1707 *pBstrOut = SysAllocString(lpStrRet->u.pOleStr);
1708 if (*pBstrOut)
1709 hRet = S_OK;
1710 CoTaskMemFree(lpStrRet->u.pOleStr);
1711 break;
1712
1713 case STRRET_CSTR:
1714 hRet = _SHStrDupAToBSTR(lpStrRet->u.cStr, pBstrOut);
1715 break;
1716
1717 case STRRET_OFFSET:
1718 hRet = _SHStrDupAToBSTR(((LPCSTR)&pidl->mkid) + lpStrRet->u.uOffset, pBstrOut);
1719 break;
1720
1721 default:
1722 *pBstrOut = NULL;
1723 }
1724
1725 return hRet;
1726}
static HRESULT _SHStrDupAToBSTR(LPCSTR src, BSTR *pBstrOut)
Definition: string.c:1664
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
@ STRRET_CSTR
Definition: shtypes.idl:87
@ STRRET_OFFSET
Definition: shtypes.idl:86
@ STRRET_WSTR
Definition: shtypes.idl:85
char cStr[MAX_PATH]
Definition: shtypes.idl:98
UINT uType
Definition: shtypes.idl:93
LPWSTR pOleStr
Definition: shtypes.idl:96
UINT uOffset
Definition: shtypes.idl:97

Referenced by CFolderItem::get_Name(), CFolderItem::get_Path(), and StrRetToVariantBSTR().

◆ StrRetToBufA()

HRESULT WINAPI StrRetToBufA ( LPSTRRET  src,
const ITEMIDLIST pidl,
LPSTR  dest,
UINT  len 
)

Definition at line 1481 of file string.c.

1482{
1483 /* NOTE:
1484 * This routine is identical to that in dlls/shell32/shellstring.c.
1485 * It was duplicated because not every version of Shlwapi.dll exports
1486 * StrRetToBufA. If you change one routine, change them both.
1487 */
1488 TRACE("dest=%p len=0x%x strret=%p pidl=%p\n", dest, len, src, pidl);
1489
1490 if (!src)
1491 {
1492 WARN("Invalid lpStrRet would crash under Win32!\n");
1493 if (dest)
1494 *dest = '\0';
1495 return E_FAIL;
1496 }
1497
1498 if (!dest || !len)
1499 return E_FAIL;
1500
1501 *dest = '\0';
1502
1503 switch (src->uType)
1504 {
1505 case STRRET_WSTR:
1506 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, dest, len, NULL, NULL);
1507 CoTaskMemFree(src->u.pOleStr);
1508 break;
1509
1510 case STRRET_CSTR:
1511 lstrcpynA(dest, src->u.cStr, len);
1512 break;
1513
1514 case STRRET_OFFSET:
1515 lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
1516 break;
1517
1518 default:
1519 FIXME("unknown type!\n");
1520 return E_NOTIMPL;
1521 }
1522 return S_OK;
1523}
#define E_NOTIMPL
Definition: ddrawi.h:99
SHITEMID mkid
Definition: shtypes.idl:34

◆ StrRetToBufW()

HRESULT WINAPI StrRetToBufW ( LPSTRRET  src,
const ITEMIDLIST pidl,
LPWSTR  dest,
UINT  len 
)

Definition at line 1530 of file string.c.

1531{
1532 TRACE("dest=%p len=0x%x strret=%p pidl=%p\n", dest, len, src, pidl);
1533
1534 if (!dest || !len)
1535 return E_FAIL;
1536
1537 if (!src)
1538 {
1539 WARN("Invalid lpStrRet would crash under Win32!\n");
1540 if (dest)
1541 *dest = '\0';
1542 return E_FAIL;
1543 }
1544
1545 *dest = '\0';
1546
1547 switch (src->uType) {
1548 case STRRET_WSTR: {
1549 size_t dst_len;
1550 if (!src->u.pOleStr)
1551 return E_FAIL;
1552 dst_len = strlenW(src->u.pOleStr);
1553 memcpy(dest, src->u.pOleStr, min(dst_len, len-1) * sizeof(WCHAR));
1554 dest[min(dst_len, len-1)] = 0;
1555 CoTaskMemFree(src->u.pOleStr);
1556 if (len <= dst_len)
1557 {
1558 dest[0] = 0;
1560 }
1561 break;
1562 }
1563
1564 case STRRET_CSTR:
1565 if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ))
1566 dest[len-1] = 0;
1567 break;
1568
1569 case STRRET_OFFSET:
1570 if (pidl)
1571 {
1572 if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1,
1573 dest, len ))
1574 dest[len-1] = 0;
1575 }
1576 break;
1577
1578 default:
1579 FIXME("unknown type!\n");
1580 return E_NOTIMPL;
1581 }
1582
1583 return S_OK;
1584}
#define min(a, b)
Definition: monoChain.cc:55
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345

Referenced by CFSDropTarget::_CopyItems(), CAddressEditBox::AddComboBoxItem(), COMDLG32_GetDisplayNameOf(), COMDLG32_UpdateCurrentDir(), CMyDocsDropHandler::Drop(), CDeskLinkDropHandler::Drop(), FindExpectedFile(), GetCommandString(), GetDisplayName(), CCommonFolder< TSelf, TItemId, TExtractIcon >::GetDisplayNameOf(), GetFullName(), IEGetNameAndFlagsEx(), ok_displayname_(), SHELL32_CompareDetails(), Shell_DisplayNameOf(), SHGetPathCchFromIDListW(), SHGetRealIDL(), SHIsRemovableDrive(), SHOpenFolderAndSelectItems(), test_desktop_displaynameof(), test_FolderShortcut(), test_GetDisplayName(), test_LocalizedNames(), test_SHGetNameFromIDList(), and test_SHGetPathFromIDList().

◆ StrRetToStrA()

HRESULT WINAPI StrRetToStrA ( LPSTRRET  lpStrRet,
const ITEMIDLIST pidl,
LPSTR ppszName 
)

Definition at line 1600 of file string.c.

1601{
1602 HRESULT hRet = E_FAIL;
1603
1604 switch (lpStrRet->uType)
1605 {
1606 case STRRET_WSTR:
1607 hRet = _SHStrDupAW(lpStrRet->u.pOleStr, ppszName);
1608 CoTaskMemFree(lpStrRet->u.pOleStr);
1609 break;
1610
1611 case STRRET_CSTR:
1612 hRet = _SHStrDupAA(lpStrRet->u.cStr, ppszName);
1613 break;
1614
1615 case STRRET_OFFSET:
1616 hRet = _SHStrDupAA(((LPCSTR)&pidl->mkid) + lpStrRet->u.uOffset, ppszName);
1617 break;
1618
1619 default:
1620 *ppszName = NULL;
1621 }
1622
1623 return hRet;
1624}
static HRESULT _SHStrDupAA(LPCSTR, LPSTR *)
Definition: string.c:1923
static HRESULT _SHStrDupAW(LPCWSTR, LPSTR *)
Definition: string.c:1990
SIGDN PWSTR * ppszName
Definition: shobjidl.idl:606

◆ StrRetToStrW()

HRESULT WINAPI StrRetToStrW ( LPSTRRET  lpStrRet,
const ITEMIDLIST pidl,
LPWSTR ppszName 
)

Definition at line 1631 of file string.c.

1632{
1633 HRESULT hRet = E_FAIL;
1634
1635 switch (lpStrRet->uType)
1636 {
1637 case STRRET_WSTR:
1638#ifdef __REACTOS__
1639 hRet = lpStrRet->u.pOleStr ? S_OK : E_FAIL;
1640 *ppszName = lpStrRet->u.pOleStr;
1641 lpStrRet->u.pOleStr = NULL; /* Windows does this, presumably in case someone calls SHFree */
1642#else
1643 hRet = SHStrDupW(lpStrRet->u.pOleStr, ppszName);
1644 CoTaskMemFree(lpStrRet->u.pOleStr);
1645#endif
1646 break;
1647
1648 case STRRET_CSTR:
1649 hRet = SHStrDupA(lpStrRet->u.cStr, ppszName);
1650 break;
1651
1652 case STRRET_OFFSET:
1653 hRet = SHStrDupA(((LPCSTR)&pidl->mkid) + lpStrRet->u.uOffset, ppszName);
1654 break;
1655
1656 default:
1657 *ppszName = NULL;
1658 }
1659
1660 return hRet;
1661}
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
Definition: string.c:2018
HRESULT WINAPI SHStrDupA(LPCSTR lpszStr, LPWSTR *lppszDest)
Definition: string.c:1960

Referenced by CEnumMergedFolder::Begin(), GetDetailsOf(), GetDisplayname(), CACListISF::GetDisplayName(), CSendToMenu::LoadAllItems(), SHELL32_GetFSItemAttributes(), SHGetNameFromIDList(), and TEST_StrRet().

◆ StrRStrIA()

LPSTR WINAPI StrRStrIA ( LPCSTR  lpszStr,
LPCSTR  lpszEnd,
LPCSTR  lpszSearch 
)

Definition at line 627 of file string.c.

628{
629 LPSTR lpszRet = NULL;
630 WORD ch1, ch2;
631 INT iLen;
632
633 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
634
635 if (!lpszStr || !lpszSearch || !*lpszSearch)
636 return NULL;
637
638 if (IsDBCSLeadByte(*lpszSearch))
639 ch1 = *lpszSearch << 8 | (UCHAR)lpszSearch[1];
640 else
641 ch1 = *lpszSearch;
642 iLen = lstrlenA(lpszSearch);
643
644 if (!lpszEnd)
645 lpszEnd = lpszStr + lstrlenA(lpszStr);
646 else /* reproduce the broken behaviour on Windows */
647 lpszEnd += min(iLen - 1, lstrlenA(lpszEnd));
648
649 while (lpszStr + iLen <= lpszEnd && *lpszStr)
650 {
651 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | (UCHAR)lpszStr[1] : *lpszStr;
652 if (!ChrCmpIA(ch1, ch2))
653 {
654 if (!StrCmpNIA(lpszStr, lpszSearch, iLen))
655 lpszRet = (LPSTR)lpszStr;
656 }
657 lpszStr = CharNextA(lpszStr);
658 }
659 return lpszRet;
660}
INT WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:296
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ StrRStrIW()

LPWSTR WINAPI StrRStrIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszEnd,
LPCWSTR  lpszSearch 
)

Definition at line 667 of file string.c.

668{
669 LPWSTR lpszRet = NULL;
670 INT iLen;
671
672 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
673
674 if (!lpszStr || !lpszSearch || !*lpszSearch)
675 return NULL;
676
677 iLen = strlenW(lpszSearch);
678
679 if (!lpszEnd)
680 lpszEnd = lpszStr + strlenW(lpszStr);
681 else /* reproduce the broken behaviour on Windows */
682 lpszEnd += min(iLen - 1, lstrlenW(lpszEnd));
683
684 while (lpszStr + iLen <= lpszEnd && *lpszStr)
685 {
686 if (!ChrCmpIW(*lpszSearch, *lpszStr))
687 {
688 if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
689 lpszRet = (LPWSTR)lpszStr;
690 }
691 lpszStr++;
692 }
693 return lpszRet;
694}
INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
Definition: string.c:307

◆ StrSpnA()

int WINAPI StrSpnA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 1157 of file string.c.

1158{
1159 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
1160
1161 return SHLWAPI_StrSpnHelperA(lpszStr, lpszMatch, StrChrA, FALSE);
1162}
#define FALSE
Definition: types.h:117

◆ StrSpnW()

int WINAPI StrSpnW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 1169 of file string.c.

1170{
1171 if (!lpszStr || !lpszMatch) return 0;
1172 return strspnW( lpszStr, lpszMatch );
1173}
#define strspnW(str, accept)
Definition: unicode.h:48

◆ StrStrA()

LPSTR WINAPI StrStrA ( LPCSTR  lpszStr,
LPCSTR  lpszSearch 
)

Definition at line 594 of file string.c.

595{
596 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
597
598 return SHLWAPI_StrStrHelperA(lpszStr, lpszSearch, StrCmpNA);
599}
INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:489
static LPSTR SHLWAPI_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch, INT(WINAPI *pStrCmpFn)(LPCSTR, LPCSTR, INT))
Definition: string.c:561

◆ StrStrIA()

LPSTR WINAPI StrStrIA ( LPCSTR  lpszStr,
LPCSTR  lpszSearch 
)

Definition at line 708 of file string.c.

709{
710 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
711
712 return SHLWAPI_StrStrHelperA(lpszStr, lpszSearch, StrCmpNIA);
713}

◆ StrStrIW()

LPWSTR WINAPI StrStrIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszSearch 
)

Definition at line 720 of file string.c.

721{
722 int iLen;
723 LPCWSTR end;
724
725 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
726
727 if (!lpszStr || !lpszSearch || !*lpszSearch)
728 return NULL;
729
730 iLen = strlenW(lpszSearch);
731 end = lpszStr + strlenW(lpszStr);
732
733 while (lpszStr + iLen <= end)
734 {
735 if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
736 return (LPWSTR)lpszStr;
737 lpszStr++;
738 }
739 return NULL;
740}

◆ StrStrNIW()

LPWSTR WINAPI StrStrNIW ( LPCWSTR  lpFirst,
LPCWSTR  lpSrch,
UINT  cchMax 
)

Definition at line 790 of file string.c.

791{
792 UINT i;
793 int len;
794
795 TRACE("(%s, %s, %u)\n", debugstr_w(lpFirst), debugstr_w(lpSrch), cchMax);
796
797 if (!lpFirst || !lpSrch || !*lpSrch || !cchMax)
798 return NULL;
799
800 len = strlenW(lpSrch);
801
802 for (i = cchMax; *lpFirst && (i > 0); i--, lpFirst++)
803 {
804 if (!strncmpiW(lpFirst, lpSrch, len))
805 return (LPWSTR)lpFirst;
806 }
807
808 return NULL;
809}
#define strncmpiW(s1, s2, n)
Definition: unicode.h:46

◆ StrStrNW()

LPWSTR WINAPI StrStrNW ( LPCWSTR  lpFirst,
LPCWSTR  lpSrch,
UINT  cchMax 
)

Definition at line 755 of file string.c.

756{
757 UINT i;
758 int len;
759
760 TRACE("(%s, %s, %u)\n", debugstr_w(lpFirst), debugstr_w(lpSrch), cchMax);
761
762 if (!lpFirst || !lpSrch || !*lpSrch || !cchMax)
763 return NULL;
764
765 len = strlenW(lpSrch);
766
767 for (i = cchMax; *lpFirst && (i > 0); i--, lpFirst++)
768 {
769 if (!strncmpW(lpFirst, lpSrch, len))
770 return (LPWSTR)lpFirst;
771 }
772
773 return NULL;
774}
#define strncmpW(s1, s2, n)
Definition: unicode.h:42

◆ StrStrW()

LPWSTR WINAPI StrStrW ( LPCWSTR  lpszStr,
LPCWSTR  lpszSearch 
)

Definition at line 606 of file string.c.

607{
608 TRACE("(%s, %s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
609
610 if (!lpszStr || !lpszSearch || !*lpszSearch) return NULL;
611 return strstrW( lpszStr, lpszSearch );
612}
#define strstrW(d, s)
Definition: unicode.h:38

◆ StrToInt64ExA()

BOOL WINAPI StrToInt64ExA ( LPCSTR  lpszStr,
DWORD  dwFlags,
LONGLONG lpiRet 
)

Definition at line 903 of file string.c.

904{
905 BOOL bNegative = FALSE;
906 LONGLONG iRet = 0;
907
908 TRACE("(%s,%08X,%p)\n", debugstr_a(lpszStr), dwFlags, lpiRet);
909
910 if (!lpszStr || !lpiRet)
911 {
912 WARN("Invalid parameter would crash under Win32!\n");
913 return FALSE;
914 }
915 if (dwFlags > STIF_SUPPORT_HEX) WARN("Unknown flags %08x\n", dwFlags);
916
917 /* Skip leading space, '+', '-' */
918 while (isspace(*lpszStr))
919 lpszStr = CharNextA(lpszStr);
920
921 if (*lpszStr == '-')
922 {
923 bNegative = TRUE;
924 lpszStr++;
925 }
926 else if (*lpszStr == '+')
927 lpszStr++;
928
930 *lpszStr == '0' && tolower(lpszStr[1]) == 'x')
931 {
932 /* Read hex number */
933 lpszStr += 2;
934
935 if (!isxdigit(*lpszStr))
936 return FALSE;
937
938 while (isxdigit(*lpszStr))
939 {
940 iRet = iRet * 16;
941 if (isdigit(*lpszStr))
942 iRet += (*lpszStr - '0');
943 else
944 iRet += 10 + (tolower(*lpszStr) - 'a');
945 lpszStr++;
946 }
947 *lpiRet = iRet;
948 return TRUE;
949 }
950
951 /* Read decimal number */
952 if (!isdigit(*lpszStr))
953 return FALSE;
954
955 while (isdigit(*lpszStr))
956 {
957 iRet = iRet * 10;
958 iRet += (*lpszStr - '0');
959 lpszStr++;
960 }
961 *lpiRet = bNegative ? -iRet : iRet;
962 return TRUE;
963}
#define isspace(c)
Definition: acclib.h:69
#define isdigit(c)
Definition: acclib.h:68
#define isxdigit(c)
Definition: acclib.h:70
int tolower(int c)
Definition: utclib.c:902
#define STIF_SUPPORT_HEX
Definition: shlwapi.h:1478

Referenced by StrToIntExA().

◆ StrToInt64ExW()

BOOL WINAPI StrToInt64ExW ( LPCWSTR  lpszStr,
DWORD  dwFlags,
LONGLONG lpiRet 
)

Definition at line 987 of file string.c.

988{
989 BOOL bNegative = FALSE;
990 LONGLONG iRet = 0;
991
992 TRACE("(%s,%08X,%p)\n", debugstr_w(lpszStr), dwFlags, lpiRet);
993
994 if (!lpszStr || !lpiRet)
995 {
996 WARN("Invalid parameter would crash under Win32!\n");
997 return FALSE;
998 }
999 if (dwFlags > STIF_SUPPORT_HEX) WARN("Unknown flags %08x\n", dwFlags);
1000
1001 /* Skip leading space, '+', '-' */
1002 while (isspaceW(*lpszStr)) lpszStr++;
1003
1004 if (*lpszStr == '-')
1005 {
1006 bNegative = TRUE;
1007 lpszStr++;
1008 }
1009 else if (*lpszStr == '+')
1010 lpszStr++;
1011
1012 if (dwFlags & STIF_SUPPORT_HEX &&
1013 *lpszStr == '0' && tolowerW(lpszStr[1]) == 'x')
1014 {
1015 /* Read hex number */
1016 lpszStr += 2;
1017
1018 if (!isxdigitW(*lpszStr))
1019 return FALSE;
1020
1021 while (isxdigitW(*lpszStr))
1022 {
1023 iRet = iRet * 16;
1024 if (isdigitW(*lpszStr))
1025 iRet += (*lpszStr - '0');
1026 else
1027 iRet += 10 + (tolowerW(*lpszStr) - 'a');
1028 lpszStr++;
1029 }
1030 *lpiRet = iRet;
1031 return TRUE;
1032 }
1033
1034 /* Read decimal number */
1035 if (!isdigitW(*lpszStr))
1036 return FALSE;
1037
1038 while (isdigitW(*lpszStr))
1039 {
1040 iRet = iRet * 10;
1041 iRet += (*lpszStr - '0');
1042 lpszStr++;
1043 }
1044 *lpiRet = bNegative ? -iRet : iRet;
1045 return TRUE;
1046}
#define tolowerW(n)
Definition: unicode.h:50
#define isxdigitW(n)
Definition: unicode.h:57
#define isspaceW(n)
Definition: unicode.h:58

Referenced by set_content_length(), and StrToIntExW().

◆ StrToIntA()

int WINAPI StrToIntA ( LPCSTR  lpszStr)

Definition at line 826 of file string.c.

827{
828 int iRet = 0;
829
830 TRACE("(%s)\n", debugstr_a(lpszStr));
831
832 if (!lpszStr)
833 {
834 WARN("Invalid lpszStr would crash under Win32!\n");
835 return 0;
836 }
837
838 if (*lpszStr == '-' || isdigit(*lpszStr))
839 StrToIntExA(lpszStr, 0, &iRet);
840 return iRet;
841}
BOOL WINAPI StrToIntExA(LPCSTR lpszStr, DWORD dwFlags, int *lpiRet)
Definition: string.c:886

◆ StrToIntExA()

BOOL WINAPI StrToIntExA ( LPCSTR  lpszStr,
DWORD  dwFlags,
int lpiRet 
)

Definition at line 886 of file string.c.

887{
888 LONGLONG li;
889 BOOL bRes;
890
891 TRACE("(%s,%08X,%p)\n", debugstr_a(lpszStr), dwFlags, lpiRet);
892
893 bRes = StrToInt64ExA(lpszStr, dwFlags, &li);
894 if (bRes) *lpiRet = li;
895 return bRes;
896}
BOOL WINAPI StrToInt64ExA(LPCSTR lpszStr, DWORD dwFlags, LONGLONG *lpiRet)
Definition: string.c:903
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235

Referenced by StrToIntA(), and test_StrToIntExA().

◆ StrToIntExW()

BOOL WINAPI StrToIntExW ( LPCWSTR  lpszStr,
DWORD  dwFlags,
int lpiRet 
)

Definition at line 970 of file string.c.

971{
972 LONGLONG li;
973 BOOL bRes;
974
975 TRACE("(%s,%08X,%p)\n", debugstr_w(lpszStr), dwFlags, lpiRet);
976
977 bRes = StrToInt64ExW(lpszStr, dwFlags, &li);
978 if (bRes) *lpiRet = li;
979 return bRes;
980}
BOOL WINAPI StrToInt64ExW(LPCWSTR lpszStr, DWORD dwFlags, LONGLONG *lpiRet)
Definition: string.c:987

Referenced by CompareVersion(), CAvailableApplicationInfo::RetrieveLanguages(), ShellExec_RunDLL_Helper(), StrCmpLogicalW(), StrToIntW(), test_StrToIntExW(), and UrlUnescapeW().

◆ StrToIntW()

int WINAPI StrToIntW ( LPCWSTR  lpszStr)

Definition at line 848 of file string.c.

849{
850 int iRet = 0;
851
852 TRACE("(%s)\n", debugstr_w(lpszStr));
853
854 if (!lpszStr)
855 {
856 WARN("Invalid lpszStr would crash under Win32!\n");
857 return 0;
858 }
859
860 if (*lpszStr == '-' || isdigitW(*lpszStr))
861 StrToIntExW(lpszStr, 0, &iRet);
862 return iRet;
863}

◆ StrTrimA()

BOOL WINAPI StrTrimA ( LPSTR  lpszStr,
LPCSTR  lpszTrim 
)

Definition at line 1842 of file string.c.

1843{
1844 DWORD dwLen;
1845 LPSTR lpszRead = lpszStr;
1846 BOOL bRet = FALSE;
1847
1848 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszTrim));
1849
1850 if (lpszRead && *lpszRead)
1851 {
1852 while (*lpszRead && StrChrA(lpszTrim, *lpszRead))
1853 lpszRead = CharNextA(lpszRead); /* Skip leading matches */
1854
1855 dwLen = strlen(lpszRead);
1856
1857 if (lpszRead != lpszStr)
1858 {
1859 memmove(lpszStr, lpszRead, dwLen + 1);
1860 bRet = TRUE;
1861 }
1862 if (dwLen > 0)
1863 {
1864 lpszRead = lpszStr + dwLen;
1865 while (StrChrA(lpszTrim, lpszRead[-1]))
1866 lpszRead = CharPrevA(lpszStr, lpszRead); /* Skip trailing matches */
1867
1868 if (lpszRead != lpszStr + dwLen)
1869 {
1870 *lpszRead = '\0';
1871 bRet = TRUE;
1872 }
1873 }
1874 }
1875 return bRet;
1876}
LPSTR WINAPI CharPrevA(_In_ LPCSTR, _In_ LPCSTR)

◆ StrTrimW()

BOOL WINAPI StrTrimW ( LPWSTR  lpszStr,
LPCWSTR  lpszTrim 
)

Definition at line 1883 of file string.c.

1884{
1885 DWORD dwLen;
1886 LPWSTR lpszRead = lpszStr;
1887 BOOL bRet = FALSE;
1888
1889 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszTrim));
1890
1891 if (lpszRead && *lpszRead)
1892 {
1893 while (*lpszRead && StrChrW(lpszTrim, *lpszRead)) lpszRead++;
1894
1895 dwLen = strlenW(lpszRead);
1896
1897 if (lpszRead != lpszStr)
1898 {
1899 memmove(lpszStr, lpszRead, (dwLen + 1) * sizeof(WCHAR));
1900 bRet = TRUE;
1901 }
1902 if (dwLen > 0)
1903 {
1904 lpszRead = lpszStr + dwLen;
1905 while (StrChrW(lpszTrim, lpszRead[-1]))
1906 lpszRead--; /* Skip trailing matches */
1907
1908 if (lpszRead != lpszStr + dwLen)
1909 {
1910 *lpszRead = '\0';
1911 bRet = TRUE;
1912 }
1913 }
1914 }
1915 return bRet;
1916}

Referenced by BrFolder_OnOK(), EditActionDlg_OnOK(), EditTypeDlg_OnOK(), EditTypeDlg_OnRemove(), FinishDlgProc(), CFSFolder::GetCustomViewInfo(), NewActionDlg_OnOK(), NewExtDlg_OnOK(), CShellLink::OnNotify(), RunDlgProc(), SHELL32_AssocGetExtensionDescription(), ShellExecCmdLine(), WelcomeDlgProc(), and WindowProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ shlwapi_hInstance

HINSTANCE shlwapi_hInstance
extern

Definition at line 33 of file shlwapi_main.c.

Referenced by DllMain(), SHLWAPI_WriteTimeClass(), and StrFormatByteSizeW().