Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872

    64 Bit x64 IA64 some handy functions

    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

    Code:
    --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:

    Code:
    --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


    Code:
    --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

  2. #2
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    when using the WOW64 FS dis-en functions:
    * the key is to maintain the stability of the runtime *

    Very important to have the above in mind when performing
    any 64bit oriented system access - actions

    some things to keep in mind too:

    * IR Lan.actions do not work if FS is Disabled
    * Test Web connection does not Work if FS is Disabled
    * Web object functionality misbehaves if FS is Disabled

    fwiw

  3. #3
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,862
    Eagle: might want to check out this registry key:

    HKEY_LOCAL_MACHINE, "hardware\\DESCRIPTION\\system\\centralprocessor\\ "..x

    where x is 0 ... 1 ... 2 etc.

    seems to be a better reg to get cpu type.


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  4. #4
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    Josh, the above function was intended only to return Os Architecture,
    are you saying that it is failing in some way ? If it is could you expand...

    Yeah, for actual CPU 'friendly name' - description string, speed etc,
    I posted a func on the forum some ways back.

    the cpu 'friendly name' can be searched for "x86", "AMD64", "Itanium",
    however the 'Environment key is more in line with msdn docs, to id OS Arch:
    x86 or
    "AMD64" covers Both:
    AMD cpus (like opteron and later) x64 and
    Intel EMT64 supported(non itanium) x64 processors.

    or: "IA64" for intel Itanium type cpu's

    lemme know as mentioned if failing to ID the Architecture.
    (anyone else having issues , please post here tks )
    Last edited by Eagle; 08-31-2007 at 06:18 AM.

  5. #5
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,862
    didn't mean to imply that anything was wrong with your code...
    just to point out an option for identifing the arch in use -- the 1st word of identifier value is usually a lot more accurate than AMD when it's really intel 64bit....


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  6. #6
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    Sure, if you want-need that additional information

Similar Threads

  1. Tip: Access Global Functions Without Closing Action Editor
    By Corey in forum AutoPlay Media Studio 5.0 Examples
    Replies: 15
    Last Post: 12-16-2004, 09:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts