James Hawkins : advpack: Forward AdvInstallFileA to its Unicode
counterpart .
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Mar 23 13:50:17 CST 2006
Module: wine
Branch: refs/heads/master
Commit: cfbc26f3e679a409868363697d8ed39fb74b106f
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=cfbc26f3e679a409868363697d8ed39fb74b106f
Author: James Hawkins <truiken at gmail.com>
Date: Wed Mar 22 14:34:41 2006 -0600
advpack: Forward AdvInstallFileA to its Unicode counterpart.
---
dlls/advpack/advpack.spec | 2 +
dlls/advpack/files.c | 78 +++++++++++++++++++++++++++++++++------------
2 files changed, 58 insertions(+), 22 deletions(-)
diff --git a/dlls/advpack/advpack.spec b/dlls/advpack/advpack.spec
index 7ab49b1..7481127 100644
--- a/dlls/advpack/advpack.spec
+++ b/dlls/advpack/advpack.spec
@@ -2,7 +2,7 @@
@ stdcall AddDelBackupEntryW(wstr wstr wstr long)
@ stdcall AddDelBackupEntry(str str str long) AddDelBackupEntryA
@ stdcall AdvInstallFileA(long str str str str long long)
-# stdcall AdvInstallFileW(long wstr wstr wstr wstr long long)
+@ stdcall AdvInstallFileW(long wstr wstr wstr wstr long long)
@ stdcall AdvInstallFile(long str str str str long long) AdvInstallFileA
@ stdcall CloseINFEngine(long)
@ stdcall DelNodeA(str long)
diff --git a/dlls/advpack/files.c b/dlls/advpack/files.c
index dbf6b66..d5eccd9 100644
--- a/dlls/advpack/files.c
+++ b/dlls/advpack/files.c
@@ -178,7 +178,7 @@ UINT CALLBACK pQueueCallback(PVOID Conte
Notification == SPFILENOTIFY_DELETEERROR ||
Notification == SPFILENOTIFY_COPYERROR)
{
- return SetupDefaultQueueCallbackA(Context, Notification,
+ return SetupDefaultQueueCallbackW(Context, Notification,
Param1, Param2);
}
@@ -188,6 +188,42 @@ UINT CALLBACK pQueueCallback(PVOID Conte
/***********************************************************************
* AdvInstallFileA (ADVPACK.@)
*
+ * See AdvInstallFileW.
+ */
+HRESULT WINAPI AdvInstallFileA(HWND hwnd, LPCSTR lpszSourceDir, LPCSTR lpszSourceFile,
+ LPCSTR lpszDestDir, LPCSTR lpszDestFile,
+ DWORD dwFlags, DWORD dwReserved)
+{
+ UNICODE_STRING sourcedir, sourcefile;
+ UNICODE_STRING destdir, destfile;
+ HRESULT res;
+
+ TRACE("(%p,%s,%s,%s,%s,%ld,%ld)\n", hwnd, debugstr_a(lpszSourceDir),
+ debugstr_a(lpszSourceFile), debugstr_a(lpszDestDir),
+ debugstr_a(lpszDestFile), dwFlags, dwReserved);
+
+ if (!lpszSourceDir || !lpszSourceFile || !lpszDestDir)
+ return E_INVALIDARG;
+
+ RtlCreateUnicodeStringFromAsciiz(&sourcedir, lpszSourceDir);
+ RtlCreateUnicodeStringFromAsciiz(&sourcefile, lpszSourceFile);
+ RtlCreateUnicodeStringFromAsciiz(&destdir, lpszDestDir);
+ RtlCreateUnicodeStringFromAsciiz(&destfile, lpszDestFile);
+
+ res = AdvInstallFileW(hwnd, sourcedir.Buffer, sourcefile.Buffer,
+ destdir.Buffer, destfile.Buffer, dwFlags, dwReserved);
+
+ RtlFreeUnicodeString(&sourcedir);
+ RtlFreeUnicodeString(&sourcefile);
+ RtlFreeUnicodeString(&destdir);
+ RtlFreeUnicodeString(&destfile);
+
+ return res;
+}
+
+/***********************************************************************
+ * AdvInstallFileW (ADVPACK.@)
+ *
* Copies a file from the source to a destination.
*
* PARAMS
@@ -207,20 +243,20 @@ UINT CALLBACK pQueueCallback(PVOID Conte
* If lpszDestFile is NULL, the destination filename is the same as
* lpszSourceFIle.
*/
-HRESULT WINAPI AdvInstallFileA(HWND hwnd, LPCSTR lpszSourceDir, LPCSTR lpszSourceFile,
- LPCSTR lpszDestDir, LPCSTR lpszDestFile,
- DWORD dwFlags, DWORD dwReserved)
-{
- PSP_FILE_CALLBACK_A pFileCallback;
- LPSTR szPath, szDestFilename;
- char szRootPath[ROOT_LENGTH];
+HRESULT WINAPI AdvInstallFileW(HWND hwnd, LPCWSTR lpszSourceDir, LPCWSTR lpszSourceFile,
+ LPCWSTR lpszDestDir, LPCWSTR lpszDestFile,
+ DWORD dwFlags, DWORD dwReserved)
+{
+ PSP_FILE_CALLBACK_W pFileCallback;
+ LPWSTR szPath, szDestFilename;
+ WCHAR szRootPath[ROOT_LENGTH];
DWORD dwLen, dwLastError;
HSPFILEQ fileQueue;
PVOID pContext;
- TRACE("(%p,%p,%p,%p,%p,%ld,%ld)\n", hwnd, debugstr_a(lpszSourceDir),
- debugstr_a(lpszSourceFile), debugstr_a(lpszDestDir),
- debugstr_a(lpszDestFile), dwFlags, dwReserved);
+ TRACE("(%p,%s,%s,%s,%s,%ld,%ld)\n", hwnd, debugstr_w(lpszSourceDir),
+ debugstr_w(lpszSourceFile), debugstr_w(lpszDestDir),
+ debugstr_w(lpszDestFile), dwFlags, dwReserved);
if (!lpszSourceDir || !lpszSourceFile || !lpszDestDir)
return E_INVALIDARG;
@@ -232,25 +268,25 @@ HRESULT WINAPI AdvInstallFileA(HWND hwnd
pContext = NULL;
dwLastError = ERROR_SUCCESS;
- lstrcpynA(szRootPath, lpszSourceDir, ROOT_LENGTH);
- szPath = (LPSTR)lpszSourceDir + ROOT_LENGTH;
+ lstrcpynW(szRootPath, lpszSourceDir, ROOT_LENGTH);
+ szPath = (LPWSTR)lpszSourceDir + ROOT_LENGTH;
/* use lpszSourceFile as destination filename if lpszDestFile is NULL */
if (lpszDestFile)
{
- dwLen = lstrlenA(lpszDestFile);
- szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen);
- lstrcpyA(szDestFilename, lpszDestFile);
+ dwLen = lstrlenW(lpszDestFile);
+ szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
+ lstrcpyW(szDestFilename, lpszDestFile);
}
else
{
- dwLen = lstrlenA(lpszSourceFile);
- szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen);
- lstrcpyA(szDestFilename, lpszSourceFile);
+ dwLen = lstrlenW(lpszSourceFile);
+ szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
+ lstrcpyW(szDestFilename, lpszSourceFile);
}
/* add the file copy operation to the setup queue */
- if (!SetupQueueCopyA(fileQueue, szRootPath, szPath, lpszSourceFile, NULL,
+ if (!SetupQueueCopyW(fileQueue, szRootPath, szPath, lpszSourceFile, NULL,
NULL, lpszDestDir, szDestFilename, dwFlags))
{
dwLastError = GetLastError();
@@ -272,7 +308,7 @@ HRESULT WINAPI AdvInstallFileA(HWND hwnd
pFileCallback = pQueueCallback;
/* perform the file copy */
- if (!SetupCommitFileQueueA(hwnd, fileQueue, pFileCallback, pContext))
+ if (!SetupCommitFileQueueW(hwnd, fileQueue, pFileCallback, pContext))
{
dwLastError = GetLastError();
goto done;
More information about the wine-cvs
mailing list