Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

notification-state-ffi

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

notification-state-ffi - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

1

lib/index.js

@@ -8,3 +8,2 @@ /*

import { shouldWindows } from "@xan105/is/assert";
shouldWindows();

@@ -11,0 +10,0 @@

15

lib/win32/ntdll.js

@@ -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 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc