winspool: Add support for APD_COPY_NEW_FILES
Detlef Riekenberg
wine.dev at web.de
Sat Sep 8 17:06:16 CDT 2007
winspool: Add support for APD_COPY_NEW_FILES
Before we can activate error-checking, wine must copy the driver-
files (wineps.drv, wineps16.drv, generic.ppd, the ppd from cups)
in the correct directory
--
By by ... Detlef
-------------- next part --------------
>From e87d730cfe3d7232a9a5e9bbf512f58813aee097 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Fri, 7 Sep 2007 22:37:26 +0200
Subject: [PATCH] winspool: Add support for APD_COPY_NEW_FILES
---
dlls/winspool.drv/info.c | 36 ++++++++++++++++++++++++++++++------
1 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 3a76bbf..647a5f0 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -364,6 +364,10 @@ static LPSTR strdupWtoA( LPCWSTR str )
*/
static BOOL apd_copyfile(LPWSTR filename, apd_data_t *apd)
{
+ WIN32_FILE_ATTRIBUTE_DATA attr_src;
+ WIN32_FILE_ATTRIBUTE_DATA attr_dst;
+ LONGLONG time_src;
+ LONGLONG time_dst;
LPWSTR ptr;
LPWSTR srcname;
DWORD res;
@@ -398,7 +402,31 @@ static BOOL apd_copyfile(LPWSTR filename
TRACE("%s => %s\n", debugstr_w(filename), debugstr_w(apd->dst));
- /* FIXME: handle APD_COPY_NEW_FILES */
+ ZeroMemory(&attr_src, sizeof(WIN32_FILE_ATTRIBUTE_DATA));
+ res = GetFileAttributesExW(srcname, GetFileExInfoStandard, &attr_src);
+ TRACE("src got %u with %u for %s\n", res, GetLastError(), debugstr_w(srcname));
+
+ /* FIXME: Disabled, until wine copy all Files for wineps.drv in the Driver-Directory */
+ /*
+ if (!res) {
+ WARN("failed with %u for %s\n", GetLastError(), debugstr_w(srcname));
+ return FALSE;
+ }
+ */
+
+ ZeroMemory(&attr_dst, sizeof(WIN32_FILE_ATTRIBUTE_DATA));
+ res = GetFileAttributesExW(apd->dst, GetFileExInfoStandard, &attr_dst);
+ TRACE("dst got %u with %u for %s\n", res, GetLastError(), debugstr_w(apd->dst));
+
+ memcpy(&time_src, &attr_src.ftCreationTime, sizeof(FILETIME));
+ memcpy(&time_dst, &attr_dst.ftCreationTime, sizeof(FILETIME));
+
+ if (res && (apd->copyflags & APD_COPY_NEW_FILES) && (time_src <= time_dst)){
+ /* copy src to dst not needed (src is not newer) */
+ TRACE("dst is %s (%s)\n", (time_src == time_dst) ? "same" : "newer", debugstr_w(apd->dst));
+ return TRUE;
+ }
+
res = CopyFileW(srcname, apd->dst, FALSE);
TRACE("got %u with %u\n", res, GetLastError());
@@ -6449,10 +6477,6 @@ BOOL WINAPI AddPrinterDriverExW( LPWSTR
return FALSE;
}
- if ((dwFileCopyFlags & ~APD_COPY_FROM_DIRECTORY) != APD_COPY_ALL_FILES) {
- FIXME("Flags 0x%x ignored (Fallback to APD_COPY_ALL_FILES)\n", dwFileCopyFlags & ~APD_COPY_FROM_DIRECTORY);
- }
-
ptr = get_servername_from_name(pName);
HeapFree(GetProcessHeap(), 0, ptr);
if (ptr) {
@@ -6578,7 +6602,7 @@ BOOL WINAPI AddPrinterDriverExW( LPWSTR
RegCloseKey(hdrv);
- FIXME("### DrvDriverEvent(...,DRIVEREVENT_INITIALIZE) not implemented yet\n");
+ TRACE("### DrvDriverEvent(...,DRIVEREVENT_INITIALIZE) not implemented yet\n");
TRACE("=> TRUE with %u\n", GetLastError());
--
1.4.1
More information about the wine-patches
mailing list