Beispiel #1
0
//
//	Add hexview's bookmarks to the gridview
//
void FillHexViewHighlights(HGRIDITEM hRoot, HWND hwndHexView, HWND hwndGridView, COLORREF col)
{
	BOOKMARK bm;
	HBOOKMARK hbm;

	for(hbm = 0; (hbm = HexView_EnumBookmark(hwndHexView, hbm, &bm)) != 0; )
	{
		FillGridView2(hwndGridView, hRoot, hbm, &bm, col);
	}
}
Beispiel #2
0
BOOL SaveHighlights(HWND hwndHexView)
{
	TCHAR szBookPath[MAX_PATH];
	TCHAR szFilePath[MAX_PATH];
	BOOKMARK bm;
	HBOOKMARK hbm;
	HCONFIG config, filedata, bookmarks;

	if (!GetBookmarkFileName(hwndHexView, NULL, szBookPath))
		return FALSE;

	config	  = CreateConfig();
	filedata  = CreateConfigSection(config, TEXT("hexFileData"));

	HexView_GetFileName(hwndHexView, szFilePath, MAX_PATH);

	// only save if the file exists
	if(GetFileAttributes(szFilePath) != INVALID_FILE_ATTRIBUTES)
	{
		SetConfigStr(filedata, TEXT("filePath"), szFilePath);
	}

	bookmarks = CreateConfigSection(filedata, TEXT("bookmarks"));

	for(hbm = 0; (hbm = HexView_EnumBookmark(hwndHexView, hbm, &bm)) != 0; )
	{
		if((bm.flags & HVBF_NOPERSIST) == 0)
		{
			HCONFIG bookmark = CreateConfigSection(bookmarks, TEXT("bookmark"));

			SetConfigStr(bookmark, TEXT("name"), bm.pszTitle);
			SetConfigStr(bookmark, TEXT("desc"), bm.pszText);
			SetConfigI64(bookmark, TEXT("offset"), bm.offset);
			SetConfigI64(bookmark, TEXT("length"), bm.length);
			SetConfigH32(bookmark, TEXT("fgcol"), bm.col);
			SetConfigH32(bookmark, TEXT("bgcol"), bm.backcol);
		}
	}

	SaveConfig(szBookPath, config);

	return TRUE;
}