docs.rs failed to build storm-ffi-0.6.4
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
storm-ffi
StormLib-compatible C API for the World of Warcraft MPQ archive library.
Status
Implemented - Drop-in StormLib replacement using wow-mpq.
Overview
The storm-ffi crate provides a C-compatible Foreign Function Interface (FFI) that emulates the StormLib API, wrapping the native Rust wow-mpq implementation. This allows C/C++ applications that expect StormLib's interface to use the memory-safe Rust implementation instead.
Features
- StormLib-compatible function signatures
- Thread-safe handle management
- Windows error code compatibility
- Support for MPQ archives from World of Warcraft versions 1.12.1 through 5.4.8
- Both static and dynamic library output
Supported Versions
- Classic (1.12.1) - Full support
- The Burning Crusade (2.4.3) - Full support
- Wrath of the Lich King (3.3.5a) - Full support
- Cataclysm (4.3.4) - Full support
- Mists of Pandaria (5.4.8) - Full support
Usage
Add to your Cargo.toml:
[]
= "0.1"
Building the Library
# Build the library
# Output libraries will be in target/release:
# - libstorm.so (Linux)
# - libstorm.dylib (macOS)
# - storm.dll (Windows)
C/C++ Usage
Include the generated header and link against the storm library:
int
Supported Functions
Archive Operations
SFileOpenArchive- Open an existing MPQ archiveSFileCreateArchive- Create a new MPQ archiveSFileCloseArchive- Close an open archive
File Operations
SFileOpenFileEx- Open a file within an archiveSFileCloseFile- Close an open fileSFileReadFile- Read data from a fileSFileGetFileSize- Get the size of a fileSFileSetFilePointer- Seek within a fileSFileHasFile- Check if a file existsSFileExtractFile- Extract a file to disk
Archive Information
SFileGetArchiveName- Get the archive file pathSFileGetFileName- Get the current file nameSFileGetFileInfo- Query archive/file informationSFileEnumFiles- Enumerate files in the archive
Utility Functions
SFileSetLocale/SFileGetLocale- Locale managementSFileGetLastError/SFileSetLastError- Error handlingSFileVerifyFile- Verify file integritySFileSignArchive- Sign an archive (stub)SFileVerifyArchive- Verify archive signatures
Error Handling
The library uses Windows-compatible error codes:
DWORD error = ;
switch
Examples
See the examples directory for C examples:
basic.c- Simple archive open/close examplestorm_example.c- Full usage example
Building from Source
Prerequisites
- Rust 1.92 or later
- C compiler (for examples)
- cbindgen (automatically installed as build dependency)
Build Steps
# Clone the repository
# Build the storm crate
# Generate C header
# Header will be at: ffi/storm-ffi/include/StormLib.h
Compatibility Notes
StormLib Differences
While the storm-ffi crate aims for StormLib compatibility, there are some differences:
- Thread-safe by default (uses Rust's safety guarantees)
- Error codes are translated from wow-mpq's error types
- Some functions are stubs (e.g.,
SFileSignArchive) - No support for protected MPQs
Memory Management
- All handles are opaque pointers managed by Rust
- No manual memory management required from C/C++
- Thread-local error storage for compatibility
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.