mirror of
https://codeberg.org/unspeaker/vestal.git
synced 2025-12-06 08:36:41 +01:00
try another library
This commit is contained in:
parent
8946a571ae
commit
33546ccfb4
4 changed files with 465 additions and 93 deletions
352
Cargo.lock
generated
352
Cargo.lock
generated
|
|
@ -8,6 +8,21 @@ version = "2.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
||||
|
||||
[[package]]
|
||||
name = "android-tzdata"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.12.1"
|
||||
|
|
@ -67,18 +82,74 @@ dependencies = [
|
|||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.30"
|
||||
|
|
@ -112,6 +183,21 @@ version = "1.0.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.4.2"
|
||||
|
|
@ -121,12 +207,39 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "exe"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37f6e4213f515539932c53cd36a87ad8296bb8b2bea7f71b27438b811ad64392"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"byteorder",
|
||||
"chrono",
|
||||
"hex",
|
||||
"md-5",
|
||||
"num-traits",
|
||||
"pkbuffer",
|
||||
"sha-1",
|
||||
"sha2",
|
||||
"widestring",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.35"
|
||||
|
|
@ -143,6 +256,16 @@ version = "0.1.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f"
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.2"
|
||||
|
|
@ -152,6 +275,12 @@ dependencies = [
|
|||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "hexy"
|
||||
version = "0.1.4"
|
||||
|
|
@ -161,6 +290,29 @@ dependencies = [
|
|||
"ansi_term",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys",
|
||||
"iana-time-zone-haiku",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"windows-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone-haiku"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.7.1"
|
||||
|
|
@ -182,7 +334,7 @@ name = "jack"
|
|||
version = "0.13.0"
|
||||
source = "git+https://codeberg.org/unspeaker/rust-jack#a13c1c4d20343e574787a703eaeea7aeda63b084"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 2.8.0",
|
||||
"jack-sys",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
|
|
@ -194,7 +346,7 @@ name = "jack-sys"
|
|||
version = "0.5.1"
|
||||
source = "git+https://codeberg.org/unspeaker/rust-jack#a13c1c4d20343e574787a703eaeea7aeda63b084"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 2.8.0",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"libloading",
|
||||
|
|
@ -202,6 +354,16 @@ dependencies = [
|
|||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.77"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.5.0"
|
||||
|
|
@ -230,6 +392,17 @@ version = "0.4.25"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
|
||||
|
||||
[[package]]
|
||||
name = "md-5"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"digest",
|
||||
"opaque-debug",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.4"
|
||||
|
|
@ -245,6 +418,15 @@ dependencies = [
|
|||
"adler2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.7"
|
||||
|
|
@ -265,6 +447,33 @@ version = "1.20.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
|
||||
|
||||
[[package]]
|
||||
name = "opaque-debug"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
|
||||
|
||||
[[package]]
|
||||
name = "pkbuffer"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfc2d171e6bab0498ea5f696960ea3647194a0549b12af99070f1e4cf6d62d94"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"pkbuffer_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkbuffer_derive"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c86ad26b9715c9c1664b79f6e5c44baf38fb87a5133bdd7ec90baff7b71d155"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.31"
|
||||
|
|
@ -295,6 +504,12 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
|
||||
|
||||
[[package]]
|
||||
name = "ruzstd"
|
||||
version = "0.7.3"
|
||||
|
|
@ -321,7 +536,7 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.98",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -332,9 +547,41 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.98",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha-1"
|
||||
version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
"opaque-debug",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.9.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
"opaque-debug",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
|
|
@ -347,6 +594,17 @@ version = "0.11.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.98"
|
||||
|
|
@ -386,6 +644,12 @@ dependencies = [
|
|||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.17"
|
||||
|
|
@ -398,11 +662,18 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "vestal"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"exe",
|
||||
"hexy",
|
||||
"object",
|
||||
"pretty-hex",
|
||||
|
|
@ -416,6 +687,70 @@ dependencies = [
|
|||
"tek_jack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.100"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"rustversion",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.100"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.100"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.100"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.100"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "widestring"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
|
@ -438,6 +773,15 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ syscalls = "0.6.18"
|
|||
object = { version = "0.36.7", features = [ "read_core", "write_core", "elf", "pe" ] }
|
||||
hexy = "0.1.4"
|
||||
pretty-hex = "0.4.1"
|
||||
#exe = "0.5.6"
|
||||
exe = "0.5.6"
|
||||
#elf = "0.7.4"
|
||||
#goblin = "0.9.3"
|
||||
#lancelot = "0.9.7"
|
||||
|
|
|
|||
|
|
@ -14,9 +14,11 @@ fn main () -> Usually<()> {
|
|||
let mut vestal = Vestal::default();
|
||||
vestal.search_paths.push(std::env::current_dir()?);
|
||||
vestal.search_paths.push("/home/user/Lab/Cosmo/wineprefix/drive_c/windows/system32".into());
|
||||
for path in vestal.search_paths.iter() {
|
||||
println!("(search {path:?})")
|
||||
}
|
||||
if let Some(path) = vestal.resolve(path.to_str().expect("path must be unicode"))? {
|
||||
vestal.load(&path)?;
|
||||
vestal.inspect();
|
||||
vestal.run_main(&path)?;
|
||||
} else {
|
||||
panic!("Could not find: {path:?}")
|
||||
|
|
@ -28,12 +30,13 @@ fn main () -> Usually<()> {
|
|||
}
|
||||
#[derive(Default, Debug)]
|
||||
struct Vestal {
|
||||
search_paths: Vec<PathBuf>,
|
||||
paths_visited: HashSet<Arc<PathBuf>>,
|
||||
path_to_bang: HashMap<Arc<PathBuf>, Arc<[u8]>>,
|
||||
path_to_data: HashMap<Arc<PathBuf>, Arc<[u8]>>,
|
||||
path_to_exports: HashMap<Arc<PathBuf>, Vec<Export>>,
|
||||
path_to_imports: HashMap<Arc<PathBuf>, Vec<Import>>,
|
||||
search_paths: Vec<PathBuf>,
|
||||
paths_visited: HashSet<Arc<PathBuf>>,
|
||||
path_to_bang: HashMap<Arc<PathBuf>, Arc<[u8]>>,
|
||||
path_to_data: HashMap<Arc<PathBuf>, Arc<[u8]>>,
|
||||
path_to_pe: HashMap<Arc<PathBuf>, Arc<VecPE>>,
|
||||
//path_to_exports: HashMap<Arc<PathBuf>, Vec<ImageExportDescriptor>>,
|
||||
//path_to_imports: HashMap<Arc<PathBuf>, Vec<ImageImportDescriptor>>,
|
||||
}
|
||||
#[derive(Debug)]
|
||||
struct Export {
|
||||
|
|
@ -76,93 +79,117 @@ impl Vestal {
|
|||
let path = Arc::new(path.clone());
|
||||
println!("(load {path:?})");
|
||||
self.paths_visited.insert(path.clone());
|
||||
let (bang, data) = slice_shebang(read(path.as_path())?.as_slice());
|
||||
self.path_to_bang.insert(path.clone(), bang.into());
|
||||
self.path_to_data.insert(path.clone(), data.clone().into());
|
||||
let dll: PeFile<'_, ImageNtHeaders64, &[u8]> = PeFile::parse(data.as_slice())?;
|
||||
if let Some(exports) = dll.export_table()? {
|
||||
let mut collected = vec![];
|
||||
for export_ref in exports.exports()?.iter() {
|
||||
collected.push(Export {
|
||||
id: export_ref.ordinal,
|
||||
name: export_ref.name.map(|name|name.into()),
|
||||
target: match export_ref.target {
|
||||
ExportTarget::Address(addr) =>
|
||||
Target::Addr(addr),
|
||||
ExportTarget::ForwardByName(dll, name) =>
|
||||
Target::Name(dll.into(), name.into()),
|
||||
_ =>
|
||||
todo!("unsupported export target {:?}", &export_ref.target)
|
||||
}
|
||||
});
|
||||
}
|
||||
self.path_to_exports.insert(path.clone(), collected);
|
||||
}
|
||||
if let Some(imports) = dll.import_table()? {
|
||||
let mut collected = vec![];
|
||||
for import in imports.descriptors()? {
|
||||
let name = imports.name(import?.name.get(LittleEndian))?.to_vec();
|
||||
let name = String::from_utf8(name.to_vec())?;
|
||||
let name = name.to_lowercase();
|
||||
if let Some(path) = self.resolve(&name)? {
|
||||
if !self.paths_visited.contains(&path) {
|
||||
//println!("(import {name:?})");
|
||||
self.load(&path)?;
|
||||
}
|
||||
} else {
|
||||
panic!("not found: {name:?}");
|
||||
}
|
||||
}
|
||||
self.path_to_imports.insert(path.clone(), collected);
|
||||
}
|
||||
let data = self.load_bang_data(&path)?;
|
||||
let dll = self.load_pe(&path, &data)?;
|
||||
let imports = self.load_imports(&path, &dll);
|
||||
let exports = self.load_exports(&path, &dll);
|
||||
println!("(entrypoint {:?})", dll.get_entrypoint()?);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
fn inspect (&self) {
|
||||
for path in self.search_paths.iter() {
|
||||
println!("(search {path:?})")
|
||||
}
|
||||
for path in self.paths_visited.iter() {
|
||||
println!("(visited {path:?})")
|
||||
}
|
||||
for (path, bang) in self.path_to_bang.iter() {
|
||||
if bang.len() > 0 {
|
||||
println!("(bang {path:?} {:x})", bang.len())
|
||||
fn load_imports (&mut self, path: &PathBuf, dll: &VecPE) -> Usually<()> {
|
||||
let directory = ImportDirectory::parse(dll)?;
|
||||
for descriptor in directory.descriptors {
|
||||
print!(" (module {} ", descriptor.get_name(dll)?.as_str()?);
|
||||
for import in descriptor.get_imports(dll)? {
|
||||
match import {
|
||||
ImportData::Ordinal(x) => print!("\n (ordi 0x{x:>04x})"),
|
||||
ImportData::ImportByName(n) => print!("\n (name {n})"),
|
||||
}
|
||||
}
|
||||
println!(")")
|
||||
}
|
||||
for (path, data) in self.path_to_data.iter() {
|
||||
println!("(buffer {:p} 0x{:08x} {path:?})", data.as_ptr(), data.len())
|
||||
}
|
||||
for (path, exports) in self.path_to_exports.iter() {
|
||||
//println!("(exports {path:?}\n {exports:?})")
|
||||
}
|
||||
for (path, imports) in self.path_to_imports.iter() {
|
||||
//print!("(imports {path:?}");
|
||||
//for import in imports.iter() {
|
||||
//print!("\n {import:?}");
|
||||
//}
|
||||
//println!(")");
|
||||
Ok(())
|
||||
}
|
||||
fn load_exports (&mut self, path: &PathBuf, dll: &VecPE) -> Usually<()> {
|
||||
Ok(())
|
||||
}
|
||||
fn load_bang_data (&mut self, path: &Arc<PathBuf>) -> Usually<Arc<[u8]>> {
|
||||
let (bang, data) = slice_shebang(read(path.as_path())?.as_slice());
|
||||
self.path_to_bang.insert(path.clone(), bang.clone());
|
||||
if bang.len() > 0 {
|
||||
println!("(bang {path:?} {:x})", bang.len())
|
||||
}
|
||||
self.path_to_data.insert(path.clone(), data.clone());
|
||||
println!("(buffer {:p} 0x{:08x} {path:?})", data.as_ptr(), data.len());
|
||||
Ok(data)
|
||||
}
|
||||
fn load_pe (&mut self, path: &Arc<PathBuf>, data: &Arc<[u8]>) -> Usually<Arc<VecPE>> {
|
||||
let pe = Arc::new(VecPE::from_disk_data(data));
|
||||
self.path_to_pe.insert(path.clone(), pe.clone());
|
||||
Ok(pe)
|
||||
}
|
||||
fn inspect (&self) {
|
||||
//for (path, exports) in self.path_to_exports.iter() {
|
||||
////println!("(exports {path:?}\n {exports:?})")
|
||||
//}
|
||||
//for (path, imports) in self.path_to_imports.iter() {
|
||||
////print!("(imports {path:?}");
|
||||
////for import in imports.iter() {
|
||||
////print!("\n {import:?}");
|
||||
////}
|
||||
////println!(")");
|
||||
//}
|
||||
}
|
||||
fn run_main (&self, path: &PathBuf) -> Usually<()> {
|
||||
let data = self.path_to_data.get(path);
|
||||
let len = data.as_ref().unwrap().len();
|
||||
let data = data.as_ref().unwrap();
|
||||
println!();
|
||||
println!("{:?}", data[0..512].hex_dump());
|
||||
println!("{:?}", data[0..256].hex_dump());
|
||||
println!();
|
||||
let exports = self.path_to_exports.get(path).expect("no exports");
|
||||
for export in exports.iter() {
|
||||
if export.name_string() == Some("VSTPluginMain".to_string()) {
|
||||
println!("{export:?}");
|
||||
println!("{}", export.name_string().unwrap());
|
||||
let addr = (export.addr() as usize);
|
||||
println!();
|
||||
println!("{:?}", data[addr..addr+512].hex_dump());
|
||||
println!();
|
||||
return Ok(())
|
||||
}
|
||||
}
|
||||
panic!("no main");
|
||||
//let exports = self.path_to_exports.get(path).expect("no exports");
|
||||
//for export in exports.iter() {
|
||||
//if export.name_string() == Some("VSTPluginMain".to_string()) {
|
||||
//println!("{export:?}");
|
||||
//println!("{}", export.name_string().unwrap());
|
||||
//let addr = (export.addr() as usize);
|
||||
//println!();
|
||||
//println!("{:?}", data[addr..addr+512].hex_dump());
|
||||
//println!();
|
||||
//return Ok(())
|
||||
//}
|
||||
//}
|
||||
//panic!("no main");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
//if let Some(exports) = dll.export_table()? {
|
||||
//let mut collected = vec![];
|
||||
//for export_ref in exports.exports()?.iter() {
|
||||
//collected.push(Export {
|
||||
//id: export_ref.ordinal,
|
||||
//name: export_ref.name.map(|name|name.into()),
|
||||
//target: match export_ref.target {
|
||||
//ExportTarget::Address(addr) =>
|
||||
//Target::Addr(addr),
|
||||
//ExportTarget::ForwardByName(dll, name) =>
|
||||
//Target::Name(dll.into(), name.into()),
|
||||
//_ =>
|
||||
//todo!("unsupported export target {:?}", &export_ref.target)
|
||||
//}
|
||||
//});
|
||||
//}
|
||||
//self.path_to_exports.insert(path.clone(), collected);
|
||||
//}
|
||||
//if let Some(imports) = dll.import_table()? {
|
||||
//let mut collected = vec![];
|
||||
//for import in imports.descriptors()? {
|
||||
//let name = imports.name(import?.name.get(LittleEndian))?.to_vec();
|
||||
//let name = String::from_utf8(name.to_vec())?;
|
||||
//let name = name.to_lowercase();
|
||||
//if let Some(path) = self.resolve(&name)? {
|
||||
//if !self.paths_visited.contains(&path) {
|
||||
////println!("(import {name:?})");
|
||||
//self.load(&path)?;
|
||||
//}
|
||||
//} else {
|
||||
//panic!("not found: {name:?}");
|
||||
//}
|
||||
//}
|
||||
//self.path_to_imports.insert(path.clone(), collected);
|
||||
//}
|
||||
//}
|
||||
//Ok(())
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -7,21 +7,22 @@ pub(crate) use std::fs::{read, canonicalize};
|
|||
//pub(crate) use ::lancelot::loader::pe::{PE, reloc::apply_relocations};
|
||||
//pub(crate) use ::goblin::{error, Object, pe::{import::Import, export::Export}};
|
||||
pub(crate) use ::object::endian::LittleEndian;
|
||||
pub(crate) use ::object::pe::ImageNtHeaders64;
|
||||
pub(crate) use ::object::read::pe::{PeFile, ExportTarget};
|
||||
//pub(crate) use ::object::pe::ImageNtHeaders64;
|
||||
//pub(crate) use ::object::read::pe::{PeFile, ExportTarget};
|
||||
pub(crate) use ::object::write::elf::Writer as ElfWriter;
|
||||
pub(crate) use ::pretty_hex::*;
|
||||
pub(crate) use ::exe::{PE, VecPE, PtrPE, types::*, headers::*};
|
||||
pub(crate) type Usually<T> = Result<T, Box<dyn std::error::Error>>;
|
||||
/// You can manually patch DLLs by prepending
|
||||
/// a `#!/usr/bin/env vestal` line to them.
|
||||
pub fn slice_shebang (buffer: &[u8]) -> (Vec<u8>, Vec<u8>) {
|
||||
pub fn slice_shebang (buffer: &[u8]) -> (Arc<[u8]>, Arc<[u8]>) {
|
||||
if buffer.get(0) == Some(&b'#') && buffer.get(1) == Some(&b'!') {
|
||||
if let Some((bang, data)) = buffer.split_once(|x|*x==0x0a) {
|
||||
(bang.to_vec(), data.to_vec())
|
||||
(bang.to_vec().into(), data.to_vec().into())
|
||||
} else {
|
||||
(buffer.to_vec(), vec![])
|
||||
(buffer.to_vec().into(), vec![].into())
|
||||
}
|
||||
} else {
|
||||
(vec![], buffer.to_vec())
|
||||
(vec![].into(), buffer.to_vec().into())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue