+ // UTF16 LE
+ LPCWSTR lpSearchPos = (LPCWSTR) lpFileContent;
+ DWORD dwCharsRemaining = size / sizeof(WCHAR);
+ const LPCWSTR lpSearchEnd = (LPCWSTR) lpFileContent + dwCharsRemaining;
+ const LPCWSTR lpszQuery = pSearchData->pSearchParams->szQuery;
+ const size_t queryLen = wcslen(lpszQuery);
+ while ((lpSearchPos = StrStrNW(lpSearchPos, lpszQuery, dwCharsRemaining))
+ && lpSearchPos < lpSearchEnd)
+ {
+ uMatches++;
+ lpSearchPos += queryLen;
+ dwCharsRemaining -= queryLen;
+ }
+ }
+ else
+ {
+ DWORD len = WideCharToMultiByte(CP_ACP, 0, pSearchData->pSearchParams->szQuery, -1, NULL, 0, NULL, NULL);
+ const LPSTR lpszQuery = new CHAR[len];
+ WideCharToMultiByte(CP_ACP, 0, pSearchData->pSearchParams->szQuery, -1, lpszQuery, len, NULL, NULL);
+ LPCSTR lpSearchPos = (LPCSTR) lpFileContent;
+ DWORD dwCharsRemaining = size;
+ const LPCSTR lpSearchEnd = (LPCSTR) lpFileContent + dwCharsRemaining;
+ const size_t queryLen = len;
+ while ((lpSearchPos = StrStrNA(lpSearchPos, lpszQuery, dwCharsRemaining))
+ && lpSearchPos < lpSearchEnd)
+ {
+ uMatches++;
+ lpSearchPos += queryLen;
+ dwCharsRemaining -= queryLen;
+ }