Eagle
08-23-2007, 02:22 PM
These may help in getting some specific IR runtime 'actions' or other
functionality to behave in your APPS - as usual fully test before Market
Global Functions: -- place in Global Functions scripting Window
--sProcArch
function GetCPUArch()
--to return(formatted string) the Operating system Architecture type
local sArch = "x86";
local sREnvKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
local Arch = String.Lower(Registry.GetValue(3, sREnvKey, "PROCESSOR_ARCHITECTURE", false));
if (Arch == "amd64") then
sArch = "x64";
elseif (Arch == "ia64") then
sArch = "IA64";
end
return sArch;
end
--eProcArch
--sWOW64 DIS-EN
function DisableWow64ReDirect()
--to disable the wow64 file system redirection of your APP(the IR 32bit 'runtime.exe')
if(not bWow64Disabled)then
local sr = DLL.CallFunction(_WindowsFolder.."\\SysWOW64\\kernel32.dll", "Wow64DisableWow64FsRedirection", "\""..Application.GetWndHandle().."\"", 1, 1);
bWow64Disabled = true; --global
end
end
function EnableWow64ReDirect()
--to restore\re-enable the wow64 file system redirection of your APP(the IR 32bit 'runtime.exe')
if(bWow64Disabled)then
local sr = DLL.CallFunction(_WindowsFolder.."\\SysWOW64\\kernel32.dll", "Wow64RevertWow64FsRedirection", "\""..Application.GetWndHandle().."\"", 1, 1);
bWow64Disabled = nil; --global
end
end
--eWOW64 DIS-EN
some example calls-uses:
--example Os Architecture:
Os_Arc = GetCPUArch(); -- Global to APP - to get the Operating system Architecture -string (x86,x64,IA64)
--one suggested method:
local bIS64Bit = System.Is64BitOS(); --could make this global to APP
if bIS64Bit then
Os_Arc = GetCPUArch(); --(wow64 influences on 32bit applications)
else
Os_Arc = "x86";
end
if (Os_Arc == "IA64") then
-- is ia64 type OS (wow64 influences on 32bit applications)
--do something here
Dialog.Message("System Architecture", Os_Arc);
elseif (Os_Arc == "x64") then
-- is x64 type OS (wow64 influences on 32bit applications)
--do something here
Dialog.Message("System Architecture", Os_Arc);
elseif (Os_Arc == "x86") then
--is 32 bit Os
-- do something here
Dialog.Message("System Architecture", Os_Arc);
end
--example using File System Redirection control ONLY if confirmed 64bit OS
local bIS64Bit = System.Is64BitOS();
if (bIS64Bit) then
DisableWow64ReDirect(); --call to disable wow64 fs redirection(if not) for the IR 32bit 'runtime.exe'
--you now have access to 64 bit system resources(based on 'wow64' OS functionality)
--perform required action-s here, when completed reccommend revert\re-enable immeditaley--
EnableWow64ReDirect(); --call to revert\re-enable wow64 fs redirection(if not) for the IR 32bit 'runtime.exe'
--you no longer have access to 64 bit system resources(based on 'wow64' OS functionality)
end
hth
functionality to behave in your APPS - as usual fully test before Market
Global Functions: -- place in Global Functions scripting Window
--sProcArch
function GetCPUArch()
--to return(formatted string) the Operating system Architecture type
local sArch = "x86";
local sREnvKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
local Arch = String.Lower(Registry.GetValue(3, sREnvKey, "PROCESSOR_ARCHITECTURE", false));
if (Arch == "amd64") then
sArch = "x64";
elseif (Arch == "ia64") then
sArch = "IA64";
end
return sArch;
end
--eProcArch
--sWOW64 DIS-EN
function DisableWow64ReDirect()
--to disable the wow64 file system redirection of your APP(the IR 32bit 'runtime.exe')
if(not bWow64Disabled)then
local sr = DLL.CallFunction(_WindowsFolder.."\\SysWOW64\\kernel32.dll", "Wow64DisableWow64FsRedirection", "\""..Application.GetWndHandle().."\"", 1, 1);
bWow64Disabled = true; --global
end
end
function EnableWow64ReDirect()
--to restore\re-enable the wow64 file system redirection of your APP(the IR 32bit 'runtime.exe')
if(bWow64Disabled)then
local sr = DLL.CallFunction(_WindowsFolder.."\\SysWOW64\\kernel32.dll", "Wow64RevertWow64FsRedirection", "\""..Application.GetWndHandle().."\"", 1, 1);
bWow64Disabled = nil; --global
end
end
--eWOW64 DIS-EN
some example calls-uses:
--example Os Architecture:
Os_Arc = GetCPUArch(); -- Global to APP - to get the Operating system Architecture -string (x86,x64,IA64)
--one suggested method:
local bIS64Bit = System.Is64BitOS(); --could make this global to APP
if bIS64Bit then
Os_Arc = GetCPUArch(); --(wow64 influences on 32bit applications)
else
Os_Arc = "x86";
end
if (Os_Arc == "IA64") then
-- is ia64 type OS (wow64 influences on 32bit applications)
--do something here
Dialog.Message("System Architecture", Os_Arc);
elseif (Os_Arc == "x64") then
-- is x64 type OS (wow64 influences on 32bit applications)
--do something here
Dialog.Message("System Architecture", Os_Arc);
elseif (Os_Arc == "x86") then
--is 32 bit Os
-- do something here
Dialog.Message("System Architecture", Os_Arc);
end
--example using File System Redirection control ONLY if confirmed 64bit OS
local bIS64Bit = System.Is64BitOS();
if (bIS64Bit) then
DisableWow64ReDirect(); --call to disable wow64 fs redirection(if not) for the IR 32bit 'runtime.exe'
--you now have access to 64 bit system resources(based on 'wow64' OS functionality)
--perform required action-s here, when completed reccommend revert\re-enable immeditaley--
EnableWow64ReDirect(); --call to revert\re-enable wow64 fs redirection(if not) for the IR 32bit 'runtime.exe'
--you no longer have access to 64 bit system resources(based on 'wow64' OS functionality)
end
hth