ReactOS  0.4.14-dev-554-g2f8d847
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, LPINT lpiRet)
 
BOOL WINAPI StrToInt64ExA (LPCSTR lpszStr, DWORD dwFlags, LONGLONG *lpiRet)
 
BOOL WINAPI StrToIntExW (LPCWSTR lpszStr, DWORD dwFlags, LPINT 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 1909 of file string.c.

1910 {
1911  HRESULT hr;
1912  int len = 0;
1913 
1914  if (src) {
1915  len = lstrlenA(src) + 1;
1916  *dest = CoTaskMemAlloc(len);
1917  } else {
1918  *dest = NULL;
1919  }
1920 
1921  if (*dest) {
1922  lstrcpynA(*dest,src, len);
1923  hr = S_OK;
1924  } else {
1925  hr = E_OUTOFMEMORY;
1926  }
1927 
1928  TRACE("%s->(%p)\n", debugstr_a(src), *dest);
1929  return hr;
1930 }
HRESULT hr
Definition: shlfolder.c:183
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define lstrcpynA
Definition: compat.h:416
static char * dest
Definition: rtl.c:135
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

Referenced by StrRetToStrA().

◆ _SHStrDupAToBSTR()

static HRESULT _SHStrDupAToBSTR ( LPCSTR  src,
BSTR pBstrOut 
)
static

Definition at line 1650 of file string.c.

1651 {
1652  *pBstrOut = NULL;
1653 
1654  if (src)
1655  {
1656  INT len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
1657  WCHAR* szTemp = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1658 
1659  if (szTemp)
1660  {
1661  MultiByteToWideChar(CP_ACP, 0, src, -1, szTemp, len);
1662  *pBstrOut = SysAllocString(szTemp);
1663  HeapFree(GetProcessHeap(), 0, szTemp);
1664 
1665  if (*pBstrOut)
1666  return S_OK;
1667  }
1668  }
1669  return E_OUTOFMEMORY;
1670 }
#define CP_ACP
Definition: compat.h:99
int32_t INT
Definition: typedefs.h:56
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
#define MultiByteToWideChar
Definition: compat.h:100
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by StrRetToBSTR().

◆ _SHStrDupAW()

static HRESULT _SHStrDupAW ( LPCWSTR  src,
LPSTR dest 
)
static

Definition at line 1976 of file string.c.

1977 {
1978  HRESULT hr;
1979  int len = 0;
1980 
1981  if (src) {
1982  len = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL);
1983  *dest = CoTaskMemAlloc(len);
1984  } else {
1985  *dest = NULL;
1986  }
1987 
1988  if (*dest) {
1989  WideCharToMultiByte(CP_ACP, 0, src, -1, *dest, len, NULL, NULL);
1990  hr = S_OK;
1991  } else {
1992  hr = E_OUTOFMEMORY;
1993  }
1994 
1995  TRACE("%s->(%p)\n", debugstr_w(src), *dest);
1996  return hr;
1997 }
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:99
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
static char * dest
Definition: rtl.c:135
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

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:173
#define TRACE(s)
Definition: solgame.cpp:4

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 }
#define NORM_IGNORECASE
Definition: winnls.h:173
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:2275
#define CSTR_EQUAL
Definition: winnls.h:453
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1449

Referenced by StrCmpLogicalW(), StrRChrIW(), StrRStrIW(), and URL_GuessScheme().

◆ DoesStringRoundTripA()

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

Definition at line 2806 of file string.c.

2807 {
2808  lstrcpynA(lpDst, lpSrcStr, iLen);
2809  return TRUE;
2810 }
#define TRUE
Definition: types.h:120
#define lstrcpynA
Definition: compat.h:416

◆ DoesStringRoundTripW()

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

Definition at line 2826 of file string.c.

2827 {
2828  WCHAR szBuff[MAX_PATH];
2829 
2830  SHUnicodeToAnsi(lpSrcStr, lpDst, iLen);
2831  SHAnsiToUnicode(lpDst, szBuff, MAX_PATH);
2832  return !strcmpW(lpSrcStr, szBuff);
2833 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
DWORD WINAPI SHAnsiToUnicode(LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
Definition: string.c:2625
INT WINAPI SHUnicodeToAnsi(LPCWSTR lpSrcStr, LPSTR lpDstStr, INT iLen)
Definition: string.c:2749
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229

◆ 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 }
#define LOCALE_SGROUPING
Definition: winnls.h:44
#define LOCALE_USER_DEFAULT
#define LOCALE_ILZERO
Definition: winnls.h:46
#define LOCALE_INEGNUMBER
Definition: winnls.h:47
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define LOCALE_STHOUSAND
Definition: winnls.h:43
#define LOCALE_SDECIMAL
Definition: winnls.h:42
__wchar_t WCHAR
Definition: xmlstorage.h:180
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
WCHAR * LPWSTR
Definition: xmlstorage.h:184
Definition: dsound.c:943

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];
133  NUMBERFMTW fmt;
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 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define LOCALE_USER_DEFAULT
const char * fmt
Definition: wsprintf.c:30
static void FillNumberFmt(NUMBERFMTW *fmt, LPWSTR decimal_buffer, int decimal_bufwlen, LPWSTR thousand_buffer, int thousand_bufwlen)
Definition: string.c:55
__wchar_t WCHAR
Definition: xmlstorage.h:180
int snprintfW(WCHAR *str, size_t len, const WCHAR *format,...)
Definition: string.c:516
INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags, LPCWSTR lpszValue, const NUMBERFMTW *lpFormat, LPWSTR lpNumberStr, int cchOut)
Definition: lcformat.c:1198
Definition: dsound.c:943

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 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define LOCALE_USER_DEFAULT
const char * fmt
Definition: wsprintf.c:30
static void FillNumberFmt(NUMBERFMTW *fmt, LPWSTR decimal_buffer, int decimal_bufwlen, LPWSTR thousand_buffer, int thousand_bufwlen)
Definition: string.c:55
unsigned int BOOL
Definition: ntddk_ex.h:94
__wchar_t WCHAR
Definition: xmlstorage.h:180
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags, LPCWSTR lpszValue, const NUMBERFMTW *lpFormat, LPWSTR lpNumberStr, int cchOut)
Definition: lcformat.c:1198
Definition: dsound.c:943

Referenced by StrFormatKBSizeW().

◆ IsCharSpaceA()

BOOL WINAPI IsCharSpaceA ( CHAR  c)

Definition at line 2890 of file string.c.

2891 {
2892  WORD CharType;
2893  return GetStringTypeA(GetSystemDefaultLCID(), CT_CTYPE1, &c, 1, &CharType) && (CharType & C1_SPACE);
2894 }
BOOL WINAPI GetStringTypeA(LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype)
Definition: lang.c:1813
LCID WINAPI GetSystemDefaultLCID(void)
Definition: lang.c:787
const GLubyte * c
Definition: glext.h:8905
unsigned short WORD
Definition: ntddk_ex.h:93
#define CT_CTYPE1
Definition: winnls.h:234
#define C1_SPACE
Definition: unicode.h:34

◆ IsCharSpaceW()

BOOL WINAPI IsCharSpaceW ( WCHAR  wc)

Definition at line 2908 of file string.c.

2909 {
2910  WORD CharType;
2911 
2912  return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_SPACE);
2913 }
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: lang.c:1699
unsigned short WORD
Definition: ntddk_ex.h:93
#define CT_CTYPE1
Definition: winnls.h:234
#define C1_SPACE
Definition: unicode.h:34

◆ SHAnsiToAnsi()

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

Definition at line 2768 of file string.c.

2769 {
2770  LPSTR lpszRet;
2771 
2772  TRACE("(%s,%p,0x%08x)\n", debugstr_a(lpszSrc), lpszDst, iLen);
2773 
2774  lpszRet = StrCpyNXA(lpszDst, lpszSrc, iLen);
2775  return lpszRet - lpszDst + 1;
2776 }
char * LPSTR
Definition: xmlstorage.h:182
#define TRACE(s)
Definition: solgame.cpp:4
LPSTR WINAPI StrCpyNXA(LPSTR lpszDest, LPCSTR lpszSrc, int iLen)
Definition: string.c:2249
#define debugstr_a
Definition: kernel32.h:31

◆ SHAnsiToUnicode()

DWORD WINAPI SHAnsiToUnicode ( LPCSTR  lpSrcStr,
LPWSTR  lpDstStr,
int  iLen 
)

Definition at line 2625 of file string.c.

