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
186b419e
Commit
186b419e
authored
Apr 16, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added hack to fetch the current directory from the subsystem tid so
that it is handled correctly in ntdll also for 16-bit tasks.
parent
bd1fdedd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
38 deletions
+46
-38
kernel_private.h
dlls/kernel/kernel_private.h
+0
-17
task.c
dlls/kernel/task.c
+18
-0
path.c
dlls/ntdll/path.c
+14
-21
thread.h
include/thread.h
+14
-0
No files found.
dlls/kernel/kernel_private.h
View file @
186b419e
...
...
@@ -21,23 +21,6 @@
#ifndef __WINE_KERNEL_PRIVATE_H
#define __WINE_KERNEL_PRIVATE_H
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winternl.h"
/* The thread information for 16-bit threads */
/* NtCurrentTeb()->SubSystemTib points to this */
typedef
struct
{
void
*
unknown
;
/* 00 unknown */
UNICODE_STRING
*
exe_name
;
/* 04 exe module name */
/* the following fields do not exist under Windows */
UNICODE_STRING
exe_str
;
/* exe name string pointed to by exe_name */
}
WIN16_SUBSYSTEM_TIB
;
HANDLE
WINAPI
OpenConsoleW
(
LPCWSTR
,
DWORD
,
BOOL
,
DWORD
);
BOOL
WINAPI
VerifyConsoleIoHandle
(
HANDLE
);
HANDLE
WINAPI
DuplicateConsoleHandle
(
HANDLE
,
DWORD
,
BOOL
,
DWORD
);
...
...
dlls/kernel/task.c
View file @
186b419e
...
...
@@ -432,6 +432,7 @@ static WIN16_SUBSYSTEM_TIB *allocate_win16_tib( TDB *pTask )
{
WCHAR
path
[
MAX_PATH
];
WIN16_SUBSYSTEM_TIB
*
tib
;
UNICODE_STRING
*
curdir
;
NE_MODULE
*
pModule
=
NE_GetPtr
(
pTask
->
hModule
);
if
(
!
(
tib
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
tib
)
)))
return
NULL
;
...
...
@@ -439,6 +440,15 @@ static WIN16_SUBSYSTEM_TIB *allocate_win16_tib( TDB *pTask )
GetLongPathNameW
(
path
,
path
,
MAX_PATH
);
if
(
RtlCreateUnicodeString
(
&
tib
->
exe_str
,
path
))
tib
->
exe_name
=
&
tib
->
exe_str
;
else
tib
->
exe_name
=
NULL
;
RtlAcquirePebLock
();
curdir
=
&
NtCurrentTeb
()
->
Peb
->
ProcessParameters
->
CurrentDirectoryName
;
tib
->
curdir
.
MaximumLength
=
sizeof
(
tib
->
curdir_buffer
);
tib
->
curdir
.
Length
=
min
(
curdir
->
Length
,
tib
->
curdir
.
MaximumLength
-
sizeof
(
WCHAR
)
);
tib
->
curdir
.
Buffer
=
tib
->
curdir_buffer
;
memcpy
(
tib
->
curdir_buffer
,
curdir
->
Buffer
,
tib
->
curdir
.
Length
);
tib
->
curdir_buffer
[
tib
->
curdir
.
Length
/
sizeof
(
WCHAR
)]
=
0
;
RtlReleasePebLock
();
return
tib
;
}
...
...
@@ -518,6 +528,7 @@ static void TASK_CallTaskSignalProc( UINT16 uCode, HANDLE16 hTaskOrModule )
*/
void
TASK_ExitTask
(
void
)
{
WIN16_SUBSYSTEM_TIB
*
tib
;
TDB
*
pTask
;
DWORD
lockCount
;
...
...
@@ -553,6 +564,13 @@ void TASK_ExitTask(void)
TASK_DeleteTask
(
pTask
->
hSelf
);
if
((
tib
=
NtCurrentTeb
()
->
Tib
.
SubSystemTib
))
{
if
(
tib
->
exe_name
)
RtlFreeUnicodeString
(
tib
->
exe_name
);
HeapFree
(
GetProcessHeap
(),
0
,
tib
);
NtCurrentTeb
()
->
Tib
.
SubSystemTib
=
NULL
;
}
/* ... and completely release the Win16Lock, just in case. */
ReleaseThunkLock
(
&
lockCount
);
}
...
...
dlls/ntdll/path.c
View file @
186b419e
...
...
@@ -541,7 +541,10 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
RtlAcquirePebLock
();
cd
=
&
NtCurrentTeb
()
->
Peb
->
ProcessParameters
->
CurrentDirectoryName
;
if
(
NtCurrentTeb
()
->
Tib
.
SubSystemTib
)
/* FIXME: hack */
cd
=
&
((
WIN16_SUBSYSTEM_TIB
*
)
NtCurrentTeb
()
->
Tib
.
SubSystemTib
)
->
curdir
;
else
cd
=
&
NtCurrentTeb
()
->
Peb
->
ProcessParameters
->
CurrentDirectoryName
;
switch
(
type
=
RtlDetermineDosPathNameType_U
(
name
))
{
...
...
@@ -851,7 +854,11 @@ NTSTATUS WINAPI RtlGetCurrentDirectory_U(ULONG buflen, LPWSTR buf)
RtlAcquirePebLock
();
us
=
&
NtCurrentTeb
()
->
Peb
->
ProcessParameters
->
CurrentDirectoryName
;
if
(
NtCurrentTeb
()
->
Tib
.
SubSystemTib
)
/* FIXME: hack */
us
=
&
((
WIN16_SUBSYSTEM_TIB
*
)
NtCurrentTeb
()
->
Tib
.
SubSystemTib
)
->
curdir
;
else
us
=
&
NtCurrentTeb
()
->
Peb
->
ProcessParameters
->
CurrentDirectoryName
;
len
=
us
->
Length
/
sizeof
(
WCHAR
);
if
(
us
->
Buffer
[
len
-
1
]
==
'\\'
&&
us
->
Buffer
[
len
-
2
]
!=
':'
)
len
--
;
...
...
@@ -886,7 +893,11 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir)
RtlAcquirePebLock
();
curdir
=
&
NtCurrentTeb
()
->
Peb
->
ProcessParameters
->
CurrentDirectoryName
;
if
(
NtCurrentTeb
()
->
Tib
.
SubSystemTib
)
/* FIXME: hack */
curdir
=
&
((
WIN16_SUBSYSTEM_TIB
*
)
NtCurrentTeb
()
->
Tib
.
SubSystemTib
)
->
curdir
;
else
curdir
=
&
NtCurrentTeb
()
->
Peb
->
ProcessParameters
->
CurrentDirectoryName
;
size
=
curdir
->
MaximumLength
;
buf
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
size
);
...
...
@@ -929,24 +940,6 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir)
memmove
(
curdir
->
Buffer
,
buf
,
size
+
sizeof
(
WCHAR
));
curdir
->
Length
=
size
;
#if 0
if (curdir->Buffer[1] == ':')
{
UNICODE_STRING env;
WCHAR var[4];
var[0] = '=';
var[1] = curdir->Buffer[0];
var[2] = ':';
var[3] = 0;
env.Length = 3 * sizeof(WCHAR);
env.MaximumLength = 4 * sizeof(WCHAR);
env.Buffer = var;
RtlSetEnvironmentVariable(NULL, &env, curdir);
}
#endif
out:
if
(
buf
)
RtlFreeHeap
(
GetProcessHeap
(),
0
,
buf
);
...
...
include/thread.h
View file @
186b419e
...
...
@@ -133,6 +133,20 @@ typedef struct _TEB
}
TEB
;
#endif
/* WINE_TEB_DEFINED */
/* The thread information for 16-bit threads */
/* NtCurrentTeb()->SubSystemTib points to this */
typedef
struct
{
void
*
unknown
;
/* 00 unknown */
UNICODE_STRING
*
exe_name
;
/* 04 exe module name */
/* the following fields do not exist under Windows */
UNICODE_STRING
exe_str
;
/* exe name string pointed to by exe_name */
UNICODE_STRING
curdir
;
/* current directory */
WCHAR
curdir_buffer
[
MAX_PATH
];
}
WIN16_SUBSYSTEM_TIB
;
/* scheduler/thread.c */
extern
TEB
*
THREAD_InitStack
(
TEB
*
teb
,
DWORD
stack_size
);
...
...
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