+/*
+ * PROJECT: ReactOS Search Shell Extension
+ * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: Search results folder
+ * COPYRIGHT: Copyright 2019 Brock Mammen
+ */
+
#include "CFindFolder.h"
#include <exdispid.h>
struct FolderViewColumns
{
- LPCWSTR wzColumnName;
+ int iResource;
DWORD dwDefaultState;
int fmt;
int cxChar;
static FolderViewColumns g_ColumnDefs[] =
{
- {L"Name", SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 30},
- {L"In Folder", SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 30},
- {L"Relevance", SHCOLSTATE_TYPE_STR, LVCFMT_LEFT, 0}
+ {IDS_COL_NAME, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 30},
+ {IDS_COL_LOCATION, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 30},
+ {IDS_COL_RELEVANCE, SHCOLSTATE_TYPE_STR, LVCFMT_LEFT, 0}
};
CFindFolder::CFindFolder() :
return uCount;
}
-static UINT StrStrCountA(const CHAR *lpFirst, const CStringA &lpSrch, UINT cchMax)
+static UINT StrStrCountNIA(const CHAR *lpFirst, const CStringA &lpSrch, UINT cchMax)
{
- return StrStrNCount<CHAR, CStringA, strncmp>(lpFirst, lpSrch, cchMax);
+ return StrStrNCount<CHAR, CStringA, _strnicmp>(lpFirst, lpSrch, cchMax);
}
-static UINT StrStrCountW(const WCHAR *lpFirst, const CStringW &lpSrch, UINT cchMax)
+static UINT StrStrCountNIW(const WCHAR *lpFirst, const CStringW &lpSrch, UINT cchMax)
{
- return StrStrNCount<WCHAR, CStringW, wcsncmp>(lpFirst, lpSrch, cchMax);
+ return StrStrNCount<WCHAR, CStringW, _wcsnicmp>(lpFirst, lpSrch, cchMax);
}
static UINT SearchFile(LPCWSTR lpFilePath, _SearchData *pSearchData)
// Check for UTF-16 BOM
if (size >= 2 && lpFileContent[0] == 0xFF && lpFileContent[1] == 0xFE)
{
- uMatches = StrStrCountW((LPCWSTR) lpFileContent, pSearchData->szQueryW, size / sizeof(WCHAR));
+ uMatches = StrStrCountNIW((LPCWSTR) lpFileContent, pSearchData->szQueryW, size / sizeof(WCHAR));
}
else
{
- uMatches = StrStrCountA((LPCSTR) lpFileContent, pSearchData->szQueryA, size / sizeof(CHAR));
+ uMatches = StrStrCountNIA((LPCSTR) lpFileContent, pSearchData->szQueryA, size / sizeof(CHAR));
}
UnmapViewOfFile(lpFileContent);
CStringW status;
status.Format(IDS_SEARCH_FILES_FOUND, uTotalFound);
::PostMessageW(data->hwnd, WM_SEARCH_UPDATE_STATUS, 0, (LPARAM) StrDupW(status.GetBuffer()));
+ ::SendMessageW(data->hwnd, WM_SEARCH_STOP, 0, 0);
+ CloseHandle(data->hStopEvent);
delete data;
return 0;
pDetails->fmt = g_ColumnDefs[iColumn].fmt;
if (!pidl)
- return SHSetStrRet(&pDetails->str, g_ColumnDefs[iColumn].wzColumnName);
+ return SHSetStrRet(&pDetails->str, _AtlBaseModule.GetResourceInstance(), g_ColumnDefs[iColumn].iResource);
if (iColumn == 1)
{
{
QCMINFO *pqcminfo = (QCMINFO *) lParam;
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, pqcminfo->idCmdFirst++, MFT_SEPARATOR, NULL, 0);
- _InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, pqcminfo->idCmdFirst++, MFT_STRING, L"Open Containing Folder", MFS_ENABLED);
+ _InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, pqcminfo->idCmdFirst++, MFT_STRING, MAKEINTRESOURCEW(IDS_SEARCH_OPEN_FOLDER), MFS_ENABLED);
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, pqcminfo->idCmdFirst++, MFT_SEPARATOR, NULL, 0);
return S_OK;
}
{
if (pClassId == NULL)
return E_INVALIDARG;
- memcpy(pClassId, &CLSID_FindFolder, sizeof(CLSID));
+ *pClassId = CLSID_FindFolder;
return S_OK;
}