resolve.c
来自「Dos6.0」· C语言 代码 · 共 664 行 · 第 1/2 页
C
664 行
| retry the operation. |
| |
\*----------------------------------------------------------------------------*/
WORD PUBLIC wsCopyError(int n, LPSTR sz)
{
char buf[200];
char file[MAXSTR];
int res;
LPSTR lpMessageText;
lstrcpy(file, sz); // in case our DS moves durring wsLoadSz()
if (!wsLoadSz(IDS_ERROR + n, buf, 200))
{
// error string doesn't exist. if it is a net error use
// net string, if not that use generic error string
if (n > ERROR_SHARE)
wsLoadSz(IDS_ERROR + ERROR_SHARE, buf, 200);
else
wsprintf(buf, wsLoadSz(IDS_ERROR,NULL, NULL), n);
}
lstrcat(buf,"\n");
// check for the out of disk space case
lstrcat(buf, file); // add the file name
lpMessageText = (LPSTR) buf;
res = fDialogWithlParam(DLG_COPYERROR, GetActiveWindow(),
wsErrorDlg, (DWORD)lpMessageText);
return res;
}
/*----------------------------------------------------------------------------*\
| |
| wsInsertDisk() |
| |
| Handles errors, as the result of copying files. |
| |
\*----------------------------------------------------------------------------*/
WORD PUBLIC wsInsertDisk(LPSTR szSrcPath)
{
DISK disk;
disk.lpszPath = szSrcPath;
disk.cDisk = (BYTE)gFiles->DiskNumber;
szEdit = szSrcPath;
return (WORD)fDialogWithlParam(DLG_EXPRESSINSERTDISK, GetActiveWindow(),
wsDiskDlg, MAKELONG(&disk,0));
}
/*----------------------------------------------------------------------------*\
| wsDiskDlg( hDlg, uiMessage, wParam, lParam ) |
| |
| Arguments: |
| hDlg window handle of about dialog window |
| uiMessage message number |
| wParam message-dependent |
| lParam message-dependent |
| |
| Returns: |
| TRUE if message has been processed, else FALSE |
| |
\*----------------------------------------------------------------------------*/
BOOL FAR PASCAL wsDiskDlg(HWND hDlg, unsigned uiMessage, WORD wParam, long lParam)
{
switch (uiMessage)
{
case WM_COMMAND:
switch (wParam)
{
case ID_OK:
EndDialog(hDlg, FC_RETRY);
break;
case ID_CANCEL:
//BUGBUG EndDialog(hDlg, fFirstTime ? FC_IGNORE : FC_ABORT);
EndDialog(hDlg, FC_IGNORE);
break;
}
return TRUE;
case WM_INITDIALOG:
{
PDISK pdisk;
char szTmp[MAX_INF_LINE_LEN];
char szTmp2[MAX_INF_LINE_LEN];
char ach[2];
EnableMenuItem(GetSystemMenu(hDlg, FALSE), SC_CLOSE,
MF_BYCOMMAND | MF_GRAYED | MF_DISABLED);
pdisk = (PDISK)LOWORD(lParam);
if ( pdisk->cDisk == NOT_REMOVEABLE )
strcpy (szTmp2, GetDistribPrompt(GetRealSrcDisk( gFiles->Name.Source, NOT_REMOVEABLE )));
else
strcpy(szTmp2,GetDistribPrompt(pdisk->cDisk));
SetDlgItemText(hDlg, ID_STATUS0, szTmp2);
// ach[0] = (char)UPCASE(*szDiskPath);
ach[0] = vInfo.chSource;
ach[1] = 0;
wsLoadSz(IDS_INTO_DRIVE, szTmp, sizeof(szTmp));
wsprintf(szTmp2, szTmp, (LPSTR)ach);
SetDlgItemText(hDlg, ID_STATUS1, szTmp2);
wsDlgInit(hDlg, DLGINIT_REMOVE_CLOSE_MENU);
MessageBeep(0);
return TRUE;
}
}
return FALSE;
}
/*----------------------------------------------------------------------------*\
| wsErrorDlg( hDlg, uiMessage, wParam, lParam ) |
| |
| Arguments: |
| hDlg window handle of about dialog window |
| uiMessage message number |
| wParam message-dependent |
| lParam message-dependent |
| |
| Returns: |
| TRUE if message has been processed, else FALSE |
| |
\*----------------------------------------------------------------------------*/
BOOL FAR PASCAL wsErrorDlg(HWND hDlg, unsigned uiMessage, WORD wParam, long lParam)
{
extern int CreatingRecovery;
switch (uiMessage)
{
case WM_SYSCOMMAND: // suppress taskman
if(wParam == SC_TASKLIST)
return TRUE;
break;
case WM_COMMAND:
switch (wParam)
{
case ID_RETRY:
EndDialog(hDlg, FC_RETRY);
break;
case ID_IGNORE:
EndDialog(hDlg, FC_IGNORE);
break;
default:
return(FALSE);
}
return TRUE;
break;
case WM_INITDIALOG:
SetDlgItemText(hDlg, ID_STATUS1, (LPSTR) lParam);
EnableMenuItem(GetSystemMenu(hDlg, FALSE), SC_CLOSE,
MF_BYCOMMAND | MF_GRAYED | MF_DISABLED);
if ( CreatingRecovery )
EnableWindow( GetDlgItem(hDlg, ID_IGNORE), FALSE );
wsDlgInit(hDlg, DLGINIT_REMOVE_CLOSE_MENU);
MessageBeep(0);
return TRUE;
break;
}
return(FALSE);
}
/*----------------------------------------------------------------------------*\
| define the call back function used by the FileCopy() function. |
| |
\*----------------------------------------------------------------------------*/
WORD FAR PASCAL wsCopyStatus(int msg, int n, LPSTR szFile)
{
extern int CreatingRecovery;
WORD res;
// char buf[80];
switch (msg)
{
case COPY_INSERTDISK:
if ( CreatingRecovery )
{
InitUninstallDisk(iUninstallDiskNum);
return FC_RETRY;
}
else
{
if ( gFiles->DiskNumber == NOT_REMOVEABLE )
return wsInsertDisk(szFile);
InsertDisk(gFiles->DiskNumber);
return FC_RETRY;
}
case COPY_ERROR:
if ( n == ERROR_WRITE && CreatingRecovery && iUninstallDiskNum == 0 ) {
/*
* For this case, we must prepare another uninstall disk. This
* may happen when folks are using 360kb or 720kb uninstall disks.
*/
/* Need to add disk space check here to assure the disk is indeed full */
InitUninstallDisk(++iUninstallDiskNum);
return FC_RETRY;
}
res = wsCopyError(n,szFile);
if ( res == FC_RETRY )
if ( CreatingRecovery )
InitUninstallDisk(iUninstallDiskNum);
else
InsertDisk(gFiles->DiskNumber);
return res;
case COPY_QUERYCOPY:
// special case hack for .386 files built into win386.exe
// infParseField(szFile, 1, buf);
// if (*FileName(buf) == '*')
// return FALSE; // don't copy
return TRUE;
case COPY_END:
case COPY_START:
SetErrorMode(msg == COPY_START); // don't crit error on us
break;
case COPY_STATUS:
// if (n == 0)
// {
// if their is a title update it. this allows shared titles
// if ( infParseField( szFile, 2, buf ) )
// ProPrintf( ID_STATUS2, wsLoadSz( IDS_COPYING,NULL,NULL ), (LPSTR)buf );
// }
if (n == 100)
ProDeltaPos(1);
wsYield(hwndParent);
break;
} /* End of switch */
return FC_IGNORE;
}
/*----------------------------------------------------------------------------*\
| wsExitDlg( hDlg, uiMessage, wParam, lParam ) |
| |
| Arguments: |
| hDlg window handle of about dialog window |
| uiMessage message number |
| wParam message-dependent |
| lParam message-dependent |
| |
| Returns: |
| TRUE if message has been processed, else FALSE |
| |
\*----------------------------------------------------------------------------*/
BOOL EXPORT wsExitDlg(HWND hDlg, unsigned uiMessage, WORD wParam, LONG lParam )
{
#define WEC_RESTART 0x42
switch (uiMessage)
{
case WM_COMMAND:
switch (wParam)
{
case ID_REBOOT:
ProClose();
iWillReboot = TRUE; // Assure reboot.
AppQuit();
break;
case ID_CANCEL:
#ifdef DEBUG
// allow abort in debug release
// if ( !fFirstTime )
EndDialog(hDlg,FALSE);
#endif
break;
default:
return FALSE;
}
return TRUE;
case WM_INITDIALOG:
wsDlgInit( hDlg, DLGINIT_REMOVE_CLOSE_MENU );
return TRUE;
}
return FALSE;
}
#define ISDIGIT(c) ((c) >= '0' && (c) <= '9')
int PUBLIC atoi(PSTR sz)
{
int n = 0;
while (ISDIGIT(*sz))
{
n *= 10;
n += *sz - '0';
sz++;
}
return n;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?