1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | /*===================================================================== |
6 | ** |
7 | ** Source: test2.c (FreeLibrary) |
8 | ** |
9 | ** Purpose: Tests the PAL implementation of the FreeLibrary function. |
10 | ** This is a negative test that will pass an invalid and a |
11 | ** null handle to FreeLibrary. |
12 | ** |
13 | ** |
14 | **===================================================================*/ |
15 | |
16 | #include <palsuite.h> |
17 | |
18 | int __cdecl main(int argc, char* argv[]) |
19 | { |
20 | HANDLE hLib; |
21 | |
22 | /* Initialize the PAL. |
23 | */ |
24 | if ((PAL_Initialize(argc, argv)) != 0) |
25 | { |
26 | return (FAIL); |
27 | } |
28 | |
29 | /* Attempt to pass FreeLibrary an invalid handle. |
30 | */ |
31 | hLib = INVALID_HANDLE_VALUE; |
32 | if (FreeLibrary(hLib)) |
33 | { |
34 | Fail("ERROR: Able to free library handle = \"0x%lx\".\n" , |
35 | hLib); |
36 | } |
37 | |
38 | /* Attempt to pass FreeLibrary a NULL handle. |
39 | */ |
40 | hLib = NULL; |
41 | if (FreeLibrary(hLib)) |
42 | { |
43 | Fail("ERROR: Able to free library handle = \"NULL\".\n" ); |
44 | } |
45 | |
46 | |
47 | /* Terminate the PAL. |
48 | */ |
49 | PAL_Terminate(); |
50 | return PASS; |
51 | |
52 | } |
53 | |