Heaventools

   English English  Deutsch Deutsch  Русский Русский
Heaventools Support Forums
May 22, 2013, 04:16:06 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: PEFileProxy.OpenFile() fails when file path is absolute and includes ..  (Read 3060 times)
0 Members and 1 Guest are viewing this topic.
chris
New Member
*
Posts: 2

Offline Offline



« on: September 08, 2010, 04:45:41 am »

Hi!
When calling my rtc script, PEFileProxy.OpenFile() fails if the file path is absolute (that is begins with a drive letter) and contains '..':

Opening the file 'E:\chris\Documents\AW\AW\trunk\Packager\AW\msw\..\..\..\Staging\bin\win32\ArchiWIZARD.exe'...
Open file: E:\chris\Documents\AW\AW\trunk\Packager\AW\msw\..\..\..\Staging\bin\win32\ArchiWIZARD.exe
Error: Failed to open file. Process cancelled.
Opening the file produced a fatal error.

Running the same script on the same file, but using a relative path works:

Opening the file '..\..\..\Staging\bin\win32\ArchiWIZARD.exe'...
Open file: E:\chris\Documents\AW\AW\trunk\Staging\bin\win32\ArchiWIZARD.exe
File Size: 15360 bytes
...

The file do exists: another error message is emitted when the file is not found.
Additionally, the script (CreateObject("Scripting.FileSystemObject").GetFile()) can successfully open the file:

Getting CreationTime, LastAccessTime and LastWriteTime for file 'E:\chris\Documents\AW\AW\trunk\Packager\AW\msw\..\..\..\Staging\bin\win32\ArchiWIZARD.exe'...
Created      : 12/07/2010 17:30:36
Last Modified: 01/09/2010 16:12:20
Last Accessed: 12/07/2010 17:30:36

I can provide the script.
I am using RTC 1.90 on Seven x64.

Is there a fix or a workaround (a way to produce the canonical path)?

Thanks for your help,
Chris.
chris
New Member
*
Posts: 2

Offline Offline



« Reply #1 on: September 08, 2010, 06:09:28 am »

I have found a workaround:

replace

  PEFileProxy.OpenFile SRCFILE

with

  set fso = CreateObject("Scripting.FileSystemObject")
  set f = fso.GetFile(SRCFILE)
  PEFileProxy.OpenFile f.Path

as f.Path is in canonical form.
TechMan
Heaventools
Support
***
Posts: 221

Location:
On Air

Offline Offline



« Reply #2 on: September 10, 2010, 09:48:25 am »

Quote
Is there a fix or a workaround (a way to produce the canonical path)?

Thanks for spotting and reporting this issue. We will fix it up in the next RTC release.

TechMan Robot
Heaventools Software
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC