1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4//
5
6#include "common.h"
7
8// This is a simplified implementation of IsTextUnicode.
9// https://github.com/dotnet/coreclr/issues/2307
10BOOL IsTextUnicode(CONST VOID* lpv, int iSize, LPINT lpiResult)
11{
12 *lpiResult = 0;
13
14 if (iSize < 2) return FALSE;
15
16 BYTE * p = (BYTE *)lpv;
17
18 // Check for Unicode BOM
19 if ((*p == 0xFF) && (*(p+1) == 0xFE))
20 {
21 *lpiResult |= IS_TEXT_UNICODE_SIGNATURE;
22 return TRUE;
23 }
24
25 return FALSE;
26}
27
28