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)
53 static const WCHAR WineW
[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
54 static const WCHAR ShowDotFilesW
[] = {'S','h','o','w','D','o','t','F','i','l','e','s',0};
58 OBJECT_ATTRIBUTES attr
;
61 RtlOpenCurrentUser( KEY_ALL_ACCESS
, &root
);
62 attr
.Length
= sizeof(attr
);
63 attr
.RootDirectory
= root
;
64 attr
.ObjectName
= &nameW
;
66 attr
.SecurityDescriptor
= NULL
;
67 attr
.SecurityQualityOfService
= NULL
;
68 RtlInitUnicodeString( &nameW
, WineW
);
70 /* @@ Wine registry key: HKCU\Software\Wine */
71 if (!NtOpenKey( &hkey
, KEY_ALL_ACCESS
, &attr
))
73 RtlInitUnicodeString( &nameW
, ShowDotFilesW
);
74 if (!NtQueryValueKey( hkey
, &nameW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
), &dummy
))
76 WCHAR
*str
= (WCHAR
*)((KEY_VALUE_PARTIAL_INFORMATION
*)tmp
)->Data
;
77 show_dot_files
= IS_OPTION_TRUE( str
[0] );
82 unix_funcs
->set_show_dot_files( show_dot_files
);
86 /******************************************************************
87 * RtlWow64EnableFsRedirection (NTDLL.@)
89 NTSTATUS WINAPI
RtlWow64EnableFsRedirection( BOOLEAN enable
)
92 return STATUS_NOT_IMPLEMENTED
;
94 if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED
;
95 NtCurrentTeb64()->TlsSlots
[WOW64_TLS_FILESYSREDIR
] = !enable
;
96 return STATUS_SUCCESS
;
101 /******************************************************************
102 * RtlWow64EnableFsRedirectionEx (NTDLL.@)
104 NTSTATUS WINAPI
RtlWow64EnableFsRedirectionEx( ULONG disable
, ULONG
*old_value
)
107 return STATUS_NOT_IMPLEMENTED
;
109 if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED
;
113 *old_value
= NtCurrentTeb64()->TlsSlots
[WOW64_TLS_FILESYSREDIR
];
117 return STATUS_ACCESS_VIOLATION
;
121 NtCurrentTeb64()->TlsSlots
[WOW64_TLS_FILESYSREDIR
] = disable
;
122 return STATUS_SUCCESS
;
127 /******************************************************************
128 * RtlDoesFileExists_U (NTDLL.@)
130 BOOLEAN WINAPI
RtlDoesFileExists_U(LPCWSTR file_name
)
132 UNICODE_STRING nt_name
;
133 FILE_BASIC_INFORMATION basic_info
;
134 OBJECT_ATTRIBUTES attr
;
137 if (!RtlDosPathNameToNtPathName_U( file_name
, &nt_name
, NULL
, NULL
)) return FALSE
;
139 attr
.Length
= sizeof(attr
);
140 attr
.RootDirectory
= 0;
141 attr
.ObjectName
= &nt_name
;
142 attr
.Attributes
= OBJ_CASE_INSENSITIVE
;
143 attr
.SecurityDescriptor
= NULL
;
144 attr
.SecurityQualityOfService
= NULL
;
146 ret
= NtQueryAttributesFile(&attr
, &basic_info
) == STATUS_SUCCESS
;
148 RtlFreeUnicodeString( &nt_name
);