setupx patch

Andreas Mohr a.mohr at mailto.de
Mon Apr 16 16:13:55 CDT 2001


Hi all,

this is a somewhat bigger SETUPX patch now.
Note that even this one doesn't really do a lot.
It's just a lot of infrastructure, but no real action.
I just want to get rid of it for now, before it gets too rotten ;-)

Overview of this patch:
- implement some more virtcopy (VCP) stuff
- add some setupx resources
- implement VHSTR functionality
- large parts of VCP callback handling
- merge setupapi and setupx stuff, especially resource handling
  gets rid of setupx debug channel; setupapi is the only one that remains

Removed files:
dlls/setupapi/setupx_private.h (in favour of setupapi_private.h)

New files:

dlls/setupapi/setupapi_private.h
dlls/setupapi/virtcopy.c
dlls/setupapi/setupapi.rc

diff:
dlls/setupapi/Makefile.in
dlls/setupapi/infparse.c
dlls/setupapi/setupapi.spec
dlls/setupapi/setupx.spec
dlls/setupapi/setupx16.h
dlls/setupapi/setupx_main.c

Andreas Mohr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setupx.tgz
Type: application/x-gtar
Size: 6758 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20010416/1f168643/setupx.tgz
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: dlls/setupapi/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/setupapi/Makefile.in,v
retrieving revision 1.9
diff -u -r1.9 Makefile.in
--- dlls/setupapi/Makefile.in	2000/12/13 21:31:37	1.9
+++ dlls/setupapi/Makefile.in	2001/04/16 21:00:55
@@ -13,7 +13,14 @@
 	devinst.c \
 	infparse.c \
 	setupx_main.c \
-	stubs.c
+	stubs.c \
+	virtcopy.c
+
+GLUE = \
+	virtcopy.c
+
+RC_SRCS= \
+	setupapi.rc
 
 @MAKE_DLL_RULES@
 
Index: dlls/setupapi/infparse.c
===================================================================
RCS file: /home/wine/wine/dlls/setupapi/infparse.c,v
retrieving revision 1.6
diff -u -r1.6 infparse.c
--- dlls/setupapi/infparse.c	2001/01/26 20:43:44	1.6
+++ dlls/setupapi/infparse.c	2001/04/16 21:00:55
@@ -16,9 +16,9 @@
 #include "heap.h"
 #include "wine/winbase16.h"
 #include "setupx16.h"
-#include "setupx_private.h"
+#include "setupapi_private.h"
 
-DEFAULT_DEBUG_CHANNEL(setupx);
+DEFAULT_DEBUG_CHANNEL(setupapi);
 
 WORD InfNumEntries = 0;
 INF_FILE *InfList = NULL;
Index: dlls/setupapi/setupapi.spec
===================================================================
RCS file: /home/wine/wine/dlls/setupapi/setupapi.spec,v
retrieving revision 1.7
diff -u -r1.7 setupapi.spec
--- dlls/setupapi/setupapi.spec	2001/01/17 20:17:46	1.7
+++ dlls/setupapi/setupapi.spec	2001/04/16 21:00:57
@@ -1,11 +1,13 @@
 name setupapi
 type win32
+rsrc setupapi.res
 
 import advapi32.dll
 import kernel32.dll
 import ntdll.dll
+import user32.dll
 
-debug_channels (setupapi setupx)
+debug_channels (setupapi)
 
 # almost all functions are commented out for now. Ordinals are from setupapi.dll 4.0
 
Index: dlls/setupapi/setupx.spec
===================================================================
RCS file: /home/wine/wine/dlls/setupapi/setupx.spec,v
retrieving revision 1.5
diff -u -r1.5 setupx.spec
--- dlls/setupapi/setupx.spec	2000/12/16 20:16:33	1.5
+++ dlls/setupapi/setupx.spec	2001/04/16 21:00:57
@@ -14,11 +14,11 @@
 10   stub     IpGetIntField #(word ptr word ptr)
 11   stub     IpFindNextLine #(word ptr)
 12   stub     IpGetFileName #(word ptr word)
-13   stub     VcpQueueCopy #(str str str str word word ptr word long)
+13   pascal16 VcpQueueCopy(str str str str word word ptr word long) VcpQueueCopy16
 14   stub     NOAUTORUNWNDPROC
 15   stub     __DEBUGMSG
 16   stub     __ASSERTMSG
