Index: src/installer-ca/dutil/strutil.h |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/src/installer-ca/dutil/strutil.h |
@@ -0,0 +1,123 @@ |
+#pragma once |
+//------------------------------------------------------------------------------------------------- |
+// <copyright file="strutil.h" company="Outercurve Foundation"> |
+// Copyright (c) 2004, Outercurve Foundation. |
+// This software is released under Microsoft Reciprocal License (MS-RL). |
+// The license and further copyright text can be found in the file |
+// LICENSE.TXT at the root directory of the distribution. |
+// </copyright> |
+// |
+// <summary> |
+// Header for string helper functions. |
+// </summary> |
+//------------------------------------------------------------------------------------------------- |
+ |
+#ifdef __cplusplus |
+extern "C" { |
+#endif |
+ |
+#define ReleaseStr(pwz) if (pwz) { StrFree(pwz); } |
+#define ReleaseNullStr(pwz) if (pwz) { StrFree(pwz); pwz = NULL; } |
+#define ReleaseBSTR(bstr) if (bstr) { ::SysFreeString(bstr); } |
+#define ReleaseNullBSTR(bstr) if (bstr) { ::SysFreeString(bstr); bstr = NULL; } |
+#define ReleaseStrArray(rg, c) { if (rg) { StrArrayFree(rg, c); } } |
+#define ReleaseNullStrArray(rg, c) { if (rg) { StrArrayFree(rg, c); c = 0; rg = NULL; } } |
+ |
+#define DeclareConstBSTR(bstr_const, wz) const WCHAR bstr_const[] = { 0x00, 0x00, sizeof(wz)-sizeof(WCHAR), 0x00, wz } |
+#define UseConstBSTR(bstr_const) const_cast<BSTR>(bstr_const + 4) |
+ |
+HRESULT DAPI StrAlloc( |
+ __deref_out_ecount_part(cch, 0) LPWSTR* ppwz, |
+ __in DWORD_PTR cch |
+ ); |
+HRESULT DAPI StrTrimCapacity( |
+ __deref_out_z LPWSTR* ppwz |
+ ); |
+HRESULT DAPI StrTrimWhitespace( |
+ __deref_out_z LPWSTR* ppwz, |
+ __in_z LPCWSTR wzSource |
+ ); |
+ |
+HRESULT DAPI StrAllocString( |
+ __deref_out_ecount_z(cchSource+1) LPWSTR* ppwz, |
+ __in_z LPCWSTR wzSource, |
+ __in DWORD_PTR cchSource |
+ ); |
+ |
+ |
+HRESULT DAPI StrAllocConcat( |
+ __deref_out_z LPWSTR* ppwz, |
+ __in_z LPCWSTR wzSource, |
+ __in DWORD_PTR cchSource |
+ ); |
+HRESULT __cdecl StrAllocFormatted( |
+ __deref_out_z LPWSTR* ppwz, |
+ __in __format_string LPCWSTR wzFormat, |
+ ... |
+ ); |
+HRESULT DAPI StrAllocFormattedArgs( |
+ __deref_out_z LPWSTR* ppwz, |
+ __in __format_string LPCWSTR wzFormat, |
+ __in va_list args |
+ ); |
+ |
+HRESULT DAPI StrMaxLength( |
+ __in LPCVOID p, |
+ __out DWORD_PTR* pcch |
+ ); |
+HRESULT DAPI StrSize( |
+ __in LPCVOID p, |
+ __out DWORD_PTR* pcb |
+ ); |
+ |
+HRESULT DAPI StrFree( |
+ __in LPVOID p |
+ ); |
+ |
+ |
+LPCWSTR wcsistr( |
+ __in_z LPCWSTR wzString, |
+ __in_z LPCWSTR wzCharSet |
+ ); |
+ |
+HRESULT DAPI StrStringToInt16( |
+ __in_z LPCWSTR wzIn, |
+ __in DWORD cchIn, |
+ __out SHORT* psOut |
+ ); |
+HRESULT DAPI StrStringToUInt16( |
+ __in_z LPCWSTR wzIn, |
+ __in DWORD cchIn, |
+ __out USHORT* pusOut |
+ ); |
+HRESULT DAPI StrStringToInt32( |
+ __in_z LPCWSTR wzIn, |
+ __in DWORD cchIn, |
+ __out INT* piOut |
+ ); |
+HRESULT DAPI StrStringToUInt32( |
+ __in_z LPCWSTR wzIn, |
+ __in DWORD cchIn, |
+ __out UINT* puiOut |
+ ); |
+HRESULT DAPI StrStringToInt64( |
+ __in_z LPCWSTR wzIn, |
+ __in DWORD cchIn, |
+ __out LONGLONG* pllOut |
+ ); |
+HRESULT DAPI StrStringToUInt64( |
+ __in_z LPCWSTR wzIn, |
+ __in DWORD cchIn, |
+ __out ULONGLONG* pullOut |
+ ); |
+void DAPI StrStringToUpper( |
+ __inout_z LPWSTR wzIn |
+ ); |
+void DAPI StrStringToLower( |
+ __inout_z LPWSTR wzIn |
+ ); |
+ |
+ |
+#ifdef __cplusplus |
+} |
+#endif |