forked from maraf/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhostimpl.cpp
More file actions
78 lines (63 loc) · 2.07 KB
/
hostimpl.cpp
File metadata and controls
78 lines (63 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include "stdafx.h"
#include "mscoree.h"
#include "clrinternal.h"
#include "clrhost.h"
#include "ex.h"
thread_local size_t t_ThreadType;
CRITSEC_COOKIE ClrCreateCriticalSection(CrstType crstType, CrstFlags flags)
{
CRITICAL_SECTION *cs = (CRITICAL_SECTION*)malloc(sizeof(CRITICAL_SECTION));
InitializeCriticalSection(cs);
return (CRITSEC_COOKIE)cs;
}
void ClrDeleteCriticalSection(CRITSEC_COOKIE cookie)
{
_ASSERTE(cookie);
DeleteCriticalSection((CRITICAL_SECTION*)cookie);
free(cookie);
}
void ClrEnterCriticalSection(CRITSEC_COOKIE cookie)
{
_ASSERTE(cookie);
EnterCriticalSection((CRITICAL_SECTION*)cookie);
}
void ClrLeaveCriticalSection(CRITSEC_COOKIE cookie)
{
_ASSERTE(cookie);
LeaveCriticalSection((CRITICAL_SECTION*)cookie);
}
DWORD ClrSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
{
return SleepEx(dwMilliseconds, bAlertable);
}
LPVOID ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect)
{
return VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
}
BOOL ClrVirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType)
{
return VirtualFree(lpAddress, dwSize, dwFreeType);
}
SIZE_T ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength)
{
return VirtualQuery(lpAddress, lpBuffer, dwLength);
}
BOOL ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
{
return VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect);
}
//------------------------------------------------------------------------------
// Helper function to get an exception from outside the exception. In
// the CLR, it may be from the Thread object. Non-CLR users have no thread object,
// and it will do nothing.
void GetLastThrownObjectExceptionFromThread(Exception** ppException)
{
*ppException = NULL;
}
#ifdef HOST_WINDOWS
void CreateCrashDumpIfEnabled(bool stackoverflow)
{
}
#endif