mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-21 15:30:12 +00:00
add resource bit to handle info
This commit is contained in:
parent
37b45e66ab
commit
bdce056449
@ -61,9 +61,10 @@ namespace
|
||||
uint32_t size;
|
||||
bool locked;
|
||||
bool purgeable;
|
||||
bool resource;
|
||||
|
||||
HandleInfo(uint32_t a = 0, uint32_t s = 0) :
|
||||
address(a), size(s), locked(false), purgeable(false)
|
||||
address(a), size(s), locked(false), purgeable(false), resource(false)
|
||||
{}
|
||||
};
|
||||
|
||||
@ -334,6 +335,27 @@ namespace MM
|
||||
handleSize = iter->second.size;
|
||||
return SetMemError(0);
|
||||
}
|
||||
uint16_t HSetRBit(uint32_t handle)
|
||||
{
|
||||
const auto iter = HandleMap.find(handle);
|
||||
|
||||
if (iter == HandleMap.end()) return SetMemError(MacOS::memWZErr);
|
||||
|
||||
auto &info = iter->second;
|
||||
info.resource = true;
|
||||
return SetMemError(0);
|
||||
}
|
||||
|
||||
uint16_t HClrRBit(uint32_t handle)
|
||||
{
|
||||
const auto iter = HandleMap.find(handle);
|
||||
|
||||
if (iter == HandleMap.end()) return SetMemError(MacOS::memWZErr);
|
||||
|
||||
auto &info = iter->second;
|
||||
info.resource = false;
|
||||
return SetMemError(0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,9 @@ namespace MM
|
||||
uint16_t DisposePtr(uint32_t pointer);
|
||||
|
||||
uint16_t GetHandleSize(uint32_t handle, uint32_t &handleSize);
|
||||
uint16_t HSetRBit(uint32_t handle);
|
||||
uint16_t HClrRBit(uint32_t handle);
|
||||
|
||||
}
|
||||
|
||||
bool Init(uint8_t *memory, uint32_t memorySize, uint32_t reserved);
|
||||
|
@ -161,6 +161,7 @@ namespace RM
|
||||
::ReleaseResource(nativeHandle);
|
||||
return SetResError(error);
|
||||
}
|
||||
MM::Native::HSetRBit(theHandle);
|
||||
|
||||
if (size)
|
||||
std::memcpy(memoryPointer(ptr), *(void **)nativeHandle, size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user