Skip to content

Commit

Permalink
ci: PRINTER_DEFAULTS.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
waitingsong committed Jun 17, 2024
1 parent b26f17b commit a29f796
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
43 changes: 43 additions & 0 deletions packages/win32-def/src/lib/winspool/PRINTER_DEFAULTS.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import * as W from '../common.def.js'
import * as M from '../common.types.js'
import { genStruct, type KoffiTypeResult } from '../helper2.js'
import { DEVMODEW_Factory, DEVMODEW_Type } from '../wingdi/DEVMODEW.js'


const key = 'PRINTER_DEFAULTS'
const ptr = `${key}*`
const init = {
pDatatype: W.LPTSTR,
pDevMode: DEVMODEW_Factory,
DesiredAccess: W.ACCESS_MASK,
} as const

/**
* PRINTER_DEFAULTS structure,
* Specifies the default data type, environment, initialization data, and access rights for a printer.
* @link https://learn.microsoft.com/en-us/windows/win32/printdocs/printer-defaults
*/
export function PRINTER_DEFAULTS_Factory(): KoffiTypeResult {
return genStruct(init, key, ptr)
}

/**
* PRINTER_DEFAULTS structure,
* Specifies the default data type, environment, initialization data, and access rights for a printer.
* @link https://learn.microsoft.com/en-us/windows/win32/printdocs/printer-defaults
*/
export interface PRINTER_DEFAULTS_Type {
/**
* Pointer to a null-terminated string that specifies the default data type for a printer.
*/
pDatatype: M.LPTSTR
/**
* Pointer to a DEVMODE structure that identifies the default environment and initialization data for a printer.
*/
pDevMode: DEVMODEW_Type
DesiredAccess: M.ACCESS_MASK
}

export const PPRINTER_DEFAULTS = ptr
export const PRINTER_DEFAULTS_Init = init

1 change: 1 addition & 0 deletions packages/win32-def/src/lib/winspool/winspool.index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

export * from './DOC_INFO_1.js'
export * from './PRINTER_DEFAULTS.js'
export * from './PRINTPROCESSOR_INFO_1.js'

21 changes: 21 additions & 0 deletions packages/win32-def/test/winspool/603.PRINTER_DEFAULTS.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { fileShortPath } from '@waiting/shared-core'

import { PRINTER_DEFAULTS_Factory, PPRINTER_DEFAULTS } from '##/index.struct.js'
import { assertStructUnion } from '#@/helper.js'


const name = 'PRINTER_DEFAULTS'
const pointer = PPRINTER_DEFAULTS
const factory = PRINTER_DEFAULTS_Factory
const size = 232
const fn = `${name}_Factory`

describe(fileShortPath(import.meta.url), () => {
describe(fn, () => {
it('normal', () => {
const data = factory()
assertStructUnion(data, { name, pointer, size })
})
})
})

0 comments on commit a29f796

Please sign in to comment.