kernel32: Implement ReplaceFileA.

This commit is contained in:
Erich Hoover 2008-02-12 23:02:34 +01:00 committed by Alexandre Julliard
parent 8d555e825b
commit 06a3c3a281
1 changed files with 31 additions and 4 deletions

View File

@ -1542,10 +1542,37 @@ BOOL WINAPI ReplaceFileA(LPCSTR lpReplacedFileName,LPCSTR lpReplacementFileName,
LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPCSTR lpBackupFileName, DWORD dwReplaceFlags,
LPVOID lpExclude, LPVOID lpReserved) LPVOID lpExclude, LPVOID lpReserved)
{ {
FIXME("(%s,%s,%s,%08x,%p,%p) stub\n",lpReplacedFileName,lpReplacementFileName, WCHAR *replacedW, *replacementW, *backupW = NULL;
lpBackupFileName,dwReplaceFlags,lpExclude,lpReserved); BOOL ret;
SetLastError(ERROR_UNABLE_TO_MOVE_REPLACEMENT);
/* This function only makes sense when the first two parameters are defined */
if (!lpReplacedFileName || !(replacedW = FILE_name_AtoW( lpReplacedFileName, TRUE )))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
}
if (!lpReplacementFileName || !(replacementW = FILE_name_AtoW( lpReplacementFileName, TRUE )))
{
HeapFree( GetProcessHeap(), 0, replacedW );
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
/* The backup parameter, however, is optional */
if (lpBackupFileName)
{
if (!(backupW = FILE_name_AtoW( lpBackupFileName, TRUE )))
{
HeapFree( GetProcessHeap(), 0, replacedW );
HeapFree( GetProcessHeap(), 0, replacementW );
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
}
ret = ReplaceFileW( replacedW, replacementW, backupW, dwReplaceFlags, lpExclude, lpReserved );
HeapFree( GetProcessHeap(), 0, replacedW );
HeapFree( GetProcessHeap(), 0, replacementW );
HeapFree( GetProcessHeap(), 0, backupW );
return ret;
} }