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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? syslinux.c

?? check your system memory for problems.
?? C
字號:
/* ----------------------------------------------------------------------- * * *   Copyright 2003 Lars Munch Christensen - All Rights Reserved *   Copyright 1998-2007 H. Peter Anvin - All Rights Reserved * *   Based on the Linux installer program for SYSLINUX by H. Peter Anvin * *   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, Inc., 53 Temple Place Ste 330, *   Boston MA 02111-1307, USA; either version 2 of the License, or *   (at your option) any later version; incorporated herein by reference. * * ----------------------------------------------------------------------- *//* * syslinux-mingw.c - Win2k/WinXP installer program for SYSLINUX */#include <windows.h>#include <stdio.h>#include <ctype.h>#include "syslinux.h"#include "libfat.h"#ifdef __GNUC__# define noreturn void __attribute__((noreturn))#else# define noreturn void#endifvoid error(char* msg);/* Begin stuff for MBR code */#include <winioctl.h>#define SECTOR_SIZE 512#define PART_TABLE  0x1be#define PART_SIZE   0x10#define PART_COUNT  4#define PART_ACTIVE 0x80// The following struct should be in the ntddstor.h file, but I didn't have it.// TODO: Make this a conditional compilationtypedef struct _STORAGE_DEVICE_NUMBER {  DEVICE_TYPE  DeviceType;  ULONG  DeviceNumber;  ULONG  PartitionNumber;} STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;BOOL GetStorageDeviceNumberByHandle( HANDLE handle, const STORAGE_DEVICE_NUMBER *sdn ) {  BOOL result = FALSE;  DWORD count;  if ( DeviceIoControl( handle, IOCTL_STORAGE_GET_DEVICE_NUMBER, NULL,			0, (LPVOID)sdn, sizeof( *sdn ), &count, NULL ) ) {    result = TRUE;  }  else {    error("GetDriveNumber: DeviceIoControl failed");  }  return( result );}int GetBytesPerSector( HANDLE drive ) {  int result = 0;  DISK_GEOMETRY g;  DWORD count;  if ( DeviceIoControl( drive, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0,			&g, sizeof( g ), &count, NULL ) ) {    result = g.BytesPerSector;  }  return( result );}BOOL FixMBR(int driveNum, int partitionNum, int write_mbr, int set_active) {  BOOL result = TRUE;  HANDLE drive;  char driveName[128];  sprintf( driveName, "\\\\.\\PHYSICALDRIVE%d", driveNum );  drive = CreateFile( driveName,		      GENERIC_READ | GENERIC_WRITE,		      FILE_SHARE_WRITE | FILE_SHARE_READ,		      NULL,		      OPEN_EXISTING,		      0,		      NULL );  if( drive == INVALID_HANDLE_VALUE ) {    error("Accessing physical drive");    result = FALSE;  }  if( result ) {    unsigned char sector[SECTOR_SIZE];    DWORD howMany;    if( GetBytesPerSector( drive ) != SECTOR_SIZE ) {      fprintf(stderr, "Error: Sector size of this drive is %d; must be %d\n",	      GetBytesPerSector( drive ), SECTOR_SIZE );      result = FALSE;    }    if ( result ) {      if ( ReadFile( drive, sector, sizeof( sector ), &howMany, NULL ) == 0 ) {	error("Reading raw drive");	result = FALSE;      } else if ( howMany != sizeof( sector ) ) {	fprintf(stderr, "Error: ReadFile on drive only got %d of %d bytes\n",		(int)howMany, sizeof( sector ) );	result = FALSE;      }    }    // Copy over the MBR code if specified (-m)    if ( write_mbr ) {      if ( result ) {	if ( syslinux_mbr_len >= PART_TABLE ) {	  fprintf(stderr, "Error: MBR will not fit; not writing\n" );	  result = FALSE;	} else {	  memcpy( sector, syslinux_mbr, syslinux_mbr_len );	}      }    }    // Check that our partition is active if specified (-a)    if ( set_active ) {      if ( sector[ PART_TABLE + ( PART_SIZE * ( partitionNum - 1 ) ) ] != 0x80 ) {	int p;	for ( p = 0; p < PART_COUNT; p++ )	  sector[ PART_TABLE + ( PART_SIZE * p ) ] = ( p == partitionNum - 1 ? 0x80 : 0 );      }    }    if ( result ) {      SetFilePointer( drive, 0, NULL, FILE_BEGIN );      if ( WriteFile( drive, sector, sizeof( sector ), &howMany, NULL ) == 0 ) {	error("Writing MBR");	result = FALSE;      } else if ( howMany != sizeof( sector ) ) {	fprintf(stderr, "Error: WriteFile on drive only wrote %d of %d bytes\n",		(int)howMany, sizeof( sector ) );	result = FALSE;      }    }    if( !CloseHandle( drive ) ) {      error("CloseFile on drive");      result = FALSE;    }  }  return( result );}/* End stuff for MBR code */const char *program;		/* Name of program */const char *drive;		/* Drive to install to *//* * Check Windows version. * * On Windows Me/98/95 you cannot open a directory, physical disk, or * volume using CreateFile. */int checkver(void){  OSVERSIONINFO osvi;  osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);  GetVersionEx(&osvi);  return  (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) &&          ((osvi.dwMajorVersion > 4) ||          ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion == 0)));}/* * Windows error function */void error(char* msg){  LPVOID lpMsgBuf;  /* Format the Windows error message */  FormatMessage(		FORMAT_MESSAGE_ALLOCATE_BUFFER |		FORMAT_MESSAGE_FROM_SYSTEM |		FORMAT_MESSAGE_IGNORE_INSERTS,		NULL, GetLastError(),		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language		(LPTSTR) &lpMsgBuf, 0, NULL );  /* Print it */  fprintf(stderr, "%s: %s", msg, (char*) lpMsgBuf);  /* Free the buffer */  LocalFree(lpMsgBuf);}/* * Wrapper for ReadFile suitable for libfat */int libfat_readfile(intptr_t pp, void *buf, size_t secsize, libfat_sector_t sector){  uint64_t offset = (uint64_t)sector * secsize;  LONG loword = (LONG)offset;  LONG hiword  = (LONG)(offset >> 32);  LONG hiwordx = hiword;  DWORD bytes_read;  if ( SetFilePointer((HANDLE)pp, loword, &hiwordx, FILE_BEGIN) != loword ||       hiword != hiwordx ||       !ReadFile((HANDLE)pp, buf, secsize, &bytes_read, NULL) ||       bytes_read != secsize ) {    fprintf(stderr, "Cannot read sector %u\n", sector);    exit(1);  }  return secsize;}noreturn usage(void){  fprintf(stderr, "Usage: syslinux.exe [-sfmar][-d directory] <drive>: [bootsecfile]\n");  exit(1);}int main(int argc, char *argv[]){  HANDLE f_handle, d_handle;  DWORD bytes_read;  DWORD bytes_written;  DWORD drives;  UINT drive_type;  static unsigned char sectbuf[512];  char **argp, *opt;  static char drive_name[] = "\\\\.\\?:";  static char drive_root[] = "?:\\";  static char ldlinux_name[] = "?:\\ldlinux.sys" ;  const char *errmsg;  struct libfat_filesystem *fs;  libfat_sector_t s, *secp, sectors[65]; /* 65 is maximum possible */  uint32_t ldlinux_cluster;  int nsectors;  const char *bootsecfile = NULL;  const char *subdir = NULL;  int force = 0;		/* -f (force) option */  int mbr = 0;			/* -m (MBR) option */  int setactive = 0;		/* -a (set partition active) */  int stupid = 0;		/* -s (stupid) option */  int raid_mode = 0;		/* -r (RAID) option */  (void)argc;  if (!checkver()) {    fprintf(stderr, "You need to be running at least Windows NT; use syslinux.com instead.\n");    exit(1);  }  program = argv[0];  drive = NULL;  for ( argp = argv+1 ; *argp ; argp++ ) {    if ( **argp == '-' ) {      opt = *argp + 1;      if ( !*opt )	usage();      while ( *opt ) {	switch ( *opt ) {	case 's':		/* Use "safe, slow and stupid" code */	  stupid = 1;	  break;	case 'r':		/* RAID mode */	  raid_mode = 1;	  break;	case 'f':		/* Force install */	  force = 1;	  break;	case 'm':		/* Install MBR */	  mbr = 1;	  break;	case 'a':		/* Mark this partition active */	  setactive = 1;	  break;	case 'd':	  if ( argp[1] )	    subdir = *++argp;	  break;	default:	  usage();	  break;	}	opt++;      }    } else {      if ( bootsecfile )	usage();      else if ( drive )	bootsecfile = *argp;      else	drive = *argp;    }  }  if ( !drive || !isalpha(drive[0]) || drive[1] != ':' || drive[2] )    usage();  /* Test if drive exists */  drives = GetLogicalDrives();  if(!(drives & ( 1 << (tolower(drive[0]) - 'a')))) {    fprintf(stderr, "No such drive %c:\n", drive[0]);    exit(1);  }  /* Determines the drive type */  drive_name[4]   = drive[0];  ldlinux_name[0] = drive[0];  drive_root[0]   = drive[0];  drive_type = GetDriveType(drive_root);  /* Test for removeable media */  if ((drive_type == DRIVE_FIXED) && (force == 0)) {    fprintf(stderr, "Not a removable drive (use -f to override) \n");    exit(1);  }  /* Test for unsupported media */  if ((drive_type != DRIVE_FIXED) && (drive_type != DRIVE_REMOVABLE)) {    fprintf(stderr, "Unsupported media\n");    exit(1);  }  /*   * First open the drive   */  d_handle = CreateFile(drive_name, GENERIC_READ | GENERIC_WRITE,			 FILE_SHARE_READ | FILE_SHARE_WRITE,			 NULL, OPEN_EXISTING, 0, NULL );  if (d_handle == INVALID_HANDLE_VALUE) {    error("Could not open drive");    exit(1);  }  /*   * Make sure we can read the boot sector   */  if ( !ReadFile(d_handle, sectbuf, 512, &bytes_read, NULL) ) {    error("Reading boot sector");    exit(1);  }  if (bytes_read != 512) {    fprintf(stderr, "Could not read the whole boot sector\n");    exit(1);  }  /* Check to see that what we got was indeed an MS-DOS boot sector/superblock */  if( (errmsg = syslinux_check_bootsect(sectbuf)) ) {    fprintf(stderr, "%s\n", errmsg);    exit(1);  }  /* Change to normal attributes to enable deletion */  /* Just ignore error if the file do not exists */  SetFileAttributes(ldlinux_name, FILE_ATTRIBUTE_NORMAL);  /* Delete the file */  /* Just ignore error if the file do not exists */  DeleteFile(ldlinux_name);  /* Create ldlinux.sys file */  f_handle = CreateFile(ldlinux_name, GENERIC_READ | GENERIC_WRITE,			FILE_SHARE_READ | FILE_SHARE_WRITE,			NULL, CREATE_ALWAYS,			FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM |			FILE_ATTRIBUTE_HIDDEN,			NULL );  if (f_handle == INVALID_HANDLE_VALUE) {    error("Unable to create ldlinux.sys");    exit(1);  }  /* Write ldlinux.sys file */  if (!WriteFile(f_handle, syslinux_ldlinux, syslinux_ldlinux_len, &bytes_written, NULL)) {    error("Could not write ldlinux.sys");    exit(1);  }  if (bytes_written != syslinux_ldlinux_len) {    fprintf(stderr, "Could not write whole ldlinux.sys\n");    exit(1);  }  /* Now flush the media */  if(!FlushFileBuffers(f_handle)) {    error("FlushFileBuffers failed");    exit(1);  }  /* Map the file (is there a better way to do this?) */  fs = libfat_open(libfat_readfile, (intptr_t)d_handle);  ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL);  secp = sectors;  nsectors = 0;  s = libfat_clustertosector(fs, ldlinux_cluster);  while ( s && nsectors < 65 ) {    *secp++ = s;    nsectors++;    s = libfat_nextsector(fs, s);  }  libfat_close(fs);  /*   * Patch ldlinux.sys and the boot sector   */  syslinux_patch(sectors, nsectors, stupid, raid_mode);  /*   * Rewrite the file   */  if ( SetFilePointer(f_handle, 0, NULL, FILE_BEGIN) != 0 ||       !WriteFile(f_handle, syslinux_ldlinux, syslinux_ldlinux_len, &bytes_written, NULL) ||       bytes_written != syslinux_ldlinux_len ) {    error("Could not write ldlinux.sys");    exit(1);  }  /* If desired, fix the MBR */  if( mbr || setactive ) {    STORAGE_DEVICE_NUMBER sdn;    if( GetStorageDeviceNumberByHandle( d_handle, &sdn ) ) {      if( !FixMBR(sdn.DeviceNumber, sdn.PartitionNumber, mbr, setactive) ) {        fprintf(stderr, "Did not successfully update the MBR; continuing...\n");      }    } else {      fprintf(stderr, "Could not find device number for updating MBR; continuing...\n");    }  }  /* Close file */  CloseHandle(f_handle);  /* Move the file to the desired location */  if (subdir) {    char new_ldlinux_name[strlen(subdir)+16];    char *cp = new_ldlinux_name+3;    const char *sd;    int slash = 1;    new_ldlinux_name[0] = drive[0];    new_ldlinux_name[1] = ':';    new_ldlinux_name[2] = '\\';    for (sd = subdir; *sd; sd++) {      char c = *sd;      if (c == '/' || c == '\\') {	if (slash)	  continue;	c = '\\';	slash = 1;      } else {	slash = 0;      }      *cp++ = c;    }    /* Skip if subdirectory == root */    if (cp > new_ldlinux_name+3) {      if (!slash)	*cp++ = '\\';      memcpy(cp, "ldlinux.sys", 12);      /* Delete any previous file */      SetFileAttributes(new_ldlinux_name, FILE_ATTRIBUTE_NORMAL);      DeleteFile(new_ldlinux_name);      if (!MoveFile(ldlinux_name, new_ldlinux_name))	SetFileAttributes(ldlinux_name, FILE_ATTRIBUTE_READONLY |			  FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);      else	SetFileAttributes(new_ldlinux_name, FILE_ATTRIBUTE_READONLY |			  FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);    }  }  /* Make the syslinux boot sector */  syslinux_make_bootsect(sectbuf);  /* Write the syslinux boot sector into the boot sector */  if ( bootsecfile ) {    f_handle = CreateFile(bootsecfile, GENERIC_READ | GENERIC_WRITE,			  FILE_SHARE_READ | FILE_SHARE_WRITE,			  NULL, CREATE_ALWAYS,			  FILE_ATTRIBUTE_ARCHIVE,			  NULL );    if (f_handle == INVALID_HANDLE_VALUE) {      error("Unable to create bootsector file");      exit(1);    }    if (!WriteFile(f_handle, sectbuf, 512, &bytes_written, NULL)) {      error("Could not write boot sector file");      exit(1);    }    CloseHandle(f_handle);  } else {    SetFilePointer(d_handle, 0, NULL, FILE_BEGIN);    WriteFile( d_handle, sectbuf, 512, &bytes_written, NULL ) ;  }  if(bytes_written != 512) {    fprintf(stderr, "Could not write the whole boot sector\n");    exit(1);  }  /* Close file */  CloseHandle(d_handle);  /* Done! */  return 0;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产三级三级三级精品8ⅰ区| 五月婷婷综合网| 亚洲午夜免费视频| 国产一区二区三区在线观看精品| 色婷婷亚洲一区二区三区| 精品久久人人做人人爱| 亚洲男女毛片无遮挡| 国产美女精品一区二区三区| 欧美日韩视频在线第一区| 中文子幕无线码一区tr| 久久精品久久久精品美女| 色欧美88888久久久久久影院| 日韩欧美成人午夜| 视频一区视频二区在线观看| 91麻豆高清视频| 国产欧美精品日韩区二区麻豆天美| 丝袜国产日韩另类美女| 91网页版在线| 国产精品动漫网站| 国产suv精品一区二区三区| 亚洲精品一区二区三区蜜桃下载 | 麻豆精品一区二区三区| 在线日韩一区二区| 亚洲一区中文日韩| 在线视频你懂得一区二区三区| 欧美国产日韩在线观看| 成人性视频免费网站| 国产欧美va欧美不卡在线| 国产美女视频一区| 欧美国产激情二区三区| 国产超碰在线一区| 中文字幕精品三区| 99久久精品免费看国产免费软件| 久久久精品欧美丰满| 国产精品1区二区.| 欧美国产精品专区| 成人动漫一区二区| 亚洲欧美国产高清| 欧洲一区在线观看| 无码av免费一区二区三区试看| 欧亚一区二区三区| 日韩 欧美一区二区三区| 91精品国产色综合久久久蜜香臀| 丝袜诱惑亚洲看片| 日韩精品影音先锋| 国产一二精品视频| 中文字幕一区在线观看视频| aaa国产一区| 亚洲成人av电影| 日韩欧美久久一区| 国产成人自拍在线| 一区二区三区精品视频| 欧美精品亚洲一区二区在线播放| 六月婷婷色综合| 国产精品视频看| 欧美午夜精品一区| 极品少妇一区二区三区精品视频| 久久精品亚洲乱码伦伦中文 | 国产精品视频观看| 在线观看日韩一区| 久久99精品国产麻豆不卡| 久久久亚洲精品石原莉奈| 91在线观看免费视频| 日韩影院在线观看| 久久精品网站免费观看| 欧日韩精品视频| 国产一区二区在线看| 一级做a爱片久久| 日韩精品一区二区三区在线播放 | 国内精品伊人久久久久影院对白| 国产亚洲精品aa| 欧美日免费三级在线| 国产一区视频网站| 亚洲一区二区三区小说| 久久精品夜夜夜夜久久| 欧美伊人精品成人久久综合97| 韩国精品在线观看| 午夜精品久久久| 综合精品久久久| 欧美精品一区二区久久久| 色视频成人在线观看免| 国产一区二区日韩精品| 亚洲1区2区3区视频| 中文字幕国产一区| 日韩欧美成人午夜| 欧美久久一二区| 色先锋资源久久综合| 国产一区在线视频| 日本最新不卡在线| 亚洲最大色网站| 中文字幕精品一区二区精品绿巨人 | 一区二区中文视频| 精品日韩99亚洲| 欧美日韩国产精品自在自线| 91在线精品一区二区三区| 精品一区二区三区免费毛片爱| 亚洲最快最全在线视频| 亚洲欧洲综合另类在线| 中文字幕国产一区| 国产亚洲精久久久久久| 日韩欧美国产麻豆| 69久久夜色精品国产69蝌蚪网| 91丨porny丨最新| 粉嫩aⅴ一区二区三区四区五区| 美女尤物国产一区| 日本亚洲最大的色成网站www| 亚洲成人综合在线| 亚洲午夜一区二区| 性做久久久久久免费观看欧美| 一区二区三区中文免费| 亚洲免费观看在线视频| 亚洲日本va在线观看| 美日韩一级片在线观看| 亚洲成人av在线电影| 丝瓜av网站精品一区二区| 偷拍日韩校园综合在线| 婷婷丁香久久五月婷婷| 婷婷成人激情在线网| 亚洲h动漫在线| 日韩精品久久理论片| 免费人成精品欧美精品| 美女视频网站久久| 黄色成人免费在线| 国产91丝袜在线18| 91视视频在线观看入口直接观看www | 毛片一区二区三区| 美国毛片一区二区三区| 国产尤物一区二区在线| 成人午夜在线播放| 色综合久久66| 欧美日韩第一区日日骚| 欧美v国产在线一区二区三区| 久久尤物电影视频在线观看| 中文幕一区二区三区久久蜜桃| 国产精品免费aⅴ片在线观看| 亚洲欧洲综合另类在线 | 国产精品另类一区| 亚洲欧美偷拍另类a∨色屁股| 亚洲黄色小视频| 日韩精品一二三| 粉嫩欧美一区二区三区高清影视 | 免费视频一区二区| 国产精品主播直播| 色综合网色综合| 678五月天丁香亚洲综合网| 久久先锋影音av| 亚洲乱码国产乱码精品精可以看| 亚洲午夜免费福利视频| 精久久久久久久久久久| 色呦呦日韩精品| 精品国产3级a| 亚洲欧美一区二区三区国产精品 | 精品伦理精品一区| 国产精品久久久久aaaa| 日韩国产欧美三级| 成人sese在线| 91精品国产高清一区二区三区| 久久色中文字幕| 亚洲国产欧美在线人成| 国产麻豆成人精品| 欧美精品在线观看一区二区| 国产欧美久久久精品影院| 午夜精品一区二区三区电影天堂 | 中文字幕在线不卡一区二区三区| 午夜久久久影院| 成人高清伦理免费影院在线观看| 欧美二区三区91| 亚洲三级小视频| 国产精品一区二区视频| 欧美视频自拍偷拍| 国产精品久久久久aaaa樱花| 蜜臀精品一区二区三区在线观看| 99精品国产视频| 国产亚洲欧美色| 另类成人小视频在线| 欧美丰满高潮xxxx喷水动漫| 国产精品成人一区二区艾草 | 美女免费视频一区| 欧美在线视频日韩| 成人欧美一区二区三区黑人麻豆| 九色porny丨国产精品| 欧美视频在线不卡| 亚洲欧美偷拍卡通变态| 成人午夜在线免费| 国产亚洲精品7777| 国产美女主播视频一区| 精品久久久久一区二区国产| 亚洲一区二区三区在线看| 91色.com| 亚洲日本丝袜连裤袜办公室| 不卡的电影网站| 国产精品久久久久久福利一牛影视| 国产一区二区在线影院| 久久日韩精品一区二区五区| 免费人成精品欧美精品| 精品人在线二区三区| 极品销魂美女一区二区三区| 精品国精品国产尤物美女| 国产一区二区三区免费观看| 亚洲精品一区二区三区香蕉 |