void Store(HKEY hKey, RegKeyType rkt) { if (!hKey || IsPredefined(hKey)) { _ASSERTE(hKey!=NULL); _ASSERTE(!IsPredefined(hKey) || (rkt>=RKT_HKCU && rkt<=RKT_HKLM64)); return; } //mhk_Last = hkSoftware; //WARNING("### Process RegKeyBlocks!"); MSectionLock SC; SC.Lock(&mc_Lock, TRUE, 500); RegKeyInfo* p = FindFreeSlot(); p->hKey = hKey; p->rkt = rkt; mp_LastKey = p; };
/* ------------------------------------------------------------------------------------ */ int CAudioStream::Play(const char *szFilename, bool fLoopIt, bool bProxy) { if((szFilename == NULL) || (strlen(szFilename) <= 0)) return RGF_FAILURE; // FIX #1 char szTemp[256]; strcpy(szTemp, CCD->GetDirectory(kAudioStreamFile)); strcat(szTemp, "\\"); strcat(szTemp, szFilename); // If this is a request from the proxy trigger to stream a wave, // ..and we're already streaming a looping wave started by a // ..proxy, kill the pre-existing one before we start the new // ..one. Why? Well, you really only want one soundtrack // ..looping at one time, and this prevents accidents where // ..another soundtrack is started ALONG WITH the earlier one. if(m_LoopingProxy > 0) { m_Streams[m_LoopingProxy]->Stop(); // Stop it. delete m_Streams[m_LoopingProxy]; // Kill it m_Streams[m_LoopingProxy] = NULL; // Crush it delete m_FileList[m_LoopingProxy]; // Smear it m_FileList[m_LoopingProxy] = NULL; // Be mean to it! m_LoopingProxy = -1; // ..and make it go away. } // Ok, locate a free spot in the list int nSlot = FindFreeSlot(); if(nSlot < 0) return RGF_FAILURE; // No free slots, too many streams // FIX #1 m_FileList[nSlot] = new char[strlen(szTemp) + 2]; // FIX #1 strcpy(m_FileList[nSlot], szTemp); // Save name off m_Streams[nSlot] = new StreamingAudio(m_dsPtr); if(m_Streams[nSlot] == NULL) { delete m_FileList[nSlot]; m_FileList[nSlot] = NULL; return RGF_FAILURE; } // Ok, we've got the slot, filled it, constructed a StreamingAudio // ..object to handle the streaming WAVE, let's PLAY IT. // FIX #1 if(m_Streams[nSlot]->Create(szTemp) != RGF_SUCCESS) { char szBug[256]; sprintf(szBug, "[WARNING] File %s - Line %d: Failed to play '%s'\n", __FILE__, __LINE__, szTemp); CCD->ReportError(szBug, false); delete m_FileList[nSlot]; m_FileList[nSlot] = NULL; delete m_Streams[nSlot]; m_Streams[nSlot] = NULL; return RGF_FAILURE; } m_Streams[nSlot]->Play(fLoopIt); // Start me up! // If this is LOOPING and a PROXY TRIGGER, save the slot ID for later if(fLoopIt && bProxy) m_LoopingProxy = nSlot; // For later harm. // At this point the thing should be playing, so we're outta here. return RGF_SUCCESS; }