Here's a small demo qabout how File redisrection and your profiles VirtualStorefolder work:
Requirement: UAC (user access control) has to be turned on. It is by default, so if you don't know what UAC is, it likely is on, you can check it in Windows Control Panel -> User Accounts -> Turn UAC on or off.
Better idea: Go into Windows Settings and via the "Find a setting" search box search "UAC".
Code:
#Define CONTENT 'test'
Local lcProgramFiles, lcNewFile, lcBackupFile, lcVirtualStore
lcProgramFiles = GetEnv("ProgramFiles")
lcNewFile = lcProgramFiles+"\vfpgenerated.txt"
lcBackupFile = ForceExt(lcNewFile,"bak")
If StrToFile(CONTENT,lcNewFile)=Len(CONTENT)
? 'File created'
Copy File (lcNewFile) TO (lcBackupFile)
? 'File copied'
EndIf
If FileToStr(lcBackupFile)== CONTENT
? 'Copy verified Ok'
EndIf
? File(lcBackupFile)
lcVirtualStore = GetEnv("LOCALAPPDATA")+"\VirtualStore\"+JustFname(lcProgramFiles)
* Files will not be seen here
Run /n explorer.exe "&lcProgramFiles"
* As redirection put them into your VirtualStore folder
Run /n explorer.exe "&lcVirtualStore"
* nevertheless redirection also works when reading from the path where the redirected file doesd not exis:
? lcBackupFile
? FileToStr(lcBackupFile)
? lcVirtualStore+"\vfpgenerated.bak"
? FileToStr(lcVirtualStore+"\vfpgenerated.bak")
If you have questoins about what the oiutputs are for, please ask.
One thing to know and do is in the Windows Explorer showing the Program Files folder, you have to scroll down to see NO generated and copied file, which due to redirection is generated in the PRogram Files subfolder of the VirtualStore folder, which the seconf Windows Explorer is showing. So there you see the effect of redirection. Not only wrintg, also reading the file is redirected. Therefore the last two FILETOSTR() commands actually both read the file from the VirtualStore, even though the backup fiel does not exist at the location of lcBackupFile.
What does this mean?
It means your backup process succeeds, proven by reading in the file copy. That you don't see it, no matter if you use Windows Explorer or your Wizfile tool, because you look at the wrong place.
And why is Microsft doing this?
To keep legacy software working, or software of programmers that think their software should write into folders under system control. MS thereby lets code work without error and it works twoways, when writing and reading.
Are they doing a great service with this? If you ask me, no. Of course legacya software that can't be modified can now still work, but if you have a permission problem like that as a company with your important legcy software of which - unllike in your situation - the developer may not even live anymore - you could also solve that damn problem by giving write permission into the application folder. So it's not a big service. On top of that, change UAC from time to time, turn it off and on, and this redirection doesn't work anymore. Install a software with UAC off and then use it with UAC on, it doesn't work. There are more situations this is unhelpful than this is helpful, if you ask me.
I guess we're at a point where - at least as of today - your backup works, you still don't see it with WizFile, but that's not your problem (anymore). I think you bark up the wrong tree, as you stand in the wrong forrest. So I suggest you get to the bottom of the problem, not to solution but what actually does not work out. After 10 years, wouldn't there also be changes in TMG, maybe your INI key/value changes don't work. I hear you say TMG9.exe ist still also the old software and nothing could have changed? Are you sure it has no self updating mechanism?
All we're doing here is taking stabs in the dark, and that has to change.
Chriss