ReactOS  0.4.15-dev-2956-g61e7ea5
CPrinterFolder.cpp File Reference
#include <precomp.h>
#include <winspool.h>
Include dependency graph for CPrinterFolder.cpp:

Go to the source code of this file.

Classes

class  CPrintersEnum
 

Macros

#define COLUMN_NAME   0
 
#define COLUMN_DOCUMENTS   1
 
#define COLUMN_STATUS   2
 
#define COLUMN_COMMENTS   3
 
#define COLUMN_LOCATION   4
 
#define COLUMN_MODEL   5
 
#define PrinterSHELLVIEWCOLUMNS   (6)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
HRESULT WINAPI CPrintersExtractIconW_CreateInstane (LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv)
 
static LPITEMIDLIST _ILCreatePrinterItem (PRINTER_INFO_4W *pi)
 
static PIDLPrinterStruct * _ILGetPrinterStruct (LPCITEMIDLIST pidl)
 

Variables

static shvheader PrinterSFHeader []
 

Macro Definition Documentation

◆ COLUMN_COMMENTS

#define COLUMN_COMMENTS   3

Definition at line 42 of file CPrinterFolder.cpp.

◆ COLUMN_DOCUMENTS

#define COLUMN_DOCUMENTS   1

Definition at line 40 of file CPrinterFolder.cpp.

◆ COLUMN_LOCATION

#define COLUMN_LOCATION   4

Definition at line 43 of file CPrinterFolder.cpp.

◆ COLUMN_MODEL

#define COLUMN_MODEL   5

Definition at line 44 of file CPrinterFolder.cpp.

◆ COLUMN_NAME

#define COLUMN_NAME   0

Definition at line 39 of file CPrinterFolder.cpp.

◆ COLUMN_STATUS

#define COLUMN_STATUS   2

Definition at line 41 of file CPrinterFolder.cpp.

◆ PrinterSHELLVIEWCOLUMNS

#define PrinterSHELLVIEWCOLUMNS   (6)

Definition at line 46 of file CPrinterFolder.cpp.

Function Documentation

◆ _ILCreatePrinterItem()

static LPITEMIDLIST _ILCreatePrinterItem ( PRINTER_INFO_4W pi)
static

Definition at line 98 of file CPrinterFolder.cpp.

99 {
100  PIDLDATA tmp;
101  LPITEMIDLIST pidl;
102  PIDLPrinterStruct * p;
103  int size0 = (char*)&tmp.u.cprinter.szName - (char*)&tmp.u.cprinter;
104  int size = size0;
105  SIZE_T cchPrinterName, cchServerName;
106 
107  cchPrinterName = wcslen(pi->pPrinterName);
108  cchServerName = wcslen(pi->pServerName);
109  if ((cchPrinterName + cchServerName) > (MAXUSHORT - 2))
110  {
111  return NULL;
112  }
113 
114  tmp.type = 0x00;
115  tmp.u.cprinter.dummy = 0xFF;
116  if (pi->pPrinterName)
117  tmp.u.cprinter.offsServer = cchPrinterName + 1;
118  else
119  tmp.u.cprinter.offsServer = 1;
120 
121  size += tmp.u.cprinter.offsServer * sizeof(WCHAR);
122  if (pi->pServerName)
123  size += (cchServerName + 1) * sizeof(WCHAR);
124  else
125  size += sizeof(WCHAR);
126 
127  pidl = (LPITEMIDLIST)SHAlloc(size + 4);
128  if (!pidl)
129  return pidl;
130 
131  pidl->mkid.cb = size + 2;
132  memcpy(pidl->mkid.abID, &tmp, 2 + size0);
133 
134  p = &((PIDLDATA*)pidl->mkid.abID)->u.cprinter;
135 
136  p->Attributes = pi->Attributes;
137  if (pi->pPrinterName)
138  wcscpy(p->szName, pi->pPrinterName);
139  else
140  p->szName[0] = L'\0';
141 
142  if (pi->pServerName)
143  wcscpy(p->szName + p->offsServer, pi->pServerName);
144  else
145  p->szName[p->offsServer] = L'\0';
146 
147  *(WORD*)((char*)pidl + (size + 2)) = 0;
148  return pidl;
149 }
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
static refpint_t pi[]
Definition: server.c:96
unsigned short WORD
Definition: ntddk_ex.h:93
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define MAXUSHORT
Definition: typedefs.h:83
GLfloat GLfloat p
Definition: glext.h:8902
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309

Referenced by CPrintersEnum::CreatePrintersEnumList().

◆ _ILGetPrinterStruct()

static PIDLPrinterStruct* _ILGetPrinterStruct ( LPCITEMIDLIST  pidl)
static

Definition at line 222 of file CPrinterFolder.cpp.

223 {
225 
226  if (pdata && pdata->type == 0x00)
227  return (PIDLPrinterStruct*) & (pdata->u.cfont);
228 
229  return NULL;
230 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2176
static PROTOCOLDATA * pdata
Definition: protocol.c:158
#define NULL
Definition: types.h:112

Referenced by CPrinterFolder::GetDisplayNameOf().

◆ CPrintersExtractIconW_CreateInstane()

HRESULT WINAPI CPrintersExtractIconW_CreateInstane ( LPCITEMIDLIST  pidl,
REFIID  riid,
LPVOID ppv 
)

Definition at line 53 of file CPrinterFolder.cpp.

54 {
55  CComPtr<IDefaultExtractIconInit> initIcon;
58  return hr;
59 
60  /* FIXME: other icons for default, network, print to file */
61  initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_PRINTER);
62 
63  return initIcon->QueryInterface(riid,ppv);
64 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
#define IID_PPV_ARG(Itype, ppType)
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
HRESULT WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
#define IDI_SHELL_PRINTER
Definition: shresdef.h:538

Referenced by CPrinterFolder::GetUIObjectOf().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ PrinterSFHeader