#include "setupapi_private.h"
-WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
+#include <aclapi.h>
/* Unicode constants */
static const WCHAR DotSecurity[] = {'.','S','e','c','u','r','i','t','y',0};
INFCONTEXT file_ctx, disk_ctx;
INT id, diskid;
DWORD len, len2;
+ WCHAR SectionName[MAX_PATH];
/* find the SourceDisksFiles entry */
- if (!SetupFindFirstLineW( hinf, SourceDisksFiles, op->src_file, &file_ctx ))
+ if(!SetupDiGetActualSectionToInstallW(hinf, SourceDisksFiles, SectionName, MAX_PATH, NULL, NULL))
+ return;
+ if (!SetupFindFirstLineW( hinf, SectionName, op->src_file, &file_ctx ))
{
if ((op->style & (SP_COPY_SOURCE_ABSOLUTE|SP_COPY_SOURCEPATH_ABSOLUTE))) return;
/* no specific info, use .inf file source directory */
if (!SetupGetIntField( &file_ctx, 1, &diskid )) return;
/* now find the diskid in the SourceDisksNames section */
- if (!SetupFindFirstLineW( hinf, SourceDisksNames, NULL, &disk_ctx )) return;
+ if(!SetupDiGetActualSectionToInstallW(hinf, SourceDisksNames, SectionName, MAX_PATH, NULL, NULL))
+ return;
+ if (!SetupFindFirstLineW( hinf, SectionName, NULL, &disk_ctx )) return;
for (;;)
{
if (SetupGetIntField( &disk_ctx, 0, &id ) && (id == diskid)) break;
op->src_tag = strdupAtoW( params->SourceTagfile );
op->dst_path = strdupAtoW( params->TargetDirectory );
op->dst_file = strdupAtoW( params->TargetFilename );
+ op->dst_sd = NULL;
/* some defaults */
if (!op->src_file) op->src_file = op->dst_file;
op->src_tag = NULL;
op->dst_path = strdupAtoW( part1 );
op->dst_file = strdupAtoW( part2 );
+ op->dst_sd = NULL;
queue_file_op( &queue->delete_queue, op );
return TRUE;
}
op->src_tag = NULL;
op->dst_path = strdupW( part1 );
op->dst_file = strdupW( part2 );
+ op->dst_sd = NULL;
queue_file_op( &queue->delete_queue, op );
return TRUE;
}
op->src_tag = NULL;
op->dst_path = strdupAtoW( TargetPath );
op->dst_file = strdupAtoW( TargetFilename );
+ op->dst_sd = NULL;
queue_file_op( &queue->rename_queue, op );
return TRUE;
}
op->src_tag = NULL;
op->dst_path = strdupW( TargetPath );
op->dst_file = strdupW( TargetFilename );
+ op->dst_sd = NULL;
queue_file_op( &queue->rename_queue, op );
return TRUE;
}
{
BOOL rc = FALSE;
BOOL docopy = TRUE;
+ WCHAR TempFile[MAX_PATH];
+ INT hSource, hTemp;
+ OFSTRUCT OfStruct;
+ WCHAR TempPath[MAX_PATH];
TRACE("copy %s to %s style 0x%x\n",debugstr_w(source),debugstr_w(target),style);
+ hSource = LZOpenFileW((LPWSTR)source, &OfStruct, OF_READ);
+ if (hSource < 0)
+ return FALSE;
+
+ /* Get a temp file name */
+ GetTempPathW(sizeof(TempPath) / sizeof(WCHAR), TempPath);
+ GetTempFileNameW(TempPath, L"", 0, TempFile);
+
+ /* Extract the compressed file to a temp location */
+ hTemp = LZOpenFileW(TempFile, &OfStruct, OF_CREATE);
+ LZCopy(hSource, hTemp);
+ LZClose(hSource);
+ LZClose(hTemp);
+
/* before copy processing */
if (style & SP_COPY_REPLACEONLY)
{
* we just basically unconditionally replace the builtin versions.
*/
if ((GetFileAttributesW(target) != INVALID_FILE_ATTRIBUTES) &&
- (GetFileAttributesW(source) != INVALID_FILE_ATTRIBUTES))
+ (GetFileAttributesW(TempFile) != INVALID_FILE_ATTRIBUTES))
{
- VersionSizeSource = GetFileVersionInfoSizeW((LPWSTR)source,&zero);
+ VersionSizeSource = GetFileVersionInfoSizeW(TempFile,&zero);
VersionSizeTarget = GetFileVersionInfoSizeW((LPWSTR)target,&zero);
}
VersionSource = HeapAlloc(GetProcessHeap(),0,VersionSizeSource);
VersionTarget = HeapAlloc(GetProcessHeap(),0,VersionSizeTarget);
- ret = GetFileVersionInfoW((LPWSTR)source,0,VersionSizeSource,VersionSource);
+ ret = GetFileVersionInfoW(TempFile,0,VersionSizeSource,VersionSource);
if (ret)
ret = GetFileVersionInfoW((LPWSTR)target, 0, VersionSizeTarget,
VersionTarget);
if (docopy)
{
- rc = CopyFileW(source,target,FALSE);
+ rc = MoveFileExW(TempFile,target,MOVEFILE_REPLACE_EXISTING);
TRACE("Did copy... rc was %i\n",rc);
}
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return FALSE;
}
- if (!SetupGetStringFieldW( inf_context, 1, inf_source, len, NULL )) return FALSE;
+ if (!SetupGetStringFieldW( inf_context, 1, inf_source, len, NULL ))
+ {
+ HeapFree( GetProcessHeap(), 0, inf_source );
+ return FALSE;
+ }
source = inf_source;
}
else if (!source)