ReactOS  0.4.15-dev-3439-g2693a26
forms.c File Reference
#include "precomp.h"
Include dependency graph for forms.c:

Go to the source code of this file.

Classes

struct  _FORM_INFO_LIST
 
struct  _REGISTRYFORMINFO
 

Macros

#define FORMINFOSIG   '.2'
 
#define FORMMAXNAMESIZE   CCHDEVICENAME-1
 

Typedefs

typedef struct _FORM_INFO_LIST FORM_INFO_LIST
 
typedef struct _FORM_INFO_LISTPFORM_INFO_LIST
 
typedef struct _REGISTRYFORMINFO REGISTRYFORMINFO
 
typedef struct _REGISTRYFORMINFOPREGISTRYFORMINFO
 
typedef void(* PLocalGetFormLevelFunc) (PFORM_INFO_LIST, PVOID, PBYTE *, PDWORD)
 

Functions

BOOL InitializeFormList (VOID)
 
PFORM_INFO_LIST FASTCALL FindForm (WCHAR *pFormName, WCHAR *pKeyword)
 
static void _LocalGetFormLevel1 (PFORM_INFO_LIST pfil, PFORM_INFO_1W *ppFormInfo, PBYTE *ppFormInfoEnd, PDWORD pcbNeeded)
 
static void _LocalGetFormLevel2 (PFORM_INFO_LIST pfil, PFORM_INFO_2W *ppFormInfo, PBYTE *ppFormInfoEnd, PDWORD pcbNeeded)
 
BOOL WINAPI LocalAddForm (HANDLE hPrinter, DWORD Level, PBYTE pForm)
 
BOOL WINAPI LocalDeleteForm (HANDLE hPrinter, PWSTR pFormName)
 
