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

Refactor DLL callbacks #665

Merged

Conversation

ASpoonPlaysGames
Copy link
Contributor

cherry-picked and slightly modified from primedev, due to missing earlier commits from primedev

@GeckoEidechse GeckoEidechse added needs testing Changes from the PR still need to be tested needs code review Changes from PR still need to be reviewed in code labels Feb 18, 2024
@github-actions github-actions bot added the merge conflicts Blocked by merge conflicts, waiting on the author to resolve label Jul 10, 2024
@GeckoEidechse

This comment was marked as outdated.

@github-actions github-actions bot removed the merge conflicts Blocked by merge conflicts, waiting on the author to resolve label Aug 14, 2024
@GeckoEidechse
Copy link
Member

@ASpoonPlaysGames just launching the game with this PR should be enough to verify that the PR works1, right?

Footnotes

  1. With the exemption of the Xinput dll of course. That also needs to be verified manually but cannot really do that on Linux I think ^^"

@ASpoonPlaysGames
Copy link
Contributor Author

As far as I know, yeah. Id go into a match just to make sure that everything is loaded and working though personally. Not sure why the xinput dll needs to be checked manually?

@GeckoEidechse
Copy link
Member

GeckoEidechse commented Aug 15, 2024

Not sure why the xinput dll needs to be checked manually?

The last time we had a PR touch it, it accidentally broke the DLL override, meaning the Xinput DLL without ASLR was loaded again. Hence I'd prefer someone double checks that the right DLL is being loaded (don't remember what tool to use for that anymore) just so that we don't accidentally introduce a vulnerability into Northstar again :,)

@barnabwhy
Copy link
Contributor

barnabwhy commented Aug 15, 2024

Not sure why the xinput dll needs to be checked manually?

it needs to be checked that XInput1_3.dll isn't being loaded and that XInput9_1_0.dll is instead just in case that behaviour was broken by this change

wow best me to it gecko 😔

@GeckoEidechse
Copy link
Member

Related 1

Last week, CyberpunkSaveEditor creator PixelRick disclosed that a buffer overflow vulnerability chained with a non-ASLR DLL (xinput1_3.dll) allows specially crafted save games or modifications to perform code execution on a PC.
https://www.bleepingcomputer.com/news/security/cyberpunk-2077-bug-fixed-that-let-malicious-mods-take-over-pcs/

(Not the best source but quickest I could find)

 

Footnotes

  1. mostly putting it here so that I can reference it again in the future

Copy link
Contributor

@barnabwhy barnabwhy left a comment

Choose a reason for hiding this comment

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

works for me, loads xinput 9.1.0 and not 1.3
image

@GeckoEidechse GeckoEidechse removed the needs testing Changes from the PR still need to be tested label Aug 15, 2024
Copy link
Member

@GeckoEidechse GeckoEidechse left a comment

Choose a reason for hiding this comment

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

As per @F1F7Y's comment on Discord (https://discord.com/channels/920776187884732556/936105663942246410/1273620659167297610)

do not merge it
new code forgets to call g_pPluginManager->InformDllLoad
which in the old only some funcs call which is funky imo

@GeckoEidechse GeckoEidechse dismissed their stale review August 15, 2024 13:22

requested change has been addressed

@barnabwhy
Copy link
Contributor

barnabwhy commented Aug 15, 2024

worth noting this pr makes a change to the behaviour when xinput could not be loaded
previously an error message box would show and the game would exit
now there is just a error log and the game is allowed to run as normal

allowing the game to run without xinput will cause the game to silently accept no controller input on computers which for some reason don't have XInput9_1_0.dll in their System32 folder as they normally should
(tested by commenting this line)

imo this change is okay, but maybe in future there can be a more visible signifier to tell the player why the game isn't accepting controller input in order to prevent unnecessary confusion

this is wrong, the game will actually close if it can't find the dll

primedev/windows/libsys.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@barnabwhy barnabwhy left a comment

Choose a reason for hiding this comment

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

everything now looks good to me
load success, game opens fine
image
load fail, error message shows
image

@GeckoEidechse GeckoEidechse added the READY TO MERGE This mergeable right now label Aug 15, 2024
Copy link
Member

@F1F7Y F1F7Y left a comment

Choose a reason for hiding this comment

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

Did not test. I don't think this should break anything, but still left some comments.

Ship it 💯

primedev/windows/libsys.cpp Show resolved Hide resolved
primedev/windows/libsys.cpp Show resolved Hide resolved
@GeckoEidechse GeckoEidechse changed the title Refactor dll callbacks Refactor DLL callbacks Aug 18, 2024
@GeckoEidechse
Copy link
Member

Merging based on reviews.

@GeckoEidechse GeckoEidechse merged commit 5c730b0 into R2Northstar:main Aug 18, 2024
4 checks passed
wolf109909 pushed a commit to R2NorthstarCN/NorthstarLauncher that referenced this pull request Sep 8, 2024
Cherry-picked from primedev and slightly modified

Co-authored-by: F1F7Y <filip.bartos07@proton.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs code review Changes from PR still need to be reviewed in code READY TO MERGE This mergeable right now
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants