Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sleuthkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Sleuthkit
Commits
aaaef59c
Commit
aaaef59c
authored
11 years ago
by
Brian Carrier
Browse files
Options
Downloads
Plain Diff
Merge pull request #285 from antonkukoba/patch-3
Fixed Tls initialization problem
parents
4bbb5ec9
1e07be4d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tsk/base/tsk_error_win32.cpp
+16
-8
16 additions, 8 deletions
tsk/base/tsk_error_win32.cpp
with
16 additions
and
8 deletions
tsk/base/tsk_error_win32.cpp
+
16
−
8
View file @
aaaef59c
...
@@ -15,22 +15,26 @@
...
@@ -15,22 +15,26 @@
#include
<windows.h>
#include
<windows.h>
static
DWORD
tlsIndex
;
namespace
tsk
{
namespace
tsk
{
static
DWORD
tlsIndex
;
class
GetTlsIndex
{
class
GetTlsIndex
{
public:
public:
GetTlsIndex
()
{
GetTlsIndex
()
{
tlsIndex
=
TlsAlloc
();
tlsIndex
=
TlsAlloc
();
}
}
~
GetTlsIndex
()
{
~
GetTlsIndex
()
{
TlsFree
(
tlsIndex
);
TlsFree
(
tlsIndex
);
}
}
DWORD
GetIndex
()
{
return
tlsIndex
;
}
private
:
static
DWORD
tlsIndex
;
};
};
DWORD
GetTlsIndex
::
tlsIndex
;
static
GetTlsIndex
getTlsIndex
;
static
GetTlsIndex
getTlsIndex
;
}
}
...
@@ -40,11 +44,13 @@ namespace tsk {
...
@@ -40,11 +44,13 @@ namespace tsk {
*/
*/
extern
"C"
extern
"C"
void
*
tsk_error_win32_get_per_thread_
(
unsigned
struct_size
)
{
void
*
tsk_error_win32_get_per_thread_
(
unsigned
struct_size
)
{
void
*
ptr
=
TlsGetValue
(
tlsIndex
);
DWORD
index
=
tsk
::
getTlsIndex
.
GetIndex
();
void
*
ptr
=
TlsGetValue
(
index
);
if
(
ptr
==
0
)
{
if
(
ptr
==
0
)
{
ptr
=
malloc
(
struct_size
);
ptr
=
malloc
(
struct_size
);
memset
(
ptr
,
0
,
struct_size
);
memset
(
ptr
,
0
,
struct_size
);
TlsSetValue
(
tlsI
ndex
,
ptr
);
TlsSetValue
(
i
ndex
,
ptr
);
}
}
return
ptr
;
return
ptr
;
}
}
...
@@ -54,10 +60,12 @@ void *tsk_error_win32_get_per_thread_(unsigned struct_size) {
...
@@ -54,10 +60,12 @@ void *tsk_error_win32_get_per_thread_(unsigned struct_size) {
*/
*/
extern
"C"
extern
"C"
void
tsk_error_win32_thread_cleanup
()
{
void
tsk_error_win32_thread_cleanup
()
{
void
*
ptr
=
TlsGetValue
(
tlsIndex
);
DWORD
index
=
tsk
::
getTlsIndex
.
GetIndex
();
void
*
ptr
=
TlsGetValue
(
index
);
if
(
ptr
!=
0
)
{
if
(
ptr
!=
0
)
{
free
(
ptr
);
free
(
ptr
);
TlsSetValue
(
tlsI
ndex
,
0
);
TlsSetValue
(
i
ndex
,
0
);
}
}
}
}
...
...
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