[S] worked on NIM frameworks.
This commit is contained in:
47
elinethingz/mic_reg.nim
Normal file
47
elinethingz/mic_reg.nim
Normal file
@@ -0,0 +1,47 @@
|
||||
# ____ _____ ____ ____ _____ _____
|
||||
# / ___|| ____/ ___| _ \| ____|_ _|
|
||||
# \___ \| _|| | | |_) | _| | |
|
||||
# ___) | |__| |___| _ <| |___ | |
|
||||
# |____/|_____\____|_| \_\_____| |_|
|
||||
|
||||
import winim
|
||||
|
||||
# Checks the status of the Windows "Privacy Bubbles" to know if target device has the Windows camera LED enabled.
|
||||
# however, it should be noted that most PC/laptop manufacturers include a hardwired LED that cannot be disabled.
|
||||
# therefore, this program does not guarantee that the user will not know about the observation.
|
||||
|
||||
# DOES NOT WORK.
|
||||
const
|
||||
KEY_QUERY_VALUE = 0x0001
|
||||
HKEY_HANDLE = 0x80000002
|
||||
|
||||
proc checkRegistryEntry(): bool =
|
||||
var hKey: HKEY
|
||||
var value: DWORD
|
||||
var dataSize: DWORD = sizeof(DWORD)
|
||||
|
||||
if RegOpenKeyEx(HKEY_HANDLE, "SOFTWARE\\Microsoft\\OEM\\Device\\Capture", 0, KEY_QUERY_VALUE, addr hKey) != ERROR_SUCCESS:
|
||||
echo "Error opening registry key. Error code:", GetLastError()
|
||||
return false
|
||||
|
||||
if RegGetValueA(HKEY_HANDLE, "NoPhysicalCameraLED", nil, nil, cast(LPBYTE, addr value), addr dataSize) != ERROR_SUCCESS:
|
||||
echo "Error querying registry value. Error code:", GetLastError()
|
||||
|
||||
# Close the registry key even if querying failed
|
||||
RegCloseKey(hKey)
|
||||
|
||||
return false
|
||||
|
||||
# Close the registry key if everything is successful
|
||||
RegCloseKey(hKey)
|
||||
|
||||
echo "NoPhysicalCameraLED value:", value
|
||||
|
||||
return value == 0x1
|
||||
|
||||
# Example usage
|
||||
if checkRegistryEntry():
|
||||
echo "NoPhysicalCameraLED is set to 0x1."
|
||||
else:
|
||||
echo "NoPhysicalCameraLED is not set to 0x1."
|
||||
|
||||
Reference in New Issue
Block a user