2626 {
2627  return SHAnsiToUnicodeCP(CP_ACP, lpSrcStr, lpDstStr, iLen);
2628 }
#define CP_ACP
Definition: compat.h:99
DWORD WINAPI SHAnsiToUnicodeCP(DWORD dwCp, LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
Definition: string.c:2600

Referenced by DoesStringRoundTripW(), CDefaultContextMenu::GetCommandString(), and CDefaultContextMenu::MapVerbToCmdId().

◆ SHAnsiToUnicodeCP()

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

Definition at line 2600 of file string.c.

2601 {
2602  DWORD dwRet;
2603 
2604  dwRet = MultiByteToWideChar(dwCp, 0, lpSrcStr, -1, lpDstStr, iLen);
2605  TRACE("%s->%s,ret=%d\n", debugstr_a(lpSrcStr), debugstr_w(lpDstStr), dwRet);
2606  return dwRet;
2607 }
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by SHAnsiToUnicode().

◆ SHLoadIndirectString()

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

Definition at line 2842 of file string.c.

2843 {
2844  WCHAR *dllname = NULL;
2845  HMODULE hmod = NULL;
2846  HRESULT hr = E_FAIL;
2847 
2848  TRACE("(%s %p %08x %p)\n", debugstr_w(src), dst, dst_len, reserved);
2849 
2850  if(src[0] == '@')
2851  {
2852  WCHAR *index_str;
2853  int index;
2854 
2855  dst[0] = 0;
2856  dllname = StrDupW(src + 1);
2857  index_str = strchrW(dllname, ',');
2858 
2859  if(!index_str) goto end;
2860 
2861  *index_str = 0;
2862  index_str++;
2863  index = atoiW(index_str);
2864 
2865  hmod = LoadLibraryW(dllname);
2866  if(!hmod) goto end;
2867 
2868  if(index < 0)
2869  {
2870  if(LoadStringW(hmod, -index, dst, dst_len))
2871  hr = S_OK;
2872  }
2873  else
2874  FIXME("can't handle non-negative indices (%d)\n", index);
2875  }
2876  else
2877  {
2878  if(dst != src)
2879  lstrcpynW(dst, src, dst_len);
2880  hr = S_OK;
2881  }
2882 
2883  TRACE("returning %s\n", debugstr_w(dst));
2884 end:
2885  if(hmod) FreeLibrary(hmod);
2886  LocalFree(dllname);
2887  return hr;
2888 }
HRESULT hr
Definition: shlfolder.c:183
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
GLuint GLuint end
Definition: gl.h:1545
#define E_FAIL
Definition: ddrawi.h:102
LPWSTR WINAPI StrDupW(LPCWSTR lpszStr)
Definition: string.c:1089
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define lstrcpynW
Definition: compat.h:405
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
r reserved
Definition: btrfs.c:2865
#define LoadLibraryW(x)
Definition: compat.h:412
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:413
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define index(s, c)
Definition: various.h:29
GLenum src
Definition: glext.h:6340
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
#define S_OK
Definition: intsafe.h:59
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
GLenum GLenum dst
Definition: glext.h:6340
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315

Referenced by AllSysInfo(), 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 }
static BOOL SHLWAPI_ChrCmpHelperA(WORD ch1, WORD ch2, DWORD dwFlags)
Definition: string.c:157

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 }
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2232
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
Definition: lang.c:2299
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define CSTR_EQUAL
Definition: winnls.h:453
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1449

Referenced by ChrCmpIA(), and SHLWAPI_ChrCmpA().

◆ SHLWAPI_FormatSignificant()

static int SHLWAPI_FormatSignificant ( LPWSTR  lpszNum,
int  dwDigits 
)
inlinestatic

Definition at line 2052 of file string.c.

2053 {
2054  /* Zero non significant digits, return remaining significant digits */
2055  while (*lpszNum)
2056  {
2057  lpszNum++;
2058  if (--dwDigits == 0)
2059  {
2060  while (*lpszNum)
2061  *lpszNum++ = '0';
2062  return 0;
2063  }
2064  }
2065  return dwDigits;
2066 }

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 1287 of file string.c.

1290 {
1291  LPCSTR lpszRet = NULL;
1292 
1293  if (lpszStr)
1294  {
1295  WORD ch2;
1296 
1297  if (!lpszEnd)
1298  lpszEnd = lpszStr + lstrlenA(lpszStr);
1299 
1300  while (*lpszStr && lpszStr <= lpszEnd)
1301  {
1302  ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
1303 
1304  if (!pChrCmpFn(ch, ch2))
1305  lpszRet = lpszStr;
1306  lpszStr = CharNextA(lpszStr);
1307  }
1308  }
1309  return (LPSTR)lpszRet;
1310 }
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2232
const char * LPCSTR
Definition: xmlstorage.h:183
unsigned short WORD
Definition: ntddk_ex.h:93
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145

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 1114 of file string.c.

1117 {
1118  LPCSTR lpszRead = lpszStr;
1119  if (lpszStr && *lpszStr && lpszMatch)
1120  {
1121  while (*lpszRead)
1122  {
1123  LPCSTR lpszTest = pStrChrFn(lpszMatch, *lpszRead);
1124 
1125  if (!bInvert && !lpszTest)
1126  break;
1127  if (bInvert && lpszTest)
1128  break;
1129  lpszRead = CharNextA(lpszRead);
1130  };
1131  }
1132  return lpszRead - lpszStr;
1133 }
LPSTR WINAPI CharNextA(_In_ LPCSTR)
const char * LPCSTR
Definition: xmlstorage.h:183
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
GLuint GLuint end
Definition: gl.h:1545
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by StrStrA(), and StrStrIA().

◆ SHLWAPI_WriteReverseNum()

static LPWSTR SHLWAPI_WriteReverseNum ( LPWSTR  lpszOut,
DWORD  dwNum 
)
inlinestatic

Definition at line 2032 of file string.c.

2033 {
2034  *lpszOut-- = '\0';
2035 
2036  /* Write a decimal number to a string, backwards */
2037  do
2038  {
2039  DWORD dwNextDigit = dwNum % 10;
2040  *lpszOut-- = '0' + dwNextDigit;
2041  dwNum = (dwNum - dwNextDigit) / 10;
2042  } while (dwNum > 0);
2043 
2044  return lpszOut;
2045 }
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by SHLWAPI_WriteTimeClass().

◆ SHLWAPI_WriteTimeClass()

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

Definition at line 2073 of file string.c.

2075 {
2076  WCHAR szBuff[64], *szOut = szBuff + 32;
2077 
2078  szOut = SHLWAPI_WriteReverseNum(szOut, dwValue);
2079  iDigits = SHLWAPI_FormatSignificant(szOut + 1, iDigits);
2080  *szOut = ' ';
2081  LoadStringW(shlwapi_hInstance, uClassStringId, szBuff + 32, 32);
2082  strcatW(lpszOut, szOut);
2083  return iDigits;
2084 }
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static int SHLWAPI_FormatSignificant(LPWSTR lpszNum, int dwDigits)
Definition: string.c:2052
__wchar_t WCHAR
Definition: xmlstorage.h:180
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
HINSTANCE shlwapi_hInstance
Definition: shlwapi_main.c:33
static LPWSTR SHLWAPI_WriteReverseNum(LPWSTR lpszOut, DWORD dwNum)
Definition: string.c:2032

Referenced by StrFromTimeIntervalW().

◆ SHStrDupA()

HRESULT WINAPI SHStrDupA ( LPCSTR  lpszStr,
LPWSTR lppszDest 
)

Definition at line 1946 of file string.c.

1947 {
1948  HRESULT hRet;
1949  int len = 0;
1950 
1951  if (lpszStr)
1952  {
1953  len = MultiByteToWideChar(CP_ACP, 0, lpszStr, -1, NULL, 0) * sizeof(WCHAR);
1954  *lppszDest = CoTaskMemAlloc(len);
1955  }
1956  else
1957  *lppszDest = NULL;
1958 
1959  if (*lppszDest)
1960  {
1961  MultiByteToWideChar(CP_ACP, 0, lpszStr, -1, *lppszDest, len/sizeof(WCHAR));
1962  hRet = S_OK;
1963  }
1964  else
1965  hRet = E_OUTOFMEMORY;
1966 
1967  TRACE("%s->(%p)\n", debugstr_a(lpszStr), *lppszDest);
1968  return hRet;
1969 }
#define CP_ACP
Definition: compat.h:99
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static WCHAR
Definition: string.c:57
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
#define MultiByteToWideChar
Definition: compat.h:100
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

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

◆ SHStrDupW()

HRESULT WINAPI SHStrDupW ( LPCWSTR  src,
LPWSTR dest 
)

Definition at line 2004 of file string.c.

2005 {
2006  HRESULT hr;
2007  int len = 0;
2008 
2009  if (src) {
2010  len = (lstrlenW(src) + 1) * sizeof(WCHAR);
2011  *dest = CoTaskMemAlloc(len);
2012  } else {
2013  *dest = NULL;
2014  }
2015 
2016  if (*dest) {
2017  memcpy(*dest, src, len);
2018  hr = S_OK;
2019  } else {
2020  hr = E_OUTOFMEMORY;
2021  }
2022 
2023  TRACE("%s->(%p)\n", debugstr_w(src), *dest);
2024  return hr;
2025 }
HRESULT hr
Definition: shlfolder.c:183
#define lstrlenW
Definition: compat.h:415
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
static char * dest
Definition: rtl.c:135
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

