1 /**
2 * WinPR: Windows Portable Runtime
3 * Error Handling Functions
4 *
5 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23
24 #include <winpr/error.h>
25
26 #ifndef _WIN32
27
28 #include <stdio.h>
29
30 #include <winpr/nt.h>
31
GetErrorMode(void)32 UINT GetErrorMode(void)
33 {
34 return 0;
35 }
36
SetErrorMode(UINT uMode)37 UINT SetErrorMode(UINT uMode)
38 {
39 return 0;
40 }
41
GetLastError(VOID)42 DWORD GetLastError(VOID)
43 {
44 PTEB pt = NtCurrentTeb();
45 if (pt)
46 {
47 return pt->LastErrorValue;
48 }
49 return ERROR_OUTOFMEMORY;
50 }
51
SetLastError(DWORD dwErrCode)52 VOID SetLastError(DWORD dwErrCode)
53 {
54 PTEB pt = NtCurrentTeb();
55 if (pt)
56 {
57 pt->LastErrorValue = dwErrCode;
58 }
59 }
60
RestoreLastError(DWORD dwErrCode)61 VOID RestoreLastError(DWORD dwErrCode)
62 {
63 }
64
RaiseException(DWORD dwExceptionCode,DWORD dwExceptionFlags,DWORD nNumberOfArguments,CONST ULONG_PTR * lpArguments)65 VOID RaiseException(DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments,
66 CONST ULONG_PTR* lpArguments)
67 {
68 }
69
UnhandledExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo)70 LONG UnhandledExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo)
71 {
72 return 0;
73 }
74
75 LPTOP_LEVEL_EXCEPTION_FILTER
SetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter)76 SetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter)
77 {
78 return NULL;
79 }
80
AddVectoredExceptionHandler(ULONG First,PVECTORED_EXCEPTION_HANDLER Handler)81 PVOID AddVectoredExceptionHandler(ULONG First, PVECTORED_EXCEPTION_HANDLER Handler)
82 {
83 return NULL;
84 }
85
RemoveVectoredExceptionHandler(PVOID Handle)86 ULONG RemoveVectoredExceptionHandler(PVOID Handle)
87 {
88 return 0;
89 }
90
AddVectoredContinueHandler(ULONG First,PVECTORED_EXCEPTION_HANDLER Handler)91 PVOID AddVectoredContinueHandler(ULONG First, PVECTORED_EXCEPTION_HANDLER Handler)
92 {
93 return NULL;
94 }
95
RemoveVectoredContinueHandler(PVOID Handle)96 ULONG RemoveVectoredContinueHandler(PVOID Handle)
97 {
98 return 0;
99 }
100
101 #endif
102