vfs: check userland buffers before reading them.
[haiku.git] / src / apps / bootmanager / LegacyBootMenu.h
blob9e7573c7ca77fe1a22efc2c909bebbbf7b2204e7
1 /*
2 * Copyright 2008-2011, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Axel Dörfler, axeld@pinc-software.de
7 * Michael Pfeiffer <laplace@users.sourceforge.net>
8 */
9 #ifndef LEGACY_BOOT_MENU_H
10 #define LEGACY_BOOT_MENU_H
13 #include "BootMenu.h"
15 #include <SupportDefs.h>
18 struct MasterBootRecord;
21 class LegacyBootMenu : public BootMenu {
22 public:
23 LegacyBootMenu();
24 virtual ~LegacyBootMenu();
26 virtual bool IsInstalled(const BootDrive& drive);
27 virtual status_t CanBeInstalled(const BootDrive& drive);
29 virtual status_t CollectPartitions(const BootDrive& drive,
30 BMessage& settings);
32 virtual status_t Install(const BootDrive& drive,
33 BMessage& settings);
34 virtual status_t SaveMasterBootRecord(BMessage* settings,
35 BFile* file);
36 virtual status_t RestoreMasterBootRecord(BMessage* settings,
37 BFile* file);
38 virtual status_t GetDisplayText(const char* text,
39 BString& displayText);
41 private:
42 bool _ConvertToBIOSText(const char* text,
43 BString& biosText);
44 status_t _GetBIOSDrive(const char* device,
45 int8& drive);
46 status_t _ReadBlocks(int fd, uint8* buffer, size_t size);
47 status_t _WriteBlocks(int fd, const uint8* buffer,
48 size_t size);
49 void _CopyPartitionTable(
50 MasterBootRecord* destination,
51 const MasterBootRecord* source);
52 bool _IsValid(const MasterBootRecord* mbr);
56 #endif // LEGACY_BOOT_MENU_H