Referenced by AssocGetPerceivedType(), CShellFolder::GetValidCharacters(), and StrRetToStrW().

◆ SHStripMneumonicA()

char WINAPI SHStripMneumonicA ( LPCSTR  lpszStr)

Definition at line 2533 of file string.c.

2534 {
2535  LPSTR lpszIter, lpszTmp;
2536  char ch;
2537 
2538  TRACE("(%s)\n", debugstr_a(lpszStr));
2539 
2540  ch = *lpszStr;
2541 
2542  if ((lpszIter = StrChrA(lpszStr, '&')))
2543  {
2544  lpszTmp = CharNextA(lpszIter);
2545  if (*lpszTmp)
2546  {
2547  if (*lpszTmp != '&')
2548  ch = *lpszTmp;
2549 
2550  memmove( lpszIter, lpszTmp, strlen(lpszTmp) + 1 );
2551  }
2552  }
2553 
2554  return ch;
2555 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:270
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

◆ SHStripMneumonicW()

WCHAR WINAPI SHStripMneumonicW ( LPCWSTR  lpszStr)

Definition at line 2562 of file string.c.

2563 {
2564  LPWSTR lpszIter, lpszTmp;
2565  WCHAR ch;
2566 
2567  TRACE("(%s)\n", debugstr_w(lpszStr));
2568 
2569  ch = *lpszStr;
2570 
2571  if ((lpszIter = StrChrW(lpszStr, '&')))
2572  {
2573  lpszTmp = lpszIter + 1;
2574  if (*lpszTmp)
2575  {
2576  if (*lpszTmp != '&')
2577  ch = *lpszTmp;
2578 
2579  memmove( lpszIter, lpszTmp, (strlenW(lpszTmp) + 1) * sizeof(WCHAR) );
2580  }
2581  }
2582 
2583  return ch;
2584 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ SHTruncateString()

DWORD WINAPI SHTruncateString ( LPSTR  lpStr,
DWORD  size 
)

Definition at line 2502 of file string.c.

2503 {
2504  if (lpStr && size)
2505  {
2506  LPSTR lastByte = lpStr + size - 1;
2507 
2508  while(lpStr < lastByte)
2509  lpStr += IsDBCSLeadByte(*lpStr) ? 2 : 1;
2510 
2511  if(lpStr == lastByte && IsDBCSLeadByte(*lpStr))
2512  {
2513  *lpStr = '\0';
2514  size--;
2515  }
2516  return size;
2517  }
2518  return 0;
2519 }
char * LPSTR
Definition: xmlstorage.h:182
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2232
GLsizeiptr size
Definition: glext.h:5919
static size_t size
Definition: string.c:62

Referenced by SHUnicodeToAnsiCP().

◆ SHUnicodeToAnsi()

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

Definition at line 2749 of file string.c.

2750 {
2751  return SHUnicodeToAnsiCP(CP_ACP, lpSrcStr, lpDstStr, iLen);
2752 }
#define CP_ACP
Definition: compat.h:99
DWORD WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr, int dstlen)
Definition: string.c:2650

Referenced by DoesStringRoundTripW(), and CDefaultContextMenu::GetCommandString().

◆ SHUnicodeToAnsiCP()

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

Definition at line 2650 of file string.c.

2651 {
2652  static const WCHAR emptyW[] = { '\0' };
2653  int len , reqLen;
2654  LPSTR mem;
2655 
2656  if (!lpDstStr || !dstlen)
2657  return 0;
2658 
2659  if (!lpSrcStr)
2660  lpSrcStr = emptyW;
2661 
2662  *lpDstStr = '\0';
2663 
2664  len = strlenW(lpSrcStr) + 1;
2665 
2666  switch (CodePage)
2667  {
2668  case CP_WINUNICODE:
2669  CodePage = CP_UTF8; /* Fall through... */
2670  case 0x0000C350: /* FIXME: CP_ #define */
2671  case CP_UTF7:
2672  case CP_UTF8:
2673  {
2674  DWORD dwMode = 0;
2675  INT lenW = len - 1;
2676  INT needed = dstlen - 1;
2677  HRESULT hr;
2678 
2679  /* try the user supplied buffer first */
2680  hr = ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &lenW, lpDstStr, &needed);
2681  if (hr == S_OK)
2682  {
2683  lpDstStr[needed] = '\0';
2684  return needed + 1;
2685  }
2686 
2687  /* user buffer too small. exclude termination and copy as much as possible */
2688  lenW = len;
2689  hr = ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &lenW, NULL, &needed);
2690  needed++;
2691  mem = HeapAlloc(GetProcessHeap(), 0, needed);
2692  if (!mem)
2693  return 0;
2694 
2695  hr = ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &len, mem, &needed);
2696  if (hr == S_OK)
2697  {
2698  reqLen = SHTruncateString(mem, dstlen);
2699  if (reqLen > 0) memcpy(lpDstStr, mem, reqLen-1);
2700  }
2701  HeapFree(GetProcessHeap(), 0, mem);
2702  return 0;
2703  }
2704  default:
2705  break;
2706  }
2707 
2708  /* try the user supplied buffer first */
2709  reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, lpDstStr, dstlen, NULL, NULL);
2710 
2711  if (!reqLen && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
2712  {
2713  reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, NULL, 0, NULL, NULL);
2714  if (reqLen)
2715  {
2716  mem = HeapAlloc(GetProcessHeap(), 0, reqLen);
2717  if (mem)
2718  {
2719  WideCharToMultiByte(CodePage, 0, lpSrcStr, len, mem, reqLen, NULL, NULL);
2720 
2721  reqLen = SHTruncateString(mem, dstlen -1);
2722  reqLen++;
2723 
2724  lstrcpynA(lpDstStr, mem, reqLen);
2725  HeapFree(GetProcessHeap(), 0, mem);
2726  lpDstStr[reqLen-1] = '\0';
2727  }
2728  }
2729  }
2730  return reqLen;
2731 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
#define CP_UTF7
Definition: winnls.h:232
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:56
#define CP_UTF8
Definition: nls.h:20
DWORD WINAPI SHTruncateString(LPSTR lpStr, DWORD size)
Definition: string.c:2502
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
static size_t len
Definition: string.c:60
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
static DWORD dstlen
Definition: directory.c:51
static const WCHAR emptyW[]
Definition: navigate.c:40
#define CP_WINUNICODE
Definition: ddeml.h:33
#define lstrcpynA
Definition: compat.h:416
Definition: mem.c:156
static CONVERTINETUNICODETOMULTIBYTE ConvertINetUnicodeToMultiByte
Definition: win_iconv.c:706
#define HeapFree(x, y, z)
Definition: compat.h:402
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by SHUnicodeToAnsi().

◆ SHUnicodeToUnicode()

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

Definition at line 2783 of file string.c.

2784 {
2785  LPWSTR lpszRet;
2786 
2787  TRACE("(%s,%p,0x%08x)\n", debugstr_w(lpszSrc), lpszDst, iLen);
2788 
2789  lpszRet = StrCpyNXW(lpszDst, lpszSrc, iLen);
2790  return lpszRet - lpszDst + 1;
2791 }
LPWSTR WINAPI StrCpyNXW(LPWSTR lpszDest, LPCWSTR lpszSrc, int iLen)
Definition: string.c:2268
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ StrCatBuffA()

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

Definition at line 1411 of file string.c.

1412 {
1413  INT iLen;
1414 
1415  TRACE("(%p,%s,%d)\n", lpszStr, debugstr_a(lpszCat), cchMax);
1416 
1417  if (!lpszStr)
1418  {
1419  WARN("Invalid lpszStr would crash under Win32!\n");
1420  return NULL;
1421  }
1422 
1423  iLen = strlen(lpszStr);
1424  cchMax -= iLen;
1425 
1426  if (cchMax > 0)
1427  StrCpyNA(lpszStr + iLen, lpszCat, cchMax);
1428  return lpszStr;
1429 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define WARN(fmt,...)
Definition: debug.h:111
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
#define StrCpyNA
Definition: shlwapi.h:1514
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
UINT cchMax

◆ StrCatBuffW()

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

Definition at line 1436 of file string.c.

1437 {
1438  INT iLen;
1439 
1440  TRACE("(%p,%s,%d)\n", lpszStr, debugstr_w(lpszCat), cchMax);
1441 
1442  if (!lpszStr)
1443  {
1444  WARN("Invalid lpszStr would crash under Win32!\n");
1445  return NULL;
1446  }
1447 
1448  iLen = strlenW(lpszStr);
1449  cchMax -= iLen;
1450 
1451  if (cchMax > 0)
1452  StrCpyNW(lpszStr + iLen, lpszCat, cchMax);
1453  return lpszStr;
1454 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WARN(fmt,...)
Definition: debug.h:111
LPWSTR WINAPI StrCpyNW(LPWSTR dst, LPCWSTR src, int count)
Definition: string.c:536
int32_t INT
Definition: typedefs.h:56
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
UINT cchMax

Referenced by SHAboutInfoW(), 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 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
UINT cchMax

◆ 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 }
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242

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
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

◆ 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 }
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI ChrCmpIA(WORD ch1, WORD ch2)
Definition: string.c:205
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

