summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/miscellaneous/CloseHandle/test2/test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/tests/palsuite/miscellaneous/CloseHandle/test2/test.cpp')
-rw-r--r--src/pal/tests/palsuite/miscellaneous/CloseHandle/test2/test.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/miscellaneous/CloseHandle/test2/test.cpp b/src/pal/tests/palsuite/miscellaneous/CloseHandle/test2/test.cpp
new file mode 100644
index 0000000000..c1eea44070
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/CloseHandle/test2/test.cpp
@@ -0,0 +1,46 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================
+**
+** Source: test.c
+**
+** Purpose: Test for CloseHandle function, try to close an unopened HANDLE
+**
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ HANDLE SomeHandle = NULL;
+
+ /*
+ * Initialize the PAL and return FAILURE if this fails
+ */
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /* If the handle is already closed and you can close it again,
+ * something is wrong.
+ */
+
+ if(CloseHandle(SomeHandle) != 0)
+ {
+ Fail("ERROR: Called CloseHandle on an already closed Handle "
+ "and it still returned as a success.\n");
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+