ntdll: Move the directory functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
573be7e602
commit
e0fca94511
|
@ -52,6 +52,7 @@ C_SRCS = \
|
|||
time.c \
|
||||
unix/debug.c \
|
||||
unix/env.c \
|
||||
unix/file.c \
|
||||
unix/loader.c \
|
||||
unix/process.c \
|
||||
unix/server.c \
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -215,9 +215,9 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
|
|||
if (alloc_size) FIXME( "alloc_size not supported\n" );
|
||||
|
||||
if (options & FILE_OPEN_BY_FILE_ID)
|
||||
io->u.Status = file_id_to_unix_file_name( attr, &unix_name );
|
||||
io->u.Status = unix_funcs->file_id_to_unix_file_name( attr, &unix_name );
|
||||
else
|
||||
io->u.Status = nt_to_unix_file_name_attr( attr, &unix_name, disposition );
|
||||
io->u.Status = unix_funcs->nt_to_unix_file_name_attr( attr, &unix_name, disposition );
|
||||
|
||||
if (io->u.Status == STATUS_BAD_DEVICE_TYPE)
|
||||
{
|
||||
|
@ -1704,7 +1704,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
|
|||
case FSCTL_DISMOUNT_VOLUME:
|
||||
status = server_ioctl_file( handle, event, apc, apc_context, io, code,
|
||||
in_buffer, in_size, out_buffer, out_size );
|
||||
if (!status) status = DIR_unmount_device( handle );
|
||||
if (!status) status = unix_funcs->unmount_device( handle );
|
||||
return status;
|
||||
|
||||
case FSCTL_PIPE_IMPERSONATE:
|
||||
|
@ -2929,7 +2929,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
|
|||
attr.RootDirectory = info->RootDirectory;
|
||||
attr.Attributes = OBJ_CASE_INSENSITIVE;
|
||||
|
||||
io->u.Status = nt_to_unix_file_name_attr( &attr, &unix_name, FILE_OPEN_IF );
|
||||
io->u.Status = unix_funcs->nt_to_unix_file_name_attr( &attr, &unix_name, FILE_OPEN_IF );
|
||||
if (io->u.Status != STATUS_SUCCESS && io->u.Status != STATUS_NO_SUCH_FILE)
|
||||
break;
|
||||
|
||||
|
@ -2966,7 +2966,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
|
|||
attr.RootDirectory = info->RootDirectory;
|
||||
attr.Attributes = OBJ_CASE_INSENSITIVE;
|
||||
|
||||
io->u.Status = nt_to_unix_file_name_attr( &attr, &unix_name, FILE_OPEN_IF );
|
||||
io->u.Status = unix_funcs->nt_to_unix_file_name_attr( &attr, &unix_name, FILE_OPEN_IF );
|
||||
if (io->u.Status != STATUS_SUCCESS && io->u.Status != STATUS_NO_SUCH_FILE)
|
||||
break;
|
||||
|
||||
|
@ -3005,7 +3005,7 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr,
|
|||
ANSI_STRING unix_name;
|
||||
NTSTATUS status;
|
||||
|
||||
if (!(status = nt_to_unix_file_name_attr( attr, &unix_name, FILE_OPEN )))
|
||||
if (!(status = unix_funcs->nt_to_unix_file_name_attr( attr, &unix_name, FILE_OPEN )))
|
||||
{
|
||||
ULONG attributes;
|
||||
struct stat st;
|
||||
|
@ -3048,7 +3048,7 @@ NTSTATUS WINAPI NtQueryAttributesFile( const OBJECT_ATTRIBUTES *attr, FILE_BASIC
|
|||
ANSI_STRING unix_name;
|
||||
NTSTATUS status;
|
||||
|
||||
if (!(status = nt_to_unix_file_name_attr( attr, &unix_name, FILE_OPEN )))
|
||||
if (!(status = unix_funcs->nt_to_unix_file_name_attr( attr, &unix_name, FILE_OPEN )))
|
||||
{
|
||||
ULONG attributes;
|
||||
struct stat st;
|
||||
|
|
|
@ -147,12 +147,8 @@ extern NTSTATUS fill_file_info( const struct stat *st, ULONG attr, void *ptr,
|
|||
extern NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name ) DECLSPEC_HIDDEN;
|
||||
extern void init_directories(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL DIR_is_hidden_file( const UNICODE_STRING *name ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS DIR_unmount_device( HANDLE handle ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS DIR_get_unix_cwd( char **cwd ) DECLSPEC_HIDDEN;
|
||||
extern unsigned int DIR_get_drives_info( struct drive_info info[MAX_DOS_DRIVES] ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS file_id_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, ANSI_STRING *unix_name_ret ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_STRING *unix_name_ret,
|
||||
UINT disposition ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* virtual memory */
|
||||
extern void virtual_fill_image_information( const pe_image_info_t *pe_info,
|
||||
|
|
|
@ -450,7 +450,7 @@ static void test_NtQueryDirectoryFile(void)
|
|||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING ntdirname, mask;
|
||||
char testdirA[MAX_PATH];
|
||||
char testdirA[MAX_PATH], buffer[MAX_PATH];
|
||||
WCHAR testdirW[MAX_PATH];
|
||||
int i;
|
||||
IO_STATUS_BLOCK io;
|
||||
|
@ -462,7 +462,7 @@ static void test_NtQueryDirectoryFile(void)
|
|||
FILE_NAMES_INFORMATION *names;
|
||||
const WCHAR *filename = fbdi->FileName;
|
||||
NTSTATUS status;
|
||||
HANDLE dirh;
|
||||
HANDLE dirh, h;
|
||||
|
||||
/* Clean up from prior aborted run, if any, then set up test files */
|
||||
ok(GetTempPathA(MAX_PATH, testdirA), "couldn't get temp dir\n");
|
||||
|
@ -728,6 +728,18 @@ static void test_NtQueryDirectoryFile(void)
|
|||
ok(status == STATUS_INVALID_HANDLE, "wrong status %x\n", status);
|
||||
ok(U(io).Status == 0xdeadbeef, "wrong status %x\n", U(io).Status);
|
||||
|
||||
GetModuleFileNameA( 0, buffer, sizeof(buffer) );
|
||||
h = CreateFileA( buffer, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
|
||||
if (h != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
U(io).Status = 0xdeadbeef;
|
||||
status = pNtQueryDirectoryFile( h, 0, NULL, NULL, &io, data, data_size,
|
||||
FileBothDirectoryInformation, TRUE, NULL, TRUE );
|
||||
ok(status == STATUS_INVALID_PARAMETER, "wrong status %x\n", status);
|
||||
ok(U(io).Status == 0xdeadbeef, "wrong status %x\n", U(io).Status);
|
||||
CloseHandle ( h );
|
||||
}
|
||||
|
||||
done:
|
||||
test_directory_sort( testdirW );
|
||||
tear_down_attribute_test( testdirW );
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -849,6 +849,7 @@ static struct unix_funcs unix_funcs =
|
|||
NtOpenTimer,
|
||||
NtProtectVirtualMemory,
|
||||
NtPulseEvent,
|
||||
NtQueryDirectoryFile,
|
||||
NtQueryEvent,
|
||||
NtQueryMutant,
|
||||
NtQueryPerformanceCounter,
|
||||
|
@ -934,6 +935,11 @@ static struct unix_funcs unix_funcs =
|
|||
server_handle_to_fd,
|
||||
server_release_fd,
|
||||
server_init_process_done,
|
||||
file_id_to_unix_file_name,
|
||||
nt_to_unix_file_name_attr,
|
||||
nt_to_unix_file_name,
|
||||
unmount_device,
|
||||
set_show_dot_files,
|
||||
__wine_dbg_get_channel_flags,
|
||||
__wine_dbg_strdup,
|
||||
__wine_dbg_output,
|
||||
|
@ -1201,6 +1207,7 @@ void __wine_main( int argc, char *argv[], char *envp[] )
|
|||
fixup_ntdll_imports( &__wine_spec_nt_header, module );
|
||||
|
||||
init_environment( argc, argv, envp );
|
||||
init_files();
|
||||
|
||||
#ifdef __APPLE__
|
||||
apple_main_thread();
|
||||
|
@ -1235,6 +1242,7 @@ NTSTATUS __cdecl __wine_init_unix_lib( HMODULE module, const void *ptr_in, void
|
|||
map_so_dll( nt, module );
|
||||
fixup_ntdll_imports( &__wine_spec_nt_header, module );
|
||||
init_environment( __wine_main_argc, __wine_main_argv, envp );
|
||||
init_files();
|
||||
*(struct unix_funcs **)ptr_out = &unix_funcs;
|
||||
wine_mmap_enum_reserved_areas( add_area, NULL, 0 );
|
||||
return STATUS_SUCCESS;
|
||||
|
|
|
@ -74,10 +74,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(sync);
|
||||
|
||||
#define TICKSPERSEC 10000000
|
||||
#define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)86400)
|
||||
#define TICKS_1601_TO_1970 (SECS_1601_TO_1970 * TICKSPERSEC)
|
||||
|
||||
HANDLE keyed_event = 0;
|
||||
|
||||
static const LARGE_INTEGER zero_timeout;
|
||||
|
|
|
@ -120,6 +120,14 @@ extern NTSTATUS CDECL exec_process( const UNICODE_STRING *cmdline, const pe_imag
|
|||
extern NTSTATUS CDECL fork_and_exec( const char *unix_name, const char *unix_dir,
|
||||
const RTL_USER_PROCESS_PARAMETERS *params ) DECLSPEC_HIDDEN;
|
||||
|
||||
extern NTSTATUS CDECL file_id_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, ANSI_STRING *unix_name ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS CDECL nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_STRING *unix_name_ret,
|
||||
UINT disposition ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
|
||||
UINT disposition, BOOLEAN check_case ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS CDECL unmount_device( HANDLE handle ) DECLSPEC_HIDDEN;
|
||||
extern void CDECL set_show_dot_files( BOOL enable ) DECLSPEC_HIDDEN;
|
||||
|
||||
extern const char *data_dir DECLSPEC_HIDDEN;
|
||||
extern const char *build_dir DECLSPEC_HIDDEN;
|
||||
extern const char *config_dir DECLSPEC_HIDDEN;
|
||||
|
@ -186,8 +194,20 @@ extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE ent
|
|||
BOOL suspend, void *relay, TEB *teb ) DECLSPEC_HIDDEN;
|
||||
extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int) ) DECLSPEC_HIDDEN;
|
||||
|
||||
extern void init_files(void) DECLSPEC_HIDDEN;
|
||||
|
||||
extern void dbg_init(void) DECLSPEC_HIDDEN;
|
||||
|
||||
#define TICKSPERSEC 10000000
|
||||
#define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)86400)
|
||||
#define TICKS_1601_TO_1970 (SECS_1601_TO_1970 * TICKSPERSEC)
|
||||
|
||||
static inline const char *debugstr_us( const UNICODE_STRING *us )
|
||||
{
|
||||
if (!us) return "<null>";
|
||||
return debugstr_wn( us->Buffer, us->Length / sizeof(WCHAR) );
|
||||
}
|
||||
|
||||
static inline size_t ntdll_wcslen( const WCHAR *str )
|
||||
{
|
||||
const WCHAR *s = str;
|
||||
|
|
|
@ -3069,6 +3069,50 @@ BOOL CDECL virtual_check_buffer_for_write( void *ptr, SIZE_T size )
|
|||
}
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* IsBadStringPtrA
|
||||
*
|
||||
* IsBadStringPtrA replacement for ntdll, to catch exception in debug traces.
|
||||
*/
|
||||
BOOL WINAPI IsBadStringPtrA( LPCSTR str, UINT_PTR max )
|
||||
{
|
||||
if (!str) return TRUE;
|
||||
__TRY
|
||||
{
|
||||
volatile const char *p = str;
|
||||
while (p != str + max) if (!*p++) break;
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
__ENDTRY
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* IsBadStringPtrW
|
||||
*
|
||||
* IsBadStringPtrW replacement for ntdll, to catch exception in debug traces.
|
||||
*/
|
||||
BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT_PTR max )
|
||||
{
|
||||
if (!str) return TRUE;
|
||||
__TRY
|
||||
{
|
||||
volatile const WCHAR *p = str;
|
||||
while (p != str + max) if (!*p++) break;
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
__ENDTRY
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* virtual_uninterrupted_read_memory
|
||||
*
|
||||
|
|
|
@ -28,7 +28,7 @@ struct ldt_copy;
|
|||
struct msghdr;
|
||||
|
||||
/* increment this when you change the function table */
|
||||
#define NTDLL_UNIXLIB_VERSION 41
|
||||
#define NTDLL_UNIXLIB_VERSION 42
|
||||
|
||||
struct unix_funcs
|
||||
{
|
||||
|
@ -92,6 +92,11 @@ struct unix_funcs
|
|||
NTSTATUS (WINAPI *NtProtectVirtualMemory)( HANDLE process, PVOID *addr_ptr, SIZE_T *size_ptr,
|
||||
ULONG new_prot, ULONG *old_prot );
|
||||
NTSTATUS (WINAPI *NtPulseEvent)( HANDLE handle, LONG *prev_state );
|
||||
NTSTATUS (WINAPI *NtQueryDirectoryFile)( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc_routine,
|
||||
void *apc_context, IO_STATUS_BLOCK *io, void *buffer,
|
||||
ULONG length, FILE_INFORMATION_CLASS info_class,
|
||||
BOOLEAN single_entry, UNICODE_STRING *mask,
|
||||
BOOLEAN restart_scan );
|
||||
NTSTATUS (WINAPI *NtQueryEvent)( HANDLE handle, EVENT_INFORMATION_CLASS class,
|
||||
void *info, ULONG len, ULONG *ret_len );
|
||||
NTSTATUS (WINAPI *NtQueryMutant)( HANDLE handle, MUTANT_INFORMATION_CLASS class,
|
||||
|
@ -223,6 +228,16 @@ struct unix_funcs
|
|||
void (CDECL *server_release_fd)( HANDLE handle, int unix_fd );
|
||||
void (CDECL *server_init_process_done)( void *relay );
|
||||
|
||||
/* file functions */
|
||||
NTSTATUS (CDECL *file_id_to_unix_file_name)( const OBJECT_ATTRIBUTES *attr,
|
||||
ANSI_STRING *unix_name );
|
||||
NTSTATUS (CDECL *nt_to_unix_file_name_attr)( const OBJECT_ATTRIBUTES *attr,
|
||||
ANSI_STRING *unix_name_ret, UINT disposition );
|
||||
NTSTATUS (CDECL *nt_to_unix_file_name)( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
|
||||
UINT disposition, BOOLEAN check_case );
|
||||
NTSTATUS (CDECL *unmount_device)( HANDLE handle );
|
||||
void (CDECL *set_show_dot_files)( BOOL enable );
|
||||
|
||||
/* debugging functions */
|
||||
unsigned char (CDECL *dbg_get_channel_flags)( struct __wine_debug_channel *channel );
|
||||
const char * (CDECL *dbg_strdup)( const char *str );
|
||||
|
|
Loading…
Reference in New Issue