- Implement SetupInstallFileA/W

- Stub implement SetupPromptForDiskA/W
All from Wine.

svn path=/trunk/; revision=37876
This commit is contained in:
Dmitry Chapyshev
2008-12-06 09:07:05 +00:00
parent 1f8539a65e
commit 336ef53fac
3 changed files with 139 additions and 4 deletions

View File

@@ -1116,6 +1116,113 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
return rc;
}
/***********************************************************************
* SetupInstallFileA (SETUPAPI.@)
*/
BOOL WINAPI SetupInstallFileA( HINF hinf, PINFCONTEXT inf_context, PCSTR source, PCSTR root,
PCSTR dest, DWORD style, PSP_FILE_CALLBACK_A handler, PVOID context )
{
BOOL ret = FALSE;
struct callback_WtoA_context ctx;
UNICODE_STRING sourceW, rootW, destW;
TRACE("%p %p %s %s %s %x %p %p\n", hinf, inf_context, debugstr_a(source), debugstr_a(root),
debugstr_a(dest), style, handler, context);
sourceW.Buffer = rootW.Buffer = destW.Buffer = NULL;
if (source && !RtlCreateUnicodeStringFromAsciiz( &sourceW, source ))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return FALSE;
}
if (root && !RtlCreateUnicodeStringFromAsciiz( &rootW, root ))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
goto exit;
}
if (dest && !RtlCreateUnicodeStringFromAsciiz( &destW, dest ))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
goto exit;
}
ctx.orig_context = context;
ctx.orig_handler = handler;
ret = SetupInstallFileW( hinf, inf_context, sourceW.Buffer, rootW.Buffer, destW.Buffer, style, QUEUE_callback_WtoA, &ctx );
exit:
RtlFreeUnicodeString( &sourceW );
RtlFreeUnicodeString( &rootW );
RtlFreeUnicodeString( &destW );
return ret;
}
/***********************************************************************
* SetupInstallFileW (SETUPAPI.@)
*/
BOOL WINAPI SetupInstallFileW( HINF hinf, PINFCONTEXT inf_context, PCWSTR source, PCWSTR root,
PCWSTR dest, DWORD style, PSP_FILE_CALLBACK_W handler, PVOID context )
{
static const WCHAR CopyFiles[] = {'C','o','p','y','F','i','l','e','s',0};
BOOL ret, absolute = (root && *root && !(style & SP_COPY_SOURCE_ABSOLUTE));
WCHAR *buffer, *p, *inf_source = NULL;
unsigned int len;
TRACE("%p %p %s %s %s %x %p %p\n", hinf, inf_context, debugstr_w(source), debugstr_w(root),
debugstr_w(dest), style, handler, context);
if (hinf)
{
INFCONTEXT ctx;
if (!inf_context)
{
inf_context = &ctx;
if (!SetupFindFirstLineW( hinf, CopyFiles, NULL, inf_context )) return FALSE;
}
if (!SetupGetStringFieldW( inf_context, 1, NULL, 0, (PDWORD) &len )) return FALSE;
if (!(inf_source = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return FALSE;
}
if (!SetupGetStringFieldW( inf_context, 1, inf_source, len, NULL )) return FALSE;
source = inf_source;
}
else if (!source)
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
len = strlenW( source ) + 1;
if (absolute) len += strlenW( root ) + 1;
if (!(p = buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
{
HeapFree( GetProcessHeap(), 0, inf_source );
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return FALSE;
}
if (absolute)
{
strcpyW( buffer, root );
p += strlenW( buffer );
if (p[-1] != '\\') *p++ = '\\';
}
while (*source == '\\') source++;
strcpyW( p, source );
ret = do_file_copyW( buffer, dest, style, handler, context );
HeapFree( GetProcessHeap(), 0, inf_source );
HeapFree( GetProcessHeap(), 0, buffer );
return ret;
}
/***********************************************************************
* SetupCommitFileQueueW (SETUPAPI.@)
*/

View File

@@ -439,10 +439,10 @@
@ stdcall SetupInitDefaultQueueCallbackEx(long long long long ptr)
@ stdcall SetupInitializeFileLogA(str long)
@ stdcall SetupInitializeFileLogW(wstr long)
@ stub SetupInstallFileA
@ stdcall SetupInstallFileA(ptr ptr str str str long ptr ptr)
@ stub SetupInstallFileExA
@ stub SetupInstallFileExW
@ stub SetupInstallFileW
@ stdcall SetupInstallFileW(ptr ptr wstr wstr wstr long ptr ptr)
@ stdcall SetupInstallFilesFromInfSectionA(long long long str str long)
@ stdcall SetupInstallFilesFromInfSectionW(long long long wstr wstr long)
@ stdcall SetupInstallFromInfSectionA(long long str long long str long ptr ptr long ptr)
@@ -464,8 +464,8 @@
@ stdcall SetupOpenInfFileW(wstr wstr long ptr)
@ stdcall SetupOpenLog(long)
@ stdcall SetupOpenMasterInf()
@ stub SetupPromptForDiskA
@ stub SetupPromptForDiskW
@ stdcall SetupPromptForDiskA(ptr str str str str str long ptr long ptr)
@ stdcall SetupPromptForDiskW(ptr wstr wstr wstr wstr wstr long ptr long ptr)
@ stdcall SetupPromptReboot(ptr ptr long)
@ stub SetupQueryDrivesInDiskSpaceListA
@ stub SetupQueryDrivesInDiskSpaceListW

View File

@@ -130,6 +130,34 @@ BOOL WINAPI SetupSetSourceListW(DWORD flags, PCWSTR *list, UINT count)
return FALSE;
}
/***********************************************************************
* SetupPromptForDiskA (SETUPAPI.@)
*/
UINT WINAPI SetupPromptForDiskA(HWND hwndParent, PCSTR DialogTitle, PCSTR DiskName,
PCSTR PathToSource, PCSTR FileSought, PCSTR TagFile, DWORD DiskPromptStyle,
PSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize)
{
FIXME("%p %s %s %s %s %s %d %p %d %p: stub\n", hwndParent, debugstr_a(DialogTitle),
debugstr_a(DiskName), debugstr_a(PathToSource), debugstr_a(FileSought),
debugstr_a(TagFile), DiskPromptStyle, PathBuffer, PathBufferSize,
PathRequiredSize);
return 0;
}
/***********************************************************************
* SetupPromptForDiskW (SETUPAPI.@)
*/
UINT WINAPI SetupPromptForDiskW(HWND hwndParent, PCWSTR DialogTitle, PCWSTR DiskName,
PCWSTR PathToSource, PCWSTR FileSought, PCWSTR TagFile, DWORD DiskPromptStyle,
PWSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize)
{
FIXME("%p %s %s %s %s %s %d %p %d %p: stub\n", hwndParent, debugstr_w(DialogTitle),
debugstr_w(DiskName), debugstr_w(PathToSource), debugstr_w(FileSought),
debugstr_w(TagFile), DiskPromptStyle, PathBuffer, PathBufferSize,
PathRequiredSize);
return 0;
}
/***********************************************************************
* SetupDiRemoveDevice(SETUPAPI.@)
*/