◆ 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 debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
WINE_UNICODE_INLINE WCHAR toupperW(WCHAR ch)
Definition: unicode.h:141
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
UINT cchMax
#define debugstr_wn
Definition: kernel32.h:33
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ 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 }
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ StrCmpIW()

int WINAPI StrCmpIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszComp 
)

Definition at line 353 of file string.c.

354 {
355  TRACE("(%s,%s)\n", debugstr_w(lpszStr),debugstr_w(lpszComp));
356  return CompareStringW(GetThreadLocale(), NORM_IGNORECASE, lpszStr, -1, lpszComp, -1) - CSTR_EQUAL;
357 }
#define NORM_IGNORECASE
Definition: winnls.h:173
#define debugstr_w
Definition: kernel32.h:32
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:2275
#define TRACE(s)
Definition: solgame.cpp:4
#define CSTR_EQUAL
Definition: winnls.h:453
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1449

Referenced by AssocFindByBuiltinExtension(), AssocFindByType(), Control_DoLaunch(), SHExplorerParseCmdLine(), test_assoc_one(), and UseCmdParameters().

◆ StrCmpLogicalW()

INT WINAPI StrCmpLogicalW ( LPCWSTR  lpszStr,
LPCWSTR  lpszComp 
)

Definition at line 2296 of file string.c.

2297 {
2298  INT iDiff;
2299 
2300  TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszComp));
2301 
2302  if (lpszStr && lpszComp)
2303  {
2304  while (*lpszStr)
2305  {
2306  if (!*lpszComp)
2307  return 1;
2308  else if (isdigitW(*lpszStr))
2309  {
2310  int iStr, iComp;
2311 
2312  if (!isdigitW(*lpszComp))
2313  return -1;
2314 
2315  /* Compare the numbers */
2316  StrToIntExW(lpszStr, 0, &iStr);
2317  StrToIntExW(lpszComp, 0, &iComp);
2318 
2319  if (iStr < iComp)
2320  return -1;
2321  else if (iStr > iComp)
2322  return 1;
2323 
2324  /* Skip */
2325  while (isdigitW(*lpszStr))
2326  lpszStr++;
2327  while (isdigitW(*lpszComp))
2328  lpszComp++;
2329  }
2330  else if (isdigitW(*lpszComp))
2331  return 1;
2332  else
2333  {
2334  iDiff = ChrCmpIW(*lpszStr,*lpszComp);
2335  if (iDiff > 0)
2336  return 1;
2337  else if (iDiff < 0)
2338  return -1;
2339 
2340  lpszStr++;
2341  lpszComp++;
2342  }
2343  }
2344  if (*lpszComp)
2345  return -1;
2346  }
2347  return 0;
2348 }
int32_t INT
Definition: typedefs.h:56
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI StrToIntExW(LPCWSTR lpszStr, DWORD dwFlags, LPINT lpiRet)
Definition: string.c:970
WINE_UNICODE_INLINE int isdigitW(WCHAR wc)
Definition: unicode.h:170
BOOL WINAPI ChrCmpIW(WCHAR ch1, WCHAR ch2)
Definition: string.c:217

Referenced by CompareFunc(), CExplorerBand::CompareTreeItems(), 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 }
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
Definition: lang.c:2299
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define CSTR_EQUAL
Definition: winnls.h:453
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1449

◆ 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 }
#define NORM_IGNORECASE
Definition: winnls.h:173
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
Definition: lang.c:2299
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define CSTR_EQUAL
Definition: winnls.h:453
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1449

◆ 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 }
#define NORM_IGNORECASE
Definition: winnls.h:173
#define debugstr_w
Definition: kernel32.h:32
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:2275
#define TRACE(s)
Definition: solgame.cpp:4
#define CSTR_EQUAL
Definition: winnls.h:453
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1449

◆ 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 }
#define debugstr_w
Definition: kernel32.h:32
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:2275
#define TRACE(s)
Definition: solgame.cpp:4
#define CSTR_EQUAL
Definition: winnls.h:453
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1449

◆ StrCmpW()

int WINAPI StrCmpW ( LPCWSTR  lpszStr,
LPCWSTR  lpszComp 
)

Definition at line 434 of file string.c.

435 {
436  TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszComp));
437  return CompareStringW(GetThreadLocale(), 0, lpszStr, -1, lpszComp, -1) - CSTR_EQUAL;
438 }
#define debugstr_w
Definition: kernel32.h:32
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:2275
#define TRACE(s)
Definition: solgame.cpp:4
#define CSTR_EQUAL
Definition: winnls.h:453
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1449

Referenced by Dde_OnExecute(), test_PathCombineW(), and test_StrCpyW().

◆ 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 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define debugstr_w
Definition: kernel32.h:32
static const char * src
Definition: string.c:59
#define TRACE(s)
Definition: solgame.cpp:4
#define d
Definition: ke_i.h:81
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by PathCreateFromUrlW(), SHGlobalCounterCreateNamedW(), SHPathPrepareForWriteW(), StrCatBuffW(), StrNCatW(), and test_StrXXX_overflows().

◆ StrCpyNXA()

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

Definition at line 2249 of file string.c.

2250 {
2251  TRACE("(%p,%s,%i)\n", lpszDest, debugstr_a(lpszSrc), iLen);
2252 
2253  if (lpszDest && lpszSrc && iLen > 0)
2254  {
2255  while ((iLen-- > 1) && *lpszSrc)
2256  *lpszDest++ = *lpszSrc++;
2257  if (iLen >= 0)
2258  *lpszDest = '\0';
2259  }
2260  return lpszDest;
2261 }
WCHAR lpszDest[260]
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

Referenced by SHAnsiToAnsi().

◆ StrCpyNXW()

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

Definition at line 2268 of file string.c.

2269 {
2270  TRACE("(%p,%s,%i)\n", lpszDest, debugstr_w(lpszSrc), iLen);
2271 
2272  if (lpszDest && lpszSrc && iLen > 0)
2273  {
2274  while ((iLen-- > 1) && *lpszSrc)
2275  *lpszDest++ = *lpszSrc++;
2276  if (iLen >= 0)
2277  *lpszDest = '\0';
2278  }
2279  return lpszDest;
2280 }
#define debugstr_w
Definition: kernel32.h:32
WCHAR lpszDest[260]
#define TRACE(s)
Definition: solgame.cpp:4

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 debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219

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

◆ StrCSpnA()

int WINAPI StrCSpnA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 1181 of file string.c.

1182 {
1183  TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
1184 
1185  return SHLWAPI_StrSpnHelperA(lpszStr, lpszMatch, StrChrA, TRUE);
1186 }
#define TRUE
Definition: types.h:120
static int SHLWAPI_StrSpnHelperA(LPCSTR lpszStr, LPCSTR lpszMatch, LPSTR(WINAPI *pStrChrFn)(LPCSTR, WORD), BOOL bInvert)
Definition: string.c:1114
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:270
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

◆ StrCSpnIA()

int WINAPI StrCSpnIA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 1213 of file string.c.

1214 {
1215  TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
1216 
1217  return SHLWAPI_StrSpnHelperA(lpszStr, lpszMatch, StrChrIA, TRUE);
1218 }
#define TRUE
Definition: types.h:120
LPSTR WINAPI StrChrIA(LPCSTR lpszStr, WORD ch)
Definition: string.c:614
static int SHLWAPI_StrSpnHelperA(LPCSTR lpszStr, LPCSTR lpszMatch, LPSTR(WINAPI *pStrChrFn)(LPCSTR, WORD), BOOL bInvert)
Definition: string.c:1114
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

◆ StrCSpnIW()

int WINAPI StrCSpnIW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 1225 of file string.c.

