ReactOS 0.4.16-dev-125-g798ea90
setupcab.c
Go to the documentation of this file.
1/*
2 * Setupapi cabinet routines
3 *
4 * Copyright 2003 Gregory M. Turner
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 *
21 * Many useful traces are commented in code, uncomment them if you have
22 * trouble and run with WINEDEBUG=+setupapi
23 *
24 */
25
26#include "setupapi_private.h"
27
28#include <fcntl.h>
29#include <share.h>
30#include <fdi.h>
31
34
36
37static HFDI (__cdecl *sc_FDICreate)(PFNALLOC, PFNFREE, PFNOPEN,
39
40static BOOL (__cdecl *sc_FDICopy)(HFDI, char *, char *, int,
42
43static BOOL (__cdecl *sc_FDIDestroy)(HFDI);
44
45#define SC_HSC_A_MAGIC 0xACABFEED
46typedef struct {
51 CHAR most_recent_cabinet_name[MAX_PATH];
52 CHAR most_recent_target[MAX_PATH];
54
55#define SC_HSC_W_MAGIC 0x0CABFEED
56typedef struct {
61 WCHAR most_recent_cabinet_name[MAX_PATH];
62 WCHAR most_recent_target[MAX_PATH];
64
65static BOOL LoadCABINETDll(void)
66{
67 if (!CABINET_hInstance) {
68 CABINET_hInstance = LoadLibraryA("cabinet.dll");
70 sc_FDICreate = (void *)GetProcAddress(CABINET_hInstance, "FDICreate");
71 sc_FDICopy = (void *)GetProcAddress(CABINET_hInstance, "FDICopy");
72 sc_FDIDestroy = (void *)GetProcAddress(CABINET_hInstance, "FDIDestroy");
73 return TRUE;
74 } else {
75 ERR("load cabinet dll failed.\n");
76 return FALSE;
77 }
78 } else
79 return TRUE;
80}
81
82/* FDICreate callbacks */
83
84static void * CDECL sc_cb_alloc(ULONG cb)
85{
86 return HeapAlloc(GetProcessHeap(), 0, cb);
87}
88
89static void CDECL sc_cb_free(void *pv)
90{
91 HeapFree(GetProcessHeap(), 0, pv);
92}
93
94static INT_PTR CDECL sc_cb_open(char *pszFile, int oflag, int pmode)
95{
96 DWORD creation = 0, sharing = 0;
97 int ioflag = 0;
98 INT_PTR ret = 0;
100
101 /* TRACE("(pszFile == %s, oflag == %d, pmode == %d)\n", debugstr_a(pszFile), oflag, pmode); */
102
103 switch(oflag & (_O_RDONLY | _O_WRONLY | _O_RDWR)) {
104 case _O_RDONLY:
105 ioflag |= GENERIC_READ;
106 break;
107 case _O_WRONLY:
108 ioflag |= GENERIC_WRITE;
109 break;
110 case _O_RDWR:
111 ioflag |= GENERIC_READ | GENERIC_WRITE;
112 break;
113 case _O_WRONLY | _O_RDWR: /* hmmm.. */
114 ERR("_O_WRONLY & _O_RDWR in oflag?\n");
115 return -1;
116 }
117
118 if (oflag & _O_CREAT) {
119 if (oflag & _O_EXCL)
120 creation = CREATE_NEW;
121 else if (oflag & _O_TRUNC)
122 creation = CREATE_ALWAYS;
123 else
124 creation = OPEN_ALWAYS;
125 } else /* no _O_CREAT */ {
126 if (oflag & _O_TRUNC)
127 creation = TRUNCATE_EXISTING;
128 else
129 creation = OPEN_EXISTING;
130 }
131
132 switch( pmode & 0x70 ) {
133 case _SH_DENYRW:
134 sharing = 0L;
135 break;
136 case _SH_DENYWR:
138 break;
139 case _SH_DENYRD:
141 break;
142 case _SH_COMPAT:
143 case _SH_DENYNO:
145 break;
146 default:
147 ERR("<-- -1 (Unhandled pmode 0x%x)\n", pmode);
148 return -1;
149 }
150
152 WARN("unsupported oflag 0x%04x\n",oflag);
153
154 sa.nLength = sizeof( SECURITY_ATTRIBUTES );
155 sa.lpSecurityDescriptor = NULL;
156 sa.bInheritHandle = !(ioflag & _O_NOINHERIT);
157
158 ret = (INT_PTR) CreateFileA(pszFile, ioflag, sharing, &sa, creation, FILE_ATTRIBUTE_NORMAL, NULL);
159
160 /* TRACE("<-- %d\n", ret); */
161
162 return ret;
163}
164
165static UINT CDECL sc_cb_read(INT_PTR hf, void *pv, UINT cb)
166{
167 DWORD num_read;
168 BOOL rslt;
169
170 /* TRACE("(hf == %d, pv == ^%p, cb == %u)\n", hf, pv, cb); */
171
172 rslt = ReadFile((HANDLE) hf, pv, cb, &num_read, NULL);
173
174
175 /* eof and failure both give "-1" return */
176 if ((! rslt) || ((cb > 0) && (num_read == 0))) {
177 /* TRACE("<-- -1\n"); */
178 return -1;
179 }
180
181 /* TRACE("<-- %lu\n", num_read); */
182 return num_read;
183}
184
185static UINT CDECL sc_cb_write(INT_PTR hf, void *pv, UINT cb)
186{
187 DWORD num_written;
188 /* BOOL rv; */
189
190 /* TRACE("(hf == %d, pv == ^%p, cb == %u)\n", hf, pv, cb); */
191
192 if ( /* (rv = */ WriteFile((HANDLE) hf, pv, cb, &num_written, NULL) /* ) */
193 && (num_written == cb)) {
194 /* TRACE("<-- %lu\n", num_written); */
195 return num_written;
196 } else {
197 /* TRACE("rv == %d, num_written == %lu, cb == %u\n", rv, num_written,cb); */
198 /* TRACE("<-- -1\n"); */
199 return -1;
200 }
201}
202
204{
205 /* TRACE("(hf == %d)\n", hf); */
206
207 if (CloseHandle((HANDLE) hf))
208 return 0;
209 else
210 return -1;
211}
212
213static LONG CDECL sc_cb_lseek(INT_PTR hf, LONG dist, int seektype)
214{
215 DWORD ret;
216
217 /* TRACE("(hf == %d, dist == %ld, seektype == %d)\n", hf, dist, seektype); */
218
219 if (seektype < 0 || seektype > 2)
220 return -1;
221
222 if (((ret = SetFilePointer((HANDLE) hf, dist, NULL, seektype)) != INVALID_SET_FILE_POINTER) || !GetLastError()) {
223 /* TRACE("<-- %lu\n", ret); */
224 return ret;
225 } else {
226 /* TRACE("<-- -1\n"); */
227 return -1;
228 }
229}
230
231#define SIZEOF_MYSTERIO (MAX_PATH*3)
232
233/* FDICopy callbacks */
234
236{
238 PSC_HSC_A phsc;
240 FILEPATHS_A fp;
241 UINT err;
242
243 CHAR mysterio[SIZEOF_MYSTERIO]; /* how big? undocumented! probably 256... */
244
245 memset(mysterio, 0, SIZEOF_MYSTERIO);
246
247 TRACE("(fdint == %d, pfdin == ^%p)\n", fdint, pfdin);
248
249 if (pfdin && pfdin->pv && (((PSC_HSC_A) pfdin->pv)->magic == SC_HSC_A_MAGIC))
250 phsc = pfdin->pv;
251 else {
252 ERR("pv %p is not an SC_HSC_A.\n", (pfdin) ? pfdin->pv : NULL);
253 return -1;
254 }
255
256 switch (fdint) {
258 TRACE("Cabinet info notification\n");
259 /* TRACE(" Cabinet name: %s\n", debugstr_a(pfdin->psz1));
260 TRACE(" Cabinet disk: %s\n", debugstr_a(pfdin->psz2));
261 TRACE(" Cabinet path: %s\n", debugstr_a(pfdin->psz3));
262 TRACE(" Cabinet Set#: %d\n", pfdin->setID);
263 TRACE(" Cabinet Cab#: %d\n", pfdin->iCabinet); */
264 WARN("SPFILENOTIFY_CABINETINFO undocumented: guess implementation.\n");
266 ci.CabinetPath = pfdin->psz3;
267 ci.DiskName = pfdin->psz2;
268 ci.SetId = pfdin->setID;
269 ci.CabinetNumber = pfdin->iCabinet;
270 phsc->msghandler(phsc->context, SPFILENOTIFY_CABINETINFO, (UINT_PTR) &ci, 0);
271 return 0;
273 TRACE("Partial file notification\n");
274 /* TRACE(" Partial file name: %s\n", debugstr_a(pfdin->psz1)); */
275 return 0;
276 case fdintCOPY_FILE:
277 TRACE("Copy file notification\n");
278 TRACE(" File name: %s\n", debugstr_a(pfdin->psz1));
279 /* TRACE(" File size: %ld\n", pfdin->cb);
280 TRACE(" File date: %u\n", pfdin->date);
281 TRACE(" File time: %u\n", pfdin->time);
282 TRACE(" File attr: %u\n", pfdin->attribs); */
283 fici.NameInCabinet = pfdin->psz1;
284 fici.FileSize = pfdin->cb;
285 fici.Win32Error = 0;
286 fici.DosDate = pfdin->date;
287 fici.DosTime = pfdin->time;
288 fici.DosAttribs = pfdin->attribs;
291 (UINT_PTR)&fici, (UINT_PTR)pfdin->psz1);
292 if (err == FILEOP_DOIT) {
293 TRACE(" Callback specified filename: %s\n", debugstr_a(fici.FullTargetName));
294 if (!fici.FullTargetName[0]) {
295 WARN(" Empty return string causing abort.\n");
297 return -1;
298 }
299 strcpy( phsc->most_recent_target, fici.FullTargetName );
300 return sc_cb_open(fici.FullTargetName, _O_BINARY | _O_CREAT | _O_WRONLY, _S_IREAD | _S_IWRITE);
301 } else {
302 TRACE(" Callback skipped file.\n");
303 return 0;
304 }
306 TRACE("Close file notification\n");
307 /* TRACE(" File name: %s\n", debugstr_a(pfdin->psz1));
308 TRACE(" Exec file? %s\n", (pfdin->cb) ? "Yes" : "No");
309 TRACE(" File hndl: %d\n", pfdin->hf); */
311 fp.Target = phsc->most_recent_target;
312 fp.Win32Error = 0;
313 fp.Flags = 0;
314 /* the following should be a fixme -- but it occurs too many times */
315 WARN("Should set file date/time/attribs (and execute files?)\n");
316 if (sc_cb_close(pfdin->hf))
317 WARN("_close failed.\n");
319 if (err) {
321 return FALSE;
322 } else
323 return TRUE;
325 TRACE("Next cabinet notification\n");
326 /* TRACE(" Cabinet name: %s\n", debugstr_a(pfdin->psz1));
327 TRACE(" Cabinet disk: %s\n", debugstr_a(pfdin->psz2));
328 TRACE(" Cabinet path: %s\n", debugstr_a(pfdin->psz3));
329 TRACE(" Cabinet Set#: %d\n", pfdin->setID);
330 TRACE(" Cabinet Cab#: %d\n", pfdin->iCabinet); */
331 ci.CabinetFile = pfdin->psz1;
332 ci.CabinetPath = pfdin->psz3;
333 ci.DiskName = pfdin->psz2;
334 ci.SetId = pfdin->setID;
335 ci.CabinetNumber = pfdin->iCabinet;
336 /* remember the new cabinet name */
337 strcpy(phsc->most_recent_cabinet_name, pfdin->psz1);
338 err = phsc->msghandler(phsc->context, SPFILENOTIFY_NEEDNEWCABINET, (UINT_PTR)&ci, (UINT_PTR)mysterio);
339 if (err) {
341 return -1;
342 } else {
343 if (mysterio[0]) {
344 /* some easy paranoia. no such carefulness exists on the wide API IIRC */
345 lstrcpynA(pfdin->psz3, mysterio, SIZEOF_MYSTERIO);
346 }
347 return 0;
348 }
349 default:
350 FIXME("Unknown notification type %d.\n", fdint);
351 return 0;
352 }
353}
354
356{
358 PSC_HSC_W phsc;
360 FILEPATHS_W fp;
361 UINT err;
362 int len;
363
364 WCHAR mysterio[SIZEOF_MYSTERIO]; /* how big? undocumented! */
365 WCHAR buf[MAX_PATH], buf2[MAX_PATH];
366 CHAR charbuf[MAX_PATH];
367
368 memset(mysterio, 0, SIZEOF_MYSTERIO * sizeof(WCHAR));
369 memset(buf, 0, MAX_PATH * sizeof(WCHAR));
370 memset(buf2, 0, MAX_PATH * sizeof(WCHAR));
371 memset(charbuf, 0, MAX_PATH);
372
373 TRACE("(fdint == %d, pfdin == ^%p)\n", fdint, pfdin);
374
375 if (pfdin && pfdin->pv && (((PSC_HSC_W) pfdin->pv)->magic == SC_HSC_W_MAGIC))
376 phsc = pfdin->pv;
377 else {
378 ERR("pv %p is not an SC_HSC_W.\n", (pfdin) ? pfdin->pv : NULL);
379 return -1;
380 }
381
382 switch (fdint) {
384 TRACE("Cabinet info notification\n");
385 /* TRACE(" Cabinet name: %s\n", debugstr_a(pfdin->psz1));
386 TRACE(" Cabinet disk: %s\n", debugstr_a(pfdin->psz2));
387 TRACE(" Cabinet path: %s\n", debugstr_a(pfdin->psz3));
388 TRACE(" Cabinet Set#: %d\n", pfdin->setID);
389 TRACE(" Cabinet Cab#: %d\n", pfdin->iCabinet); */
390 WARN("SPFILENOTIFY_CABINETINFO undocumented: guess implementation.\n");
392 len = 1 + MultiByteToWideChar(CP_ACP, 0, pfdin->psz3, -1, buf, MAX_PATH);
393 if ((len > MAX_PATH) || (len <= 1))
394 buf[0] = '\0';
395 ci.CabinetPath = buf;
396 len = 1 + MultiByteToWideChar(CP_ACP, 0, pfdin->psz2, -1, buf2, MAX_PATH);
397 if ((len > MAX_PATH) || (len <= 1))
398 buf2[0] = '\0';
399 ci.DiskName = buf2;
400 ci.SetId = pfdin->setID;
401 ci.CabinetNumber = pfdin->iCabinet;
403 return 0;
405 TRACE("Partial file notification\n");
406 /* TRACE(" Partial file name: %s\n", debugstr_a(pfdin->psz1)); */
407 return 0;
408 case fdintCOPY_FILE:
409 TRACE("Copy file notification\n");
410 TRACE(" File name: %s\n", debugstr_a(pfdin->psz1));
411 /* TRACE(" File size: %ld\n", pfdin->cb);
412 TRACE(" File date: %u\n", pfdin->date);
413 TRACE(" File time: %u\n", pfdin->time);
414 TRACE(" File attr: %u\n", pfdin->attribs); */
415 len = 1 + MultiByteToWideChar(CP_ACP, 0, pfdin->psz1, -1, buf2, MAX_PATH);
416 if ((len > MAX_PATH) || (len <= 1))
417 buf2[0] = '\0';
418 fici.NameInCabinet = buf2;
419 fici.FileSize = pfdin->cb;
420 fici.Win32Error = 0;
421 fici.DosDate = pfdin->date;
422 fici.DosTime = pfdin->time;
423 fici.DosAttribs = pfdin->attribs;
424 memset(fici.FullTargetName, 0, MAX_PATH * sizeof(WCHAR));
426 (UINT_PTR)&fici, (UINT_PTR)pfdin->psz1);
427 if (err == FILEOP_DOIT) {
428 TRACE(" Callback specified filename: %s\n", debugstr_w(fici.FullTargetName));
429 if (fici.FullTargetName[0]) {
430 len = strlenW(fici.FullTargetName) + 1;
431 if ((len > MAX_PATH ) || (len <= 1))
432 return 0;
433 if (!WideCharToMultiByte(CP_ACP, 0, fici.FullTargetName, len, charbuf, MAX_PATH, 0, 0))
434 return 0;
435 } else {
436 WARN("Empty buffer string caused abort.\n");
438 return -1;
439 }
440 strcpyW( phsc->most_recent_target, fici.FullTargetName );
442 } else {
443 TRACE(" Callback skipped file.\n");
444 return 0;
445 }
447 TRACE("Close file notification\n");
448 /* TRACE(" File name: %s\n", debugstr_a(pfdin->psz1));
449 TRACE(" Exec file? %s\n", (pfdin->cb) ? "Yes" : "No");
450 TRACE(" File hndl: %d\n", pfdin->hf); */
452 fp.Target = phsc->most_recent_target;
453 fp.Win32Error = 0;
454 fp.Flags = 0;
455 /* a valid fixme -- but occurs too many times */
456 /* FIXME("Should set file date/time/attribs (and execute files?)\n"); */
457 if (sc_cb_close(pfdin->hf))
458 WARN("_close failed.\n");
460 if (err) {
462 return FALSE;
463 } else
464 return TRUE;
466 TRACE("Next cabinet notification\n");
467 /* TRACE(" Cabinet name: %s\n", debugstr_a(pfdin->psz1));
468 TRACE(" Cabinet disk: %s\n", debugstr_a(pfdin->psz2));
469 TRACE(" Cabinet path: %s\n", debugstr_a(pfdin->psz3));
470 TRACE(" Cabinet Set#: %d\n", pfdin->setID);
471 TRACE(" Cabinet Cab#: %d\n", pfdin->iCabinet); */
472 /* remember the new cabinet name */
474 if ((len > MAX_PATH) || (len <= 1))
475 phsc->most_recent_cabinet_name[0] = '\0';
476 ci.CabinetFile = phsc->most_recent_cabinet_name;
477 len = 1 + MultiByteToWideChar(CP_ACP, 0, pfdin->psz3, -1, buf, MAX_PATH);
478 if ((len > MAX_PATH) || (len <= 1))
479 buf[0] = '\0';
480 ci.CabinetPath = buf;
481 len = 1 + MultiByteToWideChar(CP_ACP, 0, pfdin->psz2, -1, buf2, MAX_PATH);
482 if ((len > MAX_PATH) || (len <= 1))
483 buf2[0] = '\0';
484 ci.DiskName = buf2;
485 ci.SetId = pfdin->setID;
486 ci.CabinetNumber = pfdin->iCabinet;
487 err = phsc->msghandler(phsc->context, SPFILENOTIFY_NEEDNEWCABINET, (UINT_PTR)&ci, (UINT_PTR)mysterio);
488 if (err) {
490 return -1;
491 } else {
492 if (mysterio[0]) {
493 len = strlenW(mysterio) + 1;
494 if ((len > 255) || (len <= 1))
495 return 0;
496 if (!WideCharToMultiByte(CP_ACP, 0, mysterio, len, pfdin->psz3, 255, 0, 0))
497 return 0;
498 }
499 return 0;
500 }
501 default:
502 FIXME("Unknown notification type %d.\n", fdint);
503 return 0;
504 }
505}
506
507/***********************************************************************
508 * SetupIterateCabinetA (SETUPAPI.@)
509 */
512{
513
514 SC_HSC_A my_hsc;
515 ERF erf;
516 CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH], *p = NULL;
517 DWORD fpnsize;
518 BOOL ret;
519
520 TRACE("(CabinetFile == %s, Reserved == %u, MsgHandler == ^%p, Context == ^%p)\n",
521 debugstr_a(CabinetFile), Reserved, MsgHandler, Context);
522
523 if (!LoadCABINETDll())
524 return FALSE;
525
526 if (!CabinetFile)
527 {
529 return FALSE;
530 }
531
532 fpnsize = strlen(CabinetFile);
533 if (fpnsize >= MAX_PATH) {
535 return FALSE;
536 }
537
538 fpnsize = GetFullPathNameA(CabinetFile, MAX_PATH, pszCabPath, &p);
539 if (fpnsize > MAX_PATH) {
541 return FALSE;
542 }
543
544 if (p) {
545 strcpy(pszCabinet, p);
546 *p = '\0';
547 } else {
548 strcpy(pszCabinet, CabinetFile);
549 pszCabPath[0] = '\0';
550 }
551
552 TRACE("path: %s, cabfile: %s\n", debugstr_a(pszCabPath), debugstr_a(pszCabinet));
553
554 /* remember the cabinet name */
555 strcpy(my_hsc.most_recent_cabinet_name, pszCabinet);
556
557 my_hsc.magic = SC_HSC_A_MAGIC;
558 my_hsc.msghandler = MsgHandler;
559 my_hsc.context = Context;
560 my_hsc.hfdi = sc_FDICreate( sc_cb_alloc, sc_cb_free, sc_cb_open, sc_cb_read,
562
563 if (!my_hsc.hfdi) return FALSE;
564
565 ret = sc_FDICopy(my_hsc.hfdi, pszCabinet, pszCabPath, 0, sc_FNNOTIFY_A, NULL, &my_hsc);
566
567 sc_FDIDestroy(my_hsc.hfdi);
568 return ret;
569}
570
571
572/***********************************************************************
573 * SetupIterateCabinetW (SETUPAPI.@)
574 */
577{
578 CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH];
579 UINT len;
580 SC_HSC_W my_hsc;
581 ERF erf;
582 WCHAR pszCabPathW[MAX_PATH], *p = NULL;
583 DWORD fpnsize;
584 BOOL ret;
585
586 TRACE("(CabinetFile == %s, Reserved == %u, MsgHandler == ^%p, Context == ^%p)\n",
587 debugstr_w(CabinetFile), Reserved, MsgHandler, Context);
588
589 if (!LoadCABINETDll())
590 return FALSE;
591
592 if (!CabinetFile)
593 {
595 return FALSE;
596 }
597
598 fpnsize = GetFullPathNameW(CabinetFile, MAX_PATH, pszCabPathW, &p);
599 if (fpnsize > MAX_PATH) {
601 return FALSE;
602 }
603
604 if (p) {
606 *p = 0;
607 len = WideCharToMultiByte(CP_ACP, 0, pszCabPathW, -1, pszCabPath,
608 MAX_PATH, 0, 0);
609 if (!len) return FALSE;
610 } else {
611 strcpyW(my_hsc.most_recent_cabinet_name, CabinetFile);
612 pszCabPath[0] = '\0';
613 }
614
616 pszCabinet, MAX_PATH, 0, 0);
617 if (!len) return FALSE;
618
619 TRACE("path: %s, cabfile: %s\n",
620 debugstr_a(pszCabPath), debugstr_a(pszCabinet));
621
622 my_hsc.magic = SC_HSC_W_MAGIC;
623 my_hsc.msghandler = MsgHandler;
624 my_hsc.context = Context;
625 my_hsc.hfdi = sc_FDICreate( sc_cb_alloc, sc_cb_free, sc_cb_open, sc_cb_read,
627
628 if (!my_hsc.hfdi) return FALSE;
629
630 ret = sc_FDICopy(my_hsc.hfdi, pszCabinet, pszCabPath, 0, sc_FNNOTIFY_W, NULL, &my_hsc);
631
632 sc_FDIDestroy(my_hsc.hfdi);
633 return ret;
634}
635
636
637/***********************************************************************
638 * DllMain
639 *
640 * PARAMS
641 * hinstDLL [I] handle to the DLL's instance
642 * fdwReason [I]
643 * lpvReserved [I] reserved, must be NULL
644 *
645 * RETURNS
646 * Success: TRUE
647 * Failure: FALSE
648 */
649
651{
652 switch (fdwReason) {
657 return FALSE;
658 hInstance = (HINSTANCE)hinstDLL;
659 break;
661 if (lpvReserved) break;
664 break;
665 }
666
667 return TRUE;
668}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define __cdecl
Definition: accygwin.h:79
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define _O_RDWR
Definition: cabinet.h:39
#define _O_BINARY
Definition: cabinet.h:51
#define _O_NOINHERIT
Definition: cabinet.h:45
#define _O_RDONLY
Definition: cabinet.h:37
#define _O_TRUNC
Definition: cabinet.h:47
#define _O_CREAT
Definition: cabinet.h:46
#define _O_EXCL
Definition: cabinet.h:48
#define _O_WRONLY
Definition: cabinet.h:38
#define _S_IWRITE
Definition: cabinet.h:33
#define _S_IREAD
Definition: cabinet.h:34
#define CDECL
Definition: compat.h:29
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define INVALID_SET_FILE_POINTER
Definition: compat.h:732
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetFilePointer
Definition: compat.h:743
#define lstrcpynA
Definition: compat.h:751
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define FreeLibrary(x)
Definition: compat.h:748
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
DWORD WINAPI GetFullPathNameA(IN LPCSTR lpFileName, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart)
Definition: path.c:993
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
void WINAPI SetupCloseLog(void)
Definition: misc.c:2017
static INT_PTR CDECL sc_FNNOTIFY_W(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
Definition: setupcab.c:355
struct SC_HSC_A * PSC_HSC_A
static void *CDECL sc_cb_alloc(ULONG cb)
Definition: setupcab.c:84
struct SC_HSC_W * PSC_HSC_W
static PERF
Definition: setupcab.c:38
BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_W MsgHandler, PVOID Context)
Definition: setupcab.c:575
#define SC_HSC_W_MAGIC
Definition: setupcab.c:55
static char char PFNFDINOTIFY
Definition: setupcab.c:41
static HINSTANCE CABINET_hInstance
Definition: setupcab.c:35
BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_A MsgHandler, PVOID Context)
Definition: setupcab.c:510
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
Definition: setupcab.c:650
static char char PFNFDIDECRYPT
Definition: setupcab.c:41
static void CDECL sc_cb_free(void *pv)
Definition: setupcab.c:89
static PFNCLOSE
Definition: setupcab.c:38
HINSTANCE hInstance
Definition: setupcab.c:32
static INT_PTR CDECL sc_cb_open(char *pszFile, int oflag, int pmode)
Definition: setupcab.c:94
#define SC_HSC_A_MAGIC
Definition: setupcab.c:45
static PFNWRITE
Definition: setupcab.c:38
static int CDECL sc_cb_close(INT_PTR hf)
Definition: setupcab.c:203
static PFNSEEK
Definition: setupcab.c:38
static BOOL LoadCABINETDll(void)
Definition: setupcab.c:65
static PFNREAD
Definition: setupcab.c:38
#define SIZEOF_MYSTERIO
Definition: setupcab.c:231
static PFNFREE
Definition: setupcab.c:37
static PFNOPEN
Definition: setupcab.c:37
OSVERSIONINFOEXW OsVersionInfo
Definition: setupcab.c:33
static UINT CDECL sc_cb_write(INT_PTR hf, void *pv, UINT cb)
Definition: setupcab.c:185
static UINT CDECL sc_cb_read(INT_PTR hf, void *pv, UINT cb)
Definition: setupcab.c:165
static LONG CDECL sc_cb_lseek(INT_PTR hf, LONG dist, int seektype)
Definition: setupcab.c:213
static int
Definition: setupcab.c:38
static INT_PTR CDECL sc_FNNOTIFY_A(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
Definition: setupcab.c:235
FDINOTIFICATIONTYPE
Definition: fdi.h:246
@ fdintCABINET_INFO
Definition: fdi.h:247
@ fdintCOPY_FILE
Definition: fdi.h:249
@ fdintPARTIAL_FILE
Definition: fdi.h:248
@ fdintCLOSE_FILE_INFO
Definition: fdi.h:250
@ fdintNEXT_CABINET
Definition: fdi.h:251
void *(__cdecl * PFNALLOC)(ULONG cb)
Definition: fdi.h:202
void * HFDI
Definition: fdi.h:141
#define cpuUNKNOWN
Definition: fdi.h:269
UINT(CALLBACK * PSP_FILE_CALLBACK_W)(IN PVOID Context, IN UINT Notification, IN UINT_PTR Param1, IN UINT_PTR Param2)
Definition: fileqsup.h:66
#define FILEOP_DOIT
Definition: fileqsup.h:48
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
static IN DWORD IN LPVOID lpvReserved
double __cdecl erf(double)
#define CREATE_ALWAYS
Definition: disk.h:72
#define TRUNCATE_EXISTING
Definition: disk.h:71
#define CREATE_NEW
Definition: disk.h:69
#define OPEN_ALWAYS
Definition: disk.h:70
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG sharing
Definition: pipe.c:70
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define GENERIC_WRITE
Definition: nt_native.h:90
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
#define strlenW(s)
Definition: unicode.h:34
#define strcpyW(d, s)
Definition: unicode.h:35
#define err(...)
#define memset(x, y, z)
Definition: compat.h:39
#define SPFILENOTIFY_CABINETINFO
Definition: setupapi.h:561
#define SPFILENOTIFY_NEEDNEWCABINET
Definition: setupapi.h:563
UINT(CALLBACK * PSP_FILE_CALLBACK_A)(PVOID, UINT, UINT_PTR, UINT_PTR)
Definition: setupapi.h:876
#define SPFILENOTIFY_FILEEXTRACTED
Definition: setupapi.h:564
#define SPFILENOTIFY_FILEINCABINET
Definition: setupapi.h:562
#define _SH_DENYRW
Definition: share.h:14
#define _SH_DENYRD
Definition: share.h:16
#define _SH_COMPAT
Definition: share.h:13
#define _SH_DENYNO
Definition: share.h:17
#define _SH_DENYWR
Definition: share.h:15
#define TRACE(s)
Definition: solgame.cpp:4
Definition: fci.h:44
USHORT setID
Definition: fdi.h:239
USHORT iCabinet
Definition: fdi.h:240
char * psz3
Definition: fdi.h:230
char * psz2
Definition: fdi.h:229
USHORT time
Definition: fdi.h:236
void * pv
Definition: fdi.h:231
INT_PTR hf
Definition: fdi.h:233
char * psz1
Definition: fdi.h:228
USHORT date
Definition: fdi.h:235
USHORT attribs
Definition: fdi.h:237
LONG cb
Definition: fdi.h:227
CHAR most_recent_cabinet_name[MAX_PATH]
Definition: setupcab.c:51
HFDI hfdi
Definition: setupcab.c:48
PVOID context
Definition: setupcab.c:50
UINT magic
Definition: setupcab.c:47
PSP_FILE_CALLBACK_A msghandler
Definition: setupcab.c:49
CHAR most_recent_target[MAX_PATH]
Definition: setupcab.c:52
PSP_FILE_CALLBACK_W msghandler
Definition: setupcab.c:59
WCHAR most_recent_cabinet_name[MAX_PATH]
Definition: setupcab.c:61
PVOID context
Definition: setupcab.c:60
HFDI hfdi
Definition: setupcab.c:58
WCHAR most_recent_target[MAX_PATH]
Definition: setupcab.c:62
UINT magic
Definition: setupcab.c:57
PCSTR CabinetFile
Definition: setupapi.h:776
USHORT CabinetNumber
Definition: setupapi.h:779
PCSTR CabinetPath
Definition: setupapi.h:775
USHORT SetId
Definition: setupapi.h:778
PCSTR DiskName
Definition: setupapi.h:777
USHORT CabinetNumber
Definition: setupapi.h:786
PCWSTR CabinetPath
Definition: setupapi.h:782
USHORT SetId
Definition: setupapi.h:785
PCWSTR CabinetFile
Definition: setupapi.h:783
PCWSTR DiskName
Definition: setupapi.h:784
PCSTR Source
Definition: setupapi.h:748
DWORD Flags
Definition: setupapi.h:750
PCSTR Target
Definition: setupapi.h:747
UINT Win32Error
Definition: setupapi.h:749
ULONG Flags
Definition: fileqsup.h:63
UINT Win32Error
Definition: fileqsup.h:62
PCWSTR Source
Definition: fileqsup.h:61
PCWSTR Target
Definition: fileqsup.h:60
CHAR FullTargetName[MAX_PATH]
Definition: setupapi.h:795
WCHAR FullTargetName[MAX_PATH]
Definition: setupapi.h:804
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:269
HANDLE HINSTANCE
Definition: typedefs.h:77
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * PCWSTR
Definition: typedefs.h:57
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG
Definition: typedefs.h:59
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
#define WINAPI
Definition: msvc.h:6
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define ERROR_BAD_PATHNAME
Definition: winerror.h:233
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175