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

win32-def

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

win32-def

win32 definitions for node-ffi

  • 2.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
444
decreased by-60.5%
Maintainers
1
Weekly downloads
 
Created
Source

win32-def

Definitions of Windows Date Types for node-ffi

Version License Build Status Build status Coverage Status

What can I do with this?

Write node-ffi calling win32 native functions code by Typescript with Types support.

Installing

npm install --save win32-def

Usage

// struct usage by ref-struct
import * as Struct from 'ref-struct'
import {DStruct as DS} from 'win32-def';


// https://msdn.microsoft.com/en-us/library/windows/desktop/dd162805(v=vs.85).aspx
const point = new Struct(DS.POINT)();
point.x = 100;
point.y = 200;
console.log(point);
import * as ref from 'ref';
import {K} from 'win32-api';
import {DModel as DM, DTypes as DT} from 'win32-def';


const knl32 = K.load();
const buf  = <DM.FFIBuffer> Buffer.alloc(4);   // ← here the types

buf.writeInt32LE(12345, 0);

// const hInstance =<DT.FFIBuffer> Buffer.alloc(process.arch === 'x64' ? 8 : 4);
const hInstance = <DM.FFIBuffer> ref.alloc(DT.HINSTANCE);    // W.HINSTANCE is 'int64*' under x64, 'int32*' under ia32
knl32.GetModuleHandleExW(0, null, hInstance);

Relevant

License

MIT

Languages

Keywords

FAQs

Package last updated on 12 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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