Hi Gal,
+ WORD locks; + if ((locks = (GlobalFlags(lppd->hDevMode) & GMEM_LOCKCOUNT))) { + WARN("hDevMode has %d locks on it. Unlocking it now\n", locks); + while(locks--) { + GlobalUnlock(lppd->hDevMode); + TRACE("Now got %d locks\n", locks);
This looks funny. The loop may have a race condition if someone else is locking/unlocking it. The following would be simpler, and more importantly, more likely to be correct:
WORD locks; while ((locks = (GlobalFlags(lppd->hDevMode) & GMEM_LOCKCOUNT))) { GlobalUnlock(lppd->hDevMode); TRACE("Now got %d locks\n", locks); }
The same comment applies to unlocking hDevNames. --Juan