Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure WinSearchChildren=1 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified AutoItX3.dll
Binary file not shown.
44 changes: 25 additions & 19 deletions src/autoit_instance_symbols.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "autoit_instance_symbols.hpp"
#include <iostream>
#include <windows.h>
#include "autoit_instance_symbols.hpp"

#define AUTOIT_LIBRARY_NAME L"AutoItX3_original.dll"
#define countof(xs) (sizeof(xs) / sizeof(*(xs)))
Expand All @@ -10,25 +10,31 @@ DWORD autoit_path_size = 0;
WCHAR autoit_path[MAX_PATH + 1] = {0};

autoit_instance_symbols::autoit_instance_symbols(void) {
if (autoit_loaded) {
GetTempFileNameW(L".", L"ait", 0, this->library_path);
CopyFileW(autoit_path, this->library_path, false);
this->handle = LoadLibraryW(this->library_path);
this->is_library_clone = true;
} else {
this->handle = LoadLibraryW(AUTOIT_LIBRARY_NAME);
autoit_path_size = GetModuleFileNameW(this->handle, autoit_path, countof(autoit_path));
wcscpy_s(this->library_path, countof(this->library_path), autoit_path);
autoit_loaded = true;
}
void __stdcall (*init)(void) = (void __stdcall (*)(void))GetProcAddress(this->handle, "AU3_Init");
init();
#define X(type, name, params...) this->name = (type __stdcall (*)(params))(void*)GetProcAddress(this->handle, #name);
# include "autoit_functions.hpp"
#undef X
if (autoit_loaded) {
GetTempFileNameW(L".", L"ait", 0, this->library_path);
CopyFileW(autoit_path, this->library_path, false);
this->handle = LoadLibraryW(this->library_path);
this->is_library_clone = true;
} else {
this->handle = LoadLibraryW(AUTOIT_LIBRARY_NAME);
autoit_path_size =
GetModuleFileNameW(this->handle, autoit_path, countof(autoit_path));
wcscpy_s(this->library_path, countof(this->library_path), autoit_path);
autoit_loaded = true;
}
void __stdcall (*init)(void) =
(void __stdcall (*)(void))GetProcAddress(this->handle, "AU3_Init");
init();
#define X(type, name, params...) \
this->name = \
(type __stdcall(*)(params))(void *)GetProcAddress(this->handle, #name);
#include "autoit_functions.hpp"
#undef X
this->AU3_AutoItSetOption(L"WinSearchChildren", 1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only actual change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but it has a global impact on our end: with this all functions which match windows (WinWait, WinExists, etc.) will also match nested windows.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can it cause issues with other PMSs ?

}

autoit_instance_symbols::~autoit_instance_symbols(void) {
FreeLibrary(this->handle);
if (this->is_library_clone) DeleteFileW(this->library_path);
FreeLibrary(this->handle);
if (this->is_library_clone)
DeleteFileW(this->library_path);
}