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
5ebdeaaa
Commit
5ebdeaaa
authored
Jul 09, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use char pointers instead of ANSI/UNICODE_STRING in unix_to_nt_file_name().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
368e3a93
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
74 deletions
+79
-74
env.c
dlls/ntdll/unix/env.c
+13
-16
file.c
dlls/ntdll/unix/file.c
+53
-44
loader.c
dlls/ntdll/unix/loader.c
+12
-13
unix_private.h
dlls/ntdll/unix/unix_private.h
+1
-1
No files found.
dlls/ntdll/unix/env.c
View file @
5ebdeaaa
...
...
@@ -1057,16 +1057,14 @@ static void append_envW( WCHAR *env, SIZE_T *pos, const char *name, const WCHAR
/* set an environment variable for one of the wine path variables */
static
void
add_path_var
(
WCHAR
*
env
,
SIZE_T
*
pos
,
const
char
*
name
,
const
char
*
path
)
{
UNICODE_STRING
nt_name
;
ANSI_STRING
unix_name
;
WCHAR
*
nt_name
;
if
(
!
path
)
append_envW
(
env
,
pos
,
name
,
NULL
);
else
{
RtlInitAnsiString
(
&
unix_name
,
path
);
if
(
unix_to_nt_file_name
(
&
unix_name
,
&
nt_name
))
return
;
append_envW
(
env
,
pos
,
name
,
nt_name
.
Buffer
);
RtlFreeUnicodeString
(
&
nt_name
);
if
(
unix_to_nt_file_name
(
path
,
&
nt_name
))
return
;
append_envW
(
env
,
pos
,
name
,
nt_name
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
nt_name
);
}
}
...
...
@@ -1202,25 +1200,24 @@ void CDECL get_initial_directory( UNICODE_STRING *dir )
if
(
pwd
)
{
ANSI_STRING
unix_name
;
UNICODE_STRING
nt_name
;
WCHAR
*
nt_name
;
RtlInitAnsiString
(
&
unix_name
,
pwd
);
if
(
!
unix_to_nt_file_name
(
&
unix_name
,
&
nt_name
))
if
(
!
unix_to_nt_file_name
(
pwd
,
&
nt_name
))
{
/* skip the \??\ prefix */
if
(
nt_name
.
Length
>
6
*
sizeof
(
WCHAR
)
&&
nt_name
.
Buffer
[
5
]
==
':'
)
ULONG
len
=
wcslen
(
nt_name
);
if
(
len
>
6
&&
nt_name
[
5
]
==
':'
)
{
dir
->
Length
=
nt_name
.
Length
-
4
*
sizeof
(
WCHAR
);
memcpy
(
dir
->
Buffer
,
nt_name
.
Buffer
+
4
,
dir
->
Length
);
dir
->
Length
=
(
len
-
4
)
*
sizeof
(
WCHAR
);
memcpy
(
dir
->
Buffer
,
nt_name
+
4
,
dir
->
Length
);
}
else
/* change \??\ to \\?\ */
{
dir
->
Length
=
nt_name
.
Length
;
memcpy
(
dir
->
Buffer
,
nt_name
.
Buffer
,
dir
->
Length
);
dir
->
Length
=
len
*
sizeof
(
WCHAR
)
;
memcpy
(
dir
->
Buffer
,
nt_name
,
dir
->
Length
);
dir
->
Buffer
[
1
]
=
'\\'
;
}
RtlFree
UnicodeString
(
&
nt_name
);
RtlFree
Heap
(
GetProcessHeap
(),
0
,
nt_name
);
}
}
...
...
dlls/ntdll/unix/file.c
View file @
5ebdeaaa
This diff is collapsed.
Click to expand it.
dlls/ntdll/unix/loader.c
View file @
5ebdeaaa
...
...
@@ -990,19 +990,21 @@ static inline char *prepend( char *buffer, const char *str, size_t len )
*
* Open a file for a new dll. Helper for find_dll_file.
*/
static
NTSTATUS
open_dll_file
(
UNICODE_STRING
*
nt_
name
,
void
**
module
,
pe_image_info_t
*
image_info
)
static
NTSTATUS
open_dll_file
(
const
WCHAR
*
name
,
void
**
module
,
pe_image_info_t
*
image_info
)
{
struct
builtin_module
*
builtin
;
FILE_BASIC_INFORMATION
info
;
OBJECT_ATTRIBUTES
attr
;
IO_STATUS_BLOCK
io
;
UNICODE_STRING
nt_name
;
LARGE_INTEGER
size
;
FILE_OBJECTID_BUFFER
id
;
SIZE_T
len
=
0
;
NTSTATUS
status
;
HANDLE
handle
,
mapping
;
InitializeObjectAttributes
(
&
attr
,
nt_name
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
RtlInitUnicodeString
(
&
nt_name
,
name
);
InitializeObjectAttributes
(
&
attr
,
&
nt_name
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
if
((
status
=
NtOpenFile
(
&
handle
,
GENERIC_READ
|
SYNCHRONIZE
,
&
attr
,
&
io
,
FILE_SHARE_READ
|
FILE_SHARE_DELETE
,
FILE_SYNCHRONOUS_IO_NONALERT
|
FILE_NON_DIRECTORY_FILE
)))
...
...
@@ -1024,7 +1026,7 @@ static NTSTATUS open_dll_file( UNICODE_STRING *nt_name, void **module, pe_image_
{
if
(
!
memcmp
(
&
builtin
->
id
,
id
.
ObjectId
,
sizeof
(
builtin
->
id
)
))
{
TRACE
(
"%s is the same file as existing module %p
\n
"
,
debugstr_w
(
nt_name
->
Buffer
),
TRACE
(
"%s is the same file as existing module %p
\n
"
,
debugstr_w
(
name
),
builtin
->
module
);
NtClose
(
handle
);
NtUnmapViewOfSection
(
NtCurrentProcess
(),
*
module
);
...
...
@@ -1055,12 +1057,12 @@ static NTSTATUS open_dll_file( UNICODE_STRING *nt_name, void **module, pe_image_
/* ignore non-builtins */
if
(
!
(
image_info
->
image_flags
&
IMAGE_FLAGS_WineBuiltin
))
{
WARN
(
"%s found in WINEDLLPATH but not a builtin, ignoring
\n
"
,
debugstr_
us
(
nt_
name
)
);
WARN
(
"%s found in WINEDLLPATH but not a builtin, ignoring
\n
"
,
debugstr_
w
(
name
)
);
status
=
STATUS_DLL_NOT_FOUND
;
}
else
if
(
image_info
->
cpu
!=
client_cpu
)
{
TRACE
(
"%s is for CPU %u, continuing search
\n
"
,
debugstr_
us
(
nt_
name
),
image_info
->
cpu
);
TRACE
(
"%s is for CPU %u, continuing search
\n
"
,
debugstr_
w
(
name
),
image_info
->
cpu
);
status
=
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
;
}
...
...
@@ -1080,17 +1082,14 @@ static NTSTATUS open_dll_file( UNICODE_STRING *nt_name, void **module, pe_image_
*/
static
NTSTATUS
open_builtin_file
(
char
*
name
,
void
**
module
,
pe_image_info_t
*
image_info
)
{
ANSI_STRING
strA
;
UNICODE_STRING
nt_name
;
WCHAR
*
nt_name
=
NULL
;
NTSTATUS
status
;
int
fd
;
nt_name
.
Buffer
=
NULL
;
RtlInitAnsiString
(
&
strA
,
name
);
if
((
status
=
unix_to_nt_file_name
(
&
strA
,
&
nt_name
)))
return
status
;
if
((
status
=
unix_to_nt_file_name
(
name
,
&
nt_name
)))
return
status
;
status
=
open_dll_file
(
&
nt_name
,
module
,
image_info
);
RtlFree
UnicodeString
(
&
nt_name
);
status
=
open_dll_file
(
nt_name
,
module
,
image_info
);
RtlFree
Heap
(
GetProcessHeap
(),
0
,
nt_name
);
if
(
status
!=
STATUS_DLL_NOT_FOUND
)
return
status
;
...
...
@@ -1534,7 +1533,7 @@ static struct unix_funcs unix_funcs =
server_release_fd
,
server_init_process_done
,
wine_nt_to_unix_file_name
,
unix_to_nt_file_name
,
wine_
unix_to_nt_file_name
,
set_show_dot_files
,
load_so_dll
,
load_builtin_dll
,
...
...
dlls/ntdll/unix/unix_private.h
View file @
5ebdeaaa
...
...
@@ -124,7 +124,6 @@ extern NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdlin
extern
NTSTATUS
CDECL
unwind_builtin_dll
(
ULONG
type
,
struct
_DISPATCHER_CONTEXT
*
dispatch
,
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
unix_to_nt_file_name
(
const
ANSI_STRING
*
name
,
UNICODE_STRING
*
nt
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
set_show_dot_files
(
BOOL
enable
)
DECLSPEC_HIDDEN
;
extern
const
char
*
home_dir
DECLSPEC_HIDDEN
;
...
...
@@ -236,6 +235,7 @@ extern NTSTATUS tape_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTI
extern
NTSTATUS
errno_to_status
(
int
err
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
nt_to_unix_file_name
(
const
UNICODE_STRING
*
nameW
,
char
**
name_ret
,
UINT
disposition
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
unix_to_nt_file_name
(
const
char
*
name
,
WCHAR
**
nt
)
DECLSPEC_HIDDEN
;
extern
void
init_files
(
void
)
DECLSPEC_HIDDEN
;
extern
void
init_cpu_info
(
void
)
DECLSPEC_HIDDEN
;
...
...
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