| 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: loadlibrarya.c |
| 8 | ** |
| 9 | ** Purpose: Negative test the LoadLibrary API with NULL module |
| 10 | ** name. |
| 11 | ** |
| 12 | ** |
| 13 | **============================================================*/ |
| 14 | #include <palsuite.h> |
| 15 | |
| 16 | int __cdecl main(int argc, char *argv[]) |
| 17 | { |
| 18 | HMODULE ModuleHandle; |
| 19 | int err; |
| 20 | |
| 21 | /*Initialize the PAL environment*/ |
| 22 | err = PAL_Initialize(argc, argv); |
| 23 | if(0 != err) |
| 24 | { |
| 25 | return FAIL; |
| 26 | } |
| 27 | |
| 28 | /*load a module by passing a NULL module name*/ |
| 29 | ModuleHandle = LoadLibraryA(NULL); |
| 30 | if(NULL != ModuleHandle) |
| 31 | { |
| 32 | Fail("\nFailed to call loadlibrarya API for a negative test, " |
| 33 | "call loadibrarya with NULL moudle name, a NULL module " |
| 34 | "handle is expected, but no NULL module handle is returned, " |
| 35 | "error code =%u\n" , GetLastError()); |
| 36 | } |
| 37 | |
| 38 | PAL_Terminate(); |
| 39 | return PASS; |
| 40 | } |
| 41 | |