1 | /* $Id: DosFreeModuleEx.c 2254 2005-07-17 12:25:44Z bird $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * DosFreeModuleEx.
|
---|
5 | *
|
---|
6 | * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * This file is part of InnoTek LIBC.
|
---|
10 | *
|
---|
11 | * InnoTek LIBC is free software; you can redistribute it and/or modify
|
---|
12 | * it under the terms of the GNU Lesser General Public License as published
|
---|
13 | * by the Free Software Foundation; either version 2 of the License, or
|
---|
14 | * (at your option) any later version.
|
---|
15 | *
|
---|
16 | * InnoTek LIBC is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | * GNU Lesser General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU Lesser General Public License
|
---|
22 | * along with InnoTek LIBC; if not, write to the Free Software
|
---|
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
24 | *
|
---|
25 | */
|
---|
26 |
|
---|
27 | /*******************************************************************************
|
---|
28 | * Header Files *
|
---|
29 | *******************************************************************************/
|
---|
30 | #include "libc-alias.h"
|
---|
31 | #define INCL_ERRORS
|
---|
32 | #define INCL_DOSMODULEMGR
|
---|
33 | #define INCL_FSMACROS
|
---|
34 | #define INCL_EXAPIS
|
---|
35 | #include <os2emx.h>
|
---|
36 | #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_DOSEX
|
---|
37 | #include <InnoTekLIBC/logstrict.h>
|
---|
38 | #include "DosEx.h"
|
---|
39 |
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Free module loaded using the extended APIs.
|
---|
43 | */
|
---|
44 | APIRET APIENTRY DosFreeModuleEx(HMODULE hmod)
|
---|
45 | {
|
---|
46 | LIBCLOG_ENTER("hmod=%lx\n", hmod);
|
---|
47 | int rc;
|
---|
48 | FS_VAR();
|
---|
49 |
|
---|
50 | /*
|
---|
51 | * Validate input.
|
---|
52 | */
|
---|
53 | if (!hmod)
|
---|
54 | LIBCLOG_ERROR_RETURN_INT(ERROR_INVALID_HANDLE);
|
---|
55 |
|
---|
56 | /*
|
---|
57 | * Free module.
|
---|
58 | */
|
---|
59 | FS_SAVE_LOAD();
|
---|
60 | rc = __libc_dosexFree(DOSEX_TYPE_LOAD_MODULE, (unsigned)hmod);
|
---|
61 | if (rc == -1)
|
---|
62 | rc = DosFreeModule(hmod);
|
---|
63 | FS_RESTORE();
|
---|
64 | if (!rc)
|
---|
65 | LIBCLOG_RETURN_INT(rc);
|
---|
66 | LIBCLOG_ERROR_RETURN_INT(rc);
|
---|
67 | }
|
---|
68 |
|
---|