-17   stub     VcpQueueDelete #(str str word long)
+17   pascal16 VcpQueueDelete(str str word long) VcpQueueDelete16
 18   stub     TpOpenFile #(str ptr word)
 19   stub     TpCloseFile #(word)
 20   stub     TpOpenSection #(word ptr str word)
@@ -62,6 +62,7 @@
 61   stub     suErrorToIds #(word word)
 62   stub     TPWriteProfileString #(str str str)
 63   stub     SURPLSETUP
+# does SUSTORELDIDPATH set the path of an LDID in the registry ?
 64   stub     SUSTORELDIDPATH
 65   stub     WILDCARDSTRCMPI
 101  pascal16 GenInstall(word str word) GenInstall16
@@ -122,20 +123,20 @@
 160  stub     SXUPDATEDS
 170  stub     SUSETMEM
 171  stub     WriteDMFBootData #(word ptr word)
-200  pascal   VcpOpen(ptr str) VcpOpen16
+200  pascal   VcpOpen(segptr ptr) VcpOpen16
 201  pascal   VcpClose(word str) VcpClose16
-202  stub     vcpDefCallbackProc #(ptr word word long long)
+202  pascal16 vcpDefCallbackProc(ptr word word long long) vcpDefCallbackProc16
 203  stub     vcpEnumFiles #(ptr long)
-204  stub     VcpQueueRename #(str str str str word word long)
-205  stub     vsmGetStringName #(word ptr word)
-206  stub     vsmStringDelete #(word)
-207  stub     vsmStringAdd #(str)
-208  stub     vsmGetStringRawName #(word)
+204  pascal16 VcpQueueRename(str str str str word word long) VcpQueueRename16
+205  pascal16 vsmGetStringName(word ptr word) vsmGetStringName16
+206  pascal16 vsmStringDelete(word) vsmStringDelete16
+207  pascal16 vsmStringAdd(str) vsmStringAdd16
+208  pascal   vsmGetStringRawName(word) vsmGetStringRawName16
 209  stub     IpSaveRestorePosition #(word word)
 210  pascal16 IpGetProfileString(word str str ptr word) IpGetProfileString16
 211  stub     IpOpenEx #(str ptr word)
 212  stub     IpOpenAppendEx #(str word word)
-213  stub     vcpUICallbackProc #(ptr word word long long)
+213  pascal16 vcpUICallbackProc(ptr word word long long) vcpUICallbackProc16
 214  stub     VcpAddMRUPath #(str)
 300  stub     DiBuildCompatDrvList #(ptr)
 301  stub     DiBuildClassDrvList #(ptr)
Index: dlls/setupapi/setupx16.h
===================================================================
RCS file: /home/wine/wine/dlls/setupapi/setupx16.h,v
retrieving revision 1.6
diff -u -r1.6 setupx16.h
--- dlls/setupapi/setupx16.h	2001/02/12 03:51:04	1.6
+++ dlls/setupapi/setupx16.h	2001/04/16 21:00:58
@@ -5,6 +5,7 @@
 
 typedef UINT16 HINF16;
 typedef UINT16 LOGDISKID16;
+typedef UINT16 VHSTR;
 
 #define LINE_LEN	256
 
@@ -18,7 +19,7 @@
 #define GEN_ERROR	(UINT16)400
 #define DI_ERROR	(UINT16)500
 
