xcall MIAMEX, MX_QLOCK
xcall MIAMEX, MX_QUNLOK
MX_QLOCK (MIAMEX 67) locks the qflock.sys file. It should be called before trying to read the qflock.sys file, and should then be followed by MX_QUNLOK.
MX_QUNLOK (MIAMEX 68) removes the lock on the qflock.sys file which was placed by a prior call to MX_QLOCK.