PROCESS-ARCHITECTURE function Identifies the bit value of the AVM process you are using at run time and returns this value as an INTEGER. Valid values are 32 for a 32-bit AVM and 64 for 64-bit AVM. For example, an application that uses a 32-bit Windows API through the DLL external procedure interface may need to pass different parameters to a function when running a 64-bit GUI client than when running a 32-bit GUI client. Using PROCESS-ARCHITECTURE, you can decide the parameters to pass. Syntax PROCESS-ARCHITECTURE Example This procedure displays a message indicating whether the AVM is a 32-bit or 64-bit process, whether the process is running on a 32-bit or 64-bit Windows machine: r-prbits.p DEFINE VARIABLE hProcess AS INTEGER NO-UNDO. DEFINE VARIABLE Wow64Process AS INTEGER NO-UNDO. DEFINE VARIABLE resultValue AS INTEGER NO-UNDO. IF PROCESS-ARCHITECTURE = 64 THEN /* 64-bit processes always run on 64-bit Windows */ MESSAGE "64-bit process running on 64-bit Windows". ELSE DO: /* If a 32-bit process is running under WOW64 it must be ** running on 64-bit Windows. Otherwise, it is running on ** 32-bit Windows. */ RUN GetCurrentProcess(OUTPUT hProcess). RUN IsWow64Process(hProcess, INPUT-OUTPUT Wow64Process, OUTPUT resultValue). MESSAGE "32-bit process running on " + (IF Wow64Process > 0 THEN "64" ELSE "32") + "-bit Windows". END. PROCEDURE GetCurrentProcess EXTERNAL "kernel32.dll": DEFINE RETURN PARAMETER hProcess AS LONG. END. PROCEDURE IsWow64Process EXTERNAL "kernel32.dll": DEFINE INPUT PARAMETER hProcess AS LONG. DEFINE INPUT-OUTPUT PARAMETER Wow64Process AS HANDLE TO LONG. DEFINE RETURN PARAMETER resultValue AS LONG. END. Notes This function has a corresponding preprocessor. {&PROCESS-ARCHITECTURE} expands to either "32" or "64". See also { } Preprocessor name reference
PROCESS-ARCHITECTURE
DEFINE VARIABLE hProcess AS INTEGER NO-UNDO.
DEFINE VARIABLE Wow64Process AS INTEGER NO-UNDO.
DEFINE VARIABLE resultValue AS INTEGER NO-UNDO.
IF PROCESS-ARCHITECTURE = 64 THEN
/* 64-bit processes always run on 64-bit Windows */
MESSAGE "64-bit process running on 64-bit Windows".
ELSE DO:
/* If a 32-bit process is running under WOW64 it must be
** running on 64-bit Windows. Otherwise, it is running on
** 32-bit Windows.
*/
RUN GetCurrentProcess(OUTPUT hProcess).
RUN IsWow64Process(hProcess, INPUT-OUTPUT Wow64Process, OUTPUT resultValue).
MESSAGE "32-bit process running on " + (IF Wow64Process > 0 THEN "64" ELSE "32") + "-bit Windows".
END.
PROCEDURE GetCurrentProcess EXTERNAL "kernel32.dll":
DEFINE RETURN PARAMETER hProcess AS LONG.
PROCEDURE IsWow64Process EXTERNAL "kernel32.dll":
DEFINE INPUT PARAMETER hProcess AS LONG.
DEFINE INPUT-OUTPUT PARAMETER Wow64Process AS HANDLE TO LONG.
DEFINE RETURN PARAMETER resultValue AS LONG.