advpack: Forward AdvInstallFileA to its Unicode counterpart.

This commit is contained in:
James Hawkins 2006-03-22 14:34:41 -06:00 committed by Alexandre Julliard
parent 72581bd2d7
commit cfbc26f3e6
2 changed files with 57 additions and 21 deletions

View File

@ -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)

View File

@ -178,7 +178,7 @@ UINT CALLBACK pQueueCallback(PVOID Context, UINT Notification,
Notification == SPFILENOTIFY_DELETEERROR ||
Notification == SPFILENOTIFY_COPYERROR)
{
return SetupDefaultQueueCallbackA(Context, Notification,
return SetupDefaultQueueCallbackW(Context, Notification,
Param1, Param2);
}
@ -188,6 +188,42 @@ UINT CALLBACK pQueueCallback(PVOID Context, UINT Notification,
/***********************************************************************
* 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 Context, UINT Notification,
* 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)
HRESULT WINAPI AdvInstallFileW(HWND hwnd, LPCWSTR lpszSourceDir, LPCWSTR lpszSourceFile,
LPCWSTR lpszDestDir, LPCWSTR lpszDestFile,
DWORD dwFlags, DWORD dwReserved)
{
PSP_FILE_CALLBACK_A pFileCallback;
LPSTR szPath, szDestFilename;
char szRootPath[ROOT_LENGTH];
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, LPCSTR lpszSourceDir, LPCSTR lpszSourc
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, LPCSTR lpszSourceDir, LPCSTR lpszSourc
pFileCallback = pQueueCallback;
/* perform the file copy */
if (!SetupCommitFileQueueA(hwnd, fileQueue, pFileCallback, pContext))
if (!SetupCommitFileQueueW(hwnd, fileQueue, pFileCallback, pContext))
{
dwLastError = GetLastError();
goto done;