-enum _IP_ERR {
+enum {
 	ERR_IP_INVALID_FILENAME = IP_ERROR+1,
 	ERR_IP_ALLOC_ERR,
 	ERR_IP_INVALID_SECT_NAME,
@@ -37,7 +38,113 @@
 	ERR_IP_INVALID_INFTYPE
 };
 
-enum _ERR_VCP {
+/****** virtual copy operations ******/
+
+typedef DWORD LPEXPANDVTBL;
+
+typedef struct {
+	DWORD		dwSoFar;
+	DWORD		dwTotal;
+} VCPPROGRESS, *LPVCPPROGRESS;
+
+typedef struct {
+	WORD		cbSize;
+	LOGDISKID16	ldid;
+	VHSTR		vhstrRoot;
+	VHSTR		vhstrVolumeLabel;
+	VHSTR		vhstrDiskName;
+	WORD		wVolumeTime;
+	WORD		wVolumeDate;
+	DWORD		dwSerialNumber;
+	WORD		fl;
+	LPARAM		lparamRef;
+
+	VCPPROGRESS	prgFileRead;
+	VCPPROGRESS	prgByteRead;
+
+	VCPPROGRESS	prgFileWrite;
+	VCPPROGRESS	prgByteWrite;
+} VCPDISKINFO, *LPVCPDISKINFO;	
+
+typedef struct {
+	LOGDISKID16	ldid;
+	VHSTR		vhstrDir;
+	VHSTR		vhstrFileName;
+} VCPFILESPEC, *LPVCPFILESPEC;
+
+typedef struct {
+	UINT16		uiMDate;
+	UINT16		uiMTime;
+	UINT16		uiADate;
+	UINT16		uiATime;
+	UINT16		uiAttr;
+	DWORD		llenIn;
+	DWORD		llenOut;
+} VCPFATTR, *LPVCPFATTR;
+
+typedef struct {
+	UINT16		uDate;
+	UINT16		uTime;
+	DWORD		dwSize;
+} VCPFILESTAT, *LPVCPFILESTAT;
+
+typedef struct
+{
+	HFILE16		hFileSrc;
+	HFILE16		hFileDst;
+	VCPFATTR	fAttr;
+	WORD		dosError;
+	VHSTR		vhstrFileName;
+	WPARAM		vcpm;
+} VIRTNODEEX, *LPVIRTNODEEX;
+
+typedef struct {
+	WORD		cbSize;
+	VCPFILESPEC	vfsSrc;
+	VCPFILESPEC	vfsDst;
+	WORD		fl;
+	LPARAM		lParam;
+	LPEXPANDVTBL	lpExpandVtbl;
+	LPVIRTNODEEX	lpvnex;
+	VHSTR		vhstrDstFinalName;
+	VCPFILESTAT	vFileStat;
+} VIRTNODE, *LPVIRTNODE;
+
+typedef struct {
+	WORD		cbSize;
+	VCPPROGRESS	prgDiskRead;
+	VCPPROGRESS	prgFileRead;
+	VCPPROGRESS	prgByteRead;
+
+	VCPPROGRESS	prgDiskWrite;
+	VCPPROGRESS	prgFileWrite;
+	VCPPROGRESS	prgByteWrite;
+
+	LPVCPDISKINFO	lpvdiIn;
+	LPVCPDISKINFO	lpvdiOut;
+	LPVIRTNODE	lpvn;
+} VCPSTATUS, *LPVCPSTATUS;
+
+#define CNFL_BACKUP		0x0001
+#define CNFL_DELETEONFAILURE	0x0002
+#define CNFL_RENAMEONSUCCESS	0x0004
+#define CNFL_CONTINUATION	0x0008
+#define CNFL_SKIPPED		0x0010
+#define CNFL_IGNOREERRORS	0x0020
+#define CNFL_RETRYFILE		0x0040
+#define CNFL_COPIED		0x0080
+#define VNFL_UNIQUE		0x0000
+#define VNFL_MULTIPLEOK		0x0100
+#define VNFL_DESTROYOLD		0x0200
+#define VNFL_COPY		0x0000
+#define VNFL_DELETE		0x0800
+#define VNFL_RENAME		0x1000
+#define VNFL_NODE_TYPE		(VNFL_RENAME|VNFL_DELETE|VNFL_COPY)
+#define VNFL_CREATED		0x2000
+#define VNFL_REJECTED		0x4000
+#define VNFL_DEVICEINSTALLER	0x8000
+
+enum {
 	ERR_VCP_IOFAIL = VCP_ERROR+1,
 	ERR_VCP_STRINGTOOLONG,
 	ERR_VCP_NOMEM,
@@ -65,6 +172,205 @@
 	ERR_VCP_NO_DIGITAL_SIGNATURE_FILE
 };
 
+#define VCPN_OK		0
+#define VCPN_PROCEED	0
+#define VCPN_ABORT	-1
+#define VCPN_RETRY	-2
+#define VCPN_IGNORE	-3
+#define VCPN_SKIP	-4
+#define VCPN_FORCE	-5
+#define VCPN_DEFER	-6
+#define VCPN_FAIL	-7
+#define VCPN_RETRYFILE	-8
+
+#define VCPFL_ABANDON		0x00
+#define VCPFL_BACKUP		0x01
+#define VCPFL_COPY		0x02
+#define VCPFL_BACKUPANDCOPY	(VCPFL_BACKUP|VCPFL_COPY)
+#define VCPFL_INSPECIFIEDORDER	0x04
+#define VCPFL_DELETE		0x08
+#define VCPFL_RENAME		0x10
+#define VCPFL_ALL		(VCPFL_COPY|VCPFL_DELETE|VCPFL_RENAME)
+
+#define CFNL_BACKUP		0x0001
+#define CFNL_DELETEONFAILURE	0x0002
+#define CFNL_RENAMEONSUCCESS	0x0004
+#define CFNL_CONTINUATION	0x0008
+#define CFNL_SKIPPED		0x0010
+#define CFNL_IGNOREERRORS	0x0020
+#define CFNL_RETRYFILE		0x0040
+#define CFNL_COPIED		0x0080
+#define VFNL_MULTIPLEOK		0x0100
+#define VFNL_DESTROYOLD		0x0200
+#define VFNL_NOW		0x0400
+#define VFNL_COPY		0x0000
+#define VFNL_DELETE		0x0800
+#define VFNL_RENAME		0x1000
+#define VFNL_CREATED		0x2000
+#define VFNL_REJECTED		0x4000
+#define VCPM_DISKCLASS		0x01
+#define VCPM_DISKFIRST		0x0100
+#define VCPM_DISKLAST		0x01ff
+
+enum {
+	VCPM_DISKCREATEINFO = VCPM_DISKFIRST,
+	VCPM_DISKGETINFO,
+	VCPM_DISKDESTROYINFO,
+	VCPM_DISKPREPINFO,
+	VCPM_DISKENSURE,
+	VCPM_DISKPROMPT,
+	VCPM_DISKFORMATBEGIN,
+	VCPM_DISKFORMATTING,
+	VCPM_DISKFORMATEND
+};
+
+#define VCPM_FILEINCLASS	0x02
+#define VCPM_FILEOUTCLASS	0x03
+#define VCPM_FILEFIRSTIN	0x0200
+#define VCPM_FILEFIRSTOUT	0x0300
+#define VCPM_FILELAST		0x03ff
+
+enum {
+	VCPM_FILEOPENIN = VCPM_FILEFIRSTIN,
+	VCPM_FILEGETFATTR,
+	VCPM_FILECLOSEIN,
+	VCPM_FILECOPY,
+	VCPM_FILENEEDED,
+
+	VCPM_FILEOPENOUT = VCPM_FILEFIRSTOUT,
+	VCPM_FILESETFATTR,
+	VCPM_FILECLOSEOUT,
+	VCPM_FILEFINALIZE,
+	VCPM_FILEDELETE,
+	VCPM_FILERENAME
+};
+
+#define VCPM_NODECLASS		0x04
+#define VCPM_NODEFIRST		0x0400
+#define VCPM_NODELAST		0x04ff
+
+enum {
+	VCPM_NODECREATE = VCPM_NODEFIRST,
+	VCPM_NODEACCEPT,
+	VCPM_NODEREJECT,
+	VCPM_NODEDESTROY,
+	VCPM_NODECHANGEDESTDIR,
+	VCPM_NODECOMPARE
+};
+
+#define VCPM_TALLYCLASS		0x05
+#define VCPM_TALLYFIRST		0x0500
+#define VCPM_TALLYLAST		0x05ff
+
+enum {
+	VCPM_TALLYSTART = VCPM_TALLYFIRST,
+	VCPM_TALLYEND,
+	VCPM_TALLYFILE,
+	VCPM_TALLYDISK
+};
+
+#define VCPM_VERCLASS		0x06
+#define VCPM_VERFIRST		0x0600
+#define VCPM_VERLAST		0x06ff
+
+enum {
+	VCPM_VERCHECK = VCPM_VERFIRST,
+	VCPM_VERCHECKDONE,
+	VCPM_VERRESOLVECONFLICT
+};
+
+#define VCPM_VSTATCLASS		0x07
+#define VCPM_VSTATFIRST		0x0700
+#define VCPM_VSTATLAST		0x07ff
+
+enum {
+	VCPM_VSTATSTART = VCPM_VSTATFIRST,
+	VCPM_VSTATEND,
+	VCPM_VSTATREAD,
+	VCPM_VSTATWRITE,
+	VCPM_VSTATNEWDISK,
+	VCPM_VSTATCLOSESTART,
+	VCPM_VSTATCLOSEEND,
+	VCPM_VSTATBACKUPSTART,
+	VCPM_VSTATBACKUPEND,
+	VCPM_VSTATRENAMESTART,
+	VCPM_VSTATRENAMEEND,
+	VCPM_VSTATCOPYSTART,
+	VCPM_VSTATCOPYEND,
+	VCPM_VSTATDELETESTART,
+	VCPM_VSTATDELETEEND,
+	VCPM_VSTATPATHCHECKSTART,
+	VCPM_VSTATPATHCHECKEND,
+	VCPM_VSTATCERTIFYSTART,
+	VCPM_VSTATCERTIFYEND,
+	VCPM_VSTATUSERABORT,
+	VCPM_VSTATYIELD
+};
+
+#define VCPM_PATHCLASS		0x08
+#define VCPM_PATHFIRST		0x0800
+#define VCPM_PATHLAST		0x08ff
+
+enum {
+	VCPM_BUILDPATH = VCPM_PATHFIRST,
+	VCPM_UNIQUEPATH,
+	VCPM_CHECKPATH
+};
+
+#define VCPM_PATCHCLASS		0x09
+#define VCPM_PATCHFIRST		0x0900
+#define VCPM_PATCHLAST		0x09ff
+
+enum {
+	VCPM_FILEPATCHBEFORECPY = VCPM_PATCHFIRST,
+	VCPM_FILEPATCHAFTERCPY,
+	VCPM_FILEPATCHINFOPEN,
+	VCPM_FILEPATCHINFCLOSE
+};
+
+#define VCPM_CERTCLASS		0x0a
+#define VCPM_CERTFIRST		0x0a00
+#define VCPM_CERTLAST		0x0aff
+
+enum {
+	VCPM_FILECERTIFY = VCPM_CERTFIRST,
+	VCPM_FILECERTIFYWARN
+};
+
+typedef LRESULT CALLBACK (*VIFPROC)(LPVOID lpvObj, UINT16 uMsg, WPARAM wParam, LPARAM lParam, LPARAM lparamRef);
+
+typedef int CALLBACK (*VCPENUMPROC)(LPVIRTNODE lpvn, LPARAM lparamRef);
+
+RETERR16 WINAPI VcpOpen16(VIFPROC vifproc, LPARAM lparamMsgRef);
+RETERR16 WINAPI VcpQueueCopy16(
+	LPCSTR lpszSrcFileName, LPCSTR lpszDstFileName,
+	LPCSTR lpszSrcDir, LPCSTR lpszDstDir,
+	LOGDISKID16 ldidSrc, LOGDISKID16 ldidDst,
+	LPEXPANDVTBL lpExpandVtbl,
+	WORD fl, LPARAM lParam
+);
+RETERR16 VcpFlush16(WORD fl, LPCSTR lpszBackupDest);
+RETERR16 WINAPI VcpClose16(WORD fl, LPCSTR lpszBackupDest);
+
+/* VcpExplain flags */
+enum {
+	VCPEX_SRC_DISK,
+	VCPEX_SRC_CABINET,
+	VCPEX_SRC_LOCN,
+	VCPEX_DST_LOCN,
+	VCPEX_SRC_FILE,
+	VCPEX_DST_FILE,
+	VCPEX_DST_FILE_FINAL,
+	VCPEX_DOS_ERROR,
+	VCPEX_MESSAGE,
+	VCPEX_DOS_SOLUTION,
+	VCPEX_SRC_FULL,
+	VCPEX_DST_FULL,
+	VCPEX_DST_FULL_FINAL
+};
+
+LPCSTR WINAPI VcpExplain16(LPVIRTNODE lpVn, DWORD dwWhat);
+
 /****** logical disk management ******/
 
 typedef struct _LOGDISKDESC_S { /* ldd */
@@ -198,8 +504,6 @@
 } DEVICE_INFO16, *LPDEVICE_INFO16, **LPLPDEVICE_INFO16;
 
 
-typedef LRESULT CALLBACK (*VIFPROC)(LPVOID lpvObj, UINT uMsg, WPARAM wParam, LPARAM lParam, LPARAM lparamRef);
-
 extern void WINAPI GenFormStrWithoutPlaceHolders16(LPSTR,LPCSTR,HINF16);
 extern RETERR16 WINAPI IpOpen16(LPCSTR,HINF16 *);
 extern RETERR16 WINAPI IpClose16(HINF16);
@@ -208,6 +512,7 @@
 extern RETERR16 WINAPI CtlFindLdd16(LPLOGDISKDESC);
 extern RETERR16 WINAPI CtlAddLdd16(LPLOGDISKDESC);
 extern RETERR16 WINAPI CtlDelLdd16(LOGDISKID16);
+extern RETERR16 WINAPI CtlGetLddPath16(LOGDISKID16 ldid, LPSTR szPath);
 extern RETERR16 WINAPI GenInstall16(HINF16,LPCSTR,WORD);
 
 #endif /* __SETUPX16_H */
Index: dlls/setupapi/setupx_main.c
===================================================================
RCS file: /home/wine/wine/dlls/setupapi/setupx_main.c,v
retrieving revision 1.11
diff -u -r1.11 setupx_main.c
--- dlls/setupapi/setupx_main.c	2001/01/22 02:17:29	1.11
+++ dlls/setupapi/setupx_main.c	2001/04/16 21:01:14
@@ -47,12 +47,12 @@
 #include "winreg.h"
 #include "wine/winuser16.h"
 #include "setupx16.h"
-#include "setupx_private.h"
+#include "setupapi_private.h"
 #include "winerror.h"
 #include "heap.h"
 #include "debugtools.h"
 
-DEFAULT_DEBUG_CHANNEL(setupx);
+DEFAULT_DEBUG_CHANNEL(setupapi);
 
 /***********************************************************************
  *		SURegOpenKey
@@ -292,7 +292,7 @@
     LPSTR *pSub;
     DWORD count;
     HINF16 hInf = 0;
-    RETERR16 res = OK;
+    RETERR16 res = OK, tmp;
     WORD wFlags;
     BOOL reboot = FALSE;
     HMODULE hMod;
@@ -310,6 +310,8 @@
 	res = ERROR_FILE_NOT_FOUND; /* yes, correct */
 	goto end;
     }
+    if (VcpOpen16(NULL, 0))
+	goto end;
     if (GenInstall16(hInf, *(pSub+count-2), GENINSTALL_DO_ALL) != OK)
 	goto end;
     wFlags = atoi(*(pSub+count-1)) & ~128;
@@ -338,7 +340,12 @@
     
     res = OK;
 end:
-    IpClose16(hInf);
+    tmp = VcpClose16(VCPFL_ALL, NULL);
+    if (tmp != OK)
+	res = tmp;
+    tmp = IpClose16(hInf);
+    if (tmp != OK)
+	res = tmp;
     SETUPX_FreeSubStrings(pSub);
     if (reboot)
     {
@@ -502,7 +509,7 @@
  * LDID == Logical Device ID
  *
  * The whole LDD/LDID business might go into a separate file named
- * ldd.c or logdevice.c.
+ * ldd.c.
  * At the moment I don't know what the hell these functions are really doing.
  * That's why I added reporting stubs.
  * The only thing I do know is that I need them for the LDD/LDID infrastructure.
@@ -1048,28 +1055,6 @@
     TRACE("ret '%s'\n", szDst);
 }
 
-/***********************************************************************
- *		VcpOpen
- *
- * No idea what to do here.
- */
-RETERR16 WINAPI VcpOpen16(VIFPROC vifproc, LPARAM lparamMsgRef)
-{
-    FIXME("(%p, %08lx), stub.\n", vifproc, lparamMsgRef);
-    return OK;
-}
-
-/***********************************************************************
- *		VcpClose
- *
- * Is fl related to VCPDISKINFO.fl ?
- */
-RETERR16 WINAPI VcpClose16(WORD fl, LPCSTR lpszBackupDest)
-{
-    FIXME("(%04x, '%s'), stub.\n", fl, lpszBackupDest);
-    return OK;
-}
-
 /*
  * Copy all items in a CopyFiles entry over to the destination
  *
@@ -1077,26 +1062,29 @@
  */
 static BOOL SETUPX_CopyFiles(LPSTR *pSub, HINF16 hInf)
 {
-    BOOL res = FALSE;
+    BOOL bSingle = FALSE;
     unsigned int n;
     LPCSTR filename = IP_GetFileName(hInf);
     LPSTR pCopyEntry;
-    char pDestStr[MAX_PATH];
+    char pDstStr[MAX_PATH];
     LPSTR pSrcDir, pDstDir;
     LPSTR pFileEntries, p;
     WORD ldid;
     LOGDISKDESC_S ldd;
     LPSTR *pSubFile;
     LPSTR pSrcFile, pDstFile;
+    WORD flag;
 
     for (n=0; n < *(DWORD *)pSub; n++)
     {
 	pCopyEntry = *(pSub+1+n);
 	if (*pCopyEntry == '@')
 	{
-	    ERR("single file not handled yet !\n");
-	    continue;
+	    pCopyEntry++;
+	    bSingle = TRUE;
 	}
+	else
+	    bSingle = FALSE;
 
 	/* get source directory for that entry */
 	INIT_LDD(ldd, LDID_SRCPATH);
@@ -1105,20 +1093,35 @@
 	
         /* get destination directory for that entry */
 	if (!(GetPrivateProfileStringA("DestinationDirs", pCopyEntry, "",
-					pDestStr, sizeof(pDestStr), filename)))
-	    continue;
+					pDstStr, sizeof(pDstStr), filename)))
+	{
+	    /* hmm, not found; try the default entry */
+	    if (!(GetPrivateProfileStringA("DestinationDirs", "DefaultDestDir", "", pDstStr, sizeof(pDstStr), filename)))
+	    {
+		WARN("DefaultDestDir not found.\n");
+	        continue;
+	    }
+	}
 
 	/* translate destination dir if given as LDID */
