SQLite Forum

SQLite3.EXE
Login

SQLite3.EXE

(1) By anonymous on 2020-12-13 15:30:39 [source]

Is there a query or a property that I can interrogate from the CLI that will tell me whether I am using the 32- or 64-bit version?

(2.1) By Larry Brasfield (LarryBrasfield) on 2020-12-14 12:34:50 edited from 2.0 in reply to 1 [link] [source]

(Edited to avoid backslash molesting in code block.)

The SQLite CLI shell does not have such a feature.

However, the following Perl program would tell you (if run by Perl.) my $usage = <<'_'; Usage: exetype <Exe-file> ... For each file named, emit one line giving its name and .exe machine type. _ use strict; use IO::Handle; use Fcntl 'SEEK_SET';

if (@ARGV == 0){ print $usage; exit(0); }

my %machineTypes = ( 0x0 => 'Other', 0x1d3 => 'Matsushita AM33', 0x8664 => 'AMD/Intel x64', 0x1c0 => 'ARM little endian', 0xaa64 => 'ARM64 little endian', 0x1c4 => 'ARM Thumb-2 little endian', 0xebc => 'EFI byte code', 0x14c => 'Intel/AMD i386+', 0x200 => 'Intel Itanium processor family', 0x9041 => 'Mitsubishi M32R little endian', 0x266 => 'MIPS16', 0x366 => 'MIPS with FPU', 0x466 => 'MIPS16 with FPU', 0x1f0 => 'Power PC little endian', 0x1f1 => 'Power PC with floating point support', 0x166 => 'MIPS little endian', 0x5032 => 'RISC-V 32-bit address space', 0x5064 => 'RISC-V 64-bit address space', 0x5128 => 'RISC-V 128-bit address space', 0x1a2 => 'Hitachi SH3', 0x1a3 => 'Hitachi SH3 DSP', 0x1a6 => 'Hitachi SH4', 0x1a8 => 'Hitachi SH5', 0x1c2 => 'Thumb', 0x169 => 'MIPS little-endian WCE v2' ); my $efh; my $coffOffset; foreach my $efn (@ARGV){ if (!sysopen($efh, $efn, 'O_RDONLY')){ print stderr "Cannot read $efn\n"; next; } binmode($efh); my $pos = sysseek($efh, 0x3c, SEEK_SET); my $nr = sysread($efh, $coffOffset, 2); if ($nr != 2){ print "$efn\tOther\n"; close($efh); next; } my $cos = unpack('S', $coffOffset); $pos = sysseek($efh, $cos, SEEK_SET); my ($peSig, $peNs, $machine); $nr = sysread($efh, $peSig, 2); $nr += sysread($efh, $peNs, 2); $nr += sysread($efh, $machine, 2); my $ns = unpack('S', $peNs); if ($nr == 6 && $ns == 0 && $peSig eq 'PE'){ my $mtype = unpack('S', $machine); my $mt = $machineTypes{$mtype}; if (!defined($mt)){ $mt = 'Other'; } printf("$efn\tPE(%s)\n", $mt); } else{ print "$efn\tOther\n"; } close($efh); }

(3) By Gisbert (gisbert) on 2020-12-14 12:06:15 in reply to 2.0 [link] [source]

It seems a lot of backslashes in the Perl code were lost in transit.