├── generator └── main.ts ├── .gitignore ├── api ├── Web │ └── mod.ts ├── Devices │ ├── Enumeration │ │ └── mod.ts │ ├── mod.ts │ ├── DeviceAccess.ts │ └── SerialCommunication.ts ├── Graphics │ ├── Dxgi │ │ └── mod.ts │ ├── Printing │ │ └── mod.ts │ ├── Direct3D │ │ └── mod.ts │ ├── Hlsl.ts │ ├── mod.ts │ ├── Direct3D11on12.ts │ ├── Direct3D9on12.ts │ └── DirectManipulation.ts ├── Media │ ├── DirectShow │ │ ├── mod.ts │ │ └── Xml.ts │ ├── Audio │ │ ├── mod.ts │ │ └── Endpoints.ts │ ├── LibrarySharingServices.ts │ ├── mod.ts │ └── PictureAcquisition.ts ├── Security │ ├── Authorization │ │ └── mod.ts │ ├── Authentication │ │ ├── Identity │ │ │ ├── mod.ts │ │ │ └── Provider.ts │ │ └── mod.ts │ ├── Cryptography │ │ └── mod.ts │ ├── mod.ts │ ├── LicenseProtection.ts │ ├── Tpm.ts │ └── DirectoryServices.ts ├── Storage │ ├── Xps │ │ └── mod.ts │ ├── Packaging │ │ └── mod.ts │ ├── mod.ts │ ├── OperationRecorder.ts │ └── FileHistory.ts ├── UI │ ├── Xaml │ │ └── mod.ts │ ├── Controls │ │ └── mod.ts │ ├── Shell │ │ └── mod.ts │ ├── Input │ │ ├── Radial.ts │ │ ├── mod.ts │ │ └── Ink.ts │ ├── mod.ts │ ├── LegacyWindowsEnvironmentFeatures.ts │ ├── Notifications.ts │ └── Animation.ts ├── System │ ├── Diagnostics │ │ ├── Debug │ │ │ ├── mod.ts │ │ │ └── WebApp.ts │ │ ├── mod.ts │ │ └── Ceip.ts │ ├── Memory │ │ ├── mod.ts │ │ └── NonVolatile.ts │ ├── Performance │ │ └── mod.ts │ ├── WinRT │ │ ├── Graphics │ │ │ ├── mod.ts │ │ │ ├── Capture.ts │ │ │ ├── Imaging.ts │ │ │ └── Direct2D.ts │ │ ├── ML.ts │ │ ├── Media.ts │ │ ├── AllJoyn.ts │ │ ├── Display.ts │ │ ├── Printing.ts │ │ ├── Isolation.ts │ │ ├── Composition.ts │ │ ├── CoreInputView.ts │ │ ├── Holographic.ts │ │ ├── mod.ts │ │ ├── Storage.ts │ │ ├── Direct3D11.ts │ │ └── Xaml.ts │ ├── Com │ │ ├── ChannelCredentials.ts │ │ ├── mod.ts │ │ └── Events.ts │ ├── RemoteAssistance.ts │ ├── AssessmentTool.ts │ ├── DeveloperLicensing.ts │ ├── SetupAndMigration.ts │ ├── TransactionServer.ts │ ├── Mailslots.ts │ ├── CorrelationVector.ts │ ├── MixedReality.ts │ ├── mod.ts │ ├── SecurityCenter.ts │ ├── Recovery.ts │ ├── SettingsManagementInfrastructure.ts │ ├── SubsystemForLinux.ts │ ├── EventNotificationService.ts │ ├── PasswordManagement.ts │ └── Contacts.ts ├── AI │ ├── mod.ts │ └── MachineLearning │ │ └── mod.ts ├── Data │ ├── Xml │ │ └── mod.ts │ └── mod.ts ├── Management │ └── mod.ts ├── Networking │ └── mod.ts ├── mod.ts └── NetworkManagement │ ├── InternetConnectionWizard.ts │ └── mod.ts ├── examples ├── hello_msgbox.ts └── hello_gl.ts ├── winrt ├── winmd │ ├── mod.ts │ ├── dispenser.ts │ ├── scope.ts │ ├── typeid.ts │ ├── field.ts │ ├── parameter.ts │ └── typetuple.ts ├── com │ ├── IMetaDataImport2.ts │ ├── IUnknown.ts │ ├── IInspectable.ts │ └── IMetaDataDispenser.ts ├── rt.ts ├── com.ts └── guid.ts ├── deno.jsonc ├── .github └── workflows │ └── ci.yml ├── error.ts ├── overlapped.ts ├── util.ts └── README.md /generator/main.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | Windows.Win32.winmd 3 | deno.lock -------------------------------------------------------------------------------- /api/Web/mod.ts: -------------------------------------------------------------------------------- 1 | export * as MsHtml from "./MsHtml.ts"; 2 | -------------------------------------------------------------------------------- /api/Devices/Enumeration/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Pnp from "./Pnp.ts"; 2 | -------------------------------------------------------------------------------- /api/Graphics/Dxgi/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Common from "./Common.ts"; 2 | -------------------------------------------------------------------------------- /api/Media/DirectShow/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Xml from "./Xml.ts"; 2 | -------------------------------------------------------------------------------- /api/Security/Authorization/mod.ts: -------------------------------------------------------------------------------- 1 | export * as UI from "./UI.ts"; 2 | -------------------------------------------------------------------------------- /api/Storage/Xps/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Printing from "./Printing.ts"; 2 | -------------------------------------------------------------------------------- /api/UI/Xaml/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Diagnostics from "./Diagnostics.ts"; 2 | -------------------------------------------------------------------------------- /api/System/Diagnostics/Debug/mod.ts: -------------------------------------------------------------------------------- 1 | export * as WebApp from "./WebApp.ts"; 2 | -------------------------------------------------------------------------------- /api/System/Memory/mod.ts: -------------------------------------------------------------------------------- 1 | export * as NonVolatile from "./NonVolatile.ts"; 2 | -------------------------------------------------------------------------------- /api/AI/mod.ts: -------------------------------------------------------------------------------- 1 | export * as MachineLearningApis from "./MachineLearning/mod.ts"; 2 | -------------------------------------------------------------------------------- /api/Graphics/Printing/mod.ts: -------------------------------------------------------------------------------- 1 | export * as PrintTicket from "./PrintTicket.ts"; 2 | -------------------------------------------------------------------------------- /api/Security/Authentication/Identity/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Provider from "./Provider.ts"; 2 | -------------------------------------------------------------------------------- /api/Graphics/Direct3D/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Dxc from "./Dxc.ts"; 2 | export * as Fxc from "./Fxc.ts"; 3 | -------------------------------------------------------------------------------- /api/Data/Xml/mod.ts: -------------------------------------------------------------------------------- 1 | export * as MsXml from "./MsXml.ts"; 2 | export * as XmlLite from "./XmlLite.ts"; 3 | -------------------------------------------------------------------------------- /api/Storage/Packaging/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Opc from "./Opc.ts"; 2 | export * as Appx from "./Appx.ts"; 3 | -------------------------------------------------------------------------------- /api/System/Performance/mod.ts: -------------------------------------------------------------------------------- 1 | export * as HardwareCounterProfiling from "./HardwareCounterProfiling.ts"; 2 | -------------------------------------------------------------------------------- /api/AI/MachineLearning/mod.ts: -------------------------------------------------------------------------------- 1 | export * as WinML from "./WinML.ts"; 2 | export * as DirectML from "./DirectML.ts"; 3 | -------------------------------------------------------------------------------- /api/UI/Controls/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Dialogs from "./Dialogs.ts"; 2 | export * as RichEdit from "./RichEdit.ts"; 3 | -------------------------------------------------------------------------------- /api/Management/mod.ts: -------------------------------------------------------------------------------- 1 | export * as MobileDeviceManagementRegistration from "./MobileDeviceManagementRegistration.ts"; 2 | -------------------------------------------------------------------------------- /api/UI/Shell/mod.ts: -------------------------------------------------------------------------------- 1 | export * as PropertiesSystem from "./PropertiesSystem.ts"; 2 | export * as Common from "./Common.ts"; 3 | -------------------------------------------------------------------------------- /api/Security/Authentication/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Identity from "./Identity.ts"; 2 | export * as IdentityApis from "./Identity/mod.ts"; 3 | -------------------------------------------------------------------------------- /api/Data/mod.ts: -------------------------------------------------------------------------------- 1 | export * as XmlApis from "./Xml/mod.ts"; 2 | export * as HtmlHelp from "./HtmlHelp.ts"; 3 | export * as RightsManagement from "./RightsManagement.ts"; 4 | -------------------------------------------------------------------------------- /api/System/WinRT/Graphics/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Imaging from "./Imaging.ts"; 2 | export * as Capture from "./Capture.ts"; 3 | export * as Direct2D from "./Direct2D.ts"; 4 | -------------------------------------------------------------------------------- /api/Security/Cryptography/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Certificates from "./Certificates.ts"; 2 | export * as UI from "./UI.ts"; 3 | export * as Sip from "./Sip.ts"; 4 | export * as Catalog from "./Catalog.ts"; 5 | -------------------------------------------------------------------------------- /api/System/WinRT/ML.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.ML.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/UI/Input/Radial.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.UI.Input.Radial.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/System/WinRT/Media.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Media.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/Media/DirectShow/Xml.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Media.DirectShow.Xml.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/System/WinRT/AllJoyn.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.AllJoyn.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/System/WinRT/Display.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Display.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/System/WinRT/Printing.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Printing.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/System/WinRT/Isolation.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Isolation.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/System/WinRT/Composition.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Composition.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/System/WinRT/CoreInputView.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.CoreInputView.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/System/WinRT/Holographic.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Holographic.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /examples/hello_msgbox.ts: -------------------------------------------------------------------------------- 1 | import { MB_OKCANCEL, MessageBoxA } from "../api/UI/WindowsAndMessaging.ts"; 2 | 3 | const result = MessageBoxA( 4 | null, 5 | "Hello, world!", 6 | "Hello", 7 | MB_OKCANCEL, 8 | ); 9 | console.log(result); 10 | -------------------------------------------------------------------------------- /api/Media/Audio/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Endpoints from "./Endpoints.ts"; 2 | export * as DirectMusic from "./DirectMusic.ts"; 3 | export * as XAudio2 from "./XAudio2.ts"; 4 | export * as Apo from "./Apo.ts"; 5 | export * as DirectSound from "./DirectSound.ts"; 6 | -------------------------------------------------------------------------------- /api/System/Com/ChannelCredentials.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.Com.ChannelCredentials.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/System/WinRT/Graphics/Capture.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Graphics.Capture.Apis 2 | 3 | import * as util from "../../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/System/WinRT/Graphics/Imaging.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Graphics.Imaging.Apis 2 | 3 | import * as util from "../../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /api/System/Diagnostics/Debug/WebApp.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.Diagnostics.Debug.WebApp.Apis 2 | 3 | import * as util from "../../../../util.ts"; 4 | 5 | // Structs 6 | 7 | // Native Libraries 8 | 9 | // Symbols 10 | 11 | -------------------------------------------------------------------------------- /winrt/winmd/mod.ts: -------------------------------------------------------------------------------- 1 | export * from "./dispenser.ts"; 2 | export * from "./scope.ts"; 3 | export * from "./typedef.ts"; 4 | export * from "./method.ts"; 5 | export * from "./parameter.ts"; 6 | export * from "./typeid.ts"; 7 | export * from "./field.ts"; 8 | export * from "./typetuple.ts"; 9 | -------------------------------------------------------------------------------- /api/System/Diagnostics/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Etw from "./Etw.ts"; 2 | export * as Debug from "./Debug.ts"; 3 | export * as Ceip from "./Ceip.ts"; 4 | export * as ToolHelp from "./ToolHelp.ts"; 5 | export * as DebugApis from "./Debug/mod.ts"; 6 | export * as ProcessSnapshotting from "./ProcessSnapshotting.ts"; 7 | -------------------------------------------------------------------------------- /api/System/Com/mod.ts: -------------------------------------------------------------------------------- 1 | export * as StructuredStorage from "./StructuredStorage.ts"; 2 | export * as ChannelCredentials from "./ChannelCredentials.ts"; 3 | export * as Urlmon from "./Urlmon.ts"; 4 | export * as Events from "./Events.ts"; 5 | export * as CallObj from "./CallObj.ts"; 6 | export * as Marshal from "./Marshal.ts"; 7 | -------------------------------------------------------------------------------- /api/UI/Input/mod.ts: -------------------------------------------------------------------------------- 1 | export * as KeyboardAndMouse from "./KeyboardAndMouse.ts"; 2 | export * as Pointer from "./Pointer.ts"; 3 | export * as Touch from "./Touch.ts"; 4 | export * as XboxController from "./XboxController.ts"; 5 | export * as Ime from "./Ime.ts"; 6 | export * as Radial from "./Radial.ts"; 7 | export * as Ink from "./Ink.ts"; 8 | -------------------------------------------------------------------------------- /winrt/com/IMetaDataImport2.ts: -------------------------------------------------------------------------------- 1 | import { GUID } from "../guid.ts"; 2 | import { IMetaDataImport } from "./IMetaDataImport.ts"; 3 | 4 | export class IMetaDataImport2 extends IMetaDataImport { 5 | static GUID = GUID.fromString("{FCE5EFA0-8BBA-4f8E-A036-8F2022B08466}"); 6 | 7 | [Symbol.for("COMObject.name")]() { 8 | return "IMetaDataImport2"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /api/Graphics/Hlsl.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Graphics.Hlsl.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Constants 6 | export const D3DCOMPILER_DLL = `d3dcompiler_47.dll`; 7 | export const D3DCOMPILE_OPTIMIZATION_LEVEL2 = 49152; 8 | export const D3D_COMPILE_STANDARD_FILE_INCLUDE = 1; 9 | 10 | // Structs 11 | 12 | // Native Libraries 13 | 14 | // Symbols 15 | 16 | -------------------------------------------------------------------------------- /api/UI/Input/Ink.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.UI.Input.Ink.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Enums 6 | export type INK_HIGH_CONTRAST_ADJUSTMENT = number; 7 | 8 | // Constants 9 | export const USE_SYSTEM_COLORS_WHEN_NECESSARY = 0; 10 | export const USE_SYSTEM_COLORS = 1; 11 | export const USE_ORIGINAL_COLORS = 2; 12 | 13 | // Structs 14 | 15 | // Native Libraries 16 | 17 | // Symbols 18 | 19 | -------------------------------------------------------------------------------- /winrt/winmd/dispenser.ts: -------------------------------------------------------------------------------- 1 | import { IMetaDataDispenser } from "../com/IMetaDataDispenser.ts"; 2 | import { IMetaDataImport2 } from "../com/IMetaDataImport2.ts"; 3 | import { Scope } from "./scope.ts"; 4 | 5 | export class MetaDataDispenser { 6 | com: IMetaDataDispenser; 7 | 8 | constructor() { 9 | this.com = IMetaDataDispenser.createInstance(); 10 | } 11 | 12 | openScope(scope: string, flags = 0) { 13 | return new Scope(this.com.OpenScope(scope, flags, IMetaDataImport2)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /api/Media/LibrarySharingServices.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Media.LibrarySharingServices.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type WindowsMediaLibrarySharingDeviceAuthorizationStatus = number; 7 | 8 | // Constants 9 | export const DEVICE_AUTHORIZATION_UNKNOWN = 0; 10 | export const DEVICE_AUTHORIZATION_ALLOWED = 1; 11 | export const DEVICE_AUTHORIZATION_DENIED = 2; 12 | 13 | // Structs 14 | 15 | // Native Libraries 16 | 17 | // Symbols 18 | 19 | -------------------------------------------------------------------------------- /deno.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "tasks": { 3 | "gen": "deno run -A --unstable generator/gen.ts", 4 | "check": "deno check --unstable api/UI/mod.ts" 5 | }, 6 | "fmt": { 7 | "exclude": [ 8 | "api", 9 | "win32_apis.json" 10 | ] 11 | }, 12 | "lint": { 13 | "exclude": [ 14 | "api" 15 | ], 16 | "rules": { 17 | "exclude": [ 18 | "no-inner-declarations", 19 | "no-var", 20 | "no-unused-vars", 21 | "no-explicit-any" 22 | ] 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /api/System/WinRT/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Printing from "./Printing.ts"; 2 | export * as Xaml from "./Xaml.ts"; 3 | export * as Composition from "./Composition.ts"; 4 | export * as AllJoyn from "./AllJoyn.ts"; 5 | export * as Storage from "./Storage.ts"; 6 | export * as ML from "./ML.ts"; 7 | export * as Display from "./Display.ts"; 8 | export * as Pdf from "./Pdf.ts"; 9 | export * as Direct3D11 from "./Direct3D11.ts"; 10 | export * as CoreInputView from "./CoreInputView.ts"; 11 | export * as Holographic from "./Holographic.ts"; 12 | export * as GraphicsApis from "./Graphics/mod.ts"; 13 | export * as Media from "./Media.ts"; 14 | export * as Isolation from "./Isolation.ts"; 15 | -------------------------------------------------------------------------------- /api/System/Diagnostics/Ceip.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.Diagnostics.Ceip.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | export type BOOL = number; 8 | 9 | // Native Libraries 10 | 11 | try { 12 | var libKERNEL32_dll = Deno.dlopen("KERNEL32.dll", { 13 | CeipIsOptedIn: { 14 | parameters: [], 15 | result: "i32", 16 | optional: true, 17 | }, 18 | }).symbols; 19 | } catch(e) { /* ignore */ } 20 | 21 | // Symbols 22 | 23 | export function CeipIsOptedIn(): boolean /* Windows.Win32.Foundation.BOOL */ { 24 | return util.boolFromFfi(libKERNEL32_dll.CeipIsOptedIn!()); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /api/Networking/mod.ts: -------------------------------------------------------------------------------- 1 | export * as WebSocket from "./WebSocket.ts"; 2 | export * as WinInet from "./WinInet.ts"; 3 | export * as WindowsWebServices from "./WindowsWebServices.ts"; 4 | export * as NetworkListManager from "./NetworkListManager.ts"; 5 | export * as ActiveDirectory from "./ActiveDirectory.ts"; 6 | export * as RemoteDifferentialCompression from "./RemoteDifferentialCompression.ts"; 7 | export * as HttpServer from "./HttpServer.ts"; 8 | export * as Ldap from "./Ldap.ts"; 9 | export * as Clustering from "./Clustering.ts"; 10 | export * as WinSock from "./WinSock.ts"; 11 | export * as WinHttp from "./WinHttp.ts"; 12 | export * as BackgroundIntelligentTransferService from "./BackgroundIntelligentTransferService.ts"; 13 | -------------------------------------------------------------------------------- /api/Media/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Multimedia from "./Multimedia.ts"; 2 | export * as DxMediaObjects from "./DxMediaObjects.ts"; 3 | export * as PictureAcquisition from "./PictureAcquisition.ts"; 4 | export * as Speech from "./Speech.ts"; 5 | export * as Audio from "./Audio.ts"; 6 | export * as MediaFoundation from "./MediaFoundation.ts"; 7 | export * as DirectShow from "./DirectShow.ts"; 8 | export * as AudioApis from "./Audio/mod.ts"; 9 | export * as DeviceManager from "./DeviceManager.ts"; 10 | export * as WindowsMediaFormat from "./WindowsMediaFormat.ts"; 11 | export * as LibrarySharingServices from "./LibrarySharingServices.ts"; 12 | export * as KernelStreaming from "./KernelStreaming.ts"; 13 | export * as MediaPlayer from "./MediaPlayer.ts"; 14 | export * as DirectShowApis from "./DirectShow/mod.ts"; 15 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | lint: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Setup repo 14 | uses: actions/checkout@v2 15 | 16 | - name: Setup Deno 17 | uses: denoland/setup-deno@main 18 | with: 19 | deno-version: 'v1.x' 20 | 21 | - name: Check Formatting 22 | run: deno fmt --check 23 | 24 | - name: Lint 25 | run: deno lint 26 | 27 | check: 28 | runs-on: ubuntu-latest 29 | steps: 30 | - name: Setup repo 31 | uses: actions/checkout@v2 32 | 33 | - name: Setup Deno 34 | uses: denoland/setup-deno@main 35 | with: 36 | deno-version: 'v1.x' 37 | 38 | - name: Check 39 | run: deno task check 40 | -------------------------------------------------------------------------------- /api/mod.ts: -------------------------------------------------------------------------------- 1 | export * as UIApis from "./UI/mod.ts"; 2 | export * as NetworkManagementApis from "./NetworkManagement/mod.ts"; 3 | export * as SecurityApis from "./Security/mod.ts"; 4 | export * as WebApis from "./Web/mod.ts"; 5 | export * as NetworkingApis from "./Networking/mod.ts"; 6 | export * as ManagementApis from "./Management/mod.ts"; 7 | export * as StorageApis from "./Storage/mod.ts"; 8 | export * as Globalization from "./Globalization.ts"; 9 | export * as SystemApis from "./System/mod.ts"; 10 | export * as Foundation from "./Foundation.ts"; 11 | export * as Security from "./Security.ts"; 12 | export * as AIApis from "./AI/mod.ts"; 13 | export * as Gaming from "./Gaming.ts"; 14 | export * as GraphicsApis from "./Graphics/mod.ts"; 15 | export * as DataApis from "./Data/mod.ts"; 16 | export * as Media from "./Media.ts"; 17 | export * as DevicesApis from "./Devices/mod.ts"; 18 | export * as MediaApis from "./Media/mod.ts"; 19 | -------------------------------------------------------------------------------- /winrt/rt.ts: -------------------------------------------------------------------------------- 1 | import * as RT from "../api/System/WinRT.ts"; 2 | 3 | RT.RoInitialize(RT.RO_INIT_MULTITHREADED); 4 | 5 | export class HString { 6 | #handle: bigint; 7 | 8 | get handle(): bigint { 9 | return this.#handle; 10 | } 11 | 12 | constructor(handle: bigint) { 13 | this.#handle = handle; 14 | } 15 | 16 | static fromString(str: string) { 17 | const out = new BigUint64Array(1); 18 | RT.WindowsCreateString( 19 | str, 20 | str.length, 21 | new Uint8Array(out.buffer), 22 | ); 23 | return new HString(out[0]); 24 | } 25 | 26 | getRawBuffer(): Uint16Array { 27 | const out = new Uint32Array(1); 28 | const ptr = RT.WindowsGetStringRawBuffer( 29 | this.#handle, 30 | new Uint8Array(out.buffer), 31 | ); 32 | return new Uint16Array( 33 | Deno.UnsafePointerView.getArrayBuffer(Number(ptr), out[0] * 2), 34 | ); 35 | } 36 | 37 | getString(): string { 38 | const buffer = this.getRawBuffer(); 39 | return String.fromCharCode(...buffer); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /api/UI/mod.ts: -------------------------------------------------------------------------------- 1 | export * as TextServices from "./TextServices.ts"; 2 | export * as TabletPC from "./TabletPC.ts"; 3 | export * as Accessibility from "./Accessibility.ts"; 4 | export * as InputApis from "./Input/mod.ts"; 5 | export * as Notifications from "./Notifications.ts"; 6 | export * as ShellApis from "./Shell/mod.ts"; 7 | export * as Input from "./Input.ts"; 8 | export * as LegacyWindowsEnvironmentFeatures from "./LegacyWindowsEnvironmentFeatures.ts"; 9 | export * as Animation from "./Animation.ts"; 10 | export * as ControlsApis from "./Controls/mod.ts"; 11 | export * as XamlApis from "./Xaml/mod.ts"; 12 | export * as HiDpi from "./HiDpi.ts"; 13 | export * as Shell from "./Shell.ts"; 14 | export * as Ribbon from "./Ribbon.ts"; 15 | export * as InteractionContext from "./InteractionContext.ts"; 16 | export * as Magnification from "./Magnification.ts"; 17 | export * as ColorSystem from "./ColorSystem.ts"; 18 | export * as Controls from "./Controls.ts"; 19 | export * as Wpf from "./Wpf.ts"; 20 | export * as WindowsAndMessaging from "./WindowsAndMessaging.ts"; 21 | -------------------------------------------------------------------------------- /api/Security/mod.ts: -------------------------------------------------------------------------------- 1 | export * as ExtensibleAuthenticationProtocol from "./ExtensibleAuthenticationProtocol.ts"; 2 | export * as WinTrust from "./WinTrust.ts"; 3 | export * as CryptographyApis from "./Cryptography/mod.ts"; 4 | export * as Cryptography from "./Cryptography.ts"; 5 | export * as Authorization from "./Authorization.ts"; 6 | export * as Tpm from "./Tpm.ts"; 7 | export * as DiagnosticDataQuery from "./DiagnosticDataQuery.ts"; 8 | export * as ConfigurationSnapin from "./ConfigurationSnapin.ts"; 9 | export * as Credentials from "./Credentials.ts"; 10 | export * as EnterpriseData from "./EnterpriseData.ts"; 11 | export * as DirectoryServices from "./DirectoryServices.ts"; 12 | export * as AuthorizationApis from "./Authorization/mod.ts"; 13 | export * as WinWlx from "./WinWlx.ts"; 14 | export * as LicenseProtection from "./LicenseProtection.ts"; 15 | export * as AuthenticationApis from "./Authentication/mod.ts"; 16 | export * as AppLocker from "./AppLocker.ts"; 17 | export * as NetworkAccessProtection from "./NetworkAccessProtection.ts"; 18 | export * as Isolation from "./Isolation.ts"; 19 | -------------------------------------------------------------------------------- /api/System/WinRT/Graphics/Direct2D.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Graphics.Direct2D.Apis 2 | 3 | import * as util from "../../../../util.ts"; 4 | 5 | // Enums 6 | export type GRAPHICS_EFFECT_PROPERTY_MAPPING = number; 7 | 8 | // Constants 9 | export const GRAPHICS_EFFECT_PROPERTY_MAPPING_UNKNOWN = 0; 10 | export const GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT = 1; 11 | export const GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORX = 2; 12 | export const GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORY = 3; 13 | export const GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORZ = 4; 14 | export const GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORW = 5; 15 | export const GRAPHICS_EFFECT_PROPERTY_MAPPING_RECT_TO_VECTOR4 = 6; 16 | export const GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES = 7; 17 | export const GRAPHICS_EFFECT_PROPERTY_MAPPING_COLORMATRIX_ALPHA_MODE = 8; 18 | export const GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR3 = 9; 19 | export const GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4 = 10; 20 | 21 | // Structs 22 | 23 | // Native Libraries 24 | 25 | // Symbols 26 | 27 | -------------------------------------------------------------------------------- /api/System/RemoteAssistance.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.RemoteAssistance.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type RENDEZVOUS_SESSION_STATE = number; 7 | export type RENDEZVOUS_SESSION_FLAGS = number; 8 | 9 | // Constants 10 | export const DISPID_EVENT_ON_STATE_CHANGED = 5; 11 | export const DISPID_EVENT_ON_TERMINATION = 6; 12 | export const DISPID_EVENT_ON_CONTEXT_DATA = 7; 13 | export const DISPID_EVENT_ON_SEND_ERROR = 8; 14 | export const RSS_UNKNOWN = 0; 15 | export const RSS_READY = 1; 16 | export const RSS_INVITATION = 2; 17 | export const RSS_ACCEPTED = 3; 18 | export const RSS_CONNECTED = 4; 19 | export const RSS_CANCELLED = 5; 20 | export const RSS_DECLINED = 6; 21 | export const RSS_TERMINATED = 7; 22 | export const RSF_NONE = 0; 23 | export const RSF_INVITER = 1; 24 | export const RSF_INVITEE = 2; 25 | export const RSF_ORIGINAL_INVITER = 4; 26 | export const RSF_REMOTE_LEGACYSESSION = 8; 27 | export const RSF_REMOTE_WIN7SESSION = 16; 28 | 29 | // Structs 30 | 31 | // Native Libraries 32 | 33 | // Symbols 34 | 35 | -------------------------------------------------------------------------------- /error.ts: -------------------------------------------------------------------------------- 1 | import { FormatMessageA } from "./api/System/Diagnostics/Debug.ts"; 2 | import { GetLastError } from "./api/Foundation.ts"; 3 | 4 | function FormatMessage(errCode: number): string { 5 | const lpBufferPtr = new BigUint64Array(1); 6 | 7 | FormatMessageA( 8 | 0x00000100 | 0x00001000 | 0x00000200, 9 | null, 10 | errCode, 11 | 0, 12 | new Uint8Array(lpBufferPtr.buffer), 13 | 0, 14 | null, 15 | ) as number; 16 | 17 | const lpBufferView = new Deno.UnsafePointerView( 18 | lpBufferPtr[0], 19 | ); 20 | return lpBufferView.getCString(); 21 | } 22 | 23 | export class Win32Error extends Error { 24 | name = "Win32Error"; 25 | #code: number; 26 | 27 | constructor(code: number) { 28 | super(`${code}: ${FormatMessage(code)}`); 29 | this.#code = code; 30 | } 31 | 32 | get code(): number { 33 | return this.#code; 34 | } 35 | } 36 | 37 | export function unwrap(result: number | boolean) { 38 | if (!result) { 39 | const lastError = GetLastError(); 40 | if (lastError === 0 || lastError === 997) return; 41 | throw new Win32Error(lastError); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /api/NetworkManagement/InternetConnectionWizard.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.NetworkManagement.InternetConnectionWizard.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Constants 6 | export const ICW_REGPATHSETTINGS = `Software\\Microsoft\\Internet Connection Wizard`; 7 | export const ICW_REGKEYCOMPLETED = `Completed`; 8 | export const ICW_MAX_ACCTNAME = 256; 9 | export const ICW_MAX_PASSWORD = 256; 10 | export const ICW_MAX_LOGONNAME = 256; 11 | export const ICW_MAX_SERVERNAME = 64; 12 | export const ICW_MAX_RASNAME = 256; 13 | export const ICW_MAX_EMAILNAME = 64; 14 | export const ICW_MAX_EMAILADDR = 128; 15 | export const ICW_CHECKSTATUS = 1; 16 | export const ICW_LAUNCHFULL = 256; 17 | export const ICW_LAUNCHMANUAL = 512; 18 | export const ICW_USE_SHELLNEXT = 1024; 19 | export const ICW_FULL_SMARTSTART = 2048; 20 | export const ICW_FULLPRESENT = 1; 21 | export const ICW_MANUALPRESENT = 2; 22 | export const ICW_ALREADYRUN = 4; 23 | export const ICW_LAUNCHEDFULL = 256; 24 | export const ICW_LAUNCHEDMANUAL = 512; 25 | export const ICW_USEDEFAULTS = 1; 26 | 27 | // Structs 28 | 29 | // Native Libraries 30 | 31 | // Symbols 32 | 33 | -------------------------------------------------------------------------------- /winrt/winmd/scope.ts: -------------------------------------------------------------------------------- 1 | import { IMetaDataImport2 } from "../com/IMetaDataImport2.ts"; 2 | import { TypeDef } from "./typedef.ts"; 3 | 4 | export class Scope { 5 | #typeDefs = new Array(); 6 | 7 | constructor(public com: IMetaDataImport2) { 8 | this.com = com; 9 | } 10 | 11 | get moduleToken() { 12 | const tok = new Uint32Array(1); 13 | this.com.GetModuleFromScope(tok); 14 | return tok[0]; 15 | } 16 | 17 | get typeDefs() { 18 | if (this.#typeDefs.length === 0) { 19 | const phEnum = new BigUint64Array(1); 20 | const rgTypeDefs = new Uint32Array(1); 21 | const pcTypeDefs = new Uint32Array(1); 22 | 23 | let hr; 24 | 25 | hr = this.com.EnumTypeDefs( 26 | phEnum, 27 | rgTypeDefs, 28 | 1, 29 | pcTypeDefs, 30 | ); 31 | 32 | while (hr === 0) { 33 | this.#typeDefs.push(new TypeDef(this, rgTypeDefs[0])); 34 | hr = this.com.EnumTypeDefs( 35 | phEnum, 36 | rgTypeDefs, 37 | 1, 38 | pcTypeDefs, 39 | ); 40 | } 41 | 42 | this.com.CloseEnum(phEnum[0]); 43 | } 44 | return this.#typeDefs; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /api/Graphics/mod.ts: -------------------------------------------------------------------------------- 1 | export * as Printing from "./Printing.ts"; 2 | export * as Direct3D11on12 from "./Direct3D11on12.ts"; 3 | export * as Imaging from "./Imaging.ts"; 4 | export * as Direct3D12 from "./Direct3D12.ts"; 5 | export * as Direct3D9 from "./Direct3D9.ts"; 6 | export * as Gdi from "./Gdi.ts"; 7 | export * as Hlsl from "./Hlsl.ts"; 8 | export * as Direct3D9on12 from "./Direct3D9on12.ts"; 9 | export * as PrintingApis from "./Printing/mod.ts"; 10 | export * as OpenGL from "./OpenGL.ts"; 11 | export * as DirectDraw from "./DirectDraw.ts"; 12 | export * as DirectComposition from "./DirectComposition.ts"; 13 | export * as CompositionSwapchain from "./CompositionSwapchain.ts"; 14 | export * as Direct2D from "./Direct2D.ts"; 15 | export * as Direct3D from "./Direct3D.ts"; 16 | export * as Dxgi from "./Dxgi.ts"; 17 | export * as DirectWrite from "./DirectWrite.ts"; 18 | export * as Direct3D11 from "./Direct3D11.ts"; 19 | export * as DXCore from "./DXCore.ts"; 20 | export * as DirectManipulation from "./DirectManipulation.ts"; 21 | export * as DxgiApis from "./Dxgi/mod.ts"; 22 | export * as Dwm from "./Dwm.ts"; 23 | export * as Direct3D10 from "./Direct3D10.ts"; 24 | export * as Direct3DApis from "./Direct3D/mod.ts"; 25 | -------------------------------------------------------------------------------- /api/Devices/mod.ts: -------------------------------------------------------------------------------- 1 | export * as WebServicesOnDevices from "./WebServicesOnDevices.ts"; 2 | export * as Usb from "./Usb.ts"; 3 | export * as Tapi from "./Tapi.ts"; 4 | export * as BiometricFramework from "./BiometricFramework.ts"; 5 | export * as FunctionDiscovery from "./FunctionDiscovery.ts"; 6 | export * as Bluetooth from "./Bluetooth.ts"; 7 | export * as AllJoyn from "./AllJoyn.ts"; 8 | export * as EnumerationApis from "./Enumeration/mod.ts"; 9 | export * as Communication from "./Communication.ts"; 10 | export * as DeviceAndDriverInstallation from "./DeviceAndDriverInstallation.ts"; 11 | export * as ImageAcquisition from "./ImageAcquisition.ts"; 12 | export * as Display from "./Display.ts"; 13 | export * as Fax from "./Fax.ts"; 14 | export * as HumanInterfaceDevice from "./HumanInterfaceDevice.ts"; 15 | export * as DeviceAccess from "./DeviceAccess.ts"; 16 | export * as PortableDevices from "./PortableDevices.ts"; 17 | export * as Properties from "./Properties.ts"; 18 | export * as Sensors from "./Sensors.ts"; 19 | export * as Pwm from "./Pwm.ts"; 20 | export * as DeviceQuery from "./DeviceQuery.ts"; 21 | export * as SerialCommunication from "./SerialCommunication.ts"; 22 | export * as Geolocation from "./Geolocation.ts"; 23 | -------------------------------------------------------------------------------- /winrt/com/IUnknown.ts: -------------------------------------------------------------------------------- 1 | import { COMObject } from "../com.ts"; 2 | import { GUID } from "../guid.ts"; 3 | import { unwrap } from "../../util.ts"; 4 | 5 | export class IUnknown extends COMObject { 6 | static GUID = GUID.fromBigInt(0x00000000_0000_0000_c000_000000000046n); 7 | 8 | QueryInterface(type: T): InstanceType { 9 | const fn = this._getFunction( 10 | 0, 11 | { 12 | parameters: ["pointer", "buffer", "buffer"], 13 | result: "isize", 14 | } as const, 15 | ); 16 | const out = new BigUint64Array(1); 17 | unwrap(fn(this._ptr, type.GUID.data, out)); 18 | return new type(out[0]) as InstanceType; 19 | } 20 | 21 | AddRef(): number { 22 | const fn = this._getFunction( 23 | 1, 24 | { 25 | parameters: ["pointer"], 26 | result: "u64", 27 | } as const, 28 | ); 29 | return Number(fn(this._ptr)); 30 | } 31 | 32 | Release(): void { 33 | const fn = this._getFunction( 34 | 2, 35 | { 36 | parameters: ["pointer"], 37 | result: "void", 38 | } as const, 39 | ); 40 | fn(this._ptr); 41 | } 42 | 43 | [Symbol.for("COMObject.name")]() { 44 | return "IUnknown"; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /api/Storage/mod.ts: -------------------------------------------------------------------------------- 1 | export * as PackagingApis from "./Packaging/mod.ts"; 2 | export * as FileHistory from "./FileHistory.ts"; 3 | export * as Jet from "./Jet.ts"; 4 | export * as VirtualDiskService from "./VirtualDiskService.ts"; 5 | export * as IscsiDisc from "./IscsiDisc.ts"; 6 | export * as XpsApis from "./Xps/mod.ts"; 7 | export * as IndexServer from "./IndexServer.ts"; 8 | export * as Vss from "./Vss.ts"; 9 | export * as CloudFilters from "./CloudFilters.ts"; 10 | export * as InstallableFileSystems from "./InstallableFileSystems.ts"; 11 | export * as Imapi from "./Imapi.ts"; 12 | export * as OfflineFiles from "./OfflineFiles.ts"; 13 | export * as FileSystem from "./FileSystem.ts"; 14 | export * as Compression from "./Compression.ts"; 15 | export * as Xps from "./Xps.ts"; 16 | export * as OperationRecorder from "./OperationRecorder.ts"; 17 | export * as DistributedFileSystem from "./DistributedFileSystem.ts"; 18 | export * as FileServerResourceManager from "./FileServerResourceManager.ts"; 19 | export * as ProjectedFileSystem from "./ProjectedFileSystem.ts"; 20 | export * as DataDeduplication from "./DataDeduplication.ts"; 21 | export * as EnhancedStorage from "./EnhancedStorage.ts"; 22 | export * as Vhd from "./Vhd.ts"; 23 | export * as Cabinets from "./Cabinets.ts"; 24 | -------------------------------------------------------------------------------- /api/NetworkManagement/mod.ts: -------------------------------------------------------------------------------- 1 | export * as WindowsFilteringPlatform from "./WindowsFilteringPlatform.ts"; 2 | export * as Dhcp from "./Dhcp.ts"; 3 | export * as NetworkPolicyServer from "./NetworkPolicyServer.ts"; 4 | export * as NetBios from "./NetBios.ts"; 5 | export * as IpHelper from "./IpHelper.ts"; 6 | export * as InternetConnectionWizard from "./InternetConnectionWizard.ts"; 7 | export * as Multicast from "./Multicast.ts"; 8 | export * as Snmp from "./Snmp.ts"; 9 | export * as WindowsNetworkVirtualization from "./WindowsNetworkVirtualization.ts"; 10 | export * as NetShell from "./NetShell.ts"; 11 | export * as WindowsConnectNow from "./WindowsConnectNow.ts"; 12 | export * as WindowsConnectionManager from "./WindowsConnectionManager.ts"; 13 | export * as Rras from "./Rras.ts"; 14 | export * as NetworkDiagnosticsFramework from "./NetworkDiagnosticsFramework.ts"; 15 | export * as WNet from "./WNet.ts"; 16 | export * as MobileBroadband from "./MobileBroadband.ts"; 17 | export * as NetManagement from "./NetManagement.ts"; 18 | export * as QoS from "./QoS.ts"; 19 | export * as P2P from "./P2P.ts"; 20 | export * as Dns from "./Dns.ts"; 21 | export * as WiFi from "./WiFi.ts"; 22 | export * as Ndis from "./Ndis.ts"; 23 | export * as WindowsFirewall from "./WindowsFirewall.ts"; 24 | export * as WebDav from "./WebDav.ts"; 25 | -------------------------------------------------------------------------------- /api/System/WinRT/Storage.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Storage.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Enums 6 | export type HANDLE_OPTIONS = number; 7 | export type HANDLE_ACCESS_OPTIONS = number; 8 | export type HANDLE_SHARING_OPTIONS = number; 9 | export type HANDLE_CREATION_OPTIONS = number; 10 | 11 | // Constants 12 | export const HO_NONE = 0; 13 | export const HO_OPEN_REQUIRING_OPLOCK = 262144; 14 | export const HO_DELETE_ON_CLOSE = 67108864; 15 | export const HO_SEQUENTIAL_SCAN = 134217728; 16 | export const HO_RANDOM_ACCESS = 268435456; 17 | export const HO_NO_BUFFERING = 536870912; 18 | export const HO_OVERLAPPED = 1073741824; 19 | export const HO_WRITE_THROUGH = 2147483648; 20 | export const HAO_NONE = 0; 21 | export const HAO_READ_ATTRIBUTES = 128; 22 | export const HAO_READ = 1179785; 23 | export const HAO_WRITE = 1179926; 24 | export const HAO_DELETE = 65536; 25 | export const HSO_SHARE_NONE = 0; 26 | export const HSO_SHARE_READ = 1; 27 | export const HSO_SHARE_WRITE = 2; 28 | export const HSO_SHARE_DELETE = 4; 29 | export const HCO_CREATE_NEW = 1; 30 | export const HCO_CREATE_ALWAYS = 2; 31 | export const HCO_OPEN_EXISTING = 3; 32 | export const HCO_OPEN_ALWAYS = 4; 33 | export const HCO_TRUNCATE_EXISTING = 5; 34 | 35 | // Structs 36 | 37 | // Native Libraries 38 | 39 | // Symbols 40 | 41 | -------------------------------------------------------------------------------- /api/System/AssessmentTool.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.AssessmentTool.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type WINSAT_OEM_CUSTOMIZATION_STATE = number; 7 | export type WINSAT_ASSESSMENT_STATE = number; 8 | export type WINSAT_ASSESSMENT_TYPE = number; 9 | export type WINSAT_BITMAP_SIZE = number; 10 | 11 | // Constants 12 | export const WINSAT_OEM_DATA_VALID = 0; 13 | export const WINSAT_OEM_DATA_NON_SYS_CONFIG_MATCH = 1; 14 | export const WINSAT_OEM_DATA_INVALID = 2; 15 | export const WINSAT_OEM_NO_DATA_SUPPLIED = 3; 16 | export const WINSAT_ASSESSMENT_STATE_MIN = 0; 17 | export const WINSAT_ASSESSMENT_STATE_UNKNOWN = 0; 18 | export const WINSAT_ASSESSMENT_STATE_VALID = 1; 19 | export const WINSAT_ASSESSMENT_STATE_INCOHERENT_WITH_HARDWARE = 2; 20 | export const WINSAT_ASSESSMENT_STATE_NOT_AVAILABLE = 3; 21 | export const WINSAT_ASSESSMENT_STATE_INVALID = 4; 22 | export const WINSAT_ASSESSMENT_STATE_MAX = 4; 23 | export const WINSAT_ASSESSMENT_MEMORY = 0; 24 | export const WINSAT_ASSESSMENT_CPU = 1; 25 | export const WINSAT_ASSESSMENT_DISK = 2; 26 | export const WINSAT_ASSESSMENT_D3D = 3; 27 | export const WINSAT_ASSESSMENT_GRAPHICS = 4; 28 | export const WINSAT_BITMAP_SIZE_SMALL = 0; 29 | export const WINSAT_BITMAP_SIZE_NORMAL = 1; 30 | 31 | // Structs 32 | 33 | // Native Libraries 34 | 35 | // Symbols 36 | 37 | -------------------------------------------------------------------------------- /api/System/WinRT/Direct3D11.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Direct3D11.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | export type HRESULT = number; 8 | 9 | // Native Libraries 10 | 11 | try { 12 | var libd3d11_dll = Deno.dlopen("d3d11.dll", { 13 | CreateDirect3D11DeviceFromDXGIDevice: { 14 | parameters: ["pointer", "pointer"], 15 | result: "pointer", 16 | optional: true, 17 | }, 18 | CreateDirect3D11SurfaceFromDXGISurface: { 19 | parameters: ["pointer", "pointer"], 20 | result: "pointer", 21 | optional: true, 22 | }, 23 | }).symbols; 24 | } catch(e) { /* ignore */ } 25 | 26 | // Symbols 27 | 28 | export function CreateDirect3D11DeviceFromDXGIDevice( 29 | dxgiDevice: Uint8Array | Deno.PointerValue /* Windows.Win32.Graphics.Dxgi.IDXGIDevice */, 30 | graphicsDevice: Deno.PointerValue | Uint8Array /* ptr */, 31 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 32 | return libd3d11_dll.CreateDirect3D11DeviceFromDXGIDevice!(util.toPointer(dxgiDevice), util.toPointer(graphicsDevice)); 33 | } 34 | 35 | export function CreateDirect3D11SurfaceFromDXGISurface( 36 | dgxiSurface: Uint8Array | Deno.PointerValue /* Windows.Win32.Graphics.Dxgi.IDXGISurface */, 37 | graphicsSurface: Deno.PointerValue | Uint8Array /* ptr */, 38 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 39 | return libd3d11_dll.CreateDirect3D11SurfaceFromDXGISurface!(util.toPointer(dgxiSurface), util.toPointer(graphicsSurface)); 40 | } 41 | 42 | -------------------------------------------------------------------------------- /winrt/winmd/typeid.ts: -------------------------------------------------------------------------------- 1 | import { TypeDef } from "./typedef.ts"; 2 | 3 | export const ELEMENT_TYPE_MAP = { 4 | end: 0x0, 5 | void: 0x1, 6 | bool: 0x2, 7 | char: 0x3, 8 | i8: 0x4, 9 | u8: 0x5, 10 | i16: 0x6, 11 | u16: 0x7, 12 | i32: 0x8, 13 | u32: 0x9, 14 | i64: 0xa, 15 | u64: 0xb, 16 | f32: 0xc, 17 | f64: 0xd, 18 | string: 0xe, 19 | ptr: 0xf, 20 | byref: 0x10, 21 | valuetype: 0x11, 22 | class: 0x12, 23 | var: 0x13, 24 | array: 0x14, 25 | genericinst: 0x15, 26 | typedbyref: 0x16, 27 | isize: 0x18, 28 | usize: 0x19, 29 | fnptr: 0x1b, 30 | object: 0x1c, 31 | szarray: 0x1d, 32 | mvar: 0x1e, 33 | cmode_reqd: 0x1f, 34 | cmode_opt: 0x20, 35 | internal: 0x21, 36 | max: 0x22, 37 | modifier: 0x40, 38 | sentinel: 0x41, 39 | pinned: 0x45, 40 | } as const; 41 | 42 | export type ElementType = keyof typeof ELEMENT_TYPE_MAP; 43 | 44 | export class TypeId { 45 | base!: ElementType; 46 | arrayDimensions?: number[]; 47 | genericParameterSequence?: number; 48 | name?: string; 49 | type?: TypeDef; 50 | typeArg?: TypeId; 51 | 52 | static fromValue(value: number) { 53 | const id = new TypeId(); 54 | id.base = Object.entries(ELEMENT_TYPE_MAP).find((e) => 55 | e[1] === value 56 | )![0] as ElementType; 57 | return id; 58 | } 59 | 60 | toString() { 61 | return `${this.name ? `${this.name}(` : ""}${this.base}${ 62 | this.typeArg ? `<${this.typeArg}>` : "" 63 | }${this.arrayDimensions ? `[${this.arrayDimensions.join(", ")}]` : ""}${ 64 | this.name ? ")" : "" 65 | }`; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /api/System/WinRT/Xaml.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.WinRT.Xaml.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Enums 6 | export type XAML_REFERENCETRACKER_DISCONNECT = number; 7 | 8 | // Constants 9 | export const E_SURFACE_CONTENTS_LOST = 2150301728; 10 | export const XAML_REFERENCETRACKER_DISCONNECT_DEFAULT = 0; 11 | export const XAML_REFERENCETRACKER_DISCONNECT_SUSPEND = 1; 12 | 13 | // Structs 14 | 15 | /** 16 | * Windows.Win32.System.WinRT.Xaml.TrackerHandle__ (size: 8) 17 | */ 18 | export interface TrackerHandle__ { 19 | /** i32 */ 20 | unused: number; 21 | } 22 | 23 | export const sizeofTrackerHandle__ = 8; 24 | 25 | export function allocTrackerHandle__(data?: Partial): Uint8Array { 26 | const buf = new Uint8Array(sizeofTrackerHandle__); 27 | const view = new DataView(buf.buffer); 28 | // 0x00: i32 29 | if (data?.unused !== undefined) view.setInt32(0, Number(data.unused), true); 30 | // 0x04: pad4 31 | return buf; 32 | } 33 | 34 | export class TrackerHandle__View { 35 | private readonly view: DataView; 36 | constructor(private readonly buf: Uint8Array) { 37 | this.view = new DataView(buf.buffer); 38 | } 39 | 40 | get buffer(): Uint8Array { 41 | return this.buf; 42 | } 43 | 44 | // 0x00: i32 45 | get unused(): number { 46 | return this.view.getInt32(0, true); 47 | } 48 | 49 | // 0x04: pad4 50 | 51 | // 0x00: i32 52 | set unused(value: number) { 53 | this.view.setInt32(0, value, true); 54 | } 55 | 56 | // 0x04: pad4 57 | } 58 | 59 | // Native Libraries 60 | 61 | // Symbols 62 | 63 | -------------------------------------------------------------------------------- /api/UI/LegacyWindowsEnvironmentFeatures.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.UI.LegacyWindowsEnvironmentFeatures.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type EMPTY_VOLUME_CACHE_FLAGS = number; 7 | export type RECONCILEF = number; 8 | 9 | // Constants 10 | export const EVCF_HASSETTINGS = 1; 11 | export const EVCF_ENABLEBYDEFAULT = 2; 12 | export const EVCF_REMOVEFROMLIST = 4; 13 | export const EVCF_ENABLEBYDEFAULT_AUTO = 8; 14 | export const EVCF_DONTSHOWIFZERO = 16; 15 | export const EVCF_SETTINGSMODE = 32; 16 | export const EVCF_OUTOFDISKSPACE = 64; 17 | export const EVCF_USERCONSENTOBTAINED = 128; 18 | export const EVCF_SYSTEMAUTORUN = 256; 19 | export const EVCCBF_LASTNOTIFICATION = 1; 20 | export const STATEBITS_FLAT = 1; 21 | export const REC_S_IDIDTHEUPDATES = 292735092470845440n; 22 | export const REC_S_NOTCOMPLETE = 292736191982473217n; 23 | export const REC_S_NOTCOMPLETEBUTPROPAGATE = 292738391005728770n; 24 | export const REC_E_ABORTED = 297239793757327360n; 25 | export const REC_E_NOCALLBACK = 292736194129956865n; 26 | export const REC_E_NORESIDUES = 2810247286318436354n; 27 | export const REC_E_TOODIFFERENT = 4323456829834399747n; 28 | export const REC_E_INEEDTODOTHEUPDATES = 6989671363531509764n; 29 | export const RECONCILEF_MAYBOTHERUSER = 1; 30 | export const RECONCILEF_FEEDBACKWINDOWVALID = 2; 31 | export const RECONCILEF_NORESIDUESOK = 4; 32 | export const RECONCILEF_OMITSELFRESIDUE = 8; 33 | export const RECONCILEF_RESUMERECONCILIATION = 16; 34 | export const RECONCILEF_YOUMAYDOTHEUPDATES = 32; 35 | export const RECONCILEF_ONLYYOUWERECHANGED = 64; 36 | export const ALL_RECONCILE_FLAGS = 127; 37 | 38 | // Structs 39 | 40 | // Native Libraries 41 | 42 | // Symbols 43 | 44 | -------------------------------------------------------------------------------- /api/System/DeveloperLicensing.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.DeveloperLicensing.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Structs 6 | 7 | export type HRESULT = number; 8 | 9 | export type HWND = bigint | number; 10 | 11 | // Native Libraries 12 | 13 | try { 14 | var libWSClient_dll = Deno.dlopen("WSClient.dll", { 15 | CheckDeveloperLicense: { 16 | parameters: ["pointer"], 17 | result: "pointer", 18 | optional: true, 19 | }, 20 | AcquireDeveloperLicense: { 21 | parameters: ["pointer", "pointer"], 22 | result: "pointer", 23 | optional: true, 24 | }, 25 | RemoveDeveloperLicense: { 26 | parameters: ["pointer"], 27 | result: "pointer", 28 | optional: true, 29 | }, 30 | }).symbols; 31 | } catch(e) { /* ignore */ } 32 | 33 | // Symbols 34 | 35 | export function CheckDeveloperLicense( 36 | pExpiration: Deno.PointerValue | Uint8Array /* ptr */, 37 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 38 | return libWSClient_dll.CheckDeveloperLicense!(util.toPointer(pExpiration)); 39 | } 40 | 41 | export function AcquireDeveloperLicense( 42 | hwndParent: Deno.PointerValue /* Windows.Win32.Foundation.HWND */, 43 | pExpiration: Deno.PointerValue | Uint8Array /* ptr */, 44 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 45 | return libWSClient_dll.AcquireDeveloperLicense!((hwndParent), util.toPointer(pExpiration)); 46 | } 47 | 48 | export function RemoveDeveloperLicense( 49 | hwndParent: Deno.PointerValue /* Windows.Win32.Foundation.HWND */, 50 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 51 | return libWSClient_dll.RemoveDeveloperLicense!((hwndParent)); 52 | } 53 | 54 | -------------------------------------------------------------------------------- /winrt/com/IInspectable.ts: -------------------------------------------------------------------------------- 1 | import { GUID } from "../guid.ts"; 2 | import { unwrap } from "../../util.ts"; 3 | import { HString } from "../rt.ts"; 4 | import { IUnknown } from "./IUnknown.ts"; 5 | 6 | export class IInspectable extends IUnknown { 7 | static GUID = GUID.fromBigInt(0xaf86e2e0_b12d_4c6a_9c5a_d7aa65101e90n); 8 | 9 | GetIids(): GUID[] { 10 | const fn = this._getFunction( 11 | 3, 12 | { 13 | parameters: ["pointer", "buffer", "buffer"], 14 | result: "isize", 15 | } as const, 16 | ); 17 | const iids = []; 18 | const outLen = new BigUint64Array(1); 19 | const outPtr = new BigUint64Array(1); 20 | unwrap(fn(this._ptr, outLen, outPtr)); 21 | const view = new Deno.UnsafePointerView(outPtr[0]); 22 | for (let i = 0n; i < outLen[0] * 2n; i += 2n) { 23 | const guid = new Uint8Array(16); 24 | view.copyInto(guid.subarray(0, 8), Number(i * 8n)); 25 | view.copyInto(guid.subarray(8, 16), Number(i + 1n) * 8); 26 | iids.push(new GUID(guid)); 27 | } 28 | return iids; 29 | } 30 | 31 | GetRuntimeClassName(): string { 32 | const fn = this._getFunction( 33 | 4, 34 | { 35 | parameters: ["pointer", "buffer"], 36 | result: "isize", 37 | } as const, 38 | ); 39 | const out = new BigUint64Array(1); 40 | unwrap(fn(this._ptr, out)); 41 | const ptr = out[0]; 42 | return new HString(ptr).getString(); 43 | } 44 | 45 | GetTrustLevel(): number { 46 | const fn = this._getFunction( 47 | 5, 48 | { 49 | parameters: ["pointer", "buffer"], 50 | result: "isize", 51 | } as const, 52 | ); 53 | const out = new Uint32Array(1); 54 | unwrap(fn(this._ptr, out)); 55 | return out[0]; 56 | } 57 | 58 | [Symbol.for("COMObject.name")]() { 59 | return this.GetRuntimeClassName(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /winrt/com/IMetaDataDispenser.ts: -------------------------------------------------------------------------------- 1 | import { GUID, GUIDConvertible } from "../guid.ts"; 2 | import { pwstrToFfi, unwrap } from "../../util.ts"; 3 | import { createInstance } from "../com.ts"; 4 | import { IUnknown } from "./IUnknown.ts"; 5 | 6 | export class IMetaDataDispenser extends IUnknown { 7 | static GUID = GUID.fromString("{809C652E-7396-11D2-9771-00A0C9B4D50C}"); 8 | 9 | DefineScope( 10 | rclsid: GUIDConvertible, 11 | dwOpenFlags: number, 12 | riid: GUIDConvertible, 13 | ppIUnk: BigUint64Array, 14 | ) { 15 | const fn = this._getFunction( 16 | 3, 17 | { 18 | parameters: ["pointer", "buffer", "u32", "buffer", "buffer"], 19 | result: "isize", 20 | } as const, 21 | ); 22 | unwrap( 23 | fn( 24 | this._ptr, 25 | new GUID(rclsid).data, 26 | dwOpenFlags, 27 | new GUID(riid).data, 28 | ppIUnk, 29 | ), 30 | ); 31 | } 32 | 33 | OpenScope( 34 | szScope: string, 35 | dwOpenFlags: number, 36 | riid: I, 37 | ): InstanceType { 38 | const fn = this._getFunction( 39 | 4, 40 | { 41 | parameters: ["pointer", "buffer", "u32", "buffer", "buffer"], 42 | result: "isize", 43 | } as const, 44 | ); 45 | const out = new BigUint64Array(1); 46 | const guid = riid.GUID.data; 47 | const hr = fn( 48 | this._ptr, 49 | pwstrToFfi(szScope), 50 | dwOpenFlags, 51 | guid, 52 | out, 53 | ); 54 | unwrap(hr); 55 | const ptr = out[0]; 56 | return new riid(ptr) as InstanceType; 57 | } 58 | 59 | static createInstance() { 60 | return createInstance( 61 | "{E5CB7A31-7512-11D2-89CE-0080C792E5D8}", 62 | IMetaDataDispenser, 63 | ); 64 | } 65 | 66 | [Symbol.for("COMObject.name")]() { 67 | return "IMetaDataDispenser"; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /winrt/com.ts: -------------------------------------------------------------------------------- 1 | import * as Com from "../api/System/Com.ts"; 2 | import { unwrap } from "../util.ts"; 3 | import { GUID, GUIDConvertible } from "./guid.ts"; 4 | 5 | Com.CoInitializeEx(0, Com.COINIT_MULTITHREADED); 6 | 7 | export class COMObject { 8 | _ptr: Deno.PointerValue; 9 | #vtable?: Deno.UnsafePointerView; 10 | 11 | protected get _vtable() { 12 | if (!this.#vtable) { 13 | const view = new Deno.UnsafePointerView(BigInt(this._ptr)); 14 | const vtable = view.getBigUint64(0); 15 | this.#vtable = new Deno.UnsafePointerView(BigInt(vtable)); 16 | } 17 | return this.#vtable; 18 | } 19 | 20 | constructor(ptr: Deno.PointerValue) { 21 | this._ptr = ptr; 22 | } 23 | 24 | protected _getFunction( 25 | offset: number, 26 | def: Fn, 27 | ): Deno.UnsafeFnPointer["call"] { 28 | const ptr = this._vtable.getBigUint64(offset * 8); 29 | const fnptr = new Deno.UnsafeFnPointer(BigInt(ptr), def); 30 | return (...args: any) => fnptr.call(...args); 31 | } 32 | 33 | [Symbol.for("Deno.customInspect")]() { 34 | const name = (this as any)[Symbol.for("COMObject.name")]?.(); 35 | if (!this._ptr || this._ptr === 0n) { 36 | return `COMObject${name ? `<${name}>` : ""}(nullptr)`; 37 | } 38 | return `COMObject${name ? `<${name}>` : ""}(0x${ 39 | this._ptr.toString(16).padStart(8, "0") 40 | })`; 41 | } 42 | } 43 | 44 | export function createInstance< 45 | I extends { GUID: GUID } & (new (ptr: bigint) => InstanceType), 46 | >( 47 | clsid: GUIDConvertible, 48 | iid: I, 49 | ): InstanceType { 50 | const out = new BigUint64Array(1); 51 | unwrap(Com.CoCreateInstance( 52 | new GUID(clsid).data, 53 | null, 54 | 0x01 | 0x02 | 0x04 | 0x10, 55 | iid.GUID.data, 56 | new Uint8Array(out.buffer), 57 | )); 58 | return new iid(out[0]) as InstanceType; 59 | } 60 | -------------------------------------------------------------------------------- /api/System/SetupAndMigration.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.SetupAndMigration.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Structs 6 | 7 | export type BOOL = number; 8 | 9 | // Native Libraries 10 | 11 | try { 12 | var libKERNEL32_dll = Deno.dlopen("KERNEL32.dll", { 13 | OOBEComplete: { 14 | parameters: ["pointer"], 15 | result: "i32", 16 | optional: true, 17 | }, 18 | RegisterWaitUntilOOBECompleted: { 19 | parameters: ["pointer", "pointer", "pointer"], 20 | result: "i32", 21 | optional: true, 22 | }, 23 | UnregisterWaitUntilOOBECompleted: { 24 | parameters: ["pointer"], 25 | result: "i32", 26 | optional: true, 27 | }, 28 | }).symbols; 29 | } catch(e) { /* ignore */ } 30 | 31 | // Symbols 32 | 33 | export function OOBEComplete( 34 | isOOBEComplete: Deno.PointerValue | Uint8Array /* ptr */, 35 | ): boolean /* Windows.Win32.Foundation.BOOL */ { 36 | return util.boolFromFfi(libKERNEL32_dll.OOBEComplete!(util.toPointer(isOOBEComplete))); 37 | } 38 | 39 | export function RegisterWaitUntilOOBECompleted( 40 | OOBECompletedCallback: Uint8Array | Deno.PointerValue /* Windows.Win32.System.SetupAndMigration.OOBE_COMPLETED_CALLBACK */, 41 | CallbackContext: Deno.PointerValue | Uint8Array /* ptr */, 42 | WaitHandle: Deno.PointerValue | Uint8Array /* ptr */, 43 | ): boolean /* Windows.Win32.Foundation.BOOL */ { 44 | return util.boolFromFfi(libKERNEL32_dll.RegisterWaitUntilOOBECompleted!(util.toPointer(OOBECompletedCallback), util.toPointer(CallbackContext), util.toPointer(WaitHandle))); 45 | } 46 | 47 | export function UnregisterWaitUntilOOBECompleted( 48 | WaitHandle: Deno.PointerValue | Uint8Array /* ptr */, 49 | ): boolean /* Windows.Win32.Foundation.BOOL */ { 50 | return util.boolFromFfi(libKERNEL32_dll.UnregisterWaitUntilOOBECompleted!(util.toPointer(WaitHandle))); 51 | } 52 | 53 | -------------------------------------------------------------------------------- /winrt/guid.ts: -------------------------------------------------------------------------------- 1 | import { CLSIDFromString, StringFromIID } from "../api/System/Com.ts"; 2 | import { unwrap } from "../util.ts"; 3 | 4 | export type GUIDConvertible = 5 | | GUID 6 | | Uint8Array 7 | | bigint 8 | | string 9 | | BigUint64Array; 10 | 11 | export class GUID { 12 | data: Uint8Array; 13 | 14 | constructor(value: GUIDConvertible) { 15 | if (value instanceof GUID) { 16 | this.data = value.data; 17 | } else if (value instanceof Uint8Array) { 18 | this.data = value; 19 | } else if (typeof value === "bigint") { 20 | this.data = GUID.fromBigInt(value).data; 21 | } else if (typeof value === "string") { 22 | this.data = GUID.fromString(value).data; 23 | } else if (value instanceof BigUint64Array) { 24 | if (value[0] === 0n) throw new Error("Invalid GUID pointer"); 25 | const view = new Deno.UnsafePointerView(value[0]); 26 | this.data = new Uint8Array(16); 27 | view.copyInto(this.data); 28 | } else { 29 | throw new Error("Invalid value"); 30 | } 31 | } 32 | 33 | static fromString(value: string) { 34 | const ptr = new Uint8Array(16); 35 | unwrap(CLSIDFromString(value, ptr)); 36 | return new GUID(ptr); 37 | } 38 | 39 | static fromBigInt(value: bigint) { 40 | const data = value.toString(16).padStart(32, "0"); 41 | const inner = `${data.slice(0, 8)}-${data.slice(8, 12)}-${ 42 | data.slice(12, 16) 43 | }-${data.slice(16, 20)}-${data.slice(20, 32)}`; 44 | const str = "{" + inner + "}"; 45 | return this.fromString(str); 46 | } 47 | 48 | toString() { 49 | const ptr = new BigUint64Array(1); 50 | unwrap(StringFromIID(this.data, new Uint8Array(ptr.buffer))); 51 | return String.fromCharCode( 52 | ...new Uint16Array( 53 | Deno.UnsafePointerView.getArrayBuffer(Number(ptr[0]), 38 * 2), 54 | ), 55 | ); 56 | } 57 | 58 | [Symbol.for("Deno.customInspect")]() { 59 | return `GUID { ${this.toString()} }`; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /api/Security/Authentication/Identity/Provider.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Security.Authentication.Identity.Provider.Apis 2 | 3 | import * as util from "../../../../util.ts"; 4 | 5 | // Enums 6 | export type IDENTITY_TYPE = number; 7 | export type IdentityUpdateEvent = number; 8 | export type IDENTITY_URL = number; 9 | export type ACCOUNT_STATE = number; 10 | 11 | // Constants 12 | export const IDENTITY_KEYWORD_ASSOCIATED = `associated`; 13 | export const IDENTITY_KEYWORD_LOCAL = `local`; 14 | export const IDENTITY_KEYWORD_HOMEGROUP = `homegroup`; 15 | export const IDENTITY_KEYWORD_CONNECTED = `connected`; 16 | export const STR_OUT_OF_BOX_EXPERIENCE = `OutOfBoxExperience`; 17 | export const STR_MODERN_SETTINGS_ADD_USER = `ModernSettingsAddUser`; 18 | export const STR_OUT_OF_BOX_UPGRADE_EXPERIENCE = `OutOfBoxUpgradeExperience`; 19 | export const STR_COMPLETE_ACCOUNT = `CompleteAccount`; 20 | export const STR_NTH_USER_FIRST_AUTH = `NthUserFirstAuth`; 21 | export const STR_USER_NAME = `Username`; 22 | export const STR_PROPERTY_STORE = `PropertyStore`; 23 | export const IDENTITIES_ALL = 0; 24 | export const IDENTITIES_ME_ONLY = 1; 25 | export const IDENTITY_ASSOCIATED = 1; 26 | export const IDENTITY_DISASSOCIATED = 2; 27 | export const IDENTITY_CREATED = 4; 28 | export const IDENTITY_IMPORTED = 8; 29 | export const IDENTITY_DELETED = 16; 30 | export const IDENTITY_PROPCHANGED = 32; 31 | export const IDENTITY_CONNECTED = 64; 32 | export const IDENTITY_DISCONNECTED = 128; 33 | export const IDENTITY_URL_CREATE_ACCOUNT_WIZARD = 0; 34 | export const IDENTITY_URL_SIGN_IN_WIZARD = 1; 35 | export const IDENTITY_URL_CHANGE_PASSWORD_WIZARD = 2; 36 | export const IDENTITY_URL_IFEXISTS_WIZARD = 3; 37 | export const IDENTITY_URL_ACCOUNT_SETTINGS = 4; 38 | export const IDENTITY_URL_RESTORE_WIZARD = 5; 39 | export const IDENTITY_URL_CONNECT_WIZARD = 6; 40 | export const NOT_CONNECTED = 0; 41 | export const CONNECTING = 1; 42 | export const CONNECT_COMPLETED = 2; 43 | 44 | // Structs 45 | 46 | // Native Libraries 47 | 48 | // Symbols 49 | 50 | -------------------------------------------------------------------------------- /api/Security/LicenseProtection.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Security.LicenseProtection.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type LicenseProtectionStatus = number; 7 | 8 | // Constants 9 | export const Success = 0; 10 | export const LicenseKeyNotFound = 1; 11 | export const LicenseKeyUnprotected = 2; 12 | export const LicenseKeyCorrupted = 3; 13 | export const LicenseKeyAlreadyExists = 4; 14 | 15 | // Structs 16 | 17 | export type PWSTR = Deno.PointerValue | Uint8Array; 18 | 19 | export type HRESULT = number; 20 | 21 | // Native Libraries 22 | 23 | try { 24 | var liblicenseprotection_dll = Deno.dlopen("licenseprotection.dll", { 25 | RegisterLicenseKeyWithExpiration: { 26 | parameters: ["buffer", "u32", "pointer"], 27 | result: "pointer", 28 | optional: true, 29 | }, 30 | ValidateLicenseKeyProtection: { 31 | parameters: ["buffer", "pointer", "pointer", "pointer"], 32 | result: "pointer", 33 | optional: true, 34 | }, 35 | }).symbols; 36 | } catch(e) { /* ignore */ } 37 | 38 | // Symbols 39 | 40 | export function RegisterLicenseKeyWithExpiration( 41 | licenseKey: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 42 | validityInDays: number /* u32 */, 43 | status: Deno.PointerValue | Uint8Array /* ptr */, 44 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 45 | return liblicenseprotection_dll.RegisterLicenseKeyWithExpiration!(util.pwstrToFfi(licenseKey), validityInDays, util.toPointer(status)); 46 | } 47 | 48 | export function ValidateLicenseKeyProtection( 49 | licenseKey: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 50 | notValidBefore: Deno.PointerValue | Uint8Array /* ptr */, 51 | notValidAfter: Deno.PointerValue | Uint8Array /* ptr */, 52 | status: Deno.PointerValue | Uint8Array /* ptr */, 53 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 54 | return liblicenseprotection_dll.ValidateLicenseKeyProtection!(util.pwstrToFfi(licenseKey), util.toPointer(notValidBefore), util.toPointer(notValidAfter), util.toPointer(status)); 55 | } 56 | 57 | -------------------------------------------------------------------------------- /overlapped.ts: -------------------------------------------------------------------------------- 1 | import { 2 | allocOVERLAPPED, 3 | CancelIoEx, 4 | GetOverlappedResultAsync, 5 | } from "./api/System/IO.ts"; 6 | 7 | export type State = "pending" | "rejected" | "resolved" | "cancelled"; 8 | 9 | export class OverlappedPromise extends Promise { 10 | #inner = allocOVERLAPPED(); 11 | #bytesTransferred = new Uint32Array(1); 12 | #state: State = "pending"; 13 | 14 | get buffer() { 15 | return this.#inner; 16 | } 17 | 18 | get internal() { 19 | return new BigUint64Array(this.#inner.buffer, 0, 1)[0]; 20 | } 21 | 22 | get internalHigh() { 23 | return new Uint32Array(this.#inner.buffer, 8, 1)[0]; 24 | } 25 | 26 | constructor( 27 | hFile: 28 | | Deno.PointerValue 29 | | (( 30 | resolve: (value: number | PromiseLike) => void, 31 | reject: (reason?: any) => void, 32 | ) => void), 33 | signal?: AbortSignal, 34 | ) { 35 | if (typeof hFile === "function") { 36 | super(hFile); 37 | return; 38 | } 39 | let resolve: (value: number) => void; 40 | let reject: (reason: any) => void; 41 | 42 | super((iresolve, ireject) => { 43 | resolve = iresolve; 44 | reject = ireject; 45 | }); 46 | 47 | if (signal) { 48 | signal.addEventListener("abort", () => { 49 | if (this.#state === "pending") { 50 | this.#state = "cancelled"; 51 | CancelIoEx(hFile, this.#inner); 52 | reject(new DOMException("Aborted", "AbortError")); 53 | } 54 | }); 55 | } 56 | const getResult = (): any => 57 | GetOverlappedResultAsync( 58 | hFile, 59 | this.#inner, 60 | new Uint8Array(this.#bytesTransferred.buffer), 61 | true, 62 | ).then((result) => { 63 | if (this.#state === "cancelled") { 64 | return; 65 | } 66 | // why 67 | if (this.internal === 259n) { 68 | return getResult(); 69 | } 70 | if (result) { 71 | this.#state = "resolved"; 72 | resolve(this.internalHigh); 73 | } else { 74 | this.#state = "rejected"; 75 | reject(new Error("GetOverlappedResultAsync failed")); 76 | } 77 | }); 78 | getResult(); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /util.ts: -------------------------------------------------------------------------------- 1 | export function toPointer( 2 | v: Deno.PointerValue | Uint8Array | null, 3 | ): Deno.PointerValue { 4 | if (v === null) { 5 | return null; 6 | } else if ( 7 | typeof v === "object" && Object.getPrototypeOf(v) !== null && 8 | v instanceof Uint8Array 9 | ) { 10 | return Deno.UnsafePointer.of(v); 11 | } else { 12 | return v as Deno.PointerValue; 13 | } 14 | } 15 | 16 | export function pstrToFfi(str: string | Uint8Array | null): Uint8Array | null { 17 | if (str === null) { 18 | return null; 19 | } 20 | if (str instanceof Uint8Array) { 21 | return str; 22 | } 23 | return new TextEncoder().encode(str + "\0"); 24 | } 25 | 26 | export function pstrFromFfi(ptr: Deno.PointerValue): string | null { 27 | if (ptr === null) { 28 | return null; 29 | } 30 | return Deno.UnsafePointerView.getCString(ptr!); 31 | } 32 | 33 | export function pwstrToFfi( 34 | str: string | Uint8Array | Uint16Array | null, 35 | ): Uint8Array | null { 36 | if (str === null) { 37 | return null; 38 | } 39 | if (str instanceof Uint8Array) { 40 | return str; 41 | } 42 | if (str instanceof Uint16Array) { 43 | return new Uint8Array(str.buffer); 44 | } 45 | return new Uint8Array( 46 | new Uint16Array(new TextEncoder().encode(str + "\0")).buffer, 47 | ); 48 | } 49 | 50 | export function pwstrFromFfi(ptr: Deno.PointerValue): string | null { 51 | if (ptr === null) { 52 | return null; 53 | } 54 | let res = ""; 55 | const view = new Deno.UnsafePointerView(ptr); 56 | for (let i = 0;; i += 2) { 57 | const code = view.getUint16(i); 58 | if (code === 0) { 59 | break; 60 | } 61 | res += String.fromCharCode(code); 62 | } 63 | return res; 64 | } 65 | 66 | export function boolToFfi(b: boolean | number): number { 67 | return b ? 1 : 0; 68 | } 69 | 70 | export function boolFromFfi(b: number): boolean { 71 | return b !== 0; 72 | } 73 | 74 | export function unwrap(hr: Deno.PointerValue): Deno.PointerValue { 75 | if (hr !== null) { 76 | throw new Error( 77 | `HRESULT: 0x${ 78 | Deno.UnsafePointer.value(hr).toString(16).padStart(8, "0") 79 | }`, 80 | ); 81 | } 82 | return hr; 83 | } 84 | 85 | export function charToFfi(c: string | number): number { 86 | return typeof c === "number" ? c : c.charCodeAt(0); 87 | } 88 | 89 | export function charFromFfi(c: number): string { 90 | return String.fromCharCode(c); 91 | } 92 | -------------------------------------------------------------------------------- /api/Security/Tpm.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Security.Tpm.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type TPMVSC_ATTESTATION_TYPE = number; 7 | export type TPMVSCMGR_STATUS = number; 8 | export type TPMVSCMGR_ERROR = number; 9 | 10 | // Constants 11 | export const TPMVSC_DEFAULT_ADMIN_ALGORITHM_ID = 130; 12 | export const TPMVSC_ATTESTATION_NONE = 0; 13 | export const TPMVSC_ATTESTATION_AIK_ONLY = 1; 14 | export const TPMVSC_ATTESTATION_AIK_AND_CERTIFICATE = 2; 15 | export const TPMVSCMGR_STATUS_VTPMSMARTCARD_INITIALIZING = 0; 16 | export const TPMVSCMGR_STATUS_VTPMSMARTCARD_CREATING = 1; 17 | export const TPMVSCMGR_STATUS_VTPMSMARTCARD_DESTROYING = 2; 18 | export const TPMVSCMGR_STATUS_VGIDSSIMULATOR_INITIALIZING = 3; 19 | export const TPMVSCMGR_STATUS_VGIDSSIMULATOR_CREATING = 4; 20 | export const TPMVSCMGR_STATUS_VGIDSSIMULATOR_DESTROYING = 5; 21 | export const TPMVSCMGR_STATUS_VREADER_INITIALIZING = 6; 22 | export const TPMVSCMGR_STATUS_VREADER_CREATING = 7; 23 | export const TPMVSCMGR_STATUS_VREADER_DESTROYING = 8; 24 | export const TPMVSCMGR_STATUS_GENERATE_WAITING = 9; 25 | export const TPMVSCMGR_STATUS_GENERATE_AUTHENTICATING = 10; 26 | export const TPMVSCMGR_STATUS_GENERATE_RUNNING = 11; 27 | export const TPMVSCMGR_STATUS_CARD_CREATED = 12; 28 | export const TPMVSCMGR_STATUS_CARD_DESTROYED = 13; 29 | export const TPMVSCMGR_ERROR_IMPERSONATION = 0; 30 | export const TPMVSCMGR_ERROR_PIN_COMPLEXITY = 1; 31 | export const TPMVSCMGR_ERROR_READER_COUNT_LIMIT = 2; 32 | export const TPMVSCMGR_ERROR_TERMINAL_SERVICES_SESSION = 3; 33 | export const TPMVSCMGR_ERROR_VTPMSMARTCARD_INITIALIZE = 4; 34 | export const TPMVSCMGR_ERROR_VTPMSMARTCARD_CREATE = 5; 35 | export const TPMVSCMGR_ERROR_VTPMSMARTCARD_DESTROY = 6; 36 | export const TPMVSCMGR_ERROR_VGIDSSIMULATOR_INITIALIZE = 7; 37 | export const TPMVSCMGR_ERROR_VGIDSSIMULATOR_CREATE = 8; 38 | export const TPMVSCMGR_ERROR_VGIDSSIMULATOR_DESTROY = 9; 39 | export const TPMVSCMGR_ERROR_VGIDSSIMULATOR_WRITE_PROPERTY = 10; 40 | export const TPMVSCMGR_ERROR_VGIDSSIMULATOR_READ_PROPERTY = 11; 41 | export const TPMVSCMGR_ERROR_VREADER_INITIALIZE = 12; 42 | export const TPMVSCMGR_ERROR_VREADER_CREATE = 13; 43 | export const TPMVSCMGR_ERROR_VREADER_DESTROY = 14; 44 | export const TPMVSCMGR_ERROR_GENERATE_LOCATE_READER = 15; 45 | export const TPMVSCMGR_ERROR_GENERATE_FILESYSTEM = 16; 46 | export const TPMVSCMGR_ERROR_CARD_CREATE = 17; 47 | export const TPMVSCMGR_ERROR_CARD_DESTROY = 18; 48 | 49 | // Structs 50 | 51 | // Native Libraries 52 | 53 | // Symbols 54 | 55 | -------------------------------------------------------------------------------- /api/UI/Notifications.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.UI.Notifications.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Structs 6 | 7 | export type PWSTR = Deno.PointerValue | Uint8Array; 8 | 9 | /** 10 | * Windows.Win32.UI.Notifications.NOTIFICATION_USER_INPUT_DATA (size: 16) 11 | */ 12 | export interface NOTIFICATION_USER_INPUT_DATA { 13 | /** Windows.Win32.Foundation.PWSTR */ 14 | Key: string | null | Uint8Array | Uint16Array; 15 | /** Windows.Win32.Foundation.PWSTR */ 16 | Value: string | null | Uint8Array | Uint16Array; 17 | } 18 | 19 | export const sizeofNOTIFICATION_USER_INPUT_DATA = 16; 20 | 21 | export function allocNOTIFICATION_USER_INPUT_DATA(data?: Partial): Uint8Array { 22 | const buf = new Uint8Array(sizeofNOTIFICATION_USER_INPUT_DATA); 23 | const view = new DataView(buf.buffer); 24 | // 0x00: buffer 25 | if (data?.Key !== undefined) { 26 | (buf as any)._f0 = util.pwstrToFfi(data.Key); 27 | view.setBigUint64(0, (buf as any)._f0 === null ? 0n : BigInt(Deno.UnsafePointer.value(Deno.UnsafePointer.of((buf as any)._f0))), true); 28 | } 29 | // 0x08: buffer 30 | if (data?.Value !== undefined) { 31 | (buf as any)._f8 = util.pwstrToFfi(data.Value); 32 | view.setBigUint64(8, (buf as any)._f8 === null ? 0n : BigInt(Deno.UnsafePointer.value(Deno.UnsafePointer.of((buf as any)._f8))), true); 33 | } 34 | return buf; 35 | } 36 | 37 | export class NOTIFICATION_USER_INPUT_DATAView { 38 | private readonly view: DataView; 39 | constructor(private readonly buf: Uint8Array) { 40 | this.view = new DataView(buf.buffer); 41 | } 42 | 43 | get buffer(): Uint8Array { 44 | return this.buf; 45 | } 46 | 47 | // 0x00: buffer 48 | get Key(): Uint8Array | Deno.PointerValue { 49 | const ptr = this.view.getBigUint64(0, true); 50 | return Deno.UnsafePointer.create(ptr); 51 | } 52 | 53 | // 0x08: buffer 54 | get Value(): Uint8Array | Deno.PointerValue { 55 | const ptr = this.view.getBigUint64(8, true); 56 | return Deno.UnsafePointer.create(ptr); 57 | } 58 | 59 | // 0x00: buffer 60 | set Key(value: Uint8Array | Deno.PointerValue) { 61 | (this.buf as any)._f0 = value; 62 | this.view.setBigUint64(0, BigInt(Deno.UnsafePointer.value(util.toPointer((this.buf as any)._f0))), true); 63 | } 64 | 65 | // 0x08: buffer 66 | set Value(value: Uint8Array | Deno.PointerValue) { 67 | (this.buf as any)._f8 = value; 68 | this.view.setBigUint64(8, BigInt(Deno.UnsafePointer.value(util.toPointer((this.buf as any)._f8))), true); 69 | } 70 | } 71 | 72 | // Native Libraries 73 | 74 | // Symbols 75 | 76 | -------------------------------------------------------------------------------- /api/Devices/DeviceAccess.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Devices.DeviceAccess.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Constants 6 | export const ED_BASE = 4096; 7 | export const DEV_PORT_SIM = 1; 8 | export const DEV_PORT_COM1 = 2; 9 | export const DEV_PORT_COM2 = 3; 10 | export const DEV_PORT_COM3 = 4; 11 | export const DEV_PORT_COM4 = 5; 12 | export const DEV_PORT_DIAQ = 6; 13 | export const DEV_PORT_ARTI = 7; 14 | export const DEV_PORT_1394 = 8; 15 | export const DEV_PORT_USB = 9; 16 | export const DEV_PORT_MIN = 1; 17 | export const DEV_PORT_MAX = 9; 18 | export const ED_TOP = 1; 19 | export const ED_MIDDLE = 2; 20 | export const ED_BOTTOM = 4; 21 | export const ED_LEFT = 256; 22 | export const ED_CENTER = 512; 23 | export const ED_RIGHT = 1024; 24 | export const ED_AUDIO_ALL = 268435456; 25 | export const ED_AUDIO_1 = 1; 26 | export const ED_AUDIO_2 = 2; 27 | export const ED_AUDIO_3 = 4; 28 | export const ED_AUDIO_4 = 8; 29 | export const ED_AUDIO_5 = 16; 30 | export const ED_AUDIO_6 = 32; 31 | export const ED_AUDIO_7 = 64; 32 | export const ED_AUDIO_8 = 128; 33 | export const ED_AUDIO_9 = 256; 34 | export const ED_AUDIO_10 = 512; 35 | export const ED_AUDIO_11 = 1024; 36 | export const ED_AUDIO_12 = 2048; 37 | export const ED_AUDIO_13 = 4096; 38 | export const ED_AUDIO_14 = 8192; 39 | export const ED_AUDIO_15 = 16384; 40 | export const ED_AUDIO_16 = 32768; 41 | export const ED_AUDIO_17 = 65536; 42 | export const ED_AUDIO_18 = 131072; 43 | export const ED_AUDIO_19 = 262144; 44 | export const ED_AUDIO_20 = 524288; 45 | export const ED_AUDIO_21 = 1048576; 46 | export const ED_AUDIO_22 = 2097152; 47 | export const ED_AUDIO_23 = 4194304; 48 | export const ED_AUDIO_24 = 8388608; 49 | export const ED_VIDEO = 33554432; 50 | 51 | // Structs 52 | 53 | export type PWSTR = Deno.PointerValue | Uint8Array; 54 | 55 | export type HRESULT = number; 56 | 57 | // Native Libraries 58 | 59 | try { 60 | var libdeviceaccess_dll = Deno.dlopen("deviceaccess.dll", { 61 | CreateDeviceAccessInstance: { 62 | parameters: ["buffer", "u32", "pointer"], 63 | result: "pointer", 64 | optional: true, 65 | }, 66 | }).symbols; 67 | } catch(e) { /* ignore */ } 68 | 69 | // Symbols 70 | 71 | export function CreateDeviceAccessInstance( 72 | deviceInterfacePath: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 73 | desiredAccess: number /* u32 */, 74 | createAsync: Deno.PointerValue | Uint8Array /* ptr */, 75 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 76 | return libdeviceaccess_dll.CreateDeviceAccessInstance!(util.pwstrToFfi(deviceInterfacePath), desiredAccess, util.toPointer(createAsync)); 77 | } 78 | 79 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deno Win32 2 | 3 | [![Tags](https://img.shields.io/github/release/DjDeveloperr/deno_win32)](https://github.com/DjDeveloperr/deno_win32/releases) 4 | [![Checks](https://github.com/DjDeveloperr/deno_win32/actions/workflows/ci.yml/badge.svg)](https://github.com/DjDeveloperr/deno_win32/actions/workflows/ci.yml) 5 | [![License](https://img.shields.io/github/license/DjDeveloperr/deno_win32)](https://github.com/DjDeveloperr/deno_win32/blob/master/LICENSE) 6 | [![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/DjDeveloperr) 7 | 8 | Fast and complete Win32 API bindings for Deno using FFI. 9 | 10 | ## Example 11 | 12 | ```ts 13 | import { 14 | MB_OKCANCEL, 15 | MessageBoxA, 16 | } from "https://win32.deno.dev/0.4.1/UI.WindowsAndMessaging"; 17 | 18 | const result = MessageBoxA( 19 | null, 20 | "Hello, world!", 21 | "Hello", 22 | MB_OKCANCEL, 23 | ); // 1 (OK) or 2 (Cancel) 24 | ``` 25 | 26 | More in `examples/` such as demonstrating OpenGL API usage. 27 | 28 | ## Usage 29 | 30 | You need to pass `--allow-ffi` and `--unstable` flags in order to access the 31 | Win32 API. 32 | 33 | ```sh 34 | deno run --allow-ffi --unstable 35 | ``` 36 | 37 | Note: It is highly recommended to import only APIs you need. Do not import from 38 | `mod.ts` as it will import all sub modules which you might not even need. WinAPI 39 | is huge, so are the bindings. 40 | 41 | ## Documentation 42 | 43 | It is recommened to read the official documentation of 44 | [Win32 API](https://learn.microsoft.com/en-us/windows/win32/api/). 45 | 46 | APIs almost map 1:1 with the official ones, just certain types have to be 47 | transformed to be sent into C-land like `string` is first converted into 48 | null-terminated string depending on the argument (PSTR or PWSTR). 49 | 50 | Constants are exported as-is. Structs are defined as interfaces with 51 | corresponding JS types in fields. We also export a helper function 52 | `alloc${STRUCT}` which accepts `Partial<${STRUCT}>` to create a new struct and 53 | return its buffer as `Uint8Array`. A constant called `sizeof${camelCasedStruct}` 54 | is exported which is the size of the struct in bytes. 55 | 56 | Some APIs have been (manually) marked as Async capable which adds a 57 | `${name}Async` variant of the function along with original one which runs on a 58 | different thread natively and returns a promise. If you want any other API to be 59 | Async capable, please open an issue or a PR. Note that Async calls cannot go 60 | through v8 fastapi path, so they have more overhead than normal ones. 61 | 62 | ## Contributing 63 | 64 | Code is formatted using `deno fmt` and linted using `deno lint`. Please make 65 | sure to run these commands before committing. 66 | 67 | ## License 68 | 69 | Apache-2.0. Check [LICENSE](LICENSE) for more details. 70 | 71 | Copyright 2022-2023 © DjDeveloperr 72 | -------------------------------------------------------------------------------- /api/System/TransactionServer.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.TransactionServer.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type MTSPackageInstallOptions = number; 7 | export type MTSPackageExportOptions = number; 8 | export type MTSAdminErrorCodes = number; 9 | 10 | // Constants 11 | export const mtsInstallUsers = 1; 12 | export const mtsExportUsers = 1; 13 | export const mtsErrObjectErrors = `-2146368511`; 14 | export const mtsErrObjectInvalid = `-2146368510`; 15 | export const mtsErrKeyMissing = `-2146368509`; 16 | export const mtsErrAlreadyInstalled = `-2146368508`; 17 | export const mtsErrDownloadFailed = `-2146368507`; 18 | export const mtsErrPDFWriteFail = `-2146368505`; 19 | export const mtsErrPDFReadFail = `-2146368504`; 20 | export const mtsErrPDFVersion = `-2146368503`; 21 | export const mtsErrCoReqCompInstalled = `-2146368496`; 22 | export const mtsErrBadPath = `-2146368502`; 23 | export const mtsErrPackageExists = `-2146368501`; 24 | export const mtsErrRoleExists = `-2146368500`; 25 | export const mtsErrCantCopyFile = `-2146368499`; 26 | export const mtsErrNoTypeLib = `-2146368498`; 27 | export const mtsErrNoUser = `-2146368497`; 28 | export const mtsErrInvalidUserids = `-2146368496`; 29 | export const mtsErrNoRegistryCLSID = `-2146368495`; 30 | export const mtsErrBadRegistryProgID = `-2146368494`; 31 | export const mtsErrAuthenticationLevel = `-2146368493`; 32 | export const mtsErrUserPasswdNotValid = `-2146368492`; 33 | export const mtsErrNoRegistryRead = `-2146368491`; 34 | export const mtsErrNoRegistryWrite = `-2146368490`; 35 | export const mtsErrNoRegistryRepair = `-2146368489`; 36 | export const mtsErrCLSIDOrIIDMismatch = `-2146368488`; 37 | export const mtsErrRemoteInterface = `-2146368487`; 38 | export const mtsErrDllRegisterServer = `-2146368486`; 39 | export const mtsErrNoServerShare = `-2146368485`; 40 | export const mtsErrNoAccessToUNC = `-2146368484`; 41 | export const mtsErrDllLoadFailed = `-2146368483`; 42 | export const mtsErrBadRegistryLibID = `-2146368482`; 43 | export const mtsErrPackDirNotFound = `-2146368481`; 44 | export const mtsErrTreatAs = `-2146368480`; 45 | export const mtsErrBadForward = `-2146368479`; 46 | export const mtsErrBadIID = `-2146368478`; 47 | export const mtsErrRegistrarFailed = `-2146368477`; 48 | export const mtsErrCompFileDoesNotExist = `-2146368476`; 49 | export const mtsErrCompFileLoadDLLFail = `-2146368475`; 50 | export const mtsErrCompFileGetClassObj = `-2146368474`; 51 | export const mtsErrCompFileClassNotAvail = `-2146368473`; 52 | export const mtsErrCompFileBadTLB = `-2146368472`; 53 | export const mtsErrCompFileNotInstallable = `-2146368471`; 54 | export const mtsErrNotChangeable = `-2146368470`; 55 | export const mtsErrNotDeletable = `-2146368469`; 56 | export const mtsErrSession = `-2146368468`; 57 | export const mtsErrCompFileNoRegistrar = `-2146368460`; 58 | 59 | // Structs 60 | 61 | // Native Libraries 62 | 63 | // Symbols 64 | 65 | -------------------------------------------------------------------------------- /winrt/winmd/field.ts: -------------------------------------------------------------------------------- 1 | import { Scope } from "./scope.ts"; 2 | import { TypeDef } from "./typedef.ts"; 3 | import { TypeTuple } from "./typetuple.ts"; 4 | 5 | export class Field { 6 | #initialized = false; 7 | #name = ""; 8 | #type!: TypeDef; 9 | #attr = 0; 10 | #sig!: Uint8Array; 11 | #cPlusTypeFlag = 0; 12 | #pValue!: bigint; 13 | #cchValue!: number; 14 | 15 | constructor(public scope: Scope, public token: number) {} 16 | 17 | #initialize() { 18 | if (!this.#initialized) { 19 | const szField = new Uint16Array(256); 20 | const pchField = new Uint32Array(1); 21 | const pdwAttr = new Uint32Array(1); 22 | const ppvSigBlob = new BigUint64Array(1); 23 | const pcbSigBlob = new Uint32Array(1); 24 | const ptkTypeDef = new Uint32Array(1); 25 | const ppValue = new BigUint64Array(1); 26 | const pcchValue = new Uint32Array(1); 27 | const pdwCPlusTypeFlag = new Uint32Array(1); 28 | 29 | const hr = this.scope.com.GetFieldProps( 30 | this.token, 31 | ptkTypeDef, 32 | szField, 33 | szField.length, 34 | pchField, 35 | pdwAttr, 36 | ppvSigBlob, 37 | pcbSigBlob, 38 | pdwCPlusTypeFlag, 39 | ppValue, 40 | pcchValue, 41 | ); 42 | 43 | if (hr === 0) { 44 | this.#name = new TextDecoder("utf-16le").decode( 45 | szField.subarray(0, szField.indexOf(0)), 46 | ); 47 | this.#attr = pdwAttr[0]; 48 | this.#cPlusTypeFlag = pdwCPlusTypeFlag[0]; 49 | this.#sig = new Uint8Array(Number(pcbSigBlob[0])); 50 | new Deno.UnsafePointerView(ppvSigBlob[0]) 51 | .copyInto( 52 | this.#sig, 53 | ); 54 | this.#type = new TypeDef(this.scope, ptkTypeDef[0]); 55 | this.#pValue = ppValue[0]; 56 | this.#cchValue = pcchValue[0]; 57 | 58 | this.#initialized = true; 59 | } 60 | } 61 | } 62 | 63 | get name() { 64 | this.#initialize(); 65 | return this.#name; 66 | } 67 | 68 | get attr() { 69 | this.#initialize(); 70 | return this.#attr; 71 | } 72 | 73 | get sig() { 74 | this.#initialize(); 75 | return this.#sig; 76 | } 77 | 78 | get type() { 79 | this.#initialize(); 80 | return new TypeTuple(this.scope, this.#sig.subarray(1)).type; 81 | } 82 | 83 | get cPlusTypeFlag() { 84 | this.#initialize(); 85 | return this.#cPlusTypeFlag; 86 | } 87 | 88 | get pValue() { 89 | this.#initialize(); 90 | return this.#pValue; 91 | } 92 | 93 | get cchValue() { 94 | this.#initialize(); 95 | return this.#cchValue; 96 | } 97 | 98 | get isStatic() { 99 | return (this.#attr & 0x0010) !== 0; 100 | } 101 | 102 | [Symbol.for("Deno.customInspect")]() { 103 | return `Field(${this.name}: ${Deno.inspect(this.type)})`; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /api/System/Mailslots.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.Mailslots.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Structs 6 | 7 | export type PSTR = Deno.PointerValue | Uint8Array; 8 | 9 | export type HANDLE = bigint | number; 10 | 11 | export type PWSTR = Deno.PointerValue | Uint8Array; 12 | 13 | export type BOOL = number; 14 | 15 | // Native Libraries 16 | 17 | try { 18 | var libKERNEL32_dll = Deno.dlopen("KERNEL32.dll", { 19 | CreateMailslotA: { 20 | parameters: ["buffer", "u32", "u32", "pointer"], 21 | result: "pointer", 22 | optional: true, 23 | }, 24 | CreateMailslotW: { 25 | parameters: ["buffer", "u32", "u32", "pointer"], 26 | result: "pointer", 27 | optional: true, 28 | }, 29 | GetMailslotInfo: { 30 | parameters: ["pointer", "pointer", "pointer", "pointer", "pointer"], 31 | result: "i32", 32 | optional: true, 33 | }, 34 | SetMailslotInfo: { 35 | parameters: ["pointer", "u32"], 36 | result: "i32", 37 | optional: true, 38 | }, 39 | }).symbols; 40 | } catch(e) { /* ignore */ } 41 | 42 | // Symbols 43 | 44 | export function CreateMailslotA( 45 | lpName: string | null | Uint8Array /* Windows.Win32.Foundation.PSTR */, 46 | nMaxMessageSize: number /* u32 */, 47 | lReadTimeout: number /* u32 */, 48 | lpSecurityAttributes: Deno.PointerValue | Uint8Array /* ptr */, 49 | ): Deno.PointerValue /* Windows.Win32.Foundation.HANDLE */ { 50 | return libKERNEL32_dll.CreateMailslotA!(util.pstrToFfi(lpName), nMaxMessageSize, lReadTimeout, util.toPointer(lpSecurityAttributes)); 51 | } 52 | 53 | export function CreateMailslotW( 54 | lpName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 55 | nMaxMessageSize: number /* u32 */, 56 | lReadTimeout: number /* u32 */, 57 | lpSecurityAttributes: Deno.PointerValue | Uint8Array /* ptr */, 58 | ): Deno.PointerValue /* Windows.Win32.Foundation.HANDLE */ { 59 | return libKERNEL32_dll.CreateMailslotW!(util.pwstrToFfi(lpName), nMaxMessageSize, lReadTimeout, util.toPointer(lpSecurityAttributes)); 60 | } 61 | 62 | export function GetMailslotInfo( 63 | hMailslot: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.HANDLE */, 64 | lpMaxMessageSize: Deno.PointerValue | Uint8Array /* ptr */, 65 | lpNextSize: Deno.PointerValue | Uint8Array /* ptr */, 66 | lpMessageCount: Deno.PointerValue | Uint8Array /* ptr */, 67 | lpReadTimeout: Deno.PointerValue | Uint8Array /* ptr */, 68 | ): boolean /* Windows.Win32.Foundation.BOOL */ { 69 | return util.boolFromFfi(libKERNEL32_dll.GetMailslotInfo!(util.toPointer(hMailslot), util.toPointer(lpMaxMessageSize), util.toPointer(lpNextSize), util.toPointer(lpMessageCount), util.toPointer(lpReadTimeout))); 70 | } 71 | 72 | export function SetMailslotInfo( 73 | hMailslot: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.HANDLE */, 74 | lReadTimeout: number /* u32 */, 75 | ): boolean /* Windows.Win32.Foundation.BOOL */ { 76 | return util.boolFromFfi(libKERNEL32_dll.SetMailslotInfo!(util.toPointer(hMailslot), lReadTimeout)); 77 | } 78 | 79 | -------------------------------------------------------------------------------- /winrt/winmd/parameter.ts: -------------------------------------------------------------------------------- 1 | import { Scope } from "./scope.ts"; 2 | import { ELEMENT_TYPE_MAP, TypeId } from "./typeid.ts"; 3 | 4 | export class Parameter { 5 | #initialized = false; 6 | #name = ""; 7 | #sequence = 0; 8 | #attr = 0; 9 | #cPlusTypeFlag = 0; 10 | #sig!: Uint8Array; 11 | #type!: TypeId; 12 | 13 | constructor(public scope: Scope, public token: number) {} 14 | 15 | initFromType(type: TypeId) { 16 | this.#type = type; 17 | this.#initialized = true; 18 | return this; 19 | } 20 | 21 | #initialize() { 22 | if (!this.#initialized) { 23 | const ptkMethodDef = new Uint32Array(1); 24 | const pulSequence = new Uint32Array(1); 25 | const szName = new Uint16Array(256); 26 | const pchName = new Uint32Array(1); 27 | const pdwAttr = new Uint32Array(1); 28 | const pdwCPlusTypeFlag = new Uint32Array(1); 29 | const ppValue = new BigUint64Array(1); 30 | const pcchValue = new BigUint64Array(1); 31 | 32 | const hr = this.scope.com.GetParamProps( 33 | this.token, 34 | ptkMethodDef, 35 | pulSequence, 36 | szName, 37 | szName.length, 38 | pchName, 39 | pdwAttr, 40 | pdwCPlusTypeFlag, 41 | ppValue, 42 | pcchValue, 43 | ); 44 | 45 | if (hr === 0) { 46 | this.#name = new TextDecoder("utf-16le").decode( 47 | szName.subarray(0, szName.indexOf(0)), 48 | ); 49 | this.#sequence = pulSequence[0]; 50 | this.#attr = pdwAttr[0]; 51 | this.#cPlusTypeFlag = pdwCPlusTypeFlag[0]; 52 | this.#sig = new Uint8Array(Number(pcchValue[0])); 53 | new Deno.UnsafePointerView(ppValue[0]).copyInto( 54 | this.#sig, 55 | ); 56 | this.#type = TypeId.fromValue(this.#cPlusTypeFlag); 57 | 58 | this.#initialized = true; 59 | } 60 | } 61 | } 62 | 63 | get name() { 64 | this.#initialize(); 65 | return this.#name; 66 | } 67 | 68 | set name(value) { 69 | this.#name = value; 70 | } 71 | 72 | get sequence(): number { 73 | this.#initialize(); 74 | return this.#sequence; 75 | } 76 | 77 | get attr() { 78 | this.#initialize(); 79 | return this.#attr; 80 | } 81 | 82 | get cPlusTypeFlag() { 83 | this.#initialize(); 84 | return this.#cPlusTypeFlag; 85 | } 86 | 87 | get sig() { 88 | this.#initialize(); 89 | return this.#sig; 90 | } 91 | 92 | get isIn() { 93 | return (this.attr & 0x0001) === 0x0001; 94 | } 95 | 96 | get isOut() { 97 | return (this.attr & 0x0002) === 0x0002; 98 | } 99 | 100 | get isOptional() { 101 | return (this.attr & 0x0010) === 0x0010; 102 | } 103 | 104 | get hasDefault() { 105 | return (this.attr & 0x1000) === 0x1000; 106 | } 107 | 108 | get hasFieldMarshal() { 109 | return (this.attr & 0x2000) === 0x2000; 110 | } 111 | 112 | get type() { 113 | this.#initialize(); 114 | return this.#type; 115 | } 116 | 117 | [Symbol.for("Deno.customInspect")]() { 118 | return `Parameter(${this.sequence}, ${this.name}, ${this.attr}, ${this.cPlusTypeFlag})`; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /api/UI/Animation.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.UI.Animation.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type UI_ANIMATION_UPDATE_RESULT = number; 7 | export type UI_ANIMATION_MANAGER_STATUS = number; 8 | export type UI_ANIMATION_MODE = number; 9 | export type UI_ANIMATION_REPEAT_MODE = number; 10 | export type UI_ANIMATION_ROUNDING_MODE = number; 11 | export type UI_ANIMATION_STORYBOARD_STATUS = number; 12 | export type UI_ANIMATION_SCHEDULING_RESULT = number; 13 | export type UI_ANIMATION_PRIORITY_EFFECT = number; 14 | export type UI_ANIMATION_SLOPE = number; 15 | export type UI_ANIMATION_DEPENDENCIES = number; 16 | export type UI_ANIMATION_IDLE_BEHAVIOR = number; 17 | export type UI_ANIMATION_TIMER_CLIENT_STATUS = number; 18 | 19 | // Constants 20 | export const UI_ANIMATION_SECONDS_EVENTUALLY = `-1`; 21 | export const UI_ANIMATION_REPEAT_INDEFINITELY = `-1`; 22 | export const UI_ANIMATION_REPEAT_INDEFINITELY_CONCLUDE_AT_END = `-1`; 23 | export const UI_ANIMATION_REPEAT_INDEFINITELY_CONCLUDE_AT_START = `-2`; 24 | export const UI_ANIMATION_SECONDS_INFINITE = `-1`; 25 | export const UI_ANIMATION_UPDATE_NO_CHANGE = 0; 26 | export const UI_ANIMATION_UPDATE_VARIABLES_CHANGED = 1; 27 | export const UI_ANIMATION_MANAGER_IDLE = 0; 28 | export const UI_ANIMATION_MANAGER_BUSY = 1; 29 | export const UI_ANIMATION_MODE_DISABLED = 0; 30 | export const UI_ANIMATION_MODE_SYSTEM_DEFAULT = 1; 31 | export const UI_ANIMATION_MODE_ENABLED = 2; 32 | export const UI_ANIMATION_REPEAT_MODE_NORMAL = 0; 33 | export const UI_ANIMATION_REPEAT_MODE_ALTERNATE = 1; 34 | export const UI_ANIMATION_ROUNDING_NEAREST = 0; 35 | export const UI_ANIMATION_ROUNDING_FLOOR = 1; 36 | export const UI_ANIMATION_ROUNDING_CEILING = 2; 37 | export const UI_ANIMATION_STORYBOARD_BUILDING = 0; 38 | export const UI_ANIMATION_STORYBOARD_SCHEDULED = 1; 39 | export const UI_ANIMATION_STORYBOARD_CANCELLED = 2; 40 | export const UI_ANIMATION_STORYBOARD_PLAYING = 3; 41 | export const UI_ANIMATION_STORYBOARD_TRUNCATED = 4; 42 | export const UI_ANIMATION_STORYBOARD_FINISHED = 5; 43 | export const UI_ANIMATION_STORYBOARD_READY = 6; 44 | export const UI_ANIMATION_STORYBOARD_INSUFFICIENT_PRIORITY = 7; 45 | export const UI_ANIMATION_SCHEDULING_UNEXPECTED_FAILURE = 0; 46 | export const UI_ANIMATION_SCHEDULING_INSUFFICIENT_PRIORITY = 1; 47 | export const UI_ANIMATION_SCHEDULING_ALREADY_SCHEDULED = 2; 48 | export const UI_ANIMATION_SCHEDULING_SUCCEEDED = 3; 49 | export const UI_ANIMATION_SCHEDULING_DEFERRED = 4; 50 | export const UI_ANIMATION_PRIORITY_EFFECT_FAILURE = 0; 51 | export const UI_ANIMATION_PRIORITY_EFFECT_DELAY = 1; 52 | export const UI_ANIMATION_SLOPE_INCREASING = 0; 53 | export const UI_ANIMATION_SLOPE_DECREASING = 1; 54 | export const UI_ANIMATION_DEPENDENCY_NONE = 0; 55 | export const UI_ANIMATION_DEPENDENCY_INTERMEDIATE_VALUES = 1; 56 | export const UI_ANIMATION_DEPENDENCY_FINAL_VALUE = 2; 57 | export const UI_ANIMATION_DEPENDENCY_FINAL_VELOCITY = 4; 58 | export const UI_ANIMATION_DEPENDENCY_DURATION = 8; 59 | export const UI_ANIMATION_IDLE_BEHAVIOR_CONTINUE = 0; 60 | export const UI_ANIMATION_IDLE_BEHAVIOR_DISABLE = 1; 61 | export const UI_ANIMATION_TIMER_CLIENT_IDLE = 0; 62 | export const UI_ANIMATION_TIMER_CLIENT_BUSY = 1; 63 | 64 | // Structs 65 | 66 | export type UI_ANIMATION_KEYFRAME = bigint | number; 67 | 68 | // Native Libraries 69 | 70 | // Symbols 71 | 72 | -------------------------------------------------------------------------------- /api/Graphics/Direct3D11on12.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Graphics.Direct3D11on12.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Structs 6 | 7 | /** 8 | * Windows.Win32.Graphics.Direct3D11on12.D3D11_RESOURCE_FLAGS (size: 16) 9 | */ 10 | export interface D3D11_RESOURCE_FLAGS { 11 | /** u32 */ 12 | BindFlags: number; 13 | /** u32 */ 14 | MiscFlags: number; 15 | /** u32 */ 16 | CPUAccessFlags: number; 17 | /** u32 */ 18 | StructureByteStride: number; 19 | } 20 | 21 | export const sizeofD3D11_RESOURCE_FLAGS = 16; 22 | 23 | export function allocD3D11_RESOURCE_FLAGS(data?: Partial): Uint8Array { 24 | const buf = new Uint8Array(sizeofD3D11_RESOURCE_FLAGS); 25 | const view = new DataView(buf.buffer); 26 | // 0x00: u32 27 | if (data?.BindFlags !== undefined) view.setUint32(0, Number(data.BindFlags), true); 28 | // 0x04: u32 29 | if (data?.MiscFlags !== undefined) view.setUint32(4, Number(data.MiscFlags), true); 30 | // 0x08: u32 31 | if (data?.CPUAccessFlags !== undefined) view.setUint32(8, Number(data.CPUAccessFlags), true); 32 | // 0x0c: u32 33 | if (data?.StructureByteStride !== undefined) view.setUint32(12, Number(data.StructureByteStride), true); 34 | return buf; 35 | } 36 | 37 | export class D3D11_RESOURCE_FLAGSView { 38 | private readonly view: DataView; 39 | constructor(private readonly buf: Uint8Array) { 40 | this.view = new DataView(buf.buffer); 41 | } 42 | 43 | get buffer(): Uint8Array { 44 | return this.buf; 45 | } 46 | 47 | // 0x00: u32 48 | get BindFlags(): number { 49 | return this.view.getUint32(0, true); 50 | } 51 | 52 | // 0x04: u32 53 | get MiscFlags(): number { 54 | return this.view.getUint32(4, true); 55 | } 56 | 57 | // 0x08: u32 58 | get CPUAccessFlags(): number { 59 | return this.view.getUint32(8, true); 60 | } 61 | 62 | // 0x0c: u32 63 | get StructureByteStride(): number { 64 | return this.view.getUint32(12, true); 65 | } 66 | 67 | // 0x00: u32 68 | set BindFlags(value: number) { 69 | this.view.setUint32(0, value, true); 70 | } 71 | 72 | // 0x04: u32 73 | set MiscFlags(value: number) { 74 | this.view.setUint32(4, value, true); 75 | } 76 | 77 | // 0x08: u32 78 | set CPUAccessFlags(value: number) { 79 | this.view.setUint32(8, value, true); 80 | } 81 | 82 | // 0x0c: u32 83 | set StructureByteStride(value: number) { 84 | this.view.setUint32(12, value, true); 85 | } 86 | } 87 | 88 | export type HRESULT = number; 89 | 90 | // Native Libraries 91 | 92 | try { 93 | var libd3d11_dll = Deno.dlopen("d3d11.dll", { 94 | D3D11On12CreateDevice: { 95 | parameters: ["pointer", "u32", "pointer", "u32", "pointer", "u32", "u32", "pointer", "pointer", "pointer"], 96 | result: "pointer", 97 | optional: true, 98 | }, 99 | }).symbols; 100 | } catch(e) { /* ignore */ } 101 | 102 | // Symbols 103 | 104 | export function D3D11On12CreateDevice( 105 | pDevice: Uint8Array | Deno.PointerValue /* Windows.Win32.System.Com.IUnknown */, 106 | Flags: number /* u32 */, 107 | pFeatureLevels: Deno.PointerValue | Uint8Array /* ptr */, 108 | FeatureLevels: number /* u32 */, 109 | ppCommandQueues: Deno.PointerValue | Uint8Array /* ptr */, 110 | NumQueues: number /* u32 */, 111 | NodeMask: number /* u32 */, 112 | ppDevice: Deno.PointerValue | Uint8Array /* ptr */, 113 | ppImmediateContext: Deno.PointerValue | Uint8Array /* ptr */, 114 | pChosenFeatureLevel: Deno.PointerValue | Uint8Array /* ptr */, 115 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 116 | return libd3d11_dll.D3D11On12CreateDevice!(util.toPointer(pDevice), Flags, util.toPointer(pFeatureLevels), FeatureLevels, util.toPointer(ppCommandQueues), NumQueues, NodeMask, util.toPointer(ppDevice), util.toPointer(ppImmediateContext), util.toPointer(pChosenFeatureLevel)); 117 | } 118 | 119 | -------------------------------------------------------------------------------- /api/Devices/SerialCommunication.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Devices.SerialCommunication.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Constants 6 | export const COMDB_MIN_PORTS_ARBITRATED = 256; 7 | export const COMDB_MAX_PORTS_ARBITRATED = 4096; 8 | export const CDB_REPORT_BITS = 0; 9 | export const CDB_REPORT_BYTES = 1; 10 | 11 | // Structs 12 | 13 | export type HCOMDB = bigint | number; 14 | 15 | export type BOOL = number; 16 | 17 | // Native Libraries 18 | 19 | try { 20 | var libMSPORTS_dll = Deno.dlopen("MSPORTS.dll", { 21 | ComDBOpen: { 22 | parameters: ["pointer"], 23 | result: "i32", 24 | optional: true, 25 | }, 26 | ComDBClose: { 27 | parameters: ["pointer"], 28 | result: "i32", 29 | optional: true, 30 | }, 31 | ComDBGetCurrentPortUsage: { 32 | parameters: ["pointer", "pointer", "u32", "u32", "pointer"], 33 | result: "i32", 34 | optional: true, 35 | }, 36 | ComDBClaimNextFreePort: { 37 | parameters: ["pointer", "pointer"], 38 | result: "i32", 39 | optional: true, 40 | }, 41 | ComDBClaimPort: { 42 | parameters: ["pointer", "u32", "i32", "pointer"], 43 | result: "i32", 44 | optional: true, 45 | }, 46 | ComDBReleasePort: { 47 | parameters: ["pointer", "u32"], 48 | result: "i32", 49 | optional: true, 50 | }, 51 | ComDBResizeDatabase: { 52 | parameters: ["pointer", "u32"], 53 | result: "i32", 54 | optional: true, 55 | }, 56 | }).symbols; 57 | } catch(e) { /* ignore */ } 58 | 59 | // Symbols 60 | 61 | export function ComDBOpen( 62 | PHComDB: Deno.PointerValue | Uint8Array /* ptr */, 63 | ): number /* i32 */ { 64 | return libMSPORTS_dll.ComDBOpen!(util.toPointer(PHComDB)); 65 | } 66 | 67 | export function ComDBClose( 68 | HComDB: Uint8Array | Deno.PointerValue /* Windows.Win32.Devices.SerialCommunication.HCOMDB */, 69 | ): number /* i32 */ { 70 | return libMSPORTS_dll.ComDBClose!(util.toPointer(HComDB)); 71 | } 72 | 73 | export function ComDBGetCurrentPortUsage( 74 | HComDB: Uint8Array | Deno.PointerValue /* Windows.Win32.Devices.SerialCommunication.HCOMDB */, 75 | Buffer: Deno.PointerValue | Uint8Array /* ptr */, 76 | BufferSize: number /* u32 */, 77 | ReportType: number /* u32 */, 78 | MaxPortsReported: Deno.PointerValue | Uint8Array /* ptr */, 79 | ): number /* i32 */ { 80 | return libMSPORTS_dll.ComDBGetCurrentPortUsage!(util.toPointer(HComDB), util.toPointer(Buffer), BufferSize, ReportType, util.toPointer(MaxPortsReported)); 81 | } 82 | 83 | export function ComDBClaimNextFreePort( 84 | HComDB: Uint8Array | Deno.PointerValue /* Windows.Win32.Devices.SerialCommunication.HCOMDB */, 85 | ComNumber: Deno.PointerValue | Uint8Array /* ptr */, 86 | ): number /* i32 */ { 87 | return libMSPORTS_dll.ComDBClaimNextFreePort!(util.toPointer(HComDB), util.toPointer(ComNumber)); 88 | } 89 | 90 | export function ComDBClaimPort( 91 | HComDB: Uint8Array | Deno.PointerValue /* Windows.Win32.Devices.SerialCommunication.HCOMDB */, 92 | ComNumber: number /* u32 */, 93 | ForceClaim: boolean /* Windows.Win32.Foundation.BOOL */, 94 | Forced: Deno.PointerValue | Uint8Array /* ptr */, 95 | ): number /* i32 */ { 96 | return libMSPORTS_dll.ComDBClaimPort!(util.toPointer(HComDB), ComNumber, util.boolToFfi(ForceClaim), util.toPointer(Forced)); 97 | } 98 | 99 | export function ComDBReleasePort( 100 | HComDB: Uint8Array | Deno.PointerValue /* Windows.Win32.Devices.SerialCommunication.HCOMDB */, 101 | ComNumber: number /* u32 */, 102 | ): number /* i32 */ { 103 | return libMSPORTS_dll.ComDBReleasePort!(util.toPointer(HComDB), ComNumber); 104 | } 105 | 106 | export function ComDBResizeDatabase( 107 | HComDB: Uint8Array | Deno.PointerValue /* Windows.Win32.Devices.SerialCommunication.HCOMDB */, 108 | NewSize: number /* u32 */, 109 | ): number /* i32 */ { 110 | return libMSPORTS_dll.ComDBResizeDatabase!(util.toPointer(HComDB), NewSize); 111 | } 112 | 113 | -------------------------------------------------------------------------------- /api/System/CorrelationVector.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.CorrelationVector.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Constants 6 | export const RTL_CORRELATION_VECTOR_STRING_LENGTH = 129; 7 | export const RTL_CORRELATION_VECTOR_V1_PREFIX_LENGTH = 16; 8 | export const RTL_CORRELATION_VECTOR_V1_LENGTH = 64; 9 | export const RTL_CORRELATION_VECTOR_V2_PREFIX_LENGTH = 22; 10 | export const RTL_CORRELATION_VECTOR_V2_LENGTH = 128; 11 | 12 | // Structs 13 | 14 | export type CHAR = number; 15 | 16 | /** 17 | * Windows.Win32.System.CorrelationVector.CORRELATION_VECTOR (size: 16) 18 | */ 19 | export interface CORRELATION_VECTOR { 20 | /** Windows.Win32.Foundation.CHAR */ 21 | Version: string | number; 22 | /** array */ 23 | Vector: Deno.PointerValue; 24 | } 25 | 26 | export const sizeofCORRELATION_VECTOR = 16; 27 | 28 | export function allocCORRELATION_VECTOR(data?: Partial): Uint8Array { 29 | const buf = new Uint8Array(sizeofCORRELATION_VECTOR); 30 | const view = new DataView(buf.buffer); 31 | // 0x00: u8 32 | if (data?.Version !== undefined) view.setUint8(0, Number(data.Version)); 33 | // 0x01: pad7 34 | // 0x08: pointer 35 | if (data?.Vector !== undefined) view.setBigUint64(8, data.Vector === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.Vector))), true); 36 | return buf; 37 | } 38 | 39 | export class CORRELATION_VECTORView { 40 | private readonly view: DataView; 41 | constructor(private readonly buf: Uint8Array) { 42 | this.view = new DataView(buf.buffer); 43 | } 44 | 45 | get buffer(): Uint8Array { 46 | return this.buf; 47 | } 48 | 49 | // 0x00: u8 50 | get Version(): number { 51 | return this.view.getUint8(0); 52 | } 53 | 54 | // 0x01: pad7 55 | 56 | // 0x08: pointer 57 | get Vector(): Uint8Array | Deno.PointerValue { 58 | const ptr = this.view.getBigUint64(8, true); 59 | return Deno.UnsafePointer.create(ptr); 60 | } 61 | 62 | // 0x00: u8 63 | set Version(value: number) { 64 | this.view.setUint8(0, value); 65 | } 66 | 67 | // 0x01: pad7 68 | 69 | // 0x08: pointer 70 | set Vector(value: Uint8Array | Deno.PointerValue) { 71 | this.view.setBigUint64(8, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 72 | } 73 | } 74 | 75 | // Native Libraries 76 | 77 | try { 78 | var libntdll_dll = Deno.dlopen("ntdll.dll", { 79 | RtlInitializeCorrelationVector: { 80 | parameters: ["pointer", "i32", "pointer"], 81 | result: "u32", 82 | optional: true, 83 | }, 84 | RtlIncrementCorrelationVector: { 85 | parameters: ["pointer"], 86 | result: "u32", 87 | optional: true, 88 | }, 89 | RtlExtendCorrelationVector: { 90 | parameters: ["pointer"], 91 | result: "u32", 92 | optional: true, 93 | }, 94 | RtlValidateCorrelationVector: { 95 | parameters: ["pointer"], 96 | result: "u32", 97 | optional: true, 98 | }, 99 | }).symbols; 100 | } catch(e) { /* ignore */ } 101 | 102 | // Symbols 103 | 104 | export function RtlInitializeCorrelationVector( 105 | CorrelationVector: Deno.PointerValue | Uint8Array /* ptr */, 106 | Version: number /* i32 */, 107 | Guid: Deno.PointerValue | Uint8Array /* ptr */, 108 | ): number /* u32 */ { 109 | return libntdll_dll.RtlInitializeCorrelationVector!(util.toPointer(CorrelationVector), Version, util.toPointer(Guid)); 110 | } 111 | 112 | export function RtlIncrementCorrelationVector( 113 | CorrelationVector: Deno.PointerValue | Uint8Array /* ptr */, 114 | ): number /* u32 */ { 115 | return libntdll_dll.RtlIncrementCorrelationVector!(util.toPointer(CorrelationVector)); 116 | } 117 | 118 | export function RtlExtendCorrelationVector( 119 | CorrelationVector: Deno.PointerValue | Uint8Array /* ptr */, 120 | ): number /* u32 */ { 121 | return libntdll_dll.RtlExtendCorrelationVector!(util.toPointer(CorrelationVector)); 122 | } 123 | 124 | export function RtlValidateCorrelationVector( 125 | Vector: Deno.PointerValue | Uint8Array /* ptr */, 126 | ): number /* u32 */ { 127 | return libntdll_dll.RtlValidateCorrelationVector!(util.toPointer(Vector)); 128 | } 129 | 130 | -------------------------------------------------------------------------------- /winrt/winmd/typetuple.ts: -------------------------------------------------------------------------------- 1 | import { Scope } from "./scope.ts"; 2 | import { TypeDef } from "./typedef.ts"; 3 | import { TypeId } from "./typeid.ts"; 4 | 5 | export function uncompressedData(rawBytes: Uint8Array): [number, number] { 6 | if (rawBytes.byteLength === 0) { 7 | throw new Error("Bad Signature"); 8 | } 9 | 10 | if ((rawBytes[0] & 0x80) === 0x00) { 11 | return [rawBytes[0], 1]; 12 | } else if ((rawBytes[0] & 0xC0) === 0x80) { 13 | if (rawBytes.length < 2) { 14 | throw new Error("Bad Signature"); 15 | } else { 16 | return [ 17 | (rawBytes[0] & 0x3F) << 8 | rawBytes[1], 18 | 2, 19 | ]; 20 | } 21 | } else if ((rawBytes[0] & 0xE0) === 0xC0) { 22 | if (rawBytes.length < 4) { 23 | throw new Error("Bad Signature"); 24 | } else { 25 | return [ 26 | (rawBytes[0] & 0x1F) << 24 | 27 | rawBytes[1] << 16 | 28 | rawBytes[2] << 8 | 29 | rawBytes[3], 30 | 4, 31 | ]; 32 | } 33 | } else { 34 | throw new Error("Bad Signature"); 35 | } 36 | } 37 | 38 | function unencodeDefRefSpecToken(encoded: number): number { 39 | const token = encoded >> 2; 40 | 41 | if ((encoded & 0x03) === 0x00) { 42 | return 0x02000000 | token; 43 | } else if ((encoded & 0x03) === 0x01) { 44 | return 0x01000000 | token; 45 | } else if ((encoded & 0x03) === 0x02) { 46 | return 0x1b000000 | token; 47 | } else { 48 | return 0; 49 | } 50 | } 51 | 52 | export class TypeTuple { 53 | type!: TypeId; 54 | offsetLength = 0; 55 | 56 | constructor(scope: Scope, sig: Uint8Array) { 57 | this.type = TypeId.fromValue(sig[0]); 58 | 59 | switch (this.type.base) { 60 | case "valuetype": 61 | case "class": { 62 | const uncompressed = uncompressedData(sig.subarray(1)); 63 | this.offsetLength = uncompressed[1] + 1; 64 | const token = unencodeDefRefSpecToken(uncompressed[0]); 65 | const td = new TypeDef(scope, token); 66 | this.type.name = td.name; 67 | this.type.type = td; 68 | break; 69 | } 70 | 71 | case "byref": { 72 | if (sig[1] === 0x1D) { 73 | this.type.base = "array"; 74 | } 75 | break; 76 | } 77 | 78 | case "ptr": { 79 | const tup = new TypeTuple(scope, sig.subarray(1)); 80 | this.type.typeArg = tup.type; 81 | this.offsetLength = 1 + tup.offsetLength; 82 | break; 83 | } 84 | 85 | case "genericinst": { 86 | const classTup = new TypeTuple(scope, sig.subarray(1)); 87 | this.type.name = classTup.type.name; 88 | const argc = sig[1 + classTup.offsetLength]; 89 | this.offsetLength = classTup.offsetLength + 2; 90 | let argPtr = this.type; 91 | for (let i = 0; i < argc; i++) { 92 | const arg = new TypeTuple(scope, sig.subarray(this.offsetLength)); 93 | this.offsetLength += arg.offsetLength; 94 | argPtr.typeArg = arg.type; 95 | argPtr = argPtr.typeArg; 96 | } 97 | break; 98 | } 99 | 100 | case "array": { 101 | const tup = new TypeTuple(scope, sig.subarray(1)); 102 | this.offsetLength = 1 + tup.offsetLength; 103 | this.type.typeArg = tup.type; 104 | const dimsCount = sig[this.offsetLength++]; 105 | const dimUpperBounds = new Array(dimsCount).fill(0); 106 | const numSizes = sig[this.offsetLength++]; 107 | for (let i = 0; i < numSizes; i++) { 108 | const uncompressed = uncompressedData( 109 | sig.subarray(this.offsetLength), 110 | ); 111 | this.offsetLength += uncompressed[1]; 112 | dimUpperBounds[i] = uncompressed[0]; 113 | } 114 | this.type.arrayDimensions = dimUpperBounds; 115 | break; 116 | } 117 | 118 | case "var": 119 | case "mvar": { 120 | const uncompressed = uncompressedData(sig.subarray(1)); 121 | this.type.genericParameterSequence = uncompressed[0]; 122 | this.offsetLength = 2; 123 | this.type.name = this.type.base; 124 | break; 125 | } 126 | 127 | default: { 128 | this.offsetLength = 1; 129 | } 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /api/System/MixedReality.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.MixedReality.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Structs 6 | 7 | /** 8 | * Windows.Win32.System.MixedReality.PERCEPTION_PAYLOAD_FIELD (size: 16) 9 | */ 10 | export interface PERCEPTION_PAYLOAD_FIELD { 11 | /** System.Guid */ 12 | FieldId: Uint8Array | Deno.PointerValue; 13 | /** u32 */ 14 | OffsetInBytes: number; 15 | /** u32 */ 16 | SizeInBytes: number; 17 | } 18 | 19 | export const sizeofPERCEPTION_PAYLOAD_FIELD = 16; 20 | 21 | export function allocPERCEPTION_PAYLOAD_FIELD(data?: Partial): Uint8Array { 22 | const buf = new Uint8Array(sizeofPERCEPTION_PAYLOAD_FIELD); 23 | const view = new DataView(buf.buffer); 24 | // 0x00: pointer 25 | if (data?.FieldId !== undefined) view.setBigUint64(0, data.FieldId === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.FieldId))), true); 26 | // 0x08: u32 27 | if (data?.OffsetInBytes !== undefined) view.setUint32(8, Number(data.OffsetInBytes), true); 28 | // 0x0c: u32 29 | if (data?.SizeInBytes !== undefined) view.setUint32(12, Number(data.SizeInBytes), true); 30 | return buf; 31 | } 32 | 33 | export class PERCEPTION_PAYLOAD_FIELDView { 34 | private readonly view: DataView; 35 | constructor(private readonly buf: Uint8Array) { 36 | this.view = new DataView(buf.buffer); 37 | } 38 | 39 | get buffer(): Uint8Array { 40 | return this.buf; 41 | } 42 | 43 | // 0x00: pointer 44 | get FieldId(): Uint8Array | Deno.PointerValue { 45 | const ptr = this.view.getBigUint64(0, true); 46 | return Deno.UnsafePointer.create(ptr); 47 | } 48 | 49 | // 0x08: u32 50 | get OffsetInBytes(): number { 51 | return this.view.getUint32(8, true); 52 | } 53 | 54 | // 0x0c: u32 55 | get SizeInBytes(): number { 56 | return this.view.getUint32(12, true); 57 | } 58 | 59 | // 0x00: pointer 60 | set FieldId(value: Uint8Array | Deno.PointerValue) { 61 | this.view.setBigUint64(0, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 62 | } 63 | 64 | // 0x08: u32 65 | set OffsetInBytes(value: number) { 66 | this.view.setUint32(8, value, true); 67 | } 68 | 69 | // 0x0c: u32 70 | set SizeInBytes(value: number) { 71 | this.view.setUint32(12, value, true); 72 | } 73 | } 74 | 75 | /** 76 | * Windows.Win32.System.MixedReality.PERCEPTION_STATE_STREAM_TIMESTAMPS (size: 16) 77 | */ 78 | export interface PERCEPTION_STATE_STREAM_TIMESTAMPS { 79 | /** i64 */ 80 | InputTimestampInQpcCounts: bigint | number; 81 | /** i64 */ 82 | AvailableTimestampInQpcCounts: bigint | number; 83 | } 84 | 85 | export const sizeofPERCEPTION_STATE_STREAM_TIMESTAMPS = 16; 86 | 87 | export function allocPERCEPTION_STATE_STREAM_TIMESTAMPS(data?: Partial): Uint8Array { 88 | const buf = new Uint8Array(sizeofPERCEPTION_STATE_STREAM_TIMESTAMPS); 89 | const view = new DataView(buf.buffer); 90 | // 0x00: i64 91 | if (data?.InputTimestampInQpcCounts !== undefined) view.setBigInt64(0, BigInt(data.InputTimestampInQpcCounts), true); 92 | // 0x08: i64 93 | if (data?.AvailableTimestampInQpcCounts !== undefined) view.setBigInt64(8, BigInt(data.AvailableTimestampInQpcCounts), true); 94 | return buf; 95 | } 96 | 97 | export class PERCEPTION_STATE_STREAM_TIMESTAMPSView { 98 | private readonly view: DataView; 99 | constructor(private readonly buf: Uint8Array) { 100 | this.view = new DataView(buf.buffer); 101 | } 102 | 103 | get buffer(): Uint8Array { 104 | return this.buf; 105 | } 106 | 107 | // 0x00: i64 108 | get InputTimestampInQpcCounts(): bigint | number { 109 | return Number(this.view.getBigInt64(0, true)); 110 | } 111 | 112 | // 0x08: i64 113 | get AvailableTimestampInQpcCounts(): bigint | number { 114 | return Number(this.view.getBigInt64(8, true)); 115 | } 116 | 117 | // 0x00: i64 118 | set InputTimestampInQpcCounts(value: bigint | number) { 119 | this.view.setBigInt64(0, BigInt(value), true); 120 | } 121 | 122 | // 0x08: i64 123 | set AvailableTimestampInQpcCounts(value: bigint | number) { 124 | this.view.setBigInt64(8, BigInt(value), true); 125 | } 126 | } 127 | 128 | // Native Libraries 129 | 130 | // Symbols 131 | 132 | -------------------------------------------------------------------------------- /api/System/mod.ts: -------------------------------------------------------------------------------- 1 | export * as DesktopSharing from "./DesktopSharing.ts"; 2 | export * as WindowsSync from "./WindowsSync.ts"; 3 | export * as TransactionServer from "./TransactionServer.ts"; 4 | export * as Power from "./Power.ts"; 5 | export * as ParentalControls from "./ParentalControls.ts"; 6 | export * as DistributedTransactionCoordinator from "./DistributedTransactionCoordinator.ts"; 7 | export * as RemoteDesktop from "./RemoteDesktop.ts"; 8 | export * as StationsAndDesktops from "./StationsAndDesktops.ts"; 9 | export * as JobObjects from "./JobObjects.ts"; 10 | export * as Restore from "./Restore.ts"; 11 | export * as HostComputeNetwork from "./HostComputeNetwork.ts"; 12 | export * as AssessmentTool from "./AssessmentTool.ts"; 13 | export * as MixedReality from "./MixedReality.ts"; 14 | export * as TpmBaseServices from "./TpmBaseServices.ts"; 15 | export * as WinRT from "./WinRT.ts"; 16 | export * as UserAccessLogging from "./UserAccessLogging.ts"; 17 | export * as Performance from "./Performance.ts"; 18 | export * as MemoryApis from "./Memory/mod.ts"; 19 | export * as Mapi from "./Mapi.ts"; 20 | export * as ProcessStatus from "./ProcessStatus.ts"; 21 | export * as WindowsProgramming from "./WindowsProgramming.ts"; 22 | export * as Search from "./Search.ts"; 23 | export * as RemoteManagement from "./RemoteManagement.ts"; 24 | export * as Environment from "./Environment.ts"; 25 | export * as TaskScheduler from "./TaskScheduler.ts"; 26 | export * as Ioctl from "./Ioctl.ts"; 27 | export * as Wmi from "./Wmi.ts"; 28 | export * as RealTimeCommunications from "./RealTimeCommunications.ts"; 29 | export * as Com from "./Com.ts"; 30 | export * as RestartManager from "./RestartManager.ts"; 31 | export * as Pipes from "./Pipes.ts"; 32 | export * as Rpc from "./Rpc.ts"; 33 | export * as UpdateAgent from "./UpdateAgent.ts"; 34 | export * as DeveloperLicensing from "./DeveloperLicensing.ts"; 35 | export * as GroupPolicy from "./GroupPolicy.ts"; 36 | export * as Threading from "./Threading.ts"; 37 | export * as DeploymentServices from "./DeploymentServices.ts"; 38 | export * as ServerBackup from "./ServerBackup.ts"; 39 | export * as UpdateAssessment from "./UpdateAssessment.ts"; 40 | export * as PasswordManagement from "./PasswordManagement.ts"; 41 | export * as Hypervisor from "./Hypervisor.ts"; 42 | export * as EventNotificationService from "./EventNotificationService.ts"; 43 | export * as RemoteAssistance from "./RemoteAssistance.ts"; 44 | export * as MessageQueuing from "./MessageQueuing.ts"; 45 | export * as ErrorReporting from "./ErrorReporting.ts"; 46 | export * as SystemInformation from "./SystemInformation.ts"; 47 | export * as Shutdown from "./Shutdown.ts"; 48 | export * as EventLog from "./EventLog.ts"; 49 | export * as IO from "./IO.ts"; 50 | export * as SubsystemForLinux from "./SubsystemForLinux.ts"; 51 | export * as WinRTApis from "./WinRT/mod.ts"; 52 | export * as SecurityCenter from "./SecurityCenter.ts"; 53 | export * as DataExchange from "./DataExchange.ts"; 54 | export * as LibraryLoader from "./LibraryLoader.ts"; 55 | export * as Js from "./Js.ts"; 56 | export * as DiagnosticsApis from "./Diagnostics/mod.ts"; 57 | export * as ApplicationVerifier from "./ApplicationVerifier.ts"; 58 | export * as Registry from "./Registry.ts"; 59 | export * as Memory from "./Memory.ts"; 60 | export * as HostComputeSystem from "./HostComputeSystem.ts"; 61 | export * as Iis from "./Iis.ts"; 62 | export * as Kernel from "./Kernel.ts"; 63 | export * as SystemServices from "./SystemServices.ts"; 64 | export * as CorrelationVector from "./CorrelationVector.ts"; 65 | export * as Recovery from "./Recovery.ts"; 66 | export * as PerformanceApis from "./Performance/mod.ts"; 67 | export * as SetupAndMigration from "./SetupAndMigration.ts"; 68 | export * as VirtualDosMachines from "./VirtualDosMachines.ts"; 69 | export * as Contacts from "./Contacts.ts"; 70 | export * as SideShow from "./SideShow.ts"; 71 | export * as Services from "./Services.ts"; 72 | export * as ComponentServices from "./ComponentServices.ts"; 73 | export * as Console from "./Console.ts"; 74 | export * as ApplicationInstallationAndServicing from "./ApplicationInstallationAndServicing.ts"; 75 | export * as ComApis from "./Com/mod.ts"; 76 | export * as Antimalware from "./Antimalware.ts"; 77 | export * as AddressBook from "./AddressBook.ts"; 78 | export * as Ole from "./Ole.ts"; 79 | export * as Mmc from "./Mmc.ts"; 80 | export * as SettingsManagementInfrastructure from "./SettingsManagementInfrastructure.ts"; 81 | export * as Mailslots from "./Mailslots.ts"; 82 | export * as Time from "./Time.ts"; 83 | export * as EventCollector from "./EventCollector.ts"; 84 | -------------------------------------------------------------------------------- /api/System/Com/Events.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.Com.Events.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Enums 6 | export type EOC_ChangeType = number; 7 | 8 | // Constants 9 | export const EOC_NewObject = 0; 10 | export const EOC_ModifiedObject = 1; 11 | export const EOC_DeletedObject = 2; 12 | 13 | // Structs 14 | 15 | export type BSTR = Deno.PointerValue | Uint8Array; 16 | 17 | /** 18 | * Windows.Win32.System.Com.Events.COMEVENTSYSCHANGEINFO (size: 40) 19 | */ 20 | export interface COMEVENTSYSCHANGEINFO { 21 | /** u32 */ 22 | cbSize: number; 23 | /** Windows.Win32.System.Com.Events.EOC_ChangeType */ 24 | changeType: EOC_ChangeType; 25 | /** Windows.Win32.Foundation.BSTR */ 26 | objectId: Uint8Array | Deno.PointerValue; 27 | /** Windows.Win32.Foundation.BSTR */ 28 | partitionId: Uint8Array | Deno.PointerValue; 29 | /** Windows.Win32.Foundation.BSTR */ 30 | applicationId: Uint8Array | Deno.PointerValue; 31 | /** array */ 32 | reserved: Deno.PointerValue; 33 | } 34 | 35 | export const sizeofCOMEVENTSYSCHANGEINFO = 40; 36 | 37 | export function allocCOMEVENTSYSCHANGEINFO(data?: Partial): Uint8Array { 38 | const buf = new Uint8Array(sizeofCOMEVENTSYSCHANGEINFO); 39 | const view = new DataView(buf.buffer); 40 | // 0x00: u32 41 | if (data?.cbSize !== undefined) view.setUint32(0, Number(data.cbSize), true); 42 | // 0x04: i32 43 | if (data?.changeType !== undefined) view.setInt32(4, Number(data.changeType), true); 44 | // 0x08: pointer 45 | if (data?.objectId !== undefined) view.setBigUint64(8, data.objectId === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.objectId))), true); 46 | // 0x10: pointer 47 | if (data?.partitionId !== undefined) view.setBigUint64(16, data.partitionId === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.partitionId))), true); 48 | // 0x18: pointer 49 | if (data?.applicationId !== undefined) view.setBigUint64(24, data.applicationId === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.applicationId))), true); 50 | // 0x20: pointer 51 | if (data?.reserved !== undefined) view.setBigUint64(32, data.reserved === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.reserved))), true); 52 | return buf; 53 | } 54 | 55 | export class COMEVENTSYSCHANGEINFOView { 56 | private readonly view: DataView; 57 | constructor(private readonly buf: Uint8Array) { 58 | this.view = new DataView(buf.buffer); 59 | } 60 | 61 | get buffer(): Uint8Array { 62 | return this.buf; 63 | } 64 | 65 | // 0x00: u32 66 | get cbSize(): number { 67 | return this.view.getUint32(0, true); 68 | } 69 | 70 | // 0x04: i32 71 | get changeType(): number { 72 | return this.view.getInt32(4, true); 73 | } 74 | 75 | // 0x08: pointer 76 | get objectId(): Uint8Array | Deno.PointerValue { 77 | const ptr = this.view.getBigUint64(8, true); 78 | return Deno.UnsafePointer.create(ptr); 79 | } 80 | 81 | // 0x10: pointer 82 | get partitionId(): Uint8Array | Deno.PointerValue { 83 | const ptr = this.view.getBigUint64(16, true); 84 | return Deno.UnsafePointer.create(ptr); 85 | } 86 | 87 | // 0x18: pointer 88 | get applicationId(): Uint8Array | Deno.PointerValue { 89 | const ptr = this.view.getBigUint64(24, true); 90 | return Deno.UnsafePointer.create(ptr); 91 | } 92 | 93 | // 0x20: pointer 94 | get reserved(): Uint8Array | Deno.PointerValue { 95 | const ptr = this.view.getBigUint64(32, true); 96 | return Deno.UnsafePointer.create(ptr); 97 | } 98 | 99 | // 0x00: u32 100 | set cbSize(value: number) { 101 | this.view.setUint32(0, value, true); 102 | } 103 | 104 | // 0x04: i32 105 | set changeType(value: number) { 106 | this.view.setInt32(4, value, true); 107 | } 108 | 109 | // 0x08: pointer 110 | set objectId(value: Uint8Array | Deno.PointerValue) { 111 | this.view.setBigUint64(8, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 112 | } 113 | 114 | // 0x10: pointer 115 | set partitionId(value: Uint8Array | Deno.PointerValue) { 116 | this.view.setBigUint64(16, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 117 | } 118 | 119 | // 0x18: pointer 120 | set applicationId(value: Uint8Array | Deno.PointerValue) { 121 | this.view.setBigUint64(24, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 122 | } 123 | 124 | // 0x20: pointer 125 | set reserved(value: Uint8Array | Deno.PointerValue) { 126 | this.view.setBigUint64(32, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 127 | } 128 | } 129 | 130 | // Native Libraries 131 | 132 | // Symbols 133 | 134 | -------------------------------------------------------------------------------- /api/Media/PictureAcquisition.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Media.PictureAcquisition.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type USER_INPUT_STRING_TYPE = number; 7 | export type ERROR_ADVISE_MESSAGE_TYPE = number; 8 | export type ERROR_ADVISE_RESULT = number; 9 | export type PROGRESS_DIALOG_IMAGE_TYPE = number; 10 | export type PROGRESS_DIALOG_CHECKBOX_ID = number; 11 | export type DEVICE_SELECTION_DEVICE_TYPE = number; 12 | 13 | // Constants 14 | export const PROGRESS_INDETERMINATE = `-1`; 15 | export const PHOTOACQ_ERROR_RESTART_REQUIRED = 7926411350061129729n; 16 | export const PHOTOACQ_RUN_DEFAULT = 0; 17 | export const PHOTOACQ_NO_GALLERY_LAUNCH = 1; 18 | export const PHOTOACQ_DISABLE_AUTO_ROTATE = 2; 19 | export const PHOTOACQ_DISABLE_PLUGINS = 4; 20 | export const PHOTOACQ_DISABLE_GROUP_TAG_PROMPT = 8; 21 | export const PHOTOACQ_DISABLE_DB_INTEGRATION = 16; 22 | export const PHOTOACQ_DELETE_AFTER_ACQUIRE = 32; 23 | export const PHOTOACQ_DISABLE_DUPLICATE_DETECTION = 64; 24 | export const PHOTOACQ_ENABLE_THUMBNAIL_CACHING = 128; 25 | export const PHOTOACQ_DISABLE_METADATA_WRITE = 256; 26 | export const PHOTOACQ_DISABLE_THUMBNAIL_PROGRESS = 512; 27 | export const PHOTOACQ_DISABLE_SETTINGS_LINK = 1024; 28 | export const PHOTOACQ_ABORT_ON_SETTINGS_UPDATE = 2048; 29 | export const PHOTOACQ_IMPORT_VIDEO_AS_MULTIPLE_FILES = 4096; 30 | export const DSF_WPD_DEVICES = 1; 31 | export const DSF_WIA_CAMERAS = 2; 32 | export const DSF_WIA_SCANNERS = 4; 33 | export const DSF_STI_DEVICES = 8; 34 | export const DSF_TWAIN_DEVICES = 16; 35 | export const DSF_FS_DEVICES = 32; 36 | export const DSF_DV_DEVICES = 64; 37 | export const DSF_ALL_DEVICES = 65535; 38 | export const DSF_CPL_MODE = 65536; 39 | export const DSF_SHOW_OFFLINE = 131072; 40 | export const PAPS_PRESAVE = 0; 41 | export const PAPS_POSTSAVE = 1; 42 | export const PAPS_CLEANUP = 2; 43 | export const USER_INPUT_DEFAULT = 0; 44 | export const USER_INPUT_PATH_ELEMENT = 1; 45 | export const PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL = 0; 46 | export const PHOTOACQUIRE_ERROR_RETRYCANCEL = 1; 47 | export const PHOTOACQUIRE_ERROR_YESNO = 2; 48 | export const PHOTOACQUIRE_ERROR_OK = 3; 49 | export const PHOTOACQUIRE_RESULT_YES = 0; 50 | export const PHOTOACQUIRE_RESULT_NO = 1; 51 | export const PHOTOACQUIRE_RESULT_OK = 2; 52 | export const PHOTOACQUIRE_RESULT_SKIP = 3; 53 | export const PHOTOACQUIRE_RESULT_SKIP_ALL = 4; 54 | export const PHOTOACQUIRE_RESULT_RETRY = 5; 55 | export const PHOTOACQUIRE_RESULT_ABORT = 6; 56 | export const PROGRESS_DIALOG_ICON_SMALL = 0; 57 | export const PROGRESS_DIALOG_ICON_LARGE = 1; 58 | export const PROGRESS_DIALOG_ICON_THUMBNAIL = 2; 59 | export const PROGRESS_DIALOG_BITMAP_THUMBNAIL = 3; 60 | export const PROGRESS_DIALOG_CHECKBOX_ID_DEFAULT = 0; 61 | export const DST_UNKNOWN_DEVICE = 0; 62 | export const DST_WPD_DEVICE = 1; 63 | export const DST_WIA_DEVICE = 2; 64 | export const DST_STI_DEVICE = 3; 65 | export const DSF_TWAIN_DEVICE = 4; 66 | export const DST_FS_DEVICE = 5; 67 | export const DST_DV_DEVICE = 6; 68 | 69 | // Structs 70 | 71 | /** 72 | * Windows.Win32.UI.Shell.PropertiesSystem.PROPERTYKEY (size: 16) 73 | */ 74 | export interface PROPERTYKEY { 75 | /** System.Guid */ 76 | fmtid: Uint8Array | Deno.PointerValue; 77 | /** u32 */ 78 | pid: number; 79 | } 80 | 81 | export const sizeofPROPERTYKEY = 16; 82 | 83 | export function allocPROPERTYKEY(data?: Partial): Uint8Array { 84 | const buf = new Uint8Array(sizeofPROPERTYKEY); 85 | const view = new DataView(buf.buffer); 86 | // 0x00: pointer 87 | if (data?.fmtid !== undefined) view.setBigUint64(0, data.fmtid === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.fmtid))), true); 88 | // 0x08: u32 89 | if (data?.pid !== undefined) view.setUint32(8, Number(data.pid), true); 90 | // 0x0c: pad4 91 | return buf; 92 | } 93 | 94 | export class PROPERTYKEYView { 95 | private readonly view: DataView; 96 | constructor(private readonly buf: Uint8Array) { 97 | this.view = new DataView(buf.buffer); 98 | } 99 | 100 | get buffer(): Uint8Array { 101 | return this.buf; 102 | } 103 | 104 | // 0x00: pointer 105 | get fmtid(): Uint8Array | Deno.PointerValue { 106 | const ptr = this.view.getBigUint64(0, true); 107 | return Deno.UnsafePointer.create(ptr); 108 | } 109 | 110 | // 0x08: u32 111 | get pid(): number { 112 | return this.view.getUint32(8, true); 113 | } 114 | 115 | // 0x0c: pad4 116 | 117 | // 0x00: pointer 118 | set fmtid(value: Uint8Array | Deno.PointerValue) { 119 | this.view.setBigUint64(0, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 120 | } 121 | 122 | // 0x08: u32 123 | set pid(value: number) { 124 | this.view.setUint32(8, value, true); 125 | } 126 | 127 | // 0x0c: pad4 128 | } 129 | 130 | // Native Libraries 131 | 132 | // Symbols 133 | 134 | -------------------------------------------------------------------------------- /api/Graphics/Direct3D9on12.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Graphics.Direct3D9on12.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Constants 6 | export const MAX_D3D9ON12_QUEUES = 2; 7 | 8 | // Structs 9 | 10 | export type BOOL = number; 11 | 12 | /** 13 | * Windows.Win32.Graphics.Direct3D9on12.D3D9ON12_ARGS (size: 32) 14 | */ 15 | export interface D3D9ON12_ARGS { 16 | /** Windows.Win32.Foundation.BOOL */ 17 | Enable9On12: boolean; 18 | /** Windows.Win32.System.Com.IUnknown */ 19 | pD3D12Device: Uint8Array | Deno.PointerValue; 20 | /** array */ 21 | ppD3D12Queues: Deno.PointerValue; 22 | /** u32 */ 23 | NumQueues: number; 24 | /** u32 */ 25 | NodeMask: number; 26 | } 27 | 28 | export const sizeofD3D9ON12_ARGS = 32; 29 | 30 | export function allocD3D9ON12_ARGS(data?: Partial): Uint8Array { 31 | const buf = new Uint8Array(sizeofD3D9ON12_ARGS); 32 | const view = new DataView(buf.buffer); 33 | // 0x00: i32 34 | if (data?.Enable9On12 !== undefined) view.setInt32(0, Number(data.Enable9On12), true); 35 | // 0x04: pad4 36 | // 0x08: pointer 37 | if (data?.pD3D12Device !== undefined) view.setBigUint64(8, data.pD3D12Device === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.pD3D12Device))), true); 38 | // 0x10: pointer 39 | if (data?.ppD3D12Queues !== undefined) view.setBigUint64(16, data.ppD3D12Queues === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.ppD3D12Queues))), true); 40 | // 0x18: u32 41 | if (data?.NumQueues !== undefined) view.setUint32(24, Number(data.NumQueues), true); 42 | // 0x1c: u32 43 | if (data?.NodeMask !== undefined) view.setUint32(28, Number(data.NodeMask), true); 44 | return buf; 45 | } 46 | 47 | export class D3D9ON12_ARGSView { 48 | private readonly view: DataView; 49 | constructor(private readonly buf: Uint8Array) { 50 | this.view = new DataView(buf.buffer); 51 | } 52 | 53 | get buffer(): Uint8Array { 54 | return this.buf; 55 | } 56 | 57 | // 0x00: i32 58 | get Enable9On12(): number { 59 | return this.view.getInt32(0, true); 60 | } 61 | 62 | // 0x04: pad4 63 | 64 | // 0x08: pointer 65 | get pD3D12Device(): Uint8Array | Deno.PointerValue { 66 | const ptr = this.view.getBigUint64(8, true); 67 | return Deno.UnsafePointer.create(ptr); 68 | } 69 | 70 | // 0x10: pointer 71 | get ppD3D12Queues(): Uint8Array | Deno.PointerValue { 72 | const ptr = this.view.getBigUint64(16, true); 73 | return Deno.UnsafePointer.create(ptr); 74 | } 75 | 76 | // 0x18: u32 77 | get NumQueues(): number { 78 | return this.view.getUint32(24, true); 79 | } 80 | 81 | // 0x1c: u32 82 | get NodeMask(): number { 83 | return this.view.getUint32(28, true); 84 | } 85 | 86 | // 0x00: i32 87 | set Enable9On12(value: number) { 88 | this.view.setInt32(0, value, true); 89 | } 90 | 91 | // 0x04: pad4 92 | 93 | // 0x08: pointer 94 | set pD3D12Device(value: Uint8Array | Deno.PointerValue) { 95 | this.view.setBigUint64(8, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 96 | } 97 | 98 | // 0x10: pointer 99 | set ppD3D12Queues(value: Uint8Array | Deno.PointerValue) { 100 | this.view.setBigUint64(16, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 101 | } 102 | 103 | // 0x18: u32 104 | set NumQueues(value: number) { 105 | this.view.setUint32(24, value, true); 106 | } 107 | 108 | // 0x1c: u32 109 | set NodeMask(value: number) { 110 | this.view.setUint32(28, value, true); 111 | } 112 | } 113 | 114 | export type HRESULT = number; 115 | 116 | // Native Libraries 117 | 118 | try { 119 | var libd3d9_dll = Deno.dlopen("d3d9.dll", { 120 | Direct3DCreate9On12Ex: { 121 | parameters: ["u32", "pointer", "u32", "pointer"], 122 | result: "pointer", 123 | optional: true, 124 | }, 125 | Direct3DCreate9On12: { 126 | parameters: ["u32", "pointer", "u32"], 127 | result: "pointer", 128 | optional: true, 129 | }, 130 | }).symbols; 131 | } catch(e) { /* ignore */ } 132 | 133 | // Symbols 134 | 135 | export function Direct3DCreate9On12Ex( 136 | SDKVersion: number /* u32 */, 137 | pOverrideList: Deno.PointerValue | Uint8Array /* ptr */, 138 | NumOverrideEntries: number /* u32 */, 139 | ppOutputInterface: Deno.PointerValue | Uint8Array /* ptr */, 140 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 141 | return libd3d9_dll.Direct3DCreate9On12Ex!(SDKVersion, util.toPointer(pOverrideList), NumOverrideEntries, util.toPointer(ppOutputInterface)); 142 | } 143 | 144 | export function Direct3DCreate9On12( 145 | SDKVersion: number /* u32 */, 146 | pOverrideList: Deno.PointerValue | Uint8Array /* ptr */, 147 | NumOverrideEntries: number /* u32 */, 148 | ): Deno.PointerValue /* Windows.Win32.Graphics.Direct3D9.IDirect3D9 */ { 149 | return libd3d9_dll.Direct3DCreate9On12!(SDKVersion, util.toPointer(pOverrideList), NumOverrideEntries); 150 | } 151 | 152 | -------------------------------------------------------------------------------- /api/System/SecurityCenter.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.SecurityCenter.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type WSC_SECURITY_PRODUCT_SUBSTATUS = number; 7 | export type WSC_SECURITY_PRODUCT_STATE = number; 8 | export type SECURITY_PRODUCT_TYPE = number; 9 | export type WSC_SECURITY_SIGNATURE_STATUS = number; 10 | export type WSC_SECURITY_PROVIDER = number; 11 | export type WSC_SECURITY_PROVIDER_HEALTH = number; 12 | 13 | // Constants 14 | export const WSC_SECURITY_PRODUCT_SUBSTATUS_NOT_SET = 0; 15 | export const WSC_SECURITY_PRODUCT_SUBSTATUS_NO_ACTION = 1; 16 | export const WSC_SECURITY_PRODUCT_SUBSTATUS_ACTION_RECOMMENDED = 2; 17 | export const WSC_SECURITY_PRODUCT_SUBSTATUS_ACTION_NEEDED = 3; 18 | export const WSC_SECURITY_PRODUCT_STATE_ON = 0; 19 | export const WSC_SECURITY_PRODUCT_STATE_OFF = 1; 20 | export const WSC_SECURITY_PRODUCT_STATE_SNOOZED = 2; 21 | export const WSC_SECURITY_PRODUCT_STATE_EXPIRED = 3; 22 | export const SECURITY_PRODUCT_TYPE_ANTIVIRUS = 0; 23 | export const SECURITY_PRODUCT_TYPE_FIREWALL = 1; 24 | export const SECURITY_PRODUCT_TYPE_ANTISPYWARE = 2; 25 | export const WSC_SECURITY_PRODUCT_OUT_OF_DATE = 0; 26 | export const WSC_SECURITY_PRODUCT_UP_TO_DATE = 1; 27 | export const WSC_SECURITY_PROVIDER_FIREWALL = 1; 28 | export const WSC_SECURITY_PROVIDER_AUTOUPDATE_SETTINGS = 2; 29 | export const WSC_SECURITY_PROVIDER_ANTIVIRUS = 4; 30 | export const WSC_SECURITY_PROVIDER_ANTISPYWARE = 8; 31 | export const WSC_SECURITY_PROVIDER_INTERNET_SETTINGS = 16; 32 | export const WSC_SECURITY_PROVIDER_USER_ACCOUNT_CONTROL = 32; 33 | export const WSC_SECURITY_PROVIDER_SERVICE = 64; 34 | export const WSC_SECURITY_PROVIDER_NONE = 0; 35 | export const WSC_SECURITY_PROVIDER_ALL = 127; 36 | export const WSC_SECURITY_PROVIDER_HEALTH_GOOD = 0; 37 | export const WSC_SECURITY_PROVIDER_HEALTH_NOTMONITORED = 1; 38 | export const WSC_SECURITY_PROVIDER_HEALTH_POOR = 2; 39 | export const WSC_SECURITY_PROVIDER_HEALTH_SNOOZE = 3; 40 | 41 | // Structs 42 | 43 | export type HRESULT = number; 44 | 45 | export type HANDLE = bigint | number; 46 | 47 | // Native Libraries 48 | 49 | try { 50 | var libWSCAPI_dll = Deno.dlopen("WSCAPI.dll", { 51 | WscRegisterForChanges: { 52 | parameters: ["pointer", "pointer", "pointer", "pointer"], 53 | result: "pointer", 54 | optional: true, 55 | }, 56 | WscUnRegisterChanges: { 57 | parameters: ["pointer"], 58 | result: "pointer", 59 | optional: true, 60 | }, 61 | WscRegisterForUserNotifications: { 62 | parameters: [], 63 | result: "pointer", 64 | optional: true, 65 | }, 66 | WscGetSecurityProviderHealth: { 67 | parameters: ["u32", "pointer"], 68 | result: "pointer", 69 | optional: true, 70 | }, 71 | WscQueryAntiMalwareUri: { 72 | parameters: [], 73 | result: "pointer", 74 | optional: true, 75 | }, 76 | WscGetAntiMalwareUri: { 77 | parameters: ["pointer"], 78 | result: "pointer", 79 | optional: true, 80 | }, 81 | }).symbols; 82 | } catch(e) { /* ignore */ } 83 | 84 | // Symbols 85 | 86 | export function WscRegisterForChanges( 87 | Reserved: Deno.PointerValue | Uint8Array /* ptr */, 88 | phCallbackRegistration: Deno.PointerValue | Uint8Array /* ptr */, 89 | lpCallbackAddress: Uint8Array | Deno.PointerValue /* Windows.Win32.System.Threading.LPTHREAD_START_ROUTINE */, 90 | pContext: Deno.PointerValue | Uint8Array /* ptr */, 91 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 92 | return libWSCAPI_dll.WscRegisterForChanges!(util.toPointer(Reserved), util.toPointer(phCallbackRegistration), util.toPointer(lpCallbackAddress), util.toPointer(pContext)); 93 | } 94 | 95 | export function WscUnRegisterChanges( 96 | hRegistrationHandle: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.HANDLE */, 97 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 98 | return libWSCAPI_dll.WscUnRegisterChanges!(util.toPointer(hRegistrationHandle)); 99 | } 100 | 101 | export function WscRegisterForUserNotifications(): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 102 | return libWSCAPI_dll.WscRegisterForUserNotifications!(); 103 | } 104 | 105 | export function WscGetSecurityProviderHealth( 106 | Providers: number /* u32 */, 107 | pHealth: Deno.PointerValue | Uint8Array /* ptr */, 108 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 109 | return libWSCAPI_dll.WscGetSecurityProviderHealth!(Providers, util.toPointer(pHealth)); 110 | } 111 | 112 | export function WscQueryAntiMalwareUri(): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 113 | return libWSCAPI_dll.WscQueryAntiMalwareUri!(); 114 | } 115 | 116 | export function WscGetAntiMalwareUri( 117 | ppszUri: Deno.PointerValue | Uint8Array /* ptr */, 118 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 119 | return libWSCAPI_dll.WscGetAntiMalwareUri!(util.toPointer(ppszUri)); 120 | } 121 | 122 | -------------------------------------------------------------------------------- /api/System/Recovery.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.Recovery.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type REGISTER_APPLICATION_RESTART_FLAGS = number; 7 | 8 | // Constants 9 | export const RESTART_NO_CRASH = 1; 10 | export const RESTART_NO_HANG = 2; 11 | export const RESTART_NO_PATCH = 4; 12 | export const RESTART_NO_REBOOT = 8; 13 | 14 | // Structs 15 | 16 | export type HRESULT = number; 17 | 18 | export type PWSTR = Deno.PointerValue | Uint8Array; 19 | 20 | export type HANDLE = bigint | number; 21 | 22 | export type BOOL = number; 23 | 24 | // Native Libraries 25 | 26 | try { 27 | var libKERNEL32_dll = Deno.dlopen("KERNEL32.dll", { 28 | RegisterApplicationRecoveryCallback: { 29 | parameters: ["pointer", "pointer", "u32", "u32"], 30 | result: "pointer", 31 | optional: true, 32 | }, 33 | UnregisterApplicationRecoveryCallback: { 34 | parameters: [], 35 | result: "pointer", 36 | optional: true, 37 | }, 38 | RegisterApplicationRestart: { 39 | parameters: ["buffer", "u32"], 40 | result: "pointer", 41 | optional: true, 42 | }, 43 | UnregisterApplicationRestart: { 44 | parameters: [], 45 | result: "pointer", 46 | optional: true, 47 | }, 48 | GetApplicationRecoveryCallback: { 49 | parameters: ["pointer", "pointer", "pointer", "pointer", "pointer"], 50 | result: "pointer", 51 | optional: true, 52 | }, 53 | GetApplicationRestartSettings: { 54 | parameters: ["pointer", "buffer", "pointer", "pointer"], 55 | result: "pointer", 56 | optional: true, 57 | }, 58 | ApplicationRecoveryInProgress: { 59 | parameters: ["pointer"], 60 | result: "pointer", 61 | optional: true, 62 | }, 63 | ApplicationRecoveryFinished: { 64 | parameters: ["i32"], 65 | result: "void", 66 | optional: true, 67 | }, 68 | }).symbols; 69 | } catch(e) { /* ignore */ } 70 | 71 | // Symbols 72 | 73 | export function RegisterApplicationRecoveryCallback( 74 | pRecoveyCallback: Uint8Array | Deno.PointerValue /* Windows.Win32.System.WindowsProgramming.APPLICATION_RECOVERY_CALLBACK */, 75 | pvParameter: Deno.PointerValue | Uint8Array /* ptr */, 76 | dwPingInterval: number /* u32 */, 77 | dwFlags: number /* u32 */, 78 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 79 | return libKERNEL32_dll.RegisterApplicationRecoveryCallback!(util.toPointer(pRecoveyCallback), util.toPointer(pvParameter), dwPingInterval, dwFlags); 80 | } 81 | 82 | export function UnregisterApplicationRecoveryCallback(): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 83 | return libKERNEL32_dll.UnregisterApplicationRecoveryCallback!(); 84 | } 85 | 86 | export function RegisterApplicationRestart( 87 | pwzCommandline: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 88 | dwFlags: REGISTER_APPLICATION_RESTART_FLAGS /* Windows.Win32.System.Recovery.REGISTER_APPLICATION_RESTART_FLAGS */, 89 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 90 | return libKERNEL32_dll.RegisterApplicationRestart!(util.pwstrToFfi(pwzCommandline), dwFlags); 91 | } 92 | 93 | export function UnregisterApplicationRestart(): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 94 | return libKERNEL32_dll.UnregisterApplicationRestart!(); 95 | } 96 | 97 | export function GetApplicationRecoveryCallback( 98 | hProcess: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.HANDLE */, 99 | pRecoveryCallback: Deno.PointerValue | Uint8Array /* ptr */, 100 | ppvParameter: Deno.PointerValue | Uint8Array /* ptr */, 101 | pdwPingInterval: Deno.PointerValue | Uint8Array /* ptr */, 102 | pdwFlags: Deno.PointerValue | Uint8Array /* ptr */, 103 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 104 | return libKERNEL32_dll.GetApplicationRecoveryCallback!(util.toPointer(hProcess), util.toPointer(pRecoveryCallback), util.toPointer(ppvParameter), util.toPointer(pdwPingInterval), util.toPointer(pdwFlags)); 105 | } 106 | 107 | export function GetApplicationRestartSettings( 108 | hProcess: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.HANDLE */, 109 | pwzCommandline: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 110 | pcchSize: Deno.PointerValue | Uint8Array /* ptr */, 111 | pdwFlags: Deno.PointerValue | Uint8Array /* ptr */, 112 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 113 | return libKERNEL32_dll.GetApplicationRestartSettings!(util.toPointer(hProcess), util.pwstrToFfi(pwzCommandline), util.toPointer(pcchSize), util.toPointer(pdwFlags)); 114 | } 115 | 116 | export function ApplicationRecoveryInProgress( 117 | pbCancelled: Deno.PointerValue | Uint8Array /* ptr */, 118 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 119 | return libKERNEL32_dll.ApplicationRecoveryInProgress!(util.toPointer(pbCancelled)); 120 | } 121 | 122 | export function ApplicationRecoveryFinished( 123 | bSuccess: boolean /* Windows.Win32.Foundation.BOOL */, 124 | ): void /* void */ { 125 | return libKERNEL32_dll.ApplicationRecoveryFinished!(util.boolToFfi(bSuccess)); 126 | } 127 | 128 | -------------------------------------------------------------------------------- /api/Storage/OperationRecorder.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Storage.OperationRecorder.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type OPERATION_START_FLAGS = number; 7 | export type OPERATION_END_PARAMETERS_FLAGS = number; 8 | 9 | // Constants 10 | export const OPERATION_START_TRACE_CURRENT_THREAD = 1; 11 | export const OPERATION_END_DISCARD = 1; 12 | 13 | // Structs 14 | 15 | /** 16 | * Windows.Win32.Storage.OperationRecorder.OPERATION_START_PARAMETERS (size: 16) 17 | */ 18 | export interface OPERATION_START_PARAMETERS { 19 | /** u32 */ 20 | Version: number; 21 | /** u32 */ 22 | OperationId: number; 23 | /** Windows.Win32.Storage.OperationRecorder.OPERATION_START_FLAGS */ 24 | Flags: OPERATION_START_FLAGS; 25 | } 26 | 27 | export const sizeofOPERATION_START_PARAMETERS = 16; 28 | 29 | export function allocOPERATION_START_PARAMETERS(data?: Partial): Uint8Array { 30 | const buf = new Uint8Array(sizeofOPERATION_START_PARAMETERS); 31 | const view = new DataView(buf.buffer); 32 | // 0x00: u32 33 | if (data?.Version !== undefined) view.setUint32(0, Number(data.Version), true); 34 | // 0x04: u32 35 | if (data?.OperationId !== undefined) view.setUint32(4, Number(data.OperationId), true); 36 | // 0x08: u32 37 | if (data?.Flags !== undefined) view.setUint32(8, Number(data.Flags), true); 38 | // 0x0c: pad4 39 | return buf; 40 | } 41 | 42 | export class OPERATION_START_PARAMETERSView { 43 | private readonly view: DataView; 44 | constructor(private readonly buf: Uint8Array) { 45 | this.view = new DataView(buf.buffer); 46 | } 47 | 48 | get buffer(): Uint8Array { 49 | return this.buf; 50 | } 51 | 52 | // 0x00: u32 53 | get Version(): number { 54 | return this.view.getUint32(0, true); 55 | } 56 | 57 | // 0x04: u32 58 | get OperationId(): number { 59 | return this.view.getUint32(4, true); 60 | } 61 | 62 | // 0x08: u32 63 | get Flags(): number { 64 | return this.view.getUint32(8, true); 65 | } 66 | 67 | // 0x0c: pad4 68 | 69 | // 0x00: u32 70 | set Version(value: number) { 71 | this.view.setUint32(0, value, true); 72 | } 73 | 74 | // 0x04: u32 75 | set OperationId(value: number) { 76 | this.view.setUint32(4, value, true); 77 | } 78 | 79 | // 0x08: u32 80 | set Flags(value: number) { 81 | this.view.setUint32(8, value, true); 82 | } 83 | 84 | // 0x0c: pad4 85 | } 86 | 87 | /** 88 | * Windows.Win32.Storage.OperationRecorder.OPERATION_END_PARAMETERS (size: 16) 89 | */ 90 | export interface OPERATION_END_PARAMETERS { 91 | /** u32 */ 92 | Version: number; 93 | /** u32 */ 94 | OperationId: number; 95 | /** Windows.Win32.Storage.OperationRecorder.OPERATION_END_PARAMETERS_FLAGS */ 96 | Flags: OPERATION_END_PARAMETERS_FLAGS; 97 | } 98 | 99 | export const sizeofOPERATION_END_PARAMETERS = 16; 100 | 101 | export function allocOPERATION_END_PARAMETERS(data?: Partial): Uint8Array { 102 | const buf = new Uint8Array(sizeofOPERATION_END_PARAMETERS); 103 | const view = new DataView(buf.buffer); 104 | // 0x00: u32 105 | if (data?.Version !== undefined) view.setUint32(0, Number(data.Version), true); 106 | // 0x04: u32 107 | if (data?.OperationId !== undefined) view.setUint32(4, Number(data.OperationId), true); 108 | // 0x08: u32 109 | if (data?.Flags !== undefined) view.setUint32(8, Number(data.Flags), true); 110 | // 0x0c: pad4 111 | return buf; 112 | } 113 | 114 | export class OPERATION_END_PARAMETERSView { 115 | private readonly view: DataView; 116 | constructor(private readonly buf: Uint8Array) { 117 | this.view = new DataView(buf.buffer); 118 | } 119 | 120 | get buffer(): Uint8Array { 121 | return this.buf; 122 | } 123 | 124 | // 0x00: u32 125 | get Version(): number { 126 | return this.view.getUint32(0, true); 127 | } 128 | 129 | // 0x04: u32 130 | get OperationId(): number { 131 | return this.view.getUint32(4, true); 132 | } 133 | 134 | // 0x08: u32 135 | get Flags(): number { 136 | return this.view.getUint32(8, true); 137 | } 138 | 139 | // 0x0c: pad4 140 | 141 | // 0x00: u32 142 | set Version(value: number) { 143 | this.view.setUint32(0, value, true); 144 | } 145 | 146 | // 0x04: u32 147 | set OperationId(value: number) { 148 | this.view.setUint32(4, value, true); 149 | } 150 | 151 | // 0x08: u32 152 | set Flags(value: number) { 153 | this.view.setUint32(8, value, true); 154 | } 155 | 156 | // 0x0c: pad4 157 | } 158 | 159 | export type BOOL = number; 160 | 161 | // Native Libraries 162 | 163 | try { 164 | var libADVAPI32_dll = Deno.dlopen("ADVAPI32.dll", { 165 | OperationStart: { 166 | parameters: ["pointer"], 167 | result: "i32", 168 | optional: true, 169 | }, 170 | OperationEnd: { 171 | parameters: ["pointer"], 172 | result: "i32", 173 | optional: true, 174 | }, 175 | }).symbols; 176 | } catch(e) { /* ignore */ } 177 | 178 | // Symbols 179 | 180 | export function OperationStart( 181 | OperationStartParams: Deno.PointerValue | Uint8Array /* ptr */, 182 | ): boolean /* Windows.Win32.Foundation.BOOL */ { 183 | return util.boolFromFfi(libADVAPI32_dll.OperationStart!(util.toPointer(OperationStartParams))); 184 | } 185 | 186 | export function OperationEnd( 187 | OperationEndParams: Deno.PointerValue | Uint8Array /* ptr */, 188 | ): boolean /* Windows.Win32.Foundation.BOOL */ { 189 | return util.boolFromFfi(libADVAPI32_dll.OperationEnd!(util.toPointer(OperationEndParams))); 190 | } 191 | 192 | -------------------------------------------------------------------------------- /api/System/SettingsManagementInfrastructure.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.SettingsManagementInfrastructure.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type WcmTargetMode = number; 7 | export type WcmNamespaceEnumerationFlags = number; 8 | export type WcmDataType = number; 9 | export type WcmSettingType = number; 10 | export type WcmRestrictionFacets = number; 11 | export type WcmUserStatus = number; 12 | export type WcmNamespaceAccess = number; 13 | 14 | // Constants 15 | export const WCM_SETTINGS_ID_NAME = `name`; 16 | export const WCM_SETTINGS_ID_VERSION = `version`; 17 | export const WCM_SETTINGS_ID_LANGUAGE = `language`; 18 | export const WCM_SETTINGS_ID_ARCHITECTURE = `architecture`; 19 | export const WCM_SETTINGS_ID_TOKEN = `token`; 20 | export const WCM_SETTINGS_ID_URI = `uri`; 21 | export const WCM_SETTINGS_ID_VERSION_SCOPE = `versionScope`; 22 | export const WCM_SETTINGS_ID_FLAG_REFERENCE = 0; 23 | export const WCM_SETTINGS_ID_FLAG_DEFINITION = 1; 24 | export const LINK_STORE_TO_ENGINE_INSTANCE = 1; 25 | export const LIMITED_VALIDATION_MODE = 1; 26 | export const WCM_E_INTERNALERROR = 2449959316130758656n; 27 | export const WCM_E_STATENODENOTFOUND = 2449960415642386433n; 28 | export const WCM_E_STATENODENOTALLOWED = 2449961515154014210n; 29 | export const WCM_E_ATTRIBUTENOTFOUND = 2449962614665641987n; 30 | export const WCM_E_ATTRIBUTENOTALLOWED = 2449963714177269764n; 31 | export const WCM_E_INVALIDVALUE = 2449964813688897541n; 32 | export const WCM_E_INVALIDVALUEFORMAT = 2449965913200525318n; 33 | export const WCM_E_TYPENOTSPECIFIED = 2449967012712153095n; 34 | export const WCM_E_INVALIDDATATYPE = 2449968112223780872n; 35 | export const WCM_E_NOTPOSITIONED = 2449969211735408649n; 36 | export const WCM_E_READONLYITEM = 2449970311247036426n; 37 | export const WCM_E_INVALIDPATH = 2449971410758664203n; 38 | export const WCM_E_WRONGESCAPESTRING = 2449972510270291980n; 39 | export const WCM_E_INVALIDVERSIONFORMAT = 2449973609781919757n; 40 | export const WCM_E_INVALIDLANGUAGEFORMAT = 2449974709293547534n; 41 | export const WCM_E_KEYNOTCHANGEABLE = 2449975808805175311n; 42 | export const WCM_E_EXPRESSIONNOTFOUND = 2449976908316803088n; 43 | export const WCM_E_SUBSTITUTIONNOTFOUND = 2449978007828430865n; 44 | export const WCM_E_USERALREADYREGISTERED = 2449979107340058642n; 45 | export const WCM_E_USERNOTFOUND = 2449980206851686419n; 46 | export const WCM_E_NAMESPACENOTFOUND = 2449981306363314196n; 47 | export const WCM_E_NAMESPACEALREADYREGISTERED = 2449982405874941973n; 48 | export const WCM_E_STORECORRUPTED = 2449983505386569750n; 49 | export const WCM_E_INVALIDEXPRESSIONSYNTAX = 2449984604898197527n; 50 | export const WCM_E_NOTIFICATIONNOTFOUND = 2449985704409825304n; 51 | export const WCM_E_CONFLICTINGASSERTION = 2449986803921453081n; 52 | export const WCM_E_ASSERTIONFAILED = 2449987903433080858n; 53 | export const WCM_E_DUPLICATENAME = 2449989002944708635n; 54 | export const WCM_E_INVALIDKEY = 2449990102456336412n; 55 | export const WCM_E_INVALIDSTREAM = 2449991201967964189n; 56 | export const WCM_E_HANDLERNOTFOUND = 2449992301479591966n; 57 | export const WCM_E_INVALIDHANDLERSYNTAX = 2449993400991219743n; 58 | export const WCM_E_VALIDATIONFAILED = 2449994500502847520n; 59 | export const WCM_E_RESTRICTIONFAILED = 2449995600014475297n; 60 | export const WCM_E_MANIFESTCOMPILATIONFAILED = 2449996699526103074n; 61 | export const WCM_E_CYCLICREFERENCE = 2449997799037730851n; 62 | export const WCM_E_MIXTYPEASSERTION = 2449998898549358628n; 63 | export const WCM_E_NOTSUPPORTEDFUNCTION = 2449999998060986405n; 64 | export const WCM_E_VALUETOOBIG = 2450001097572614182n; 65 | export const WCM_E_INVALIDATTRIBUTECOMBINATION = 2450002197084241959n; 66 | export const WCM_E_ABORTOPERATION = 2450003296595869736n; 67 | export const WCM_E_MISSINGCONFIGURATION = 2450004396107497513n; 68 | export const WCM_E_INVALIDPROCESSORFORMAT = 2450005495619125290n; 69 | export const WCM_E_SOURCEMANEMPTYVALUE = 2454462915758129195n; 70 | export const WCM_S_INTERNALERROR = 1225823570821779456n; 71 | export const WCM_S_ATTRIBUTENOTFOUND = 2454464013122277377n; 72 | export const WCM_S_LEGACYSETTINGWARNING = 2454466212145532930n; 73 | export const WCM_S_INVALIDATTRIBUTECOMBINATION = 2454467311657160708n; 74 | export const WCM_S_ATTRIBUTENOTALLOWED = 2454468411168788485n; 75 | export const WCM_S_NAMESPACENOTFOUND = 2454465112633905158n; 76 | export const WCM_E_UNKNOWNRESULT = 1226386531512619011n; 77 | export const OfflineMode = 1; 78 | export const OnlineMode = 2; 79 | export const SharedEnumeration = 1; 80 | export const UserEnumeration = 2; 81 | export const AllEnumeration = 3; 82 | export const dataTypeByte = 1; 83 | export const dataTypeSByte = 2; 84 | export const dataTypeUInt16 = 3; 85 | export const dataTypeInt16 = 4; 86 | export const dataTypeUInt32 = 5; 87 | export const dataTypeInt32 = 6; 88 | export const dataTypeUInt64 = 7; 89 | export const dataTypeInt64 = 8; 90 | export const dataTypeBoolean = 11; 91 | export const dataTypeString = 12; 92 | export const dataTypeFlagArray = 32768; 93 | export const settingTypeScalar = 1; 94 | export const settingTypeComplex = 2; 95 | export const settingTypeList = 3; 96 | export const restrictionFacetMaxLength = 1; 97 | export const restrictionFacetEnumeration = 2; 98 | export const restrictionFacetMaxInclusive = 4; 99 | export const restrictionFacetMinInclusive = 8; 100 | export const UnknownStatus = 0; 101 | export const UserRegistered = 1; 102 | export const UserUnregistered = 2; 103 | export const UserLoaded = 3; 104 | export const UserUnloaded = 4; 105 | export const ReadOnlyAccess = 1; 106 | export const ReadWriteAccess = 2; 107 | 108 | // Structs 109 | 110 | // Native Libraries 111 | 112 | // Symbols 113 | 114 | -------------------------------------------------------------------------------- /api/System/Memory/NonVolatile.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.Memory.NonVolatile.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Structs 6 | 7 | /** 8 | * Windows.Win32.System.Memory.NonVolatile.NV_MEMORY_RANGE (size: 16) 9 | */ 10 | export interface NV_MEMORY_RANGE { 11 | /** ptr */ 12 | BaseAddress: Deno.PointerValue | Uint8Array; 13 | /** usize */ 14 | Length: bigint | number; 15 | } 16 | 17 | export const sizeofNV_MEMORY_RANGE = 16; 18 | 19 | export function allocNV_MEMORY_RANGE(data?: Partial): Uint8Array { 20 | const buf = new Uint8Array(sizeofNV_MEMORY_RANGE); 21 | const view = new DataView(buf.buffer); 22 | // 0x00: pointer 23 | if (data?.BaseAddress !== undefined) view.setBigUint64(0, data.BaseAddress === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.BaseAddress))), true); 24 | // 0x08: usize 25 | if (data?.Length !== undefined) view.setBigUint64(8, BigInt(data.Length), true); 26 | return buf; 27 | } 28 | 29 | export class NV_MEMORY_RANGEView { 30 | private readonly view: DataView; 31 | constructor(private readonly buf: Uint8Array) { 32 | this.view = new DataView(buf.buffer); 33 | } 34 | 35 | get buffer(): Uint8Array { 36 | return this.buf; 37 | } 38 | 39 | // 0x00: pointer 40 | get BaseAddress(): Uint8Array | Deno.PointerValue { 41 | const ptr = this.view.getBigUint64(0, true); 42 | return Deno.UnsafePointer.create(ptr); 43 | } 44 | 45 | // 0x08: usize 46 | get Length(): bigint | number { 47 | return Number(this.view.getBigUint64(8, true)); 48 | } 49 | 50 | // 0x00: pointer 51 | set BaseAddress(value: Uint8Array | Deno.PointerValue) { 52 | this.view.setBigUint64(0, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 53 | } 54 | 55 | // 0x08: usize 56 | set Length(value: bigint | number) { 57 | this.view.setBigUint64(8, BigInt(value), true); 58 | } 59 | } 60 | 61 | // Native Libraries 62 | 63 | try { 64 | var libntdll_dll = Deno.dlopen("ntdll.dll", { 65 | RtlGetNonVolatileToken: { 66 | parameters: ["pointer", "usize", "pointer"], 67 | result: "u32", 68 | optional: true, 69 | }, 70 | RtlFreeNonVolatileToken: { 71 | parameters: ["pointer"], 72 | result: "u32", 73 | optional: true, 74 | }, 75 | RtlFlushNonVolatileMemory: { 76 | parameters: ["pointer", "pointer", "usize", "u32"], 77 | result: "u32", 78 | optional: true, 79 | }, 80 | RtlDrainNonVolatileFlush: { 81 | parameters: ["pointer"], 82 | result: "u32", 83 | optional: true, 84 | }, 85 | RtlWriteNonVolatileMemory: { 86 | parameters: ["pointer", "pointer", "pointer", "usize", "u32"], 87 | result: "u32", 88 | optional: true, 89 | }, 90 | RtlFillNonVolatileMemory: { 91 | parameters: ["pointer", "pointer", "usize", "u8", "u32"], 92 | result: "u32", 93 | optional: true, 94 | }, 95 | RtlFlushNonVolatileMemoryRanges: { 96 | parameters: ["pointer", "pointer", "usize", "u32"], 97 | result: "u32", 98 | optional: true, 99 | }, 100 | }).symbols; 101 | } catch(e) { /* ignore */ } 102 | 103 | // Symbols 104 | 105 | export function RtlGetNonVolatileToken( 106 | NvBuffer: Deno.PointerValue | Uint8Array /* ptr */, 107 | Size: bigint | number /* usize */, 108 | NvToken: Deno.PointerValue | Uint8Array /* ptr */, 109 | ): number /* u32 */ { 110 | return libntdll_dll.RtlGetNonVolatileToken!(util.toPointer(NvBuffer), Size, util.toPointer(NvToken)); 111 | } 112 | 113 | export function RtlFreeNonVolatileToken( 114 | NvToken: Deno.PointerValue | Uint8Array /* ptr */, 115 | ): number /* u32 */ { 116 | return libntdll_dll.RtlFreeNonVolatileToken!(util.toPointer(NvToken)); 117 | } 118 | 119 | export function RtlFlushNonVolatileMemory( 120 | NvToken: Deno.PointerValue | Uint8Array /* ptr */, 121 | NvBuffer: Deno.PointerValue | Uint8Array /* ptr */, 122 | Size: bigint | number /* usize */, 123 | Flags: number /* u32 */, 124 | ): number /* u32 */ { 125 | return libntdll_dll.RtlFlushNonVolatileMemory!(util.toPointer(NvToken), util.toPointer(NvBuffer), Size, Flags); 126 | } 127 | 128 | export function RtlDrainNonVolatileFlush( 129 | NvToken: Deno.PointerValue | Uint8Array /* ptr */, 130 | ): number /* u32 */ { 131 | return libntdll_dll.RtlDrainNonVolatileFlush!(util.toPointer(NvToken)); 132 | } 133 | 134 | export function RtlWriteNonVolatileMemory( 135 | NvToken: Deno.PointerValue | Uint8Array /* ptr */, 136 | NvDestination: Deno.PointerValue | Uint8Array /* ptr */, 137 | Source: Deno.PointerValue | Uint8Array /* ptr */, 138 | Size: bigint | number /* usize */, 139 | Flags: number /* u32 */, 140 | ): number /* u32 */ { 141 | return libntdll_dll.RtlWriteNonVolatileMemory!(util.toPointer(NvToken), util.toPointer(NvDestination), util.toPointer(Source), Size, Flags); 142 | } 143 | 144 | export function RtlFillNonVolatileMemory( 145 | NvToken: Deno.PointerValue | Uint8Array /* ptr */, 146 | NvDestination: Deno.PointerValue | Uint8Array /* ptr */, 147 | Size: bigint | number /* usize */, 148 | Value: number /* u8 */, 149 | Flags: number /* u32 */, 150 | ): number /* u32 */ { 151 | return libntdll_dll.RtlFillNonVolatileMemory!(util.toPointer(NvToken), util.toPointer(NvDestination), Size, Value, Flags); 152 | } 153 | 154 | export function RtlFlushNonVolatileMemoryRanges( 155 | NvToken: Deno.PointerValue | Uint8Array /* ptr */, 156 | NvRanges: Deno.PointerValue | Uint8Array /* ptr */, 157 | NumRanges: bigint | number /* usize */, 158 | Flags: number /* u32 */, 159 | ): number /* u32 */ { 160 | return libntdll_dll.RtlFlushNonVolatileMemoryRanges!(util.toPointer(NvToken), util.toPointer(NvRanges), NumRanges, Flags); 161 | } 162 | 163 | -------------------------------------------------------------------------------- /api/Security/DirectoryServices.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Security.DirectoryServices.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Constants 6 | export const DSSI_READ_ONLY = 1; 7 | export const DSSI_NO_ACCESS_CHECK = 2; 8 | export const DSSI_NO_EDIT_SACL = 4; 9 | export const DSSI_NO_EDIT_OWNER = 8; 10 | export const DSSI_IS_ROOT = 16; 11 | export const DSSI_NO_FILTER = 32; 12 | export const DSSI_NO_READONLY_MESSAGE = 64; 13 | 14 | // Structs 15 | 16 | export type PWSTR = Deno.PointerValue | Uint8Array; 17 | 18 | export type LPARAM = bigint | number; 19 | 20 | export type HRESULT = number; 21 | 22 | export type HWND = bigint | number; 23 | 24 | // Native Libraries 25 | 26 | try { 27 | var libDSSEC_dll = Deno.dlopen("DSSEC.dll", { 28 | DSCreateISecurityInfoObject: { 29 | parameters: ["buffer", "buffer", "u32", "pointer", "pointer", "pointer", "pointer"], 30 | result: "pointer", 31 | optional: true, 32 | }, 33 | DSCreateISecurityInfoObjectEx: { 34 | parameters: ["buffer", "buffer", "buffer", "buffer", "buffer", "u32", "pointer", "pointer", "pointer", "pointer"], 35 | result: "pointer", 36 | optional: true, 37 | }, 38 | DSCreateSecurityPage: { 39 | parameters: ["buffer", "buffer", "u32", "pointer", "pointer", "pointer", "pointer"], 40 | result: "pointer", 41 | optional: true, 42 | }, 43 | DSEditSecurity: { 44 | parameters: ["pointer", "buffer", "buffer", "u32", "buffer", "pointer", "pointer", "pointer"], 45 | result: "pointer", 46 | optional: true, 47 | }, 48 | }).symbols; 49 | } catch(e) { /* ignore */ } 50 | 51 | // Symbols 52 | 53 | export function DSCreateISecurityInfoObject( 54 | pwszObjectPath: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 55 | pwszObjectClass: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 56 | dwFlags: number /* u32 */, 57 | ppSI: Deno.PointerValue | Uint8Array /* ptr */, 58 | pfnReadSD: Uint8Array | Deno.PointerValue /* Windows.Win32.Security.DirectoryServices.PFNREADOBJECTSECURITY */, 59 | pfnWriteSD: Uint8Array | Deno.PointerValue /* Windows.Win32.Security.DirectoryServices.PFNWRITEOBJECTSECURITY */, 60 | lpContext: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.LPARAM */, 61 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 62 | return libDSSEC_dll.DSCreateISecurityInfoObject!(util.pwstrToFfi(pwszObjectPath), util.pwstrToFfi(pwszObjectClass), dwFlags, util.toPointer(ppSI), util.toPointer(pfnReadSD), util.toPointer(pfnWriteSD), util.toPointer(lpContext)); 63 | } 64 | 65 | export function DSCreateISecurityInfoObjectEx( 66 | pwszObjectPath: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 67 | pwszObjectClass: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 68 | pwszServer: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 69 | pwszUserName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 70 | pwszPassword: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 71 | dwFlags: number /* u32 */, 72 | ppSI: Deno.PointerValue | Uint8Array /* ptr */, 73 | pfnReadSD: Uint8Array | Deno.PointerValue /* Windows.Win32.Security.DirectoryServices.PFNREADOBJECTSECURITY */, 74 | pfnWriteSD: Uint8Array | Deno.PointerValue /* Windows.Win32.Security.DirectoryServices.PFNWRITEOBJECTSECURITY */, 75 | lpContext: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.LPARAM */, 76 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 77 | return libDSSEC_dll.DSCreateISecurityInfoObjectEx!(util.pwstrToFfi(pwszObjectPath), util.pwstrToFfi(pwszObjectClass), util.pwstrToFfi(pwszServer), util.pwstrToFfi(pwszUserName), util.pwstrToFfi(pwszPassword), dwFlags, util.toPointer(ppSI), util.toPointer(pfnReadSD), util.toPointer(pfnWriteSD), util.toPointer(lpContext)); 78 | } 79 | 80 | export function DSCreateSecurityPage( 81 | pwszObjectPath: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 82 | pwszObjectClass: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 83 | dwFlags: number /* u32 */, 84 | phPage: Deno.PointerValue | Uint8Array /* ptr */, 85 | pfnReadSD: Uint8Array | Deno.PointerValue /* Windows.Win32.Security.DirectoryServices.PFNREADOBJECTSECURITY */, 86 | pfnWriteSD: Uint8Array | Deno.PointerValue /* Windows.Win32.Security.DirectoryServices.PFNWRITEOBJECTSECURITY */, 87 | lpContext: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.LPARAM */, 88 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 89 | return libDSSEC_dll.DSCreateSecurityPage!(util.pwstrToFfi(pwszObjectPath), util.pwstrToFfi(pwszObjectClass), dwFlags, util.toPointer(phPage), util.toPointer(pfnReadSD), util.toPointer(pfnWriteSD), util.toPointer(lpContext)); 90 | } 91 | 92 | export function DSEditSecurity( 93 | hwndOwner: Deno.PointerValue /* Windows.Win32.Foundation.HWND */, 94 | pwszObjectPath: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 95 | pwszObjectClass: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 96 | dwFlags: number /* u32 */, 97 | pwszCaption: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 98 | pfnReadSD: Uint8Array | Deno.PointerValue /* Windows.Win32.Security.DirectoryServices.PFNREADOBJECTSECURITY */, 99 | pfnWriteSD: Uint8Array | Deno.PointerValue /* Windows.Win32.Security.DirectoryServices.PFNWRITEOBJECTSECURITY */, 100 | lpContext: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.LPARAM */, 101 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 102 | return libDSSEC_dll.DSEditSecurity!((hwndOwner), util.pwstrToFfi(pwszObjectPath), util.pwstrToFfi(pwszObjectClass), dwFlags, util.pwstrToFfi(pwszCaption), util.toPointer(pfnReadSD), util.toPointer(pfnWriteSD), util.toPointer(lpContext)); 103 | } 104 | 105 | -------------------------------------------------------------------------------- /examples/hello_gl.ts: -------------------------------------------------------------------------------- 1 | import * as Wm from "../api/UI/WindowsAndMessaging.ts"; 2 | import * as Gfx from "../api/Graphics/OpenGL.ts"; 3 | import * as Gdi from "../api/Graphics/Gdi.ts"; 4 | 5 | function display() { 6 | Gfx.glClear(Gfx.GL_COLOR_BUFFER_BIT); 7 | Gfx.glBegin(Gfx.GL_TRIANGLES); 8 | Gfx.glColor3f(1.0, 0.0, 0.0); 9 | Gfx.glVertex2i(0, 1); 10 | Gfx.glColor3f(0.0, 1.0, 0.0); 11 | Gfx.glVertex2i(-1, -1); 12 | Gfx.glColor3f(0.0, 0.0, 1.0); 13 | Gfx.glVertex2i(1, -1); 14 | Gfx.glEnd(); 15 | Gfx.glFlush(); 16 | } 17 | 18 | const ps = Gdi.allocPAINTSTRUCT(); 19 | 20 | let clicks1 = 0, clicks2 = 0; 21 | 22 | const cb = new Deno.UnsafeCallback( 23 | { 24 | parameters: ["pointer", "u32", "pointer", "pointer"], 25 | result: "pointer", 26 | } as const, 27 | (hWnd, msg, wParam, lParam) => { 28 | switch (msg) { 29 | case Wm.WM_PAINT: { 30 | Gdi.BeginPaint(hWnd, ps); 31 | Gdi.EndPaint(hWnd, ps); 32 | return null; 33 | } 34 | 35 | case Wm.WM_SIZE: { 36 | const lParamInt = Number(Deno.UnsafePointer.value(lParam)); 37 | Gfx.glViewport(0, 0, lParamInt & 0xffff, lParamInt >> 16); 38 | Wm.PostMessageA(hWnd, Wm.WM_PAINT, null, null); 39 | return null; 40 | } 41 | 42 | case Wm.WM_COMMAND: { 43 | const wParamInt = Number(Deno.UnsafePointer.value(wParam)); 44 | if ((wParamInt & 0xffff) === Wm.BN_CLICKED) { 45 | if (Deno.UnsafePointer.equals(lParam, button1)) { 46 | Wm.SendMessageA( 47 | staticText1, 48 | Wm.WM_SETTEXT, 49 | null, 50 | new TextEncoder().encode(`Clicks: ${++clicks1}\0`), 51 | ); 52 | } else if (Deno.UnsafePointer.equals(lParam, button2)) { 53 | Wm.SendMessageA( 54 | staticText2, 55 | Wm.WM_SETTEXT, 56 | null, 57 | new TextEncoder().encode(`Clicks: ${++clicks2}\0`), 58 | ); 59 | } 60 | } 61 | return null; 62 | } 63 | 64 | case Wm.WM_CLOSE: { 65 | Deno.exit(0); 66 | } 67 | } 68 | return Wm.DefWindowProcA( 69 | hWnd, 70 | msg, 71 | wParam, 72 | lParam, 73 | ); 74 | }, 75 | ); 76 | 77 | const wc = Wm.allocWNDCLASSA({ 78 | style: Wm.CS_OWNDC, 79 | lpfnWndProc: cb.pointer, 80 | lpszClassName: "OpenGL", 81 | }); 82 | 83 | if (!Wm.RegisterClassA(wc)) { 84 | Wm.MessageBoxA( 85 | null, 86 | "RegisterClass() failed: Cannot register window class.", 87 | "Error", 88 | 0, 89 | ); 90 | Deno.exit(1); 91 | } 92 | 93 | function createOpenGLWindow( 94 | title: string, 95 | x: number, 96 | y: number, 97 | width: number, 98 | height: number, 99 | type: number, 100 | flags: number, 101 | ) { 102 | const hWnd = Wm.CreateWindowExA( 103 | Wm.WS_EX_OVERLAPPEDWINDOW, 104 | "OpenGL", 105 | title, 106 | Wm.WS_OVERLAPPEDWINDOW | Wm.WS_CLIPSIBLINGS | Wm.WS_CLIPCHILDREN, 107 | x, 108 | y, 109 | width, 110 | height, 111 | null, 112 | null, 113 | null, 114 | null, 115 | ); 116 | 117 | if (!hWnd) { 118 | Wm.MessageBoxA( 119 | null, 120 | "CreateWindowEx() failed: Cannot create a window.", 121 | "Error", 122 | 0, 123 | ); 124 | return; 125 | } 126 | 127 | const hdc = Gdi.GetDC(hWnd); 128 | 129 | const pfd = Gfx.allocPIXELFORMATDESCRIPTOR({ 130 | nSize: 40, 131 | nVersion: 1, 132 | dwFlags: Gfx.PFD_DRAW_TO_WINDOW | Gfx.PFD_SUPPORT_OPENGL | flags, 133 | iPixelType: type, 134 | cColorBits: 32, 135 | }); 136 | 137 | const pf = Gfx.ChoosePixelFormat(hdc, pfd); 138 | if (!pf) { 139 | Wm.MessageBoxA( 140 | null, 141 | "ChoosePixelFormat() failed: Cannot find a suitable pixel format.", 142 | "Error", 143 | 0, 144 | ); 145 | return; 146 | } 147 | 148 | if (!Gfx.SetPixelFormat(hdc, pf, pfd)) { 149 | Wm.MessageBoxA( 150 | null, 151 | "SetPixelFormat() failed: Cannot set format specified.", 152 | "Error", 153 | 0, 154 | ); 155 | return; 156 | } 157 | 158 | Gfx.DescribePixelFormat(hdc, pf, pfd.byteLength, pfd); 159 | 160 | Gdi.ReleaseDC(hWnd, hdc); 161 | 162 | return hWnd; 163 | } 164 | 165 | const msg = Wm.allocMSG(); 166 | 167 | const hWnd = createOpenGLWindow( 168 | "Deno Win32 OpenGL", 169 | 0, 170 | 0, 171 | 800, 172 | 600, 173 | Gfx.PFD_TYPE_RGBA, 174 | 0, 175 | ); 176 | if (!hWnd) { 177 | Deno.exit(1); 178 | } 179 | 180 | const button1 = Wm.CreateWindowExA( 181 | 0, 182 | "Button", 183 | "button1", 184 | Wm.WS_CHILD | Wm.WS_VISIBLE, 185 | 50, 186 | 50, 187 | 200, 188 | 25, 189 | hWnd, 190 | null, 191 | null, 192 | null, 193 | ); 194 | const button2 = Wm.CreateWindowExA( 195 | 0, 196 | "Button", 197 | "button2", 198 | Wm.WS_CHILD | Wm.WS_VISIBLE, 199 | 50, 200 | 100, 201 | 200, 202 | 75, 203 | hWnd, 204 | null, 205 | null, 206 | null, 207 | ); 208 | const staticText1 = Wm.CreateWindowExA( 209 | 0, 210 | "Static", 211 | "Clicks: 0", 212 | Wm.WS_CHILD | Wm.WS_VISIBLE, 213 | 50, 214 | 200, 215 | 200, 216 | 23, 217 | hWnd, 218 | null, 219 | null, 220 | null, 221 | ); 222 | const staticText2 = Wm.CreateWindowExA( 223 | 0, 224 | "Static", 225 | "Clicks: 0", 226 | Wm.WS_CHILD | Wm.WS_VISIBLE, 227 | 50, 228 | 230, 229 | 200, 230 | 23, 231 | hWnd, 232 | null, 233 | null, 234 | null, 235 | ); 236 | 237 | const hDC = Gdi.GetDC(hWnd); 238 | const hRC = Gfx.wglCreateContext(hDC); 239 | Gfx.wglMakeCurrent(hDC, hRC); 240 | 241 | Wm.ShowWindow(hWnd, 1); 242 | 243 | addEventListener("unload", () => { 244 | Gfx.wglMakeCurrent(null, null); 245 | Gdi.ReleaseDC(hWnd, hDC); 246 | Gfx.wglDeleteContext(hRC); 247 | Wm.DestroyWindow(hWnd); 248 | }); 249 | 250 | while (true) { 251 | display(); 252 | Gfx.SwapBuffers(hDC); 253 | 254 | while (Wm.PeekMessageA(msg, null, 0, 0, Wm.PM_REMOVE)) { 255 | Wm.TranslateMessage(msg); 256 | Wm.DispatchMessageA(msg); 257 | } 258 | } 259 | -------------------------------------------------------------------------------- /api/System/SubsystemForLinux.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.SubsystemForLinux.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type WSL_DISTRIBUTION_FLAGS = number; 7 | 8 | // Constants 9 | export const WSL_DISTRIBUTION_FLAGS_NONE = 0; 10 | export const WSL_DISTRIBUTION_FLAGS_ENABLE_INTEROP = 1; 11 | export const WSL_DISTRIBUTION_FLAGS_APPEND_NT_PATH = 2; 12 | export const WSL_DISTRIBUTION_FLAGS_ENABLE_DRIVE_MOUNTING = 4; 13 | 14 | // Structs 15 | 16 | export type PWSTR = Deno.PointerValue | Uint8Array; 17 | 18 | export type BOOL = number; 19 | 20 | export type HRESULT = number; 21 | 22 | export type HANDLE = bigint | number; 23 | 24 | // Native Libraries 25 | 26 | try { 27 | var libApi_ms_win_wsl_api_l1_1_0_dll = Deno.dlopen("Api-ms-win-wsl-api-l1-1-0.dll", { 28 | WslIsDistributionRegistered: { 29 | parameters: ["buffer"], 30 | result: "i32", 31 | optional: true, 32 | }, 33 | WslRegisterDistribution: { 34 | parameters: ["buffer", "buffer"], 35 | result: "pointer", 36 | optional: true, 37 | }, 38 | WslUnregisterDistribution: { 39 | parameters: ["buffer"], 40 | result: "pointer", 41 | optional: true, 42 | }, 43 | WslConfigureDistribution: { 44 | parameters: ["buffer", "u32", "u32"], 45 | result: "pointer", 46 | optional: true, 47 | }, 48 | WslGetDistributionConfiguration: { 49 | parameters: ["buffer", "pointer", "pointer", "pointer", "pointer", "pointer"], 50 | result: "pointer", 51 | optional: true, 52 | }, 53 | WslLaunchInteractive: { 54 | parameters: ["buffer", "buffer", "i32", "pointer"], 55 | result: "pointer", 56 | optional: true, 57 | }, 58 | WslLaunch: { 59 | parameters: ["buffer", "buffer", "i32", "pointer", "pointer", "pointer", "pointer"], 60 | result: "pointer", 61 | optional: true, 62 | }, 63 | }).symbols; 64 | } catch(e) { /* ignore */ } 65 | 66 | // Symbols 67 | 68 | export function WslIsDistributionRegistered( 69 | distributionName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 70 | ): boolean /* Windows.Win32.Foundation.BOOL */ { 71 | return util.boolFromFfi(libApi_ms_win_wsl_api_l1_1_0_dll.WslIsDistributionRegistered!(util.pwstrToFfi(distributionName))); 72 | } 73 | 74 | export function WslRegisterDistribution( 75 | distributionName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 76 | tarGzFilename: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 77 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 78 | return libApi_ms_win_wsl_api_l1_1_0_dll.WslRegisterDistribution!(util.pwstrToFfi(distributionName), util.pwstrToFfi(tarGzFilename)); 79 | } 80 | 81 | export function WslUnregisterDistribution( 82 | distributionName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 83 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 84 | return libApi_ms_win_wsl_api_l1_1_0_dll.WslUnregisterDistribution!(util.pwstrToFfi(distributionName)); 85 | } 86 | 87 | export function WslConfigureDistribution( 88 | distributionName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 89 | defaultUID: number /* u32 */, 90 | wslDistributionFlags: WSL_DISTRIBUTION_FLAGS /* Windows.Win32.System.SubsystemForLinux.WSL_DISTRIBUTION_FLAGS */, 91 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 92 | return libApi_ms_win_wsl_api_l1_1_0_dll.WslConfigureDistribution!(util.pwstrToFfi(distributionName), defaultUID, wslDistributionFlags); 93 | } 94 | 95 | export function WslGetDistributionConfiguration( 96 | distributionName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 97 | distributionVersion: Deno.PointerValue | Uint8Array /* ptr */, 98 | defaultUID: Deno.PointerValue | Uint8Array /* ptr */, 99 | wslDistributionFlags: Deno.PointerValue | Uint8Array /* ptr */, 100 | defaultEnvironmentVariables: Deno.PointerValue | Uint8Array /* ptr */, 101 | defaultEnvironmentVariableCount: Deno.PointerValue | Uint8Array /* ptr */, 102 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 103 | return libApi_ms_win_wsl_api_l1_1_0_dll.WslGetDistributionConfiguration!(util.pwstrToFfi(distributionName), util.toPointer(distributionVersion), util.toPointer(defaultUID), util.toPointer(wslDistributionFlags), util.toPointer(defaultEnvironmentVariables), util.toPointer(defaultEnvironmentVariableCount)); 104 | } 105 | 106 | export function WslLaunchInteractive( 107 | distributionName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 108 | command: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 109 | useCurrentWorkingDirectory: boolean /* Windows.Win32.Foundation.BOOL */, 110 | exitCode: Deno.PointerValue | Uint8Array /* ptr */, 111 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 112 | return libApi_ms_win_wsl_api_l1_1_0_dll.WslLaunchInteractive!(util.pwstrToFfi(distributionName), util.pwstrToFfi(command), util.boolToFfi(useCurrentWorkingDirectory), util.toPointer(exitCode)); 113 | } 114 | 115 | export function WslLaunch( 116 | distributionName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 117 | command: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 118 | useCurrentWorkingDirectory: boolean /* Windows.Win32.Foundation.BOOL */, 119 | stdIn: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.HANDLE */, 120 | stdOut: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.HANDLE */, 121 | stdErr: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.HANDLE */, 122 | process: Deno.PointerValue | Uint8Array /* ptr */, 123 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 124 | return libApi_ms_win_wsl_api_l1_1_0_dll.WslLaunch!(util.pwstrToFfi(distributionName), util.pwstrToFfi(command), util.boolToFfi(useCurrentWorkingDirectory), util.toPointer(stdIn), util.toPointer(stdOut), util.toPointer(stdErr), util.toPointer(process)); 125 | } 126 | 127 | -------------------------------------------------------------------------------- /api/Graphics/DirectManipulation.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Graphics.DirectManipulation.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type DIRECTMANIPULATION_STATUS = number; 7 | export type DIRECTMANIPULATION_HITTEST_TYPE = number; 8 | export type DIRECTMANIPULATION_CONFIGURATION = number; 9 | export type DIRECTMANIPULATION_GESTURE_CONFIGURATION = number; 10 | export type DIRECTMANIPULATION_MOTION_TYPES = number; 11 | export type DIRECTMANIPULATION_VIEWPORT_OPTIONS = number; 12 | export type DIRECTMANIPULATION_SNAPPOINT_TYPE = number; 13 | export type DIRECTMANIPULATION_SNAPPOINT_COORDINATE = number; 14 | export type DIRECTMANIPULATION_HORIZONTALALIGNMENT = number; 15 | export type DIRECTMANIPULATION_VERTICALALIGNMENT = number; 16 | export type DIRECTMANIPULATION_INPUT_MODE = number; 17 | export type DIRECTMANIPULATION_DRAG_DROP_STATUS = number; 18 | export type DIRECTMANIPULATION_DRAG_DROP_CONFIGURATION = number; 19 | export type DIRECTMANIPULATION_INTERACTION_TYPE = number; 20 | export type DIRECTMANIPULATION_AUTOSCROLL_CONFIGURATION = number; 21 | 22 | // Constants 23 | export const DIRECTMANIPULATION_KEYBOARDFOCUS = 4294967294; 24 | export const DIRECTMANIPULATION_MOUSEFOCUS = 4294967293; 25 | export const DIRECTMANIPULATION_BUILDING = 0; 26 | export const DIRECTMANIPULATION_ENABLED = 1; 27 | export const DIRECTMANIPULATION_DISABLED = 2; 28 | export const DIRECTMANIPULATION_RUNNING = 3; 29 | export const DIRECTMANIPULATION_INERTIA = 4; 30 | export const DIRECTMANIPULATION_READY = 5; 31 | export const DIRECTMANIPULATION_SUSPENDED = 6; 32 | export const DIRECTMANIPULATION_HITTEST_TYPE_ASYNCHRONOUS = 0; 33 | export const DIRECTMANIPULATION_HITTEST_TYPE_SYNCHRONOUS = 1; 34 | export const DIRECTMANIPULATION_HITTEST_TYPE_AUTO_SYNCHRONOUS = 2; 35 | export const DIRECTMANIPULATION_CONFIGURATION_NONE = 0; 36 | export const DIRECTMANIPULATION_CONFIGURATION_INTERACTION = 1; 37 | export const DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_X = 2; 38 | export const DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_Y = 4; 39 | export const DIRECTMANIPULATION_CONFIGURATION_SCALING = 16; 40 | export const DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_INERTIA = 32; 41 | export const DIRECTMANIPULATION_CONFIGURATION_SCALING_INERTIA = 128; 42 | export const DIRECTMANIPULATION_CONFIGURATION_RAILS_X = 256; 43 | export const DIRECTMANIPULATION_CONFIGURATION_RAILS_Y = 512; 44 | export const DIRECTMANIPULATION_GESTURE_NONE = 0; 45 | export const DIRECTMANIPULATION_GESTURE_DEFAULT = 0; 46 | export const DIRECTMANIPULATION_GESTURE_CROSS_SLIDE_VERTICAL = 8; 47 | export const DIRECTMANIPULATION_GESTURE_CROSS_SLIDE_HORIZONTAL = 16; 48 | export const DIRECTMANIPULATION_GESTURE_PINCH_ZOOM = 32; 49 | export const DIRECTMANIPULATION_MOTION_NONE = 0; 50 | export const DIRECTMANIPULATION_MOTION_TRANSLATEX = 1; 51 | export const DIRECTMANIPULATION_MOTION_TRANSLATEY = 2; 52 | export const DIRECTMANIPULATION_MOTION_ZOOM = 4; 53 | export const DIRECTMANIPULATION_MOTION_CENTERX = 16; 54 | export const DIRECTMANIPULATION_MOTION_CENTERY = 32; 55 | export const DIRECTMANIPULATION_MOTION_ALL = 55; 56 | export const DIRECTMANIPULATION_VIEWPORT_OPTIONS_DEFAULT = 0; 57 | export const DIRECTMANIPULATION_VIEWPORT_OPTIONS_AUTODISABLE = 1; 58 | export const DIRECTMANIPULATION_VIEWPORT_OPTIONS_MANUALUPDATE = 2; 59 | export const DIRECTMANIPULATION_VIEWPORT_OPTIONS_INPUT = 4; 60 | export const DIRECTMANIPULATION_VIEWPORT_OPTIONS_EXPLICITHITTEST = 8; 61 | export const DIRECTMANIPULATION_VIEWPORT_OPTIONS_DISABLEPIXELSNAPPING = 16; 62 | export const DIRECTMANIPULATION_SNAPPOINT_MANDATORY = 0; 63 | export const DIRECTMANIPULATION_SNAPPOINT_OPTIONAL = 1; 64 | export const DIRECTMANIPULATION_SNAPPOINT_MANDATORY_SINGLE = 2; 65 | export const DIRECTMANIPULATION_SNAPPOINT_OPTIONAL_SINGLE = 3; 66 | export const DIRECTMANIPULATION_COORDINATE_BOUNDARY = 0; 67 | export const DIRECTMANIPULATION_COORDINATE_ORIGIN = 1; 68 | export const DIRECTMANIPULATION_COORDINATE_MIRRORED = 16; 69 | export const DIRECTMANIPULATION_HORIZONTALALIGNMENT_NONE = 0; 70 | export const DIRECTMANIPULATION_HORIZONTALALIGNMENT_LEFT = 1; 71 | export const DIRECTMANIPULATION_HORIZONTALALIGNMENT_CENTER = 2; 72 | export const DIRECTMANIPULATION_HORIZONTALALIGNMENT_RIGHT = 4; 73 | export const DIRECTMANIPULATION_HORIZONTALALIGNMENT_UNLOCKCENTER = 8; 74 | export const DIRECTMANIPULATION_VERTICALALIGNMENT_NONE = 0; 75 | export const DIRECTMANIPULATION_VERTICALALIGNMENT_TOP = 1; 76 | export const DIRECTMANIPULATION_VERTICALALIGNMENT_CENTER = 2; 77 | export const DIRECTMANIPULATION_VERTICALALIGNMENT_BOTTOM = 4; 78 | export const DIRECTMANIPULATION_VERTICALALIGNMENT_UNLOCKCENTER = 8; 79 | export const DIRECTMANIPULATION_INPUT_MODE_AUTOMATIC = 0; 80 | export const DIRECTMANIPULATION_INPUT_MODE_MANUAL = 1; 81 | export const DIRECTMANIPULATION_DRAG_DROP_READY = 0; 82 | export const DIRECTMANIPULATION_DRAG_DROP_PRESELECT = 1; 83 | export const DIRECTMANIPULATION_DRAG_DROP_SELECTING = 2; 84 | export const DIRECTMANIPULATION_DRAG_DROP_DRAGGING = 3; 85 | export const DIRECTMANIPULATION_DRAG_DROP_CANCELLED = 4; 86 | export const DIRECTMANIPULATION_DRAG_DROP_COMMITTED = 5; 87 | export const DIRECTMANIPULATION_DRAG_DROP_CONFIGURATION_VERTICAL = 1; 88 | export const DIRECTMANIPULATION_DRAG_DROP_CONFIGURATION_HORIZONTAL = 2; 89 | export const DIRECTMANIPULATION_DRAG_DROP_CONFIGURATION_SELECT_ONLY = 16; 90 | export const DIRECTMANIPULATION_DRAG_DROP_CONFIGURATION_SELECT_DRAG = 32; 91 | export const DIRECTMANIPULATION_DRAG_DROP_CONFIGURATION_HOLD_DRAG = 64; 92 | export const DIRECTMANIPULATION_INTERACTION_BEGIN = 0; 93 | export const DIRECTMANIPULATION_INTERACTION_TYPE_MANIPULATION = 1; 94 | export const DIRECTMANIPULATION_INTERACTION_TYPE_GESTURE_TAP = 2; 95 | export const DIRECTMANIPULATION_INTERACTION_TYPE_GESTURE_HOLD = 3; 96 | export const DIRECTMANIPULATION_INTERACTION_TYPE_GESTURE_CROSS_SLIDE = 4; 97 | export const DIRECTMANIPULATION_INTERACTION_TYPE_GESTURE_PINCH_ZOOM = 5; 98 | export const DIRECTMANIPULATION_INTERACTION_END = 100; 99 | export const DIRECTMANIPULATION_AUTOSCROLL_CONFIGURATION_STOP = 0; 100 | export const DIRECTMANIPULATION_AUTOSCROLL_CONFIGURATION_FORWARD = 1; 101 | export const DIRECTMANIPULATION_AUTOSCROLL_CONFIGURATION_REVERSE = 2; 102 | 103 | // Structs 104 | 105 | // Native Libraries 106 | 107 | // Symbols 108 | 109 | -------------------------------------------------------------------------------- /api/System/EventNotificationService.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.EventNotificationService.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type SENS_CONNECTION_TYPE = number; 7 | 8 | // Constants 9 | export const CONNECTION_LAN = 0; 10 | export const CONNECTION_WAN = 1; 11 | export const NETWORK_ALIVE_LAN = 1; 12 | export const NETWORK_ALIVE_WAN = 2; 13 | export const NETWORK_ALIVE_AOL = 4; 14 | export const NETWORK_ALIVE_INTERNET = 8; 15 | export const CONNECTION_AOL = 4; 16 | 17 | // Structs 18 | 19 | /** 20 | * Windows.Win32.System.EventNotificationService.QOCINFO (size: 16) 21 | */ 22 | export interface QOCINFO { 23 | /** u32 */ 24 | dwSize: number; 25 | /** u32 */ 26 | dwFlags: number; 27 | /** u32 */ 28 | dwInSpeed: number; 29 | /** u32 */ 30 | dwOutSpeed: number; 31 | } 32 | 33 | export const sizeofQOCINFO = 16; 34 | 35 | export function allocQOCINFO(data?: Partial): Uint8Array { 36 | const buf = new Uint8Array(sizeofQOCINFO); 37 | const view = new DataView(buf.buffer); 38 | // 0x00: u32 39 | if (data?.dwSize !== undefined) view.setUint32(0, Number(data.dwSize), true); 40 | // 0x04: u32 41 | if (data?.dwFlags !== undefined) view.setUint32(4, Number(data.dwFlags), true); 42 | // 0x08: u32 43 | if (data?.dwInSpeed !== undefined) view.setUint32(8, Number(data.dwInSpeed), true); 44 | // 0x0c: u32 45 | if (data?.dwOutSpeed !== undefined) view.setUint32(12, Number(data.dwOutSpeed), true); 46 | return buf; 47 | } 48 | 49 | export class QOCINFOView { 50 | private readonly view: DataView; 51 | constructor(private readonly buf: Uint8Array) { 52 | this.view = new DataView(buf.buffer); 53 | } 54 | 55 | get buffer(): Uint8Array { 56 | return this.buf; 57 | } 58 | 59 | // 0x00: u32 60 | get dwSize(): number { 61 | return this.view.getUint32(0, true); 62 | } 63 | 64 | // 0x04: u32 65 | get dwFlags(): number { 66 | return this.view.getUint32(4, true); 67 | } 68 | 69 | // 0x08: u32 70 | get dwInSpeed(): number { 71 | return this.view.getUint32(8, true); 72 | } 73 | 74 | // 0x0c: u32 75 | get dwOutSpeed(): number { 76 | return this.view.getUint32(12, true); 77 | } 78 | 79 | // 0x00: u32 80 | set dwSize(value: number) { 81 | this.view.setUint32(0, value, true); 82 | } 83 | 84 | // 0x04: u32 85 | set dwFlags(value: number) { 86 | this.view.setUint32(4, value, true); 87 | } 88 | 89 | // 0x08: u32 90 | set dwInSpeed(value: number) { 91 | this.view.setUint32(8, value, true); 92 | } 93 | 94 | // 0x0c: u32 95 | set dwOutSpeed(value: number) { 96 | this.view.setUint32(12, value, true); 97 | } 98 | } 99 | 100 | /** 101 | * Windows.Win32.System.EventNotificationService.SENS_QOCINFO (size: 16) 102 | */ 103 | export interface SENS_QOCINFO { 104 | /** u32 */ 105 | dwSize: number; 106 | /** u32 */ 107 | dwFlags: number; 108 | /** u32 */ 109 | dwOutSpeed: number; 110 | /** u32 */ 111 | dwInSpeed: number; 112 | } 113 | 114 | export const sizeofSENS_QOCINFO = 16; 115 | 116 | export function allocSENS_QOCINFO(data?: Partial): Uint8Array { 117 | const buf = new Uint8Array(sizeofSENS_QOCINFO); 118 | const view = new DataView(buf.buffer); 119 | // 0x00: u32 120 | if (data?.dwSize !== undefined) view.setUint32(0, Number(data.dwSize), true); 121 | // 0x04: u32 122 | if (data?.dwFlags !== undefined) view.setUint32(4, Number(data.dwFlags), true); 123 | // 0x08: u32 124 | if (data?.dwOutSpeed !== undefined) view.setUint32(8, Number(data.dwOutSpeed), true); 125 | // 0x0c: u32 126 | if (data?.dwInSpeed !== undefined) view.setUint32(12, Number(data.dwInSpeed), true); 127 | return buf; 128 | } 129 | 130 | export class SENS_QOCINFOView { 131 | private readonly view: DataView; 132 | constructor(private readonly buf: Uint8Array) { 133 | this.view = new DataView(buf.buffer); 134 | } 135 | 136 | get buffer(): Uint8Array { 137 | return this.buf; 138 | } 139 | 140 | // 0x00: u32 141 | get dwSize(): number { 142 | return this.view.getUint32(0, true); 143 | } 144 | 145 | // 0x04: u32 146 | get dwFlags(): number { 147 | return this.view.getUint32(4, true); 148 | } 149 | 150 | // 0x08: u32 151 | get dwOutSpeed(): number { 152 | return this.view.getUint32(8, true); 153 | } 154 | 155 | // 0x0c: u32 156 | get dwInSpeed(): number { 157 | return this.view.getUint32(12, true); 158 | } 159 | 160 | // 0x00: u32 161 | set dwSize(value: number) { 162 | this.view.setUint32(0, value, true); 163 | } 164 | 165 | // 0x04: u32 166 | set dwFlags(value: number) { 167 | this.view.setUint32(4, value, true); 168 | } 169 | 170 | // 0x08: u32 171 | set dwOutSpeed(value: number) { 172 | this.view.setUint32(8, value, true); 173 | } 174 | 175 | // 0x0c: u32 176 | set dwInSpeed(value: number) { 177 | this.view.setUint32(12, value, true); 178 | } 179 | } 180 | 181 | export type PSTR = Deno.PointerValue | Uint8Array; 182 | 183 | export type BOOL = number; 184 | 185 | export type PWSTR = Deno.PointerValue | Uint8Array; 186 | 187 | // Native Libraries 188 | 189 | try { 190 | var libSensApi_dll = Deno.dlopen("SensApi.dll", { 191 | IsDestinationReachableA: { 192 | parameters: ["buffer", "pointer"], 193 | result: "i32", 194 | optional: true, 195 | }, 196 | IsDestinationReachableW: { 197 | parameters: ["buffer", "pointer"], 198 | result: "i32", 199 | optional: true, 200 | }, 201 | IsNetworkAlive: { 202 | parameters: ["pointer"], 203 | result: "i32", 204 | optional: true, 205 | }, 206 | }).symbols; 207 | } catch(e) { /* ignore */ } 208 | 209 | // Symbols 210 | 211 | export function IsDestinationReachableA( 212 | lpszDestination: string | null | Uint8Array /* Windows.Win32.Foundation.PSTR */, 213 | lpQOCInfo: Deno.PointerValue | Uint8Array /* ptr */, 214 | ): boolean /* Windows.Win32.Foundation.BOOL */ { 215 | return util.boolFromFfi(libSensApi_dll.IsDestinationReachableA!(util.pstrToFfi(lpszDestination), util.toPointer(lpQOCInfo))); 216 | } 217 | 218 | export function IsDestinationReachableW( 219 | lpszDestination: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 220 | lpQOCInfo: Deno.PointerValue | Uint8Array /* ptr */, 221 | ): boolean /* Windows.Win32.Foundation.BOOL */ { 222 | return util.boolFromFfi(libSensApi_dll.IsDestinationReachableW!(util.pwstrToFfi(lpszDestination), util.toPointer(lpQOCInfo))); 223 | } 224 | 225 | export function IsNetworkAlive( 226 | lpdwFlags: Deno.PointerValue | Uint8Array /* ptr */, 227 | ): boolean /* Windows.Win32.Foundation.BOOL */ { 228 | return util.boolFromFfi(libSensApi_dll.IsNetworkAlive!(util.toPointer(lpdwFlags))); 229 | } 230 | 231 | -------------------------------------------------------------------------------- /api/System/PasswordManagement.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.PasswordManagement.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Structs 6 | 7 | /** 8 | * Windows.Win32.System.PasswordManagement.CYPHER_BLOCK (size: 8) 9 | */ 10 | export interface CYPHER_BLOCK { 11 | /** array */ 12 | data: Deno.PointerValue; 13 | } 14 | 15 | export const sizeofCYPHER_BLOCK = 8; 16 | 17 | export function allocCYPHER_BLOCK(data?: Partial): Uint8Array { 18 | const buf = new Uint8Array(sizeofCYPHER_BLOCK); 19 | const view = new DataView(buf.buffer); 20 | // 0x00: pointer 21 | if (data?.data !== undefined) view.setBigUint64(0, data.data === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.data))), true); 22 | return buf; 23 | } 24 | 25 | export class CYPHER_BLOCKView { 26 | private readonly view: DataView; 27 | constructor(private readonly buf: Uint8Array) { 28 | this.view = new DataView(buf.buffer); 29 | } 30 | 31 | get buffer(): Uint8Array { 32 | return this.buf; 33 | } 34 | 35 | // 0x00: pointer 36 | get data(): Uint8Array | Deno.PointerValue { 37 | const ptr = this.view.getBigUint64(0, true); 38 | return Deno.UnsafePointer.create(ptr); 39 | } 40 | 41 | // 0x00: pointer 42 | set data(value: Uint8Array | Deno.PointerValue) { 43 | this.view.setBigUint64(0, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 44 | } 45 | } 46 | 47 | /** 48 | * Windows.Win32.System.PasswordManagement.LM_OWF_PASSWORD (size: 8) 49 | */ 50 | export interface LM_OWF_PASSWORD { 51 | /** array */ 52 | data: Deno.PointerValue; 53 | } 54 | 55 | export const sizeofLM_OWF_PASSWORD = 8; 56 | 57 | export function allocLM_OWF_PASSWORD(data?: Partial): Uint8Array { 58 | const buf = new Uint8Array(sizeofLM_OWF_PASSWORD); 59 | const view = new DataView(buf.buffer); 60 | // 0x00: pointer 61 | if (data?.data !== undefined) view.setBigUint64(0, data.data === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.data))), true); 62 | return buf; 63 | } 64 | 65 | export class LM_OWF_PASSWORDView { 66 | private readonly view: DataView; 67 | constructor(private readonly buf: Uint8Array) { 68 | this.view = new DataView(buf.buffer); 69 | } 70 | 71 | get buffer(): Uint8Array { 72 | return this.buf; 73 | } 74 | 75 | // 0x00: pointer 76 | get data(): Uint8Array | Deno.PointerValue { 77 | const ptr = this.view.getBigUint64(0, true); 78 | return Deno.UnsafePointer.create(ptr); 79 | } 80 | 81 | // 0x00: pointer 82 | set data(value: Uint8Array | Deno.PointerValue) { 83 | this.view.setBigUint64(0, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 84 | } 85 | } 86 | 87 | /** 88 | * Windows.Win32.System.PasswordManagement.SAMPR_ENCRYPTED_USER_PASSWORD (size: 8) 89 | */ 90 | export interface SAMPR_ENCRYPTED_USER_PASSWORD { 91 | /** array */ 92 | Buffer: Deno.PointerValue; 93 | } 94 | 95 | export const sizeofSAMPR_ENCRYPTED_USER_PASSWORD = 8; 96 | 97 | export function allocSAMPR_ENCRYPTED_USER_PASSWORD(data?: Partial): Uint8Array { 98 | const buf = new Uint8Array(sizeofSAMPR_ENCRYPTED_USER_PASSWORD); 99 | const view = new DataView(buf.buffer); 100 | // 0x00: pointer 101 | if (data?.Buffer !== undefined) view.setBigUint64(0, data.Buffer === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.Buffer))), true); 102 | return buf; 103 | } 104 | 105 | export class SAMPR_ENCRYPTED_USER_PASSWORDView { 106 | private readonly view: DataView; 107 | constructor(private readonly buf: Uint8Array) { 108 | this.view = new DataView(buf.buffer); 109 | } 110 | 111 | get buffer(): Uint8Array { 112 | return this.buf; 113 | } 114 | 115 | // 0x00: pointer 116 | get Buffer(): Uint8Array | Deno.PointerValue { 117 | const ptr = this.view.getBigUint64(0, true); 118 | return Deno.UnsafePointer.create(ptr); 119 | } 120 | 121 | // 0x00: pointer 122 | set Buffer(value: Uint8Array | Deno.PointerValue) { 123 | this.view.setBigUint64(0, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 124 | } 125 | } 126 | 127 | /** 128 | * Windows.Win32.System.PasswordManagement.ENCRYPTED_LM_OWF_PASSWORD (size: 8) 129 | */ 130 | export interface ENCRYPTED_LM_OWF_PASSWORD { 131 | /** array */ 132 | data: Deno.PointerValue; 133 | } 134 | 135 | export const sizeofENCRYPTED_LM_OWF_PASSWORD = 8; 136 | 137 | export function allocENCRYPTED_LM_OWF_PASSWORD(data?: Partial): Uint8Array { 138 | const buf = new Uint8Array(sizeofENCRYPTED_LM_OWF_PASSWORD); 139 | const view = new DataView(buf.buffer); 140 | // 0x00: pointer 141 | if (data?.data !== undefined) view.setBigUint64(0, data.data === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.data))), true); 142 | return buf; 143 | } 144 | 145 | export class ENCRYPTED_LM_OWF_PASSWORDView { 146 | private readonly view: DataView; 147 | constructor(private readonly buf: Uint8Array) { 148 | this.view = new DataView(buf.buffer); 149 | } 150 | 151 | get buffer(): Uint8Array { 152 | return this.buf; 153 | } 154 | 155 | // 0x00: pointer 156 | get data(): Uint8Array | Deno.PointerValue { 157 | const ptr = this.view.getBigUint64(0, true); 158 | return Deno.UnsafePointer.create(ptr); 159 | } 160 | 161 | // 0x00: pointer 162 | set data(value: Uint8Array | Deno.PointerValue) { 163 | this.view.setBigUint64(0, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 164 | } 165 | } 166 | 167 | export type PWSTR = Deno.PointerValue | Uint8Array; 168 | 169 | export type BOOLEAN = number; 170 | 171 | // Native Libraries 172 | 173 | try { 174 | var libADVAPI32_dll = Deno.dlopen("ADVAPI32.dll", { 175 | MSChapSrvChangePassword: { 176 | parameters: ["buffer", "buffer", "pointer", "pointer", "pointer", "pointer", "pointer"], 177 | result: "u32", 178 | optional: true, 179 | }, 180 | MSChapSrvChangePassword2: { 181 | parameters: ["buffer", "buffer", "pointer", "pointer", "pointer", "pointer", "pointer"], 182 | result: "u32", 183 | optional: true, 184 | }, 185 | }).symbols; 186 | } catch(e) { /* ignore */ } 187 | 188 | // Symbols 189 | 190 | export function MSChapSrvChangePassword( 191 | ServerName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 192 | UserName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 193 | LmOldPresent: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.BOOLEAN */, 194 | LmOldOwfPassword: Deno.PointerValue | Uint8Array /* ptr */, 195 | LmNewOwfPassword: Deno.PointerValue | Uint8Array /* ptr */, 196 | NtOldOwfPassword: Deno.PointerValue | Uint8Array /* ptr */, 197 | NtNewOwfPassword: Deno.PointerValue | Uint8Array /* ptr */, 198 | ): number /* u32 */ { 199 | return libADVAPI32_dll.MSChapSrvChangePassword!(util.pwstrToFfi(ServerName), util.pwstrToFfi(UserName), util.toPointer(LmOldPresent), util.toPointer(LmOldOwfPassword), util.toPointer(LmNewOwfPassword), util.toPointer(NtOldOwfPassword), util.toPointer(NtNewOwfPassword)); 200 | } 201 | 202 | export function MSChapSrvChangePassword2( 203 | ServerName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 204 | UserName: string | null | Uint8Array | Uint16Array /* Windows.Win32.Foundation.PWSTR */, 205 | NewPasswordEncryptedWithOldNt: Deno.PointerValue | Uint8Array /* ptr */, 206 | OldNtOwfPasswordEncryptedWithNewNt: Deno.PointerValue | Uint8Array /* ptr */, 207 | LmPresent: Uint8Array | Deno.PointerValue /* Windows.Win32.Foundation.BOOLEAN */, 208 | NewPasswordEncryptedWithOldLm: Deno.PointerValue | Uint8Array /* ptr */, 209 | OldLmOwfPasswordEncryptedWithNewLmOrNt: Deno.PointerValue | Uint8Array /* ptr */, 210 | ): number /* u32 */ { 211 | return libADVAPI32_dll.MSChapSrvChangePassword2!(util.pwstrToFfi(ServerName), util.pwstrToFfi(UserName), util.toPointer(NewPasswordEncryptedWithOldNt), util.toPointer(OldNtOwfPasswordEncryptedWithNewNt), util.toPointer(LmPresent), util.toPointer(NewPasswordEncryptedWithOldLm), util.toPointer(OldLmOwfPasswordEncryptedWithNewLmOrNt)); 212 | } 213 | 214 | -------------------------------------------------------------------------------- /api/Storage/FileHistory.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Storage.FileHistory.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type FH_TARGET_PROPERTY_TYPE = number; 7 | export type FH_TARGET_DRIVE_TYPES = number; 8 | export type FH_PROTECTED_ITEM_CATEGORY = number; 9 | export type FH_LOCAL_POLICY_TYPE = number; 10 | export type FH_RETENTION_TYPES = number; 11 | export type FH_BACKUP_STATUS = number; 12 | export type FH_DEVICE_VALIDATION_RESULT = number; 13 | export type FhBackupStopReason = number; 14 | 15 | // Constants 16 | export const FHCFG_E_CORRUPT_CONFIG_FILE = 333301576125121280n; 17 | export const FHCFG_E_CONFIG_FILE_NOT_FOUND = 289077019432715009n; 18 | export const FHCFG_E_CONFIG_ALREADY_EXISTS = 289078118944342786n; 19 | export const FHCFG_E_NO_VALID_CONFIGURATION_LOADED = 289079218455970563n; 20 | export const FHCFG_E_TARGET_NOT_CONNECTED = 289080317967598340n; 21 | export const FHCFG_E_CONFIGURATION_PREVIOUSLY_LOADED = 289081417479226117n; 22 | export const FHCFG_E_TARGET_VERIFICATION_FAILED = 289082516990853894n; 23 | export const FHCFG_E_TARGET_NOT_CONFIGURED = 289083616502481671n; 24 | export const FHCFG_E_TARGET_NOT_ENOUGH_FREE_SPACE = 289084716014109448n; 25 | export const FHCFG_E_TARGET_CANNOT_BE_USED = 289085815525737225n; 26 | export const FHCFG_E_INVALID_REHYDRATION_STATE = 289094611618759434n; 27 | export const FHCFG_E_RECOMMENDATION_CHANGE_NOT_ALLOWED = 289093512107131664n; 28 | export const FHCFG_E_TARGET_REHYDRATED_ELSEWHERE = 289095711130387217n; 29 | export const FHCFG_E_LEGACY_TARGET_UNSUPPORTED = 289920344851219218n; 30 | export const FHCFG_E_LEGACY_TARGET_VALIDATION_UNSUPPORTED = 289096810642014995n; 31 | export const FHCFG_E_LEGACY_BACKUP_USER_EXCLUDED = 289097910153642772n; 32 | export const FHCFG_E_LEGACY_BACKUP_NOT_FOUND = 289110004781548309n; 33 | export const FHSVC_E_BACKUP_BLOCKED = 1224980286203495936n; 34 | export const FHSVC_E_NOT_CONFIGURED = 289921444362847745n; 35 | export const FHSVC_E_CONFIG_DISABLED = 289922543874475522n; 36 | export const FHSVC_E_CONFIG_DISABLED_GP = 289923643386103299n; 37 | export const FHSVC_E_FATAL_CONFIG_ERROR = 289924742897731076n; 38 | export const FHSVC_E_CONFIG_REHYDRATING = 1225542093695616517n; 39 | export const FH_STATE_NOT_TRACKED = 0; 40 | export const FH_STATE_OFF = 1; 41 | export const FH_STATE_DISABLED_BY_GP = 2; 42 | export const FH_STATE_FATAL_CONFIG_ERROR = 3; 43 | export const FH_STATE_MIGRATING = 4; 44 | export const FH_STATE_REHYDRATING = 5; 45 | export const FH_STATE_TARGET_FS_LIMITATION = 13; 46 | export const FH_STATE_TARGET_ACCESS_DENIED = 14; 47 | export const FH_STATE_TARGET_VOLUME_DIRTY = 15; 48 | export const FH_STATE_TARGET_FULL_RETENTION_MAX = 16; 49 | export const FH_STATE_TARGET_FULL = 17; 50 | export const FH_STATE_STAGING_FULL = 18; 51 | export const FH_STATE_TARGET_LOW_SPACE_RETENTION_MAX = 19; 52 | export const FH_STATE_TARGET_LOW_SPACE = 20; 53 | export const FH_STATE_TARGET_ABSENT = 21; 54 | export const FH_STATE_TOO_MUCH_BEHIND = 240; 55 | export const FH_STATE_NO_ERROR = 255; 56 | export const FH_STATE_BACKUP_NOT_SUPPORTED = 2064; 57 | export const FH_STATE_RUNNING = 256; 58 | export const FH_TARGET_NAME = 0; 59 | export const FH_TARGET_URL = 1; 60 | export const FH_TARGET_DRIVE_TYPE = 2; 61 | export const MAX_TARGET_PROPERTY = 3; 62 | export const FH_DRIVE_UNKNOWN = 0; 63 | export const FH_DRIVE_REMOVABLE = 2; 64 | export const FH_DRIVE_FIXED = 3; 65 | export const FH_DRIVE_REMOTE = 4; 66 | export const FH_FOLDER = 0; 67 | export const FH_LIBRARY = 1; 68 | export const MAX_PROTECTED_ITEM_CATEGORY = 2; 69 | export const FH_FREQUENCY = 0; 70 | export const FH_RETENTION_TYPE = 1; 71 | export const FH_RETENTION_AGE = 2; 72 | export const MAX_LOCAL_POLICY = 3; 73 | export const FH_RETENTION_DISABLED = 0; 74 | export const FH_RETENTION_UNLIMITED = 1; 75 | export const FH_RETENTION_AGE_BASED = 2; 76 | export const MAX_RETENTION_TYPE = 3; 77 | export const FH_STATUS_DISABLED = 0; 78 | export const FH_STATUS_DISABLED_BY_GP = 1; 79 | export const FH_STATUS_ENABLED = 2; 80 | export const FH_STATUS_REHYDRATING = 3; 81 | export const MAX_BACKUP_STATUS = 4; 82 | export const FH_ACCESS_DENIED = 0; 83 | export const FH_INVALID_DRIVE_TYPE = 1; 84 | export const FH_READ_ONLY_PERMISSION = 2; 85 | export const FH_CURRENT_DEFAULT = 3; 86 | export const FH_NAMESPACE_EXISTS = 4; 87 | export const FH_TARGET_PART_OF_LIBRARY = 5; 88 | export const FH_VALID_TARGET = 6; 89 | export const MAX_VALIDATION_RESULT = 7; 90 | export const BackupInvalidStopReason = 0; 91 | export const BackupLimitUserBusyMachineOnAC = 1; 92 | export const BackupLimitUserIdleMachineOnDC = 2; 93 | export const BackupLimitUserBusyMachineOnDC = 3; 94 | export const BackupCancelled = 4; 95 | 96 | // Structs 97 | 98 | export type BOOL = number; 99 | 100 | export type HRESULT = number; 101 | 102 | export type FH_SERVICE_PIPE_HANDLE = bigint | number; 103 | 104 | // Native Libraries 105 | 106 | try { 107 | var libfhsvcctl_dll = Deno.dlopen("fhsvcctl.dll", { 108 | FhServiceOpenPipe: { 109 | parameters: ["i32", "pointer"], 110 | result: "pointer", 111 | optional: true, 112 | }, 113 | FhServiceClosePipe: { 114 | parameters: ["pointer"], 115 | result: "pointer", 116 | optional: true, 117 | }, 118 | FhServiceStartBackup: { 119 | parameters: ["pointer", "i32"], 120 | result: "pointer", 121 | optional: true, 122 | }, 123 | FhServiceStopBackup: { 124 | parameters: ["pointer", "i32"], 125 | result: "pointer", 126 | optional: true, 127 | }, 128 | FhServiceReloadConfiguration: { 129 | parameters: ["pointer"], 130 | result: "pointer", 131 | optional: true, 132 | }, 133 | FhServiceBlockBackup: { 134 | parameters: ["pointer"], 135 | result: "pointer", 136 | optional: true, 137 | }, 138 | FhServiceUnblockBackup: { 139 | parameters: ["pointer"], 140 | result: "pointer", 141 | optional: true, 142 | }, 143 | }).symbols; 144 | } catch(e) { /* ignore */ } 145 | 146 | // Symbols 147 | 148 | export function FhServiceOpenPipe( 149 | StartServiceIfStopped: boolean /* Windows.Win32.Foundation.BOOL */, 150 | Pipe: Deno.PointerValue | Uint8Array /* ptr */, 151 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 152 | return libfhsvcctl_dll.FhServiceOpenPipe!(util.boolToFfi(StartServiceIfStopped), util.toPointer(Pipe)); 153 | } 154 | 155 | export function FhServiceClosePipe( 156 | Pipe: Uint8Array | Deno.PointerValue /* Windows.Win32.System.WindowsProgramming.FH_SERVICE_PIPE_HANDLE */, 157 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 158 | return libfhsvcctl_dll.FhServiceClosePipe!(util.toPointer(Pipe)); 159 | } 160 | 161 | export function FhServiceStartBackup( 162 | Pipe: Uint8Array | Deno.PointerValue /* Windows.Win32.System.WindowsProgramming.FH_SERVICE_PIPE_HANDLE */, 163 | LowPriorityIo: boolean /* Windows.Win32.Foundation.BOOL */, 164 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 165 | return libfhsvcctl_dll.FhServiceStartBackup!(util.toPointer(Pipe), util.boolToFfi(LowPriorityIo)); 166 | } 167 | 168 | export function FhServiceStopBackup( 169 | Pipe: Uint8Array | Deno.PointerValue /* Windows.Win32.System.WindowsProgramming.FH_SERVICE_PIPE_HANDLE */, 170 | StopTracking: boolean /* Windows.Win32.Foundation.BOOL */, 171 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 172 | return libfhsvcctl_dll.FhServiceStopBackup!(util.toPointer(Pipe), util.boolToFfi(StopTracking)); 173 | } 174 | 175 | export function FhServiceReloadConfiguration( 176 | Pipe: Uint8Array | Deno.PointerValue /* Windows.Win32.System.WindowsProgramming.FH_SERVICE_PIPE_HANDLE */, 177 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 178 | return libfhsvcctl_dll.FhServiceReloadConfiguration!(util.toPointer(Pipe)); 179 | } 180 | 181 | export function FhServiceBlockBackup( 182 | Pipe: Uint8Array | Deno.PointerValue /* Windows.Win32.System.WindowsProgramming.FH_SERVICE_PIPE_HANDLE */, 183 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 184 | return libfhsvcctl_dll.FhServiceBlockBackup!(util.toPointer(Pipe)); 185 | } 186 | 187 | export function FhServiceUnblockBackup( 188 | Pipe: Uint8Array | Deno.PointerValue /* Windows.Win32.System.WindowsProgramming.FH_SERVICE_PIPE_HANDLE */, 189 | ): Deno.PointerValue /* Windows.Win32.Foundation.HRESULT */ { 190 | return libfhsvcctl_dll.FhServiceUnblockBackup!(util.toPointer(Pipe)); 191 | } 192 | 193 | -------------------------------------------------------------------------------- /api/System/Contacts.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.System.Contacts.Apis 2 | 3 | import * as util from "../../util.ts"; 4 | 5 | // Enums 6 | export type CONTACT_AGGREGATION_CREATE_OR_OPEN_OPTIONS = number; 7 | export type CONTACT_AGGREGATION_COLLECTION_OPTIONS = number; 8 | 9 | // Constants 10 | export const CGD_DEFAULT = 0; 11 | export const CGD_UNKNOWN_PROPERTY = 0; 12 | export const CGD_STRING_PROPERTY = 1; 13 | export const CGD_DATE_PROPERTY = 2; 14 | export const CGD_BINARY_PROPERTY = 4; 15 | export const CGD_ARRAY_NODE = 8; 16 | export const CONTACTPROP_PUB_NOTES = `Notes`; 17 | export const CONTACTPROP_PUB_MAILER = `Mailer`; 18 | export const CONTACTPROP_PUB_PROGID = `ProgID`; 19 | export const CONTACTPROP_PUB_GENDER = `Gender`; 20 | export const CONTACTPROP_PUB_GENDER_UNSPECIFIED = `Unspecified`; 21 | export const CONTACTPROP_PUB_GENDER_MALE = `Male`; 22 | export const CONTACTPROP_PUB_GENDER_FEMALE = `Female`; 23 | export const CONTACTPROP_PUB_CREATIONDATE = `CreationDate`; 24 | export const CONTACTPROP_PUB_L1_CONTACTIDCOLLECTION = `ContactIDCollection`; 25 | export const CONTACTPROP_PUB_L2_CONTACTID = `/ContactID`; 26 | export const CONTACTPROP_PUB_L3_VALUE = `/Value`; 27 | export const CONTACTPROP_PUB_L1_NAMECOLLECTION = `NameCollection`; 28 | export const CONTACTPROP_PUB_L2_NAME = `/Name`; 29 | export const CONTACTPROP_PUB_L3_FORMATTEDNAME = `/FormattedName`; 30 | export const CONTACTPROP_PUB_L3_PHONETIC = `/Phonetic`; 31 | export const CONTACTPROP_PUB_L3_PREFIX = `/Prefix`; 32 | export const CONTACTPROP_PUB_L3_TITLE = `/Title`; 33 | export const CONTACTPROP_PUB_L3_GIVENNAME = `/GivenName`; 34 | export const CONTACTPROP_PUB_L3_FAMILYNAME = `/FamilyName`; 35 | export const CONTACTPROP_PUB_L3_MIDDLENAME = `/MiddleName`; 36 | export const CONTACTPROP_PUB_L3_GENERATION = `/Generation`; 37 | export const CONTACTPROP_PUB_L3_SUFFIX = `/Suffix`; 38 | export const CONTACTPROP_PUB_L3_NICKNAME = `/NickName`; 39 | export const CONTACTPROP_PUB_L1_POSITIONCOLLECTION = `PositionCollection`; 40 | export const CONTACTPROP_PUB_L2_POSITION = `/Position`; 41 | export const CONTACTPROP_PUB_L3_ORGANIZATION = `/Organization`; 42 | export const CONTACTPROP_PUB_L3_COMPANY = `/Company`; 43 | export const CONTACTPROP_PUB_L3_DEPARTMENT = `/Department`; 44 | export const CONTACTPROP_PUB_L3_OFFICE = `/Office`; 45 | export const CONTACTPROP_PUB_L3_JOB_TITLE = `/JobTitle`; 46 | export const CONTACTPROP_PUB_L3_PROFESSION = `/Profession`; 47 | export const CONTACTPROP_PUB_L3_ROLE = `/Role`; 48 | export const CONTACTPROP_PUB_L1_PERSONCOLLECTION = `PersonCollection`; 49 | export const CONTACTPROP_PUB_L2_PERSON = `/Person`; 50 | export const CONTACTPROP_PUB_L3_PERSONID = `/PersonID`; 51 | export const CONTACTPROP_PUB_L1_DATECOLLECTION = `DateCollection`; 52 | export const CONTACTPROP_PUB_L2_DATE = `/Date`; 53 | export const CONTACTPROP_PUB_L1_EMAILADDRESSCOLLECTION = `EmailAddressCollection`; 54 | export const CONTACTPROP_PUB_L2_EMAILADDRESS = `/EmailAddress`; 55 | export const CONTACTPROP_PUB_L3_ADDRESS = `/Address`; 56 | export const CONTACTPROP_PUB_L3_TYPE = `/Type`; 57 | export const CONTACTPROP_PUB_L1_CERTIFICATECOLLECTION = `CertificateCollection`; 58 | export const CONTACTPROP_PUB_L2_CERTIFICATE = `/Certificate`; 59 | export const CONTACTPROP_PUB_L3_THUMBPRINT = `/ThumbPrint`; 60 | export const CONTACTPROP_PUB_L1_PHONENUMBERCOLLECTION = `PhoneNumberCollection`; 61 | export const CONTACTPROP_PUB_L2_PHONENUMBER = `/PhoneNumber`; 62 | export const CONTACTPROP_PUB_L3_NUMBER = `/Number`; 63 | export const CONTACTPROP_PUB_L3_ALTERNATE = `/Alternate`; 64 | export const CONTACTPROP_PUB_L1_PHYSICALADDRESSCOLLECTION = `PhysicalAddressCollection`; 65 | export const CONTACTPROP_PUB_L2_PHYSICALADDRESS = `/PhysicalAddress`; 66 | export const CONTACTPROP_PUB_L3_ADDRESSLABEL = `/AddressLabel`; 67 | export const CONTACTPROP_PUB_L3_STREET = `/Street`; 68 | export const CONTACTPROP_PUB_L3_LOCALITY = `/Locality`; 69 | export const CONTACTPROP_PUB_L3_REGION = `/Region`; 70 | export const CONTACTPROP_PUB_L3_POSTALCODE = `/PostalCode`; 71 | export const CONTACTPROP_PUB_L3_COUNTRY = `/Country`; 72 | export const CONTACTPROP_PUB_L3_POBOX = `/POBox`; 73 | export const CONTACTPROP_PUB_L3_EXTENDEDADDRESS = `/ExtendedAddress`; 74 | export const CONTACTPROP_PUB_L1_IMADDRESSCOLLECTION = `IMAddressCollection`; 75 | export const CONTACTPROP_PUB_L2_IMADDRESSENTRY = `/IMAddress`; 76 | export const CONTACTPROP_PUB_L3_PROTOCOL = `/Protocol`; 77 | export const CONTACTPROP_PUB_L1_URLCOLLECTION = `UrlCollection`; 78 | export const CONTACTPROP_PUB_L2_URL = `/Url`; 79 | export const CONTACTPROP_PUB_L1_PHOTOCOLLECTION = `PhotoCollection`; 80 | export const CONTACTPROP_PUB_L2_PHOTO = `/Photo`; 81 | export const CONTACTPROP_PUB_L3_URL = `/Url`; 82 | export const CONTACTLABEL_PUB_PREFERRED = `Preferred`; 83 | export const CONTACTLABEL_PUB_PERSONAL = `Personal`; 84 | export const CONTACTLABEL_PUB_BUSINESS = `Business`; 85 | export const CONTACTLABEL_PUB_OTHER = `Other`; 86 | export const CONTACTLABEL_PUB_VOICE = `Voice`; 87 | export const CONTACTLABEL_PUB_MOBILE = `Mobile`; 88 | export const CONTACTLABEL_PUB_PCS = `PCS`; 89 | export const CONTACTLABEL_PUB_CELLULAR = `Cellular`; 90 | export const CONTACTLABEL_PUB_CAR = `Car`; 91 | export const CONTACTLABEL_PUB_PAGER = `Pager`; 92 | export const CONTACTLABEL_PUB_TTY = `TTY`; 93 | export const CONTACTLABEL_PUB_FAX = `Fax`; 94 | export const CONTACTLABEL_PUB_VIDEO = `Video`; 95 | export const CONTACTLABEL_PUB_MODEM = `Modem`; 96 | export const CONTACTLABEL_PUB_BBS = `BBS`; 97 | export const CONTACTLABEL_PUB_ISDN = `ISDN`; 98 | export const CONTACTLABEL_PUB_AGENT = `Agent`; 99 | export const CONTACTLABEL_PUB_DOMESTIC = `Domestic`; 100 | export const CONTACTLABEL_PUB_INTERNATIONAL = `International`; 101 | export const CONTACTLABEL_PUB_POSTAL = `Postal`; 102 | export const CONTACTLABEL_PUB_PARCEL = `Parcel`; 103 | export const CONTACTLABEL_PUB_USERTILE = `UserTile`; 104 | export const CONTACTLABEL_PUB_LOGO = `Logo`; 105 | export const CONTACTLABEL_WAB_SPOUSE = `wab:Spouse`; 106 | export const CONTACTLABEL_WAB_CHILD = `wab:Child`; 107 | export const CONTACTLABEL_WAB_MANAGER = `wab:Manager`; 108 | export const CONTACTLABEL_WAB_ASSISTANT = `wab:Assistant`; 109 | export const CONTACTLABEL_WAB_BIRTHDAY = `wab:Birthday`; 110 | export const CONTACTLABEL_WAB_ANNIVERSARY = `wab:Anniversary`; 111 | export const CONTACTLABEL_WAB_SOCIALNETWORK = `wab:SocialNetwork`; 112 | export const CONTACTLABEL_WAB_SCHOOL = `wab:School`; 113 | export const CONTACTLABEL_WAB_WISHLIST = `wab:WishList`; 114 | export const CA_CREATE_LOCAL = 0; 115 | export const CA_CREATE_EXTERNAL = 1; 116 | export const CACO_DEFAULT = 0; 117 | export const CACO_INCLUDE_EXTERNAL = 1; 118 | export const CACO_EXTERNAL_ONLY = 2; 119 | 120 | // Structs 121 | 122 | /** 123 | * Windows.Win32.System.Contacts.CONTACT_AGGREGATION_BLOB (size: 16) 124 | */ 125 | export interface CONTACT_AGGREGATION_BLOB { 126 | /** u32 */ 127 | dwCount: number; 128 | /** ptr */ 129 | lpb: Deno.PointerValue | Uint8Array; 130 | } 131 | 132 | export const sizeofCONTACT_AGGREGATION_BLOB = 16; 133 | 134 | export function allocCONTACT_AGGREGATION_BLOB(data?: Partial): Uint8Array { 135 | const buf = new Uint8Array(sizeofCONTACT_AGGREGATION_BLOB); 136 | const view = new DataView(buf.buffer); 137 | // 0x00: u32 138 | if (data?.dwCount !== undefined) view.setUint32(0, Number(data.dwCount), true); 139 | // 0x04: pad4 140 | // 0x08: pointer 141 | if (data?.lpb !== undefined) view.setBigUint64(8, data.lpb === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.lpb))), true); 142 | return buf; 143 | } 144 | 145 | export class CONTACT_AGGREGATION_BLOBView { 146 | private readonly view: DataView; 147 | constructor(private readonly buf: Uint8Array) { 148 | this.view = new DataView(buf.buffer); 149 | } 150 | 151 | get buffer(): Uint8Array { 152 | return this.buf; 153 | } 154 | 155 | // 0x00: u32 156 | get dwCount(): number { 157 | return this.view.getUint32(0, true); 158 | } 159 | 160 | // 0x04: pad4 161 | 162 | // 0x08: pointer 163 | get lpb(): Uint8Array | Deno.PointerValue { 164 | const ptr = this.view.getBigUint64(8, true); 165 | return Deno.UnsafePointer.create(ptr); 166 | } 167 | 168 | // 0x00: u32 169 | set dwCount(value: number) { 170 | this.view.setUint32(0, value, true); 171 | } 172 | 173 | // 0x04: pad4 174 | 175 | // 0x08: pointer 176 | set lpb(value: Uint8Array | Deno.PointerValue) { 177 | this.view.setBigUint64(8, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 178 | } 179 | } 180 | 181 | // Native Libraries 182 | 183 | // Symbols 184 | 185 | -------------------------------------------------------------------------------- /api/Media/Audio/Endpoints.ts: -------------------------------------------------------------------------------- 1 | /// Auto-generated by Deno Win32: Windows.Win32.Media.Audio.Endpoints.Apis 2 | 3 | import * as util from "../../../util.ts"; 4 | 5 | // Enums 6 | export type EndpointConnectorType = number; 7 | 8 | // Constants 9 | export const eHostProcessConnector = 0; 10 | export const eOffloadConnector = 1; 11 | export const eLoopbackConnector = 2; 12 | export const eKeywordDetectorConnector = 3; 13 | export const eConnectorCount = 4; 14 | 15 | // Structs 16 | 17 | /** 18 | * Windows.Win32.UI.Shell.PropertiesSystem.PROPERTYKEY (size: 16) 19 | */ 20 | export interface PROPERTYKEY { 21 | /** System.Guid */ 22 | fmtid: Uint8Array | Deno.PointerValue; 23 | /** u32 */ 24 | pid: number; 25 | } 26 | 27 | export const sizeofPROPERTYKEY = 16; 28 | 29 | export function allocPROPERTYKEY(data?: Partial): Uint8Array { 30 | const buf = new Uint8Array(sizeofPROPERTYKEY); 31 | const view = new DataView(buf.buffer); 32 | // 0x00: pointer 33 | if (data?.fmtid !== undefined) view.setBigUint64(0, data.fmtid === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.fmtid))), true); 34 | // 0x08: u32 35 | if (data?.pid !== undefined) view.setUint32(8, Number(data.pid), true); 36 | // 0x0c: pad4 37 | return buf; 38 | } 39 | 40 | export class PROPERTYKEYView { 41 | private readonly view: DataView; 42 | constructor(private readonly buf: Uint8Array) { 43 | this.view = new DataView(buf.buffer); 44 | } 45 | 46 | get buffer(): Uint8Array { 47 | return this.buf; 48 | } 49 | 50 | // 0x00: pointer 51 | get fmtid(): Uint8Array | Deno.PointerValue { 52 | const ptr = this.view.getBigUint64(0, true); 53 | return Deno.UnsafePointer.create(ptr); 54 | } 55 | 56 | // 0x08: u32 57 | get pid(): number { 58 | return this.view.getUint32(8, true); 59 | } 60 | 61 | // 0x0c: pad4 62 | 63 | // 0x00: pointer 64 | set fmtid(value: Uint8Array | Deno.PointerValue) { 65 | this.view.setBigUint64(0, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 66 | } 67 | 68 | // 0x08: u32 69 | set pid(value: number) { 70 | this.view.setUint32(8, value, true); 71 | } 72 | 73 | // 0x0c: pad4 74 | } 75 | 76 | /** 77 | * Windows.Win32.Media.Audio.WAVEFORMATEX (size: 24) 78 | */ 79 | export interface WAVEFORMATEX { 80 | /** u16 */ 81 | wFormatTag: number; 82 | /** u16 */ 83 | nChannels: number; 84 | /** u32 */ 85 | nSamplesPerSec: number; 86 | /** u32 */ 87 | nAvgBytesPerSec: number; 88 | /** u16 */ 89 | nBlockAlign: number; 90 | /** u16 */ 91 | wBitsPerSample: number; 92 | /** u16 */ 93 | cbSize: number; 94 | } 95 | 96 | export const sizeofWAVEFORMATEX = 24; 97 | 98 | export function allocWAVEFORMATEX(data?: Partial): Uint8Array { 99 | const buf = new Uint8Array(sizeofWAVEFORMATEX); 100 | const view = new DataView(buf.buffer); 101 | // 0x00: u16 102 | if (data?.wFormatTag !== undefined) view.setUint16(0, Number(data.wFormatTag), true); 103 | // 0x02: u16 104 | if (data?.nChannels !== undefined) view.setUint16(2, Number(data.nChannels), true); 105 | // 0x04: u32 106 | if (data?.nSamplesPerSec !== undefined) view.setUint32(4, Number(data.nSamplesPerSec), true); 107 | // 0x08: u32 108 | if (data?.nAvgBytesPerSec !== undefined) view.setUint32(8, Number(data.nAvgBytesPerSec), true); 109 | // 0x0c: u16 110 | if (data?.nBlockAlign !== undefined) view.setUint16(12, Number(data.nBlockAlign), true); 111 | // 0x0e: u16 112 | if (data?.wBitsPerSample !== undefined) view.setUint16(14, Number(data.wBitsPerSample), true); 113 | // 0x10: u16 114 | if (data?.cbSize !== undefined) view.setUint16(16, Number(data.cbSize), true); 115 | // 0x12: pad6 116 | return buf; 117 | } 118 | 119 | export class WAVEFORMATEXView { 120 | private readonly view: DataView; 121 | constructor(private readonly buf: Uint8Array) { 122 | this.view = new DataView(buf.buffer); 123 | } 124 | 125 | get buffer(): Uint8Array { 126 | return this.buf; 127 | } 128 | 129 | // 0x00: u16 130 | get wFormatTag(): number { 131 | return this.view.getUint16(0, true); 132 | } 133 | 134 | // 0x02: u16 135 | get nChannels(): number { 136 | return this.view.getUint16(2, true); 137 | } 138 | 139 | // 0x04: u32 140 | get nSamplesPerSec(): number { 141 | return this.view.getUint32(4, true); 142 | } 143 | 144 | // 0x08: u32 145 | get nAvgBytesPerSec(): number { 146 | return this.view.getUint32(8, true); 147 | } 148 | 149 | // 0x0c: u16 150 | get nBlockAlign(): number { 151 | return this.view.getUint16(12, true); 152 | } 153 | 154 | // 0x0e: u16 155 | get wBitsPerSample(): number { 156 | return this.view.getUint16(14, true); 157 | } 158 | 159 | // 0x10: u16 160 | get cbSize(): number { 161 | return this.view.getUint16(16, true); 162 | } 163 | 164 | // 0x12: pad6 165 | 166 | // 0x00: u16 167 | set wFormatTag(value: number) { 168 | this.view.setUint16(0, value, true); 169 | } 170 | 171 | // 0x02: u16 172 | set nChannels(value: number) { 173 | this.view.setUint16(2, value, true); 174 | } 175 | 176 | // 0x04: u32 177 | set nSamplesPerSec(value: number) { 178 | this.view.setUint32(4, value, true); 179 | } 180 | 181 | // 0x08: u32 182 | set nAvgBytesPerSec(value: number) { 183 | this.view.setUint32(8, value, true); 184 | } 185 | 186 | // 0x0c: u16 187 | set nBlockAlign(value: number) { 188 | this.view.setUint16(12, value, true); 189 | } 190 | 191 | // 0x0e: u16 192 | set wBitsPerSample(value: number) { 193 | this.view.setUint16(14, value, true); 194 | } 195 | 196 | // 0x10: u16 197 | set cbSize(value: number) { 198 | this.view.setUint16(16, value, true); 199 | } 200 | 201 | // 0x12: pad6 202 | } 203 | 204 | /** 205 | * Windows.Win32.Media.Audio.Endpoints.AUDIO_ENDPOINT_SHARED_CREATE_PARAMS (size: 24) 206 | */ 207 | export interface AUDIO_ENDPOINT_SHARED_CREATE_PARAMS { 208 | /** u32 */ 209 | u32Size: number; 210 | /** u32 */ 211 | u32TSSessionId: number; 212 | /** Windows.Win32.Media.Audio.Endpoints.EndpointConnectorType */ 213 | targetEndpointConnectorType: EndpointConnectorType; 214 | /** Windows.Win32.Media.Audio.WAVEFORMATEX */ 215 | wfxDeviceFormat: Uint8Array | Deno.PointerValue; 216 | } 217 | 218 | export const sizeofAUDIO_ENDPOINT_SHARED_CREATE_PARAMS = 24; 219 | 220 | export function allocAUDIO_ENDPOINT_SHARED_CREATE_PARAMS(data?: Partial): Uint8Array { 221 | const buf = new Uint8Array(sizeofAUDIO_ENDPOINT_SHARED_CREATE_PARAMS); 222 | const view = new DataView(buf.buffer); 223 | // 0x00: u32 224 | if (data?.u32Size !== undefined) view.setUint32(0, Number(data.u32Size), true); 225 | // 0x04: u32 226 | if (data?.u32TSSessionId !== undefined) view.setUint32(4, Number(data.u32TSSessionId), true); 227 | // 0x08: i32 228 | if (data?.targetEndpointConnectorType !== undefined) view.setInt32(8, Number(data.targetEndpointConnectorType), true); 229 | // 0x0c: pad4 230 | // 0x10: pointer 231 | if (data?.wfxDeviceFormat !== undefined) view.setBigUint64(16, data.wfxDeviceFormat === null ? 0n : BigInt(Deno.UnsafePointer.value(util.toPointer(data.wfxDeviceFormat))), true); 232 | return buf; 233 | } 234 | 235 | export class AUDIO_ENDPOINT_SHARED_CREATE_PARAMSView { 236 | private readonly view: DataView; 237 | constructor(private readonly buf: Uint8Array) { 238 | this.view = new DataView(buf.buffer); 239 | } 240 | 241 | get buffer(): Uint8Array { 242 | return this.buf; 243 | } 244 | 245 | // 0x00: u32 246 | get u32Size(): number { 247 | return this.view.getUint32(0, true); 248 | } 249 | 250 | // 0x04: u32 251 | get u32TSSessionId(): number { 252 | return this.view.getUint32(4, true); 253 | } 254 | 255 | // 0x08: i32 256 | get targetEndpointConnectorType(): number { 257 | return this.view.getInt32(8, true); 258 | } 259 | 260 | // 0x0c: pad4 261 | 262 | // 0x10: pointer 263 | get wfxDeviceFormat(): Uint8Array | Deno.PointerValue { 264 | const ptr = this.view.getBigUint64(16, true); 265 | return Deno.UnsafePointer.create(ptr); 266 | } 267 | 268 | // 0x00: u32 269 | set u32Size(value: number) { 270 | this.view.setUint32(0, value, true); 271 | } 272 | 273 | // 0x04: u32 274 | set u32TSSessionId(value: number) { 275 | this.view.setUint32(4, value, true); 276 | } 277 | 278 | // 0x08: i32 279 | set targetEndpointConnectorType(value: number) { 280 | this.view.setInt32(8, value, true); 281 | } 282 | 283 | // 0x0c: pad4 284 | 285 | // 0x10: pointer 286 | set wfxDeviceFormat(value: Uint8Array | Deno.PointerValue) { 287 | this.view.setBigUint64(16, BigInt(Deno.UnsafePointer.value(util.toPointer(value))), true); 288 | } 289 | } 290 | 291 | // Native Libraries 292 | 293 | // Symbols 294 | 295 | --------------------------------------------------------------------------------