diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 6529105..10360e2 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -620,7 +620,7 @@ static WINE_MODREF *import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *d while (import_list[protect_size].u1.Ordinal) protect_size++; protect_base = thunk_list; protect_size *= sizeof(*thunk_list); - NtProtectVirtualMemory( NtCurrentProcess(), &protect_base, + SYSCALL(NtProtectVirtualMemory)( NtCurrentProcess(), &protect_base, &protect_size, PAGE_READWRITE, &protect_old ); imp_mod = wmImp->ldr.BaseAddress; @@ -692,7 +692,7 @@ static WINE_MODREF *import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *d done: /* restore old protection of the import address table */ - NtProtectVirtualMemory( NtCurrentProcess(), &protect_base, &protect_size, protect_old, &protect_old ); + SYSCALL(NtProtectVirtualMemory)( NtCurrentProcess(), &protect_base, &protect_size, protect_old, &protect_old ); return wmImp; } @@ -1475,7 +1475,7 @@ static BOOL is_fake_dll( HANDLE handle ) LARGE_INTEGER offset; offset.QuadPart = 0; - if (NtReadFile( handle, 0, NULL, 0, &io, buffer, sizeof(buffer), &offset, NULL )) return FALSE; + if (SYSCALL(NtReadFile)( handle, 0, NULL, 0, &io, buffer, sizeof(buffer), &offset, NULL )) return FALSE; if (io.Information < sizeof(buffer)) return FALSE; if (dos->e_magic != IMAGE_DOS_SIGNATURE) return FALSE; if (dos->e_lfanew >= sizeof(*dos) + sizeof(fakedll_signature) && @@ -1774,12 +1774,12 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, TRACE("Trying native dll %s\n", debugstr_w(name)); size.QuadPart = 0; - status = NtCreateSection( &mapping, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ, + status = SYSCALL(NtCreateSection)( &mapping, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ, NULL, &size, PAGE_EXECUTE_READ, SEC_IMAGE, file ); if (status != STATUS_SUCCESS) return status; module = NULL; - status = NtMapViewOfSection( mapping, NtCurrentProcess(), + status = SYSCALL(NtMapViewOfSection)( mapping, NtCurrentProcess(), &module, 0, 0, &size, &len, ViewShare, 0, PAGE_EXECUTE_READ ); /* perform base relocation, if necessary */ @@ -1789,7 +1789,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, if (status != STATUS_SUCCESS) { - if (module) NtUnmapViewOfSection( NtCurrentProcess(), module ); + if (module) SYSCALL(NtUnmapViewOfSection)( NtCurrentProcess(), module ); goto done; } @@ -1851,7 +1851,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, *pwm = wm; status = STATUS_SUCCESS; done: - NtClose( mapping ); + SYSCALL(NtClose)( mapping ); return status; } @@ -2247,7 +2247,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ if (handle && is_fake_dll( handle )) { TRACE( "%s is a fake Wine dll\n", debugstr_w(filename) ); - NtClose( handle ); + SYSCALL(NtClose)( handle ); handle = 0; } @@ -2299,13 +2299,13 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ TRACE("Loaded module %s (%s) at %p\n", debugstr_w(filename), ((*pwm)->ldr.Flags & LDR_WINE_INTERNAL) ? "builtin" : "native", (*pwm)->ldr.BaseAddress); - if (handle) NtClose( handle ); + if (handle) SYSCALL(NtClose)( handle ); if (filename != buffer) RtlFreeHeap( GetProcessHeap(), 0, filename ); return nts; } WARN("Failed to load module %s; status=%x\n", debugstr_w(libname), nts); - if (handle) NtClose( handle ); + if (handle) SYSCALL(NtClose)( handle ); if (filename != buffer) RtlFreeHeap( GetProcessHeap(), 0, filename ); return nts; } @@ -2579,7 +2579,7 @@ static NTSTATUS query_string_option( HANDLE hkey, LPCWSTR name, ULONG type, size = info_size + in_size; if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, size ))) return STATUS_NO_MEMORY; info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer; - status = NtQueryValueKey( hkey, &str, KeyValuePartialInformation, buffer, size, &size ); + status = SYSCALL(NtQueryValueKey)( hkey, &str, KeyValuePartialInformation, buffer, size, &size ); if (!status || status == STATUS_BUFFER_OVERFLOW) { if (out_size) *out_size = info->DataLength; @@ -2626,7 +2626,7 @@ NTSTATUS WINAPI LdrQueryImageFileExecutionOptions( const UNICODE_STRING *key, LP name_str.MaximumLength = name_str.Length; memcpy( path, optionsW, sizeof(optionsW) ); memcpy( path + sizeof(optionsW)/sizeof(WCHAR), p, len ); - if ((status = NtOpenKey( &hkey, KEY_QUERY_VALUE, &attr ))) return status; + if ((status = SYSCALL(NtOpenKey)( &hkey, KEY_QUERY_VALUE, &attr ))) return status; if (type == REG_DWORD) { @@ -2636,7 +2636,7 @@ NTSTATUS WINAPI LdrQueryImageFileExecutionOptions( const UNICODE_STRING *key, LP } else status = query_string_option( hkey, value, type, data, in_size, out_size ); - NtClose( hkey ); + SYSCALL(NtClose)( hkey ); return status; } @@ -2733,9 +2733,9 @@ void WINAPI RtlExitUserProcess( DWORD status ) { RtlEnterCriticalSection( &loader_section ); RtlAcquirePebLock(); - NtTerminateProcess( 0, status ); + SYSCALL(NtTerminateProcess)( 0, status ); LdrShutdownProcess(); - NtTerminateProcess( GetCurrentProcess(), status ); + SYSCALL(NtTerminateProcess)( GetCurrentProcess(), status ); exit( status ); } @@ -2813,7 +2813,7 @@ static void free_modref( WINE_MODREF *wm ) free_tls_slot( &wm->ldr ); RtlReleaseActivationContext( wm->ldr.ActivationContext ); if (wm->ldr.Flags & LDR_WINE_INTERNAL) wine_dll_unload( wm->ldr.SectionHandle ); - NtUnmapViewOfSection( NtCurrentProcess(), wm->ldr.BaseAddress ); + SYSCALL(NtUnmapViewOfSection)( NtCurrentProcess(), wm->ldr.BaseAddress ); if (cached_modref == wm) cached_modref = NULL; RtlFreeUnicodeString( &wm->ldr.FullDllName ); RtlFreeHeap( GetProcessHeap(), 0, wm->deps ); @@ -3053,7 +3053,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2, LPCWSTR load_path; PEB *peb = NtCurrentTeb()->Peb; - if (main_exe_file) NtClose( main_exe_file ); /* at this point the main module is created */ + if (main_exe_file) SYSCALL(NtClose)( main_exe_file ); /* at this point the main module is created */ /* allocate the modref for the main exe (if not already done) */ wm = get_modref( peb->ImageBaseAddress ); @@ -3096,7 +3096,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2, error: ERR( "Main exe initialization for %s failed, status %x\n", debugstr_w(peb->ProcessParameters->ImagePathName.Buffer), status ); - NtTerminateProcess( GetCurrentProcess(), status ); + SYSCALL(NtTerminateProcess)( GetCurrentProcess(), status ); } diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index f185eb9..254e527 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -273,6 +273,16 @@ NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*); extern typeof( name ) __jit_ ## name DECLARE_SYSCALL_ENTRYPOINT( NtOpenFile ); +DECLARE_SYSCALL_ENTRYPOINT( NtAllocateVirtualMemory ); +DECLARE_SYSCALL_ENTRYPOINT( NtProtectVirtualMemory ); +DECLARE_SYSCALL_ENTRYPOINT( NtReadFile ); +DECLARE_SYSCALL_ENTRYPOINT( NtCreateSection ); +DECLARE_SYSCALL_ENTRYPOINT( NtMapViewOfSection ); +DECLARE_SYSCALL_ENTRYPOINT( NtUnmapViewOfSection ); +DECLARE_SYSCALL_ENTRYPOINT( NtClose ); +DECLARE_SYSCALL_ENTRYPOINT( NtQueryValueKey ); +DECLARE_SYSCALL_ENTRYPOINT( NtOpenKey ); +DECLARE_SYSCALL_ENTRYPOINT( NtTerminateProcess ); #else /* defined(__i386__) */