-
Notifications
You must be signed in to change notification settings - Fork 65
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
Create cef-titlebar-enabler.wh.cpp #1326
Conversation
|
||
typedef _cef_window_t* (*cef_window_create_top_level_t)(void* delegate); | ||
cef_window_create_top_level_t cef_window_create_top_level_original; | ||
_cef_window_t* cef_window_create_top_level_hook(void* delegate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calling convention is missing here, which is likely to cause a crash for 32-bit targets. Please add calling conventions or, if the mod doesn't support 32-bit, limit it to 64-bit, which will also make compilation faster. See:
https://github.com/ramensoftware/windhawk/wiki/Development-tips#hooks-and-calling-conventions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mod already worked fine without adding a calling convention there on Spotify 1.1.x (which only had 32-bit releases). As adding a calling convention did not cause any harm, I added it anyway.
However, adding it to cef_panel_create
caused Spotify 1.1.x to crash, so I did not add it there.
Also, as stated in the readme, 32-bit releases of 1.2.x are not supported. I did not figure out how to get it to work on those versions. (This mod simply does nothing on them.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As adding a calling convention did not cause any harm
That's not enough to make sure that the calling convention is correct. If you don't have headers or documentation, you can check the calling convention via assembly. Usually it's either cdecl or stdcall, but there are other calling conventions too, such as fastcall. If you need help with that, you can upload the binary and I'll take a look.
However, adding it to
cef_panel_create
caused Spotify 1.1.x to crash
By not adding a calling convention, you're leaving it up to the compiler to pick one. I'm not sure what's the default that Windhawk's compiler uses, maybe cdecl, but I'd rather not rely on it, as it might change in the future. It's best to specify the calling convention explicitly.
Also, as stated in the readme, 32-bit releases of 1.2.x are not supported.
In this case, how about returning FALSE
for these versions to have an indication the the mod wasn't loaded successfully? It can be something like:
#ifndef _WIN64
if (...1.2.x version...) {
return FALSE;
}
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inspected the binary with IDA and found out those two functions are cdecl. Btw there are no calling conventions defined for those functions in the CEF source code. It seems it's just using the compiler default.
Also found out that I simply missed that struct sizes are different per architecture; now it supports both x86 and x86-64 on all supported versions.
I also added support for more versions and tested all Spotify releases since 1.1.60. Now, there are no unsupported versions between CEF 90.4-132 and Spotify 1.1.60-1.2.52.
Can you please detailize what should be done with Electron? In all my attempts, the window frame is created buggy and gets glitched when the window is partially moved outside of the screen. |
Can you tell me what Electron you are trying to enable native title bars? I have no experience of messing with heavily obfuscated apps though. For Windhawk: F1 -> Open Settings (UI) -> Window -> Title Bar Style -> Native |
* Support and test more versions, now no missed versions between 90.4 and 132 * Support both x86 and x86-64 in all versions * Add calling convention
No description provided.