Added support for ordinal hint in PE_FindExportedFunction.
[wine] / dlls / ntdll / loader.c
1 /*
2  * Copyright 2002 Dmitry Timoshkov for Codeweavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include "winbase.h"
20 #include "ntdef.h"
21 #include "winnt.h"
22 #include "ntddk.h"
23
24 #include "module.h"
25 #include "wine/debug.h"
26
27
28 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
29
30 NTSTATUS WINAPI LdrDisableThreadCalloutsForDll(HANDLE hModule)
31 {
32     if (DisableThreadLibraryCalls(hModule))
33         return STATUS_SUCCESS;
34     else
35         return STATUS_DLL_NOT_FOUND;
36 }
37
38 /* FIXME : MODULE_FindModule should depend on LdrGetDllHandle, not vice-versa */
39
40 NTSTATUS WINAPI LdrGetDllHandle(ULONG x, LONG y, PUNICODE_STRING name, PVOID *base)
41 {
42     STRING str;
43     WINE_MODREF *wm;
44
45     FIXME("%08lx %08lx %s %p : partial stub\n",x,y,debugstr_wn(name->Buffer,name->Length),base);
46
47     *base = 0;
48
49     RtlUnicodeStringToAnsiString(&str, name, TRUE);
50     wm = MODULE_FindModule(str.Buffer);
51     if(!wm)
52         return STATUS_DLL_NOT_FOUND;
53     *base = (PVOID) wm->module;
54
55     return STATUS_SUCCESS;
56 }
57
58 /* FIXME : MODULE_GetProcAddress should depend on LdrGetProcedureAddress, not vice-versa */
59
60 NTSTATUS WINAPI LdrGetProcedureAddress(PVOID base, PANSI_STRING name, ULONG ord, PVOID *address)
61 {
62     WARN("%p %s %ld %p\n",base, debugstr_an(name->Buffer,name->Length), ord, address);
63
64     if(name)
65         *address = MODULE_GetProcAddress( (HMODULE) base, name->Buffer, -1, FALSE);
66     else
67         *address = MODULE_GetProcAddress( (HMODULE) base, (LPSTR) ord, -1, FALSE);
68
69     return (*address) ? STATUS_SUCCESS : STATUS_DLL_NOT_FOUND;
70 }