Check the Arquitecture of Files and DLLs

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
138
Reaction score
30
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Small rant: While using SRD Hud maker for a battle hud, I typed in the wrong script call and got an error, but then forgot to delete the piece that caused the error before closed the Hud maker and hit F5 to restart the game. Now everytime I engage in a battle my game crashes...
:kaolivid:
Would Jump into Javascript be best off continuing to break down the MV core files, or would people prefer a quick detour to cover everything that's changed in the core from MV to MZ?
Not going to lie... PIXI Particles make fantastic graphics... But predicting the hitbox of something with a "fixed size" but whose graphics can stick out past that, is quite challenging. :kaoswt:
Would you like a glass of spiders?

Forum statistics

Threads
100,530
Messages
976,896
Members
132,081
Latest member
Kaezyelnatz
Top