Updating Xamarin/Microsoft file headers
[platform/upstream/libSkiaSharp.git] / src / xamarin / WinRTCompat.cpp
1 /*
2  * Copyright 2015 Xamarin Inc.
3  * Copyright 2017 Microsoft Corporation. All rights reserved.
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8
9 #include "WinRTCompat.h"
10
11 #ifdef SK_BUILD_FOR_WINRT
12
13 #include <windows.h>
14
15 #ifdef _M_ARM
16
17 unsigned int _mm_crc32_u32(unsigned int crc, unsigned int v)
18 {
19         return 0;
20 }
21
22 #endif // _M_ARM
23
24 DWORD WINAPI TlsAllocCompat(VOID)
25 {
26         return ::FlsAlloc(NULL);
27 }
28
29 LPVOID WINAPI TlsGetValueCompat(_In_ DWORD dwTlsIndex)
30 {
31         return ::FlsGetValue(dwTlsIndex);
32 }
33
34 BOOL WINAPI TlsSetValueCompat(_In_ DWORD dwTlsIndex, _In_opt_ LPVOID lpTlsValue)
35 {
36         return ::FlsSetValue(dwTlsIndex, lpTlsValue);
37 }
38
39 BOOL WINAPI TlsFreeCompat(_In_ DWORD dwTlsIndex)
40 {
41         return ::FlsFree(dwTlsIndex);
42 }
43
44 char *getenvCompat(const char *name)
45 {
46         // there is no environment in WinRT
47         return NULL;
48 }
49
50 int WINAPI CompareStringWCompat(_In_ LCID Locale, _In_ DWORD dwCmpFlags, _In_NLS_string_(cchCount1) PCNZWCH lpString1, _In_ int cchCount1, _In_NLS_string_(cchCount2) PCNZWCH lpString2, _In_ int cchCount2)
51 {
52         WCHAR localeName[LOCALE_NAME_MAX_LENGTH];
53         LCIDToLocaleName(Locale, localeName, LOCALE_NAME_MAX_LENGTH, 0);
54         return CompareStringEx(localeName, dwCmpFlags, lpString1, cchCount1, lpString2, cchCount2, NULL, NULL, NULL);
55 }
56
57 UINT WINAPI GetACPCompat(void)
58 {
59         return CP_ACP;
60 }
61
62 HANDLE WINAPI OpenThreadCompat(_In_ DWORD dwDesiredAccess, _In_ BOOL bInheritHandle, _In_ DWORD dwThreadId)
63 {
64         // TODO: implementation
65         return NULL;
66 }
67
68 DWORD WINAPI GetTickCountCompat(VOID)
69 {
70         return (long)GetTickCount64();
71 }
72
73 int WINAPI MessageBoxACompat(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
74 {
75         // TODO: implementation
76         return 0;
77 }
78
79 #endif // SK_BUILD_FOR_WINRT