Code review and fixes.
This commit is contained in:
1 parent
b51a08e7cc
commit
f9aa0dabed
9 files changed
+58
-20
No files matched your search
@@ -1171,6 +1171,7 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, char *, int) {
|
||||
WINE_ACCESS_VERSION, WINE_ACCESS_REVISION, WINE_ACCESS_MODIFIED);
|
||||
bool validReader = true;
|
||||
bool validEndpoint = true;
|
||||
bool validHookExclusions = true;
|
||||
std::string readerPath, readerInterface;
|
||||
bool dialogReaderEnabled = true, controllerEnabled = true;
|
||||
for (int index = 1; index < argumentCount; ++index) {
|
||||
@@ -1180,8 +1181,10 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, char *, int) {
|
||||
}
|
||||
if (lstrcmpW(arguments[index], L"--exclude-hook-program") == 0) {
|
||||
if (++index == argumentCount ||
|
||||
!wine_access_hook_exclusions_add(&hookExclusions, arguments[index]))
|
||||
std::fprintf(stderr, "wine-access: ignoring invalid --exclude-hook-program value\n");
|
||||
!wine_access_hook_exclusions_add(&hookExclusions, arguments[index])) {
|
||||
validHookExclusions = false;
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (lstrcmpW(arguments[index], L"--no-controller") == 0) {
|
||||
@@ -1211,6 +1214,11 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, char *, int) {
|
||||
else { validReader = false; break; }
|
||||
}
|
||||
LocalFree(arguments);
|
||||
if (!validHookExclusions) {
|
||||
std::fprintf(stderr, "wine-access: --exclude-hook-program requires a valid executable basename "
|
||||
"and at most %d unique exclusions\n", WINE_ACCESS_MAX_HOOK_EXCLUSIONS);
|
||||
return 1;
|
||||
}
|
||||
if (!validReader) {
|
||||
std::fprintf(stderr, "wine-access: --reader requires cthulhu or orca\n");
|
||||
return 1;
|
||||
@@ -1235,7 +1243,7 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, char *, int) {
|
||||
std::vector<WCHAR> joined(joinedLength);
|
||||
joined[0] = 0;
|
||||
for (int index = 0; index < hookExclusions.count; ++index) {
|
||||
if (index) lstrcatW(joined.data(), L";");
|
||||
if (index) lstrcatW(joined.data(), L"\n");
|
||||
lstrcatW(joined.data(), hookExclusions.names[index]);
|
||||
}
|
||||
if (joined.size() >= 32767 ||
|
||||
|
||||
Reference in new issue
Block a user