Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a9832be1
Commit
a9832be1
authored
Apr 17, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make FindFirstFileExW and FindFirstChangeNotificationW use NtOpenFile
directly so that they can take advantage of the FILE_DIRECTORY_FILE option.
parent
2a6e89ca
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
38 deletions
+60
-38
change.c
dlls/kernel/change.c
+32
-16
file.c
dlls/kernel/file.c
+28
-22
No files found.
dlls/kernel/change.c
View file @
a9832be1
...
...
@@ -27,6 +27,7 @@
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "ntstatus.h"
#include "wine/windef16.h"
#include "wine/server.h"
#include "wine/debug.h"
...
...
@@ -39,23 +40,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(file);
HANDLE
WINAPI
FindFirstChangeNotificationA
(
LPCSTR
lpPathName
,
BOOL
bWatchSubtree
,
DWORD
dwNotifyFilter
)
{
HANDLE
file
,
ret
=
INVALID_HANDLE_VALUE
;
TRACE
(
"%s %d %lx
\n
"
,
debugstr_a
(
lpPathName
),
bWatchSubtree
,
dwNotifyFilter
);
UNICODE_STRING
pathW
;
HANDLE
ret
=
INVALID_HANDLE_VALUE
;
if
((
file
=
CreateFileA
(
lpPathName
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
0
))
==
INVALID_HANDLE_VALUE
)
return
INVALID_HANDLE_VALUE
;
SERVER_START_REQ
(
create_change_notification
)
if
(
RtlCreateUnicodeStringFromAsciiz
(
&
pathW
,
lpPathName
))
{
req
->
handle
=
file
;
req
->
subtree
=
bWatchSubtree
;
req
->
filter
=
dwNotifyFilter
;
if
(
!
wine_server_call_err
(
req
))
ret
=
reply
->
handle
;
ret
=
FindFirstChangeNotificationW
(
pathW
.
Buffer
,
bWatchSubtree
,
dwNotifyFilter
);
RtlFreeUnicodeString
(
&
pathW
);
}
SERVER_END_REQ
;
CloseHandle
(
file
);
else
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
ret
;
}
...
...
@@ -65,13 +58,36 @@ HANDLE WINAPI FindFirstChangeNotificationA( LPCSTR lpPathName, BOOL bWatchSubtre
HANDLE
WINAPI
FindFirstChangeNotificationW
(
LPCWSTR
lpPathName
,
BOOL
bWatchSubtree
,
DWORD
dwNotifyFilter
)
{
UNICODE_STRING
nt_name
;
OBJECT_ATTRIBUTES
attr
;
IO_STATUS_BLOCK
io
;
NTSTATUS
status
;
HANDLE
file
,
ret
=
INVALID_HANDLE_VALUE
;
TRACE
(
"%s %d %lx
\n
"
,
debugstr_w
(
lpPathName
),
bWatchSubtree
,
dwNotifyFilter
);
if
((
file
=
CreateFileW
(
lpPathName
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
0
))
==
INVALID_HANDLE_VALUE
)
if
(
!
RtlDosPathNameToNtPathName_U
(
lpPathName
,
&
nt_name
,
NULL
,
NULL
))
{
SetLastError
(
ERROR_PATH_NOT_FOUND
);
return
INVALID_HANDLE_VALUE
;
}
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
;
attr
.
ObjectName
=
&
nt_name
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
status
=
NtOpenFile
(
&
file
,
0
,
&
attr
,
&
io
,
0
,
FILE_DIRECTORY_FILE
|
FILE_SYNCHRONOUS_IO_NONALERT
);
RtlFreeUnicodeString
(
&
nt_name
);
if
(
status
!=
STATUS_SUCCESS
)
{
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
INVALID_HANDLE_VALUE
;
}
SERVER_START_REQ
(
create_change_notification
)
{
...
...
dlls/kernel/file.c
View file @
a9832be1
...
...
@@ -626,10 +626,12 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
LPVOID
data
,
FINDEX_SEARCH_OPS
search_op
,
LPVOID
filter
,
DWORD
flags
)
{
WCHAR
buffer
[
MAX_PATH
];
WCHAR
*
mask
,
*
tmp
=
buffer
;
WCHAR
*
mask
,
*
p
;
FIND_FIRST_INFO
*
info
=
NULL
;
DWORD
size
;
UNICODE_STRING
nt_name
;
OBJECT_ATTRIBUTES
attr
;
IO_STATUS_BLOCK
io
;
NTSTATUS
status
;
if
((
search_op
!=
FindExSearchNameMatch
)
||
(
flags
!=
0
))
{
...
...
@@ -641,22 +643,12 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
FIXME
(
"info level %d not implemented
\n
"
,
level
);
return
INVALID_HANDLE_VALUE
;
}
size
=
RtlGetFullPathName_U
(
filename
,
sizeof
(
buffer
),
buffer
,
&
mask
);
if
(
!
size
)
if
(
!
RtlDosPathNameToNtPathName_U
(
filename
,
&
nt_name
,
&
mask
,
NULL
)
)
{
SetLastError
(
ERROR_PATH_NOT_FOUND
);
return
INVALID_HANDLE_VALUE
;
}
if
(
size
>
sizeof
(
buffer
))
{
tmp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
tmp
)
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
INVALID_HANDLE_VALUE
;
}
size
=
RtlGetFullPathName_U
(
filename
,
size
,
tmp
,
&
mask
);
}
if
(
!
mask
||
!*
mask
)
{
...
...
@@ -675,29 +667,43 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
goto
error
;
}
/* truncate dir name before mask */
*
mask
=
0
;
nt_name
.
Length
=
(
mask
-
nt_name
.
Buffer
)
*
sizeof
(
WCHAR
);
/* check if path is the root of the drive */
info
->
is_root
=
FALSE
;
if
(
tmp
[
0
]
&&
tmp
[
1
]
==
':'
)
p
=
nt_name
.
Buffer
+
4
;
/* skip \??\ prefix */
if
(
p
[
0
]
&&
p
[
1
]
==
':'
)
{
WCHAR
*
p
=
tmp
+
2
;
p
+=
2
;
while
(
*
p
==
'\\'
)
p
++
;
info
->
is_root
=
(
*
p
==
0
);
}
info
->
handle
=
CreateFileW
(
tmp
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
0
);
if
(
info
->
handle
==
INVALID_HANDLE_VALUE
)
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
;
attr
.
ObjectName
=
&
nt_name
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
status
=
NtOpenFile
(
&
info
->
handle
,
GENERIC_READ
,
&
attr
,
&
io
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_DIRECTORY_FILE
|
FILE_SYNCHRONOUS_IO_NONALERT
);
if
(
status
!=
STATUS_SUCCESS
)
{
RtlFreeUnicodeString
(
&
info
->
mask
);
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
goto
error
;
}
RtlFreeUnicodeString
(
&
nt_name
);
RtlInitializeCriticalSection
(
&
info
->
cs
);
info
->
data_pos
=
0
;
info
->
data_len
=
0
;
if
(
tmp
!=
buffer
)
HeapFree
(
GetProcessHeap
(),
0
,
tmp
);
if
(
!
FindNextFileW
(
(
HANDLE
)
info
,
data
))
{
...
...
@@ -709,8 +715,8 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
return
(
HANDLE
)
info
;
error:
if
(
tmp
!=
buffer
)
HeapFree
(
GetProcessHeap
(),
0
,
tmp
);
if
(
info
)
HeapFree
(
GetProcessHeap
(),
0
,
info
);
RtlFreeUnicodeString
(
&
nt_name
);
return
INVALID_HANDLE_VALUE
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment