-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b26f17b
commit a29f796
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
21
packages/win32-def/test/winspool/603.PRINTER_DEFAULTS.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }) | ||
}) | ||
}) | ||
}) | ||
|