Skip to content

Commit

Permalink
Add dialog error checking and implement blue screen of death
Browse files Browse the repository at this point in the history
  • Loading branch information
eschan145 committed Oct 29, 2024
1 parent 0f629bf commit 175f08e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ __declspec(dllexport) int __stdcall bsod()
NtRaiseHardError(STATUS_ASSERTION_FAILURE, 0, 0, nullptr, 6, &uResp);

return 0;
}
}
27 changes: 27 additions & 0 deletions dieknow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
"""

import ctypes
from ctypes import wintypes

# Button Options
MB_OK = 0x00000000
MB_OKCANCEL = 0x00000001
MB_YESNO = 0x00000004
MB_YESNOCANCEL = 0x00000003
MB_RETRYCANCEL = 0x00000005
MB_ABORTRETRYIGNORE = 0x00000002

# Icon Options
MB_ICONINFORMATION = 0x00000040
MB_ICONEXCLAMATION = 0x00000030
MB_ICONWARNING = MB_ICONEXCLAMATION
MB_ICONERROR = 0x00000010
MB_ICONQUESTION = 0x00000020

# Default Button Options
MB_DEFBUTTON1 = 0x00000000
MB_DEFBUTTON2 = 0x00000100
MB_DEFBUTTON3 = 0x00000200
MB_DEFBUTTON4 = 0x00000300

lib = ctypes.CDLL("./api.dll")

Expand All @@ -10,8 +32,13 @@
lib.get_killed_count.restype = ctypes.c_int
lib.get_executables_in_folder.argtypes = [ctypes.c_char_p]
lib.get_executables_in_folder.restype = ctypes.c_char_p
lib.bsod.restype = ctypes.c_int
lib.dialog.argtypes = [wintypes.LPCWSTR, wintypes.LPCWSTR, wintypes.UINT]
lib.dialog.restype = ctypes.c_int

start_monitoring = lib.start_monitoring
stop_monitoring = lib.stop_monitoring
get_killed_count = lib.get_killed_count
get_executables_in_folder = lib.get_executables_in_folder
bsod = lib.bsod
dialog = lib.dialog
13 changes: 13 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
"""DieKnow main interface.
"""

import os

import dieknow

def main():
"""Main starting point."""

folder_path = b"C:/Program Files/DyKnow/Cloud/7.10.22.9"
if not os.path.exists(folder_path):
dieknow.dialog(
"A DyKnow installation was not able to be found on your device. "
"Ensure %s exists and you have the permissions to access it!"
% folder_path, "FATAL ERROR",
dieknow.MB_ICONERROR
)
exit()

print("DieKnow Shell\n=============")

while True:
Expand All @@ -25,6 +36,8 @@ def main():
executables = dieknow.get_executables_in_folder(folder_path)
print(f"Files in {folder_path.decode()}:")
print(executables.decode())
elif user_input == "bsod":
dieknow.bsod()
elif user_input == "exit":
dieknow.stop_monitoring()
break
Expand Down

0 comments on commit 175f08e

Please sign in to comment.