99{
102 PIDLPrinterStruct *
p;
103 int size0 = (char*)&tmp.u.cprinter.szName - (char*)&tmp.u.cprinter;
105 SIZE_T cchPrinterName = 0;
107
108 if (
pi->pPrinterName)
109 cchPrinterName =
wcslen(
pi->pPrinterName);
111 cchServerName =
wcslen(
pi->pServerName);
112 if ((cchPrinterName + cchServerName) > (
MAXUSHORT - 2))
113 {
115 }
116
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);
126 size += (cchServerName + 1) *
sizeof(
WCHAR);
127 else
129
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)
142 else
143 p->szName[0] =
L'\0';
144
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}
LPVOID WINAPI SHAlloc(SIZE_T len)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define memcpy(s1, s2, n)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
ITEMIDLIST UNALIGNED * LPITEMIDLIST