1226 {
1227  LPCWSTR lpszRead = lpszStr;
1228 
1229  TRACE("(%s,%s)\n",debugstr_w(lpszStr), debugstr_w(lpszMatch));
1230 
1231  if (lpszStr && *lpszStr && lpszMatch)
1232  {
1233  while (*lpszRead)
1234  {
1235  if (StrChrIW(lpszMatch, *lpszRead)) break;
1236  lpszRead++;
1237  }
1238  }
1239  return lpszRead - lpszStr;
1240 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:635

◆ StrCSpnW()

int WINAPI StrCSpnW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 1193 of file string.c.

1194 {
1195  if (!lpszStr || !lpszMatch) return 0;
1196  return strcspnW( lpszStr, lpszMatch );
1197 }
WINE_UNICODE_INLINE size_t strcspnW(const WCHAR *str, const WCHAR *reject)
Definition: unicode.h:274

◆ 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  iLen = lpszStr ? strlen(lpszStr) + 1 : 1;
1072  lpszRet = LocalAlloc(LMEM_FIXED, iLen);
1073 
1074  if (lpszRet)
1075  {
1076  if (lpszStr)
1077  memcpy(lpszRet, lpszStr, iLen);
1078  else
1079  *lpszRet = '\0';
1080  }
1081  return lpszRet;
1082 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * LPSTR
Definition: xmlstorage.h:182
#define LMEM_FIXED
Definition: winbase.h:349
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

Referenced by test_StrDupA().

◆ StrDupW()

LPWSTR WINAPI StrDupW ( LPCWSTR  lpszStr)

Definition at line 1089 of file string.c.

1090 {
1091  int iLen;
1092  LPWSTR lpszRet;
1093 
1094  TRACE("(%s)\n",debugstr_w(lpszStr));
1095 
1096  iLen = (lpszStr ? strlenW(lpszStr) + 1 : 1) * sizeof(WCHAR);
1097  lpszRet = LocalAlloc(LMEM_FIXED, iLen);
1098 
1099  if (lpszRet)
1100  {
1101  if (lpszStr)
1102  memcpy(lpszRet, lpszStr, iLen);
1103  else
1104  *lpszRet = '\0';
1105  }
1106  return lpszRet;
1107 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define debugstr_w
Definition: kernel32.h:32
#define LMEM_FIXED
Definition: winbase.h:349
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FileDialog_constructor(), CRecycleBin::GetDisplayNameOf(), IFileDialog2_fnSetCancelButtonLabel(), IFileDialog2_fnSetDefaultExtension(), IFileDialog2_fnSetFileNameLabel(), IFileDialog2_fnSetFileTypes(), IFileDialog2_fnSetOkButtonLabel(), IFileDialog2_fnSetTitle(), IStream_Create(), IStream_fnStat(), PathCreateFromUrlAlloc(), RecursiveFind(), CFindFolder::SearchThreadProc(), set_file_name(), SHExplorerParseCmdLine(), SHLoadIndirectString(), and test_StrXXX_overflows().

◆ StrFormatByteSize64A()

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

Definition at line 2454 of file string.c.

2455 {
2456  WCHAR wszBuff[32];
2457 
2458  StrFormatByteSizeW(llBytes, wszBuff, sizeof(wszBuff)/sizeof(WCHAR));
2459 
2460  if (lpszDest)
2461  WideCharToMultiByte(CP_ACP, 0, wszBuff, -1, lpszDest, cchMax, 0, 0);
2462  return lpszDest;
2463 }
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2376
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
WCHAR lpszDest[260]
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT cchMax

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

◆ StrFormatByteSizeA()

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

Definition at line 2482 of file string.c.

2483 {
2484  TRACE("(%d,%p,%d)\n", dwBytes, lpszDest, cchMax);
2485 
2486  return StrFormatByteSize64A(dwBytes, lpszDest, cchMax);
2487 }
LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
Definition: string.c:2454
WCHAR lpszDest[260]
#define TRACE(s)
Definition: solgame.cpp:4
UINT cchMax

◆ StrFormatByteSizeW()

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

Definition at line 2376 of file string.c.

2377 {
2378 #define KB ((ULONGLONG)1024)
2379 #define MB (KB*KB)
2380 #define GB (KB*KB*KB)
2381 #define TB (KB*KB*KB*KB)
2382 #define PB (KB*KB*KB*KB*KB)
2383 
2384  static const SHLWAPI_BYTEFORMATS bfFormats[] =
2385  {
2386  { 10*KB, 10.24, 100.0, 2, 'K' }, /* 10 KB */
2387  { 100*KB, 102.4, 10.0, 1, 'K' }, /* 100 KB */
2388  { 1000*KB, 1024.0, 1.0, 0, 'K' }, /* 1000 KB */
2389  { 10*MB, 10485.76, 100.0, 2, 'M' }, /* 10 MB */
2390  { 100*MB, 104857.6, 10.0, 1, 'M' }, /* 100 MB */
2391  { 1000*MB, 1048576.0, 1.0, 0, 'M' }, /* 1000 MB */
2392  { 10*GB, 10737418.24, 100.0, 2, 'G' }, /* 10 GB */
2393  { 100*GB, 107374182.4, 10.0, 1, 'G' }, /* 100 GB */
2394  { 1000*GB, 1073741824.0, 1.0, 0, 'G' }, /* 1000 GB */
2395  { 10*TB, 10485.76, 100.0, 2, 'T' }, /* 10 TB */
2396  { 100*TB, 104857.6, 10.0, 1, 'T' }, /* 100 TB */
2397  { 1000*TB, 1048576.0, 1.0, 0, 'T' }, /* 1000 TB */
2398  { 10*PB, 10737418.24, 100.00, 2, 'P' }, /* 10 PB */
2399  { 100*PB, 107374182.4, 10.00, 1, 'P' }, /* 100 PB */
2400  { 1000*PB, 1073741824.0, 1.00, 0, 'P' }, /* 1000 PB */
2401  { 0, 10995116277.76, 100.00, 2, 'E' } /* EB's, catch all */
2402  };
2403  WCHAR wszAdd[] = {' ','?','B',0};
2404  double dBytes;
2405  UINT i = 0;
2406 
2407  TRACE("(0x%s,%p,%d)\n", wine_dbgstr_longlong(llBytes), lpszDest, cchMax);
2408 
2409  if (!lpszDest || !cchMax)
2410  return lpszDest;
2411 
2412  if (llBytes < 1024) /* 1K */
2413  {
2414  WCHAR wszBytesFormat[64];
2415  LoadStringW(shlwapi_hInstance, IDS_BYTES_FORMAT, wszBytesFormat, 64);
2416  snprintfW(lpszDest, cchMax, wszBytesFormat, (int)llBytes);
2417  return lpszDest;
2418  }
2419 
2420  /* Note that if this loop completes without finding a match, i will be
2421  * pointing at the last entry, which is a catch all for > 1000 PB
2422  */
2423  while (i < sizeof(bfFormats) / sizeof(SHLWAPI_BYTEFORMATS) - 1)
2424  {
2425  if (llBytes < bfFormats[i].dLimit)
2426  break;
2427  i++;
2428  }
2429  /* Above 1 TB we encounter problems with FP accuracy. So for amounts above
2430  * this number we integer shift down by 1 MB first. The table above has
2431  * the divisors scaled down from the '< 10 TB' entry onwards, to account
2432  * for this. We also add a small fudge factor to get the correct result for
2433  * counts that lie exactly on a 1024 byte boundary.
2434  */
2435  if (i > 8)
2436  dBytes = (double)(llBytes >> 20) + 0.001; /* Scale down by 1 MB */
2437  else
2438  dBytes = (double)llBytes + 0.00001;
2439 
2440  dBytes = floor(dBytes / bfFormats[i].dDivisor) / bfFormats[i].dNormaliser;
2441 
2442  if (!FormatDouble(dBytes, bfFormats[i].nDecimals, lpszDest, cchMax))
2443  return NULL;
2444  wszAdd[1] = bfFormats[i].wPrefix;
2445  StrCatBuffW(lpszDest, wszAdd, cchMax);
2446  return lpszDest;
2447 }
LPWSTR WINAPI StrCatBuffW(LPWSTR lpszStr, LPCWSTR lpszCat, INT cchMax)
Definition: string.c:1436
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define TB
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
#define IDS_BYTES_FORMAT
Definition: resource.h:109
#define GB
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
smooth NULL
Definition: ftsmooth.c:416
WCHAR lpszDest[260]
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PB
UINT cchMax
static int FormatDouble(double value, int decimals, LPWSTR pszBuf, int cchBuf)
Definition: string.c:129
#define KB
unsigned int UINT
Definition: ndis.h:50
HINSTANCE shlwapi_hInstance
Definition: shlwapi_main.c:33
int snprintfW(WCHAR *str, size_t len, const WCHAR *format,...)
Definition: string.c:516
#define MB
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)

Referenced by FormatFileSizeWithBytes(), CZipFolder::GetDetailsOf(), CDrvDefExt::InitGeneralPage(), InitializeFormatDriveDlg(), InitializeRecycleBinDlg(), InsertDefaultClusterSizeForFs(), msi_dialog_vcl_add_drives(), PerformancePageRefreshThread(), PrintDiskData(), PrintPartitionData(), CAvailableApplicationInfo::RetrieveSize(), CDownloaderProgress::SetProgress(), SH_FormatFileSizeWithBytes(), StrFormatByteSize64A(), and UpdateLanStatusUiDlg().

◆ StrFormatKBSizeA()

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

Definition at line 1727 of file string.c.

1728 {
1729  WCHAR wszBuf[256];
1730 
1731  if (!StrFormatKBSizeW(llBytes, wszBuf, 256))
1732  return NULL;
1733  if (!WideCharToMultiByte(CP_ACP, 0, wszBuf, -1, lpszDest, cchMax, NULL, NULL))
1734  return NULL;
1735  return lpszDest;
1736 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
WCHAR lpszDest[260]
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT cchMax
LPWSTR WINAPI StrFormatKBSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:1743

Referenced by _ILGetFileSize().

◆ StrFormatKBSizeW()

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

Definition at line 1743 of file string.c.

1744 {
1745  static const WCHAR kb[] = {' ','K','B',0};
1746  LONGLONG llKB = (llBytes + 1023) >> 10;
1747  int len;
1748 
1749  TRACE("(0x%s,%p,%d)\n", wine_dbgstr_longlong(llBytes), lpszDest, cchMax);
1750 
1751  if (!FormatInt(llKB, lpszDest, cchMax))
1752  return NULL;
1753 
1754  len = lstrlenW(lpszDest);
1755  if (cchMax - len < 4)
1756  return NULL;
1757  lstrcatW(lpszDest, kb);
1758  return lpszDest;
1759 }
#define lstrlenW
Definition: compat.h:415
smooth NULL
Definition: ftsmooth.c:416
WCHAR lpszDest[260]
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT cchMax
static size_t len
Definition: string.c:60
GLenum GLsizei len
Definition: glext.h:6722
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static int FormatInt(LONGLONG qdwValue, LPWSTR pszBuf, int cchBuf)
Definition: string.c:96

Referenced by CRecycleBin::GetDetailsOf(), and StrFormatKBSizeA().

◆ StrFromTimeIntervalA()

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

Definition at line 2117 of file string.c.

2119 {
2120  INT iRet = 0;
2121 
2122  TRACE("(%p,%d,%d,%d)\n", lpszStr, cchMax, dwMS, iDigits);
2123 
2124  if (lpszStr && cchMax)
2125  {
2126  WCHAR szBuff[128];
2127  StrFromTimeIntervalW(szBuff, sizeof(szBuff)/sizeof(WCHAR), dwMS, iDigits);
2128  WideCharToMultiByte(CP_ACP,0,szBuff,-1,lpszStr,cchMax,0,0);
2129  }
2130  return iRet;
2131 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
INT WINAPI StrFromTimeIntervalW(LPWSTR lpszStr, UINT cchMax, DWORD dwMS, int iDigits)
Definition: string.c:2139
int32_t INT
Definition: typedefs.h:56
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT cchMax

Referenced by test_StrFromTimeIntervalA().

◆ StrFromTimeIntervalW()

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

Definition at line 2139 of file string.c.

2141 {
2142  INT iRet = 0;
2143 
2144  TRACE("(%p,%d,%d,%d)\n", lpszStr, cchMax, dwMS, iDigits);
2145 
2146  if (lpszStr && cchMax)
2147  {
2148  WCHAR szCopy[128];
2149  DWORD dwHours, dwMinutes;
2150 
2151  if (!iDigits || cchMax == 1)
2152  {
2153  *lpszStr = '\0';
2154  return 0;
2155  }
2156 
2157  /* Calculate the time classes */
2158  dwMS = (dwMS + 500) / 1000;
2159  dwHours = dwMS / 3600;
2160  dwMS -= dwHours * 3600;
2161  dwMinutes = dwMS / 60;
2162  dwMS -= dwMinutes * 60;
2163 
2164  szCopy[0] = '\0';
2165 
2166  if (dwHours)
2167  iDigits = SHLWAPI_WriteTimeClass(szCopy, dwHours, IDS_TIME_INTERVAL_HOURS, iDigits);
2168 
2169  if (dwMinutes && iDigits)
2170  iDigits = SHLWAPI_WriteTimeClass(szCopy, dwMinutes, IDS_TIME_INTERVAL_MINUTES, iDigits);
2171 
2172  if (iDigits) /* Always write seconds if we have significant digits */
2173  SHLWAPI_WriteTimeClass(szCopy, dwMS, IDS_TIME_INTERVAL_SECONDS, iDigits);
2174 
2175  lstrcpynW(lpszStr, szCopy, cchMax);
2176  iRet = strlenW(lpszStr);
2177  }
2178  return iRet;
2179 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
int32_t INT
Definition: typedefs.h:56
#define IDS_TIME_INTERVAL_SECONDS
Definition: resource.h:29
#define lstrcpynW
Definition: compat.h:405
#define IDS_TIME_INTERVAL_HOURS
Definition: resource.h:27
static int SHLWAPI_WriteTimeClass(LPWSTR lpszOut, DWORD dwValue, UINT uClassStringId, int iDigits)
Definition: string.c:2073
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT cchMax
#define IDS_TIME_INTERVAL_MINUTES
Definition: resource.h:28

Referenced by dialog_proc(), and StrFromTimeIntervalA().

◆ StrIsIntlEqualA()

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

Definition at line 2196 of file string.c.

2198 {
2199  DWORD dwFlags;
2200 
2201  TRACE("(%d,%s,%s,%d)\n", bCase,
2202  debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
2203 
2204  /* FIXME: This flag is undocumented and unknown by our CompareString.
2205  * We need a define for it.
2206  */
2207  dwFlags = 0x10000000;
2208  if (!bCase) dwFlags |= NORM_IGNORECASE;
2209 
2210  return (CompareStringA(GetThreadLocale(), dwFlags, lpszStr, iLen, lpszComp, iLen) == CSTR_EQUAL);
2211 }
#define NORM_IGNORECASE
Definition: winnls.h:173
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
Definition: lang.c:2299
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define CSTR_EQUAL
Definition: winnls.h:453
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1449

◆ StrIsIntlEqualW()

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

Definition at line 2218 of file string.c.

2220 {
2221  DWORD dwFlags;
2222 
2223  TRACE("(%d,%s,%s,%d)\n", bCase,
2224  debugstr_w(lpszStr),debugstr_w(lpszComp), iLen);
2225 
2226  /* FIXME: This flag is undocumented and unknown by our CompareString.
2227  * We need a define for it.
2228  */
2229  dwFlags = 0x10000000;
2230  if (!bCase) dwFlags |= NORM_IGNORECASE;
2231 
2232  return (CompareStringW(GetThreadLocale(), dwFlags, lpszStr, iLen, lpszComp, iLen) == CSTR_EQUAL);
2233 }
#define NORM_IGNORECASE
Definition: winnls.h:173
#define debugstr_w
Definition: kernel32.h:32
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:2275
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define CSTR_EQUAL
Definition: winnls.h:453
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1449

◆ StrNCatA()

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

Definition at line 1778 of file string.c.

1779 {
1780  LPSTR lpszRet = lpszStr;
1781 
1782  TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszCat), cchMax);
1783 
1784  if (!lpszStr)
1785  {
1786  WARN("Invalid lpszStr would crash under Win32!\n");
1787  return NULL;
1788  }
1789 
1790  StrCpyNA(lpszStr + strlen(lpszStr), lpszCat, cchMax);
1791  return lpszRet;
1792 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define WARN(fmt,...)
Definition: debug.h:111
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
#define StrCpyNA
Definition: shlwapi.h:1514
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
UINT cchMax

◆ StrNCatW()

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

Definition at line 1799 of file string.c.

1800 {
1801  LPWSTR lpszRet = lpszStr;
1802 
1803  TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszCat), cchMax);
1804 
1805  if (!lpszStr)
1806  {
1807  WARN("Invalid lpszStr would crash under Win32\n");
1808  return NULL;
1809  }
1810 
1811  StrCpyNW(lpszStr + strlenW(lpszStr), lpszCat, cchMax);
1812  return lpszRet;
1813 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WARN(fmt,...)
Definition: debug.h:111
LPWSTR WINAPI StrCpyNW(LPWSTR dst, LPCWSTR src, int count)
Definition: string.c:536
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
UINT cchMax
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ StrPBrkA()

LPSTR WINAPI StrPBrkA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 1255 of file string.c.

1256 {
1257  TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
1258 
1259  if (lpszStr && lpszMatch && *lpszMatch)
1260  {
1261  while (*lpszStr)
1262  {
1263  if (StrChrA(lpszMatch, *lpszStr))
1264  return (LPSTR)lpszStr;
1265  lpszStr = CharNextA(lpszStr);
1266  }
1267  }
1268  return NULL;
1269 }
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:270
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

◆ StrPBrkW()

LPWSTR WINAPI StrPBrkW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 1276 of file string.c.

1277 {
1278  if (!lpszStr || !lpszMatch) return NULL;
1279  return strpbrkW( lpszStr, lpszMatch );
1280 }
smooth NULL
Definition: ftsmooth.c:416
WINE_UNICODE_INLINE WCHAR * strpbrkW(const WCHAR *str, const WCHAR *accept)
Definition: unicode.h:261

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

◆ StrRChrA()

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

Definition at line 1327 of file string.c.

1328 {
1329  TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
1330 
1331  return SHLWAPI_StrRChrHelperA(lpszStr, lpszEnd, ch, SHLWAPI_ChrCmpA);
1332 }
static BOOL WINAPI SHLWAPI_ChrCmpA(WORD ch1, WORD ch2)
Definition: string.c:187
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
static LPSTR SHLWAPI_StrRChrHelperA(LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch, BOOL(WINAPI *pChrCmpFn)(WORD, WORD))
Definition: string.c:1287

◆ StrRChrIA()

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

Definition at line 1368 of file string.c.

1369 {
1370  TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
1371 
1372  return SHLWAPI_StrRChrHelperA(lpszStr, lpszEnd, ch, ChrCmpIA);
1373 }
BOOL WINAPI ChrCmpIA(WORD ch1, WORD ch2)
Definition: string.c:205
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
static LPSTR SHLWAPI_StrRChrHelperA(LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch, BOOL(WINAPI *pChrCmpFn)(WORD, WORD))
Definition: string.c:1287

◆ StrRChrIW()

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

Definition at line 1380 of file string.c.

1381 {
1382  WCHAR *ret = NULL;
1383 
1384  if (!str) return NULL;
1385  if (!end) end = str + strlenW(str);
1386  while (str < end)
1387  {
1388  if (!ChrCmpIW(*str, ch)) ret = (WCHAR *)str;
1389  str++;
1390  }
1391  return ret;
1392 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
GLuint GLuint end
Definition: gl.h:1545
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
BOOL WINAPI ChrCmpIW(WCHAR ch1, WCHAR ch2)
Definition: string.c:217

◆ StrRChrW()

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

Definition at line 1339 of file string.c.

1340 {
1341  WCHAR *ret = NULL;
1342 
1343  if (!str) return NULL;
1344  if (!end) end = str + strlenW(str);
1345  while (str < end)
1346  {
1347  if (*str == ch) ret = (WCHAR *)str;
1348  str++;
1349  }
1350  return ret;
1351 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
GLuint GLuint end
Definition: gl.h:1545
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret

◆ StrRetToBSTR()

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

Definition at line 1686 of file string.c.

1687 {
1688  HRESULT hRet = E_FAIL;
1689 
1690  switch (lpStrRet->uType)
1691  {
1692  case STRRET_WSTR:
1693  *pBstrOut = SysAllocString(lpStrRet->u.pOleStr);
1694  if (*pBstrOut)
1695  hRet = S_OK;
1696  CoTaskMemFree(lpStrRet->u.pOleStr);
1697  break;
1698 
1699  case STRRET_CSTR:
1700  hRet = _SHStrDupAToBSTR(lpStrRet->u.cStr, pBstrOut);
1701  break;
1702 
1703  case STRRET_OFFSET:
1704  hRet = _SHStrDupAToBSTR(((LPCSTR)&pidl->mkid) + lpStrRet->u.uOffset, pBstrOut);
1705  break;
1706 
1707  default:
1708  *pBstrOut = NULL;
1709  }
1710 
1711  return hRet;
1712 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
static HRESULT _SHStrDupAToBSTR(LPCSTR src, BSTR *pBstrOut)
Definition: string.c:1650
LPWSTR pOleStr
Definition: shtypes.idl:96
#define E_FAIL
Definition: ddrawi.h:102
char cStr[MAX_PATH]
Definition: shtypes.idl:98
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
const char * LPCSTR
Definition: xmlstorage.h:183
UINT uOffset
Definition: shtypes.idl:97
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
UINT uType
Definition: shtypes.idl:93

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

◆ StrRetToBufA()

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

Definition at line 1473 of file string.c.

1474 {
1475  /* NOTE:
1476  * This routine is identical to that in dlls/shell32/shellstring.c.
1477  * It was duplicated because not every version of Shlwapi.dll exports
1478  * StrRetToBufA. If you change one routine, change them both.
1479  */
1480  TRACE("dest=%p len=0x%x strret=%p pidl=%p\n", dest, len, src, pidl);
1481 
1482  if (!src)
1483  {
1484  WARN("Invalid lpStrRet would crash under Win32!\n");
1485  if (dest)
1486  *dest = '\0';
1487  return E_FAIL;
1488  }
1489 
1490  if (!dest || !len)
1491  return E_FAIL;
1492 
1493  *dest = '\0';
1494 
1495  switch (src->uType)
1496  {
1497  case STRRET_WSTR:
1498  WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, dest, len, NULL, NULL);
1499  CoTaskMemFree(src->u.pOleStr);
1500  break;
1501 
1502  case STRRET_CSTR:
1503  lstrcpynA(dest, src->u.cStr, len);
1504  break;
1505 
1506  case STRRET_OFFSET:
1507  lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
1508  break;
1509 
1510  default:
1511  FIXME("unknown type!\n");
1512  return E_NOTIMPL;
1513  }
1514  return S_OK;
1515 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
#define WARN(fmt,...)
Definition: debug.h:111
char * LPSTR
Definition: xmlstorage.h:182
#define E_FAIL
Definition: ddrawi.h:102
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
#define lstrcpynA
Definition: compat.h:416
static char * dest
Definition: rtl.c:135
SHITEMID mkid
Definition: shtypes.idl:34

◆ StrRetToBufW()

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

Definition at line 1522 of file string.c.

1523 {
1524  TRACE("dest=%p len=0x%x strret=%p pidl=%p\n", dest, len, src, pidl);
1525 
1526  if (!dest || !len)
1527  return E_FAIL;
1528 
1529  if (!src)
1530  {
1531  WARN("Invalid lpStrRet would crash under Win32!\n");
1532  if (dest)
1533  *dest = '\0';
1534  return E_FAIL;
1535  }
1536 
1537  *dest = '\0';
1538 
1539  switch (src->uType) {
1540  case STRRET_WSTR: {
1541  size_t dst_len;
1542  if (!src->u.pOleStr)
1543  return E_FAIL;
1544  dst_len = strlenW(src->u.pOleStr);
1545  memcpy(dest, src->u.pOleStr, min(dst_len, len-1) * sizeof(WCHAR));
1546  dest[min(dst_len, len-1)] = 0;
1547  CoTaskMemFree(src->u.pOleStr);
1548  if (len <= dst_len)
1549  {
1550  dest[0] = 0;
1551  return E_NOT_SUFFICIENT_BUFFER;
1552  }
1553  break;
1554  }
1555 
1556  case STRRET_CSTR:
1557  if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ))
1558  dest[len-1] = 0;
1559  break;
1560 
1561  case STRRET_OFFSET:
1562  if (pidl)
1563  {
1564  if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1,
1565  dest, len ))
1566  dest[len-1] = 0;
1567  }
1568  break;
1569 
1570  default:
1571  FIXME("unknown type!\n");
1572  return E_NOTIMPL;
1573  }
1574 
1575  return S_OK;
1576 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define CP_ACP
Definition: compat.h:99
#define WARN(fmt,...)
Definition: debug.h:111
#define E_FAIL
Definition: ddrawi.h:102
#define FIXME(fmt,...)
Definition: debug.h:110
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
#define min(a, b)
Definition: monoChain.cc:55
#define MultiByteToWideChar
Definition: compat.h:100
static char * dest
Definition: rtl.c:135
SHITEMID mkid
Definition: shtypes.idl:34

Referenced by CFSDropTarget::_DoDrop(), CAddressEditBox::AddComboBoxItem(), COMDLG32_GetDisplayNameOf(), COMDLG32_UpdateCurrentDir(), CDeskLinkDropHandler::Drop(), CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >::GetDisplayNameOf(), GetFullName(), IEGetNameAndFlagsEx(), CExplorerBand::InsertItem(), CAddressEditBox::Invoke(), SHELL32_CompareDetails(), SHGetPathFromIDListW(), 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 1592 of file string.c.

1593 {
1594  HRESULT hRet = E_FAIL;
1595 
1596  switch (lpStrRet->uType)
1597  {
1598  case STRRET_WSTR:
1599  hRet = _SHStrDupAW(lpStrRet->u.pOleStr, ppszName);
1600  CoTaskMemFree(lpStrRet->u.pOleStr);
1601  break;
1602 
1603  case STRRET_CSTR:
1604  hRet = _SHStrDupAA(lpStrRet->u.cStr, ppszName);
1605  break;
1606 
1607  case STRRET_OFFSET:
1608  hRet = _SHStrDupAA(((LPCSTR)&pidl->mkid) + lpStrRet->u.uOffset, ppszName);
1609  break;
1610 
1611  default:
1612  *ppszName = NULL;
1613  }
1614 
1615  return hRet;
1616 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
LPWSTR pOleStr
Definition: shtypes.idl:96
static HRESULT _SHStrDupAW(LPCWSTR, LPSTR *)
Definition: string.c:1976
#define E_FAIL
Definition: ddrawi.h:102
static HRESULT _SHStrDupAA(LPCSTR, LPSTR *)
Definition: string.c:1909
char cStr[MAX_PATH]
Definition: shtypes.idl:98
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
SIGDN PWSTR * ppszName
Definition: shobjidl.idl:593
UINT uOffset
Definition: shtypes.idl:97
LONG HRESULT
Definition: typedefs.h:77
SHITEMID mkid
Definition: shtypes.idl:34
UINT uType
Definition: shtypes.idl:93

◆ StrRetToStrW()

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

Definition at line 1623 of file string.c.

1624 {
1625  HRESULT hRet = E_FAIL;
1626 
1627  switch (lpStrRet->uType)
1628  {
1629  case STRRET_WSTR:
1630  hRet = SHStrDupW(lpStrRet->u.pOleStr, ppszName);
1631  CoTaskMemFree(lpStrRet->u.pOleStr);
1632  break;
1633 
1634  case STRRET_CSTR:
1635  hRet = SHStrDupA(lpStrRet->u.cStr, ppszName);
1636  break;
1637 
1638  case STRRET_OFFSET:
1639  hRet = SHStrDupA(((LPCSTR)&pidl->mkid) + lpStrRet->u.uOffset, ppszName);
1640  break;
1641 
1642  default:
1643  *ppszName = NULL;
1644  }
1645 
1646  return hRet;
1647 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
LPWSTR pOleStr
Definition: shtypes.idl:96
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
Definition: string.c:2004
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI SHStrDupA(LPCSTR lpszStr, LPWSTR *lppszDest)
Definition: string.c:1946
char cStr[MAX_PATH]
Definition: shtypes.idl:98
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
SIGDN PWSTR * ppszName
Definition: shobjidl.idl:593
UINT uOffset
Definition: shtypes.idl:97
LONG HRESULT
Definition: typedefs.h:77
SHITEMID mkid
Definition: shtypes.idl:34
UINT uType
Definition: shtypes.idl:93

Referenced by CEnumMergedFolder::Begin(), GetDisplayname(), CSendToMenu::LoadAllItems(), and SHGetNameFromIDList().

◆ 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 }
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2232
BOOL WINAPI ChrCmpIA(WORD ch1, WORD ch2)
Definition: string.c:205
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned short WORD
Definition: ntddk_ex.h:93
INT WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:300
unsigned char UCHAR
Definition: xmlstorage.h:181
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define min(a, b)
Definition: monoChain.cc:55

◆ 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 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define lstrlenW
Definition: compat.h:415
int32_t INT
Definition: typedefs.h:56
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define min(a, b)
Definition: monoChain.cc:55
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static LPWSTR
Definition: string.c:48
BOOL WINAPI ChrCmpIW(WCHAR ch1, WCHAR ch2)
Definition: string.c:217
INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
Definition: string.c:311

◆ StrSpnA()

int WINAPI StrSpnA ( LPCSTR  lpszStr,
LPCSTR  lpszMatch 
)

Definition at line 1149 of file string.c.

1150 {
1151  TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
1152 
1153  return SHLWAPI_StrSpnHelperA(lpszStr, lpszMatch, StrChrA, FALSE);
1154 }
static int SHLWAPI_StrSpnHelperA(LPCSTR lpszStr, LPCSTR lpszMatch, LPSTR(WINAPI *pStrChrFn)(LPCSTR, WORD), BOOL bInvert)
Definition: string.c:1114
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:270
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

◆ StrSpnW()

int WINAPI StrSpnW ( LPCWSTR  lpszStr,
LPCWSTR  lpszMatch 
)

Definition at line 1161 of file string.c.

1162 {
1163  if (!lpszStr || !lpszMatch) return 0;
1164  return strspnW( lpszStr, lpszMatch );
1165 }
WINE_UNICODE_INLINE size_t strspnW(const WCHAR *str, const WCHAR *accept)
Definition: unicode.h:267

◆ 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 }
static LPSTR SHLWAPI_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch, INT(WINAPI *pStrCmpFn)(LPCSTR, LPCSTR, INT))
Definition: string.c:561
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:493

◆ 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 }
static LPSTR SHLWAPI_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch, INT(WINAPI *pStrCmpFn)(LPCSTR, LPCSTR, INT))
Definition: string.c:561
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
INT WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:300

