Master goodies.

This commit is contained in:
hjozwiak committed 2026-11-02 23:14:16 -05:00
commit b51a08e7cc
13 files changed
+246 -48

No files matched your search

+15 -4
View File
@@ -34,6 +34,7 @@
#include <deque>
#include <iterator>
#include <string>
#include <vector>
namespace {
// Read directly by readers without starting Wine or initializing a prefix.
@@ -1226,12 +1227,22 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, char *, int) {
// exclusions there (or clear any inherited list) so both hook hosts gate
// the same programs. Readers communicate them by argument only.
if (hookExclusions.count) {
std::wstring joined;
// Winelib WCHAR is 16-bit; std::wstring would call the host libc's
// 32-bit wide-string routines. Join with the Windows APIs instead.
std::size_t joinedLength = 0;
for (int index = 0; index < hookExclusions.count; ++index)
joinedLength += lstrlenW(hookExclusions.names[index]) + 1;
std::vector<WCHAR> joined(joinedLength);
joined[0] = 0;
for (int index = 0; index < hookExclusions.count; ++index) {
if (index) joined += L';';
joined += hookExclusions.names[index];
if (index) lstrcatW(joined.data(), L";");
lstrcatW(joined.data(), hookExclusions.names[index]);
}
if (joined.size() >= 32767 ||
!SetEnvironmentVariableW(L"WINE_ACCESS_EXCLUDE_HOOK_PROGRAMS", joined.data())) {
std::fprintf(stderr, "wine-access: cannot configure hook exclusions\n");
return 1;
}
SetEnvironmentVariableW(L"WINE_ACCESS_EXCLUDE_HOOK_PROGRAMS", joined.c_str());
std::fprintf(stderr, "wine-access: hook exclusions for %d program(s)\n", hookExclusions.count);
} else {
SetEnvironmentVariableW(L"WINE_ACCESS_EXCLUDE_HOOK_PROGRAMS", nullptr);