#include <stdio.h>
#include <conio.h>
#include <string.h>
#include "bootmgr.h"
#include "common.h"
#include "selemenu.h"
#include "global.h"
#include "keymap.h"
sword Fdisk (PARTN *partnArr)
{
#if ( DISPLAY == CHINESE )
#define PROMPT_MSG "[Esc]:币笆恨瞶匡虫 [TAB]:\匡虫 [][] ?矪瞶だ澄"
#define IS_QUIT_MSG "琌 璶 瞒 秨 だ 澄 祘 Α "
#else
#define PROMPT_MSG "[Esc]:Quit, [TAB]:Menu, [][] ?Process partition"
#define IS_QUIT_MSG "Are you sure to quit ?"
#endif
extern SeleMenu g_Menu;
sword lastkey, sele, err;
g_Info.fd.use_fat32 = TRUE; /** 砞)琌や穿 FAT 32 **/
g_Info.fd.modified = 0; /** 竚笆篨腹 **/
err = Chg_Work_Disk(partnArr); /** 匡拒祑盒 **/
if ( err & 0x40 )
return(0); /** 斌秈だ澄ㄣ **/
else if ( err & 0x80 )
return(-1); /** 祇ネ祑砰岿粇 **/
sele = 1;
do
{
ShowMSG(PROMPT_MSG);
Redraw_Fdisk_Picture(TRUE);
/*===============================================================*/
/* だ澄ず甧匡虫 General_sele 兵ンㄧΑ PartnMnu.C ず */
/*===============================================================*/
sele = Sele_Partn(partnArr, 0, 0, General_sele);
lastkey = g_Menu.lastKey(); /** 眔程龄 **/
if ( sele > 0 )
Fdisk_Menu(partnArr, sele); /** だ澄矪瞶匡虫, in fd_menu.c **/
else if ( sele < 0 )
{
if ( lastkey == TAB_KEY ) /** Tab 匡虫, in fd_menu.c **/
Fdisk_Tab_Menu(partnArr);
else if ( lastkey == ESC_KEY ) /** 瞒秨だ澄祘Α **/
if ( g_Info.fd.modified )
{
err = Prompt_Save_Partn(partnArr); /** 琌纗 **/
if ( err && !YN_box(TALK_BOX, IS_QUIT_MSG) )
lastkey = ENTER_KEY; /** 瞒秨 **/
} /* end if */
} /* end if */
} while ( lastkey != ESC_KEY );
return(0);
} /* end Fdisk */
/*============================= Reset FDisk =================================*/
void Init_Fdisk (void)
{
g_Info.fd.ext_head = -1;
g_Info.fd.ext_end = -1;
g_Info.fd.modified = 0;
g_Info.fd.maxParNO = 0;
g_Info.fd.used = 0;
g_Info.fd.pri_use = 0;
g_Info.fd.primary = 0;
/* g_Info.fd.use_fat32 = 0; */
g_Info.fd.logic_exist = FALSE;
g_Info.fd.canSaveFlag = TRUE;
g_Info.fd.clr_screen = TRUE;
} /* end Init_Fdisk */
/*============================= Reset FDisk =================================*/
void Reset_Fdisk (void)
{
Init_Fdisk();
} /* end Reset_Fdisk */
/*=========================== ﹍ PARTN じ =============================*/
void Init_Partn_Elem (PARTN *ptr) /* ptr 饼竚だ澄じ */
{
memset(ptr, 0, sizeof(PARTN)); /** 竚ず甧 **/
ptr->sector = 1; /** 币﹍合跋 **/
} /* end Init_Partn_Elem */
/*============================ 砞 ) 笆 だ 澄 ============================*/
void Set_Active_Partn (PARTN *partnArr, PARTN *ptr, sword bToggle)
{
sword i;
if ( ptr->active != 0x80 )
{
ptr->active = 0x80;
for ( i = 0 ; i < g_Info.fd.pri_use ; i++ )
if ( &partnArr[i] != ptr )
partnArr[i].active = 0;
}
else if ( bToggle )
ptr->active = 0;
else
return;
if ( g_Info.fd.modified == 0 )
g_Info.fd.modified = -2;
#include <conio.h>
#include <string.h>
#include "bootmgr.h"
#include "common.h"
#include "selemenu.h"
#include "global.h"
#include "keymap.h"
sword Fdisk (PARTN *partnArr)
{
#if ( DISPLAY == CHINESE )
#define PROMPT_MSG "[Esc]:币笆恨瞶匡虫 [TAB]:\匡虫 [][] ?矪瞶だ澄"
#define IS_QUIT_MSG "琌 璶 瞒 秨 だ 澄 祘 Α "
#else
#define PROMPT_MSG "[Esc]:Quit, [TAB]:Menu, [][] ?Process partition"
#define IS_QUIT_MSG "Are you sure to quit ?"
#endif
extern SeleMenu g_Menu;
sword lastkey, sele, err;
g_Info.fd.use_fat32 = TRUE; /** 砞)琌や穿 FAT 32 **/
g_Info.fd.modified = 0; /** 竚笆篨腹 **/
err = Chg_Work_Disk(partnArr); /** 匡拒祑盒 **/
if ( err & 0x40 )
return(0); /** 斌秈だ澄ㄣ **/
else if ( err & 0x80 )
return(-1); /** 祇ネ祑砰岿粇 **/
sele = 1;
do
{
ShowMSG(PROMPT_MSG);
Redraw_Fdisk_Picture(TRUE);
/*===============================================================*/
/* だ澄ず甧匡虫 General_sele 兵ンㄧΑ PartnMnu.C ず */
/*===============================================================*/
sele = Sele_Partn(partnArr, 0, 0, General_sele);
lastkey = g_Menu.lastKey(); /** 眔程龄 **/
if ( sele > 0 )
Fdisk_Menu(partnArr, sele); /** だ澄矪瞶匡虫, in fd_menu.c **/
else if ( sele < 0 )
{
if ( lastkey == TAB_KEY ) /** Tab 匡虫, in fd_menu.c **/
Fdisk_Tab_Menu(partnArr);
else if ( lastkey == ESC_KEY ) /** 瞒秨だ澄祘Α **/
if ( g_Info.fd.modified )
{
err = Prompt_Save_Partn(partnArr); /** 琌纗 **/
if ( err && !YN_box(TALK_BOX, IS_QUIT_MSG) )
lastkey = ENTER_KEY; /** 瞒秨 **/
} /* end if */
} /* end if */
} while ( lastkey != ESC_KEY );
return(0);
} /* end Fdisk */
/*============================= Reset FDisk =================================*/
void Init_Fdisk (void)
{
g_Info.fd.ext_head = -1;
g_Info.fd.ext_end = -1;
g_Info.fd.modified = 0;
g_Info.fd.maxParNO = 0;
g_Info.fd.used = 0;
g_Info.fd.pri_use = 0;
g_Info.fd.primary = 0;
/* g_Info.fd.use_fat32 = 0; */
g_Info.fd.logic_exist = FALSE;
g_Info.fd.canSaveFlag = TRUE;
g_Info.fd.clr_screen = TRUE;
} /* end Init_Fdisk */
/*============================= Reset FDisk =================================*/
void Reset_Fdisk (void)
{
Init_Fdisk();
} /* end Reset_Fdisk */
/*=========================== ﹍ PARTN じ =============================*/
void Init_Partn_Elem (PARTN *ptr) /* ptr 饼竚だ澄じ */
{
memset(ptr, 0, sizeof(PARTN)); /** 竚ず甧 **/
ptr->sector = 1; /** 币﹍合跋 **/
} /* end Init_Partn_Elem */
/*============================ 砞 ) 笆 だ 澄 ============================*/
void Set_Active_Partn (PARTN *partnArr, PARTN *ptr, sword bToggle)
{
sword i;
if ( ptr->active != 0x80 )
{
ptr->active = 0x80;
for ( i = 0 ; i < g_Info.fd.pri_use ; i++ )
if ( &partnArr[i] != ptr )
partnArr[i].active = 0;
}
else if ( bToggle )
ptr->active = 0;
else
return;
if ( g_Info.fd.modified == 0 )
g_Info.fd.modified = -2;