fix CloseResFile with refNum 0.

This commit is contained in:
Kelvin Sherlock 2014-12-24 10:17:23 -05:00
parent 8c811c4de9
commit 45fae53ef5

View File

@ -196,14 +196,21 @@ namespace RM
uint16_t CloseResFile(uint16_t trap) uint16_t CloseResFile(uint16_t trap)
{ {
// PROCEDURE CloseResFile (refNum: Integer);
uint16_t refNum; uint16_t refNum;
StackFrame<2>(refNum); StackFrame<2>(refNum);
Log("%04x CloseResFile(%04x)\n", trap, refNum); Log("%04x CloseResFile(%04x)\n", trap, refNum);
::CloseResFile(refNum);
return SetResError(::ResError());
// If the value of the refNum parameter is 0, it represents the System file and is ignored.
if (refNum != 0)
{
::CloseResFile(refNum);
return SetResError(::ResError());
}
return SetResError(0);
//return SetResError(resFNotFound); //return SetResError(resFNotFound);
} }
@ -543,7 +550,8 @@ namespace RM
buffer[7] = creator >> 0; buffer[7] = creator >> 0;
std::memcpy(buffer+4, &creator, 4); std::memcpy(buffer+4, &creator, 4);
OS::Internal::SetFinderInfo(sname, buffer, false); // this is a new file, set the full finder info.
OS::Internal::SetFinderInfo(sname, buffer, true);
} }
return SetResError(rv.error() == errFSForkExists ? 0 : rv.error()); return SetResError(rv.error() == errFSForkExists ? 0 : rv.error());