◆ 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 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GLuint GLuint end
Definition: gl.h:1545
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184
INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
Definition: string.c:311

◆ 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 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
int strncmpiW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: string.c:44
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
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
UINT cchMax
static size_t len
Definition: string.c:60
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ 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 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
WINE_UNICODE_INLINE int strncmpW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: unicode.h:235
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
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
UINT cchMax
static size_t len
Definition: string.c:60
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ 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 debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR * strstrW(const WCHAR *str, const WCHAR *sub)
Definition: string.c:60

◆ 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 
929  if (dwFlags & STIF_SUPPORT_HEX &&
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 TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
LPSTR WINAPI CharNextA(_In_ LPCSTR)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define isdigit(c)
Definition: acclib.h:68
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STIF_SUPPORT_HEX
Definition: shlwapi.h:1452
#define isxdigit(c)
Definition: acclib.h:70
int tolower(int c)
Definition: utclib.c:902

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 TRUE
Definition: types.h:120
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
#define WARN(fmt,...)
Definition: debug.h:111
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
WINE_UNICODE_INLINE WCHAR tolowerW(WCHAR ch)
Definition: unicode.h:135
WINE_UNICODE_INLINE int isxdigitW(WCHAR wc)
Definition: unicode.h:175
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STIF_SUPPORT_HEX
Definition: shlwapi.h:1452
WINE_UNICODE_INLINE int isdigitW(WCHAR wc)
Definition: unicode.h:170

Referenced by 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, LPINT lpiRet)
Definition: string.c:886
#define WARN(fmt,...)
Definition: debug.h:111
#define isdigit(c)
Definition: acclib.h:68
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

