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
bcc71717
Commit
bcc71717
authored
Jan 22, 2007
by
Mike McCormack
Committed by
Alexandre Julliard
Jan 22, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implement RtlDecodePointer and RtlEncodePointer.
parent
4dc61069
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
ntdll.spec
dlls/ntdll/ntdll.spec
+2
-2
rtl.c
dlls/ntdll/rtl.c
+36
-0
No files found.
dlls/ntdll/ntdll.spec
View file @
bcc71717
...
@@ -501,7 +501,7 @@
...
@@ -501,7 +501,7 @@
@ stub RtlDeactivateActivationContext
@ stub RtlDeactivateActivationContext
@ stub RtlDeactivateActivationContextUnsafeFast
@ stub RtlDeactivateActivationContextUnsafeFast
@ stub RtlDebugPrintTimes
@ stub RtlDebugPrintTimes
# @ stub RtlDecodePointer
@ stdcall RtlDecodePointer(ptr)
# @ stub RtlDecodeSystemPointer
# @ stub RtlDecodeSystemPointer
@ stub RtlDecompressBuffer
@ stub RtlDecompressBuffer
@ stub RtlDecompressFragment
@ stub RtlDecompressFragment
...
@@ -543,7 +543,7 @@
...
@@ -543,7 +543,7 @@
@ stdcall RtlDuplicateUnicodeString(long ptr ptr)
@ stdcall RtlDuplicateUnicodeString(long ptr ptr)
@ stdcall RtlEmptyAtomTable(ptr long)
@ stdcall RtlEmptyAtomTable(ptr long)
# @ stub RtlEnableEarlyCriticalSectionEventCreation
# @ stub RtlEnableEarlyCriticalSectionEventCreation
# @ stub RtlEncodePointer
@ stdcall RtlEncodePointer(ptr)
# @ stub RtlEncodeSystemPointer
# @ stub RtlEncodeSystemPointer
@ stdcall -ret64 RtlEnlargedIntegerMultiply(long long)
@ stdcall -ret64 RtlEnlargedIntegerMultiply(long long)
@ stdcall RtlEnlargedUnsignedDivide(double long ptr)
@ stdcall RtlEnlargedUnsignedDivide(double long ptr)
...
...
dlls/ntdll/rtl.c
View file @
bcc71717
...
@@ -886,3 +886,39 @@ NTSTATUS WINAPI RtlIpv4AddressToStringExW (PULONG IP, PULONG Port,
...
@@ -886,3 +886,39 @@ NTSTATUS WINAPI RtlIpv4AddressToStringExW (PULONG IP, PULONG Port,
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
static
DWORD_PTR
get_pointer_obfuscator
(
void
)
{
static
DWORD_PTR
pointer_obfuscator
;
if
(
!
pointer_obfuscator
)
{
ULONG
seed
=
NtGetTickCount
();
ULONG_PTR
rand
;
/* generate a random value for the obfuscator */
rand
=
RtlUniform
(
&
seed
);
/* handle 64bit pointers */
rand
^=
RtlUniform
(
&
seed
)
<<
((
sizeof
(
DWORD_PTR
)
-
sizeof
(
ULONG
))
*
8
);
/* set the high bits so dereferencing obfuscated pointers will (usually) crash */
rand
|=
0xc0000000
<<
((
sizeof
(
DWORD_PTR
)
-
sizeof
(
ULONG
))
*
8
);
interlocked_cmpxchg_ptr
(
(
void
**
)
&
pointer_obfuscator
,
(
void
*
)
rand
,
NULL
);
}
return
pointer_obfuscator
;
}
PVOID
WINAPI
RtlEncodePointer
(
PVOID
ptr
)
{
DWORD_PTR
ptrval
=
(
DWORD_PTR
)
ptr
;
return
(
PVOID
)(
ptrval
^
get_pointer_obfuscator
());
}
PVOID
WINAPI
RtlDecodePointer
(
PVOID
ptr
)
{
DWORD_PTR
ptrval
=
(
DWORD_PTR
)
ptr
;
return
(
PVOID
)(
ptrval
^
get_pointer_obfuscator
());
}
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