MCPcopy Create free account
hub / github.com/GPUOpen-Tools/GPU-Reshape / DllMain

Function DllMain

Source/Backends/DX12/Layer/Source/DLL.cpp:73–131  ·  view source on GitHub ↗

DLL entrypoint

Source from the content-addressed store, hash-verified

71
72/// DLL entrypoint
73BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved) {
74 if (DetourIsHelperProcess()) {
75 return TRUE;
76 }
77
78 // Attach?
79 if (dwReason == DLL_PROCESS_ATTACH) {
80 // If the process is already bootstrapped, skip
81 if (IsBootstrapped()) {
82 IsBootstrappedOnAttach = true;
83 return TRUE;
84 }
85
86 DetourRestoreAfterWith();
87
88 // Open transaction
89 DetourTransactionBegin();
90 DetourUpdateThread(GetCurrentThread());
91
92 // Install dxgi factory
93 if (!dxgiFactoryDetour.Install()) {
94 return FALSE;
95 }
96
97 // Install device
98 if (!deviceDetour.Install()) {
99 return FALSE;
100 }
101
102 // Commit all transactions
103 if (FAILED(DetourTransactionCommit())) {
104 return FALSE;
105 }
106 }
107
108 // Detach?
109 else if (dwReason == DLL_PROCESS_DETACH) {
110 // If the process is already bootstrapped, skip
111 if (IsBootstrappedOnAttach) {
112 return TRUE;
113 }
114
115 // Open transaction
116 DetourTransactionBegin();
117 DetourUpdateThread(GetCurrentThread());
118
119 // Uninstall detours
120 dxgiFactoryDetour.Uninstall();
121 deviceDetour.Uninstall();
122
123 // Commit all transactions
124 if (FAILED(DetourTransactionCommit())) {
125 return FALSE;
126 }
127 }
128
129 // OK
130 return TRUE;

Callers

nothing calls this directly

Calls 3

IsBootstrappedFunction · 0.85
InstallMethod · 0.45
UninstallMethod · 0.45

Tested by

no test coverage detected