ReactOS
0.4.16-dev-2284-g3529151
msys2.c
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS 'General' Shim library
3
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4
* PURPOSE: Shim to apply the msys2 decoy
5
* COPYRIGHT: Copyright 2025 Timo kreuzer <timo.kreuzer@reactos.org>
6
* Copyright 2025 Mark Jansen <mark.jansen@reactos.org>
7
*/
8
9
#define WIN32_NO_STATUS
10
#include <
windef.h
>
11
#include <
winbase.h
>
12
#include <rtlfuncs.h>
13
#include <
shimlib.h
>
14
#include <
compat_undoc.h
>
15
16
static
PVOID
RtlGetCurrentDirectory_U_RtlpMsysDecoy
;
17
18
#define SHIM_NS MsysDecoy
19
#include <setup_shim.inl>
20
21
22
BOOL
WINAPI
SHIM_OBJ_NAME(
Notify
)(
DWORD
fdwReason
,
PVOID
ptr
)
23
{
24
if
(
fdwReason
==
SHIM_NOTIFY_ATTACH
)
25
{
26
ReactOS_ShimData
*pShimData = (
ReactOS_ShimData
*)
NtCurrentPeb
()->pShimData;
27
if
(pShimData && pShimData->
dwMagic
==
REACTOS_SHIMDATA_MAGIC
)
28
{
29
/* Grab the private function from ntdll */
30
RtlGetCurrentDirectory_U_RtlpMsysDecoy
= pShimData->RtlGetCurrentDirectory_U_RtlpMsysDecoy;
31
SHIM_MSG
(
"RtlGetCurrentDirectory_U_RtlpMsysDecoy=%p\n"
,
RtlGetCurrentDirectory_U_RtlpMsysDecoy
);
32
return
RtlGetCurrentDirectory_U_RtlpMsysDecoy
!=
NULL
;
33
}
34
SHIM_FAIL
(
"Invalid pShimData @ %p\n"
, pShimData);
35
/* Returning false here will not register the hooks */
36
return
FALSE
;
37
}
38
return
TRUE
;
39
}
40
41
#define SHIM_NOTIFY_FN SHIM_OBJ_NAME(Notify)
42
#define SHIM_NUM_HOOKS 1
43
#define SHIM_SETUP_HOOKS \
44
SHIM_HOOK(0, "NTDLL.DLL"
, "RtlGetCurrentDirectory_U", RtlGetCurrentDirectory_U_RtlpMsysDecoy)
45
46
#include <implement_shim.inl>
NtCurrentPeb
#define NtCurrentPeb()
Definition:
FLS.c:22
fdwReason
static DWORD const fdwReason
Definition:
appcrt_dllmain.cpp:57
compat_undoc.h
REACTOS_SHIMDATA_MAGIC
#define REACTOS_SHIMDATA_MAGIC
Definition:
compat_undoc.h:19
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
void
Definition:
nsiface.idl:2307
ptr
static PVOID ptr
Definition:
dispmode.c:27
RtlGetCurrentDirectory_U_RtlpMsysDecoy
static PVOID RtlGetCurrentDirectory_U_RtlpMsysDecoy
Definition:
msys2.c:16
Notify
BOOL WINAPI SHIM_OBJ_NAME() Notify(DWORD fdwReason, PVOID ptr)
Definition:
msys2.c:22
shimlib.h
SHIM_FAIL
#define SHIM_FAIL(fmt,...)
Definition:
shimlib.h:76
SHIM_MSG
#define SHIM_MSG(fmt,...)
Definition:
shimlib.h:75
SHIM_NOTIFY_ATTACH
#define SHIM_NOTIFY_ATTACH
Definition:
shimlib.h:50
_ReactOS_ShimData
Definition:
compat_undoc.h:6
_ReactOS_ShimData::dwMagic
DWORD dwMagic
Definition:
compat_undoc.h:9
winbase.h
windef.h
WINAPI
#define WINAPI
Definition:
msvc.h:6
dll
appcompat
shims
genral
msys2.c
Generated on Mon Feb 16 2026 06:03:20 for ReactOS by
1.9.6