2004-03-16 02:32:02 +01:00
|
|
|
/*
|
|
|
|
* NTDLL directory functions
|
|
|
|
*
|
|
|
|
* Copyright 1993 Erik Bos
|
|
|
|
* Copyright 2003 Eric Pouech
|
|
|
|
* Copyright 1996, 2004 Alexandre Julliard
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-03-16 02:32:02 +01:00
|
|
|
*/
|
|
|
|
|
2008-10-28 13:55:24 +01:00
|
|
|
#include <assert.h>
|
2004-03-16 02:32:02 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2004-04-29 22:04:48 +02:00
|
|
|
#include <stdio.h>
|
2004-03-16 02:32:02 +01:00
|
|
|
|
2005-11-28 17:32:54 +01:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
2015-03-14 03:38:17 +01:00
|
|
|
#define NONAMELESSUNION
|
2004-03-16 02:32:02 +01:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winnt.h"
|
|
|
|
#include "winternl.h"
|
2011-06-16 12:27:01 +02:00
|
|
|
#include "ddk/wdm.h"
|
2004-03-16 02:32:02 +01:00
|
|
|
#include "ntdll_misc.h"
|
2009-12-09 23:34:45 +01:00
|
|
|
#include "wine/list.h"
|
2004-03-16 02:32:02 +01:00
|
|
|
#include "wine/debug.h"
|
2016-08-07 00:00:21 +02:00
|
|
|
#include "wine/exception.h"
|
2004-03-16 02:32:02 +01:00
|
|
|
|
2009-12-02 17:35:43 +01:00
|
|
|
|
2009-07-06 15:08:39 +02:00
|
|
|
/******************************************************************
|
|
|
|
* RtlWow64EnableFsRedirection (NTDLL.@)
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlWow64EnableFsRedirection( BOOLEAN enable )
|
|
|
|
{
|
2020-07-24 13:29:31 +02:00
|
|
|
if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED;
|
|
|
|
NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR] = !enable;
|
2009-07-06 15:08:39 +02:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* RtlWow64EnableFsRedirectionEx (NTDLL.@)
|
|
|
|
*/
|
2009-10-28 10:54:22 +01:00
|
|
|
NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx( ULONG disable, ULONG *old_value )
|
2009-07-06 15:08:39 +02:00
|
|
|
{
|
2020-07-24 13:29:31 +02:00
|
|
|
if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED;
|
2012-08-21 21:58:17 +02:00
|
|
|
|
2016-08-07 00:00:21 +02:00
|
|
|
__TRY
|
|
|
|
{
|
2020-07-24 13:29:31 +02:00
|
|
|
*old_value = NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR];
|
2016-08-07 00:00:21 +02:00
|
|
|
}
|
|
|
|
__EXCEPT_PAGE_FAULT
|
|
|
|
{
|
|
|
|
return STATUS_ACCESS_VIOLATION;
|
|
|
|
}
|
|
|
|
__ENDTRY
|
|
|
|
|
2020-07-24 13:29:31 +02:00
|
|
|
NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR] = disable;
|
2009-07-06 15:08:39 +02:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-04-13 01:31:09 +02:00
|
|
|
/******************************************************************
|
|
|
|
* RtlDoesFileExists_U (NTDLL.@)
|
|
|
|
*/
|
|
|
|
BOOLEAN WINAPI RtlDoesFileExists_U(LPCWSTR file_name)
|
|
|
|
{
|
|
|
|
UNICODE_STRING nt_name;
|
2007-05-03 22:33:58 +02:00
|
|
|
FILE_BASIC_INFORMATION basic_info;
|
|
|
|
OBJECT_ATTRIBUTES attr;
|
2004-04-13 01:31:09 +02:00
|
|
|
BOOLEAN ret;
|
|
|
|
|
|
|
|
if (!RtlDosPathNameToNtPathName_U( file_name, &nt_name, NULL, NULL )) return FALSE;
|
2007-05-03 22:33:58 +02:00
|
|
|
|
|
|
|
attr.Length = sizeof(attr);
|
|
|
|
attr.RootDirectory = 0;
|
|
|
|
attr.ObjectName = &nt_name;
|
|
|
|
attr.Attributes = OBJ_CASE_INSENSITIVE;
|
|
|
|
attr.SecurityDescriptor = NULL;
|
|
|
|
attr.SecurityQualityOfService = NULL;
|
|
|
|
|
|
|
|
ret = NtQueryAttributesFile(&attr, &basic_info) == STATUS_SUCCESS;
|
|
|
|
|
2004-04-13 01:31:09 +02:00
|
|
|
RtlFreeUnicodeString( &nt_name );
|
|
|
|
return ret;
|
|
|
|
}
|