亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? iso.c

?? ReactOS是一些高手根據(jù)Windows XP的內(nèi)核編寫出的類XP。內(nèi)核實(shí)現(xiàn)機(jī)理和API函數(shù)調(diào)用幾乎相同。甚至可以兼容XP的程序。喜歡研究系統(tǒng)內(nèi)核的人可以看一看。
?? C
字號(hào):
/*
 *  FreeLoader
 *  Copyright (C) 1998-2003  Brian Palmer  <brianp@sginet.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <freeldr.h>
#include <debug.h>

#define SECTORSIZE 2048

static ULONG		IsoRootSector;		// Starting sector of the root directory
static ULONG		IsoRootLength;		// Length of the root directory

ULONG			IsoDriveNumber = 0;


BOOLEAN IsoOpenVolume(ULONG DriveNumber)
{
	PPVD Pvd = (PPVD)DISKREADBUFFER;

	DbgPrint((DPRINT_FILESYSTEM, "IsoOpenVolume() DriveNumber = 0x%x VolumeStartSector = 16\n", DriveNumber));

	// Store the drive number
	IsoDriveNumber = DriveNumber;

	IsoRootSector = 0;
	IsoRootLength = 0;

	if (!MachDiskReadLogicalSectors(DriveNumber, 16, 1, Pvd))
	{
		FileSystemError("Failed to read the PVD.");
		return FALSE;
	}

	IsoRootSector = Pvd->RootDirRecord.ExtentLocationL;
	IsoRootLength = Pvd->RootDirRecord.DataLengthL;

	DbgPrint((DPRINT_FILESYSTEM, "IsoRootSector = %u  IsoRootLegth = %u\n", IsoRootSector, IsoRootLength));

	return TRUE;
}


static BOOLEAN IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectoryLength, PCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer)
{
	PDIR_RECORD	Record;
	ULONG		Offset;
	ULONG i;
	CHAR Name[32];

	DbgPrint((DPRINT_FILESYSTEM, "IsoSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectoryLength = %d FileName = %s\n", DirectoryBuffer, DirectoryLength, FileName));

	RtlZeroMemory(Name, 32 * sizeof(UCHAR));

	Offset = 0;
	Record = (PDIR_RECORD)DirectoryBuffer;
	while (TRUE)
	{
		Offset = Offset + Record->RecordLength;
		Record = (PDIR_RECORD)((ULONG_PTR)DirectoryBuffer + Offset);

		if (Record->RecordLength == 0)
		{
			Offset = ROUND_UP(Offset, SECTORSIZE);
			Record = (PDIR_RECORD)((ULONG_PTR)DirectoryBuffer + Offset);
		}

		if (Offset >= DirectoryLength)
			return FALSE;

		if (Record->FileIdLength == 1 && Record->FileId[0] == 0)
		{
			DbgPrint((DPRINT_FILESYSTEM, "Name '.'\n"));
		}
		else if (Record->FileIdLength == 1 && Record->FileId[0] == 1)
		{
			DbgPrint((DPRINT_FILESYSTEM, "Name '..'\n"));
		}
		else
		{
			for (i = 0; i < Record->FileIdLength && Record->FileId[i] != ';'; i++)
				Name[i] = Record->FileId[i];
			Name[i] = 0;
			DbgPrint((DPRINT_FILESYSTEM, "Name '%s'\n", Name));

			if (strlen(FileName) == strlen(Name) && _stricmp(FileName, Name) == 0)
			{
				IsoFileInfoPointer->FileStart = Record->ExtentLocationL;
				IsoFileInfoPointer->FileSize = Record->DataLengthL;
				IsoFileInfoPointer->FilePointer = 0;
				IsoFileInfoPointer->Directory = (Record->FileFlags & 0x02)?TRUE:FALSE;

				return TRUE;
			}

		}

		RtlZeroMemory(Name, 32 * sizeof(UCHAR));
	}

	return FALSE;
}


/*
 * IsoBufferDirectory()
 * This function allocates a buffer, reads the specified directory
 * and returns a pointer to that buffer. The function returns NULL
 * if allocation or read fails. The directory is specified by its
 * starting sector and length.
 */
