Update tests exclusion
[mono-project.git] / mono / metadata / w32file-win32-uwp.c
blob0538b74b7d767b4f0193e5efd0104063e0093c6b
1 /**
2 * \file
3 * UWP w32file support for Mono.
5 * Copyright 2016 Microsoft
6 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
7 */
8 #include <config.h>
9 #include <glib.h>
10 #include "mono/utils/mono-compiler.h"
11 #include <windows.h>
12 #include "mono/metadata/w32file-win32-internals.h"
13 #include "mono/metadata/w32subset.h"
14 #include "icall-decl.h"
16 #if !HAVE_API_SUPPORT_WIN32_MOVE_FILE && HAVE_API_SUPPORT_WIN32_MOVE_FILE_EX
17 gboolean
18 mono_w32file_move (const gunichar2 *path, const gunichar2 *dest, gint32 *error)
20 gboolean result = FALSE;
21 MONO_ENTER_GC_SAFE;
23 result = MoveFileExW (path, dest, MOVEFILE_COPY_ALLOWED);
24 if (result == FALSE) {
25 *error=GetLastError ();
28 MONO_EXIT_GC_SAFE;
29 return result;
31 #endif
33 #if !HAVE_API_SUPPORT_WIN32_COPY_FILE && HAVE_API_SUPPORT_WIN32_COPY_FILE2
34 gboolean
35 mono_w32file_copy (const gunichar2 *path, const gunichar2 *dest, gboolean overwrite, gint32 *error)
37 gboolean result = FALSE;
38 COPYFILE2_EXTENDED_PARAMETERS copy_param = {0};
40 copy_param.dwSize = sizeof (COPYFILE2_EXTENDED_PARAMETERS);
41 copy_param.dwCopyFlags = (!overwrite) ? COPY_FILE_FAIL_IF_EXISTS : 0;
43 MONO_ENTER_GC_SAFE;
45 result = SUCCEEDED (CopyFile2 (path, dest, &copy_param));
46 if (result == FALSE) {
47 *error=GetLastError ();
50 MONO_EXIT_GC_SAFE;
51 return result;
53 #endif
55 #if !HAVE_API_SUPPORT_WIN32_GET_STD_HANDLE
56 HANDLE
57 mono_w32file_get_console_output (void)
59 ERROR_DECL (error);
61 g_unsupported_api ("GetStdHandle (STD_OUTPUT_HANDLE)");
63 mono_error_set_not_supported (error, G_UNSUPPORTED_API, "GetStdHandle (STD_OUTPUT_HANDLE)");
64 mono_error_set_pending_exception (error);
66 SetLastError (ERROR_NOT_SUPPORTED);
68 return INVALID_HANDLE_VALUE;
71 HANDLE
72 mono_w32file_get_console_input (void)
74 ERROR_DECL (error);
76 g_unsupported_api ("GetStdHandle (STD_INPUT_HANDLE)");
78 mono_error_set_not_supported (error, G_UNSUPPORTED_API, "GetStdHandle (STD_INPUT_HANDLE)");
79 mono_error_set_pending_exception (error);
81 SetLastError (ERROR_NOT_SUPPORTED);
83 return INVALID_HANDLE_VALUE;
86 HANDLE
87 mono_w32file_get_console_error (void)
89 ERROR_DECL (error);
91 g_unsupported_api ("GetStdHandle (STD_ERROR_HANDLE)");
93 mono_error_set_not_supported (error, G_UNSUPPORTED_API, "GetStdHandle (STD_ERROR_HANDLE)");
94 mono_error_set_pending_exception (error);
96 SetLastError (ERROR_NOT_SUPPORTED);
98 return INVALID_HANDLE_VALUE;
100 #endif // HAVE_API_SUPPORT_WIN32_GET_STD_HANDLE
102 MONO_EMPTY_SOURCE_FILE (file_io_windows_uwp);