Skip to content
This repository was archived by the owner on Jan 4, 2025. It is now read-only.

Commit db8925e

Browse files
committed
modify compile option
disable debug output
1 parent 993ee26 commit db8925e

8 files changed

+41
-19
lines changed

Common/Api.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ bool Api::InteractiveIO::OutputToConsole(
152152

153153
auto outputString{std::format(L"{}{}{}", prefixStr, str, additionalStr)};
154154
std::wcout << outputString;
155+
#ifdef _DEBUG
155156
OutputDebugStringW(outputString.c_str());
157+
#endif
156158

157159
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
158160

Common/Utils.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,11 @@ namespace TranslucentFlyouts::Utils
443443
}
444444
else
445445
{
446+
#ifdef _DEBUG
446447
OutputDebugStringW(
447448
std::format(L"distance: {}, bgra: [{}, {}, {}, {}]", distance, b, g, r, a).c_str()
448449
);
450+
#endif
449451
return;
450452
}
451453

TFMain/HookDispatcher.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ namespace TranslucentFlyouts::HookHelper
3636
OffsetStorage::From(imageMapper.GetBaseAddress(), functionAddress),
3737
!moduleHandle ? std::nullopt : std::make_optional(OffsetStorage::From(imageMapper.GetBaseAddress(), moduleHandle))
3838
);
39+
40+
#ifdef _DEBUG
3941
OutputDebugStringW(
4042
std::format(
4143
L"[{}] index: {}, offset stored: {}, {}\n",
@@ -45,6 +47,7 @@ namespace TranslucentFlyouts::HookHelper
4547
hookInfoCache[index].second.has_value() ? std::format(L"{}", hookInfoCache[index].second.value().value) : L"empty"
4648
).c_str()
4749
);
50+
#endif
4851
functionAddress = nullptr;
4952
moduleHandle = nullptr;
5053
};

TFMain/MenuHooks.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,6 @@ BOOL WINAPI MenuHooks::MySetMenuInfo(
104104
if (menuInfo && (menuInfo->fMask & MIM_BACKGROUND) && menuInfo->hbrBack)
105105
{
106106
g_targetModule = callerModule;
107-
{
108-
WCHAR dllName[MAX_PATH + 1]{};
109-
if (GetModuleBaseNameW(GetCurrentProcess(), callerModule, dllName, MAX_PATH))
110-
{
111-
OutputDebugStringW(
112-
std::format(
113-
L"[{}] MySetMenuInfo",
114-
dllName
115-
).c_str()
116-
);
117-
}
118-
}
119107
}
120108

121109
return reinterpret_cast<decltype(&MySetMenuInfo)>(std::get<0>(g_hookTable[reinterpret_cast<PVOID>(callerModule)]))(hMenu, menuInfo);

TFModern/DiagnosticsHandler.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,14 @@ void DiagnosticsHandler::Startup()
264264
}
265265
});
266266

267+
#ifdef _DEBUG
267268
OutputDebugStringW(
268269
std::format(
269270
L"[WUX] Get DispatcherQueue of {}\n",
270271
threadEntry.ThreadId
271272
).c_str()
272273
);
274+
#endif
273275
}
274276
return true;
275277
});
@@ -329,12 +331,14 @@ void DiagnosticsHandler::Startup()
329331
}
330332
});
331333

334+
#ifdef _DEBUG
332335
OutputDebugStringW(
333336
std::format(
334337
L"[MUX] Get DispatcherQueue of {}\n",
335338
threadEntry.ThreadId
336339
).c_str()
337340
);
341+
#endif
338342
}
339343
return true;
340344
});
@@ -358,6 +362,7 @@ void DiagnosticsHandler::OnVisualTreeChanged(IInspectable* element, FrameworkTyp
358362
return;
359363
}
360364

365+
#ifdef _DEBUG
361366
OutputDebugStringW(
362367
std::format(
363368
L"[{}] object {}: [{}]\n",
@@ -366,6 +371,7 @@ void DiagnosticsHandler::OnVisualTreeChanged(IInspectable* element, FrameworkTyp
366371
className.c_str()
367372
).c_str()
368373
);
374+
#endif
369375
}
370376

371377
bool DiagnosticsHandler::IsMUXModule(HMODULE moduleHandle)

