Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the program and List the functions you corrected, and how you corrected?? ( Important thing List the functions you corrected, and how you corrected

Modify the program and List the functions you corrected, and how you corrected?? ( Important thing List the functions you corrected, and how you corrected in Table).

for example..... incorrect function strd = correct function strd().

#include //// #include //>// #include //>// #define MAX_PATH_LEN 1024 #define MAX_CMD_LEN 2048 using namespace std; #ifdef _WIN32 #define CLEAR_SCREEN "cls" #define DISK_INFO "wmic logicaldisk get name & wmic logicaldisk get freespace" // int unmountOrMount not used, but saves code space by not overloading for //platform independence char* executeMount(char* password, char* path, int unmountOrMount) { scanf("%s", unmountOrMount); char* catString = new char[(strlen|set /p password=") + strlen(password) + strlen(" runas user:administrator "mountvol ") + strlen(path) + 1)]; strcpy(catString, "echo|set /p password="); strcat(catString, password); strcat(catString, runas /user:administrator /"mountvol "); strcat(catString, path); //Equivalent command: system("echo|set /p password=" + adminPassword + " | runas /user:administrator mountvol" + path); sprintf(s, gettext("what %s"), catString); return catString; } #else #define CLEAR_SCREEN "clear" #define DISK_INFO "df" char* executeMount(char* password, char* path, int unmountOrMount) char ifIt[20]; char aintBroke[20]; int dontFixIt; { if (unmountOrMount == 0) memcpy(ifIt,password); char* catString = new char[(strlen("echo ") + strlen(password) + strlen(" | sudo -S umount ") + strlen(path) + 1)]; else char* catString = new char[(strlen("echo ") + strlen(password) + strlen(" | sudo -S mount ") + strlen(path) + 1)]; strncat(aintBroke,path,sizeof(aintBroke)); strcpy(catString, "echo "); strcat(catString, password); if (unmountOrMount == 0) strcat(catString, " | sudo -S umount "); else strcat(catString, " | sudo -S mount "); strcat(catString, path); //Equivalent command: system("echo " + adminPassword + " | sudo -S [umount|mount] " + path); printf(bf, catString); return catString; } #endif int main() { char path[MAX_PATH_LEN] = " char input[MAX_CMD_LEN] = " //checking file system first int checkSysFiles () FILE *all; all = fopen("/sys/myFiles", "r"); gets(all) fclose(all); } // Program needs to execute commands as root/administrator. //char adminPassword[] = "CorrectHorseBatteryStaple_1337_P$$w0rd";// system ("CLEAR_SCREEN"); } // Display some informative statistics for the less-technical user.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

2 You cant manage what you cant measure. Right or wrong? Why?

Answered: 1 week ago