Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
231674d8
Commit
231674d8
authored
24 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
Removed the DOS handles table from the PDB and made it a static
variable.
parent
4fef2f19
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
files/file.c
+25
-40
25 additions, 40 deletions
files/file.c
include/file.h
+0
-1
0 additions, 1 deletion
include/file.h
loader/dos/dosvm.c
+0
-2
0 additions, 2 deletions
loader/dos/dosvm.c
with
25 additions
and
43 deletions
files/file.c
+
25
−
40
View file @
231674d8
...
...
@@ -42,7 +42,6 @@
#include
"heap.h"
#include
"msdos.h"
#include
"ldt.h"
#include
"process.h"
#include
"task.h"
#include
"wincon.h"
#include
"debugtools.h"
...
...
@@ -58,6 +57,8 @@ DEFAULT_DEBUG_CHANNEL(file);
/* Size of per-process table of DOS handles */
#define DOS_TABLE_SIZE 256
static
HANDLE
dos_handles
[
DOS_TABLE_SIZE
];
/***********************************************************************
* FILE_ConvertOFMode
...
...
@@ -990,19 +991,13 @@ HFILE WINAPI OpenFile( LPCSTR name, OFSTRUCT *ofs, UINT mode )
* Allocates the default DOS handles for a process. Called either by
* AllocDosHandle below or by the DOSVM stuff.
*/
BOOL
FILE_InitProcessDosHandles
(
void
)
{
HANDLE
*
ptr
;
if
(
!
(
ptr
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
ptr
)
*
DOS_TABLE_SIZE
)))
return
FALSE
;
PROCESS_Current
()
->
dos_handles
=
ptr
;
ptr
[
0
]
=
GetStdHandle
(
STD_INPUT_HANDLE
);
ptr
[
1
]
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
ptr
[
2
]
=
GetStdHandle
(
STD_ERROR_HANDLE
);
ptr
[
3
]
=
GetStdHandle
(
STD_ERROR_HANDLE
);
ptr
[
4
]
=
GetStdHandle
(
STD_ERROR_HANDLE
);
return
TRUE
;
static
void
FILE_InitProcessDosHandles
(
void
)
{
dos_handles
[
0
]
=
GetStdHandle
(
STD_INPUT_HANDLE
);
dos_handles
[
1
]
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
dos_handles
[
2
]
=
GetStdHandle
(
STD_ERROR_HANDLE
);
dos_handles
[
3
]
=
GetStdHandle
(
STD_ERROR_HANDLE
);
dos_handles
[
4
]
=
GetStdHandle
(
STD_ERROR_HANDLE
);
}
/***********************************************************************
...
...
@@ -1014,25 +1009,17 @@ BOOL FILE_InitProcessDosHandles( void ) {
HFILE16
FILE_AllocDosHandle
(
HANDLE
handle
)
{
int
i
;
HANDLE
*
ptr
=
PROCESS_Current
()
->
dos_handles
;
if
(
!
handle
||
(
handle
==
INVALID_HANDLE_VALUE
))
return
INVALID_HANDLE_VALUE16
;
if
(
!
ptr
)
{
if
(
!
FILE_InitProcessDosHandles
())
goto
error
;
ptr
=
PROCESS_Current
()
->
dos_handles
;
}
for
(
i
=
0
;
i
<
DOS_TABLE_SIZE
;
i
++
,
ptr
++
)
if
(
!*
ptr
)
for
(
i
=
5
;
i
<
DOS_TABLE_SIZE
;
i
++
)
if
(
!
dos_handles
[
i
])
{
*
ptr
=
handle
;
dos_handles
[
i
]
=
handle
;
TRACE
(
"Got %d for h32 %d
\n
"
,
i
,
handle
);
return
i
;
}
error:
CloseHandle
(
handle
);
SetLastError
(
ERROR_TOO_MANY_OPEN_FILES
);
return
INVALID_HANDLE_VALUE16
;
...
...
@@ -1046,13 +1033,13 @@ error:
*/
HANDLE
FILE_GetHandle
(
HFILE16
hfile
)
{
HANDLE
*
table
=
PROCESS_Current
()
->
dos_h
andles
;
if
((
hfile
>=
DOS_TABLE_SIZE
)
||
!
table
||
!
tab
le
[
hfile
])
if
(
hfile
<
5
&&
!
dos_handles
[
hfile
])
FILE_InitProcessDosH
andles
()
;
if
((
hfile
>=
DOS_TABLE_SIZE
)
||
!
dos_hand
le
s
[
hfile
])
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
INVALID_HANDLE_VALUE
;
}
return
tab
le
[
hfile
];
return
dos_hand
le
s
[
hfile
];
}
...
...
@@ -1063,11 +1050,11 @@ HANDLE FILE_GetHandle( HFILE16 hfile )
*/
HFILE16
FILE_Dup2
(
HFILE16
hFile1
,
HFILE16
hFile2
)
{
HANDLE
*
table
=
PROCESS_Current
()
->
dos_handles
;
HANDLE
new_handle
;
if
((
hFile1
>=
DOS_TABLE_SIZE
)
||
(
hFile2
>=
DOS_TABLE_SIZE
)
||
!
table
||
!
table
[
hFile1
])
if
(
hFile1
<
5
&&
!
dos_handles
[
hFile1
])
FILE_InitProcessDosHandles
();
if
((
hFile1
>=
DOS_TABLE_SIZE
)
||
(
hFile2
>=
DOS_TABLE_SIZE
)
||
!
dos_handles
[
hFile1
])
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
HFILE_ERROR16
;
...
...
@@ -1078,12 +1065,12 @@ HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 )
SetLastError
(
ERROR_INVALID_HANDLE
);
return
HFILE_ERROR16
;
}
if
(
!
DuplicateHandle
(
GetCurrentProcess
(),
tab
le
[
hFile1
],
if
(
!
DuplicateHandle
(
GetCurrentProcess
(),
dos_hand
le
s
[
hFile1
],
GetCurrentProcess
(),
&
new_handle
,
0
,
FALSE
,
DUPLICATE_SAME_ACCESS
))
return
HFILE_ERROR16
;
if
(
tab
le
[
hFile2
])
CloseHandle
(
tab
le
[
hFile2
]
);
tab
le
[
hFile2
]
=
new_handle
;
if
(
dos_hand
le
s
[
hFile2
])
CloseHandle
(
dos_hand
le
s
[
hFile2
]
);
dos_hand
le
s
[
hFile2
]
=
new_handle
;
return
hFile2
;
}
...
...
@@ -1093,22 +1080,20 @@ HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 )
*/
HFILE16
WINAPI
_lclose16
(
HFILE16
hFile
)
{
HANDLE
*
table
=
PROCESS_Current
()
->
dos_handles
;
if
(
hFile
<
5
)
{
FIXME
(
"stdio handle closed, need proper conversion
\n
"
);
SetLastError
(
ERROR_INVALID_HANDLE
);
return
HFILE_ERROR16
;
}
if
((
hFile
>=
DOS_TABLE_SIZE
)
||
!
table
||
!
tab
le
[
hFile
])
if
((
hFile
>=
DOS_TABLE_SIZE
)
||
!
dos_hand
le
s
[
hFile
])
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
HFILE_ERROR16
;
}
TRACE
(
"%d (handle32=%d)
\n
"
,
hFile
,
tab
le
[
hFile
]
);
CloseHandle
(
tab
le
[
hFile
]
);
tab
le
[
hFile
]
=
0
;
TRACE
(
"%d (handle32=%d)
\n
"
,
hFile
,
dos_hand
le
s
[
hFile
]
);
CloseHandle
(
dos_hand
le
s
[
hFile
]
);
dos_hand
le
s
[
hFile
]
=
0
;
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
include/file.h
+
0
−
1
View file @
231674d8
...
...
@@ -46,7 +46,6 @@ extern LPVOID FILE_dommap( int unix_handle, LPVOID start,
int
prot
,
int
flags
);
extern
int
FILE_munmap
(
LPVOID
start
,
DWORD
size_high
,
DWORD
size_low
);
extern
HFILE16
FILE_AllocDosHandle
(
HANDLE
handle
);
extern
BOOL
FILE_InitProcessDosHandles
(
void
);
extern
HANDLE
FILE_GetHandle
(
HFILE16
hfile
);
/* files/directory.c */
...
...
This diff is collapsed.
Click to expand it.
loader/dos/dosvm.c
+
0
−
2
View file @
231674d8
...
...
@@ -464,8 +464,6 @@ int DOSVM_Enter( CONTEXT86 *context )
VM86
.
regs
.
eflags
|=
VIF_MASK
;
}
else
{
/* initial setup */
/* allocate standard DOS handles */
FILE_InitProcessDosHandles
();
/* registers */
memset
(
&
VM86
,
0
,
sizeof
(
VM86
));
VM86
.
regs
.
cs
=
lpDosTask
->
init_cs
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment