notification-state-ffi
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -8,3 +8,2 @@ /* | ||
import { shouldWindows } from "@xan105/is/assert"; | ||
shouldWindows(); | ||
@@ -11,0 +10,0 @@ |
@@ -8,3 +8,3 @@ /* | ||
import koffi from "koffi"; | ||
import { dlopen, pointer } from "@xan105/ffi/koffi"; | ||
import { dlopen, pointer, alloc } from "@xan105/ffi/koffi"; | ||
import { Failure, errorLookup } from "@xan105/error"; | ||
@@ -30,4 +30,4 @@ import { shouldObj } from "@xan105/is/assert"; | ||
const { NtQueryWnfStateData } = dlopen("ntdll.dll", { | ||
"NtQueryWnfStateData": { | ||
result: "long", //"NTSTATUS" | ||
NtQueryWnfStateData: { | ||
result: "NTSTATUS", | ||
parameters: [ | ||
@@ -69,4 +69,3 @@ pointer(WNF_STATE_NAME), | ||
const bufferSize = koffi.sizeof("DWORD"); | ||
const buffer = Buffer.alloc(bufferSize); | ||
const buffer = alloc("DWORD"); | ||
const status = await NtQueryWnfStateData( | ||
@@ -77,8 +76,8 @@ WNF_SHEL_QUIETHOURS_ACTIVE_PROFILE_CHANGED, | ||
[], | ||
buffer, | ||
[bufferSize] | ||
buffer.pointer, | ||
[buffer.pointer.length] | ||
); | ||
if (status < 0) throw new Failure(...errorLookup(status, "ntstatus")); | ||
const state = koffi.decode(buffer, "DWORD"); | ||
const state = buffer.get(); | ||
return options.translate ? STATES[state] ?? state : state; | ||
@@ -85,0 +84,0 @@ } |
@@ -7,4 +7,3 @@ /* | ||
import koffi from "koffi"; | ||
import { dlopen, pointer } from "@xan105/ffi/koffi"; | ||
import { dlopen, pointer, alloc } from "@xan105/ffi/koffi"; | ||
import { Failure, errorLookup, attempt } from "@xan105/error"; | ||
@@ -15,3 +14,3 @@ import { shouldObj } from "@xan105/is/assert"; | ||
const { SHQueryUserNotificationState } = dlopen("shell32.dll", { | ||
"SHQueryUserNotificationState": { | ||
SHQueryUserNotificationState: { | ||
result: "HRESULT", | ||
@@ -47,7 +46,7 @@ parameters: [ | ||
const pquns = Buffer.alloc(koffi.sizeof("ENUM")); | ||
const hr = await SHQueryUserNotificationState(pquns); | ||
const pquns = alloc("ENUM"); | ||
const hr = await SHQueryUserNotificationState(pquns.pointer); | ||
if (hr < 0) throw new Failure(...errorLookup(hr, "hresult")); | ||
const state = koffi.decode(pquns, "ENUM"); | ||
const state = pquns.get(); | ||
return options.translate ? QUERY_USER_NOTIFICATION_STATE[state] ?? state : state; | ||
@@ -54,0 +53,0 @@ } |
{ | ||
"name": "notification-state-ffi", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Determine whether sending a notification is appropriate", | ||
@@ -57,5 +57,5 @@ "type": "module", | ||
"dependencies": { | ||
"@xan105/error": "^1.5.0", | ||
"@xan105/ffi": "^0.2.0", | ||
"@xan105/is": "^2.8.0", | ||
"@xan105/error": "^1.6.0", | ||
"@xan105/ffi": "^0.4.1", | ||
"@xan105/is": "^2.8.1", | ||
"koffi": "^2.3.4" | ||
@@ -62,0 +62,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
11265
130
+ Added@xan105/ffi@0.4.1(transitive)
- Removed@xan105/ffi@0.2.0(transitive)
Updated@xan105/error@^1.6.0
Updated@xan105/ffi@^0.4.1
Updated@xan105/is@^2.8.1