Hans Leidekker : wininet: Implement InternetQueryOption( INTERNET_OPTION_DATAFILE_NAME) for ftp file objects.

Alexandre Julliard julliard at winehq.org
Wed Dec 2 10:22:11 CST 2009


Module: wine
Branch: master
Commit: be86c2976bcb42edaf51de5943af6fa51313e75a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=be86c2976bcb42edaf51de5943af6fa51313e75a

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Dec  1 17:01:35 2009 +0100

wininet: Implement InternetQueryOption(INTERNET_OPTION_DATAFILE_NAME) for ftp file objects.

---

 dlls/wininet/ftp.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index ea5b355..48a7a95 100644
--- a/dlls/wininet/ftp.c
+++ b/dlls/wininet/ftp.c
@@ -1133,8 +1133,39 @@ static DWORD FTPFILE_QueryOption(object_header_t *hdr, DWORD option, void *buffe
         *size = sizeof(DWORD);
         *(DWORD*)buffer = INTERNET_HANDLE_TYPE_FTP_FILE;
         return ERROR_SUCCESS;
-    }
+    case INTERNET_OPTION_DATAFILE_NAME:
+    {
+        DWORD required;
+        ftp_file_t *file = (ftp_file_t *)hdr;
+
+        TRACE("INTERNET_OPTION_DATAFILE_NAME\n");
+
+        if (!file->cache_file)
+        {
+            *size = 0;
+            return ERROR_INTERNET_ITEM_NOT_FOUND;
+        }
+        if (unicode)
+        {
+            required = (lstrlenW(file->cache_file) + 1) * sizeof(WCHAR);
+            if (*size < required)
+                return ERROR_INSUFFICIENT_BUFFER;
 
+            *size = required;
+            memcpy(buffer, file->cache_file, *size);
+            return ERROR_SUCCESS;
+        }
+        else
+        {
+            required = WideCharToMultiByte(CP_ACP, 0, file->cache_file, -1, NULL, 0, NULL, NULL);
+            if (required > *size)
+                return ERROR_INSUFFICIENT_BUFFER;
+
+            *size = WideCharToMultiByte(CP_ACP, 0, file->cache_file, -1, buffer, *size, NULL, NULL);
+            return ERROR_SUCCESS;
+        }
+    }
+    }
     return INET_QueryOption(option, buffer, size, unicode);
 }
 




More information about the wine-cvs mailing list