2 * NTDLL directory functions
4 * Copyright 1993 Erik Bos
5 * Copyright 2003 Eric Pouech
6 * Copyright 1996, 2004 Alexandre Julliard
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include <sys/types.h>
32 #define WIN32_NO_STATUS
33 #define NONAMELESSUNION
38 #include "ntdll_misc.h"
39 #include "wine/server.h"
40 #include "wine/list.h"
41 #include "wine/debug.h"
42 #include "wine/exception.h"
44 #define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
46 static BOOL show_dot_files
;
48 /***********************************************************************
51 void init_directories(void)
56 OBJECT_ATTRIBUTES attr
;
59 RtlOpenCurrentUser( KEY_ALL_ACCESS
, &root
);
60 attr
.Length
= sizeof(attr
);
61 attr
.RootDirectory
= root
;
62 attr
.ObjectName
= &nameW
;
64 attr
.SecurityDescriptor
= NULL
;
65 attr
.SecurityQualityOfService
= NULL
;
66 RtlInitUnicodeString( &nameW
, L
"Software\\Wine" );
68 /* @@ Wine registry key: HKCU\Software\Wine */
69 if (!NtOpenKey( &hkey
, KEY_ALL_ACCESS
, &attr
))
71 RtlInitUnicodeString( &nameW
, L
"ShowDotFiles" );
72 if (!NtQueryValueKey( hkey
, &nameW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
), &dummy
))
74 WCHAR
*str
= (WCHAR
*)((KEY_VALUE_PARTIAL_INFORMATION
*)tmp
)->Data
;
75 show_dot_files
= IS_OPTION_TRUE( str
[0] );
80 unix_funcs
->set_show_dot_files( show_dot_files
);
84 /******************************************************************
85 * RtlWow64EnableFsRedirection (NTDLL.@)
87 NTSTATUS WINAPI
RtlWow64EnableFsRedirection( BOOLEAN enable
)
90 return STATUS_NOT_IMPLEMENTED
;
92 if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED
;
93 NtCurrentTeb64()->TlsSlots
[WOW64_TLS_FILESYSREDIR
] = !enable
;
94 return STATUS_SUCCESS
;
99 /******************************************************************
100 * RtlWow64EnableFsRedirectionEx (NTDLL.@)
102 NTSTATUS WINAPI
RtlWow64EnableFsRedirectionEx( ULONG disable
, ULONG
*old_value
)
105 return STATUS_NOT_IMPLEMENTED
;
107 if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED
;
111 *old_value
= NtCurrentTeb64()->TlsSlots
[WOW64_TLS_FILESYSREDIR
];
115 return STATUS_ACCESS_VIOLATION
;
119 NtCurrentTeb64()->TlsSlots
[WOW64_TLS_FILESYSREDIR
] = disable
;
120 return STATUS_SUCCESS
;
125 /******************************************************************
126 * RtlDoesFileExists_U (NTDLL.@)
128 BOOLEAN WINAPI
RtlDoesFileExists_U(LPCWSTR file_name
)
130 UNICODE_STRING nt_name
;
131 FILE_BASIC_INFORMATION basic_info
;
132 OBJECT_ATTRIBUTES attr
;
135 if (!RtlDosPathNameToNtPathName_U( file_name
, &nt_name
, NULL
, NULL
)) return FALSE
;
137 attr
.Length
= sizeof(attr
);
138 attr
.RootDirectory
= 0;
139 attr
.ObjectName
= &nt_name
;
140 attr
.Attributes
= OBJ_CASE_INSENSITIVE
;
141 attr
.SecurityDescriptor
= NULL
;
142 attr
.SecurityQualityOfService
= NULL
;
144 ret
= NtQueryAttributesFile(&attr
, &basic_info
) == STATUS_SUCCESS
;
146 RtlFreeUnicodeString( &nt_name
);