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.
This commit is contained in:
Andy McFadden 2014-11-10 15:32:55 -08:00
parent 63b9996009
commit 51b5f00f5c
292 changed files with 57242 additions and 7887 deletions

23
CP.sln
View File

@ -1,12 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "app", "app\app.vcxproj", "{B023611B-7086-46E1-847B-3B21C4732384}"
ProjectSection(ProjectDependencies) = postProject
{B66109F4-217B-43C0-86AA-EB55657E5AC0} = {B66109F4-217B-43C0-86AA-EB55657E5AC0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "diskimg", "diskimg\diskimg.vcxproj", "{0CFE6FAD-0126-4E99-8625-C807D1D2AAF4}"
ProjectSection(ProjectDependencies) = postProject
{B66109F4-217B-43C0-86AA-EB55657E5AC0} = {B66109F4-217B-43C0-86AA-EB55657E5AC0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mdc", "mdc\mdc.vcxproj", "{7DF41D71-C8DC-48AA-B372-4613210310A4}"
ProjectSection(ProjectDependencies) = postProject
{B66109F4-217B-43C0-86AA-EB55657E5AC0} = {B66109F4-217B-43C0-86AA-EB55657E5AC0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "util", "util\util.vcxproj", "{04BFAE2A-7AB3-4B63-B4AB-42FF1D6AD3C5}"
EndProject
@ -14,6 +23,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhfs", "diskimg\libhfs\li
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reformat", "reformat\reformat.vcxproj", "{18BCF397-397E-460C-A1DC-3E26798966E4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib\zlib.vcxproj", "{B66109F4-217B-43C0-86AA-EB55657E5AC0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nufxlib", "nufxlib\nufxlib.vcxproj", "{C48AE53B-3DCB-43B1-9207-B7C5B6BB78AF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -44,6 +57,14 @@ Global
{18BCF397-397E-460C-A1DC-3E26798966E4}.Debug|Win32.Build.0 = Debug|Win32
{18BCF397-397E-460C-A1DC-3E26798966E4}.Release|Win32.ActiveCfg = Release|Win32
{18BCF397-397E-460C-A1DC-3E26798966E4}.Release|Win32.Build.0 = Release|Win32
{B66109F4-217B-43C0-86AA-EB55657E5AC0}.Debug|Win32.ActiveCfg = Debug|Win32
{B66109F4-217B-43C0-86AA-EB55657E5AC0}.Debug|Win32.Build.0 = Debug|Win32
{B66109F4-217B-43C0-86AA-EB55657E5AC0}.Release|Win32.ActiveCfg = Release|Win32
{B66109F4-217B-43C0-86AA-EB55657E5AC0}.Release|Win32.Build.0 = Release|Win32
{C48AE53B-3DCB-43B1-9207-B7C5B6BB78AF}.Debug|Win32.ActiveCfg = Debug|Win32
{C48AE53B-3DCB-43B1-9207-B7C5B6BB78AF}.Debug|Win32.Build.0 = Debug|Win32
{C48AE53B-3DCB-43B1-9207-B7C5B6BB78AF}.Release|Win32.ActiveCfg = Release|Win32
{C48AE53B-3DCB-43B1-9207-B7C5B6BB78AF}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -111,7 +111,7 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
errno = 0;
if (fseek(fpArchive->fFp, fOffset, SEEK_SET) < 0) {
pErrMsg->Format("Unable to seek to offset %ld: %s",
pErrMsg->Format(L"Unable to seek to offset %ld: %hs",
fOffset, strerror(errno));
goto bail;
}
@ -120,7 +120,7 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetCompressedLen(),
&expBuf, false, 0);
if (nerr != kNuErrNone) {
pErrMsg->Format("File read failed: %s", NuStrError(nerr));
pErrMsg->Format(L"File read failed: %hs", NuStrError(nerr));
goto bail;
}
@ -146,7 +146,7 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
*pLength = unsqLen;
} else {
if (*pLength < unsqLen) {
pErrMsg->Format("buf size %ld too short (%ld)",
pErrMsg->Format(L"buf size %ld too short (%ld)",
*pLength, unsqLen);
delete[] unsqBuf;
goto bail;
@ -162,19 +162,19 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
if (needAlloc) {
dataBuf = new char[len];
if (dataBuf == nil) {
pErrMsg->Format("allocation of %ld bytes failed", len);
pErrMsg->Format(L"allocation of %ld bytes failed", len);
goto bail;
}
} else {
if (*pLength < (long) len) {
pErrMsg->Format("buf size %ld too short (%ld)",
pErrMsg->Format(L"buf size %ld too short (%ld)",
*pLength, len);
goto bail;
}
dataBuf = *ppText;
}
if (fread(dataBuf, len, 1, fpArchive->fFp) != 1) {
pErrMsg->Format("File read failed: %s", strerror(errno));
pErrMsg->Format(L"File read failed: %hs", strerror(errno));
goto bail;
}
@ -217,7 +217,7 @@ AcuEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
ASSERT(IDOK != -1 && IDCANCEL != -1);
if (which != kDataThread) {
*pErrMsg = "No such fork";
*pErrMsg = L"No such fork";
goto bail;
}
@ -230,7 +230,7 @@ AcuEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
errno = 0;
if (fseek(fpArchive->fFp, fOffset, SEEK_SET) < 0) {
pErrMsg->Format("Unable to seek to offset %ld: %s",
pErrMsg->Format(L"Unable to seek to offset %ld: %hs",
fOffset, strerror(errno));
goto bail;
}
@ -255,7 +255,7 @@ AcuEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetCompressedLen(),
&expBuf, false, 0);
if (nerr != kNuErrNone) {
pErrMsg->Format("File read failed: %s", NuStrError(nerr));
pErrMsg->Format(L"File read failed: %hs", NuStrError(nerr));
goto bail;
}
@ -273,7 +273,7 @@ AcuEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
int err = GenericEntry::WriteConvert(outfp, buf, uncLen, &conv,
&convHA, &lastCR);
if (err != 0) {
pErrMsg->Format("File write failed: %s", strerror(err));
pErrMsg->Format(L"File write failed: %hs", strerror(err));
delete[] buf;
goto bail;
}
@ -283,7 +283,7 @@ AcuEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
nerr = CopyData(outfp, conv, convHA, pErrMsg);
if (nerr != kNuErrNone) {
if (pErrMsg->IsEmpty()) {
pErrMsg->Format("Failed while copying data: %s\n",
pErrMsg->Format(L"Failed while copying data: %hs\n",
NuStrError(nerr));
}
goto bail;
@ -329,7 +329,7 @@ AcuEntry::CopyData(FILE* outfp, ConvertEOL conv, ConvertHighASCII convHA,
/* read a chunk from the source file */
nerr = fpArchive->AcuRead(buf, chunkLen);
if (nerr != kNuErrNone) {
pMsg->Format("File read failed: %s.", NuStrError(nerr));
pMsg->Format(L"File read failed: %hs.", NuStrError(nerr));
goto bail;
}
@ -337,7 +337,7 @@ AcuEntry::CopyData(FILE* outfp, ConvertEOL conv, ConvertHighASCII convHA,
int err = GenericEntry::WriteConvert(outfp, buf, chunkLen, &conv,
&convHA, &lastCR);
if (err != 0) {
pMsg->Format("File write failed: %s.", strerror(err));
pMsg->Format(L"File write failed: %hs.", strerror(err));
nerr = kNuErrGeneric;
goto bail;
}
@ -372,7 +372,7 @@ AcuEntry::TestEntry(CWnd* pMsgWnd)
errno = 0;
if (fseek(fpArchive->fFp, fOffset, SEEK_SET) < 0) {
nerr = kNuErrGeneric;
errMsg.Format("Unable to seek to offset %ld: %s\n",
errMsg.Format(L"Unable to seek to offset %ld: %hs\n",
fOffset, strerror(errno));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail;
@ -382,7 +382,7 @@ AcuEntry::TestEntry(CWnd* pMsgWnd)
nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetCompressedLen(),
nil, false, 0);
if (nerr != kNuErrNone) {
errMsg.Format("Unsqueeze failed: %s.", NuStrError(nerr));
errMsg.Format(L"Unsqueeze failed: %hs.", NuStrError(nerr));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail;
}
@ -390,7 +390,7 @@ AcuEntry::TestEntry(CWnd* pMsgWnd)
errno = 0;
if (fseek(fpArchive->fFp, fOffset + len, SEEK_SET) < 0) {
nerr = kNuErrGeneric;
errMsg.Format("Unable to seek to offset %ld (file truncated?): %s\n",
errMsg.Format(L"Unable to seek to offset %ld (file truncated?): %hs\n",
fOffset, strerror(errno));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail;
@ -428,16 +428,16 @@ AcuArchive::AppInit(void)
* Returns an error string on failure, or "" on success.
*/
GenericArchive::OpenResult
AcuArchive::Open(const char* filename, bool readOnly, CString* pErrMsg)
AcuArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg)
{
CString errMsg;
fIsReadOnly = true; // ignore "readOnly"
errno = 0;
fFp = fopen(filename, "rb");
fFp = _wfopen(filename, L"rb");
if (fFp == nil) {
errMsg.Format("Unable to open %s: %s.", filename, strerror(errno));
errMsg.Format(L"Unable to open %ls: %hs.", filename, strerror(errno));
goto bail;
}
@ -447,10 +447,10 @@ AcuArchive::Open(const char* filename, bool readOnly, CString* pErrMsg)
result = LoadContents();
if (result < 0) {
errMsg.Format("The file is not an ACU archive.");
errMsg.Format(L"The file is not an ACU archive.");
goto bail;
} else if (result > 0) {
errMsg.Format("Failed while reading data from ACU archive.");
errMsg.Format(L"Failed while reading data from ACU archive.");
goto bail;
}
}
@ -471,10 +471,9 @@ bail:
* Returns an error string on failure, or "" on success.
*/
CString
AcuArchive::New(const char* /*filename*/, const void* /*options*/)
AcuArchive::New(const WCHAR* /*filename*/, const void* /*options*/)
{
CString retmsg("Sorry, AppleLink Compression Utility files can't be created.");
return retmsg;
return L"Sorry, AppleLink Compression Utility files can't be created.";
}
@ -572,7 +571,7 @@ AcuArchive::Reload(void)
DeleteEntries();
if (LoadContents() != 0) {
return "Reload failed.";
return L"Reload failed.";
}
return "";
@ -703,14 +702,14 @@ AcuArchive::DumpFileHeader(const AcuFileEntry* pEntry)
FormatDate(createWhen, &createStr);
FormatDate(modWhen, &modStr);
WMSG1(" Header for file '%s':\n", pEntry->fileName);
WMSG1(" Header for file '%hs':\n", pEntry->fileName);
WMSG4(" dataStorageLen=%d eof=%d blockCount=%d checksum=0x%04x\n",
pEntry->dataStorageLen, pEntry->dataEof, pEntry->blockCount,
pEntry->dataChecksum);
WMSG4(" fileType=0x%02x auxType=0x%04x storageType=0x%02x access=0x%04x\n",
pEntry->fileType, pEntry->auxType, pEntry->storageType, pEntry->access);
WMSG2(" created %s, modified %s\n", (const char*) createStr,
(const char*) modStr);
WMSG2(" created %ls, modified %ls\n",
(LPCWSTR) createStr, (LPCWSTR) modStr);
WMSG2(" fileNameLen=%d headerChecksum=0x%04x\n",
pEntry->fileNameLen, pEntry->headerChecksum);
}
@ -730,7 +729,8 @@ AcuArchive::CreateEntry(const AcuFileEntry* pEntry)
* Create the new entry.
*/
pNewEntry = new AcuEntry(this);
pNewEntry->SetPathName(pEntry->fileName);
CString fileName(pEntry->fileName);
pNewEntry->SetPathName(fileName);
pNewEntry->SetFssep(kAcuFssep);
pNewEntry->SetFileType(pEntry->fileType);
pNewEntry->SetAuxType(pEntry->auxType);
@ -753,12 +753,12 @@ AcuArchive::CreateEntry(const AcuFileEntry* pEntry)
pNewEntry->SetDataForkLen(pEntry->dataEof);
if (pEntry->compressionType == kAcuCompNone) {
pNewEntry->SetFormatStr("Uncompr");
pNewEntry->SetFormatStr(L"Uncompr");
} else if (pEntry->compressionType == kAcuCompSqueeze) {
pNewEntry->SetFormatStr("Squeeze");
pNewEntry->SetFormatStr(L"Squeeze");
pNewEntry->SetSqueezed(true);
} else {
pNewEntry->SetFormatStr("(unknown)");
pNewEntry->SetFormatStr(L"(unknown)");
pNewEntry->SetSqueezed(false);
}
@ -870,7 +870,7 @@ AcuArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
while (pSelEntry != nil) {
pEntry = (AcuEntry*) pSelEntry->GetEntry();
WMSG2(" Testing '%s' (offset=%ld)\n", pEntry->GetDisplayName(),
WMSG2(" Testing '%hs' (offset=%ld)\n", pEntry->GetDisplayName(),
pEntry->GetOffset());
SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), nil);
@ -883,7 +883,7 @@ AcuArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
errMsg = "Cancelled.";
pMsgWnd->MessageBox(errMsg, title, MB_OK);
} else {
errMsg.Format("Failed while testing '%s': %s.",
errMsg.Format(L"Failed while testing '%hs': %hs.",
pEntry->GetPathName(), NuStrError(nerr));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
}
@ -894,9 +894,9 @@ AcuArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
}
/* show success message */
errMsg.Format("Tested %d file%s, no errors found.",
errMsg.Format(L"Tested %d file%ls, no errors found.",
pSelSet->GetNumEntries(),
pSelSet->GetNumEntries() == 1 ? "" : "s");
pSelSet->GetNumEntries() == 1 ? L"" : L"s");
pMsgWnd->MessageBox(errMsg);
retVal = true;

View File

@ -6,8 +6,8 @@
/*
* AppleLink Compression Utility archive support.
*/
#ifndef __ACU_ARCHIVE__
#define __ACU_ARCHIVE__
#ifndef APP_ACUARCHIVE_H
#define APP_ACUARCHIVE_H
#include "GenericArchive.h"
@ -69,9 +69,9 @@ public:
// One-time initialization; returns an error string.
static CString AppInit(void);
virtual OpenResult Open(const char* filename, bool readOnly,
virtual OpenResult Open(const WCHAR* filename, bool readOnly,
CString* pErrMsg);
virtual CString New(const char* filename, const void* options);
virtual CString New(const WCHAR* filename, const void* options);
virtual CString Flush(void) { return ""; }
virtual CString Reload(void);
virtual bool IsReadOnly(void) const { return fIsReadOnly; };
@ -84,7 +84,7 @@ public:
const AddFilesDialog* pAddOpts)
{ ASSERT(false); return false; }
virtual bool CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry,
const char* newName)
const WCHAR* newName)
{ ASSERT(false); return false; }
virtual bool TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet);
virtual bool DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
@ -92,10 +92,10 @@ public:
virtual bool RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
{ ASSERT(false); return false; }
virtual bool RenameVolume(CWnd* pMsgWnd, DiskFS* pDiskFS,
const char* newName)
const WCHAR* newName)
{ ASSERT(false); return false; }
virtual CString TestVolumeName(const DiskFS* pDiskFS,
const char* newName) const
const WCHAR* newName) const
{ ASSERT(false); return "!"; }
virtual CString TestPathName(const GenericEntry* pGenericEntry,
const CString& basePath, const CString& newName, char newFssep) const
@ -219,4 +219,4 @@ private:
bool fIsReadOnly;
};
#endif /*__ACU_ARCHIVE__*/
#endif /*APP_ACUARCHIVE_H*/

View File

@ -12,10 +12,9 @@
#include "HelpTopics.h"
#include "MyApp.h"
#include "resource.h"
#include "../prebuilt/NufxLib.h"
#include "../nufxlib/NufxLib.h"
#include "../diskimg/DiskImg.h"
#define ZLIB_DLL
#include "../prebuilt/zlib.h"
#include "../zlib/zlib.h"
BEGIN_MESSAGE_MAP(AboutDialog, CDialog)
@ -23,16 +22,16 @@ BEGIN_MESSAGE_MAP(AboutDialog, CDialog)
//ON_BN_CLICKED(IDC_ABOUT_ENTER_REG, OnEnterReg)
END_MESSAGE_MAP()
static const char* kVersionExtra =
static const WCHAR kVersionExtra[] =
#ifdef _DEBUG
" _DEBUG"
L" _DEBUG"
#else
""
L""
#endif
#ifdef _DEBUG_LOG
" _LOG"
L" _LOG"
#else
""
L""
#endif
;
@ -80,7 +79,8 @@ AboutDialog::OnInitDialog(void)
pStatic = (CStatic*) GetDlgItem(IDC_ZLIB_VERS_TEXT);
ASSERT(pStatic != nil);
pStatic->GetWindowText(tmpStr);
newVersion.Format(tmpStr, zlibVersion());
CString zlibVersionStr(zlibVersion());
newVersion.Format(tmpStr, zlibVersionStr);
pStatic->SetWindowText(newVersion);
/* and, finally, the ASPI version */
@ -89,7 +89,7 @@ AboutDialog::OnInitDialog(void)
if (DiskImgLib::Global::GetHasASPI()) {
CString versionStr;
DWORD version = DiskImgLib::Global::GetASPIVersion();
versionStr.Format("%d.%d.%d.%d",
versionStr.Format(L"%d.%d.%d.%d",
version & 0x0ff,
(version >> 8) & 0xff,
(version >> 16) & 0xff,

View File

@ -6,8 +6,8 @@
/*
* Class definition for About dialog.
*/
#ifndef __ABOUT_DIALOG__
#define __ABOUT_DIALOG__
#ifndef APP_ABOUTDIALOG_H
#define APP_ABOUTDIALOG_H
//#include <afxwin.h>
#include "resource.h"
@ -34,4 +34,4 @@ protected:
DECLARE_MESSAGE_MAP()
};
#endif /*__ABOUT_DIALOG__*/
#endif /*APP_ABOUTDIALOG_H*/

View File

@ -100,7 +100,7 @@ ActionProgressDialog::OnInitDialog(void)
* Set the name of the file as it appears in the archive.
*/
void
ActionProgressDialog::SetArcName(const char* str)
ActionProgressDialog::SetArcName(const WCHAR* str)
{
CString oldStr;
@ -127,7 +127,7 @@ ActionProgressDialog::GetFileName(void)
* Set the name of the file as it appears under Windows.
*/
void
ActionProgressDialog::SetFileName(const char* str)
ActionProgressDialog::SetFileName(const WCHAR* str)
{
CString oldStr;

View File

@ -6,8 +6,8 @@
/*
* Show the progress of an action like "add" or "extract".
*/
#ifndef __ACTIONPROGRESSDIALOG__
#define __ACTIONPROGRESSDIALOG__
#ifndef APP_ACTIONPROGRESSDIALOG_H
#define APP_ACTIONPROGRESSDIALOG_H
#include "resource.h"
@ -48,8 +48,8 @@ public:
DestroyWindow();
}
void SetArcName(const char* str);
void SetFileName(const char* str);
void SetArcName(const WCHAR* str);
void SetFileName(const WCHAR* str);
const CString GetFileName(void);
int SetProgress(int perc);
@ -62,4 +62,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__ACTIONPROGRESSDIALOG__*/
#endif /*APP_ACTIONPROGRESSDIALOG_H*/

View File

@ -82,8 +82,8 @@ MainWindow::HandleView(void)
selSet.Dump();
if (selSet.GetNumEntries() == 0) {
MessageBox("Nothing viewable found.",
"No match", MB_OK | MB_ICONEXCLAMATION);
MessageBox(L"Nothing viewable found.",
L"No match", MB_OK | MB_ICONEXCLAMATION);
return;
}
@ -101,7 +101,7 @@ MainWindow::HandleView(void)
// remember which font they used (sticky pref, not in registry)
fPreferences.SetPrefString(kPrViewTextTypeFace, vfd.GetTextTypeFace());
fPreferences.SetPrefLong(kPrViewTextPointSize, vfd.GetTextPointSize());
WMSG2("Preferences: saving view font %d-point '%s'\n",
WMSG2("Preferences: saving view font %d-point '%ls'\n",
fPreferences.GetPrefLong(kPrViewTextPointSize),
fPreferences.GetPrefString(kPrViewTextTypeFace));
}
@ -364,8 +364,8 @@ MainWindow::OnActionsAddDisks(void)
openFilters = kOpenDiskImage;
openFilters += kOpenAll;
openFilters += kOpenEnd;
CFileDialog dlg(TRUE, "dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
dlg.m_ofn.lpstrTitle = "Add Disk Image";
CFileDialog dlg(TRUE, L"dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
dlg.m_ofn.lpstrTitle = L"Add Disk Image";
/* file is always opened read-only */
dlg.m_ofn.Flags |= OFN_HIDEREADONLY;
@ -381,14 +381,14 @@ MainWindow::OnActionsAddDisks(void)
/* open the image file and analyze it */
dierr = img.OpenImage(dlg.GetPathName(), PathProposal::kLocalFssep, true);
if (dierr != kDIErrNone) {
errMsg.Format("Unable to open disk image: %s.",
errMsg.Format(L"Unable to open disk image: %hs.",
DiskImgLib::DIStrError(dierr));
MessageBox(errMsg, failed, MB_OK|MB_ICONSTOP);
goto bail;
}
if (img.AnalyzeImage() != kDIErrNone) {
errMsg.Format("The file '%s' doesn't seem to hold a valid disk image.",
errMsg.Format(L"The file '%ls' doesn't seem to hold a valid disk image.",
dlg.GetPathName());
MessageBox(errMsg, failed, MB_OK|MB_ICONSTOP);
goto bail;
@ -426,8 +426,8 @@ MainWindow::OnActionsAddDisks(void)
dierr = img.OverrideFormat(img.GetPhysicalFormat(), imf.fFSFormat,
imf.fSectorOrder);
if (dierr != kDIErrNone) {
errMsg.Format("Unable to access disk image using selected"
" parameters. Error: %s.",
errMsg.Format(L"Unable to access disk image using selected"
L" parameters. Error: %hs.",
DiskImgLib::DIStrError(dierr));
MessageBox(errMsg, failed, MB_OK | MB_ICONSTOP);
goto bail;
@ -444,7 +444,7 @@ MainWindow::OnActionsAddDisks(void)
dierr = img.OverrideFormat(img.GetPhysicalFormat(),
DiskImg::kFormatGenericProDOSOrd, img.GetSectorOrder());
if (dierr != kDIErrNone) {
errMsg.Format("Internal error: couldn't switch to generic ProDOS: %s.",
errMsg.Format(L"Internal error: couldn't switch to generic ProDOS: %hs.",
DiskImgLib::DIStrError(dierr));
MessageBox(errMsg, failed, MB_OK | MB_ICONSTOP);
goto bail;
@ -459,7 +459,7 @@ MainWindow::OnActionsAddDisks(void)
*/
ASSERT(dlg.m_ofn.nFileOffset > 0);
int len;
len = strlen(dlg.m_ofn.lpstrFile) + 2;
len = wcslen(dlg.m_ofn.lpstrFile) + 2;
dlg.m_ofn.lpstrFile[dlg.m_ofn.nFileOffset-1] = '\0';
addOpts.SetFileNames(dlg.m_ofn.lpstrFile, len, dlg.m_ofn.nFileOffset);
addOpts.fStoragePrefix = "";
@ -535,7 +535,7 @@ MainWindow::OnActionsCreateSubdir(void)
return;
}
WMSG1("Creating subdir in '%s'\n", pEntry->GetPathName());
WMSG1("Creating subdir in '%ls'\n", pEntry->GetPathName());
csDialog.fBasePath = pEntry->GetPathName();
csDialog.fpArchive = fpOpenArchive;
@ -544,7 +544,7 @@ MainWindow::OnActionsCreateSubdir(void)
if (csDialog.DoModal() != IDOK)
return;
WMSG1("Creating '%s'\n", csDialog.fNewName);
WMSG1("Creating '%ls'\n", (LPCWSTR) csDialog.fNewName);
fpOpenArchive->CreateSubdir(this, pEntry, csDialog.fNewName);
fpContentList->Reload();
@ -630,7 +630,7 @@ MainWindow::OnActionsExtract(void)
fPreferences.SetPrefBool(kPrExtractStripFolderNames, extOpts.fStripFolderNames != 0);
fPreferences.SetPrefBool(kPrExtractOverwriteExisting, extOpts.fOverwriteExisting != 0);
WMSG1("Requested extract path is '%s'\n", extOpts.fExtractPath);
WMSG1("Requested extract path is '%ls'\n", (LPCWSTR) extOpts.fExtractPath);
/*
* Create a "selection set" of things to display.
@ -652,8 +652,8 @@ MainWindow::OnActionsExtract(void)
//selSet.Dump();
if (selSet.GetNumEntries() == 0) {
MessageBox("No files matched the selection criteria.",
"No match", MB_OK | MB_ICONEXCLAMATION);
MessageBox(L"No files matched the selection criteria.",
L"No match", MB_OK | MB_ICONEXCLAMATION);
return;
}
@ -711,7 +711,7 @@ MainWindow::DoBulkExtract(SelectionSet* pSelSet,
GenericEntry* pEntry = pSelEntry->GetEntry();
if (pEntry->GetDamaged()) {
WMSG1("Skipping '%s' due to damage\n", pEntry->GetPathName());
WMSG1("Skipping '%ls' due to damage\n", pEntry->GetPathName());
continue;
}
@ -737,7 +737,7 @@ MainWindow::DoBulkExtract(SelectionSet* pSelSet,
pEntry->GetRecordKind() == GenericEntry::kRecordKindForkedFile))
{
fpActionProgress->SetArcName(pEntry->GetDisplayName());
fpActionProgress->SetFileName(_T("-"));
fpActionProgress->SetFileName(L"-");
SET_PROGRESS_BEGIN();
if (GetFileParts(pEntry, &pHolder) == 0) {
@ -759,7 +759,7 @@ MainWindow::DoBulkExtract(SelectionSet* pSelSet,
pEntry->GetFileType(),
pEntry->GetAuxType(),
ReformatterSourceFormat(pEntry->GetSourceFS()),
pEntry->GetFileNameExtension());
pEntry->GetFileNameExtensionA());
pHolder->TestApplicability();
}
}
@ -869,7 +869,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
{
extractAs2MG = true;
} else {
WMSG2("Not extracting funky image '%s' as 2MG (len=%ld)\n",
WMSG2("Not extracting funky image '%ls' as 2MG (len=%ld)\n",
pEntry->GetPathName(), pEntry->GetUncompressedLen());
}
}
@ -970,20 +970,20 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
*/
switch (pOutput->GetOutputKind()) {
case ReformatOutput::kOutputText:
if (lastFour.CompareNoCase(".txt") != 0)
tmpPath += ".txt";
if (lastFour.CompareNoCase(L".txt") != 0)
tmpPath += L".txt";
break;
case ReformatOutput::kOutputRTF:
if (lastFour.CompareNoCase(".rtf") != 0)
tmpPath += ".rtf";
if (lastFour.CompareNoCase(L".rtf") != 0)
tmpPath += L".rtf";
break;
case ReformatOutput::kOutputCSV:
if (lastFour.CompareNoCase(".csv") != 0)
tmpPath += ".csv";
if (lastFour.CompareNoCase(L".csv") != 0)
tmpPath += L".csv";
break;
case ReformatOutput::kOutputBitmap:
if (lastFour.CompareNoCase(".bmp") != 0)
tmpPath += ".bmp";
if (lastFour.CompareNoCase(L".bmp") != 0)
tmpPath += L".bmp";
break;
case ReformatOutput::kOutputRaw:
noChangePath = true;
@ -1011,12 +1011,12 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
*/
outputPath = adjustedExtractPath;
outputPath += convName;
outputPath += ".2mg";
outputPath += L".2mg";
}
/* update the display in case we renamed it */
if (outputPath != fpActionProgress->GetFileName()) {
WMSG2(" Renamed our output, from '%s' to '%s'\n",
WMSG2(" Renamed our output, from '%ls' to '%ls'\n",
(LPCTSTR) fpActionProgress->GetFileName(), outputPath);
fpActionProgress->SetFileName(outputPath);
}
@ -1026,7 +1026,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
*/
fpActionProgress->SetArcName(pathProp.fStoredPathName);
fpActionProgress->SetFileName(outputPath);
WMSG2("Extracting from '%s' to '%s'\n",
WMSG2("Extracting from '%ls' to '%ls'\n",
pathProp.fStoredPathName, outputPath);
SET_PROGRESS_BEGIN();
@ -1048,8 +1048,8 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
/* update the display in case they renamed the file */
if (outputPath != fpActionProgress->GetFileName()) {
WMSG2(" Detected rename, from '%s' to '%s'\n",
(LPCTSTR) fpActionProgress->GetFileName(), outputPath);
WMSG2(" Detected rename, from '%ls' to '%ls'\n",
(LPCWSTR) fpActionProgress->GetFileName(), outputPath);
fpActionProgress->SetFileName(outputPath);
}
@ -1082,7 +1082,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
ASSERT(ftell(fp) == 0);
err = header.WriteHeader(fp);
if (err != 0) {
errMsg.Format("Unable to save 2MG file '%s': %s\n",
errMsg.Format(L"Unable to save 2MG file '%ls': %hs\n",
outputPath, strerror(err));
fpActionProgress->MessageBox(errMsg, failed,
MB_OK | MB_ICONERROR);
@ -1166,7 +1166,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
pOutput->GetTextLen(), 1, fp) != 1)
err = errno;
if (err != 0) {
errMsg.Format("Unable to save reformatted file '%s': %s\n",
errMsg.Format(L"Unable to save reformatted file '%ls': %hs\n",
outputPath, strerror(err));
fpActionProgress->MessageBox(errMsg, failed,
MB_OK | MB_ICONERROR);
@ -1179,7 +1179,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
ASSERT(pOutput->GetDIB() != nil);
int err = pOutput->GetDIB()->WriteToFile(fp);
if (err != 0) {
errMsg.Format("Unable to save bitmap '%s': %s\n",
errMsg.Format(L"Unable to save bitmap '%ls': %hs\n",
outputPath, strerror(err));
fpActionProgress->MessageBox(errMsg, failed,
MB_OK | MB_ICONERROR);
@ -1205,7 +1205,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
err = GenericEntry::WriteConvert(fp, pOutput->GetTextBuf(),
pOutput->GetTextLen(), &thisConv, &thisConvHA, &lastCR);
if (err != 0) {
errMsg.Format("Unable to write file '%s': %s\n",
errMsg.Format(L"Unable to write file '%ls': %hs\n",
outputPath, strerror(err));
fpActionProgress->MessageBox(errMsg, failed,
MB_OK | MB_ICONERROR);
@ -1230,7 +1230,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
CString msg;
int result;
ASSERT(fpActionProgress != nil);
WMSG3("Extracting '%s', requesting thisConv=%d, convHA=%d\n",
WMSG3("Extracting '%ls', requesting thisConv=%d, convHA=%d\n",
outputPath, thisConv, convHA);
result = pEntry->ExtractThreadToFile(thread, fp,
thisConv, convHA, &msg);
@ -1239,11 +1239,11 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
CString msg;
msg.LoadString(IDS_OPERATION_CANCELLED);
fpActionProgress->MessageBox(msg,
"CiderPress", MB_OK | MB_ICONEXCLAMATION);
L"CiderPress", MB_OK | MB_ICONEXCLAMATION);
} else {
WMSG2(" FAILED on '%s': %s\n", outputPath, msg);
errMsg.Format("Unable to extract file '%s': %s\n",
outputPath, (LPCTSTR) msg);
WMSG2(" FAILED on '%ls': %ls\n", outputPath, msg);
errMsg.Format(L"Unable to extract file '%ls': %ls\n",
outputPath, msg);
fpActionProgress->MessageBox(errMsg, failed,
MB_OK | MB_ICONERROR);
}
@ -1309,11 +1309,11 @@ did_rename:
if (*pOverwriteExisting) {
do_overwrite:
/* delete existing */
WMSG1(" Deleting existing '%s'\n", (LPCTSTR) *pOutputPath);
if (::unlink(*pOutputPath) != 0) {
WMSG1(" Deleting existing '%ls'\n", (LPCWSTR) *pOutputPath);
if (::_wunlink(*pOutputPath) != 0) {
err = errno;
WMSG2(" Failed deleting '%s', err=%d\n",
(LPCTSTR)*pOutputPath, err);
WMSG2(" Failed deleting '%ls', err=%d\n",
(LPCWSTR)*pOutputPath, err);
if (err == ENOENT) {
/* user might have removed it while dialog was up */
err = 0;
@ -1324,7 +1324,7 @@ do_overwrite:
}
} else if (*pOvwrForAll) {
/* never overwrite */
WMSG1(" Skipping '%s'\n", (LPCTSTR) *pOutputPath);
WMSG1(" Skipping '%ls'\n", (LPCWSTR) *pOutputPath);
goto bail;
} else {
/* no firm policy, ask the user */
@ -1360,7 +1360,7 @@ do_overwrite:
if (err != 0)
goto bail;
*pFp = fopen(*pOutputPath, "wb");
*pFp = _wfopen(*pOutputPath, L"wb");
if (*pFp == nil)
err = errno ? errno : -1;
/* fall through with error */
@ -1369,14 +1369,14 @@ bail:
/* if we failed, tell the user why */
if (err == ENOTDIR) {
/* part of the output path exists, but isn't a directory */
msg.Format("Unable to create folders for '%s': part of the path "
"already exists but is not a folder.\n",
msg.Format(L"Unable to create folders for '%ls': part of the path "
L"already exists but is not a folder.\n",
*pOutputPath);
fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR);
return IDCANCEL;
} else if (err == EINVAL) {
/* invalid argument; assume it's an invalid filename */
msg.Format("Unable to create file '%s': invalid filename.\n",
msg.Format(L"Unable to create file '%ls': invalid filename.\n",
*pOutputPath);
fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR);
return IDCANCEL;
@ -1385,7 +1385,7 @@ bail:
WMSG0("Cancelling due to user request\n");
return IDCANCEL;
} else if (err != 0) {
msg.Format("Unable to create file '%s': %s\n",
msg.Format(L"Unable to create file '%ls': %hs\n",
*pOutputPath, strerror(err));
fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR);
return IDCANCEL;
@ -1445,8 +1445,8 @@ MainWindow::OnActionsTest(void)
if (selSet.GetNumEntries() == 0) {
/* should be impossible */
MessageBox("No files matched the selection criteria.",
"No match", MB_OK|MB_ICONEXCLAMATION);
MessageBox(L"No files matched the selection criteria.",
L"No match", MB_OK|MB_ICONEXCLAMATION);
return;
}
@ -1543,16 +1543,16 @@ MainWindow::OnActionsDelete(void)
selSet.CreateFromSelection(fpContentList, threadMask);
if (selSet.GetNumEntries() == 0) {
/* can happen if they selected volume dir only */
MessageBox("Nothing to delete.",
"No match", MB_OK | MB_ICONEXCLAMATION);
MessageBox(L"Nothing to delete.",
L"No match", MB_OK | MB_ICONEXCLAMATION);
return;
}
CString appName, msg;
appName.LoadString(IDS_MB_APP_NAME);
msg.Format("Delete %d file%s?", selSet.GetNumEntries(),
selSet.GetNumEntries() == 1 ? "" : "s");
msg.Format(L"Delete %d file%ls?", selSet.GetNumEntries(),
selSet.GetNumEntries() == 1 ? L"" : L"s");
if (MessageBox(msg, appName, MB_OKCANCEL | MB_ICONQUESTION) != IDOK)
return;
@ -1614,8 +1614,8 @@ MainWindow::OnActionsRename(void)
if (selSet.GetNumEntries() == 0) {
/* should be impossible */
MessageBox("No files matched the selection criteria.",
"No match", MB_OK | MB_ICONEXCLAMATION);
MessageBox(L"No files matched the selection criteria.",
L"No match", MB_OK | MB_ICONEXCLAMATION);
return;
}
@ -1863,8 +1863,8 @@ MainWindow::OnActionsRecompress(void)
if (selSet.GetNumEntries() == 0) {
/* should be impossible */
MessageBox("No files matched the selection criteria.",
"No match", MB_OK|MB_ICONEXCLAMATION);
MessageBox(L"No files matched the selection criteria.",
L"No match", MB_OK|MB_ICONEXCLAMATION);
return;
}
@ -1896,10 +1896,10 @@ MainWindow::OnActionsRecompress(void)
ASSERT(beforeUncomp == afterUncomp);
appName.LoadString(IDS_MB_APP_NAME);
msg.Format("Total uncompressed size of all files:\t%.1fK\r\n"
"Total size before recompress:\t\t%.1fK\r\n"
"Total size after recompress:\t\t%.1fK\r\n"
"Overall reduction:\t\t\t%.1fK",
msg.Format(L"Total uncompressed size of all files:\t%.1fK\r\n"
L"Total size before recompress:\t\t%.1fK\r\n"
L"Total size after recompress:\t\t%.1fK\r\n"
L"Overall reduction:\t\t\t%.1fK",
beforeUncomp / 1024.0, beforeComp / 1024.0, afterComp / 1024.0,
(beforeComp - afterComp) / 1024.0);
MessageBox(msg, appName, MB_OK|MB_ICONINFORMATION);
@ -1993,8 +1993,8 @@ MainWindow::OnActionsConvDisk(void)
if (selSet.GetNumEntries() == 0) {
/* should be impossible */
MessageBox("No files matched the selection criteria.",
"No match", MB_OK|MB_ICONEXCLAMATION);
MessageBox(L"No files matched the selection criteria.",
L"No match", MB_OK|MB_ICONEXCLAMATION);
return;
}
@ -2004,18 +2004,18 @@ MainWindow::OnActionsConvDisk(void)
//xferOpts.fUseSparseBlocks =
// fPreferences.GetPrefBool(kPrProDOSUseSparse) != 0;
WMSG1("New volume name will be '%s'\n", selOpts.fVolName);
WMSG1("New volume name will be '%ls'\n", (LPCWSTR) selOpts.fVolName);
/*
* Create a new disk image.
*/
CString filename, saveFolder, errStr;
CFileDialog dlg(FALSE, _T("po"), NULL,
CFileDialog dlg(FALSE, L"po", NULL,
OFN_OVERWRITEPROMPT|OFN_NOREADONLYRETURN|OFN_HIDEREADONLY,
"Disk Images (*.po)|*.po||", this);
L"Disk Images (*.po)|*.po||", this);
dlg.m_ofn.lpstrTitle = "New Disk Image (.PO)";
dlg.m_ofn.lpstrTitle = L"New Disk Image (.PO)";
dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
if (dlg.DoModal() != IDOK) {
@ -2028,7 +2028,7 @@ MainWindow::OnActionsConvDisk(void)
fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder);
filename = dlg.GetPathName();
WMSG1(" Will xfer to file '%s'\n", filename);
WMSG1(" Will xfer to file '%ls'\n", filename);
/* remove file if it already exists */
CString errMsg;
@ -2149,8 +2149,8 @@ MainWindow::OnActionsConvFile(void)
//selSet.Dump();
if (selSet.GetNumEntries() == 0) {
MessageBox("No files matched the selection criteria.",
"No match", MB_OK|MB_ICONEXCLAMATION);
MessageBox(L"No files matched the selection criteria.",
L"No match", MB_OK|MB_ICONEXCLAMATION);
return;
}
@ -2164,11 +2164,11 @@ MainWindow::OnActionsConvFile(void)
*/
CString filename, saveFolder, errStr;
CFileDialog dlg(FALSE, _T("shk"), NULL,
CFileDialog dlg(FALSE, L"shk", NULL,
OFN_OVERWRITEPROMPT|OFN_NOREADONLYRETURN|OFN_HIDEREADONLY,
"ShrinkIt Archives (*.shk)|*.shk||", this);
L"ShrinkIt Archives (*.shk)|*.shk||", this);
dlg.m_ofn.lpstrTitle = "New Archive";
dlg.m_ofn.lpstrTitle = L"New Archive";
dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
if (dlg.DoModal() != IDOK) {
@ -2181,7 +2181,7 @@ MainWindow::OnActionsConvFile(void)
fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder);
filename = dlg.GetPathName();
WMSG1(" Will xfer to file '%s'\n", filename);
WMSG1(" Will xfer to file '%ls'\n", filename);
/* remove file if it already exists */
CString errMsg;
@ -2273,9 +2273,9 @@ MainWindow::OnActionsConvFromWav(void)
CassetteDialog dlg;
CString fileName, saveFolder;
CFileDialog fileDlg(TRUE, "wav", NULL, OFN_FILEMUSTEXIST|OFN_HIDEREADONLY,
"Sound Files (*.wav)|*.wav||", this);
fileDlg.m_ofn.lpstrTitle = "Open Sound File";
CFileDialog fileDlg(TRUE, L"wav", NULL, OFN_FILEMUSTEXIST|OFN_HIDEREADONLY,
L"Sound Files (*.wav)|*.wav||", this);
fileDlg.m_ofn.lpstrTitle = L"Open Sound File";
fileDlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenWAVFolder);
if (fileDlg.DoModal() != IDOK)
@ -2286,7 +2286,7 @@ MainWindow::OnActionsConvFromWav(void)
fPreferences.SetPrefString(kPrOpenWAVFolder, saveFolder);
fileName = fileDlg.GetPathName();
WMSG1("Opening WAV file '%s'\n", fileName);
WMSG1("Opening WAV file '%ls'\n", fileName);
dlg.fFileName = fileName;
// pass in fpOpenArchive?
@ -2340,7 +2340,7 @@ MainWindow::SaveToArchive(GenericArchive::FileDetails* pDetails,
else
dataBuf = new unsigned char[dataLen];
if (dataBuf == nil) {
errMsg.Format("Unable to allocate %ld bytes", dataLen);
errMsg.Format(L"Unable to allocate %ld bytes", dataLen);
goto bail;
}
memcpy(dataBuf, dataBufIn, dataLen);
@ -2368,7 +2368,7 @@ MainWindow::SaveToArchive(GenericArchive::FileDetails* pDetails,
}
if (pTargetSubdir != nil) {
storagePrefix = pTargetSubdir->GetPathName();
WMSG1("--- using storagePrefix '%s'\n", (const char*) storagePrefix);
WMSG1("--- using storagePrefix '%ls'\n", storagePrefix);
}
if (!storagePrefix.IsEmpty()) {
CString tmpStr, tmpFileName;
@ -2421,9 +2421,9 @@ MainWindow::OnActionsImportBAS(void)
ImportBASDialog dlg;
CString fileName, saveFolder;
CFileDialog fileDlg(TRUE, "txt", NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY,
"Text files (*.txt)|*.txt||", this);
fileDlg.m_ofn.lpstrTitle = "Open Text File";
CFileDialog fileDlg(TRUE, L"txt", NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY,
L"Text files (*.txt)|*.txt||", this);
fileDlg.m_ofn.lpstrTitle = L"Open Text File";
fileDlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrAddFileFolder);
if (fileDlg.DoModal() != IDOK)
@ -2434,7 +2434,7 @@ MainWindow::OnActionsImportBAS(void)
fPreferences.SetPrefString(kPrAddFileFolder, saveFolder);
fileName = fileDlg.GetPathName();
WMSG1("Opening TXT file '%s'\n", fileName);
WMSG1("Opening TXT file '%ls'\n", fileName);
dlg.fFileName = fileName;
// pass in fpOpenArchive?
@ -2530,7 +2530,7 @@ MainWindow::GetFilePart(const GenericEntry* pEntry, int whichThread,
if (threadLen > fPreferences.GetPrefLong(kPrMaxViewFileSize)) {
errMsg.Format(
"[File size (%I64d KBytes) exceeds file viewer maximum (%ld KBytes).]\n",
L"[File size (%I64d KBytes) exceeds file viewer maximum (%ld KBytes).]\n",
((LONGLONG) threadLen + 1023) / 1024,
(fPreferences.GetPrefLong(kPrMaxViewFileSize) + 1023) / 1024);
pHolder->SetErrorMsg(part, errMsg);
@ -2546,12 +2546,13 @@ MainWindow::GetFilePart(const GenericEntry* pEntry, int whichThread,
pHolder->SetSourceBuf(part, (unsigned char*) buf, len);
} else if (result == IDCANCEL) {
/* not expected */
errMsg = "Cancelled!";
errMsg = L"Cancelled!";
pHolder->SetErrorMsg(part, errMsg);
ASSERT(buf == nil);
} else {
/* transfer error message to ReformatHolder buffer */
WMSG1("Got error message from ExtractThread: '%s'\n", errMsg);
WMSG1("Got error message from ExtractThread: '%ls'\n",
(LPCWSTR) errMsg);
pHolder->SetErrorMsg(part, errMsg);
ASSERT(buf == nil);
}

View File

@ -6,8 +6,8 @@
/*
* Resolve a filename clash when adding files.
*/
#ifndef __ADDCLASHDIALOG__
#define __ADDCLASHDIALOG__
#ifndef APP_ADDCLASHDIALOG_H
#define APP_ADDCLASHDIALOG_H
/*
*
@ -36,4 +36,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__ADDCLASHDIALOG__*/
#endif /*APP_ADDCLASHDIALOG_H*/

View File

@ -125,7 +125,7 @@ AddFilesDialog::ValidateStoragePrefix(void)
const char kFssep = PathProposal::kDefaultStoredFssep;
if (fStoragePrefix[0] == kFssep || fStoragePrefix.Right(1) == kFssep) {
CString errMsg;
errMsg.Format("The storage prefix may not start or end with '%c'.",
errMsg.Format(L"The storage prefix may not start or end with '%c'.",
kFssep);
MessageBox(errMsg, m_ofn.lpstrTitle, MB_OK | MB_ICONWARNING);
return false;

View File

@ -7,8 +7,8 @@
* File selection dialog, a sub-class of "Open" that allows multiple selection
* of both files and directories.
*/
#ifndef __ADDFILESDIALOG__
#define __ADDFILESDIALOG__
#ifndef APP_ADDFILESDIALOG_H
#define APP_ADDFILESDIALOG_H
#include "../diskimg/DiskImg.h"
#include "../util/UtilLib.h"
@ -23,9 +23,9 @@
class AddFilesDialog : public SelectFilesDialog {
public:
AddFilesDialog(CWnd* pParentWnd = NULL) :
SelectFilesDialog("IDD_ADD_FILES", pParentWnd)
SelectFilesDialog(L"IDD_ADD_FILES", pParentWnd)
{
SetWindowTitle(_T("Add Files..."));
SetWindowTitle(L"Add Files...");
fStoragePrefix = "";
fStoragePrefixEnable = true;
fIncludeSubfolders = FALSE;
@ -77,4 +77,4 @@ private:
//DECLARE_MESSAGE_MAP()
};
#endif /*__ADDFILESDIALOG__*/
#endif /*APP_ADDFILESDIALOG_H*/

View File

@ -9,7 +9,7 @@
#include "StdAfx.h"
#include "HelpTopics.h"
#include "ArchiveInfoDialog.h"
#include "../prebuilt/NufxLib.h"
#include "../nufxlib/NufxLib.h"
/*
* ===========================================================================
@ -60,12 +60,13 @@ NufxArchiveInfoDialog::OnInitDialog(void)
ASSERT(pMasterHeader != nil);
pWnd = GetDlgItem(IDC_AI_FILENAME);
pWnd->SetWindowText(fpArchive->GetPathName());
CString pathName(fpArchive->GetPathName());
pWnd->SetWindowText(pathName);
pWnd = GetDlgItem(IDC_AINUFX_RECORDS);
nerr = NuGetAttr(pNuArchive, kNuAttrNumRecords, &attr);
if (nerr == kNuErrNone)
tmpStr.Format("%ld", attr);
tmpStr.Format(L"%ld", attr);
else
tmpStr = notAvailable;
pWnd->SetWindowText(tmpStr);
@ -73,36 +74,36 @@ NufxArchiveInfoDialog::OnInitDialog(void)
pWnd = GetDlgItem(IDC_AINUFX_FORMAT);
nerr = NuGetAttr(pNuArchive, kNuAttrArchiveType, &attr);
switch (attr) {
case kNuArchiveNuFX: tmpStr = "NuFX"; break;
case kNuArchiveNuFXInBNY: tmpStr = "NuFX in Binary II"; break;
case kNuArchiveNuFXSelfEx: tmpStr = "Self-extracting NuFX"; break;
case kNuArchiveNuFXSelfExInBNY: tmpStr = "Self-extracting NuFX in Binary II";
case kNuArchiveNuFX: tmpStr = L"NuFX"; break;
case kNuArchiveNuFXInBNY: tmpStr = L"NuFX in Binary II"; break;
case kNuArchiveNuFXSelfEx: tmpStr = L"Self-extracting NuFX"; break;
case kNuArchiveNuFXSelfExInBNY: tmpStr = L"Self-extracting NuFX in Binary II";
break;
case kNuArchiveBNY: tmpStr = "Binary II"; break;
case kNuArchiveBNY: tmpStr = L"Binary II"; break;
default:
tmpStr = "(unknown)";
tmpStr = L"(unknown)";
break;
};
pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_AINUFX_MASTERVERSION);
tmpStr.Format("%ld", pMasterHeader->mhMasterVersion);
tmpStr.Format(L"%ld", pMasterHeader->mhMasterVersion);
pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_AINUFX_CREATEWHEN);
when = NufxArchive::DateTimeToSeconds(&pMasterHeader->mhArchiveCreateWhen);
tmpStr.Format("%.24s", ctime(&when));
tmpStr.Format(L"%.24hs", ctime(&when));
pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_AINUFX_MODIFYWHEN);
when = NufxArchive::DateTimeToSeconds(&pMasterHeader->mhArchiveModWhen);
tmpStr.Format("%.24s", ctime(&when));
tmpStr.Format(L"%.24hs", ctime(&when));
pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_AINUFX_JUNKSKIPPED);
nerr = NuGetAttr(pNuArchive, kNuAttrJunkOffset, &attr);
if (nerr == kNuErrNone)
tmpStr.Format("%ld bytes", attr);
tmpStr.Format(L"%ld bytes", attr);
else
tmpStr = notAvailable;
pWnd->SetWindowText(tmpStr);
@ -146,10 +147,12 @@ DiskArchiveInfoDialog::OnInitDialog(void)
pWnd->SetWindowText(fpArchive->GetPathName());
pWnd = GetDlgItem(IDC_AIDISK_OUTERFORMAT);
pWnd->SetWindowText(DiskImg::ToString(pDiskImg->GetOuterFormat()));
CStringW outerFormat(DiskImg::ToString(pDiskImg->GetOuterFormat()));
pWnd->SetWindowText(outerFormat);
pWnd = GetDlgItem(IDC_AIDISK_FILEFORMAT);
pWnd->SetWindowText(DiskImg::ToString(pDiskImg->GetFileFormat()));
CStringW fileFormat(DiskImg::ToString(pDiskImg->GetFileFormat()));
pWnd->SetWindowText(fileFormat);
pWnd = GetDlgItem(IDC_AIDISK_PHYSICALFORMAT);
DiskImg::PhysicalFormat physicalFormat = pDiskImg->GetPhysicalFormat();
@ -160,13 +163,14 @@ DiskArchiveInfoDialog::OnInitDialog(void)
CString tmpStr;
const DiskImg::NibbleDescr* pNibbleDescr = pDiskImg->GetNibbleDescr();
if (pNibbleDescr != nil)
tmpStr.Format("%s, layout is \"%s\"",
tmpStr.Format(L"%hs, layout is \"%hs\"",
DiskImg::ToString(physicalFormat), pNibbleDescr->description);
else
tmpStr = DiskImg::ToString(physicalFormat); // unexpected
pWnd->SetWindowText(tmpStr);
} else {
pWnd->SetWindowText(DiskImg::ToString(physicalFormat));
CString physicalFormat(DiskImg::ToString(physicalFormat));
pWnd->SetWindowText(physicalFormat);
}
FillInVolumeInfo(pDiskFS);
@ -178,7 +182,7 @@ DiskArchiveInfoDialog::OnInitDialog(void)
CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_AIDISK_SUBVOLSEL);
int idx = 0;
AddSubVolumes(pDiskFS, "", &idx);
AddSubVolumes(pDiskFS, L"", &idx);
ASSERT(idx > 0); // must have at least the top-level DiskFS
pCombo->SetCurSel(0);
@ -192,7 +196,7 @@ DiskArchiveInfoDialog::OnInitDialog(void)
* Recursively add sub-volumes to the list.
*/
void
DiskArchiveInfoDialog::AddSubVolumes(const DiskFS* pDiskFS, const char* prefix,
DiskArchiveInfoDialog::AddSubVolumes(const DiskFS* pDiskFS, const WCHAR* prefix,
int* pIdx)
{
CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_AIDISK_SUBVOLSEL);
@ -213,7 +217,7 @@ DiskArchiveInfoDialog::AddSubVolumes(const DiskFS* pDiskFS, const char* prefix,
DiskFS::SubVolume* pSubVol;
pSubVol = pDiskFS->GetNextSubVolume(nil);
tmpStr = prefix;
tmpStr += " ";
tmpStr += L" ";
while (pSubVol != nil) {
AddSubVolumes(pSubVol->GetDiskFS(), tmpStr, pIdx);
@ -244,19 +248,21 @@ void
DiskArchiveInfoDialog::FillInVolumeInfo(const DiskFS* pDiskFS)
{
const DiskImg* pDiskImg = pDiskFS->GetDiskImg();
CString unknown = "(unknown)";
CString unknown = L"(unknown)";
CString tmpStr;
DIError dierr;
CWnd* pWnd;
pWnd = GetDlgItem(IDC_AIDISK_SECTORORDER);
pWnd->SetWindowText(DiskImg::ToString(pDiskImg->GetSectorOrder()));
CStringW sectorOrderW(DiskImg::ToString(pDiskImg->GetSectorOrder()));
pWnd->SetWindowText(sectorOrderW);
pWnd = GetDlgItem(IDC_AIDISK_FSFORMAT);
pWnd->SetWindowText(DiskImg::ToString(pDiskImg->GetFSFormat()));
CStringW fsFormat(DiskImg::ToString(pDiskImg->GetFSFormat()));
pWnd->SetWindowText(fsFormat);
pWnd = GetDlgItem(IDC_AIDISK_FILECOUNT);
tmpStr.Format("%ld", pDiskFS->GetFileCount());
tmpStr.Format(L"%ld", pDiskFS->GetFileCount());
pWnd->SetWindowText(tmpStr);
long totalUnits, freeUnits;
@ -270,11 +276,11 @@ DiskArchiveInfoDialog::FillInVolumeInfo(const DiskFS* pDiskFS)
if (unitSize == DiskImgLib::kBlockSize) {
pWnd = GetDlgItem(IDC_AIDISK_CAPACITY);
GetReducedSize(totalUnits, unitSize, &reducedSize);
tmpStr.Format("%ld blocks (%s)",
tmpStr.Format(L"%ld blocks (%ls)",
totalUnits, reducedSize);
if (totalUnits != pDiskImg->GetNumBlocks()) {
CString tmpStr2;
tmpStr2.Format(", image has room for %ld blocks",
tmpStr2.Format(L", image has room for %ld blocks",
pDiskImg->GetNumBlocks());
tmpStr += tmpStr2;
}
@ -282,7 +288,7 @@ DiskArchiveInfoDialog::FillInVolumeInfo(const DiskFS* pDiskFS)
pWnd = GetDlgItem(IDC_AIDISK_FREESPACE);
GetReducedSize(freeUnits, unitSize, &reducedSize);
tmpStr.Format("%ld blocks (%s)",
tmpStr.Format(L"%ld blocks (%ls)",
freeUnits, reducedSize);
pWnd->SetWindowText(tmpStr);
} else {
@ -290,13 +296,13 @@ DiskArchiveInfoDialog::FillInVolumeInfo(const DiskFS* pDiskFS)
pWnd = GetDlgItem(IDC_AIDISK_CAPACITY);
GetReducedSize(totalUnits, unitSize, &reducedSize);
tmpStr.Format("%ld sectors (%s)",
tmpStr.Format(L"%ld sectors (%ls)",
totalUnits, reducedSize);
pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_AIDISK_FREESPACE);
GetReducedSize(freeUnits, unitSize, &reducedSize);
tmpStr.Format("%ld sectors (%s)",
tmpStr.Format(L"%ld sectors (%ls)",
freeUnits, reducedSize);
pWnd->SetWindowText(tmpStr);
}
@ -306,10 +312,10 @@ DiskArchiveInfoDialog::FillInVolumeInfo(const DiskFS* pDiskFS)
if (pDiskImg->GetHasBlocks()) {
totalUnits = pDiskImg->GetNumBlocks();
GetReducedSize(totalUnits, DiskImgLib::kBlockSize, &reducedSize);
tmpStr.Format("%ld blocks (%s)",
tmpStr.Format(L"%ld blocks (%ls)",
totalUnits, reducedSize);
} else if (pDiskImg->GetHasSectors()) {
tmpStr.Format("%ld tracks, %d sectors per track",
tmpStr.Format(L"%ld tracks, %d sectors per track",
pDiskImg->GetNumTracks(), pDiskImg->GetNumSectPerTrack());
} else {
tmpStr = unknown;
@ -321,18 +327,20 @@ DiskArchiveInfoDialog::FillInVolumeInfo(const DiskFS* pDiskFS)
}
pWnd = GetDlgItem(IDC_AIDISK_WRITEABLE);
tmpStr = pDiskFS->GetReadWriteSupported() ? "Yes" : "No";
tmpStr = pDiskFS->GetReadWriteSupported() ? L"Yes" : L"No";
pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_AIDISK_DAMAGED);
tmpStr = pDiskFS->GetFSDamaged() ? "Yes" : "No";
tmpStr = pDiskFS->GetFSDamaged() ? L"Yes" : L"No";
pWnd->SetWindowText(tmpStr);
const char* cp;
char* outp;
WCHAR* outp;
pWnd = GetDlgItem(IDC_AIDISK_NOTES);
cp = pDiskImg->GetNotes();
// GetBuffer wants length in code units, which will be 2x since it's
// wide chars. The 2x mult below is for worst-case linefeed conversion.
outp = tmpStr.GetBuffer(strlen(cp) * 2 +1);
/* convert '\n' to '\r\n' */
while (*cp != '\0') {
@ -361,18 +369,18 @@ DiskArchiveInfoDialog::GetReducedSize(long numUnits, int unitSize,
if (sizeInBytes < 0) {
ASSERT(false);
pOut->Format("<bogus>");
pOut->Format(L"<bogus>");
return;
}
if (sizeInBytes >= 1024*1024*1024) {
reducedSize = (long) (sizeInBytes / (1024*1024));
pOut->Format("%.2fGB", reducedSize / 1024.0);
pOut->Format(L"%.2fGB", reducedSize / 1024.0);
} else if (sizeInBytes >= 1024*1024) {
reducedSize = (long) (sizeInBytes / 1024);
pOut->Format("%.2fMB", reducedSize / 1024.0);
pOut->Format(L"%.2fMB", reducedSize / 1024.0);
} else {
pOut->Format("%.2fKB", ((long) sizeInBytes) / 1024.0);
pOut->Format(L"%.2fKB", ((long) sizeInBytes) / 1024.0);
}
}
@ -398,7 +406,7 @@ BnyArchiveInfoDialog::OnInitDialog(void)
pWnd = GetDlgItem(IDC_AI_FILENAME);
pWnd->SetWindowText(fpArchive->GetPathName());
tmpStr.Format("%ld", fpArchive->GetNumEntries());
tmpStr.Format(L"%ld", fpArchive->GetNumEntries());
pWnd = GetDlgItem(IDC_AIBNY_RECORDS);
pWnd->SetWindowText(tmpStr);
@ -425,7 +433,7 @@ AcuArchiveInfoDialog::OnInitDialog(void)
pWnd = GetDlgItem(IDC_AI_FILENAME);
pWnd->SetWindowText(fpArchive->GetPathName());
tmpStr.Format("%ld", fpArchive->GetNumEntries());
tmpStr.Format(L"%ld", fpArchive->GetNumEntries());
pWnd = GetDlgItem(IDC_AIBNY_RECORDS);
pWnd->SetWindowText(tmpStr);

View File

@ -6,8 +6,8 @@
/*
* Definitions for the ArchiveInfo set of dialog classes.
*/
#ifndef __ARCHIVEINFODIALOG__
#define __ARCHIVEINFODIALOG__
#ifndef APP_ARCHIVEINFODIALOG_H
#define APP_ARCHIVEINFODIALOG_H
#include "resource.h"
#include "GenericArchive.h"
@ -69,7 +69,7 @@ private:
afx_msg void OnSubVolSelChange(void);
void FillInVolumeInfo(const DiskFS* pDiskFS);
void AddSubVolumes(const DiskFS* pDiskFS, const char* prefix,
void AddSubVolumes(const DiskFS* pDiskFS, const WCHAR* prefix,
int* pIdx);
void GetReducedSize(long numUnits, int unitSize,
CString* pOut) const;
@ -115,4 +115,4 @@ private:
AcuArchive* fpArchive;
};
#endif /*__ARCHIVEINFODIALOG__*/
#endif /*APP_ARCHIVEINFODIALOG_H*/

View File

@ -74,7 +74,7 @@ BnyEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
errno = 0;
if (fseek(fpArchive->fFp, fOffset, SEEK_SET) < 0) {
pErrMsg->Format("Unable to seek to offset %ld: %s",
pErrMsg->Format(L"Unable to seek to offset %ld: %hs",
fOffset, strerror(errno));
goto bail;
}
@ -83,7 +83,7 @@ BnyEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetUncompressedLen(),
&expBuf, true, kBNYBlockSize);
if (nerr != kNuErrNone) {
pErrMsg->Format("File read failed: %s", NuStrError(nerr));
pErrMsg->Format(L"File read failed: %hs", NuStrError(nerr));
goto bail;
}
@ -108,7 +108,7 @@ BnyEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
*pLength = unsqLen;
} else {
if (*pLength < unsqLen) {
pErrMsg->Format("buf size %ld too short (%ld)",
pErrMsg->Format(L"buf size %ld too short (%ld)",
*pLength, unsqLen);
delete[] unsqBuf;
goto bail;
@ -124,19 +124,19 @@ BnyEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
if (needAlloc) {
dataBuf = new char[len];
if (dataBuf == nil) {
pErrMsg->Format("allocation of %ld bytes failed", len);
pErrMsg->Format(L"allocation of %ld bytes failed", len);
goto bail;
}
} else {
if (*pLength < (long) len) {
pErrMsg->Format("buf size %ld too short (%ld)",
pErrMsg->Format(L"buf size %ld too short (%ld)",
*pLength, len);
goto bail;
}
dataBuf = *ppText;
}
if (fread(dataBuf, len, 1, fpArchive->fFp) != 1) {
pErrMsg->Format("File read failed: %s", strerror(errno));
pErrMsg->Format(L"File read failed: %hs", strerror(errno));
goto bail;
}
@ -179,7 +179,7 @@ BnyEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
ASSERT(IDOK != -1 && IDCANCEL != -1);
if (which != kDataThread) {
*pErrMsg = "No such fork";
*pErrMsg = L"No such fork";
goto bail;
}
@ -192,7 +192,7 @@ BnyEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
errno = 0;
if (fseek(fpArchive->fFp, fOffset, SEEK_SET) < 0) {
pErrMsg->Format("Unable to seek to offset %ld: %s",
pErrMsg->Format(L"Unable to seek to offset %ld: %hs",
fOffset, strerror(errno));
goto bail;
}
@ -217,7 +217,7 @@ BnyEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetUncompressedLen(),
&expBuf, true, kBNYBlockSize);
if (nerr != kNuErrNone) {
pErrMsg->Format("File read failed: %s", NuStrError(nerr));
pErrMsg->Format(L"File read failed: %hs", NuStrError(nerr));
goto bail;
}
@ -235,7 +235,7 @@ BnyEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
int err = GenericEntry::WriteConvert(outfp, buf, uncLen, &conv,
&convHA, &lastCR);
if (err != 0) {
pErrMsg->Format("File write failed: %s", strerror(err));
pErrMsg->Format(L"File write failed: %hs", strerror(err));
delete[] buf;
goto bail;
}
@ -245,7 +245,7 @@ BnyEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
nerr = CopyData(outfp, conv, convHA, pErrMsg);
if (nerr != kNuErrNone) {
if (pErrMsg->IsEmpty()) {
pErrMsg->Format("Failed while copying data: %s\n",
pErrMsg->Format(L"Failed while copying data: %hs\n",
NuStrError(nerr));
}
goto bail;
@ -291,7 +291,7 @@ BnyEntry::CopyData(FILE* outfp, ConvertEOL conv, ConvertHighASCII convHA,
/* read a chunk from the source file */
nerr = fpArchive->BNYRead(buf, chunkLen);
if (nerr != kNuErrNone) {
pMsg->Format("File read failed: %s.", NuStrError(nerr));
pMsg->Format(L"File read failed: %hs.", NuStrError(nerr));
goto bail;
}
@ -299,7 +299,7 @@ BnyEntry::CopyData(FILE* outfp, ConvertEOL conv, ConvertHighASCII convHA,
int err = GenericEntry::WriteConvert(outfp, buf, chunkLen, &conv,
&convHA, &lastCR);
if (err != 0) {
pMsg->Format("File write failed: %s.", strerror(err));
pMsg->Format(L"File write failed: %hs.", strerror(err));
nerr = kNuErrGeneric;
goto bail;
}
@ -334,7 +334,7 @@ BnyEntry::TestEntry(CWnd* pMsgWnd)
errno = 0;
if (fseek(fpArchive->fFp, fOffset, SEEK_SET) < 0) {
nerr = kNuErrGeneric;
errMsg.Format("Unable to seek to offset %ld: %s\n",
errMsg.Format(L"Unable to seek to offset %ld: %hs\n",
fOffset, strerror(errno));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail;
@ -344,7 +344,7 @@ BnyEntry::TestEntry(CWnd* pMsgWnd)
nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetUncompressedLen(),
nil, true, kBNYBlockSize);
if (nerr != kNuErrNone) {
errMsg.Format("Unsqueeze failed: %s.", NuStrError(nerr));
errMsg.Format(L"Unsqueeze failed: %hs.", NuStrError(nerr));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail;
}
@ -352,7 +352,7 @@ BnyEntry::TestEntry(CWnd* pMsgWnd)
errno = 0;
if (fseek(fpArchive->fFp, fOffset + len, SEEK_SET) < 0) {
nerr = kNuErrGeneric;
errMsg.Format("Unable to seek to offset %ld (file truncated?): %s\n",
errMsg.Format(L"Unable to seek to offset %ld (file truncated?): %hs\n",
fOffset, strerror(errno));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail;
@ -391,16 +391,16 @@ BnyArchive::AppInit(void)
* Returns an error string on failure, or "" on success.
*/
GenericArchive::OpenResult
BnyArchive::Open(const char* filename, bool readOnly, CString* pErrMsg)
BnyArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg)
{
CString errMsg;
fIsReadOnly = true; // ignore "readOnly"
errno = 0;
fFp = fopen(filename, "rb");
fFp = _wfopen(filename, L"rb");
if (fFp == nil) {
errMsg.Format("Unable to open %s: %s.", filename, strerror(errno));
errMsg.Format(L"Unable to open %ls: %hs.", filename, strerror(errno));
goto bail;
}
@ -408,7 +408,7 @@ BnyArchive::Open(const char* filename, bool readOnly, CString* pErrMsg)
CWaitCursor waitc;
if (LoadContents() != 0) {
errMsg.Format("Failed while loading contents of Binary II file.");
errMsg.Format(L"Failed while loading contents of Binary II file.");
goto bail;
}
}
@ -429,9 +429,9 @@ bail:
* Returns an error string on failure, or "" on success.
*/
CString
BnyArchive::New(const char* /*filename*/, const void* /*options*/)
BnyArchive::New(const WCHAR* /*filename*/, const void* /*options*/)
{
CString retmsg("Sorry, Binary II files can't be created.");
CString retmsg(L"Sorry, Binary II files can't be created.");
return retmsg;
}
@ -503,7 +503,7 @@ BnyArchive::Reload(void)
DeleteEntries();
if (LoadContents() != 0) {
return "Reload failed.";
return L"Reload failed.";
}
return "";
@ -546,7 +546,8 @@ BnyArchive::LoadContentsCallback(BnyFileEntry* pEntry)
* Create the new entry.
*/
pNewEntry = new BnyEntry(this);
pNewEntry->SetPathName(fileName);
CString fileNameW(fileName);
pNewEntry->SetPathName(fileNameW);
pNewEntry->SetFssep(kBNYFssep);
pNewEntry->SetFileType(pEntry->fileType);
pNewEntry->SetAuxType(pEntry->auxType);
@ -570,9 +571,9 @@ BnyArchive::LoadContentsCallback(BnyFileEntry* pEntry)
pNewEntry->SetDataForkLen(pEntry->realEOF);
if (isSqueezed)
pNewEntry->SetFormatStr("Squeeze");
pNewEntry->SetFormatStr(L"Squeeze");
else
pNewEntry->SetFormatStr("Uncompr");
pNewEntry->SetFormatStr(L"Uncompr");
pNewEntry->SetSqueezed(isSqueezed);
if (pEntry->realEOF != 0)
@ -962,7 +963,7 @@ BnyArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
while (pSelEntry != nil) {
pEntry = (BnyEntry*) pSelEntry->GetEntry();
WMSG2(" Testing '%s' (offset=%ld)\n", pEntry->GetDisplayName(),
WMSG2(" Testing '%ls' (offset=%ld)\n", pEntry->GetDisplayName(),
pEntry->GetOffset());
SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), nil);
@ -975,7 +976,7 @@ BnyArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
errMsg = "Cancelled.";
pMsgWnd->MessageBox(errMsg, title, MB_OK);
} else {
errMsg.Format("Failed while testing '%s': %s.",
errMsg.Format(L"Failed while testing '%hs': %hs.",
pEntry->GetPathName(), NuStrError(nerr));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
}
@ -986,9 +987,9 @@ BnyArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
}
/* show success message */
errMsg.Format("Tested %d file%s, no errors found.",
errMsg.Format(L"Tested %d file%ls, no errors found.",
pSelSet->GetNumEntries(),
pSelSet->GetNumEntries() == 1 ? "" : "s");
pSelSet->GetNumEntries() == 1 ? L"" : L"s");
pMsgWnd->MessageBox(errMsg);
retVal = true;

View File

@ -6,8 +6,8 @@
/*
* Binary II support.
*/
#ifndef __BNY_ARCHIVE__
#define __BNY_ARCHIVE__
#ifndef APP_BNYARCHIVE_H
#define APP_BNYARCHIVE_H
#include "GenericArchive.h"
@ -73,9 +73,9 @@ public:
// One-time initialization; returns an error string.
static CString AppInit(void);
virtual OpenResult Open(const char* filename, bool readOnly,
virtual OpenResult Open(const WCHAR* filename, bool readOnly,
CString* pErrMsg);
virtual CString New(const char* filename, const void* options);
virtual CString New(const WCHAR* filename, const void* options);
virtual CString Flush(void) { return ""; }
virtual CString Reload(void);
virtual bool IsReadOnly(void) const { return fIsReadOnly; };
@ -88,7 +88,7 @@ public:
const AddFilesDialog* pAddOpts)
{ ASSERT(false); return false; }
virtual bool CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry,
const char* newName)
const WCHAR* newName)
{ ASSERT(false); return false; }
virtual bool TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet);
virtual bool DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
@ -96,10 +96,10 @@ public:
virtual bool RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
{ ASSERT(false); return false; }
virtual bool RenameVolume(CWnd* pMsgWnd, DiskFS* pDiskFS,
const char* newName)
const WCHAR* newName)
{ ASSERT(false); return false; }
virtual CString TestVolumeName(const DiskFS* pDiskFS,
const char* newName) const
const WCHAR* newName) const
{ ASSERT(false); return "!"; }
virtual CString TestPathName(const GenericEntry* pGenericEntry,
const CString& basePath, const CString& newName, char newFssep) const
@ -215,4 +215,4 @@ private:
bool fIsReadOnly;
};
#endif /*__BNY_ARCHIVE__*/
#endif /*APP_BNYARCHIVE_H*/

View File

@ -97,8 +97,8 @@ ImportBASDialog::OnInitDialog(void)
PathName path(fFileName);
CString fileNameOnly(path.GetFileName());
CString ext(fileNameOnly.Right(4));
if (ext.CompareNoCase(".txt") == 0) {
WMSG1("removing extension from '%s'\n", (const char*) fileNameOnly);
if (ext.CompareNoCase(L".txt") == 0) {
WMSG1("removing extension from '%ls'\n", (LPCWSTR) fileNameOnly);
fileNameOnly = fileNameOnly.Left(fileNameOnly.GetLength() - 4);
}
@ -126,7 +126,7 @@ static const char* kSuccess = "success!\r\n\r\n";
* Import an Applesoft BASIC program from the specified file.
*/
bool
ImportBASDialog::ImportBAS(const char* fileName)
ImportBASDialog::ImportBAS(const WCHAR* fileName)
{
FILE* fp = NULL;
ExpandBuffer msgs(1024);
@ -135,8 +135,8 @@ ImportBASDialog::ImportBAS(const char* fileName)
char* outBuf = nil;
bool result = false;
msgs.Printf("Importing from '%s'...", fileName);
fp = fopen(fileName, "rb"); // EOL unknown, open as binary and deal
msgs.Printf("Importing from '%ls'...", fileName);
fp = _wfopen(fileName, L"rb"); // EOL unknown, open as binary and deal
if (fp == NULL) {
msgs.Printf("%sUnable to open file.", kFailed);
goto bail;
@ -190,7 +190,8 @@ bail:
char* msgBuf = nil;
long msgLen;
msgs.SeizeBuffer(&msgBuf, &msgLen);
pEdit->SetWindowText(msgBuf);
CString msgStr(msgBuf);
pEdit->SetWindowText(msgStr);
delete[] msgBuf;
return result;
@ -225,7 +226,7 @@ ImportBASDialog::ConvertTextToBAS(const char* buf, long fileLen,
if (!ProcessBASLine(lineStart, lineEnd - lineStart, &output,
/*ref*/ msg))
{
pMsgs->Printf("%sLine %d: %s", kFailed, lineNum, (const char*) msg);
pMsgs->Printf("%sLine %d: %ls", kFailed, lineNum, (LPCWSTR) msg);
return false;
}
@ -380,7 +381,7 @@ ImportBASDialog::ProcessBASLine(const char* buf, int len,
return true; // blank lines with whitespace are okay
else {
// end of line reached while scanning line number is bad
msg = "found nothing except line number";
msg = L"found nothing except line number";
return false;
}
}
@ -389,14 +390,14 @@ ImportBASDialog::ProcessBASLine(const char* buf, int len,
if (!isdigit(ch))
break;
if (tokenLen == 5) { // theoretical max is "65535"
msg = "line number has too many digits";
msg = L"line number has too many digits";
return false;
}
tokenBuf[tokenLen++] = ch;
}
if (!tokenLen) {
msg = "line did not start with a line number";
msg = L"line did not start with a line number";
return false;
}
tokenBuf[tokenLen] = '\0';
@ -661,7 +662,7 @@ void ImportBASDialog::OnOK(void)
CString appName;
appName.LoadString(IDS_MB_APP_NAME);
MessageBox("You must specify a filename.",
MessageBox(L"You must specify a filename.",
appName, MB_OK);
}
@ -671,7 +672,7 @@ void ImportBASDialog::OnOK(void)
GenericArchive::FileDetails details;
details.entryKind = GenericArchive::FileDetails::kFileKindDataFork;
details.origName = "Imported BASIC";
details.origName = L"Imported BASIC";
details.storageName = fileName;
details.access = 0xe3; // unlocked, backup bit set
details.fileType = kFileTypeBAS;
@ -697,7 +698,7 @@ void ImportBASDialog::OnOK(void)
bail:
if (!errMsg.IsEmpty()) {
CString msg;
msg.Format("Unable to import file: %s.", (const char *) errMsg);
msg.Format(L"Unable to import file: %ls.", (LPCWSTR) errMsg);
ShowFailureMsg(this, msg, IDS_FAILED);
return;
}

View File

@ -12,8 +12,8 @@
* neglected to "poke 33,33"). Have an optional "check syntax" box if we
* want to get really fancy.
*/
#ifndef __BASICIMPORT__
#define __BASICIMPORT__
#ifndef APP_BASICIMPORT_H
#define APP_BASICIMPORT_H
/*
* This is a helper class to scan for a token in the list.
@ -76,7 +76,7 @@ private:
afx_msg void OnHelp(void);
bool ImportBAS(const char* fileName);
bool ImportBAS(const WCHAR* fileName);
bool ConvertTextToBAS(const char* buf, long fileLen,
char** pOutBuf, long* pOutLen, ExpandBuffer* pMsgs);
bool ProcessBASLine(const char* buf, int len,
@ -101,4 +101,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__BASICIMPORT__*/
#endif /*APP_BASICIMPORT_H*/

View File

@ -60,8 +60,8 @@ CassImpTargetDialog::DoDataExchange(CDataExchange* pDX)
if (fFileTypeIndex == kTypeBIN) {
if (GetStartAddr() < 0) {
MessageBox("The address field must be a valid 4-digit "
" hexadecimal number.",
MessageBox(L"The address field must be a valid 4-digit "
L" hexadecimal number.",
appName, MB_OK);
pDX->Fail();
return;
@ -69,7 +69,7 @@ CassImpTargetDialog::DoDataExchange(CDataExchange* pDX)
fStartAddr = (unsigned short) GetStartAddr();
}
if (fFileName.IsEmpty()) {
MessageBox("You must enter a filename.", appName, MB_OK);
MessageBox(L"You must enter a filename.", appName, MB_OK);
pDX->Fail();
return;
}
@ -78,7 +78,7 @@ CassImpTargetDialog::DoDataExchange(CDataExchange* pDX)
CString tmpStr;
pWnd = GetDlgItem(IDC_CASSIMPTARG_BINADDR);
tmpStr.Format("%04X", fStartAddr);
tmpStr.Format(L"%04X", fStartAddr);
pWnd->SetWindowText(tmpStr);
}
}
@ -113,7 +113,7 @@ CassImpTargetDialog::OnAddrChange(void)
if (val < 0)
val = 0;
tmpStr.Format(".%04X", val + fFileLength-1);
tmpStr.Format(L".%04X", val + fFileLength-1);
pWnd = GetDlgItem(IDC_CASSIMPTARG_RANGE);
pWnd->SetWindowText(tmpStr);
@ -134,18 +134,18 @@ CassImpTargetDialog::GetStartAddr(void) const
CString aux;
pWnd->GetWindowText(aux);
const char* str = aux;
char* end;
const WCHAR* str = aux;
WCHAR* end;
long val;
if (str[0] == '\0') {
WMSG0(" HEY: blank addr, returning -1\n");
return -1;
}
val = strtoul(aux, &end, 16);
if (end != str + strlen(str)) {
WMSG1(" HEY: found some garbage in addr '%s', returning -1\n",
(LPCTSTR) aux);
val = wcstoul(aux, &end, 16);
if (end != str + wcslen(str)) {
WMSG1(" HEY: found some garbage in addr '%ls', returning -1\n",
(LPCWSTR) aux);
return -1;
}
return val;

View File

@ -7,8 +7,8 @@
* Choose file name and characteristics for a file imported from an audio
* cassette tape.
*/
#ifndef __CASSIMPTARGETDIALOG__
#define __CASSIMPTARGETDIALOG__
#ifndef APP_CASSIMPTARGETDIALOG_H
#define APP_CASSIMPTARGETDIALOG_H
#include "resource.h"
@ -49,4 +49,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__CASSIMPTARGETDIALOG__*/
#endif /*APP_CASSIMPTARGETDIALOG_H*/

View File

@ -314,19 +314,19 @@ CassetteDialog::OnInitDialog(void)
int width0, width1, width2, width3, width4;
pListView->GetClientRect(&rect);
width0 = pListView->GetStringWidth("XXIndexX");
width1 = pListView->GetStringWidth("XXFormatXmmmmmmmmmmmmmm");
width2 = pListView->GetStringWidth("XXLengthXm");
width3 = pListView->GetStringWidth("XXChecksumXm");
width4 = pListView->GetStringWidth("XXStart sampleX");
width0 = pListView->GetStringWidth(L"XXIndexX");
width1 = pListView->GetStringWidth(L"XXFormatXmmmmmmmmmmmmmm");
width2 = pListView->GetStringWidth(L"XXLengthXm");
width3 = pListView->GetStringWidth(L"XXChecksumXm");
width4 = pListView->GetStringWidth(L"XXStart sampleX");
//width5 = pListView->GetStringWidth("XXEnd sampleX");
pListView->InsertColumn(0, "Index", LVCFMT_LEFT, width0);
pListView->InsertColumn(1, "Format", LVCFMT_LEFT, width1);
pListView->InsertColumn(2, "Length", LVCFMT_LEFT, width2);
pListView->InsertColumn(3, "Checksum", LVCFMT_LEFT, width3);
pListView->InsertColumn(4, "Start sample", LVCFMT_LEFT, width4);
pListView->InsertColumn(5, "End sample", LVCFMT_LEFT,
pListView->InsertColumn(0, L"Index", LVCFMT_LEFT, width0);
pListView->InsertColumn(1, L"Format", LVCFMT_LEFT, width1);
pListView->InsertColumn(2, L"Length", LVCFMT_LEFT, width2);
pListView->InsertColumn(3, L"Checksum", LVCFMT_LEFT, width3);
pListView->InsertColumn(4, L"Start sample", LVCFMT_LEFT, width4);
pListView->InsertColumn(5, L"End sample", LVCFMT_LEFT,
rect.Width() - (width0+width1+width2+width3+width4)
/*- ::GetSystemMetrics(SM_CXVSCROLL)*/ );
@ -480,7 +480,7 @@ CassetteDialog::OnImport(void)
bail:
if (!errMsg.IsEmpty()) {
CString msg;
msg.Format("Unable to import file: %s.", (const char *) errMsg);
msg.Format(L"Unable to import file: %ls.", (LPCWSTR) errMsg);
ShowFailureMsg(this, msg, IDS_FAILED);
return;
}
@ -511,13 +511,13 @@ CassetteDialog::AnalyzeWAV(void)
if (pFormat->nChannels < 1 || pFormat->nChannels > 2 ||
(pFormat->wBitsPerSample != 8 && pFormat->wBitsPerSample != 16))
{
errMsg.Format("Unexpected PCM format (%d channels, %d bits/sample)",
errMsg.Format(L"Unexpected PCM format (%d channels, %d bits/sample)",
pFormat->nChannels, pFormat->wBitsPerSample);
ShowFailureMsg(this, errMsg, IDS_FAILED);
return false;
}
if (soundFile.GetDataLen() % soundFile.GetBPS() != 0) {
errMsg.Format("Unexpected sound data length (%ld, samples are %d bytes)",
errMsg.Format(L"Unexpected sound data length (%ld, samples are %d bytes)",
soundFile.GetDataLen(), soundFile.GetBPS());
ShowFailureMsg(this, errMsg, IDS_FAILED);
return false;
@ -560,41 +560,41 @@ CassetteDialog::AddEntry(int idx, CListCtrl* pListCtrl, long* pFileType)
ASSERT(pDataBuf != nil);
tmpStr.Format("%d", idx);
tmpStr.Format(L"%d", idx);
pListCtrl->InsertItem(idx, tmpStr);
*pFileType = kFileTypeBIN;
if (pData->GetDataLen() == 2) {
tmpStr.Format("Integer header ($%04X)",
tmpStr.Format(L"Integer header ($%04X)",
pDataBuf[0] | pDataBuf[1] << 8);
} else if (pData->GetDataLen() == 3) {
tmpStr.Format("Applesoft header ($%04X $%02x)",
tmpStr.Format(L"Applesoft header ($%04X $%02x)",
pDataBuf[0] | pDataBuf[1] << 8, pDataBuf[2]);
} else if (pData->GetDataLen() > 3 && idx > 0 &&
fDataArray[idx-1].GetDataLen() == 2)
{
tmpStr = "Integer BASIC";
tmpStr = L"Integer BASIC";
*pFileType = kFileTypeINT;
} else if (pData->GetDataLen() > 3 && idx > 0 &&
fDataArray[idx-1].GetDataLen() == 3)
{
tmpStr = "Applesoft BASIC";
tmpStr = L"Applesoft BASIC";
*pFileType = kFileTypeBAS;
} else {
tmpStr = "Binary";
tmpStr = L"Binary";
}
pListCtrl->SetItemText(idx, 1, tmpStr);
tmpStr.Format("%d", pData->GetDataLen());
tmpStr.Format(L"%d", pData->GetDataLen());
pListCtrl->SetItemText(idx, 2, tmpStr);
if (pData->GetDataChkGood())
tmpStr.Format("Good (0x%02x)", pData->GetDataChecksum());
tmpStr.Format(L"Good (0x%02x)", pData->GetDataChecksum());
else
tmpStr.Format("BAD (0x%02x)", pData->GetDataChecksum());
tmpStr.Format(L"BAD (0x%02x)", pData->GetDataChecksum());
pListCtrl->SetItemText(idx, 3, tmpStr);
tmpStr.Format("%ld", pData->GetDataOffset());
tmpStr.Format(L"%ld", pData->GetDataOffset());
pListCtrl->SetItemText(idx, 4, tmpStr);
tmpStr.Format("%ld", pData->GetDataEndOffset());
tmpStr.Format(L"%ld", pData->GetDataEndOffset());
pListCtrl->SetItemText(idx, 5, tmpStr);
}

View File

@ -6,8 +6,8 @@
/*
* Apple II cassette I/O functions.
*/
#ifndef __CASSETTEDIALOG__
#define __CASSETTEDIALOG__
#ifndef APP_CASSETTEDIALOG_H
#define APP_CASSETTEDIALOG_H
/*
* The dialog box is primarily concerned with extracting the original data
@ -157,4 +157,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__CASSETTEDIALOG__*/
#endif /*APP_CASSETTEDIALOG_H*/

View File

@ -6,8 +6,8 @@
/*
* Choose the sub-volume and directory where added files will be put.
*/
#ifndef __CHOOSE_ADD_TARGET_DIALOG__
#define __CHOOSE_ADD_TARGET_DIALOG__
#ifndef APP_CHOOSEADDTARGETDIALOG_H
#define APP_CHOOSEADDTARGETDIALOG_H
#include "resource.h"
#include "DiskFSTree.h"
@ -44,4 +44,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__CHOOSE_ADD_TARGET_DIALOG__*/
#endif /*APP_CHOOSEADDTARGETDIALOG_H*/

View File

@ -53,8 +53,8 @@ ChooseDirDialog::OnInitDialog(void)
fShellTree.TunnelTree(fPathName, &msg);
if (!msg.IsEmpty()) {
/* failed */
WMSG2("TunnelTree failed on '%s' (%s), using MyComputer instead\n",
fPathName, msg);
WMSG2("TunnelTree failed on '%ls' (%ls), using MyComputer instead\n",
(LPCWSTR) fPathName, (LPCWSTR) msg);
fShellTree.ExpandMyComputer();
}
}
@ -117,7 +117,7 @@ ChooseDirDialog::OnSelChanged(NMHDR* pnmh, LRESULT* pResult)
if (fShellTree.GetFolderPath(&path))
fPathName = path;
else
fPathName = "";
fPathName = L"";
pWnd->SetWindowText(fPathName);
// disable the "Select" button when there's no path ready
@ -128,7 +128,7 @@ ChooseDirDialog::OnSelChanged(NMHDR* pnmh, LRESULT* pResult)
// It's confusing to have two different paths showing, so wipe out the
// free entry field when the selection changes.
pWnd = GetDlgItem(IDC_CHOOSEDIR_PATHEDIT);
pWnd->SetWindowText("");
pWnd->SetWindowText(L"");
*pResult = 0;
}
@ -164,8 +164,8 @@ void
ChooseDirDialog::OnNewFolder(void)
{
if (fPathName.IsEmpty()) {
MessageBox("You can't create a folder in this part of the tree.",
"Bad Location", MB_OK | MB_ICONERROR);
MessageBox(L"You can't create a folder in this part of the tree.",
L"Bad Location", MB_OK | MB_ICONERROR);
return;
}
@ -182,11 +182,11 @@ ChooseDirDialog::OnNewFolder(void)
*/
if (fShellTree.AddFolderAtSelection(newFolderDlg.fNewFolder)) {
CString msg;
WMSG1("Success, tunneling to '%s'\n",
newFolderDlg.fNewFullPath);
WMSG1("Success, tunneling to '%ls'\n",
(LPCWSTR) newFolderDlg.fNewFullPath);
fShellTree.TunnelTree(newFolderDlg.fNewFullPath, &msg);
if (!msg.IsEmpty()) {
WMSG1("TunnelTree failed: %s\n", (LPCTSTR) msg);
WMSG1("TunnelTree failed: %ls\n", (LPCWSTR) msg);
}
} else {
WMSG0("AddFolderAtSelection FAILED\n");

View File

@ -6,8 +6,8 @@
/*
* Dialog for choosing a directory.
*/
#ifndef __CHOOSEDIRDIALOG__
#define __CHOOSEDIRDIALOG__
#ifndef APP_CHOOSEDIRDIALOG
#define APP_CHOOSEDIRDIALOG
#include "../util/UtilLib.h"
#include "resource.h"
@ -22,14 +22,14 @@ public:
ChooseDirDialog(CWnd* pParent = NULL, int dialogID = IDD_CHOOSEDIR) :
CDialog(dialogID, pParent)
{
fPathName = "";
fPathName = L"";
}
virtual ~ChooseDirDialog(void) {}
const char* GetPathName(void) const { return fPathName; }
const WCHAR* GetPathName(void) const { return fPathName; }
// set the pathname; when DoModal is called this will tunnel in
void SetPathName(const char* str) { fPathName = str; }
void SetPathName(const WCHAR* str) { fPathName = str; }
protected:
virtual BOOL OnInitDialog(void);
@ -50,4 +50,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__CHOOSEDIRDIALOG__*/
#endif /*APP_CHOOSEDIRDIALOG*/

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
#include "PasteSpecialDialog.h"
static const char* kClipboardFmtName = "faddenSoft:CiderPress:v1";
static const WCHAR kClipboardFmtName[] = L"faddenSoft:CiderPress:v1";
const int kClipVersion = 1; // should match "vN" in fmt name
const unsigned short kEntrySignature = 0x4350;
@ -71,7 +71,7 @@ typedef enum EntryKind {
typedef struct FileCollectionEntry {
unsigned short signature; // let's be paranoid
unsigned short dataOffset; // offset to start of data
unsigned short fileNameLen; // len of filename
unsigned short fileNameLen; // len of (8-bit) filename, in bytes
unsigned long dataLen; // len of data fork
unsigned long rsrcLen; // len of rsrc fork
unsigned long cmmtLen; // len of comments
@ -138,7 +138,7 @@ MainWindow::OnEditCopy(void)
GenericEntry::kAnyThread | GenericEntry::kAllowDirectory);
if (selSet.GetNumEntries() == 0) {
errStr.LoadString(IDS_CLIPBOARD_NOITEMS);
MessageBox(errStr, "No match", MB_OK | MB_ICONEXCLAMATION);
MessageBox(errStr, L"No match", MB_OK | MB_ICONEXCLAMATION);
goto bail;
}
@ -151,21 +151,21 @@ MainWindow::OnEditCopy(void)
* Add the string to the clipboard. The clipboard will own the memory we
* allocate.
*/
hGlobal = ::GlobalAlloc(GHND | GMEM_SHARE, fileList.GetLength() +1);
size_t neededLen = (fileList.GetLength() + 1) * sizeof(WCHAR);
hGlobal = ::GlobalAlloc(GHND | GMEM_SHARE, neededLen);
if (hGlobal == nil) {
WMSG1("Failed allocating %ld bytes\n", fileList.GetLength() +1);
WMSG1("Failed allocating %d bytes\n", neededLen);
errStr.LoadString(IDS_CLIPBOARD_ALLOCFAILED);
ShowFailureMsg(this, errStr, IDS_FAILED);
goto bail;
}
WMSG1(" Allocated %ld bytes for file list on clipboard\n",
fileList.GetLength() +1);
WMSG1(" Allocated %ld bytes for file list on clipboard\n", neededLen);
pGlobal = ::GlobalLock(hGlobal);
ASSERT(pGlobal != nil);
strcpy((char*) pGlobal, fileList);
wcscpy((WCHAR*) pGlobal, fileList);
::GlobalUnlock(hGlobal);
SetClipboardData(CF_TEXT, hGlobal);
SetClipboardData(CF_UNICODETEXT, hGlobal);
/*
* Create a (potentially very large) buffer with the contents of the
@ -201,8 +201,8 @@ MainWindow::CreateFileList(SelectionSet* pSelSet)
SelectionEntry* pSelEntry;
GenericEntry* pEntry;
CString tmpStr, fullStr;
char fileTypeBuf[ContentList::kFileTypeBufLen];
char auxTypeBuf[ContentList::kAuxTypeBufLen];
WCHAR fileTypeBuf[ContentList::kFileTypeBufLen];
WCHAR auxTypeBuf[ContentList::kAuxTypeBufLen];
CString fileName, subVol, fileType, auxType, modDate, format, length;
pSelEntry = pSelSet->IterNext();
@ -218,9 +218,9 @@ MainWindow::CreateFileList(SelectionSet* pSelSet)
auxType = DblDblQuote(auxTypeBuf);
FormatDate(pEntry->GetModWhen(), &modDate);
format = pEntry->GetFormatStr();
length.Format("%I64d", (LONGLONG) pEntry->GetUncompressedLen());
length.Format(L"%I64d", (LONGLONG) pEntry->GetUncompressedLen());
tmpStr.Format("\"%s\"\t%s\t\"%s\"\t\"%s\"\t%s\t%s\t%s\r\n",
tmpStr.Format(L"\"%hs\"\t%hs\t\"%hs\"\t\"%hs\"\t%hs\t%hs\t%hs\r\n",
fileName, subVol, fileType, auxType, modDate, format, length);
fullStr += tmpStr;
@ -234,12 +234,12 @@ MainWindow::CreateFileList(SelectionSet* pSelSet)
* Double-up all double quotes.
*/
/*static*/ CString
MainWindow::DblDblQuote(const char* str)
MainWindow::DblDblQuote(const WCHAR* str)
{
CString result;
char* buf;
WCHAR* buf;
buf = result.GetBuffer(strlen(str) * 2 +1);
buf = result.GetBuffer(wcslen(str) * 2 +1);
while (*str != '\0') {
if (*str == '"') {
*buf++ = *str;
@ -287,7 +287,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
HGLOBAL hGlobal = nil;
HGLOBAL hResult = nil;
LPVOID pGlobal;
long totalLength, numFiles;
size_t totalLength, numFiles;
long priorLength;
/* get len of text version(s), with kluge to avoid close & reopen */
@ -311,7 +311,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
if (pEntry->GetRecordKind() != GenericEntry::kRecordKindVolumeDir) {
totalLength += sizeof(FileCollectionEntry);
totalLength += strlen(pEntry->GetPathName()) +1;
totalLength += wcslen(pEntry->GetPathName()) +1;
numFiles++;
if (pEntry->GetRecordKind() != GenericEntry::kRecordKindDirectory) {
totalLength += (long) pEntry->GetDataForkLen();
@ -355,9 +355,9 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
hGlobal = ::GlobalAlloc(GHND | GMEM_SHARE, totalLength);
if (hGlobal == nil) {
CString errMsg;
errMsg.Format("ERROR: unable to allocate %ld bytes for copy",
errMsg.Format(L"ERROR: unable to allocate %ld bytes for copy",
totalLength);
WMSG1("%s\n", (const char*) errMsg);
WMSG1("%ls\n", (LPCWSTR) errMsg);
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
@ -374,7 +374,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
ASSERT(fpActionProgress == nil);
fpActionProgress = new ActionProgressDialog;
fpActionProgress->Create(ActionProgressDialog::kActionExtract, this);
fpActionProgress->SetFileName("Clipboard");
fpActionProgress->SetFileName(L"Clipboard");
/*
* Extract the data into the buffer.
@ -392,7 +392,8 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
pEntry = pSelEntry->GetEntry();
ASSERT(pEntry != nil);
fpActionProgress->SetArcName(pEntry->GetDisplayName());
CString displayName(pEntry->GetDisplayName());
fpActionProgress->SetArcName(displayName);
errStr = CopyToCollection(pEntry, &buf, &remainingLen);
if (!errStr.IsEmpty()) {
@ -488,7 +489,7 @@ MainWindow::CopyToCollection(GenericEntry* pEntry, void** pBuf, long* pBufLen)
memset(&collEnt, 0x99, sizeof(collEnt));
collEnt.signature = kEntrySignature;
collEnt.dataOffset = sizeof(collEnt);
collEnt.fileNameLen = strlen(pEntry->GetPathName()) +1;
collEnt.fileNameLen = wcslen(pEntry->GetPathName()) +1;
if (pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory) {
collEnt.dataLen = collEnt.rsrcLen = collEnt.cmmtLen = 0;
} else {
@ -622,6 +623,7 @@ MainWindow::OnEditPaste(void)
DoPaste(pasteJunkPaths);
}
void
MainWindow::OnUpdateEditPaste(CCmdUI* pCmdUI)
{
@ -668,6 +670,7 @@ MainWindow::OnEditPasteSpecial(void)
DoPaste(pasteJunkPaths);
}
void
MainWindow::OnUpdateEditPasteSpecial(CCmdUI* pCmdUI)
{
@ -708,10 +711,10 @@ MainWindow::DoPaste(bool pasteJunkPaths)
WMSG1("Found %d clipboard formats\n", CountClipboardFormats());
while ((format = EnumClipboardFormats(format)) != 0) {
CString tmpStr;
tmpStr.Format(" %u", format);
tmpStr.Format(L" %u", format);
buildStr += tmpStr;
}
WMSG1(" %s\n", buildStr);
WMSG1(" %ls\n", (LPCWSTR) buildStr);
#if 0
if (IsClipboardFormatAvailable(CF_HDROP)) {
@ -820,14 +823,14 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths)
*/
if (fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveDiskImage) {
if (!ChooseAddTarget(&pTargetSubdir, &xferOpts.fpTargetFS))
return "";
return L"";
}
fpOpenArchive->XferPrepare(&xferOpts);
xferPrepped = true;
if (pTargetSubdir != nil) {
storagePrefix = pTargetSubdir->GetPathName();
WMSG1("--- using storagePrefix '%s'\n", (const char*) storagePrefix);
WMSG1("--- using storagePrefix '%ls'\n", (LPCWSTR) storagePrefix);
}
/*
@ -836,7 +839,7 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths)
ASSERT(fpActionProgress == nil);
fpActionProgress = new ActionProgressDialog;
fpActionProgress->Create(ActionProgressDialog::kActionAdd, this);
fpActionProgress->SetArcName("Clipboard data");
fpActionProgress->SetArcName(L"Clipboard data");
/*
* Loop over all files.
@ -923,8 +926,8 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths)
*/
processErrStr = ProcessClipboardEntry(&collEnt, fileName, buf, bufLen);
if (!processErrStr.IsEmpty()) {
errMsg.Format("Unable to paste '%s': %s.",
(const char*) fileName, (const char*) processErrStr);
errMsg.Format(L"Unable to paste '%ls': %ls.",
(LPCWSTR) fileName, (LPCWSTR) processErrStr);
goto bail;
}
@ -959,7 +962,7 @@ bail:
*/
CString
MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt,
const char* pathName, const unsigned char* buf, long remLen)
const WCHAR* pathName, const unsigned char* buf, long remLen)
{
GenericArchive::FileDetails::FileKind entryKind;
GenericArchive::FileDetails details;
@ -969,10 +972,10 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt,
CString errMsg;
entryKind = (GenericArchive::FileDetails::FileKind) pCollEnt->entryKind;
WMSG2(" Processing '%s' (%d)\n", pathName, entryKind);
WMSG2(" Processing '%ls' (%d)\n", pathName, entryKind);
details.entryKind = entryKind;
details.origName = "Clipboard";
details.origName = L"Clipboard";
details.storageName = pathName;
details.fileSysFmt = (DiskImg::FSFormat) pCollEnt->sourceFS;
details.fileSysInfo = pCollEnt->fssep;

View File

@ -49,8 +49,8 @@ RenameOverwriteDialog::DoDataExchange(CDataExchange* pDX)
/* validate the path field */
if (pDX->m_bSaveAndValidate) {
if (fNewName.IsEmpty()) {
MessageBox("You must specify a new name.",
"CiderPress", MB_OK);
MessageBox(L"You must specify a new name.",
L"CiderPress", MB_OK);
pDX->Fail();
}
@ -98,7 +98,7 @@ ConfirmOverwriteDialog::OnInitDialog(void)
pWnd = GetDlgItem(IDC_OVWR_EXIST_INFO);
ASSERT(pWnd != nil);
FormatDate(fExistingFileModWhen, &dateStr);
tmpStr.Format("Modified %s", dateStr);
tmpStr.Format(L"Modified %ls", dateStr);
pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_OVWR_NEW_NAME);
@ -108,7 +108,7 @@ ConfirmOverwriteDialog::OnInitDialog(void)
pWnd = GetDlgItem(IDC_OVWR_NEW_INFO);
ASSERT(pWnd != nil);
FormatDate(fNewFileModWhen, &dateStr);
tmpStr.Format("Modified %s", dateStr);
tmpStr.Format(L"Modified %ls", dateStr);
pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_OVWR_RENAME);

View File

@ -6,8 +6,8 @@
/*
* Ask for confirmation before overwriting a file.
*/
#ifndef __CONFIRMOVERWRITEDIALOG__
#define __CONFIRMOVERWRITEDIALOG__
#ifndef APP_CONFIRMOVERWRITEDIALOG_H
#define APP_CONFIRMOVERWRITEDIALOG_H
#include "resource.h"
@ -90,4 +90,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__CONFIRMOVERWRITEDIALOG__*/
#endif /*APP_CONFIRMOVERWRITEDIALOG_H*/

View File

@ -110,7 +110,7 @@ ContentList::OnCreate(LPCREATESTRUCT lpcs)
/* load the data and sort it */
if (LoadData() != 0) {
MessageBox("Not all entries were loaded.", "Error",
MessageBox(L"Not all entries were loaded.", L"Error",
MB_OK | MB_ICONSTOP);
/* keep going with what we've got; the error only affects display */
}
@ -368,7 +368,7 @@ ContentList::NewSortOrder(void)
* Use kFileTypeBufLen.
*/
/*static*/ void
ContentList::MakeFileTypeDisplayString(const GenericEntry* pEntry, char* buf)
ContentList::MakeFileTypeDisplayString(const GenericEntry* pEntry, WCHAR* buf)
{
bool isDir =
pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir ||
@ -376,30 +376,30 @@ ContentList::MakeFileTypeDisplayString(const GenericEntry* pEntry, char* buf)
if (pEntry->GetSourceFS() == DiskImg::kFormatMacHFS && isDir) {
/* HFS directories don't have types; fake it */
::lstrcpy(buf, "DIR/");
wcscpy(buf, L"DIR/");
} else if (!(pEntry->GetFileType() >= 0 && pEntry->GetFileType() <= 0xff))
{
/* oversized type; assume it's HFS */
char typeBuf[kFileTypeBufLen];
WCHAR typeBuf[kFileTypeBufLen];
MakeMacTypeString(pEntry->GetFileType(), typeBuf);
switch (pEntry->GetRecordKind()) {
case GenericEntry::kRecordKindFile:
::lstrcpy(buf, typeBuf);
wcscpy(buf, typeBuf);
break;
case GenericEntry::kRecordKindForkedFile:
::sprintf(buf, "%s+", typeBuf);
wsprintf(buf, L"%ls+", typeBuf);
break;
case GenericEntry::kRecordKindUnknown:
// shouldn't happen
::sprintf(buf, "%s-", typeBuf);
wsprintf(buf, L"%ls-", typeBuf);
break;
case GenericEntry::kRecordKindVolumeDir:
case GenericEntry::kRecordKindDirectory:
case GenericEntry::kRecordKindDisk:
default:
ASSERT(FALSE);
::lstrcpy(buf, "!!!");
wcscpy(buf, L"!!!");
break;
}
} else {
@ -407,24 +407,24 @@ ContentList::MakeFileTypeDisplayString(const GenericEntry* pEntry, char* buf)
switch (pEntry->GetRecordKind()) {
case GenericEntry::kRecordKindVolumeDir:
case GenericEntry::kRecordKindDirectory:
::sprintf(buf, "%s/", pEntry->GetFileTypeString());
wsprintf(buf, L"%ls/", pEntry->GetFileTypeString());
break;
case GenericEntry::kRecordKindFile:
::sprintf(buf, "%s", pEntry->GetFileTypeString());
wsprintf(buf, L"%ls", pEntry->GetFileTypeString());
break;
case GenericEntry::kRecordKindForkedFile:
::sprintf(buf, "%s+", pEntry->GetFileTypeString());
wsprintf(buf, L"%ls+", pEntry->GetFileTypeString());
break;
case GenericEntry::kRecordKindDisk:
::lstrcpy(buf, "Disk");
wcscpy(buf, L"Disk");
break;
case GenericEntry::kRecordKindUnknown:
// usually a GSHK-archived empty data file does this
::sprintf(buf, "%s-", pEntry->GetFileTypeString());
wsprintf(buf, L"%ls-", pEntry->GetFileTypeString());
break;
default:
ASSERT(FALSE);
::lstrcpy(buf, "!!!");
wcscpy(buf, L"!!!");
break;
}
}
@ -437,7 +437,7 @@ ContentList::MakeFileTypeDisplayString(const GenericEntry* pEntry, char* buf)
* kFileTypeBufLen.
*/
/*static*/ void
ContentList::MakeMacTypeString(unsigned long val, char* buf)
ContentList::MakeMacTypeString(unsigned long val, WCHAR* buf)
{
/* expand longword with ASCII type bytes */
buf[0] = (unsigned char) (val >> 24);
@ -460,7 +460,7 @@ ContentList::MakeMacTypeString(unsigned long val, char* buf)
* Use kFileTypeBufLen.
*/
/*static*/ void
ContentList::MakeAuxTypeDisplayString(const GenericEntry* pEntry, char* buf)
ContentList::MakeAuxTypeDisplayString(const GenericEntry* pEntry, WCHAR* buf)
{
bool isDir =
pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir ||
@ -468,16 +468,16 @@ ContentList::MakeAuxTypeDisplayString(const GenericEntry* pEntry, char* buf)
if (pEntry->GetSourceFS() == DiskImg::kFormatMacHFS && isDir) {
/* HFS directories don't have types; fake it */
::lstrcpy(buf, " ");
wcscpy(buf, L" ");
} else if (!(pEntry->GetFileType() >= 0 && pEntry->GetFileType() <= 0xff))
{
/* oversized type; assume it's HFS */
MakeMacTypeString(pEntry->GetAuxType(), buf);
} else {
if (pEntry->GetRecordKind() == GenericEntry::kRecordKindDisk)
::sprintf(buf, "%dk", pEntry->GetUncompressedLen() / 1024);
wsprintf(buf, L"%dk", pEntry->GetUncompressedLen() / 1024);
else
::sprintf(buf, "$%04lX", pEntry->GetAuxType());
wsprintf(buf, L"$%04lX", pEntry->GetAuxType());
}
}
@ -489,7 +489,7 @@ ContentList::MakeAuxTypeDisplayString(const GenericEntry* pEntry, char* buf)
* "buf" must be able to hold at least 6 chars plus the NULL.
*/
void
ContentList::MakeRatioDisplayString(const GenericEntry* pEntry, char* buf,
ContentList::MakeRatioDisplayString(const GenericEntry* pEntry, WCHAR* buf,
int* pPerc)
{
LONGLONG totalLen, totalCompLen;
@ -497,14 +497,14 @@ ContentList::MakeRatioDisplayString(const GenericEntry* pEntry, char* buf,
totalCompLen = pEntry->GetCompressedLen();
if ((!totalLen && totalCompLen) || (totalLen && !totalCompLen)) {
::lstrcpy(buf, "---"); /* weird */
wcscpy(buf, L"---"); /* weird */
*pPerc = -1;
} else if (totalLen < totalCompLen) {
::lstrcpy(buf, ">100%"); /* compression failed? */
wcscpy(buf, L">100%"); /* compression failed? */
*pPerc = 101;
} else {
*pPerc = ComputePercent(totalCompLen, totalLen);
::sprintf(buf, "%d%%", *pPerc);
wsprintf(buf, L"%d%%", *pPerc);
}
}
@ -518,13 +518,12 @@ ContentList::MakeRatioDisplayString(const GenericEntry* pEntry, char* buf,
void
ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult)
{
//static const char kAccessBits[] = "DNB IWR";
static const char kAccessBits[] = "dnb iwr";
static const WCHAR kAccessBits[] = L"dnb iwr";
LV_DISPINFO* plvdi = (LV_DISPINFO*) pnmh;
CString str;
if (fpArchive->GetReloadFlag()) {
::lstrcpy(plvdi->item.pszText, "");
wcscpy(plvdi->item.pszText, L"");
*pResult = 0;
return;
}
@ -537,13 +536,13 @@ ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult)
switch (plvdi->item.iSubItem) {
case 0: // pathname
if ((int)strlen(pEntry->GetDisplayName()) > plvdi->item.cchTextMax) {
if (wcslen(pEntry->GetDisplayName()) > plvdi->item.cchTextMax) {
// looks like current limit is 264 chars, which we could hit
::strncpy(plvdi->item.pszText, pEntry->GetDisplayName(),
wcsncpy(plvdi->item.pszText, pEntry->GetDisplayName(),
plvdi->item.cchTextMax);
plvdi->item.pszText[plvdi->item.cchTextMax-1] = '\0';
} else {
::lstrcpy(plvdi->item.pszText, pEntry->GetDisplayName());
wcscpy(plvdi->item.pszText, pEntry->GetDisplayName());
}
/*
@ -553,10 +552,10 @@ ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult)
* it a little.
*/
{
unsigned char* str = (unsigned char*) plvdi->item.pszText;
WCHAR* str = plvdi->item.pszText;
while (*str != '\0') {
*str = DiskImg::MacToASCII(*str);
*str = DiskImg::MacToASCII((unsigned char) (*str));
str++;
}
}
@ -576,20 +575,20 @@ ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult)
break;
case 4: // format
ASSERT(pEntry->GetFormatStr() != nil);
::lstrcpy(plvdi->item.pszText, pEntry->GetFormatStr());
wcscpy(plvdi->item.pszText, pEntry->GetFormatStr());
break;
case 5: // size
::sprintf(plvdi->item.pszText, "%ld", pEntry->GetUncompressedLen());
wsprintf(plvdi->item.pszText, L"%ld", pEntry->GetUncompressedLen());
break;
case 6: // ratio
int crud;
MakeRatioDisplayString(pEntry, plvdi->item.pszText, &crud);
break;
case 7: // packed
::sprintf(plvdi->item.pszText, "%ld", pEntry->GetCompressedLen());
wsprintf(plvdi->item.pszText, L"%ld", pEntry->GetCompressedLen());
break;
case 8: // access
char bitLabels[sizeof(kAccessBits)];
WCHAR bitLabels[sizeof(kAccessBits)];
int i, j, mask;
for (i = 0, j = 0, mask = 0x80; i < 8; i++, mask >>= 1) {
@ -599,7 +598,7 @@ ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult)
bitLabels[j] = '\0';
ASSERT(j < sizeof(bitLabels));
//::sprintf(plvdi->item.pszText, "0x%02x", pEntry->GetAccess());
::lstrcpy(plvdi->item.pszText, bitLabels);
wcscpy(plvdi->item.pszText, bitLabels);
break;
case 9: // NuRecordIdx [hidden]
break;
@ -621,7 +620,7 @@ ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult)
/*
* Helper functions for sort routine.
*/
static inline
static inline int
CompareUnsignedLong(unsigned long u1, unsigned long u2)
{
if (u1 < u2)
@ -631,7 +630,7 @@ CompareUnsignedLong(unsigned long u1, unsigned long u2)
else
return 0;
}
static inline
static inline int
CompareLONGLONG(LONGLONG u1, LONGLONG u2)
{
if (u1 < u2)
@ -650,8 +649,8 @@ ContentList::CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
const GenericEntry* pEntry1 = (const GenericEntry*) lParam1;
const GenericEntry* pEntry2 = (const GenericEntry*) lParam2;
char tmpBuf1[16]; // needs >= 5 for file type compare, and
char tmpBuf2[16]; // >= 7 for ratio string
WCHAR tmpBuf1[16]; // needs >= 5 for file type compare, and
WCHAR tmpBuf2[16]; // >= 7 for ratio string
int result;
/* for descending order, flip the parameters */
@ -665,12 +664,12 @@ ContentList::CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
switch (lParamSort) {
case 0: // pathname
result = ::stricmp(pEntry1->GetDisplayName(), pEntry2->GetDisplayName());
result = wcsicmp(pEntry1->GetDisplayName(), pEntry2->GetDisplayName());
break;
case 1: // file type
MakeFileTypeDisplayString(pEntry1, tmpBuf1);
MakeFileTypeDisplayString(pEntry2, tmpBuf2);
result = ::stricmp(tmpBuf1, tmpBuf2);
result = wcsicmp(tmpBuf1, tmpBuf2);
if (result != 0)
break;
/* else fall through to case 2 */
@ -786,30 +785,28 @@ ContentList::GetDefaultWidth(int col)
retval = 200;
break;
case 1: // type (need "$XY" and long HFS types)
//retval = MaxVal(GetStringWidth("XXMMM+"), GetStringWidth("XXType"));
retval = MaxVal(GetStringWidth("XXMMMM+"), GetStringWidth("XXType"));
retval = MaxVal(GetStringWidth(L"XXMMMM+"), GetStringWidth(L"XXType"));
break;
case 2: // auxtype (hex or long HFS type)
//retval = MaxVal(GetStringWidth("XX$8888"), GetStringWidth("XXAux"));
retval = MaxVal(GetStringWidth("XX$CCCC"), GetStringWidth("XXAux"));
retval = MaxVal(GetStringWidth(L"XX$CCCC"), GetStringWidth(L"XXAux"));
break;
case 3: // mod date
retval = GetStringWidth("XX88-MMM-88 88:88");
retval = GetStringWidth(L"XX88-MMM-88 88:88");
break;
case 4: // format
retval = GetStringWidth("XXUncompr");
retval = GetStringWidth(L"XXUncompr");
break;
case 5: // uncompressed size
retval = GetStringWidth("XX88888888");
retval = GetStringWidth(L"XX88888888");
break;
case 6: // ratio
retval = MaxVal(GetStringWidth("XXRatio"), GetStringWidth("XX100%"));
retval = MaxVal(GetStringWidth(L"XXRatio"), GetStringWidth(L"XX100%"));
break;
case 7: // packed
retval = GetStringWidth("XX88888888");
retval = GetStringWidth(L"XX88888888");
break;
case 8: // access
retval = MaxVal(GetStringWidth("XXAccess"), GetStringWidth("XXdnbiwr"));
retval = MaxVal(GetStringWidth(L"XXAccess"), GetStringWidth(L"XXdnbiwr"));
break;
default:
ASSERT(false);
@ -869,7 +866,7 @@ ContentList::OnDoubleClick(NMHDR*, LRESULT* pResult)
int idx = HitTest(point);
if (idx != -1) {
CString str = GetItemText(idx, 0);
WMSG1("%s was double-clicked\n", str);
WMSG1("%ls was double-clicked\n", (LPCWSTR) str);
}
((MainWindow*) ::AfxGetMainWnd())->HandleDoubleClick();
@ -898,8 +895,7 @@ ContentList::OnRightClick(NMHDR*, LRESULT* pResult)
int idx = HitTest(point);
if (idx != -1) {
CString str = GetItemText(idx, 0);
//TRACE1("%s was right-clicked\n", str);
WMSG1("%s was right-clicked\n", str);
WMSG1("%ls was right-clicked\n", (LPCWSTR) str);
//fRightClickItem = idx;
#else
@ -1016,15 +1012,15 @@ ContentList::SelectSubdirContents(void)
* Select every entry whose display name has "displayPrefix" as a prefix.
*/
void
ContentList::SelectSubdir(const char* displayPrefix)
ContentList::SelectSubdir(const WCHAR* displayPrefix)
{
WMSG1(" ContentList selecting all in '%s'\n", displayPrefix);
int len = strlen(displayPrefix);
WMSG1(" ContentList selecting all in '%ls'\n", displayPrefix);
int len = wcslen(displayPrefix);
for (int i = GetItemCount()-1; i >= 0; i--) {
GenericEntry* pEntry = (GenericEntry*) GetItemData(i);
if (strncasecmp(displayPrefix, pEntry->GetDisplayName(), len) == 0)
if (wcsnicmp(displayPrefix, pEntry->GetDisplayName(), len) == 0)
SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
}
}
@ -1044,14 +1040,14 @@ ContentList::ClearSelection(void)
* If we find a matching entry, we clear the current selection and select it.
*/
void
ContentList::FindNext(const char* str, bool down, bool matchCase,
ContentList::FindNext(const WCHAR* str, bool down, bool matchCase,
bool wholeWord)
{
POSITION posn;
int i, num;
bool found = false;
WMSG4("FindNext '%s' d=%d c=%d w=%d\n", str, down, matchCase, wholeWord);
WMSG4("FindNext '%ls' d=%d c=%d w=%d\n", str, down, matchCase, wholeWord);
posn = GetFirstSelectedItemPosition();
num = GetNextSelectedItem(/*ref*/ posn);
@ -1108,26 +1104,26 @@ ContentList::FindNext(const char* str, bool down, bool matchCase,
* Compare "str" against the contents of entry "num".
*/
bool
ContentList::CompareFindString(int num, const char* str, bool matchCase,
ContentList::CompareFindString(int num, const WCHAR* str, bool matchCase,
bool wholeWord)
{
GenericEntry* pEntry = (GenericEntry*) GetItemData(num);
char fssep = pEntry->GetFssep();
char* (*pSubCompare)(const char* str, const char* subStr) = nil;
const WCHAR* (*pSubCompare)(const WCHAR* str, const WCHAR* subStr) = nil;
if (matchCase)
pSubCompare = strstr;
pSubCompare = wcsstr;
else
pSubCompare = stristr;
pSubCompare = Stristr;
if (wholeWord) {
const char* src = pEntry->GetDisplayName();
const char* start = src;
int strLen = strlen(str);
const WCHAR* src = pEntry->GetDisplayName();
const WCHAR* start = src;
size_t strLen = wcslen(str);
/* scan forward, looking for a match that starts & ends on fssep */
while (*start != '\0') {
const char* match;
const WCHAR* match;
match = (*pSubCompare)(start, str);

View File

@ -6,8 +6,8 @@
/*
* Class declaration for a list control showing archive contents.
*/
#ifndef __CONTENT_LIST__
#define __CONTENT_LIST__
#ifndef APP_CONTENTLIST_H
#define APP_CONTENTLIST_H
#include "GenericArchive.h"
#include "Preferences.h"
@ -59,8 +59,8 @@ public:
void SelectSubdirContents(void);
void FindNext(const char* str, bool down, bool matchCase, bool wholeWord);
bool CompareFindString(int num, const char* str, bool matchCase,
void FindNext(const WCHAR* str, bool down, bool matchCase, bool wholeWord);
bool CompareFindString(int num, const WCHAR* str, bool matchCase,
bool wholeWord);
//int GetRightClickItem(void) const { return fRightClickItem; }
@ -68,9 +68,9 @@ public:
enum { kFileTypeBufLen = 5, kAuxTypeBufLen = 6 };
static void MakeFileTypeDisplayString(const GenericEntry* pEntry,
char* buf);
WCHAR* buf);
static void MakeAuxTypeDisplayString(const GenericEntry* pEntry,
char* buf);
WCHAR* buf);
protected:
// overridden functions
@ -111,8 +111,8 @@ private:
int GetDefaultWidth(int col);
static void MakeMacTypeString(unsigned long val, char* buf);
static void MakeRatioDisplayString(const GenericEntry* pEntry, char* buf,
static void MakeMacTypeString(unsigned long val, WCHAR* buf);
static void MakeRatioDisplayString(const GenericEntry* pEntry, WCHAR* buf,
int* pPerc);
void SetSortIcon(void);
@ -121,7 +121,7 @@ private:
void OnDoubleClick(NMHDR* pnmh, LRESULT* pResult);
void OnRightClick(NMHDR* pnmh, LRESULT* pResult);
void SelectSubdir(const char* displayPrefix);
void SelectSubdir(const WCHAR* displayPrefix);
CImageList fHdrImageList;
CImageList fListImageList;
@ -133,4 +133,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__CONTENT_LIST__*/
#endif /*APP_CONTENTLIST_H*/

View File

@ -119,9 +119,10 @@ ConvDiskOptionsDialog::OnRadioChangeRange(UINT nID)
* Test a ProDOS filename for validity.
*/
bool
ConvDiskOptionsDialog::IsValidVolumeName_ProDOS(const char* name)
ConvDiskOptionsDialog::IsValidVolumeName_ProDOS(const WCHAR* name)
{
return DiskImgLib::DiskFSProDOS::IsValidVolumeName(name);
CStringA nameA(name);
return DiskImgLib::DiskFSProDOS::IsValidVolumeName(nameA);
}
@ -172,7 +173,7 @@ ConvDiskOptionsDialog::LimitSizeControls(long totalBlocks, long blocksUsed)
blocksUsed - NewDiskSize::GetNumBitmapBlocks_ProDOS(totalBlocks);
long sizeInK = usedWithoutBitmap / 2;
CString sizeStr, spaceReq;
sizeStr.Format("%dK", sizeInK);
sizeStr.Format(L"%dK", sizeInK);
spaceReq.Format(IDS_CONVDISK_SPACEREQ, sizeStr);
pWnd = GetDlgItem(IDC_CONVDISK_SPACEREQ);
@ -242,8 +243,8 @@ ConvDiskOptionsDialog::OnCompute(void)
if (selSet.GetNumEntries() == 0) {
/* should be impossible */
MessageBox("No files matched the selection criteria.",
"No match", MB_OK|MB_ICONEXCLAMATION);
MessageBox(L"No files matched the selection criteria.",
L"No match", MB_OK|MB_ICONEXCLAMATION);
return;
}
@ -253,26 +254,26 @@ ConvDiskOptionsDialog::OnCompute(void)
//xferOpts.fUseSparseBlocks =
// pPreferences->GetPrefBool(kPrProDOSUseSparse) != 0;
WMSG1("New volume name will be '%s'\n", fVolName);
WMSG1("New volume name will be '%ls'\n", fVolName);
/*
* Create a new disk image file.
*/
CString errStr;
char nameBuf[MAX_PATH];
WCHAR nameBuf[MAX_PATH];
UINT unique;
unique = GetTempFileName(pMain->GetPreferences()->GetPrefString(kPrTempPath),
"CPdisk", 0, nameBuf);
L"CPdisk", 0, nameBuf);
if (unique == 0) {
DWORD dwerr = ::GetLastError();
errStr.Format("GetTempFileName failed on '%s' (err=0x%08lx)\n",
errStr.Format(L"GetTempFileName failed on '%ls' (err=0x%08lx)\n",
pMain->GetPreferences()->GetPrefString(kPrTempPath), dwerr);
ShowFailureMsg(this, errStr, IDS_FAILED);
return;
}
WMSG1(" Will xfer to file '%s'\n", nameBuf);
WMSG1(" Will xfer to file '%ls'\n", nameBuf);
// annoying -- DiskArchive insists on creating it
(void) unlink(nameBuf);
(void) _wunlink(nameBuf);
DiskArchive::NewOptions options;
memset(&options, 0, sizeof(options));
@ -318,7 +319,7 @@ ConvDiskOptionsDialog::OnCompute(void)
dierr = pDiskFS->GetFreeSpaceCount(&totalBlocks, &freeBlocks,
&unitSize);
if (dierr != kDIErrNone) {
errStr.Format("Unable to get free space count: %s.\n",
errStr.Format(L"Unable to get free space count: %hs.\n",
DiskImgLib::DIStrError(dierr));
ShowFailureMsg(this, errStr, IDS_FAILED);
} else {
@ -340,5 +341,5 @@ ConvDiskOptionsDialog::OnCompute(void)
/* clean up */
delete xferOpts.fTarget;
(void) unlink(nameBuf);
(void) _wunlink(nameBuf);
}

View File

@ -6,8 +6,8 @@
/*
* Options for converting a disk image to a file archive.
*/
#ifndef __CONVDISK_OPTIONS_DIALOG__
#define __CONVDISK_OPTIONS_DIALOG__
#ifndef APP_CONVDISKOPTIONSDIALOG_H
#define APP_CONVDISKOPTIONSDIALOG_H
#include "UseSelectionDialog.h"
#include "resource.h"
@ -22,7 +22,7 @@ public:
{
fDiskSizeIdx = 0;
//fAllowLower = fSparseAlloc = FALSE;
fVolName = "NEW.DISK";
fVolName = L"NEW.DISK";
fNumBlocks = -1;
}
virtual ~ConvDiskOptionsDialog(void) {}
@ -45,9 +45,9 @@ private:
afx_msg void OnRadioChangeRange(UINT nID);
void LimitSizeControls(long totalBlocks, long blocksUsed);
bool IsValidVolumeName_ProDOS(const char* name);
bool IsValidVolumeName_ProDOS(const WCHAR* name);
DECLARE_MESSAGE_MAP()
};
#endif /*__CONVDISK_OPTIONS_DIALOG__*/
#endif /*APP_CONVDISKOPTIONSDIALOG_H*/

View File

@ -6,8 +6,8 @@
/*
* Options for converting a disk image to a file archive.
*/
#ifndef __CONVFILE_OPTIONS_DIALOG__
#define __CONVFILE_OPTIONS_DIALOG__
#ifndef APP_CONFFILEOPTIONSDIALOG_H
#define APP_CONFFILEOPTIONSDIALOG_H
#include "UseSelectionDialog.h"
#include "resource.h"
@ -35,4 +35,4 @@ private:
//DECLARE_MESSAGE_MAP()
};
#endif /*__CONVFILE_OPTIONS_DIALOG__*/
#endif /*APP_CONFFILEOPTIONSDIALOG_H*/

View File

@ -90,12 +90,12 @@ CreateImageDialog::DoDataExchange(CDataExchange* pDX)
if (fDiskFormatIdx == kFmtDOS32) {
CString tmpStr;
tmpStr.Format("%d", fDOSVolumeNum);
tmpStr.Format(L"%d", fDOSVolumeNum);
if (!IsValidVolumeName_DOS(tmpStr))
errMsg.LoadString(IDS_VALID_VOLNAME_DOS);
} else if (fDiskFormatIdx == kFmtDOS33) {
CString tmpStr;
tmpStr.Format("%d", fDOSVolumeNum);
tmpStr.Format(L"%d", fDOSVolumeNum);
if (!IsValidVolumeName_DOS(tmpStr))
errMsg.LoadString(IDS_VALID_VOLNAME_DOS);
@ -105,24 +105,24 @@ CreateImageDialog::DoDataExchange(CDataExchange* pDX)
(fNumBlocks <= 400 && (fNumBlocks % 8) != 0) ||
(fNumBlocks > 400 && (fNumBlocks % 16) != 0))
{
errMsg = "Specify a size between 144 blocks (18 tracks) and"
" 800 blocks (50 tracks/32 sectors). The block count"
" must be a multiple of 8 for 16-sector disks, or a"
" multiple of 16 for 32-sector disks. 32 sector"
" formatting starts at 400 blocks. Disks larger than"
" 400 blocks but less than 800 aren't recognized by"
" CiderPress.";
errMsg = L"Specify a size between 144 blocks (18 tracks) and"
L" 800 blocks (50 tracks/32 sectors). The block count"
L" must be a multiple of 8 for 16-sector disks, or a"
L" multiple of 16 for 32-sector disks. 32 sector"
L" formatting starts at 400 blocks. Disks larger than"
L" 400 blocks but less than 800 aren't recognized by"
L" CiderPress.";
}
} else if (fDiskFormatIdx == kFmtProDOS) {
// Max is really 65535, but we allow 65536 for creation of volumes
// that can be copied to CFFA cards.
if (fNumBlocks < 16 || fNumBlocks > 65536) {
errMsg = "Specify a size of at least 16 blocks and no more"
" than 65536 blocks.";
errMsg = L"Specify a size of at least 16 blocks and no more"
L" than 65536 blocks.";
} else if (fVolName_ProDOS.IsEmpty() ||
fVolName_ProDOS.GetLength() > kProDOSVolNameMax)
{
errMsg = "You must specify a volume name 1-15 characters long.";
errMsg = L"You must specify a volume name 1-15 characters long.";
} else {
if (!IsValidVolumeName_ProDOS(fVolName_ProDOS))
errMsg.LoadString(IDS_VALID_VOLNAME_PRODOS);
@ -131,27 +131,27 @@ CreateImageDialog::DoDataExchange(CDataExchange* pDX)
if (fVolName_Pascal.IsEmpty() ||
fVolName_Pascal.GetLength() > kPascalVolNameMax)
{
errMsg = "You must specify a volume name 1-7 characters long.";
errMsg = L"You must specify a volume name 1-7 characters long.";
} else {
if (!IsValidVolumeName_Pascal(fVolName_Pascal))
errMsg.LoadString(IDS_VALID_VOLNAME_PASCAL);
}
} else if (fDiskFormatIdx == kFmtHFS) {
if (fNumBlocks < 1600 || fNumBlocks > 4194303) {
errMsg = "Specify a size of at least 1600 blocks and no more"
" than 4194303 blocks.";
errMsg = L"Specify a size of at least 1600 blocks and no more"
L" than 4194303 blocks.";
} else if (fVolName_HFS.IsEmpty() ||
fVolName_HFS.GetLength() > kHFSVolNameMax)
{
errMsg = "You must specify a volume name 1-27 characters long.";
errMsg = L"You must specify a volume name 1-27 characters long.";
} else {
if (!IsValidVolumeName_HFS(fVolName_HFS))
errMsg.LoadString(IDS_VALID_VOLNAME_HFS);
}
} else if (fDiskFormatIdx == kFmtBlank) {
if (fNumBlocks < 1 || fNumBlocks > kMaxBlankBlocks)
errMsg = "Specify a size of at least 1 block and no more"
" than 16777216 blocks.";
errMsg = L"Specify a size of at least 1 block and no more"
L" than 16777216 blocks.";
} else {
ASSERT(false);
}
@ -294,36 +294,40 @@ CreateImageDialog::OnSizeChangeRange(UINT nID)
* Test a DOS filename for validity.
*/
bool
CreateImageDialog::IsValidVolumeName_DOS(const char* name)
CreateImageDialog::IsValidVolumeName_DOS(const WCHAR* name)
{
return DiskImgLib::DiskFSDOS33::IsValidVolumeName(name);
CStringA nameStr(name);
return DiskImgLib::DiskFSDOS33::IsValidVolumeName(nameStr);
}
/*
* Test a ProDOS filename for validity.
*/
bool
CreateImageDialog::IsValidVolumeName_ProDOS(const char* name)
CreateImageDialog::IsValidVolumeName_ProDOS(const WCHAR* name)
{
return DiskImgLib::DiskFSProDOS::IsValidVolumeName(name);
CStringA nameStr(name);
return DiskImgLib::DiskFSProDOS::IsValidVolumeName(nameStr);
}
/*
* Test a Pascal filename for validity.
*/
bool
CreateImageDialog::IsValidVolumeName_Pascal(const char* name)
CreateImageDialog::IsValidVolumeName_Pascal(const WCHAR* name)
{
return DiskImgLib::DiskFSPascal::IsValidVolumeName(name);
CStringA nameStr(name);
return DiskImgLib::DiskFSPascal::IsValidVolumeName(nameStr);
}
/*
* Test an HFS filename for validity.
*/
bool
CreateImageDialog::IsValidVolumeName_HFS(const char* name)
CreateImageDialog::IsValidVolumeName_HFS(const WCHAR* name)
{
return DiskImgLib::DiskFSHFS::IsValidVolumeName(name);
CStringA nameStr(name);
return DiskImgLib::DiskFSHFS::IsValidVolumeName(nameStr);
}

View File

@ -6,8 +6,8 @@
/*
* Options for creating a blank disk image.
*/
#ifndef __CREATE_IMAGE_DIALOG__
#define __CREATE_IMAGE_DIALOG__
#ifndef APP_CREATEIMAGEDIALOG_H
#define APP_CREATEIMAGEDIALOG_H
#include "resource.h"
@ -33,9 +33,9 @@ public:
fDiskFormatIdx = kFmtProDOS;
fAllocTracks_DOS = TRUE;
fDOSVolumeNum = 254;
fVolName_ProDOS = "NEW.DISK";
fVolName_Pascal = "BLANK";
fVolName_HFS = "New Disk";
fVolName_ProDOS = L"NEW.DISK";
fVolName_Pascal = L"BLANK";
fVolName_HFS = L"New Disk";
fNumBlocks = -2; // -1 has special meaning
fExtendedOpts = false;
}
@ -62,14 +62,14 @@ private:
afx_msg BOOL OnHelpInfo(HELPINFO* lpHelpInfo);
afx_msg void OnHelp(void);
bool IsValidVolumeName_DOS(const char* name);
bool IsValidVolumeName_ProDOS(const char* name);
bool IsValidVolumeName_Pascal(const char* name);
bool IsValidVolumeName_HFS(const char* name);
bool IsValidVolumeName_DOS(const WCHAR* name);
bool IsValidVolumeName_ProDOS(const WCHAR* name);
bool IsValidVolumeName_Pascal(const WCHAR* name);
bool IsValidVolumeName_HFS(const WCHAR* name);
bool fExtendedOpts;
DECLARE_MESSAGE_MAP()
};
#endif /*__CREATE_IMAGE_DIALOG__*/
#endif /*APP_CREATEIMAGEDIALOG_H*/

View File

@ -6,8 +6,8 @@
/*
* Create a subdirectory (e.g. on a ProDOS disk image).
*/
#ifndef __CREATESUBDIRDIALOG__
#define __CREATESUBDIRDIALOG__
#ifndef APP_CREATESUBDIRDIALOG_H
#define APP_CREATESUBDIRDIALOG_H
#include "GenericArchive.h"
#include "resource.h"
@ -42,4 +42,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__CREATESUBDIRDIALOG__*/
#endif /*APP_CREATESUBDIRDIALOG_H*/

View File

@ -51,7 +51,7 @@ DEFileDialog::OnChange(void)
CString str;
pEdit->GetWindowText(str);
//WMSG2("STR is '%s' (%d)\n", str, str.GetLength());
//WMSG2("STR is '%ls' (%d)\n", str, str.GetLength());
CWnd* pWnd = GetDlgItem(IDOK);
ASSERT(pWnd != nil);

View File

@ -16,8 +16,8 @@
* state of the sector editor. The read-only state of the underlying FS
* doesn't matter, since we're writing sectors, not really editing files.
*/
#ifndef __DEFILEDIALOG__
#define __DEFILEDIALOG__
#ifndef APP_DEFILEDIALOG_H
#define APP_DEFILEDIALOG_H
#include "resource.h"
#include "../diskimg/DiskImg.h"
@ -32,7 +32,7 @@ public:
DEFileDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_DEFILE, pParentWnd)
{
fOpenRsrcFork = false;
fName = "";
fName = L"";
}
virtual ~DEFileDialog(void) {}
@ -57,4 +57,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__DEFILEDIALOG__*/
#endif /*APP_DEFILEDIALOG_H*/

File diff suppressed because it is too large Load Diff

View File

@ -6,8 +6,8 @@
/*
* Disk image "archive" support.
*/
#ifndef __DISK_ARCHIVE__
#define __DISK_ARCHIVE__
#ifndef APP_DISKARCHIVE_H
#define APP_DISKARCHIVE_H
#include "GenericArchive.h"
#include "../diskimg/DiskImg.h"
@ -74,17 +74,17 @@ public:
} blank;
struct {
NewOptionsBase base;
const char* volName;
const WCHAR* volName;
long numBlocks;
} prodos;
struct {
NewOptionsBase base;
const char* volName;
const WCHAR* volName;
long numBlocks;
} pascalfs; // "pascal" is reserved token in MSVC++
struct {
NewOptionsBase base;
const char* volName;
const WCHAR* volName;
long numBlocks;
} hfs;
struct {
@ -101,8 +101,8 @@ public:
// one-time cleanup at app shutdown time
static void AppCleanup(void);
virtual OpenResult Open(const char* filename, bool readOnly, CString* pErrMsg);
virtual CString New(const char* filename, const void* options);
virtual OpenResult Open(const WCHAR* filename, bool readOnly, CString* pErrMsg);
virtual CString New(const WCHAR* filename, const void* options);
virtual CString Flush(void);
virtual CString Reload(void);
virtual bool IsReadOnly(void) const { return fIsReadOnly; };
@ -114,7 +114,7 @@ public:
const AddFilesDialog* pAddOpts)
{ ASSERT(false); return false; }
virtual bool CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry,
const char* newName);
const WCHAR* newName);
virtual bool TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
{ ASSERT(false); return false; }
virtual bool DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet);
@ -122,9 +122,9 @@ public:
virtual CString TestPathName(const GenericEntry* pGenericEntry,
const CString& basePath, const CString& newName, char newFssep) const;
virtual bool RenameVolume(CWnd* pMsgWnd, DiskFS* pDiskFS,
const char* newName);
const WCHAR* newName);
virtual CString TestVolumeName(const DiskFS* pDiskFS,
const char* newName) const;
const WCHAR* newName) const;
virtual bool RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
const RecompressOptionsDialog* pRecompOpts)
{ ASSERT(false); return false; }
@ -153,12 +153,12 @@ public:
private:
virtual CString Close(void);
virtual void XferPrepare(const XferFileOptions* pXferOpts);
virtual CString XferFile(FileDetails* pDetails, unsigned char** pDataBuf,
long dataLen, unsigned char** pRsrcBuf, long rsrcLen);
virtual CString XferFile(FileDetails* pDetails, BYTE** pDataBuf,
long dataLen, BYTE** pRsrcBuf, long rsrcLen);
virtual void XferAbort(CWnd* pMsgWnd);
virtual void XferFinish(CWnd* pMsgWnd);
/* internal function, used during initial scan of volume */
/* DiskImg callback, used during initial scan of volume */
static bool ScanProgressCallback(void* cookie, const char* str,
int count);
@ -168,7 +168,7 @@ private:
*/
class FileAddData {
public:
FileAddData(const FileDetails* pDetails, const char* fsNormalPath) {
FileAddData(const FileDetails* pDetails, char* fsNormalPath) {
fDetails = *pDetails;
fFSNormalPath = fsNormalPath;
@ -183,15 +183,24 @@ private:
void SetOtherFork(FileAddData* pData) { fpOtherFork = pData; }
const FileDetails* GetDetails(void) const { return &fDetails; }
/*
* Get the "FS-normal" path, i.e. exactly what we want to appear
* on the disk image. This has the result of any conversions, so
* we need to store it as a narrow string.
*/
const char* GetFSNormalPath(void) const { return fFSNormalPath; }
private:
// Three filenames stored here:
// Three filenames stored inside FileDetails:
// fDetails.origName -- the name of the Windows file
// fDetails.storageName -- the normalized Windows name
// fFSNormalPath -- the FS-normalized version of "storageName"
// fDetails.storageName -- origName with type-preservation goodies
// stripped out
// fFSNormalPath -- the FS-normalized version of "storageName", i.e.
// the name as it will appear on the Apple II disk image
FileDetails fDetails;
CString fFSNormalPath;
CStringA fFSNormalPath;
FileAddData* fpOtherFork;
FileAddData* fpNext;
@ -205,7 +214,7 @@ private:
static int CompareDisplayNamesDesc(const void* ventry1, const void* ventry2);
int LoadContents(void);
int LoadDiskFSContents(DiskFS* pDiskFS, const char* volName);
int LoadDiskFSContents(DiskFS* pDiskFS, const WCHAR* volName);
void DowncaseSubstring(CString* pStr, int startPos, int endPos,
bool prevWasSpace);
static void DebugMsgHandler(const char* file, int line, const char* msg);
@ -213,11 +222,11 @@ private:
NuResult HandleReplaceExisting(const A2File* pExisting,
FileDetails* pDetails);
CString ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL);
CString LoadFile(const char* pathName, unsigned char** pBuf, long* pLen,
CString LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen,
GenericEntry::ConvertEOL conv, GenericEntry::ConvertHighASCII convHA) const;
DIError AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms,
const unsigned char* dataBuf, long dataLen,
const unsigned char* rsrcBuf, long rsrcLen) const;
const BYTE* dataBuf, long dataLen,
const BYTE* rsrcBuf, long rsrcLen) const;
void AddToAddDataList(FileAddData* pData);
void FreeAddDataList(void);
void ConvertFDToCP(const FileDetails* pDetails,
@ -241,4 +250,4 @@ private:
DiskFS* fpXferTargetFS;
};
#endif /*__DISK_ARCHIVE__*/
#endif /*APP_DISKARCHIVE_H*/

View File

@ -141,7 +141,7 @@ DiskConvertDialog::Init(int fileCount)
fAllowNuFX = fAllowTrackStar = fAllowSim2eHDV = fAllowDDD = true;
fConvertIdx = kConvDOSRaw; // default choice == first in list
fBulkFileCount = fileCount;
fDiskDescription.Format("%d images selected", fBulkFileCount);
fDiskDescription.Format(L"%d images selected", fBulkFileCount);
}
@ -238,28 +238,29 @@ DiskConvertDialog::DoDataExchange(CDataExchange* pDX)
if (pDX->m_bSaveAndValidate) {
switch (fConvertIdx) {
case kConvDOSRaw: fExtension = "do"; break;
case kConvDOS2MG: fExtension = "2mg"; break;
case kConvProDOSRaw: fExtension = "po"; break;
case kConvProDOS2MG: fExtension = "2mg"; break;
case kConvNibbleRaw: fExtension = "nib"; break;
case kConvNibble2MG: fExtension = "2mg"; break;
case kConvD13: fExtension = "d13"; break;
case kConvDiskCopy42: fExtension = "dsk"; break;
case kConvNuFX: fExtension = "sdk"; break;
case kConvTrackStar: fExtension = "app"; break;
case kConvSim2eHDV: fExtension = "hdv"; break;
case kConvDDD: fExtension = "ddd"; break;
case kConvDOSRaw: fExtension = L"do"; break;
case kConvDOS2MG: fExtension = L"2mg"; break;
case kConvProDOSRaw: fExtension = L"po"; break;
case kConvProDOS2MG: fExtension = L"2mg"; break;
case kConvNibbleRaw: fExtension = L"nib"; break;
case kConvNibble2MG: fExtension = L"2mg"; break;
case kConvD13: fExtension = L"d13"; break;
case kConvDiskCopy42: fExtension = L"dsk"; break;
case kConvNuFX: fExtension = L"sdk"; break;
case kConvTrackStar: fExtension = L"app"; break;
case kConvSim2eHDV: fExtension = L"hdv"; break;
case kConvDDD: fExtension = L"ddd"; break;
default:
fExtension = "???";
fExtension = L"???";
ASSERT(false);
break;
}
if (fAddGzip && fConvertIdx != kConvNuFX)
fExtension += ".gz";
if (fAddGzip && fConvertIdx != kConvNuFX) {
fExtension += L".gz";
}
WMSG1(" DCD recommending extension '%s'\n", (LPCTSTR) fExtension);
WMSG1(" DCD recommending extension '%ls'\n", (LPCWSTR) fExtension);
}
}

View File

@ -6,8 +6,8 @@
/*
* Let the user choose how they want to convert a disk image.
*/
#ifndef __DISKCONVERTDIALOG__
#define __DISKCONVERTDIALOG__
#ifndef APP_DISKCONVERTDIALOG_H
#define APP_DISKCONVERTDIALOG_H
#include "resource.h"
#include "../diskimg/DiskImg.h"
@ -82,4 +82,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__DISKCONVERTDIALOG__*/
#endif /*APP_DISKCONVERTDIALOG_H*/

View File

@ -83,7 +83,7 @@ DiskEditDialog::OnInitDialog(void)
CHARFORMAT cf;
cf.cbSize = sizeof(CHARFORMAT);
cf.dwMask = CFM_FACE | CFM_SIZE;
::lstrcpy(cf.szFaceName, "Courier New");
wcscpy(cf.szFaceName, L"Courier New");
cf.yHeight = 10 * 20; // point size in twips
BOOL cc = pEdit->SetDefaultCharFormat(cf);
if (cc == FALSE) {
@ -188,16 +188,17 @@ DiskEditDialog::InitNibbleParmList(void)
}
for (i = 0; i < count; i++) {
if (pTable[i].numSectors > 0)
pCombo->AddString(pTable[i].description);
else {
if (pTable[i].numSectors > 0) {
CString description(pTable[i].description);
pCombo->AddString(description);
} else {
/* only expecting this on the last, "custom" entry */
ASSERT(i == count-1);
}
}
pCombo->SetCurSel(dflt);
} else {
pCombo->AddString("Nibble Parms");
pCombo->AddString(L"Nibble Parms");
pCombo->SetCurSel(0);
pCombo->EnableWindow(FALSE);
}
@ -345,7 +346,8 @@ DiskEditDialog::OnSubVolume(void)
pEditDialog = &blockEdit;
else
pEditDialog = &sectorEdit;
pEditDialog->Setup(pSubVol->GetDiskFS(), fpDiskFS->GetVolumeID());
CString volumeID(fpDiskFS->GetVolumeID());
pEditDialog->Setup(pSubVol->GetDiskFS(), volumeID);
pEditDialog->SetPositionShift(8);
(void) pEditDialog->DoModal();
}
@ -378,9 +380,9 @@ DiskEditDialog::SetSpinMode(int id, int base)
}
if (base == 10)
valStr.Format("%d", val);
valStr.Format(L"%d", val);
else
valStr.Format("%X", val);
valStr.Format(L"%X", val);
pSpin->SetBase(base);
pSpin->GetBuddy()->SetWindowText(valStr);
@ -407,7 +409,7 @@ DiskEditDialog::ReadSpinner(int id, long* pVal)
err.LoadString(IDS_ERROR);
int lower, upper;
pSpin->GetRange32(lower, upper);
msg.Format("Please enter a value between %d and %d (0x%x and 0x%x).",
msg.Format(L"Please enter a value between %d and %d (0x%x and 0x%x).",
lower, upper, lower, upper);
MessageBox(msg, err, MB_OK|MB_ICONEXCLAMATION);
return -1;
@ -438,10 +440,10 @@ DiskEditDialog::SetSpinner(int id, long val)
* Convert a chunk of data into a hex dump, and stuff it into the edit control.
*/
void
DiskEditDialog::DisplayData(const unsigned char* srcBuf, int size)
DiskEditDialog::DisplayData(const BYTE* srcBuf, int size)
{
char textBuf[80 * 16 * 2];
char* cp;
WCHAR textBuf[80 * 16 * 2];
WCHAR* cp;
int i, j;
ASSERT(srcBuf != nil);
@ -459,8 +461,8 @@ DiskEditDialog::DisplayData(const unsigned char* srcBuf, int size)
if (indent < 0)
indent = 0;
CString msg = " "
" ";
CString msg = L" "
L" ";
ASSERT(msg.GetLength() == kWidth);
msg = msg.Left(indent);
msg += fAlertMsg;
@ -468,7 +470,7 @@ DiskEditDialog::DisplayData(const unsigned char* srcBuf, int size)
textBuf[i] = '\r';
textBuf[i+1] = '\n';
}
strcpy(&textBuf[i], msg);
wcscpy(&textBuf[i], msg);
pEdit->SetWindowText(textBuf);
return;
@ -481,8 +483,8 @@ DiskEditDialog::DisplayData(const unsigned char* srcBuf, int size)
for (i = 0; i < size/16; i++) {
if (size == kSectorSize) {
/* two-nybble addr */
sprintf(cp, " %02x: %02x %02x %02x %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x %02x %02x %02x %02x ",
wsprintf(cp, L" %02x: %02x %02x %02x %02x %02x %02x %02x %02x "
L"%02x %02x %02x %02x %02x %02x %02x %02x ",
i * 16,
srcBuf[0], srcBuf[1], srcBuf[2], srcBuf[3],
srcBuf[4], srcBuf[5], srcBuf[6], srcBuf[7],
@ -490,15 +492,15 @@ DiskEditDialog::DisplayData(const unsigned char* srcBuf, int size)
srcBuf[12], srcBuf[13], srcBuf[14], srcBuf[15]);
} else {
/* three-nybble addr */
sprintf(cp, "%03x: %02x %02x %02x %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x %02x %02x %02x %02x ",
wsprintf(cp, L"%03x: %02x %02x %02x %02x %02x %02x %02x %02x "
L"%02x %02x %02x %02x %02x %02x %02x %02x ",
i * 16,
srcBuf[0], srcBuf[1], srcBuf[2], srcBuf[3],
srcBuf[4], srcBuf[5], srcBuf[6], srcBuf[7],
srcBuf[8], srcBuf[9], srcBuf[10], srcBuf[11],
srcBuf[12], srcBuf[13], srcBuf[14], srcBuf[15]);
}
ASSERT(strlen(cp) == 54);
ASSERT(wcslen(cp) == 54);
cp += 54; // strlen(cp)
for (j = 0; j < 16; j++)
*cp++ = PrintableChar(srcBuf[j]);
@ -526,8 +528,8 @@ DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size)
ASSERT(fAlertMsg.IsEmpty());
int bufSize = ((size+15) / 16) * 80;
char* textBuf = new char[bufSize];
char* cp;
WCHAR* textBuf = new WCHAR[bufSize];
WCHAR* cp;
int i;
if (textBuf == nil)
@ -536,20 +538,20 @@ DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size)
cp = textBuf;
for (i = 0; size > 0; i++) {
if (size >= 16) {
sprintf(cp, "%04x: %02x %02x %02x %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x %02x %02x %02x %02x",
wsprintf(cp, L"%04x: %02x %02x %02x %02x %02x %02x %02x %02x "
L"%02x %02x %02x %02x %02x %02x %02x %02x",
i * 16,
srcBuf[0], srcBuf[1], srcBuf[2], srcBuf[3],
srcBuf[4], srcBuf[5], srcBuf[6], srcBuf[7],
srcBuf[8], srcBuf[9], srcBuf[10], srcBuf[11],
srcBuf[12], srcBuf[13], srcBuf[14], srcBuf[15]);
ASSERT(strlen(cp) == 53);
ASSERT(wcslen(cp) == 53);
cp += 53; // strlen(cp)
} else {
sprintf(cp, "%04x:", i * 16);
wsprintf(cp, L"%04x:", i * 16);
cp += 5;
for (int j = 0; j < size; j++) {
sprintf(cp, " %02x", srcBuf[j]);
wsprintf(cp, L" %02x", srcBuf[j]);
cp += 3;
}
}
@ -602,14 +604,15 @@ DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size)
* its Close function.
*/
DIError
DiskEditDialog::OpenFile(const char* fileName, bool openRsrc, A2File** ppFile,
DiskEditDialog::OpenFile(const WCHAR* fileName, bool openRsrc, A2File** ppFile,
A2FileDescr** ppOpenFile)
{
A2File* pFile;
A2FileDescr* pOpenFile = nil;
WMSG2(" OpenFile '%s' rsrc=%d\n", fileName, openRsrc);
pFile = fpDiskFS->GetFileByName(fileName);
WMSG2(" OpenFile '%ls' rsrc=%d\n", fileName, openRsrc);
CStringA fileNameA(fileName);
pFile = fpDiskFS->GetFileByName(fileNameA);
if (pFile == nil) {
CString msg, failed;
@ -716,11 +719,11 @@ SectorEditDialog::OnInitDialog(void)
*/
CString trackStr;
CWnd* pWnd;
trackStr.Format("Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks());
trackStr.Format(L"Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks());
pWnd = GetDlgItem(IDC_STEXT_TRACK);
ASSERT(pWnd != nil);
pWnd->SetWindowText(trackStr);
trackStr.Format("Sector (%d):", fpDiskFS->GetDiskImg()->GetNumSectPerTrack());
trackStr.Format(L"Sector (%d):", fpDiskFS->GetDiskImg()->GetNumSectPerTrack());
pWnd = GetDlgItem(IDC_STEXT_SECTOR);
ASSERT(pWnd != nil);
pWnd->SetWindowText(trackStr);
@ -767,7 +770,7 @@ SectorEditDialog::LoadData(void)
DIError dierr;
dierr = fpDiskFS->GetDiskImg()->ReadTrackSector(fTrack, fSector, fSectorData);
if (dierr != kDIErrNone) {
WMSG1("SED sector read failed: %s\n", DiskImgLib::DIStrError(dierr));
WMSG1("SED sector read failed: %hs\n", DiskImgLib::DIStrError(dierr));
//CString msg;
//CString err;
//err.LoadString(IDS_ERROR);
@ -797,7 +800,7 @@ SectorEditDialog::OnDoRead(void)
void
SectorEditDialog::OnDoWrite(void)
{
MessageBox("Write!");
MessageBox(L"Write!");
}
/*
@ -922,9 +925,9 @@ SectorFileEditDialog::OnInitDialog(void)
CString title;
CString rsrcIndic;
rsrcIndic.LoadString(IDS_INDIC_RSRC);
title.Format("Disk Viewer - %s%s (%ld bytes)",
fpFile->GetPathName(), // use fpFile version to get case
fOpenRsrcFork ? (LPCTSTR)rsrcIndic : "", fLength);
title.Format(L"Disk Viewer - %hs%ls (%ld bytes)",
(LPCSTR) fpFile->GetPathName(), // use fpFile version to get case
fOpenRsrcFork ? (LPCWSTR)rsrcIndic : L"", fLength);
SetWindowText(title);
return retval;
@ -1091,7 +1094,7 @@ BlockEditDialog::OnInitDialog(void)
CString blockStr;
//blockStr.LoadString(IDS_BLOCK);
blockStr.Format("Block (%d):", fpDiskFS->GetDiskImg()->GetNumBlocks());
blockStr.Format(L"Block (%d):", fpDiskFS->GetDiskImg()->GetNumBlocks());
pWnd = GetDlgItem(IDC_STEXT_TRACK);
ASSERT(pWnd != nil);
pWnd->SetWindowText(blockStr);
@ -1189,7 +1192,7 @@ BlockEditDialog::LoadData(void)
DIError dierr;
dierr = fpDiskFS->GetDiskImg()->ReadBlock(fBlock, fBlockData);
if (dierr != kDIErrNone) {
WMSG1("BED block read failed: %s\n", DiskImgLib::DIStrError(dierr));
WMSG1("BED block read failed: %hs\n", DiskImgLib::DIStrError(dierr));
//CString msg;
//CString err;
//err.LoadString(IDS_ERROR);
@ -1219,7 +1222,7 @@ BlockEditDialog::OnDoRead(void)
void
BlockEditDialog::OnDoWrite(void)
{
MessageBox("Write!");
MessageBox(L"Write!");
}
/*
@ -1320,9 +1323,9 @@ BlockFileEditDialog::OnInitDialog(void)
CString title;
CString rsrcIndic;
rsrcIndic.LoadString(IDS_INDIC_RSRC);
title.Format("Disk Viewer - %s%s (%ld bytes)",
fpFile->GetPathName(), // use fpFile version to get case
fOpenRsrcFork ? (LPCTSTR)rsrcIndic : "", fLength);
title.Format(L"Disk Viewer - %hs%ls (%ld bytes)",
(LPCSTR) fpFile->GetPathName(), // use fpFile version to get case
fOpenRsrcFork ? (LPCWSTR)rsrcIndic : L"", fLength);
SetWindowText(title);
return retval;
@ -1484,7 +1487,7 @@ NibbleEditDialog::OnInitDialog(void)
pWnd->DestroyWindow();
CString trackStr;
trackStr.Format("Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks());
trackStr.Format(L"Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks());
pWnd = GetDlgItem(IDC_STEXT_TRACK);
ASSERT(pWnd != nil);
pWnd->SetWindowText(trackStr);
@ -1583,7 +1586,7 @@ NibbleEditDialog::LoadData(void)
dierr = fpDiskFS->GetDiskImg()->ReadNibbleTrack(fTrack, fNibbleData,
&fNibbleDataLen);
if (dierr != kDIErrNone) {
WMSG1("NED track read failed: %s\n", DiskImgLib::DIStrError(dierr));
WMSG1("NED track read failed: %hs\n", DiskImgLib::DIStrError(dierr));
fAlertMsg.LoadString(IDS_DISKEDITMSG_BADTRACK);
}
@ -1607,7 +1610,7 @@ NibbleEditDialog::OnDoRead(void)
void
NibbleEditDialog::OnDoWrite(void)
{
MessageBox("Write!");
MessageBox(L"Write!");
}
/*

View File

@ -6,8 +6,8 @@
/*
* Class definition for DiskEdit dialog.
*/
#ifndef __DISK_EDIT_DIALOG__
#define __DISK_EDIT_DIALOG__
#ifndef APP_DISKEDITDIALOG_H
#define APP_DISKEDITDIALOG_H
#include "../diskimg/DiskImg.h"
#include "../util/UtilLib.h"
@ -37,7 +37,7 @@ public:
}
virtual ~DiskEditDialog() {}
void Setup(DiskFS* pDiskFS, const char* fileName) {
void Setup(DiskFS* pDiskFS, const WCHAR* fileName) {
ASSERT(pDiskFS != nil);
ASSERT(fileName != nil);
fpDiskFS = pDiskFS;
@ -49,15 +49,15 @@ public:
virtual int LoadData(void) = 0;
virtual void DisplayData(void) = 0;
virtual void DisplayData(const unsigned char* buf, int size);
virtual void DisplayNibbleData(const unsigned char* srcBuf, int size);
virtual void DisplayData(const BYTE* buf, int size);
virtual void DisplayNibbleData(const BYTE* srcBuf, int size);
bool GetReadOnly(void) const { return fReadOnly; }
void SetReadOnly(bool val) { fReadOnly = val; }
int GetPositionShift(void) const { return fPositionShift; }
void SetPositionShift(int val) { fPositionShift = val; }
DiskFS* GetDiskFS(void) const { return fpDiskFS; }
const char* GetFileName(void) const { return fFileName; }
const WCHAR* GetFileName(void) const { return fFileName; }
protected:
// return a low-ASCII character so we can read high-ASCII files
@ -94,7 +94,7 @@ protected:
void SetSpinner(int id, long val);
//void FillWithPattern(unsigned char* buf, int size, const char* pattern);
DIError OpenFile(const char* fileName, bool openRsrc, A2File** ppFile,
DIError OpenFile(const WCHAR* fileName, bool openRsrc, A2File** ppFile,
A2FileDescr** ppOpenFile);
DiskFS* fpDiskFS;
@ -149,7 +149,7 @@ protected:
long fTrack;
long fSector;
unsigned char fSectorData[kSectorSize];
BYTE fSectorData[kSectorSize];
};
/*
@ -167,7 +167,7 @@ public:
virtual ~SectorFileEditDialog() {}
/* we do NOT own pOpenFile, and should not delete it */
void SetupFile(const char* fileName, bool rsrcFork, A2File* pFile,
void SetupFile(const WCHAR* fileName, bool rsrcFork, A2File* pFile,
A2FileDescr* pOpenFile)
{
fOpenFileName = fileName;
@ -229,7 +229,7 @@ protected:
afx_msg virtual void OnOpenFile(void);
long fBlock;
unsigned char fBlockData[kBlockSize];
BYTE fBlockData[kBlockSize];
};
@ -248,7 +248,7 @@ public:
virtual ~BlockFileEditDialog() {}
/* we do NOT own pOpenFile, and should not delete it */
void SetupFile(const char* fileName, bool rsrcFork, A2File* pFile,
void SetupFile(const WCHAR* fileName, bool rsrcFork, A2File* pFile,
A2FileDescr* pOpenFile)
{
fOpenFileName = fileName;
@ -308,8 +308,8 @@ protected:
afx_msg virtual void OnNibbleParms(void) { ASSERT(false); }
long fTrack;
unsigned char fNibbleData[DiskImgLib::kTrackAllocSize];
BYTE fNibbleData[DiskImgLib::kTrackAllocSize];
long fNibbleDataLen;
};
#endif /*__DISK_EDIT_DIALOG__*/
#endif /*APP_DISKEDITDIALOG_H*/

View File

@ -6,8 +6,8 @@
/*
* Decide how to open the disk editor.
*/
#ifndef __DISKEDITOPENDIALOG__
#define __DISKEDITOPENDIALOG__
#ifndef APP_DISKEDITOPENDIALOG_H
#define APP_DISKEDITOPENDIALOG_H
#include <afxwin.h>
#include "resource.h"
@ -46,4 +46,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__DISKEDITOPENDIALOG__*/
#endif /*APP_DISKEDITOPENDIALOG_H*/

View File

@ -51,7 +51,8 @@ DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent,
pTarget->pDiskFS = pDiskFS;
pTarget->pFile = nil; // could also use volume dir for ProDOS
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
tvi.pszText = const_cast<char*>(pDiskFS->GetVolumeID());
// TODO(xyzzy): need storage for wide-char version
tvi.pszText = L"XYZZY-DiskFSTree1"; // pDiskFS->GetVolumeID();
tvi.cchTextMax = 0; // not needed for insertitem
// tvi.iImage = kTreeImageFolderClosed;
// tvi.iSelectedImage = kTreeImageFolderOpen;
@ -170,7 +171,8 @@ DiskFSTree::AddSubdir(CTreeCtrl* pTree, HTREEITEM parent,
pTarget->pDiskFS = pDiskFS;
pTarget->pFile = pParentFile;
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
tvi.pszText = const_cast<char*>(pParentFile->GetFileName());
// TODO(xyzzy): need storage for wide-char version
tvi.pszText = L"XYZZY-DiskFSTree2"; // pParentFile->GetFileName();
tvi.cchTextMax = 0; // not needed for insertitem
tvi.iImage = kTreeImageFolderClosed;
tvi.iSelectedImage = kTreeImageFolderOpen;
@ -180,7 +182,7 @@ DiskFSTree::AddSubdir(CTreeCtrl* pTree, HTREEITEM parent,
tvins.hParent = parent;
hLocalRoot = pTree->InsertItem(&tvins);
if (hLocalRoot == nil) {
WMSG1("Tree insert '%s' failed\n", tvi.pszText);
WMSG1("Tree insert '%ls' failed\n", tvi.pszText);
return nil;
}
}

View File

@ -7,8 +7,8 @@
* Fill out a CTreeCtrl with the results of a tree search through a DiskFS and
* its sub-volumes.
*/
#ifndef __DISKFSTREE__
#define __DISKFSTREE__
#ifndef APP_DISKFSTREE_H
#define APP_DISKFSTREE_H
#include "resource.h"
#include "../diskimg/DiskImg.h"
@ -78,4 +78,4 @@ private:
TargetData* fpTargetData;
};
#endif /*__DISKFSTREE__*/
#endif /*APP_DISKFSTREE_H*/

View File

@ -6,6 +6,9 @@
/*
* Simple dialog to offer the opportunity to open the file we just created.
*/
#ifndef APP_DONEOPENDIALOG_H
#define APP_DONEOPENDIALOG_H
#include "resource.h"
class DoneOpenDialog : public CDialog {
@ -14,3 +17,5 @@ public:
{}
virtual ~DoneOpenDialog(void) {}
};
#endif /*APP_DONEOPENDIALOG_H*/

View File

@ -26,23 +26,23 @@ EOLScanDialog::OnInitDialog(void)
CWnd* pWnd;
CString fmt;
fmt.Format("%ld", fCountChars);
fmt.Format(L"%ld", fCountChars);
pWnd = GetDlgItem(IDC_EOLSCAN_CHARS);
pWnd->SetWindowText(fmt);
fmt.Format("%ld", fCountCR);
fmt.Format(L"%ld", fCountCR);
pWnd = GetDlgItem(IDC_EOLSCAN_CR);
pWnd->SetWindowText(fmt);
fmt.Format("%ld", fCountLF);
fmt.Format(L"%ld", fCountLF);
pWnd = GetDlgItem(IDC_EOLSCAN_LF);
pWnd->SetWindowText(fmt);
fmt.Format("%ld", fCountCRLF);
fmt.Format(L"%ld", fCountCRLF);
pWnd = GetDlgItem(IDC_EOLSCAN_CRLF);
pWnd->SetWindowText(fmt);
fmt.Format("%ld", fCountHighASCII);
fmt.Format(L"%ld", fCountHighASCII);
pWnd = GetDlgItem(IDC_EOLSCAN_HIGHASCII);
pWnd->SetWindowText(fmt);

View File

@ -6,8 +6,8 @@
/*
* A simple dialog to display the results of an EOL scan.
*/
#ifndef __EOLSCANDIALOG__
#define __EOLSCANDIALOG__
#ifndef APP_EOLSCANDIALOG_H
#define APP_EOLSCANDIALOG_H
#include "resource.h"
@ -34,4 +34,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__EOLSCANDIALOG__*/
#endif /*APP_EOLSCANDIALOG_H*/

View File

@ -82,9 +82,9 @@ EditAssocDialog::Setup(bool loadAssoc)
pListView->GetClientRect(&rect);
int width;
width = pListView->GetStringWidth("XXExtensionXX");
pListView->InsertColumn(0, "Extension", LVCFMT_LEFT, width);
pListView->InsertColumn(1, "Association", LVCFMT_LEFT,
width = pListView->GetStringWidth(L"XXExtensionXX");
pListView->InsertColumn(0, L"Extension", LVCFMT_LEFT, width);
pListView->InsertColumn(1, L"Association", LVCFMT_LEFT,
rect.Width() - width);
int num = gMyApp.fRegistry.GetNumFileAssocs();

View File

@ -6,8 +6,8 @@
/*
* File associations edit dialog.
*/
#ifndef __EDITASSOCDIALOG__
#define __EDITASSOCDIALOG__
#ifndef APP_EDITASSOCDIALOG_H
#define APP_EDITASSOCDIALOG_H
#include "resource.h"
@ -42,4 +42,4 @@ protected:
DECLARE_MESSAGE_MAP()
};
#endif /*__EDITASSOCDIALOG__*/
#endif /*APP_EDITASSOCDIALOG_H*/

View File

@ -6,8 +6,8 @@
/*
* Edit a comment.
*/
#ifndef __EDITCOMMENTDIALOG__
#define __EDITCOMMENTDIALOG__
#ifndef APP_EDITCOMMENTDIALOG_H
#define APP_EDITCOMMENTDIALOG_H
#include "GenericArchive.h"
#include "resource.h"
@ -44,4 +44,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__EDITCOMMENTDIALOG__*/
#endif /*APP_EDITCOMMENTDIALOG_H*/

View File

@ -88,19 +88,21 @@ EditPropsDialog::OnInitDialog(void)
pCombo->InitStorage(256, 256 * 8);
for (int type = 0; type < 256; type++) {
const char* str;
char buf[10];
const WCHAR* str;
WCHAR buf[10];
if (fAllowedTypes == kAllowedPascal) {
/* not the most efficient way, but it'll do */
for (int j = 0; j < NELEM(kPascalTypes); j++) {
int j;
for (j = 0; j < NELEM(kPascalTypes); j++) {
if (kPascalTypes[j] == type)
break;
}
if (j == NELEM(kPascalTypes))
continue;
} else if (fAllowedTypes == kAllowedDOS) {
for (int j = 0; j < NELEM(kDOSTypes); j++) {
int j;
for (j = 0; j < NELEM(kDOSTypes); j++) {
if (kDOSTypes[j] == type)
break;
}
@ -110,9 +112,9 @@ EditPropsDialog::OnInitDialog(void)
str = PathProposal::FileTypeString(type);
if (str[0] == '$')
sprintf(buf, "??? $%02X", type);
wsprintf(buf, L"??? $%02X", type);
else
sprintf(buf, "%s $%02X", str, type);
wsprintf(buf, L"%ls $%02X", str, type);
comboIdx = pCombo->AddString(buf);
pCombo->SetItemData(comboIdx, type);
@ -124,7 +126,7 @@ EditPropsDialog::OnInitDialog(void)
pCombo->SetCurSel(0);
} else {
// unexpected -- bogus data out of DiskFS?
comboIdx = pCombo->AddString("???");
comboIdx = pCombo->AddString(L"???");
pCombo->SetCurSel(comboIdx);
pCombo->SetItemData(comboIdx, 256);
}
@ -140,7 +142,7 @@ EditPropsDialog::OnInitDialog(void)
ASSERT(pWnd != nil);
FormatDate(fProps.modWhen, &dateStr);
pWnd->SetWindowText(dateStr);
//WMSG2("USING DATE '%s' from 0x%08lx\n", dateStr, fProps.modWhen);
//WMSG2("USING DATE '%ls' from 0x%08lx\n", dateStr, fProps.modWhen);
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_PROPS_AUXTYPE);
ASSERT(pEdit != nil);
@ -219,8 +221,8 @@ EditPropsDialog::DoDataExchange(CDataExchange* pDX)
DDX_Text(pDX, IDC_PROPS_HFS_FILETYPE, type);
DDX_Text(pDX, IDC_PROPS_HFS_AUXTYPE, creator);
if (type.GetLength() != 4 || creator.GetLength() != 4) {
MessageBox("The file and creator types must be exactly"
" 4 characters each.",
MessageBox(L"The file and creator types must be exactly"
L" 4 characters each.",
appName, MB_OK);
pDX->Fail();
return;
@ -236,8 +238,8 @@ EditPropsDialog::DoDataExchange(CDataExchange* pDX)
} else {
/* ProDOS mode */
if (GetAuxType() < 0) {
MessageBox("The AuxType field must be a valid 4-digit"
" hexadecimal number.",
MessageBox(L"The AuxType field must be a valid 4-digit"
L" hexadecimal number.",
appName, MB_OK);
pDX->Fail();
return;
@ -329,7 +331,7 @@ EditPropsDialog::DoDataExchange(CDataExchange* pDX)
//DDX_CBIndex(pDX, IDC_PROPS_FILETYPE, fileTypeIdx);
/* write the aux type as a hex string */
fAuxType.Format("%04X", fProps.auxType);
fAuxType.Format(L"%04X", fProps.auxType);
DDX_Text(pDX, IDC_PROPS_AUXTYPE, fAuxType);
}
OnTypeChange(); // set the description field
@ -352,12 +354,12 @@ EditPropsDialog::DoDataExchange(CDataExchange* pDX)
void
EditPropsDialog::OnTypeChange(void)
{
static const char* kUnknownFileType = "Unknown file type";
static const WCHAR kUnknownFileType[] = L"Unknown file type";
CComboBox* pCombo;
CWnd* pWnd;
int fileType, fileTypeIdx;
long auxType;
const char* descr = nil;
const WCHAR* descr = nil;
pCombo = (CComboBox*) GetDlgItem(IDC_PROPS_FILETYPE);
ASSERT(pCombo != nil);
@ -426,7 +428,7 @@ EditPropsDialog::UpdateHFSMode(void)
pWnd = GetDlgItem(IDC_PROPS_TYPEDESCR);
ASSERT(pWnd != nil);
pWnd->SetWindowText("(HFS type)");
pWnd->SetWindowText(L"(HFS type)");
OnHFSTypeChange();
} else {
/* switch to ProDOS mode */
@ -486,18 +488,18 @@ EditPropsDialog::GetAuxType(void)
CString aux;
pWnd->GetWindowText(aux);
const char* str = aux;
char* end;
const WCHAR* str = aux;
WCHAR* end;
long val;
if (str[0] == '\0') {
WMSG0(" HEY: blank aux type, returning -1\n");
return -1;
}
val = strtoul(aux, &end, 16);
if (end != str + strlen(str)) {
WMSG1(" HEY: found some garbage in aux type '%s', returning -1\n",
(LPCTSTR) aux);
val = wcstoul(aux, &end, 16);
if (end != str + wcslen(str)) {
WMSG1(" HEY: found some garbage in aux type '%ls', returning -1\n",
(LPCWSTR) aux);
return -1;
}
return val;

View File

@ -6,8 +6,8 @@
/*
* Edit file properties.
*/
#ifndef __EDITPROPSDIALOG__
#define __EDITPROPSDIALOG__
#ifndef APP_EDITPROPSDIALOG_H
#define APP_EDITPROPSDIALOG_H
#include "GenericArchive.h"
#include "resource.h"
@ -85,4 +85,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__EDITPROPSDIALOG__*/
#endif /*APP_EDITPROPSDIALOG_H*/

View File

@ -68,7 +68,7 @@ EnterRegDialog::DoDataExchange(CDataExchange* pDX)
if (gMyApp.fRegistry.IsValidRegistrationKey(fUserName, fCompanyName,
fRegKey))
{
WMSG3("Correct key entered: '%s' '%s' '%s'\n",
WMSG3("Correct key entered: '%ls' '%ls' '%ls'\n",
(LPCTSTR)fUserName, (LPCTSTR)fCompanyName, (LPCTSTR)fRegKey);
} else {
WMSG0("Incorrect key entered, rejecting\n");

View File

@ -6,8 +6,8 @@
/*
* Dialog allowing the user to enter registration data.
*/
#ifndef __ENTERREGDIALOG__
#define __ENTERREGDIALOG__
#ifndef APP_ENTERREGDIALOG_H
#define APP_ENTERREGDIALOG_H
#include "../util/UtilLib.h"
#include "resource.h"
@ -47,4 +47,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__ENTERREGDIALOG__*/
#endif /*APP_ENTERREGDIALOG_H*/

View File

@ -181,8 +181,8 @@ ExtractOptionsDialog::OnChooseFolder(void)
chooseDir.SetPathName(editPath);
if (chooseDir.DoModal() == IDOK) {
const char* ccp = chooseDir.GetPathName();
WMSG1("New extract path chosen = '%s'\n", ccp);
const WCHAR* ccp = chooseDir.GetPathName();
WMSG1("New extract path chosen = '%ls'\n", ccp);
pEditWnd->SetWindowText(ccp);
}

View File

@ -6,8 +6,8 @@
/*
* Choose options related to file extraction.
*/
#ifndef __EXTRACT_OPTIONS_DIALOG__
#define __EXTRACT_OPTIONS_DIALOG__
#ifndef APP_EXTRACTOPTIONSDIALOG_H
#define APP_EXTRACTOPTIONSDIALOG_H
#include "../util/UtilLib.h"
#include "resource.h"
@ -84,4 +84,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__EXTRACT_OPTIONS_DIALOG__*/
#endif /*APP_EXTRACTOPTIONSDIALOG_H*/

File diff suppressed because it is too large Load Diff

View File

@ -6,12 +6,12 @@
/*
* File name conversion.
*/
#ifndef __FILENAMECONV__
#define __FILENAMECONV__
#ifndef APP_FILENAMECONV_H
#define APP_FILENAMECONV_H
#include "GenericArchive.h"
#define kUnknownTypeStr "???"
#define kUnknownTypeStr L"???"
/*
* Proposal for an output pathname, based on the contents of a GenericEntry.
@ -26,13 +26,13 @@ public:
};
PathProposal(void) {
fStoredPathName = ":BOGUS:";
fStoredPathName = L":BOGUS:";
fStoredFssep = '[';
fFileType = 256;
fAuxType = 65536;
fThreadKind = 0;
fLocalPathName = ":HOSED:";
fLocalPathName = L":HOSED:";
fLocalFssep = ']';
fPreservation = false;
@ -52,7 +52,7 @@ public:
fAuxType = pEntry->GetAuxType();
//fThreadKind set from SelectionEntry
// reset the "output" fields
fLocalPathName = ":HOSED:";
fLocalPathName = L":HOSED:";
fLocalFssep = ']';
// I expect these to be as-yet unset; check it
ASSERT(!fPreservation);
@ -61,13 +61,13 @@ public:
}
// init the "add to archive" side
void Init(const char* localPathName) {
void Init(const WCHAR* localPathName) {
//ASSERT(basePathName[strlen(basePathName)-1] != kLocalFssep);
//fLocalPathName = localPathName + strlen(basePathName)+1;
fLocalPathName = localPathName;
fLocalFssep = kLocalFssep;
// reset the "output" fields
fStoredPathName = ":HOSED:";
fStoredPathName = L":HOSED:";
fStoredFssep = '[';
fFileType = 0;
fAuxType = 0;
@ -115,25 +115,25 @@ public:
/*
* Misc utility functions.
*/
static const char* FileTypeString(unsigned long fileType);
static const char* FileTypeDescription(long fileType, long auxType);
static const WCHAR* FileTypeString(unsigned long fileType);
static const WCHAR* FileTypeDescription(long fileType, long auxType);
private:
void Win32NormalizeFileName(const char* srcp, long srcLen,
char fssep, char** pDstp, long dstLen);
void NormalizeFileName(const char* srcp, long srcLen,
char fssep, char** pDstp, long dstLen);
void NormalizeDirectoryName(const char* srcp, long srcLen,
char fssep, char** pDstp, long dstLen);
void AddPreservationString(const char* pathBuf, char* extBuf);
void AddTypeExtension(const char* pathBuf, char* extBuf);
void Win32NormalizeFileName(const WCHAR* srcp, long srcLen,
char fssep, WCHAR** pDstp, long dstLen);
void NormalizeFileName(const WCHAR* srcp, long srcLen,
char fssep, WCHAR** pDstp, long dstLen);
void NormalizeDirectoryName(const WCHAR* srcp, long srcLen,
char fssep, WCHAR** pDstp, long dstLen);
void AddPreservationString(const WCHAR* pathBuf, WCHAR* extBuf);
void AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf);
void ReplaceFssep(char* str, char oldc, char newc, char newSubst);
void LookupExtension(const char* ext);
bool ExtractPreservationString(char* pathName);
void InterpretExtension(const char* pathName);
void DenormalizePath(char* pathBuf);
void StripDiskImageSuffix(char* pathName);
void ReplaceFssep(WCHAR* str, char oldc, char newc, char newSubst);
void LookupExtension(const WCHAR* ext);
bool ExtractPreservationString(WCHAR* pathName);
void InterpretExtension(const WCHAR* pathName);
void DenormalizePath(WCHAR* pathBuf);
void StripDiskImageSuffix(WCHAR* pathName);
};
#endif /*__FILENAMECONV__*/
#endif /*APP_FILENAMECONV_H*/

View File

@ -61,7 +61,7 @@ GenericEntry::GenericEntry(void)
fModWhen = kDateNone;
fCreateWhen = kDateNone;
fRecordKind = kRecordKindUnknown;
fFormatStr = "Unknown";
fFormatStr = L"Unknown";
fCompressedLen = 0;
//fUncompressedLen = 0;
fDataForkLen = fRsrcForkLen = 0;
@ -95,13 +95,12 @@ GenericEntry::~GenericEntry(void)
* Pathname getters and setters.
*/
void
GenericEntry::SetPathName(const char* path)
GenericEntry::SetPathName(const WCHAR* path)
{
ASSERT(path != nil && strlen(path) > 0);
ASSERT(path != nil && wcslen(path) > 0);
if (fPathName != nil)
delete fPathName;
fPathName = new char[strlen(path)+1];
strcpy(fPathName, path);
fPathName = wcsdup(path);
// nuke the derived fields
fFileName = nil;
fFileNameExtension = nil;
@ -118,59 +117,65 @@ GenericEntry::SetPathName(const char* path)
if (pPreferences->GetPrefBool(kPrSpacesToUnder))
SpacesToUnderscores(fPathName);
}
const char*
const WCHAR*
GenericEntry::GetFileName(void)
{
ASSERT(fPathName != nil);
if (fFileName == nil)
fFileName = FilenameOnly(fPathName, fFssep);
fFileName = PathName::FilenameOnly(fPathName, fFssep);
return fFileName;
}
const char*
const WCHAR*
GenericEntry::GetFileNameExtension(void)
{
ASSERT(fPathName != nil);
if (fFileNameExtension == nil)
fFileNameExtension = FindExtension(fPathName, fFssep);
fFileNameExtension = PathName::FindExtension(fPathName, fFssep);
return fFileNameExtension;
}
CStringA
GenericEntry::GetFileNameExtensionA(void)
{
return GetFileNameExtension();
}
void
GenericEntry::SetSubVolName(const char* name)
GenericEntry::SetSubVolName(const WCHAR* name)
{
delete[] fSubVolName;
fSubVolName = nil;
if (name != nil) {
fSubVolName = new char[strlen(name)+1];
strcpy(fSubVolName, name);
fSubVolName = wcsdup(name);
}
}
const char*
const WCHAR*
GenericEntry::GetDisplayName(void) const
{
ASSERT(fPathName != nil);
if (fDisplayName != nil)
return fDisplayName;
// TODO: hmm...
GenericEntry* pThis = const_cast<GenericEntry*>(this);
int len = strlen(fPathName) +1;
int len = wcslen(fPathName) +1;
if (fSubVolName != nil)
len += strlen(fSubVolName) +1;
pThis->fDisplayName = new char[len];
len += wcslen(fSubVolName) +1;
pThis->fDisplayName = new WCHAR[len];
if (fSubVolName != nil) {
char xtra[2] = { DiskFS::kDIFssep, '\0' };
strcpy(pThis->fDisplayName, fSubVolName);
strcat(pThis->fDisplayName, xtra);
} else
WCHAR xtra[2] = { DiskFS::kDIFssep, '\0' };
wcscpy(pThis->fDisplayName, fSubVolName);
wcscat(pThis->fDisplayName, xtra);
} else {
pThis->fDisplayName[0] = '\0';
strcat(pThis->fDisplayName, fPathName);
}
wcscat(pThis->fDisplayName, fPathName);
return pThis->fDisplayName;
}
/*
* Get a string for this entry's filetype.
*/
const char*
const WCHAR*
GenericEntry::GetFileTypeString(void) const
{
return PathProposal::FileTypeString(fFileType);
@ -180,7 +185,7 @@ GenericEntry::GetFileTypeString(void) const
* Convert spaces to underscores.
*/
/*static*/ void
GenericEntry::SpacesToUnderscores(char* buf)
GenericEntry::SpacesToUnderscores(WCHAR* buf)
{
while (*buf != '\0') {
if (*buf == ' ')
@ -574,9 +579,9 @@ GenericArchive::CreateIndex(void)
* in which bad things could happen, but it should be okay.
*/
/*static*/ CString
GenericArchive::GenDerivedTempName(const char* filename)
GenericArchive::GenDerivedTempName(const WCHAR* filename)
{
static const char* kTmpTemplate = "CPtmp_XXXXXX";
static const WCHAR kTmpTemplate[] = L"CPtmp_XXXXXX";
CString mangle(filename);
int idx, len;
@ -592,7 +597,7 @@ GenericArchive::GenDerivedTempName(const char* filename)
mangle.Delete(idx+1, len-(idx+1)); /* delete out to the end */
mangle += kTmpTemplate;
}
WMSG2("GenDerived: passed '%s' returned '%s'\n", filename, mangle);
WMSG2("GenDerived: passed '%ls' returned '%ls'\n", filename, (LPCWSTR) mangle);
return mangle;
}
@ -616,8 +621,8 @@ GenericArchive::GenDerivedTempName(const char* filename)
GenericArchive::ComparePaths(const CString& name1, char fssep1,
const CString& name2, char fssep2)
{
const char* cp1 = name1;
const char* cp2 = name2;
const WCHAR* cp1 = name1;
const WCHAR* cp2 = name2;
while (*cp1 != '\0' && *cp2 != '\0') {
if (*cp1 == fssep1) {
@ -700,7 +705,7 @@ GenericArchive::UNIXTimeToDateTime(const time_t* pWhen, NuDateTime* pDateTime)
*/
NuError
GenericArchive::GetFileDetails(const AddFilesDialog* pAddOpts,
const char* pathname, struct stat* psb, FileDetails* pDetails)
const WCHAR* pathname, struct _stat* psb, FileDetails* pDetails)
{
//char* livePathStr;
time_t now;
@ -728,7 +733,7 @@ GenericArchive::GetFileDetails(const AddFilesDialog* pAddOpts,
if (NState_GetModAddAsDisk(pState)) {
if ((psb->st_size & 0x1ff) != 0) {
/* reject anything whose size isn't a multiple of 512 bytes */
printf("NOT storing odd-sized (%ld) file as disk image: %s\n",
printf("NOT storing odd-sized (%ld) file as disk image: %ls\n",
(long)psb->st_size, livePathStr);
} else {
/* set fields; note the "preserve" stuff can override this */
@ -797,12 +802,12 @@ GenericArchive::GetFileDetails(const AddFilesDialog* pAddOpts,
*/
typedef struct Win32dirent {
char d_attr;
char d_name[MAX_PATH];
WCHAR d_name[MAX_PATH];
int d_first;
HANDLE d_hFindFile;
} Win32dirent;
static const char* kWildMatchAll = "*.*";
static const WCHAR kWildMatchAll[] = L"*.*";
/*
* Prepare a directory for reading.
@ -810,36 +815,36 @@ static const char* kWildMatchAll = "*.*";
* Allocates a Win32dirent struct that must be freed by the caller.
*/
Win32dirent*
GenericArchive::OpenDir(const char* name)
GenericArchive::OpenDir(const WCHAR* name)
{
Win32dirent* dir = nil;
char* tmpStr = nil;
char* cp;
WCHAR* tmpStr = nil;
WCHAR* cp;
WIN32_FIND_DATA fnd;
dir = (Win32dirent*) malloc(sizeof(*dir));
tmpStr = (char*) malloc(strlen(name) + (2 + sizeof(kWildMatchAll)));
tmpStr = (WCHAR*) malloc((wcslen(name) + 2 + wcslen(kWildMatchAll)) * sizeof(WCHAR));
if (dir == nil || tmpStr == nil)
goto failed;
strcpy(tmpStr, name);
cp = tmpStr + strlen(tmpStr);
wcscpy(tmpStr, name);
cp = tmpStr + wcslen(tmpStr);
/* don't end in a colon (e.g. "C:") */
if ((cp - tmpStr) > 0 && strrchr(tmpStr, ':') == (cp - 1))
if ((cp - tmpStr) > 0 && wcsrchr(tmpStr, ':') == (cp - 1))
*cp++ = '.';
/* must end in a slash */
if ((cp - tmpStr) > 0 &&
strrchr(tmpStr, PathProposal::kLocalFssep) != (cp - 1))
wcsrchr(tmpStr, PathProposal::kLocalFssep) != (cp - 1))
*cp++ = PathProposal::kLocalFssep;
strcpy(cp, kWildMatchAll);
wcscpy(cp, kWildMatchAll);
dir->d_hFindFile = FindFirstFile(tmpStr, &fnd);
if (dir->d_hFindFile == INVALID_HANDLE_VALUE)
goto failed;
strcpy(dir->d_name, fnd.cFileName);
wcscpy(dir->d_name, fnd.cFileName);
dir->d_attr = (unsigned char) fnd.dwFileAttributes;
dir->d_first = 1;
@ -868,7 +873,7 @@ GenericArchive::ReadDir(Win32dirent* dir)
if (!FindNextFile(dir->d_hFindFile, &fnd))
return nil;
strcpy(dir->d_name, fnd.cFileName);
wcscpy(dir->d_name, fnd.cFileName);
dir->d_attr = (unsigned char) fnd.dwFileAttributes;
}
@ -888,14 +893,6 @@ GenericArchive::CloseDir(Win32dirent* dir)
free(dir);
}
/* might as well blend in with the UNIX version */
#define DIR_NAME_LEN(dirent) ((int)strlen((dirent)->d_name))
//static NuError Win32AddFile(NulibState* pState, NuArchive* pArchive,
// const char* pathname);
/*
* Win32 recursive directory descent. Scan the contents of a directory.
* If a subdirectory is found, follow it; otherwise, call Win32AddFile to
@ -903,19 +900,19 @@ GenericArchive::CloseDir(Win32dirent* dir)
*/
NuError
GenericArchive::Win32AddDirectory(const AddFilesDialog* pAddOpts,
const char* dirName, CString* pErrMsg)
const WCHAR* dirName, CString* pErrMsg)
{
NuError err = kNuErrNone;
Win32dirent* dirp = nil;
Win32dirent* entry;
char nbuf[MAX_PATH]; /* malloc might be better; this soaks stack */
WCHAR nbuf[MAX_PATH]; /* malloc might be better; this soaks stack */
char fssep;
int len;
ASSERT(pAddOpts != nil);
ASSERT(dirName != nil);
WMSG1("+++ DESCEND: '%s'\n", dirName);
WMSG1("+++ DESCEND: '%ls'\n", dirName);
dirp = OpenDir(dirName);
if (dirp == nil) {
@ -924,7 +921,7 @@ GenericArchive::Win32AddDirectory(const AddFilesDialog* pAddOpts,
else
err = errno ? (NuError)errno : kNuErrOpenDir;
pErrMsg->Format("Failed on '%s': %s.", dirName, NuStrError(err));
pErrMsg->Format(L"Failed on '%ls': %hs.", dirName, NuStrError(err));
goto bail;
}
@ -933,22 +930,25 @@ GenericArchive::Win32AddDirectory(const AddFilesDialog* pAddOpts,
/* could use readdir_r, but we don't care about reentrancy here */
while ((entry = ReadDir(dirp)) != nil) {
/* skip the dotsies */
if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
if (wcscmp(entry->d_name, L".") == 0 ||
wcscmp(entry->d_name, L"..") == 0)
{
continue;
}
len = strlen(dirName);
if (len + DIR_NAME_LEN(entry) +2 > MAX_PATH) {
len = wcslen(dirName);
if (len + wcslen(entry->d_name) +2 > MAX_PATH) {
err = kNuErrInternal;
WMSG4("ERROR: Filename exceeds %d bytes: %s%c%s",
WMSG4("ERROR: Filename exceeds %d bytes: %ls%c%ls",
MAX_PATH, dirName, fssep, entry->d_name);
goto bail;
}
/* form the new name, inserting an fssep if needed */
strcpy(nbuf, dirName);
wcscpy(nbuf, dirName);
if (dirName[len-1] != fssep)
nbuf[len++] = fssep;
strcpy(nbuf+len, entry->d_name);
wcscpy(nbuf+len, entry->d_name);
err = Win32AddFile(pAddOpts, nbuf, pErrMsg);
if (err != kNuErrNone)
@ -970,12 +970,12 @@ bail:
*/
NuError
GenericArchive::Win32AddFile(const AddFilesDialog* pAddOpts,
const char* pathname, CString* pErrMsg)
const WCHAR* pathname, CString* pErrMsg)
{
NuError err = kNuErrNone;
Boolean exists, isDir, isReadable;
FileDetails details;
struct stat sb;
struct _stat sb;
ASSERT(pAddOpts != nil);
ASSERT(pathname != nil);
@ -984,19 +984,19 @@ GenericArchive::Win32AddFile(const AddFilesDialog* pAddOpts,
int ierr = checkPath.CheckFileStatus(&sb, &exists, &isReadable, &isDir);
if (ierr != 0) {
err = kNuErrGeneric;
pErrMsg->Format("Unexpected error while examining '%s': %s.", pathname,
NuStrError((NuError) ierr));
pErrMsg->Format(L"Unexpected error while examining '%ls': %hs.",
pathname, NuStrError((NuError) ierr));
goto bail;
}
if (!exists) {
err = kNuErrFileNotFound;
pErrMsg->Format("Couldn't find '%s'", pathname);
pErrMsg->Format(L"Couldn't find '%ls'", pathname);
goto bail;
}
if (!isReadable) {
err = kNuErrFileNotReadable;
pErrMsg->Format("File '%s' isn't readable.", pathname);
pErrMsg->Format(L"File '%ls' isn't readable.", pathname);
goto bail;
}
if (isDir) {
@ -1010,7 +1010,7 @@ GenericArchive::Win32AddFile(const AddFilesDialog* pAddOpts,
* filetype and auxtype it has, and whether or not it's actually the
* resource fork of another file.
*/
WMSG1("+++ ADD '%s'\n", pathname);
WMSG1("+++ ADD '%ls'\n", pathname);
/*
* Fill out the "details" structure. The class has an automatic
@ -1021,7 +1021,7 @@ GenericArchive::Win32AddFile(const AddFilesDialog* pAddOpts,
if (err != kNuErrNone)
goto bail;
assert(strcmp(pathname, details.origName) == 0);
assert(wcscmp(pathname, details.origName) == 0);
err = DoAddFile(pAddOpts, &details);
if (err == kNuErrSkipped) // ignore "skipped" result
err = kNuErrNone;
@ -1030,7 +1030,7 @@ GenericArchive::Win32AddFile(const AddFilesDialog* pAddOpts,
bail:
if (err != kNuErrNone && pErrMsg->IsEmpty()) {
pErrMsg->Format("Unable to add file '%s': %s.",
pErrMsg->Format(L"Unable to add file '%ls': %hs.",
pathname, NuStrError(err));
}
return err;
@ -1047,7 +1047,7 @@ bail:
* GSOSAddFile. ]
*/
NuError
GenericArchive::AddFile(const AddFilesDialog* pAddOpts, const char* pathname,
GenericArchive::AddFile(const AddFilesDialog* pAddOpts, const WCHAR* pathname,
CString* pErrMsg)
{
*pErrMsg = "";
@ -1106,8 +1106,10 @@ GenericArchive::FileDetails::operator const NuFileDetails() const
break;
}
details.origName = origName; // CString to char*
details.storageName = storageName; // CString to char*
// TODO(xyzzy): need narrow-string versions of origName and storageName
// (probably need to re-think this automatic-cast-conversion stuff)
details.origName = "XYZZY-GenericArchive1"; // origName;
details.storageName = "XYZZY-GenericArchive2"; // storageName;
//details.fileSysID = fileSysID;
details.fileSysInfo = fileSysInfo;
details.access = access;
@ -1234,13 +1236,13 @@ SelectionSet::AddToSet(GenericEntry* pEntry, int threadMask)
{
SelectionEntry* pSelEntry;
//WMSG1(" Sel '%s'\n", pEntry->GetPathName());
//WMSG1(" Sel '%ls'\n", pEntry->GetPathName());
if (!(threadMask & GenericEntry::kAllowVolumeDir) &&
pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir)
{
/* only include volume dir if specifically requested */
//WMSG1(" Excluding volume dir '%s' from set\n", pEntry->GetPathName());
//WMSG1(" Excluding volume dir '%ls' from set\n", pEntry->GetPathName());
return;
}
@ -1248,7 +1250,7 @@ SelectionSet::AddToSet(GenericEntry* pEntry, int threadMask)
pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory)
{
/* only include directories if specifically requested */
//WMSG1(" Excluding folder '%s' from set\n", pEntry->GetPathName());
//WMSG1(" Excluding folder '%ls' from set\n", pEntry->GetPathName());
return;
}
@ -1325,18 +1327,18 @@ SelectionSet::DeleteEntries(void)
* Count the #of entries whose display name matches the prefix string.
*/
int
SelectionSet::CountMatchingPrefix(const char* prefix)
SelectionSet::CountMatchingPrefix(const WCHAR* prefix)
{
SelectionEntry* pEntry;
int count = 0;
int len = strlen(prefix);
int len = wcslen(prefix);
ASSERT(len > 0);
pEntry = GetEntries();
while (pEntry != nil) {
GenericEntry* pGeneric = pEntry->GetEntry();
if (strncasecmp(prefix, pGeneric->GetDisplayName(), len) == 0)
if (wcsnicmp(prefix, pGeneric->GetDisplayName(), len) == 0)
count++;
pEntry = pEntry->GetNext();
}
@ -1356,7 +1358,7 @@ SelectionSet::Dump(void)
pEntry = fEntryHead;
while (pEntry != nil) {
WMSG1(" : name='%s'\n", pEntry->GetEntry()->GetPathName());
WMSG1(" : name='%ls'\n", pEntry->GetEntry()->GetPathName());
pEntry = pEntry->GetNext();
}
}

View File

@ -8,13 +8,13 @@
*
* These are abstract base classes.
*/
#ifndef __GENERIC_ARCHIVE__
#define __GENERIC_ARCHIVE__
#ifndef APP_GENERICARCHIVE_H
#define APP_GENERICARCHIVE_H
#include "Preferences.h"
#include "../util/UtilLib.h"
#include "../diskimg/DiskImg.h"
#include "../prebuilt/NufxLib.h"
#include "../nufxlib/NufxLib.h"
#include "../reformat/Reformat.h"
#include <time.h>
#include <string.h>
@ -166,13 +166,14 @@ public:
long GetIndex(void) const { return fIndex; }
void SetIndex(long idx) { fIndex = idx; }
const char* GetPathName(void) const { return fPathName; }
void SetPathName(const char* path);
const char* GetFileName(void);
const char* GetFileNameExtension(void); // returns e.g. ".SHK"
void SetSubVolName(const char* name);
const char* GetSubVolName(void) const { return fSubVolName; }
const char* GetDisplayName(void) const; // not really "const"
const WCHAR* GetPathName(void) const { return fPathName; }
void SetPathName(const WCHAR* path);
const WCHAR* GetFileName(void);
const WCHAR* GetFileNameExtension(void); // returns e.g. ".SHK"
CStringA GetFileNameExtensionA(void);
void SetSubVolName(const WCHAR* name);
const WCHAR* GetSubVolName(void) const { return fSubVolName; }
const WCHAR* GetDisplayName(void) const; // not really "const"
char GetFssep(void) const { return fFssep; }
void SetFssep(char fssep) { fFssep = fssep; }
@ -188,8 +189,8 @@ public:
void SetModWhen(time_t when) { fModWhen = when; }
RecordKind GetRecordKind(void) const { return fRecordKind; }
void SetRecordKind(RecordKind recordKind) { fRecordKind = recordKind; }
const char* GetFormatStr(void) const { return fFormatStr; }
void SetFormatStr(const char* str) { fFormatStr = str; } // arg not copied, must be static!
const WCHAR* GetFormatStr(void) const { return fFormatStr; }
void SetFormatStr(const WCHAR* str) { fFormatStr = str; } // arg not copied, must be static!
LONGLONG GetCompressedLen(void) const { return fCompressedLen; }
void SetCompressedLen(LONGLONG len) { fCompressedLen = len; }
LONGLONG GetUncompressedLen(void) const {
@ -226,33 +227,33 @@ public:
void SetNext(GenericEntry* pEntry) { fpNext = pEntry; }
// Utility functions.
const char* GetFileTypeString(void) const;
static bool CheckHighASCII(const unsigned char* buffer,
const WCHAR* GetFileTypeString(void) const;
static bool CheckHighASCII(const BYTE* buffer,
unsigned long count);
static ConvertEOL DetermineConversion(const unsigned char* buffer,
static ConvertEOL DetermineConversion(const BYTE* buffer,
long count, EOLType* pSourceType, ConvertHighASCII* pConvHA);
static int GenericEntry::WriteConvert(FILE* fp, const char* buf,
size_t len, ConvertEOL* pConv, ConvertHighASCII* pConvHA,
bool* pLastCR);
protected:
static void SpacesToUnderscores(char* buf);
static void SpacesToUnderscores(WCHAR* buf);
private:
char* fPathName;
const char* fFileName; // points within fPathName
const char* fFileNameExtension; // points within fPathName
WCHAR* fPathName;
const WCHAR* fFileName; // points within fPathName
const WCHAR* fFileNameExtension; // points within fPathName
char fFssep;
char* fSubVolName; // sub-volume prefix, or nil if none
char* fDisplayName; // combination of sub-vol and path
WCHAR* fSubVolName; // sub-volume prefix, or nil if none
WCHAR* fDisplayName; // combination of sub-vol and path
long fFileType;
long fAuxType;
long fAccess;
time_t fCreateWhen;
time_t fModWhen;
RecordKind fRecordKind; // forked file, disk image, ??
const char* fFormatStr; // static str; compression or fs format
const WCHAR* fFormatStr; // static str; compression or fs format
//LONGLONG fUncompressedLen;
LONGLONG fDataForkLen; // also for disk images
LONGLONG fRsrcForkLen; // set to 0 when nonexistent
@ -318,10 +319,10 @@ public:
} OpenResult;
// Open an archive and do fun things with the innards.
virtual OpenResult Open(const char* filename, bool readOnly,
virtual OpenResult Open(const WCHAR* filename, bool readOnly,
CString* pErrMsg) = 0;
// Create a new archive with the specified name.
virtual CString New(const char* filename, const void* options) = 0;
virtual CString New(const WCHAR* filename, const void* options) = 0;
// Flush any unwritten data to disk
virtual CString Flush(void) = 0;
// Force a re-read from the underlying storage.
@ -357,7 +358,7 @@ public:
const AddFilesDialog* pAddOpts) = 0;
// Create a subdirectory.
virtual bool CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry,
const char* newName) = 0;
const WCHAR* newName) = 0;
// Test a set of files.
virtual bool TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) = 0;
@ -372,9 +373,9 @@ public:
// Rename a volume (or sub-volume)
virtual bool RenameVolume(CWnd* pMsgWnd, DiskFS* pDiskFS,
const char* newName) = 0;
const WCHAR* newName) = 0;
virtual CString TestVolumeName(const DiskFS* pDiskFS,
const char* newName) const = 0;
const WCHAR* newName) const = 0;
// Recompress a set of files.
virtual bool RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
@ -419,10 +420,10 @@ public:
virtual long GetCapability(Capability cap) = 0;
// Get the pathname of the file we opened.
const char* GetPathName(void) const { return fPathName; }
const WCHAR* GetPathName(void) const { return fPathName; }
// Generic utility function.
static CString GenDerivedTempName(const char* filename);
static CString GenDerivedTempName(const WCHAR* filename);
static int ComparePaths(const CString& name1, char fssep1,
const CString& name2, char fssep2);
@ -433,6 +434,9 @@ public:
*
* It's based on the NuFileDetails class from NufxLib (which used to be
* used everywhere).
*
* TODO: xyzzy: NuFileDetails cast requires us to store pathnames with
* narrow strings.
*/
class FileDetails {
public:
@ -482,11 +486,23 @@ public:
* Data fields. While transitioning from general use of NuFileDetails
* (v1.2.x to v2.0) I'm just going to leave these public.
*/
//NuThreadID threadID; /* data, rsrc, disk img? */
FileKind entryKind;
/*
* Original full pathname as found on Windows.
*/
CString origName;
CString storageName; /* normalized (NOT FS-normalized) */
/*
* "Normalized" pathname. This is the full path with any of our
* added bits removed (e.g. file type & fork identifiers). It has
* not been sanitized for any specific target filesystem. See also
* PathProposal::LocalToArchive().
*/
CString storageName;
//NuFileSysID fileSysID;
DiskImg::FSFormat fileSysFmt;
unsigned short fileSysInfo; /* fssep lurks here */
@ -504,8 +520,8 @@ public:
// Transfer files, one at a time, into this archive from another.
virtual void XferPrepare(const XferFileOptions* pXferOpts) = 0;
virtual CString XferFile(FileDetails* pDetails, unsigned char** pDataBuf,
long dataLen, unsigned char** pRsrcBuf, long rsrcLen) = 0;
virtual CString XferFile(FileDetails* pDetails, BYTE** pDataBuf,
long dataLen, BYTE** pRsrcBuf, long rsrcLen) = 0;
virtual void XferAbort(CWnd* pMsgWnd) = 0;
virtual void XferFinish(CWnd* pMsgWnd) = 0;
static void UNIXTimeToDateTime(const time_t* pWhen, NuDateTime *pDateTime);
@ -514,17 +530,17 @@ protected:
virtual void DeleteEntries(void);
/* NuLib2-derived recursive directory add functions */
void ReplaceFssep(char* str, char oldc, char newc, char newSubst);
NuError GetFileDetails(const AddFilesDialog* pAddOpts, const char* pathname,
struct stat* psb, FileDetails* pDetails);
Win32dirent* OpenDir(const char* name);
void ReplaceFssep(WCHAR* str, char oldc, char newc, char newSubst);
NuError GetFileDetails(const AddFilesDialog* pAddOpts, const WCHAR* pathname,
struct _stat* psb, FileDetails* pDetails);
Win32dirent* OpenDir(const WCHAR* name);
Win32dirent* ReadDir(Win32dirent* dir);
void CloseDir(Win32dirent* dir);
NuError Win32AddDirectory(const AddFilesDialog* pAddOpts,
const char* dirName, CString* pErrMsg);
const WCHAR* dirName, CString* pErrMsg);
NuError Win32AddFile(const AddFilesDialog* pAddOpts,
const char* pathname, CString* pErrMsg);
NuError AddFile(const AddFilesDialog* pAddOpts, const char* pathname,
const WCHAR* pathname, CString* pErrMsg);
NuError AddFile(const AddFilesDialog* pAddOpts, const WCHAR* pathname,
CString* pErrMsg);
/*
@ -545,13 +561,13 @@ protected:
virtual NuError DoAddFile(const AddFilesDialog* pAddOpts,
FileDetails* pDetails) = 0;
void SetPathName(const char* pathName) {
delete fPathName;
void SetPathName(const WCHAR* pathName) {
free(fPathName);
if (pathName != nil) {
fPathName = new char[strlen(pathName)+1];
strcpy(fPathName, pathName);
} else
fPathName = _wcsdup(pathName);
} else {
fPathName = nil;
}
}
bool fReloadFlag; // set after Reload called
@ -562,7 +578,7 @@ private:
//CString fNewPathHolder;
//CString fOrigPathHolder;
char* fPathName;
WCHAR* fPathName;
long fNumEntries;
GenericEntry* fEntryHead;
GenericEntry* fEntryTail;
@ -669,7 +685,7 @@ public:
int GetNumEntries(void) const { return fNumEntries; }
// count the #of entries whose display name matches "prefix"
int CountMatchingPrefix(const char* prefix);
int CountMatchingPrefix(const WCHAR* prefix);
// debug dump
void Dump(void);
@ -687,4 +703,4 @@ private:
SelectionEntry* fEntryTail;
};
#endif /*__GENERIC_ARCHIVE__*/
#endif /*APP_GENERICARCHIVE_H*/

View File

@ -6,8 +6,8 @@
/*
* Constants for help topics.
*/
#ifndef __HELP_TOPICS__
#define __HELP_TOPICS__
#ifndef APP_HELP_TOPICS_H
#define APP_HELP_TOPICS_H
#define HELP_TOPIC_WELCOME 10
#define HELP_TOPIC_DISKEDIT 13
@ -40,4 +40,4 @@
#define HELP_TOPIC_RENAME_VOLUME 268
#define HELP_TOPIC_EOL_SCAN 272
#endif /*__HELP_TOPICS__*/
#endif /*APP_HELP_TOPICS_H*/

View File

@ -30,83 +30,83 @@ END_MESSAGE_MAP()
* to get the text string. That way we'd be consistent.
*/
typedef struct ImageFormatDialog::ConvTable {
int enumval; // a DiskImg::enum type
const char* name;
int enumval; // a DiskImg::enum type
const WCHAR* name;
} ConvTable;
const int kLastEntry = -1;
/* DiskImg::OuterFormat */
static const ConvTable gOuterFormats[] = {
{ DiskImg::kOuterFormatUnknown, "Unknown format" },
{ DiskImg::kOuterFormatNone, "(none)" },
// { DiskImg::kOuterFormatCompress, "UNIX compress" },
{ DiskImg::kOuterFormatGzip, "gzip" },
// { DiskImg::kOuterFormatBzip2, "bzip2" },
{ DiskImg::kOuterFormatZip, "Zip archive" },
{ DiskImg::kOuterFormatUnknown, L"Unknown format" },
{ DiskImg::kOuterFormatNone, L"(none)" },
// { DiskImg::kOuterFormatCompress, L"UNIX compress" },
{ DiskImg::kOuterFormatGzip, L"gzip" },
// { DiskImg::kOuterFormatBzip2, L"bzip2" },
{ DiskImg::kOuterFormatZip, L"Zip archive" },
{ kLastEntry, nil }
};
/* DiskImg::FileFormat */
static const ConvTable gFileFormats[] = {
{ DiskImg::kFileFormatUnknown, "Unknown format" },
{ DiskImg::kFileFormatUnadorned, "Unadorned raw data" },
{ DiskImg::kFileFormat2MG, "2MG" },
{ DiskImg::kFileFormatNuFX, "NuFX (ShrinkIt)" },
{ DiskImg::kFileFormatDiskCopy42, "DiskCopy 4.2" },
// { DiskImg::kFileFormatDiskCopy60, "DiskCopy 6.0" },
// { DiskImg::kFileFormatDavex, "Davex volume image" },
{ DiskImg::kFileFormatSim2eHDV, "Sim //e HDV" },
{ DiskImg::kFileFormatDDD, "DDD" },
{ DiskImg::kFileFormatTrackStar, "TrackStar image" },
{ DiskImg::kFileFormatFDI, "FDI image" },
// { DiskImg::kFileFormatDDDDeluxe, "DDDDeluxe" },
{ DiskImg::kFileFormatUnknown, L"Unknown format" },
{ DiskImg::kFileFormatUnadorned, L"Unadorned raw data" },
{ DiskImg::kFileFormat2MG, L"2MG" },
{ DiskImg::kFileFormatNuFX, L"NuFX (ShrinkIt)" },
{ DiskImg::kFileFormatDiskCopy42, L"DiskCopy 4.2" },
// { DiskImg::kFileFormatDiskCopy60, L"DiskCopy 6.0" },
// { DiskImg::kFileFormatDavex, L"Davex volume image" },
{ DiskImg::kFileFormatSim2eHDV, L"Sim //e HDV" },
{ DiskImg::kFileFormatDDD, L"DDD" },
{ DiskImg::kFileFormatTrackStar, L"TrackStar image" },
{ DiskImg::kFileFormatFDI, L"FDI image" },
// { DiskImg::kFileFormatDDDDeluxe, L"DDDDeluxe" },
{ kLastEntry, nil }
};
/* DiskImg::PhysicalFormat */
static const ConvTable gPhysicalFormats[] = {
{ DiskImg::kPhysicalFormatUnknown, "Unknown format" },
{ DiskImg::kPhysicalFormatSectors, "Sectors" },
{ DiskImg::kPhysicalFormatNib525_6656, "Raw nibbles (6656-byte)" },
{ DiskImg::kPhysicalFormatNib525_6384, "Raw nibbles (6384-byte)" },
{ DiskImg::kPhysicalFormatNib525_Var, "Raw nibbles (variable len)" },
{ DiskImg::kPhysicalFormatUnknown, L"Unknown format" },
{ DiskImg::kPhysicalFormatSectors, L"Sectors" },
{ DiskImg::kPhysicalFormatNib525_6656, L"Raw nibbles (6656-byte)" },
{ DiskImg::kPhysicalFormatNib525_6384, L"Raw nibbles (6384-byte)" },
{ DiskImg::kPhysicalFormatNib525_Var, L"Raw nibbles (variable len)" },
{ kLastEntry, nil }
};
/* DiskImg::SectorOrder */
static const ConvTable gSectorOrders[] = {
{ DiskImg::kSectorOrderUnknown, "Unknown ordering" },
{ DiskImg::kSectorOrderProDOS, "ProDOS block ordering" },
{ DiskImg::kSectorOrderDOS, "DOS sector ordering" },
{ DiskImg::kSectorOrderCPM, "CP/M block ordering" },
{ DiskImg::kSectorOrderPhysical, "Physical sector ordering" },
{ DiskImg::kSectorOrderUnknown, L"Unknown ordering" },
{ DiskImg::kSectorOrderProDOS, L"ProDOS block ordering" },
{ DiskImg::kSectorOrderDOS, L"DOS sector ordering" },
{ DiskImg::kSectorOrderCPM, L"CP/M block ordering" },
{ DiskImg::kSectorOrderPhysical, L"Physical sector ordering" },
{ kLastEntry, nil }
};
/* DiskImg::FSFormat */
static const ConvTable gFSFormats[] = {
{ DiskImg::kFormatUnknown, "Unknown filesystem" },
{ DiskImg::kFormatGenericDOSOrd, "Generic DOS sectors" },
{ DiskImg::kFormatGenericProDOSOrd, "Generic ProDOS blocks" },
{ DiskImg::kFormatGenericPhysicalOrd, "Generic raw sectors" },
{ DiskImg::kFormatGenericCPMOrd, "Generic CP/M blocks" },
{ DiskImg::kFormatProDOS, "ProDOS" },
{ DiskImg::kFormatDOS33, "DOS 3.3" },
{ DiskImg::kFormatDOS32, "DOS 3.2" },
{ DiskImg::kFormatPascal, "Pascal" },
{ DiskImg::kFormatMacHFS, "HFS" },
// { DiskImg::kFormatMacMFS, "MFS" },
// { DiskImg::kFormatLisa, "Lisa" },
{ DiskImg::kFormatCPM, "CP/M" },
{ DiskImg::kFormatMSDOS, "MS-DOS FAT" },
// { DiskImg::kFormatISO9660, "ISO-9660" },
{ DiskImg::kFormatUNIDOS, "UNIDOS (400K DOS x2)" },
{ DiskImg::kFormatOzDOS, "OzDOS (400K DOS x2)" },
{ DiskImg::kFormatCFFA4, "CFFA (4 or 6 partitions)" },
{ DiskImg::kFormatCFFA8, "CFFA (8 partitions)" },
{ DiskImg::kFormatMacPart, "Macintosh partitioned disk" },
{ DiskImg::kFormatMicroDrive, "MicroDrive partitioned disk" },
{ DiskImg::kFormatFocusDrive, "FocusDrive partitioned disk" },
{ DiskImg::kFormatRDOS33, "RDOS 3.3 (16-sector)" },
{ DiskImg::kFormatRDOS32, "RDOS 3.2 (13-sector)" },
{ DiskImg::kFormatRDOS3, "RDOS 3 (cracked 13-sector)" },
{ DiskImg::kFormatUnknown, L"Unknown filesystem" },
{ DiskImg::kFormatGenericDOSOrd, L"Generic DOS sectors" },
{ DiskImg::kFormatGenericProDOSOrd, L"Generic ProDOS blocks" },
{ DiskImg::kFormatGenericPhysicalOrd, L"Generic raw sectors" },
{ DiskImg::kFormatGenericCPMOrd, L"Generic CP/M blocks" },
{ DiskImg::kFormatProDOS, L"ProDOS" },
{ DiskImg::kFormatDOS33, L"DOS 3.3" },
{ DiskImg::kFormatDOS32, L"DOS 3.2" },
{ DiskImg::kFormatPascal, L"Pascal" },
{ DiskImg::kFormatMacHFS, L"HFS" },
// { DiskImg::kFormatMacMFS, L"MFS" },
// { DiskImg::kFormatLisa, L"Lisa" },
{ DiskImg::kFormatCPM, L"CP/M" },
{ DiskImg::kFormatMSDOS, L"MS-DOS FAT" },
// { DiskImg::kFormatISO9660, L"ISO-9660" },
{ DiskImg::kFormatUNIDOS, L"UNIDOS (400K DOS x2)" },
{ DiskImg::kFormatOzDOS, L"OzDOS (400K DOS x2)" },
{ DiskImg::kFormatCFFA4, L"CFFA (4 or 6 partitions)" },
{ DiskImg::kFormatCFFA8, L"CFFA (8 partitions)" },
{ DiskImg::kFormatMacPart, L"Macintosh partitioned disk" },
{ DiskImg::kFormatMicroDrive, L"MicroDrive partitioned disk" },
{ DiskImg::kFormatFocusDrive, L"FocusDrive partitioned disk" },
{ DiskImg::kFormatRDOS33, L"RDOS 3.3 (16-sector)" },
{ DiskImg::kFormatRDOS32, L"RDOS 3.2 (13-sector)" },
{ DiskImg::kFormatRDOS3, L"RDOS 3 (cracked 13-sector)" },
{ kLastEntry, nil }
};
@ -230,7 +230,7 @@ ImageFormatDialog::LoadComboBox(int boxID, const ConvTable* pTable, int dflt)
if (pTable == gFSFormats && !fAllowGenericFormats &&
DiskImg::IsGenericFormat((DiskImg::FSFormat)pTable[idx].enumval))
{
WMSG1("LoadComboBox skipping '%s'\n", pTable[idx].name);
WMSG1("LoadComboBox skipping '%ls'\n", pTable[idx].name);
idxShift++;
} else {
// Note to self: AddString returns the combo box item ID;
@ -281,7 +281,7 @@ ImageFormatDialog::ConvComboSel(int boxID, const ConvTable* pTable)
ASSERT(enumval == pTable[idx].enumval);
}
WMSG3(" Returning ev=%d for %d entry '%s'\n",
WMSG3(" Returning ev=%d for %d entry '%ls'\n",
enumval, boxID, pTable[idx].name);
return enumval;
@ -321,7 +321,7 @@ ImageFormatDialog::OnOK(void)
ConvComboSel(IDC_DECONF_FSFORMAT, gFSFormats);
if (fSectorOrder == DiskImg::kSectorOrderUnknown) {
MessageBox("You must choose a sector ordering.", "Error",
MessageBox(L"You must choose a sector ordering.", L"Error",
MB_OK | MB_ICONEXCLAMATION);
return;
}
@ -329,9 +329,9 @@ ImageFormatDialog::OnOK(void)
if (fFSFormat == DiskImg::kFormatUnknown &&
!fAllowUnknown)
{
MessageBox("You must choose a filesystem format. If not known,"
" use one of the 'generic' entries.",
"Error", MB_OK | MB_ICONEXCLAMATION);
MessageBox(L"You must choose a filesystem format. If not known,"
L" use one of the 'generic' entries.",
L"Error", MB_OK | MB_ICONEXCLAMATION);
return;
}

View File

@ -6,8 +6,8 @@
/*
* Dialog asking the user to confirm certain details of a disk image.
*/
#ifndef __IMAGEFORMATDIALOG__
#define __IMAGEFORMATDIALOG__
#ifndef APP_IMAGEFORMATDIALOG_H
#define APP_IMAGEFORMATDIALOG_H
//#include <afxwin.h>
#include "resource.h"
@ -24,7 +24,7 @@ public:
CDialog(IDD_DECONF, pParentWnd)
{
fInitialized = false;
fFileSource = "";
fFileSource = L"";
fAllowUnknown = false;
fOuterFormat = DiskImg::kOuterFormatUnknown;
fFileFormat = DiskImg::kFileFormatUnknown;
@ -78,4 +78,4 @@ protected:
DECLARE_MESSAGE_MAP()
};
#endif /*__IMAGEFORMATDIALOG__*/
#endif /*APP_IMAGEFORMATDIALOG_H*/

View File

@ -26,59 +26,58 @@
/* use MFC's fancy version of new for debugging */
//#define new DEBUG_NEW
static const char* kWebSiteURL = "http://www.faddensoft.com/";
static const WCHAR kWebSiteURL[] = L"http://www.faddensoft.com/";
/*
* Filters for the "open file" command. In some cases a file may be opened
* in more than one format, so it's necessary to keep track of what the
* file filter was set to when the file was opened.
*/
const char MainWindow::kOpenNuFX[] =
"ShrinkIt Archives (.shk .sdk .bxy .sea .bse)|*.shk;*.sdk;*.bxy;*.sea;*.bse|";
const char MainWindow::kOpenBinaryII[] =
"Binary II Archives (.bny .bqy .bxy)|*.bny;*.bqy;*.bxy|";
const char MainWindow::kOpenACU[] =
"ACU Archives (.acu)|*.acu|";
const char MainWindow::kOpenDiskImage[] =
"Disk Images (.shk .sdk .dsk .po .do .d13 .2mg .img .nib .nb2 .raw .hdv .dc .dc6 .ddd .app .fdi .iso .gz .zip)|"
"*.shk;*.sdk;*.dsk;*.po;*.do;*.d13;*.2mg;*.img;*.nib;*.nb2;*.raw;*.hdv;*.dc;*.dc6;*.ddd;*.app;*.fdi;*.iso;*.gz;*.zip|";
const char MainWindow::kOpenAll[] =
"All Files (*.*)|*.*|";
const char MainWindow::kOpenEnd[] =
"|";
const WCHAR MainWindow::kOpenNuFX[] =
L"ShrinkIt Archives (.shk .sdk .bxy .sea .bse)|*.shk;*.sdk;*.bxy;*.sea;*.bse|";
const WCHAR MainWindow::kOpenBinaryII[] =
L"Binary II Archives (.bny .bqy .bxy)|*.bny;*.bqy;*.bxy|";
const WCHAR MainWindow::kOpenACU[] =
L"ACU Archives (.acu)|*.acu|";
const WCHAR MainWindow::kOpenDiskImage[] =
L"Disk Images (.shk .sdk .dsk .po .do .d13 .2mg .img .nib .nb2 .raw .hdv .dc .dc6 .ddd .app .fdi .iso .gz .zip)|"
L"*.shk;*.sdk;*.dsk;*.po;*.do;*.d13;*.2mg;*.img;*.nib;*.nb2;*.raw;*.hdv;*.dc;*.dc6;*.ddd;*.app;*.fdi;*.iso;*.gz;*.zip|";
const WCHAR MainWindow::kOpenAll[] =
L"All Files (*.*)|*.*|";
const WCHAR MainWindow::kOpenEnd[] =
L"|";
static const struct {
//const char* extension;
char extension[4];
WCHAR extension[4];
FilterIndex idx;
} gExtensionToIndex[] = {
{ "shk", kFilterIndexNuFX },
{ "bxy", kFilterIndexNuFX },
{ "bse", kFilterIndexNuFX },
{ "sea", kFilterIndexNuFX },
{ "bny", kFilterIndexBinaryII },
{ "bqy", kFilterIndexBinaryII },
{ "acu", kFilterIndexACU },
{ "dsk", kFilterIndexDiskImage },
{ "po", kFilterIndexDiskImage },
{ "do", kFilterIndexDiskImage },
{ "d13", kFilterIndexDiskImage },
{ "2mg", kFilterIndexDiskImage },
{ "img", kFilterIndexDiskImage },
{ "sdk", kFilterIndexDiskImage },
{ "raw", kFilterIndexDiskImage },
{ "ddd", kFilterIndexDiskImage },
{ "app", kFilterIndexDiskImage },
{ "fdi", kFilterIndexDiskImage },
{ "iso", kFilterIndexDiskImage },
{ "gz", kFilterIndexDiskImage }, // assume disk image inside
{ "zip", kFilterIndexDiskImage }, // assume disk image inside
{ L"shk", kFilterIndexNuFX },
{ L"bxy", kFilterIndexNuFX },
{ L"bse", kFilterIndexNuFX },
{ L"sea", kFilterIndexNuFX },
{ L"bny", kFilterIndexBinaryII },
{ L"bqy", kFilterIndexBinaryII },
{ L"acu", kFilterIndexACU },
{ L"dsk", kFilterIndexDiskImage },
{ L"po", kFilterIndexDiskImage },
{ L"do", kFilterIndexDiskImage },
{ L"d13", kFilterIndexDiskImage },
{ L"2mg", kFilterIndexDiskImage },
{ L"img", kFilterIndexDiskImage },
{ L"sdk", kFilterIndexDiskImage },
{ L"raw", kFilterIndexDiskImage },
{ L"ddd", kFilterIndexDiskImage },
{ L"app", kFilterIndexDiskImage },
{ L"fdi", kFilterIndexDiskImage },
{ L"iso", kFilterIndexDiskImage },
{ L"gz", kFilterIndexDiskImage }, // assume disk image inside
{ L"zip", kFilterIndexDiskImage }, // assume disk image inside
};
const char* MainWindow::kModeNuFX = _T("nufx");
const char* MainWindow::kModeBinaryII = _T("bin2");
const char* MainWindow::kModeACU = _T("acu");
const char* MainWindow::kModeDiskImage = _T("disk");
const WCHAR MainWindow::kModeNuFX[] = L"nufx";
const WCHAR MainWindow::kModeBinaryII[] = L"bin2";
const WCHAR MainWindow::kModeACU[] = L"acu";
const WCHAR MainWindow::kModeDiskImage[] = L"disk";
/*
@ -198,7 +197,7 @@ END_MESSAGE_MAP()
*/
MainWindow::MainWindow()
{
static const char* kAppName = _T("CiderPress");
static const WCHAR kAppName[] = L"CiderPress";
fpContentList = nil;
fpOpenArchive = nil;
@ -368,71 +367,71 @@ MainWindow::ProcessCommandLine(void)
/*
* Get the command line and break it down into an argument vector.
*/
const char* cmdLine = ::GetCommandLine();
if (cmdLine == nil || strlen(cmdLine) == 0)
const WCHAR* cmdLine = ::GetCommandLine();
if (cmdLine == nil || wcslen(cmdLine) == 0)
return;
char* mangle = strdup(cmdLine);
WCHAR* mangle = wcsdup(cmdLine);
if (mangle == nil)
return;
WMSG1("Mangling '%s'\n", mangle);
char* argv[8];
WMSG1("Mangling '%ls'\n", mangle);
WCHAR* argv[8];
int argc = 8;
VectorizeString(mangle, argv, &argc);
WMSG0("Args:\n");
for (int i = 0; i < argc; i++) {
WMSG2(" %d '%s'\n", i, argv[i]);
WMSG2(" %d '%ls'\n", i, argv[i]);
}
/*
* Figure out what the arguments are.
*/
const char* filename = nil;
const char* dispName = nil;
const WCHAR* filename = nil;
const WCHAR* dispName = nil;
int filterIndex = kFilterIndexGeneric;
bool temp = false;
for (i = 1; i < argc; i++) {
for (int i = 1; i < argc; i++) {
if (argv[i][0] == '-') {
if (strcasecmp(argv[i], "-mode") == 0) {
if (wcsicmp(argv[i], L"-mode") == 0) {
if (i == argc-1) {
WMSG0("WARNING: -mode specified without mode\n");
} else
i++;
if (strcasecmp(argv[i], kModeNuFX) == 0)
if (wcsicmp(argv[i], kModeNuFX) == 0)
filterIndex = kFilterIndexNuFX;
else if (strcasecmp(argv[i], kModeBinaryII) == 0)
else if (wcsicmp(argv[i], kModeBinaryII) == 0)
filterIndex = kFilterIndexBinaryII;
else if (strcasecmp(argv[i], kModeACU) == 0)
else if (wcsicmp(argv[i], kModeACU) == 0)
filterIndex = kFilterIndexACU;
else if (strcasecmp(argv[i], kModeDiskImage) == 0)
else if (wcsicmp(argv[i], kModeDiskImage) == 0)
filterIndex = kFilterIndexDiskImage;
else {
WMSG1("WARNING: unrecognized mode '%s'\n", argv[i]);
WMSG1("WARNING: unrecognized mode '%ls'\n", argv[i]);
}
} else if (strcasecmp(argv[i], "-dispname") == 0) {
} else if (wcsicmp(argv[i], L"-dispname") == 0) {
if (i == argc-1) {
WMSG0("WARNING: -dispname specified without name\n");
} else
i++;
dispName = argv[i];
} else if (strcasecmp(argv[i], "-temparc") == 0) {
} else if (wcsicmp(argv[i], L"-temparc") == 0) {
temp = true;
} else if (strcasecmp(argv[i], "-install") == 0) {
} else if (wcsicmp(argv[i], L"-install") == 0) {
// see MyApp::InitInstance
WMSG0("Got '-install' flag, doing nothing\n");
} else if (strcasecmp(argv[i], "-uninstall") == 0) {
} else if (wcsicmp(argv[i], L"-uninstall") == 0) {
// see MyApp::InitInstance
WMSG0("Got '-uninstall' flag, doing nothing\n");
} else {
WMSG1("WARNING: unrecognized flag '%s'\n", argv[i]);
WMSG1("WARNING: unrecognized flag '%ls'\n", argv[i]);
}
} else {
/* must be the filename */
if (i != argc-1) {
WMSG1("WARNING: ignoring extra arguments (e.g. '%s')\n",
WMSG1("WARNING: ignoring extra arguments (e.g. '%ls')\n",
argv[i+1]);
}
filename = argv[i];
@ -444,8 +443,8 @@ MainWindow::ProcessCommandLine(void)
}
WMSG0("Argument handling:\n");
WMSG3(" index=%d temp=%d filename='%s'\n",
filterIndex, temp, filename == nil ? "(nil)" : filename);
WMSG3(" index=%d temp=%d filename='%ls'\n",
filterIndex, temp, filename == nil ? L"(null)" : filename);
if (filename != nil) {
PathName path(filename);
@ -469,12 +468,12 @@ MainWindow::ProcessCommandLine(void)
/* if it's a temporary file, arrange to have it deleted before exit */
if (temp) {
int len = strlen(filename);
int len = wcslen(filename);
if (len > 4 && strcasecmp(filename + (len-4), ".tmp") == 0) {
if (len > 4 && wcsicmp(filename + (len-4), L".tmp") == 0) {
fDeleteList.Add(filename);
} else {
WMSG1("NOT adding '%s' to DeleteList -- does not end in '.tmp'\n",
WMSG1("NOT adding '%ls' to DeleteList -- does not end in '.tmp'\n",
filename);
}
}
@ -525,7 +524,7 @@ MainWindow::OnCreate(LPCREATESTRUCT lpcs)
fStatusBar.SetIndicators(indicators, NELEM(indicators));
//fStatusBar.SetPaneInfo(0, ID_SEPARATOR, SBPS_NOBORDERS | SBPS_STRETCH, 0);
fStatusBar.SetPaneText(kProgressPane, "");
fStatusBar.SetPaneText(kProgressPane, L"");
return 0;
}
@ -618,7 +617,7 @@ MainWindow::OnLateInit(UINT, LONG)
default:
ASSERT(false);
CString confused;
confused.Format("Registration check failed. %s", (LPCTSTR) result);
confused.Format(L"Registration check failed. %ls", (LPCWSTR) result);
result = confused;
goto fail;
}
@ -992,7 +991,7 @@ MainWindow::ApplyNow(PrefsSheet* pPS)
fPreferences.SetPrefBool(kPrConvResources, pPS->fFviewPage.fConvResources != 0);
fPreferences.SetPrefString(kPrTempPath, pPS->fFilesPage.fTempPath);
WMSG1("--- Temp path now '%s'\n", fPreferences.GetPrefString(kPrTempPath));
WMSG1("--- Temp path now '%ls'\n", fPreferences.GetPrefString(kPrTempPath));
fPreferences.SetPrefString(kPrExtViewerExts, pPS->fFilesPage.fExtViewerExts);
@ -1122,17 +1121,17 @@ MainWindow::OnHelpWebSite(void)
{
int err;
err = (int) ::ShellExecute(m_hWnd, _T("open"), kWebSiteURL, NULL, NULL,
err = (int) ::ShellExecute(m_hWnd, L"open", kWebSiteURL, NULL, NULL,
SW_SHOWNORMAL);
if (err <= 32) {
CString msg;
if (err == ERROR_FILE_NOT_FOUND) {
msg = "Windows call failed: web browser not found. (Sometimes"
" it mistakenly reports this when IE is not the default"
" browser.)";
msg = L"Windows call failed: web browser not found. (Sometimes"
L" it mistakenly reports this when IE is not the default"
L" browser.)";
ShowFailureMsg(this, msg, IDS_FAILED);
} else {
msg.Format("Unable to launch web browser (err=%d).", err);
msg.Format(L"Unable to launch web browser (err=%d).", err);
ShowFailureMsg(this, msg, IDS_FAILED);
}
}
@ -1178,11 +1177,11 @@ MainWindow::OnFileNewArchive(void)
GenericArchive* pOpenArchive;
CString errMsg;
CFileDialog dlg(FALSE, _T("shk"), NULL,
CFileDialog dlg(FALSE, L"shk", NULL,
OFN_OVERWRITEPROMPT|OFN_NOREADONLYRETURN|OFN_HIDEREADONLY,
"ShrinkIt Archives (*.shk)|*.shk||", this);
L"ShrinkIt Archives (*.shk)|*.shk||", this);
dlg.m_ofn.lpstrTitle = "New Archive";
dlg.m_ofn.lpstrTitle = L"New Archive";
dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
if (dlg.DoModal() != IDOK)
@ -1193,7 +1192,7 @@ MainWindow::OnFileNewArchive(void)
fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder);
filename = dlg.GetPathName();
WMSG1("NEW FILE '%s'\n", filename);
WMSG1("NEW FILE '%ls'\n", (LPCWSTR) filename);
/* remove file if it already exists */
errMsg = RemoveFile(filename);
@ -1237,7 +1236,7 @@ MainWindow::OnFileOpen(void)
openFilters += kOpenDiskImage;
openFilters += kOpenAll;
openFilters += kOpenEnd;
CFileDialog dlg(TRUE, "shk", NULL,
CFileDialog dlg(TRUE, L"shk", NULL,
OFN_FILEMUSTEXIST, openFilters, this);
dlg.m_ofn.nFilterIndex = fPreferences.GetPrefLong(kPrLastOpenFilterIndex);
@ -1291,7 +1290,7 @@ MainWindow::OnUpdateFileOpenVolume(CCmdUI* pCmdUI)
* Open an archive.
*/
void
MainWindow::DoOpenArchive(const char* pathName, const char* ext,
MainWindow::DoOpenArchive(const WCHAR* pathName, const WCHAR* ext,
int filterIndex, bool readOnly)
{
if (LoadArchive(pathName, ext, filterIndex, readOnly, false) == 0) {
@ -1564,11 +1563,11 @@ MainWindow::HandleDoubleClick(void)
if (pEntry == nil)
return;
WMSG1(" Double-click GOT '%s'\n", pEntry->GetPathName());
const char* ext;
WMSG1(" Double-click GOT '%ls'\n", pEntry->GetPathName());
const WCHAR* ext;
long fileType, auxType;
ext = FindExtension(pEntry->GetPathName(), pEntry->GetFssep());
ext = PathName::FindExtension(pEntry->GetPathName(), pEntry->GetFssep());
fileType = pEntry->GetFileType();
auxType = pEntry->GetAuxType();
@ -1595,14 +1594,14 @@ MainWindow::HandleDoubleClick(void)
CString extViewerExts;
extViewerExts = fPreferences.GetPrefString(kPrExtViewerExts);
if (ext != nil && MatchSemicolonList(extViewerExts, ext+1)) {
WMSG1(" Launching external viewer for '%s'\n", ext);
WMSG1(" Launching external viewer for '%ls'\n", ext);
TmpExtractForExternal(pEntry);
handled = true;
} else if (pEntry->GetRecordKind() == GenericEntry::kRecordKindFile) {
if ((ext != nil && (
stricmp(ext, ".shk") == 0 ||
stricmp(ext, ".sdk") == 0 ||
stricmp(ext, ".bxy") == 0 )) ||
wcsicmp(ext, L".shk") == 0 ||
wcsicmp(ext, L".sdk") == 0 ||
wcsicmp(ext, L".bxy") == 0)) ||
(fileType == 0xe0 && auxType == 0x8002))
{
WMSG0(" Guessing NuFX\n");
@ -1610,8 +1609,8 @@ MainWindow::HandleDoubleClick(void)
handled = true;
} else
if ((ext != nil && (
stricmp(ext, ".bny") == 0 ||
stricmp(ext, ".bqy") == 0 )) ||
wcsicmp(ext, L".bny") == 0 ||
wcsicmp(ext, L".bqy") == 0)) ||
(fileType == 0xe0 && auxType == 0x8000))
{
WMSG0(" Guessing Binary II\n");
@ -1619,7 +1618,7 @@ MainWindow::HandleDoubleClick(void)
handled = true;
} else
if ((ext != nil && (
stricmp(ext, ".acu") == 0 )) ||
wcsicmp(ext, L".acu") == 0)) ||
(fileType == 0xe0 && auxType == 0x8001))
{
WMSG0(" Guessing ACU\n");
@ -1661,7 +1660,7 @@ MainWindow::HandleDoubleClick(void)
*/
int
MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind,
const char* modeStr)
const WCHAR* modeStr)
{
CString dispName;
bool mustDelete = false;
@ -1674,13 +1673,13 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind,
dispName = pEntry->GetFileName();
dispName.Replace('"', '_');
char nameBuf[MAX_PATH];
WCHAR nameBuf[MAX_PATH];
UINT unique;
unique = GetTempFileName(fPreferences.GetPrefString(kPrTempPath),
"CPfile", 0, nameBuf);
L"CPfile", 0, nameBuf);
if (unique == 0) {
DWORD dwerr = ::GetLastError();
WMSG2("GetTempFileName failed on '%s' (err=%ld)\n",
WMSG2("GetTempFileName failed on '%ls' (err=%ld)\n",
fPreferences.GetPrefString(kPrTempPath), dwerr);
return dwerr;
}
@ -1693,9 +1692,9 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind,
int result;
FILE* fp;
fp = fopen(nameBuf, "wb");
fp = _wfopen(nameBuf, L"wb");
if (fp != nil) {
WMSG2("Extracting to '%s' (unique=%d)\n", nameBuf, unique);
WMSG2("Extracting to '%ls' (unique=%d)\n", nameBuf, unique);
result = pEntry->ExtractThreadToFile(threadKind, fp,
GenericEntry::kConvertEOLOff, GenericEntry::kConvertHAOff,
&errMsg);
@ -1704,16 +1703,16 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind,
/* success */
CString parameters;
parameters.Format("-mode %s -dispname \"%s\" -temparc \"%s\"",
parameters.Format(L"-mode %ls -dispname \"%ls\" -temparc \"%ls\"",
modeStr, dispName, nameBuf);
int err;
err = (int) ::ShellExecute(m_hWnd, _T("open"),
err = (int) ::ShellExecute(m_hWnd, L"open",
gMyApp.GetExeFileName(), parameters, NULL,
SW_SHOWNORMAL);
if (err <= 32) {
CString msg;
msg.Format("Unable to launch CiderPress (err=%d).", err);
msg.Format(L"Unable to launch CiderPress (err=%d).", err);
ShowFailureMsg(this, msg, IDS_FAILED);
} else {
/* during dev, "missing DLL" causes false-positive success */
@ -1725,13 +1724,13 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind,
}
} else {
CString msg;
msg.Format("Unable to open temp file '%s'.", nameBuf);
msg.Format(L"Unable to open temp file '%ls'.", nameBuf);
::ShowFailureMsg(this, msg, IDS_FAILED);
}
if (mustDelete) {
WMSG1("Deleting '%s'\n", nameBuf);
unlink(nameBuf);
WMSG1("Deleting '%ls'\n", nameBuf);
_wunlink(nameBuf);
}
return 0;
@ -1758,23 +1757,23 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind,
int
MainWindow::TmpExtractForExternal(GenericEntry* pEntry)
{
const char* ext;
const WCHAR* ext;
ext = FindExtension(pEntry->GetPathName(), pEntry->GetFssep());
ext = PathName::FindExtension(pEntry->GetPathName(), pEntry->GetFssep());
char nameBuf[MAX_PATH];
WCHAR nameBuf[MAX_PATH];
UINT unique;
unique = GetTempFileName(fPreferences.GetPrefString(kPrTempPath),
"CPfile", 0, nameBuf);
L"CPfile", 0, nameBuf);
if (unique == 0) {
DWORD dwerr = ::GetLastError();
WMSG2("GetTempFileName failed on '%s' (err=%ld)\n",
WMSG2("GetTempFileName failed on '%ls' (err=%ld)\n",
fPreferences.GetPrefString(kPrTempPath), dwerr);
return dwerr;
}
fDeleteList.Add(nameBuf); // file is created by GetTempFileName
strcat(nameBuf, ext);
wcscat(nameBuf, ext);
/*
* Open the temp file and extract the data into it.
@ -1783,10 +1782,10 @@ MainWindow::TmpExtractForExternal(GenericEntry* pEntry)
int result;
FILE* fp;
fp = fopen(nameBuf, "wb");
fp = _wfopen(nameBuf, L"wb");
if (fp != nil) {
fDeleteList.Add(nameBuf); // second file created by fopen
WMSG2("Extracting to '%s' (unique=%d)\n", nameBuf, unique);
WMSG2("Extracting to '%ls' (unique=%d)\n", nameBuf, unique);
result = pEntry->ExtractThreadToFile(GenericEntry::kDataThread, fp,
GenericEntry::kConvertEOLOff, GenericEntry::kConvertHAOff,
&errMsg);
@ -1795,11 +1794,11 @@ MainWindow::TmpExtractForExternal(GenericEntry* pEntry)
/* success */
int err;
err = (int) ::ShellExecute(m_hWnd, _T("open"), nameBuf, NULL,
err = (int) ::ShellExecute(m_hWnd, L"open", nameBuf, NULL,
NULL, SW_SHOWNORMAL);
if (err <= 32) {
CString msg;
msg.Format("Unable to launch external viewer (err=%d).", err);
msg.Format(L"Unable to launch external viewer (err=%d).", err);
ShowFailureMsg(this, msg, IDS_FAILED);
} else {
WMSG0("Successfully launched external viewer\n");
@ -1809,7 +1808,7 @@ MainWindow::TmpExtractForExternal(GenericEntry* pEntry)
}
} else {
CString msg;
msg.Format("Unable to open temp file '%s'.", nameBuf);
msg.Format(L"Unable to open temp file '%ls'.", nameBuf);
ShowFailureMsg(this, msg, IDS_FAILED);
}
@ -1858,7 +1857,7 @@ MainWindow::SetProgressBegin(void)
if (fpActionProgress != nil)
fpActionProgress->SetProgress(0);
else
fStatusBar.SetPaneText(kProgressPane, "--%");
fStatusBar.SetPaneText(kProgressPane, L"--%");
//WMSG0(" Complete: BEGIN\n");
/* redraw stuff with the changes */
@ -1866,8 +1865,8 @@ MainWindow::SetProgressBegin(void)
}
int
MainWindow::SetProgressUpdate(int percent, const char* oldName,
const char* newName)
MainWindow::SetProgressUpdate(int percent, const WCHAR* oldName,
const WCHAR* newName)
{
int status = IDOK;
@ -1878,10 +1877,10 @@ MainWindow::SetProgressUpdate(int percent, const char* oldName,
if (newName != nil)
fpActionProgress->SetFileName(newName);
} else {
char buf[8];
sprintf(buf, "%d%%", percent);
WCHAR buf[8];
wsprintf(buf, L"%d%%", percent);
fStatusBar.SetPaneText(kProgressPane, buf);
//WMSG1(" Complete: %s\n", buf);
//WMSG1(" Complete: %ls\n", buf);
}
if (!PeekAndPump()) {
@ -1898,7 +1897,7 @@ MainWindow::SetProgressEnd(void)
if (fpActionProgress != nil)
fpActionProgress->SetProgress(100);
else
fStatusBar.SetPaneText(kProgressPane, "");
fStatusBar.SetPaneText(kProgressPane, L"");
// EventPause(100); // DEBUG DEBUG
//WMSG0(" Complete: END\n");
}
@ -1914,13 +1913,13 @@ MainWindow::SetProgressEnd(void)
* Returns "true" if we'd like things to continue.
*/
bool
MainWindow::SetProgressCounter(const char* str, long val)
MainWindow::SetProgressCounter(const WCHAR* str, long val)
{
/* if the main window is enabled, user could activate menus */
ASSERT(!IsWindowEnabled());
if (fpProgressCounter != nil) {
//WMSG2("SetProgressCounter '%s' %d\n", str, val);
//WMSG2("SetProgressCounter '%ls' %d\n", str, val);
CString msg;
if (str != nil)
@ -1928,10 +1927,10 @@ MainWindow::SetProgressCounter(const char* str, long val)
fpProgressCounter->SetCount((int) val);
} else {
if (val < 0) {
fStatusBar.SetPaneText(kProgressPane, "");
fStatusBar.SetPaneText(kProgressPane, L"");
} else {
CString tmpStr;
tmpStr.Format("%ld", val);
tmpStr.Format(L"%ld", val);
fStatusBar.SetPaneText(kProgressPane, tmpStr);
}
}
@ -2073,7 +2072,7 @@ MainWindow::DrawEmptyClientArea(CDC* pDC, const CRect& clientRect)
* Returns 0 on success, nonzero on failure.
*/
int
MainWindow::LoadArchive(const char* fileName, const char* extension,
MainWindow::LoadArchive(const WCHAR* fileName, const WCHAR* extension,
int filterIndex, bool readOnly, bool createFile)
{
GenericArchive::OpenResult openResult;
@ -2084,7 +2083,7 @@ MainWindow::LoadArchive(const char* fileName, const char* extension,
appName.LoadString(IDS_MB_APP_NAME);
WMSG3("LoadArchive: '%s' ro=%d idx=%d\n", fileName, readOnly, filterIndex);
WMSG3("LoadArchive: '%ls' ro=%d idx=%d\n", fileName, readOnly, filterIndex);
/* close any existing archive to avoid weirdness from re-open */
CloseArchive();
@ -2104,7 +2103,7 @@ MainWindow::LoadArchive(const char* fileName, const char* extension,
int i;
for (i = 0; i < NELEM(gExtensionToIndex); i++) {
if (strcasecmp(extension, gExtensionToIndex[i].extension) == 0) {
if (wcsicmp(extension, gExtensionToIndex[i].extension) == 0) {
filterIndex = gExtensionToIndex[i].idx;
break;
}
@ -2155,7 +2154,7 @@ try_again:
delete pOpenArchive;
pOpenArchive = nil;
if (strcasecmp(extension, "zip") == 0) {
if (wcsicmp(extension, L"zip") == 0) {
errStr = "ZIP archives with multiple files are not supported.";
MessageBox(errStr, appName, MB_OK|MB_ICONINFORMATION);
result = -1;
@ -2172,8 +2171,8 @@ try_again:
/*
* Kluge: assume we guessed disk image and were wrong.
*/
errStr = "File doesn't appear to be a valid archive"
" or disk image.";
errStr = L"File doesn't appear to be a valid archive"
L" or disk image.";
}
if (!errStr.IsEmpty())
ShowFailureMsg(this, errStr, IDS_FAILED);
@ -2234,7 +2233,7 @@ MainWindow::DoOpenVolume(CString drive, bool readOnly)
//char filename[4] = "_:\\";
//filename[0] = driveLetter;
WMSG2("FileOpenVolume '%s' %d\n", (const char*)drive, readOnly);
WMSG2("FileOpenVolume '%ls' %d\n", (LPCWSTR)drive, readOnly);
/* close existing archive */
CloseArchive();
@ -2296,7 +2295,8 @@ MainWindow::ReopenArchive(void)
CString errStr;
/* if the open fails we *don't* want to leave the previous content up */
WMSG3("Reopening '%s' ro=%d kind=%d\n", pathName, readOnly, archiveKind);
WMSG3("Reopening '%ls' ro=%d kind=%d\n",
(LPCWSTR) pathName, readOnly, archiveKind);
CloseArchive();
switch (archiveKind) {
@ -2337,12 +2337,12 @@ bail:
* Determine whether "path" matches the pathname of the currently open archive.
*/
bool
MainWindow::IsOpenPathName(const char* path)
MainWindow::IsOpenPathName(const WCHAR* path)
{
if (fpOpenArchive == nil)
return false;
if (stricmp(path, fpOpenArchive->GetPathName()) == 0)
if (wcsicmp(path, fpOpenArchive->GetPathName()) == 0)
return true;
return false;
@ -2450,22 +2450,23 @@ MainWindow::CloseArchive(void)
* temp file whose name we're trying to conceal.
*/
void
MainWindow::SetCPTitle(const char* pathname, GenericArchive* pOpenArchive)
MainWindow::SetCPTitle(const WCHAR* pathname, GenericArchive* pOpenArchive)
{
ASSERT(pathname != nil);
CString title;
CString archiveDescription;
CString appName;
CString archiveDescription;
appName.LoadString(IDS_MB_APP_NAME);
pOpenArchive->GetDescription(&archiveDescription);
title.Format(_T("%s - %s (%s)"), appName, pathname, archiveDescription);
title.Format(L"%ls - %ls (%ls)", (LPCWSTR) appName, pathname,
(LPCWSTR) archiveDescription);
if (fpOpenArchive->IsReadOnly()) {
CString readOnly;
readOnly.LoadString(IDS_READONLY);
title += _T(" ");
title += L" ";
title += readOnly;
}
@ -2520,8 +2521,8 @@ MainWindow::GetPrintTitle(void)
appName.LoadString(IDS_MB_APP_NAME);
fpOpenArchive->GetDescription(&archiveDescription);
title.Format(_T("%s - %s (%s)"),
appName, fOpenArchivePathName, archiveDescription);
title.Format(L"%ls - %ls (%ls)", (LPCWSTR) appName,
(LPCWSTR) fOpenArchivePathName, (LPCWSTR) archiveDescription);
return title;
}
@ -2562,19 +2563,19 @@ MainWindow::FailureBeep(void)
* The absence of the file is not considered an error.
*/
CString
MainWindow::RemoveFile(const char* fileName)
MainWindow::RemoveFile(const WCHAR* fileName)
{
CString errMsg;
int cc;
cc = unlink(fileName);
cc = _wunlink(fileName);
if (cc < 0 && errno != ENOENT) {
int err = errno;
WMSG2("Failed removing file '%s', errno=%d\n", fileName, err);
errMsg.Format("Unable to remove '%s': %s.",
WMSG2("Failed removing file '%ls', errno=%d\n", fileName, err);
errMsg.Format(L"Unable to remove '%ls': %hs.",
fileName, strerror(err));
if (err == EACCES)
errMsg += "\n\n(Make sure the file isn't open.)";
errMsg += L"\n\n(Make sure the file isn't open.)";
}
return errMsg;

View File

@ -6,8 +6,8 @@
/*
* Application UI classes.
*/
#ifndef __MAIN__
#define __MAIN__
#ifndef APP_MAIN_H
#define APP_MAIN_H
#include "ContentList.h"
#include "GenericArchive.h"
@ -61,12 +61,12 @@ public:
// update the progress meter
void SetProgressBegin(void);
int SetProgressUpdate(int percent, const char* oldName,
const char* newName);
int SetProgressUpdate(int percent, const WCHAR* oldName,
const WCHAR* newName);
void SetProgressEnd(void);
// update the progress counter
bool SetProgressCounter(const char* fmt, long val);
bool SetProgressCounter(const WCHAR* fmt, long val);
// handle a double-click in the content view
void HandleDoubleClick(void);
@ -115,14 +115,14 @@ public:
void FailureBeep(void);
// remove a file, returning a helpful message on failure
CString RemoveFile(const char* fileName);
CString RemoveFile(const WCHAR* fileName);
// choose the place to put a file
bool ChooseAddTarget(DiskImgLib::A2File** ppTargetSubdir,
DiskImgLib::DiskFS** ppDiskFS);
// try a disk image override dialog
int TryDiskImgOverride(DiskImg* pImg, const char* fileSource,
int TryDiskImgOverride(DiskImg* pImg, const WCHAR* fileSource,
DiskImg::FSFormat defaultFormat, int* pDisplayFormat,
bool allowUnknown, CString* pErrMsg);
// copy all blocks from one disk image to another
@ -130,7 +130,7 @@ public:
bool partial, ProgressCancelDialog* pPCDialog);
// does the currently open archive pathname match?
bool IsOpenPathName(const char* path);
bool IsOpenPathName(const WCHAR* path);
// raise a flag to cause a full reload of the open file
void SetReopenFlag(void) { fNeedReopen = true; }
@ -139,22 +139,22 @@ public:
// save a buffer of data as a file in a disk image or file archive
static bool SaveToArchive(GenericArchive::FileDetails* pDetails,
const unsigned char* dataBuf, long dataLen,
const unsigned char* rsrcBuf, long rsrcLen,
const BYTE* dataBuf, long dataLen,
const BYTE* rsrcBuf, long rsrcLen,
CString& errMsg, CWnd* pDialog);
static const char kOpenNuFX[];
static const char kOpenBinaryII[];
static const char kOpenACU[];
static const char kOpenDiskImage[];
static const char kOpenAll[];
static const char kOpenEnd[];
static const WCHAR kOpenNuFX[];
static const WCHAR kOpenBinaryII[];
static const WCHAR kOpenACU[];
static const WCHAR kOpenDiskImage[];
static const WCHAR kOpenAll[];
static const WCHAR kOpenEnd[];
private:
static const char* kModeNuFX;
static const char* kModeBinaryII;
static const char* kModeACU;
static const char* kModeDiskImage;
static const WCHAR kModeNuFX[];
static const WCHAR kModeBinaryII[];
static const WCHAR kModeACU[];
static const WCHAR kModeDiskImage[];
// Command handlers
afx_msg int OnCreate(LPCREATESTRUCT lpcs);
@ -255,22 +255,22 @@ private:
void ResizeClientArea(void);
void DrawEmptyClientArea(CDC* pDC, const CRect& clientRect);
int TmpExtractAndOpen(GenericEntry* pEntry, int threadKind,
const char* modeStr);
const WCHAR* modeStr);
int TmpExtractForExternal(GenericEntry* pEntry);
void DoOpenArchive(const char* pathName, const char* ext,
void DoOpenArchive(const WCHAR* pathName, const WCHAR* ext,
int filterIndex, bool readOnly);
int LoadArchive(const char* filename, const char* extension,
int LoadArchive(const WCHAR* filename, const WCHAR* extension,
int filterIndex, bool readOnly, bool createFile);
int DoOpenVolume(CString drive, bool readOnly);
void SwitchContentList(GenericArchive* pOpenArchive);
void CloseArchiveWOControls(void);
void CloseArchive(void);
void SetCPTitle(const char* pathname, GenericArchive* pArchive);
void SetCPTitle(const WCHAR* pathname, GenericArchive* pArchive);
void SetCPTitle(void);
GenericEntry* GetSelectedItem(ContentList* pContentList);
void HandleView(void);
void DeleteFileOnExit(const char* name);
void DeleteFileOnExit(const WCHAR* name);
void ReopenArchive(void);
@ -280,6 +280,11 @@ private:
void GetFilePart(const GenericEntry* pEntry, int whichThread,
ReformatHolder* pHolder) const;
/**
* this is a test
* of whatever the hell this does
* whee.
*/
void DoBulkExtract(SelectionSet* pSelSet,
const ExtractOptionsDialog* pExtOpts);
bool ExtractEntry(GenericEntry* pEntry, int thread,
@ -294,7 +299,7 @@ private:
/* some stuff from Clipboard.cpp */
CString CreateFileList(SelectionSet* pSelSet);
static CString DblDblQuote(const char* str);
static CString DblDblQuote(const WCHAR* str);
long GetClipboardContentLen(void);
HGLOBAL CreateFileCollection(SelectionSet* pSelSet);
CString CopyToCollection(GenericEntry* pEntry, void** pBuf, long* pBufLen);
@ -302,23 +307,23 @@ private:
CString ProcessClipboard(const void* vbuf, long bufLen,
bool pasteJunkPaths);
CString ProcessClipboardEntry(const FileCollectionEntry* pCollEnt,
const char* pathName, const unsigned char* buf, long remLen);
const WCHAR* pathName, const unsigned char* buf, long remLen);
/* some stuff from Tools.cpp */
int DetermineImageSettings(int convertIdx, bool addGzip,
DiskImg::OuterFormat* pOuterFormat, DiskImg::FileFormat* pFileFormat,
DiskImg::PhysicalFormat* pPhysicalFormat,
DiskImg::SectorOrder* pSectorOrder);
void BulkConvertImage(const char* pathName, const char* targetDir,
void BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir,
const DiskConvertDialog& convDlg, CString* pErrMsg);
int SSTOpenImage(int seqNum, DiskImg* pDiskImg);
int SSTLoadData(int seqNum, DiskImg* pDiskImg, unsigned char* trackBuf,
int SSTLoadData(int seqNum, DiskImg* pDiskImg, BYTE* trackBuf,
long* pBadCount);
long SSTGetBufOffset(int track);
long SSTCountBadBytes(const unsigned char* sctBuf, int count);
void SSTProcessTrackData(unsigned char* trackBuf);
long SSTCountBadBytes(const BYTE* sctBuf, int count);
void SSTProcessTrackData(BYTE* trackBuf);
void VolumeCopier(bool openFile);
bool EditTwoImgProps(const char* fileName);
bool EditTwoImgProps(const WCHAR* fileName);
void PrintListing(const ContentList* pContentList);
@ -386,11 +391,11 @@ private:
while (pNode != nil) {
pNext = pNode->fNext;
if (unlink(pNode->fName) != 0) {
WMSG2(" WARNING: delete of '%s' failed, err=%d\n",
if (_wunlink(pNode->fName) != 0) {
WMSG2(" WARNING: delete of '%ls' failed, err=%d\n",
pNode->fName, errno);
} else {
WMSG1(" Deleted '%s'\n", pNode->fName);
WMSG1(" Deleted '%ls'\n", pNode->fName);
}
delete pNode;
pNode = pNext;
@ -405,7 +410,7 @@ private:
pNode->fNext = fHead;
}
fHead = pNode;
WMSG1("Delete-on-exit '%s'\n", (LPCTSTR) name);
WMSG1("Delete-on-exit '%ls'\n", (LPCWSTR) name);
}
DeleteListNode* fHead;
@ -432,4 +437,4 @@ private:
#define GET_PREFERENCES() ((MainWindow*)::AfxGetMainWnd())->GetPreferences()
#define GET_PREFERENCES_WR() ((MainWindow*)::AfxGetMainWnd())->GetPreferencesWr()
#endif /*__MAIN__*/
#endif /*APP_MAIN_H*/

View File

@ -57,7 +57,7 @@ MyApp::MyApp(LPCTSTR lpszAppName) : CWinApp(lpszAppName)
}
#endif
WMSG5("CiderPress v%d.%d.%d%s started at %.24s\n",
WMSG5("CiderPress v%d.%d.%d%s started at %.24hs\n",
kAppMajorVersion, kAppMinorVersion, kAppBugVersion,
kAppDevString, ctime(&now));
@ -105,14 +105,14 @@ MyApp::InitInstance(void)
/* find our .EXE file */
//HMODULE hModule = ::GetModuleHandle(NULL);
char buf[MAX_PATH];
if (::GetModuleFileName(nil /*hModule*/, buf, sizeof(buf)) != 0) {
WMSG1("Module name is '%s'\n", buf);
WCHAR buf[MAX_PATH];
if (::GetModuleFileName(nil /*hModule*/, buf, NELEM(buf)) != 0) {
WMSG1("Module name is '%ls'\n", buf);
fExeFileName = buf;
char* cp = strrchr(buf, '\\');
WCHAR* cp = wcsrchr(buf, '\\');
if (cp == nil)
fExeBaseName = "";
fExeBaseName = L"";
else
fExeBaseName = fExeFileName.Left(cp - buf +1);
} else {
@ -120,9 +120,9 @@ MyApp::InitInstance(void)
::GetLastError());
}
LogModuleLocation("riched.dll");
LogModuleLocation("riched20.dll");
LogModuleLocation("riched32.dll");
LogModuleLocation(L"riched.dll");
LogModuleLocation(L"riched20.dll");
LogModuleLocation(L"riched32.dll");
#if 0
/* find our .INI file by tweaking the EXE path */
@ -137,7 +137,7 @@ MyApp::InitInstance(void)
free((void*)m_pszProfileName);
m_pszProfileName = strdup(buf);
WMSG1("Profile name is '%s'\n", m_pszProfileName);
WMSG1("Profile name is '%ls'\n", m_pszProfileName);
if (!WriteProfileString("SectionOne", "MyEntry", "test"))
WMSG0("WriteProfileString failed\n");
@ -145,13 +145,13 @@ MyApp::InitInstance(void)
SetRegistryKey(fRegistry.GetAppRegistryKey());
//WMSG1("Registry key is '%s'\n", m_pszRegistryKey);
//WMSG1("Profile name is '%s'\n", m_pszProfileName);
WMSG1("Short command line is '%s'\n", m_lpCmdLine);
//WMSG1("CP app name is '%s'\n", m_pszAppName);
//WMSG1("CP exe name is '%s'\n", m_pszExeName);
WMSG1("CP help file is '%s'\n", m_pszHelpFilePath);
WMSG1("Command line is '%s'\n", ::GetCommandLine());
//WMSG1("Registry key is '%ls'\n", m_pszRegistryKey);
//WMSG1("Profile name is '%ls'\n", m_pszProfileName);
WMSG1("Short command line is '%ls'\n", m_lpCmdLine);
//WMSG1("CP app name is '%ls'\n", m_pszAppName);
//WMSG1("CP exe name is '%ls'\n", m_pszExeName);
WMSG1("CP help file is '%ls'\n", m_pszHelpFilePath);
WMSG1("Command line is '%ls'\n", ::GetCommandLine());
//if (!WriteProfileString("SectionOne", "MyEntry", "test"))
// WMSG0("WriteProfileString failed\n");
@ -161,11 +161,11 @@ MyApp::InitInstance(void)
* bail immediately. This will hemorrhage memory, but I'm sure the
* incredibly robust Windows environment will take it in stride.
*/
if (strcmp(m_lpCmdLine, _T("-install")) == 0) {
if (wcscmp(m_lpCmdLine, L"-install") == 0) {
WMSG0("Invoked with INSTALL flag\n");
fRegistry.OneTimeInstall();
exit(0);
} else if (strcmp(m_lpCmdLine, _T("-uninstall")) == 0) {
} else if (wcscmp(m_lpCmdLine, L"-uninstall") == 0) {
WMSG0("Invoked with UNINSTALL flag\n");
fRegistry.OneTimeUninstall();
exit(1); // tell DeployMaster to continue with uninstall
@ -182,18 +182,18 @@ MyApp::InitInstance(void)
* If "name" is nil, we show the EXE info.
*/
void
MyApp::LogModuleLocation(const char* name)
MyApp::LogModuleLocation(const WCHAR* name)
{
HMODULE hModule;
char fileNameBuf[256];
WCHAR fileNameBuf[256];
hModule = ::GetModuleHandle(name);
if (hModule != nil &&
::GetModuleFileName(hModule, fileNameBuf, sizeof(fileNameBuf)) != 0)
::GetModuleFileName(hModule, fileNameBuf, NELEM(fileNameBuf)) != 0)
{
// GetModuleHandle does not increase ref count, so no need to release
WMSG2("Module '%s' loaded from '%s'\n", name, fileNameBuf);
WMSG2("Module '%ls' loaded from '%ls'\n", name, fileNameBuf);
} else {
WMSG1("Module '%s' not loaded\n", name);
WMSG1("Module '%ls' not loaded\n", name);
}
}

View File

@ -6,21 +6,21 @@
/*
* The application object.
*/
#ifndef __MYAPP__
#define __MYAPP__
#ifndef APP_MYAPP_H
#define APP_MYAPP_H
#include "Registry.h"
#if defined(_DEBUG_LOG)
//#define kDebugLog "C:\\test\\cplog.txt"
#define kDebugLog "C:\\cplog.txt"
#define kDebugLog L"C:\\cplog.txt"
#endif
/* CiderPress version numbers */
#define kAppMajorVersion 3
#define kAppMinorVersion 0
#define kAppBugVersion 1
#define kAppDevString ""
#define kAppDevString L""
/*
* Windows application object.
@ -33,15 +33,15 @@ public:
MyRegistry fRegistry;
const char* GetExeFileName(void) const { return fExeFileName; }
const char* GetExeBaseName(void) const { return fExeBaseName; }
const WCHAR* GetExeFileName(void) const { return fExeFileName; }
const WCHAR* GetExeBaseName(void) const { return fExeBaseName; }
private:
// Overridden functions
virtual BOOL InitInstance(void);
virtual BOOL OnIdle(LONG lCount);
void LogModuleLocation(const char* name);
void LogModuleLocation(const WCHAR* name);
CString fExeFileName;
CString fExeBaseName;
@ -49,4 +49,4 @@ private:
extern MyApp gMyApp;
#endif /*__MYAPP__*/
#endif /*APP_MYAPP_H*/

View File

@ -25,7 +25,7 @@
{ IDC_CONVDISK_32MB, 65535 },
{ IDC_CONVDISK_SPECIFY, kSpecified },
};
static const kEditBoxID = IDC_CONVDISK_SPECIFY_EDIT;
static const int kEditBoxID = IDC_CONVDISK_SPECIFY_EDIT;
/*
* Return the #of entries in the table.
@ -161,6 +161,6 @@ NewDiskSize::UpdateSpecifyEdit(CDialog* pDialog)
}
CString fmt;
fmt.Format("%ld", kCtrlMap[i].blocks);
fmt.Format(L"%ld", kCtrlMap[i].blocks);
pEdit->SetWindowText(fmt);
}

View File

@ -6,8 +6,8 @@
/*
* Functions to manage the "new disk size" radio button set in dialogs.
*/
#ifndef __NEWDISKSIZE__
#define __NEWDISKSIZE__
#ifndef APP_NEWDISKSIZE_H
#define APP_NEWDISKSIZE_H
/*
* All members are static. Don't instantiate the class.
@ -35,4 +35,4 @@ private:
static const RadioCtrlMap kCtrlMap[];
};
#endif /*__NEWDISKSIZE__*/
#endif /*APP_NEWDISKSIZE_H*/

View File

@ -39,28 +39,28 @@ NewFolderDialog::DoDataExchange(CDataExchange* pDX)
/* validate the new folder by creating it */
if (pDX->m_bSaveAndValidate) {
if (fNewFolder.IsEmpty()) {
MessageBox("No name entered, not creating new folder.",
"CiderPress", MB_OK);
MessageBox(L"No name entered, not creating new folder.",
L"CiderPress", MB_OK);
// fall out of DoModal with fFolderCreated==false
} else if (fNewFolder.Find('\\') >= 0 ||
fNewFolder.Find('/') >= 0)
{
MessageBox("Folder names may not contain '/' or '\\'.",
"CiderPress", MB_OK);
MessageBox(L"Folder names may not contain '/' or '\\'.",
L"CiderPress", MB_OK);
pDX->Fail();
} else {
fNewFullPath = fCurrentFolder;
if (fNewFullPath.Right(1) != "\\")
fNewFullPath += "\\";
fNewFullPath += fNewFolder;
WMSG1("CREATING '%s'\n", fNewFullPath);
WMSG1("CREATING '%ls'\n", (LPCWSTR) fNewFullPath);
if (!::CreateDirectory(fNewFullPath, nil)) {
/* show the sometimes-bizarre Windows error string */
CString msg, errStr, failed;
DWORD dwerr = ::GetLastError();
GetWin32ErrorString(dwerr, &errStr);
msg.Format("Unable to create folder '%s': %s",
fNewFolder, errStr);
msg.Format(L"Unable to create folder '%ls': %ls",
(LPCWSTR) fNewFolder, (LPCWSTR) errStr);
failed.LoadString(IDS_FAILED);
MessageBox(msg, failed, MB_OK | MB_ICONERROR);
pDX->Fail();

View File

@ -6,8 +6,8 @@
/*
* Allow the user to create a new folder.
*/
#ifndef __NEWFOLDERDIALOG__
#define __NEWFOLDERDIALOG__
#ifndef APP_NEWFOLDERDIALOG_H
#define APP_NEWFOLDERDIALOG_H
#include "resource.h"
@ -20,8 +20,8 @@
class NewFolderDialog : public CDialog {
public:
NewFolderDialog(CWnd* pParent = NULL) : CDialog(IDD_NEWFOLDER, pParent) {
fCurrentFolder = "";
fNewFolder = "";
fCurrentFolder = L"";
fNewFolder = L"";
fFolderCreated = false;
}
virtual ~NewFolderDialog(void) {}
@ -47,4 +47,4 @@ protected:
DECLARE_MESSAGE_MAP()
};
#endif /*__NEWFOLDERDIALOG__*/
#endif /*APP_NEWFOLDERDIALOG_H*/

File diff suppressed because it is too large Load Diff

View File

@ -6,11 +6,11 @@
/*
* NuFX archive support.
*/
#ifndef __NUFX_ARCHIVE__
#define __NUFX_ARCHIVE__
#ifndef APP_NUFXARCHIVE_H
#define APP_NUFXARCHIVE_H
#include "GenericArchive.h"
#include "../prebuilt/NufxLib.h" // ideally this wouldn't be here, only in .cpp
#include "../nufxlib/NufxLib.h" // ideally this wouldn't be here, only in .cpp
/*
@ -72,20 +72,20 @@ public:
// One-time initialization; returns an error string.
static CString AppInit(void);
virtual OpenResult Open(const char* filename, bool readOnly,
virtual OpenResult Open(const WCHAR* filename, bool readOnly,
CString* pErrMsg);
virtual CString New(const char* filename, const void* options);
virtual CString New(const WCHAR* filename, const void* options);
virtual CString Flush(void) { return ""; }
virtual CString Reload(void);
virtual bool IsReadOnly(void) const { return fIsReadOnly; };
virtual bool IsModified(void) const { return false; }
virtual void GetDescription(CString* pStr) const { *pStr = "NuFX"; }
virtual void GetDescription(CString* pStr) const { *pStr = L"NuFX"; }
virtual bool BulkAdd(ActionProgressDialog* pActionProgress,
const AddFilesDialog* pAddOpts);
virtual bool AddDisk(ActionProgressDialog* pActionProgress,
const AddFilesDialog* pAddOpts);
virtual bool CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry,
const char* newName)
const WCHAR* newName)
{ ASSERT(false); return false; }
virtual bool TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet);
virtual bool DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet);
@ -93,11 +93,11 @@ public:
virtual CString TestPathName(const GenericEntry* pGenericEntry,
const CString& basePath, const CString& newName, char newFssep) const;
virtual bool RenameVolume(CWnd* pMsgWnd, DiskFS* pDiskFS,
const char* newName)
const WCHAR* newName)
{ ASSERT(false); return false; }
virtual CString TestVolumeName(const DiskFS* pDiskFS,
const char* newName) const
{ ASSERT(false); return "!"; }
const WCHAR* newName) const
{ ASSERT(false); return L"!"; }
virtual bool RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
const RecompressOptionsDialog* pRecompOpts);
virtual XferStatus XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
@ -129,7 +129,7 @@ private:
NuClose(fpArchive);
fpArchive = nil;
}
return "";
return L"";
}
bool RecompressThread(NufxEntry* pEntry, int threadKind,
const RecompressOptionsDialog* pRecompOpts, long* pSizeInMemory,
@ -178,4 +178,4 @@ private:
const AddFilesDialog* fpAddOpts;
};
#endif /*__NUFX_ARCHIVE__*/
#endif /*APP_NUFXARCHIVE_H*/

View File

@ -71,9 +71,9 @@ OpenVolumeDialog::OnInitDialog(void)
pListView->GetClientRect(&rect);
int width;
width = pListView->GetStringWidth("XXVolume or Device NameXXmmmmmm");
pListView->InsertColumn(0, "Volume or Device Name", LVCFMT_LEFT, width);
pListView->InsertColumn(1, "Remarks", LVCFMT_LEFT,
width = pListView->GetStringWidth(L"XXVolume or Device NameXXmmmmmm");
pListView->InsertColumn(0, L"Volume or Device Name", LVCFMT_LEFT, width);
pListView->InsertColumn(1, L"Remarks", LVCFMT_LEFT,
rect.Width() - width - ::GetSystemMetrics(SM_CXVSCROLL));
// Load the drive list.
@ -153,11 +153,11 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex)
fVolumeInfo[i].driveType = DRIVE_UNKNOWN;
if ((drivesAvailable >> i) & 0x01) {
char driveName[] = "_:\\";
WCHAR driveName[] = L"_:\\";
driveName[0] = 'A' + i;
unsigned int driveType;
const char* driveTypeComment = nil;
const WCHAR* driveTypeComment = nil;
BOOL result;
driveType = fVolumeInfo[i].driveType = GetDriveType(driveName);
@ -170,19 +170,19 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex)
break;
case DRIVE_REMOVABLE:
// The disk can be removed from the drive.
driveTypeComment = "Removable";
driveTypeComment = L"Removable";
break;
case DRIVE_FIXED:
// The disk cannot be removed from the drive.
driveTypeComment = "Local Disk";
driveTypeComment = L"Local Disk";
break;
case DRIVE_REMOTE:
// The drive is a remote (network) drive.
driveTypeComment = "Network";
driveTypeComment = L"Network";
break;
case DRIVE_CDROM:
// The drive is a CD-ROM drive.
driveTypeComment = "CD-ROM";
driveTypeComment = L"CD-ROM";
break;
case DRIVE_RAMDISK:
// The drive is a RAM disk.
@ -194,79 +194,79 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex)
if (driveType == DRIVE_CDROM && !DiskImgLib::Global::GetHasSPTI()) {
/* use "physical" device via ASPI instead */
WMSG1("Not including CD-ROM '%s' in logical drive list\n",
WMSG1("Not including CD-ROM '%ls' in logical drive list\n",
driveName);
continue;
}
char volNameBuf[256];
char fsNameBuf[64];
const char* errorComment = nil;
WCHAR volNameBuf[256];
WCHAR fsNameBuf[64];
const WCHAR* errorComment = nil;
//DWORD fsFlags;
CString entryName, entryRemarks;
result = ::GetVolumeInformation(driveName, volNameBuf,
sizeof(volNameBuf), NULL, NULL, NULL /*&fsFlags*/, fsNameBuf,
sizeof(fsNameBuf));
NELEM(volNameBuf), NULL, NULL, NULL /*&fsFlags*/, fsNameBuf,
NELEM(fsNameBuf));
if (result == FALSE) {
DWORD err = GetLastError();
if (err == ERROR_UNRECOGNIZED_VOLUME) {
// Win2K: media exists but format not recognized
errorComment = "Non-Windows format";
errorComment = L"Non-Windows format";
} else if (err == ERROR_NOT_READY) {
// Win2K: device exists but no media loaded
if (isWin9x) {
WMSG1("Not showing drive '%s': not ready\n",
WMSG1("Not showing drive '%ls': not ready\n",
driveName);
continue; // safer not to show it
} else
errorComment = "Not ready";
errorComment = L"Not ready";
} else if (err == ERROR_PATH_NOT_FOUND /*Win2K*/ ||
err == ERROR_INVALID_DATA /*Win98*/)
{
// Win2K/Win98: device letter not in use
WMSG1("GetVolumeInformation '%s': nothing there\n",
WMSG1("GetVolumeInformation '%ls': nothing there\n",
driveName);
continue;
} else if (err == ERROR_INVALID_PARAMETER) {
// Win2K: device is already open
//WMSG1("GetVolumeInformation '%s': currently open??\n",
//WMSG1("GetVolumeInformation '%ls': currently open??\n",
// driveName);
errorComment = "(currently open?)";
errorComment = L"(currently open?)";
//continue;
} else if (err == ERROR_ACCESS_DENIED) {
// Win2K: disk is open no-read-sharing elsewhere
errorComment = "(already open read-write)";
errorComment = L"(already open read-write)";
} else if (err == ERROR_GEN_FAILURE) {
// Win98: floppy format not recognzied
// --> we don't want to access ProDOS floppies via A: in
// Win98, so we skip it here
WMSG1("GetVolumeInformation '%s': general failure\n",
WMSG1("GetVolumeInformation '%ls': general failure\n",
driveName);
continue;
} else if (err == ERROR_INVALID_FUNCTION) {
// Win2K: CD-ROM with HFS
if (driveType == DRIVE_CDROM)
errorComment = "Non-Windows format";
errorComment = L"Non-Windows format";
else
errorComment = "(invalid disc?)";
errorComment = L"(invalid disc?)";
} else {
WMSG2("GetVolumeInformation '%s' failed: %ld\n",
WMSG2("GetVolumeInformation '%ls' failed: %ld\n",
driveName, GetLastError());
continue;
}
ASSERT(errorComment != nil);
entryName.Format("(%c:)", 'A' + i);
entryName.Format(L"(%c:)", 'A' + i);
if (driveTypeComment != nil)
entryRemarks.Format("%s - %s", driveTypeComment,
entryRemarks.Format(L"%ls - %ls", driveTypeComment,
errorComment);
else
entryRemarks.Format("%s", errorComment);
entryRemarks.Format(L"%ls", errorComment);
} else {
entryName.Format("%s (%c:)", volNameBuf, 'A' + i);
entryName.Format(L"%ls (%c:)", volNameBuf, 'A' + i);
if (driveTypeComment != nil)
entryRemarks.Format("%s", driveTypeComment);
entryRemarks.Format(L"%ls", driveTypeComment);
else
entryRemarks = "";
}
@ -313,7 +313,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex)
result = HasPhysicalDriveWin9x(i, &remark);
if (result) {
driveName.Format("Floppy disk %d", i);
driveName.Format(L"Floppy disk %d", i);
pListView->InsertItem(itemIndex, driveName);
pListView->SetItemText(itemIndex, 1, remark);
pListView->SetItemData(itemIndex, (DWORD) i);
@ -327,7 +327,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex)
result = HasPhysicalDriveWin9x(i + 128, &remark);
if (result) {
driveName.Format("Hard drive %d", i);
driveName.Format(L"Hard drive %d", i);
pListView->InsertItem(itemIndex, driveName);
pListView->SetItemText(itemIndex, 1, remark);
pListView->SetItemData(itemIndex, (DWORD) i + 128);
@ -342,7 +342,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex)
result = HasPhysicalDriveWin2K(i + 128, &remark);
if (result) {
driveName.Format("Physical disk %d", i);
driveName.Format(L"Physical disk %d", i);
pListView->InsertItem(itemIndex, driveName);
pListView->SetItemText(itemIndex, 1, remark);
pListView->SetItemData(itemIndex, (DWORD) i + 128); // HD volume
@ -352,6 +352,8 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex)
}
if (DiskImgLib::Global::GetHasASPI()) {
WMSG0("IGNORING ASPI");
#if 0 // can we remove this?
DIError dierr;
DiskImgLib::ASPI* pASPI = DiskImgLib::Global::GetASPI();
ASPIDevice* deviceArray = nil;
@ -399,6 +401,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex)
}
delete[] deviceArray;
#endif
}
*pItemIndex = itemIndex;
@ -410,6 +413,8 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex)
*
* Pass in the Int13 unit number, i.e. 0x00 for the first floppy drive. Win9x
* makes direct access to the hard drive very difficult, so we don't even try.
*
* TODO: remove this entirely?
*/
bool
OpenVolumeDialog::HasPhysicalDriveWin9x(int unit, CString* pRemark)
@ -434,7 +439,7 @@ OpenVolumeDialog::HasPhysicalDriveWin9x(int unit, CString* pRemark)
if (unit > 4)
return false; // floppy drives only
handle = CreateFile("\\\\.\\vwin32", 0, 0, NULL,
handle = CreateFile(L"\\\\.\\vwin32", 0, 0, NULL,
OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, NULL);
if (handle == INVALID_HANDLE_VALUE) {
WMSG1(" Unable to open vwin32: %ld\n", ::GetLastError());
@ -456,7 +461,7 @@ OpenVolumeDialog::HasPhysicalDriveWin9x(int unit, CString* pRemark)
reg.reg_EDX = MAKEWORD(unit, 0); // head
result = DeviceIoControl(handle, VWIN32_DIOC_DOS_INT13, &reg,
sizeof(reg), &reg, sizeof(reg), &cb, 0);
sizeof(reg) /*bytes*/, &reg, sizeof(reg) /*bytes*/, &cb, 0);
lastError = GetLastError();
::CloseHandle(handle);
@ -501,9 +506,9 @@ OpenVolumeDialog::HasPhysicalDriveWin2K(int unit, CString* pRemark)
* See if the drive is there.
*/
ASSERT(unit >= 128 && unit < 160); // arbitrary max
fileName.Format("\\\\.\\PhysicalDrive%d", unit - 128);
fileName.Format(L"\\\\.\\PhysicalDrive%d", unit - 128);
hDevice = ::CreateFile((const char*) fileName, // drive to open
hDevice = ::CreateFile(fileName, // drive to open
0, // no access to the drive
FILE_SHARE_READ | FILE_SHARE_WRITE, // share mode
NULL, // default security attributes
@ -521,7 +526,7 @@ OpenVolumeDialog::HasPhysicalDriveWin2K(int unit, CString* pRemark)
result = ::DeviceIoControl(hDevice,
IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
NULL, 0, // input buffer
&dge, sizeof(dge), // output buffer
&dge, sizeof(dge), // output buffer + size in bytes
&junk, // # bytes returned
(LPOVERLAPPED) NULL); // synchronous I/O
if (result) {
@ -530,10 +535,10 @@ OpenVolumeDialog::HasPhysicalDriveWin2K(int unit, CString* pRemark)
WMSG2(" Disk size = %I64d (bytes) = %I64d (MB)\n",
diskSize, diskSize / (1024*1024));
if (diskSize > 1024*1024*1024)
pRemark->Format("Size is %.2fGB",
pRemark->Format(L"Size is %.2fGB",
(double) diskSize / (1024.0 * 1024.0 * 1024.0));
else
pRemark->Format("Size is %.2fMB",
pRemark->Format(L"Size is %.2fMB",
(double) diskSize / (1024.0 * 1024.0));
} else {
// Win2K shows ERROR_INVALID_FUNCTION or ERROR_NOT_SUPPORTED
@ -542,7 +547,7 @@ OpenVolumeDialog::HasPhysicalDriveWin2K(int unit, CString* pRemark)
result = ::DeviceIoControl(hDevice, // device to be queried
IOCTL_DISK_GET_DRIVE_GEOMETRY, // operation to perform
NULL, 0, // no input buffer
&dg, sizeof(dg), // output buffer
&dg, sizeof(dg), // output buffer + size in bytes
&junk, // # bytes returned
(LPOVERLAPPED) NULL); // synchronous I/O
@ -558,10 +563,10 @@ OpenVolumeDialog::HasPhysicalDriveWin2K(int unit, CString* pRemark)
WMSG2("Disk size = %I64d (bytes) = %I64d (MB)\n", diskSize,
diskSize / (1024 * 1024));
if (diskSize > 1024*1024*1024)
pRemark->Format("Size is %.2fGB",
pRemark->Format(L"Size is %.2fGB",
(double) diskSize / (1024.0 * 1024.0 * 1024.0));
else
pRemark->Format("Size is %.2fMB",
pRemark->Format(L"Size is %.2fMB",
(double) diskSize / (1024.0 * 1024.0));
} else {
err = GetLastError();
@ -654,7 +659,8 @@ OpenVolumeDialog::OnOK(void)
UINT formatID = 0;
if (HIBYTE(HIWORD(driveID)) == 0xaa) {
fChosenDrive.Format("%s%d:%d:%d\\",
// TODO: remove this?
fChosenDrive.Format(L"%hs%d:%d:%d\\",
DiskImgLib::kASPIDev,
LOBYTE(HIWORD(driveID)),
HIBYTE(LOWORD(driveID)),
@ -682,11 +688,11 @@ OpenVolumeDialog::OnOK(void)
break;
}
fChosenDrive.Format("%c:\\", driveID);
fChosenDrive.Format(L"%c:\\", driveID);
} else if ((driveID >= 0 && driveID < 4) ||
(driveID >= 0x80 && driveID < 0x88))
{
fChosenDrive.Format("%02x:\\", driveID);
fChosenDrive.Format(L"%02x:\\", driveID);
} else {
ASSERT(false);
return;

View File

@ -6,8 +6,8 @@
/*
* Class definition for Open Volume dialog.
*/
#ifndef __OPEN_VOLUME_DIALOG__
#define __OPEN_VOLUME_DIALOG__
#ifndef APP_OPENVOLUMEDIALOG_H
#define APP_OPENVOLUMEDIALOG_H
#include <afxwin.h>
#include "resource.h"
@ -20,7 +20,7 @@ class OpenVolumeDialog : public CDialog {
public:
OpenVolumeDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_OPENVOLUMEDLG, pParentWnd),
fChosenDrive(""),
fChosenDrive(L""),
fAllowROChange(true)
{
Preferences* pPreferences = GET_PREFERENCES_WR();
@ -67,4 +67,4 @@ protected:
DECLARE_MESSAGE_MAP()
};
#endif /*__OPEN_VOLUME_DIALOG__*/
#endif /*APP_OPENVOLUMEDIALOG_H*/

View File

@ -6,8 +6,8 @@
/*
* Paste Special dialog.
*/
#ifndef __PASTESPECIALDIALOG__
#define __PASTESPECIALDIALOG__
#ifndef APP_PASTESPECIALDIALOG_H
#define APP_PASTESPECIALDIALOG_H
#include "resource.h"
@ -38,4 +38,4 @@ protected:
//DECLARE_MESSAGE_MAP()
};
#endif /*__PASTESPECIALDIALOG__*/
#endif /*APP_PASTESPECIALDIALOG_H*/

View File

@ -15,25 +15,25 @@
static const char* kDefaultTempPath = ".";
/* registry section for columns */
static const char* kColumnSect = _T("columns");
static const WCHAR kColumnSect[] = L"columns";
/* registry section for file add options */
static const char* kAddSect = _T("add");
static const WCHAR kAddSect[] = L"add";
/* registry section for extraction options */
static const char* kExtractSect = _T("extract");
static const WCHAR kExtractSect[] = L"extract";
/* registry section for view options */
static const char* kViewSect = _T("view");
static const WCHAR kViewSect[] = L"view";
/* registry section for logical/physical volume operations */
static const char* kVolumeSect = _T("volume");
static const WCHAR kVolumeSect[] = L"volume";
/* registry section for file-to-disk options */
//static const char* kConvDiskSect = _T("conv-disk");
//static const WCHAR kConvDiskSect[] = L"conv-disk";
/* registry section for disk-to-file options */
static const char* kConvFileSect = _T("conv-file");
static const WCHAR kConvFileSect[] = L"conv-file";
/* registry section for folders */
static const char* kFolderSect = _T("folders");
static const WCHAR kFolderSect[] = L"folders";
/* registry section for preferences on property pages */
static const char* kPrefsSect = _T("prefs");
static const WCHAR kPrefsSect[] = L"prefs";
/* registry section for miscellaneous settings */
static const char* kMiscSect = _T("misc");
static const WCHAR kMiscSect[] = L"misc";
/*
@ -46,96 +46,96 @@ static const char* kMiscSect = _T("misc");
const Preferences::PrefMap Preferences::fPrefMaps[kPrefNumLastEntry] = {
/**/ { kPrefNumUnknown, kPTNone, nil, nil },
{ kPrAddIncludeSubFolders, kBool, kAddSect, _T("include-sub-folders") },
{ kPrAddStripFolderNames, kBool, kAddSect, _T("strip-folder-names") },
{ kPrAddOverwriteExisting, kBool, kAddSect, _T("overwrite-existing") },
{ kPrAddTypePreservation, kLong, kAddSect, _T("type-preservation") },
{ kPrAddConvEOL, kLong, kAddSect, _T("conv-eol") },
{ kPrAddIncludeSubFolders, kBool, kAddSect, L"include-sub-folders" },
{ kPrAddStripFolderNames, kBool, kAddSect, L"strip-folder-names" },
{ kPrAddOverwriteExisting, kBool, kAddSect, L"overwrite-existing" },
{ kPrAddTypePreservation, kLong, kAddSect, L"type-preservation" },
{ kPrAddConvEOL, kLong, kAddSect, L"conv-eol" },
// { kPrExtractPath, kString, kExtractSect, _T("path") },
{ kPrExtractConvEOL, kLong, kExtractSect, _T("conv-eol") },
{ kPrExtractConvHighASCII, kBool, kExtractSect, _T("conv-high-ascii") },
{ kPrExtractIncludeData, kBool, kExtractSect, _T("include-data") },
{ kPrExtractIncludeRsrc, kBool, kExtractSect, _T("include-rsrc") },
{ kPrExtractIncludeDisk, kBool, kExtractSect, _T("include-disk") },
{ kPrExtractEnableReformat, kBool, kExtractSect, _T("enable-reformat") },
{ kPrExtractDiskTo2MG, kBool, kExtractSect, _T("disk-to-2mg") },
{ kPrExtractAddTypePreservation, kBool, kExtractSect, _T("add-type-preservation") },
{ kPrExtractAddExtension, kBool, kExtractSect, _T("add-extension") },
{ kPrExtractStripFolderNames, kBool, kExtractSect, _T("strip-folder-names") },
{ kPrExtractOverwriteExisting, kBool, kExtractSect, _T("overwrite-existing") },
// { kPrExtractPath, kString, kExtractSect, L"path" },
{ kPrExtractConvEOL, kLong, kExtractSect, L"conv-eol" },
{ kPrExtractConvHighASCII, kBool, kExtractSect, L"conv-high-ascii" },
{ kPrExtractIncludeData, kBool, kExtractSect, L"include-data" },
{ kPrExtractIncludeRsrc, kBool, kExtractSect, L"include-rsrc" },
{ kPrExtractIncludeDisk, kBool, kExtractSect, L"include-disk" },
{ kPrExtractEnableReformat, kBool, kExtractSect, L"enable-reformat" },
{ kPrExtractDiskTo2MG, kBool, kExtractSect, L"disk-to-2mg" },
{ kPrExtractAddTypePreservation, kBool, kExtractSect, L"add-type-preservation" },
{ kPrExtractAddExtension, kBool, kExtractSect, L"add-extension" },
{ kPrExtractStripFolderNames, kBool, kExtractSect, L"strip-folder-names" },
{ kPrExtractOverwriteExisting, kBool, kExtractSect, L"overwrite-existing" },
// { kPrViewIncludeDataForks, kBool, kViewSect, _T("include-data-forks") },
// { kPrViewIncludeRsrcForks, kBool, kViewSect, _T("include-rsrc-forks") },
// { kPrViewIncludeDiskImages, kBool, kViewSect, _T("include-disk-images") },
// { kPrViewIncludeComments, kBool, kViewSect, _T("include-comments") },
// { kPrViewIncludeDataForks, kBool, kViewSect, L"include-data-forks" },
// { kPrViewIncludeRsrcForks, kBool, kViewSect, L"include-rsrc-forks" },
// { kPrViewIncludeDiskImages, kBool, kViewSect, L"include-disk-images" },
// { kPrViewIncludeComments, kBool, kViewSect, L"include-comments" },
{ kPrConvFileEmptyFolders, kBool, kConvFileSect, _T("preserve-empty-folders") },
{ kPrConvFileEmptyFolders, kBool, kConvFileSect, L"preserve-empty-folders" },
{ kPrOpenArchiveFolder, kString, kFolderSect, _T("open-archive") },
{ kPrConvertArchiveFolder, kString, kFolderSect, _T("convert-archive") },
{ kPrAddFileFolder, kString, kFolderSect, _T("add-file") },
{ kPrExtractFileFolder, kString, kFolderSect, _T("extract-file") },
{ kPrOpenArchiveFolder, kString, kFolderSect, L"open-archive" },
{ kPrConvertArchiveFolder, kString, kFolderSect, L"convert-archive" },
{ kPrAddFileFolder, kString, kFolderSect, L"add-file" },
{ kPrExtractFileFolder, kString, kFolderSect, L"extract-file" },
{ kPrVolumeFilter, kLong, kVolumeSect, _T("open-filter") },
//{ kPrVolumeReadOnly, kBool, kVolumeSect, _T("read-only") },
{ kPrVolumeFilter, kLong, kVolumeSect, L"open-filter" },
//{ kPrVolumeReadOnly, kBool, kVolumeSect, L"read-only" },
{ kPrCassetteAlgorithm, kLong, kVolumeSect, _T("cassette-algorithm") },
{ kPrOpenWAVFolder, kString, kFolderSect, _T("open-wav") },
{ kPrCassetteAlgorithm, kLong, kVolumeSect, L"cassette-algorithm" },
{ kPrOpenWAVFolder, kString, kFolderSect, L"open-wav" },
{ kPrMimicShrinkIt, kBool, kPrefsSect, _T("mimic-shrinkit") },
{ kPrBadMacSHK, kBool, kPrefsSect, _T("bad-mac-shk") },
{ kPrReduceSHKErrorChecks, kBool, kPrefsSect, _T("reduce-shk-error-checks") },
{ kPrCoerceDOSFilenames, kBool, kPrefsSect, _T("coerce-dos-filenames") },
{ kPrSpacesToUnder, kBool, kPrefsSect, _T("spaces-to-under") },
{ kPrPasteJunkPaths, kBool, kPrefsSect, _T("paste-junk-paths") },
{ kPrBeepOnSuccess, kBool, kPrefsSect, _T("beep-on-success") },
{ kPrMimicShrinkIt, kBool, kPrefsSect, L"mimic-shrinkit" },
{ kPrBadMacSHK, kBool, kPrefsSect, L"bad-mac-shk" },
{ kPrReduceSHKErrorChecks, kBool, kPrefsSect, L"reduce-shk-error-checks" },
{ kPrCoerceDOSFilenames, kBool, kPrefsSect, L"coerce-dos-filenames" },
{ kPrSpacesToUnder, kBool, kPrefsSect, L"spaces-to-under" },
{ kPrPasteJunkPaths, kBool, kPrefsSect, L"paste-junk-paths" },
{ kPrBeepOnSuccess, kBool, kPrefsSect, L"beep-on-success" },
{ kPrQueryImageFormat, kBool, kPrefsSect, _T("query-image-format") },
{ kPrOpenVolumeRO, kBool, kPrefsSect, _T("open-volume-ro") },
{ kPrOpenVolumePhys0, kBool, kPrefsSect, _T("open-volume-phys0") },
{ kPrProDOSAllowLower, kBool, kPrefsSect, _T("prodos-allow-lower") },
{ kPrProDOSUseSparse, kBool, kPrefsSect, _T("prodos-use-sparse") },
{ kPrQueryImageFormat, kBool, kPrefsSect, L"query-image-format" },
{ kPrOpenVolumeRO, kBool, kPrefsSect, L"open-volume-ro" },
{ kPrOpenVolumePhys0, kBool, kPrefsSect, L"open-volume-phys0" },
{ kPrProDOSAllowLower, kBool, kPrefsSect, L"prodos-allow-lower" },
{ kPrProDOSUseSparse, kBool, kPrefsSect, L"prodos-use-sparse" },
{ kPrCompressionType, kLong, kPrefsSect, _T("compression-type") },
{ kPrCompressionType, kLong, kPrefsSect, L"compression-type" },
{ kPrMaxViewFileSize, kLong, kPrefsSect, _T("max-view-file-size") },
{ kPrNoWrapText, kBool, kPrefsSect, _T("no-wrap-text") },
{ kPrMaxViewFileSize, kLong, kPrefsSect, L"max-view-file-size" },
{ kPrNoWrapText, kBool, kPrefsSect, L"no-wrap-text" },
{ kPrHighlightHexDump, kBool, kPrefsSect, _T("highlight-hex-dump") },
{ kPrHighlightBASIC, kBool, kPrefsSect, _T("highlight-basic") },
{ kPrConvHiResBlackWhite, kBool, kPrefsSect, _T("conv-hi-res-black-white") },
{ kPrConvDHRAlgorithm, kLong, kPrefsSect, _T("dhr-algorithm") },
{ kPrRelaxGfxTypeCheck, kBool, kPrefsSect, _T("relax-gfx-type-check") },
{ kPrDisasmOneByteBrkCop, kBool, kPrefsSect, _T("disasm-onebytebrkcop") },
//{ kPrEOLConvRaw, kBool, kPrefsSect, _T("eol-conv-raw") },
{ kPrConvTextEOL_HA, kBool, kPrefsSect, _T("conv-eol-ha") },
{ kPrConvPascalText, kBool, kPrefsSect, _T("conv-pascal-text") },
{ kPrConvPascalCode, kBool, kPrefsSect, _T("conv-pascal-code") },
{ kPrConvCPMText, kBool, kPrefsSect, _T("conv-cpm-text") },
{ kPrConvApplesoft, kBool, kPrefsSect, _T("conv-applesoft") },
{ kPrConvInteger, kBool, kPrefsSect, _T("conv-integer") },
{ kPrConvBusiness, kBool, kPrefsSect, _T("conv-business") },
{ kPrConvGWP, kBool, kPrefsSect, _T("conv-gwp") },
{ kPrConvText8, kBool, kPrefsSect, _T("conv-text8") },
{ kPrConvGutenberg, kBool, kPrefsSect, _T("conv-gutenberg") },
{ kPrConvAWP, kBool, kPrefsSect, _T("conv-awp") },
{ kPrConvADB, kBool, kPrefsSect, _T("conv-adb") },
{ kPrConvASP, kBool, kPrefsSect, _T("conv-asp") },
{ kPrConvSCAssem, kBool, kPrefsSect, _T("conv-scassem") },
{ kPrConvDisasm, kBool, kPrefsSect, _T("conv-disasm") },
{ kPrConvHiRes, kBool, kPrefsSect, _T("conv-hi-res") },
{ kPrConvDHR, kBool, kPrefsSect, _T("conv-dhr") },
{ kPrConvSHR, kBool, kPrefsSect, _T("conv-shr") },
{ kPrConvPrintShop, kBool, kPrefsSect, _T("conv-print-shop") },
{ kPrConvMacPaint, kBool, kPrefsSect, _T("conv-mac-paint") },
{ kPrConvProDOSFolder, kBool, kPrefsSect, _T("conv-prodos-folder") },
{ kPrConvResources, kBool, kPrefsSect, _T("conv-resources") },
{ kPrHighlightHexDump, kBool, kPrefsSect, L"highlight-hex-dump" },
{ kPrHighlightBASIC, kBool, kPrefsSect, L"highlight-basic" },
{ kPrConvHiResBlackWhite, kBool, kPrefsSect, L"conv-hi-res-black-white" },
{ kPrConvDHRAlgorithm, kLong, kPrefsSect, L"dhr-algorithm" },
{ kPrRelaxGfxTypeCheck, kBool, kPrefsSect, L"relax-gfx-type-check" },
{ kPrDisasmOneByteBrkCop, kBool, kPrefsSect, L"disasm-onebytebrkcop" },
//{ kPrEOLConvRaw, kBool, kPrefsSect, L"eol-conv-raw" },
{ kPrConvTextEOL_HA, kBool, kPrefsSect, L"conv-eol-ha" },
{ kPrConvPascalText, kBool, kPrefsSect, L"conv-pascal-text" },
{ kPrConvPascalCode, kBool, kPrefsSect, L"conv-pascal-code" },
{ kPrConvCPMText, kBool, kPrefsSect, L"conv-cpm-text" },
{ kPrConvApplesoft, kBool, kPrefsSect, L"conv-applesoft" },
{ kPrConvInteger, kBool, kPrefsSect, L"conv-integer" },
{ kPrConvBusiness, kBool, kPrefsSect, L"conv-business" },
{ kPrConvGWP, kBool, kPrefsSect, L"conv-gwp" },
{ kPrConvText8, kBool, kPrefsSect, L"conv-text8" },
{ kPrConvGutenberg, kBool, kPrefsSect, L"conv-gutenberg" },
{ kPrConvAWP, kBool, kPrefsSect, L"conv-awp" },
{ kPrConvADB, kBool, kPrefsSect, L"conv-adb" },
{ kPrConvASP, kBool, kPrefsSect, L"conv-asp" },
{ kPrConvSCAssem, kBool, kPrefsSect, L"conv-scassem" },
{ kPrConvDisasm, kBool, kPrefsSect, L"conv-disasm" },
{ kPrConvHiRes, kBool, kPrefsSect, L"conv-hi-res" },
{ kPrConvDHR, kBool, kPrefsSect, L"conv-dhr" },
{ kPrConvSHR, kBool, kPrefsSect, L"conv-shr" },
{ kPrConvPrintShop, kBool, kPrefsSect, L"conv-print-shop" },
{ kPrConvMacPaint, kBool, kPrefsSect, L"conv-mac-paint" },
{ kPrConvProDOSFolder, kBool, kPrefsSect, L"conv-prodos-folder" },
{ kPrConvResources, kBool, kPrefsSect, L"conv-resources" },
{ kPrTempPath, kString, kPrefsSect, _T("temp-path") },
{ kPrExtViewerExts, kString, kPrefsSect, _T("extviewer-exts") },
{ kPrTempPath, kString, kPrefsSect, L"temp-path" },
{ kPrExtViewerExts, kString, kPrefsSect, L"extviewer-exts" },
{ kPrLastOpenFilterIndex, kLong, kMiscSect, _T("open-filter-index") },
{ kPrLastOpenFilterIndex, kLong, kMiscSect, L"open-filter-index" },
/**/ { kPrefNumLastRegistry, kPTNone, nil, nil },
@ -243,11 +243,11 @@ Preferences::Preferences(void)
SetPrefBool(kPrConvResources, true);
InitTempPath(); // set default for kPrTempPath
SetPrefString(kPrExtViewerExts, "gif; jpg; jpeg");
SetPrefString(kPrExtViewerExts, L"gif; jpg; jpeg");
SetPrefLong(kPrLastOpenFilterIndex, 0);
SetPrefString(kPrViewTextTypeFace, "Courier New");
SetPrefString(kPrViewTextTypeFace, L"Courier New");
SetPrefLong(kPrViewTextPointSize, 10);
long width = 680; /* exact width for 80-column text */
long height = 510; /* exact height for file viewer to show IIgs graphic */
@ -272,39 +272,39 @@ Preferences::Preferences(void)
* Restore column widths.
*/
void
ColumnLayout::LoadFromRegistry(const char* section)
ColumnLayout::LoadFromRegistry(const WCHAR* section)
{
char numBuf[8];
WCHAR numBuf[8];
int i;
for (i = 0; i < kNumVisibleColumns; i++) {
sprintf(numBuf, "%d", i);
wsprintf(numBuf, L"%d", i);
fColumnWidth[i] = gMyApp.GetProfileInt(section, numBuf,
fColumnWidth[i]);
fColumnWidth[i] = gMyApp.GetProfileInt(section, numBuf,
fColumnWidth[i]);
}
fSortColumn = gMyApp.GetProfileInt(section, _T("sort-column"), fSortColumn);
fAscending = (gMyApp.GetProfileInt(section, _T("ascending"), fAscending) != 0);
fSortColumn = gMyApp.GetProfileInt(section, L"sort-column", fSortColumn);
fAscending = (gMyApp.GetProfileInt(section, L"ascending", fAscending) != 0);
}
/*
* Store column widths.
*/
void
ColumnLayout::SaveToRegistry(const char* section)
ColumnLayout::SaveToRegistry(const WCHAR* section)
{
char numBuf[8];
WCHAR numBuf[8];
int i;
for (i = 0; i < kNumVisibleColumns; i++) {
sprintf(numBuf, "%d", i);
wsprintf(numBuf, L"%d", i);
gMyApp.WriteProfileInt(section, numBuf, fColumnWidth[i]);
}
gMyApp.WriteProfileInt(section, _T("sort-column"), fSortColumn);
gMyApp.WriteProfileInt(section, _T("ascending"), fAscending);
gMyApp.WriteProfileInt(section, L"sort-column", fSortColumn);
gMyApp.WriteProfileInt(section, L"ascending", fAscending);
}
@ -320,29 +320,29 @@ ColumnLayout::SaveToRegistry(const char* section)
void
Preferences::InitTempPath(void)
{
char buf[MAX_PATH];
WCHAR buf[MAX_PATH];
DWORD len;
CString tempPath;
len = ::GetTempPath(sizeof(buf), buf);
len = ::GetTempPath(NELEM(buf), buf);
if (len == 0) {
DWORD err = ::GetLastError();
WMSG1("GetTempPath failed, err=%d\n", err);
tempPath = kDefaultTempPath;
} else if (len >= sizeof(buf)) {
} else if (len >= NELEM(buf)) {
/* sheesh! */
WMSG1("GetTempPath wants a %d-byte buffer\n", len);
WMSG1("GetTempPath wants a %d-unit buffer\n", len);
tempPath = kDefaultTempPath;
} else {
tempPath = buf;
}
PathName path(tempPath);
WMSG1("Temp path is '%s'\n", tempPath);
WMSG1("Temp path is '%ls'\n", tempPath);
path.SFNToLFN();
tempPath = path.GetPathName();
WMSG1("Temp path (long form) is '%s'\n", tempPath);
WMSG1("Temp path (long form) is '%ls'\n", tempPath);
SetPrefString(kPrTempPath, tempPath);
@ -366,8 +366,8 @@ Preferences::InitFolders(void)
SetPrefString(kPrExtractFileFolder, path);
SetPrefString(kPrOpenWAVFolder, path);
} else {
char buf[MAX_PATH];
::GetCurrentDirectory(sizeof(buf), buf);
WCHAR buf[MAX_PATH];
::GetCurrentDirectory(NELEM(buf), buf);
SetPrefString(kPrOpenArchiveFolder, buf);
SetPrefString(kPrConvertArchiveFolder, buf);
SetPrefString(kPrAddFileFolder, buf);
@ -375,7 +375,7 @@ Preferences::InitFolders(void)
SetPrefString(kPrOpenWAVFolder, buf);
}
WMSG1("Default folder is '%s'\n", GetPrefString(kPrExtractFileFolder));
WMSG1("Default folder is '%ls'\n", GetPrefString(kPrExtractFileFolder));
}
/*
@ -459,25 +459,23 @@ Preferences::SetPrefLong(PrefNum num, long val)
return;
fValues[num] = (void*) val;
}
const char*
const WCHAR*
Preferences::GetPrefString(PrefNum num) const
{
if (!ValidateEntry(num, kString))
return nil;
return (const char*) fValues[num];
return (const WCHAR*) fValues[num];
}
void
Preferences::SetPrefString(PrefNum num, const char* str)
Preferences::SetPrefString(PrefNum num, const WCHAR* str)
{
if (!ValidateEntry(num, kString))
return;
free(fValues[num]);
if (str == nil)
if (str == nil) {
fValues[num] = nil;
else {
fValues[num] = new char[strlen(str) +1];
if (fValues[num] != nil)
strcpy((char*)fValues[num], str);
} else {
fValues[num] = wcsdup(str);
}
}
@ -523,12 +521,12 @@ Preferences::ScanPrefMaps(void)
{
continue;
}
if (strcasecmp(fPrefMaps[i].registryKey,
fPrefMaps[j].registryKey) == 0 &&
strcasecmp(fPrefMaps[i].registrySection,
fPrefMaps[j].registrySection) == 0)
if (wcsicmp(fPrefMaps[i].registryKey,
fPrefMaps[j].registryKey) == 0 &&
wcsicmp(fPrefMaps[i].registrySection,
fPrefMaps[j].registrySection) == 0)
{
WMSG4("HEY: PrefMaps[%d] and [%d] both have '%s'/'%s'\n",
WMSG4("HEY: PrefMaps[%d] and [%d] both have '%ls'/'%ls'\n",
i, j, fPrefMaps[i].registrySection,
fPrefMaps[i].registryKey);
ASSERT(false);

View File

@ -13,8 +13,8 @@
* - Add a default value to Preferences::Preferences. If not specified,
* strings will be nil and numeric values will be zero.
*/
#ifndef __PREFERENCES__
#define __PREFERENCES__
#ifndef APP_PREFERENCES_H
#define APP_PREFERENCES_H
#include "MyApp.h"
@ -42,8 +42,8 @@ public:
}
~ColumnLayout(void) {}
void LoadFromRegistry(const char* section);
void SaveToRegistry(const char* section);
void LoadFromRegistry(const WCHAR* section);
void SaveToRegistry(const WCHAR* section);
int GetColumnWidth(int col) const {
ASSERT(col >= 0 && col < kNumVisibleColumns);
@ -229,8 +229,8 @@ public:
void SetPrefBool(PrefNum num, bool val);
long GetPrefLong(PrefNum num) const;
void SetPrefLong(PrefNum num, long val);
const char* GetPrefString(PrefNum num) const;
void SetPrefString(PrefNum num, const char* str);
const WCHAR* GetPrefString(PrefNum num) const;
void SetPrefString(PrefNum num, const WCHAR* str);
private:
@ -247,8 +247,8 @@ private:
typedef struct PrefMap {
PrefNum num;
PrefType type;
const char* registrySection;
const char* registryKey;
const WCHAR* registrySection;
const WCHAR* registryKey;
} PrefMap;
static const PrefMap fPrefMaps[kPrefNumLastEntry];
void ScanPrefMaps(void);
@ -275,26 +275,26 @@ private:
/*
* Registry helpers.
*/
UINT GetInt(const char* section, const char* key, int dflt) {
UINT GetInt(const WCHAR* section, const WCHAR* key, int dflt) {
return gMyApp.GetProfileInt(section, key, dflt);
}
bool GetBool(const char* section, const char* key, bool dflt) {
bool GetBool(const WCHAR* section, const WCHAR* key, bool dflt) {
return (gMyApp.GetProfileInt(section, key, dflt) != 0);
}
CString GetString(const char* section, const char* key,
const char* dflt)
CString GetString(const WCHAR* section, const WCHAR* key,
const WCHAR* dflt)
{
return gMyApp.GetProfileString(section, key, dflt);
}
BOOL WriteInt(const char* section, const char* key, int value) {
BOOL WriteInt(const WCHAR* section, const WCHAR* key, int value) {
return gMyApp.WriteProfileInt(section, key, value);
}
BOOL WriteBool(const char* section, const char* key, bool value) {
BOOL WriteBool(const WCHAR* section, const WCHAR* key, bool value) {
return gMyApp.WriteProfileInt(section, key, value);
}
BOOL WriteString(const char* section, const char* key, const char* value) {
BOOL WriteString(const WCHAR* section, const WCHAR* key, const WCHAR* value) {
return gMyApp.WriteProfileString(section, key, value);
}
};
#endif /*__PREFERENCES__*/
#endif /*APP_PREFERENCES_H*/

View File

@ -520,7 +520,7 @@ PrefsFilesPage::DoDataExchange(CDataExchange* pDX)
if (fTempPath.IsEmpty()) {
CString appName;
appName.LoadString(IDS_MB_APP_NAME);
MessageBox("You must specify a path for temp files",
MessageBox(L"You must specify a path for temp files",
appName, MB_OK);
pDX->Fail();
}
@ -546,8 +546,8 @@ PrefsFilesPage::OnChooseFolder(void)
chooseDir.SetPathName(editPath);
if (chooseDir.DoModal() == IDOK) {
const char* ccp = chooseDir.GetPathName();
WMSG1("New temp path chosen = '%s'\n", ccp);
const WCHAR* ccp = chooseDir.GetPathName();
WMSG1("New temp path chosen = '%ls'\n", ccp);
pEditWnd->SetWindowText(ccp);
@ -593,7 +593,7 @@ END_MESSAGE_MAP()
* Construct the preferences dialog from the individual pages.
*/
PrefsSheet::PrefsSheet(CWnd* pParentWnd) :
CPropertySheet("Preferences", pParentWnd)
CPropertySheet(L"Preferences", pParentWnd)
{
AddPage(&fGeneralPage);
AddPage(&fDiskImagePage);

View File

@ -6,8 +6,8 @@
/*
* Classes to support the Preferences property pages.
*/
#ifndef __PREFSDIALOG__
#define __PREFSDIALOG__
#ifndef APP_PREFSDIALOG_H
#define APP_PREFSDIALOG_H
#include "Preferences.h"
#include "../util/UtilLib.h"
@ -239,4 +239,4 @@ protected:
DECLARE_MESSAGE_MAP()
};
#endif /*__PREFSDIALOG__*/
#endif /*APP_PREFSDIALOG_H*/

View File

@ -18,8 +18,8 @@
* ==========================================================================
*/
/*static*/ const char* PrintStuff::kCourierNew = _T("Courier New");
/*static*/ const char* PrintStuff::kTimesNewRoman = _T("Times New Roman");
/*static*/ const WCHAR PrintStuff::kCourierNew[] = L"Courier New";
/*static*/ const WCHAR PrintStuff::kTimesNewRoman[] = L"Times New Roman";
/*
* Set up various values.
@ -122,7 +122,7 @@ PrintStuff::TrimString(CString* pStr, int width, bool addOnLeft)
}
if (!addOnLeft) {
WMSG1("Now trying '%s'\n", (LPCTSTR) newStr);
WMSG1("Now trying '%ls'\n", (LPCWSTR) newStr);
}
strWidth = StringWidth(newStr);
}
@ -367,7 +367,7 @@ PrintContentList::DoPrintPage(int page)
*/
fpDC->TextOut(0, 1 * fCharHeight, fDocTitle);
CString pageNum;
pageNum.Format("Page %d/%d", page, fNumPages);
pageNum.Format(L"Page %d/%d", page, fNumPages);
int pageNumWidth = StringWidth(pageNum);
fpDC->TextOut(fHorzRes - pageNumWidth, 1 * fCharHeight, pageNum);
@ -472,14 +472,14 @@ PrintRichEdit::PrintPreflight(CRichEditCtrl* pREC, int* pNumPages)
fEndChar = -1;
fStartPage = 0;
fEndPage = -1;
return StartPrint(pREC, "(test)", pNumPages, false);
return StartPrint(pREC, L"(test)", pNumPages, false);
}
/*
* Print all pages.
*/
int
PrintRichEdit::PrintAll(CRichEditCtrl* pREC, const char* title)
PrintRichEdit::PrintAll(CRichEditCtrl* pREC, const WCHAR* title)
{
fStartChar = 0;
fEndChar = -1;
@ -492,7 +492,7 @@ PrintRichEdit::PrintAll(CRichEditCtrl* pREC, const char* title)
* Print a range of pages.
*/
int
PrintRichEdit::PrintPages(CRichEditCtrl* pREC, const char* title,
PrintRichEdit::PrintPages(CRichEditCtrl* pREC, const WCHAR* title,
int startPage, int endPage)
{
fStartChar = 0;
@ -506,7 +506,7 @@ PrintRichEdit::PrintPages(CRichEditCtrl* pREC, const char* title,
* Print the selected area.
*/
int
PrintRichEdit::PrintSelection(CRichEditCtrl* pREC, const char* title,
PrintRichEdit::PrintSelection(CRichEditCtrl* pREC, const WCHAR* title,
long startChar, long endChar)
{
fStartChar = startChar;
@ -520,7 +520,7 @@ PrintRichEdit::PrintSelection(CRichEditCtrl* pREC, const char* title,
* Start the printing process by posting a print-cancel dialog.
*/
int
PrintRichEdit::StartPrint(CRichEditCtrl* pREC, const char* title,
PrintRichEdit::StartPrint(CRichEditCtrl* pREC, const WCHAR* title,
int* pNumPages, bool doPrint)
{
CancelDialog* pPCD = nil;
@ -630,10 +630,10 @@ PrintRichEdit::ComputeMargins(void)
pOldFont = fpDC->SelectObject(&tmpFont);
// in theory we could compute one 'X' * 80; this seems more reliable
char str[81];
WCHAR str[81];
for (int i = 0; i < 80; i++)
str[i] = 'X';
str[i] = '\0';
str[80] = '\0';
char80width = StringWidth(str);
fpDC->SelectObject(pOldFont);
@ -668,7 +668,7 @@ PrintRichEdit::ComputeMargins(void)
* This was derived from Microsft KB article 129860.
*/
int
PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const char* title,
PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const WCHAR* title,
int* pNumPages, bool doPrint)
{
FORMATRANGE fr;
@ -676,7 +676,7 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const char* title,
long textLength, textPrinted, lastTextPrinted;
int pageNum;
WMSG2("DoPrint: title='%s' doPrint=%d\n", title, doPrint);
WMSG2("DoPrint: title='%ls' doPrint=%d\n", title, doPrint);
WMSG4(" startChar=%d endChar=%d startPage=%d endPage=%d\n",
fStartChar, fEndChar, fStartPage, fEndPage);
@ -712,14 +712,15 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const char* title,
* GetTextLengthEx is part of "riched20.dll". Win9x uses "riched32.dll",
* which doesn't support the call.
*/
#ifdef _UNICODE
# error "should be code page 1200, not CP_ACP"
#endif
GETTEXTLENGTHEX exLenReq;
long basicTextLength, extdTextLength;
basicTextLength = pREC->GetTextLength();
exLenReq.flags = GTL_PRECISE | GTL_NUMCHARS;
#ifdef _UNICODE
exLenReq.codepage = 1200; // UTF-16 little-endian
#else
exLenReq.codepage = CP_ACP;
#endif
extdTextLength = (long)::SendMessage(pREC->m_hWnd, EM_GETTEXTLENGTHEX,
(WPARAM) &exLenReq, (LPARAM) NULL);
WMSG2("RichEdit text length: std=%ld extd=%ld\n",
@ -754,7 +755,7 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const char* title,
CFont* pOldFont = fpDC->SelectObject(&fTitleFont);
fpDC->TextOut(0, 0 * fCharHeight, title);
CString pageNumStr;
pageNumStr.Format("Page %d", pageNum);
pageNumStr.Format(L"Page %d", pageNum);
int pageNumWidth = StringWidth(pageNumStr);
fpDC->TextOut(fHorzRes - pageNumWidth, 0 * fCharHeight, pageNumStr);
fpDC->SelectObject(pOldFont);

View File

@ -6,8 +6,8 @@
/*
* Goodies needed for printing.
*/
#ifndef __PRINT__
#define __PRINT__
#ifndef APP_PRINT_H
#define APP_PRINT_H
#include "ContentList.h"
#include "resource.h"
@ -33,8 +33,8 @@ protected:
int StringWidth(const CString& str);
static const char* kCourierNew;
static const char* kTimesNewRoman;
static const WCHAR kCourierNew[];
static const WCHAR kTimesNewRoman[];
enum {
kTwipsPerInch = 1440
@ -113,18 +113,18 @@ public:
* Commence printing.
*/
int PrintPreflight(CRichEditCtrl* pREC, int* pNumPages);
int PrintAll(CRichEditCtrl* pREC, const char* title);
int PrintPages(CRichEditCtrl* pREC, const char* title, int startPage,
int PrintAll(CRichEditCtrl* pREC, const WCHAR* title);
int PrintPages(CRichEditCtrl* pREC, const WCHAR* title, int startPage,
int endPage);
int PrintSelection(CRichEditCtrl* pREC, const char* title, long startChar,
int PrintSelection(CRichEditCtrl* pREC, const WCHAR* title, long startChar,
long endChar);
private:
int StartPrint(CRichEditCtrl* pREC, const char* title,
int StartPrint(CRichEditCtrl* pREC, const WCHAR* title,
int* pNumPages, bool doPrint);
void PrintPrep(FORMATRANGE* pFR);
void ComputeMargins(void);
int DoPrint(CRichEditCtrl* pREC, const char* title, int* pNumPages,
int DoPrint(CRichEditCtrl* pREC, const WCHAR* title, int* pNumPages,
bool doPrint);
bool fInitialized;
@ -140,4 +140,4 @@ private:
int fEndPage;
};
#endif /*__PRINT__*/
#endif /*APP_PRINT_H*/

View File

@ -7,8 +7,8 @@
* Show the progress of something that has no definite bound. Because we
* don't know when we need to stop, we just count upward.
*/
#ifndef __PROGRESSCOUNTERDIALOG__
#define __PROGRESSCOUNTERDIALOG__
#ifndef APP_PROGRESSCOUNTERDIALOG_H
#define APP_PROGRESSCOUNTERDIALOG_H
#include "resource.h"
@ -20,7 +20,7 @@ public:
BOOL Create(const CString& descr, CWnd* pParentWnd = NULL) {
fpParentWnd = pParentWnd;
fDescr = descr;
fCountFormat = "%d";
fCountFormat = L"%d";
fCancel = false;
/* disable the parent window before we're created */
@ -56,7 +56,7 @@ private:
CWnd* pWnd = GetDlgItem(IDC_PROGRESS_COUNTER_DESC);
pWnd->SetWindowText(fDescr);
pWnd = GetDlgItem(IDC_PROGRESS_COUNTER_COUNT);
pWnd->SetWindowText("");
pWnd->SetWindowText(L"");
pWnd->SetFocus(); // get focus off of the Cancel button
return FALSE; // accept our focus
}
@ -67,4 +67,4 @@ private:
bool fCancel;
};
#endif /*__PROGRESSCOUNTERDIALOG__*/
#endif /*APP_PROGRESSCOUNTERDIALOG_H*/

View File

@ -39,16 +39,16 @@ RecompressOptionsDialog::LoadComboBox(NuThreadFormat fmt)
{
static const struct {
NuThreadFormat format;
const char* name;
const WCHAR* name;
} kComboStrings[] = {
{ kNuThreadFormatUncompressed, "No compression" },
{ kNuThreadFormatHuffmanSQ, "Squeeze" },
{ kNuThreadFormatLZW1, "Dynamic LZW/1" },
{ kNuThreadFormatLZW2, "Dynamic LZW/2" },
{ kNuThreadFormatLZC12, "12-bit LZC" },
{ kNuThreadFormatLZC16, "16-bit LZC" },
{ kNuThreadFormatDeflate, "Deflate" },
{ kNuThreadFormatBzip2, "Bzip2" },
{ kNuThreadFormatUncompressed, L"No compression" },
{ kNuThreadFormatHuffmanSQ, L"Squeeze" },
{ kNuThreadFormatLZW1, L"Dynamic LZW/1" },
{ kNuThreadFormatLZW2, L"Dynamic LZW/2" },
{ kNuThreadFormatLZC12, L"12-bit LZC" },
{ kNuThreadFormatLZC16, L"16-bit LZC" },
{ kNuThreadFormatDeflate, L"Deflate" },
{ kNuThreadFormatBzip2, L"Bzip2" },
};
CComboBox* pCombo;

View File

@ -7,11 +7,11 @@
* Options for recompressing files. This is derived from the "use selection"
* dialog.
*/
#ifndef __RECOMPRESS_OPTIONS_DIALOG__
#define __RECOMPRESS_OPTIONS_DIALOG__
#ifndef APP_RECOMPESSOPTIONSDIALOG_H
#define APP_RECOMPESSOPTIONSDIALOG_H
#include "UseSelectionDialog.h"
#include "../prebuilt/NufxLib.h"
#include "../nufxlib/NufxLib.h"
#include "resource.h"
/*
@ -40,4 +40,4 @@ private:
//DECLARE_MESSAGE_MAP()
};
#endif /*__RECOMPRESS_OPTIONS_DIALOG__*/
#endif /*APP_RECOMPESSOPTIONSDIALOG_H*/

View File

@ -11,12 +11,12 @@
#include "Main.h"
#include "MyApp.h"
#define kRegAppName "CiderPress"
#define kRegExeName "CiderPress.exe"
#define kCompanyName "faddenSoft"
#define kRegAppName L"CiderPress"
#define kRegExeName L"CiderPress.exe"
#define kCompanyName L"faddenSoft"
static const char* kRegKeyCPKVersions = _T("vrs");
static const char* kRegKeyCPKExpire = _T("epr");
static const WCHAR kRegKeyCPKVersions[] = L"vrs";
static const WCHAR kRegKeyCPKExpire[] = L"epr";
/*
* Application path. Add two keys:
@ -27,23 +27,23 @@ static const char* kRegKeyCPKExpire = _T("epr");
* The $PATH that will be in effect when the program starts (but only if
* launched from the Windows explorer).
*/
static const char* kAppKeyBase =
_T("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" kRegExeName);
static const WCHAR kAppKeyBase[] =
L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" kRegExeName;
/*
* Local settings. App stuff goes in the per-user key, registration info is
* in the per-machine key.
*/
static const char* kMachineSettingsBaseKey =
_T("HKEY_LOCAL_MACHINE\\SOFTWARE\\" kCompanyName "\\" kRegAppName);
static const char* kUserSettingsBaseKey =
_T("HKEY_CURRENT_USER\\Software\\" kCompanyName "\\" kRegAppName);
static const WCHAR kMachineSettingsBaseKey[] =
L"HKEY_LOCAL_MACHINE\\SOFTWARE\\" kCompanyName L"\\" kRegAppName;
static const WCHAR kUserSettingsBaseKey[] =
L"HKEY_CURRENT_USER\\Software\\" kCompanyName L"\\" kRegAppName;
/*
* Set this key + ".XXX" to (Default)=AppID. This associates the file
* type with kRegAppID.
*/
//static const char* kFileExtensionBase = _T("HKEY_CLASSES_ROOT");
//static const char* kFileExtensionBase = L"HKEY_CLASSES_ROOT";
/*
* Description of data files. Set this key + AppID to 40-char string, e.g.
@ -51,48 +51,48 @@ static const char* kUserSettingsBaseKey =
*
* Can also set DefaultIcon = Pathname [,Index]
*/
//static const char* kAppIDBase = _T("HKEY_CLASSES_ROOT");
//static const char* kAppIDBase = L"HKEY_CLASSES_ROOT";
/*
* Put one of these under the AppID to specify the icon for a file type.
*/
static const char* kDefaultIcon = _T("DefaultIcon");
static const WCHAR* kDefaultIcon = L"DefaultIcon";
static const char* kRegKeyCPKStr = "CPK";
static const WCHAR* kRegKeyCPKStr = L"CPK";
/*
* Table of file type associations. They will appear in the UI in the same
* order that they appear here, so try to maintain alphabetical order.
*/
#define kAppIDNuFX _T("CiderPress.NuFX")
#define kAppIDDiskImage _T("CiderPress.DiskImage")
#define kAppIDBinaryII _T("CiderPress.BinaryII")
#define kNoAssociation _T("(no association)")
#define kAppIDNuFX L"CiderPress.NuFX"
#define kAppIDDiskImage L"CiderPress.DiskImage"
#define kAppIDBinaryII L"CiderPress.BinaryII"
#define kNoAssociation L"(no association)"
const MyRegistry::FileTypeAssoc MyRegistry::kFileTypeAssoc[] = {
{ _T(".2MG"), kAppIDDiskImage },
{ _T(".APP"), kAppIDDiskImage },
{ _T(".BNY"), kAppIDBinaryII },
{ _T(".BQY"), kAppIDBinaryII },
{ _T(".BSE"), kAppIDNuFX },
{ _T(".BXY"), kAppIDNuFX },
{ _T(".D13"), kAppIDDiskImage },
{ _T(".DDD"), kAppIDDiskImage },
{ _T(".DO"), kAppIDDiskImage },
{ _T(".DSK"), kAppIDDiskImage },
{ _T(".FDI"), kAppIDDiskImage },
{ _T(".HDV"), kAppIDDiskImage },
{ _T(".IMG"), kAppIDDiskImage },
{ _T(".NIB"), kAppIDDiskImage },
{ _T(".PO"), kAppIDDiskImage },
{ _T(".SDK"), kAppIDDiskImage },
{ _T(".SEA"), kAppIDNuFX },
{ _T(".SHK"), kAppIDNuFX },
// { _T(".DC"), kAppIDDiskImage },
// { _T(".DC6"), kAppIDDiskImage },
// { _T(".GZ"), kAppIDDiskImage },
// { _T(".NB2"), kAppIDDiskImage },
// { _T(".RAW"), kAppIDDiskImage },
// { _T(".ZIP"), kAppIDDiskImage },
{ L".2MG", kAppIDDiskImage },
{ L".APP", kAppIDDiskImage },
{ L".BNY", kAppIDBinaryII },
{ L".BQY", kAppIDBinaryII },
{ L".BSE", kAppIDNuFX },
{ L".BXY", kAppIDNuFX },
{ L".D13", kAppIDDiskImage },
{ L".DDD", kAppIDDiskImage },
{ L".DO", kAppIDDiskImage },
{ L".DSK", kAppIDDiskImage },
{ L".FDI", kAppIDDiskImage },
{ L".HDV", kAppIDDiskImage },
{ L".IMG", kAppIDDiskImage },
{ L".NIB", kAppIDDiskImage },
{ L".PO", kAppIDDiskImage },
{ L".SDK", kAppIDDiskImage },
{ L".SEA", kAppIDNuFX },
{ L".SHK", kAppIDNuFX },
// { L".DC", kAppIDDiskImage },
// { L".DC6", kAppIDDiskImage },
// { L".GZ", kAppIDDiskImage },
// { L".NB2", kAppIDDiskImage },
// { L".RAW", kAppIDDiskImage },
// { L".ZIP", kAppIDDiskImage },
};
static const struct {
@ -137,13 +137,13 @@ MyRegistry::OneTimeInstall(void) const
res = RegOpenKeyEx(HKEY_CLASSES_ROOT, kFileTypeAssoc[i].ext, 0,
KEY_READ, &hExtKey);
if (res == ERROR_SUCCESS) {
WMSG1(" Found existing HKCR\\'%s', leaving alone\n",
WMSG1(" Found existing HKCR\\'%ls', leaving alone\n",
kFileTypeAssoc[i].ext);
RegCloseKey(hExtKey);
} else if (res == ERROR_FILE_NOT_FOUND) {
OwnExtension(kFileTypeAssoc[i].ext, kFileTypeAssoc[i].appID);
} else {
WMSG2(" Got error %ld opening HKCR\\'%s', leaving alone\n",
WMSG2(" Got error %ld opening HKCR\\'%ls', leaving alone\n",
res, kFileTypeAssoc[i].ext);
}
}
@ -201,7 +201,7 @@ MyRegistry::OneTimeUninstall(void) const
* (in m_pszRegistryKey) with the app name (in m_pszProfileName) and prepend
* "HKEY_CURRENT_USER\Software\".
*/
const char*
const WCHAR*
MyRegistry::GetAppRegistryKey(void) const
{
return kCompanyName;
@ -211,11 +211,11 @@ MyRegistry::GetAppRegistryKey(void) const
* See if an AppID is one we recognize.
*/
bool
MyRegistry::IsOurAppID(const char* id) const
MyRegistry::IsOurAppID(const WCHAR* id) const
{
return (strcasecmp(id, kAppIDNuFX) == 0 ||
strcasecmp(id, kAppIDDiskImage) == 0 ||
strcasecmp(id, kAppIDBinaryII) == 0);
return (wcsicmp(id, kAppIDNuFX) == 0 ||
wcsicmp(id, kAppIDDiskImage) == 0 ||
wcsicmp(id, kAppIDBinaryII) == 0);
}
/*
@ -229,24 +229,24 @@ MyRegistry::IsOurAppID(const char* id) const
void
MyRegistry::FixBasicSettings(void) const
{
const char* exeName = gMyApp.GetExeFileName();
ASSERT(exeName != nil && strlen(exeName) > 0);
const WCHAR* exeName = gMyApp.GetExeFileName();
ASSERT(exeName != nil && wcslen(exeName) > 0);
WMSG0("Fixing any missing file type AppID entries in registry\n");
ConfigureAppID(kAppIDNuFX, "NuFX Archive (CiderPress)", exeName, 1);
ConfigureAppID(kAppIDBinaryII, "Binary II (CiderPress)", exeName, 2);
ConfigureAppID(kAppIDDiskImage, "Disk Image (CiderPress)", exeName, 3);
ConfigureAppID(kAppIDNuFX, L"NuFX Archive (CiderPress)", exeName, 1);
ConfigureAppID(kAppIDBinaryII, L"Binary II (CiderPress)", exeName, 2);
ConfigureAppID(kAppIDDiskImage, L"Disk Image (CiderPress)", exeName, 3);
}
/*
* Set up the registry goodies for one appID.
*/
void
MyRegistry::ConfigureAppID(const char* appID, const char* descr,
const char* exeName, int iconIdx) const
MyRegistry::ConfigureAppID(const WCHAR* appID, const WCHAR* descr,
const WCHAR* exeName, int iconIdx) const
{
WMSG2(" Configuring '%s' for '%s'\n", appID, exeName);
WMSG2(" Configuring '%ls' for '%ls'\n", appID, exeName);
HKEY hAppKey = nil;
HKEY hIconKey = nil;
@ -263,31 +263,33 @@ MyRegistry::ConfigureAppID(const char* appID, const char* descr,
&hIconKey, &dw) == ERROR_SUCCESS)
{
DWORD type, size;
unsigned char buf[256];
unsigned char buf[512];
long res;
size = sizeof(buf);
res = RegQueryValueEx(hIconKey, "", nil, &type, buf, &size);
size = sizeof(buf); // size in bytes
res = RegQueryValueEx(hIconKey, L"", nil, &type, buf, &size);
if (res == ERROR_SUCCESS && size > 1) {
WMSG1(" Icon for '%s' already exists, not altering\n", appID);
WMSG1(" Icon for '%ls' already exists, not altering\n", appID);
} else {
CString iconStr;
iconStr.Format("%s,%d", exeName, iconIdx);
iconStr.Format(L"%ls,%d", exeName, iconIdx);
if (RegSetValueEx(hIconKey, "", 0, REG_SZ, (const unsigned char*)
(const char*) iconStr, strlen(iconStr)) == ERROR_SUCCESS)
if (RegSetValueEx(hIconKey, L"", 0, REG_SZ,
(const BYTE*)(LPCTSTR) iconStr,
wcslen(iconStr) * sizeof(WCHAR)) == ERROR_SUCCESS)
{
WMSG2(" Set icon for '%s' to '%s'\n", appID, (LPCTSTR) iconStr);
WMSG2(" Set icon for '%ls' to '%ls'\n", appID,
(LPCWSTR) iconStr);
} else {
WMSG2(" WARNING: unable to set DefaultIcon for '%s' to '%s'\n",
appID, (LPCTSTR) iconStr);
WMSG2(" WARNING: unable to set DefaultIcon for '%ls' to '%ls'\n",
appID, (LPCWSTR) iconStr);
}
}
} else {
WMSG1("WARNING: couldn't set up DefaultIcon for '%s'\n", appID);
WMSG1("WARNING: couldn't set up DefaultIcon for '%ls'\n", appID);
}
} else {
WMSG1("WARNING: couldn't create AppID='%s'\n", appID);
WMSG1("WARNING: couldn't create AppID='%ls'\n", appID);
}
RegCloseKey(hIconKey);
@ -299,8 +301,8 @@ MyRegistry::ConfigureAppID(const char* appID, const char* descr,
* description) and put the "Open" command in "...\shell\open\command".
*/
void
MyRegistry::ConfigureAppIDSubFields(HKEY hAppKey, const char* descr,
const char* exeName) const
MyRegistry::ConfigureAppIDSubFields(HKEY hAppKey, const WCHAR* descr,
const WCHAR* exeName) const
{
HKEY hShellKey, hOpenKey, hCommandKey;
DWORD dw;
@ -310,43 +312,44 @@ MyRegistry::ConfigureAppIDSubFields(HKEY hAppKey, const char* descr,
ASSERT(exeName != nil);
hShellKey = hOpenKey = hCommandKey = nil;
if (RegSetValueEx(hAppKey, "", 0, REG_SZ, (const unsigned char*) descr,
strlen(descr)) != ERROR_SUCCESS)
if (RegSetValueEx(hAppKey, L"", 0, REG_SZ, (const BYTE*) descr,
wcslen(descr) * sizeof(WCHAR)) != ERROR_SUCCESS)
{
WMSG1(" WARNING: unable to set description to '%s'\n", descr);
WMSG1(" WARNING: unable to set description to '%ls'\n", descr);
}
if (RegCreateKeyEx(hAppKey, _T("shell"), 0, REG_NONE,
if (RegCreateKeyEx(hAppKey, L"shell", 0, REG_NONE,
REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
&hShellKey, &dw) == ERROR_SUCCESS)
{
if (RegCreateKeyEx(hShellKey, _T("open"), 0, REG_NONE,
if (RegCreateKeyEx(hShellKey, L"open", 0, REG_NONE,
REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
&hOpenKey, &dw) == ERROR_SUCCESS)
{
if (RegCreateKeyEx(hOpenKey, _T("command"), 0, REG_NONE,
if (RegCreateKeyEx(hOpenKey, L"command", 0, REG_NONE,
REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
&hCommandKey, &dw) == ERROR_SUCCESS)
{
DWORD type, size;
unsigned char buf[MAX_PATH+8];
WCHAR buf[MAX_PATH+8];
long res;
size = sizeof(buf);
res = RegQueryValueEx(hCommandKey, "", nil, &type, buf, &size);
size = sizeof(buf); // size in bytes
res = RegQueryValueEx(hCommandKey, L"", nil, &type, (LPBYTE) buf,
&size);
if (res == ERROR_SUCCESS && size > 1) {
WMSG1(" Command already exists, not altering ('%s')\n", buf);
WMSG1(" Command already exists, not altering ('%ls')\n", buf);
} else {
CString openCmd;
openCmd.Format("\"%s\" \"%%1\"", exeName);
if (RegSetValueEx(hCommandKey, "", 0, REG_SZ,
(const unsigned char*) (const char*) openCmd,
strlen(openCmd)) == ERROR_SUCCESS)
openCmd.Format(L"\"%ls\" \"%%1\"", exeName);
if (RegSetValueEx(hCommandKey, L"", 0, REG_SZ,
(LPBYTE)(LPCWSTR) openCmd,
wcslen(openCmd) * sizeof(WCHAR)) == ERROR_SUCCESS)
{
WMSG1(" Set command to '%s'\n", openCmd);
WMSG1(" Set command to '%ls'\n", openCmd);
} else {
WMSG1(" WARNING: unable to set open cmd '%s'\n", openCmd);
WMSG1(" WARNING: unable to set open cmd '%ls'\n", openCmd);
}
}
}
@ -424,22 +427,22 @@ MyRegistry::GetFileAssoc(int idx, CString* pExt, CString* pHandler,
res = RegOpenKeyEx(HKEY_CLASSES_ROOT, *pExt, 0, KEY_READ, &hExtKey);
if (res == ERROR_SUCCESS) {
unsigned char buf[260];
DWORD type, size;
WCHAR buf[260];
DWORD type;
DWORD size = sizeof(buf); // size in bytes
size = sizeof(buf);
res = RegQueryValueEx(hExtKey, "", nil, &type, buf, &size);
res = RegQueryValueEx(hExtKey, L"", nil, &type, (LPBYTE)buf, &size);
if (res == ERROR_SUCCESS) {
WMSG1(" Got '%s'\n", buf);
WMSG1(" Got '%ls'\n", buf);
appID = buf;
if (GetAssocAppName(appID, pHandler) != 0)
*pHandler = appID;
} else {
WMSG1("RegQueryValueEx failed on '%s'\n", (LPCTSTR) *pExt);
WMSG1("RegQueryValueEx failed on '%ls'\n", (LPCWSTR) *pExt);
}
} else {
WMSG1(" RegOpenKeyEx failed on '%s'\n", *pExt);
WMSG1(" RegOpenKeyEx failed on '%ls'\n", *pExt);
}
*pOurs = false;
@ -461,17 +464,19 @@ int
MyRegistry::GetAssocAppName(const CString& appID, CString* pCmd) const
{
CString keyName;
unsigned char buf[260];
DWORD type, size = sizeof(buf);
WCHAR buf[260];
HKEY hAppKey = nil;
long res;
int result = -1;
keyName = appID + "\\shell\\open\\command";
keyName = appID + L"\\shell\\open\\command";
res = RegOpenKeyEx(HKEY_CLASSES_ROOT, keyName, 0, KEY_READ, &hAppKey);
if (res == ERROR_SUCCESS) {
res = RegQueryValueEx(hAppKey, "", nil, &type, buf, &size);
DWORD type;
DWORD size = sizeof(buf); // size in bytes
res = RegQueryValueEx(hAppKey, L"", nil, &type, (LPBYTE) buf, &size);
if (res == ERROR_SUCCESS) {
CString cmd(buf);
int pos;
@ -487,14 +492,14 @@ MyRegistry::GetAssocAppName(const CString& appID, CString* pCmd) const
*pCmd = cmd;
result = 0;
} else {
WMSG1("Unable to open shell\\open\\command for '%s'\n", appID);
WMSG1("Unable to open shell\\open\\command for '%ls'\n", appID);
}
} else {
CString errBuf;
GetWin32ErrorString(res, &errBuf);
WMSG2("Unable to open AppID key '%s' (%s)\n",
keyName, (LPCTSTR) errBuf);
WMSG2("Unable to open AppID key '%ls' (%ls)\n",
keyName, (LPCWSTR) errBuf);
}
RegCloseKey(hAppKey);
@ -507,9 +512,9 @@ MyRegistry::GetAssocAppName(const CString& appID, CString* pCmd) const
void
MyRegistry::ReduceToToken(CString* pStr) const
{
char* argv[1];
WCHAR* argv[1];
int argc = 1;
char* mangle = strdup(*pStr);
WCHAR* mangle = wcsdup(*pStr);
VectorizeString(mangle, argv, &argc);
@ -532,7 +537,7 @@ MyRegistry::ReduceToToken(CString* pStr) const
int
MyRegistry::SetFileAssoc(int idx, bool wantIt) const
{
const char* ext;
const WCHAR* ext;
bool weOwnIt;
int result = 0;
@ -540,18 +545,18 @@ MyRegistry::SetFileAssoc(int idx, bool wantIt) const
ext = kFileTypeAssoc[idx].ext;
weOwnIt = GetAssocState(ext);
WMSG3("SetFileAssoc: ext='%s' own=%d want=%d\n", ext, weOwnIt, wantIt);
WMSG3("SetFileAssoc: ext='%ls' own=%d want=%d\n", ext, weOwnIt, wantIt);
if (weOwnIt && !wantIt) {
/* reset it */
WMSG1(" SetFileAssoc: clearing '%s'\n", ext);
WMSG1(" SetFileAssoc: clearing '%ls'\n", ext);
result = DisownExtension(ext);
} else if (!weOwnIt && wantIt) {
/* take it */
WMSG1(" SetFileAssoc: taking '%s'\n", ext);
WMSG1(" SetFileAssoc: taking '%ls'\n", ext);
result = OwnExtension(ext, kFileTypeAssoc[idx].appID);
} else {
WMSG1(" SetFileAssoc: do nothing with '%s'\n", ext);
WMSG1(" SetFileAssoc: do nothing with '%ls'\n", ext);
/* do nothing */
}
@ -566,22 +571,22 @@ MyRegistry::SetFileAssoc(int idx, bool wantIt) const
* encountered.
*/
bool
MyRegistry::GetAssocState(const char* ext) const
MyRegistry::GetAssocState(const WCHAR* ext) const
{
unsigned char buf[260];
WCHAR buf[260];
HKEY hExtKey = nil;
DWORD type, size;
int res;
bool result = false;
res = RegOpenKeyEx(HKEY_CLASSES_ROOT, ext, 0, KEY_READ, &hExtKey);
if (res == ERROR_SUCCESS) {
size = sizeof(buf);
res = RegQueryValueEx(hExtKey, "", nil, &type, buf, &size);
DWORD type;
DWORD size = sizeof(buf); // size in bytes
res = RegQueryValueEx(hExtKey, L"", nil, &type, (LPBYTE) buf, &size);
if (res == ERROR_SUCCESS && type == REG_SZ) {
/* compare it to known appID values */
WMSG2(" Found '%s', testing '%s'\n", ext, buf);
if (IsOurAppID((char*)buf))
WMSG2(" Found '%ls', testing '%ls'\n", ext, buf);
if (IsOurAppID((WCHAR*)buf))
result = true;
}
}
@ -598,17 +603,17 @@ MyRegistry::GetAssocState(const char* ext) const
* Returns 0 on success, -1 on error.
*/
int
MyRegistry::DisownExtension(const char* ext) const
MyRegistry::DisownExtension(const WCHAR* ext) const
{
ASSERT(ext != nil);
ASSERT(ext[0] == '.');
if (ext == nil || strlen(ext) < 2)
if (ext == nil || wcslen(ext) < 2)
return -1;
if (RegDeleteKeyNT(HKEY_CLASSES_ROOT, ext) == ERROR_SUCCESS) {
WMSG1(" HKCR\\%s subtree deleted\n", ext);
WMSG1(" HKCR\\%ls subtree deleted\n", ext);
} else {
WMSG1(" Failed deleting HKCR\\'%s'\n", ext);
WMSG1(" Failed deleting HKCR\\'%ls'\n", ext);
return -1;
}
@ -621,11 +626,11 @@ MyRegistry::DisownExtension(const char* ext) const
* Returns 0 on success, -1 on error.
*/
int
MyRegistry::OwnExtension(const char* ext, const char* appID) const
MyRegistry::OwnExtension(const WCHAR* ext, const WCHAR* appID) const
{
ASSERT(ext != nil);
ASSERT(ext[0] == '.');
if (ext == nil || strlen(ext) < 2)
if (ext == nil || wcslen(ext) < 2)
return -1;
HKEY hExtKey = nil;
@ -635,11 +640,11 @@ MyRegistry::OwnExtension(const char* ext, const char* appID) const
/* delete the old key (which might be a hierarchy) */
res = RegDeleteKeyNT(HKEY_CLASSES_ROOT, ext);
if (res == ERROR_SUCCESS) {
WMSG1(" HKCR\\%s subtree deleted\n", ext);
WMSG1(" HKCR\\%ls subtree deleted\n", ext);
} else if (res == ERROR_FILE_NOT_FOUND) {
WMSG1(" No HKCR\\%s subtree to delete\n", ext);
WMSG1(" No HKCR\\%ls subtree to delete\n", ext);
} else {
WMSG1(" Failed deleting HKCR\\'%s'\n", ext);
WMSG1(" Failed deleting HKCR\\'%ls'\n", ext);
goto bail;
}
@ -648,13 +653,13 @@ MyRegistry::OwnExtension(const char* ext, const char* appID) const
REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
&hExtKey, &dw) == ERROR_SUCCESS)
{
res = RegSetValueEx(hExtKey, "", 0, REG_SZ,
(const unsigned char*) appID, strlen(appID));
res = RegSetValueEx(hExtKey, L"", 0, REG_SZ,
(LPBYTE) appID, wcslen(appID) * sizeof(WCHAR));
if (res == ERROR_SUCCESS) {
WMSG2(" Set '%s' to '%s'\n", ext, appID);
WMSG2(" Set '%ls' to '%ls'\n", ext, appID);
result = 0;
} else {
WMSG3("Failed setting '%s' to '%s' (res=%d)\n", ext, appID, res);
WMSG3("Failed setting '%ls' to '%ls' (res=%d)\n", ext, appID, res);
goto bail;
}
}

View File

@ -6,8 +6,8 @@
/*
* A class representing the system registry.
*/
#ifndef __REGISTRY__
#define __REGISTRY__
#ifndef APP_REGISTRY_H
#define APP_REGISTRY_H
/*
@ -42,7 +42,7 @@ public:
*/
// Get the registry key to be used for our application.
const char* GetAppRegistryKey(void) const;
const WCHAR* GetAppRegistryKey(void) const;
// Fix basic settings, e.g. HKCR AppID classes.
void FixBasicSettings(void) const;
@ -56,22 +56,22 @@ public:
private:
typedef struct FileTypeAssoc {
const char* ext; // e.g. ".SHK"
const char* appID; // e.g. "CiderPress.NuFX"
const WCHAR* ext; // e.g. ".SHK"
const WCHAR* appID; // e.g. "CiderPress.NuFX"
} FileTypeAssoc;
static const FileTypeAssoc kFileTypeAssoc[];
bool IsOurAppID(const char* id) const;
void ConfigureAppID(const char* appID, const char* descr,
const char* exeName, int iconIdx) const;
void ConfigureAppIDSubFields(HKEY hAppKey, const char* descr,
const char* exeName) const;
bool IsOurAppID(const WCHAR* id) const;
void ConfigureAppID(const WCHAR* appID, const WCHAR* descr,
const WCHAR* exeName, int iconIdx) const;
void ConfigureAppIDSubFields(HKEY hAppKey, const WCHAR* descr,
const WCHAR* exeName) const;
int GetAssocAppName(const CString& appID, CString* pCmd) const;
void ReduceToToken(CString* pStr) const;
bool GetAssocState(const char* ext) const;
int DisownExtension(const char* ext) const;
int OwnExtension(const char* ext, const char* appID) const;
bool GetAssocState(const WCHAR* ext) const;
int DisownExtension(const WCHAR* ext) const;
int OwnExtension(const WCHAR* ext, const WCHAR* appID) const;
DWORD RegDeleteKeyNT(HKEY hStartKey, LPCTSTR pKeyName) const;
/* key validation */
@ -82,4 +82,4 @@ private:
int VerifyKey(const char* user, const char* company, const char* key);
};
#endif /*__REGISTRY__*/
#endif /*APP_REGISTRY_H*/

View File

@ -6,8 +6,8 @@
/*
* Rename an archive entry.
*/
#ifndef __RENAMEENTRYDIALOG__
#define __RENAMEENTRYDIALOG__
#ifndef APP_RENAMEENTRYDIALOG_H
#define APP_RENAMEENTRYDIALOG_H
#include "GenericArchive.h"
#include "resource.h"
@ -67,4 +67,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__RENAMEENTRYDIALOG__*/
#endif /*APP_RENAMEENTRYDIALOG_H*/

View File

@ -6,8 +6,8 @@
/*
* Declarations for "rename volume" dialog.
*/
#ifndef __RENAMEVOLUME__
#define __RENAMEVOLUME__
#ifndef APP_RENAMEVOLUME_H
#define APP_RENAMEVOLUME_H
#include "DiskFSTree.h"
#include "resource.h"
@ -47,4 +47,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__RENAMEVOLUME__*/
#endif /*APP_RENAMEVOLUME_H*/

View File

@ -6,10 +6,10 @@
/*
* Implementation of SQueeze compression.
*/
#ifndef __SQUEEZE__
#define __SQUEEZE__
#ifndef APP_SQUEEZE_H
#define APP_SQUEEZE_H
NuError UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp,
bool fullSqHeader, int blockSize);
#endif /*__SQUEEZE__*/
#endif /*APP_SQUEEZE_H*/

View File

@ -19,6 +19,8 @@
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define VC_EXTRALEAN
#include "targetver.h"
#include <afxwin.h>
#include <afxcmn.h>
#include <afxdlgs.h>

View File

@ -37,7 +37,8 @@ SubVolumeDialog::OnInitDialog(void)
DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(nil);
ASSERT(pSubVol != nil); // shouldn't be here otherwise
while (pSubVol != nil) {
pListBox->AddString(pSubVol->GetDiskFS()->GetVolumeID());
CString volumeIdW(pSubVol->GetDiskFS()->GetVolumeID());
pListBox->AddString(volumeIdW); // makes a copy of the string
pSubVol = fpDiskFS->GetNextSubVolume(pSubVol);
}

View File

@ -6,8 +6,8 @@
/*
* Sub-volume selection dialog.
*/
#ifndef __SUBVOLUMEDIALOG__
#define __SUBVOLUMEDIALOG__
#ifndef APP_SUBVOLUMEDIALOG_H
#define APP_SUBVOLUMEDIALOG_H
#include "resource.h"
#include "../diskimg/DiskImg.h"
@ -44,4 +44,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__SUBVOLUMEDIALOG__*/
#endif /*APP_SUBVOLUMEDIALOG_H*/

View File

@ -37,7 +37,7 @@
* On error, "*pErrMsg" will be non-empty.
*/
int
MainWindow::TryDiskImgOverride(DiskImg* pImg, const char* fileSource,
MainWindow::TryDiskImgOverride(DiskImg* pImg, const WCHAR* fileSource,
DiskImg::FSFormat defaultFormat, int* pDisplayFormat, bool allowUnknown,
CString* pErrMsg)
{
@ -78,8 +78,8 @@ MainWindow::TryDiskImgOverride(DiskImg* pImg, const char* fileSource,
dierr = pImg->OverrideFormat(pImg->GetPhysicalFormat(), imf.fFSFormat,
imf.fSectorOrder);
if (dierr != kDIErrNone) {
pErrMsg->Format("Unable to access disk image using selected"
" parameters. Error: %s.",
pErrMsg->Format(L"Unable to access disk image using selected"
L" parameters. Error: %hs.",
DiskImgLib::DIStrError(dierr));
// fall through to "return IDOK"
}
@ -138,7 +138,7 @@ MainWindow::OnToolsDiskEdit(void)
openFilters = kOpenDiskImage;
openFilters += kOpenAll;
openFilters += kOpenEnd;
CFileDialog dlg(TRUE, "dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
CFileDialog dlg(TRUE, L"dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
/* for now, everything is read-only */
dlg.m_ofn.Flags |= OFN_HIDEREADONLY;
@ -173,8 +173,8 @@ MainWindow::OnToolsDiskEdit(void)
goto bail;
}
WMSG3("Disk editor what=%d name='%s' ro=%d\n",
diskEditOpen.fOpenWhat, loadName, readOnly);
WMSG3("Disk editor what=%d name='%ls' ro=%d\n",
diskEditOpen.fOpenWhat, (LPCWSTR) loadName, readOnly);
#if 1
@ -203,7 +203,7 @@ MainWindow::OnToolsDiskEdit(void)
#endif
if (dierr != kDIErrNone) {
errMsg.Format("Unable to open disk image: %s.",
errMsg.Format(L"Unable to open disk image: %hs.",
DiskImgLib::DIStrError(dierr));
MessageBox(errMsg, failed, MB_OK|MB_ICONSTOP);
goto bail;
@ -258,8 +258,8 @@ MainWindow::OnToolsDiskEdit(void)
if (img.AnalyzeImage() != kDIErrNone) {
errMsg.Format("The file '%s' doesn't seem to hold a valid disk image.",
loadName);
errMsg.Format(L"The file '%ls' doesn't seem to hold a valid disk image.",
(LPCWSTR) loadName);
MessageBox(errMsg, failed, MB_OK|MB_ICONSTOP);
goto bail;
}
@ -319,7 +319,7 @@ MainWindow::OnToolsDiskEdit(void)
dierr = pDiskFS->Initialize(&img, DiskFS::kInitFull);
}
if (dierr != kDIErrNone) {
errMsg.Format("Warning: error during disk scan: %s.",
errMsg.Format(L"Warning: error during disk scan: %hs.",
DiskImgLib::DIStrError(dierr));
MessageBox(errMsg, failed, MB_OK | MB_ICONEXCLAMATION);
/* keep going */
@ -361,6 +361,7 @@ MainWindow::OnToolsDiskConv(void)
DiskImg srcImg, dstImg;
DiskConvertDialog convDlg(this);
CString storageName;
CStringA saveNameA, storageNameA;
/* flush current archive in case that's what we're planning to convert */
OnFileSave();
@ -373,11 +374,11 @@ MainWindow::OnToolsDiskConv(void)
openFilters = kOpenDiskImage;
openFilters += kOpenAll;
openFilters += kOpenEnd;
CFileDialog dlg(TRUE, "dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
CFileDialog dlg(TRUE, L"dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
/* for now, everything is read-only */
dlg.m_ofn.Flags |= OFN_HIDEREADONLY;
dlg.m_ofn.lpstrTitle = "Select image to convert";
dlg.m_ofn.lpstrTitle = L"Select image to convert";
dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
if (dlg.DoModal() != IDOK)
@ -391,15 +392,15 @@ MainWindow::OnToolsDiskConv(void)
/* open the image file and analyze it */
dierr = srcImg.OpenImage(loadName, PathProposal::kLocalFssep, true);
if (dierr != kDIErrNone) {
errMsg.Format("Unable to open disk image: %s.",
errMsg.Format(L"Unable to open disk image: %hs.",
DiskImgLib::DIStrError(dierr));
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
if (srcImg.AnalyzeImage() != kDIErrNone) {
errMsg.Format("The file '%s' doesn't seem to hold a valid disk image.",
loadName);
errMsg.Format(L"The file '%ls' doesn't seem to hold a valid disk image.",
(LPCWSTR) loadName);
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
@ -437,9 +438,9 @@ MainWindow::OnToolsDiskConv(void)
delete pDiskFS;
} else {
/* use filename as storageName (exception for DiskCopy42 later) */
storageName = FilenameOnly(loadName, '\\');
storageName = PathName::FilenameOnly(loadName, '\\');
}
WMSG1(" Using '%s' as storageName\n", storageName);
WMSG1(" Using '%ls' as storageName\n", (LPCWSTR) storageName);
/* transfer the DOS volume num, if one was set */
dstImg.SetDOSVolumeNum(srcImg.GetDOSVolumeNum());
@ -457,7 +458,7 @@ MainWindow::OnToolsDiskConv(void)
dierr = srcImg.OverrideFormat(srcImg.GetPhysicalFormat(),
DiskImg::kFormatGenericProDOSOrd, srcImg.GetSectorOrder());
if (dierr != kDIErrNone) {
errMsg.Format("Internal error: couldn't switch to generic ProDOS: %s.",
errMsg.Format(L"Internal error: couldn't switch to generic ProDOS: %hs.",
DiskImgLib::DIStrError(dierr));
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
@ -506,7 +507,7 @@ MainWindow::OnToolsDiskConv(void)
DiskImg::kNibbleDescrDOS33Std);
}
}
WMSG2(" NibbleDescr is 0x%08lx (%s)\n", (long) pNibbleDescr,
WMSG2(" NibbleDescr is 0x%08lx (%hs)\n", (long) pNibbleDescr,
pNibbleDescr != nil ? pNibbleDescr->description : "---");
if (srcImg.GetFileFormat() == DiskImg::kFileFormatTrackStar &&
@ -571,7 +572,7 @@ MainWindow::OnToolsDiskConv(void)
fileFormat == DiskImg::kFileFormatDiskCopy42)
{
WMSG0(" Nuking storage name for non-ProDOS DiskCopy42 image");
storageName = ""; // want to use "-not a mac disk" for non-ProDOS
storageName = L""; // want to use "-not a mac disk" for non-ProDOS
}
/*
@ -580,12 +581,12 @@ MainWindow::OnToolsDiskConv(void)
{
CFileDialog saveDlg(FALSE, convDlg.fExtension, NULL,
OFN_OVERWRITEPROMPT|OFN_NOREADONLYRETURN|OFN_HIDEREADONLY,
"All Files (*.*)|*.*||", this);
L"All Files (*.*)|*.*||", this);
CString saveFolder;
CString title = "New disk image (.";
CString title = L"New disk image (.";
title += convDlg.fExtension;
title += ")";
title += L")";
saveDlg.m_ofn.lpstrTitle = title;
saveDlg.m_ofn.lpstrInitialDir =
@ -602,7 +603,7 @@ MainWindow::OnToolsDiskConv(void)
saveName = saveDlg.GetPathName();
}
WMSG1("File will be saved to '%s'\n", saveName);
WMSG1("File will be saved to '%ls'\n", (LPCWSTR) saveName);
/* DiskImgLib does not like it if file already exists */
errMsg = RemoveFile(saveName);
@ -649,6 +650,9 @@ MainWindow::OnToolsDiskConv(void)
isPartial = true;
}
saveNameA = saveName;
storageNameA = storageName;
if (srcImg.GetHasNibbles() &&
DiskImg::IsNibbleFormat(physicalFormat) &&
physicalFormat == srcImg.GetPhysicalFormat())
@ -657,7 +661,8 @@ MainWindow::OnToolsDiskConv(void)
* For nibble-to-nibble with the same track format, copy it as
* a collection of tracks.
*/
dierr = dstImg.CreateImage(saveName, storageName,
dierr = dstImg.CreateImage((LPCSTR) saveNameA,
(LPCSTR) storageNameA,
outerFormat,
fileFormat,
physicalFormat,
@ -671,7 +676,8 @@ MainWindow::OnToolsDiskConv(void)
* For general case, copy as a block image, converting in and out of
* nibbles as needed.
*/
dierr = dstImg.CreateImage(saveName, storageName,
dierr = dstImg.CreateImage((LPCSTR) saveNameA,
(LPCSTR) storageNameA,
outerFormat,
fileFormat,
physicalFormat,
@ -687,7 +693,8 @@ MainWindow::OnToolsDiskConv(void)
* block copying as the lowest common denominator. D13 screwed
* everything up. :-)
*/
dierr = dstImg.CreateImage(saveName, storageName,
dierr = dstImg.CreateImage((LPCSTR) saveNameA,
(LPCSTR) storageNameA,
outerFormat,
fileFormat,
physicalFormat,
@ -707,7 +714,7 @@ MainWindow::OnToolsDiskConv(void)
dierr = kDIErrInternal;
}
if (dierr != kDIErrNone) {
errMsg.Format("Couldn't create disk image: %s.",
errMsg.Format(L"Couldn't create disk image: %hs.",
DiskImgLib::DIStrError(dierr));
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
@ -718,21 +725,21 @@ MainWindow::OnToolsDiskConv(void)
*/
dierr = CopyDiskImage(&dstImg, &srcImg, false, isPartial, nil);
if (dierr != kDIErrNone) {
errMsg.Format("Copy failed: %s.", DiskImgLib::DIStrError(dierr));
errMsg.Format(L"Copy failed: %hs.", DiskImgLib::DIStrError(dierr));
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
dierr = srcImg.CloseImage();
if (dierr != kDIErrNone) {
errMsg.Format("ERROR: srcImg close failed (err=%d)\n", dierr);
errMsg.Format(L"ERROR: srcImg close failed (err=%d)\n", dierr);
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
dierr = dstImg.CloseImage();
if (dierr != kDIErrNone) {
errMsg.Format("ERROR: dstImg close failed (err=%d)\n", dierr);
errMsg.Format(L"ERROR: dstImg close failed (err=%d)\n", dierr);
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
@ -747,7 +754,7 @@ MainWindow::OnToolsDiskConv(void)
DoneOpenDialog doneOpen(this);
if (doneOpen.DoModal() == IDOK) {
WMSG1(" At user request, opening '%s'\n", saveName);
WMSG1(" At user request, opening '%ls'\n", (LPCWSTR) saveName);
DoOpenArchive(saveName, convDlg.fExtension,
kFilterIndexDiskImage, false);
@ -895,14 +902,14 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
for (int track = 0; track < numTracks; track++) {
dierr = pSrcImg->ReadNibbleTrack(track, dataBuf, &trackLen);
if (dierr != kDIErrNone) {
errMsg.Format("ERROR: read on track %d failed (err=%d)\n",
errMsg.Format(L"ERROR: read on track %d failed (err=%d)\n",
track, dierr);
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
dierr = pDstImg->WriteNibbleTrack(track, dataBuf, trackLen);
if (dierr != kDIErrNone) {
errMsg.Format("ERROR: write on track %d failed (err=%d)\n",
errMsg.Format(L"ERROR: write on track %d failed (err=%d)\n",
track, dierr);
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
@ -944,7 +951,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
}
dierr = pDstImg->WriteTrackSector(track, sector, dataBuf);
if (dierr != kDIErrNone) {
errMsg.Format("ERROR: write of T=%d S=%d failed (err=%d)\n",
errMsg.Format(L"ERROR: write of T=%d S=%d failed (err=%d)\n",
track, sector, dierr);
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
@ -957,8 +964,8 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
if (!bulk && numBadSectors != 0) {
CString appName;
appName.LoadString(IDS_MB_APP_NAME);
errMsg.Format("Skipped %ld unreadable sector%s.", numBadSectors,
numBadSectors == 1 ? "" : "s");
errMsg.Format(L"Skipped %ld unreadable sector%ls.", numBadSectors,
numBadSectors == 1 ? L"" : L"s");
MessageBox(errMsg, appName, MB_OK | MB_ICONWARNING);
}
} else {
@ -1011,7 +1018,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
dierr = pDstImg->WriteBlocks(block, blocksThisTime, dataBuf);
if (dierr != kDIErrNone) {
if (dierr != kDIErrWriteProtected) {
errMsg.Format("ERROR: write of block %ld failed (%s)\n",
errMsg.Format(L"ERROR: write of block %ld failed: %hs\n",
block, DiskImgLib::DIStrError(dierr));
ShowFailureMsg(this, errMsg, IDS_FAILED);
}
@ -1039,8 +1046,8 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
if (!bulk && numBadBlocks != 0) {
CString appName;
appName.LoadString(IDS_MB_APP_NAME);
errMsg.Format("Skipped %ld unreadable block%s.", numBadBlocks,
numBadBlocks == 1 ? "" : "s");
errMsg.Format(L"Skipped %ld unreadable block%ls.", numBadBlocks,
numBadBlocks == 1 ? L"" : L"s");
MessageBox(errMsg, appName, MB_OK | MB_ICONWARNING);
}
}
@ -1068,7 +1075,7 @@ public:
IDD_BULKCONV, pParentWnd);
}
void SetCurrentFile(const char* fileName) {
void SetCurrentFile(const WCHAR* fileName) {
CWnd* pWnd = GetDlgItem(IDC_BULKCONV_PATHNAME);
ASSERT(pWnd != nil);
pWnd->SetWindowText(fileName);
@ -1109,14 +1116,14 @@ MainWindow::OnToolsBulkDiskConv(void)
openFilters = kOpenDiskImage;
openFilters += kOpenAll;
openFilters += kOpenEnd;
CFileDialog dlg(TRUE, "dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
CFileDialog dlg(TRUE, L"dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
dlg.m_ofn.lpstrFile = new char[kFileNameBufSize];
dlg.m_ofn.lpstrFile = new WCHAR[kFileNameBufSize];
dlg.m_ofn.lpstrFile[0] = dlg.m_ofn.lpstrFile[1] = '\0';
dlg.m_ofn.nMaxFile = kFileNameBufSize;
dlg.m_ofn.Flags |= OFN_HIDEREADONLY; // open all images as read-only
dlg.m_ofn.Flags |= OFN_ALLOWMULTISELECT;
dlg.m_ofn.lpstrTitle = "Select images to convert";
dlg.m_ofn.lpstrTitle = L"Select images to convert";
dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
if (dlg.DoModal() != IDOK)
@ -1177,9 +1184,9 @@ MainWindow::OnToolsBulkDiskConv(void)
while (posn != nil) {
CString pathName;
pathName = dlg.GetNextPathName(posn);
WMSG1(" BulkConv: source path='%s'\n", pathName);
WMSG1(" BulkConv: source path='%ls'\n", (LPCWSTR) pathName);
pCancelDialog->SetCurrentFile(FilenameOnly(pathName, '\\'));
pCancelDialog->SetCurrentFile(PathName::FilenameOnly(pathName, '\\'));
PeekAndPump();
if (pCancelDialog->fAbortOperation)
break;
@ -1228,7 +1235,7 @@ bail:
* On failure, the reason for failure is stuffed into "*pErrMsg".
*/
void
MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir,
const DiskConvertDialog& convDlg, CString* pErrMsg)
{
DIError dierr;
@ -1237,8 +1244,9 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
CString storageName;
PathName srcPath(pathName);
CString fileName, ext;
CStringA saveNameA, storageNameA;
*pErrMsg = "";
*pErrMsg = L"";
dstImg.SetNuFXCompressionType(
fPreferences.GetPrefLong(kPrCompressionType));
@ -1246,13 +1254,13 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
/* open the image file and analyze it */
dierr = srcImg.OpenImage(pathName, PathProposal::kLocalFssep, true);
if (dierr != kDIErrNone) {
pErrMsg->Format("Unable to open disk image: %s.",
pErrMsg->Format(L"Unable to open disk image: %hs.",
DiskImgLib::DIStrError(dierr));
goto bail;
}
if (srcImg.AnalyzeImage() != kDIErrNone) {
pErrMsg->Format("The file doesn't seem to hold a valid disk image.");
pErrMsg->Format(L"The file doesn't seem to hold a valid disk image.");
goto bail;
}
@ -1274,8 +1282,8 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
}
#else
if (srcImg.GetSectorOrder() == DiskImg::kSectorOrderUnknown) {
*pErrMsg = "Could not determine the disk image sector ordering. You "
"may need to change the file extension.";
*pErrMsg = L"Could not determine the disk image sector ordering. You "
L"may need to change the file extension.";
goto bail;
}
#endif
@ -1296,7 +1304,7 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
dierr = srcImg.OverrideFormat(srcImg.GetPhysicalFormat(),
DiskImg::kFormatGenericProDOSOrd, srcImg.GetSectorOrder());
if (dierr != kDIErrNone) {
pErrMsg->Format("Internal error: couldn't switch to generic ProDOS: %s.",
pErrMsg->Format(L"Internal error: couldn't switch to generic ProDOS: %hs.",
DiskImgLib::DIStrError(dierr));
goto bail;
}
@ -1312,7 +1320,7 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
if (DetermineImageSettings(convDlg.fConvertIdx, (convDlg.fAddGzip != 0),
&outerFormat, &fileFormat, &physicalFormat, &sectorOrder) != 0)
{
*pErrMsg = "Odd: couldn't configure image settings";
*pErrMsg = L"Odd: couldn't configure image settings";
goto bail;
}
@ -1333,7 +1341,7 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
DiskImg::kNibbleDescrDOS33Std);
}
}
WMSG2(" NibbleDescr is 0x%08lx (%s)\n", (long) pNibbleDescr,
WMSG2(" NibbleDescr is 0x%08lx (%hs)\n", (long) pNibbleDescr,
pNibbleDescr != nil ? pNibbleDescr->description : "---");
/*
@ -1344,7 +1352,7 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
saveName += '\\';
fileName = srcPath.GetFileName();
ext = srcPath.GetExtension(); // extension, including '.'
if (ext.CompareNoCase(".gz") == 0) {
if (ext.CompareNoCase(L".gz") == 0) {
/* got a .gz, see if there's anything else in front of it */
CString tmpName, ext2;
tmpName = srcPath.GetPathName();
@ -1363,10 +1371,10 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
saveName += fileName.Left(fileName.GetLength() - ext.GetLength());
}
}
storageName = FilenameOnly(saveName, '\\'); // grab this for SHK name
storageName = PathName::FilenameOnly(saveName, '\\'); // grab this for SHK name
saveName += '.';
saveName += convDlg.fExtension;
WMSG2(" Bulk converting '%s' to '%s'\n", pathName, saveName);
WMSG2(" Bulk converting '%ls' to '%ls'\n", pathName, (LPCWSTR) saveName);
/*
* If this is a ProDOS volume, use the disk volume name as the default
@ -1384,9 +1392,9 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
} else {
/* just use storageName as set earlier, unless target is DiskCopy42 */
if (fileFormat == DiskImg::kFileFormatDiskCopy42)
storageName = ""; // want to use "not a mac disk" for non-ProDOS
storageName = L""; // want to use "not a mac disk" for non-ProDOS
}
WMSG1(" Using '%s' as storageName\n", storageName);
WMSG1(" Using '%ls' as storageName\n", (LPCWSTR) storageName);
/*
* If the source is a UNIDOS volume and the target format is DiskCopy 4.2,
@ -1438,13 +1446,16 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
isPartial = true;
}
saveNameA = saveName;
storageNameA = storageName;
if (srcImg.GetHasNibbles() &&
DiskImg::IsNibbleFormat(physicalFormat) &&
physicalFormat == srcImg.GetPhysicalFormat())
{
/* for nibble-to-nibble with the same track format, copy it
as collection of tracks */
dierr = dstImg.CreateImage(saveName, storageName,
dierr = dstImg.CreateImage((LPCSTR) saveNameA,
(LPCSTR) storageNameA,
outerFormat,
fileFormat,
physicalFormat,
@ -1456,7 +1467,8 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
} else if (srcImg.GetHasBlocks()) {
/* for general case, create as a block image */
ASSERT(srcImg.GetHasBlocks());
dierr = dstImg.CreateImage(saveName, storageName,
dierr = dstImg.CreateImage((LPCSTR) saveNameA,
(LPCSTR) storageNameA,
outerFormat,
fileFormat,
physicalFormat,
@ -1472,7 +1484,8 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
* block copying as the lowest common denominator. D13 screwed
* everything up. :-)
*/
dierr = dstImg.CreateImage(saveName, storageName,
dierr = dstImg.CreateImage((LPCSTR) saveNameA,
(LPCSTR) storageNameA,
outerFormat,
fileFormat,
physicalFormat,
@ -1483,14 +1496,14 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
false /* only need for dest=nibble? */);
} else {
/* e.g. unrecognizeable nibble to blocks */
*pErrMsg = "Could not convert to requested format.";
*pErrMsg = L"Could not convert to requested format.";
goto bail;
}
if (dierr != kDIErrNone) {
if (dierr == kDIErrInvalidCreateReq)
*pErrMsg = "Could not convert to requested format.";
*pErrMsg = L"Could not convert to requested format.";
else
pErrMsg->Format("Couldn't construct disk image: %s.",
pErrMsg->Format(L"Couldn't construct disk image: %hs.",
DiskImgLib::DIStrError(dierr));
goto bail;
}
@ -1504,13 +1517,13 @@ MainWindow::BulkConvertImage(const char* pathName, const char* targetDir,
dierr = dstImg.CloseImage();
if (dierr != kDIErrNone) {
pErrMsg->Format("ERROR: dstImg close failed (err=%d)\n", dierr);
pErrMsg->Format(L"ERROR: dstImg close failed (err=%d)\n", dierr);
goto bail;
}
dierr = srcImg.CloseImage();
if (dierr != kDIErrNone) {
pErrMsg->Format("ERROR: srcImg close failed (err=%d)\n", dierr);
pErrMsg->Format(L"ERROR: srcImg close failed (err=%d)\n", dierr);
goto bail;
}
@ -1538,18 +1551,18 @@ MainWindow::OnToolsSSTMerge(void)
const int kBadCountThreshold = 3072;
DiskImg srcImg0, srcImg1;
CString appName, saveName, saveFolder, errMsg;
unsigned char* trackBuf = nil;
BYTE* trackBuf = nil;
long badCount;
// no need to flush -- can't really open raw SST images
CFileDialog saveDlg(FALSE, _T("nib"), NULL,
CFileDialog saveDlg(FALSE, L"nib", NULL,
OFN_OVERWRITEPROMPT|OFN_NOREADONLYRETURN|OFN_HIDEREADONLY,
"All Files (*.*)|*.*||", this);
L"All Files (*.*)|*.*||", this);
appName.LoadString(IDS_MB_APP_NAME);
trackBuf = new unsigned char[kSSTNumTracks * kSSTTrackLen];
trackBuf = new BYTE[kSSTNumTracks * kSSTTrackLen];
if (trackBuf == nil)
goto bail;
@ -1588,7 +1601,7 @@ MainWindow::OnToolsSSTMerge(void)
/*
* Pick the output file and write the buffer to it.
*/
saveDlg.m_ofn.lpstrTitle = _T("Save .NIB disk image as...");
saveDlg.m_ofn.lpstrTitle = L"Save .NIB disk image as...";
saveDlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
if (saveDlg.DoModal() != IDOK) {
WMSG0(" User bailed out of image save dialog\n");
@ -1599,7 +1612,7 @@ MainWindow::OnToolsSSTMerge(void)
fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder);
saveName = saveDlg.GetPathName();
WMSG1("File will be saved to '%s'\n", saveName);
WMSG1("File will be saved to '%ls'\n", (LPCWSTR) saveName);
/* remove the file if it exists */
errMsg = RemoveFile(saveName);
@ -1609,16 +1622,16 @@ MainWindow::OnToolsSSTMerge(void)
}
FILE* fp;
fp = fopen(saveName, "wb");
fp = _wfopen(saveName, L"wb");
if (fp == nil) {
errMsg.Format("Unable to create '%s': %s.",
saveName, strerror(errno));
errMsg.Format(L"Unable to create '%ls': %hs.",
(LPCWSTR) saveName, strerror(errno));
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
if (fwrite(trackBuf, kSSTNumTracks * kSSTTrackLen, 1, fp) != 1) {
errMsg.Format("Failed while writing to new image file: %s.",
errMsg.Format(L"Failed while writing to new image file: %hs.",
strerror(errno));
ShowFailureMsg(this, errMsg, IDS_FAILED);
fclose(fp);
@ -1637,9 +1650,9 @@ MainWindow::OnToolsSSTMerge(void)
DoneOpenDialog doneOpen(this);
if (doneOpen.DoModal() == IDOK) {
WMSG1(" At user request, opening '%s'\n", saveName);
WMSG1(" At user request, opening '%ls'\n", (LPCWSTR) saveName);
DoOpenArchive(saveName, "nib", kFilterIndexDiskImage, false);
DoOpenArchive(saveName, L"nib", kFilterIndexDiskImage, false);
}
}
@ -1669,13 +1682,13 @@ MainWindow::SSTOpenImage(int seqNum, DiskImg* pDiskImg)
openFilters = kOpenDiskImage;
openFilters += kOpenAll;
openFilters += kOpenEnd;
CFileDialog dlg(TRUE, "dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
CFileDialog dlg(TRUE, L"dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
dlg.m_ofn.Flags |= OFN_HIDEREADONLY;
if (seqNum == 0)
dlg.m_ofn.lpstrTitle = "Select first SST image";
dlg.m_ofn.lpstrTitle = L"Select first SST image";
else
dlg.m_ofn.lpstrTitle = "Select second SST image";
dlg.m_ofn.lpstrTitle = L"Select second SST image";
dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
if (dlg.DoModal() != IDOK)
@ -1689,15 +1702,15 @@ MainWindow::SSTOpenImage(int seqNum, DiskImg* pDiskImg)
/* open the image file and analyze it */
dierr = pDiskImg->OpenImage(loadName, PathProposal::kLocalFssep, true);
if (dierr != kDIErrNone) {
errMsg.Format("Unable to open disk image: %s.",
errMsg.Format(L"Unable to open disk image: %hs.",
DiskImgLib::DIStrError(dierr));
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
if (pDiskImg->AnalyzeImage() != kDIErrNone) {
errMsg.Format("The file '%s' doesn't seem to hold a valid disk image.",
loadName);
errMsg.Format(L"The file '%ls' doesn't seem to hold a valid disk image.",
(LPCWSTR) loadName);
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
@ -1723,15 +1736,15 @@ MainWindow::SSTOpenImage(int seqNum, DiskImg* pDiskImg)
if (pDiskImg->GetFSFormat() != DiskImg::kFormatUnknown &&
!DiskImg::IsGenericFormat(pDiskImg->GetFSFormat()))
{
errMsg = "This disk image appears to have a valid filesystem. SST"
" images are just raw track dumps.";
errMsg = L"This disk image appears to have a valid filesystem. SST"
L" images are just raw track dumps.";
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
if (pDiskImg->GetNumTracks() != kSSTNumTracks ||
pDiskImg->GetNumSectPerTrack() != kSSTNumSectPerTrack)
{
errMsg = "ERROR: only 5.25\" floppy disk images can be SST inputs.";
errMsg = L"ERROR: only 5.25\" floppy disk images can be SST inputs.";
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
@ -1740,7 +1753,7 @@ MainWindow::SSTOpenImage(int seqNum, DiskImg* pDiskImg)
dierr = pDiskImg->OverrideFormat(pDiskImg->GetPhysicalFormat(),
DiskImg::kFormatGenericDOSOrd, pDiskImg->GetSectorOrder());
if (dierr != kDIErrNone) {
errMsg = "ERROR: internal failure: format override failed.";
errMsg = L"ERROR: internal failure: format override failed.";
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
}
@ -1760,11 +1773,11 @@ bail:
* Returns 0 on success, -1 on failure.
*/
int
MainWindow::SSTLoadData(int seqNum, DiskImg* pDiskImg, unsigned char* trackBuf,
MainWindow::SSTLoadData(int seqNum, DiskImg* pDiskImg, BYTE* trackBuf,
long* pBadCount)
{
DIError dierr;
unsigned char sctBuf[256];
BYTE sctBuf[256];
int track, sector;
long bufOffset;
@ -1987,11 +2000,11 @@ MainWindow::VolumeCopier(bool openFile)
openFilters = kOpenDiskImage;
openFilters += kOpenAll;
openFilters += kOpenEnd;
CFileDialog fileDlg(TRUE, "dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
CFileDialog fileDlg(TRUE, L"dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
//dlg.m_ofn.Flags |= OFN_HIDEREADONLY;
fileDlg.m_ofn.Flags &= ~(OFN_READONLY);
fileDlg.m_ofn.lpstrTitle = "Select disk image file";
fileDlg.m_ofn.lpstrTitle = L"Select disk image file";
fileDlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
if (fileDlg.DoModal() != IDOK)
@ -2011,21 +2024,21 @@ MainWindow::VolumeCopier(bool openFile)
dierr = srcImg.OpenImage(deviceName, '\0', readOnly);
if (dierr == kDIErrAccessDenied) {
if (openFile) {
errMsg.Format("Unable to open '%s': %s (try opening the file"
" with 'Read Only' checked).", deviceName,
DiskImgLib::DIStrError(dierr));
errMsg.Format(L"Unable to open '%ls': %hs (try opening the file"
L" with 'Read Only' checked).",
(LPCWSTR) deviceName, DiskImgLib::DIStrError(dierr));
} else if (!IsWin9x() && !openFile) {
errMsg.Format("Unable to open '%s': %s (make sure you have"
" administrator privileges).", deviceName,
DiskImgLib::DIStrError(dierr));
errMsg.Format(L"Unable to open '%ls': %hs (make sure you have"
L" administrator privileges).",
(LPCWSTR) deviceName, DiskImgLib::DIStrError(dierr));
} else {
errMsg.Format("Unable to open '%s': %s.", deviceName,
DiskImgLib::DIStrError(dierr));
errMsg.Format(L"Unable to open '%ls': %hs.",
(LPCWSTR) deviceName, DiskImgLib::DIStrError(dierr));
}
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
} else if (dierr != kDIErrNone) {
errMsg.Format("Unable to open '%s': %s.", deviceName,
errMsg.Format(L"Unable to open '%ls': %hs.", (LPCWSTR) deviceName,
DiskImgLib::DIStrError(dierr));
ShowFailureMsg(this, errMsg, IDS_FAILED);
goto bail;
@ -2033,7 +2046,7 @@ MainWindow::VolumeCopier(bool openFile)
/* analyze it to get #of blocks and determine the FS */
if (srcImg.AnalyzeImage() != kDIErrNone) {
errMsg.Format("There isn't a valid disk image here?!?");
errMsg.Format(L"There isn't a valid disk image here?!?");
MessageBox(errMsg, failed, MB_OK|MB_ICONSTOP);
goto bail;
}
@ -2174,20 +2187,20 @@ MainWindow::OnToolsDiskImageCreator(void)
CString formats;
if (createDlg.fDiskFormatIdx == CreateImageDialog::kFmtDOS32) {
formats = "13-sector disk (*.d13)|*.d13|";
formats = L"13-sector disk (*.d13)|*.d13|";
} else {
formats = "ProDOS-ordered image (*.po)|*.po|";
formats = L"ProDOS-ordered image (*.po)|*.po|";
if (createDlg.fNumBlocks == 280) {
formats += "DOS-ordered image (*.do)|*.do|";
formats += L"DOS-ordered image (*.do)|*.do|";
filterIndex = 2;
}
}
formats += "|";
formats += L"|";
CFileDialog saveDlg(FALSE, _T("po"), NULL,
CFileDialog saveDlg(FALSE, L"po", NULL,
OFN_OVERWRITEPROMPT|OFN_NOREADONLYRETURN|OFN_HIDEREADONLY,
formats, this);
saveDlg.m_ofn.lpstrTitle = "New Disk Image";
saveDlg.m_ofn.lpstrTitle = L"New Disk Image";
saveDlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
saveDlg.m_ofn.nFilterIndex = filterIndex;
@ -2201,8 +2214,8 @@ MainWindow::OnToolsDiskImageCreator(void)
fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder);
filename = saveDlg.GetPathName();
WMSG2(" Will xfer to file '%s' (filterIndex=%d)\n",
filename, saveDlg.m_ofn.nFilterIndex);
WMSG2(" Will xfer to file '%ls' (filterIndex=%d)\n",
(LPCWSTR) filename, saveDlg.m_ofn.nFilterIndex);
if (createDlg.fDiskFormatIdx == CreateImageDialog::kFmtDOS32) {
options.base.sectorOrder = DiskImg::kSectorOrderDOS;
@ -2240,7 +2253,7 @@ MainWindow::OnToolsDiskImageCreator(void)
delete pNewArchive; // close it, either way
if (!errStr.IsEmpty()) {
ShowFailureMsg(this, errStr, IDS_FAILED);
(void) unlink(filename);
(void) _wunlink(filename);
} else {
WMSG0("Disk image created successfully\n");
#if 0
@ -2250,13 +2263,13 @@ MainWindow::OnToolsDiskImageCreator(void)
DoneOpenDialog doneOpen(this);
if (doneOpen.DoModal() == IDOK) {
WMSG1(" At user request, opening '%s'\n", filename);
WMSG1(" At user request, opening '%ls'\n", filename);
DoOpenArchive(filename, "dsk", kFilterIndexDiskImage, false);
}
#else
if (createDlg.fDiskFormatIdx != CreateImageDialog::kFmtBlank)
DoOpenArchive(filename, "dsk", kFilterIndexDiskImage, false);
DoOpenArchive(filename, L"dsk", kFilterIndexDiskImage, false);
#endif
}
}
@ -2281,11 +2294,11 @@ MainWindow::OnToolsEOLScanner(void)
CString openFilters;
openFilters = kOpenAll;
openFilters += kOpenEnd;
CFileDialog fileDlg(TRUE, "dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
CFileDialog fileDlg(TRUE, L"dsk", NULL, OFN_FILEMUSTEXIST, openFilters, this);
fileDlg.m_ofn.Flags |= OFN_HIDEREADONLY;
//fileDlg.m_ofn.Flags &= ~(OFN_READONLY);
fileDlg.m_ofn.lpstrTitle = "Select file to scan";
fileDlg.m_ofn.lpstrTitle = L"Select file to scan";
fileDlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
if (fileDlg.DoModal() != IDOK)
@ -2296,12 +2309,12 @@ MainWindow::OnToolsEOLScanner(void)
saveFolder = saveFolder.Left(fileDlg.m_ofn.nFileOffset);
fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder);
WMSG1("Scanning '%s'\n", (const char*) fileName);
WMSG1("Scanning '%ls'\n", (LPCWSTR) fileName);
FILE* fp;
fp = fopen(fileName, "rb");
FILE* fp = _wfopen(fileName, L"rb");
if (fp == nil) {
errMsg.Format("Unable to open '%s': %s.", fileName, strerror(errno));
errMsg.Format(L"Unable to open '%ls': %hs.",
(LPCWSTR) fileName, strerror(errno));
ShowFailureMsg(this, errMsg, IDS_FAILED);
return;
}
@ -2375,14 +2388,14 @@ MainWindow::OnToolsTwoImgProps(void)
/*
* Select the file to open.
*/
openFilters = "2MG Disk Images (.2mg .2img)|*.2mg;*.2img|";
openFilters = L"2MG Disk Images (.2mg .2img)|*.2mg;*.2img|";
openFilters += kOpenAll;
openFilters += kOpenEnd;
CFileDialog fileDlg(TRUE, "2mg", NULL, OFN_FILEMUSTEXIST, openFilters, this);
CFileDialog fileDlg(TRUE, L"2mg", NULL, OFN_FILEMUSTEXIST, openFilters, this);
fileDlg.m_ofn.Flags |= OFN_HIDEREADONLY;
//fileDlg.m_ofn.Flags &= ~(OFN_READONLY);
fileDlg.m_ofn.lpstrTitle = "Select file to edit";
fileDlg.m_ofn.lpstrTitle = L"Select file to edit";
fileDlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder);
if (fileDlg.DoModal() != IDOK)
@ -2411,7 +2424,7 @@ MainWindow::OnToolsTwoImgProps(void)
* Returns "true" if the file was modified, "false" if not.
*/
bool
MainWindow::EditTwoImgProps(const char* fileName)
MainWindow::EditTwoImgProps(const WCHAR* fileName)
{
TwoImgPropsDialog dialog;
TwoImgHeader header;
@ -2421,17 +2434,18 @@ MainWindow::EditTwoImgProps(const char* fileName)
long totalLength;
bool readOnly = false;
WMSG1("EditTwoImgProps '%s'\n", fileName);
fp = fopen(fileName, "r+b");
WMSG1("EditTwoImgProps '%ls'\n", fileName);
fp = _wfopen(fileName, L"r+b");
if (fp == nil) {
int firstError = errno;
fp = fopen(fileName, "rb");
fp = _wfopen(fileName, L"rb");
if (fp == nil) {
errMsg.Format("Unable to open '%s': %s.",
errMsg.Format(L"Unable to open '%ls': %hs.",
fileName, strerror(firstError));
goto bail;
} else
} else {
readOnly = true;
}
}
fseek(fp, 0, SEEK_END);
@ -2439,9 +2453,9 @@ MainWindow::EditTwoImgProps(const char* fileName)
rewind(fp);
if (header.ReadHeader(fp, totalLength) != 0) {
errMsg.Format("Unable to process 2MG header in '%s'"
" (are you sure this is in 2MG format?).",
fileName);
errMsg.Format(L"Unable to process 2MG header in '%ls'"
L" (are you sure this is in 2MG format?).",
(LPCWSTR) fileName);
goto bail;
}
@ -2453,7 +2467,7 @@ MainWindow::EditTwoImgProps(const char* fileName)
rewind(fp);
if (header.WriteHeader(fp) != 0) {
errMsg = "Unable to write 2MG header";
errMsg = L"Unable to write 2MG header";
goto bail;
}
@ -2464,19 +2478,19 @@ MainWindow::EditTwoImgProps(const char* fileName)
*/
result = fseek(fp, header.fDataOffset + header.fDataLen, SEEK_SET);
if (result < 0) {
errMsg = "Unable to seek to end of 2MG file";
errMsg = L"Unable to seek to end of 2MG file";
goto bail;
}
dirty = true;
if (::chsize(fileno(fp), ftell(fp)) != 0) {
errMsg = "Unable to truncate 2MG file before writing footer";
errMsg = L"Unable to truncate 2MG file before writing footer";
goto bail;
}
if (header.fCmtLen || header.fCreatorLen) {
if (header.WriteFooter(fp) != 0) {
errMsg = "Unable to write 2MG footer";
errMsg = L"Unable to write 2MG footer";
goto bail;
}
}

View File

@ -34,24 +34,24 @@ TwoImgPropsDialog::OnInitDialog(void)
* Set up the static fields.
*/
pWnd = GetDlgItem(IDC_TWOIMG_CREATOR);
tmpStr.Format("'%s'", fpHeader->GetCreatorStr());
tmpStr.Format(L"'%hs'", fpHeader->GetCreatorStr());
pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_TWOIMG_VERSION);
tmpStr.Format("%d", fpHeader->fVersion);
tmpStr.Format(L"%d", fpHeader->fVersion);
pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_TWOIMG_FORMAT);
switch (fpHeader->fImageFormat) {
case TwoImgHeader::kImageFormatDOS: tmpStr = "DOS order sectors"; break;
case TwoImgHeader::kImageFormatProDOS: tmpStr = "ProDOS order sectors"; break;
case TwoImgHeader::kImageFormatNibble: tmpStr = "Raw nibbles"; break;
default: tmpStr = "Unknown"; break;
case TwoImgHeader::kImageFormatDOS: tmpStr = L"DOS order sectors"; break;
case TwoImgHeader::kImageFormatProDOS: tmpStr = L"ProDOS order sectors"; break;
case TwoImgHeader::kImageFormatNibble: tmpStr = L"Raw nibbles"; break;
default: tmpStr = L"Unknown"; break;
}
pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_TWOIMG_BLOCKS);
tmpStr.Format("%d", fpHeader->fNumBlocks);
tmpStr.Format(L"%d", fpHeader->fNumBlocks);
pWnd->SetWindowText(tmpStr);
/*
@ -121,10 +121,12 @@ TwoImgPropsDialog::DoDataExchange(CDataExchange* pDX)
}
if (!comment.IsEmpty())
fpHeader->SetComment(comment);
else
if (!comment.IsEmpty()) {
CStringA commentA(comment);
fpHeader->SetComment(commentA);
} else {
fpHeader->SetComment(nil);
}
} else {
CWnd* pWnd;

View File

@ -6,8 +6,8 @@
/*
* Class definition for TwoImg properties edit dialog.
*/
#ifndef __TWOIMG_PROPS_DIALOG__
#define __TWOIMG_PROPS_DIALOG__
#ifndef APP_TWOIMGPROPSDIALOG_H
#define APP_TWOIMGPROPSDIALOG_H
#include "resource.h"
#include "../diskimg/TwoImg.h"
@ -46,4 +46,4 @@ protected:
DECLARE_MESSAGE_MAP()
};
#endif /*__TWOIMG_PROPS_DIALOG__*/
#endif /*APP_TWOIMGPROPSDIALOG_H*/

View File

@ -6,10 +6,9 @@
/*
* Acknowledge and clarify a request to delete files.
*/
#ifndef __USE_SELECTION_DIALOG__
#define __USE_SELECTION_DIALOG__
#ifndef APP_USESELECTIONDIALOG_H
#define APP_USESELECTIONDIALOG_H
//#include "../util/UtilLib.h"
#include "resource.h"
/*
@ -59,4 +58,4 @@ private:
DECLARE_MESSAGE_MAP()
};
#endif /*__USE_SELECTION_DIALOG__*/
#endif /*APP_USESELECTIONDIALOG_H*/

Some files were not shown because too many files have changed in this diff Show More