kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
357
Reaction score
101
First Language
English
Primarily Uses
RMXP
Check the Arquitecture of Files and DLLs with a Ruby script!

I'm posting this scriptlet here because it's not RGSS based but a common Ruby script so it might work on any version of RGSS in theory. You can also run it as a typical Ruby script on your PC in case you have already installed the Ruby interpreter there. Place the script in the same directory as the executable or DLL's and run it! Or paste it in the script editor as you'd do with any RGSS script, save your project and run it! :o

Usually the results would be either 32 bit (i386) or 64 bit (x64). I doubt any of you is currently running any Itanium based PC. :D

Code:
#!/usr/bin/env ruby
# Find out if your executables and libraries are compiled for a 32 or 64 bit architecture!
def arch_of(fn)
  f = File.open(fn,"rb")
  dos = f.read(64)
  magic, padding, offset = dos.unpack("a2a58l")
  if magic != "MZ"
    puts "This is neither an executable nor a library!"
    return
  end
  f.pos = offset
  hdr = f.read(6)
  sig, padding, machine = hdr.unpack("a2a2v")
  f.close
  if sig != "PE"
    return puts "File #{fn} has an unknown architecture..."
  end
  if machine == 0x014c
    puts fn + " architecture detected: i386"
  elsif machine == 0x0200
    puts fn + " architecture detected: IA64"
  elsif machine == 0x8664
    puts fn + " architecture detected: x64"
  else
    puts "File #{fn} has an unknown architecture..."
  end
end

filenames = Dir['*.exe'].sort + Dir['*.dll'].sort
filenames.each {|fn| arch_of(fn) }

NOTE: #!/usr/bin/env ruby line included in the script above means it can be run on Linux as well, just in case you ever wanted to know that...

Terms

You're free to use, it's free as in speech and as in beer!
I would appreciate if you include me in your credits.
 

Latest Threads

Latest Profile Posts

Day 2 of my redesign journey, as a follow up from the previous post :kaothx:
pXiRJSm.jpg

This is Cedric's son, Apollo!
New pet peeve: Telling tech support personnel what something is doing, only for them to tell me (in excessively condescending tones) what it should be doing. Yes, I know what it should be doing, and if it was doing that, I wouldn’t be talking to you and your attitude problem about it right now, would I? >.<
uglywolf wrote on Khulse's profile.
Hello.
The rules I makes pun about on your last thread is about "Verify Files" before anything else, if the stuff comes from STEAM. Which means, if it could be fixed with just that, there is no need to redownload the whole stuff.
But glad the reinstall worked, hope you enjoy it and your days too.
uh oh, I just tapped into a fresh, deep vein of nightmare fuel right here guys:

Forum statistics

Threads
115,432
Messages
1,089,815
Members
150,191
Latest member
georgeal365
Top