Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: IntControl 92 Sysnative File Redirection
Disabling file system redirection affects all file operations performed by the the script, so it should be disabled only when necessary for a single call and re-enabled again immediately after the function returns. Disabling file system redirection for longer periods can prevent WinBatch from loading system DLLs, causing the it to fail.
NOTE: It is REALLY important to minimize the code run when the File System Redirection is disabled, especially when loading WIL Extenders, using COM / OLE, or doing anything that asks Windows to load any new DLLs. The problem is that while File System Redirection is disabled, your code will be looking at the wrong version of windows and will attempt to load wrong (64 instead of 32 bit) versions of modules, and usually fail, GPF, or otherwise not function properly.
32-bit applications can also access the native system directory by substituting %windir%\Sysnative for %windir%\System32. WOW64 recognizes Sysnative as a special alias used to indicate that the file system should not redirect the access. This mechanism is flexible and easy to use, therefore, it is the recommended mechanism to bypass file system redirection. Note that 64-bit applications cannot use the Sysnative alias as it is a virtual directory not a real one.
Details: http://msdn.microsoft.com/en-us/library/aa384187(VS.85).aspx
AddExtender("WWWNT34I.DLL") sPath = 'c:\Windows\System32\Test' ; Disable redirect oldvalue = IntControl( 92, "disable", 0, 0, 0 ) ;Delete and recreate directory if DirExist(sPath) then DirRemove(sPath) DirMake(sPath) ;Add permissions wntAccessAdd("", sPath, "Users", 300, "Dir:Change") Pause(sPath,"Successfully applied permissions") ; Remove test directory DirRemove(sPath) Pause(sPath,"Successfully removed directoy") ; Enable redirect IntControl( 92, "revert", oldvalue, 0, 0 )
Instead of using IntControl 92, use 'Sysnative' where you mean 'system32' in the file paths and all is well i.e.,
sPath = 'c:\Windows\Sysnative\Test'
Complete example:
AddExtender("WWWNT34I.DLL") sPath = 'c:\Windows\Sysnative\Test' ; Notice the use of Sysnative ;Delete and recreate directory if DirExist(sPath) then DirRemove(sPath) DirMake(sPath) ;Add permissions wntAccessAdd("", sPath, "Users", 300, "Dir:Change") Pause(sPath,"Successfully applied permissions") ; Remove test directory DirRemove(sPath) Pause(sPath,"Successfully removed test directoy")
Article ID: W17645
Filename: File Redirection.txt
File Created: 2012:10:18:08:34:20
Last Updated: 2012:10:18:08:34:20