forked from Hay1tsme/segatools
Add automatically apply OpenSSL patch for Intel Gen 10+ CPUs #43
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "kagaminehaku/segatools:develop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It ensures that only intel cpus of gen 10 or newer will have the OpenSSL patch applied, other cpus are skipped.
Uses user-level environment variables
@ -0,0 +4,4 @@
#include "util/dprintf.h"
#include "platform/opensslpatch.h"
int ChecknPatch(void) {
Please use snake_case instead of camelCase for the function names.
Still camelCase.
@ -0,0 +15,4 @@
if (CheckCpu(cpuname)) {
OpenSSLPatch();
dprintf("OpenSSL Patch applied successfully.\n");
To make it clear where the printed message in the console came from, prefix every string with "OpenSSL Patch:" or similar.
@ -0,0 +17,4 @@
OpenSSLPatch();
dprintf("OpenSSL Patch applied successfully.\n");
} else {
dprintf("Info: OpenSSL Patch is not required (AMD or Intel < 10th gen or older CPU detected).\n");
Please remove that, as this will just clutter the output.
@ -0,0 +87,4 @@
HKEY hKey;
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Environment", 0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS) {
if (RegSetValueExA(hKey, variablename, 0, REG_SZ, (const BYTE*)variablevalue, strlen(variablevalue) + 1) == ERROR_SUCCESS) {
dprintf("Successfully set the user environment variable %s to %s\n", variablename, variablevalue);
I would only keep this print, change it to add that the patch applied successfully and remove the
@ -0,0 +2,4 @@
#include <windows.h>
int ChecknPatch(void);
Only add the function you need to access from outside so in your case only
ChecknPatch()
. All other functions can be static.@ -28,6 +29,8 @@ HRESULT platform_hook_init(
assert(platform_id != NULL);
assert(redir_mod != NULL);
ChecknPatch();
I would rename it to something more descriptive, like
openssl_patch_apply()
.@ -0,0 +66,4 @@
HKEY hKey;
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Environment", 0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS) {
if (RegSetValueExA(hKey, variablename, 0, REG_SZ, (const BYTE*)variablevalue, strlen(variablevalue) + 1) == ERROR_SUCCESS) {
dprintf("OpenSSL Patch: Applied successfully : Set the user environment variable %s to %s\n", variablename, variablevalue);
Either remove the space before " :" or remove it all together as it's redundant in my opinion.
Checkout
From your project repository, check out a new branch and test the changes.