◆ StrToIntExA()

BOOL WINAPI StrToIntExA ( LPCSTR  lpszStr,
DWORD  dwFlags,
LPINT  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
unsigned int BOOL
Definition: ntddk_ex.h:94
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

Referenced by StrToIntA(), and test_StrToIntExA().

◆ StrToIntExW()

BOOL WINAPI StrToIntExW ( LPCWSTR  lpszStr,
DWORD  dwFlags,
LPINT  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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

Referenced by CAvailableApplicationInfo::RetrieveLanguages(), 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 }
#define WARN(fmt,...)
Definition: debug.h:111
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI StrToIntExW(LPCWSTR lpszStr, DWORD dwFlags, LPINT lpiRet)
Definition: string.c:970
WINE_UNICODE_INLINE int isdigitW(WCHAR wc)
Definition: unicode.h:170

◆ StrTrimA()

BOOL WINAPI StrTrimA ( LPSTR  lpszStr,
LPCSTR  lpszTrim 
)

Definition at line 1828 of file string.c.

1829 {
1830  DWORD dwLen;
1831  LPSTR lpszRead = lpszStr;
1832  BOOL bRet = FALSE;
1833 
1834  TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszTrim));
1835 
1836  if (lpszRead && *lpszRead)
1837  {
1838  while (*lpszRead && StrChrA(lpszTrim, *lpszRead))
1839  lpszRead = CharNextA(lpszRead); /* Skip leading matches */
1840 
1841  dwLen = strlen(lpszRead);
1842 
1843  if (lpszRead != lpszStr)
1844  {
1845  memmove(lpszStr, lpszRead, dwLen + 1);
1846  bRet = TRUE;
1847  }
1848  if (dwLen > 0)
1849  {
1850  lpszRead = lpszStr + dwLen;
1851  while (StrChrA(lpszTrim, lpszRead[-1]))
1852  lpszRead = CharPrevA(lpszStr, lpszRead); /* Skip trailing matches */
1853 
1854  if (lpszRead != lpszStr + dwLen)
1855  {
1856  *lpszRead = '\0';
1857  bRet = TRUE;
1858  }
1859  }
1860  }
1861  return bRet;
1862 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
unsigned int BOOL
Definition: ntddk_ex.h:94
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:270
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR WINAPI CharPrevA(_In_ LPCSTR, _In_ LPCSTR)

