cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sree_vis
Level 3

Issue with Xcopyfile in Vista

Hi ,
I'm building a 32 bit installer and I'm using a custom action to copy files to a particular folder when running the installer on a 64 bit machine.
I'm using the XCopyFile method.
I've put the CA to run in Deferred exec in system context .
When installing this on a 64 bit machine , XcopyFile returns a value = 0; which means the files where copied successfully, but in actual case I couldn't find them.
Can anyone help me out.
Labels (1)
0 Kudos
(6) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

Does your 'particular folder' normally get redirected for 32-bit processes? If so, make sure to Disable() and Enable() WOW64FSREDIRECTION if this is a scenario you support.
0 Kudos
sree_vis
Level 3

Yes I tried copying the files to D:\\NewFolder.
This worked fine with 32 bit machine.But the same is not working for Vista 64.
Also I've included Disable()/enable() WOW64FSREDIRECTION in my script.
0 Kudos
sree_vis
Level 3

can anyone help me about this issue ???
0 Kudos
abrasha
Level 4

Hi,

Could you attach your example? (InstallShield project)
0 Kudos
sree_vis
Level 3

Hi,
Below is the actual script that I'm using :


function CopyXML(hMSI)
//Declare Local variables
STRING szSrcFile,Path;
NUMBER nResult,nvString,nvSize,nKeyType,nvType;
begin

// Setting the source file type to xml
szSrcFile = "*.xml";


// Enable Write to the 64bit registry...
REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;

Disable(WOW64FSREDIRECTION );

// Registry Entry Root directory
nKeyType = HKEY_LOCAL_MACHINE;

if (RegDBSetDefaultRoot (nKeyType) < 0) then
MessageBox ("First call to RegDBSetDefaultRoot failed.", SEVERE);
else
MessageBox ("Root key successfully set to HKEY_LOCAL_MACHINE",INFORMATION);

endif;

RegDBGetKeyValueEx(
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{05865F9E-7870-46F6-8E35-7168982452A1}", // [in] subkey
"InstallLocation", // [in] value name
nvType, // [out] value type
Path, // [out] value, in string form
nvSize); // [out] value size
SprintfBox(INFORMATION, "Info" , Path);


if ( Path!= "" ) then
MessageBox("Pathfound",SEVERE);

Path= Path+"\Public";
SprintfBox(INFORMATION, "Info" , Path);

// Set variable to filespec for source files.

// Copy all XML files in the source directory

// into the target directory.

//COPY_SDIR is already defined .

if ( XCopyFile (COPY_SDIR ^ szSrcFile, Path^ "*.*", COMP_NORMAL)< 0) then

MessageBox ("XCopyFile failed", SEVERE);

else

MessageBox ("XML files successfully copied to PathFolder", INFORMATION);

endif;

Enable(WOW64FSREDIRECTION );

endif;

Disable Write to the 64bit registry
REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY;

end;


While using this script I got the "Path" fetched correctly and
Path= Path+"\Public";
SprintfBox(INFORMATION, "Info" , Path);
gave me the correct path.

Then I got a message that the xml files were succesfull7y copied, but this dint happen on Vista 64cmachine.
Please note that this script copied the xml files sucesfully in 32 bitXP machine and this dint work in 1 64bit Vista machine .


Since this dint work, I tried a simpler script in Vista ie I tried copying the files to path = " D://NewFolder".

Path="C:\\Users\\SViswanathan5\\Documents";


nResult = XCopyFile (COPY_SDIR ^ szSrcFile, Path^ "*.*", COMP_NORMAL) ;
SprintfBox (INFORMATION, "XCopyFile info ", "The return value of XCopyFile is %d ",nResult);


Here nResult returned me a value = 0, but the files were not copied in Vista.

Any idea why this is happening ?
0 Kudos
sree_vis
Level 3

Sorry there is a Small Correction,
in the second scenario I'm trying to copy the files to C:\\Users\\\\Documents
ie."C:\\Users\\SViswanathan5\\Documents"; and not "D:\\NewFolder"
0 Kudos