TFModern/Framework.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -436,17 +436,31 @@ void CALLBACK Framework::HandleWinEvent(
436436
processId
437437
)
438438
};
439-
if (!HookHelper::GetProcessModule(processHandle.get(), g_currentDllPath))
439+
WCHAR processName[MAX_PATH + 1]{};
440+
GetModuleBaseNameW(processHandle.get(), nullptr, processName, MAX_PATH);
441+
442+
if (
443+
!HookHelper::GetProcessModule(processHandle.get(), g_currentDllPath) &&
444+
(
445+
!_wcsicmp(L"explorer.exe", processName) ||
446+
!_wcsicmp(L"PhotosApp.exe", processName) ||
447+
!_wcsicmp(L"Microsoft.Media.Player.exe", processName) ||
448+
!_wcsicmp(L"StartMenuExperienceHost.exe", processName) ||
449+
!_wcsicmp(L"ShellExperienceHost.exe", processName)
450+
)
451+
)
440452
{
441453
Inject(processHandle.get());
442454

455+
#ifdef _DEBUG
443456
OutputDebugStringW(
444457
std::format(
445458
L"[{}] process: {} injected\n",
446459
processId,
447460
wil::QueryFullProcessImageNameW<std::wstring, MAX_PATH + 1>(processHandle.get()).c_str()
448461
).c_str()
449462
);
463+
#endif
450464
}
451465
}
452466
}

TFModern/Framework.hpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,20 @@ namespace TranslucentFlyouts::Framework
1111
bool disabled{ false };
1212
winrt::Windows::UI::Color darkMode_TintColor{ 255, 32, 32, 32 };
1313
winrt::Windows::UI::Color lightMode_TintColor{ 255, 243, 243, 243 };
14+
float darkMode_TintOpacity{ 0.1f };
15+
float lightMode_TintOpacity{ 0.1f };
16+
float darkMode_LuminosityOpacity{ 0.0f };
17+
float lightMode_LuminosityOpacity{ 0.0f };
18+
float darkMode_Opacity{ 1.0f };
19+
float lightMode_Opacity{ 1.0f };
20+
/*winrt::Windows::UI::Color darkMode_TintColor{ 255, 32, 32, 32 };
21+
winrt::Windows::UI::Color lightMode_TintColor{ 255, 243, 243, 243 };
1422
float darkMode_TintOpacity{ 0.3f };
1523
float lightMode_TintOpacity{ 0.15f };
1624
float darkMode_LuminosityOpacity{ 0.8f };
1725
float lightMode_LuminosityOpacity{ 0.8f };
1826
float darkMode_Opacity{ 1.0f };
19-
float lightMode_Opacity{ 1.0f };
27+
float lightMode_Opacity{ 1.0f };*/
2028
} g_immersiveContext{};
2129
#pragma data_seg()
2230
#pragma comment(linker,"/SECTION:.shared,RWS")
@@ -30,9 +38,6 @@ namespace TranslucentFlyouts::Framework
3038
{
3139
static_cast<DWORD>(element.ActualTheme()) == 1
3240
};
33-
OutputDebugStringW(
34-
std::format(L"isLight: {}, theme: {}\n", isLight, static_cast<DWORD>(element.ActualTheme())).c_str()
35-
);
3641

3742
if constexpr (is_wux_object_v<ElementType>)
3843
{

TFModern/TFModern.vcxproj

+4-2
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@
427427
<LanguageStandard>stdcpplatest</LanguageStandard>
428428
<LanguageStandard_C>stdc17</LanguageStandard_C>
429429
<Optimization>Disabled</Optimization>
430+
<ControlFlowGuard>false</ControlFlowGuard>
430431
</ClCompile>
431432
<Link>
432433
<SubSystem>Windows</SubSystem>
@@ -468,7 +469,7 @@
468469
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
469470
<StringPooling>true</StringPooling>
470471
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
471-
<ControlFlowGuard>Guard</ControlFlowGuard>
472+
<ControlFlowGuard>false</ControlFlowGuard>
472473
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
473474
<FloatingPointModel>Fast</FloatingPointModel>
474475
</ClCompile>
@@ -509,6 +510,7 @@
509510
<LanguageStandard>stdcpplatest</LanguageStandard>
510511
<LanguageStandard_C>stdc17</LanguageStandard_C>
511512
<Optimization>Disabled</Optimization>
513+
<ControlFlowGuard>false</ControlFlowGuard>
512514
</ClCompile>
513515
<Link>
514516
<SubSystem>Windows</SubSystem>
@@ -551,7 +553,7 @@
551553
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
552554
<StringPooling>true</StringPooling>
553555
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
554-
<ControlFlowGuard>Guard</ControlFlowGuard>
556+
<ControlFlowGuard>false</ControlFlowGuard>
555557
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
556558
<FloatingPointModel>Fast</FloatingPointModel>
557559
</ClCompile>

0 commit comments

Comments
 (0)