ReactOS  0.4.15-dev-1070-ge1a01de
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 
106  tmp.type = 0x00;
107  tmp.u.cprinter.dummy = 0xFF;
108  if (pi->pPrinterName)
109  tmp.u.cprinter.offsServer = wcslen(pi->pPrinterName) + 1;
110  else
111  tmp.u.cprinter.offsServer = 1;
112 
113  size += tmp.u.cprinter.offsServer * sizeof(WCHAR);
114  if (pi->pServerName)
115  size += (wcslen(pi->pServerName) + 1) * sizeof(WCHAR);
116  else
117  size += sizeof(WCHAR);
118 
119  pidl = (LPITEMIDLIST)SHAlloc(size + 4);
120  if (!pidl)
121  return pidl;
122 
123  pidl->mkid.cb = size + 2;
124  memcpy(pidl->mkid.abID, &tmp, 2 + size0);
125 
126  p = &((PIDLDATA*)pidl->mkid.abID)->u.cprinter;
127 
128  p->Attributes = pi->Attributes;
129  if (pi->pPrinterName)
130  wcscpy(p->szName, pi->pPrinterName);
131  else
132  p->szName[0] = L'\0';
133 
134  if (pi->pServerName)
135  wcscpy(p->szName + p->offsServer, pi->pServerName);
136  else
137  p->szName[p->offsServer] = L'\0';
138 
139  *(WORD*)((char*)pidl + (size + 2)) = 0;
140  return pidl;
141 }
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
GLfloat GLfloat p
Definition: glext.h:8902
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by CPrintersEnum::CreatePrintersEnumList().

◆ _ILGetPrinterStruct()

static PIDLPrinterStruct* _ILGetPrinterStruct ( LPCITEMIDLIST  pidl)
static

Definition at line 214 of file CPrinterFolder.cpp.

215 {
217 
218  if (pdata && pdata->type == 0x00)
219  return (PIDLPrinterStruct*) & (pdata->u.cfont);
220 
221  return NULL;
222 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2176
smooth NULL
Definition: ftsmooth.c:416
static PROTOCOLDATA * pdata
Definition: protocol.c:158

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:71
HRESULT WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
#define IDI_SHELL_PRINTER
Definition: shresdef.h:512

Referenced by CPrinterFolder::GetUIObjectOf().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ PrinterSFHeader