2007-03-27 17:47:10 +00:00
|
|
|
/*
|
|
|
|
* CiderPress
|
|
|
|
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
|
|
|
|
* See the file LICENSE for distribution terms.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Main frame window declarations.
|
|
|
|
*/
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
#ifndef MDC_MAIN_H
|
|
|
|
#define MDC_MAIN_H
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
#include "../diskimg/DiskImg.h"
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
#include "../nufxlib/NufxLib.h"
|
2007-03-27 17:47:10 +00:00
|
|
|
using namespace DiskImgLib;
|
|
|
|
|
|
|
|
struct Win32dirent;
|
|
|
|
struct ScanOpts;
|
|
|
|
|
|
|
|
typedef enum RecordKind {
|
2014-11-04 00:26:53 +00:00
|
|
|
kRecordKindUnknown = 0,
|
|
|
|
kRecordKindDisk,
|
|
|
|
kRecordKindFile,
|
|
|
|
kRecordKindForkedFile,
|
|
|
|
kRecordKindDirectory,
|
|
|
|
kRecordKindVolumeDir,
|
2007-03-27 17:47:10 +00:00
|
|
|
} RecordKind;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The main UI window.
|
|
|
|
*/
|
|
|
|
class MainWindow : public CFrameWnd {
|
|
|
|
public:
|
2014-11-25 22:34:14 +00:00
|
|
|
/*
|
|
|
|
* MainWindow constructor. Creates the main window and sets
|
|
|
|
* its properties.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
MainWindow(void);
|
2014-11-25 22:34:14 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* MainWindow destructor. Close the archive if one is open, but don't try
|
|
|
|
* to shut down any controls in child windows. By this point, Windows has
|
|
|
|
* already snuffed them.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
~MainWindow(void);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
private:
|
2014-11-04 00:26:53 +00:00
|
|
|
afx_msg void OnFileScan(void);
|
|
|
|
afx_msg void OnFileExit(void);
|
|
|
|
afx_msg void OnHelpWebSite(void);
|
|
|
|
afx_msg void OnHelpAbout(void);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
/*
|
|
|
|
* Allow events to flow through the message queue whenever the
|
|
|
|
* progress meter gets updated. This will allow us to redraw with
|
|
|
|
* reasonable frequency.
|
|
|
|
*
|
|
|
|
* Calling this can result in other code being called, such as Windows
|
|
|
|
* message handlers, which can lead to reentrancy problems. Make sure
|
|
|
|
* you're adequately semaphored before calling here.
|
|
|
|
*
|
|
|
|
* Returns TRUE if all is well, FALSE if we're trying to quit.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
BOOL PeekAndPump(void);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
/*
|
|
|
|
* Handle a debug message from the DiskImg library.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
static void DebugMsgHandler(const char* file, int line,
|
|
|
|
const char* msg);
|
|
|
|
static NuResult NufxErrorMsgHandler(NuArchive* /*pArchive*/,
|
|
|
|
void* vErrorMessage);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
/*
|
2014-12-02 06:07:39 +00:00
|
|
|
* Prompts the user to select the input set and output file, then starts
|
|
|
|
* the scan.
|
2014-11-25 22:34:14 +00:00
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
void ScanFiles(void);
|
2014-11-25 22:34:14 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Prepare a directory for reading.
|
|
|
|
*
|
|
|
|
* Allocates a Win32dirent struct that must be freed by the caller.
|
|
|
|
*/
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
Win32dirent* OpenDir(const WCHAR* name);
|
2014-11-25 22:34:14 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get an entry from an open directory.
|
|
|
|
*
|
|
|
|
* Returns a NULL pointer after the last entry has been read.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
Win32dirent* ReadDir(Win32dirent* dir);
|
2014-11-25 22:34:14 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Close a directory.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
void CloseDir(Win32dirent* dir);
|
2014-11-25 22:34:14 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Process a file or directory. These are expected to be names of files in
|
|
|
|
* the current directory.
|
|
|
|
*
|
|
|
|
* Returns 0 on success, nonzero on error with a message in "*pErrMsg".
|
|
|
|
*/
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
int Process(const WCHAR* pathname, ScanOpts* pScanOpts,
|
2014-11-04 00:26:53 +00:00
|
|
|
CString* pErrMsg);
|
2014-11-25 22:34:14 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Win32 recursive directory descent. Scan the contents of a directory.
|
|
|
|
* If a subdirectory is found, follow it; otherwise, call Win32AddFile to
|
|
|
|
* add the file.
|
|
|
|
*/
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
int ProcessDirectory(const WCHAR* dirName, ScanOpts* pScanOpts,
|
2014-11-04 00:26:53 +00:00
|
|
|
CString* pErrMsg);
|
2014-11-25 22:34:14 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Open a disk image and dump the contents.
|
|
|
|
*
|
|
|
|
* Returns 0 on success, nonzero on failure.
|
|
|
|
*/
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
int ScanDiskImage(const WCHAR* pathName, ScanOpts* pScanOpts);
|
2014-11-25 22:34:14 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Analyze a file's characteristics.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
void AnalyzeFile(const A2File* pFile, RecordKind* pRecordKind,
|
|
|
|
LONGLONG* pTotalLen, LONGLONG* pTotalCompLen);
|
2014-11-25 22:34:14 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Determine whether the access bits on the record make it a read-only
|
|
|
|
* file or not.
|
|
|
|
*
|
|
|
|
* Uses a simplified view of the access flags.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
bool IsRecordReadOnly(int access);
|
2014-11-25 22:34:14 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Return a pointer to the three-letter representation of the file type name.
|
|
|
|
*
|
|
|
|
* Note to self: code down below tests first char for '?'.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
static const char* GetFileTypeString(unsigned long fileType);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
/*
|
|
|
|
* Load the contents of a DiskFS.
|
|
|
|
*
|
|
|
|
* Recursively handle sub-volumes.
|
|
|
|
*/
|
|
|
|
int LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
|
|
|
|
ScanOpts* pScanOpts);
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
bool fCancelFlag;
|
|
|
|
//int fTitleAnimation;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
DECLARE_MESSAGE_MAP()
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
#endif /*MDC_MAIN_H*/
|