home *** CD-ROM | disk | FTP | other *** search
- /*
- * This file is (C) Chris Wohlgemuth 1999
- */
- /*
- * 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; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- #include "audiofolder.hh"
- #include "audiofolderhelp.h"
-
- #include <stdlib.h>
- #include <stdio.h>
-
-
-
- char chrImage[CCHMAXPATH]={0};/* Path to iso-image */
- char lnchParam[1024];
- extern char chrCDROptions[CCHMAXPATH];
- extern char chrCDRecord[CCHMAXPATH];/* Path to cdrecord */
- extern char chrMkisofs[CCHMAXPATH];/* Path to mkisofs */
- extern char chrMkisofsOptions[CCHMAXPATH];
- extern BOOL bMultiSessionDone;
- extern char chosenMultiSessionCD[3];
-
- HMODULE queryModuleHandle(void);
- MRESULT EXPENTRY cdTypeOptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
- MRESULT EXPENTRY authorOptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
- MRESULT EXPENTRY cdrecordOptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
- MRESULT EXPENTRY mkisofsOptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
- MRESULT EXPENTRY fileNameOptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
- void _Optlink imageWriteThreadFunc (void *arg);
- void _Optlink mkisofsThreadFunc (void *arg);
- void _Optlink flyThreadFunc (void *arg);
- void buildDataWriteParam(CWDataFolder* thisPtr, char * text);
- void buildMkisofsParam(CWDataFolder* thisPtr, char * text, char * outputName);
- PSZ buildWrapName(PSZ wrapperName);
-
- /********************************************************/
- /* New class function which inserts the filename option */
- /* page into the settings notebook */
- /********************************************************/
- BOOL CWDataFolder::AddFileNameOptionPage(HWND hwndNotebook)
- {
- PAGEINFO pageinfo;
-
- //Clear the pageinfo structure
- memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
- //Fill the pageinfo structure
- pageinfo.cb = sizeof(PAGEINFO);
- pageinfo.hwndPage = NULLHANDLE;
- pageinfo.usPageStyleFlags = BKA_MAJOR | BKA_STATUSTEXTON;
- pageinfo.usPageInsertFlags = BKA_FIRST;
- //We want page numbers
- pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
- //The dialog procedure for this page
- pageinfo.pfnwp = fileNameOptionDlgProc;
- //The resource is in the class file
- pageinfo.resid = queryModuleHandle();
- pageinfo.dlgid = IDDLG_FILENAMEOPTIONS;
- //We need a pointer to our WPS-object in the dialog procedure
- //to call class functions
- pageinfo.pCreateParams = this;
- //The ID of the help panel for this page
- pageinfo.idDefaultHelpPanel = IDDLG_FILENAMEOPTIONS;
- //Tell the WPS the help library name
- pageinfo.pszHelpLibraryName = AFHELPLIBRARY;
- //We have a major tab so we need a name
- pageinfo.pszName = "Filename options";
-
- //Insert the page into the settings notebook
- return wpInsertSettingsPage(hwndNotebook,&pageinfo);
- }
-
- /********************************************************/
- /* New class function which inserts the mkisofs setup */
- /* page into the settings notebook */
- /********************************************************/
- BOOL CWDataFolder::AddMkisofsOptionPage(HWND hwndNotebook)
- {
- PAGEINFO pageinfo;
-
- //Clear the pageinfo structure
- memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
- //Fill the pageinfo structure
- pageinfo.cb = sizeof(PAGEINFO);
- pageinfo.hwndPage = NULLHANDLE;
- pageinfo.usPageStyleFlags = BKA_MAJOR | BKA_STATUSTEXTON;
- pageinfo.usPageInsertFlags = BKA_FIRST;
- //We want page numbers
- pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
- //The dialog procedure for this page
- pageinfo.pfnwp = mkisofsOptionDlgProc;
- //The resource is in the class file
- pageinfo.resid = queryModuleHandle();
- pageinfo.dlgid = IDDLG_MKISOFSSETUP;
- //We need a pointer to our WPS-object in the dialog procedure
- //to call class functions
- pageinfo.pCreateParams = this;
- //The ID of the help panel for this page
- pageinfo.idDefaultHelpPanel = IDDLG_MKISOFSSETUP;
- //Tell the WPS the help library name
- pageinfo.pszHelpLibraryName = AFHELPLIBRARY;
- //We have a major tab so we need a name
- pageinfo.pszName = "Mkisofs setup";
-
- //Insert the page into the settings notebook
- return wpInsertSettingsPage(hwndNotebook,&pageinfo);
- }
-
- /********************************************************/
- /* New class function which inserts the Cdrecord option */
- /* page into the settings notebook */
- /********************************************************/
- BOOL CWDataFolder::AddCdrecordOptionPage(HWND hwndNotebook)
- {
- PAGEINFO pageinfo;
-
- //Clear the pageinfo structure
- memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
- //Fill the pageinfo structure
- pageinfo.cb = sizeof(PAGEINFO);
- pageinfo.hwndPage = NULLHANDLE;
- pageinfo.usPageStyleFlags = BKA_MAJOR | BKA_STATUSTEXTON;
- pageinfo.usPageInsertFlags = BKA_FIRST;
- //We want page numbers
- pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
- //The dialog procedure for this page
- pageinfo.pfnwp = cdrecordOptionDlgProc;
- //The resource is in the class file
- pageinfo.resid = queryModuleHandle();
- pageinfo.dlgid = IDDLG_CDRECORDSETUP;
- //We need a pointer to our WPS-object in the dialog procedure
- //to call class functions
- pageinfo.pCreateParams = this;
- //The ID of the help panel for this page
- pageinfo.idDefaultHelpPanel = IDDLG_CDRECORDSETUP;
- //Tell the WPS the help library name
- pageinfo.pszHelpLibraryName = AFHELPLIBRARY;
- //We have a major tab so we need a name
- pageinfo.pszName = "CDRecord/2 options";
-
- //Insert the page into the settings notebook
- return wpInsertSettingsPage(hwndNotebook,&pageinfo);
- }
-
- /********************************************************/
- /* New class function which inserts the author */
- /* page into the settings notebook */
- /********************************************************/
- BOOL CWDataFolder::AddAuthorOptionPage(HWND hwndNotebook)
- {
- PAGEINFO pageinfo;
-
- //Clear the pageinfo structure
- memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
- //Fill the pageinfo structure
- pageinfo.cb = sizeof(PAGEINFO);
- pageinfo.hwndPage = NULLHANDLE;
- pageinfo.usPageStyleFlags = BKA_MAJOR | BKA_STATUSTEXTON;
- pageinfo.usPageInsertFlags = BKA_FIRST;
- //We want page numbers
- pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
- //The dialog procedure for this page
- pageinfo.pfnwp = authorOptionDlgProc;
- //The resource is in the class file
- pageinfo.resid = queryModuleHandle();
- pageinfo.dlgid = IDDLG_AUTHOR;
- //We need a pointer to our WPS-object in the dialog procedure
- //to call class functions
- pageinfo.pCreateParams = this;
- //The ID of the help panel for this page
- pageinfo.idDefaultHelpPanel = IDDLG_AUTHOR;
- //Tell the WPS the help library name
- pageinfo.pszHelpLibraryName = AFHELPLIBRARY;
- //We have a major tab so we need a name
- pageinfo.pszName = "Author";
-
- //Insert the page into the settings notebook
- return wpInsertSettingsPage(hwndNotebook,&pageinfo);
- }
-
- /********************************************************/
- /* New class function which inserts the CD-Type */
- /* page into the settings notebook */
- /********************************************************/
- BOOL CWDataFolder::AddCDTypeOptionPage(HWND hwndNotebook)
- {
- PAGEINFO pageinfo;
-
- //Clear the pageinfo structure
- memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
- //Fill the pageinfo structure
- pageinfo.cb = sizeof(PAGEINFO);
- pageinfo.hwndPage = NULLHANDLE;
- pageinfo.usPageStyleFlags = BKA_MAJOR | BKA_STATUSTEXTON;
- pageinfo.usPageInsertFlags = BKA_FIRST;
- //We want page numbers
- pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
- //The dialog procedure for this page
- pageinfo.pfnwp = cdTypeOptionDlgProc;
- //The resource is in the class file
- pageinfo.resid = queryModuleHandle();
- pageinfo.dlgid = IDDLG_CDTYPE;
- //We need a pointer to our WPS-object in the dialog procedure
- //to call class functions
- pageinfo.pCreateParams = this;
- //The ID of the help panel for this page
- pageinfo.idDefaultHelpPanel = IDDLG_CDTYPE;
- //Tell the WPS the help library name
- pageinfo.pszHelpLibraryName = AFHELPLIBRARY;
- //We have a major tab so we need a name
- pageinfo.pszName = "CD-Type selection";
-
- //Insert the page into the settings notebook
- return wpInsertSettingsPage(hwndNotebook,&pageinfo);
- }
-
- /********************************************************/
- /*BOOL CWDataFolder::AddCreateOptionPage(HWND hwndNotebook)
- {
- PAGEINFO pageinfo;
-
- //Clear the pageinfo structure
- memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
- //Fill the pageinfo structure
- pageinfo.cb = sizeof(PAGEINFO);
- pageinfo.hwndPage = NULLHANDLE;
- pageinfo.usPageStyleFlags = BKA_MAJOR | BKA_STATUSTEXTON;
- pageinfo.usPageInsertFlags = BKA_FIRST;
- //We want page numbers
- pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
- //The dialog procedure for this page
- pageinfo.pfnwp = createOptionDlgProc;
- //The resource is in the class file
- pageinfo.resid = queryModuleHandle();
- pageinfo.dlgid = IDDLG_CREATION;
- //We need a pointer to our WPS-object in the dialog procedure
- //to call class functions
- pageinfo.pCreateParams = this;
- //The ID of the help panel for this page
- pageinfo.idDefaultHelpPanel = IDDLG_CDRECORDSETUP;
- //Tell the WPS the help library name
- pageinfo.pszHelpLibraryName = AFHELPLIBRARY;
- //We have a major tab so we need a name
- pageinfo.pszName = "Creation";
-
- //Insert the page into the settings notebook
- return wpInsertSettingsPage(hwndNotebook,&pageinfo);
- }*/
-
- void CWDataFolder::cwSetStatusText(PSZ pszText)
- {
- if(pszText)
- WinSetWindowText(WinWindowFromID(hwndStatusCntrl,IDST_STATUSTOTALTIME),pszText);
- else
- WinSetWindowText(WinWindowFromID(hwndStatusCntrl,IDST_STATUSTOTALTIME),chrStatusText);
- }
-
- ULONG CWDataFolder::cwQueryMkisofsFlags()
- {
- return ulMkisofsFlags;
- }
-
- ULONG CWDataFolder::cwSetMkisofsFlags(ULONG ulNewMkisofsFlags,ULONG ulMask)
- {
- ULONG rc;
-
- rc=cwQueryMkisofsFlags();
- ulMkisofsFlags=((ulNewMkisofsFlags&ulMask) | (~ulMask & ulMkisofsFlags));
-
- return rc;/* return previous flags */
- }
-
- LONG CWDataFolder::cwQueryPreviousStartSector()
- {
- return lPreviousStart;
- }
-
- LONG CWDataFolder::cwQueryNextStartSector()
- {
- return lNextStart;
- }
-
- void CWDataFolder::cwSetPreviousStartSector(LONG lSector)
- {
- lPreviousStart=lSector;
- }
-
- void CWDataFolder::cwSetNextStartSector(LONG lSector)
- {
- lNextStart=lSector;
- }
-
-
- ULONG CWDataFolder::cwQueryCDTypeFlags()
- {
- return ulCDTypeFlags;
- }
-
- ULONG CWDataFolder::cwSetCDTypeFlags(ULONG ulNewCDTypeFlags,ULONG ulMask)
- {
- ULONG rc;
-
- rc=cwQueryCDTypeFlags();
- ulCDTypeFlags=((ulNewCDTypeFlags&ulMask) | (~ulMask & ulCDTypeFlags));
-
- return rc;/* return previous flags */
- }
-
- void CWDataFolder::cwEnableMultiSessionCntrls(HWND hwnd, BOOL bEnable)
- {
- /* hwnd: Dialog-HWND
- nEnable: New enable state */
-
- WinEnableWindow(WinWindowFromID(hwnd,IDCB_FIRSTSESSION),bEnable);
- WinEnableWindow(WinWindowFromID(hwnd,IDCB_WRITERSOURCE),bEnable);
- WinEnableWindow(WinWindowFromID(hwnd,IDDD_SOURCEDRIVE),bEnable);
- WinEnableWindow(WinWindowFromID(hwnd,IDST_PREVIOUSINFO),bEnable);
- WinEnableWindow(WinWindowFromID(hwnd,IDST_SOURCEDRIVE),bEnable);
- WinEnableWindow(WinWindowFromID(hwnd,IDSB_PREVIOUSSTART),bEnable);
- WinEnableWindow(WinWindowFromID(hwnd,IDSB_NEXTSTART),bEnable);
- WinEnableWindow(WinWindowFromID(hwnd,IDPB_GETMSINFO),bEnable);
- bEnable?bEnable=FALSE:bEnable=TRUE;
- WinEnableWindow(WinWindowFromID(hwnd,IDRB_TRACKDATA),bEnable);
- WinEnableWindow(WinWindowFromID(hwnd,IDRB_TRACKMODE2),bEnable);
- WinEnableWindow(WinWindowFromID(hwnd,IDRB_TRACKXA1),bEnable);
- WinEnableWindow(WinWindowFromID(hwnd,IDRB_TRACKXA2),bEnable);
- WinEnableWindow(WinWindowFromID(hwnd,IDRB_TRACKCDI),bEnable);
- }
-
- ULONG CWDataFolder::cwQueryCreateFlags()
- {
- return ulCreateFlags;
- }
-
- ULONG CWDataFolder::cwSetCreateFlags(ULONG ulNewCreateFlags,ULONG ulMask)
- {
- ULONG rc;
-
- rc=cwQueryCreateFlags();
- ulCreateFlags=((ulNewCreateFlags&ulMask) | (~ulMask & ulCreateFlags));
-
- return rc;/* return previous flags */
- }
-
- void CWDataFolder::cwEnableWriteControls(BOOL bEnable)
- {
- if(!hwndMkisofsMain)
- return;
- WinEnableWindow(WinWindowFromID(hwndMkisofsMain,IDRB_WRITEIMAGE) ,bEnable);
- WinEnableWindow(WinWindowFromID(hwndMkisofsMain,IDRB_ONTHEFLY) ,bEnable);
- WinEnableWindow(WinWindowFromID(hwndMkisofsMain,IDRB_IMAGEONLY) ,bEnable);
- WinEnableWindow(WinWindowFromID(hwndMkisofsMain,IDPB_CREATE) ,bEnable);
- WinEnableWindow(WinWindowFromID(hwndMkisofsMain,IDPB_WRITECD) ,bEnable);
-
- }
-
- void CWDataFolder::cwWriteImage()
- {
- char * text;
-
- text=lnchParam;
-
- /* Get current filename from entryfield */
- WinQueryWindowText( WinWindowFromID(hwndImageName,IDEF_IMAGENAME),sizeof(chrImage),chrImage);
-
- /* Check if we have an output filename */
- if(strlen(chrImage)<=3) {
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, "You have to specify a valid filename.","Write image file.",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- return;
- }
- if(pvSharedMem) {
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,"There is an imagefile creation process running." ,"Write image file.",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- return;
- }
-
- /* Build cdrecord/2 cmd-line parameters */
- buildDataWriteParam(this, text);
-
- /* Check if we perform a dummy write */
- if(sDummy==1)
- strcat(text," -dummy");// Dummy write
- else
- if(WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, "Dummy is unchecked!\n Do you want to perform a real write?","Write CDR",
- 0UL, MB_YESNO | MB_ICONEXCLAMATION|MB_MOVEABLE )==MBID_NO)
- return;
-
- /* Add the imagefile name */
- strcat(text," ");
- strcat(text,chrImage);
-
- /* Start cdrecord */
- /* WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text,"void CWDataFolder::cwWriteImage()",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- return;*/
- sprintf(chrStatusText,"Writing image %s...",chrImage);
- _beginthread(imageWriteThreadFunc,NULL,8192*16,(void*)this); //Fehlerbehandlung fehlt
- }
-
-
- void changeBackslash(char* text)
- {
- char * chrPtr;
-
- chrPtr=strchr(text,'\\');
-
- while(chrPtr!=NULL) {
- *chrPtr='/';
- chrPtr=strchr(text,'\\');
- }
- }
-
- void CWDataFolder::cwWriteOnTheFly()
- {
- char *text;
- char *chrPtrParam;
- ULONG ulFlags;
-
- if(pvSharedMem) {
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,"There is already an imagefile creation process running. Currently there's \
- only one mkisofs process allowed." ,"Write on the fly",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- return;
- }
-
- ulFlags=cwQueryCDTypeFlags();
- if((ulFlags & IDCDT_MULTISESSION) && !(ulFlags & IDCDT_FIRSTSESSION)) {
- /* We are building the second image of a multisession disk */
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,"With this version of Data-CD-Creator it isn't possible \
- to write further sessions of a multisession CD on the fly." ,"Write on the fly",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- return;
- }
-
- if(DosAllocSharedMem(&pvSharedMem,"\\SHAREMEM\\MKISOFSCMDLINE",SHAREDMEM_SIZE,PAG_READ|PAG_WRITE|PAG_COMMIT)) {
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, "Can't allocate shared Mem!","Write on the fly",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- return;
- }
- memset(pvSharedMem,0,SHAREDMEM_SIZE);
- text= (char*)pvSharedMem;
-
- strcat(text,buildWrapName("spe t28 "));
- chrPtrParam=strrchr(text,' ');
-
- /* Add the mkisofs command */
- buildMkisofsParam(this, chrPtrParam,NULL);
-
- /* Add cdrecord command */
- strcat(text," | ");
- strcat(text,chrCDRecord);
- strcat(text," ");
- chrPtrParam=strrchr(text,' ');
- /* Add cdrecord options */
- buildDataWriteParam(this, chrPtrParam);
-
- /* Check if we perform a dummy write */
- if(sDummy==1)
- strcat(text," -dummy");// Dummy write
- else {
- if(WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, "Dummy is unchecked!\n Do you want to perform a real write?","Write CDR",
- 0UL, MB_YESNO | MB_ICONEXCLAMATION|MB_MOVEABLE )==MBID_NO) {
- DosFreeMem(pvSharedMem);
- pvSharedMem=NULL;
- return;
- }
- }
- /* Add the imagefile name */
- strcat(text," -");
-
- /* WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text,"void CWDataFolder::cwWriteOnTheFly()",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- */
-
- /* Change backslashs in parameters and sourcefiles */
- //changeBackslash(chrPtrParam);
- sprintf(chrStatusText,"Writing on the fly...");
- _beginthread(flyThreadFunc,NULL,8192*16,(void*)this); //Fehlerbehandlung fehlt
-
- //DosFreeMem(pvSharedMem);
- //pvSharedMem=NULL;
- return;
- }
-
- void CWDataFolder::cwCreateImage()
- {
-
- ULONG ulFlags;
- char filename[CCHMAXPATH];
- char * chrPtr;
- char * chrPtr2;
- ULONG ulSize;
- HWND hwnd;
- PMINIRECORDCORE mrc;
- WPObject * contentObject;
- LONG lValue1,lValue2;
- char *text;
- char *chrPtrParam;
-
- if(pvSharedMem) {
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,"There is already an imagefile creation process running." ,"Image file creation",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- return;
- }
-
- /* Get current filename from entryfield */
- WinQueryWindowText( WinWindowFromID(hwndImageName,IDEF_IMAGENAME),sizeof(chrImage),chrImage);
-
- /* Check if we have an output filename */
- if(strlen(chrImage)<=3) {
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, "You have to specify a valid filename including the path.",
- "Image file creation",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- return;
- }
- /* Check if we have a full path (just a quick check) */
- if(chrImage[1]!=':') {
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, "You have to specify a full path.","Image file creation",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- return;
- }
-
- if(DosAllocSharedMem(&pvSharedMem,"\\SHAREMEM\\MKISOFSCMDLINE",SHAREDMEM_SIZE,PAG_READ|PAG_WRITE|PAG_COMMIT)) {
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, "Can't allocate shared Mem!","Image file creation",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- return;
- }
- memset(pvSharedMem,0,SHAREDMEM_SIZE);
- text= (char*)pvSharedMem;
-
-
- buildMkisofsParam(this, text,chrImage);
- /* Change backslashs in parameters and sourcefiles */
- //chrPtrParam=strchr(text,' ');
- // changeBackslash(chrPtrParam);
- sprintf(chrStatusText,"Creating image %s...",chrImage);
- _beginthread(mkisofsThreadFunc,NULL,8192*16,(void*)this); //Fehlerbehandlung fehlt
-
- return;
-
-
-
-
- /**********************************/
-
- /* Build cmd-line for mkisofs */
- ulFlags=cwQueryMkisofsFlags();
- /* Path to mkisofs */
- sprintf(text,"%s ",chrMkisofs);
- chrPtrParam=strchr(text,0);
- /* Additional options */
- strncat(text,chrMkisofsOptions,sizeof(chrMkisofsOptions));
- /* Filename options */
- if(ulFlags & IDMK_ALLOW32CHARS)
- strncat(text," -l",4);
- if(ulFlags & IDMK_LEADINGPERIODS)
- strncat(text," -L",4);
- if(ulFlags & IDMK_JOLIET)
- strncat(text," -J",4);
- if(ulFlags & IDMK_ROCKRIDGE)
- strncat(text," -r",4);
- if(ulFlags & IDMK_TRANSTABLE)
- strncat(text," -T",4);
- // if(ulFlags & IDMK_LOGFILE)
- // strncat(text," -log-filemkisofs.log",sizeof(" -log-filemkisofs.log"));
- /* Add the autor-stuff */
- if(strlen(chrApplication)) {
- strncat(text," -A",strlen(" -A"));
- strncat(text,chrApplication,strlen(chrApplication));
- }
- if(strlen(chrPublisher)) {
- strncat(text," -P",strlen(" -P"));
- strncat(text,chrPublisher,strlen(chrPublisher));
- }
- if(strlen(chrPreparer)) {
- strncat(text," -p",strlen(" -p"));
- strncat(text,chrPreparer,strlen(chrPreparer));
- }
- /* if(strlen(chrCopyright)) {
- strncat(text," -copyright",strlen(" -copyright"));
- strncat(text,chrCopyright,strlen(chrCopyright));
- }*/
-
-
- ulFlags=cwQueryCDTypeFlags();
- if((ulFlags & IDCDT_MULTISESSION) && !(ulFlags & IDCDT_FIRSTSESSION)) {
- /* We are building the second image of a multisession disk */
- /* Check if we did some setup stuff on the ms-page. Caution! Isn't bullet proof! */
- if(!bMultiSessionDone) {
- sprintf(text,"You have to provide some information on the 'CD-type selection' page prior to the creating \
- of multisession CDs!");
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,
- text,
- "Imagefile creation error",
- 0UL, MB_OK | MB_ICONEXCLAMATION |MB_MOVEABLE);
- DosFreeMem(pvSharedMem);
- pvSharedMem=NULL;
- return;
- }
-
- /* Check if we have the necessary sectornumbers */
- lValue1=cwQueryPreviousStartSector();
- lValue2=cwQueryNextStartSector();
- if(lValue1==lValue2) {
- sprintf(text,"Need sector information of previous session. Go to the 'CD-type selection' page in \
- the settings notebook to supply it.");
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,
- text,
- "Imagefile creation error",
- 0UL, MB_OK | MB_ICONEXCLAMATION |MB_MOVEABLE);
- DosFreeMem(pvSharedMem);
- pvSharedMem=NULL;
- return;
- }
- sprintf(filename," -C%d,%d",lValue1,lValue2);
- strncat(text,filename,strlen(filename));
-
- /* Check if we have a source drive for previous image */
- strncat(text," -M",4);
- if(ulFlags & IDCDT_USEWRITER) {
- /* We use the writer as source. Check if 'dev=x,y,z' is given as cdrecord options */
- chrPtr=strstr(chrCDROptions,"dev=");
- if(NULL==chrPtr) {
- sprintf(text,"There is no device given as a CD-writer . Go to the 'CD-type selection' page in \
- the settings notebook to chose a drive letter instead or go to the 'CDRecord/2' page to include a 'dev=x,y,z'-\
- statement in the options entryfield.");
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,
- text,
- "Imagefile creation error",
- 0UL, MB_OK | MB_ICONEXCLAMATION |MB_MOVEABLE);
- DosFreeMem(pvSharedMem);
- pvSharedMem=NULL;
- return;
- }
- /* Find '=' in 'dev=...' statement */
- // chrPtr=strstr(chrCDROptions,"=");
- //chrPtr++;/* Get address of value for dev=... */
- /* Find end of 'dev=...' statement */
- chrPtr2=chrPtr;
- while(*chrPtr2!=' '&& *chrPtr2!=0)
- chrPtr2++;
- filename[0]=*chrPtr2;
- *chrPtr2=0;
- chrPtr=chrPtr2;
- /* Find begin of traget,lun */
- chrPtr-=3;
- /* Add dev=... statement to cmd-line */
- strncat(text,chrPtr,strlen(chrPtr));
- *chrPtr2=filename[0];
- }/* if(ulFlags & IDCDT_USEWRITER) */
- else {
- /* We use a drive letter as source drive */
- strncat(text,chosenMultiSessionCD,sizeof(chosenMultiSessionCD));
- }
- /* We have all information. Build the rest of the cmd-line */
- }/* end of if((ulFlags & IDCDT_MULTISESSION) && !(ulFlags & IDCDT_FIRSTSESSION)) */
- else {
-
- }
- /* Name of output file */
- strncat(text," -o",4);
- strncat(text,chrImage,sizeof(chrImage));
- /*****************************/
- /* Query input files/folders */
- /*****************************/
- strncat(text," ",2);
- ulSize=sizeof(filename);
- /* Query name of this folder */
- if(!wpQueryRealName(filename,&ulSize,TRUE)) {
- sprintf(text,"Error while quering the foldername!");
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text,"Image file creation",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- DosFreeMem(pvSharedMem);
- pvSharedMem=NULL;
- return;/* There's an error */
- }
- strncat(text,filename,ulSize);
-
- hwnd=WinQueryWindow(hwndMkisofsMain,QW_PARENT); // Get folder HWND
- /* Get hwnd of folder container */
- hwnd=WinWindowFromID(hwnd,FID_CLIENT);
- if(!WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP),hwnd)) {
- sprintf(text,"Error while quering the container HWND!");
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text,"void CWDataFolder::cwCreateImage()",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- DosFreeMem(pvSharedMem);
- pvSharedMem=NULL;
- return;
- }
- mrc=(PMINIRECORDCORE)WinSendMsg(hwnd,CM_QUERYRECORD,NULL,
- MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));
- if(!mrc){
- sprintf(text,"Error! The folder is empty!");
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text,"Image file creation",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- DosFreeMem(pvSharedMem);
- pvSharedMem=NULL;
- return;
- }
-
- /* Enumerate folder contents. We only use filesystem objects. If we find a shadow we follow
- the link and use the linked object if it's a filesystem object */
- while(mrc) {
- /* Get wps-object-ptr. from container item */
- contentObject=(WPObject*)OBJECT_FROM_PREC(mrc);//Get object
- if(contentObject) {
- /* Check if it's a shadow */
- if(somResolveByName(contentObject,"wpQueryShadowedObject"))
- /* Yes, it's a shadow. Get file system object or NULL */
- contentObject=cwGetFileSystemObject(contentObject);
- else
- /* It's no shadow, so do nothing. If it's a filesystem object it's included in our list
- because we yet provide this folder as input directory. If it's any other object (abstract)
- mkisofs will skip it because it uses the filesystem for querying directory contents. */
- contentObject=NULL;
- }
- if(contentObject){
- /* It's a file system object */
- strncat(text," ",2);
- /* Check if it's folder */
- if(somResolveByName(contentObject,"wpQueryContent")) {
- /* It's a folder. Query the name. */
- ulSize=sizeof(filename);
- ((WPFileSystem*)contentObject)->wpQueryRealName(filename,&ulSize,FALSE);
- /* Add the graft point to the command line. If not done, mkisofs will include the contents of
- of the folder in the image, not the folder itself */
- if((strlen(text)+strlen(filename)+2)>=SHAREDMEM_SIZE) {
- sprintf(text,"Error! The length of the cmd-line exceeds %d Bytes!!\n",SHAREDMEM_SIZE);
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text,"Image file creation",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- DosFreeMem(pvSharedMem);
- pvSharedMem=NULL;
- return;
- }
- strncat(text,filename,ulSize);
- strncat(text,"/=",2);
- }
- /* Query the full path */
- ulSize=sizeof(filename);
- ((WPFileSystem*)contentObject)->wpQueryRealName(filename,&ulSize,TRUE);
- /* Add the name to the command line */
- if((strlen(text)+strlen(filename)+2)>=SHAREDMEM_SIZE) {
- sprintf(text,"Error! The length of the cmd-line exceeds %d Bytes!!\n",SHAREDMEM_SIZE);
- WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text,"Image file creation",
- 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
- DosFreeMem(pvSharedMem);
- pvSharedMem=NULL;
- return;
- }
- strncat(text,filename,ulSize);
- }/* end of if(contentObject) */
- /* Get next container item */
- mrc=(PMINIRECORDCORE)WinSendMsg(hwnd,CM_QUERYRECORD,MPFROMP(mrc),
- MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
- }// end of while(mrc)
-
- /* Change backslashs in parameters and sourcefiles */
- changeBackslash(chrPtrParam);
-
- /* start mkisofs here: */
- // WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text,"void CWDataFolder::cwCreateImage()",
- // 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
-
-
- _beginthread(mkisofsThreadFunc,NULL,8192*16,(void*)this); //Fehlerbehandlung fehlt
- // DosFreeMem(pvSharedMem);
- // pvSharedMem=NULL;
- }
-
-
-