LOCAL_C void testInfo() // // Test the HAL info. // { test.Next(_L("Test UserHal::MemoryInfo")); TInt pageSize=0; UserHal::PageSizeInBytes(pageSize); TMemoryInfoV1Buf membuf; UserHal::MemoryInfo(membuf); TMemoryInfoV1& memoryInfo=*(TMemoryInfoV1*)membuf.Ptr(); test.Printf(_L("Allocate some memory & check RAM goes down")); #if !defined(__WINS__) TInt freeMem=memoryInfo.iFreeRamInBytes; #endif TInt8* someMem = new TInt8[0x4000]; // make an access to each page in order to get pages actually allocated also on data paged systems someMem[0]=1; someMem[0x1000]=2; someMem[0x2000]=3; someMem[0x3000]=4; UserHal::MemoryInfo(membuf); delete someMem; #if !defined(__WINS__) if (!(freeMem>memoryInfo.iFreeRamInBytes)) test.Printf(_L("Warning: free RAM value didn't go down")); #endif test.Printf(_L("Total RAM size= %- 5dKBytes : Free RAM size = %- 5dKBytes\n"),memoryInfo.iTotalRamInBytes/1024,memoryInfo.iFreeRamInBytes/1024); test.Printf(_L("Max free RAM = %- 5dKBytes : ROM size = %- 5dKBytes\n"),memoryInfo.iMaxFreeRamInBytes/1024,memoryInfo.iTotalRomInBytes/1024); test.Printf(_L("RAM disk size = %- 5dKBytes\n"),memoryInfo.iInternalDiskRamInBytes/1024); test.Next(_L("Test UserHal::MachineInfo")); TMachineInfoV2Buf mbuf; UserHal::MachineInfo(mbuf); TMachineInfoV2& machineInfo=*(TMachineInfoV2*)mbuf.Ptr(); TName tn = machineInfo.iRomVersion.Name(); test.Printf(_L("Page Size = %- 16d : Rom version = %- 16S\n"),pageSize,&tn); test.Printf(_L("ScreenOffsetX = %- 16d : ScreenOffsetY = %- 16d\n"),machineInfo.iOffsetToDisplayInPixels.iX,machineInfo.iOffsetToDisplayInPixels.iY); TBool password=EFalse; // Password::IsEnabled(); This API was removed by __SECURE_API__ TPtrC t1=onOff(password); TPtrC t2=yesNo(machineInfo.iBacklightPresent); test.Printf(_L("Password = %- 16S : BacklightPresent= %S\n"),&t1,&t2); test.Printf(_L("LanguageIndex = %- 16d : KeyboardIndex = %d\n"),machineInfo.iLanguageIndex,machineInfo.iKeyboardIndex); test.Next(_L("Test deprecated UserHal::RomInfo API")); TRomInfoV1Buf rombuf; test(UserHal::RomInfo(rombuf)==KErrNotSupported); // kernel side API has been deprecated }
void inPhieu(char *dir,char* trangThai){ // Chuong trinh in phieu nhay theo tung 500 ms FILE *fp; khachHang temp; fp = fopen(dir,"rb"); fread(&temp,sizeof(temp),1,fp); fclose(fp); printf(" Ban Co Muon In Phieu? (Y/N)\n"); if (yesNo() == 1){ printf("\n ..Dang In."); animation(); printf("\n ..Xong........\n\n\n"); printInfo(temp,0,trangThai); } else return; }
int createAcc(){ // ham tao tai khoan FILE *fp; char dir[30]; khachHang khach,temp; int stt; makeDir(dir,stt=readnum("CSDL.txt",1)); // tao ten duong dan (ten file) VD : acc1.dat, acc2.dat .... makesoTk(khach.soTk,readnum("CSDL.txt",0) - 1); //tao so tai khoan voi dinh dang 2221995xxxxx khach.soDu= 50000; Menu: printf("\n==================Tao Tai Khoan ATM==================\n"); printf("\n Nhap Ho Ten : "); fflush(stdin); gets(khach.tenTk); printf("\n Nhap Ma PIN : "); while(1){ getpin(khach.pin,7); if(strlen(khach.pin) < 6){ printf("\n Khong Du 6 Chu So. Nhan Phim Bat Ky De Nhap Lai Ma PIN\n"); getch(); system("cls"); printf("\n==================Tao Tai Khoan ATM==================\n"); printf("\n Nhap Ho Ten : %s\n",khach.tenTk); printf("\n Nhap Ma PIN : "); } else{ break; } } strcpy(khach.time,getTime()); khach.active = 0; printf("\n\n"); strcpy(khach.trangThai,"Tao Tai Khoan"); printInfo(khach,1,khach.trangThai); printf("\n Dong Y Tao Tai Khoan ? (Y/N)\n"); if(yesNo()==1) goto TaoTk; else{ system("cls"); goto Menu; } TaoTk: fp=fopen(dir,"wb"); fwrite(&khach,sizeof(khach),1,fp); fclose(fp); printf("\n Tao Tai Khoan Thanh Cong\n"); getch(); return stt; //tra ve so thu tu cua file vd: acc1.dat thi stt = 1 }
int main(int argc, char ** argv) { double startTime = 0; // Parse command line. SakOptions options; seqan::ArgumentParser::ParseResult res = parseArgs(options, argc, argv); if (res != seqan::ArgumentParser::PARSE_OK) return res == seqan::ArgumentParser::PARSE_ERROR; // 1 on errors, 0 otherwise // ----------------------------------------------------------------------- // Show options. // ----------------------------------------------------------------------- if (options.verbosity >= 2) { std::cerr << "____OPTIONS___________________________________________________________________\n" << "\n" << "VERBOSITY " << options.verbosity << "\n" << "IN " << options.inFastxPath << "\n" << "OUT " << options.outPath << "\n" << "INFIX BEGIN " << options.seqInfixBegin << "\n" << "INFIX END " << options.seqInfixEnd << "\n" << "MAX LEN " << options.maxLength << "\n" << "READ PATTERN " << options.readPattern << "\n" << "REVCOMP " << yesNo(options.reverseComplement) << "\n" << "SEQUENCES\n"; for (unsigned i = 0; i < length(options.seqIndices); ++i) std::cerr << " SEQ " << options.seqIndices[i] << "\n"; for (unsigned i = 0; i < length(options.seqIndexRanges); ++i) std::cerr << " SEQS " << options.seqIndexRanges[i].i1 << "-" << options.seqIndexRanges[i].i2 << "\n"; } // ----------------------------------------------------------------------- // Open Files. // ----------------------------------------------------------------------- seqan::SeqFileIn inFile; seqan::SeqFileOut outFile; bool openRes = false; if (!empty(options.inFastxPath)) openRes = open(inFile, toCString(options.inFastxPath)); else openRes = open(inFile, std::cin); if (!openRes) { std::cerr << "ERROR: Problem opening input file.\n"; return 1; } if (!empty(options.outPath)) openRes = open(outFile, toCString(options.outPath)); else openRes = open(outFile, std::cout, seqan::Fastq()); if (!openRes) { std::cerr << "ERROR: Problem opening output file.\n"; return 1; } // Compute index of last sequence to write if any. uint64_t endIdx = seqan::maxValue<uint64_t>(); for (unsigned i = 0; i < length(options.seqIndices); ++i) if (endIdx == seqan::maxValue<uint64_t>() || endIdx > options.seqIndices[i] + 1) endIdx = options.seqIndices[i] + 1; for (unsigned i = 0; i < length(options.seqIndexRanges); ++i) if (endIdx == seqan::maxValue<uint64_t>() || endIdx > options.seqIndexRanges[i].i2) endIdx = options.seqIndexRanges[i].i2; if (options.verbosity >= 2) std::cerr << "Sequence end idx: " << endIdx << "\n"; // ----------------------------------------------------------------------- // Read and Write Filtered. // ----------------------------------------------------------------------- startTime = seqan::sysTime(); unsigned idx = 0; uint64_t charsWritten = 0; seqan::CharString id; seqan::CharString seq; seqan::CharString quals; while (!atEnd(inFile) && charsWritten < options.maxLength && idx < endIdx) { try { readRecord(id, seq, quals, inFile); } catch (seqan::ParseError const & e) { std::cerr << "ERROR: Problem reading file: " << e.what() << "\n"; return 1; } // Check whether to write out sequence. bool writeOut = false; if (empty(options.seqIndices) && empty(options.seqIndexRanges)) writeOut = true; // One of options.seqIndices. if (!writeOut) { for (unsigned i = 0; i < length(options.seqIndices); ++i) { if (options.seqIndices[i] == idx) { writeOut = true; break; } } } // One of options.seqIndexRanges. if (!writeOut) { for (unsigned i = 0; i < length(options.seqIndexRanges); ++i) { if (idx >= options.seqIndexRanges[i].i1 && idx < options.seqIndexRanges[i].i2) { writeOut = true; break; } } } // Name pattern matches. if (!writeOut && !empty(options.readPattern)) { unsigned l = length(options.readPattern); if (l > length(id)) l = length(id); if (prefix(id, l) == prefix(options.readPattern, l)) writeOut = true; } // Write out if we want this. if (writeOut) { // Get begin and end index of infix to write out. uint64_t infixBegin = 0; if (options.seqInfixBegin != seqan::maxValue<uint64_t>()) infixBegin = options.seqInfixBegin; if (infixBegin > length(seq)) infixBegin = length(seq); uint64_t infixEnd = length(seq); if (options.seqInfixEnd < length(seq)) infixEnd = options.seqInfixEnd; if (infixEnd < infixBegin) infixEnd = infixBegin; if (options.verbosity >= 3) std::cerr << "INFIX\tbegin:" << infixBegin << "\tend:" << infixEnd << "\n"; if (options.reverseComplement) { seqan::Dna5String seqCopy = seq; reverseComplement(seqCopy); reverse(quals); infixEnd = length(seq) - infixEnd; infixBegin = length(seq) - infixBegin; std::swap(infixEnd, infixBegin); writeRecord(outFile, id, infix(seqCopy, infixBegin, infixEnd), infix(quals, infixBegin, infixEnd)); } else writeRecord(outFile, id, infix(seq, infixBegin, infixEnd), infix(quals, infixBegin, infixEnd)); } // Advance counter idx. idx += 1; } if (options.verbosity >= 2) std::cerr << "Took " << (seqan::sysTime() - startTime) << " s\n"; return 0; }
int napTien(){ int num; FILE *fp; char dir[30]; khachHang khach; unsigned int tien; Nhap: system("cls"); printf("\n====================Nap Tien====================\n"); printf("\n #Nhap Ma So The : "); scanf("%d",&num); makeDir(dir,num); if((fp=fopen(dir,"rb")) == NULL){ fclose(fp); int choice; do{ printf("\n Account Nay Khong Ton Tai\n"); printf("\n ---1.Nhap Ma So The Khac\n"); printf("\n ---2.Tro Ve Menu\n"); printf("\n #Chon : "); fflush(stdin); scanf("%d",&choice); switch (choice){ case 1 : system("cls"); goto Nhap; break; case 2 : return 0; default : system("cls"); printf("\n====================Nap Tien====================\n"); printf("\n #Nhap Ma So The : %d\n",num); break; } }while(choice > 2 || choice < 1 ); } else{ fread(&khach,sizeof(khach),1,fp); fclose(fp); if(khach.active == 2){ printf("\n Tai Khoan Dang Bi Khoa\n"); printf("\n Xin Hay Mo Khoa Account Truoc Khi Nap"); printf("\n Nhan Phim Bat Ky De Quay Ve Menu\n"); getch(); return 0; } while(1){ printf("\n Nhap So Tien Muon Nap (Toi Thieu 50000) : "); scanf("%d",&tien); if(tien < 50000){ // nap it nhat 50000 printf("\n So Tien Ban Muon Nap Qua It. Ban Co Muon Nhap Lai So Tien Muon Nap (Y/N)\n"); if(yesNo() == 1){ system("cls"); printf("\n====================Nap Tien====================\n"); printf("\n #Nhap Ma So The : %d\n",num); continue; } else{ return 0; } } else{ printf("\n Ban Co Muon Nap So Tien Nay (Y/N)\n"); if(yesNo() == 1){ khach.soDu += tien; strcpy(khach.time,getTime()); khach.active = 1; strcpy(khach.trangThai,"Active"); printf("\n ...Dang Thuc Hien Nap Tien."); fp = fopen(dir,"wb"); fwrite(&khach,sizeof(khach),1,fp); fclose(fp); animation(); printf("\n ...Xong........................\n"); printf("\n So Du Trong Tai Khoan Cua Ban : %d\n",khach.soDu); sprintf(khach.trangThai,"Da Nap %dVND",tien); fp = fopen(dir,"wb"); fwrite(&khach,sizeof(khach),1,fp); fclose(fp); printLog(dir,khach); getch(); break; } else{ system("cls"); printf("\n====================Nap Tien====================\n"); printf("\n #Nhap Ma So The : %d\n",num); continue; } } } } }
int active(){ int num; FILE *fp; char dir[30]; khachHang khach; Nhap: system("cls"); printf("\n====================Active Account====================\n"); printf("\n #Nhap Ma So The : "); scanf("%d",&num); makeDir(dir,num); if((fp=fopen(dir,"rb")) == NULL){ fclose(fp); int choice; do{ printf("\n Account Nay Khong Ton Tai. Ban Muon\n"); printf("\n ---1.Nhap Ma So The Khac\n"); printf("\n ---2.Tro Ve Menu\n"); printf("\n #Chon : "); fflush(stdin); scanf("%d",&choice); switch (choice){ case 1 : system("cls"); goto Nhap; break; case 2 : return 0; default : system("cls"); printf("\n====================Active Account====================\n"); printf("\n #Nhap Ma So The : %d\n",num); break; } }while(choice > 2 || choice < 1 ); } else{ fread(&khach,sizeof(khach),1,fp); fclose(fp); if(khach.active == 1){ printf("\n Tai Khoan Da Duoc Active Roi\n"); printf("\n Nhan Phim Bat Ky De Quay Ve Menu\n"); getch(); return 0; } printf("\n\n"); printInfo(khach,0,"Non Actived Account"); printf("\n Dong Y Active Tai Khoan Nay (Y/N)\n"); if(yesNo() == 1){ khach.active = 1; strcpy(khach.time,getTime()); strcpy(khach.trangThai,"Active"); fp = fopen(dir,"wb"); fwrite(&khach,sizeof(khach),1,fp); fclose(fp); printLog(dir,khach); return 1; } else{ system("cls"); goto Nhap; } } }
void editAcc(){ int num; FILE *fp; char dir[30]; khachHang khach; Nhap: system("cls"); printf("\n==================Sua Tai Khoan ATM==================\n"); printf("\n #Nhap Ma So The : "); scanf("%d",&num); makeDir(dir,num); if((fp=fopen(dir,"rb")) == NULL){ fclose(fp); int choice; do{ printf("\n Account Nay Khong Ton Tai. Ban Muon\n"); printf("\n ---1.Nhap Ma So The Khac\n"); printf("\n ---2.Tro Ve Menu\n"); printf("\n #Chon : "); fflush(stdin); scanf("%d",&choice); switch (choice){ case 1 : system("cls"); goto Nhap; break; case 2 : return; default : system("cls"); printf("\n==================Sua Tai Khoan ATM==================\n"); printf("\n #Nhap Ma So The : %d\n",num); break; } }while(choice > 2 || choice < 1 ); } else{ fread(&khach,sizeof(khach),1,fp); fclose(fp); Menu: printf("\n Nhap Ho Ten : "); fflush(stdin); gets(khach.tenTk); printf("\n Nhap Ma PIN : "); while(1){ getpin(khach.pin,7); if(strlen(khach.pin) < 6){ printf("\n Khong Du 6 Chu So. Nhan Phim Bat Ky De Nhap Lai Ma PIN\n"); getch(); system("cls"); printf("\n==================Sua Tai Khoan ATM==================\n"); printf("\n #Nhap Ma So The : %d\n",num); printf("\n Nhap Ho Ten : %s\n",khach.tenTk); printf("\n Nhap Ma PIN : "); } else{ break; } } printf("\n Nhap So Du : "); scanf("%d",&khach.soDu); strcpy(khach.time,getTime()); printf("\n\n"); printInfo(khach,1,"Sua Tai Khoan"); printf("\n Dong Y Sua Tai Khoan ? (Y/N)\n"); if(yesNo()==1) goto SuaTk; else{ system("cls"); printf("\n==================Sua Tai Khoan ATM==================\n"); printf("\n #Nhap Ma So The : %d\n",num); goto Menu; } SuaTk: fp=fopen(dir,"wb"); fwrite(&khach,sizeof(khach),1,fp); fclose(fp); printf("\n Sua Tai Khoan Thanh Cong\n"); getch(); system("cls"); return ; } }
void menuGuest(char *dir){ FILE *fp; khachHang temp; fp = fopen(dir,"rb"); fread(&temp,sizeof(temp),1,fp); // doc cac thong tin can thiet tu file fclose(fp); int choice; // bien lua chon switch case do{ printf("\n======================================"); printf("\n| Xin Chao %-20s |",temp.tenTk); printf("\n| |"); printf("\n| ---1.Kiem Tra So Du Tai Khoan |"); printf("\n| |"); printf("\n| ---2.Rut Tien |"); printf("\n| |"); printf("\n| ---3.Chuyen Khoan |"); printf("\n| |"); printf("\n| ---4.Doi Ma Pin |"); printf("\n| |"); printf("\n| ---5.Xem Lich Su Giao Dich |"); printf("\n| |"); printf("\n| ---6.Thoat |"); printf("\n| |"); printf("\n======================================\n"); printf("\n#Chon : "); fflush(stdin); scanf("%d",&choice); switch (choice){ case 1 : system("cls"); kttk(dir); printf("\n Ban Co Muon Thuc Hien Tiep Giao Dich (Y/N) \n"); if(yesNo() == 1){ system("cls"); choice = 0; // de quay ve menu, thoa dieu kien vong lap continue; } else{ printf("\n Xin Chao Va Hen Gap Lai\n"); getch(); exit(0); //thoat chuong trinh break; } case 2 : system("cls"); rutTien(dir); printf("\n Ban Co Muon Thuc Hien Tiep Giao Dich (Y/N) \n"); if(yesNo() == 1){ system("cls"); choice = 0; // de quay ve menu continue; } else{ printf("\n Xin Chao Va Hen Gap Lai\n"); getch(); exit(0); //thoat chuong trinh break; } case 3 : system("cls"); chuyenKhoan(dir); printf("\n Ban Co Muon Thuc Hien Tiep Giao Dich (Y/N) \n"); if(yesNo() == 1){ system("cls"); choice = 0; // de quay ve menu continue; } else{ printf("\n Xin Chao Va Hen Gap Lai\n"); getch(); exit(0); //thoat chuong trinh break; } case 4 : system("cls"); doiMaPin(dir); printf("\n Ban Co Muon Thuc Hien Tiep Giao Dich (Y/N) \n"); if(yesNo() == 1){ system("cls"); choice = 0; // de quay ve menu continue; } else{ printf("\n Xin Chao Va Hen Gap Lai\n"); getch(); exit(0); //thoat chuong trinh break; } case 5 : system("cls"); logReader(1,dir); printf("\n Ban Co Muon Thuc Hien Tiep Giao Dich (Y/N) \n"); system("cls"); choice = 0; // de quay ve menu continue; case 6 : printf("\nXin Chao Va Hen Gap Lai\n"); getch(); exit(0); //thoat chuong trinh break; default: system("cls"); // xoa man hinh, nhap lai break; } } while (choice > 6 || choice < 1); }
int chuyenKhoan(char* dir){ // chuyen khoan (tuong tu rut tien) int num = 0; unsigned int tien; char desName[15],desDir[30],tempTThai[50]; // des = destination ( tai khoan can chuyen ) FILE *fp; // name la soTk, Dir la ten file, vd : acc1.dat khachHang temp,desTemp; // temp la cua tai khoan chuyen, desTemp la tai khoan duoc chuyen fp = fopen(dir,"rb"); // ghi cac du lieu can thiet vao temp fread(&temp,sizeof(temp),1,fp); fclose(fp); printf("\n====================Chuyen Khoan====================\n"); printf("\n So Du Trong Tai Khoan Cua Ban : %d\n",temp.soDu); while(1){ printf("\n Nhap Tai Khoan Muon Chuyen : "); fflush(stdin); gets(desName); for(int i = 0;i <6;i++){ //gan chuoi 2221995xxxxx thanh xxxxx NULL 5xxxx desName[i] = desName[i+7]; //muc dich de lay 5 so cuoi } num = atoi(desName); //chuyen alpha thanh integer makeDir(desDir,num); //tao duong dan (ten file) tu bien num if((fp=fopen(desDir,"rb")) == NULL){ //kiem tra xem da ton tai file chua fclose(fp); printf("\n The Khong Ton Tai. Nhan Phim Bat Ky De Nhap Lai\n"); getch(); system("cls"); // 2 dong nay de trinh bay dep mat them printf("\n====================Chuyen Khoan====================\n"); printf(" So Du Trong Tai Khoan Cua Ban : %d\n",temp.soDu); continue; } else if(strcmp(desDir,dir)==0){ printf("\n The Duoc Chuyen Trung Voi The Chuyen Tien\n"); printf("\n Nhan Phim Bat Ky De Nhap Lai\n"); getch(); system("cls"); // 2 dong nay de trinh bay dep mat them printf("\n====================Chuyen Khoan====================\n"); printf(" So Du Trong Tai Khoan Cua Ban : %d\n",temp.soDu); continue; } else{ fp = fopen(desDir,"rb"); fread(&desTemp,sizeof(desTemp),1,fp); fclose(fp); break; } } while(1){ printf("\n Nhap So Tien Muon Chuyen (Toi Thieu 10000) : "); scanf("%d",&tien); if(tien > temp.soDu){ // nhu ham rutTien printf("\n So Du Khong Du. Ban Co Muon Nhap Lai So Tien Muon Chuyen (Y/N)\n"); if(yesNo() == 1){ system("cls"); continue; } else{ return 0; } } else if(tien < 10000){ printf("\n So Tien Ban Muon Chuyen Qua It. Ban Co Muon Nhap Lai So Tien Muon Chuyen (Y/N)\n"); if(yesNo() == 1){ system("cls"); continue; } else{ return 0; } } printf("\n Ban Co Muon Chuyen So Tien Nay (Y/N)\n"); if(yesNo() == 1){ temp.soDu -= tien; strcpy(temp.time,getTime()); //cap nhat du lieu cho tai khoan chuyen tien fp = fopen(dir,"wb"); fwrite(&temp,sizeof(temp),1,fp); fclose(fp); desTemp.soDu += tien; //cap nhat du lieu cho tai khoan duoc chuyen tien sprintf(desTemp.trangThai,"Da Nhan Tu Tai Khoan %s %dVND",temp.soTk,tien); printLog(desDir,desTemp); printUserLog(desDir,desTemp); printf("\n ...Dang Chuyen."); fp = fopen(desDir,"wb"); fwrite(&desTemp,sizeof(desTemp),1,fp); fclose(fp); animation(); printf("\n ...Xong............\n"); printf("\n So Du Trong Tai Khoan Cua Ban : %d\n\n",temp.soDu); sprintf(temp.trangThai,"Da Chuyen Cho Tai Khoan %s %dVND",desTemp.soTk,tien); fp = fopen(dir,"wb"); fwrite(&temp,sizeof(temp),1,fp); fclose(fp); inPhieu(dir,temp.trangThai); printLog(dir,temp); printUserLog(dir,temp); break; } else{ system("cls"); continue; } return tien; } }
int rutTien(char *dir){ // ham rut tien tai khoan ATM unsigned int tien; FILE *fp; khachHang temp; char tempTThai[50]; fp = fopen(dir,"rb"); fread(&temp,sizeof(temp),1,fp); fclose(fp); while(1){ // kiem tra dieu kien printf("\n=====================Rut Tien=====================\n"); printf("\n Nhap So Tien Can Rut (Toi Thieu 10000) : "); scanf("%d",&tien); if(tien > temp.soDu){ // so du nho hon thi nhap lai so tien can rut printf("\n So Du Khong Du. Ban Co Muon Nhap Lai So Tien Muon Rut (Y/N)\n"); if(yesNo() == 1){ system("cls"); continue; } else{ return 0; } } else if(tien < 10000){ // so du nho hon 10000 thi nhap lai so tien can rut printf("\n So Tien Ban Rut Qua It. Ban Co Muon Nhap Lai So Tien Muon Rut (Y/N)\n"); if(yesNo() == 1){ system("cls"); continue; } else{ return 0; } } printf("\n Ban Co Muon Rut So Tien Nay (Y/N)\n"); if(yesNo() == 1){ temp.soDu -= tien; strcpy(temp.time,getTime()); printf("\n ...Dang Thuc Hien Rut Tien."); fp = fopen(dir,"wb"); fwrite(&temp,sizeof(temp),1,fp); fclose(fp); animation(); printf("\n ...Xong........................\n"); printf("\n So Du Trong Tai Khoan Cua Ban : %d\n",temp.soDu); printf("\n >> Nhan Tien : Nhan Mot Phim Bat Ky <<\n"); getch(); Sleep(500); printf("\n Tien Cua Ban Day\n"); printf("\n **************\n"); printf(" * $%-10d*",tien); printf("\n **************\n\n"); sprintf(temp.trangThai,"Da Rut %dVND",tien); fp = fopen(dir,"wb"); fwrite(&temp,sizeof(temp),1,fp); fclose(fp); inPhieu(dir,temp.trangThai); printLog(dir,temp); printUserLog(dir,temp); break; } else{ system("cls"); continue; } return tien; } }
int main(){ global *container;/*holder for EVERYTHING!*/ container=malloc(sizeof(global)); resetContainer(&container);/*clear out container*/ int esc = False;/*build for loop to contain prompt*/ /*system("clear");*/ printf("Good day, this is the recovery utility\n"); while(esc !=True){ char *inp; printf("\nPlease select ONE of the following:\n"); printf("1: Scan drive.\n");/*restarts program from beginning*/ printf("2: Save results to file.\n");/*save stack to file if exists*/ printf("3: Load results from file.\n");/*load stack from file*/ printf("4: Begin recovery.\n");/*start processing if we have full stack. if not open option 2, will prompt to save stack if it preexists*/ printf("5: Exit.\n");/*exits program, prompts to save current stack*/ printf(">"); inp = getInput(); int select = answer1(inp); free(inp); inp=NULL; /*begin task*/ if(select == 1){/*Scan drive*/ int go=True; if(container ->head != NULL && container ->tail != NULL){ printf("\nSCANNING DRIVE WILL WIPE CURRENT MEMORY!\n"); printf("Are you sure you would like to continue?(y or n)\n>"); go=yesNo(); } if(go==True){ printf("\nActivating scanner program, please standby\n"); destroyContainer(&container); resetContainer(&container); /*system("clear");*/ printf("Follow the prompt below\n"); printf("Name of file: "); char *tmp3 = getInput(); strcpy(container->name,tmp3); free(tmp3); tmp3=NULL; /*container->name =getInput();*/ go=partOne(&container);/*start program*/ if(go ==True){ /*system("clear");*/ stats(container); } } } else if(select == 2){/*Save results to file*/ if(one(container) == False){ printf("\nInitial scan skipped or invalid name given\ninvalid option selected. Try again\n"); } else{ printf("\nSAVE COMPLETE\n"); } } else if(select == 3){/*Load results from file*/ if(container ->head != NULL && container ->tail != NULL){/*pre existing data in memory*/ printf("\nLoading from file will DELETE RESULTS already in memory.\nContinue?\n>"); if(yesNo() == True){ if(two(&container) == False){ printf("\nInvalid file or file does not exist.\ninvalid option selected. Try again\n"); }/*error*/ }/*yes or no*/ }/*if head and tail are not nulled*/ else{/*are nulled so skip prompt*/ if(two(&container) == False){ printf("\nInvalid file or file does not exist.\ninvalid option selected. Try again\n"); }/*error*/ } /*system("clear");*/ stats(container); }/*end processing*/ else if(select == 4){/*Begin processing*/ if(container ->head != NULL && container ->tail != NULL){ printf("\nAbout to begin processing.\nONCE STARTED ALL RESULTS IN MEMORY WILL BE DELETED\n"); printf("Would you like to continue?\n>"); if(yesNo() == True){/*do not save before continuing*/ /*system("clear");*/ stats(container); end(&container);/*make threaded to show progress*/ /*system("clear");*//*return to main menu*/ printf("Complete!\n"); } } else{/*no stack*/ printf("\nInitial scan skipped.\ninvalid option selected. Try again\n"); } }/*end the processing case*/ else if(select == 5){/*exit*/ if(container ->head != NULL && container ->tail != NULL){/*pre existing data in memory*/ printf("\nEXITING WITHOUT SAVING CURRENT RESULTS WILL WIPE MEMORY!\nAre you sure you would like to exit?(y or n)\n>"); if(yesNo()==True){ printf("\n"); esc = True; break;/*break from this loop*/ } /*end the yesno question*/ }/*end case of data preexisting in memory*/ else{/*no data in memory so just exit*/ esc = True; break;/*break from this loop*/ } }/*end the exit case*/ /*end task*/ }/*end while loop*/ printf("\nShutting down program, Please wait\n"); destroyContainer(&container); free(container); container=NULL; destroy_mutex(); fprintf(stderr,"All Done! =^.^=\n"); pthread_exit(NULL); }/*end mainfile*/
VOID int21_service(iregs FAR * r) { COUNT rc, rc1; ULONG lrc; psp FAR *p = MK_FP(cu_psp, 0); p->ps_stack = (BYTE FAR *) r; #ifdef DEBUG if (bDumpRegs) { fbcopy((VOID FAR *) user_r, (VOID FAR *) & error_regs, sizeof(iregs)); printf("System call (21h): %02x\n", user_r->AX); dump_regs = TRUE; dump(); } #endif dispatch: /* Check for Ctrl-Break */ switch (r->AH) { default: if (!break_ena) break; case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x08: case 0x09: case 0x0a: case 0x0b: if (control_break()) handle_break(); } /* The dispatch handler */ switch (r->AH) { /* int 21h common error handler */ case 0x64: case 0x6b: default: error_invalid: r->AX = -DE_INVLDFUNC; goto error_out; error_exit: r->AX = -rc; error_out: r->FLAGS |= FLG_CARRY; break; #if 0 /* Moved to simulate a 0x4c00 -- 1999/04/21 ska */ /* Terminate Program */ case 0x00: if (cu_psp == RootPsp) break; else if (((psp FAR *) (MK_FP(cu_psp, 0)))->ps_parent == cu_psp) break; tsr = FALSE; return_mode = break_flg ? 1 : 0; return_code = r->AL; if (DosMemCheck() != SUCCESS) panic("MCB chain corrupted"); #ifdef TSC StartTrace(); #endif return_user(); break; #endif /* Read Keyboard with Echo */ case 0x01: Do_DosIdle_loop(); r->AL = _sti(); sto(r->AL); break; /* Display Character */ case 0x02: sto(r->DL); break; /* Auxiliary Input */ case 0x03: r->AL = _sti(); break; /* Auxiliary Output */ case 0x04: sto(r->DL); break; /* Print Character */ case 0x05: sto(r->DL); break; /* Direct Cosole I/O */ case 0x06: if (r->DL != 0xff) sto(r->DL); else if (StdinBusy()) { r->AL = 0x00; r->FLAGS |= FLG_ZERO; } else { r->FLAGS &= ~FLG_ZERO; r->AL = _sti(); } break; /* Direct Console Input */ case 0x07: /* Read Keyboard Without Echo */ case 0x08: Do_DosIdle_loop(); r->AL = _sti(); break; /* Display String */ case 0x09: { static COUNT scratch; BYTE FAR *p = MK_FP(r->DS, r->DX), FAR * q; q = p; while (*q != '$') ++q; DosWrite(STDOUT, q - p, p, (COUNT FAR *) & scratch); } r->AL = '$'; break; /* Buffered Keyboard Input */ case 0x0a: ((keyboard FAR *) MK_FP(r->DS, r->DX))->kb_count = 0; sti((keyboard FAR *) MK_FP(r->DS, r->DX)); ((keyboard FAR *) MK_FP(r->DS, r->DX))->kb_count -= 2; break; /* Check Stdin Status */ case 0x0b: if (StdinBusy()) r->AL = 0xFF; else r->AL = 0x00; break; /* Flush Buffer, Read Keayboard */ case 0x0c: KbdFlush(); switch (r->AL) { case 0x01: case 0x06: case 0x07: case 0x08: case 0x0a: r->AH = r->AL; goto dispatch; default: r->AL = 0x00; break; } break; /* Reset Drive */ case 0x0d: flush(); break; /* Set Default Drive */ case 0x0e: r->AL = DosSelectDrv(r->DL); break; case 0x0f: if (FcbOpen(MK_FP(r->DS, r->DX))) r->AL = 0; else r->AL = 0xff; break; case 0x10: if (FcbClose(MK_FP(r->DS, r->DX))) r->AL = 0; else r->AL = 0xff; break; case 0x11: if (FcbFindFirst(MK_FP(r->DS, r->DX))) r->AL = 0; else r->AL = 0xff; break; case 0x12: if (FcbFindNext(MK_FP(r->DS, r->DX))) r->AL = 0; else r->AL = 0xff; break; case 0x13: if (FcbDelete(MK_FP(r->DS, r->DX))) r->AL = 0; else r->AL = 0xff; break; case 0x14: { COUNT nErrorCode; if (FcbRead(MK_FP(r->DS, r->DX), &nErrorCode)) r->AL = 0; else r->AL = nErrorCode; break; } case 0x15: { COUNT nErrorCode; if (FcbWrite(MK_FP(r->DS, r->DX), &nErrorCode)) r->AL = 0; else r->AL = nErrorCode; break; } case 0x16: if (FcbCreate(MK_FP(r->DS, r->DX))) r->AL = 0; else r->AL = 0xff; break; case 0x17: if (FcbRename(MK_FP(r->DS, r->DX))) r->AL = 0; else r->AL = 0xff; break; /* CP/M compatibility functions */ case 0x18: case 0x1d: case 0x1e: case 0x20: #ifndef TSC case 0x61: #endif r->AL = 0; break; /* Get Default Drive */ case 0x19: r->AL = default_drive; break; /* Set DTA */ case 0x1a: { psp FAR *p = MK_FP(cu_psp, 0); p->ps_dta = MK_FP(r->DS, r->DX); dos_setdta(p->ps_dta); } break; /* Get Default Drive Data */ case 0x1b: { BYTE FAR *p; FatGetDrvData(0, (COUNT FAR *) & r->AX, (COUNT FAR *) & r->CX, (COUNT FAR *) & r->DX, (BYTE FAR **) & p); r->DS = FP_SEG(p); r->BX = FP_OFF(p); } break; /* Get Drive Data */ case 0x1c: { BYTE FAR *p; FatGetDrvData(r->DL, (COUNT FAR *) & r->AX, (COUNT FAR *) & r->CX, (COUNT FAR *) & r->DX, (BYTE FAR **) & p); r->DS = FP_SEG(p); r->BX = FP_OFF(p); } break; /* Get default DPB */ case 0x1f: if (default_drive < lastdrive) { struct dpb FAR *dpb = (struct dpb FAR *)CDSp->cds_table[default_drive].cdsDpb; if (dpb == 0) { r->AL = 0xff; break; } r->DS = FP_SEG(dpb); r->BX = FP_OFF(dpb); r->AL = 0; } else r->AL = 0xff; break; /* Random read using FCB */ case 0x21: { COUNT nErrorCode; if (FcbRandomRead(MK_FP(r->DS, r->DX), &nErrorCode)) r->AL = 0; else r->AL = nErrorCode; break; } /* Random write using FCB */ case 0x22: { COUNT nErrorCode; if (FcbRandomWrite(MK_FP(r->DS, r->DX), &nErrorCode)) r->AL = 0; else r->AL = nErrorCode; break; } /* Get file size in records using FCB */ case 0x23: if (FcbGetFileSize(MK_FP(r->DS, r->DX))) r->AL = 0; else r->AL = 0xff; break; /* Set random record field in FCB */ case 0x24: FcbSetRandom(MK_FP(r->DS, r->DX)); break; /* Set Interrupt Vector */ case 0x25: { VOID(INRPT FAR * p) () = MK_FP(r->DS, r->DX); setvec(r->AL, p); } break; /* Dos Create New Psp */ case 0x26: { psp FAR *p = MK_FP(cu_psp, 0); new_psp((psp FAR *) MK_FP(r->DX, 0), p->ps_size); } break; /* Read random record(s) using FCB */ case 0x27: { COUNT nErrorCode; if (FcbRandomBlockRead(MK_FP(r->DS, r->DX), r->CX, &nErrorCode)) r->AL = 0; else r->AL = nErrorCode; break; } /* Write random record(s) using FCB */ case 0x28: { COUNT nErrorCode; if (FcbRandomBlockWrite(MK_FP(r->DS, r->DX), r->CX, &nErrorCode)) r->AL = 0; else r->AL = nErrorCode; break; } /* Parse File Name */ case 0x29: { BYTE FAR *lpFileName; lpFileName = MK_FP(r->DS, r->SI); r->AL = FcbParseFname(r->AL, &lpFileName, MK_FP(r->ES, r->DI)); r->DS = FP_SEG(lpFileName); r->SI = FP_OFF(lpFileName); } break; /* Get Date */ case 0x2a: DosGetDate( (BYTE FAR *) & (r->AL), /* WeekDay */ (BYTE FAR *) & (r->DH), /* Month */ (BYTE FAR *) & (r->DL), /* MonthDay */ (COUNT FAR *) & (r->CX)); /* Year */ break; /* Set Date */ case 0x2b: rc = DosSetDate( (BYTE FAR *) & (r->DH), /* Month */ (BYTE FAR *) & (r->DL), /* MonthDay */ (COUNT FAR *) & (r->CX)); /* Year */ if (rc != SUCCESS) r->AL = 0xff; else r->AL = 0; break; /* Get Time */ case 0x2c: DosGetTime( (BYTE FAR *) & (r->CH), /* Hour */ (BYTE FAR *) & (r->CL), /* Minutes */ (BYTE FAR *) & (r->DH), /* Seconds */ (BYTE FAR *) & (r->DL)); /* Hundredths */ break; /* Set Date */ case 0x2d: rc = DosSetTime( (BYTE FAR *) & (r->CH), /* Hour */ (BYTE FAR *) & (r->CL), /* Minutes */ (BYTE FAR *) & (r->DH), /* Seconds */ (BYTE FAR *) & (r->DL)); /* Hundredths */ if (rc != SUCCESS) r->AL = 0xff; else r->AL = 0; break; /* Set verify flag */ case 0x2e: verify_ena = (r->AL ? TRUE : FALSE); break; /* Get DTA */ case 0x2f: r->ES = FP_SEG(dta); r->BX = FP_OFF(dta); break; /* Get DOS Version */ case 0x30: r->AL = os_major; r->AH = os_minor; r->BH = OEM_ID; r->CH = REVISION_MAJOR; /* JPP */ r->CL = REVISION_MINOR; r->BL = REVISION_SEQ; break; /* Keep Program (Terminate and stay resident) */ case 0x31: DosMemChange(cu_psp, r->DX < 6 ? 6 : r->DX, 0); return_mode = 3; return_code = r->AL; tsr = TRUE; return_user(); break; /* Get DPB */ case 0x32: if (r->DL < lastdrive) { struct dpb FAR *dpb = CDSp->cds_table[r->DL].cdsDpb; if (dpb == 0) { r->AL = 0xff; break; } r->DS = FP_SEG(dpb); r->BX = FP_OFF(dpb); r->AL = 0; } else r->AL = 0xFF; break; /* Get InDOS flag */ case 0x34: { BYTE FAR *p; p = (BYTE FAR *) ((BYTE *) & InDOS); r->ES = FP_SEG(p); r->BX = FP_OFF(p); } break; /* Get Interrupt Vector */ case 0x35: { BYTE FAR *p; p = getvec((COUNT) r->AL); r->ES = FP_SEG(p); r->BX = FP_OFF(p); } break; /* Dos Get Disk Free Space */ case 0x36: DosGetFree( (COUNT) r->DL, (COUNT FAR *) & r->AX, (COUNT FAR *) & r->BX, (COUNT FAR *) & r->CX, (COUNT FAR *) & r->DX); break; /* Undocumented Get/Set Switchar */ case 0x37: switch (r->AL) { /* Get switch character */ case 0x00: r->DL = switchar; r->AL = 0x00; break; /* Set switch character */ case 0x01: switchar = r->DL; r->AL = 0x00; break; default: goto error_invalid; } break; /* Get/Set Country Info */ case 0x38: { BYTE FAR *lpTable = (BYTE FAR *) MK_FP(r->DS, r->DX); BYTE nRetCode; if (0xffff == r->DX) { r->BX = SetCtryInfo( (UBYTE FAR *) & (r->AL), (UWORD FAR *) & (r->BX), (BYTE FAR *) & lpTable, (UBYTE *) & nRetCode); if (nRetCode != 0) { r->AX = 0xff; r->FLAGS |= FLG_CARRY; } else { r->AX = nRetCode; r->FLAGS &= ~FLG_CARRY; } } else { r->BX = GetCtryInfo(&(r->AL), &(r->BX), lpTable); r->FLAGS &= ~FLG_CARRY; } } break; /* Dos Create Directory */ case 0x39: rc = dos_mkdir((BYTE FAR *) MK_FP(r->DS, r->DX)); if (rc != SUCCESS) goto error_exit; else { r->FLAGS &= ~FLG_CARRY; } break; /* Dos Remove Directory */ case 0x3a: rc = dos_rmdir((BYTE FAR *) MK_FP(r->DS, r->DX)); if (rc != SUCCESS) goto error_exit; else { r->FLAGS &= ~FLG_CARRY; } break; /* Dos Change Directory */ case 0x3b: if ((rc = DosChangeDir((BYTE FAR *) MK_FP(r->DS, r->DX))) < 0) goto error_exit; else { r->FLAGS &= ~FLG_CARRY; } break; /* Dos Create File */ case 0x3c: if ((rc = DosCreat(MK_FP(r->DS, r->DX), r->CX)) < 0) goto error_exit; else { r->AX = rc; r->FLAGS &= ~FLG_CARRY; } break; /* Dos Open */ case 0x3d: if ((rc = DosOpen(MK_FP(r->DS, r->DX), r->AL)) < 0) goto error_exit; else { r->AX = rc; r->FLAGS &= ~FLG_CARRY; } break; /* Dos Close */ case 0x3e: if ((rc = DosClose(r->BX)) < 0) goto error_exit; else r->FLAGS &= ~FLG_CARRY; break; /* Dos Read */ case 0x3f: rc = DosRead(r->BX, r->CX, MK_FP(r->DS, r->DX), (COUNT FAR *) & rc1); if (rc1 != SUCCESS) { r->FLAGS |= FLG_CARRY; r->AX = -rc1; } else { r->FLAGS &= ~FLG_CARRY; r->AX = rc; } break; /* Dos Write */ case 0x40: rc = DosWrite(r->BX, r->CX, MK_FP(r->DS, r->DX), (COUNT FAR *) & rc1); if (rc1 != SUCCESS) { r->FLAGS |= FLG_CARRY; r->AX = -rc1; } else { r->FLAGS &= ~FLG_CARRY; r->AX = rc; } break; /* Dos Delete File */ case 0x41: rc = dos_delete((BYTE FAR *) MK_FP(r->DS, r->DX)); if (rc < 0) { r->FLAGS |= FLG_CARRY; r->AX = -rc1; } else r->FLAGS &= ~FLG_CARRY; break; /* Dos Seek */ case 0x42: if ((rc = DosSeek(r->BX, (LONG) ((((LONG) (r->CX)) << 16) + r->DX), r->AL, &lrc)) < 0) goto error_exit; else { r->DX = (lrc >> 16); r->AX = lrc & 0xffff; r->FLAGS &= ~FLG_CARRY; } break; /* Get/Set File Attributes */ case 0x43: switch (r->AL) { case 0x00: rc = DosGetFattr((BYTE FAR *) MK_FP(r->DS, r->DX), (UWORD FAR *) & r->CX); if (rc < SUCCESS) goto error_exit; else { r->FLAGS &= ~FLG_CARRY; } break; case 0x01: rc = DosSetFattr((BYTE FAR *) MK_FP(r->DS, r->DX), (UWORD FAR *) & r->CX); if (rc != SUCCESS) goto error_exit; else r->FLAGS &= ~FLG_CARRY; break; default: goto error_invalid; } break; /* Device I/O Control */ case 0x44: { rc = DosDevIOctl(r, (COUNT FAR *) & rc1); if (rc1 != SUCCESS) { r->FLAGS |= FLG_CARRY; r->AX = -rc1; } else { r->FLAGS &= ~FLG_CARRY; } } break; /* Duplicate File Handle */ case 0x45: rc = DosDup(r->BX); if (rc < SUCCESS) goto error_exit; else { r->FLAGS &= ~FLG_CARRY; r->AX = rc; } break; /* Force Duplicate File Handle */ case 0x46: rc = DosForceDup(r->BX, r->CX); if (rc < SUCCESS) goto error_exit; else r->FLAGS &= ~FLG_CARRY; break; /* Get Current Directory */ case 0x47: if ((rc = DosGetCuDir(r->DL, MK_FP(r->DS, r->SI))) < 0) goto error_exit; else { r->FLAGS &= ~FLG_CARRY; r->AX = 0x0100; /*jpp: from interrupt list */ } break; /* Allocate memory */ case 0x48: if ((rc = DosMemAlloc(r->BX, mem_access_mode, &(r->AX), &(r->BX))) < 0) { DosMemLargest(&(r->BX)); goto error_exit; } else { ++(r->AX); /* DosMemAlloc() returns seg of MCB rather than data */ r->FLAGS &= ~FLG_CARRY; } break; /* Free memory */ case 0x49: if ((rc = DosMemFree((r->ES) - 1)) < 0) goto error_exit; else r->FLAGS &= ~FLG_CARRY; break; /* Set memory block size */ case 0x4a: { UWORD maxSize; if ((rc = DosMemChange(r->ES, r->BX, &maxSize)) < 0) { if (rc == DE_NOMEM) r->BX = maxSize; #if 0 if (cu_psp == r->ES) { psp FAR *p; p = MK_FP(cu_psp, 0); p->ps_size = r->BX + cu_psp; } #endif goto error_exit; } else r->FLAGS &= ~FLG_CARRY; break; } /* Load and Execute Program */ case 0x4b: break_flg = FALSE; if ((rc = DosExec(r->AL, MK_FP(r->ES, r->BX), MK_FP(r->DS, r->DX))) != SUCCESS) goto error_exit; else r->FLAGS &= ~FLG_CARRY; break; /* Terminate Program */ case 0x00: r->AX = 0x4c00; /* End Program */ case 0x4c: if (cu_psp == RootPsp || ((psp FAR *) (MK_FP(cu_psp, 0)))->ps_parent == cu_psp) break; tsr = FALSE; /* int2f_Remote_call(0x1122, 0, 0, 0, 0, 0, 0); int2f_Remote_call(REM_CLOSEALL, 0, 0, 0, 0, 0, 0); */ if (ErrorMode) { ErrorMode = FALSE; return_mode = 2; } else if (break_flg) { break_flg = FALSE; return_mode = 1; } else { return_mode = 0; } return_code = r->AL; if (DosMemCheck() != SUCCESS) panic("MCB chain corrupted"); #ifdef TSC StartTrace(); #endif return_user(); break; /* Get Child-program Return Value */ case 0x4d: r->AL = return_code; r->AH = return_mode; break; /* Dos Find First */ case 0x4e: { /* dta for this call is set on entry. This */ /* needs to be changed for new versions. */ if ((rc = DosFindFirst((UCOUNT) r->CX, (BYTE FAR *) MK_FP(r->DS, r->DX))) < 0) goto error_exit; else { r->AX = 0; r->FLAGS &= ~FLG_CARRY; } } break; /* Dos Find Next */ case 0x4f: { /* dta for this call is set on entry. This */ /* needs to be changed for new versions. */ if ((rc = DosFindNext()) < 0) { r->AX = -rc; if (r->AX == 2) r->AX = 18; r->FLAGS |= FLG_CARRY; } else { r->FLAGS &= ~FLG_CARRY; } } break; /* ************UNDOCUMENTED************************************* */ /* Get List of Lists */ case 0x52: { BYTE FAR *p; p = (BYTE FAR *) & DPBp; r->ES = FP_SEG(p); r->BX = FP_OFF(p); } break; /* Get verify state */ case 0x54: r->AL = (verify_ena ? TRUE : FALSE); break; /* ************UNDOCUMENTED************************************* */ /* Dos Create New Psp & set p_size */ case 0x55: new_psp((psp FAR *) MK_FP(r->DX, 0), r->SI); break; /* Dos Rename */ case 0x56: rc = dos_rename( (BYTE FAR *) MK_FP(r->DS, r->DX), /* OldName */ (BYTE FAR *) MK_FP(r->ES, r->DI)); /* NewName */ if (rc < SUCCESS) goto error_exit; else { r->FLAGS &= ~FLG_CARRY; } break; /* Get/Set File Date and Time */ case 0x57: switch (r->AL) { case 0x00: rc = DosGetFtime( (COUNT) r->BX, /* Handle */ (date FAR *) & r->DX, /* FileDate */ (time FAR *) & r->CX); /* FileTime */ if (rc < SUCCESS) goto error_exit; else r->FLAGS &= ~FLG_CARRY; break; case 0x01: rc = DosSetFtime( (COUNT) r->BX, /* Handle */ (date FAR *) & r->DX, /* FileDate */ (time FAR *) & r->CX); /* FileTime */ if (rc < SUCCESS) goto error_exit; else r->FLAGS &= ~FLG_CARRY; break; default: goto error_invalid; } break; /* Get/Set Allocation Strategy */ case 0x58: switch (r->AL) { case 0x00: r->AX = mem_access_mode; break; case 0x01: if (((COUNT) r->BX) < 0 || r->BX > 2) goto error_invalid; else { mem_access_mode = r->BX; r->FLAGS &= ~FLG_CARRY; } break; default: goto error_invalid; #ifdef DEBUG case 0xff: show_chain(); break; #endif } break; /* Create Temporary File */ case 0x5a: if ((rc = DosMkTmp(MK_FP(r->DS, r->DX), r->CX)) < 0) goto error_exit; else { r->AX = rc; r->FLAGS &= ~FLG_CARRY; } break; /* Create New File */ case 0x5b: if ((rc = DosOpen(MK_FP(r->DS, r->DX), 0)) >= 0) { DosClose(rc); r->AX = 80; r->FLAGS |= FLG_CARRY; } else { if ((rc = DosCreat(MK_FP(r->DS, r->DX), r->CX)) < 0) goto error_exit; else { r->AX = rc; r->FLAGS &= ~FLG_CARRY; } } break; /* UNDOCUMENTED: server, share.exe and sda function */ case 0x5d: switch (r->AL) { /* Remote Server Call */ case 0x00: { UWORD FAR *x = MK_FP(r->DS, r->DX); r->AX = x[0]; r->BX = x[1]; r->CX = x[2]; r->DX = x[3]; r->SI = x[4]; r->DI = x[5]; r->DS = x[6]; r->ES = x[7]; } goto dispatch; case 0x06: r->DS = FP_SEG(internal_data); r->SI = FP_OFF(internal_data); r->CX = swap_always - internal_data; r->DX = swap_indos - internal_data; r->FLAGS &= ~FLG_CARRY; break; case 0x07: case 0x08: case 0x09: int2f_Remote_call(REM_PRINTREDIR, 0, 0, r->DX, 0, 0, (MK_FP(0, Int21AX))); break; default: goto error_invalid; } break; case 0x5e: switch (r->AL) { case 0x00: r->CX = get_machine_name(MK_FP(r->DS, r->DX)); break; case 0x01: set_machine_name(MK_FP(r->DS, r->DX), r->CX); break; default: int2f_Remote_call(REM_PRINTSET, r->BX, r->CX, r->DX, (MK_FP(r->ES, r->DI)), r->SI, (MK_FP(r->DS, Int21AX))); break; } break; case 0x5f: switch (r->AL) { case 0x07: CDSp->cds_table[r->DL].cdsFlags |= 0x100; break; case 0x08: CDSp->cds_table[r->DL].cdsFlags &= ~0x100; break; default: int2f_Remote_call(REM_DOREDIRECT, r->BX, r->CX, r->DX, (MK_FP(r->ES, r->DI)), r->SI, (MK_FP(r->DS, Int21AX))); break; } break; case 0x60: /* TRUENAME */ if ((rc = truename(MK_FP(r->DS, r->SI), adjust_far(MK_FP(r->ES, r->DI)), TRUE)) != SUCCESS) goto error_exit; else { r->FLAGS &= ~FLG_CARRY; } break; #ifdef TSC /* UNDOCUMENTED: no-op */ /* */ /* DOS-C: tsc support */ case 0x61: #ifdef DEBUG switch (r->AL) { case 0x01: bTraceNext = TRUE; break; case 0x02: bDumpRegs = FALSE; break; } #endif r->AL = 0x00; break; #endif /* UNDOCUMENTED: return current psp */ case 0x62: r->BX = cu_psp; break; /* UNDOCUMENTED: Double byte and korean tables */ case 0x63: { #ifdef DBLBYTE static char dbcsTable[2] = { 0, 0 }; void FAR *dp = &dbcsTable; r->DS = FP_SEG(dp); r->SI = FP_OFF(dp); r->AL = 0; #else /* not really supported, but will pass. */ r->AL = 0x00; /*jpp: according to interrupt list */ #endif break; } /* Extended country info */ case 0x65: if (r->AL <= 0x7) { if (ExtCtryInfo( r->AL, r->BX, r->CX, MK_FP(r->ES, r->DI))) r->FLAGS &= ~FLG_CARRY; else goto error_invalid; } else if ((r->AL >= 0x20) && (r->AL <= 0x22)) { switch (r->AL) { case 0x20: r->DL = upChar(r->DL); goto okay; case 0x21: upMem( MK_FP(r->DS, r->DX), r->CX); goto okay; case 0x22: upString(MK_FP(r->DS, r->DX)); okay: r->FLAGS &= ~FLG_CARRY; break; case 0x23: r->AX = yesNo(r->DL); goto okay; default: goto error_invalid; } } else r->FLAGS |= FLG_CARRY; break; /* Code Page functions */ case 0x66: switch (r->AL) { case 1: GetGlblCodePage( (UWORD FAR *) & (r->BX), (UWORD FAR *) & (r->DX)); goto okay_66; case 2: SetGlblCodePage( (UWORD FAR *) & (r->BX), (UWORD FAR *) & (r->DX)); okay_66: r->FLAGS &= ~FLG_CARRY; break; default: goto error_invalid; } break; /* Set Max file handle count */ case 0x67: if ((rc = SetJFTSize(r->BX)) != SUCCESS) goto error_exit; else { r->FLAGS &= ~FLG_CARRY; } break; /* Flush file buffer -- dummy function right now. */ case 0x68: r->FLAGS &= ~FLG_CARRY; break; } #ifdef DEBUG if (bDumpRegs) { fbcopy((VOID FAR *) user_r, (VOID FAR *) & error_regs, sizeof(iregs)); dump_regs = TRUE; dump(); } #endif }