topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 9:14 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: One config for x86 and x64  (Read 7321 times)

towlerg

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 18
    • View Profile
    • Donate to Member
One config for x86 and x64
« on: October 22, 2018, 11:20 AM »
I Love LBC, lost without it.

I have several PCs (weeeee lucky me) both x86 and x64. %ProgramFiles% wiii find c:\Program files on a x86 machine and C:\Program files (x86) on a x64 machine but NOT both C:\Program files and C:\Program files (x86).

I have some apps ie. Notepad++ runs as x86 on one machine and x64 on the other. Is there any way to have a LBC setup that will work in both cases?

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #1 on: October 22, 2018, 11:50 AM »
You're saying you have x86 Notepad++ on x64 Windows? That's quite common as not all npp plugins seem to work properly in an x64 install, so x86 npp is usually the wisest/safest choice.
Guess you'll have to play with the other %programfiles*% environment variables, or run npp from a batch file that validates where the exe is actually found and starts it from there.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #2 on: October 22, 2018, 05:03 PM »
Regarding running programs via a script/batch file, an alternative would be to run LBC via batch/script that checks the architecture of the OS and sets an environment variable with the appropriate path for the architecture.

Then preface those executables that can be either 32 or 64 bit with that variable rather than %programfiles%.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: One config for x86 and x64
« Reply #3 on: October 22, 2018, 05:38 PM »
Hmm this is an interesting point.

I'm assuming you are talking about when you create a LBC node to show the contents of a folder?

You can specify multiple folders to list the contents of by using a | character between them, so you could specify for the folder contents the directories explicitly:
c:\Program files | C:\Program files (x86)

And that should do it..

But I could make the %ProgramFiles% expand to do that automatically..

Can you confirm that this is what we're talking about?

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #4 on: October 23, 2018, 03:45 AM »
Regarding running programs via a script/batch file, an alternative would be to run LBC via batch/script that checks the architecture of the OS and sets an environment variable with the appropriate path for the architecture.

Then preface those executables that can be either 32 or 64 bit with that variable rather than %programfiles%.
Well, as the OP already stated, Windows does a fine job there, it's only 'problematic' when x86 apps are used on an x64 OS where there is also an x64 version of that same app available and in use, and configs should be shared.
I think @mouser is on the right track already.

towlerg

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 18
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #5 on: October 23, 2018, 10:09 AM »
Sorry I wasn't clear. I'm trying to create one set of config files that will work on both 32 bit and 64 bit OS's

Assuming that on 32bit OS all apps in C:\Program files and that on 64bit OS apps are either in C:\Program files or C:\Program files (x86).

If I replace C:\Program files with %\ProgramFiles% in an existing config, all x86 applications are available on both 32 and 64 bit OS's. But an application ie. Notepad+ which has an x86 version on the 32 bit OS and a x64 version on 64 bit OS is not available on the 64 bit OS.

Another way to describe it would be that %ProgramFiles% expands to C:\Program files on the 32 bit OS and C:\Program files (x86) on the 64 bit OS, but not also C:\Program files on the 64 bit OS. 

A truth table of my atempt to unify LBC configs on both 32 bit and 64 bit OS using the %ProgramFiles% replacment

32bit OS      x86 app     OK       
32bit OS      x64 app      -
64bit OS      x86 app     OK
64bit OS      x64 app     fails

I hope I haven't laboured the point but several posts can to different conclutions about my objective.

George

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #6 on: October 23, 2018, 10:14 AM »
My guess is, that LBC is 32bit; thats why it uses 32bit environment. (resulting that %ProgramFiles% lead to the x86 variant.) I re-check.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #7 on: October 23, 2018, 06:20 PM »
A truth table of my atempt to unify LBC configs on both 32 bit and 64 bit OS using the %ProgramFiles% replacment

32bit OS      x86 app     OK       
32bit OS      x64 app      -
64bit OS      x86 app     OK
64bit OS      x64 app     fails

So basically test for an executable under \Program Files first with fallback to an executable under \Program Files (x86) if not found in \Program Files.
« Last Edit: October 23, 2018, 06:36 PM by 4wd »

towlerg

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 18
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #8 on: October 23, 2018, 06:49 PM »
@4wd Yes, you made it sound so simple. I assume you're looking at a solution internal to LBC, whereas I thought perhaps I'd missed some clever OS function. Either ways fine with me.

So expand %FunctionFiles% into C:\Program Files, check for presence of exe, if found execute, else expand to C:\Program Files (x86), check for presence of exe, if found execute, else quit.
« Last Edit: October 23, 2018, 06:58 PM by towlerg »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #9 on: October 23, 2018, 07:07 PM »
@4wd Yes, you made it sound so simple. I assume you're looking at a solution internal to LBC, whereas I thought perhaps I'd missed some clever OS function. Either ways fine with me.

So expand %FunctionFiles% into C:\Program Files, check for presence of exe, if found execute, else expand to C:\Program Files (x86), check for presence of exe, if found execute, else quit.

It'd be simpler, (for the end user), to have mouser implement it in LBC, another alternative is to run an intermediate command/script that checks for the existence of an executable.

eg. .\TestX64.cmd \notepad++\notepad++.exe

TestX64.cmd would check Program Files and then Program Files (x86) prepending whichever was valid to the given parameter, eg. so for x64 system/app you'd end up with something like: %SYSTEMDRIVE%\Program Files\notepad++\notepad++.exe

I think whispering in mouser' ear is a nicer solution ;)

towlerg

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 18
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #10 on: October 25, 2018, 11:58 AM »
I think whispering in mouser' ear is a nicer solution

Me too.   w h i s p e r    w  h  i  s  p  e  r



Edit. If LBC could handle and the situation where an item defined by %ProgramFiles% on a 64bit OS is not found in C:\Program Files (x86), %ProgramFiles% could then be parsed as it is currently.
« Last Edit: October 26, 2018, 11:34 AM by towlerg »

towlerg

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 18
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #11 on: October 26, 2018, 11:51 AM »
Well this is embarassing, I've just realized that is I put C:\Program Files for x64 apps instead of %ProgramFiles% it works for both 64bit and 32bit OS's.

Oooppsy

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #12 on: October 26, 2018, 03:27 PM »
That's correct, be more versatile if that wasn't necessary though.

ie. No need to segregate x86 and x64 apps, one config will cover all cases.

towlerg

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 18
    • View Profile
    • Donate to Member
Re: One config for x86 and x64
« Reply #13 on: October 29, 2018, 02:21 PM »
ie. No need to segregate x86 and x64 apps, one config will cover all cases.

That would be great but unfortunatly some apps use a different name for the x64 executable ie Procexp.exe and Procexp64.exe (although I suppose you could rename them although that has problems also).

The ultimate solution is to have LBC have separate file selection for x64 and x32 apps.