-	ldid = atoi(pDestStr);
+	ldid = atoi(pDstStr);
 	if (ldid)
 	{
 	    if (!(SETUPX_IP_TranslateLDID(ldid, &pDstDir, hInf)))
 		continue;
 	}
 	else
-	    pDstDir = pDestStr;
+	    pDstDir = pDstStr;
 	
-	/* now that we have the destination dir, iterate over files to copy */
+	/* now that we have the destination dir, register file copying */
+
+	if (bSingle)
+	{
+	    VcpQueueCopy16(pCopyEntry, pCopyEntry, pSrcDir, pDstDir, LDID_SRCPATH, ldid ? ldid : 0xffff, 0, VFNL_COPY, 0);
+	    return TRUE;
+	}
+
+	/* entry wasn't a single file, so let's iterate over section */
 	pFileEntries = SETUPX_GetSectionEntries(filename, pCopyEntry);
         for (p=pFileEntries; *p; p +=strlen(p)+1)
 	{
@@ -1126,30 +1129,34 @@
 	    pSrcFile = *(pSubFile+1);
 	    pDstFile = (*(DWORD *)pSubFile > 1) ? *(pSubFile+2) : pSrcFile;
 	    TRACE("copying file '%s\\%s' to '%s\\%s'\n", pSrcDir, pSrcFile, pDstDir, pDstFile);
+	    flag = 0;
 	    if (*(DWORD *)pSubFile > 2)
 	    {
-		WORD flag;
 		if ((flag = atoi(*(pSubFile+3)))) /* ah, flag */
 		{
 		    if (flag & 0x2c)
 		    FIXME("VNLP_xxx flag %d not handled yet.\n", flag);
 		}
 		else
-		    FIXME("temp file name '%s' given. Need to register in wininit.ini !\n", *(pSubFile+3)); /* strong guess that this is VcpQueueCopy() */
+		{
+		    FIXME("temp file name '%s' given. Need to register in wininit.ini !\n", *(pSubFile+3));
+		    /* we probably need to set VIRTNODE.vhstrDstFinalName to
+		     * the final destination name, and the temp name is merely
+		     * the copy destination */
+		}
 	    }
+	    VcpQueueCopy16(pSrcFile, pDstFile, pSrcDir, pDstDir, LDID_SRCPATH, ldid ? ldid : 0xffff, 0, VFNL_COPY|flag, 0);
 	    SETUPX_FreeSubStrings(pSubFile);
-	    /* we don't copy ANYTHING yet ! (I'm too lazy and want to verify
-	     * this first before destroying whole partitions ;-) */
 	}
     }
 	    
-    return res;
+    return TRUE;
 }
 
 /***********************************************************************
  *		GenInstall
  *
- * general install function for .INF file sections
+ * generic installer function for .INF file sections
  *
  * This is not perfect - patch whenever you can !
  * 


More information about the wine-patches mailing list