◆ StrTrimW()

BOOL WINAPI StrTrimW ( LPWSTR  lpszStr,
LPCWSTR  lpszTrim 
)

Definition at line 1869 of file string.c.

1870 {
1871  DWORD dwLen;
1872  LPWSTR lpszRead = lpszStr;
1873  BOOL bRet = FALSE;
1874 
1875  TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszTrim));
1876 
1877  if (lpszRead && *lpszRead)
1878  {
1879  while (*lpszRead && StrChrW(lpszTrim, *lpszRead)) lpszRead++;
1880 
1881  dwLen = strlenW(lpszRead);
1882 
1883  if (lpszRead != lpszStr)
1884  {
1885  memmove(lpszStr, lpszRead, (dwLen + 1) * sizeof(WCHAR));
1886  bRet = TRUE;
1887  }
1888  if (dwLen > 0)
1889  {
1890  lpszRead = lpszStr + dwLen;
1891  while (StrChrW(lpszTrim, lpszRead[-1]))
1892  lpszRead--; /* Skip trailing matches */
1893 
1894  if (lpszRead != lpszStr + dwLen)
1895  {
1896  *lpszRead = '\0';
1897  bRet = TRUE;
1898  }
1899  }
1900  }
1901  return bRet;
1902 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ shlwapi_hInstance

HINSTANCE shlwapi_hInstance

Definition at line 33 of file shlwapi_main.c.

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