Author Topic: Test for 32 vs 64 bit  (Read 17689 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2081
Test for 32 vs 64 bit
« on: September 08, 2008, 11:17:25 AM »
How would I test within a lisp routine to check for 32 vs 64 bit operaring system?

I need to load different arx files based on the test above.

Here are the two files I need to check for:
DOSLib17.arx
DOSLib17x64.arx


Code: [Select]
(defun ARCH:DOSLIBLOADER  ()
  (cond ((and (>= (distof (substr (getvar "acadver") 1 4)) 15.0)
              (< (distof (substr (getvar "acadver") 1 4)) 16.0))
         (if (not (member "doslib2k.arx" (arx)))
           (arxload (findfile (strcat ARCH#SUPF "V_15\\doslib2k.arx")))))

        ((and (>= (distof (substr (getvar "acadver") 1 4)) 16.0)
              (< (distof (substr (getvar "acadver") 1 4)) 17.0))       
         (if (not (member "doslib2004.arx" (arx)))
           (arxload (findfile (strcat ARCH#SUPF "V_16\\doslib2004.arx")))))

        ((and (>= (distof (substr (getvar "acadver") 1 4)) 17.0)
              (< (distof (substr (getvar "acadver") 1 4)) 18.0))       
         (if (not (member "DOSLib17.arx" (arx)))
           (arxload (findfile (strcat ARCH#SUPF "V_17\\DOSLib17.arx")))))

        ((and (>= (distof (substr (getvar "acadver") 1 4)) 18.0)
              (< (distof (substr (getvar "acadver") 1 4)) 19.0))       
         (if (not (member "DOSLib17.arx" (arx)))
           (arxload (findfile (strcat ARCH#SUPF "V_18\\DOSLib17.arx")))))
  )
  (princ))

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Test for 32 vs 64 bit
« Reply #1 on: September 08, 2008, 11:34:26 AM »
This isn't necessarily a foolproof method, but you could check for the existance of C:\Program Files(x86) ... on all 64 bit systems, 32bit programs are installed in the C:\Program Files(x36) folder, while 64 bit programs are installed in C:\Program Files
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Spike Wilbury

  • Guest
Re: Test for 32 vs 64 bit
« Reply #2 on: September 08, 2008, 11:39:12 AM »
Gary,

Not of much, help I know... but

If I remember right, the guys from OpenDCL, have an autolisp function for this....

VovKa

  • Water Moccasin
  • Posts: 1628
  • Ukraine
Re: Test for 32 vs 64 bit
« Reply #3 on: September 08, 2008, 11:44:22 AM »
running 32bit
so i can not say for sure but you may try any of these
Code: [Select]
(vl-registry-read "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion" "ProductName")
(getenv "PROCESSOR_ARCHITECTURE")
(getenv "OS")

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Test for 32 vs 64 bit
« Reply #4 on: September 08, 2008, 11:56:43 AM »
Would this not work? [Not Tested]
Code: [Select]
        ((and (>= (distof (substr (getvar "acadver") 1 4)) 18.0)
              (< (distof (substr (getvar "acadver") 1 4)) 19.0))       
         (if (not (or (member "DOSLib17.arx" (arx))(member "DOSLib17x64.arx" (arx))))
           (or (arxload (findfile (strcat ARCH#SUPF "V_18\\DOSLib17x64.arx")))
                (arxload (findfile (strcat ARCH#SUPF "V_18\\DOSLib17.arx"))))))

<edit>
Now that I think about the situation, you may have the file present but not the resource. :oops:
« Last Edit: September 08, 2008, 01:36:51 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Test for 32 vs 64 bit
« Reply #5 on: September 08, 2008, 11:57:32 AM »
VovKa, That is a good push in the right direction ... this should work flawlessly ... returns 32 for 32 bit and 64 for 64 bit

Code: [Select]
(if (= (getenv "PROCESSOR_ARCHITEW6432") nil)
    32
    64
)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

mjguzik

  • Newt
  • Posts: 30
Re: Test for 32 vs 64 bit
« Reply #6 on: September 08, 2008, 12:35:59 PM »
Maybe this will provide you the information needed:

http://through-the-interface.typepad.com/through_the_interface/2007/04/loading_the_rig.html

At the bottom you will find a modified arxload function to test between 32 or 64 bit.

MJG

GDF

  • Water Moccasin
  • Posts: 2081
Re: Test for 32 vs 64 bit
« Reply #7 on: September 08, 2008, 01:37:15 PM »
Would this not work? [Not Tested]
Code: [Select]
        ((and (>= (distof (substr (getvar "acadver") 1 4)) 18.0)
              (< (distof (substr (getvar "acadver") 1 4)) 19.0))       
         (if (not (or (member "DOSLib17.arx" (arx))(member "DOSLib17x64.arx" (arx))))
           (or (arxload (findfile (strcat ARCH#SUPF "V_18\\DOSLib17x64.arx")))
                (arxload (findfile (strcat ARCH#SUPF "V_18\\DOSLib17.arx"))))))

<edit>
Now that I think about the situation, you may have the file present but not the resource. :oops:



Thanks Alan, this worked.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Test for 32 vs 64 bit
« Reply #8 on: September 08, 2008, 01:37:45 PM »
Maybe this will provide you the information needed:

http://through-the-interface.typepad.com/through_the_interface/2007/04/loading_the_rig.html

At the bottom you will find a modified arxload function to test between 32 or 64 bit.

MJG


Thanks for the link, I will have to dig into it.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Test for 32 vs 64 bit
« Reply #9 on: September 08, 2008, 02:01:16 PM »
Gary, all versions of Windows create environment variables that determine what kind of processor architecture is running. If it is a 64 bit process you will always find PROCESSOR_ARCHITEW6432 in the environment variables, however, it will be nonexistant on 32 bit operating systems, therefore you can readily tell if the OS is running a 64 bit process or 32 bit. All windows will have the environment variable PROCESSOR_ARCHITECTURE, but you would need to verify the value against a set of unknowns.

The mere existance of PROCESSOR_ARCHITEW6432 assures you that you have a 64 bit OS running so the result would be effective.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

VovKa

  • Water Moccasin
  • Posts: 1628
  • Ukraine
Re: Test for 32 vs 64 bit
« Reply #10 on: September 08, 2008, 02:17:05 PM »
The mere existance of PROCESSOR_ARCHITEW6432 assures you that you have a 64 bit OS running so the result would be effective.
cool Keith™, i'll save it in my "in case of" notes

GDF

  • Water Moccasin
  • Posts: 2081
Re: Test for 32 vs 64 bit
« Reply #11 on: September 08, 2008, 02:25:40 PM »
Gary, all versions of Windows create environment variables that determine what kind of processor architecture is running. If it is a 64 bit process you will always find PROCESSOR_ARCHITEW6432 in the environment variables, however, it will be nonexistant on 32 bit operating systems, therefore you can readily tell if the OS is running a 64 bit process or 32 bit. All windows will have the environment variable PROCESSOR_ARCHITECTURE, but you would need to verify the value against a set of unknowns.

The mere existance of PROCESSOR_ARCHITEW6432 assures you that you have a 64 bit OS running so the result would be effective.


Thanks. I am playing around with and testing autocad 2009 on windows xp 64 bit on a backup machine.

So far I think autocad 09 is ___ well lets just say, I think I'll keep on 2008 for a while longer.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Test for 32 vs 64 bit
« Reply #12 on: September 08, 2008, 02:47:28 PM »
Do you have the 64 bit version of AutoCAD running? If not then I am not sure you can run the 64bit arx modules.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

GDF

  • Water Moccasin
  • Posts: 2081
Re: Test for 32 vs 64 bit
« Reply #13 on: September 08, 2008, 03:06:30 PM »
Do you have the 64 bit version of AutoCAD running? If not then I am not sure you can run the 64bit arx modules.

Yes I have 2009 running with all of my customization "arch program" on a 64 bit window xp machine. The DOSLib17x64.arx file loads ok...used CAB's code.
I'm looking for an acetutil.arx 64 bit version.

Everything seems to be running ok, just a very minor glitches.

My first impression is that it takes longer to open drawing files, and I don't like autocads new menu interface.

My goal is to update my "arch program" custom routines to be able to run either a 32 or 64 bit operating system.

Gary
« Last Edit: September 08, 2008, 03:09:40 PM by Gary Fowler »
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Test for 32 vs 64 bit
« Reply #14 on: September 08, 2008, 03:09:28 PM »
Expresstools for 64bit ... hmmm ... might be hard to come by ... will the 32bit modules not load?
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie