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
6a4dca0e
Commit
6a4dca0e
authored
Nov 28, 2023
by
Eric Pouech
Committed by
Alexandre Julliard
Nov 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Return NULL in RtlFindExportedRoutine for forwarded entries.
Signed-off-by:
Eric Pouech
<
epouech@codeweavers.com
>
parent
8e00767f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
loader.c
dlls/ntdll/loader.c
+7
-1
rtl.c
dlls/ntdll/tests/rtl.c
+18
-0
No files found.
dlls/ntdll/loader.c
View file @
6a4dca0e
...
...
@@ -1066,6 +1066,7 @@ void * WINAPI RtlFindExportedRoutineByName( HMODULE module, const char *name )
const
DWORD
*
functions
;
DWORD
exp_size
;
int
ordinal
;
void
*
proc
;
exports
=
RtlImageDirectoryEntryToData
(
module
,
TRUE
,
IMAGE_DIRECTORY_ENTRY_EXPORT
,
&
exp_size
);
if
(
!
exports
||
exp_size
<
sizeof
(
*
exports
))
return
NULL
;
...
...
@@ -1074,7 +1075,12 @@ void * WINAPI RtlFindExportedRoutineByName( HMODULE module, const char *name )
if
(
ordinal
>=
exports
->
NumberOfFunctions
)
return
NULL
;
functions
=
get_rva
(
module
,
exports
->
AddressOfFunctions
);
if
(
!
functions
[
ordinal
])
return
NULL
;
return
get_rva
(
module
,
functions
[
ordinal
]
);
proc
=
get_rva
(
module
,
functions
[
ordinal
]
);
/* if the address falls into the export dir, it's a forward */
if
(((
const
char
*
)
proc
>=
(
const
char
*
)
exports
)
&&
((
const
char
*
)
proc
<
(
const
char
*
)
exports
+
exp_size
))
return
NULL
;
return
proc
;
}
...
...
dlls/ntdll/tests/rtl.c
View file @
6a4dca0e
...
...
@@ -95,6 +95,7 @@ static NTSTATUS (WINAPI *pRtlIpv6StringToAddressExW)(PCWSTR, struct in6_addr *,
static
BOOL
(
WINAPI
*
pRtlIsCriticalSectionLocked
)(
CRITICAL_SECTION
*
);
static
BOOL
(
WINAPI
*
pRtlIsCriticalSectionLockedByThread
)(
CRITICAL_SECTION
*
);
static
NTSTATUS
(
WINAPI
*
pRtlInitializeCriticalSectionEx
)(
CRITICAL_SECTION
*
,
ULONG
,
ULONG
);
static
void
*
(
WINAPI
*
pRtlFindExportedRoutineByName
)(
HMODULE
,
const
char
*
);
static
NTSTATUS
(
WINAPI
*
pLdrEnumerateLoadedModules
)(
void
*
,
void
*
,
void
*
);
static
NTSTATUS
(
WINAPI
*
pLdrRegisterDllNotification
)(
ULONG
,
PLDR_DLL_NOTIFICATION_FUNCTION
,
void
*
,
void
**
);
static
NTSTATUS
(
WINAPI
*
pLdrUnregisterDllNotification
)(
void
*
);
...
...
@@ -137,6 +138,7 @@ static void InitFunctionPtrs(void)
pRtlIsCriticalSectionLocked
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIsCriticalSectionLocked"
);
pRtlIsCriticalSectionLockedByThread
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIsCriticalSectionLockedByThread"
);
pRtlInitializeCriticalSectionEx
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlInitializeCriticalSectionEx"
);
pRtlFindExportedRoutineByName
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlFindExportedRoutineByName"
);
pLdrEnumerateLoadedModules
=
(
void
*
)
GetProcAddress
(
hntdll
,
"LdrEnumerateLoadedModules"
);
pLdrRegisterDllNotification
=
(
void
*
)
GetProcAddress
(
hntdll
,
"LdrRegisterDllNotification"
);
pLdrUnregisterDllNotification
=
(
void
*
)
GetProcAddress
(
hntdll
,
"LdrUnregisterDllNotification"
);
...
...
@@ -3651,6 +3653,21 @@ static void test_RtlValidSecurityDescriptor(void)
free
(
sd
);
}
static
void
test_RtlFindExportedRoutineByName
(
void
)
{
void
*
proc
;
if
(
!
pRtlFindExportedRoutineByName
)
{
win_skip
(
"RtlFindExportedRoutineByName is not present
\n
"
);
return
;
}
proc
=
pRtlFindExportedRoutineByName
(
GetModuleHandleW
(
L"kernelbase"
),
"CtrlRoutine"
);
ok
(
proc
!=
NULL
,
"Expected non NULL address
\n
"
);
proc
=
pRtlFindExportedRoutineByName
(
GetModuleHandleW
(
L"kernel32"
),
"CtrlRoutine"
);
ok
(
proc
==
NULL
,
"Shouldn't find forwarded function
\n
"
);
}
START_TEST
(
rtl
)
{
InitFunctionPtrs
();
...
...
@@ -3697,4 +3714,5 @@ START_TEST(rtl)
test_RtlFirstFreeAce
();
test_RtlInitializeSid
();
test_RtlValidSecurityDescriptor
();
test_RtlFindExportedRoutineByName
();
}
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