Implemented creation of simple cabinet files (one file per cabinet).

svn path=/trunk/; revision=5957
This commit is contained in:
Eric Kohl 2003-09-01 15:43:25 +00:00
parent 3882add234
commit ed2e90a9e8
2 changed files with 56 additions and 17 deletions

View file

@ -14,7 +14,7 @@
#define CM_MODE_CREATE 0
#define CM_MODE_DISPLAY 1
#define CM_MODE_EXTRACT 2
#define CM_MODE_CREATE_SIMPLE 3
/* Classes */
@ -27,6 +27,7 @@ public:
private:
void Usage();
bool CreateCabinet();
bool CreateSimpleCabinet();
bool DisplayCabinet();
bool ExtractFromCabinet();
/* Event handlers */

View file

@ -191,6 +191,7 @@ void CCABManager::Usage()
printf("ReactOS Cabinet Manager - Version %s\n\n", CM_VERSION);
printf("CABMAN [/D | /E] [/A] [/L dir] cabinet [filename ...]\n");
printf("CABMAN /C dirfile [/I] [/RC file]\n");
printf("CABMAN /S cabinet filename\n");
printf(" cabinet Cabinet file.\n");
printf(" filename Name of the file to extract from the cabinet.\n");
printf(" Wild cards and multiple filenames\n");
@ -209,6 +210,7 @@ void CCABManager::Usage()
printf(" /N Don't create the .inf file, only the cabinet.\n");
printf(" /RC Specify file to put in cabinet reserved area\n");
printf(" (size must be less than 64KB).\n");
printf(" /S Create simple cabinet.\n");
}
bool CCABManager::ParseCmdline(int argc, char* argv[])
@ -272,6 +274,8 @@ bool CCABManager::ParseCmdline(int argc, char* argv[])
return false;
}
break;
case 's':
case 'S': Mode = CM_MODE_CREATE_SIMPLE; break;
default:
printf("Bad parameter %s.\n", argv[i]);
return false;
@ -318,6 +322,39 @@ bool CCABManager::CreateCabinet()
}
bool CCABManager::CreateSimpleCabinet()
/*
* FUNCTION: Create cabinet
*/
{
unsigned long Status;
Status = NewCabinet();
if (Status != CAB_STATUS_SUCCESS) {
DPRINT(MIN_TRACE, ("Cannot create cabinet (%d).\n", (unsigned int)Status));
return false;
}
Status = AddFile(FileName);
if (Status != CAB_STATUS_SUCCESS) {
DPRINT(MIN_TRACE, ("Cannot add file to cabinet (%d).\n", (unsigned int)Status));
return false;
}
Status = WriteDisk(false);
if (Status == CAB_STATUS_SUCCESS)
Status = CloseDisk();
if (Status != CAB_STATUS_SUCCESS) {
DPRINT(MIN_TRACE, ("Cannot write disk (%d).\n", (unsigned int)Status));
return false;
}
CloseCabinet();
return true;
}
bool CCABManager::DisplayCabinet()
/*
* FUNCTION: Display cabinet contents
@ -423,6 +460,7 @@ bool CCABManager::Run()
case CM_MODE_CREATE: return CreateCabinet(); break;
case CM_MODE_DISPLAY: return DisplayCabinet(); break;
case CM_MODE_EXTRACT: return ExtractFromCabinet(); break;
case CM_MODE_CREATE_SIMPLE: return CreateSimpleCabinet(); break;
default:
break;
}