XStore: a store id without an installed package is an invalid argument

XStoreQueryPackageIdentifier documents E_INVALIDARG for a store id that
has no installed package. We returned XPackage's 0x89245208 instead.

(cherry picked from commit e3bef089855cc4b463a0ce7e1a70f6abf7c859e5)
This commit is contained in:
marquezini authored and local committed 2026-11-25 01:02:57 -06:00
1 parent a27ec9e57f
commit e5224a3f2c
1 file changed
+15 -3
+15 -3
View File
@@ -7,7 +7,7 @@
use std::ffi::{c_char, c_void};
use super::xasync::{self, AsyncBlock, E_ILLEGAL_METHOD_CALL};
use super::xasync::{self, AsyncBlock, E_ILLEGAL_METHOD_CALL, E_INVALIDARG};
use super::xgameruntime::{
Guid, HRESULT, Interface, Methods, Object, S_OK, add_ref, missing, put, put_string, text, token,
};
@@ -301,7 +301,8 @@ extern "system" fn install_async(
}
/// The game's own store id maps to its installation; nothing else is
/// installed.
/// installed, and any other id gets the documented E_INVALIDARG (not
/// XPackage's "could not resolve" error).
extern "system" fn package_identifier(
_: This,
store_id: *const c_char,
@@ -313,7 +314,7 @@ extern "system" fn package_identifier(
Some(id) if !title.store_id.is_empty() && id == title.store_id => {
put_string(&xpackage::identifier(), size, buffer, std::ptr::null_mut())
}
_ => xpackage::NO_PACKAGE,
_ => E_INVALIDARG,
}
}
@@ -476,4 +477,15 @@ mod tests {
&OBJECT, 0xb0
)(this, l));
}
#[test]
fn a_store_id_without_a_package_is_an_invalid_argument() {
type Query = extern "system" fn(This, *const c_char, usize, *mut u8) -> HRESULT;
let query = method::<Query>(&OBJECT, 0x208);
let mut id = [0u8; 33];
assert_eq!(
query(&OBJECT, c"9NOTINSTALLED".as_ptr(), 33, id.as_mut_ptr()),
E_INVALIDARG
);
}
}