Don't crash if DeviceCapabilities(DC_PAPERNAMES) fails.
[wine] / dlls / setupapi / setupx16.h
1 #ifndef __SETUPX16_H
2 #define __SETUPX16_H
3
4 #include "wine/windef16.h"
5
6 typedef UINT16 HINF16;
7 typedef UINT16 LOGDISKID16;
8 typedef UINT16 VHSTR;
9
10 #define LINE_LEN        256
11
12 /* error codes stuff */
13
14 typedef UINT16 RETERR16;
15 #define OK              0
16 #define IP_ERROR        (UINT16)100
17 #define TP_ERROR        (UINT16)200
18 #define VCP_ERROR       (UINT16)300
19 #define GEN_ERROR       (UINT16)400
20 #define DI_ERROR        (UINT16)500
21
22 enum {
23         ERR_IP_INVALID_FILENAME = IP_ERROR+1,
24         ERR_IP_ALLOC_ERR,
25         ERR_IP_INVALID_SECT_NAME,
26         ERR_IP_OUT_OF_HANDLES,
27         ERR_IP_INF_NOT_FOUND,
28         ERR_IP_INVALID_INFFILE,
29         ERR_IP_INVALID_HINF,
30         ERR_IP_INVALID_FIELD,
31         ERR_IP_SECT_NOT_FOUND,
32         ERR_IP_END_OF_SECTION,
33         ERR_IP_PROFILE_NOT_FOUND,
34         ERR_IP_LINE_NOT_FOUND,
35         ERR_IP_FILEREAD,
36         ERR_IP_TOOMANYINFFILES,
37         ERR_IP_INVALID_SAVERESTORE,
38         ERR_IP_INVALID_INFTYPE
39 };
40
41 /****** virtual copy operations ******/
42
43 typedef DWORD LPEXPANDVTBL;
44
45 typedef struct {
46         DWORD           dwSoFar;
47         DWORD           dwTotal;
48 } VCPPROGRESS, *LPVCPPROGRESS;
49
50 typedef struct {
51         WORD            cbSize;
52         LOGDISKID16     ldid;
53         VHSTR           vhstrRoot;
54         VHSTR           vhstrVolumeLabel;
55         VHSTR           vhstrDiskName;
56         WORD            wVolumeTime;
57         WORD            wVolumeDate;
58         DWORD           dwSerialNumber;
59         WORD            fl;
60         LPARAM          lparamRef;
61
62         VCPPROGRESS     prgFileRead;
63         VCPPROGRESS     prgByteRead;
64
65         VCPPROGRESS     prgFileWrite;
66         VCPPROGRESS     prgByteWrite;
67 } VCPDISKINFO, *LPVCPDISKINFO;  
68
69 typedef struct {
70         LOGDISKID16     ldid;
71         VHSTR           vhstrDir;
72         VHSTR           vhstrFileName;
73 } VCPFILESPEC, *LPVCPFILESPEC;
74
75 typedef struct {
76         UINT16          uiMDate;
77         UINT16          uiMTime;
78         UINT16          uiADate;
79         UINT16          uiATime;
80         UINT16          uiAttr;
81         DWORD           llenIn;
82         DWORD           llenOut;
83 } VCPFATTR, *LPVCPFATTR;
84
85 typedef struct {
86         UINT16          uDate;
87         UINT16          uTime;
88         DWORD           dwSize;
89 } VCPFILESTAT, *LPVCPFILESTAT;
90
91 typedef struct
92 {
93         HFILE16         hFileSrc;
94         HFILE16         hFileDst;
95         VCPFATTR        fAttr;
96         WORD            dosError;
97         VHSTR           vhstrFileName;
98         WPARAM          vcpm;
99 } VIRTNODEEX, *LPVIRTNODEEX;
100
101 typedef struct {
102         WORD            cbSize;
103         VCPFILESPEC     vfsSrc;
104         VCPFILESPEC     vfsDst;
105         WORD            fl;
106         LPARAM          lParam;
107         LPEXPANDVTBL    lpExpandVtbl;
108         LPVIRTNODEEX    lpvnex;
109         VHSTR           vhstrDstFinalName;
110         VCPFILESTAT     vFileStat;
111 } VIRTNODE, *LPVIRTNODE;
112
113 typedef struct {
114         WORD            cbSize;
115         VCPPROGRESS     prgDiskRead;
116         VCPPROGRESS     prgFileRead;
117         VCPPROGRESS     prgByteRead;
118
119         VCPPROGRESS     prgDiskWrite;
120         VCPPROGRESS     prgFileWrite;
121         VCPPROGRESS     prgByteWrite;
122
123         LPVCPDISKINFO   lpvdiIn;
124         LPVCPDISKINFO   lpvdiOut;
125         LPVIRTNODE      lpvn;
126 } VCPSTATUS, *LPVCPSTATUS;
127
128 #define CNFL_BACKUP             0x0001
129 #define CNFL_DELETEONFAILURE    0x0002
130 #define CNFL_RENAMEONSUCCESS    0x0004
131 #define CNFL_CONTINUATION       0x0008
132 #define CNFL_SKIPPED            0x0010
133 #define CNFL_IGNOREERRORS       0x0020
134 #define CNFL_RETRYFILE          0x0040
135 #define CNFL_COPIED             0x0080
136 #define VNFL_UNIQUE             0x0000
137 #define VNFL_MULTIPLEOK         0x0100
138 #define VNFL_DESTROYOLD         0x0200
139 #define VNFL_COPY               0x0000
140 #define VNFL_DELETE             0x0800
141 #define VNFL_RENAME             0x1000
142 #define VNFL_NODE_TYPE          (VNFL_RENAME|VNFL_DELETE|VNFL_COPY)
143 #define VNFL_CREATED            0x2000
144 #define VNFL_REJECTED           0x4000
145 #define VNFL_DEVICEINSTALLER    0x8000
146
147 enum {
148         ERR_VCP_IOFAIL = VCP_ERROR+1,
149         ERR_VCP_STRINGTOOLONG,
150         ERR_VCP_NOMEM,
151         ERR_VCP_QUEUEFULL,
152         ERR_VCP_NOVHSTR,
153         ERR_VCP_OVERFLOW,
154         ERR_VCP_BADARG,
155         ERR_VCP_UNINIT,
156         ERR_VCP_NOTFOUND,
157         ERR_VCP_BUSY,
158         ERR_VCP_INTERRUPTED,
159         ERR_VCP_BADDEST,
160         ERR_VCP_SKIPPED,
161         ERR_VCP_IO,
162         ERR_VCP_LOCKED,
163         ERR_VCP_WRONGDISK,
164         ERR_VCP_CHANGEMODE,
165         ERR_VCP_LDDINVALID,
166         ERR_VCP_LDDFIND,
167         ERR_VCP_LDDUNINIT,
168         ERR_VCP_LDDPATH_INVALID,
169         ERR_VCP_NOEXPANSION,
170         ERR_VCP_NOTOPEN,
171         ERR_VCP_NO_DIGITAL_SIGNATURE_CATALOG,
172         ERR_VCP_NO_DIGITAL_SIGNATURE_FILE
173 };
174
175 #define VCPN_OK         0
176 #define VCPN_PROCEED    0
177 #define VCPN_ABORT      -1
178 #define VCPN_RETRY      -2
179 #define VCPN_IGNORE     -3
180 #define VCPN_SKIP       -4
181 #define VCPN_FORCE      -5
182 #define VCPN_DEFER      -6
183 #define VCPN_FAIL       -7
184 #define VCPN_RETRYFILE  -8
185
186 #define VCPFL_ABANDON           0x00
187 #define VCPFL_BACKUP            0x01
188 #define VCPFL_COPY              0x02
189 #define VCPFL_BACKUPANDCOPY     (VCPFL_BACKUP|VCPFL_COPY)
190 #define VCPFL_INSPECIFIEDORDER  0x04
191 #define VCPFL_DELETE            0x08
192 #define VCPFL_RENAME            0x10
193 #define VCPFL_ALL               (VCPFL_COPY|VCPFL_DELETE|VCPFL_RENAME)
194
195 #define CFNL_BACKUP             0x0001
196 #define CFNL_DELETEONFAILURE    0x0002
197 #define CFNL_RENAMEONSUCCESS    0x0004
198 #define CFNL_CONTINUATION       0x0008
199 #define CFNL_SKIPPED            0x0010
200 #define CFNL_IGNOREERRORS       0x0020
201 #define CFNL_RETRYFILE          0x0040
202 #define CFNL_COPIED             0x0080
203 #define VFNL_MULTIPLEOK         0x0100
204 #define VFNL_DESTROYOLD         0x0200
205 #define VFNL_NOW                0x0400
206 #define VFNL_COPY               0x0000
207 #define VFNL_DELETE             0x0800
208 #define VFNL_RENAME             0x1000
209 #define VFNL_CREATED            0x2000
210 #define VFNL_REJECTED           0x4000
211 #define VCPM_DISKCLASS          0x01
212 #define VCPM_DISKFIRST          0x0100
213 #define VCPM_DISKLAST           0x01ff
214
215 enum {
216         VCPM_DISKCREATEINFO = VCPM_DISKFIRST,
217         VCPM_DISKGETINFO,
218         VCPM_DISKDESTROYINFO,
219         VCPM_DISKPREPINFO,
220         VCPM_DISKENSURE,
221         VCPM_DISKPROMPT,
222         VCPM_DISKFORMATBEGIN,
223         VCPM_DISKFORMATTING,
224         VCPM_DISKFORMATEND
225 };
226
227 #define VCPM_FILEINCLASS        0x02
228 #define VCPM_FILEOUTCLASS       0x03
229 #define VCPM_FILEFIRSTIN        0x0200
230 #define VCPM_FILEFIRSTOUT       0x0300
231 #define VCPM_FILELAST           0x03ff
232
233 enum {
234         VCPM_FILEOPENIN = VCPM_FILEFIRSTIN,
235         VCPM_FILEGETFATTR,
236         VCPM_FILECLOSEIN,
237         VCPM_FILECOPY,
238         VCPM_FILENEEDED,
239
240         VCPM_FILEOPENOUT = VCPM_FILEFIRSTOUT,
241         VCPM_FILESETFATTR,
242         VCPM_FILECLOSEOUT,
243         VCPM_FILEFINALIZE,
244         VCPM_FILEDELETE,
245         VCPM_FILERENAME
246 };
247
248 #define VCPM_NODECLASS          0x04
249 #define VCPM_NODEFIRST          0x0400
250 #define VCPM_NODELAST           0x04ff
251
252 enum {
253         VCPM_NODECREATE = VCPM_NODEFIRST,
254         VCPM_NODEACCEPT,
255         VCPM_NODEREJECT,
256         VCPM_NODEDESTROY,
257         VCPM_NODECHANGEDESTDIR,
258         VCPM_NODECOMPARE
259 };
260
261 #define VCPM_TALLYCLASS         0x05
262 #define VCPM_TALLYFIRST         0x0500
263 #define VCPM_TALLYLAST          0x05ff
264
265 enum {
266         VCPM_TALLYSTART = VCPM_TALLYFIRST,
267         VCPM_TALLYEND,
268         VCPM_TALLYFILE,
269         VCPM_TALLYDISK
270 };
271
272 #define VCPM_VERCLASS           0x06
273 #define VCPM_VERFIRST           0x0600
274 #define VCPM_VERLAST            0x06ff
275
276 enum {
277         VCPM_VERCHECK = VCPM_VERFIRST,
278         VCPM_VERCHECKDONE,
279         VCPM_VERRESOLVECONFLICT
280 };
281
282 #define VCPM_VSTATCLASS         0x07
283 #define VCPM_VSTATFIRST         0x0700
284 #define VCPM_VSTATLAST          0x07ff
285
286 enum {
287         VCPM_VSTATSTART = VCPM_VSTATFIRST,
288         VCPM_VSTATEND,
289         VCPM_VSTATREAD,
290         VCPM_VSTATWRITE,
291         VCPM_VSTATNEWDISK,
292         VCPM_VSTATCLOSESTART,
293         VCPM_VSTATCLOSEEND,
294         VCPM_VSTATBACKUPSTART,
295         VCPM_VSTATBACKUPEND,
296         VCPM_VSTATRENAMESTART,
297         VCPM_VSTATRENAMEEND,
298         VCPM_VSTATCOPYSTART,
299         VCPM_VSTATCOPYEND,
300         VCPM_VSTATDELETESTART,
301         VCPM_VSTATDELETEEND,
302         VCPM_VSTATPATHCHECKSTART,
303         VCPM_VSTATPATHCHECKEND,
304         VCPM_VSTATCERTIFYSTART,
305         VCPM_VSTATCERTIFYEND,
306         VCPM_VSTATUSERABORT,
307         VCPM_VSTATYIELD
308 };
309
310 #define VCPM_PATHCLASS          0x08
311 #define VCPM_PATHFIRST          0x0800
312 #define VCPM_PATHLAST           0x08ff
313
314 enum {
315         VCPM_BUILDPATH = VCPM_PATHFIRST,
316         VCPM_UNIQUEPATH,
317         VCPM_CHECKPATH
318 };
319
320 #define VCPM_PATCHCLASS         0x09
321 #define VCPM_PATCHFIRST         0x0900
322 #define VCPM_PATCHLAST          0x09ff
323
324 enum {
325         VCPM_FILEPATCHBEFORECPY = VCPM_PATCHFIRST,
326         VCPM_FILEPATCHAFTERCPY,
327         VCPM_FILEPATCHINFOPEN,
328         VCPM_FILEPATCHINFCLOSE
329 };
330
331 #define VCPM_CERTCLASS          0x0a
332 #define VCPM_CERTFIRST          0x0a00
333 #define VCPM_CERTLAST           0x0aff
334
335 enum {
336         VCPM_FILECERTIFY = VCPM_CERTFIRST,
337         VCPM_FILECERTIFYWARN
338 };
339
340 typedef LRESULT CALLBACK (*VIFPROC)(LPVOID lpvObj, UINT16 uMsg, WPARAM wParam, LPARAM lParam, LPARAM lparamRef);
341
342 typedef int CALLBACK (*VCPENUMPROC)(LPVIRTNODE lpvn, LPARAM lparamRef);
343
344 RETERR16 WINAPI VcpOpen16(VIFPROC vifproc, LPARAM lparamMsgRef);
345 RETERR16 WINAPI VcpQueueCopy16(
346         LPCSTR lpszSrcFileName, LPCSTR lpszDstFileName,
347         LPCSTR lpszSrcDir, LPCSTR lpszDstDir,
348         LOGDISKID16 ldidSrc, LOGDISKID16 ldidDst,
349         LPEXPANDVTBL lpExpandVtbl,
350         WORD fl, LPARAM lParam
351 );
352 RETERR16 VcpFlush16(WORD fl, LPCSTR lpszBackupDest);
353 RETERR16 WINAPI VcpClose16(WORD fl, LPCSTR lpszBackupDest);
354
355 /* VcpExplain flags */
356 enum {
357         VCPEX_SRC_DISK,
358         VCPEX_SRC_CABINET,
359         VCPEX_SRC_LOCN,
360         VCPEX_DST_LOCN,
361         VCPEX_SRC_FILE,
362         VCPEX_DST_FILE,
363         VCPEX_DST_FILE_FINAL,
364         VCPEX_DOS_ERROR,
365         VCPEX_MESSAGE,
366         VCPEX_DOS_SOLUTION,
367         VCPEX_SRC_FULL,
368         VCPEX_DST_FULL,
369         VCPEX_DST_FULL_FINAL
370 };
371
372 LPCSTR WINAPI VcpExplain16(LPVIRTNODE lpVn, DWORD dwWhat);
373
374 /****** logical disk management ******/
375
376 typedef struct _LOGDISKDESC_S { /* ldd */
377         WORD        cbSize;       /* struct size */
378         LOGDISKID16 ldid;         /* logical disk ID */
379         LPSTR       pszPath;      /* path this descriptor points to */
380         LPSTR       pszVolLabel;  /* volume label of the disk related to it */
381         LPSTR       pszDiskName;  /* name of this disk */
382         WORD        wVolTime;     /* modification time of volume label */
383         WORD        wVolDate;     /* modification date */
384         DWORD       dwSerNum;     /* serial number of disk */
385         WORD        wFlags;
386 } LOGDISKDESC_S, *LPLOGDISKDESC;
387
388 /** logical disk identifiers (LDID) **/
389
390 /* predefined LDIDs */
391 #define LDID_PREDEF_START       0x0001
392 #define LDID_PREDEF_END         0x7fff
393
394 /* registry-assigned LDIDs */
395 #define LDID_VAR_START          0x7000
396 #define LDID_VAR_END            0x7fff
397
398 /* dynamically assigned LDIDs */
399 #define LDID_ASSIGN_START       0x8000
400 #define LDID_ASSIGN_END         0xbfff
401
402 #define LDID_NULL               0
403 #define LDID_ABSOLUTE           ((UINT)-1)
404 #define LDID_SRCPATH            1               /* setup source path */
405 #define LDID_SETUPTEMP          2               /* setup temp dir */
406 #define LDID_UNINSTALL          3               /* uninstall dir */
407 #define LDID_BACKUP             4               /* backup dir */
408 #define LDID_SETUPSCRATCH       5               /* setup scratch dir */
409 #define LDID_WIN                10              /* win dir */
410 #define LDID_SYS                11              /* win system dir */
411 #define LDID_IOS                12              /* win Iosubsys dir */
412 #define LDID_CMD                13              /* win command dir */
413 #define LDID_CPL                14              /* win control panel dir */
414 #define LDID_PRINT              15              /* win printer dir */
415 #define LDID_MAIL               16              /* win mail dir */
416 #define LDID_INF                17              /* win inf dir */
417 #define LDID_HELP               18              /* win help dir */
418 #define LDID_WINADMIN           19              /* admin dir */
419 #define LDID_FONTS              20              /* win fonts dir */
420 #define LDID_VIEWERS            21              /* win viewers dir */
421 #define LDID_VMM32              22              /* win VMM32 dir */
422 #define LDID_COLOR              23              /* win color mngment dir */
423 #define LDID_APPS               24              /* win apps dir */
424 #define LDID_SHARED             25              /* win shared dir */
425 #define LDID_WINBOOT            26              /* guaranteed win boot drive */
426 #define LDID_MACHINE            27              /* machine specific files */
427 #define LDID_HOST_WINBOOT       28
428 #define LDID_BOOT               30              /* boot drive root dir */
429 #define LDID_BOOT_HOST          31              /* boot drive host root dir */
430 #define LDID_OLD_WINBOOT        32              /* root subdir */
431 #define LDID_OLD_WIN            33              /* old windows dir */
432
433 /* flags for GenInstall() */
434 #define GENINSTALL_DO_FILES             1
435 #define GENINSTALL_DO_INI               2
436 #define GENINSTALL_DO_REG               4
437 #define GENINSTALL_DO_INI2REG           8
438 #define GENINSTALL_DO_CFGAUTO           16
439 #define GENINSTALL_DO_LOGCONFIG         32
440 #define GENINSTALL_DO_REGSRCPATH        64
441 #define GENINSTALL_DO_PERUSER           128
442
443 #define GEINISTALL_DO_INIREG            14
444 #define GENINSTALL_DO_ALL               255
445
446 /*
447  * flags for InstallHinfSection()
448  * 128 can be added, too. This means that the .inf file is provided by you
449  * instead of being a 32 bit file (i.e. Windows .inf file).
450  * In this case all files you install must be in the same dir
451  * as your .inf file on the install disk.
452  */
453 #define HOW_NEVER_REBOOT                0
454 #define HOW_ALWAYS_SILENT_REBOOT        1
455 #define HOW_ALWAYS_PROMPT_REBOOT        2
456 #define HOW_SILENT_REBOOT               3
457 #define HOW_PROMPT_REBOOT               4
458
459 /****** device installation stuff ******/
460
461 #define MAX_CLASS_NAME_LEN      32
462 #define MAX_DEVNODE_ID_LEN      256
463 #define MAX_GUID_STR            50
464
465 typedef struct _DEVICE_INFO
466 {
467         UINT16              cbSize;
468         struct _DEVICE_INFO *lpNextDi;
469         char                szDescription[LINE_LEN];
470         DWORD               dnDevnode;
471         HKEY                hRegKey;
472         char                szRegSubkey[MAX_DEVNODE_ID_LEN];
473         char                szClassName[MAX_CLASS_NAME_LEN];
474         DWORD               Flags;
475         HWND16              hwndParent;
476         /*LPDRIVER_NODE*/ LPVOID      lpCompatDrvList;
477         /*LPDRIVER_NODE*/ LPVOID      lpClassDrvList;
478         /*LPDRIVER_NODE*/ LPVOID      lpSelectedDriver;
479         ATOM                atDriverPath;
480         ATOM                atTempInfFile;
481         HINSTANCE16         hinstClassInstaller;
482         HINSTANCE16         hinstClassPropProvidor;
483         HINSTANCE16         hinstDevicePropProvidor;
484         HINSTANCE16         hinstBasicPropProvidor;
485         FARPROC16           fpClassInstaller;
486         FARPROC16           fpClassEnumPropPages;
487         FARPROC16           fpDeviceEnumPropPages;
488         FARPROC16           fpEnumBasicProperties;
489         DWORD               dwSetupReserved;
490         DWORD               dwClassInstallReserved;
491         /*GENCALLBACKPROC*/ LPVOID     gicpGenInstallCallBack;
492
493         LPARAM              gicplParam;
494         UINT16              InfType;
495
496         HINSTANCE16         hinstPrivateProblemHandler;
497         FARPROC16           fpPrivateProblemHandler;
498         LPARAM              lpClassInstallParams;
499         struct _DEVICE_INFO *lpdiChildList;
500         DWORD               dwFlagsEx;
501         /*LPDRIVER_INFO*/ LPVOID       lpCompatDrvInfoList;
502         /*LPDRIVER_INFO*/ LPVOID      lpClassDrvInfoList;
503         char                szClassGUID[MAX_GUID_STR];
504 } DEVICE_INFO16, *LPDEVICE_INFO16, **LPLPDEVICE_INFO16;
505
506
507 extern void WINAPI GenFormStrWithoutPlaceHolders16(LPSTR,LPCSTR,HINF16);
508 extern RETERR16 WINAPI IpOpen16(LPCSTR,HINF16 *);
509 extern RETERR16 WINAPI IpClose16(HINF16);
510 extern RETERR16 WINAPI CtlSetLdd16(LPLOGDISKDESC);
511 extern RETERR16 WINAPI CtlGetLdd16(LPLOGDISKDESC);
512 extern RETERR16 WINAPI CtlFindLdd16(LPLOGDISKDESC);
513 extern RETERR16 WINAPI CtlAddLdd16(LPLOGDISKDESC);
514 extern RETERR16 WINAPI CtlDelLdd16(LOGDISKID16);
515 extern RETERR16 WINAPI CtlGetLddPath16(LOGDISKID16 ldid, LPSTR szPath);
516 extern RETERR16 WINAPI GenInstall16(HINF16,LPCSTR,WORD);
517
518 #endif /* __SETUPX16_H */