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

Referenced by CPrintersEnum::CreatePrintersEnumList().

◆ _ILGetPrinterStruct()

static PIDLPrinterStruct * _ILGetPrinterStruct ( LPCITEMIDLIST  pidl)
static

Definition at line 225 of file CPrinterFolder.cpp.

226{
228
229 if (pdata && pdata->type == 0x00)
230 return (PIDLPrinterStruct*) & (pdata->u.cfont);
231
232 return NULL;
233}
static PROTOCOLDATA * pdata
Definition: protocol.c:158
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2202

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 WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
HRESULT hr
Definition: shlfolder.c:183
#define IDI_SHELL_PRINTER
Definition: shresdef.h:566
#define IID_PPV_ARG(Itype, ppType)

Referenced by CPrinterFolder::GetUIObjectOf().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ PrinterSFHeader