From 4b4aad7217d3292650e77eec2cf4c198ea9c3b4b Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Wed, 23 Nov 2016 19:09:09 +0900 Subject: Imported Upstream version 1.1.0 --- src/palrt/shlwapip.h | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 src/palrt/shlwapip.h (limited to 'src/palrt/shlwapip.h') diff --git a/src/palrt/shlwapip.h b/src/palrt/shlwapip.h new file mode 100644 index 0000000000..bc449c5054 --- /dev/null +++ b/src/palrt/shlwapip.h @@ -0,0 +1,88 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// + +// +// =========================================================================== +// File: shlwapi.h +// +// Header for ported shlwapi stuff +// =========================================================================== + +#ifndef SHLWAPIP_H_INCLUDED +#define SHLWAPIP_H_INCLUDED + +#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0])) +#define SIZECHARS(sz) (sizeof(sz)/sizeof(sz[0])) + +#define SIZEOF(x) sizeof(x) +#define PRIVATE +#define PUBLIC +#ifndef ASSERT +#define ASSERT _ASSERTE +#endif +#define AssertMsg(f,m) _ASSERTE(f) +#define RIP(f) _ASSERTE(f) +#define RIPMSG(f,m) _ASSERTE(f) + +#define IsFlagSet(obj, f) (BOOL)(((obj) & (f)) == (f)) +#define IsFlagClear(obj, f) (BOOL)(((obj) & (f)) != (f)) + +#define InRange(id, idFirst, idLast) ((UINT)((id)-(idFirst)) <= (UINT)((idLast)-(idFirst))) + +#define CbFromCch(cch) ((cch)*sizeof(TCHAR)) + +#define IS_VALID_READ_BUFFER(p, t, n) (p != NULL) +#define IS_VALID_WRITE_BUFFER(p, t, n) (p != NULL) + +#define IS_VALID_READ_PTR(p, t) IS_VALID_READ_BUFFER(p, t, 1) +#define IS_VALID_WRITE_PTR(p, t) IS_VALID_WRITE_BUFFER(p, t, 1) + +#define IS_VALID_STRING_PTR(p, c) (p != NULL) +#define IS_VALID_STRING_PTRW(p, c) (p != NULL) + +#define CharLowerW _wcslwr + +inline int StrCmpNCW(LPCWSTR pch1, LPCWSTR pch2, int n) +{ + if (n == 0) + return 0; + + while (--n && *pch1 && *pch1 == *pch2) + { + pch1++; + pch2++; + } + + return *pch1 - *pch2; +} + +typedef struct tagPARSEDURLW { + DWORD cbSize; + // Pointers into the buffer that was provided to ParseURL + LPCWSTR pszProtocol; + UINT cchProtocol; + LPCWSTR pszSuffix; + UINT cchSuffix; + UINT nScheme; // One of URL_SCHEME_* + } PARSEDURLW, * PPARSEDURLW; + +typedef enum { + URL_SCHEME_INVALID = -1, + URL_SCHEME_UNKNOWN = 0, + URL_SCHEME_FTP = 1, + URL_SCHEME_HTTP = 2, + URL_SCHEME_FILE = 9, + URL_SCHEME_HTTPS = 11, +} URL_SCHEME; + +#define URL_ESCAPE_UNSAFE 0x20000000 +#define URL_DONT_ESCAPE_EXTRA_INFO 0x02000000 +#define URL_ESCAPE_SPACES_ONLY 0x04000000 +#define URL_DONT_SIMPLIFY 0x08000000 +#define URL_UNESCAPE_INPLACE 0x00100000 +#define URL_ESCAPE_PERCENT 0x00001000 +#define URL_ESCAPE_SEGMENT_ONLY 0x00002000 // Treat the entire URL param as one URL segment. + +#endif // ! SHLWAPIP_H_INCLUDED -- cgit v1.2.3