Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
7e4af0f6
Commit
7e4af0f6
authored
May 14, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store the winsock per-thread data in NtCurrentTeb()->WinSockData
instead of using TlsAlloc.
parent
55d449e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
socket.c
dlls/winsock/socket.c
+4
-6
thread.h
include/thread.h
+14
-6
No files found.
dlls/winsock/socket.c
View file @
7e4af0f6
...
...
@@ -222,7 +222,6 @@ struct per_thread_data
int
pe_len
;
};
static
DWORD
tls_index
=
TLS_OUT_OF_INDEXES
;
/* TLS index for per-thread data */
static
INT
num_startup
;
/* reference counter */
static
FARPROC
blocking_hook
=
WSA_DefaultBlockingHook
;
...
...
@@ -405,19 +404,19 @@ static int _get_sock_error(SOCKET s, unsigned int bit)
static
struct
per_thread_data
*
get_per_thread_data
(
void
)
{
struct
per_thread_data
*
ptb
=
TlsGetValue
(
tls_index
)
;
struct
per_thread_data
*
ptb
=
NtCurrentTeb
()
->
WinSockData
;
/* lazy initialization */
if
(
!
ptb
)
{
ptb
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
ptb
)
);
TlsSetValue
(
tls_index
,
ptb
)
;
NtCurrentTeb
()
->
WinSockData
=
ptb
;
}
return
ptb
;
}
static
void
free_per_thread_data
(
void
)
{
struct
per_thread_data
*
ptb
=
TlsGetValue
(
tls_index
)
;
struct
per_thread_data
*
ptb
=
NtCurrentTeb
()
->
WinSockData
;
if
(
!
ptb
)
return
;
...
...
@@ -430,6 +429,7 @@ static void free_per_thread_data(void)
ptb
->
pe_buffer
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
ptb
);
NtCurrentTeb
()
->
WinSockData
=
NULL
;
}
/***********************************************************************
...
...
@@ -440,11 +440,9 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
TRACE
(
"%p 0x%lx %p
\n
"
,
hInstDLL
,
fdwReason
,
fImpLoad
);
switch
(
fdwReason
)
{
case
DLL_PROCESS_ATTACH
:
tls_index
=
TlsAlloc
();
break
;
case
DLL_PROCESS_DETACH
:
free_per_thread_data
();
TlsFree
(
tls_index
);
num_startup
=
0
;
break
;
case
DLL_THREAD_DETACH
:
...
...
include/thread.h
View file @
7e4af0f6
...
...
@@ -110,12 +110,20 @@ typedef struct _TEB
PVOID
DeallocationStack
;
/* -2- e0c Base of the stack */
LPVOID
TlsSlots
[
64
];
/* -2- e10 Thread local storage */
LIST_ENTRY
TlsLinks
;
/* -2- f10 */
DWORD
pad8
[
1
];
/* --n f18 */
PVOID
ReservedForNtRpc
;
/* -2- f1c used by rpcrt4 */
DWORD
pad9
[
24
];
/* --n f20 */
PVOID
ReservedForOle
;
/* -2- f80 used by ole32 (IErrorInfo*) */
PVOID
pad10
[
4
];
/* --n f84 */
PVOID
*
TlsExpansionSlots
;
/* -2- f94 */
PVOID
Vdm
;
/* f18 */
PVOID
ReservedForNtRpc
;
/* f1c */
PVOID
DbgSsReserved
[
2
];
/* f20 */
ULONG
HardErrorDisabled
;
/* f28 */
PVOID
Instrumentation
[
16
];
/* f2c */
PVOID
WinSockData
;
/* f6c */
ULONG
GdiBatchCount
;
/* f70 */
ULONG
Spare2
;
/* f74 */
ULONG
Spare3
;
/* f78 */
ULONG
Spare4
;
/* f7c */
PVOID
ReservedForOle
;
/* f80 */
ULONG
WaitingOnLoaderLock
;
/* f84 */
PVOID
Reserved5
[
3
];
/* f88 */
PVOID
*
TlsExpansionSlots
;
/* f94 */
}
TEB
;
#endif
/* WINE_TEB_DEFINED */
...
...
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