-
-
Save catb0t/68ce6870732fda757546e7688e7df830 to your computer and use it in GitHub Desktop.
winhak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <stdbool.h> | |
/* | |
if path to windows installation is provided then only use that | |
if a path to scan is provided, test all the subfolders for windows installations | |
if a path selected as a windows installation is determined to have the patch applied, | |
*/ | |
// name of Command Prompt | |
#define WH_WIN_CMD_EXE_FNAME "cmd.exe" | |
#define WH_WIN_CMD_EXE_FQPN "/Windows/System32/cmd.exe" | |
// name of Sticky Keys helper | |
#define WH_WIN_SETHC_EXE_FNAME "sethc.exe" | |
#define WH_WIN_SETHC_EXE_FQPN "/Windows/System32/sethc.exe" | |
// name of the backup location of the Sticky Keys helper | |
#define WH_WIN_SETHC_BAK_FNAME WIN_SETHC_EXE_FNAME ## ".old" | |
#define WH_WIN_SETHC_BAK_FQPN WIN_SETHC_EXE_FQPN ## ".old" | |
// move a file | |
bool wh_fmove (const char* const path); | |
// remove a file | |
bool wh_fremove (const char* const path); | |
// perform the setch patch on a Windows installation directory | |
bool wh_do_patch (const char* const win_path); | |
// revert the sethc patch | |
bool wh_undo_patch (const char* const win_path); | |
// perform the setch patch on each Windows installation in the list | |
bool wh_do_patch_each (const char* const * const paths); | |
// revert the patch on each given Windows installation directory | |
bool wh_undo_patch_each (const char* const * const paths); | |
// is path a Windows installation root directory? | |
bool wh_is_win_root (const char* const path); | |
// attempt to automagically patch any Windows installations in /media and /mnt | |
bool wh_try_autopatch (void); | |
// attempt to automagically unpatch Windows roots in /media, /mnt | |
bool wh_try_autounpatch (void); | |
int main(void) { | |
// to do: | |
// rename Windows/System32/sethc.exe -> sethc.exe.old | |
// copy Windows/System32/cmd.exe -> sethc.exe | |
// to undo: | |
// delete Windows/System32/sethc.exe | |
// rename Windows/System32/sethc.exe.old -> sethc.exe | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment