Removed a few external dependencies from ntdll.

This commit is contained in:
Alexandre Julliard 2000-07-29 21:56:59 +00:00
parent e5c1b9dded
commit 0aa6cc298e
12 changed files with 136 additions and 103 deletions

View File

@ -117,7 +117,7 @@ static void EXC_DefaultHandling( EXCEPTION_RECORD *rec, CONTEXT *context )
else
ERR("Unhandled exception code %lx flags %lx addr %p\n",
rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress );
TerminateProcess( GetCurrentProcess(), 1 );
NtTerminateProcess( NtCurrentProcess(), 1 );
}

View File

@ -15,6 +15,7 @@
#include "ntddk.h"
#include "ntdll_misc.h"
#include "server.h"
DEFAULT_DEBUG_CHANNEL(ntdll);
@ -70,19 +71,15 @@ NTSTATUS WINAPI NtQueryTimerResolution(DWORD x1,DWORD x2,DWORD x3)
* NtTerminateProcess [NTDLL.]
*
* Native applications must kill themselves when done
* FIXME: return value 0-success
*/
NTSTATUS WINAPI NtTerminateProcess(
HANDLE ProcessHandle,
LONG ExitStatus)
NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
{
TRACE("0x%08x 0x%08lx\n", ProcessHandle, ExitStatus );
/* win32 (0x7fffffff) to nt (-1) */
if ( NtCurrentProcess() == ProcessHandle )
ProcessHandle = GetCurrentProcess();
return (! TerminateProcess( ProcessHandle, ExitStatus ));
NTSTATUS ret;
struct terminate_process_request *req = get_req_buffer();
req->handle = handle;
req->exit_code = exit_code;
if (!(ret = server_call_noerr( REQ_TERMINATE_PROCESS )) && req->self) exit( exit_code );
return ret;
}
/******************************************************************************
@ -140,14 +137,19 @@ NTSTATUS WINAPI NtResumeThread(
/******************************************************************************
* NtTerminateThread [NTDLL]
*/
NTSTATUS WINAPI NtTerminateThread(
IN HANDLE ThreadHandle,
IN NTSTATUS ExitStatus)
NTSTATUS WINAPI NtTerminateThread( IN HANDLE handle,
IN NTSTATUS exit_code )
{
if ( TerminateThread(ThreadHandle,ExitStatus) )
return 0;
return 0xc0000000; /* FIXME: lasterror->ntstatus */
NTSTATUS ret;
struct terminate_thread_request *req = get_req_buffer();
req->handle = handle;
req->exit_code = exit_code;
if (!(ret = server_call_noerr( REQ_TERMINATE_THREAD )) && req->self)
{
if (req->last) exit( exit_code );
else SYSDEPS_ExitThread( exit_code );
}
return ret;
}
/******************************************************************************

View File

@ -480,8 +480,8 @@ type win32
@ stub RtlResetRtlTranslations
@ stub RtlRunDecodeUnicodeString
@ stub RtlRunEncodeUnicodeString
@ stub RtlSecondsSince1970ToTime
@ stub RtlSecondsSince1980ToTime
@ stdcall RtlSecondsSince1970ToTime(long ptr) RtlSecondsSince1970ToTime
@ stdcall RtlSecondsSince1980ToTime(long ptr) RtlSecondsSince1980ToTime
@ stub RtlSelfRelativeToAbsoluteSD
@ stub RtlSetAllBits
@ stdcall RtlSetBits(long long long) RtlSetBits
@ -873,7 +873,7 @@ type win32
@ cdecl _ltoa(long ptr long) _ltoa
@ stub _memccpy
@ cdecl _memicmp(str str long) _memicmp
@ stub _snprintf
@ varargs _snprintf(ptr long ptr) snprintf
@ stub _snwprintf
@ stub _splitpath
@ cdecl _strcmpi(str str) strcasecmp
@ -882,7 +882,7 @@ type win32
@ cdecl _strnicmp(str str long) strncasecmp
@ cdecl _strupr(str) _strupr
@ cdecl _ultoa(long ptr long) _ultoa
@ stub _vsnprintf
@ cdecl _vsnprintf(ptr long ptr ptr) vsnprintf
@ cdecl _wcsicmp(wstr wstr) NTDLL__wcsicmp
@ cdecl _wcslwr(wstr) NTDLL__wcslwr
@ cdecl _wcsnicmp(wstr wstr long) NTDLL__wcsnicmp
@ -915,7 +915,7 @@ type win32
@ stub pow
@ stub qsort
@ stub sin
@ varargs sprintf(str str) wsprintfA
@ varargs sprintf(str str) sprintf
@ stub sqrt
@ varargs sscanf() sscanf
@ cdecl strcat(str str) strcat

View File

@ -8,8 +8,9 @@
#include "ntddk.h"
#include "ntdll_misc.h"
#include "server.h"
DEFAULT_DEBUG_CHANNEL(ntdll)
DEFAULT_DEBUG_CHANNEL(ntdll);
/* move to somewhere */
typedef void * POBJDIR_INFORMATION;
@ -212,13 +213,11 @@ NTSTATUS WINAPI NtDuplicateObject(
* ARGUMENTS:
* Handle handle to close
*/
NTSTATUS WINAPI NtClose(
HANDLE Handle)
NTSTATUS WINAPI NtClose( HANDLE Handle )
{
TRACE("(0x%08x)\n",Handle);
if (CloseHandle(Handle))
return STATUS_SUCCESS;
return STATUS_UNSUCCESSFUL; /*fixme*/
struct close_handle_request *req = get_req_buffer();
req->handle = Handle;
return server_call_noerr( REQ_CLOSE_HANDLE );
}
/******************************************************************************

View File

@ -12,7 +12,6 @@
#include "winreg.h"
#include "winerror.h"
#include "wine/unicode.h"
#include "file.h"
#include "server.h"
#include "ntddk.h"
#include "ntdll_misc.h"
@ -25,7 +24,7 @@ static inline NTSTATUS copy_nameU( LPWSTR Dest, PUNICODE_STRING Name, UINT Offse
if (Name->Buffer)
{
if ((Name->Length-Offset) > MAX_PATH) return STATUS_BUFFER_OVERFLOW;
lstrcpyW( Dest, Name->Buffer+Offset );
strcpyW( Dest, Name->Buffer+Offset );
}
else Dest[0] = 0;
return STATUS_SUCCESS;
@ -63,19 +62,19 @@ static BOOLEAN _NtKeyToWinKey(
len = 0;
*KeyHandle = ObjectAttributes->RootDirectory;
}
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKLM)))
else if((ObjectName->Length > (len=strlenW(KeyPath_HKLM)))
&& (0==strncmpiW(ObjectName->Buffer,KeyPath_HKLM,len)))
{ *KeyHandle = HKEY_LOCAL_MACHINE;
}
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKU)))
else if((ObjectName->Length > (len=strlenW(KeyPath_HKU)))
&& (0==strncmpiW(ObjectName->Buffer,KeyPath_HKU,len)))
{ *KeyHandle = HKEY_USERS;
}
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCR)))
else if((ObjectName->Length > (len=strlenW(KeyPath_HCR)))
&& (0==strncmpiW(ObjectName->Buffer,KeyPath_HCR,len)))
{ *KeyHandle = HKEY_CLASSES_ROOT;
}
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCC)))
else if((ObjectName->Length > (len=strlenW(KeyPath_HCC)))
&& (0==strncmpiW(ObjectName->Buffer,KeyPath_HCC,len)))
{ *KeyHandle = HKEY_CURRENT_CONFIG;
}
@ -132,7 +131,8 @@ NTSTATUS WINAPI NtCreateKey(
{
int ClassLen = Class->Length+1;
if ( ClassLen*sizeof(WCHAR) > server_remaining(req->class)) return STATUS_BUFFER_OVERFLOW;
lstrcpynW( req->class, Class->Buffer, ClassLen);
memcpy( req->class, Class->Buffer, ClassLen );
req->class[ClassLen] = 0;
}
else
req->class[0] = 0x0000;
@ -237,11 +237,11 @@ NTSTATUS WINAPI NtEnumerateKey(
case KeyBasicInformation:
{
PKEY_BASIC_INFORMATION kbi = KeyInformation;
UINT NameLength = lstrlenW(req->name) * sizeof(WCHAR);
UINT NameLength = strlenW(req->name) * sizeof(WCHAR);
*ResultLength = sizeof(KEY_BASIC_INFORMATION) - sizeof(WCHAR) + NameLength;
if (Length < *ResultLength) return STATUS_BUFFER_OVERFLOW;
DOSFS_UnixTimeToFileTime(req->modif, &kbi->LastWriteTime, 0);
RtlSecondsSince1970ToTime(req->modif, &kbi->LastWriteTime);
kbi->TitleIndex = 0;
kbi->NameLength = NameLength;
memcpy (kbi->Name, req->name, NameLength);
@ -250,13 +250,13 @@ NTSTATUS WINAPI NtEnumerateKey(
case KeyFullInformation:
{
PKEY_FULL_INFORMATION kfi = KeyInformation;
kfi->ClassLength = lstrlenW(req->class) * sizeof(WCHAR);
kfi->ClassLength = strlenW(req->class) * sizeof(WCHAR);
kfi->ClassOffset = (kfi->ClassLength) ?
sizeof(KEY_FULL_INFORMATION) - sizeof(WCHAR) : 0xffffffff;
*ResultLength = sizeof(KEY_FULL_INFORMATION) - sizeof(WCHAR) + kfi->ClassLength;
if (Length < *ResultLength) return STATUS_BUFFER_OVERFLOW;
DOSFS_UnixTimeToFileTime(req->modif, &kfi->LastWriteTime, 0);
RtlSecondsSince1970ToTime(req->modif, &kfi->LastWriteTime);
kfi->TitleIndex = 0;
/* kfi->SubKeys = req->subkeys;
kfi->MaxNameLength = req->max_subkey;
@ -272,15 +272,15 @@ NTSTATUS WINAPI NtEnumerateKey(
case KeyNodeInformation:
{
PKEY_NODE_INFORMATION kni = KeyInformation;
kni->ClassLength = lstrlenW(req->class) * sizeof(WCHAR);
kni->NameLength = lstrlenW(req->name) * sizeof(WCHAR);
kni->ClassLength = strlenW(req->class) * sizeof(WCHAR);
kni->NameLength = strlenW(req->name) * sizeof(WCHAR);
kni->ClassOffset = (kni->ClassLength) ?
sizeof(KEY_NODE_INFORMATION) - sizeof(WCHAR) + kni->NameLength : 0xffffffff;
*ResultLength = sizeof(KEY_NODE_INFORMATION) - sizeof(WCHAR) + kni->NameLength + kni->ClassLength;
if (Length < *ResultLength) return STATUS_BUFFER_OVERFLOW;
DOSFS_UnixTimeToFileTime(req->modif, &kni->LastWriteTime, 0);
RtlSecondsSince1970ToTime(req->modif, &kni->LastWriteTime);
kni->TitleIndex = 0;
memcpy (kni->Name, req->name, kni->NameLength);
if (kni->ClassLength) memcpy ((char *) KeyInformation + kni->ClassOffset, req->class, kni->ClassLength);
@ -319,11 +319,11 @@ NTSTATUS WINAPI NtQueryKey(
case KeyBasicInformation:
{
PKEY_BASIC_INFORMATION kbi = KeyInformation;
UINT NameLength = lstrlenW(req->name) * sizeof(WCHAR);
UINT NameLength = strlenW(req->name) * sizeof(WCHAR);
*ResultLength = sizeof(KEY_BASIC_INFORMATION) - sizeof(WCHAR) + NameLength;
if (Length < *ResultLength) return STATUS_BUFFER_OVERFLOW;
DOSFS_UnixTimeToFileTime(req->modif, &kbi->LastWriteTime, 0);
RtlSecondsSince1970ToTime(req->modif, &kbi->LastWriteTime);
kbi->TitleIndex = 0;
kbi->NameLength = NameLength;
memcpy (kbi->Name, req->name, NameLength);
@ -332,14 +332,14 @@ NTSTATUS WINAPI NtQueryKey(
case KeyFullInformation:
{
PKEY_FULL_INFORMATION kfi = KeyInformation;
kfi->ClassLength = lstrlenW(req->class) * sizeof(WCHAR);
kfi->ClassLength = strlenW(req->class) * sizeof(WCHAR);
kfi->ClassOffset = (kfi->ClassLength) ?
sizeof(KEY_FULL_INFORMATION) - sizeof(WCHAR) : 0xffffffff;
*ResultLength = sizeof(KEY_FULL_INFORMATION) - sizeof(WCHAR) + kfi->ClassLength;
if (Length < *ResultLength) return STATUS_BUFFER_OVERFLOW;
DOSFS_UnixTimeToFileTime(req->modif, &kfi->LastWriteTime, 0);
RtlSecondsSince1970ToTime(req->modif, &kfi->LastWriteTime);
kfi->TitleIndex = 0;
kfi->SubKeys = req->subkeys;
kfi->MaxNameLen = req->max_subkey;
@ -353,15 +353,15 @@ NTSTATUS WINAPI NtQueryKey(
case KeyNodeInformation:
{
PKEY_NODE_INFORMATION kni = KeyInformation;
kni->ClassLength = lstrlenW(req->class) * sizeof(WCHAR);
kni->NameLength = lstrlenW(req->name) * sizeof(WCHAR);
kni->ClassLength = strlenW(req->class) * sizeof(WCHAR);
kni->NameLength = strlenW(req->name) * sizeof(WCHAR);
kni->ClassOffset = (kni->ClassLength) ?
sizeof(KEY_NODE_INFORMATION) - sizeof(WCHAR) + kni->NameLength : 0xffffffff;
*ResultLength = sizeof(KEY_NODE_INFORMATION) - sizeof(WCHAR) + kni->NameLength + kni->ClassLength;
if (Length < *ResultLength) return STATUS_BUFFER_OVERFLOW;
DOSFS_UnixTimeToFileTime(req->modif, &kni->LastWriteTime, 0);
RtlSecondsSince1970ToTime(req->modif, &kni->LastWriteTime);
kni->TitleIndex = 0;
memcpy (kni->Name, req->name, kni->NameLength);
if(kni->ClassLength) memcpy ((char *) KeyInformation + kni->ClassOffset, req->class, kni->ClassLength);
@ -403,7 +403,7 @@ NTSTATUS WINAPI NtEnumerateValueKey(
{
PKEY_VALUE_BASIC_INFORMATION kbi = KeyInformation;
NameLength = lstrlenW(req->name) * sizeof(WCHAR);
NameLength = strlenW(req->name) * sizeof(WCHAR);
*ResultLength = sizeof(KEY_VALUE_BASIC_INFORMATION) - sizeof(WCHAR) + NameLength;
if (*ResultLength > Length) return STATUS_BUFFER_TOO_SMALL;
@ -418,7 +418,7 @@ NTSTATUS WINAPI NtEnumerateValueKey(
PKEY_VALUE_FULL_INFORMATION kbi = KeyInformation;
UINT DataOffset;
NameLength = lstrlenW(req->name) * sizeof(WCHAR);
NameLength = strlenW(req->name) * sizeof(WCHAR);
DataOffset = sizeof(KEY_VALUE_FULL_INFORMATION) - sizeof(WCHAR) + NameLength;
*ResultLength = DataOffset + req->len;

View File

@ -8,19 +8,18 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "heap.h"
#include "debugtools.h"
#include "windef.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "stackframe.h"
#include "ntddk.h"
#include "winreg.h"
DEFAULT_DEBUG_CHANNEL(ntdll)
DEFAULT_DEBUG_CHANNEL(ntdll);
/*
@ -43,8 +42,8 @@ void WINAPI RtlInitializeResource(LPRTL_RWLOCK rwl)
rwl->hOwningThreadId = 0;
rwl->dwTimeoutBoost = 0; /* no info on this one, default value is 0 */
InitializeCriticalSection( &rwl->rtlCS );
rwl->hExclusiveReleaseSemaphore = CreateSemaphoreA( NULL, 0, 65535, NULL );
rwl->hSharedReleaseSemaphore = CreateSemaphoreA( NULL, 0, 65535, NULL );
NtCreateSemaphore( &rwl->hExclusiveReleaseSemaphore, 0, NULL, 0, 65535 );
NtCreateSemaphore( &rwl->hSharedReleaseSemaphore, 0, NULL, 0, 65535 );
}
}
@ -62,8 +61,8 @@ void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl)
rwl->hOwningThreadId = 0;
rwl->uExclusiveWaiters = rwl->uSharedWaiters = 0;
rwl->iNumberActive = 0;
CloseHandle( rwl->hExclusiveReleaseSemaphore );
CloseHandle( rwl->hSharedReleaseSemaphore );
NtClose( rwl->hExclusiveReleaseSemaphore );
NtClose( rwl->hSharedReleaseSemaphore );
LeaveCriticalSection( &rwl->rtlCS );
DeleteCriticalSection( &rwl->rtlCS );
}
@ -171,7 +170,7 @@ void WINAPI RtlReleaseResource(LPRTL_RWLOCK rwl)
{
wake_exclusive:
rwl->uExclusiveWaiters--;
ReleaseSemaphore( rwl->hExclusiveReleaseSemaphore, 1, NULL );
NtReleaseSemaphore( rwl->hExclusiveReleaseSemaphore, 1, NULL );
}
}
}
@ -190,7 +189,7 @@ wake_exclusive:
rwl->iNumberActive = rwl->uSharedWaiters; /* prevent new writers from joining until
* all queued readers have done their thing */
rwl->uSharedWaiters = 0;
ReleaseSemaphore( rwl->hSharedReleaseSemaphore, n, NULL );
NtReleaseSemaphore( rwl->hSharedReleaseSemaphore, n, NULL );
}
}
}
@ -278,12 +277,13 @@ BOOLEAN WINAPI RtlDestroyHeap(
/******************************************************************************
* DbgPrint [NTDLL]
*/
void WINAPIV DbgPrint(LPCSTR fmt, ...) {
char buf[512];
void WINAPIV DbgPrint(LPCSTR fmt, ...)
{
char buf[512];
va_list args;
va_start(args, fmt);
wvsprintfA(buf,fmt, args);
vsprintf(buf,fmt, args);
va_end(args);
MESSAGE("DbgPrint says: %s",buf);
@ -429,6 +429,24 @@ BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(
return TRUE;
}
/***********************************************************************
* RtlImageNtHeader (NTDLL)
*/
PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule)
{
IMAGE_NT_HEADERS *ret = NULL;
IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)hModule;
if (dos->e_magic == IMAGE_DOS_SIGNATURE)
{
ret = (IMAGE_NT_HEADERS *)((char *)dos + dos->e_lfanew);
if (ret->Signature != IMAGE_NT_SIGNATURE) ret = NULL;
}
return ret;
}
/******************************************************************************
* RtlCreateEnvironment [NTDLL]
*/

View File

@ -31,7 +31,7 @@ VOID WINAPI RtlInitString(PSTRING target,LPCSTR source)
target->Buffer = (LPSTR)source;
if (source)
{
target->Length = lstrlenA(source);
target->Length = strlen(source);
target->MaximumLength = target->Length+1;
}
else
@ -56,7 +56,7 @@ VOID WINAPI RtlInitAnsiString(
target->Buffer = (LPSTR)source;
if (source)
{
target->Length = lstrlenA(source);
target->Length = strlen(source);
target->MaximumLength = target->Length+1;
}
else
@ -94,7 +94,7 @@ VOID WINAPI RtlInitUnicodeString(
target->Buffer = (LPWSTR)source;
if (source)
{
target->Length = lstrlenW(source)*2;
target->Length = strlenW(source)*2;
target->MaximumLength = target->Length + 2;
}
else

View File

@ -11,8 +11,6 @@
#include <math.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/winestring.h"
#include "file.h"
#include "heap.h"

View File

@ -9,6 +9,7 @@
#include "debugtools.h"
#include "winerror.h"
#include "wine/unicode.h"
#include "server.h"
#include "ntddk.h"
#include "ntdll_misc.h"
@ -21,7 +22,7 @@ static inline NTSTATUS copy_nameU( LPWSTR Dest, const OBJECT_ATTRIBUTES *attr )
if (attr && attr->ObjectName && attr->ObjectName->Buffer)
{
if ((attr->ObjectName->Length) > MAX_PATH) return STATUS_BUFFER_OVERFLOW;
lstrcpyW( Dest, attr->ObjectName->Buffer );
strcpyW( Dest, attr->ObjectName->Buffer );
}
else Dest[0] = 0;
return STATUS_SUCCESS;

View File

@ -178,17 +178,6 @@ VOID WINAPI RtlSystemTimeToLocalTime(
memcpy (LocalTime, SystemTime, sizeof (PLARGE_INTEGER));
}
/******************************************************************************
* RtlTimeToSecondsSince1980 [NTDLL]
*/
BOOLEAN WINAPI RtlTimeToSecondsSince1980(
LPFILETIME ft,
LPDWORD timeret)
{
/* 1980 = 1970+10*365 days + 29. februar 1972 + 29.februar 1976 */
*timeret = DOSFS_FileTimeToUnixTime(ft,NULL) - (10*365+2)*24*3600;
return 1;
}
/******************************************************************************
* RtlTimeToSecondsSince1970 [NTDLL]
@ -197,8 +186,37 @@ BOOLEAN WINAPI RtlTimeToSecondsSince1970(
LPFILETIME ft,
LPDWORD timeret)
{
*timeret = DOSFS_FileTimeToUnixTime(ft,NULL);
return 1;
*timeret = DOSFS_FileTimeToUnixTime(ft,NULL);
return TRUE;
}
/******************************************************************************
* RtlTimeToSecondsSince1980 [NTDLL]
*/
BOOLEAN WINAPI RtlTimeToSecondsSince1980(
LPFILETIME ft,
LPDWORD timeret)
{
/* 1980 = 1970+10*365 days + 29. februar 1972 + 29.februar 1976 */
if (!RtlTimeToSecondsSince1970( ft, timeret )) return FALSE;
*timeret -= (10*365+2)*24*60*60;
return TRUE;
}
/******************************************************************************
* RtlSecondsSince1970ToTime [NTDLL]
*/
void WINAPI RtlSecondsSince1970ToTime( DWORD time, LPFILETIME ft )
{
DOSFS_UnixTimeToFileTime( time, ft, 0 );
}
/******************************************************************************
* RtlSecondsSince1980ToTime [NTDLL]
*/
void WINAPI RtlSecondsSince1980ToTime( DWORD time, LPFILETIME ft )
{
RtlSecondsSince1970ToTime( time + (10*365+2)*24*60*60, ft );
}
/******************************************************************************

View File

@ -741,6 +741,9 @@ BOOLEAN WINAPI RtlTimeToSecondsSince1970(
LPFILETIME ft,
LPDWORD timeret);
void WINAPI RtlSecondsSince1970ToTime( DWORD time, LPFILETIME ft );
void WINAPI RtlSecondsSince1980ToTime( DWORD time, LPFILETIME ft );
/* heap functions */
/* Data structure for heap definition. This includes various
@ -959,6 +962,18 @@ NTSTATUS WINAPI NtUnloadKey(
NTSTATUS WINAPI NtClose(
HANDLE Handle);
NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code );
NTSTATUS WINAPI NtCreateSemaphore( OUT PHANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN ULONG InitialCount,
IN ULONG MaximumCount);
NTSTATUS WINAPI NtReleaseSemaphore( IN HANDLE SemaphoreHandle,
IN ULONG ReleaseCount,
IN PULONG PreviousCount);
/* misc */
#if defined(__i386__) && defined(__GNUC__)

View File

@ -12,9 +12,7 @@
#include <sys/types.h>
#include <unistd.h>
#include "windef.h"
#include "wingdi.h"
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "winerror.h"
#include "file.h"
#include "global.h"
@ -1619,22 +1617,6 @@ FARPROC MODULE_GetProcAddress(
}
/***********************************************************************
* RtlImageNtHeader (NTDLL)
*/
PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule)
{
/* basically:
* return hModule+(((IMAGE_DOS_HEADER*)hModule)->e_lfanew);
* but we could get HMODULE16 or the like (think builtin modules)
*/
WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
if (!wm || (wm->type != MODULE32_PE)) return (PIMAGE_NT_HEADERS)0;
return PE_HEADER(wm->module);
}
/***************************************************************************
* HasGPHandler (KERNEL.338)
*/