From b730f8abb67dccdadbbe19ca5a0d9d9e2f6ecb5d Mon Sep 17 00:00:00 2001 From: DeltaNeverUsed Date: Sun, 10 Nov 2024 19:25:23 +0100 Subject: [PATCH 1/3] Workaround Win32 loader lock --- Cargo.lock | 459 +++++++++++++----- Cargo.toml | 3 + loader/.cargo/config.toml | 2 + loader/Cargo.toml | 25 +- loader/rust-toolchain.toml | 2 + loader/src/export_indices.rs | 196 ++++++++ loader/src/intercepted_exports.rs | 57 +++ loader/src/lib.rs | 156 +++++- loader/src/orig_exports.rs | 308 ++++++++++++ loader/src/proxied_exports.rs | 762 ++++++++++++++++++++++++++++++ proxygen-macros/Cargo.toml | 17 + proxygen-macros/README.md | 3 + proxygen-macros/src/lib.rs | 350 ++++++++++++++ 13 files changed, 2206 insertions(+), 134 deletions(-) create mode 100644 loader/.cargo/config.toml create mode 100644 loader/rust-toolchain.toml create mode 100644 loader/src/export_indices.rs create mode 100644 loader/src/intercepted_exports.rs create mode 100644 loader/src/orig_exports.rs create mode 100644 loader/src/proxied_exports.rs create mode 100644 proxygen-macros/Cargo.toml create mode 100644 proxygen-macros/README.md create mode 100644 proxygen-macros/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 133059c..fe16a52 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -30,15 +30,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "arbitrary" -version = "1.3.2" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" dependencies = [ "derive_arbitrary", ] @@ -116,9 +116,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "bzip2" @@ -155,9 +155,9 @@ checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6" [[package]] name = "cc" -version = "1.1.30" +version = "1.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" +checksum = "40545c26d092346d8a8dab71ee48e7685a7a9cba76e634790c215b41a4a7b4cf" dependencies = [ "jobserver", "libc", @@ -170,6 +170,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "cipher" version = "0.4.4" @@ -263,16 +269,6 @@ dependencies = [ "quote", ] -[[package]] -name = "ctor" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" -dependencies = [ - "quote", - "syn 1.0.109", -] - [[package]] name = "cty" version = "0.2.2" @@ -296,9 +292,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.77+curl-8.10.1" +version = "0.4.78+curl-8.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f469e8a5991f277a208224f6c7ad72ecb5f986e36d09ae1f2c1bb9259478a480" +checksum = "8eec768341c5c7789611ae51cf6c459099f22e64a5d5d0ce4892434e33821eaf" dependencies = [ "cc", "libc", @@ -327,13 +323,13 @@ dependencies = [ [[package]] name = "derive_arbitrary" -version = "1.3.2" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -344,7 +340,7 @@ checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -364,7 +360,7 @@ checksum = "133a7fa5cffeec6867fb2847335ec2d688f5bbee6318889d2a137ce1d226b180" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -386,7 +382,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -409,14 +405,14 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -438,7 +434,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -587,9 +583,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" [[package]] name = "hermit-abi" @@ -707,9 +703,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-channel", @@ -724,14 +720,143 @@ dependencies = [ "tracing", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", ] [[package]] @@ -821,9 +946,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.159" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "libnghttp2-sys" @@ -847,16 +972,24 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "loader" version = "0.1.0" dependencies = [ "anyhow", "isahc", + "libc", "netcorehost", - "proxy-dll", + "proxygen-macros", "thiserror", "win-msgbox", + "winapi", ] [[package]] @@ -973,7 +1106,7 @@ checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -1033,29 +1166,29 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -1102,32 +1235,19 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] [[package]] -name = "proxy-dll" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d585884a50595e966284bdfd1279e7aa5512607efcff7315d42d867768df19b" -dependencies = [ - "ctor", - "proxy-sys", - "thiserror", - "winapi", -] - -[[package]] -name = "proxy-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef9628341c0c4cf46b877dbfb65b7cc9d8ced89102afd401c77f2edf3bd61398" +name = "proxygen-macros" +version = "0.5.1" dependencies = [ - "syn 1.0.109", + "quote", + "syn", ] [[package]] @@ -1167,10 +1287,11 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" +checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" dependencies = [ + "cfg_aliases", "libc", "once_cell", "socket2", @@ -1219,9 +1340,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.8" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64", "bytes", @@ -1289,9 +1410,9 @@ checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustls" -version = "0.23.14" +version = "0.23.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" +checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" dependencies = [ "once_cell", "ring", @@ -1350,29 +1471,29 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", "memchr", @@ -1457,6 +1578,12 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "subtle" version = "2.6.1" @@ -1465,9 +1592,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -1475,43 +1602,43 @@ dependencies = [ ] [[package]] -name = "syn" -version = "2.0.79" +name = "sync_wrapper" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "futures-core", ] [[package]] -name = "sync_wrapper" -version = "1.0.1" +name = "synstructure" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ - "futures-core", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -1533,6 +1660,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -1550,9 +1687,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", @@ -1600,7 +1737,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -1634,27 +1771,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - [[package]] name = "unicode-ident" version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" -[[package]] -name = "unicode-normalization" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] - [[package]] name = "untrusted" version = "0.9.0" @@ -1663,15 +1785,27 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "vcpkg" version = "0.2.15" @@ -1727,7 +1861,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn", "wasm-bindgen-shared", ] @@ -1761,7 +1895,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2006,6 +2140,42 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -2024,7 +2194,28 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] @@ -2044,7 +2235,29 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a29855c..ce4be3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,6 @@ [workspace] resolver = "2" members = ["loader"] + +[patch.crates-io] +proxygen-macros = { path = "proxygen-macros" } diff --git a/loader/.cargo/config.toml b/loader/.cargo/config.toml new file mode 100644 index 0000000..ccc4a6c --- /dev/null +++ b/loader/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target = "x86_64-pc-windows-msvc" \ No newline at end of file diff --git a/loader/Cargo.toml b/loader/Cargo.toml index fa78fa7..de81edb 100644 --- a/loader/Cargo.toml +++ b/loader/Cargo.toml @@ -2,14 +2,29 @@ name = "loader" version = "0.1.0" edition = "2021" +# build = "build.rs" -[lib] -crate-type = ["cdylib"] +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = "1.0.89" +proxygen-macros = "0.5.1" +libc = "0.2.149" +winapi = { version = "0.3.9", features = [ + "minwindef", + "libloaderapi", + "processthreadsapi", + "consoleapi", + "processenv", + "winbase", + "winuser", + "errhandlingapi", +] } +thiserror = "1.0.64" isahc = "1.7.2" netcorehost = "0.17.0" -proxy-dll = "0.2.5" -thiserror = "1.0.64" +anyhow = "1.0.89" win-msgbox = "0.2.1" + +[lib] +name = "winmm" +crate-type = ["cdylib"] diff --git a/loader/rust-toolchain.toml b/loader/rust-toolchain.toml new file mode 100644 index 0000000..271800c --- /dev/null +++ b/loader/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "nightly" \ No newline at end of file diff --git a/loader/src/export_indices.rs b/loader/src/export_indices.rs new file mode 100644 index 0000000..2995ce2 --- /dev/null +++ b/loader/src/export_indices.rs @@ -0,0 +1,196 @@ +// After making changes in this file, you should run `proxygen update .`` in the root of this project to update exports + +#![allow(non_upper_case_globals)] + +pub const TOTAL_EXPORTS: usize = 191; +pub const Index_CloseDriver: usize = 0; +pub const Index_DefDriverProc: usize = 1; +pub const Index_DriverCallback: usize = 2; +pub const Index_DrvGetModuleHandle: usize = 3; +pub const Index_GetDriverModuleHandle: usize = 4; +pub const Index_NotifyCallbackData: usize = 5; +pub const Index_OpenDriver: usize = 6; +pub const Index_PlaySound: usize = 7; +pub const Index_PlaySoundA: usize = 8; +pub const Index_PlaySoundW: usize = 9; +pub const Index_SendDriverMessage: usize = 10; +pub const Index_WOW32DriverCallback: usize = 11; +pub const Index_WOWAppExit: usize = 12; +pub const Index_aux32Message: usize = 13; +pub const Index_auxGetDevCapsA: usize = 14; +pub const Index_auxGetDevCapsW: usize = 15; +pub const Index_auxGetNumDevs: usize = 16; +pub const Index_auxGetVolume: usize = 17; +pub const Index_auxOutMessage: usize = 18; +pub const Index_auxSetVolume: usize = 19; +pub const Index_joy32Message: usize = 20; +pub const Index_joyConfigChanged: usize = 21; +pub const Index_joyGetDevCapsA: usize = 22; +pub const Index_joyGetDevCapsW: usize = 23; +pub const Index_joyGetNumDevs: usize = 24; +pub const Index_joyGetPos: usize = 25; +pub const Index_joyGetPosEx: usize = 26; +pub const Index_joyGetThreshold: usize = 27; +pub const Index_joyReleaseCapture: usize = 28; +pub const Index_joySetCapture: usize = 29; +pub const Index_joySetThreshold: usize = 30; +pub const Index_mci32Message: usize = 31; +pub const Index_mciDriverNotify: usize = 32; +pub const Index_mciDriverYield: usize = 33; +pub const Index_mciExecute: usize = 34; +pub const Index_mciFreeCommandResource: usize = 35; +pub const Index_mciGetCreatorTask: usize = 36; +pub const Index_mciGetDeviceIDA: usize = 37; +pub const Index_mciGetDeviceIDFromElementIDA: usize = 38; +pub const Index_mciGetDeviceIDFromElementIDW: usize = 39; +pub const Index_mciGetDeviceIDW: usize = 40; +pub const Index_mciGetDriverData: usize = 41; +pub const Index_mciGetErrorStringA: usize = 42; +pub const Index_mciGetErrorStringW: usize = 43; +pub const Index_mciGetYieldProc: usize = 44; +pub const Index_mciLoadCommandResource: usize = 45; +pub const Index_mciSendCommandA: usize = 46; +pub const Index_mciSendCommandW: usize = 47; +pub const Index_mciSendStringA: usize = 48; +pub const Index_mciSendStringW: usize = 49; +pub const Index_mciSetDriverData: usize = 50; +pub const Index_mciSetYieldProc: usize = 51; +pub const Index_mid32Message: usize = 52; +pub const Index_midiConnect: usize = 53; +pub const Index_midiDisconnect: usize = 54; +pub const Index_midiInAddBuffer: usize = 55; +pub const Index_midiInClose: usize = 56; +pub const Index_midiInGetDevCapsA: usize = 57; +pub const Index_midiInGetDevCapsW: usize = 58; +pub const Index_midiInGetErrorTextA: usize = 59; +pub const Index_midiInGetErrorTextW: usize = 60; +pub const Index_midiInGetID: usize = 61; +pub const Index_midiInGetNumDevs: usize = 62; +pub const Index_midiInMessage: usize = 63; +pub const Index_midiInOpen: usize = 64; +pub const Index_midiInPrepareHeader: usize = 65; +pub const Index_midiInReset: usize = 66; +pub const Index_midiInStart: usize = 67; +pub const Index_midiInStop: usize = 68; +pub const Index_midiInUnprepareHeader: usize = 69; +pub const Index_midiOutCacheDrumPatches: usize = 70; +pub const Index_midiOutCachePatches: usize = 71; +pub const Index_midiOutClose: usize = 72; +pub const Index_midiOutGetDevCapsA: usize = 73; +pub const Index_midiOutGetDevCapsW: usize = 74; +pub const Index_midiOutGetErrorTextA: usize = 75; +pub const Index_midiOutGetErrorTextW: usize = 76; +pub const Index_midiOutGetID: usize = 77; +pub const Index_midiOutGetNumDevs: usize = 78; +pub const Index_midiOutGetVolume: usize = 79; +pub const Index_midiOutLongMsg: usize = 80; +pub const Index_midiOutMessage: usize = 81; +pub const Index_midiOutOpen: usize = 82; +pub const Index_midiOutPrepareHeader: usize = 83; +pub const Index_midiOutReset: usize = 84; +pub const Index_midiOutSetVolume: usize = 85; +pub const Index_midiOutShortMsg: usize = 86; +pub const Index_midiOutUnprepareHeader: usize = 87; +pub const Index_midiStreamClose: usize = 88; +pub const Index_midiStreamOpen: usize = 89; +pub const Index_midiStreamOut: usize = 90; +pub const Index_midiStreamPause: usize = 91; +pub const Index_midiStreamPosition: usize = 92; +pub const Index_midiStreamProperty: usize = 93; +pub const Index_midiStreamRestart: usize = 94; +pub const Index_midiStreamStop: usize = 95; +pub const Index_mixerClose: usize = 96; +pub const Index_mixerGetControlDetailsA: usize = 97; +pub const Index_mixerGetControlDetailsW: usize = 98; +pub const Index_mixerGetDevCapsA: usize = 99; +pub const Index_mixerGetDevCapsW: usize = 100; +pub const Index_mixerGetID: usize = 101; +pub const Index_mixerGetLineControlsA: usize = 102; +pub const Index_mixerGetLineControlsW: usize = 103; +pub const Index_mixerGetLineInfoA: usize = 104; +pub const Index_mixerGetLineInfoW: usize = 105; +pub const Index_mixerGetNumDevs: usize = 106; +pub const Index_mixerMessage: usize = 107; +pub const Index_mixerOpen: usize = 108; +pub const Index_mixerSetControlDetails: usize = 109; +pub const Index_mmDrvInstall: usize = 110; +pub const Index_mmGetCurrentTask: usize = 111; +pub const Index_mmTaskBlock: usize = 112; +pub const Index_mmTaskCreate: usize = 113; +pub const Index_mmTaskSignal: usize = 114; +pub const Index_mmTaskYield: usize = 115; +pub const Index_mmioAdvance: usize = 116; +pub const Index_mmioAscend: usize = 117; +pub const Index_mmioClose: usize = 118; +pub const Index_mmioCreateChunk: usize = 119; +pub const Index_mmioDescend: usize = 120; +pub const Index_mmioFlush: usize = 121; +pub const Index_mmioGetInfo: usize = 122; +pub const Index_mmioInstallIOProcA: usize = 123; +pub const Index_mmioInstallIOProcW: usize = 124; +pub const Index_mmioOpenA: usize = 125; +pub const Index_mmioOpenW: usize = 126; +pub const Index_mmioRead: usize = 127; +pub const Index_mmioRenameA: usize = 128; +pub const Index_mmioRenameW: usize = 129; +pub const Index_mmioSeek: usize = 130; +pub const Index_mmioSendMessage: usize = 131; +pub const Index_mmioSetBuffer: usize = 132; +pub const Index_mmioSetInfo: usize = 133; +pub const Index_mmioStringToFOURCCA: usize = 134; +pub const Index_mmioStringToFOURCCW: usize = 135; +pub const Index_mmioWrite: usize = 136; +pub const Index_mmsystemGetVersion: usize = 137; +pub const Index_mod32Message: usize = 138; +pub const Index_mxd32Message: usize = 139; +pub const Index_sndPlaySoundA: usize = 140; +pub const Index_sndPlaySoundW: usize = 141; +pub const Index_tid32Message: usize = 142; +pub const Index_timeBeginPeriod: usize = 143; +pub const Index_timeEndPeriod: usize = 144; +pub const Index_timeGetDevCaps: usize = 145; +pub const Index_timeGetSystemTime: usize = 146; +pub const Index_timeGetTime: usize = 147; +pub const Index_timeKillEvent: usize = 148; +pub const Index_timeSetEvent: usize = 149; +pub const Index_waveInAddBuffer: usize = 150; +pub const Index_waveInClose: usize = 151; +pub const Index_waveInGetDevCapsA: usize = 152; +pub const Index_waveInGetDevCapsW: usize = 153; +pub const Index_waveInGetErrorTextA: usize = 154; +pub const Index_waveInGetErrorTextW: usize = 155; +pub const Index_waveInGetID: usize = 156; +pub const Index_waveInGetNumDevs: usize = 157; +pub const Index_waveInGetPosition: usize = 158; +pub const Index_waveInMessage: usize = 159; +pub const Index_waveInOpen: usize = 160; +pub const Index_waveInPrepareHeader: usize = 161; +pub const Index_waveInReset: usize = 162; +pub const Index_waveInStart: usize = 163; +pub const Index_waveInStop: usize = 164; +pub const Index_waveInUnprepareHeader: usize = 165; +pub const Index_waveOutBreakLoop: usize = 166; +pub const Index_waveOutClose: usize = 167; +pub const Index_waveOutGetDevCapsA: usize = 168; +pub const Index_waveOutGetDevCapsW: usize = 169; +pub const Index_waveOutGetErrorTextA: usize = 170; +pub const Index_waveOutGetErrorTextW: usize = 171; +pub const Index_waveOutGetID: usize = 172; +pub const Index_waveOutGetNumDevs: usize = 173; +pub const Index_waveOutGetPitch: usize = 174; +pub const Index_waveOutGetPlaybackRate: usize = 175; +pub const Index_waveOutGetPosition: usize = 176; +pub const Index_waveOutGetVolume: usize = 177; +pub const Index_waveOutMessage: usize = 178; +pub const Index_waveOutOpen: usize = 179; +pub const Index_waveOutPause: usize = 180; +pub const Index_waveOutPrepareHeader: usize = 181; +pub const Index_waveOutReset: usize = 182; +pub const Index_waveOutRestart: usize = 183; +pub const Index_waveOutSetPitch: usize = 184; +pub const Index_waveOutSetPlaybackRate: usize = 185; +pub const Index_waveOutSetVolume: usize = 186; +pub const Index_waveOutUnprepareHeader: usize = 187; +pub const Index_waveOutWrite: usize = 188; +pub const Index_wid32Message: usize = 189; +pub const Index_wod32Message: usize = 190; diff --git a/loader/src/intercepted_exports.rs b/loader/src/intercepted_exports.rs new file mode 100644 index 0000000..d4bf424 --- /dev/null +++ b/loader/src/intercepted_exports.rs @@ -0,0 +1,57 @@ +// Intercepted/replaced functions go here +// Remember to run `proxygen update .` in the root of this project every time you add or remove an export here +// +// Example function proxies/hooks. +// Note, if using any of the `proxy`, `pre_hook` or `post_hook` macros, you will have access to the original function +// You can easily call `orig_func` with the same args as your interceptor function +// NOTE: Use the correct arg types and return type for any functions you proxy, or else you will probably mess up the stack +// and you will probably crash whatever program the DLL is loaded into +// +// #[pre_hook(sig="known")] +// #[export_name="SomeFunction"] +// pub extern "C" fn SomeFunction(some_arg_1: usize, some_arg_2: u32) -> bool { +// println!("Pre-hooked SomeFunction. Args: {}, {}", some_arg_1, some_arg_2); +// // After all our code in this pre-hook runs, if we don't return, the original function will be called +// // and its result will be returned +// } +// +// #[proxy(sig="known")] +// #[export_name="SomeFunction"] +// pub extern "C" fn SomeFunction(some_arg_1: usize, some_arg_2: u32) -> bool { +// let orig_result = orig_func(some_arg_1, some_arg_2); +// println!("Manually proxied SomeFunction. Args: {}, {}. Result: {}", some_arg_1, some_arg_2, orig_result); +// // This is just a normal/manual proxy. It is up to us to return a value. +// // Also note that the original function `orig_func` will not be run in this case unless we explicitly call it +// true +// } +// +// #[post_hook(sig="known")] +// #[export_name="SomeFunction"] +// pub extern "C" fn SomeFunction(some_arg_1: usize, some_arg_2: u32) -> bool { +// // `orig_func` got run just before our code. Its result is stored in `orig_result` +// println!("In post-hook for SomeFunction. Args: {}, {}. Result: {}", some_arg_1, some_arg_2, orig_result); +// // We could manually return something here if we didn't want `orig_result` returned +// } +// +// #[pre_hook(sig="unknown")] +// #[export_name="SomeFunction"] +// pub extern "C" fn SomeFunction() { +// println!("In pre-hook for SomeFunction. (signature unknown)") +// } + +static mut started: bool = false; + +#[allow(unused_imports)] +use proxygen_macros::{forward, post_hook, pre_hook, proxy}; + +use crate::start; + +#[pre_hook(sig = "unknown")] +#[export_name = "timeBeginPeriod"] +pub extern "C" fn timeBeginPeriod() { + if started { + return; + } + started = true; + start(); +} diff --git a/loader/src/lib.rs b/loader/src/lib.rs index 5fc1701..112ca5c 100644 --- a/loader/src/lib.rs +++ b/loader/src/lib.rs @@ -1,8 +1,39 @@ +#![feature(naked_functions)] +#![allow(named_asm_labels)] +#![allow(non_snake_case)] + +mod export_indices; +mod intercepted_exports; +mod orig_exports; +mod proxied_exports; + +#[allow(unused_imports)] +pub use intercepted_exports::*; +pub use proxied_exports::*; + +use export_indices::TOTAL_EXPORTS; +use orig_exports::load_dll_funcs; +#[cfg(target_arch = "x86")] +use std::arch::x86::_mm_pause; +#[cfg(target_arch = "x86_64")] +use std::arch::x86_64::_mm_pause; +use std::os::windows::prelude::AsRawHandle; +use win_msgbox::Okay; +use winapi::ctypes::c_void; +use winapi::shared::minwindef::{FARPROC, HMODULE}; +use winapi::shared::ntdef::LPCSTR; +use winapi::um::consoleapi::AllocConsole; +use winapi::um::errhandlingapi::GetLastError; +use winapi::um::libloaderapi::{DisableThreadLibraryCalls, FreeLibrary, LoadLibraryA}; +use winapi::um::processenv::SetStdHandle; +use winapi::um::processthreadsapi::{CreateThread, GetCurrentProcess, TerminateProcess}; +use winapi::um::winbase::{STD_ERROR_HANDLE, STD_OUTPUT_HANDLE}; +use winapi::um::winnt::{DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH}; + use isahc::ReadResponseExt; use netcorehost::{error::HostingError, nethost, pdcstr, pdcstring::PdCString}; -use proxy_dll::proxy; use thiserror::Error; -use win_msgbox::{Okay, YesNo}; +use win_msgbox::YesNo; #[derive(Error, Debug)] pub enum LoaderError { @@ -25,7 +56,121 @@ pub enum LoaderError { Unknown, } -fn init() -> Result<(), LoaderError> { +// Static handles +static mut THIS_HANDLE: Option = None; +static mut ORIG_DLL_HANDLE: Option = None; + +// Original funcs +#[no_mangle] +static mut ORIGINAL_FUNCS: [FARPROC; TOTAL_EXPORTS] = [std::ptr::null_mut(); TOTAL_EXPORTS]; +#[no_mangle] +static mut ORIG_FUNCS_PTR: *const FARPROC = std::ptr::null_mut(); + +/// Indicates once we are ready to accept incoming calls to proxied functions +static mut PROXYGEN_READY: bool = false; + +#[no_mangle] +pub unsafe extern "stdcall" fn DllMain(module: HMODULE, reason: u32, _res: *const c_void) -> i32 { + DisableThreadLibraryCalls(module); + THIS_HANDLE = Some(module); + + if reason == DLL_PROCESS_ATTACH { + CreateThread( + std::ptr::null_mut(), + 0, + Some(init), + std::ptr::null_mut(), + 0, + std::ptr::null_mut(), + ); + } else if reason == DLL_PROCESS_DETACH { + if let Some(orig_dll_handle) = ORIG_DLL_HANDLE { + println!("Freeing original DLL"); + FreeLibrary(orig_dll_handle); + } + } + + 1 +} + +unsafe fn die() { + win_msgbox::information::("Exiting...") + .title("LOADER") + .show() + .ok(); + println!("Exiting..."); + TerminateProcess(GetCurrentProcess(), 0); +} + +/// Called when the thread is spawned +unsafe extern "system" fn init(_: *mut c_void) -> u32 { + ORIG_FUNCS_PTR = ORIGINAL_FUNCS.as_ptr(); + match std::env::var("GDWEAVE_CONSOLE") { + Ok(_) => { + AllocConsole(); + } + Err(_) => {} + } + + let stdout = std::io::stdout(); + let out_handle = stdout.as_raw_handle(); + let out_handle = out_handle as *mut c_void; + SetStdHandle(STD_OUTPUT_HANDLE, out_handle); + let stderr = std::io::stderr(); + let err_handle = stderr.as_raw_handle(); + let err_handle = err_handle as *mut c_void; + SetStdHandle(STD_ERROR_HANDLE, err_handle); + ORIG_DLL_HANDLE = Some(LoadLibraryA( + b"C:\\Windows\\system32\\winmm.dll\0".as_ptr() as LPCSTR + )); + if let Some(orig_dll_handle) = ORIG_DLL_HANDLE { + if orig_dll_handle.is_null() { + let err = GetLastError(); + eprintln!("Failed to load original DLL"); + win_msgbox::error::(&format!("Failed to load original DLL. Error: {}", err)) + .title("LOADER") + .show() + .ok(); + die(); + } + println!("Original DLL handle: {:?}", orig_dll_handle); + } else { + let err = GetLastError(); + eprintln!("Failed to load original DLL"); + win_msgbox::error::(&format!("Failed to load original DLL. Error: {}", err)) + .title("LOADER") + .show() + .ok(); + die(); + } + load_dll_funcs(); + PROXYGEN_READY = true; + 0 +} + +/// Call this before attempting to call a function in the proxied DLL +/// +/// This will wait for proxygen to fully load up all the proxied function addresses before returning +#[no_mangle] +pub extern "C" fn wait_dll_proxy_init() { + // NOTE TO SELF: DO NO PRINT STUFF IN HERE + + // Safety: `PROXYGEN_READY` will only get flipped to true once, and never back again. + // We also check if sse2 is supported before using _mm_pause + if is_x86_feature_detected!("sse2") { + unsafe { + while !PROXYGEN_READY { + _mm_pause(); + } + } + } else { + while !unsafe { PROXYGEN_READY } { + std::thread::sleep(std::time::Duration::from_millis(100)); + } + } +} + +fn init_gdweave() -> Result<(), LoaderError> { let args = std::env::args().collect::>(); if args.iter().any(|s| s == "--gdweave-disable") { return Ok(()); @@ -89,9 +234,8 @@ fn install_net() -> anyhow::Result<()> { Ok(()) } -#[proxy] -pub fn main() { - if let Err(e) = init() { +pub fn start() { + if let Err(e) = init_gdweave() { match e { LoaderError::LoadHostfxrError(_) | LoaderError::HostingError(HostingError::FrameworkMissingFailure) => { diff --git a/loader/src/orig_exports.rs b/loader/src/orig_exports.rs new file mode 100644 index 0000000..a647231 --- /dev/null +++ b/loader/src/orig_exports.rs @@ -0,0 +1,308 @@ +use crate::export_indices::*; +use crate::{ORIGINAL_FUNCS, ORIG_DLL_HANDLE}; +use std::ffi::CString; +use winapi::{ + shared::minwindef::{FARPROC, HMODULE}, + um::libloaderapi::GetProcAddress, +}; + +/// Loads up the address of the original function in the given module +unsafe fn load_dll_func(index: usize, h_module: HMODULE, func: &str) { + let func_c_string = CString::new(func).unwrap(); + let proc_address: FARPROC = GetProcAddress(h_module, func_c_string.as_ptr()); + ORIGINAL_FUNCS[index] = proc_address; + println!("[0x{:016x}] Loaded {}", proc_address as u64, func); +} + +/// Loads the original DLL functions for later use +pub unsafe fn load_dll_funcs() { + println!("Loading original DLL functions"); + if ORIG_DLL_HANDLE.is_none() { + eprintln!("Original DLL handle is none. Cannot load original DLL funcs"); + return; + } + let dll_handle = ORIG_DLL_HANDLE.unwrap(); + load_dll_func(Index_CloseDriver, dll_handle, "CloseDriver"); + load_dll_func(Index_DefDriverProc, dll_handle, "DefDriverProc"); + load_dll_func(Index_DriverCallback, dll_handle, "DriverCallback"); + load_dll_func(Index_DrvGetModuleHandle, dll_handle, "DrvGetModuleHandle"); + load_dll_func( + Index_GetDriverModuleHandle, + dll_handle, + "GetDriverModuleHandle", + ); + load_dll_func(Index_NotifyCallbackData, dll_handle, "NotifyCallbackData"); + load_dll_func(Index_OpenDriver, dll_handle, "OpenDriver"); + load_dll_func(Index_PlaySound, dll_handle, "PlaySound"); + load_dll_func(Index_PlaySoundA, dll_handle, "PlaySoundA"); + load_dll_func(Index_PlaySoundW, dll_handle, "PlaySoundW"); + load_dll_func(Index_SendDriverMessage, dll_handle, "SendDriverMessage"); + load_dll_func(Index_WOW32DriverCallback, dll_handle, "WOW32DriverCallback"); + load_dll_func(Index_WOWAppExit, dll_handle, "WOWAppExit"); + load_dll_func(Index_aux32Message, dll_handle, "aux32Message"); + load_dll_func(Index_auxGetDevCapsA, dll_handle, "auxGetDevCapsA"); + load_dll_func(Index_auxGetDevCapsW, dll_handle, "auxGetDevCapsW"); + load_dll_func(Index_auxGetNumDevs, dll_handle, "auxGetNumDevs"); + load_dll_func(Index_auxGetVolume, dll_handle, "auxGetVolume"); + load_dll_func(Index_auxOutMessage, dll_handle, "auxOutMessage"); + load_dll_func(Index_auxSetVolume, dll_handle, "auxSetVolume"); + load_dll_func(Index_joy32Message, dll_handle, "joy32Message"); + load_dll_func(Index_joyConfigChanged, dll_handle, "joyConfigChanged"); + load_dll_func(Index_joyGetDevCapsA, dll_handle, "joyGetDevCapsA"); + load_dll_func(Index_joyGetDevCapsW, dll_handle, "joyGetDevCapsW"); + load_dll_func(Index_joyGetNumDevs, dll_handle, "joyGetNumDevs"); + load_dll_func(Index_joyGetPos, dll_handle, "joyGetPos"); + load_dll_func(Index_joyGetPosEx, dll_handle, "joyGetPosEx"); + load_dll_func(Index_joyGetThreshold, dll_handle, "joyGetThreshold"); + load_dll_func(Index_joyReleaseCapture, dll_handle, "joyReleaseCapture"); + load_dll_func(Index_joySetCapture, dll_handle, "joySetCapture"); + load_dll_func(Index_joySetThreshold, dll_handle, "joySetThreshold"); + load_dll_func(Index_mci32Message, dll_handle, "mci32Message"); + load_dll_func(Index_mciDriverNotify, dll_handle, "mciDriverNotify"); + load_dll_func(Index_mciDriverYield, dll_handle, "mciDriverYield"); + load_dll_func(Index_mciExecute, dll_handle, "mciExecute"); + load_dll_func( + Index_mciFreeCommandResource, + dll_handle, + "mciFreeCommandResource", + ); + load_dll_func(Index_mciGetCreatorTask, dll_handle, "mciGetCreatorTask"); + load_dll_func(Index_mciGetDeviceIDA, dll_handle, "mciGetDeviceIDA"); + load_dll_func( + Index_mciGetDeviceIDFromElementIDA, + dll_handle, + "mciGetDeviceIDFromElementIDA", + ); + load_dll_func( + Index_mciGetDeviceIDFromElementIDW, + dll_handle, + "mciGetDeviceIDFromElementIDW", + ); + load_dll_func(Index_mciGetDeviceIDW, dll_handle, "mciGetDeviceIDW"); + load_dll_func(Index_mciGetDriverData, dll_handle, "mciGetDriverData"); + load_dll_func(Index_mciGetErrorStringA, dll_handle, "mciGetErrorStringA"); + load_dll_func(Index_mciGetErrorStringW, dll_handle, "mciGetErrorStringW"); + load_dll_func(Index_mciGetYieldProc, dll_handle, "mciGetYieldProc"); + load_dll_func( + Index_mciLoadCommandResource, + dll_handle, + "mciLoadCommandResource", + ); + load_dll_func(Index_mciSendCommandA, dll_handle, "mciSendCommandA"); + load_dll_func(Index_mciSendCommandW, dll_handle, "mciSendCommandW"); + load_dll_func(Index_mciSendStringA, dll_handle, "mciSendStringA"); + load_dll_func(Index_mciSendStringW, dll_handle, "mciSendStringW"); + load_dll_func(Index_mciSetDriverData, dll_handle, "mciSetDriverData"); + load_dll_func(Index_mciSetYieldProc, dll_handle, "mciSetYieldProc"); + load_dll_func(Index_mid32Message, dll_handle, "mid32Message"); + load_dll_func(Index_midiConnect, dll_handle, "midiConnect"); + load_dll_func(Index_midiDisconnect, dll_handle, "midiDisconnect"); + load_dll_func(Index_midiInAddBuffer, dll_handle, "midiInAddBuffer"); + load_dll_func(Index_midiInClose, dll_handle, "midiInClose"); + load_dll_func(Index_midiInGetDevCapsA, dll_handle, "midiInGetDevCapsA"); + load_dll_func(Index_midiInGetDevCapsW, dll_handle, "midiInGetDevCapsW"); + load_dll_func(Index_midiInGetErrorTextA, dll_handle, "midiInGetErrorTextA"); + load_dll_func(Index_midiInGetErrorTextW, dll_handle, "midiInGetErrorTextW"); + load_dll_func(Index_midiInGetID, dll_handle, "midiInGetID"); + load_dll_func(Index_midiInGetNumDevs, dll_handle, "midiInGetNumDevs"); + load_dll_func(Index_midiInMessage, dll_handle, "midiInMessage"); + load_dll_func(Index_midiInOpen, dll_handle, "midiInOpen"); + load_dll_func(Index_midiInPrepareHeader, dll_handle, "midiInPrepareHeader"); + load_dll_func(Index_midiInReset, dll_handle, "midiInReset"); + load_dll_func(Index_midiInStart, dll_handle, "midiInStart"); + load_dll_func(Index_midiInStop, dll_handle, "midiInStop"); + load_dll_func( + Index_midiInUnprepareHeader, + dll_handle, + "midiInUnprepareHeader", + ); + load_dll_func( + Index_midiOutCacheDrumPatches, + dll_handle, + "midiOutCacheDrumPatches", + ); + load_dll_func(Index_midiOutCachePatches, dll_handle, "midiOutCachePatches"); + load_dll_func(Index_midiOutClose, dll_handle, "midiOutClose"); + load_dll_func(Index_midiOutGetDevCapsA, dll_handle, "midiOutGetDevCapsA"); + load_dll_func(Index_midiOutGetDevCapsW, dll_handle, "midiOutGetDevCapsW"); + load_dll_func( + Index_midiOutGetErrorTextA, + dll_handle, + "midiOutGetErrorTextA", + ); + load_dll_func( + Index_midiOutGetErrorTextW, + dll_handle, + "midiOutGetErrorTextW", + ); + load_dll_func(Index_midiOutGetID, dll_handle, "midiOutGetID"); + load_dll_func(Index_midiOutGetNumDevs, dll_handle, "midiOutGetNumDevs"); + load_dll_func(Index_midiOutGetVolume, dll_handle, "midiOutGetVolume"); + load_dll_func(Index_midiOutLongMsg, dll_handle, "midiOutLongMsg"); + load_dll_func(Index_midiOutMessage, dll_handle, "midiOutMessage"); + load_dll_func(Index_midiOutOpen, dll_handle, "midiOutOpen"); + load_dll_func( + Index_midiOutPrepareHeader, + dll_handle, + "midiOutPrepareHeader", + ); + load_dll_func(Index_midiOutReset, dll_handle, "midiOutReset"); + load_dll_func(Index_midiOutSetVolume, dll_handle, "midiOutSetVolume"); + load_dll_func(Index_midiOutShortMsg, dll_handle, "midiOutShortMsg"); + load_dll_func( + Index_midiOutUnprepareHeader, + dll_handle, + "midiOutUnprepareHeader", + ); + load_dll_func(Index_midiStreamClose, dll_handle, "midiStreamClose"); + load_dll_func(Index_midiStreamOpen, dll_handle, "midiStreamOpen"); + load_dll_func(Index_midiStreamOut, dll_handle, "midiStreamOut"); + load_dll_func(Index_midiStreamPause, dll_handle, "midiStreamPause"); + load_dll_func(Index_midiStreamPosition, dll_handle, "midiStreamPosition"); + load_dll_func(Index_midiStreamProperty, dll_handle, "midiStreamProperty"); + load_dll_func(Index_midiStreamRestart, dll_handle, "midiStreamRestart"); + load_dll_func(Index_midiStreamStop, dll_handle, "midiStreamStop"); + load_dll_func(Index_mixerClose, dll_handle, "mixerClose"); + load_dll_func( + Index_mixerGetControlDetailsA, + dll_handle, + "mixerGetControlDetailsA", + ); + load_dll_func( + Index_mixerGetControlDetailsW, + dll_handle, + "mixerGetControlDetailsW", + ); + load_dll_func(Index_mixerGetDevCapsA, dll_handle, "mixerGetDevCapsA"); + load_dll_func(Index_mixerGetDevCapsW, dll_handle, "mixerGetDevCapsW"); + load_dll_func(Index_mixerGetID, dll_handle, "mixerGetID"); + load_dll_func( + Index_mixerGetLineControlsA, + dll_handle, + "mixerGetLineControlsA", + ); + load_dll_func( + Index_mixerGetLineControlsW, + dll_handle, + "mixerGetLineControlsW", + ); + load_dll_func(Index_mixerGetLineInfoA, dll_handle, "mixerGetLineInfoA"); + load_dll_func(Index_mixerGetLineInfoW, dll_handle, "mixerGetLineInfoW"); + load_dll_func(Index_mixerGetNumDevs, dll_handle, "mixerGetNumDevs"); + load_dll_func(Index_mixerMessage, dll_handle, "mixerMessage"); + load_dll_func(Index_mixerOpen, dll_handle, "mixerOpen"); + load_dll_func( + Index_mixerSetControlDetails, + dll_handle, + "mixerSetControlDetails", + ); + load_dll_func(Index_mmDrvInstall, dll_handle, "mmDrvInstall"); + load_dll_func(Index_mmGetCurrentTask, dll_handle, "mmGetCurrentTask"); + load_dll_func(Index_mmTaskBlock, dll_handle, "mmTaskBlock"); + load_dll_func(Index_mmTaskCreate, dll_handle, "mmTaskCreate"); + load_dll_func(Index_mmTaskSignal, dll_handle, "mmTaskSignal"); + load_dll_func(Index_mmTaskYield, dll_handle, "mmTaskYield"); + load_dll_func(Index_mmioAdvance, dll_handle, "mmioAdvance"); + load_dll_func(Index_mmioAscend, dll_handle, "mmioAscend"); + load_dll_func(Index_mmioClose, dll_handle, "mmioClose"); + load_dll_func(Index_mmioCreateChunk, dll_handle, "mmioCreateChunk"); + load_dll_func(Index_mmioDescend, dll_handle, "mmioDescend"); + load_dll_func(Index_mmioFlush, dll_handle, "mmioFlush"); + load_dll_func(Index_mmioGetInfo, dll_handle, "mmioGetInfo"); + load_dll_func(Index_mmioInstallIOProcA, dll_handle, "mmioInstallIOProcA"); + load_dll_func(Index_mmioInstallIOProcW, dll_handle, "mmioInstallIOProcW"); + load_dll_func(Index_mmioOpenA, dll_handle, "mmioOpenA"); + load_dll_func(Index_mmioOpenW, dll_handle, "mmioOpenW"); + load_dll_func(Index_mmioRead, dll_handle, "mmioRead"); + load_dll_func(Index_mmioRenameA, dll_handle, "mmioRenameA"); + load_dll_func(Index_mmioRenameW, dll_handle, "mmioRenameW"); + load_dll_func(Index_mmioSeek, dll_handle, "mmioSeek"); + load_dll_func(Index_mmioSendMessage, dll_handle, "mmioSendMessage"); + load_dll_func(Index_mmioSetBuffer, dll_handle, "mmioSetBuffer"); + load_dll_func(Index_mmioSetInfo, dll_handle, "mmioSetInfo"); + load_dll_func(Index_mmioStringToFOURCCA, dll_handle, "mmioStringToFOURCCA"); + load_dll_func(Index_mmioStringToFOURCCW, dll_handle, "mmioStringToFOURCCW"); + load_dll_func(Index_mmioWrite, dll_handle, "mmioWrite"); + load_dll_func(Index_mmsystemGetVersion, dll_handle, "mmsystemGetVersion"); + load_dll_func(Index_mod32Message, dll_handle, "mod32Message"); + load_dll_func(Index_mxd32Message, dll_handle, "mxd32Message"); + load_dll_func(Index_sndPlaySoundA, dll_handle, "sndPlaySoundA"); + load_dll_func(Index_sndPlaySoundW, dll_handle, "sndPlaySoundW"); + load_dll_func(Index_tid32Message, dll_handle, "tid32Message"); + load_dll_func(Index_timeBeginPeriod, dll_handle, "timeBeginPeriod"); + load_dll_func(Index_timeEndPeriod, dll_handle, "timeEndPeriod"); + load_dll_func(Index_timeGetDevCaps, dll_handle, "timeGetDevCaps"); + load_dll_func(Index_timeGetSystemTime, dll_handle, "timeGetSystemTime"); + load_dll_func(Index_timeGetTime, dll_handle, "timeGetTime"); + load_dll_func(Index_timeKillEvent, dll_handle, "timeKillEvent"); + load_dll_func(Index_timeSetEvent, dll_handle, "timeSetEvent"); + load_dll_func(Index_waveInAddBuffer, dll_handle, "waveInAddBuffer"); + load_dll_func(Index_waveInClose, dll_handle, "waveInClose"); + load_dll_func(Index_waveInGetDevCapsA, dll_handle, "waveInGetDevCapsA"); + load_dll_func(Index_waveInGetDevCapsW, dll_handle, "waveInGetDevCapsW"); + load_dll_func(Index_waveInGetErrorTextA, dll_handle, "waveInGetErrorTextA"); + load_dll_func(Index_waveInGetErrorTextW, dll_handle, "waveInGetErrorTextW"); + load_dll_func(Index_waveInGetID, dll_handle, "waveInGetID"); + load_dll_func(Index_waveInGetNumDevs, dll_handle, "waveInGetNumDevs"); + load_dll_func(Index_waveInGetPosition, dll_handle, "waveInGetPosition"); + load_dll_func(Index_waveInMessage, dll_handle, "waveInMessage"); + load_dll_func(Index_waveInOpen, dll_handle, "waveInOpen"); + load_dll_func(Index_waveInPrepareHeader, dll_handle, "waveInPrepareHeader"); + load_dll_func(Index_waveInReset, dll_handle, "waveInReset"); + load_dll_func(Index_waveInStart, dll_handle, "waveInStart"); + load_dll_func(Index_waveInStop, dll_handle, "waveInStop"); + load_dll_func( + Index_waveInUnprepareHeader, + dll_handle, + "waveInUnprepareHeader", + ); + load_dll_func(Index_waveOutBreakLoop, dll_handle, "waveOutBreakLoop"); + load_dll_func(Index_waveOutClose, dll_handle, "waveOutClose"); + load_dll_func(Index_waveOutGetDevCapsA, dll_handle, "waveOutGetDevCapsA"); + load_dll_func(Index_waveOutGetDevCapsW, dll_handle, "waveOutGetDevCapsW"); + load_dll_func( + Index_waveOutGetErrorTextA, + dll_handle, + "waveOutGetErrorTextA", + ); + load_dll_func( + Index_waveOutGetErrorTextW, + dll_handle, + "waveOutGetErrorTextW", + ); + load_dll_func(Index_waveOutGetID, dll_handle, "waveOutGetID"); + load_dll_func(Index_waveOutGetNumDevs, dll_handle, "waveOutGetNumDevs"); + load_dll_func(Index_waveOutGetPitch, dll_handle, "waveOutGetPitch"); + load_dll_func( + Index_waveOutGetPlaybackRate, + dll_handle, + "waveOutGetPlaybackRate", + ); + load_dll_func(Index_waveOutGetPosition, dll_handle, "waveOutGetPosition"); + load_dll_func(Index_waveOutGetVolume, dll_handle, "waveOutGetVolume"); + load_dll_func(Index_waveOutMessage, dll_handle, "waveOutMessage"); + load_dll_func(Index_waveOutOpen, dll_handle, "waveOutOpen"); + load_dll_func(Index_waveOutPause, dll_handle, "waveOutPause"); + load_dll_func( + Index_waveOutPrepareHeader, + dll_handle, + "waveOutPrepareHeader", + ); + load_dll_func(Index_waveOutReset, dll_handle, "waveOutReset"); + load_dll_func(Index_waveOutRestart, dll_handle, "waveOutRestart"); + load_dll_func(Index_waveOutSetPitch, dll_handle, "waveOutSetPitch"); + load_dll_func( + Index_waveOutSetPlaybackRate, + dll_handle, + "waveOutSetPlaybackRate", + ); + load_dll_func(Index_waveOutSetVolume, dll_handle, "waveOutSetVolume"); + load_dll_func( + Index_waveOutUnprepareHeader, + dll_handle, + "waveOutUnprepareHeader", + ); + load_dll_func(Index_waveOutWrite, dll_handle, "waveOutWrite"); + load_dll_func(Index_wid32Message, dll_handle, "wid32Message"); + load_dll_func(Index_wod32Message, dll_handle, "wod32Message"); +} diff --git a/loader/src/proxied_exports.rs b/loader/src/proxied_exports.rs new file mode 100644 index 0000000..77448a0 --- /dev/null +++ b/loader/src/proxied_exports.rs @@ -0,0 +1,762 @@ +// Just proxied functions in this file +use proxygen_macros::forward; + +#[forward] +#[export_name = "CloseDriver"] +pub extern "C" fn CloseDriver() {} + +#[forward] +#[export_name = "DefDriverProc"] +pub extern "C" fn DefDriverProc() {} + +#[forward] +#[export_name = "DriverCallback"] +pub extern "C" fn DriverCallback() {} + +#[forward] +#[export_name = "DrvGetModuleHandle"] +pub extern "C" fn DrvGetModuleHandle() {} + +#[forward] +#[export_name = "GetDriverModuleHandle"] +pub extern "C" fn GetDriverModuleHandle() {} + +#[forward] +#[export_name = "NotifyCallbackData"] +pub extern "C" fn NotifyCallbackData() {} + +#[forward] +#[export_name = "OpenDriver"] +pub extern "C" fn OpenDriver() {} + +#[forward] +#[export_name = "PlaySound"] +pub extern "C" fn PlaySound() {} + +#[forward] +#[export_name = "PlaySoundA"] +pub extern "C" fn PlaySoundA() {} + +#[forward] +#[export_name = "PlaySoundW"] +pub extern "C" fn PlaySoundW() {} + +#[forward] +#[export_name = "SendDriverMessage"] +pub extern "C" fn SendDriverMessage() {} + +#[forward] +#[export_name = "WOW32DriverCallback"] +pub extern "C" fn WOW32DriverCallback() {} + +#[forward] +#[export_name = "WOWAppExit"] +pub extern "C" fn WOWAppExit() {} + +#[forward] +#[export_name = "aux32Message"] +pub extern "C" fn aux32Message() {} + +#[forward] +#[export_name = "auxGetDevCapsA"] +pub extern "C" fn auxGetDevCapsA() {} + +#[forward] +#[export_name = "auxGetDevCapsW"] +pub extern "C" fn auxGetDevCapsW() {} + +#[forward] +#[export_name = "auxGetNumDevs"] +pub extern "C" fn auxGetNumDevs() {} + +#[forward] +#[export_name = "auxGetVolume"] +pub extern "C" fn auxGetVolume() {} + +#[forward] +#[export_name = "auxOutMessage"] +pub extern "C" fn auxOutMessage() {} + +#[forward] +#[export_name = "auxSetVolume"] +pub extern "C" fn auxSetVolume() {} + +#[forward] +#[export_name = "joy32Message"] +pub extern "C" fn joy32Message() {} + +#[forward] +#[export_name = "joyConfigChanged"] +pub extern "C" fn joyConfigChanged() {} + +#[forward] +#[export_name = "joyGetDevCapsA"] +pub extern "C" fn joyGetDevCapsA() {} + +#[forward] +#[export_name = "joyGetDevCapsW"] +pub extern "C" fn joyGetDevCapsW() {} + +#[forward] +#[export_name = "joyGetNumDevs"] +pub extern "C" fn joyGetNumDevs() {} + +#[forward] +#[export_name = "joyGetPos"] +pub extern "C" fn joyGetPos() {} + +#[forward] +#[export_name = "joyGetPosEx"] +pub extern "C" fn joyGetPosEx() {} + +#[forward] +#[export_name = "joyGetThreshold"] +pub extern "C" fn joyGetThreshold() {} + +#[forward] +#[export_name = "joyReleaseCapture"] +pub extern "C" fn joyReleaseCapture() {} + +#[forward] +#[export_name = "joySetCapture"] +pub extern "C" fn joySetCapture() {} + +#[forward] +#[export_name = "joySetThreshold"] +pub extern "C" fn joySetThreshold() {} + +#[forward] +#[export_name = "mci32Message"] +pub extern "C" fn mci32Message() {} + +#[forward] +#[export_name = "mciDriverNotify"] +pub extern "C" fn mciDriverNotify() {} + +#[forward] +#[export_name = "mciDriverYield"] +pub extern "C" fn mciDriverYield() {} + +#[forward] +#[export_name = "mciExecute"] +pub extern "C" fn mciExecute() {} + +#[forward] +#[export_name = "mciFreeCommandResource"] +pub extern "C" fn mciFreeCommandResource() {} + +#[forward] +#[export_name = "mciGetCreatorTask"] +pub extern "C" fn mciGetCreatorTask() {} + +#[forward] +#[export_name = "mciGetDeviceIDA"] +pub extern "C" fn mciGetDeviceIDA() {} + +#[forward] +#[export_name = "mciGetDeviceIDFromElementIDA"] +pub extern "C" fn mciGetDeviceIDFromElementIDA() {} + +#[forward] +#[export_name = "mciGetDeviceIDFromElementIDW"] +pub extern "C" fn mciGetDeviceIDFromElementIDW() {} + +#[forward] +#[export_name = "mciGetDeviceIDW"] +pub extern "C" fn mciGetDeviceIDW() {} + +#[forward] +#[export_name = "mciGetDriverData"] +pub extern "C" fn mciGetDriverData() {} + +#[forward] +#[export_name = "mciGetErrorStringA"] +pub extern "C" fn mciGetErrorStringA() {} + +#[forward] +#[export_name = "mciGetErrorStringW"] +pub extern "C" fn mciGetErrorStringW() {} + +#[forward] +#[export_name = "mciGetYieldProc"] +pub extern "C" fn mciGetYieldProc() {} + +#[forward] +#[export_name = "mciLoadCommandResource"] +pub extern "C" fn mciLoadCommandResource() {} + +#[forward] +#[export_name = "mciSendCommandA"] +pub extern "C" fn mciSendCommandA() {} + +#[forward] +#[export_name = "mciSendCommandW"] +pub extern "C" fn mciSendCommandW() {} + +#[forward] +#[export_name = "mciSendStringA"] +pub extern "C" fn mciSendStringA() {} + +#[forward] +#[export_name = "mciSendStringW"] +pub extern "C" fn mciSendStringW() {} + +#[forward] +#[export_name = "mciSetDriverData"] +pub extern "C" fn mciSetDriverData() {} + +#[forward] +#[export_name = "mciSetYieldProc"] +pub extern "C" fn mciSetYieldProc() {} + +#[forward] +#[export_name = "mid32Message"] +pub extern "C" fn mid32Message() {} + +#[forward] +#[export_name = "midiConnect"] +pub extern "C" fn midiConnect() {} + +#[forward] +#[export_name = "midiDisconnect"] +pub extern "C" fn midiDisconnect() {} + +#[forward] +#[export_name = "midiInAddBuffer"] +pub extern "C" fn midiInAddBuffer() {} + +#[forward] +#[export_name = "midiInClose"] +pub extern "C" fn midiInClose() {} + +#[forward] +#[export_name = "midiInGetDevCapsA"] +pub extern "C" fn midiInGetDevCapsA() {} + +#[forward] +#[export_name = "midiInGetDevCapsW"] +pub extern "C" fn midiInGetDevCapsW() {} + +#[forward] +#[export_name = "midiInGetErrorTextA"] +pub extern "C" fn midiInGetErrorTextA() {} + +#[forward] +#[export_name = "midiInGetErrorTextW"] +pub extern "C" fn midiInGetErrorTextW() {} + +#[forward] +#[export_name = "midiInGetID"] +pub extern "C" fn midiInGetID() {} + +#[forward] +#[export_name = "midiInGetNumDevs"] +pub extern "C" fn midiInGetNumDevs() {} + +#[forward] +#[export_name = "midiInMessage"] +pub extern "C" fn midiInMessage() {} + +#[forward] +#[export_name = "midiInOpen"] +pub extern "C" fn midiInOpen() {} + +#[forward] +#[export_name = "midiInPrepareHeader"] +pub extern "C" fn midiInPrepareHeader() {} + +#[forward] +#[export_name = "midiInReset"] +pub extern "C" fn midiInReset() {} + +#[forward] +#[export_name = "midiInStart"] +pub extern "C" fn midiInStart() {} + +#[forward] +#[export_name = "midiInStop"] +pub extern "C" fn midiInStop() {} + +#[forward] +#[export_name = "midiInUnprepareHeader"] +pub extern "C" fn midiInUnprepareHeader() {} + +#[forward] +#[export_name = "midiOutCacheDrumPatches"] +pub extern "C" fn midiOutCacheDrumPatches() {} + +#[forward] +#[export_name = "midiOutCachePatches"] +pub extern "C" fn midiOutCachePatches() {} + +#[forward] +#[export_name = "midiOutClose"] +pub extern "C" fn midiOutClose() {} + +#[forward] +#[export_name = "midiOutGetDevCapsA"] +pub extern "C" fn midiOutGetDevCapsA() {} + +#[forward] +#[export_name = "midiOutGetDevCapsW"] +pub extern "C" fn midiOutGetDevCapsW() {} + +#[forward] +#[export_name = "midiOutGetErrorTextA"] +pub extern "C" fn midiOutGetErrorTextA() {} + +#[forward] +#[export_name = "midiOutGetErrorTextW"] +pub extern "C" fn midiOutGetErrorTextW() {} + +#[forward] +#[export_name = "midiOutGetID"] +pub extern "C" fn midiOutGetID() {} + +#[forward] +#[export_name = "midiOutGetNumDevs"] +pub extern "C" fn midiOutGetNumDevs() {} + +#[forward] +#[export_name = "midiOutGetVolume"] +pub extern "C" fn midiOutGetVolume() {} + +#[forward] +#[export_name = "midiOutLongMsg"] +pub extern "C" fn midiOutLongMsg() {} + +#[forward] +#[export_name = "midiOutMessage"] +pub extern "C" fn midiOutMessage() {} + +#[forward] +#[export_name = "midiOutOpen"] +pub extern "C" fn midiOutOpen() {} + +#[forward] +#[export_name = "midiOutPrepareHeader"] +pub extern "C" fn midiOutPrepareHeader() {} + +#[forward] +#[export_name = "midiOutReset"] +pub extern "C" fn midiOutReset() {} + +#[forward] +#[export_name = "midiOutSetVolume"] +pub extern "C" fn midiOutSetVolume() {} + +#[forward] +#[export_name = "midiOutShortMsg"] +pub extern "C" fn midiOutShortMsg() {} + +#[forward] +#[export_name = "midiOutUnprepareHeader"] +pub extern "C" fn midiOutUnprepareHeader() {} + +#[forward] +#[export_name = "midiStreamClose"] +pub extern "C" fn midiStreamClose() {} + +#[forward] +#[export_name = "midiStreamOpen"] +pub extern "C" fn midiStreamOpen() {} + +#[forward] +#[export_name = "midiStreamOut"] +pub extern "C" fn midiStreamOut() {} + +#[forward] +#[export_name = "midiStreamPause"] +pub extern "C" fn midiStreamPause() {} + +#[forward] +#[export_name = "midiStreamPosition"] +pub extern "C" fn midiStreamPosition() {} + +#[forward] +#[export_name = "midiStreamProperty"] +pub extern "C" fn midiStreamProperty() {} + +#[forward] +#[export_name = "midiStreamRestart"] +pub extern "C" fn midiStreamRestart() {} + +#[forward] +#[export_name = "midiStreamStop"] +pub extern "C" fn midiStreamStop() {} + +#[forward] +#[export_name = "mixerClose"] +pub extern "C" fn mixerClose() {} + +#[forward] +#[export_name = "mixerGetControlDetailsA"] +pub extern "C" fn mixerGetControlDetailsA() {} + +#[forward] +#[export_name = "mixerGetControlDetailsW"] +pub extern "C" fn mixerGetControlDetailsW() {} + +#[forward] +#[export_name = "mixerGetDevCapsA"] +pub extern "C" fn mixerGetDevCapsA() {} + +#[forward] +#[export_name = "mixerGetDevCapsW"] +pub extern "C" fn mixerGetDevCapsW() {} + +#[forward] +#[export_name = "mixerGetID"] +pub extern "C" fn mixerGetID() {} + +#[forward] +#[export_name = "mixerGetLineControlsA"] +pub extern "C" fn mixerGetLineControlsA() {} + +#[forward] +#[export_name = "mixerGetLineControlsW"] +pub extern "C" fn mixerGetLineControlsW() {} + +#[forward] +#[export_name = "mixerGetLineInfoA"] +pub extern "C" fn mixerGetLineInfoA() {} + +#[forward] +#[export_name = "mixerGetLineInfoW"] +pub extern "C" fn mixerGetLineInfoW() {} + +#[forward] +#[export_name = "mixerGetNumDevs"] +pub extern "C" fn mixerGetNumDevs() {} + +#[forward] +#[export_name = "mixerMessage"] +pub extern "C" fn mixerMessage() {} + +#[forward] +#[export_name = "mixerOpen"] +pub extern "C" fn mixerOpen() {} + +#[forward] +#[export_name = "mixerSetControlDetails"] +pub extern "C" fn mixerSetControlDetails() {} + +#[forward] +#[export_name = "mmDrvInstall"] +pub extern "C" fn mmDrvInstall() {} + +#[forward] +#[export_name = "mmGetCurrentTask"] +pub extern "C" fn mmGetCurrentTask() {} + +#[forward] +#[export_name = "mmTaskBlock"] +pub extern "C" fn mmTaskBlock() {} + +#[forward] +#[export_name = "mmTaskCreate"] +pub extern "C" fn mmTaskCreate() {} + +#[forward] +#[export_name = "mmTaskSignal"] +pub extern "C" fn mmTaskSignal() {} + +#[forward] +#[export_name = "mmTaskYield"] +pub extern "C" fn mmTaskYield() {} + +#[forward] +#[export_name = "mmioAdvance"] +pub extern "C" fn mmioAdvance() {} + +#[forward] +#[export_name = "mmioAscend"] +pub extern "C" fn mmioAscend() {} + +#[forward] +#[export_name = "mmioClose"] +pub extern "C" fn mmioClose() {} + +#[forward] +#[export_name = "mmioCreateChunk"] +pub extern "C" fn mmioCreateChunk() {} + +#[forward] +#[export_name = "mmioDescend"] +pub extern "C" fn mmioDescend() {} + +#[forward] +#[export_name = "mmioFlush"] +pub extern "C" fn mmioFlush() {} + +#[forward] +#[export_name = "mmioGetInfo"] +pub extern "C" fn mmioGetInfo() {} + +#[forward] +#[export_name = "mmioInstallIOProcA"] +pub extern "C" fn mmioInstallIOProcA() {} + +#[forward] +#[export_name = "mmioInstallIOProcW"] +pub extern "C" fn mmioInstallIOProcW() {} + +#[forward] +#[export_name = "mmioOpenA"] +pub extern "C" fn mmioOpenA() {} + +#[forward] +#[export_name = "mmioOpenW"] +pub extern "C" fn mmioOpenW() {} + +#[forward] +#[export_name = "mmioRead"] +pub extern "C" fn mmioRead() {} + +#[forward] +#[export_name = "mmioRenameA"] +pub extern "C" fn mmioRenameA() {} + +#[forward] +#[export_name = "mmioRenameW"] +pub extern "C" fn mmioRenameW() {} + +#[forward] +#[export_name = "mmioSeek"] +pub extern "C" fn mmioSeek() {} + +#[forward] +#[export_name = "mmioSendMessage"] +pub extern "C" fn mmioSendMessage() {} + +#[forward] +#[export_name = "mmioSetBuffer"] +pub extern "C" fn mmioSetBuffer() {} + +#[forward] +#[export_name = "mmioSetInfo"] +pub extern "C" fn mmioSetInfo() {} + +#[forward] +#[export_name = "mmioStringToFOURCCA"] +pub extern "C" fn mmioStringToFOURCCA() {} + +#[forward] +#[export_name = "mmioStringToFOURCCW"] +pub extern "C" fn mmioStringToFOURCCW() {} + +#[forward] +#[export_name = "mmioWrite"] +pub extern "C" fn mmioWrite() {} + +#[forward] +#[export_name = "mmsystemGetVersion"] +pub extern "C" fn mmsystemGetVersion() {} + +#[forward] +#[export_name = "mod32Message"] +pub extern "C" fn mod32Message() {} + +#[forward] +#[export_name = "mxd32Message"] +pub extern "C" fn mxd32Message() {} + +#[forward] +#[export_name = "sndPlaySoundA"] +pub extern "C" fn sndPlaySoundA() {} + +#[forward] +#[export_name = "sndPlaySoundW"] +pub extern "C" fn sndPlaySoundW() {} + +#[forward] +#[export_name = "tid32Message"] +pub extern "C" fn tid32Message() {} + +#[forward] +#[export_name = "timeEndPeriod"] +pub extern "C" fn timeEndPeriod() {} + +#[forward] +#[export_name = "timeGetDevCaps"] +pub extern "C" fn timeGetDevCaps() {} + +#[forward] +#[export_name = "timeGetSystemTime"] +pub extern "C" fn timeGetSystemTime() {} + +#[forward] +#[export_name = "timeGetTime"] +pub extern "C" fn timeGetTime() {} + +#[forward] +#[export_name = "timeKillEvent"] +pub extern "C" fn timeKillEvent() {} + +#[forward] +#[export_name = "timeSetEvent"] +pub extern "C" fn timeSetEvent() {} + +#[forward] +#[export_name = "waveInAddBuffer"] +pub extern "C" fn waveInAddBuffer() {} + +#[forward] +#[export_name = "waveInClose"] +pub extern "C" fn waveInClose() {} + +#[forward] +#[export_name = "waveInGetDevCapsA"] +pub extern "C" fn waveInGetDevCapsA() {} + +#[forward] +#[export_name = "waveInGetDevCapsW"] +pub extern "C" fn waveInGetDevCapsW() {} + +#[forward] +#[export_name = "waveInGetErrorTextA"] +pub extern "C" fn waveInGetErrorTextA() {} + +#[forward] +#[export_name = "waveInGetErrorTextW"] +pub extern "C" fn waveInGetErrorTextW() {} + +#[forward] +#[export_name = "waveInGetID"] +pub extern "C" fn waveInGetID() {} + +#[forward] +#[export_name = "waveInGetNumDevs"] +pub extern "C" fn waveInGetNumDevs() {} + +#[forward] +#[export_name = "waveInGetPosition"] +pub extern "C" fn waveInGetPosition() {} + +#[forward] +#[export_name = "waveInMessage"] +pub extern "C" fn waveInMessage() {} + +#[forward] +#[export_name = "waveInOpen"] +pub extern "C" fn waveInOpen() {} + +#[forward] +#[export_name = "waveInPrepareHeader"] +pub extern "C" fn waveInPrepareHeader() {} + +#[forward] +#[export_name = "waveInReset"] +pub extern "C" fn waveInReset() {} + +#[forward] +#[export_name = "waveInStart"] +pub extern "C" fn waveInStart() {} + +#[forward] +#[export_name = "waveInStop"] +pub extern "C" fn waveInStop() {} + +#[forward] +#[export_name = "waveInUnprepareHeader"] +pub extern "C" fn waveInUnprepareHeader() {} + +#[forward] +#[export_name = "waveOutBreakLoop"] +pub extern "C" fn waveOutBreakLoop() {} + +#[forward] +#[export_name = "waveOutClose"] +pub extern "C" fn waveOutClose() {} + +#[forward] +#[export_name = "waveOutGetDevCapsA"] +pub extern "C" fn waveOutGetDevCapsA() {} + +#[forward] +#[export_name = "waveOutGetDevCapsW"] +pub extern "C" fn waveOutGetDevCapsW() {} + +#[forward] +#[export_name = "waveOutGetErrorTextA"] +pub extern "C" fn waveOutGetErrorTextA() {} + +#[forward] +#[export_name = "waveOutGetErrorTextW"] +pub extern "C" fn waveOutGetErrorTextW() {} + +#[forward] +#[export_name = "waveOutGetID"] +pub extern "C" fn waveOutGetID() {} + +#[forward] +#[export_name = "waveOutGetNumDevs"] +pub extern "C" fn waveOutGetNumDevs() {} + +#[forward] +#[export_name = "waveOutGetPitch"] +pub extern "C" fn waveOutGetPitch() {} + +#[forward] +#[export_name = "waveOutGetPlaybackRate"] +pub extern "C" fn waveOutGetPlaybackRate() {} + +#[forward] +#[export_name = "waveOutGetPosition"] +pub extern "C" fn waveOutGetPosition() {} + +#[forward] +#[export_name = "waveOutGetVolume"] +pub extern "C" fn waveOutGetVolume() {} + +#[forward] +#[export_name = "waveOutMessage"] +pub extern "C" fn waveOutMessage() {} + +#[forward] +#[export_name = "waveOutOpen"] +pub extern "C" fn waveOutOpen() {} + +#[forward] +#[export_name = "waveOutPause"] +pub extern "C" fn waveOutPause() {} + +#[forward] +#[export_name = "waveOutPrepareHeader"] +pub extern "C" fn waveOutPrepareHeader() {} + +#[forward] +#[export_name = "waveOutReset"] +pub extern "C" fn waveOutReset() {} + +#[forward] +#[export_name = "waveOutRestart"] +pub extern "C" fn waveOutRestart() {} + +#[forward] +#[export_name = "waveOutSetPitch"] +pub extern "C" fn waveOutSetPitch() {} + +#[forward] +#[export_name = "waveOutSetPlaybackRate"] +pub extern "C" fn waveOutSetPlaybackRate() {} + +#[forward] +#[export_name = "waveOutSetVolume"] +pub extern "C" fn waveOutSetVolume() {} + +#[forward] +#[export_name = "waveOutUnprepareHeader"] +pub extern "C" fn waveOutUnprepareHeader() {} + +#[forward] +#[export_name = "waveOutWrite"] +pub extern "C" fn waveOutWrite() {} + +#[forward] +#[export_name = "wid32Message"] +pub extern "C" fn wid32Message() {} + +#[forward] +#[export_name = "wod32Message"] +pub extern "C" fn wod32Message() {} diff --git a/proxygen-macros/Cargo.toml b/proxygen-macros/Cargo.toml new file mode 100644 index 0000000..2510543 --- /dev/null +++ b/proxygen-macros/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "proxygen-macros" +keywords = ["proc-macro", "dll", "proxy", "hacking"] +readme = "README.md" +include = ["/src/**/*"] +description = "proc-macros for proxygen" +version = "0.5.1" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +proc_macro = true + +[dependencies] +quote = "1.0.33" +syn = { version = "2.0.39", features = ["extra-traits", "full"] } + diff --git a/proxygen-macros/README.md b/proxygen-macros/README.md new file mode 100644 index 0000000..fcd8f10 --- /dev/null +++ b/proxygen-macros/README.md @@ -0,0 +1,3 @@ +# proxygen-macros + +This crate contains some proc macros that should make working with proxygen proxies easier. \ No newline at end of file diff --git a/proxygen-macros/src/lib.rs b/proxygen-macros/src/lib.rs new file mode 100644 index 0000000..9ee8e36 --- /dev/null +++ b/proxygen-macros/src/lib.rs @@ -0,0 +1,350 @@ +extern crate proc_macro; +extern crate quote; +extern crate syn; + +use proc_macro::TokenStream; +use quote::quote; +use syn::{FnArg, ItemFn}; + +const GET_ARG_TYPES: fn(&FnArg) -> syn::Ident = |arg: &FnArg| match arg { + FnArg::Receiver(_) => panic!("Cannot use receivers (self) with proxy functions"), + FnArg::Typed(arg) => { + if let syn::Type::Path(syn::TypePath { + path: syn::Path { segments, .. }, + .. + }) = arg.ty.as_ref() + { + return segments.first().unwrap().ident.clone(); + } + panic!("Unsupported function signature"); + } +}; + +const GET_ARG_NAMES: fn(&FnArg) -> syn::Ident = |arg: &FnArg| match arg { + FnArg::Receiver(_) => panic!("Cannot use receivers (self) with proxy functions"), + FnArg::Typed(arg) => { + let syn::PatType { pat, .. } = &arg; + let pat = pat.clone(); + match *pat { + syn::Pat::Ident(ident) => ident.ident, + _ => panic!("Unexpected arg name: {:?}", pat), + } + } +}; + +#[derive(Debug, Clone, Copy)] +enum ProxySignatureType { + Known, + Unknown, +} + +impl From for ProxySignatureType { + fn from(meta: syn::Meta) -> Self { + match meta { + syn::Meta::Path(_) => panic!("Unsupported attribute inputs"), + syn::Meta::List(_) => panic!("Unsupported attribute inputs"), + syn::Meta::NameValue(sig) => { + if let Some(ident) = sig.path.get_ident() { + if ident.to_string() != "sig" { + panic!("Expected sig=\"unknown\" or sig=\"known\"") + } + if let syn::Expr::Lit(syn::ExprLit { + lit: syn::Lit::Str(token), + .. + }) = sig.value + { + match token.value().as_str() { + "known" => ProxySignatureType::Known, + "unknown" => ProxySignatureType::Unknown, + _ => panic!("Expected sig=\"unknown\" or sig=\"known\""), + } + } else { + panic!("Expected sig=\"unknown\" or sig=\"known\"") + } + } else { + panic!("Expected sig=\"unknown\" or sig=\"known\"") + } + } + } + } +} + +// Proc macro to forward a function call to the orginal function +// +// Note: You may not have any instructions in the function body when forwarding function calls +#[proc_macro_attribute] +pub fn forward(_attr_input: TokenStream, item: TokenStream) -> TokenStream { + let input: ItemFn = syn::parse(item).expect("You may only proxy a function"); + let func_name = input.sig.clone().ident; + let func_body = input.block.stmts.clone(); + let ret_type = input.sig.output.clone(); + let orig_index_ident = + syn::parse_str::(&format!("crate::export_indices::Index_{}", &func_name)) + .unwrap(); + let arg_types = input.sig.inputs.iter().map(GET_ARG_TYPES); + let attrs = input + .attrs + .into_iter() + .filter(|attr| !attr.path().is_ident("proxy")); + + if arg_types.len() > 0 { + panic!("You may not specifiy arguments in a forwarding proxy"); + } + match ret_type.clone() { + syn::ReturnType::Default => {} + syn::ReturnType::Type(_, ty) => match *ty { + syn::Type::Path(ref p) => { + if !p.path.is_ident("()") { + panic!("You may not specify a return type when forwarding a function call"); + } + } + syn::Type::Tuple(ref t) => { + if !t.elems.is_empty() { + panic!("You may not specify a return type when forwarding a function call"); + } + } + _ => panic!("You may not specify a return type when forwarding a function call"), + }, + }; + if func_body.len() > 0 { + panic!("Your function body will not get run in a forwarding proxy. Perhaps you meant to use a `pre_hook`?"); + } + + TokenStream::from(quote!( + #[naked] + #(#attrs)* + pub unsafe extern "C" fn #func_name() { + #[cfg(target_arch = "x86_64")] + { + std::arch::naked_asm!( + "call {wait_dll_proxy_init}", + "mov rax, qword ptr [rip + {ORIG_FUNCS_PTR}]", + "add rax, {orig_index} * 8", + "mov rax, qword ptr [rax]", + "push rax", + "ret", + wait_dll_proxy_init = sym crate::wait_dll_proxy_init, + ORIG_FUNCS_PTR = sym crate::ORIG_FUNCS_PTR, + orig_index = const #orig_index_ident, + //options(noreturn) + ) + } + + #[cfg(target_arch = "x86")] + { + std::arch::naked_asm!( + "call {wait_dll_proxy_init}", + "mov eax, dword ptr [{ORIG_FUNCS_PTR}]", + "add eax, {orig_index} * 4", + "mov eax, dword ptr [eax]", + "push eax", + "ret", + wait_dll_proxy_init = sym crate::wait_dll_proxy_init, + ORIG_FUNCS_PTR = sym crate::ORIG_FUNCS_PTR, + orig_index = const #orig_index_ident, + //options(noreturn) + ) + } + } + )) +} + +// Proc macro to bring the original function into the scope of an interceptor function as `orig_func` +#[proc_macro_attribute] +pub fn proxy(attr_input: TokenStream, item: TokenStream) -> TokenStream { + let input: ItemFn = syn::parse(item).expect("You may only proxy a function"); + let attr_input = syn::parse::(attr_input); + let func_name = input.sig.clone().ident; + let func_sig = input.sig.clone(); + let func_body = input.block.stmts.clone(); + let ret_type = input.sig.output.clone(); + let orig_index_ident = + syn::parse_str::(&format!("crate::export_indices::Index_{}", &func_name)) + .unwrap(); + let arg_types = input.sig.inputs.iter().map(GET_ARG_TYPES); + let attrs = input + .attrs + .into_iter() + .filter(|attr| !attr.path().is_ident("proxy")); + let sig_type: ProxySignatureType = match attr_input { + Ok(attr_input) => attr_input.into(), + Err(_) => panic!("Please explictly set sig=\"known\" or sig=\"unknown\". Eg. #[post_hook(sig = \"known\")]"), + }; + + match sig_type { + ProxySignatureType::Known => { + TokenStream::from(quote!( + #(#attrs)* + #func_sig { + crate::wait_dll_proxy_init(); + let orig_func: fn (#(#arg_types,)*) #ret_type = unsafe { std::mem::transmute(crate::ORIGINAL_FUNCS[#orig_index_ident]) }; + #(#func_body)* + } + )) + }, + ProxySignatureType::Unknown => panic!("You may not manual-proxy a function with an unknown signature (only pre-hooking is supported)"), + } +} + +/// Proc macro that indicates that any code in this function will be run just before the original function is called. +// +// You should explicitly set `sig="known"` if you know the function signature +// +/// The function being proxied can be accessed as `orig_func` +/// +/// Note: Returning in this function will skip running the original. +#[proc_macro_attribute] +pub fn pre_hook(attr_input: TokenStream, item: TokenStream) -> TokenStream { + let input: ItemFn = syn::parse(item).expect("You may only proxy a function"); + let attr_input = syn::parse::(attr_input); + let func_name = input.sig.ident.clone(); + let func_sig = input.sig.clone(); + let func_body = input.block.stmts.clone(); + let ret_type = input.sig.output.clone(); + let orig_index_ident = + syn::parse_str::(&format!("crate::export_indices::Index_{}", &func_name)) + .unwrap(); + let arg_names = input.sig.inputs.iter().map(GET_ARG_NAMES); + let arg_types = input.sig.inputs.iter().map(GET_ARG_TYPES); + let attrs = input + .attrs + .into_iter() + .filter(|attr| !attr.path().is_ident("pre_hook")); + let sig_type: ProxySignatureType = match attr_input { + Ok(attr_input) => attr_input.into(), + Err(_) => panic!("Please explictly set sig=\"known\" or sig=\"unknown\". Eg. #[post_hook(sig = \"known\")]"), + }; + + match sig_type { + ProxySignatureType::Known => TokenStream::from(quote!( + #(#attrs)* + #func_sig { + let orig_func: fn (#(#arg_types,)*) #ret_type = unsafe { std::mem::transmute(crate::ORIGINAL_FUNCS[#orig_index_ident]) }; + #(#func_body)* + orig_func(#(#arg_names,)*) + } + )), + ProxySignatureType::Unknown => { + if arg_names.clone().len() != 0 { + panic!("You may not specifiy any arguments when proxying a function with an unknown signature"); + } + match ret_type.clone() { + syn::ReturnType::Default => {}, + syn::ReturnType::Type(_, ty) => { + match *ty { + syn::Type::Path(ref p) => if !p.path.is_ident("()") { + panic!("You may not specify a return type when proxying a function with an unknown signature"); + }, + syn::Type::Tuple(ref t) => if !t.elems.is_empty() { + panic!("You may not specify a return type when proxying a function with an unknown signature"); + }, + _ => panic!("You may not specify a return type when proxying a function with an unknown signature") + } + } + }; + let hook_func_name = + syn::parse_str::(&format!("Proxygen_PreHook_{}", &func_name)).unwrap(); + TokenStream::from(quote!( + #[cfg(not(target_arch = "x86_64"))] + compile_error!("Pre-hooks aren't yet implemented for non x86-64"); + + #[no_mangle] + // TODO: Use the same safety/unsafety modifier as the original here + pub unsafe extern "C" fn #hook_func_name() { + let orig_func: fn () = std::mem::transmute(crate::ORIGINAL_FUNCS[#orig_index_ident]); + #(#func_body)* + } + + #[naked] + #(#attrs)* + pub unsafe extern "C" fn #func_name() { + std::arch::naked_asm!( + // Wait for dll proxy to initialize + "call {wait_dll_proxy_init}", + "mov rax, qword ptr [rip + {ORIG_FUNCS_PTR}]", + "add rax, {orig_index} * 8", + "mov rax, qword ptr [rax]", + + // Push the original function onto the stack + "push rax", + + // Save the general purpose registers + "push rdi; push rsi; push rcx; push rdx; push r8; push r9", + + // Save the 128-bit floating point registers + "sub rsp, 64", + "movaps [rsp], xmm0", + "movaps [rsp + 16], xmm1", + "movaps [rsp + 32], xmm2", + "movaps [rsp + 48], xmm3", + + // Call our hook code here + "call {proxygen_pre_hook_func}", + + // Restore the 128-bit floating point registers + "movaps xmm3, [rsp + 48]", + "movaps xmm2, [rsp + 32]", + "movaps xmm1, [rsp + 16]", + "movaps xmm0, [rsp]", + "add rsp, 64", + + // Restore the general purpose registers + "pop r9; pop r8; pop rdx; pop rcx; pop rsi; pop rdi", + + // Return to the original function + "ret", + wait_dll_proxy_init = sym crate::wait_dll_proxy_init, + ORIG_FUNCS_PTR = sym crate::ORIG_FUNCS_PTR, + orig_index = const #orig_index_ident, + proxygen_pre_hook_func = sym #hook_func_name, + //options(noreturn) + ); + } + )) + } + } +} + +/// Proc macro that indicates that any code in this function will be run after the original function is called. +/// +/// The result of calling the original function will be accessible in `orig_result`. +/// +/// Note: `orig_result` will be returned unless you choose to return your own result from this function. +#[proc_macro_attribute] +pub fn post_hook(attr_input: TokenStream, item: TokenStream) -> TokenStream { + let input: ItemFn = syn::parse(item).expect("You may only proxy a function"); + let attr_input = syn::parse::(attr_input); + let func_name = input.sig.clone().ident; + let func_sig = input.sig.clone(); + let func_body = input.block.stmts.clone(); + let ret_type = input.sig.output.clone(); + let orig_index_ident = + syn::parse_str::(&format!("crate::export_indices::Index_{}", &func_name)) + .unwrap(); + let arg_names = input.sig.inputs.iter().map(GET_ARG_NAMES); + let arg_types = input.sig.inputs.iter().map(GET_ARG_TYPES); + let attrs = input + .attrs + .into_iter() + .filter(|attr| !attr.path().is_ident("post_hook")); + let sig_type: ProxySignatureType = match attr_input { + Ok(attr_input) => attr_input.into(), + Err(_) => panic!("Please explictly set sig=\"known\" or sig=\"unknown\". Eg. #[post_hook(sig = \"known\")]"), + }; + + match sig_type { + ProxySignatureType::Known => TokenStream::from(quote!( + #(#attrs)* + #func_sig { + crate::wait_dll_proxy_init(); + let orig_func: fn (#(#arg_types,)*) #ret_type = unsafe { std::mem::transmute(crate::ORIGINAL_FUNCS[#orig_index_ident]) }; + let orig_result = orig_func(#(#arg_names,)*); + #(#func_body)* + orig_result + } + )), + ProxySignatureType::Unknown => { + panic!("You may not post-hook a function with an unknown signature (only pre-hooking is supported)"); + } + } +} From 35d3490b8c2119462b7197a71c72c80a15f411fa Mon Sep 17 00:00:00 2001 From: DeltaNeverUsed Date: Sun, 10 Nov 2024 19:31:44 +0100 Subject: [PATCH 2/3] Removed some example comments --- loader/src/export_indices.rs | 353 ++++++++++++++---------------- loader/src/intercepted_exports.rs | 49 +---- loader/src/orig_exports.rs | 115 ---------- loader/src/proxied_exports.rs | 92 -------- 4 files changed, 169 insertions(+), 440 deletions(-) diff --git a/loader/src/export_indices.rs b/loader/src/export_indices.rs index 2995ce2..f92c78e 100644 --- a/loader/src/export_indices.rs +++ b/loader/src/export_indices.rs @@ -2,195 +2,172 @@ #![allow(non_upper_case_globals)] -pub const TOTAL_EXPORTS: usize = 191; +pub const TOTAL_EXPORTS: usize = 168; pub const Index_CloseDriver: usize = 0; pub const Index_DefDriverProc: usize = 1; pub const Index_DriverCallback: usize = 2; pub const Index_DrvGetModuleHandle: usize = 3; -pub const Index_GetDriverModuleHandle: usize = 4; -pub const Index_NotifyCallbackData: usize = 5; -pub const Index_OpenDriver: usize = 6; -pub const Index_PlaySound: usize = 7; -pub const Index_PlaySoundA: usize = 8; -pub const Index_PlaySoundW: usize = 9; -pub const Index_SendDriverMessage: usize = 10; -pub const Index_WOW32DriverCallback: usize = 11; -pub const Index_WOWAppExit: usize = 12; -pub const Index_aux32Message: usize = 13; -pub const Index_auxGetDevCapsA: usize = 14; -pub const Index_auxGetDevCapsW: usize = 15; -pub const Index_auxGetNumDevs: usize = 16; -pub const Index_auxGetVolume: usize = 17; -pub const Index_auxOutMessage: usize = 18; -pub const Index_auxSetVolume: usize = 19; -pub const Index_joy32Message: usize = 20; -pub const Index_joyConfigChanged: usize = 21; -pub const Index_joyGetDevCapsA: usize = 22; -pub const Index_joyGetDevCapsW: usize = 23; -pub const Index_joyGetNumDevs: usize = 24; -pub const Index_joyGetPos: usize = 25; -pub const Index_joyGetPosEx: usize = 26; -pub const Index_joyGetThreshold: usize = 27; -pub const Index_joyReleaseCapture: usize = 28; -pub const Index_joySetCapture: usize = 29; -pub const Index_joySetThreshold: usize = 30; -pub const Index_mci32Message: usize = 31; -pub const Index_mciDriverNotify: usize = 32; -pub const Index_mciDriverYield: usize = 33; -pub const Index_mciExecute: usize = 34; -pub const Index_mciFreeCommandResource: usize = 35; -pub const Index_mciGetCreatorTask: usize = 36; -pub const Index_mciGetDeviceIDA: usize = 37; -pub const Index_mciGetDeviceIDFromElementIDA: usize = 38; -pub const Index_mciGetDeviceIDFromElementIDW: usize = 39; -pub const Index_mciGetDeviceIDW: usize = 40; -pub const Index_mciGetDriverData: usize = 41; -pub const Index_mciGetErrorStringA: usize = 42; -pub const Index_mciGetErrorStringW: usize = 43; -pub const Index_mciGetYieldProc: usize = 44; -pub const Index_mciLoadCommandResource: usize = 45; -pub const Index_mciSendCommandA: usize = 46; -pub const Index_mciSendCommandW: usize = 47; -pub const Index_mciSendStringA: usize = 48; -pub const Index_mciSendStringW: usize = 49; -pub const Index_mciSetDriverData: usize = 50; -pub const Index_mciSetYieldProc: usize = 51; -pub const Index_mid32Message: usize = 52; -pub const Index_midiConnect: usize = 53; -pub const Index_midiDisconnect: usize = 54; -pub const Index_midiInAddBuffer: usize = 55; -pub const Index_midiInClose: usize = 56; -pub const Index_midiInGetDevCapsA: usize = 57; -pub const Index_midiInGetDevCapsW: usize = 58; -pub const Index_midiInGetErrorTextA: usize = 59; -pub const Index_midiInGetErrorTextW: usize = 60; -pub const Index_midiInGetID: usize = 61; -pub const Index_midiInGetNumDevs: usize = 62; -pub const Index_midiInMessage: usize = 63; -pub const Index_midiInOpen: usize = 64; -pub const Index_midiInPrepareHeader: usize = 65; -pub const Index_midiInReset: usize = 66; -pub const Index_midiInStart: usize = 67; -pub const Index_midiInStop: usize = 68; -pub const Index_midiInUnprepareHeader: usize = 69; -pub const Index_midiOutCacheDrumPatches: usize = 70; -pub const Index_midiOutCachePatches: usize = 71; -pub const Index_midiOutClose: usize = 72; -pub const Index_midiOutGetDevCapsA: usize = 73; -pub const Index_midiOutGetDevCapsW: usize = 74; -pub const Index_midiOutGetErrorTextA: usize = 75; -pub const Index_midiOutGetErrorTextW: usize = 76; -pub const Index_midiOutGetID: usize = 77; -pub const Index_midiOutGetNumDevs: usize = 78; -pub const Index_midiOutGetVolume: usize = 79; -pub const Index_midiOutLongMsg: usize = 80; -pub const Index_midiOutMessage: usize = 81; -pub const Index_midiOutOpen: usize = 82; -pub const Index_midiOutPrepareHeader: usize = 83; -pub const Index_midiOutReset: usize = 84; -pub const Index_midiOutSetVolume: usize = 85; -pub const Index_midiOutShortMsg: usize = 86; -pub const Index_midiOutUnprepareHeader: usize = 87; -pub const Index_midiStreamClose: usize = 88; -pub const Index_midiStreamOpen: usize = 89; -pub const Index_midiStreamOut: usize = 90; -pub const Index_midiStreamPause: usize = 91; -pub const Index_midiStreamPosition: usize = 92; -pub const Index_midiStreamProperty: usize = 93; -pub const Index_midiStreamRestart: usize = 94; -pub const Index_midiStreamStop: usize = 95; -pub const Index_mixerClose: usize = 96; -pub const Index_mixerGetControlDetailsA: usize = 97; -pub const Index_mixerGetControlDetailsW: usize = 98; -pub const Index_mixerGetDevCapsA: usize = 99; -pub const Index_mixerGetDevCapsW: usize = 100; -pub const Index_mixerGetID: usize = 101; -pub const Index_mixerGetLineControlsA: usize = 102; -pub const Index_mixerGetLineControlsW: usize = 103; -pub const Index_mixerGetLineInfoA: usize = 104; -pub const Index_mixerGetLineInfoW: usize = 105; -pub const Index_mixerGetNumDevs: usize = 106; -pub const Index_mixerMessage: usize = 107; -pub const Index_mixerOpen: usize = 108; -pub const Index_mixerSetControlDetails: usize = 109; -pub const Index_mmDrvInstall: usize = 110; -pub const Index_mmGetCurrentTask: usize = 111; -pub const Index_mmTaskBlock: usize = 112; -pub const Index_mmTaskCreate: usize = 113; -pub const Index_mmTaskSignal: usize = 114; -pub const Index_mmTaskYield: usize = 115; -pub const Index_mmioAdvance: usize = 116; -pub const Index_mmioAscend: usize = 117; -pub const Index_mmioClose: usize = 118; -pub const Index_mmioCreateChunk: usize = 119; -pub const Index_mmioDescend: usize = 120; -pub const Index_mmioFlush: usize = 121; -pub const Index_mmioGetInfo: usize = 122; -pub const Index_mmioInstallIOProcA: usize = 123; -pub const Index_mmioInstallIOProcW: usize = 124; -pub const Index_mmioOpenA: usize = 125; -pub const Index_mmioOpenW: usize = 126; -pub const Index_mmioRead: usize = 127; -pub const Index_mmioRenameA: usize = 128; -pub const Index_mmioRenameW: usize = 129; -pub const Index_mmioSeek: usize = 130; -pub const Index_mmioSendMessage: usize = 131; -pub const Index_mmioSetBuffer: usize = 132; -pub const Index_mmioSetInfo: usize = 133; -pub const Index_mmioStringToFOURCCA: usize = 134; -pub const Index_mmioStringToFOURCCW: usize = 135; -pub const Index_mmioWrite: usize = 136; -pub const Index_mmsystemGetVersion: usize = 137; -pub const Index_mod32Message: usize = 138; -pub const Index_mxd32Message: usize = 139; -pub const Index_sndPlaySoundA: usize = 140; -pub const Index_sndPlaySoundW: usize = 141; -pub const Index_tid32Message: usize = 142; -pub const Index_timeBeginPeriod: usize = 143; -pub const Index_timeEndPeriod: usize = 144; -pub const Index_timeGetDevCaps: usize = 145; -pub const Index_timeGetSystemTime: usize = 146; -pub const Index_timeGetTime: usize = 147; -pub const Index_timeKillEvent: usize = 148; -pub const Index_timeSetEvent: usize = 149; -pub const Index_waveInAddBuffer: usize = 150; -pub const Index_waveInClose: usize = 151; -pub const Index_waveInGetDevCapsA: usize = 152; -pub const Index_waveInGetDevCapsW: usize = 153; -pub const Index_waveInGetErrorTextA: usize = 154; -pub const Index_waveInGetErrorTextW: usize = 155; -pub const Index_waveInGetID: usize = 156; -pub const Index_waveInGetNumDevs: usize = 157; -pub const Index_waveInGetPosition: usize = 158; -pub const Index_waveInMessage: usize = 159; -pub const Index_waveInOpen: usize = 160; -pub const Index_waveInPrepareHeader: usize = 161; -pub const Index_waveInReset: usize = 162; -pub const Index_waveInStart: usize = 163; -pub const Index_waveInStop: usize = 164; -pub const Index_waveInUnprepareHeader: usize = 165; -pub const Index_waveOutBreakLoop: usize = 166; -pub const Index_waveOutClose: usize = 167; -pub const Index_waveOutGetDevCapsA: usize = 168; -pub const Index_waveOutGetDevCapsW: usize = 169; -pub const Index_waveOutGetErrorTextA: usize = 170; -pub const Index_waveOutGetErrorTextW: usize = 171; -pub const Index_waveOutGetID: usize = 172; -pub const Index_waveOutGetNumDevs: usize = 173; -pub const Index_waveOutGetPitch: usize = 174; -pub const Index_waveOutGetPlaybackRate: usize = 175; -pub const Index_waveOutGetPosition: usize = 176; -pub const Index_waveOutGetVolume: usize = 177; -pub const Index_waveOutMessage: usize = 178; -pub const Index_waveOutOpen: usize = 179; -pub const Index_waveOutPause: usize = 180; -pub const Index_waveOutPrepareHeader: usize = 181; -pub const Index_waveOutReset: usize = 182; -pub const Index_waveOutRestart: usize = 183; -pub const Index_waveOutSetPitch: usize = 184; -pub const Index_waveOutSetPlaybackRate: usize = 185; -pub const Index_waveOutSetVolume: usize = 186; -pub const Index_waveOutUnprepareHeader: usize = 187; -pub const Index_waveOutWrite: usize = 188; -pub const Index_wid32Message: usize = 189; -pub const Index_wod32Message: usize = 190; +pub const Index_NotifyCallbackData: usize = 4; +pub const Index_OpenDriver: usize = 5; +pub const Index_PlaySound: usize = 6; +pub const Index_PlaySoundA: usize = 7; +pub const Index_PlaySoundW: usize = 8; +pub const Index_SendDriverMessage: usize = 9; +pub const Index_WOW32DriverCallback: usize = 10; +pub const Index_WOWAppExit: usize = 11; +pub const Index_aux32Message: usize = 12; +pub const Index_auxGetDevCapsA: usize = 13; +pub const Index_auxGetDevCapsW: usize = 14; +pub const Index_auxGetNumDevs: usize = 15; +pub const Index_auxGetVolume: usize = 16; +pub const Index_auxOutMessage: usize = 17; +pub const Index_auxSetVolume: usize = 18; +pub const Index_joy32Message: usize = 19; +pub const Index_joyConfigChanged: usize = 20; +pub const Index_joyGetDevCapsA: usize = 21; +pub const Index_joyGetDevCapsW: usize = 22; +pub const Index_joyGetNumDevs: usize = 23; +pub const Index_joyGetPos: usize = 24; +pub const Index_joyGetPosEx: usize = 25; +pub const Index_joyGetThreshold: usize = 26; +pub const Index_joyReleaseCapture: usize = 27; +pub const Index_joySetCapture: usize = 28; +pub const Index_joySetThreshold: usize = 29; +pub const Index_mci32Message: usize = 30; +pub const Index_mciDriverNotify: usize = 31; +pub const Index_mciDriverYield: usize = 32; +pub const Index_mciExecute: usize = 33; +pub const Index_mciGetCreatorTask: usize = 34; +pub const Index_mciGetDeviceIDA: usize = 35; +pub const Index_mciGetDeviceIDW: usize = 36; +pub const Index_mciGetDriverData: usize = 37; +pub const Index_mciGetErrorStringA: usize = 38; +pub const Index_mciGetErrorStringW: usize = 39; +pub const Index_mciGetYieldProc: usize = 40; +pub const Index_mciSendCommandA: usize = 41; +pub const Index_mciSendCommandW: usize = 42; +pub const Index_mciSendStringA: usize = 43; +pub const Index_mciSendStringW: usize = 44; +pub const Index_mciSetDriverData: usize = 45; +pub const Index_mciSetYieldProc: usize = 46; +pub const Index_mid32Message: usize = 47; +pub const Index_midiConnect: usize = 48; +pub const Index_midiDisconnect: usize = 49; +pub const Index_midiInAddBuffer: usize = 50; +pub const Index_midiInClose: usize = 51; +pub const Index_midiInGetDevCapsA: usize = 52; +pub const Index_midiInGetDevCapsW: usize = 53; +pub const Index_midiInGetErrorTextA: usize = 54; +pub const Index_midiInGetErrorTextW: usize = 55; +pub const Index_midiInGetID: usize = 56; +pub const Index_midiInGetNumDevs: usize = 57; +pub const Index_midiInMessage: usize = 58; +pub const Index_midiInOpen: usize = 59; +pub const Index_midiInPrepareHeader: usize = 60; +pub const Index_midiInReset: usize = 61; +pub const Index_midiInStart: usize = 62; +pub const Index_midiInStop: usize = 63; +pub const Index_midiOutCachePatches: usize = 64; +pub const Index_midiOutClose: usize = 65; +pub const Index_midiOutGetDevCapsA: usize = 66; +pub const Index_midiOutGetDevCapsW: usize = 67; +pub const Index_midiOutGetID: usize = 68; +pub const Index_midiOutGetNumDevs: usize = 69; +pub const Index_midiOutGetVolume: usize = 70; +pub const Index_midiOutLongMsg: usize = 71; +pub const Index_midiOutMessage: usize = 72; +pub const Index_midiOutOpen: usize = 73; +pub const Index_midiOutReset: usize = 74; +pub const Index_midiOutSetVolume: usize = 75; +pub const Index_midiOutShortMsg: usize = 76; +pub const Index_midiStreamClose: usize = 77; +pub const Index_midiStreamOpen: usize = 78; +pub const Index_midiStreamOut: usize = 79; +pub const Index_midiStreamPause: usize = 80; +pub const Index_midiStreamPosition: usize = 81; +pub const Index_midiStreamProperty: usize = 82; +pub const Index_midiStreamRestart: usize = 83; +pub const Index_midiStreamStop: usize = 84; +pub const Index_mixerClose: usize = 85; +pub const Index_mixerGetDevCapsA: usize = 86; +pub const Index_mixerGetDevCapsW: usize = 87; +pub const Index_mixerGetID: usize = 88; +pub const Index_mixerGetLineInfoA: usize = 89; +pub const Index_mixerGetLineInfoW: usize = 90; +pub const Index_mixerGetNumDevs: usize = 91; +pub const Index_mixerMessage: usize = 92; +pub const Index_mixerOpen: usize = 93; +pub const Index_mmDrvInstall: usize = 94; +pub const Index_mmGetCurrentTask: usize = 95; +pub const Index_mmTaskBlock: usize = 96; +pub const Index_mmTaskCreate: usize = 97; +pub const Index_mmTaskSignal: usize = 98; +pub const Index_mmTaskYield: usize = 99; +pub const Index_mmioAdvance: usize = 100; +pub const Index_mmioAscend: usize = 101; +pub const Index_mmioClose: usize = 102; +pub const Index_mmioCreateChunk: usize = 103; +pub const Index_mmioDescend: usize = 104; +pub const Index_mmioFlush: usize = 105; +pub const Index_mmioGetInfo: usize = 106; +pub const Index_mmioInstallIOProcA: usize = 107; +pub const Index_mmioInstallIOProcW: usize = 108; +pub const Index_mmioOpenA: usize = 109; +pub const Index_mmioOpenW: usize = 110; +pub const Index_mmioRead: usize = 111; +pub const Index_mmioRenameA: usize = 112; +pub const Index_mmioRenameW: usize = 113; +pub const Index_mmioSeek: usize = 114; +pub const Index_mmioSendMessage: usize = 115; +pub const Index_mmioSetBuffer: usize = 116; +pub const Index_mmioSetInfo: usize = 117; +pub const Index_mmioStringToFOURCCA: usize = 118; +pub const Index_mmioStringToFOURCCW: usize = 119; +pub const Index_mmioWrite: usize = 120; +pub const Index_mmsystemGetVersion: usize = 121; +pub const Index_mod32Message: usize = 122; +pub const Index_mxd32Message: usize = 123; +pub const Index_sndPlaySoundA: usize = 124; +pub const Index_sndPlaySoundW: usize = 125; +pub const Index_tid32Message: usize = 126; +pub const Index_timeBeginPeriod: usize = 127; +pub const Index_timeEndPeriod: usize = 128; +pub const Index_timeGetDevCaps: usize = 129; +pub const Index_timeGetSystemTime: usize = 130; +pub const Index_timeGetTime: usize = 131; +pub const Index_timeKillEvent: usize = 132; +pub const Index_timeSetEvent: usize = 133; +pub const Index_waveInAddBuffer: usize = 134; +pub const Index_waveInClose: usize = 135; +pub const Index_waveInGetDevCapsA: usize = 136; +pub const Index_waveInGetDevCapsW: usize = 137; +pub const Index_waveInGetErrorTextA: usize = 138; +pub const Index_waveInGetErrorTextW: usize = 139; +pub const Index_waveInGetID: usize = 140; +pub const Index_waveInGetNumDevs: usize = 141; +pub const Index_waveInGetPosition: usize = 142; +pub const Index_waveInMessage: usize = 143; +pub const Index_waveInOpen: usize = 144; +pub const Index_waveInPrepareHeader: usize = 145; +pub const Index_waveInReset: usize = 146; +pub const Index_waveInStart: usize = 147; +pub const Index_waveInStop: usize = 148; +pub const Index_waveOutBreakLoop: usize = 149; +pub const Index_waveOutClose: usize = 150; +pub const Index_waveOutGetDevCapsA: usize = 151; +pub const Index_waveOutGetDevCapsW: usize = 152; +pub const Index_waveOutGetID: usize = 153; +pub const Index_waveOutGetNumDevs: usize = 154; +pub const Index_waveOutGetPitch: usize = 155; +pub const Index_waveOutGetPosition: usize = 156; +pub const Index_waveOutGetVolume: usize = 157; +pub const Index_waveOutMessage: usize = 158; +pub const Index_waveOutOpen: usize = 159; +pub const Index_waveOutPause: usize = 160; +pub const Index_waveOutReset: usize = 161; +pub const Index_waveOutRestart: usize = 162; +pub const Index_waveOutSetPitch: usize = 163; +pub const Index_waveOutSetVolume: usize = 164; +pub const Index_waveOutWrite: usize = 165; +pub const Index_wid32Message: usize = 166; +pub const Index_wod32Message: usize = 167; diff --git a/loader/src/intercepted_exports.rs b/loader/src/intercepted_exports.rs index d4bf424..a0a503f 100644 --- a/loader/src/intercepted_exports.rs +++ b/loader/src/intercepted_exports.rs @@ -1,57 +1,16 @@ -// Intercepted/replaced functions go here -// Remember to run `proxygen update .` in the root of this project every time you add or remove an export here -// -// Example function proxies/hooks. -// Note, if using any of the `proxy`, `pre_hook` or `post_hook` macros, you will have access to the original function -// You can easily call `orig_func` with the same args as your interceptor function -// NOTE: Use the correct arg types and return type for any functions you proxy, or else you will probably mess up the stack -// and you will probably crash whatever program the DLL is loaded into -// -// #[pre_hook(sig="known")] -// #[export_name="SomeFunction"] -// pub extern "C" fn SomeFunction(some_arg_1: usize, some_arg_2: u32) -> bool { -// println!("Pre-hooked SomeFunction. Args: {}, {}", some_arg_1, some_arg_2); -// // After all our code in this pre-hook runs, if we don't return, the original function will be called -// // and its result will be returned -// } -// -// #[proxy(sig="known")] -// #[export_name="SomeFunction"] -// pub extern "C" fn SomeFunction(some_arg_1: usize, some_arg_2: u32) -> bool { -// let orig_result = orig_func(some_arg_1, some_arg_2); -// println!("Manually proxied SomeFunction. Args: {}, {}. Result: {}", some_arg_1, some_arg_2, orig_result); -// // This is just a normal/manual proxy. It is up to us to return a value. -// // Also note that the original function `orig_func` will not be run in this case unless we explicitly call it -// true -// } -// -// #[post_hook(sig="known")] -// #[export_name="SomeFunction"] -// pub extern "C" fn SomeFunction(some_arg_1: usize, some_arg_2: u32) -> bool { -// // `orig_func` got run just before our code. Its result is stored in `orig_result` -// println!("In post-hook for SomeFunction. Args: {}, {}. Result: {}", some_arg_1, some_arg_2, orig_result); -// // We could manually return something here if we didn't want `orig_result` returned -// } -// -// #[pre_hook(sig="unknown")] -// #[export_name="SomeFunction"] -// pub extern "C" fn SomeFunction() { -// println!("In pre-hook for SomeFunction. (signature unknown)") -// } - -static mut started: bool = false; - #[allow(unused_imports)] use proxygen_macros::{forward, post_hook, pre_hook, proxy}; use crate::start; +static mut STARTED: bool = false; + #[pre_hook(sig = "unknown")] #[export_name = "timeBeginPeriod"] pub extern "C" fn timeBeginPeriod() { - if started { + if STARTED { return; } - started = true; + STARTED = true; start(); } diff --git a/loader/src/orig_exports.rs b/loader/src/orig_exports.rs index a647231..1326940 100644 --- a/loader/src/orig_exports.rs +++ b/loader/src/orig_exports.rs @@ -26,11 +26,6 @@ pub unsafe fn load_dll_funcs() { load_dll_func(Index_DefDriverProc, dll_handle, "DefDriverProc"); load_dll_func(Index_DriverCallback, dll_handle, "DriverCallback"); load_dll_func(Index_DrvGetModuleHandle, dll_handle, "DrvGetModuleHandle"); - load_dll_func( - Index_GetDriverModuleHandle, - dll_handle, - "GetDriverModuleHandle", - ); load_dll_func(Index_NotifyCallbackData, dll_handle, "NotifyCallbackData"); load_dll_func(Index_OpenDriver, dll_handle, "OpenDriver"); load_dll_func(Index_PlaySound, dll_handle, "PlaySound"); @@ -61,33 +56,13 @@ pub unsafe fn load_dll_funcs() { load_dll_func(Index_mciDriverNotify, dll_handle, "mciDriverNotify"); load_dll_func(Index_mciDriverYield, dll_handle, "mciDriverYield"); load_dll_func(Index_mciExecute, dll_handle, "mciExecute"); - load_dll_func( - Index_mciFreeCommandResource, - dll_handle, - "mciFreeCommandResource", - ); load_dll_func(Index_mciGetCreatorTask, dll_handle, "mciGetCreatorTask"); load_dll_func(Index_mciGetDeviceIDA, dll_handle, "mciGetDeviceIDA"); - load_dll_func( - Index_mciGetDeviceIDFromElementIDA, - dll_handle, - "mciGetDeviceIDFromElementIDA", - ); - load_dll_func( - Index_mciGetDeviceIDFromElementIDW, - dll_handle, - "mciGetDeviceIDFromElementIDW", - ); load_dll_func(Index_mciGetDeviceIDW, dll_handle, "mciGetDeviceIDW"); load_dll_func(Index_mciGetDriverData, dll_handle, "mciGetDriverData"); load_dll_func(Index_mciGetErrorStringA, dll_handle, "mciGetErrorStringA"); load_dll_func(Index_mciGetErrorStringW, dll_handle, "mciGetErrorStringW"); load_dll_func(Index_mciGetYieldProc, dll_handle, "mciGetYieldProc"); - load_dll_func( - Index_mciLoadCommandResource, - dll_handle, - "mciLoadCommandResource", - ); load_dll_func(Index_mciSendCommandA, dll_handle, "mciSendCommandA"); load_dll_func(Index_mciSendCommandW, dll_handle, "mciSendCommandW"); load_dll_func(Index_mciSendStringA, dll_handle, "mciSendStringA"); @@ -111,49 +86,19 @@ pub unsafe fn load_dll_funcs() { load_dll_func(Index_midiInReset, dll_handle, "midiInReset"); load_dll_func(Index_midiInStart, dll_handle, "midiInStart"); load_dll_func(Index_midiInStop, dll_handle, "midiInStop"); - load_dll_func( - Index_midiInUnprepareHeader, - dll_handle, - "midiInUnprepareHeader", - ); - load_dll_func( - Index_midiOutCacheDrumPatches, - dll_handle, - "midiOutCacheDrumPatches", - ); load_dll_func(Index_midiOutCachePatches, dll_handle, "midiOutCachePatches"); load_dll_func(Index_midiOutClose, dll_handle, "midiOutClose"); load_dll_func(Index_midiOutGetDevCapsA, dll_handle, "midiOutGetDevCapsA"); load_dll_func(Index_midiOutGetDevCapsW, dll_handle, "midiOutGetDevCapsW"); - load_dll_func( - Index_midiOutGetErrorTextA, - dll_handle, - "midiOutGetErrorTextA", - ); - load_dll_func( - Index_midiOutGetErrorTextW, - dll_handle, - "midiOutGetErrorTextW", - ); load_dll_func(Index_midiOutGetID, dll_handle, "midiOutGetID"); load_dll_func(Index_midiOutGetNumDevs, dll_handle, "midiOutGetNumDevs"); load_dll_func(Index_midiOutGetVolume, dll_handle, "midiOutGetVolume"); load_dll_func(Index_midiOutLongMsg, dll_handle, "midiOutLongMsg"); load_dll_func(Index_midiOutMessage, dll_handle, "midiOutMessage"); load_dll_func(Index_midiOutOpen, dll_handle, "midiOutOpen"); - load_dll_func( - Index_midiOutPrepareHeader, - dll_handle, - "midiOutPrepareHeader", - ); load_dll_func(Index_midiOutReset, dll_handle, "midiOutReset"); load_dll_func(Index_midiOutSetVolume, dll_handle, "midiOutSetVolume"); load_dll_func(Index_midiOutShortMsg, dll_handle, "midiOutShortMsg"); - load_dll_func( - Index_midiOutUnprepareHeader, - dll_handle, - "midiOutUnprepareHeader", - ); load_dll_func(Index_midiStreamClose, dll_handle, "midiStreamClose"); load_dll_func(Index_midiStreamOpen, dll_handle, "midiStreamOpen"); load_dll_func(Index_midiStreamOut, dll_handle, "midiStreamOut"); @@ -163,39 +108,14 @@ pub unsafe fn load_dll_funcs() { load_dll_func(Index_midiStreamRestart, dll_handle, "midiStreamRestart"); load_dll_func(Index_midiStreamStop, dll_handle, "midiStreamStop"); load_dll_func(Index_mixerClose, dll_handle, "mixerClose"); - load_dll_func( - Index_mixerGetControlDetailsA, - dll_handle, - "mixerGetControlDetailsA", - ); - load_dll_func( - Index_mixerGetControlDetailsW, - dll_handle, - "mixerGetControlDetailsW", - ); load_dll_func(Index_mixerGetDevCapsA, dll_handle, "mixerGetDevCapsA"); load_dll_func(Index_mixerGetDevCapsW, dll_handle, "mixerGetDevCapsW"); load_dll_func(Index_mixerGetID, dll_handle, "mixerGetID"); - load_dll_func( - Index_mixerGetLineControlsA, - dll_handle, - "mixerGetLineControlsA", - ); - load_dll_func( - Index_mixerGetLineControlsW, - dll_handle, - "mixerGetLineControlsW", - ); load_dll_func(Index_mixerGetLineInfoA, dll_handle, "mixerGetLineInfoA"); load_dll_func(Index_mixerGetLineInfoW, dll_handle, "mixerGetLineInfoW"); load_dll_func(Index_mixerGetNumDevs, dll_handle, "mixerGetNumDevs"); load_dll_func(Index_mixerMessage, dll_handle, "mixerMessage"); load_dll_func(Index_mixerOpen, dll_handle, "mixerOpen"); - load_dll_func( - Index_mixerSetControlDetails, - dll_handle, - "mixerSetControlDetails", - ); load_dll_func(Index_mmDrvInstall, dll_handle, "mmDrvInstall"); load_dll_func(Index_mmGetCurrentTask, dll_handle, "mmGetCurrentTask"); load_dll_func(Index_mmTaskBlock, dll_handle, "mmTaskBlock"); @@ -251,57 +171,22 @@ pub unsafe fn load_dll_funcs() { load_dll_func(Index_waveInReset, dll_handle, "waveInReset"); load_dll_func(Index_waveInStart, dll_handle, "waveInStart"); load_dll_func(Index_waveInStop, dll_handle, "waveInStop"); - load_dll_func( - Index_waveInUnprepareHeader, - dll_handle, - "waveInUnprepareHeader", - ); load_dll_func(Index_waveOutBreakLoop, dll_handle, "waveOutBreakLoop"); load_dll_func(Index_waveOutClose, dll_handle, "waveOutClose"); load_dll_func(Index_waveOutGetDevCapsA, dll_handle, "waveOutGetDevCapsA"); load_dll_func(Index_waveOutGetDevCapsW, dll_handle, "waveOutGetDevCapsW"); - load_dll_func( - Index_waveOutGetErrorTextA, - dll_handle, - "waveOutGetErrorTextA", - ); - load_dll_func( - Index_waveOutGetErrorTextW, - dll_handle, - "waveOutGetErrorTextW", - ); load_dll_func(Index_waveOutGetID, dll_handle, "waveOutGetID"); load_dll_func(Index_waveOutGetNumDevs, dll_handle, "waveOutGetNumDevs"); load_dll_func(Index_waveOutGetPitch, dll_handle, "waveOutGetPitch"); - load_dll_func( - Index_waveOutGetPlaybackRate, - dll_handle, - "waveOutGetPlaybackRate", - ); load_dll_func(Index_waveOutGetPosition, dll_handle, "waveOutGetPosition"); load_dll_func(Index_waveOutGetVolume, dll_handle, "waveOutGetVolume"); load_dll_func(Index_waveOutMessage, dll_handle, "waveOutMessage"); load_dll_func(Index_waveOutOpen, dll_handle, "waveOutOpen"); load_dll_func(Index_waveOutPause, dll_handle, "waveOutPause"); - load_dll_func( - Index_waveOutPrepareHeader, - dll_handle, - "waveOutPrepareHeader", - ); load_dll_func(Index_waveOutReset, dll_handle, "waveOutReset"); load_dll_func(Index_waveOutRestart, dll_handle, "waveOutRestart"); load_dll_func(Index_waveOutSetPitch, dll_handle, "waveOutSetPitch"); - load_dll_func( - Index_waveOutSetPlaybackRate, - dll_handle, - "waveOutSetPlaybackRate", - ); load_dll_func(Index_waveOutSetVolume, dll_handle, "waveOutSetVolume"); - load_dll_func( - Index_waveOutUnprepareHeader, - dll_handle, - "waveOutUnprepareHeader", - ); load_dll_func(Index_waveOutWrite, dll_handle, "waveOutWrite"); load_dll_func(Index_wid32Message, dll_handle, "wid32Message"); load_dll_func(Index_wod32Message, dll_handle, "wod32Message"); diff --git a/loader/src/proxied_exports.rs b/loader/src/proxied_exports.rs index 77448a0..b3994fe 100644 --- a/loader/src/proxied_exports.rs +++ b/loader/src/proxied_exports.rs @@ -17,10 +17,6 @@ pub extern "C" fn DriverCallback() {} #[export_name = "DrvGetModuleHandle"] pub extern "C" fn DrvGetModuleHandle() {} -#[forward] -#[export_name = "GetDriverModuleHandle"] -pub extern "C" fn GetDriverModuleHandle() {} - #[forward] #[export_name = "NotifyCallbackData"] pub extern "C" fn NotifyCallbackData() {} @@ -141,10 +137,6 @@ pub extern "C" fn mciDriverYield() {} #[export_name = "mciExecute"] pub extern "C" fn mciExecute() {} -#[forward] -#[export_name = "mciFreeCommandResource"] -pub extern "C" fn mciFreeCommandResource() {} - #[forward] #[export_name = "mciGetCreatorTask"] pub extern "C" fn mciGetCreatorTask() {} @@ -153,14 +145,6 @@ pub extern "C" fn mciGetCreatorTask() {} #[export_name = "mciGetDeviceIDA"] pub extern "C" fn mciGetDeviceIDA() {} -#[forward] -#[export_name = "mciGetDeviceIDFromElementIDA"] -pub extern "C" fn mciGetDeviceIDFromElementIDA() {} - -#[forward] -#[export_name = "mciGetDeviceIDFromElementIDW"] -pub extern "C" fn mciGetDeviceIDFromElementIDW() {} - #[forward] #[export_name = "mciGetDeviceIDW"] pub extern "C" fn mciGetDeviceIDW() {} @@ -181,10 +165,6 @@ pub extern "C" fn mciGetErrorStringW() {} #[export_name = "mciGetYieldProc"] pub extern "C" fn mciGetYieldProc() {} -#[forward] -#[export_name = "mciLoadCommandResource"] -pub extern "C" fn mciLoadCommandResource() {} - #[forward] #[export_name = "mciSendCommandA"] pub extern "C" fn mciSendCommandA() {} @@ -277,14 +257,6 @@ pub extern "C" fn midiInStart() {} #[export_name = "midiInStop"] pub extern "C" fn midiInStop() {} -#[forward] -#[export_name = "midiInUnprepareHeader"] -pub extern "C" fn midiInUnprepareHeader() {} - -#[forward] -#[export_name = "midiOutCacheDrumPatches"] -pub extern "C" fn midiOutCacheDrumPatches() {} - #[forward] #[export_name = "midiOutCachePatches"] pub extern "C" fn midiOutCachePatches() {} @@ -301,14 +273,6 @@ pub extern "C" fn midiOutGetDevCapsA() {} #[export_name = "midiOutGetDevCapsW"] pub extern "C" fn midiOutGetDevCapsW() {} -#[forward] -#[export_name = "midiOutGetErrorTextA"] -pub extern "C" fn midiOutGetErrorTextA() {} - -#[forward] -#[export_name = "midiOutGetErrorTextW"] -pub extern "C" fn midiOutGetErrorTextW() {} - #[forward] #[export_name = "midiOutGetID"] pub extern "C" fn midiOutGetID() {} @@ -333,10 +297,6 @@ pub extern "C" fn midiOutMessage() {} #[export_name = "midiOutOpen"] pub extern "C" fn midiOutOpen() {} -#[forward] -#[export_name = "midiOutPrepareHeader"] -pub extern "C" fn midiOutPrepareHeader() {} - #[forward] #[export_name = "midiOutReset"] pub extern "C" fn midiOutReset() {} @@ -349,10 +309,6 @@ pub extern "C" fn midiOutSetVolume() {} #[export_name = "midiOutShortMsg"] pub extern "C" fn midiOutShortMsg() {} -#[forward] -#[export_name = "midiOutUnprepareHeader"] -pub extern "C" fn midiOutUnprepareHeader() {} - #[forward] #[export_name = "midiStreamClose"] pub extern "C" fn midiStreamClose() {} @@ -389,14 +345,6 @@ pub extern "C" fn midiStreamStop() {} #[export_name = "mixerClose"] pub extern "C" fn mixerClose() {} -#[forward] -#[export_name = "mixerGetControlDetailsA"] -pub extern "C" fn mixerGetControlDetailsA() {} - -#[forward] -#[export_name = "mixerGetControlDetailsW"] -pub extern "C" fn mixerGetControlDetailsW() {} - #[forward] #[export_name = "mixerGetDevCapsA"] pub extern "C" fn mixerGetDevCapsA() {} @@ -409,14 +357,6 @@ pub extern "C" fn mixerGetDevCapsW() {} #[export_name = "mixerGetID"] pub extern "C" fn mixerGetID() {} -#[forward] -#[export_name = "mixerGetLineControlsA"] -pub extern "C" fn mixerGetLineControlsA() {} - -#[forward] -#[export_name = "mixerGetLineControlsW"] -pub extern "C" fn mixerGetLineControlsW() {} - #[forward] #[export_name = "mixerGetLineInfoA"] pub extern "C" fn mixerGetLineInfoA() {} @@ -437,10 +377,6 @@ pub extern "C" fn mixerMessage() {} #[export_name = "mixerOpen"] pub extern "C" fn mixerOpen() {} -#[forward] -#[export_name = "mixerSetControlDetails"] -pub extern "C" fn mixerSetControlDetails() {} - #[forward] #[export_name = "mmDrvInstall"] pub extern "C" fn mmDrvInstall() {} @@ -657,10 +593,6 @@ pub extern "C" fn waveInStart() {} #[export_name = "waveInStop"] pub extern "C" fn waveInStop() {} -#[forward] -#[export_name = "waveInUnprepareHeader"] -pub extern "C" fn waveInUnprepareHeader() {} - #[forward] #[export_name = "waveOutBreakLoop"] pub extern "C" fn waveOutBreakLoop() {} @@ -677,14 +609,6 @@ pub extern "C" fn waveOutGetDevCapsA() {} #[export_name = "waveOutGetDevCapsW"] pub extern "C" fn waveOutGetDevCapsW() {} -#[forward] -#[export_name = "waveOutGetErrorTextA"] -pub extern "C" fn waveOutGetErrorTextA() {} - -#[forward] -#[export_name = "waveOutGetErrorTextW"] -pub extern "C" fn waveOutGetErrorTextW() {} - #[forward] #[export_name = "waveOutGetID"] pub extern "C" fn waveOutGetID() {} @@ -697,10 +621,6 @@ pub extern "C" fn waveOutGetNumDevs() {} #[export_name = "waveOutGetPitch"] pub extern "C" fn waveOutGetPitch() {} -#[forward] -#[export_name = "waveOutGetPlaybackRate"] -pub extern "C" fn waveOutGetPlaybackRate() {} - #[forward] #[export_name = "waveOutGetPosition"] pub extern "C" fn waveOutGetPosition() {} @@ -721,10 +641,6 @@ pub extern "C" fn waveOutOpen() {} #[export_name = "waveOutPause"] pub extern "C" fn waveOutPause() {} -#[forward] -#[export_name = "waveOutPrepareHeader"] -pub extern "C" fn waveOutPrepareHeader() {} - #[forward] #[export_name = "waveOutReset"] pub extern "C" fn waveOutReset() {} @@ -737,18 +653,10 @@ pub extern "C" fn waveOutRestart() {} #[export_name = "waveOutSetPitch"] pub extern "C" fn waveOutSetPitch() {} -#[forward] -#[export_name = "waveOutSetPlaybackRate"] -pub extern "C" fn waveOutSetPlaybackRate() {} - #[forward] #[export_name = "waveOutSetVolume"] pub extern "C" fn waveOutSetVolume() {} -#[forward] -#[export_name = "waveOutUnprepareHeader"] -pub extern "C" fn waveOutUnprepareHeader() {} - #[forward] #[export_name = "waveOutWrite"] pub extern "C" fn waveOutWrite() {} From b903de616b70fb451f8ef46da88dcddb8c806ed0 Mon Sep 17 00:00:00 2001 From: DeltaNeverUsed Date: Sun, 10 Nov 2024 19:39:33 +0100 Subject: [PATCH 3/3] Fix version of winmm --- loader/src/export_indices.rs | 320 ++++++++++++------------ loader/src/orig_exports.rs | 34 ++- loader/src/proxied_exports.rs | 441 +++++++++++++++++++--------------- 3 files changed, 434 insertions(+), 361 deletions(-) diff --git a/loader/src/export_indices.rs b/loader/src/export_indices.rs index f92c78e..b62e67f 100644 --- a/loader/src/export_indices.rs +++ b/loader/src/export_indices.rs @@ -2,172 +2,184 @@ #![allow(non_upper_case_globals)] -pub const TOTAL_EXPORTS: usize = 168; +pub const TOTAL_EXPORTS: usize = 180; pub const Index_CloseDriver: usize = 0; pub const Index_DefDriverProc: usize = 1; pub const Index_DriverCallback: usize = 2; pub const Index_DrvGetModuleHandle: usize = 3; -pub const Index_NotifyCallbackData: usize = 4; +pub const Index_GetDriverModuleHandle: usize = 4; pub const Index_OpenDriver: usize = 5; pub const Index_PlaySound: usize = 6; pub const Index_PlaySoundA: usize = 7; pub const Index_PlaySoundW: usize = 8; pub const Index_SendDriverMessage: usize = 9; -pub const Index_WOW32DriverCallback: usize = 10; -pub const Index_WOWAppExit: usize = 11; -pub const Index_aux32Message: usize = 12; -pub const Index_auxGetDevCapsA: usize = 13; -pub const Index_auxGetDevCapsW: usize = 14; -pub const Index_auxGetNumDevs: usize = 15; -pub const Index_auxGetVolume: usize = 16; -pub const Index_auxOutMessage: usize = 17; -pub const Index_auxSetVolume: usize = 18; -pub const Index_joy32Message: usize = 19; -pub const Index_joyConfigChanged: usize = 20; -pub const Index_joyGetDevCapsA: usize = 21; -pub const Index_joyGetDevCapsW: usize = 22; -pub const Index_joyGetNumDevs: usize = 23; -pub const Index_joyGetPos: usize = 24; -pub const Index_joyGetPosEx: usize = 25; -pub const Index_joyGetThreshold: usize = 26; -pub const Index_joyReleaseCapture: usize = 27; -pub const Index_joySetCapture: usize = 28; -pub const Index_joySetThreshold: usize = 29; -pub const Index_mci32Message: usize = 30; -pub const Index_mciDriverNotify: usize = 31; -pub const Index_mciDriverYield: usize = 32; -pub const Index_mciExecute: usize = 33; -pub const Index_mciGetCreatorTask: usize = 34; -pub const Index_mciGetDeviceIDA: usize = 35; -pub const Index_mciGetDeviceIDW: usize = 36; -pub const Index_mciGetDriverData: usize = 37; -pub const Index_mciGetErrorStringA: usize = 38; -pub const Index_mciGetErrorStringW: usize = 39; -pub const Index_mciGetYieldProc: usize = 40; +pub const Index_WOWAppExit: usize = 10; +pub const Index_auxGetDevCapsA: usize = 11; +pub const Index_auxGetDevCapsW: usize = 12; +pub const Index_auxGetNumDevs: usize = 13; +pub const Index_auxGetVolume: usize = 14; +pub const Index_auxOutMessage: usize = 15; +pub const Index_auxSetVolume: usize = 16; +pub const Index_joyConfigChanged: usize = 17; +pub const Index_joyGetDevCapsA: usize = 18; +pub const Index_joyGetDevCapsW: usize = 19; +pub const Index_joyGetNumDevs: usize = 20; +pub const Index_joyGetPos: usize = 21; +pub const Index_joyGetPosEx: usize = 22; +pub const Index_joyGetThreshold: usize = 23; +pub const Index_joyReleaseCapture: usize = 24; +pub const Index_joySetCapture: usize = 25; +pub const Index_joySetThreshold: usize = 26; +pub const Index_mciDriverNotify: usize = 27; +pub const Index_mciDriverYield: usize = 28; +pub const Index_mciExecute: usize = 29; +pub const Index_mciFreeCommandResource: usize = 30; +pub const Index_mciGetCreatorTask: usize = 31; +pub const Index_mciGetDeviceIDA: usize = 32; +pub const Index_mciGetDeviceIDFromElementIDA: usize = 33; +pub const Index_mciGetDeviceIDFromElementIDW: usize = 34; +pub const Index_mciGetDeviceIDW: usize = 35; +pub const Index_mciGetDriverData: usize = 36; +pub const Index_mciGetErrorStringA: usize = 37; +pub const Index_mciGetErrorStringW: usize = 38; +pub const Index_mciGetYieldProc: usize = 39; +pub const Index_mciLoadCommandResource: usize = 40; pub const Index_mciSendCommandA: usize = 41; pub const Index_mciSendCommandW: usize = 42; pub const Index_mciSendStringA: usize = 43; pub const Index_mciSendStringW: usize = 44; pub const Index_mciSetDriverData: usize = 45; pub const Index_mciSetYieldProc: usize = 46; -pub const Index_mid32Message: usize = 47; -pub const Index_midiConnect: usize = 48; -pub const Index_midiDisconnect: usize = 49; -pub const Index_midiInAddBuffer: usize = 50; -pub const Index_midiInClose: usize = 51; -pub const Index_midiInGetDevCapsA: usize = 52; -pub const Index_midiInGetDevCapsW: usize = 53; -pub const Index_midiInGetErrorTextA: usize = 54; -pub const Index_midiInGetErrorTextW: usize = 55; -pub const Index_midiInGetID: usize = 56; -pub const Index_midiInGetNumDevs: usize = 57; -pub const Index_midiInMessage: usize = 58; -pub const Index_midiInOpen: usize = 59; -pub const Index_midiInPrepareHeader: usize = 60; -pub const Index_midiInReset: usize = 61; -pub const Index_midiInStart: usize = 62; -pub const Index_midiInStop: usize = 63; -pub const Index_midiOutCachePatches: usize = 64; -pub const Index_midiOutClose: usize = 65; -pub const Index_midiOutGetDevCapsA: usize = 66; -pub const Index_midiOutGetDevCapsW: usize = 67; -pub const Index_midiOutGetID: usize = 68; -pub const Index_midiOutGetNumDevs: usize = 69; -pub const Index_midiOutGetVolume: usize = 70; -pub const Index_midiOutLongMsg: usize = 71; -pub const Index_midiOutMessage: usize = 72; -pub const Index_midiOutOpen: usize = 73; -pub const Index_midiOutReset: usize = 74; -pub const Index_midiOutSetVolume: usize = 75; -pub const Index_midiOutShortMsg: usize = 76; -pub const Index_midiStreamClose: usize = 77; -pub const Index_midiStreamOpen: usize = 78; -pub const Index_midiStreamOut: usize = 79; -pub const Index_midiStreamPause: usize = 80; -pub const Index_midiStreamPosition: usize = 81; -pub const Index_midiStreamProperty: usize = 82; -pub const Index_midiStreamRestart: usize = 83; -pub const Index_midiStreamStop: usize = 84; -pub const Index_mixerClose: usize = 85; -pub const Index_mixerGetDevCapsA: usize = 86; -pub const Index_mixerGetDevCapsW: usize = 87; -pub const Index_mixerGetID: usize = 88; -pub const Index_mixerGetLineInfoA: usize = 89; -pub const Index_mixerGetLineInfoW: usize = 90; -pub const Index_mixerGetNumDevs: usize = 91; -pub const Index_mixerMessage: usize = 92; -pub const Index_mixerOpen: usize = 93; -pub const Index_mmDrvInstall: usize = 94; -pub const Index_mmGetCurrentTask: usize = 95; -pub const Index_mmTaskBlock: usize = 96; -pub const Index_mmTaskCreate: usize = 97; -pub const Index_mmTaskSignal: usize = 98; -pub const Index_mmTaskYield: usize = 99; -pub const Index_mmioAdvance: usize = 100; -pub const Index_mmioAscend: usize = 101; -pub const Index_mmioClose: usize = 102; -pub const Index_mmioCreateChunk: usize = 103; -pub const Index_mmioDescend: usize = 104; -pub const Index_mmioFlush: usize = 105; -pub const Index_mmioGetInfo: usize = 106; -pub const Index_mmioInstallIOProcA: usize = 107; -pub const Index_mmioInstallIOProcW: usize = 108; -pub const Index_mmioOpenA: usize = 109; -pub const Index_mmioOpenW: usize = 110; -pub const Index_mmioRead: usize = 111; -pub const Index_mmioRenameA: usize = 112; -pub const Index_mmioRenameW: usize = 113; -pub const Index_mmioSeek: usize = 114; -pub const Index_mmioSendMessage: usize = 115; -pub const Index_mmioSetBuffer: usize = 116; -pub const Index_mmioSetInfo: usize = 117; -pub const Index_mmioStringToFOURCCA: usize = 118; -pub const Index_mmioStringToFOURCCW: usize = 119; -pub const Index_mmioWrite: usize = 120; -pub const Index_mmsystemGetVersion: usize = 121; -pub const Index_mod32Message: usize = 122; -pub const Index_mxd32Message: usize = 123; -pub const Index_sndPlaySoundA: usize = 124; -pub const Index_sndPlaySoundW: usize = 125; -pub const Index_tid32Message: usize = 126; -pub const Index_timeBeginPeriod: usize = 127; -pub const Index_timeEndPeriod: usize = 128; -pub const Index_timeGetDevCaps: usize = 129; -pub const Index_timeGetSystemTime: usize = 130; -pub const Index_timeGetTime: usize = 131; -pub const Index_timeKillEvent: usize = 132; -pub const Index_timeSetEvent: usize = 133; -pub const Index_waveInAddBuffer: usize = 134; -pub const Index_waveInClose: usize = 135; -pub const Index_waveInGetDevCapsA: usize = 136; -pub const Index_waveInGetDevCapsW: usize = 137; -pub const Index_waveInGetErrorTextA: usize = 138; -pub const Index_waveInGetErrorTextW: usize = 139; -pub const Index_waveInGetID: usize = 140; -pub const Index_waveInGetNumDevs: usize = 141; -pub const Index_waveInGetPosition: usize = 142; -pub const Index_waveInMessage: usize = 143; -pub const Index_waveInOpen: usize = 144; -pub const Index_waveInPrepareHeader: usize = 145; -pub const Index_waveInReset: usize = 146; -pub const Index_waveInStart: usize = 147; -pub const Index_waveInStop: usize = 148; -pub const Index_waveOutBreakLoop: usize = 149; -pub const Index_waveOutClose: usize = 150; -pub const Index_waveOutGetDevCapsA: usize = 151; -pub const Index_waveOutGetDevCapsW: usize = 152; -pub const Index_waveOutGetID: usize = 153; -pub const Index_waveOutGetNumDevs: usize = 154; -pub const Index_waveOutGetPitch: usize = 155; -pub const Index_waveOutGetPosition: usize = 156; -pub const Index_waveOutGetVolume: usize = 157; -pub const Index_waveOutMessage: usize = 158; -pub const Index_waveOutOpen: usize = 159; -pub const Index_waveOutPause: usize = 160; -pub const Index_waveOutReset: usize = 161; -pub const Index_waveOutRestart: usize = 162; -pub const Index_waveOutSetPitch: usize = 163; -pub const Index_waveOutSetVolume: usize = 164; -pub const Index_waveOutWrite: usize = 165; -pub const Index_wid32Message: usize = 166; -pub const Index_wod32Message: usize = 167; +pub const Index_midiConnect: usize = 47; +pub const Index_midiDisconnect: usize = 48; +pub const Index_midiInAddBuffer: usize = 49; +pub const Index_midiInClose: usize = 50; +pub const Index_midiInGetDevCapsA: usize = 51; +pub const Index_midiInGetDevCapsW: usize = 52; +pub const Index_midiInGetErrorTextA: usize = 53; +pub const Index_midiInGetErrorTextW: usize = 54; +pub const Index_midiInGetID: usize = 55; +pub const Index_midiInGetNumDevs: usize = 56; +pub const Index_midiInMessage: usize = 57; +pub const Index_midiInOpen: usize = 58; +pub const Index_midiInPrepareHeader: usize = 59; +pub const Index_midiInReset: usize = 60; +pub const Index_midiInStart: usize = 61; +pub const Index_midiInStop: usize = 62; +pub const Index_midiInUnprepareHeader: usize = 63; +pub const Index_midiOutCacheDrumPatches: usize = 64; +pub const Index_midiOutCachePatches: usize = 65; +pub const Index_midiOutClose: usize = 66; +pub const Index_midiOutGetDevCapsA: usize = 67; +pub const Index_midiOutGetDevCapsW: usize = 68; +pub const Index_midiOutGetErrorTextA: usize = 69; +pub const Index_midiOutGetErrorTextW: usize = 70; +pub const Index_midiOutGetID: usize = 71; +pub const Index_midiOutGetNumDevs: usize = 72; +pub const Index_midiOutGetVolume: usize = 73; +pub const Index_midiOutLongMsg: usize = 74; +pub const Index_midiOutMessage: usize = 75; +pub const Index_midiOutOpen: usize = 76; +pub const Index_midiOutPrepareHeader: usize = 77; +pub const Index_midiOutReset: usize = 78; +pub const Index_midiOutSetVolume: usize = 79; +pub const Index_midiOutShortMsg: usize = 80; +pub const Index_midiOutUnprepareHeader: usize = 81; +pub const Index_midiStreamClose: usize = 82; +pub const Index_midiStreamOpen: usize = 83; +pub const Index_midiStreamOut: usize = 84; +pub const Index_midiStreamPause: usize = 85; +pub const Index_midiStreamPosition: usize = 86; +pub const Index_midiStreamProperty: usize = 87; +pub const Index_midiStreamRestart: usize = 88; +pub const Index_midiStreamStop: usize = 89; +pub const Index_mixerClose: usize = 90; +pub const Index_mixerGetControlDetailsA: usize = 91; +pub const Index_mixerGetControlDetailsW: usize = 92; +pub const Index_mixerGetDevCapsA: usize = 93; +pub const Index_mixerGetDevCapsW: usize = 94; +pub const Index_mixerGetID: usize = 95; +pub const Index_mixerGetLineControlsA: usize = 96; +pub const Index_mixerGetLineControlsW: usize = 97; +pub const Index_mixerGetLineInfoA: usize = 98; +pub const Index_mixerGetLineInfoW: usize = 99; +pub const Index_mixerGetNumDevs: usize = 100; +pub const Index_mixerMessage: usize = 101; +pub const Index_mixerOpen: usize = 102; +pub const Index_mixerSetControlDetails: usize = 103; +pub const Index_mmDrvInstall: usize = 104; +pub const Index_mmGetCurrentTask: usize = 105; +pub const Index_mmTaskBlock: usize = 106; +pub const Index_mmTaskCreate: usize = 107; +pub const Index_mmTaskSignal: usize = 108; +pub const Index_mmTaskYield: usize = 109; +pub const Index_mmioAdvance: usize = 110; +pub const Index_mmioAscend: usize = 111; +pub const Index_mmioClose: usize = 112; +pub const Index_mmioCreateChunk: usize = 113; +pub const Index_mmioDescend: usize = 114; +pub const Index_mmioFlush: usize = 115; +pub const Index_mmioGetInfo: usize = 116; +pub const Index_mmioInstallIOProcA: usize = 117; +pub const Index_mmioInstallIOProcW: usize = 118; +pub const Index_mmioOpenA: usize = 119; +pub const Index_mmioOpenW: usize = 120; +pub const Index_mmioRead: usize = 121; +pub const Index_mmioRenameA: usize = 122; +pub const Index_mmioRenameW: usize = 123; +pub const Index_mmioSeek: usize = 124; +pub const Index_mmioSendMessage: usize = 125; +pub const Index_mmioSetBuffer: usize = 126; +pub const Index_mmioSetInfo: usize = 127; +pub const Index_mmioStringToFOURCCA: usize = 128; +pub const Index_mmioStringToFOURCCW: usize = 129; +pub const Index_mmioWrite: usize = 130; +pub const Index_mmsystemGetVersion: usize = 131; +pub const Index_sndPlaySoundA: usize = 132; +pub const Index_sndPlaySoundW: usize = 133; +pub const Index_timeBeginPeriod: usize = 134; +pub const Index_timeEndPeriod: usize = 135; +pub const Index_timeGetDevCaps: usize = 136; +pub const Index_timeGetSystemTime: usize = 137; +pub const Index_timeGetTime: usize = 138; +pub const Index_timeKillEvent: usize = 139; +pub const Index_timeSetEvent: usize = 140; +pub const Index_waveInAddBuffer: usize = 141; +pub const Index_waveInClose: usize = 142; +pub const Index_waveInGetDevCapsA: usize = 143; +pub const Index_waveInGetDevCapsW: usize = 144; +pub const Index_waveInGetErrorTextA: usize = 145; +pub const Index_waveInGetErrorTextW: usize = 146; +pub const Index_waveInGetID: usize = 147; +pub const Index_waveInGetNumDevs: usize = 148; +pub const Index_waveInGetPosition: usize = 149; +pub const Index_waveInMessage: usize = 150; +pub const Index_waveInOpen: usize = 151; +pub const Index_waveInPrepareHeader: usize = 152; +pub const Index_waveInReset: usize = 153; +pub const Index_waveInStart: usize = 154; +pub const Index_waveInStop: usize = 155; +pub const Index_waveInUnprepareHeader: usize = 156; +pub const Index_waveOutBreakLoop: usize = 157; +pub const Index_waveOutClose: usize = 158; +pub const Index_waveOutGetDevCapsA: usize = 159; +pub const Index_waveOutGetDevCapsW: usize = 160; +pub const Index_waveOutGetErrorTextA: usize = 161; +pub const Index_waveOutGetErrorTextW: usize = 162; +pub const Index_waveOutGetID: usize = 163; +pub const Index_waveOutGetNumDevs: usize = 164; +pub const Index_waveOutGetPitch: usize = 165; +pub const Index_waveOutGetPlaybackRate: usize = 166; +pub const Index_waveOutGetPosition: usize = 167; +pub const Index_waveOutGetVolume: usize = 168; +pub const Index_waveOutMessage: usize = 169; +pub const Index_waveOutOpen: usize = 170; +pub const Index_waveOutPause: usize = 171; +pub const Index_waveOutPrepareHeader: usize = 172; +pub const Index_waveOutReset: usize = 173; +pub const Index_waveOutRestart: usize = 174; +pub const Index_waveOutSetPitch: usize = 175; +pub const Index_waveOutSetPlaybackRate: usize = 176; +pub const Index_waveOutSetVolume: usize = 177; +pub const Index_waveOutUnprepareHeader: usize = 178; +pub const Index_waveOutWrite: usize = 179; diff --git a/loader/src/orig_exports.rs b/loader/src/orig_exports.rs index 1326940..28b0893 100644 --- a/loader/src/orig_exports.rs +++ b/loader/src/orig_exports.rs @@ -26,22 +26,19 @@ pub unsafe fn load_dll_funcs() { load_dll_func(Index_DefDriverProc, dll_handle, "DefDriverProc"); load_dll_func(Index_DriverCallback, dll_handle, "DriverCallback"); load_dll_func(Index_DrvGetModuleHandle, dll_handle, "DrvGetModuleHandle"); - load_dll_func(Index_NotifyCallbackData, dll_handle, "NotifyCallbackData"); + load_dll_func(Index_GetDriverModuleHandle, dll_handle, "GetDriverModuleHandle"); load_dll_func(Index_OpenDriver, dll_handle, "OpenDriver"); load_dll_func(Index_PlaySound, dll_handle, "PlaySound"); load_dll_func(Index_PlaySoundA, dll_handle, "PlaySoundA"); load_dll_func(Index_PlaySoundW, dll_handle, "PlaySoundW"); load_dll_func(Index_SendDriverMessage, dll_handle, "SendDriverMessage"); - load_dll_func(Index_WOW32DriverCallback, dll_handle, "WOW32DriverCallback"); load_dll_func(Index_WOWAppExit, dll_handle, "WOWAppExit"); - load_dll_func(Index_aux32Message, dll_handle, "aux32Message"); load_dll_func(Index_auxGetDevCapsA, dll_handle, "auxGetDevCapsA"); load_dll_func(Index_auxGetDevCapsW, dll_handle, "auxGetDevCapsW"); load_dll_func(Index_auxGetNumDevs, dll_handle, "auxGetNumDevs"); load_dll_func(Index_auxGetVolume, dll_handle, "auxGetVolume"); load_dll_func(Index_auxOutMessage, dll_handle, "auxOutMessage"); load_dll_func(Index_auxSetVolume, dll_handle, "auxSetVolume"); - load_dll_func(Index_joy32Message, dll_handle, "joy32Message"); load_dll_func(Index_joyConfigChanged, dll_handle, "joyConfigChanged"); load_dll_func(Index_joyGetDevCapsA, dll_handle, "joyGetDevCapsA"); load_dll_func(Index_joyGetDevCapsW, dll_handle, "joyGetDevCapsW"); @@ -52,24 +49,26 @@ pub unsafe fn load_dll_funcs() { load_dll_func(Index_joyReleaseCapture, dll_handle, "joyReleaseCapture"); load_dll_func(Index_joySetCapture, dll_handle, "joySetCapture"); load_dll_func(Index_joySetThreshold, dll_handle, "joySetThreshold"); - load_dll_func(Index_mci32Message, dll_handle, "mci32Message"); load_dll_func(Index_mciDriverNotify, dll_handle, "mciDriverNotify"); load_dll_func(Index_mciDriverYield, dll_handle, "mciDriverYield"); load_dll_func(Index_mciExecute, dll_handle, "mciExecute"); + load_dll_func(Index_mciFreeCommandResource, dll_handle, "mciFreeCommandResource"); load_dll_func(Index_mciGetCreatorTask, dll_handle, "mciGetCreatorTask"); load_dll_func(Index_mciGetDeviceIDA, dll_handle, "mciGetDeviceIDA"); + load_dll_func(Index_mciGetDeviceIDFromElementIDA, dll_handle, "mciGetDeviceIDFromElementIDA"); + load_dll_func(Index_mciGetDeviceIDFromElementIDW, dll_handle, "mciGetDeviceIDFromElementIDW"); load_dll_func(Index_mciGetDeviceIDW, dll_handle, "mciGetDeviceIDW"); load_dll_func(Index_mciGetDriverData, dll_handle, "mciGetDriverData"); load_dll_func(Index_mciGetErrorStringA, dll_handle, "mciGetErrorStringA"); load_dll_func(Index_mciGetErrorStringW, dll_handle, "mciGetErrorStringW"); load_dll_func(Index_mciGetYieldProc, dll_handle, "mciGetYieldProc"); + load_dll_func(Index_mciLoadCommandResource, dll_handle, "mciLoadCommandResource"); load_dll_func(Index_mciSendCommandA, dll_handle, "mciSendCommandA"); load_dll_func(Index_mciSendCommandW, dll_handle, "mciSendCommandW"); load_dll_func(Index_mciSendStringA, dll_handle, "mciSendStringA"); load_dll_func(Index_mciSendStringW, dll_handle, "mciSendStringW"); load_dll_func(Index_mciSetDriverData, dll_handle, "mciSetDriverData"); load_dll_func(Index_mciSetYieldProc, dll_handle, "mciSetYieldProc"); - load_dll_func(Index_mid32Message, dll_handle, "mid32Message"); load_dll_func(Index_midiConnect, dll_handle, "midiConnect"); load_dll_func(Index_midiDisconnect, dll_handle, "midiDisconnect"); load_dll_func(Index_midiInAddBuffer, dll_handle, "midiInAddBuffer"); @@ -86,19 +85,25 @@ pub unsafe fn load_dll_funcs() { load_dll_func(Index_midiInReset, dll_handle, "midiInReset"); load_dll_func(Index_midiInStart, dll_handle, "midiInStart"); load_dll_func(Index_midiInStop, dll_handle, "midiInStop"); + load_dll_func(Index_midiInUnprepareHeader, dll_handle, "midiInUnprepareHeader"); + load_dll_func(Index_midiOutCacheDrumPatches, dll_handle, "midiOutCacheDrumPatches"); load_dll_func(Index_midiOutCachePatches, dll_handle, "midiOutCachePatches"); load_dll_func(Index_midiOutClose, dll_handle, "midiOutClose"); load_dll_func(Index_midiOutGetDevCapsA, dll_handle, "midiOutGetDevCapsA"); load_dll_func(Index_midiOutGetDevCapsW, dll_handle, "midiOutGetDevCapsW"); + load_dll_func(Index_midiOutGetErrorTextA, dll_handle, "midiOutGetErrorTextA"); + load_dll_func(Index_midiOutGetErrorTextW, dll_handle, "midiOutGetErrorTextW"); load_dll_func(Index_midiOutGetID, dll_handle, "midiOutGetID"); load_dll_func(Index_midiOutGetNumDevs, dll_handle, "midiOutGetNumDevs"); load_dll_func(Index_midiOutGetVolume, dll_handle, "midiOutGetVolume"); load_dll_func(Index_midiOutLongMsg, dll_handle, "midiOutLongMsg"); load_dll_func(Index_midiOutMessage, dll_handle, "midiOutMessage"); load_dll_func(Index_midiOutOpen, dll_handle, "midiOutOpen"); + load_dll_func(Index_midiOutPrepareHeader, dll_handle, "midiOutPrepareHeader"); load_dll_func(Index_midiOutReset, dll_handle, "midiOutReset"); load_dll_func(Index_midiOutSetVolume, dll_handle, "midiOutSetVolume"); load_dll_func(Index_midiOutShortMsg, dll_handle, "midiOutShortMsg"); + load_dll_func(Index_midiOutUnprepareHeader, dll_handle, "midiOutUnprepareHeader"); load_dll_func(Index_midiStreamClose, dll_handle, "midiStreamClose"); load_dll_func(Index_midiStreamOpen, dll_handle, "midiStreamOpen"); load_dll_func(Index_midiStreamOut, dll_handle, "midiStreamOut"); @@ -108,14 +113,19 @@ pub unsafe fn load_dll_funcs() { load_dll_func(Index_midiStreamRestart, dll_handle, "midiStreamRestart"); load_dll_func(Index_midiStreamStop, dll_handle, "midiStreamStop"); load_dll_func(Index_mixerClose, dll_handle, "mixerClose"); + load_dll_func(Index_mixerGetControlDetailsA, dll_handle, "mixerGetControlDetailsA"); + load_dll_func(Index_mixerGetControlDetailsW, dll_handle, "mixerGetControlDetailsW"); load_dll_func(Index_mixerGetDevCapsA, dll_handle, "mixerGetDevCapsA"); load_dll_func(Index_mixerGetDevCapsW, dll_handle, "mixerGetDevCapsW"); load_dll_func(Index_mixerGetID, dll_handle, "mixerGetID"); + load_dll_func(Index_mixerGetLineControlsA, dll_handle, "mixerGetLineControlsA"); + load_dll_func(Index_mixerGetLineControlsW, dll_handle, "mixerGetLineControlsW"); load_dll_func(Index_mixerGetLineInfoA, dll_handle, "mixerGetLineInfoA"); load_dll_func(Index_mixerGetLineInfoW, dll_handle, "mixerGetLineInfoW"); load_dll_func(Index_mixerGetNumDevs, dll_handle, "mixerGetNumDevs"); load_dll_func(Index_mixerMessage, dll_handle, "mixerMessage"); load_dll_func(Index_mixerOpen, dll_handle, "mixerOpen"); + load_dll_func(Index_mixerSetControlDetails, dll_handle, "mixerSetControlDetails"); load_dll_func(Index_mmDrvInstall, dll_handle, "mmDrvInstall"); load_dll_func(Index_mmGetCurrentTask, dll_handle, "mmGetCurrentTask"); load_dll_func(Index_mmTaskBlock, dll_handle, "mmTaskBlock"); @@ -144,11 +154,8 @@ pub unsafe fn load_dll_funcs() { load_dll_func(Index_mmioStringToFOURCCW, dll_handle, "mmioStringToFOURCCW"); load_dll_func(Index_mmioWrite, dll_handle, "mmioWrite"); load_dll_func(Index_mmsystemGetVersion, dll_handle, "mmsystemGetVersion"); - load_dll_func(Index_mod32Message, dll_handle, "mod32Message"); - load_dll_func(Index_mxd32Message, dll_handle, "mxd32Message"); load_dll_func(Index_sndPlaySoundA, dll_handle, "sndPlaySoundA"); load_dll_func(Index_sndPlaySoundW, dll_handle, "sndPlaySoundW"); - load_dll_func(Index_tid32Message, dll_handle, "tid32Message"); load_dll_func(Index_timeBeginPeriod, dll_handle, "timeBeginPeriod"); load_dll_func(Index_timeEndPeriod, dll_handle, "timeEndPeriod"); load_dll_func(Index_timeGetDevCaps, dll_handle, "timeGetDevCaps"); @@ -171,23 +178,28 @@ pub unsafe fn load_dll_funcs() { load_dll_func(Index_waveInReset, dll_handle, "waveInReset"); load_dll_func(Index_waveInStart, dll_handle, "waveInStart"); load_dll_func(Index_waveInStop, dll_handle, "waveInStop"); + load_dll_func(Index_waveInUnprepareHeader, dll_handle, "waveInUnprepareHeader"); load_dll_func(Index_waveOutBreakLoop, dll_handle, "waveOutBreakLoop"); load_dll_func(Index_waveOutClose, dll_handle, "waveOutClose"); load_dll_func(Index_waveOutGetDevCapsA, dll_handle, "waveOutGetDevCapsA"); load_dll_func(Index_waveOutGetDevCapsW, dll_handle, "waveOutGetDevCapsW"); + load_dll_func(Index_waveOutGetErrorTextA, dll_handle, "waveOutGetErrorTextA"); + load_dll_func(Index_waveOutGetErrorTextW, dll_handle, "waveOutGetErrorTextW"); load_dll_func(Index_waveOutGetID, dll_handle, "waveOutGetID"); load_dll_func(Index_waveOutGetNumDevs, dll_handle, "waveOutGetNumDevs"); load_dll_func(Index_waveOutGetPitch, dll_handle, "waveOutGetPitch"); + load_dll_func(Index_waveOutGetPlaybackRate, dll_handle, "waveOutGetPlaybackRate"); load_dll_func(Index_waveOutGetPosition, dll_handle, "waveOutGetPosition"); load_dll_func(Index_waveOutGetVolume, dll_handle, "waveOutGetVolume"); load_dll_func(Index_waveOutMessage, dll_handle, "waveOutMessage"); load_dll_func(Index_waveOutOpen, dll_handle, "waveOutOpen"); load_dll_func(Index_waveOutPause, dll_handle, "waveOutPause"); + load_dll_func(Index_waveOutPrepareHeader, dll_handle, "waveOutPrepareHeader"); load_dll_func(Index_waveOutReset, dll_handle, "waveOutReset"); load_dll_func(Index_waveOutRestart, dll_handle, "waveOutRestart"); load_dll_func(Index_waveOutSetPitch, dll_handle, "waveOutSetPitch"); + load_dll_func(Index_waveOutSetPlaybackRate, dll_handle, "waveOutSetPlaybackRate"); load_dll_func(Index_waveOutSetVolume, dll_handle, "waveOutSetVolume"); + load_dll_func(Index_waveOutUnprepareHeader, dll_handle, "waveOutUnprepareHeader"); load_dll_func(Index_waveOutWrite, dll_handle, "waveOutWrite"); - load_dll_func(Index_wid32Message, dll_handle, "wid32Message"); - load_dll_func(Index_wod32Message, dll_handle, "wod32Message"); } diff --git a/loader/src/proxied_exports.rs b/loader/src/proxied_exports.rs index b3994fe..e1d045a 100644 --- a/loader/src/proxied_exports.rs +++ b/loader/src/proxied_exports.rs @@ -2,669 +2,718 @@ use proxygen_macros::forward; #[forward] -#[export_name = "CloseDriver"] +#[export_name="CloseDriver"] pub extern "C" fn CloseDriver() {} #[forward] -#[export_name = "DefDriverProc"] +#[export_name="DefDriverProc"] pub extern "C" fn DefDriverProc() {} #[forward] -#[export_name = "DriverCallback"] +#[export_name="DriverCallback"] pub extern "C" fn DriverCallback() {} #[forward] -#[export_name = "DrvGetModuleHandle"] +#[export_name="DrvGetModuleHandle"] pub extern "C" fn DrvGetModuleHandle() {} #[forward] -#[export_name = "NotifyCallbackData"] -pub extern "C" fn NotifyCallbackData() {} +#[export_name="GetDriverModuleHandle"] +pub extern "C" fn GetDriverModuleHandle() {} #[forward] -#[export_name = "OpenDriver"] +#[export_name="OpenDriver"] pub extern "C" fn OpenDriver() {} #[forward] -#[export_name = "PlaySound"] +#[export_name="PlaySound"] pub extern "C" fn PlaySound() {} #[forward] -#[export_name = "PlaySoundA"] +#[export_name="PlaySoundA"] pub extern "C" fn PlaySoundA() {} #[forward] -#[export_name = "PlaySoundW"] +#[export_name="PlaySoundW"] pub extern "C" fn PlaySoundW() {} #[forward] -#[export_name = "SendDriverMessage"] +#[export_name="SendDriverMessage"] pub extern "C" fn SendDriverMessage() {} #[forward] -#[export_name = "WOW32DriverCallback"] -pub extern "C" fn WOW32DriverCallback() {} - -#[forward] -#[export_name = "WOWAppExit"] +#[export_name="WOWAppExit"] pub extern "C" fn WOWAppExit() {} #[forward] -#[export_name = "aux32Message"] -pub extern "C" fn aux32Message() {} - -#[forward] -#[export_name = "auxGetDevCapsA"] +#[export_name="auxGetDevCapsA"] pub extern "C" fn auxGetDevCapsA() {} #[forward] -#[export_name = "auxGetDevCapsW"] +#[export_name="auxGetDevCapsW"] pub extern "C" fn auxGetDevCapsW() {} #[forward] -#[export_name = "auxGetNumDevs"] +#[export_name="auxGetNumDevs"] pub extern "C" fn auxGetNumDevs() {} #[forward] -#[export_name = "auxGetVolume"] +#[export_name="auxGetVolume"] pub extern "C" fn auxGetVolume() {} #[forward] -#[export_name = "auxOutMessage"] +#[export_name="auxOutMessage"] pub extern "C" fn auxOutMessage() {} #[forward] -#[export_name = "auxSetVolume"] +#[export_name="auxSetVolume"] pub extern "C" fn auxSetVolume() {} #[forward] -#[export_name = "joy32Message"] -pub extern "C" fn joy32Message() {} - -#[forward] -#[export_name = "joyConfigChanged"] +#[export_name="joyConfigChanged"] pub extern "C" fn joyConfigChanged() {} #[forward] -#[export_name = "joyGetDevCapsA"] +#[export_name="joyGetDevCapsA"] pub extern "C" fn joyGetDevCapsA() {} #[forward] -#[export_name = "joyGetDevCapsW"] +#[export_name="joyGetDevCapsW"] pub extern "C" fn joyGetDevCapsW() {} #[forward] -#[export_name = "joyGetNumDevs"] +#[export_name="joyGetNumDevs"] pub extern "C" fn joyGetNumDevs() {} #[forward] -#[export_name = "joyGetPos"] +#[export_name="joyGetPos"] pub extern "C" fn joyGetPos() {} #[forward] -#[export_name = "joyGetPosEx"] +#[export_name="joyGetPosEx"] pub extern "C" fn joyGetPosEx() {} #[forward] -#[export_name = "joyGetThreshold"] +#[export_name="joyGetThreshold"] pub extern "C" fn joyGetThreshold() {} #[forward] -#[export_name = "joyReleaseCapture"] +#[export_name="joyReleaseCapture"] pub extern "C" fn joyReleaseCapture() {} #[forward] -#[export_name = "joySetCapture"] +#[export_name="joySetCapture"] pub extern "C" fn joySetCapture() {} #[forward] -#[export_name = "joySetThreshold"] +#[export_name="joySetThreshold"] pub extern "C" fn joySetThreshold() {} #[forward] -#[export_name = "mci32Message"] -pub extern "C" fn mci32Message() {} - -#[forward] -#[export_name = "mciDriverNotify"] +#[export_name="mciDriverNotify"] pub extern "C" fn mciDriverNotify() {} #[forward] -#[export_name = "mciDriverYield"] +#[export_name="mciDriverYield"] pub extern "C" fn mciDriverYield() {} #[forward] -#[export_name = "mciExecute"] +#[export_name="mciExecute"] pub extern "C" fn mciExecute() {} #[forward] -#[export_name = "mciGetCreatorTask"] +#[export_name="mciFreeCommandResource"] +pub extern "C" fn mciFreeCommandResource() {} + +#[forward] +#[export_name="mciGetCreatorTask"] pub extern "C" fn mciGetCreatorTask() {} #[forward] -#[export_name = "mciGetDeviceIDA"] +#[export_name="mciGetDeviceIDA"] pub extern "C" fn mciGetDeviceIDA() {} #[forward] -#[export_name = "mciGetDeviceIDW"] +#[export_name="mciGetDeviceIDFromElementIDA"] +pub extern "C" fn mciGetDeviceIDFromElementIDA() {} + +#[forward] +#[export_name="mciGetDeviceIDFromElementIDW"] +pub extern "C" fn mciGetDeviceIDFromElementIDW() {} + +#[forward] +#[export_name="mciGetDeviceIDW"] pub extern "C" fn mciGetDeviceIDW() {} #[forward] -#[export_name = "mciGetDriverData"] +#[export_name="mciGetDriverData"] pub extern "C" fn mciGetDriverData() {} #[forward] -#[export_name = "mciGetErrorStringA"] +#[export_name="mciGetErrorStringA"] pub extern "C" fn mciGetErrorStringA() {} #[forward] -#[export_name = "mciGetErrorStringW"] +#[export_name="mciGetErrorStringW"] pub extern "C" fn mciGetErrorStringW() {} #[forward] -#[export_name = "mciGetYieldProc"] +#[export_name="mciGetYieldProc"] pub extern "C" fn mciGetYieldProc() {} #[forward] -#[export_name = "mciSendCommandA"] +#[export_name="mciLoadCommandResource"] +pub extern "C" fn mciLoadCommandResource() {} + +#[forward] +#[export_name="mciSendCommandA"] pub extern "C" fn mciSendCommandA() {} #[forward] -#[export_name = "mciSendCommandW"] +#[export_name="mciSendCommandW"] pub extern "C" fn mciSendCommandW() {} #[forward] -#[export_name = "mciSendStringA"] +#[export_name="mciSendStringA"] pub extern "C" fn mciSendStringA() {} #[forward] -#[export_name = "mciSendStringW"] +#[export_name="mciSendStringW"] pub extern "C" fn mciSendStringW() {} #[forward] -#[export_name = "mciSetDriverData"] +#[export_name="mciSetDriverData"] pub extern "C" fn mciSetDriverData() {} #[forward] -#[export_name = "mciSetYieldProc"] +#[export_name="mciSetYieldProc"] pub extern "C" fn mciSetYieldProc() {} #[forward] -#[export_name = "mid32Message"] -pub extern "C" fn mid32Message() {} - -#[forward] -#[export_name = "midiConnect"] +#[export_name="midiConnect"] pub extern "C" fn midiConnect() {} #[forward] -#[export_name = "midiDisconnect"] +#[export_name="midiDisconnect"] pub extern "C" fn midiDisconnect() {} #[forward] -#[export_name = "midiInAddBuffer"] +#[export_name="midiInAddBuffer"] pub extern "C" fn midiInAddBuffer() {} #[forward] -#[export_name = "midiInClose"] +#[export_name="midiInClose"] pub extern "C" fn midiInClose() {} #[forward] -#[export_name = "midiInGetDevCapsA"] +#[export_name="midiInGetDevCapsA"] pub extern "C" fn midiInGetDevCapsA() {} #[forward] -#[export_name = "midiInGetDevCapsW"] +#[export_name="midiInGetDevCapsW"] pub extern "C" fn midiInGetDevCapsW() {} #[forward] -#[export_name = "midiInGetErrorTextA"] +#[export_name="midiInGetErrorTextA"] pub extern "C" fn midiInGetErrorTextA() {} #[forward] -#[export_name = "midiInGetErrorTextW"] +#[export_name="midiInGetErrorTextW"] pub extern "C" fn midiInGetErrorTextW() {} #[forward] -#[export_name = "midiInGetID"] +#[export_name="midiInGetID"] pub extern "C" fn midiInGetID() {} #[forward] -#[export_name = "midiInGetNumDevs"] +#[export_name="midiInGetNumDevs"] pub extern "C" fn midiInGetNumDevs() {} #[forward] -#[export_name = "midiInMessage"] +#[export_name="midiInMessage"] pub extern "C" fn midiInMessage() {} #[forward] -#[export_name = "midiInOpen"] +#[export_name="midiInOpen"] pub extern "C" fn midiInOpen() {} #[forward] -#[export_name = "midiInPrepareHeader"] +#[export_name="midiInPrepareHeader"] pub extern "C" fn midiInPrepareHeader() {} #[forward] -#[export_name = "midiInReset"] +#[export_name="midiInReset"] pub extern "C" fn midiInReset() {} #[forward] -#[export_name = "midiInStart"] +#[export_name="midiInStart"] pub extern "C" fn midiInStart() {} #[forward] -#[export_name = "midiInStop"] +#[export_name="midiInStop"] pub extern "C" fn midiInStop() {} #[forward] -#[export_name = "midiOutCachePatches"] +#[export_name="midiInUnprepareHeader"] +pub extern "C" fn midiInUnprepareHeader() {} + +#[forward] +#[export_name="midiOutCacheDrumPatches"] +pub extern "C" fn midiOutCacheDrumPatches() {} + +#[forward] +#[export_name="midiOutCachePatches"] pub extern "C" fn midiOutCachePatches() {} #[forward] -#[export_name = "midiOutClose"] +#[export_name="midiOutClose"] pub extern "C" fn midiOutClose() {} #[forward] -#[export_name = "midiOutGetDevCapsA"] +#[export_name="midiOutGetDevCapsA"] pub extern "C" fn midiOutGetDevCapsA() {} #[forward] -#[export_name = "midiOutGetDevCapsW"] +#[export_name="midiOutGetDevCapsW"] pub extern "C" fn midiOutGetDevCapsW() {} #[forward] -#[export_name = "midiOutGetID"] +#[export_name="midiOutGetErrorTextA"] +pub extern "C" fn midiOutGetErrorTextA() {} + +#[forward] +#[export_name="midiOutGetErrorTextW"] +pub extern "C" fn midiOutGetErrorTextW() {} + +#[forward] +#[export_name="midiOutGetID"] pub extern "C" fn midiOutGetID() {} #[forward] -#[export_name = "midiOutGetNumDevs"] +#[export_name="midiOutGetNumDevs"] pub extern "C" fn midiOutGetNumDevs() {} #[forward] -#[export_name = "midiOutGetVolume"] +#[export_name="midiOutGetVolume"] pub extern "C" fn midiOutGetVolume() {} #[forward] -#[export_name = "midiOutLongMsg"] +#[export_name="midiOutLongMsg"] pub extern "C" fn midiOutLongMsg() {} #[forward] -#[export_name = "midiOutMessage"] +#[export_name="midiOutMessage"] pub extern "C" fn midiOutMessage() {} #[forward] -#[export_name = "midiOutOpen"] +#[export_name="midiOutOpen"] pub extern "C" fn midiOutOpen() {} #[forward] -#[export_name = "midiOutReset"] +#[export_name="midiOutPrepareHeader"] +pub extern "C" fn midiOutPrepareHeader() {} + +#[forward] +#[export_name="midiOutReset"] pub extern "C" fn midiOutReset() {} #[forward] -#[export_name = "midiOutSetVolume"] +#[export_name="midiOutSetVolume"] pub extern "C" fn midiOutSetVolume() {} #[forward] -#[export_name = "midiOutShortMsg"] +#[export_name="midiOutShortMsg"] pub extern "C" fn midiOutShortMsg() {} #[forward] -#[export_name = "midiStreamClose"] +#[export_name="midiOutUnprepareHeader"] +pub extern "C" fn midiOutUnprepareHeader() {} + +#[forward] +#[export_name="midiStreamClose"] pub extern "C" fn midiStreamClose() {} #[forward] -#[export_name = "midiStreamOpen"] +#[export_name="midiStreamOpen"] pub extern "C" fn midiStreamOpen() {} #[forward] -#[export_name = "midiStreamOut"] +#[export_name="midiStreamOut"] pub extern "C" fn midiStreamOut() {} #[forward] -#[export_name = "midiStreamPause"] +#[export_name="midiStreamPause"] pub extern "C" fn midiStreamPause() {} #[forward] -#[export_name = "midiStreamPosition"] +#[export_name="midiStreamPosition"] pub extern "C" fn midiStreamPosition() {} #[forward] -#[export_name = "midiStreamProperty"] +#[export_name="midiStreamProperty"] pub extern "C" fn midiStreamProperty() {} #[forward] -#[export_name = "midiStreamRestart"] +#[export_name="midiStreamRestart"] pub extern "C" fn midiStreamRestart() {} #[forward] -#[export_name = "midiStreamStop"] +#[export_name="midiStreamStop"] pub extern "C" fn midiStreamStop() {} #[forward] -#[export_name = "mixerClose"] +#[export_name="mixerClose"] pub extern "C" fn mixerClose() {} #[forward] -#[export_name = "mixerGetDevCapsA"] +#[export_name="mixerGetControlDetailsA"] +pub extern "C" fn mixerGetControlDetailsA() {} + +#[forward] +#[export_name="mixerGetControlDetailsW"] +pub extern "C" fn mixerGetControlDetailsW() {} + +#[forward] +#[export_name="mixerGetDevCapsA"] pub extern "C" fn mixerGetDevCapsA() {} #[forward] -#[export_name = "mixerGetDevCapsW"] +#[export_name="mixerGetDevCapsW"] pub extern "C" fn mixerGetDevCapsW() {} #[forward] -#[export_name = "mixerGetID"] +#[export_name="mixerGetID"] pub extern "C" fn mixerGetID() {} #[forward] -#[export_name = "mixerGetLineInfoA"] +#[export_name="mixerGetLineControlsA"] +pub extern "C" fn mixerGetLineControlsA() {} + +#[forward] +#[export_name="mixerGetLineControlsW"] +pub extern "C" fn mixerGetLineControlsW() {} + +#[forward] +#[export_name="mixerGetLineInfoA"] pub extern "C" fn mixerGetLineInfoA() {} #[forward] -#[export_name = "mixerGetLineInfoW"] +#[export_name="mixerGetLineInfoW"] pub extern "C" fn mixerGetLineInfoW() {} #[forward] -#[export_name = "mixerGetNumDevs"] +#[export_name="mixerGetNumDevs"] pub extern "C" fn mixerGetNumDevs() {} #[forward] -#[export_name = "mixerMessage"] +#[export_name="mixerMessage"] pub extern "C" fn mixerMessage() {} #[forward] -#[export_name = "mixerOpen"] +#[export_name="mixerOpen"] pub extern "C" fn mixerOpen() {} #[forward] -#[export_name = "mmDrvInstall"] +#[export_name="mixerSetControlDetails"] +pub extern "C" fn mixerSetControlDetails() {} + +#[forward] +#[export_name="mmDrvInstall"] pub extern "C" fn mmDrvInstall() {} #[forward] -#[export_name = "mmGetCurrentTask"] +#[export_name="mmGetCurrentTask"] pub extern "C" fn mmGetCurrentTask() {} #[forward] -#[export_name = "mmTaskBlock"] +#[export_name="mmTaskBlock"] pub extern "C" fn mmTaskBlock() {} #[forward] -#[export_name = "mmTaskCreate"] +#[export_name="mmTaskCreate"] pub extern "C" fn mmTaskCreate() {} #[forward] -#[export_name = "mmTaskSignal"] +#[export_name="mmTaskSignal"] pub extern "C" fn mmTaskSignal() {} #[forward] -#[export_name = "mmTaskYield"] +#[export_name="mmTaskYield"] pub extern "C" fn mmTaskYield() {} #[forward] -#[export_name = "mmioAdvance"] +#[export_name="mmioAdvance"] pub extern "C" fn mmioAdvance() {} #[forward] -#[export_name = "mmioAscend"] +#[export_name="mmioAscend"] pub extern "C" fn mmioAscend() {} #[forward] -#[export_name = "mmioClose"] +#[export_name="mmioClose"] pub extern "C" fn mmioClose() {} #[forward] -#[export_name = "mmioCreateChunk"] +#[export_name="mmioCreateChunk"] pub extern "C" fn mmioCreateChunk() {} #[forward] -#[export_name = "mmioDescend"] +#[export_name="mmioDescend"] pub extern "C" fn mmioDescend() {} #[forward] -#[export_name = "mmioFlush"] +#[export_name="mmioFlush"] pub extern "C" fn mmioFlush() {} #[forward] -#[export_name = "mmioGetInfo"] +#[export_name="mmioGetInfo"] pub extern "C" fn mmioGetInfo() {} #[forward] -#[export_name = "mmioInstallIOProcA"] +#[export_name="mmioInstallIOProcA"] pub extern "C" fn mmioInstallIOProcA() {} #[forward] -#[export_name = "mmioInstallIOProcW"] +#[export_name="mmioInstallIOProcW"] pub extern "C" fn mmioInstallIOProcW() {} #[forward] -#[export_name = "mmioOpenA"] +#[export_name="mmioOpenA"] pub extern "C" fn mmioOpenA() {} #[forward] -#[export_name = "mmioOpenW"] +#[export_name="mmioOpenW"] pub extern "C" fn mmioOpenW() {} #[forward] -#[export_name = "mmioRead"] +#[export_name="mmioRead"] pub extern "C" fn mmioRead() {} #[forward] -#[export_name = "mmioRenameA"] +#[export_name="mmioRenameA"] pub extern "C" fn mmioRenameA() {} #[forward] -#[export_name = "mmioRenameW"] +#[export_name="mmioRenameW"] pub extern "C" fn mmioRenameW() {} #[forward] -#[export_name = "mmioSeek"] +#[export_name="mmioSeek"] pub extern "C" fn mmioSeek() {} #[forward] -#[export_name = "mmioSendMessage"] +#[export_name="mmioSendMessage"] pub extern "C" fn mmioSendMessage() {} #[forward] -#[export_name = "mmioSetBuffer"] +#[export_name="mmioSetBuffer"] pub extern "C" fn mmioSetBuffer() {} #[forward] -#[export_name = "mmioSetInfo"] +#[export_name="mmioSetInfo"] pub extern "C" fn mmioSetInfo() {} #[forward] -#[export_name = "mmioStringToFOURCCA"] +#[export_name="mmioStringToFOURCCA"] pub extern "C" fn mmioStringToFOURCCA() {} #[forward] -#[export_name = "mmioStringToFOURCCW"] +#[export_name="mmioStringToFOURCCW"] pub extern "C" fn mmioStringToFOURCCW() {} #[forward] -#[export_name = "mmioWrite"] +#[export_name="mmioWrite"] pub extern "C" fn mmioWrite() {} #[forward] -#[export_name = "mmsystemGetVersion"] +#[export_name="mmsystemGetVersion"] pub extern "C" fn mmsystemGetVersion() {} #[forward] -#[export_name = "mod32Message"] -pub extern "C" fn mod32Message() {} - -#[forward] -#[export_name = "mxd32Message"] -pub extern "C" fn mxd32Message() {} - -#[forward] -#[export_name = "sndPlaySoundA"] +#[export_name="sndPlaySoundA"] pub extern "C" fn sndPlaySoundA() {} #[forward] -#[export_name = "sndPlaySoundW"] +#[export_name="sndPlaySoundW"] pub extern "C" fn sndPlaySoundW() {} #[forward] -#[export_name = "tid32Message"] -pub extern "C" fn tid32Message() {} - -#[forward] -#[export_name = "timeEndPeriod"] +#[export_name="timeEndPeriod"] pub extern "C" fn timeEndPeriod() {} #[forward] -#[export_name = "timeGetDevCaps"] +#[export_name="timeGetDevCaps"] pub extern "C" fn timeGetDevCaps() {} #[forward] -#[export_name = "timeGetSystemTime"] +#[export_name="timeGetSystemTime"] pub extern "C" fn timeGetSystemTime() {} #[forward] -#[export_name = "timeGetTime"] +#[export_name="timeGetTime"] pub extern "C" fn timeGetTime() {} #[forward] -#[export_name = "timeKillEvent"] +#[export_name="timeKillEvent"] pub extern "C" fn timeKillEvent() {} #[forward] -#[export_name = "timeSetEvent"] +#[export_name="timeSetEvent"] pub extern "C" fn timeSetEvent() {} #[forward] -#[export_name = "waveInAddBuffer"] +#[export_name="waveInAddBuffer"] pub extern "C" fn waveInAddBuffer() {} #[forward] -#[export_name = "waveInClose"] +#[export_name="waveInClose"] pub extern "C" fn waveInClose() {} #[forward] -#[export_name = "waveInGetDevCapsA"] +#[export_name="waveInGetDevCapsA"] pub extern "C" fn waveInGetDevCapsA() {} #[forward] -#[export_name = "waveInGetDevCapsW"] +#[export_name="waveInGetDevCapsW"] pub extern "C" fn waveInGetDevCapsW() {} #[forward] -#[export_name = "waveInGetErrorTextA"] +#[export_name="waveInGetErrorTextA"] pub extern "C" fn waveInGetErrorTextA() {} #[forward] -#[export_name = "waveInGetErrorTextW"] +#[export_name="waveInGetErrorTextW"] pub extern "C" fn waveInGetErrorTextW() {} #[forward] -#[export_name = "waveInGetID"] +#[export_name="waveInGetID"] pub extern "C" fn waveInGetID() {} #[forward] -#[export_name = "waveInGetNumDevs"] +#[export_name="waveInGetNumDevs"] pub extern "C" fn waveInGetNumDevs() {} #[forward] -#[export_name = "waveInGetPosition"] +#[export_name="waveInGetPosition"] pub extern "C" fn waveInGetPosition() {} #[forward] -#[export_name = "waveInMessage"] +#[export_name="waveInMessage"] pub extern "C" fn waveInMessage() {} #[forward] -#[export_name = "waveInOpen"] +#[export_name="waveInOpen"] pub extern "C" fn waveInOpen() {} #[forward] -#[export_name = "waveInPrepareHeader"] +#[export_name="waveInPrepareHeader"] pub extern "C" fn waveInPrepareHeader() {} #[forward] -#[export_name = "waveInReset"] +#[export_name="waveInReset"] pub extern "C" fn waveInReset() {} #[forward] -#[export_name = "waveInStart"] +#[export_name="waveInStart"] pub extern "C" fn waveInStart() {} #[forward] -#[export_name = "waveInStop"] +#[export_name="waveInStop"] pub extern "C" fn waveInStop() {} #[forward] -#[export_name = "waveOutBreakLoop"] +#[export_name="waveInUnprepareHeader"] +pub extern "C" fn waveInUnprepareHeader() {} + +#[forward] +#[export_name="waveOutBreakLoop"] pub extern "C" fn waveOutBreakLoop() {} #[forward] -#[export_name = "waveOutClose"] +#[export_name="waveOutClose"] pub extern "C" fn waveOutClose() {} #[forward] -#[export_name = "waveOutGetDevCapsA"] +#[export_name="waveOutGetDevCapsA"] pub extern "C" fn waveOutGetDevCapsA() {} #[forward] -#[export_name = "waveOutGetDevCapsW"] +#[export_name="waveOutGetDevCapsW"] pub extern "C" fn waveOutGetDevCapsW() {} #[forward] -#[export_name = "waveOutGetID"] +#[export_name="waveOutGetErrorTextA"] +pub extern "C" fn waveOutGetErrorTextA() {} + +#[forward] +#[export_name="waveOutGetErrorTextW"] +pub extern "C" fn waveOutGetErrorTextW() {} + +#[forward] +#[export_name="waveOutGetID"] pub extern "C" fn waveOutGetID() {} #[forward] -#[export_name = "waveOutGetNumDevs"] +#[export_name="waveOutGetNumDevs"] pub extern "C" fn waveOutGetNumDevs() {} #[forward] -#[export_name = "waveOutGetPitch"] +#[export_name="waveOutGetPitch"] pub extern "C" fn waveOutGetPitch() {} #[forward] -#[export_name = "waveOutGetPosition"] +#[export_name="waveOutGetPlaybackRate"] +pub extern "C" fn waveOutGetPlaybackRate() {} + +#[forward] +#[export_name="waveOutGetPosition"] pub extern "C" fn waveOutGetPosition() {} #[forward] -#[export_name = "waveOutGetVolume"] +#[export_name="waveOutGetVolume"] pub extern "C" fn waveOutGetVolume() {} #[forward] -#[export_name = "waveOutMessage"] +#[export_name="waveOutMessage"] pub extern "C" fn waveOutMessage() {} #[forward] -#[export_name = "waveOutOpen"] +#[export_name="waveOutOpen"] pub extern "C" fn waveOutOpen() {} #[forward] -#[export_name = "waveOutPause"] +#[export_name="waveOutPause"] pub extern "C" fn waveOutPause() {} #[forward] -#[export_name = "waveOutReset"] +#[export_name="waveOutPrepareHeader"] +pub extern "C" fn waveOutPrepareHeader() {} + +#[forward] +#[export_name="waveOutReset"] pub extern "C" fn waveOutReset() {} #[forward] -#[export_name = "waveOutRestart"] +#[export_name="waveOutRestart"] pub extern "C" fn waveOutRestart() {} #[forward] -#[export_name = "waveOutSetPitch"] +#[export_name="waveOutSetPitch"] pub extern "C" fn waveOutSetPitch() {} #[forward] -#[export_name = "waveOutSetVolume"] -pub extern "C" fn waveOutSetVolume() {} +#[export_name="waveOutSetPlaybackRate"] +pub extern "C" fn waveOutSetPlaybackRate() {} #[forward] -#[export_name = "waveOutWrite"] -pub extern "C" fn waveOutWrite() {} +#[export_name="waveOutSetVolume"] +pub extern "C" fn waveOutSetVolume() {} #[forward] -#[export_name = "wid32Message"] -pub extern "C" fn wid32Message() {} +#[export_name="waveOutUnprepareHeader"] +pub extern "C" fn waveOutUnprepareHeader() {} #[forward] -#[export_name = "wod32Message"] -pub extern "C" fn wod32Message() {} +#[export_name="waveOutWrite"] +pub extern "C" fn waveOutWrite() {} +