BOOL WINAPI LocalEnumForms (HANDLE hPrinter, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
 
BOOL WINAPI LocalGetForm (HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded)
 
BOOL WINAPI LocalSetForm (HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm)
 

Variables

LIST_ENTRY FormList
 
static DWORD _dwLastForm
 
static DWORD dwFormInfo1Offsets []
 
static DWORD dwFormInfo2Offsets []
 
WCHAR wszLetter [] = L"Letter"
 
WCHAR wszLetterSmall [] = L"Letter Small"
 
WCHAR wszTabloid [] = L"Tabloid"
 
WCHAR wszLedger [] = L"Ledger"
 
WCHAR wszLegal [] = L"Legal"
 
WCHAR wszStatement [] = L"Statement"
 
WCHAR wszExecutive [] = L"Executive"
 
WCHAR wszA3 [] = L"A3"
 
WCHAR wszA4 [] = L"A4"
 
WCHAR wszA4Small [] = L"A4 Small"
 
WCHAR wszA5 [] = L"A5"
 
WCHAR wszB4JIS [] = L"B4 (JIS)"
 
WCHAR wszB5JIS [] = L"B5 (JIS)"
 
WCHAR wszFolio [] = L"Folio"
 
WCHAR wszQuarto [] = L"Quarto"
 
WCHAR wsz10x14 [] = L"10 x 14"
 
WCHAR wsz11x17 [] = L"11 x 17"
 
WCHAR wszNote [] = L"Note"
 
WCHAR wszEnvelope9 [] = L"Envelope #9"
 
WCHAR wszEnvelope10 [] = L"Envelope #10"
 
WCHAR wszEnvelope11 [] = L"Envelope #11"
 
WCHAR wszEnvelope12 [] = L"Envelope #12"
 
WCHAR wszEnvelope14 [] = L"Envelope #14"
 
WCHAR wszCsizesheet [] = L"C size sheet"
 
WCHAR wszDsizesheet [] = L"D size sheet"
 
WCHAR wszEsizesheet [] = L"E size sheet"
 
WCHAR wszEnvelopeDL [] = L"Envelope DL"
 
WCHAR wszEnvelopeC5 [] = L"Envelope C5"
 
WCHAR wszEnvelopeC3 [] = L"Envelope C3"
 
WCHAR wszEnvelopeC4 [] = L"Envelope C4"
 
WCHAR wszEnvelopeC6 [] = L"Envelope C6"
 
WCHAR wszEnvelope65 [] = L"Envelope 65"
 
WCHAR wszEnvelopeB4 [] = L"Envelope B4"
 
WCHAR wszEnvelopeB5 [] = L"Envelope B5"
 
WCHAR wszEnvelopeB6 [] = L"Envelope B6"
 
WCHAR wszEnvelope [] = L"Envelope"
 
WCHAR wszEnvelopeMonarch [] = L"Envelope Monarch"
 
WCHAR wsz634Envelope [] = L"6 3/4 Envelope"
 
WCHAR wszUSStdFanfold [] = L"US Std Fanfold"
 
WCHAR wszGermanStdFanfold [] = L"German Std Fanfold"
 
WCHAR wszGermanLegalFanfold [] = L"German Legal Fanfold"
 
WCHAR wszB4ISO [] = L"B4 (ISO)"
 
WCHAR wszJapanesePostcard [] = L"Japanese Postcard"
 
WCHAR wsz9x11 [] = L"9 x 11"
 
WCHAR wsz10x11 [] = L"10 x 11"
 
WCHAR wsz15x11 [] = L"15 x 11"
 
WCHAR wszEnvelopeInvite [] = L"Envelope Invite"
 
WCHAR wszReserved48 [] = L"Reserved48"
 
WCHAR wszReserved49 [] = L"Reserved49"
 
WCHAR wszLetterExtra [] = L"Letter Extra"
 
WCHAR wszLegalExtra [] = L"Legal Extra"
 
WCHAR wszTabloidExtra [] = L"Tabloid Extra"
 
WCHAR wszA4Extra [] = L"A4 Extra"
 
WCHAR wszLetterTransverse [] = L"Letter Transverse"
 
WCHAR wszA4Transverse [] = L"A4 Transverse"
 
WCHAR wszLetterExtraTransverse [] = L"Letter Extra Transverse"
 
WCHAR wszSuperA [] = L"Super A"
 
WCHAR wszSuperB [] = L"Super B"
 
WCHAR wszLetterPlus [] = L"Letter Plus"
 
WCHAR wszA4Plus [] = L"A4 Plus"
 
WCHAR wszA5Transverse [] = L"A5 Transverse"
 
WCHAR wszB5JISTransverse [] = L"B5 (JIS) Transverse"
 
WCHAR wszA3Extra [] = L"A3 Extra"
 
WCHAR wszA5Extra [] = L"A5 Extra"
 
WCHAR wszB5ISOExtra [] = L"B5 (ISO) Extra"
 
WCHAR wszA0 [] = L"A0"
 
WCHAR wszA3Transverse [] = L"A3 Transverse"
 
WCHAR wszA3ExtraTransverse [] = L"A3 Extra Transverse"
 
WCHAR wszJapaneseDoublePostcard [] = L"Japanese Double Postcard"
 
WCHAR wszA1 [] = L"A1"
 
WCHAR wszJapaneseEnvelopeKaku2 [] = L"Japanese Envelope Kaku #2"
 
WCHAR wszJapaneseEnvelopeKaku3 [] = L"Japanese Envelope Kaku #3"
 
WCHAR wszJapaneseEnvelopeChou3 [] = L"Japanese Envelope Chou #3"
 
WCHAR wszJapaneseEnvelopeChou4 [] = L"Japanese Envelope Chou #4"
 
WCHAR wszLetterRotated [] = L"Letter Rotated"
 
WCHAR wszA3Rotated [] = L"A3 Rotated"
 
WCHAR wszA4Rotated [] = L"A4 Rotated"
 
WCHAR wszA5Rotated [] = L"A5 Rotated"
 
WCHAR wszB4JISRotated [] = L"B4 (JIS) Rotated"
 
WCHAR wszB5JISRotated [] = L"B5 (JIS) Rotated"
 
WCHAR wszJapanesePostcardRotated [] = L"Japanese Postcard Rotated"
 
WCHAR wszDoubleJapanPostcardRotated [] = L"Double Japan Postcard Rotated"
 
WCHAR wsA6Rotatedz [] = L"A6 Rotated"
 
WCHAR wszJapanEnvelopeKaku2Rotated [] = L"Japan Envelope Kaku #2 Rotated"
 
WCHAR wszJapanEnvelopeKaku3Rotated [] = L"Japan Envelope Kaku #3 Rotated"
 
WCHAR wszJapanEnvelopeChou3Rotated [] = L"Japan Envelope Chou #3 Rotated"
 
WCHAR wszJapanEnvelopeChou4Rotated [] = L"Japan Envelope Chou #4 Rotated"
 
WCHAR wszB6JIS [] = L"B6 (JIS)"
 
WCHAR wszB6JISRotated [] = L"B6 (JIS) Rotated"
 
WCHAR wsz12x11 [] = L"12 x 11"
 
WCHAR wszJapanEnvelopeYou4 [] = L"Japan Envelope You #4"
 
WCHAR wszJapanEnvelopeYou4Rotated [] = L"Japan Envelope You #4 Rotated"
 
WCHAR wszPRC16K [] = L"PRC 16K"
 
WCHAR wszPRC32K [] = L"PRC 32K"
 
WCHAR wszPRC32KBig [] = L"PRC 32K(Big)"
 
WCHAR wszPRCEnvelope1 [] = L"PRC Envelope #1"
 
WCHAR wszPRCEnvelope2 [] = L"PRC Envelope #2"
 
WCHAR wszPRCEnvelope3 [] = L"PRC Envelope #3"
 
WCHAR wszPRCEnvelope4 [] = L"PRC Envelope #4"
 
WCHAR wszPRCEnvelope5 [] = L"PRC Envelope #5"
 
WCHAR wszPRCEnvelope6 [] = L"PRC Envelope #6"
 
WCHAR wszPRCEnvelope7 [] = L"PRC Envelope #7"
 
WCHAR wszPRCEnvelope8 [] = L"PRC Envelope #8"
 
WCHAR wszPRCEnvelope9 [] = L"PRC Envelope #9"
 
WCHAR wszPRCEnvelope10 [] = L"PRC Envelope #10"
 
WCHAR wszPRC16KRotated [] = L"PRC 16K Rotated"
 
WCHAR wszPRC32KRotated [] = L"PRC 32K Rotated"
 
WCHAR wszPRC32KBigRotated [] = L"PRC 32K(Big) Rotated"
 
WCHAR wszPRCEnvelope1Rotated [] = L"PRC Envelope #1 Rotated"
 
WCHAR wszPRCEnvelope2Rotated [] = L"PRC Envelope #2 Rotated"
 
WCHAR wszPRCEnvelope3Rotated [] = L"PRC Envelope #3 Rotated"
 
WCHAR wszPRCEnvelope4Rotated [] = L"PRC Envelope #4 Rotated"
 
WCHAR wszPRCEnvelope5Rotated [] = L"PRC Envelope #5 Rotated"
 
WCHAR wszPRCEnvelope6Rotated [] = L"PRC Envelope #6 Rotated"
 
WCHAR wszPRCEnvelope7Rotated [] = L"PRC Envelope #7 Rotated"
 
WCHAR wszPRCEnvelope8Rotated [] = L"PRC Envelope #8 Rotated"
 
WCHAR wszPRCEnvelope9Rotated [] = L"PRC Envelope #9 Rotated"
 
WCHAR wszPRCEnvelope10Rotated [] = L"PRC Envelope #10 Rotated"
 
FORM_INFO_1W BuiltInForms []
 
HKEY hFormCKey = NULL
 
HKEY hFormsKey = NULL
 
static const PLocalGetFormLevelFunc pfnGetFormLevels []
 

Macro Definition Documentation

◆ FORMINFOSIG

#define FORMINFOSIG   '.2'

Definition at line 10 of file forms.c.

◆ FORMMAXNAMESIZE

#define FORMMAXNAMESIZE   CCHDEVICENAME-1

Definition at line 11 of file forms.c.

Typedef Documentation

◆ FORM_INFO_LIST

◆ PFORM_INFO_LIST

◆ PLocalGetFormLevelFunc

typedef void(* PLocalGetFormLevelFunc) (PFORM_INFO_LIST, PVOID, PBYTE *, PDWORD)

Definition at line 397 of file forms.c.

◆ PREGISTRYFORMINFO

◆ REGISTRYFORMINFO

Function Documentation

◆ _LocalGetFormLevel1()

static void _LocalGetFormLevel1 ( PFORM_INFO_LIST  pfil,
PFORM_INFO_1W ppFormInfo,
PBYTE ppFormInfoEnd,
PDWORD  pcbNeeded 
)
static

Definition at line 333 of file forms.c.

334 {
335  DWORD n;
336  PCWSTR pwszStrings[1];
337 
338  pwszStrings[0] = pfil->pName;
339 
340  // Calculate the string lengths.
341  if (!ppFormInfo)
342  {
343  for (n = 0; n < _countof(pwszStrings); ++n)
344  {
345  *pcbNeeded += (wcslen(pwszStrings[n]) + 1) * sizeof(WCHAR);
346  }
347 
348  *pcbNeeded += sizeof(FORM_INFO_1W);
349  return;
350  }
351 
352  (*ppFormInfo)->Flags = pfil->Flags;
353  (*ppFormInfo)->Size = pfil->Size;
354  (*ppFormInfo)->ImageableArea = pfil->ImageableArea;
355 
356  // Finally copy the structure and advance to the next one in the output buffer.
357  *ppFormInfoEnd = PackStrings(pwszStrings, (PBYTE)(*ppFormInfo), dwFormInfo1Offsets, *ppFormInfoEnd);
358  (*ppFormInfo)++;
359 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
static DWORD dwFormInfo1Offsets[]
Definition: forms.c:25
GLdouble n
Definition: glext.h:7729
__wchar_t WCHAR
Definition: xmlstorage.h:180
PBYTE WINAPI PackStrings(PCWSTR *pSource, PBYTE pDest, const DWORD *DestOffsets, PBYTE pEnd)
Definition: tools.c:39
#define _countof(array)
Definition: sndvol32.h:68
struct _FORM_INFO_1W FORM_INFO_1W
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
BYTE * PBYTE
Definition: pedump.c:66

◆ _LocalGetFormLevel2()

static void _LocalGetFormLevel2 ( PFORM_INFO_LIST  pfil,
PFORM_INFO_2W ppFormInfo,
PBYTE ppFormInfoEnd,
PDWORD  pcbNeeded 
)
static

Definition at line 362 of file forms.c.

363 {
364  DWORD n;
365  PCWSTR pwszStrings[4];
366 
367  pwszStrings[0] = pfil->pName;
368  pwszStrings[1] = (PCWSTR)pfil->pKeyword;
369  pwszStrings[2] = pfil->pMuiDll;
370  pwszStrings[3] = pfil->pDisplayName;
371 
372  // Calculate the string lengths.
373  if (!ppFormInfo)
374  {
375  for (n = 0; n < _countof(pwszStrings); ++n)
376  {
377  if (pwszStrings[n])
378  {
379  *pcbNeeded += (wcslen(pwszStrings[n]) + 1) * sizeof(WCHAR);
380  }
381  }
382  *pcbNeeded += sizeof(FORM_INFO_2W);
383  return;
384  }
385 
386  (*ppFormInfo)->Flags = pfil->Flags;
387  (*ppFormInfo)->Size = pfil->Size;
388  (*ppFormInfo)->ImageableArea = pfil->ImageableArea;
389  (*ppFormInfo)->StringType = pfil->StringType;
390  (*ppFormInfo)->dwResourceId = pfil->dwResourceId;
391 
392  // Finally copy the structure and advance to the next one in the output buffer.
393  *ppFormInfoEnd = PackStrings(pwszStrings, (PBYTE)(*ppFormInfo), dwFormInfo2Offsets, *ppFormInfoEnd);
394  (*ppFormInfo)++;
395 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
GLdouble n
Definition: glext.h:7729
if(dx==0 &&dy==0)
Definition: linetemp.h:174
struct _FORM_INFO_2W FORM_INFO_2W
__wchar_t WCHAR
Definition: xmlstorage.h:180
PBYTE WINAPI PackStrings(PCWSTR *pSource, PBYTE pDest, const DWORD *DestOffsets, PBYTE pEnd)
Definition: tools.c:39
#define _countof(array)
Definition: sndvol32.h:68
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static DWORD dwFormInfo2Offsets[]
Definition: forms.c:30
BYTE * PBYTE
Definition: pedump.c:66

◆ FindForm()

PFORM_INFO_LIST FASTCALL FindForm ( WCHAR pFormName,
WCHAR pKeyword 
)

Definition at line 310 of file forms.c.

311 {
312  PLIST_ENTRY ListEntry;
313  PFORM_INFO_LIST pfil;
314 
315  ListEntry = FormList.Flink;
316 
317  while (ListEntry != &FormList)
318  {
319  pfil = CONTAINING_RECORD(ListEntry, FORM_INFO_LIST, List);
320 
321  ListEntry = ListEntry->Flink;
322 
323  if ( pFormName && !_wcsicmp( pfil->pName, pFormName ) )
324  return pfil;
325 
326  if ( pKeyword && !_wcsicmp( (WCHAR*)pfil->pKeyword, pKeyword ) )
327  return pfil;
328  }
329  return NULL;
330 }
LIST_ENTRY FormList
Definition: forms.c:21
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
__wchar_t WCHAR
Definition: xmlstorage.h:180
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
Definition: typedefs.h:119
#define NULL
Definition: types.h:112
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by LocalAddForm(), LocalDeleteForm(), LocalGetForm(), and LocalSetForm().

◆ InitializeFormList()

BOOL InitializeFormList ( VOID  )

Definition at line 228 of file forms.c.

229 {
230  DWORD dwErrorCode;
231  PFORM_INFO_LIST pfil;
232  REGISTRYFORMINFO rfi;
233 
234  FIXME("InitializeFormList\n");
235 
236  dwErrorCode = (DWORD)RegCreateKeyExW( HKEY_LOCAL_MACHINE,
237  L"SYSTEM\\CurrentControlSet\\Control\\Print\\Forms",
238  0,
239  NULL,
242  NULL,
243  &hFormCKey,
244  NULL ); // KEY_OPENED_EXISTING_KEY );
245 
246  if ( dwErrorCode != ERROR_SUCCESS && dwErrorCode != ERROR_ALREADY_EXISTS )
247  {
248  ERR("RegCreateKeyExW failed for the Forms with error %lu!\n", dwErrorCode);
249  goto Cleanup;
250  }
251 
252  // Open some registry keys and leave them open. We need them multiple times throughout the Local Spooler.
253  dwErrorCode = (DWORD)RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\Print\\Forms", 0, KEY_ALL_ACCESS, &hFormsKey);
254  if (dwErrorCode != ERROR_SUCCESS)
255  {
256  ERR("RegOpenKeyExW failed for \"Forms\" with error %lu!\n", dwErrorCode);
257  goto Cleanup;
258  }
259 
260  _dwLastForm = 1;
261 
263 
264  {
265  int i = 0, Size;
266  while ( BuiltInForms[ i ].pName != NULL )
267  {
268  TRACE("InitializeFormList L s %S\n",BuiltInForms[ i ].pName );
269 
270  Size = sizeof(FORM_INFO_LIST) + ((wcslen(BuiltInForms[ i ].pName) + 1) * sizeof(WCHAR));
271 
272  pfil = DllAllocSplMem( Size );
273 
274  pfil->pName = wcscpy( (PWSTR)(pfil+1), BuiltInForms[ i ].pName );
275  pfil->Flags = BuiltInForms[ i ].Flags;
276  pfil->Size = BuiltInForms[ i ].Size;
277  pfil->ImageableArea = BuiltInForms[ i ].ImageableArea;
278  pfil->Sig = FORMINFOSIG;
279  pfil->Index = _dwLastForm++;
280  pfil->pKeyword = NULL;
281  pfil->StringType = STRING_NONE;
282  pfil->pMuiDll = NULL;
283  pfil->dwResourceId = 0;
284  pfil->pDisplayName = NULL;
285  pfil->wLangId = 0;
286 
287  InsertTailList( &FormList, &pfil->List );
288 
289  rfi.Size = pfil->Size;
290  rfi.ImageableArea = pfil->ImageableArea;
291  rfi.Index = pfil->Index;
292  rfi.Flags = pfil->Flags;
293 
294  dwErrorCode = RegSetValueExW( hFormsKey, pfil->pName, 0, REG_BINARY, (PBYTE)&rfi, sizeof( rfi ) );
295  if ( dwErrorCode == ERROR_SUCCESS )
296  {
297  TRACE("Init : RQVEW : %S added\n",pfil->pName);
298  }
299 
300  i++;
301  }
302  }
303 
304 Cleanup:
305  return TRUE;
306 }
static DWORD _dwLastForm
Definition: forms.c:22
#define STRING_NONE
Definition: winspool.h:672
HKEY hFormsKey
Definition: forms.c:225
#define ERROR_SUCCESS
Definition: deptool.c:10
RECTL ImageableArea
Definition: forms.c:219
#define REG_BINARY
Definition: nt_native.h:1496
#define TRUE
Definition: types.h:120
uint16_t * PWSTR
Definition: typedefs.h:56
FORM_INFO_1W BuiltInForms[]
Definition: forms.c:160
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
LIST_ENTRY List
Definition: forms.c:15
#define InsertTailList(ListHead, Entry)
#define DWORD
Definition: nt_native.h:44
DWORD Flags
Definition: winspool.h:633
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
#define L(x)
Definition: ntvdm.h:50
LIST_ENTRY FormList
Definition: forms.c:21
#define FIXME(fmt,...)
Definition: debug.h:111
RECTL ImageableArea
Definition: winspool.h:636
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4899
#define TRACE(s)
Definition: solgame.cpp:4
static LPSTR pName
Definition: security.c:75
DWORD Sig
Definition: forms.c:16
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _FORM_INFO_LIST FORM_INFO_LIST
HKEY hFormCKey
Definition: forms.c:224
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
DWORD Index
Definition: forms.c:17
static const WCHAR Cleanup[]
Definition: register.c:80
#define ERR(fmt,...)
Definition: debug.h:110
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FORMINFOSIG
Definition: forms.c:10
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
PVOID WINAPI DllAllocSplMem(DWORD dwBytes)
Definition: memory.c:95
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
BYTE * PBYTE
Definition: pedump.c:66
SIZEL Size
Definition: winspool.h:635
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by _InitializeLocalSpooler().

◆ LocalAddForm()

BOOL WINAPI LocalAddForm ( HANDLE  hPrinter,
DWORD  Level,
PBYTE  pForm 
)

Definition at line 409 of file forms.c.

410 {
411  DWORD dwErrorCode, Size, cbNeeded;
412  PFORM_INFO_LIST pfil;
413  PLOCAL_HANDLE pHandle;
414  REGISTRYFORMINFO rfi;
415  PFORM_INFO_1W pfi1w = (PFORM_INFO_1W)pForm;
416  PFORM_INFO_2W pfi2w = (PFORM_INFO_2W)pForm;
417 
418  FIXME("AddForm(%p, %lu, %p)\n", hPrinter, Level, pForm);
419 
420  // Check if this is a printer handle.
421  pHandle = (PLOCAL_HANDLE)hPrinter;
422  if (pHandle->HandleType != HandleType_Printer)
423  {
424  dwErrorCode = ERROR_INVALID_HANDLE;
425  goto Cleanup;
426  }
427 
428  // Only support 1 & 2
429  if (Level < 1 || Level > 2)
430  {
431  // The caller supplied an invalid level.
432  dwErrorCode = ERROR_INVALID_LEVEL;
433  goto Cleanup;
434  }
435 
436  pfil = FindForm( pfi1w->pName, NULL );
437  if ( pfil )
438  {
439  dwErrorCode = ERROR_FILE_EXISTS;
440  goto Cleanup;
441  }
442 
443  dwErrorCode = RegQueryValueExW( hFormsKey, pfi1w->pName, NULL, NULL, NULL, &cbNeeded );
444  if ( dwErrorCode == ERROR_SUCCESS )
445  {
446  dwErrorCode = ERROR_FILE_EXISTS;
447  goto Cleanup;
448  }
449 
450  if ( wcslen(pfi1w->pName) > FORMMAXNAMESIZE ) // Limit REG Name size.
451  {
452  dwErrorCode = ERROR_INVALID_PARAMETER;
453  goto Cleanup;
454  }
455 
456  Size = sizeof(FORM_INFO_LIST) + ((MAX_PATH + 1) * sizeof(WCHAR));
457 
458  pfil = DllAllocSplMem( Size );
459  if ( !pfil )
460  {
461  dwErrorCode = ERROR_NOT_ENOUGH_MEMORY;
462  goto Cleanup;
463  }
464 
465  pfil->Sig = FORMINFOSIG;
466  pfil->Index = _dwLastForm++;
467  pfil->pName = wcscpy( (PWSTR)(pfil+1), pfi1w->pName );
468  pfil->Flags = pfi1w->Flags;
469  pfil->Size = pfi1w->Size;
470  pfil->ImageableArea = pfi1w->ImageableArea;
471  pfil->StringType = STRING_NONE;
472 
473  if ( Level > 1 )
474  {
475  pfil->pKeyword = pfi2w->pKeyword;
476  pfil->pMuiDll = pfi2w->pMuiDll;
477  pfil->pDisplayName = pfi2w->pDisplayName;
478  pfil->StringType = pfi2w->StringType;
479  pfil->dwResourceId = pfi2w->dwResourceId;
480  }
481 
482  rfi.Size = pfil->Size;
483  rfi.ImageableArea = pfil->ImageableArea;
484  rfi.Index = pfil->Index;
485  rfi.Flags = pfil->Flags;
486 
487  dwErrorCode = RegSetValueExW( hFormsKey, pfil->pName, 0, REG_BINARY, (PBYTE)&rfi, sizeof( rfi ) );
488 
489  BroadcastChange(pHandle);
490 
491  InsertTailList( &FormList, &pfil->List );
492 
493 Cleanup:
494  SetLastError(dwErrorCode);
495  return (dwErrorCode == ERROR_SUCCESS);
496 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static DWORD _dwLastForm
Definition: forms.c:22
#define STRING_NONE
Definition: winspool.h:672
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
HKEY hFormsKey
Definition: forms.c:225
#define ERROR_SUCCESS
Definition: deptool.c:10
RECTL ImageableArea
Definition: forms.c:219
#define REG_BINARY
Definition: nt_native.h:1496
uint16_t * PWSTR
Definition: typedefs.h:56
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
LPCWSTR pMuiDll
Definition: winspool.h:663
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
LIST_ENTRY List
Definition: forms.c:15
#define InsertTailList(ListHead, Entry)
LPCWSTR pDisplayName
Definition: winspool.h:665
DWORD Flags
Definition: winspool.h:633
#define FORMMAXNAMESIZE
Definition: forms.c:11
struct _LOCAL_HANDLE * PLOCAL_HANDLE
Definition: precomp.h:56
LIST_ENTRY FormList
Definition: forms.c:21
#define FIXME(fmt,...)
Definition: debug.h:111
RECTL ImageableArea
Definition: winspool.h:636
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4899
PFORM_INFO_LIST FASTCALL FindForm(WCHAR *pFormName, WCHAR *pKeyword)
Definition: forms.c:310
DWORD dwResourceId
Definition: winspool.h:664
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
DWORD Sig
Definition: forms.c:16
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _FORM_INFO_LIST FORM_INFO_LIST
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
LPCSTR pKeyword
Definition: winspool.h:661
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
DWORD Index
Definition: forms.c:17
VOID BroadcastChange(PLOCAL_HANDLE pHandle)
Definition: printers.c:350
static const WCHAR Cleanup[]
Definition: register.c:80
struct _FORM_INFO_1W * PFORM_INFO_1W
enum _LOCAL_HANDLE::@4880 HandleType
#define FORMINFOSIG
Definition: forms.c:10
LPWSTR pName
Definition: winspool.h:634
DWORD StringType
Definition: winspool.h:662
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
struct _FORM_INFO_2W * PFORM_INFO_2W
PVOID WINAPI DllAllocSplMem(DWORD dwBytes)
Definition: memory.c:95
#define ERROR_INVALID_LEVEL
Definition: winerror.h:196
BYTE * PBYTE
Definition: pedump.c:66
SIZEL Size
Definition: winspool.h:635

◆ LocalDeleteForm()

BOOL WINAPI LocalDeleteForm ( HANDLE  hPrinter,
PWSTR  pFormName 
)

Definition at line 499 of file forms.c.

500 {
501  DWORD dwErrorCode, cbNeeded;
502  PFORM_INFO_LIST pfil;
503  REGISTRYFORMINFO rfi;
504  PLOCAL_HANDLE pHandle;
505 
506  FIXME("DeleteForm(%p, %S)\n", hPrinter, pFormName);
507 
508  // Check if this is a printer handle.
509  pHandle = (PLOCAL_HANDLE)hPrinter;
510  if (pHandle->HandleType != HandleType_Printer)
511  {
512  dwErrorCode = ERROR_INVALID_HANDLE;
513  goto Cleanup;
514  }
515 
516  pfil = FindForm( pFormName, NULL );
517  if ( !pfil )
518  {
519  dwErrorCode = ERROR_INVALID_PARAMETER;
520  goto Cleanup;
521  }
522 
523  dwErrorCode = RegQueryValueExW( hFormsKey, pFormName, NULL, NULL, (PBYTE)&rfi, &cbNeeded );
524  if ( dwErrorCode != ERROR_SUCCESS )
525  {
526  goto Cleanup;
527  }
528 
529  dwErrorCode = RegDeleteValueW(hFormsKey, pFormName);
530  if ( dwErrorCode != ERROR_SUCCESS )
531  {
532  goto Cleanup;
533  }
534 
535  RemoveEntryList(&pfil->List);
536 
537  DllFreeSplMem(pfil);
538 
539  BroadcastChange(pHandle);
540 
541  dwErrorCode = ERROR_SUCCESS;
542 
543 Cleanup:
544  SetLastError(dwErrorCode);
545  return (dwErrorCode == ERROR_SUCCESS);
546 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
HKEY hFormsKey
Definition: forms.c:225
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI DllFreeSplMem(PVOID pMem)
Definition: memory.c:112
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LIST_ENTRY List
Definition: forms.c:15
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
struct _LOCAL_HANDLE * PLOCAL_HANDLE
Definition: precomp.h:56
#define FIXME(fmt,...)
Definition: debug.h:111
PFORM_INFO_LIST FASTCALL FindForm(WCHAR *pFormName, WCHAR *pKeyword)
Definition: forms.c:310
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
VOID BroadcastChange(PLOCAL_HANDLE pHandle)
Definition: printers.c:350
static const WCHAR Cleanup[]
Definition: register.c:80
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
enum _LOCAL_HANDLE::@4880 HandleType
#define NULL
Definition: types.h:112
BYTE * PBYTE
Definition: pedump.c:66

◆ LocalEnumForms()

BOOL WINAPI LocalEnumForms ( HANDLE  hPrinter,
DWORD  Level,
PBYTE  pForm,
DWORD  cbBuf,
PDWORD  pcbNeeded,
PDWORD  pcReturned 
)

Definition at line 549 of file forms.c.

550 {
551  DWORD dwErrorCode;
552  PFORM_INFO_LIST pfil = NULL;
553  PBYTE pEnd = &pForm[cbBuf];
554  PLOCAL_HANDLE pHandle;
555  PLIST_ENTRY ListEntry;
556 
557  FIXME("EnumForms(%p, %lu, %p, %lu, %p, %p)\n", hPrinter, Level, pForm, cbBuf, pcbNeeded, pcReturned);
558 
559  // Check if this is a printer handle.
560  pHandle = (PLOCAL_HANDLE)hPrinter;
561  if (pHandle->HandleType != HandleType_Printer)
562  {
563  dwErrorCode = ERROR_INVALID_HANDLE;
564  goto Cleanup;
565  }
566 
567  // Only support 1 & 2
568  if (Level < 1 || Level > 2)
569  {
570  // The caller supplied an invalid level.
571  dwErrorCode = ERROR_INVALID_LEVEL;
572  goto Cleanup;
573  }
574 
575  // Count the required buffer size.
576  *pcbNeeded = 0;
577 
578  ListEntry = FormList.Flink;
579 
580  if (IsListEmpty(ListEntry))
581  {
582  dwErrorCode = ERROR_INVALID_PARAMETER;
583  goto Cleanup;
584  }
585 
586  while ( ListEntry != &FormList )
587  {
588  pfil = CONTAINING_RECORD(ListEntry, FORM_INFO_LIST, List);
589  ListEntry = ListEntry->Flink;
590 
592  }
593 
594  // Check if the supplied buffer is large enough.
595  if (cbBuf < *pcbNeeded)
596  {
597  ERR("Insuffisient Buffer size\n");
598  dwErrorCode = ERROR_INSUFFICIENT_BUFFER;
599  goto Cleanup;
600  }
601 
602  // Copy over the information.
603  pEnd = &pForm[*pcbNeeded];
604 
605  ListEntry = FormList.Flink;
606 
607  while ( ListEntry != &FormList )
608  {
609  pfil = CONTAINING_RECORD(ListEntry, FORM_INFO_LIST, List);
610  ListEntry = ListEntry->Flink;
611 
612  pfnGetFormLevels[Level](pfil, &pForm, &pEnd, NULL);
613  (*pcReturned)++;
614  }
615 
616  dwErrorCode = ERROR_SUCCESS;
617 
618 Cleanup:
619  SetLastError(dwErrorCode);
620  return (dwErrorCode == ERROR_SUCCESS);
621 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
struct _LOCAL_HANDLE * PLOCAL_HANDLE
Definition: precomp.h:56
LIST_ENTRY FormList
Definition: forms.c:21
#define FIXME(fmt,...)
Definition: debug.h:111
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
static const PLocalGetFormLevelFunc pfnGetFormLevels[]
Definition: forms.c:399
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
Definition: typedefs.h:119
static const WCHAR Cleanup[]
Definition: register.c:80
#define ERR(fmt,...)
Definition: debug.h:110
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
enum _LOCAL_HANDLE::@4880 HandleType
#define NULL
Definition: types.h:112
#define ERROR_INVALID_LEVEL
Definition: winerror.h:196
BYTE * PBYTE
Definition: pedump.c:66
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

◆ LocalGetForm()

BOOL WINAPI LocalGetForm ( HANDLE  hPrinter,
PWSTR  pFormName,
DWORD  Level,
PBYTE  pForm,
DWORD  cbBuf,
PDWORD  pcbNeeded 
)

Definition at line 624 of file forms.c.

625 {
626  DWORD dwErrorCode;
627  PFORM_INFO_LIST pfil;
628  PBYTE pEnd = &pForm[cbBuf];
629  PLOCAL_HANDLE pHandle;
630 
631  FIXME("GetForm(%p, %S, %lu, %p, %lu, %p)\n", hPrinter, pFormName, Level, pForm, cbBuf, pcbNeeded);
632 
633  // Check if this is a printer handle.
634  pHandle = (PLOCAL_HANDLE)hPrinter;
635  if (pHandle->HandleType != HandleType_Printer)
636  {
637  dwErrorCode = ERROR_INVALID_HANDLE;
638  goto Cleanup;
639  }
640 
641  // Only support 1 & 2
642  if (Level < 1 || Level > 2)
643  {
644  // The caller supplied an invalid level.
645  dwErrorCode = ERROR_INVALID_LEVEL;
646  goto Cleanup;
647  }
648 
649  pfil = FindForm( pFormName, NULL );
650  if ( !pfil )
651  {
652  dwErrorCode = ERROR_INVALID_PARAMETER;
653  goto Cleanup;
654  }
655 
656  // Count the required buffer size.
657  *pcbNeeded = 0;
658 
660 
661  // Check if the supplied buffer is large enough.
662  if (cbBuf < *pcbNeeded)
663  {
664  ERR("Insuffisient Buffer size\n");
665  dwErrorCode = ERROR_INSUFFICIENT_BUFFER;
666  goto Cleanup;
667  }
668 
669  // Copy over the information.
670  pEnd = &pForm[*pcbNeeded];
671 
672  pfnGetFormLevels[Level](pfil, &pForm, &pEnd, NULL);
673 
674  dwErrorCode = ERROR_SUCCESS;
675 
676 Cleanup:
677  SetLastError(dwErrorCode);
678  return (dwErrorCode == ERROR_SUCCESS);
679 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
struct _LOCAL_HANDLE * PLOCAL_HANDLE
Definition: precomp.h:56
#define FIXME(fmt,...)
Definition: debug.h:111
PFORM_INFO_LIST FASTCALL FindForm(WCHAR *pFormName, WCHAR *pKeyword)
Definition: forms.c:310
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
static const PLocalGetFormLevelFunc pfnGetFormLevels[]
Definition: forms.c:399
static const WCHAR Cleanup[]
Definition: register.c:80
#define ERR(fmt,...)
Definition: debug.h:110
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
enum _LOCAL_HANDLE::@4880 HandleType
#define NULL
Definition: types.h:112
#define ERROR_INVALID_LEVEL
Definition: winerror.h:196
BYTE * PBYTE
Definition: pedump.c:66
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

◆ LocalSetForm()

BOOL WINAPI LocalSetForm ( HANDLE  hPrinter,
PWSTR  pFormName,
DWORD  Level,
PBYTE  pForm 
)

Definition at line 682 of file forms.c.

683 {
684  DWORD dwErrorCode, cbNeeded;
685  PFORM_INFO_LIST pfil;
686  REGISTRYFORMINFO rfi;
687  PLOCAL_HANDLE pHandle;
688  PFORM_INFO_1W pfi1w = (PFORM_INFO_1W)pForm;
689  PFORM_INFO_2W pfi2w = (PFORM_INFO_2W)pForm;
690 
691  FIXME("SetFormW(%p, %S, %lu, %p)\n", hPrinter, pFormName, Level, pForm);
692 
693  // Check if this is a printer handle.
694  pHandle = (PLOCAL_HANDLE)hPrinter;
695  if (pHandle->HandleType != HandleType_Printer)
696  {
697  dwErrorCode = ERROR_INVALID_HANDLE;
698  goto Cleanup;
699  }
700 
701  // Only support 1 & 2
702  if (Level < 1 || Level > 2)
703  {
704  // The caller supplied an invalid level.
705  dwErrorCode = ERROR_INVALID_LEVEL;
706  goto Cleanup;
707  }
708 
709  pfil = FindForm( pFormName, NULL );
710  if ( !pfil )
711  {
712  dwErrorCode = ERROR_INVALID_PARAMETER;
713  goto Cleanup;
714  }
715 
716  dwErrorCode = RegQueryValueExW( hFormsKey, pFormName, NULL, NULL, (PBYTE)&rfi, &cbNeeded) ;
717  if ( dwErrorCode != ERROR_SUCCESS )
718  {
719  goto Cleanup;
720  }
721 
722  pfil->Flags = pfi1w->Flags;
723  pfil->Size = pfi1w->Size;
724  pfil->ImageableArea = pfi1w->ImageableArea;
725 
726  if ( Level > 1 )
727  {
728  pfil->pKeyword = pfi2w->pKeyword;
729  pfil->pMuiDll = pfi2w->pMuiDll;
730  pfil->pDisplayName = pfi2w->pDisplayName;
731  pfil->StringType = pfi2w->StringType;
732  pfil->dwResourceId = pfi2w->dwResourceId;
733  }
734 
735  rfi.Size = pfil->Size;
736  rfi.ImageableArea = pfil->ImageableArea;
737  rfi.Flags = pfil->Flags;
738 
739  dwErrorCode = RegSetValueExW( hFormsKey, pfil->pName, 0, REG_BINARY, (PBYTE)&rfi, sizeof( rfi ) );
740 
741  BroadcastChange(pHandle);
742 
743 Cleanup:
744  SetLastError(dwErrorCode);
745  return (dwErrorCode == ERROR_SUCCESS);
746 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
HKEY hFormsKey
Definition: forms.c:225
#define ERROR_SUCCESS
Definition: deptool.c:10
RECTL ImageableArea
Definition: forms.c:219
#define REG_BINARY
Definition: nt_native.h:1496
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LPCWSTR pMuiDll
Definition: winspool.h:663
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
LPCWSTR pDisplayName
Definition: winspool.h:665
DWORD Flags
Definition: winspool.h:633
struct _LOCAL_HANDLE * PLOCAL_HANDLE
Definition: precomp.h:56
#define FIXME(fmt,...)
Definition: debug.h:111
RECTL ImageableArea
Definition: winspool.h:636
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4899
PFORM_INFO_LIST FASTCALL FindForm(WCHAR *pFormName, WCHAR *pKeyword)
Definition: forms.c:310
DWORD dwResourceId
Definition: winspool.h:664
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
LPCSTR pKeyword
Definition: winspool.h:661
VOID BroadcastChange(PLOCAL_HANDLE pHandle)
Definition: printers.c:350
static const WCHAR Cleanup[]
Definition: register.c:80
struct _FORM_INFO_1W * PFORM_INFO_1W
enum _LOCAL_HANDLE::@4880 HandleType
DWORD StringType
Definition: winspool.h:662
#define NULL
Definition: types.h:112
struct _FORM_INFO_2W * PFORM_INFO_2W
#define ERROR_INVALID_LEVEL
Definition: winerror.h:196
BYTE * PBYTE
Definition: pedump.c:66
SIZEL Size
Definition: winspool.h:635

Variable Documentation

◆ _dwLastForm

DWORD _dwLastForm
static

Definition at line 22 of file forms.c.

Referenced by InitializeFormList(), and LocalAddForm().

◆ BuiltInForms

FORM_INFO_1W BuiltInForms[]

Definition at line 160 of file forms.c.

Referenced by InitializeFormList().

◆ dwFormInfo1Offsets

DWORD dwFormInfo1Offsets[]
static
Initial value:
= {
}
#define MAXDWORD
static LPSTR pName
Definition: security.c:75
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Definition at line 25 of file forms.c.

Referenced by _LocalGetFormLevel1().

◆ dwFormInfo2Offsets

DWORD dwFormInfo2Offsets[]
static
Initial value:
= {
FIELD_OFFSET(FORM_INFO_2W, pDisplayName),
}
#define MAXDWORD
static LPSTR pName
Definition: security.c:75
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Definition at line 30 of file forms.c.

Referenced by _LocalGetFormLevel2().

◆ FormList

LIST_ENTRY FormList

Definition at line 21 of file forms.c.

Referenced by FindForm(), InitializeFormList(), LocalAddForm(), and LocalEnumForms().

◆ hFormCKey

HKEY hFormCKey = NULL

Definition at line 224 of file forms.c.

Referenced by InitializeFormList().

◆ hFormsKey

HKEY hFormsKey = NULL

Definition at line 225 of file forms.c.

Referenced by InitializeFormList(), LocalAddForm(), LocalDeleteForm(), and LocalSetForm().

◆ pfnGetFormLevels

const PLocalGetFormLevelFunc pfnGetFormLevels[]
static
Initial value:
= {
}
static void _LocalGetFormLevel1(PFORM_INFO_LIST pfil, PFORM_INFO_1W *ppFormInfo, PBYTE *ppFormInfoEnd, PDWORD pcbNeeded)
Definition: forms.c:333
static void _LocalGetFormLevel2(PFORM_INFO_LIST pfil, PFORM_INFO_2W *ppFormInfo, PBYTE *ppFormInfoEnd, PDWORD pcbNeeded)
Definition: forms.c:362
#define NULL
Definition: types.h:112
void(* PLocalGetFormLevelFunc)(PFORM_INFO_LIST, PVOID, PBYTE *, PDWORD)
Definition: forms.c:397

Definition at line 399 of file forms.c.

Referenced by LocalEnumForms(), and LocalGetForm().

◆ wsA6Rotatedz

WCHAR wsA6Rotatedz[] = L"A6 Rotated"

Definition at line 122 of file forms.c.

◆ wsz10x11

WCHAR wsz10x11[] = L"10 x 11"

Definition at line 84 of file forms.c.

◆ wsz10x14

WCHAR wsz10x14[] = L"10 x 14"

Definition at line 55 of file forms.c.

◆ wsz11x17

WCHAR wsz11x17[] = L"11 x 17"

Definition at line 56 of file forms.c.

◆ wsz12x11

WCHAR wsz12x11[] = L"12 x 11"

Definition at line 129 of file forms.c.

◆ wsz15x11

WCHAR wsz15x11[] = L"15 x 11"

Definition at line 85 of file forms.c.

◆ wsz634Envelope

WCHAR wsz634Envelope[] = L"6 3/4 Envelope"

Definition at line 77 of file forms.c.

◆ wsz9x11

WCHAR wsz9x11[] = L"9 x 11"

Definition at line 83 of file forms.c.

◆ wszA0

WCHAR wszA0[] = L"A0"

Definition at line 105 of file forms.c.

◆ wszA1

WCHAR wszA1[] = L"A1"

Definition at line 109 of file forms.c.

◆ wszA3

WCHAR wszA3[] = L"A3"

Definition at line 47 of file forms.c.

◆ wszA3Extra

WCHAR wszA3Extra[] = L"A3 Extra"

Definition at line 102 of file forms.c.

◆ wszA3ExtraTransverse

WCHAR wszA3ExtraTransverse[] = L"A3 Extra Transverse"

Definition at line 107 of file forms.c.

◆ wszA3Rotated

WCHAR wszA3Rotated[] = L"A3 Rotated"

Definition at line 115 of file forms.c.

◆ wszA3Transverse

WCHAR wszA3Transverse[] = L"A3 Transverse"

Definition at line 106 of file forms.c.

◆ wszA4

WCHAR wszA4[] = L"A4"

Definition at line 48 of file forms.c.

◆ wszA4Extra

WCHAR wszA4Extra[] = L"A4 Extra"

Definition at line 92 of file forms.c.

◆ wszA4Plus

WCHAR wszA4Plus[] = L"A4 Plus"

Definition at line 99 of file forms.c.

◆ wszA4Rotated

WCHAR wszA4Rotated[] = L"A4 Rotated"

Definition at line 116 of file forms.c.

◆ wszA4Small

WCHAR wszA4Small[] = L"A4 Small"

Definition at line 49 of file forms.c.

◆ wszA4Transverse

WCHAR wszA4Transverse[] = L"A4 Transverse"

Definition at line 94 of file forms.c.

◆ wszA5

WCHAR wszA5[] = L"A5"

Definition at line 50 of file forms.c.

◆ wszA5Extra

WCHAR wszA5Extra[] = L"A5 Extra"

Definition at line 103 of file forms.c.

◆ wszA5Rotated

WCHAR wszA5Rotated[] = L"A5 Rotated"

Definition at line 117 of file forms.c.

◆ wszA5Transverse

WCHAR wszA5Transverse[] = L"A5 Transverse"

Definition at line 100 of file forms.c.

◆ wszB4ISO

WCHAR wszB4ISO[] = L"B4 (ISO)"

Definition at line 81 of file forms.c.

◆ wszB4JIS

WCHAR wszB4JIS[] = L"B4 (JIS)"

Definition at line 51 of file forms.c.

◆ wszB4JISRotated

WCHAR wszB4JISRotated[] = L"B4 (JIS) Rotated"

Definition at line 118 of file forms.c.

◆ wszB5ISOExtra

WCHAR wszB5ISOExtra[] = L"B5 (ISO) Extra"

Definition at line 104 of file forms.c.

◆ wszB5JIS

WCHAR wszB5JIS[] = L"B5 (JIS)"

Definition at line 52 of file forms.c.

◆ wszB5JISRotated

WCHAR wszB5JISRotated[] = L"B5 (JIS) Rotated"

Definition at line 119 of file forms.c.

◆ wszB5JISTransverse

WCHAR wszB5JISTransverse[] = L"B5 (JIS) Transverse"

Definition at line 101 of file forms.c.

◆ wszB6JIS

WCHAR wszB6JIS[] = L"B6 (JIS)"

Definition at line 127 of file forms.c.

◆ wszB6JISRotated

WCHAR wszB6JISRotated[] = L"B6 (JIS) Rotated"

Definition at line 128 of file forms.c.

◆ wszCsizesheet

WCHAR wszCsizesheet[] = L"C size sheet"

Definition at line 63 of file forms.c.

◆ wszDoubleJapanPostcardRotated

WCHAR wszDoubleJapanPostcardRotated[] = L"Double Japan Postcard Rotated"

Definition at line 121 of file forms.c.

◆ wszDsizesheet

WCHAR wszDsizesheet[] = L"D size sheet"

Definition at line 64 of file forms.c.

◆ wszEnvelope

WCHAR wszEnvelope[] = L"Envelope"

Definition at line 75 of file forms.c.

◆ wszEnvelope10

WCHAR wszEnvelope10[] = L"Envelope #10"

Definition at line 59 of file forms.c.

◆ wszEnvelope11

WCHAR wszEnvelope11[] = L"Envelope #11"

Definition at line 60 of file forms.c.

◆ wszEnvelope12

WCHAR wszEnvelope12[] = L"Envelope #12"

Definition at line 61 of file forms.c.

◆ wszEnvelope14

WCHAR wszEnvelope14[] = L"Envelope #14"

Definition at line 62 of file forms.c.

◆ wszEnvelope65

WCHAR wszEnvelope65[] = L"Envelope 65"

Definition at line 71 of file forms.c.

◆ wszEnvelope9

WCHAR wszEnvelope9[] = L"Envelope #9"

Definition at line 58 of file forms.c.

◆ wszEnvelopeB4

WCHAR wszEnvelopeB4[] = L"Envelope B4"

Definition at line 72 of file forms.c.

◆ wszEnvelopeB5

WCHAR wszEnvelopeB5[] = L"Envelope B5"

Definition at line 73 of file forms.c.

◆ wszEnvelopeB6

WCHAR wszEnvelopeB6[] = L"Envelope B6"

Definition at line 74 of file forms.c.

◆ wszEnvelopeC3

WCHAR wszEnvelopeC3[] = L"Envelope C3"

Definition at line 68 of file forms.c.

◆ wszEnvelopeC4

WCHAR wszEnvelopeC4[] = L"Envelope C4"

Definition at line 69 of file forms.c.

◆ wszEnvelopeC5

WCHAR wszEnvelopeC5[] = L"Envelope C5"

Definition at line 67 of file forms.c.

◆ wszEnvelopeC6

WCHAR wszEnvelopeC6[] = L"Envelope C6"

Definition at line 70 of file forms.c.

◆ wszEnvelopeDL

WCHAR wszEnvelopeDL[] = L"Envelope DL"

Definition at line 66 of file forms.c.

◆ wszEnvelopeInvite

WCHAR wszEnvelopeInvite[] = L"Envelope Invite"

Definition at line 86 of file forms.c.

◆ wszEnvelopeMonarch

WCHAR wszEnvelopeMonarch[] = L"Envelope Monarch"

Definition at line 76 of file forms.c.

◆ wszEsizesheet

WCHAR wszEsizesheet[] = L"E size sheet"

Definition at line 65 of file forms.c.

◆ wszExecutive

WCHAR wszExecutive[] = L"Executive"

Definition at line 46 of file forms.c.

◆ wszFolio

WCHAR wszFolio[] = L"Folio"

Definition at line 53 of file forms.c.

◆ wszGermanLegalFanfold

WCHAR wszGermanLegalFanfold[] = L"German Legal Fanfold"

Definition at line 80 of file forms.c.

◆ wszGermanStdFanfold

WCHAR wszGermanStdFanfold[] = L"German Std Fanfold"

Definition at line 79 of file forms.c.

◆ wszJapanEnvelopeChou3Rotated

WCHAR wszJapanEnvelopeChou3Rotated[] = L"Japan Envelope Chou #3 Rotated"

Definition at line 125 of file forms.c.

◆ wszJapanEnvelopeChou4Rotated

WCHAR wszJapanEnvelopeChou4Rotated[] = L"Japan Envelope Chou #4 Rotated"

Definition at line 126 of file forms.c.

◆ wszJapanEnvelopeKaku2Rotated

WCHAR wszJapanEnvelopeKaku2Rotated[] = L"Japan Envelope Kaku #2 Rotated"

Definition at line 123 of file forms.c.

◆ wszJapanEnvelopeKaku3Rotated

WCHAR wszJapanEnvelopeKaku3Rotated[] = L"Japan Envelope Kaku #3 Rotated"

Definition at line 124 of file forms.c.

◆ wszJapanEnvelopeYou4

WCHAR wszJapanEnvelopeYou4[] = L"Japan Envelope You #4"

Definition at line 130 of file forms.c.

◆ wszJapanEnvelopeYou4Rotated

WCHAR wszJapanEnvelopeYou4Rotated[] = L"Japan Envelope You #4 Rotated"

Definition at line 131 of file forms.c.

◆ wszJapaneseDoublePostcard

WCHAR wszJapaneseDoublePostcard[] = L"Japanese Double Postcard"

Definition at line 108 of file forms.c.

◆ wszJapaneseEnvelopeChou3

WCHAR wszJapaneseEnvelopeChou3[] = L"Japanese Envelope Chou #3"

Definition at line 112 of file forms.c.

◆ wszJapaneseEnvelopeChou4

WCHAR wszJapaneseEnvelopeChou4[] = L"Japanese Envelope Chou #4"

Definition at line 113 of file forms.c.

◆ wszJapaneseEnvelopeKaku2

WCHAR wszJapaneseEnvelopeKaku2[] = L"Japanese Envelope Kaku #2"

Definition at line 110 of file forms.c.

◆ wszJapaneseEnvelopeKaku3

WCHAR wszJapaneseEnvelopeKaku3[] = L"Japanese Envelope Kaku #3"

Definition at line 111 of file forms.c.

◆ wszJapanesePostcard

WCHAR wszJapanesePostcard[] = L"Japanese Postcard"

Definition at line 82 of file forms.c.

◆ wszJapanesePostcardRotated

WCHAR wszJapanesePostcardRotated[] = L"Japanese Postcard Rotated"

Definition at line 120 of file forms.c.

◆ wszLedger

WCHAR wszLedger[] = L"Ledger"

Definition at line 43 of file forms.c.

◆ wszLegal

WCHAR wszLegal[] = L"Legal"

Definition at line 44 of file forms.c.

◆ wszLegalExtra

WCHAR wszLegalExtra[] = L"Legal Extra"

Definition at line 90 of file forms.c.

◆ wszLetter

WCHAR wszLetter[] = L"Letter"

Definition at line 40 of file forms.c.

◆ wszLetterExtra

WCHAR wszLetterExtra[] = L"Letter Extra"

Definition at line 89 of file forms.c.

◆ wszLetterExtraTransverse

WCHAR wszLetterExtraTransverse[] = L"Letter Extra Transverse"

Definition at line 95 of file forms.c.

◆ wszLetterPlus

WCHAR wszLetterPlus[] = L"Letter Plus"

Definition at line 98 of file forms.c.

◆ wszLetterRotated

WCHAR wszLetterRotated[] = L"Letter Rotated"

Definition at line 114 of file forms.c.

◆ wszLetterSmall

WCHAR wszLetterSmall[] = L"Letter Small"

Definition at line 41 of file forms.c.

◆ wszLetterTransverse

WCHAR wszLetterTransverse[] = L"Letter Transverse"

Definition at line 93 of file forms.c.

◆ wszNote

WCHAR wszNote[] = L"Note"

Definition at line 57 of file forms.c.

◆ wszPRC16K

WCHAR wszPRC16K[] = L"PRC 16K"

Definition at line 132 of file forms.c.

◆ wszPRC16KRotated

WCHAR wszPRC16KRotated[] = L"PRC 16K Rotated"

Definition at line 145 of file forms.c.

◆ wszPRC32K

WCHAR wszPRC32K[] = L"PRC 32K"

Definition at line 133 of file forms.c.

◆ wszPRC32KBig

WCHAR wszPRC32KBig[] = L"PRC 32K(Big)"

Definition at line 134 of file forms.c.

◆ wszPRC32KBigRotated

WCHAR wszPRC32KBigRotated[] = L"PRC 32K(Big) Rotated"

Definition at line 147 of file forms.c.

◆ wszPRC32KRotated

WCHAR wszPRC32KRotated[] = L"PRC 32K Rotated"

Definition at line 146 of file forms.c.

◆ wszPRCEnvelope1

WCHAR wszPRCEnvelope1[] = L"PRC Envelope #1"

Definition at line 135 of file forms.c.

◆ wszPRCEnvelope10

WCHAR wszPRCEnvelope10[] = L"PRC Envelope #10"

Definition at line 144 of file forms.c.

◆ wszPRCEnvelope10Rotated

WCHAR wszPRCEnvelope10Rotated[] = L"PRC Envelope #10 Rotated"

Definition at line 157 of file forms.c.

◆ wszPRCEnvelope1Rotated

WCHAR wszPRCEnvelope1Rotated[] = L"PRC Envelope #1 Rotated"

Definition at line 148 of file forms.c.

◆ wszPRCEnvelope2

WCHAR wszPRCEnvelope2[] = L"PRC Envelope #2"

Definition at line 136 of file forms.c.

◆ wszPRCEnvelope2Rotated

WCHAR wszPRCEnvelope2Rotated[] = L"PRC Envelope #2 Rotated"

Definition at line 149 of file forms.c.

◆ wszPRCEnvelope3

WCHAR wszPRCEnvelope3[] = L"PRC Envelope #3"

Definition at line 137 of file forms.c.

◆ wszPRCEnvelope3Rotated

WCHAR wszPRCEnvelope3Rotated[] = L"PRC Envelope #3 Rotated"

Definition at line 150 of file forms.c.

◆ wszPRCEnvelope4

WCHAR wszPRCEnvelope4[] = L"PRC Envelope #4"

Definition at line 138 of file forms.c.

◆ wszPRCEnvelope4Rotated

WCHAR wszPRCEnvelope4Rotated[] = L"PRC Envelope #4 Rotated"

Definition at line 151 of file forms.c.

◆ wszPRCEnvelope5

WCHAR wszPRCEnvelope5[] = L"PRC Envelope #5"

Definition at line 139 of file forms.c.

◆ wszPRCEnvelope5Rotated

WCHAR wszPRCEnvelope5Rotated[] = L"PRC Envelope #5 Rotated"

Definition at line 152 of file forms.c.

◆ wszPRCEnvelope6

WCHAR wszPRCEnvelope6[] = L"PRC Envelope #6"

Definition at line 140 of file forms.c.

◆ wszPRCEnvelope6Rotated

WCHAR wszPRCEnvelope6Rotated[] = L"PRC Envelope #6 Rotated"

Definition at line 153 of file forms.c.

◆ wszPRCEnvelope7

WCHAR wszPRCEnvelope7[] = L"PRC Envelope #7"

Definition at line 141 of file forms.c.

◆ wszPRCEnvelope7Rotated

WCHAR wszPRCEnvelope7Rotated[] = L"PRC Envelope #7 Rotated"

Definition at line 154 of file forms.c.

◆ wszPRCEnvelope8

WCHAR wszPRCEnvelope8[] = L"PRC Envelope #8"

Definition at line 142 of file forms.c.

◆ wszPRCEnvelope8Rotated

WCHAR wszPRCEnvelope8Rotated[] = L"PRC Envelope #8 Rotated"

Definition at line 155 of file forms.c.

◆ wszPRCEnvelope9

WCHAR wszPRCEnvelope9[] = L"PRC Envelope #9"

Definition at line 143 of file forms.c.

◆ wszPRCEnvelope9Rotated

WCHAR wszPRCEnvelope9Rotated[] = L"PRC Envelope #9 Rotated"

Definition at line 156 of file forms.c.

◆ wszQuarto

WCHAR wszQuarto[] = L"Quarto"

Definition at line 54 of file forms.c.

◆ wszReserved48

WCHAR wszReserved48[] = L"Reserved48"

Definition at line 87 of file forms.c.

◆ wszReserved49

WCHAR wszReserved49[] = L"Reserved49"

Definition at line 88 of file forms.c.

◆ wszStatement

WCHAR wszStatement[] = L"Statement"

Definition at line 45 of file forms.c.

◆ wszSuperA

WCHAR wszSuperA[] = L"Super A"

Definition at line 96 of file forms.c.

◆ wszSuperB

WCHAR wszSuperB[] = L"Super B"

Definition at line 97 of file forms.c.

◆ wszTabloid

WCHAR wszTabloid[] = L"Tabloid"

Definition at line 42 of file forms.c.

◆ wszTabloidExtra

WCHAR wszTabloidExtra[] = L"Tabloid Extra"

Definition at line 91 of file forms.c.

◆ wszUSStdFanfold

WCHAR wszUSStdFanfold[] = L"US Std Fanfold"

Definition at line 78 of file forms.c.