advpack: Forward AdvInstallFileA to its Unicode counterpart.
This commit is contained in:
parent
72581bd2d7
commit
cfbc26f3e6
|
@ -2,7 +2,7 @@
|
||||||
@ stdcall AddDelBackupEntryW(wstr wstr wstr long)
|
@ stdcall AddDelBackupEntryW(wstr wstr wstr long)
|
||||||
@ stdcall AddDelBackupEntry(str str str long) AddDelBackupEntryA
|
@ stdcall AddDelBackupEntry(str str str long) AddDelBackupEntryA
|
||||||
@ stdcall AdvInstallFileA(long str str str str long long)
|
@ 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 AdvInstallFile(long str str str str long long) AdvInstallFileA
|
||||||
@ stdcall CloseINFEngine(long)
|
@ stdcall CloseINFEngine(long)
|
||||||
@ stdcall DelNodeA(str long)
|
@ stdcall DelNodeA(str long)
|
||||||
|
|
|
@ -178,7 +178,7 @@ UINT CALLBACK pQueueCallback(PVOID Context, UINT Notification,
|
||||||
Notification == SPFILENOTIFY_DELETEERROR ||
|
Notification == SPFILENOTIFY_DELETEERROR ||
|
||||||
Notification == SPFILENOTIFY_COPYERROR)
|
Notification == SPFILENOTIFY_COPYERROR)
|
||||||
{
|
{
|
||||||
return SetupDefaultQueueCallbackA(Context, Notification,
|
return SetupDefaultQueueCallbackW(Context, Notification,
|
||||||
Param1, Param2);
|
Param1, Param2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,6 +188,42 @@ UINT CALLBACK pQueueCallback(PVOID Context, UINT Notification,
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* AdvInstallFileA (ADVPACK.@)
|
* 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.
|
* Copies a file from the source to a destination.
|
||||||
*
|
*
|
||||||
* PARAMS
|
* PARAMS
|
||||||
|
@ -207,20 +243,20 @@ UINT CALLBACK pQueueCallback(PVOID Context, UINT Notification,
|
||||||
* If lpszDestFile is NULL, the destination filename is the same as
|
* If lpszDestFile is NULL, the destination filename is the same as
|
||||||
* lpszSourceFIle.
|
* lpszSourceFIle.
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI AdvInstallFileA(HWND hwnd, LPCSTR lpszSourceDir, LPCSTR lpszSourceFile,
|
HRESULT WINAPI AdvInstallFileW(HWND hwnd, LPCWSTR lpszSourceDir, LPCWSTR lpszSourceFile,
|
||||||
LPCSTR lpszDestDir, LPCSTR lpszDestFile,
|
LPCWSTR lpszDestDir, LPCWSTR lpszDestFile,
|
||||||
DWORD dwFlags, DWORD dwReserved)
|
DWORD dwFlags, DWORD dwReserved)
|
||||||
{
|
{
|
||||||
PSP_FILE_CALLBACK_A pFileCallback;
|
PSP_FILE_CALLBACK_W pFileCallback;
|
||||||
LPSTR szPath, szDestFilename;
|
LPWSTR szPath, szDestFilename;
|
||||||
char szRootPath[ROOT_LENGTH];
|
WCHAR szRootPath[ROOT_LENGTH];
|
||||||
DWORD dwLen, dwLastError;
|
DWORD dwLen, dwLastError;
|
||||||
HSPFILEQ fileQueue;
|
HSPFILEQ fileQueue;
|
||||||
PVOID pContext;
|
PVOID pContext;
|
||||||
|
|
||||||
TRACE("(%p,%p,%p,%p,%p,%ld,%ld)\n", hwnd, debugstr_a(lpszSourceDir),
|
TRACE("(%p,%s,%s,%s,%s,%ld,%ld)\n", hwnd, debugstr_w(lpszSourceDir),
|
||||||
debugstr_a(lpszSourceFile), debugstr_a(lpszDestDir),
|
debugstr_w(lpszSourceFile), debugstr_w(lpszDestDir),
|
||||||
debugstr_a(lpszDestFile), dwFlags, dwReserved);
|
debugstr_w(lpszDestFile), dwFlags, dwReserved);
|
||||||
|
|
||||||
if (!lpszSourceDir || !lpszSourceFile || !lpszDestDir)
|
if (!lpszSourceDir || !lpszSourceFile || !lpszDestDir)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -232,25 +268,25 @@ HRESULT WINAPI AdvInstallFileA(HWND hwnd, LPCSTR lpszSourceDir, LPCSTR lpszSourc
|
||||||
pContext = NULL;
|
pContext = NULL;
|
||||||
dwLastError = ERROR_SUCCESS;
|
dwLastError = ERROR_SUCCESS;
|
||||||
|
|
||||||
lstrcpynA(szRootPath, lpszSourceDir, ROOT_LENGTH);
|
lstrcpynW(szRootPath, lpszSourceDir, ROOT_LENGTH);
|
||||||
szPath = (LPSTR)lpszSourceDir + ROOT_LENGTH;
|
szPath = (LPWSTR)lpszSourceDir + ROOT_LENGTH;
|
||||||
|
|
||||||
/* use lpszSourceFile as destination filename if lpszDestFile is NULL */
|
/* use lpszSourceFile as destination filename if lpszDestFile is NULL */
|
||||||
if (lpszDestFile)
|
if (lpszDestFile)
|
||||||
{
|
{
|
||||||
dwLen = lstrlenA(lpszDestFile);
|
dwLen = lstrlenW(lpszDestFile);
|
||||||
szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen);
|
szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
|
||||||
lstrcpyA(szDestFilename, lpszDestFile);
|
lstrcpyW(szDestFilename, lpszDestFile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dwLen = lstrlenA(lpszSourceFile);
|
dwLen = lstrlenW(lpszSourceFile);
|
||||||
szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen);
|
szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
|
||||||
lstrcpyA(szDestFilename, lpszSourceFile);
|
lstrcpyW(szDestFilename, lpszSourceFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add the file copy operation to the setup queue */
|
/* 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))
|
NULL, lpszDestDir, szDestFilename, dwFlags))
|
||||||
{
|
{
|
||||||
dwLastError = GetLastError();
|
dwLastError = GetLastError();
|
||||||
|
@ -272,7 +308,7 @@ HRESULT WINAPI AdvInstallFileA(HWND hwnd, LPCSTR lpszSourceDir, LPCSTR lpszSourc
|
||||||
pFileCallback = pQueueCallback;
|
pFileCallback = pQueueCallback;
|
||||||
|
|
||||||
/* perform the file copy */
|
/* perform the file copy */
|
||||||
if (!SetupCommitFileQueueA(hwnd, fileQueue, pFileCallback, pContext))
|
if (!SetupCommitFileQueueW(hwnd, fileQueue, pFileCallback, pContext))
|
||||||
{
|
{
|
||||||
dwLastError = GetLastError();
|
dwLastError = GetLastError();
|
||||||
goto done;
|
goto done;
|
||||||
|
|
Loading…
Reference in New Issue