Author: dchapyshev Date: Sat Dec 6 03:07:05 2008 New Revision: 37876
URL: http://svn.reactos.org/svn/reactos?rev=37876&view=rev Log: - Implement SetupInstallFileA/W - Stub implement SetupPromptForDiskA/W All from Wine.
Modified: trunk/reactos/dll/win32/setupapi/queue.c trunk/reactos/dll/win32/setupapi/setupapi.spec trunk/reactos/dll/win32/setupapi/stubs.c
Modified: trunk/reactos/dll/win32/setupapi/queue.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/queue.c?... ============================================================================== --- trunk/reactos/dll/win32/setupapi/queue.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/queue.c [iso-8859-1] Sat Dec 6 03:07:05 2008 @@ -1114,6 +1114,113 @@ }
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; }
/***********************************************************************
Modified: trunk/reactos/dll/win32/setupapi/setupapi.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupapi... ============================================================================== --- trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] Sat Dec 6 03:07:05 2008 @@ -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
Modified: trunk/reactos/dll/win32/setupapi/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/stubs.c?... ============================================================================== --- trunk/reactos/dll/win32/setupapi/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/stubs.c [iso-8859-1] Sat Dec 6 03:07:05 2008 @@ -131,6 +131,34 @@ }
/*********************************************************************** + * 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.@) */ BOOL WINAPI