Added hack to call CreateFileW through a pointer so that we don't need
to link to kernel functions. Commented out SMB support in NtReadFile for now.
This commit is contained in:
parent
01def427b7
commit
953849f2fc
@ -761,7 +761,8 @@ void __wine_process_init( int argc, char *argv[] )
|
|||||||
if (!build_command_line( argv )) goto error;
|
if (!build_command_line( argv )) goto error;
|
||||||
|
|
||||||
/* create 32-bit module for main exe */
|
/* create 32-bit module for main exe */
|
||||||
if (!(current_process.module = BUILTIN32_LoadExeModule( current_process.module ))) goto error;
|
if (!(current_process.module = BUILTIN32_LoadExeModule( current_process.module, CreateFileW )))
|
||||||
|
goto error;
|
||||||
stack_size = RtlImageNtHeader(current_process.module)->OptionalHeader.SizeOfStackReserve;
|
stack_size = RtlImageNtHeader(current_process.module)->OptionalHeader.SizeOfStackReserve;
|
||||||
|
|
||||||
/* allocate main thread stack */
|
/* allocate main thread stack */
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
#include "wine/server.h"
|
#include "wine/server.h"
|
||||||
#include "async.h"
|
#include "async.h"
|
||||||
#include "ntdll_misc.h"
|
#include "ntdll_misc.h"
|
||||||
#include "../files/smb.h"
|
|
||||||
|
|
||||||
#include "winternl.h"
|
#include "winternl.h"
|
||||||
#include "winioctl.h"
|
#include "winioctl.h"
|
||||||
@ -94,7 +93,7 @@ NTSTATUS WINAPI NtOpenFile(
|
|||||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
|
|
||||||
/* FIXME: this calls SetLastError() -> bad */
|
/* FIXME: this calls SetLastError() -> bad */
|
||||||
*FileHandle = CreateFileW( &filename[strlenW(szDosDevices)], DesiredAccess, ShareAccess,
|
*FileHandle = pCreateFileW( &filename[strlenW(szDosDevices)], DesiredAccess, ShareAccess,
|
||||||
NULL, OPEN_EXISTING, 0, 0 );
|
NULL, OPEN_EXISTING, 0, 0 );
|
||||||
if (*FileHandle == INVALID_HANDLE_VALUE) return STATUS_OBJECT_NAME_NOT_FOUND;
|
if (*FileHandle == INVALID_HANDLE_VALUE) return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
@ -415,7 +414,9 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
|
|||||||
case FD_TYPE_SMB:
|
case FD_TYPE_SMB:
|
||||||
FIXME("NIY-SMB\n");
|
FIXME("NIY-SMB\n");
|
||||||
close(unix_handle);
|
close(unix_handle);
|
||||||
return SMB_ReadFile(hFile, buffer, length, io_status);
|
/* FIXME */
|
||||||
|
/* return SMB_ReadFile(hFile, buffer, length, io_status); */
|
||||||
|
return STATUS_INVALID_HANDLE;
|
||||||
|
|
||||||
case FD_TYPE_DEFAULT:
|
case FD_TYPE_DEFAULT:
|
||||||
/* normal unix files */
|
/* normal unix files */
|
||||||
|
@ -1313,7 +1313,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
|
|||||||
{
|
{
|
||||||
if ((*pwm = find_basename_module( file_part )) != NULL) return STATUS_SUCCESS;
|
if ((*pwm = find_basename_module( file_part )) != NULL) return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
*handle = CreateFileW( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
|
*handle = pCreateFileW( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1348,7 +1348,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
|
|||||||
strcatW( file_part, dllW );
|
strcatW( file_part, dllW );
|
||||||
}
|
}
|
||||||
if ((*pwm = find_fullname_module( filename )) != NULL) return STATUS_SUCCESS;
|
if ((*pwm = find_fullname_module( filename )) != NULL) return STATUS_SUCCESS;
|
||||||
*handle = CreateFileW( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
|
*handle = pCreateFileW( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
overflow:
|
overflow:
|
||||||
@ -1881,10 +1881,11 @@ PVOID WINAPI RtlImageRvaToVa( const IMAGE_NT_HEADERS *nt, HMODULE module,
|
|||||||
*
|
*
|
||||||
* FIXME: this should be done differently once kernel is properly separated.
|
* FIXME: this should be done differently once kernel is properly separated.
|
||||||
*/
|
*/
|
||||||
HMODULE BUILTIN32_LoadExeModule( HMODULE main )
|
HMODULE BUILTIN32_LoadExeModule( HMODULE main, void *CreateFileW_ptr )
|
||||||
{
|
{
|
||||||
static struct builtin_load_info default_info;
|
static struct builtin_load_info default_info;
|
||||||
|
|
||||||
|
pCreateFileW = CreateFileW_ptr;
|
||||||
if (!MODULE_GetSystemDirectory( &system_dir ))
|
if (!MODULE_GetSystemDirectory( &system_dir ))
|
||||||
MESSAGE( "Couldn't get system dir in process init\n");
|
MESSAGE( "Couldn't get system dir in process init\n");
|
||||||
NtCurrentTeb()->Peb->ImageBaseAddress = main;
|
NtCurrentTeb()->Peb->ImageBaseAddress = main;
|
||||||
|
@ -53,13 +53,21 @@ static inline HANDLE ntdll_get_process_heap(void)
|
|||||||
{
|
{
|
||||||
return NtCurrentTeb()->Peb->ProcessHeap;
|
return NtCurrentTeb()->Peb->ProcessHeap;
|
||||||
}
|
}
|
||||||
#define GetProcessHeap() ntdll_get_process_heap()
|
/* redefine these to make sure we don't reference kernel symbols */
|
||||||
|
#define GetProcessHeap() (NtCurrentTeb()->Peb->ProcessHeap)
|
||||||
|
#define GetCurrentProcessId() ((DWORD)NtCurrentTeb()->ClientId.UniqueProcess)
|
||||||
|
#define GetCurrentThreadId() ((DWORD)NtCurrentTeb()->ClientId.UniqueThread)
|
||||||
|
|
||||||
static inline RTL_USER_PROCESS_PARAMETERS* ntdll_get_process_pmts(void)
|
static inline RTL_USER_PROCESS_PARAMETERS* ntdll_get_process_pmts(void)
|
||||||
{
|
{
|
||||||
return NtCurrentTeb()->Peb->ProcessParameters;
|
return NtCurrentTeb()->Peb->ProcessParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* hack: upcall to kernel */
|
||||||
|
extern HANDLE (WINAPI *pCreateFileW)( LPCWSTR filename, DWORD access, DWORD sharing,
|
||||||
|
LPSECURITY_ATTRIBUTES sa, DWORD creation,
|
||||||
|
DWORD attributes, HANDLE template );
|
||||||
|
|
||||||
/* Device IO */
|
/* Device IO */
|
||||||
/* ntdll/cdrom.c.c */
|
/* ntdll/cdrom.c.c */
|
||||||
extern NTSTATUS CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice,
|
extern NTSTATUS CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice,
|
||||||
|
@ -37,6 +37,11 @@ static const WCHAR DeviceRootW[] = {'\\','\\','.','\\',0};
|
|||||||
static const WCHAR NTDosPrefixW[] = {'\\','?','?','\\',0};
|
static const WCHAR NTDosPrefixW[] = {'\\','?','?','\\',0};
|
||||||
static const WCHAR UncPfxW[] = {'U','N','C','\\',0};
|
static const WCHAR UncPfxW[] = {'U','N','C','\\',0};
|
||||||
|
|
||||||
|
/* FIXME: hack! */
|
||||||
|
HANDLE (WINAPI *pCreateFileW)( LPCWSTR filename, DWORD access, DWORD sharing,
|
||||||
|
LPSECURITY_ATTRIBUTES sa, DWORD creation,
|
||||||
|
DWORD attributes, HANDLE template );
|
||||||
|
|
||||||
#define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/')
|
#define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/')
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
@ -67,7 +72,7 @@ DOS_PATHNAME_TYPE WINAPI RtlDetermineDosPathNameType_U( PCWSTR path )
|
|||||||
*/
|
*/
|
||||||
BOOLEAN WINAPI RtlDoesFileExists_U(LPCWSTR file_name)
|
BOOLEAN WINAPI RtlDoesFileExists_U(LPCWSTR file_name)
|
||||||
{
|
{
|
||||||
HANDLE handle = CreateFileW( file_name, 0, FILE_SHARE_READ|FILE_SHARE_WRITE,
|
HANDLE handle = pCreateFileW( file_name, 0, FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||||
NULL, OPEN_EXISTING, 0, 0 );
|
NULL, OPEN_EXISTING, 0, 0 );
|
||||||
if (handle == INVALID_HANDLE_VALUE) return FALSE;
|
if (handle == INVALID_HANDLE_VALUE) return FALSE;
|
||||||
NtClose( handle );
|
NtClose( handle );
|
||||||
|
@ -204,6 +204,6 @@ extern void MODULE_GetLoadOrderA( enum loadorder_type plo[], const WCHAR *app_na
|
|||||||
const char *path, BOOL win32 );
|
const char *path, BOOL win32 );
|
||||||
|
|
||||||
/* relay32/builtin.c */
|
/* relay32/builtin.c */
|
||||||
extern HMODULE BUILTIN32_LoadExeModule( HMODULE main );
|
extern HMODULE BUILTIN32_LoadExeModule( HMODULE main, void *CreateFileW_ptr );
|
||||||
|
|
||||||
#endif /* __WINE_MODULE_H */
|
#endif /* __WINE_MODULE_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user