39 hRomFile =
FileOpen(RomFileName, &ulRomSize);
49 if (ulRomSize > 0x40000)
52 DPRINT1(
"ROM image size 0x%lx too large, expected at most 0x40000 (256kB)\n", ulRomSize);
58 if (RomSize) *RomSize = ulRomSize;
73 if (RomSize > 0x40000)
75 DPRINT1(
"ROM image size 0x%lx too large, expected at most 0x40000 (256kB)\n", RomSize);
111 if (
Address >= 0xE0000) RomSize = 0x10000;
114 if (Checksum == 0x00)
117 DPRINT1(
"Going to run @ address 0x%p\n", EntryPoint);
119 EntryPoint =
MAKELONG((EntryPoint & 0xFFFF), (EntryPoint & 0xF0000) >> 4);
129 DPRINT1(
"ROM @ address 0x%p has invalid checksum of 0x%02x\n",
Address, Checksum);
156 ULONG RomLastAddress = RomLocation + RomSize;
159 while (RomLocation < RomLastAddress)
175 ULONG ulBiosSize = 0;
179 hBiosFile =
OpenRomFile(BiosFileName, &ulBiosSize);
206 if (BiosLocation) *BiosLocation = pBiosLocation;
207 if (BiosSize) *BiosSize = ulBiosSize;
245 if (RomSize) *RomSize = ulRomSize;
#define TO_LINEAR(seg, off)
#define REAL_TO_PHYS(ptr)
#define MEM_ALIGN_DOWN(ptr, align)
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
UCHAR CalcRomChecksum(IN ULONG RomLocation, IN ULONG RomSize)
BOOLEAN LoadBios(IN PCSTR BiosFileName, OUT PVOID *BiosLocation OPTIONAL, OUT PULONG BiosSize OPTIONAL)
VOID SearchAndInitRoms(IN PCALLBACK16 Context)
static BOOLEAN FASTCALL ShadowRomWrite(ULONG Address, PVOID Buffer, ULONG Size)
static VOID InitRomRange(IN PCALLBACK16 Context, IN ULONG Start, IN ULONG End, IN ULONG Increment)
BOOLEAN LoadRom(IN PCSTR RomFileName, IN PVOID RomLocation, OUT PULONG RomSize OPTIONAL)
BOOLEAN WriteUnProtectRom(IN PVOID RomLocation, IN ULONG RomSize)
static HANDLE OpenRomFile(IN PCSTR RomFileName, OUT PULONG RomSize OPTIONAL)
BOOLEAN WriteProtectRom(IN PVOID RomLocation, IN ULONG RomSize)
static BOOLEAN LoadRomFileByHandle(IN HANDLE RomFileHandle, IN PVOID RomLocation, IN ULONG RomSize, OUT PULONG BytesRead)
#define OPTION_ROM_SIGNATURE
PULONG MinorVersion OPTIONAL
VOID RunCallback16(IN PCALLBACK16 Context, IN ULONG FarPtr)
BOOL MemRemoveFastMemoryHook(PVOID Address, ULONG Size)
BOOL MemInstallFastMemoryHook(PVOID Address, ULONG Size, PMEMORY_READ_HANDLER ReadHandler, PMEMORY_WRITE_HANDLER WriteHandler)
HANDLE FileOpen(IN PCSTR FileName, OUT PULONG FileSize OPTIONAL)
VOID FileClose(IN HANDLE FileHandle)
BOOLEAN FileLoadByHandle(IN HANDLE FileHandle, IN PVOID Location, IN ULONG FileSize, OUT PULONG BytesRead)
VOID WINAPI setDS(USHORT)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
DWORD WINAPI GetLastError(void)