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 window management.
|
|
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "Main.h"
|
|
|
|
#include "mdc.h"
|
|
|
|
#include "AboutDlg.h"
|
|
|
|
#include "ProgressDlg.h"
|
|
|
|
#include "resource.h"
|
|
|
|
#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 "../zlib/zlib.h"
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-12-02 06:07:39 +00:00
|
|
|
const WCHAR* kWebSiteURL = L"http://www.a2ciderpress.com/";
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(MainWindow, CFrameWnd)
|
2014-11-04 00:26:53 +00:00
|
|
|
ON_COMMAND(IDM_FILE_SCAN, OnFileScan)
|
|
|
|
ON_COMMAND(IDM_FILE_EXIT, OnFileExit)
|
|
|
|
ON_COMMAND(IDM_HELP_WEBSITE, OnHelpWebSite)
|
|
|
|
ON_COMMAND(IDM_HELP_ABOUT, OnHelpAbout)
|
2007-03-27 17:47:10 +00:00
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow()
|
|
|
|
{
|
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
|
|
|
static const WCHAR* kAppName = L"MDC";
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
CString wndClass = AfxRegisterWndClass(
|
|
|
|
CS_DBLCLKS /*| CS_HREDRAW | CS_VREDRAW*/,
|
|
|
|
gMyApp.LoadStandardCursor(IDC_ARROW),
|
|
|
|
(HBRUSH) (COLOR_WINDOW + 1),
|
|
|
|
gMyApp.LoadIcon(IDI_MDC) );
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
Create(wndClass, kAppName, WS_OVERLAPPEDWINDOW /*| WS_CLIPCHILDREN*/,
|
|
|
|
rectDefault, NULL, MAKEINTRESOURCE(IDC_MDC));
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
LoadAccelTable(MAKEINTRESOURCE(IDC_MDC));
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
// initialize some OLE garbage
|
|
|
|
//AfxOleInit();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
// required by MFC if Rich Edit controls are used
|
|
|
|
//AfxInitRichEdit();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::Global::SetDebugMsgHandler(DebugMsgHandler);
|
|
|
|
DiskImgLib::Global::AppInit();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
NuSetGlobalErrorMessageHandler(NufxErrorMsgHandler);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
//fTitleAnimation = 0;
|
|
|
|
fCancelFlag = false;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::Global::AppCleanup();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
void MainWindow::OnFileExit(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-25 22:34:14 +00:00
|
|
|
// Handle Exit item by sending a close request.
|
2014-11-04 00:26:53 +00:00
|
|
|
SendMessage(WM_CLOSE, 0, 0);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
void MainWindow::OnHelpWebSite(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-12-02 06:07:39 +00:00
|
|
|
// Go to the CiderPress web site.
|
2014-11-04 00:26:53 +00:00
|
|
|
int err;
|
|
|
|
|
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
|
|
|
err = (int) ::ShellExecute(m_hWnd, L"open", kWebSiteURL, NULL, NULL,
|
2014-11-04 00:26:53 +00:00
|
|
|
SW_SHOWNORMAL);
|
|
|
|
if (err <= 32) {
|
|
|
|
CString msg;
|
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
|
|
|
msg.Format(L"Unable to launch web browser (err=%d).", err);
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(this, msg, IDS_FAILED);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
void MainWindow::OnHelpAbout(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
int result;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
AboutDlg dlg(this);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
result = dlg.DoModal();
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("HelpAbout returned %d", result);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
void MainWindow::OnFileScan(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (0) {
|
|
|
|
CString msg;
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&msg, IDS_MUST_REGISTER);
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(this, msg, IDS_APP_TITLE);
|
|
|
|
} else {
|
|
|
|
ScanFiles();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
BOOL MainWindow::PeekAndPump(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
MSG msg;
|
|
|
|
|
|
|
|
while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
|
|
|
|
if (!AfxGetApp()->PumpMessage()) {
|
|
|
|
::PostQuitMessage(0);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG lIdle = 0;
|
|
|
|
while (AfxGetApp()->OnIdle(lIdle++))
|
|
|
|
;
|
|
|
|
return TRUE;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========================================================================
|
2014-11-04 00:26:53 +00:00
|
|
|
* Disk image processing
|
2007-03-27 17:47:10 +00:00
|
|
|
* ==========================================================================
|
|
|
|
*/
|
|
|
|
|
2014-12-02 06:07:39 +00:00
|
|
|
/*static*/ void MainWindow::DebugMsgHandler(const char* file, int line,
|
|
|
|
const char* msg)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(file != NULL);
|
|
|
|
ASSERT(msg != NULL);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 01:54:34 +00:00
|
|
|
LOG_BASE(DebugLog::LOG_INFO, file, line, "<diskimg> %hs", msg);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-18 01:54:34 +00:00
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
/*static*/ NuResult MainWindow::NufxErrorMsgHandler(NuArchive* /*pArchive*/,
|
|
|
|
void* vErrorMessage)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
const NuErrorMessage* pErrorMessage = (const NuErrorMessage*) vErrorMessage;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-19 22:54:24 +00:00
|
|
|
LOG_BASE(pErrorMessage->isDebug ? DebugLog::LOG_DEBUG : DebugLog::LOG_WARN,
|
2014-11-18 21:05:15 +00:00
|
|
|
pErrorMessage->file, pErrorMessage->line, "<nufxlib> %hs",
|
2014-11-18 01:54:34 +00:00
|
|
|
pErrorMessage->message);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
return kNuOK;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-12-02 06:07:39 +00:00
|
|
|
|
2007-03-27 17:47:10 +00:00
|
|
|
const int kLocalFssep = '\\';
|
|
|
|
|
2014-12-02 06:07:39 +00:00
|
|
|
struct ScanOpts {
|
2014-11-04 00:26:53 +00:00
|
|
|
FILE* outfp;
|
|
|
|
ProgressDlg* pProgress;
|
2014-12-02 06:07:39 +00:00
|
|
|
};
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
void MainWindow::ScanFiles(void)
|
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
|
|
|
WCHAR curDir[MAX_PATH] = L"";
|
2014-12-02 06:07:39 +00:00
|
|
|
CString errMsg, newDir;
|
2014-11-04 00:26:53 +00:00
|
|
|
bool doResetDir = false;
|
2014-12-02 06:07:39 +00:00
|
|
|
ScanOpts scanOpts;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
memset(&scanOpts, 0, sizeof(scanOpts));
|
|
|
|
|
2014-12-02 06:07:39 +00:00
|
|
|
// choose input files
|
2014-12-04 00:10:03 +00:00
|
|
|
SelectFilesDialog chooseFiles(L"IDD_CHOOSE_FILES", false, this);
|
2014-12-02 06:07:39 +00:00
|
|
|
chooseFiles.SetWindowTitle(L"Choose Files...");
|
|
|
|
INT_PTR retval = chooseFiles.DoModal();
|
|
|
|
if (retval != IDOK) {
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
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
|
|
|
}
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-12-02 06:07:39 +00:00
|
|
|
// choose output file; use an Explorer-style dialog for consistency
|
|
|
|
CString outPath;
|
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
|
|
|
CFileDialog dlg(FALSE, L"txt", NULL,
|
2014-11-04 00:26:53 +00:00
|
|
|
OFN_OVERWRITEPROMPT|OFN_NOREADONLYRETURN,
|
2014-12-02 06:07:39 +00:00
|
|
|
L"Text Files (*.txt)|*.txt|All Files (*.*)|*.*||", this,
|
|
|
|
0, FALSE /*disable Vista style*/);
|
2014-11-04 00:26:53 +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
|
|
|
dlg.m_ofn.lpstrTitle = L"Save Output As...";
|
|
|
|
wcscpy(dlg.m_ofn.lpstrFile, L"mdc-out.txt");
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (dlg.DoModal() != IDOK) {
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
outPath = dlg.GetPathName();
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("NEW FILE '%ls'", (LPCWSTR) outPath);
|
2014-11-04 00:26:53 +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
|
|
|
scanOpts.outfp = _wfopen(outPath, L"w");
|
2014-11-18 05:13:13 +00:00
|
|
|
if (scanOpts.outfp == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(this, "Unable to open output file", IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
2015-01-04 19:29:51 +00:00
|
|
|
int32_t major, minor, bug;
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::Global::GetVersion(&major, &minor, &bug);
|
|
|
|
fprintf(scanOpts.outfp, "MDC for Windows v%d.%d.%d (DiskImg library v%ld.%ld.%ld)\n",
|
|
|
|
kAppMajorVersion, kAppMinorVersion, kAppBugVersion,
|
|
|
|
major, minor, bug);
|
|
|
|
fprintf(scanOpts.outfp,
|
2014-12-02 06:07:39 +00:00
|
|
|
"Copyright (C) 2014 by faddenSoft, LLC. All rights reserved.\n");
|
2014-11-04 00:26:53 +00:00
|
|
|
fprintf(scanOpts.outfp,
|
2014-12-02 06:07:39 +00:00
|
|
|
"MDC is part of CiderPress, available from http://www.a2ciderpress.com/.\n");
|
2014-11-04 00:26:53 +00:00
|
|
|
NuGetVersion(&major, &minor, &bug, NULL, NULL);
|
|
|
|
fprintf(scanOpts.outfp,
|
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
|
|
|
"Linked against NufxLib v%ld.%ld.%ld and zlib v%hs\n",
|
2014-11-04 00:26:53 +00:00
|
|
|
major, minor, bug, zlibVersion());
|
|
|
|
fprintf(scanOpts.outfp, "\n");
|
|
|
|
|
|
|
|
/* change to base directory */
|
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
|
|
|
if (GetCurrentDirectory(NELEM(curDir), curDir) == 0) {
|
|
|
|
errMsg = L"Unable to get current directory.";
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
2014-12-02 06:07:39 +00:00
|
|
|
newDir = chooseFiles.GetDirectory();
|
|
|
|
if (SetCurrentDirectory(newDir) == false) {
|
|
|
|
errMsg.Format(L"Unable to change current directory to '%ls'.",
|
|
|
|
(LPCWSTR) newDir);
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
doResetDir = true;
|
|
|
|
|
|
|
|
time_t now;
|
2014-11-18 05:13:13 +00:00
|
|
|
now = time(NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
fprintf(scanOpts.outfp,
|
2014-12-03 01:55:19 +00:00
|
|
|
"Run started at %.24hs in '%ls'\n\n", ctime(&now), (LPCWSTR) newDir);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* obstruct input to the main window */
|
|
|
|
EnableWindow(FALSE);
|
|
|
|
|
|
|
|
|
|
|
|
/* create a modeless dialog with a cancel button */
|
|
|
|
scanOpts.pProgress = new ProgressDlg;
|
2014-11-18 05:13:13 +00:00
|
|
|
if (scanOpts.pProgress == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
scanOpts.pProgress->fpCancelFlag = &fCancelFlag;
|
|
|
|
fCancelFlag = false;
|
|
|
|
if (scanOpts.pProgress->Create(this) == FALSE) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("WARNING: ProgressDlg init failed");
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(false);
|
|
|
|
} else {
|
|
|
|
scanOpts.pProgress->CenterWindow(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
time_t start, end;
|
2014-11-18 05:13:13 +00:00
|
|
|
start = time(NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* start cranking */
|
2014-12-02 06:07:39 +00:00
|
|
|
const CStringArray& arr = chooseFiles.GetFileNames();
|
|
|
|
for (int i = 0; i < arr.GetCount(); i++) {
|
|
|
|
const CString& name = arr.GetAt(i);
|
|
|
|
if (Process(name, &scanOpts, &errMsg) != 0) {
|
|
|
|
LOGI("Skipping '%ls': %ls.", (LPCWSTR) name, (LPCWSTR) errMsg);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fCancelFlag) {
|
2014-12-02 06:07:39 +00:00
|
|
|
LOGI("Canceled by user");
|
|
|
|
MessageBox(L"Canceled!", L"MDC", MB_OK);
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
}
|
2014-11-18 05:13:13 +00:00
|
|
|
end = time(NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
fprintf(scanOpts.outfp, "\nScan completed in %ld seconds.\n",
|
2014-11-19 22:54:24 +00:00
|
|
|
(long) (end - start));
|
2014-11-04 00:26:53 +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
|
|
|
SetWindowText(L"MDC Done!");
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-12-02 06:07:39 +00:00
|
|
|
CString doneMsg = L"Processing completed.";
|
2014-11-04 00:26:53 +00:00
|
|
|
CString appName;
|
|
|
|
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&appName, IDS_APP_TITLE);
|
2014-11-04 00:26:53 +00:00
|
|
|
scanOpts.pProgress->MessageBox(doneMsg, appName, MB_OK|MB_ICONINFORMATION);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
bail:
|
2014-11-18 05:13:13 +00:00
|
|
|
if (scanOpts.outfp != NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
fclose(scanOpts.outfp);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (doResetDir && SetCurrentDirectory(curDir) == false) {
|
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
|
|
|
errMsg.Format(L"Unable to reset current directory to '%ls'.\n", curDir);
|
2014-11-04 00:26:53 +00:00
|
|
|
ShowFailureMsg(this, errMsg, IDS_FAILED);
|
|
|
|
// bummer
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
// restore the main window
|
|
|
|
EnableWindow(TRUE);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (scanOpts.pProgress != NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
scanOpts.pProgress->DestroyWindow();
|
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
|
|
|
SetWindowText(L"MDC");
|
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
|
|
|
* Directory structure and functions, modified from zDIR in Info-Zip sources.
|
2007-03-27 17:47:10 +00:00
|
|
|
*/
|
|
|
|
typedef struct Win32dirent {
|
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
|
|
|
DWORD d_attr;
|
|
|
|
WCHAR d_name[MAX_PATH];
|
2014-11-04 00:26:53 +00:00
|
|
|
int d_first;
|
|
|
|
HANDLE d_hFindFile;
|
2007-03-27 17:47:10 +00:00
|
|
|
} Win32dirent;
|
|
|
|
|
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
|
|
|
static const WCHAR kWildMatchAll[] = L"*.*";
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
Win32dirent* MainWindow::OpenDir(const WCHAR* name)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
Win32dirent* dir = NULL;
|
|
|
|
WCHAR* tmpStr = NULL;
|
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
|
|
|
WCHAR* cp;
|
2014-11-04 00:26:53 +00:00
|
|
|
WIN32_FIND_DATA fnd;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
dir = (Win32dirent*) malloc(sizeof(*dir));
|
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
|
|
|
tmpStr = (WCHAR*) malloc((wcslen(name) + wcslen(kWildMatchAll) + 2)
|
|
|
|
* sizeof(WCHAR));
|
2014-11-18 05:13:13 +00:00
|
|
|
if (dir == NULL || tmpStr == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
goto failed;
|
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
|
|
|
wcscpy(tmpStr, name);
|
|
|
|
cp = tmpStr + wcslen(tmpStr);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
/* don't end in a colon (e.g. "C:") */
|
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
|
|
|
if ((cp - tmpStr) > 0 && wcsrchr(tmpStr, ':') == (cp - 1))
|
2014-11-04 00:26:53 +00:00
|
|
|
*cp++ = '.';
|
|
|
|
/* must end in a slash */
|
|
|
|
if ((cp - tmpStr) > 0 &&
|
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
|
|
|
wcsrchr(tmpStr, kLocalFssep) != (cp - 1))
|
2014-11-04 00:26:53 +00:00
|
|
|
*cp++ = kLocalFssep;
|
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
|
|
|
wcscpy(cp, kWildMatchAll);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
dir->d_hFindFile = FindFirstFile(tmpStr, &fnd);
|
|
|
|
if (dir->d_hFindFile == INVALID_HANDLE_VALUE)
|
|
|
|
goto failed;
|
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
|
|
|
wcscpy(dir->d_name, fnd.cFileName);
|
|
|
|
dir->d_attr = fnd.dwFileAttributes;
|
2014-11-04 00:26:53 +00:00
|
|
|
dir->d_first = 1;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
bail:
|
2014-11-04 00:26:53 +00:00
|
|
|
free(tmpStr);
|
|
|
|
return dir;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
failed:
|
2014-11-04 00:26:53 +00:00
|
|
|
free(dir);
|
2014-11-18 05:13:13 +00:00
|
|
|
dir = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
Win32dirent* MainWindow::ReadDir(Win32dirent* dir)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (dir->d_first)
|
|
|
|
dir->d_first = 0;
|
|
|
|
else {
|
|
|
|
WIN32_FIND_DATA fnd;
|
|
|
|
|
|
|
|
if (!FindNextFile(dir->d_hFindFile, &fnd))
|
2014-11-18 05:13:13 +00:00
|
|
|
return NULL;
|
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
|
|
|
wcscpy(dir->d_name, fnd.cFileName);
|
2014-11-04 00:26:53 +00:00
|
|
|
dir->d_attr = (unsigned char) fnd.dwFileAttributes;
|
|
|
|
}
|
|
|
|
|
|
|
|
return dir;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
void MainWindow::CloseDir(Win32dirent* dir)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
if (dir == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
FindClose(dir->d_hFindFile);
|
|
|
|
free(dir);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
int MainWindow::Process(const WCHAR* pathname, ScanOpts* pScanOpts,
|
2014-11-04 00:26:53 +00:00
|
|
|
CString* pErrMsg)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
bool exists, isDir, isReadable;
|
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
|
|
|
struct _stat sb;
|
2014-11-04 00:26:53 +00:00
|
|
|
int result = -1;
|
|
|
|
|
|
|
|
if (fCancelFlag)
|
|
|
|
return -1;
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pathname != NULL);
|
|
|
|
ASSERT(pErrMsg != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
PathName checkPath(pathname);
|
|
|
|
int ierr = checkPath.CheckFileStatus(&sb, &exists, &isReadable, &isDir);
|
|
|
|
if (ierr != 0) {
|
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
|
|
|
pErrMsg->Format(L"Unexpected error while examining '%ls': %hs", pathname,
|
2014-11-04 00:26:53 +00:00
|
|
|
strerror(ierr));
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!exists) {
|
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
|
|
|
pErrMsg->Format(L"Couldn't find '%ls'", pathname);
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
if (!isReadable) {
|
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
|
|
|
pErrMsg->Format(L"File '%ls' isn't readable", pathname);
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
if (isDir) {
|
|
|
|
result = ProcessDirectory(pathname, pScanOpts, pErrMsg);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
(void) ScanDiskImage(pathname, pScanOpts);
|
|
|
|
|
|
|
|
result = 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
bail:
|
2014-11-04 00:26:53 +00:00
|
|
|
if (result != 0 && pErrMsg->IsEmpty()) {
|
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
|
|
|
pErrMsg->Format(L"Unable to add file '%ls'", pathname);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
return result;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
int MainWindow::ProcessDirectory(const WCHAR* dirName, ScanOpts* pScanOpts,
|
2014-11-04 00:26:53 +00:00
|
|
|
CString* pErrMsg)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
Win32dirent* dirp = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
Win32dirent* entry;
|
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
|
|
|
WCHAR nbuf[MAX_PATH]; /* malloc might be better; this soaks stack */
|
|
|
|
WCHAR fssep;
|
2014-11-04 00:26:53 +00:00
|
|
|
int len;
|
|
|
|
int result = -1;
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(dirName != NULL);
|
|
|
|
ASSERT(pErrMsg != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("+++ DESCEND: '%ls'", (LPCWSTR) dirName);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
dirp = OpenDir(dirName);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (dirp == NULL) {
|
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
|
|
|
pErrMsg->Format(L"Failed on '%ls': %hs", dirName, strerror(errno));
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
fssep = kLocalFssep;
|
|
|
|
|
|
|
|
/* could use readdir_r, but we don't care about reentrancy here */
|
2014-11-18 05:13:13 +00:00
|
|
|
while ((entry = ReadDir(dirp)) != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
/* skip the dotsies */
|
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
|
|
|
if (wcscmp(entry->d_name, L".") == 0 || wcscmp(entry->d_name, L"..") == 0)
|
2014-11-04 00:26:53 +00:00
|
|
|
continue;
|
|
|
|
|
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
|
|
|
len = wcslen(dirName);
|
|
|
|
if (len + wcslen(entry->d_name) + 2 > MAX_PATH) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGE("ERROR: Filename exceeds %d bytes: %ls%c%ls",
|
2014-11-04 00:26:53 +00:00
|
|
|
MAX_PATH, dirName, fssep, entry->d_name);
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* form the new name, inserting an fssep if needed */
|
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
|
|
|
wcscpy(nbuf, dirName);
|
|
|
|
if (dirName[len - 1] != fssep) {
|
2014-11-04 00:26:53 +00:00
|
|
|
nbuf[len++] = fssep;
|
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
|
|
|
}
|
|
|
|
wcscpy(nbuf+len, entry->d_name);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
result = Process(nbuf, pScanOpts, pErrMsg);
|
|
|
|
if (result != 0)
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
result = 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
bail:
|
2014-11-18 05:13:13 +00:00
|
|
|
if (dirp != NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
(void)CloseDir(dirp);
|
|
|
|
return result;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
int MainWindow::ScanDiskImage(const WCHAR* pathName, ScanOpts* pScanOpts)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pathName != NULL);
|
|
|
|
ASSERT(pScanOpts != NULL);
|
|
|
|
ASSERT(pScanOpts->outfp != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
DIError dierr;
|
|
|
|
CString errMsg;
|
|
|
|
DiskImg diskImg;
|
2014-11-18 05:13:13 +00:00
|
|
|
DiskFS* pDiskFS = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
PathName path(pathName);
|
|
|
|
CString ext = path.GetExtension();
|
|
|
|
|
|
|
|
/* first, some housekeeping */
|
|
|
|
PeekAndPump();
|
|
|
|
pScanOpts->pProgress->SetCurrentFile(pathName);
|
|
|
|
if (fCancelFlag)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
CString title;
|
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
|
|
|
title = L"MDC ";
|
|
|
|
title += PathName::FilenameOnly(pathName, '\\');
|
2014-11-04 00:26:53 +00:00
|
|
|
SetWindowText(title);
|
|
|
|
|
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
|
|
|
fprintf(pScanOpts->outfp, "File: %ls\n", pathName);
|
2014-11-04 00:26:53 +00:00
|
|
|
fflush(pScanOpts->outfp); // in case we crash
|
|
|
|
|
|
|
|
if (!ext.IsEmpty()) {
|
|
|
|
/* delete the leading '.' */
|
|
|
|
ext.Delete(0, 1);
|
|
|
|
}
|
|
|
|
|
2014-11-24 20:56:19 +00:00
|
|
|
CStringA pathNameA(pathName);
|
|
|
|
dierr = diskImg.OpenImage(pathNameA, '\\', true);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (dierr != kDIErrNone) {
|
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
|
|
|
errMsg.Format(L"Unable to open '%ls': %hs", pathName,
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
dierr = diskImg.AnalyzeImage();
|
|
|
|
if (dierr != kDIErrNone) {
|
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
|
|
|
errMsg.Format(L"Analysis of '%ls' failed: %hs", pathName,
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (diskImg.GetFSFormat() == DiskImg::kFormatUnknown ||
|
|
|
|
diskImg.GetSectorOrder() == DiskImg::kSectorOrderUnknown)
|
|
|
|
{
|
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
|
|
|
errMsg.Format(L"Unable to identify filesystem on '%ls'", pathName);
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create an appropriate DiskFS object */
|
|
|
|
pDiskFS = diskImg.OpenAppropriateDiskFS();
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pDiskFS == NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
/* unknown FS should've been caught above! */
|
|
|
|
ASSERT(false);
|
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
|
|
|
errMsg.Format(L"Format of '%ls' not recognized.", pathName);
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
pDiskFS->SetScanForSubVolumes(DiskFS::kScanSubEnabled);
|
|
|
|
|
|
|
|
/* object created; prep it */
|
|
|
|
dierr = pDiskFS->Initialize(&diskImg, DiskFS::kInitFull);
|
|
|
|
if (dierr != kDIErrNone) {
|
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
|
|
|
errMsg.Format(L"Error reading list of files from disk: %hs",
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskImgLib::DIStrError(dierr));
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
int kbytes;
|
|
|
|
if (pDiskFS->GetDiskImg()->GetHasBlocks())
|
|
|
|
kbytes = pDiskFS->GetDiskImg()->GetNumBlocks() / 2;
|
|
|
|
else if (pDiskFS->GetDiskImg()->GetHasSectors())
|
|
|
|
kbytes = (pDiskFS->GetDiskImg()->GetNumTracks() *
|
|
|
|
pDiskFS->GetDiskImg()->GetNumSectPerTrack()) / 4;
|
|
|
|
else
|
|
|
|
kbytes = 0;
|
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
|
|
|
fprintf(pScanOpts->outfp, "Disk: %hs%hs (%dKB)\n", pDiskFS->GetVolumeID(),
|
2014-11-04 00:26:53 +00:00
|
|
|
pDiskFS->GetFSDamaged() ? " [*]" : "", kbytes);
|
2007-03-27 17:47:10 +00:00
|
|
|
fprintf(pScanOpts->outfp,
|
2014-11-04 00:26:53 +00:00
|
|
|
" Name Type Auxtyp Modified"
|
2007-03-27 17:47:10 +00:00
|
|
|
" Format Length\n");
|
|
|
|
fprintf(pScanOpts->outfp,
|
2014-11-04 00:26:53 +00:00
|
|
|
"------------------------------------------------------"
|
2007-03-27 17:47:10 +00:00
|
|
|
"------------------------\n");
|
2014-11-04 00:26:53 +00:00
|
|
|
if (LoadDiskFSContents(pDiskFS, "", pScanOpts) != 0) {
|
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
|
|
|
errMsg.Format(L"Failed while loading contents of '%ls'.", pathName);
|
2014-11-04 00:26:53 +00:00
|
|
|
goto bail;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
fprintf(pScanOpts->outfp,
|
2014-11-04 00:26:53 +00:00
|
|
|
"------------------------------------------------------"
|
2007-03-27 17:47:10 +00:00
|
|
|
"------------------------\n\n");
|
|
|
|
|
|
|
|
bail:
|
2014-11-04 00:26:53 +00:00
|
|
|
delete pDiskFS;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
//PeekAndPump();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (!errMsg.IsEmpty()) {
|
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
|
|
|
fprintf(pScanOpts->outfp, "Failed: %ls\n\n", (LPCWSTR) errMsg);
|
2014-11-04 00:26:53 +00:00
|
|
|
return -1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
void MainWindow::AnalyzeFile(const A2File* pFile, RecordKind* pRecordKind,
|
2014-11-04 00:26:53 +00:00
|
|
|
LONGLONG* pTotalLen, LONGLONG* pTotalCompLen)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (pFile->IsVolumeDirectory()) {
|
|
|
|
/* volume dir entry */
|
|
|
|
ASSERT(pFile->GetRsrcLength() < 0);
|
|
|
|
*pRecordKind = kRecordKindVolumeDir;
|
|
|
|
*pTotalLen = pFile->GetDataLength();
|
|
|
|
*pTotalCompLen = pFile->GetDataLength();
|
|
|
|
} else if (pFile->IsDirectory()) {
|
|
|
|
/* directory entry */
|
|
|
|
ASSERT(pFile->GetRsrcLength() < 0);
|
|
|
|
*pRecordKind = kRecordKindDirectory;
|
|
|
|
*pTotalLen = pFile->GetDataLength();
|
|
|
|
*pTotalCompLen = pFile->GetDataLength();
|
|
|
|
} else if (pFile->GetRsrcLength() >= 0) {
|
|
|
|
/* has resource fork */
|
|
|
|
*pRecordKind = kRecordKindForkedFile;
|
|
|
|
*pTotalLen = pFile->GetDataLength() + pFile->GetRsrcLength();
|
|
|
|
*pTotalCompLen =
|
|
|
|
pFile->GetDataSparseLength() + pFile->GetRsrcSparseLength();
|
|
|
|
} else {
|
|
|
|
/* just data fork */
|
|
|
|
*pRecordKind = kRecordKindFile;
|
|
|
|
*pTotalLen = pFile->GetDataLength();
|
|
|
|
*pTotalCompLen = pFile->GetDataSparseLength();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
bool MainWindow::IsRecordReadOnly(int access)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
|
|
|
if (access == 0x21L || access == 0x01L)
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ProDOS file type names; must be entirely in upper case */
|
|
|
|
static const char gFileTypeNames[256][4] = {
|
2014-11-04 00:26:53 +00:00
|
|
|
"NON", "BAD", "PCD", "PTX", "TXT", "PDA", "BIN", "FNT",
|
|
|
|
"FOT", "BA3", "DA3", "WPF", "SOS", "$0D", "$0E", "DIR",
|
|
|
|
"RPD", "RPI", "AFD", "AFM", "AFR", "SCL", "PFS", "$17",
|
|
|
|
"$18", "ADB", "AWP", "ASP", "$1C", "$1D", "$1E", "$1F",
|
|
|
|
"TDM", "$21", "$22", "$23", "$24", "$25", "$26", "$27",
|
|
|
|
"$28", "$29", "8SC", "8OB", "8IC", "8LD", "P8C", "$2F",
|
|
|
|
"$30", "$31", "$32", "$33", "$34", "$35", "$36", "$37",
|
|
|
|
"$38", "$39", "$3A", "$3B", "$3C", "$3D", "$3E", "$3F",
|
|
|
|
"DIC", "OCR", "FTD", "$43", "$44", "$45", "$46", "$47",
|
|
|
|
"$48", "$49", "$4A", "$4B", "$4C", "$4D", "$4E", "$4F",
|
|
|
|
"GWP", "GSS", "GDB", "DRW", "GDP", "HMD", "EDU", "STN",
|
|
|
|
"HLP", "COM", "CFG", "ANM", "MUM", "ENT", "DVU", "FIN",
|
|
|
|
"$60", "$61", "$62", "$63", "$64", "$65", "$66", "$67",
|
|
|
|
"$68", "$69", "$6A", "BIO", "$6C", "TDR", "PRE", "HDV",
|
|
|
|
"$70", "$71", "$72", "$73", "$74", "$75", "$76", "$77",
|
|
|
|
"$78", "$79", "$7A", "$7B", "$7C", "$7D", "$7E", "$7F",
|
|
|
|
"$80", "$81", "$82", "$83", "$84", "$85", "$86", "$87",
|
|
|
|
"$88", "$89", "$8A", "$8B", "$8C", "$8D", "$8E", "$8F",
|
|
|
|
"$90", "$91", "$92", "$93", "$94", "$95", "$96", "$97",
|
|
|
|
"$98", "$99", "$9A", "$9B", "$9C", "$9D", "$9E", "$9F",
|
|
|
|
"WP ", "$A1", "$A2", "$A3", "$A4", "$A5", "$A6", "$A7",
|
|
|
|
"$A8", "$A9", "$AA", "GSB", "TDF", "BDF", "$AE", "$AF",
|
|
|
|
"SRC", "OBJ", "LIB", "S16", "RTL", "EXE", "PIF", "TIF",
|
|
|
|
"NDA", "CDA", "TOL", "DVR", "LDF", "FST", "$BE", "DOC",
|
|
|
|
"PNT", "PIC", "ANI", "PAL", "$C4", "OOG", "SCR", "CDV",
|
|
|
|
"FON", "FND", "ICN", "$CB", "$CC", "$CD", "$CE", "$CF",
|
|
|
|
"$D0", "$D1", "$D2", "$D3", "$D4", "MUS", "INS", "MDI",
|
|
|
|
"SND", "$D9", "$DA", "DBM", "$DC", "DDD", "$DE", "$DF",
|
|
|
|
"LBR", "$E1", "ATK", "$E3", "$E4", "$E5", "$E6", "$E7",
|
|
|
|
"$E8", "$E9", "$EA", "$EB", "$EC", "$ED", "R16", "PAS",
|
|
|
|
"CMD", "$F1", "$F2", "$F3", "$F4", "$F5", "$F6", "$F7",
|
|
|
|
"$F8", "OS ", "INT", "IVR", "BAS", "VAR", "REL", "SYS"
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
/*static*/ const char* MainWindow::GetFileTypeString(unsigned long fileType)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fileType < NELEM(gFileTypeNames))
|
|
|
|
return gFileTypeNames[fileType];
|
|
|
|
else
|
|
|
|
return "???";
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sanitize a string. The Mac likes to stick control characters into
|
|
|
|
* things, e.g. ^C and ^M, and uses high ASCII for special characters.
|
2014-11-25 22:34:14 +00:00
|
|
|
*
|
2015-01-09 01:41:53 +00:00
|
|
|
* TODO(Unicode): we could do a Mac OS Roman to Unicode conversion, but
|
|
|
|
* we'd probably want to output UTF-8 (which Windows accessories like
|
|
|
|
* Notepad *are* able to read).
|
2007-03-27 17:47:10 +00:00
|
|
|
*/
|
2014-11-25 22:34:14 +00:00
|
|
|
static void MacSanitize(char* str)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
|
|
|
while (*str != '\0') {
|
2014-11-04 00:26:53 +00:00
|
|
|
*str = DiskImg::MacToASCII(*str);
|
2007-03-27 17:47:10 +00:00
|
|
|
str++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-25 22:34:14 +00:00
|
|
|
int MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
|
2014-11-04 00:26:53 +00:00
|
|
|
ScanOpts* pScanOpts)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2015-01-09 01:41:53 +00:00
|
|
|
static const char* kBlankFileNameMOR = "<blank filename>";
|
2014-11-18 05:13:13 +00:00
|
|
|
DiskFS::SubVolume* pSubVol = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
A2File* pFile;
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pDiskFS != NULL);
|
|
|
|
pFile = pDiskFS->GetNextFile(NULL);
|
|
|
|
for ( ; pFile != NULL; pFile = pDiskFS->GetNextFile(pFile)) {
|
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
|
|
|
CStringA subVolName, dispName;
|
2014-11-04 00:26:53 +00:00
|
|
|
RecordKind recordKind;
|
|
|
|
LONGLONG totalLen, totalCompLen;
|
|
|
|
char tmpbuf[16];
|
|
|
|
|
|
|
|
AnalyzeFile(pFile, &recordKind, &totalLen, &totalCompLen);
|
|
|
|
|
|
|
|
if (recordKind == kRecordKindVolumeDir) {
|
|
|
|
/* this is a volume directory */
|
2014-11-19 22:54:24 +00:00
|
|
|
LOGI("Not displaying volume dir '%hs'", pFile->GetPathName());
|
2014-11-04 00:26:53 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* prepend volName for sub-volumes; must be valid Win32 dirname */
|
|
|
|
if (volName[0] != '\0')
|
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
|
|
|
subVolName.Format("_%hs", volName);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
const char* ccp = pFile->GetPathName();
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(ccp != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (strlen(ccp) == 0)
|
2015-01-09 01:41:53 +00:00
|
|
|
ccp = kBlankFileNameMOR;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2015-01-09 01:41:53 +00:00
|
|
|
CStringA path(ccp);
|
|
|
|
if (DiskImg::UsesDOSFileStructure(pFile->GetFSFormat()) && 0) {
|
2014-11-04 00:26:53 +00:00
|
|
|
InjectLowercase(&path);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (subVolName.IsEmpty())
|
|
|
|
dispName = path;
|
|
|
|
else {
|
|
|
|
dispName = subVolName;
|
|
|
|
dispName += ':';
|
|
|
|
dispName += path;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* strip out ctrl chars and high ASCII in HFS names */
|
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
|
|
|
// TODO: consider having a Unicode output mode
|
2014-11-04 00:26:53 +00:00
|
|
|
MacSanitize(dispName.GetBuffer(0));
|
|
|
|
dispName.ReleaseBuffer();
|
|
|
|
|
|
|
|
ccp = dispName;
|
|
|
|
|
|
|
|
int len = strlen(ccp);
|
|
|
|
if (len <= 32) {
|
|
|
|
fprintf(pScanOpts->outfp, "%c%-32.32s ",
|
|
|
|
IsRecordReadOnly(pFile->GetAccess()) ? '*' : ' ',
|
|
|
|
ccp);
|
|
|
|
} else {
|
|
|
|
fprintf(pScanOpts->outfp, "%c..%-30.30s ",
|
|
|
|
IsRecordReadOnly(pFile->GetAccess()) ? '*' : ' ',
|
|
|
|
ccp + len - 30);
|
|
|
|
}
|
|
|
|
switch (recordKind) {
|
|
|
|
case kRecordKindUnknown:
|
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
|
|
|
fprintf(pScanOpts->outfp, "%hs- $%04lX ",
|
2014-11-04 00:26:53 +00:00
|
|
|
GetFileTypeString(pFile->GetFileType()),
|
|
|
|
pFile->GetAuxType());
|
|
|
|
break;
|
|
|
|
case kRecordKindDisk:
|
2014-11-19 22:54:24 +00:00
|
|
|
sprintf(tmpbuf, "%I64dk", totalLen / 1024);
|
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
|
|
|
fprintf(pScanOpts->outfp, "Disk %-6hs ", tmpbuf);
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case kRecordKindFile:
|
|
|
|
case kRecordKindForkedFile:
|
|
|
|
case kRecordKindDirectory:
|
2007-03-27 17:47:10 +00:00
|
|
|
if (pDiskFS->GetDiskImg()->GetFSFormat() == DiskImg::kFormatMacHFS)
|
|
|
|
{
|
|
|
|
if (recordKind != kRecordKindDirectory &&
|
|
|
|
pFile->GetFileType() >= 0 && pFile->GetFileType() <= 0xff &&
|
|
|
|
pFile->GetAuxType() >= 0 && pFile->GetAuxType() <= 0xffff)
|
|
|
|
{
|
|
|
|
/* ProDOS type embedded in HFS */
|
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
|
|
|
fprintf(pScanOpts->outfp, "%hs%c $%04lX ",
|
2007-03-27 17:47:10 +00:00
|
|
|
GetFileTypeString(pFile->GetFileType()),
|
|
|
|
recordKind == kRecordKindForkedFile ? '+' : ' ',
|
|
|
|
pFile->GetAuxType());
|
|
|
|
} else {
|
|
|
|
char typeStr[5];
|
|
|
|
char creatorStr[5];
|
|
|
|
unsigned long val;
|
|
|
|
|
|
|
|
val = pFile->GetAuxType();
|
|
|
|
creatorStr[0] = (unsigned char) (val >> 24);
|
|
|
|
creatorStr[1] = (unsigned char) (val >> 16);
|
|
|
|
creatorStr[2] = (unsigned char) (val >> 8);
|
|
|
|
creatorStr[3] = (unsigned char) val;
|
|
|
|
creatorStr[4] = '\0';
|
|
|
|
|
|
|
|
val = pFile->GetFileType();
|
|
|
|
typeStr[0] = (unsigned char) (val >> 24);
|
|
|
|
typeStr[1] = (unsigned char) (val >> 16);
|
|
|
|
typeStr[2] = (unsigned char) (val >> 8);
|
|
|
|
typeStr[3] = (unsigned char) val;
|
|
|
|
typeStr[4] = '\0';
|
|
|
|
|
|
|
|
MacSanitize(creatorStr);
|
|
|
|
MacSanitize(typeStr);
|
|
|
|
|
|
|
|
if (recordKind == kRecordKindDirectory) {
|
|
|
|
fprintf(pScanOpts->outfp, "DIR %-4s ", creatorStr);
|
|
|
|
} else {
|
|
|
|
fprintf(pScanOpts->outfp, "%-4s%c %-4s ",
|
|
|
|
typeStr,
|
|
|
|
pFile->GetRsrcLength() > 0 ? '+' : ' ',
|
|
|
|
creatorStr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
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
|
|
|
fprintf(pScanOpts->outfp, "%hs%c $%04lX ",
|
2007-03-27 17:47:10 +00:00
|
|
|
GetFileTypeString(pFile->GetFileType()),
|
|
|
|
recordKind == kRecordKindForkedFile ? '+' : ' ',
|
|
|
|
pFile->GetAuxType());
|
|
|
|
}
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case kRecordKindVolumeDir:
|
|
|
|
/* should've trapped this earlier */
|
|
|
|
ASSERT(0);
|
|
|
|
fprintf(pScanOpts->outfp, "ERROR ");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT(0);
|
|
|
|
fprintf(pScanOpts->outfp, "ERROR ");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
CString date;
|
|
|
|
if (pFile->GetModWhen() == 0)
|
|
|
|
FormatDate(kDateNone, &date);
|
|
|
|
else
|
|
|
|
FormatDate(pFile->GetModWhen(), &date);
|
2014-11-19 22:54:24 +00:00
|
|
|
fprintf(pScanOpts->outfp, "%-15ls ", (LPCWSTR) date);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
const char* fmtStr;
|
|
|
|
switch (pFile->GetFSFormat()) {
|
|
|
|
case DiskImg::kFormatDOS33:
|
|
|
|
case DiskImg::kFormatDOS32:
|
|
|
|
case DiskImg::kFormatUNIDOS:
|
|
|
|
case DiskImg::kFormatOzDOS:
|
|
|
|
fmtStr = "DOS ";
|
|
|
|
break;
|
|
|
|
case DiskImg::kFormatProDOS:
|
|
|
|
fmtStr = "ProDOS";
|
|
|
|
break;
|
|
|
|
case DiskImg::kFormatPascal:
|
|
|
|
fmtStr = "Pascal";
|
|
|
|
break;
|
|
|
|
case DiskImg::kFormatCPM:
|
|
|
|
fmtStr = "CP/M ";
|
|
|
|
break;
|
|
|
|
case DiskImg::kFormatRDOS33:
|
|
|
|
case DiskImg::kFormatRDOS32:
|
|
|
|
case DiskImg::kFormatRDOS3:
|
|
|
|
fmtStr = "RDOS ";
|
|
|
|
break;
|
|
|
|
case DiskImg::kFormatMacHFS:
|
|
|
|
fmtStr = "HFS ";
|
|
|
|
break;
|
|
|
|
case DiskImg::kFormatMSDOS:
|
|
|
|
fmtStr = "MS-DOS";
|
|
|
|
break;
|
2015-01-10 02:19:14 +00:00
|
|
|
case DiskImg::kFormatGutenberg:
|
|
|
|
fmtStr = "Gutenb";
|
|
|
|
break;
|
2014-11-04 00:26:53 +00:00
|
|
|
default:
|
|
|
|
fmtStr = "??? ";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (pFile->GetQuality() == A2File::kQualityDamaged)
|
|
|
|
fmtStr = "BROKEN";
|
|
|
|
else if (pFile->GetQuality() == A2File::kQualitySuspicious)
|
|
|
|
fmtStr = "BAD? ";
|
|
|
|
|
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
|
|
|
fprintf(pScanOpts->outfp, "%hs ", fmtStr);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
2014-11-04 00:26:53 +00:00
|
|
|
/* compute the percent size */
|
|
|
|
if ((!totalLen && totalCompLen) || (totalLen && !totalCompLen))
|
|
|
|
fprintf(pScanOpts->outfp, "--- "); /* weird */
|
|
|
|
else if (totalLen < totalCompLen)
|
|
|
|
fprintf(pScanOpts->outfp, ">100%% "); /* compression failed? */
|
|
|
|
else {
|
|
|
|
sprintf(tmpbuf, "%02d%%", ComputePercent(totalCompLen, totalLen));
|
|
|
|
fprintf(pScanOpts->outfp, "%4s ", tmpbuf);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (!totalLen && totalCompLen)
|
|
|
|
fprintf(pScanOpts->outfp, " ????"); /* weird */
|
|
|
|
else
|
2014-11-19 22:54:24 +00:00
|
|
|
fprintf(pScanOpts->outfp, "%8I64d", totalLen);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
fprintf(pScanOpts->outfp, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Load all sub-volumes.
|
|
|
|
*/
|
2014-11-18 05:13:13 +00:00
|
|
|
pSubVol = pDiskFS->GetNextSubVolume(NULL);
|
|
|
|
while (pSubVol != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
const char* subVolName;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
subVolName = pSubVol->GetDiskFS()->GetVolumeName();
|
2014-11-18 05:13:13 +00:00
|
|
|
if (subVolName == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
subVolName = "+++"; // could probably do better than this
|
|
|
|
|
|
|
|
ret = LoadDiskFSContents(pSubVol->GetDiskFS(), subVolName, pScanOpts);
|
|
|
|
if (ret != 0)
|
|
|
|
return ret;
|
|
|
|
pSubVol = pDiskFS->GetNextSubVolume(pSubVol);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|