Check the Arquitecture of Files and DLLs

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
306
Reaction score
77
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 Posts

Latest Profile Posts

Feel free to check out our "Touch the Stars" gamejam submission, "Starlight, Starbright!"
just finished playing one shot. im kinda disappointed with return the sun ending ngl. i was hoping there would be some after credits scene that would play with my emotions
So apparently the surprise Google Search page browser game saves your progress when you close the browser.

This really makes me miss the golden age of Flash gaming.
ohh man im ending oneshot now (im doing the last stepping puzzle rn) and the music is so...sad...like...ive been thinking recently about how fast moments pass and...my anxious thoughts combined with that music and nostalgia...like...im comfortably sad...and want to cry internally
We're playing one of the Touch the Stars game jam entries, come join us!

Forum statistics

Threads
113,552
Messages
1,075,790
Members
147,551
Latest member
ananansy
Top