~CEventSetEnd() { NSynchronization::CManualResetEvent event; if (event.Open(EVENT_MODIFY_STATE, false, GetSystemString(Name)) == 0) event.Set(); }
static void ParseMapWithPaths(NWildcard::CCensor &wildcardCensor, const UString &switchParam, bool include, NRecursedType::EEnum commonRecursedType) { int splitPos = switchParam.Find(L':'); if (splitPos < 0) ThrowUserErrorException(); UString mappingName = switchParam.Left(splitPos); UString switchParam2 = switchParam.Mid(splitPos + 1); splitPos = switchParam2.Find(L':'); if (splitPos < 0) ThrowUserErrorException(); UString mappingSize = switchParam2.Left(splitPos); UString eventName = switchParam2.Mid(splitPos + 1); UInt64 dataSize64 = ConvertStringToUInt64(mappingSize, NULL); UInt32 dataSize = (UInt32)dataSize64; { CFileMapping fileMapping; if (fileMapping.Open(FILE_MAP_READ, GetSystemString(mappingName)) != 0) ThrowException("Can not open mapping"); LPVOID data = fileMapping.Map(FILE_MAP_READ, 0, dataSize); if (data == NULL) ThrowException("MapViewOfFile error"); try { const wchar_t *curData = (const wchar_t *)data; if (*curData != 0) ThrowException("Incorrect mapping data"); UInt32 numChars = dataSize / sizeof(wchar_t); UString name; for (UInt32 i = 1; i < numChars; i++) { wchar_t c = curData[i]; if (c == L'\0') { AddNameToCensor(wildcardCensor, name, include, commonRecursedType); name.Empty(); } else name += c; } if (!name.IsEmpty()) ThrowException("data error"); } catch(...) { UnmapViewOfFile(data); throw; } UnmapViewOfFile(data); } { NSynchronization::CManualResetEvent event; if (event.Open(EVENT_MODIFY_STATE, false, GetSystemString(eventName)) == S_OK) event.Set(); } }