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

Whatever for does, it returns 1 #2

Open
aeagean opened this issue Jan 7, 2022 · 2 comments
Open

Whatever for does, it returns 1 #2

aeagean opened this issue Jan 7, 2022 · 2 comments

Comments

@aeagean
Copy link

aeagean commented Jan 7, 2022

for (i = v5; ; i = v16)

source code

Finally, 1 will be returned

for (i = v5; ; i = v16)
{
  v15 = GetWindow(i, 4u);
  v16 = v15;
  if (!v15)
	  break;
  
  v14 = GetWindowLongPtrW(v15, -20);
  if ((v14 & 0x40000i64) == 0 && ((v14 & 0x80u) != 0 || (v14 & 0x8000000) != 0))
	  break;
  
  if (!IsWindowVisible(v16) || _sws_GhostWindowFromHungWindow(v16))
	  break;
  
  v5 = v16;
}

return 1; // is BUG?
@valinet
Copy link
Owner

valinet commented Jan 7, 2022

It’s taken directly from the disassembly of some system file (AltTab.dll from Windows 7 if I remember correctly). Might not be optimally written, but it is probably optimized away anyway and it seems to work. What’s the actual problem?

@aeagean
Copy link
Author

aeagean commented Jan 14, 2022

Invalid behavior in the for loop。There is a problem with the code logic。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants