DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: One config for x86 and x64  (Read 11,976 times)

towlerg

  • Participant
  • Joined in 2005
  • *
  • Posts: 18
One config for x86 and x64
« on: October 22, 2018, 04:20 PM »
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,649
    • Participated in NANY Challenge Eleven Times
    • Coding Snacks
    • Linux User
    • Hardware Hacker
Re: One config for x86 and x64
« Reply #1 on: October 22, 2018, 04:50 PM »
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.
/Ton
Ath's software collection, Quote: "A problem well stated is a problem half-solved." (Charles Kettering)

4wd

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: One config for x86 and x64
« Reply #2 on: October 22, 2018, 10: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%.
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: One config for x86 and x64
« Reply #3 on: October 22, 2018, 10: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,649
    • Participated in NANY Challenge Eleven Times
    • Coding Snacks
    • Linux User
    • Hardware Hacker
Re: One config for x86 and x64
« Reply #4 on: October 23, 2018, 08: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.
/Ton
Ath's software collection, Quote: "A problem well stated is a problem half-solved." (Charles Kettering)

towlerg

  • Participant
  • Joined in 2005
  • *
  • Posts: 18
Re: One config for x86 and x64
« Reply #5 on: October 23, 2018, 03:09 PM »
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
    • Participated in NANY Challenge Four Times
    • Coding Snacks
Re: One config for x86 and x64
« Reply #6 on: October 23, 2018, 03:14 PM »
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

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: One config for x86 and x64
« Reply #7 on: October 23, 2018, 11: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.
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903
« Last Edit: October 23, 2018, 11:36 PM by 4wd »

towlerg

  • Participant
  • Joined in 2005
  • *
  • Posts: 18
Re: One config for x86 and x64
« Reply #8 on: October 23, 2018, 11: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, 11:58 PM by towlerg »

4wd

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: One config for x86 and x64
« Reply #9 on: October 24, 2018, 12:07 AM »
@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 ;)
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903

towlerg

  • Participant
  • Joined in 2005
  • *
  • Posts: 18
Re: One config for x86 and x64
« Reply #10 on: October 25, 2018, 04:58 PM »
Quote
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, 04:34 PM by towlerg »

towlerg

  • Participant
  • Joined in 2005
  • *
  • Posts: 18
Re: One config for x86 and x64
« Reply #11 on: October 26, 2018, 04:51 PM »
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

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: One config for x86 and x64
« Reply #12 on: October 26, 2018, 08: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.
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903

towlerg

  • Participant
  • Joined in 2005
  • *
  • Posts: 18
Re: One config for x86 and x64
« Reply #13 on: October 29, 2018, 07:21 PM »
Quote
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.

Original address: https://www.donationcoder.com/forum/index.php?topic=46559.0