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

First pull request with several commits to review. #20

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

ozfive
Copy link

@ozfive ozfive commented Mar 4, 2023

Hi this is my first pull request here on Github. I randomly found your deadman application and decided to contribute some work towards it. The commits speak for themselves. Some major things to point out are the support for FreeBSD and adjustments to how USB devices are enumerated as well as direct system calls for the OSs for shutdown operations. If you could verify the functionality for the Operating Systems you do have that would be great!

ozfive added 20 commits March 3, 2023 12:21
…h is a directory, then checks if the extensions on windows are either .exe or .com, if it isn't running on windows check for 0111 file permission bits.
…g the CfgMgr32.dll library, and the return value of CM_Open_Class_Key_ExW is now checked to ensure that the function succeeded in opening the registry key. Additionally, the code now uses syscall.UTF16ToString instead of string to convert the byte slices to strings, as this is a safer way to handle Unicode strings.
…ework. The C library and header are both part of the IOKit framework and are included by specifying -framework IOKit as a linker flag. The enumerateDevices() function opens an I/O Kit registry entry for USB devices, creates a matching dictionary for USB devices, and iterates over USB devices to get their names and IDs. The function then converts the names and IDs to Go strings and adds them to a device list.
…nction. This commit uses MustFindProc to find the ExitWindowsEx function, and then calls it with the appropriate arguments to initiate a forced shutdown. The commit also includes a custom error message using fmt.Errorf function. The function takes two parameters: the first specifies the shutdown operation, and the second specifies the shutdown reason. If ExitWindowsEx returns 0, an error occurred.
…only. The function attempts to call the reboot system call with the LINUX_REBOOT_CMD_POWER_OFF command first and, if that fails, with the LINUX_REBOOT_CMD_HALT command. If both calls fail, the function returns an error.
… using the syscall package. The function first tries to call the Reboot system call with the RB_POWEROFF command, which should initiate an immediate shutdown of the system. If that fails, it tries to call the Reboot system call with the RB_HALT command, which should initiate a system halt. If both of these system calls fail, the function returns an error.
@ozfive ozfive changed the title Please review the commits for further details if I missed any. First pull request with several commits to review. Mar 4, 2023
@flowchartsman
Copy link
Owner

Thanks for the PR, it's about time this repository saw some love. I'll try and get to it this week.

ozfive and others added 3 commits March 7, 2023 08:46
@ozfive
Copy link
Author

ozfive commented Mar 13, 2023

Hey @flowchartsman I just wanted to check in with you to see if you got a chance to look at the changes yet? I know you are probably really busy so understand if you haven't.

Ozfive

@flowchartsman
Copy link
Owner

Not yet, it's... a lot

@ozfive
Copy link
Author

ozfive commented Mar 14, 2023

I'm sorry. :( In the future I will only submit single feature/few commit pull requests. I was just on a roll...

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

Successfully merging this pull request may close these issues.

2 participants