diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..443959d --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,164 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "syn" +version = "2.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "untitled" +version = "0.1.0" +dependencies = [ + "hex", + "windows", + "windows-core", +] + +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-link", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..fd2478b --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "untitled" +version = "0.1.0" +edition = "2024" +build = "build.rs" + +[dependencies] +windows = { version = "0.61.3", features = ["Foundation", "UI", "Win32", "Win32_UI", "Win32_UI_WindowsAndMessaging", "Win32_Graphics_Gdi", "Win32_System", "Win32_System_LibraryLoader", "Win32_Storage", "Win32_Storage_FileSystem", "Win32_Security", "Win32_Devices", "Win32_Devices_DeviceAndDriverInstallation", "Win32_System_IO", "Devices", "Devices_Usb", "Win32_Devices_Usb", "Win32_System_SystemServices", "Win32_System_Registry"] } +windows-core = "0.61.2" +hex = "0.4.3" + + +[lib] +crate-type = ["staticlib"] + +[[bin]] +name = "force-build" +path = "C:\\Users\\cr385008\\RustroverProjects\\untitled\\build.rs" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..c4b7999 --- /dev/null +++ b/build.rs @@ -0,0 +1,5 @@ + +fn main(){ + println!("cargo:rustc-link-lib=setupapi"); + println!("cargo:rustc-link-lib=ws2_32"); +} \ No newline at end of file diff --git a/cbindgen.toml b/cbindgen.toml new file mode 100644 index 0000000..06d7405 Binary files /dev/null and b/cbindgen.toml differ diff --git a/untitled.h b/untitled.h new file mode 100644 index 0000000..6250265 --- /dev/null +++ b/untitled.h @@ -0,0 +1,25 @@ +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ +#pragma pack(push,1) + +#define WRITE_DIRECTION 0 + +#define READ_DIRECTION 1 + +typedef struct WinUsbDevice WinUsbDevice; + +HANDLE initialize_usb(void); + +void write_usb(struct WinUsbDevice *device, const uint8_t *data, uintptr_t len); + +#pragma pack(pop) +#ifdef __cplusplus +} /* End of extern "C" { */ +#endif \ No newline at end of file