static PVOID IsoBufferDirectory(ULONG DirectoryStartSector, ULONG DirectoryLength)
{
	PVOID	DirectoryBuffer;
	PVOID	Ptr;
	ULONG	SectorCount;
	ULONG	i;

	DbgPrint((DPRINT_FILESYSTEM, "IsoBufferDirectory() DirectoryStartSector = %d DirectoryLength = %d\n", DirectoryStartSector, DirectoryLength));

	SectorCount = ROUND_UP(DirectoryLength, SECTORSIZE) / SECTORSIZE;
	DbgPrint((DPRINT_FILESYSTEM, "Trying to read (DirectoryCount) %d sectors.\n", SectorCount));

	//
	// Attempt to allocate memory for directory buffer
	//
	DbgPrint((DPRINT_FILESYSTEM, "Trying to allocate (DirectoryLength) %d bytes.\n", DirectoryLength));
	DirectoryBuffer = MmAllocateMemory(DirectoryLength);

	if (DirectoryBuffer == NULL)
	{
		return NULL;
	}

	//
	// Now read directory contents into DirectoryBuffer
	//
	for (i = 0, Ptr = DirectoryBuffer; i < SectorCount; i++, Ptr = (PVOID)((ULONG_PTR)Ptr + SECTORSIZE))
	{
		if (!MachDiskReadLogicalSectors(IsoDriveNumber, DirectoryStartSector + i, 1, (PVOID)DISKREADBUFFER))
		{
			MmFreeMemory(DirectoryBuffer);
			return NULL;
		}
		RtlCopyMemory(Ptr, (PVOID)DISKREADBUFFER, SECTORSIZE);
	}

	return DirectoryBuffer;
}


/*
 * IsoLookupFile()
 * This function searches the file system for the
 * specified filename and fills in an ISO_FILE_INFO structure
 * with info describing the file, etc. returns true
 * if the file exists or false otherwise
 */
static BOOLEAN IsoLookupFile(PCSTR FileName, PISO_FILE_INFO IsoFileInfoPointer)
{
	UINT		i;
	ULONG			NumberOfPathParts;
	CHAR		PathPart[261];
	PVOID		DirectoryBuffer;
	ULONG		DirectorySector;
	ULONG		DirectoryLength;
	ISO_FILE_INFO	IsoFileInfo;

	DbgPrint((DPRINT_FILESYSTEM, "IsoLookupFile() FileName = %s\n", FileName));

	RtlZeroMemory(IsoFileInfoPointer, sizeof(ISO_FILE_INFO));

	//
	// Figure out how many sub-directories we are nested in
	//
	NumberOfPathParts = FsGetNumPathParts(FileName);

	DirectorySector = IsoRootSector;
	DirectoryLength = IsoRootLength;

	//
	// Loop once for each part
	//
	for (i=0; i<NumberOfPathParts; i++)
	{
		//
		// Get first path part
		//
		FsGetFirstNameFromPath(PathPart, FileName);

		//
		// Advance to the next part of the path
		//
		for (; (*FileName != '\\') && (*FileName != '/') && (*FileName != '\0'); FileName++)
		{
		}
		FileName++;

		//
		// Buffer the directory contents
		//
		DirectoryBuffer = IsoBufferDirectory(DirectorySector, DirectoryLength);
		if (DirectoryBuffer == NULL)
		{
			return FALSE;
		}

		//
		// Search for file name in directory
		//
		if (!IsoSearchDirectoryBufferForFile(DirectoryBuffer, DirectoryLength, PathPart, &IsoFileInfo))
		{
			MmFreeMemory(DirectoryBuffer);
			return FALSE;
		}

		MmFreeMemory(DirectoryBuffer);

		//
		// If we have another sub-directory to go then
		// grab the start sector and file size
		//
		if ((i+1) < NumberOfPathParts)
		{
			DirectorySector = IsoFileInfo.FileStart;
			DirectoryLength = IsoFileInfo.FileSize;
		}

	}

	RtlCopyMemory(IsoFileInfoPointer, &IsoFileInfo, sizeof(ISO_FILE_INFO));

	return TRUE;
}


/*
 * IsoOpenFile()
 * Tries to open the file 'name' and returns true or false
 * for success and failure respectively
 */
FILE* IsoOpenFile(PCSTR FileName)
{
	ISO_FILE_INFO		TempFileInfo;
	PISO_FILE_INFO		FileHandle;

	DbgPrint((DPRINT_FILESYSTEM, "IsoOpenFile() FileName = %s\n", FileName));

	if (!IsoLookupFile(FileName, &TempFileInfo))
	{
		return NULL;
	}

	FileHandle = MmAllocateMemory(sizeof(ISO_FILE_INFO));

	if (FileHandle == NULL)
	{
		return NULL;
	}

	RtlCopyMemory(FileHandle, &TempFileInfo, sizeof(ISO_FILE_INFO));

	return (FILE*)FileHandle;
}


