IsValidDevmode function

The IsValidDevmode function verifies that the contents of a DEVMODE structure are valid.

Syntax


BOOL IsValidDevmode(
  _In_ PDEVMODE pDevmode,
       size_t   DevmodeSize
);

Parameters

pDevmode [in]

A pointer to the DEVMODE to validate.

DevmodeSize

The size in bytes of the input byte buffer.

Return value

TRUE, if the DEVMODE is structurally valid. If minor errors are found the function will fix them and return TRUE.

FALSE, if the DEVMODE has one or more significant structural problems. For example, its dmSize member is misaligned or specifies a buffer that is too small. Also, FALSE if pDevmode is NULL.

Remarks

No private printer driver fields of the DEVMODE are checked, only the public fields.

Callers should use dmSize+dmDriverExtra for DevmodeSize only if they can guarantee that the input buffer size is at least that big. Since the DEVMODE is generally untrusted data, the values that are in the input buffer at the dmSize and dmDriverExtra offsets are also untrusted.

This function is executable in Least-Privileged User Account (LUA) context.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Winspool.h

Library

Winspool.lib

DLL

Winspool.drv

Unicode and ANSI names

IsValidDevmodeW (Unicode) and IsValidDevmodeA (ANSI)

See also

Printing
Print Spooler API Functions
DEVMODE

 

 

Show: