summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/loader/LoadLibraryW/test3/loadlibraryw.c
blob: c722edaf131e529b0da9c5eb4fc3faf923a8a589 (plain)
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
// 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: loadlibraryw.c
**
** Purpose: Negative test the loadlibraryw API.
**          Call loadlibraryw with NULL module name
**
**
**============================================================*/
#define UNICODE
#include <palsuite.h>

int __cdecl main(int argc, char *argv[])
{
    HMODULE ModuleHandle;
    int err;

    /* Initialize the PAL environment */
    err = PAL_Initialize(argc, argv);
    if(0 != err)
    {
        return FAIL;
    }

    /* load a module with a NULL module name */
    ModuleHandle = LoadLibraryW(NULL);
    if(NULL != ModuleHandle)
    {
        Fail("\nFailed to call loadlibraryw API for a negative test, "
            "call loadibraryw with NULL moudle name, a NULL module "
            "handle is expected, but no NULL module handle is returned, "
            "error code =%u\n", GetLastError());   
    }
  
    PAL_Terminate();
    return PASS;
}