/*
 * IsoReadFile()
 * Reads BytesToRead from open file and
 * returns the number of bytes read in BytesRead
 */
BOOLEAN IsoReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer)
{
	PISO_FILE_INFO	IsoFileInfo = (PISO_FILE_INFO)FileHandle;
	ULONG		SectorNumber;
	ULONG		OffsetInSector;
	ULONG		LengthInSector;
	ULONG		NumberOfSectors;
	ULONG		i;

	DbgPrint((DPRINT_FILESYSTEM, "IsoReadFile() BytesToRead = %d Buffer = 0x%x\n", BytesToRead, Buffer));

	if (BytesRead != NULL)
	{
		*BytesRead = 0;
	}

	//
	// If they are trying to read past the
	// end of the file then return success
	// with BytesRead == 0
	//
	if (IsoFileInfo->FilePointer >= IsoFileInfo->FileSize)
	{
		return TRUE;
	}

	//
	// If they are trying to read more than there is to read
	// then adjust the amount to read
	//
	if ((IsoFileInfo->FilePointer + BytesToRead) > IsoFileInfo->FileSize)
	{
		BytesToRead = (IsoFileInfo->FileSize - IsoFileInfo->FilePointer);
	}

	//
	// Ok, now we have to perform at most 3 calculations
	// I'll draw you a picture (using nifty ASCII art):
	//
	// CurrentFilePointer -+
	//                     |
	//    +----------------+
	//    |
	// +-----------+-----------+-----------+-----------+
	// | Sector  1 | Sector  2 | Sector  3 | Sector  4 |
	// +-----------+-----------+-----------+-----------+
	//    |                                    |
	//    +---------------+--------------------+
	//                    |
	// BytesToRead -------+
	//
	// 1 - The first calculation (and read) will align
	//     the file pointer with the next sector
	//     boundary (if we are supposed to read that much)
	// 2 - The next calculation (and read) will read
	//     in all the full sectors that the requested
	//     amount of data would cover (in this case
	//     sectors 2 & 3).
	// 3 - The last calculation (and read) would read
	//     in the remainder of the data requested out of
	//     the last sector.
	//


	//
	// Only do the first read if we
	// aren't aligned on a cluster boundary
	//
	if (IsoFileInfo->FilePointer % SECTORSIZE)
	{
		//
		// Do the math for our first read
		//
		SectorNumber = IsoFileInfo->FileStart + (IsoFileInfo->FilePointer / SECTORSIZE);
		OffsetInSector = IsoFileInfo->FilePointer % SECTORSIZE;
		LengthInSector = (BytesToRead > (SECTORSIZE - OffsetInSector)) ? (SECTORSIZE - OffsetInSector) : BytesToRead;

		//
		// Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer
		//
		if (!MachDiskReadLogicalSectors(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER))
		{
			return FALSE;
		}
		RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)DISKREADBUFFER + OffsetInSector), LengthInSector);
		if (BytesRead != NULL)
		{
			*BytesRead += LengthInSector;
		}
		BytesToRead -= LengthInSector;
		IsoFileInfo->FilePointer += LengthInSector;
		Buffer = (PVOID)((ULONG_PTR)Buffer + LengthInSector);
	}

	//
	// Do the math for our second read (if any data left)
	//
	if (BytesToRead > 0)
	{
		//
		// Determine how many full clusters we need to read
		//
		NumberOfSectors = (BytesToRead / SECTORSIZE);

		for (i = 0; i < NumberOfSectors; i++)
		{
			SectorNumber = IsoFileInfo->FileStart + (IsoFileInfo->FilePointer / SECTORSIZE);

			//
			// Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer
			//
			if (!MachDiskReadLogicalSectors(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER))
			{
				return FALSE;
			}

			RtlCopyMemory(Buffer, (PVOID)DISKREADBUFFER, SECTORSIZE);

			if (BytesRead != NULL)
			{
				*BytesRead += SECTORSIZE;
			}
			BytesToRead -= SECTORSIZE;
			IsoFileInfo->FilePointer += SECTORSIZE;
			Buffer = (PVOID)((ULONG_PTR)Buffer + SECTORSIZE);
		}
	}

	//
	// Do the math for our third read (if any data left)
	//
	if (BytesToRead > 0)
	{
		SectorNumber = IsoFileInfo->FileStart + (IsoFileInfo->FilePointer / SECTORSIZE);

		//
		// Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer
		//
		if (!MachDiskReadLogicalSectors(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER))
		{
			return FALSE;
		}
		RtlCopyMemory(Buffer, (PVOID)DISKREADBUFFER, BytesToRead);
		if (BytesRead != NULL)
		{
			*BytesRead += BytesToRead;
		}
		IsoFileInfo->FilePointer += BytesToRead;
		BytesToRead -= BytesToRead;
		Buffer = (PVOID)((ULONG_PTR)Buffer + BytesToRead);
	}

	DbgPrint((DPRINT_FILESYSTEM, "IsoReadFile() done\n"));

	return TRUE;
}


ULONG IsoGetFileSize(FILE *FileHandle)
{
	PISO_FILE_INFO	IsoFileHandle = (PISO_FILE_INFO)FileHandle;

	DbgPrint((DPRINT_FILESYSTEM, "IsoGetFileSize() FileSize = %d\n", IsoFileHandle->FileSize));

	return IsoFileHandle->FileSize;
}

VOID IsoSetFilePointer(FILE *FileHandle, ULONG NewFilePointer)
{
	PISO_FILE_INFO	IsoFileHandle = (PISO_FILE_INFO)FileHandle;

	DbgPrint((DPRINT_FILESYSTEM, "IsoSetFilePointer() NewFilePointer = %d\n", NewFilePointer));

	IsoFileHandle->FilePointer = NewFilePointer;
}

ULONG IsoGetFilePointer(FILE *FileHandle)
{
	PISO_FILE_INFO	IsoFileHandle = (PISO_FILE_INFO)FileHandle;

	DbgPrint((DPRINT_FILESYSTEM, "IsoGetFilePointer() FilePointer = %d\n", IsoFileHandle->FilePointer));

	return IsoFileHandle->FilePointer;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩电影在线观看电影| 国产精品久久久久久久久快鸭| 色婷婷精品大在线视频| 欧美日韩国产电影| 高清免费成人av| 在线看国产一区二区| 中文字幕av在线一区二区三区| 免费观看30秒视频久久| 国产91精品入口| 在线观看网站黄不卡| 国产精品理伦片| 在线视频亚洲一区| 国产精品久久久久婷婷二区次| 精品在线亚洲视频| 久久久天堂av| 视频一区视频二区在线观看| 免费看欧美美女黄的网站| 97精品电影院| 欧美一级一区二区| 一区二区三区四区在线免费观看| 亚洲成人免费av| 欧美日韩免费电影| 日本欧洲一区二区| 日韩午夜激情电影| 精品一区精品二区高清| 国产人久久人人人人爽| 99国产精品国产精品久久| 亚洲老妇xxxxxx| 日韩一区二区三区在线观看 | 亚洲丝袜另类动漫二区| 91免费版在线看| 激情久久五月天| 国产女人aaa级久久久级 | 在线不卡的av| 国产精品麻豆视频| 国产精品一区二区在线观看不卡 | 99国产欧美久久久精品| 国产午夜精品久久久久久久| 色视频一区二区| 国产精品毛片大码女人| 国产激情视频一区二区三区欧美| 日韩三级.com| 蜜臀av一级做a爰片久久| 欧美日本免费一区二区三区| 亚洲综合激情另类小说区| 一本久道中文字幕精品亚洲嫩| 亚洲视频图片小说| 91网站最新网址| 中文字幕一区二| 99麻豆久久久国产精品免费| 国产精品毛片无遮挡高清| 不卡免费追剧大全电视剧网站| 国产精品久久久久久妇女6080| 国产成人三级在线观看| 国产精品视频看| 99久久免费精品高清特色大片| 日韩理论片一区二区| 成人av高清在线| 亚洲蜜桃精久久久久久久| 91国产成人在线| 亚洲成人手机在线| 日韩午夜在线播放| 韩国精品在线观看| 国产精品狼人久久影院观看方式| 91偷拍与自偷拍精品| 亚洲综合丝袜美腿| 这里只有精品视频在线观看| 久久99日本精品| 国产精品视频九色porn| 91丝袜国产在线播放| 亚洲一区二区三区中文字幕| 欧美精品在线观看一区二区| 日韩成人精品在线观看| 久久一区二区三区四区| 99精品国产视频| 亚洲成人av电影在线| 日韩美女主播在线视频一区二区三区 | 97se亚洲国产综合在线| 亚洲国产综合色| 精品国产一区二区亚洲人成毛片| 国产剧情一区二区| 一区二区三区四区高清精品免费观看 | 国产在线精品一区在线观看麻豆| 中文字幕高清一区| 欧美在线视频日韩| 九色综合狠狠综合久久| 国产精品久久久久久久久免费桃花| 色8久久人人97超碰香蕉987| 日本欧洲一区二区| 国产精品国产三级国产普通话蜜臀 | 亚洲一区二区中文在线| 欧美大片在线观看| 成人av在线播放网址| 五月婷婷激情综合| 久久久99久久| 欧美日韩一级视频| 国产精品白丝av| 亚洲一区二区免费视频| 日韩视频一区二区三区在线播放 | 日本aⅴ精品一区二区三区| 精品久久免费看| 成人免费av在线| 国产精品人成在线观看免费 | 亚洲精品亚洲人成人网| 自拍偷拍亚洲综合| 国产日产精品一区| 亚洲国产精品一区二区www在线| 国产精品18久久久久久久久久久久| 欧洲av一区二区嗯嗯嗯啊| 91丨porny丨在线| 色呦呦国产精品| 精品国产麻豆免费人成网站| 亚洲精品乱码久久久久久黑人 | 一本大道久久a久久精品综合| 色婷婷亚洲一区二区三区| 亚洲视频狠狠干| 天堂蜜桃一区二区三区| 一本色道亚洲精品aⅴ| 欧美一区二区三区在线视频 | 欧美日韩国产综合久久| 中文字幕一区二区三区不卡在线 | 欧美巨大另类极品videosbest| 综合亚洲深深色噜噜狠狠网站| 国产成人啪午夜精品网站男同| 日韩精品中文字幕一区二区三区| 亚洲成人高清在线| 91精品国产福利| 一个色综合网站| 精品视频在线免费| 午夜av一区二区| 欧美mv和日韩mv国产网站| 免费看精品久久片| 久久久久久久性| 国产成人在线看| 中文字幕在线一区二区三区| av高清久久久| 亚洲综合色区另类av| 欧美精品在欧美一区二区少妇| 国产精品久久久久四虎| 国产一区在线观看视频| 日本一区二区视频在线| 91婷婷韩国欧美一区二区| 亚洲欧美偷拍卡通变态| 欧美这里有精品| 日本伊人色综合网| 精品久久久久久无| 国产成人av电影在线观看| 国产精品卡一卡二卡三| 欧美日韩国产bt| 国产盗摄视频一区二区三区| 欧美videossexotv100| 一色屋精品亚洲香蕉网站| 91美女福利视频| 精品一区二区三区的国产在线播放| 精品国产一区二区三区四区四| jvid福利写真一区二区三区| 亚洲成人在线观看视频| 国产精品成人网| 欧美一级艳片视频免费观看| 99久久精品情趣| 国内精品不卡在线| 午夜激情久久久| 国产精品美女视频| 国产成人免费xxxxxxxx| 欧美成人一区二区| 色综合中文字幕国产 | 国产欧美日韩视频在线观看| 欧美中文字幕久久 | 国产精品日产欧美久久久久| 日韩亚洲欧美一区二区三区| 91在线国产福利| 成人av综合在线| www.日韩大片| 亚洲6080在线| 亚洲欧洲中文日韩久久av乱码| 国产日韩av一区| 久久先锋影音av鲁色资源网| 5566中文字幕一区二区电影| 91亚洲国产成人精品一区二区三 | 午夜精品在线视频一区| 亚洲精品大片www| 亚洲色图视频免费播放| 亚洲欧美日韩国产成人精品影院| 麻豆久久久久久久| 亚洲伊人色欲综合网| 亚洲制服丝袜av| 亚洲bt欧美bt精品| 天天综合色天天综合色h| 亚洲成人精品一区二区| 亚洲成年人网站在线观看| 亚洲一区二区五区| 日韩影院免费视频| 蜜臀久久久99精品久久久久久| 日本欧美在线看| 久久99九九99精品| 日韩av一区二区三区四区| 欧美日韩电影在线播放| 精品久久久久一区二区国产| 日韩一区二区三区av| 日韩午夜在线影院|