Skip to content

Commit

Permalink
Merge pull request #45 from davidrg/vintagevc
Browse files Browse the repository at this point in the history
Windows NT 3.50 support
  • Loading branch information
davidrg committed Sep 2, 2022
2 parents c2f00f5 + 211e3f1 commit 08ef5dd
Show file tree
Hide file tree
Showing 30 changed files with 469 additions and 45 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/build.yml
Expand Up @@ -243,6 +243,72 @@ jobs:
if-no-files-found: error
retention-days: 7

Build-OpenWatcom19-Win32-NT-legacy:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3

# Cache OpenWatcom because it takes quite a while to download and
# decompress.
- name: Cache OpenWatcom
uses: actions/cache@v3.0.5
id: cache-watcom
with:
path: |
${{github.workspace}}\watcom
key: watcom-1.9
- name: Get OpenWatcom 1.9
if: steps.cache-watcom.outputs.cache-hit != 'true'
run: |
mkdir watcom
cd watcom
wget https://github.com/open-watcom/open-watcom-1.9/releases/download/ow1.9/open-watcom-c-win32-1.9.exe -outfile open-watcom-c-win32-1.9.exe
7z x open-watcom-c-win32-1.9.exe
shell: powershell
- name: Full Build
run: |
SET PATH=%WATCOM%\BINW;%PATH%
SET PATH=%WATCOM%\BINNT;%PATH%
SET INCLUDE=%WATCOM%\H\NT;%INCLUDE%
SET INCLUDE=%WATCOM%\H\NT;%INCLUDE%
SET INCLUDE=%INCLUDE%;C:\WATCOM\H\NT\DIRECTX
SET INCLUDE=%INCLUDE%;C:\WATCOM\H\NT\DDK
SET INCLUDE=%WATCOM%\H;%INCLUDE%
SET EDPATH=%WATCOM%\EDDAT
SET WHTMLHELP=%WATCOM%\BINNT\HELP
SET WIPFC=%WATCOM%\WIPFC
REM Build for Windows NT 3.50 (and, someday, NT 3.1)
set CKT_NT31=yes
call ..\..\setenv.bat
call mk.bat
shell: cmd
working-directory: ${{ github.workspace }}\kermit\k95
env:
ROOT: ${{ github.workspace }}
WATCOM: ${{ github.workspace }}\watcom
- name: Make Distribution
run: mkdist.bat
shell: cmd
working-directory: ${{ github.workspace }}\kermit\k95
env:
ROOT: ${{ github.workspace }}
WATCOM: ${{ github.workspace }}\watcom
- name: Prepare Artifact
shell: cmd
working-directory: ${{ github.workspace }}\kermit\k95
run: |
move dist ${{ github.workspace }}\ckwin
- name: Upload Artifact
uses: actions/upload-artifact@v2.2.4
with:
name: ckwin-ow1.9-x86-nt350
path: ${{ github.workspace }}\ckwin
if-no-files-found: error
retention-days: 7

##############################################################################
# Build C-Kermit for OS/2 with OpenWatcom 1.9 which can cross-compile #
##############################################################################
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -79,7 +79,7 @@ Compiling
---------

To build C-Kermit for Windows, see the [Build Instructions](doc/building.md).
You'll need at least Visual C++ 4.0 or newer, or OpenWatcom 1.9+. To build
You'll need at least Visual C++ 2.0 or newer, or OpenWatcom 1.9+. To build
with ConPTY and SSH support you'll need to use Visual C++ 2019 or newer.

To build C-Kermit for OS/2, see the [OS/2 Build Instructions](doc/os2-building.md).
Expand Down
20 changes: 17 additions & 3 deletions doc/compilers.md
Expand Up @@ -11,8 +11,9 @@ For the best security, always use the most recent compiler you
can. Support for older compilers remains for those wishing to build
C-Kermit for vintage Windows systems, the security situation of which
is well known. C-Kermit for Windows, when built with the right compiler,
supports Windows NT 3.51+ and Windows 95+. Windows NT 3.1 and 3.50 are
unsupported at this time.
supports Windows NT 3.50+ and Windows 95+. Windows NT 3.1 is unsupported at
this time though that may change in the future. Win32s (Win32 on Windows 3.x)
can not be supported due to the lack of support for threading.

The CI system is set-up to do builds with Visual C++ 2022,
Visual C++ 2015, Visual C++ 2003, and OpenWatcom 1.9.
Expand Down Expand Up @@ -207,6 +208,19 @@ Visual C++ 2015, Visual C++ 2003, and OpenWatcom 1.9.
<td>✅</td> <!-- Console -->
<td></td> <!-- Notes -->
</tr>
<tr>
<td>Visual C++ 2.0</td>
<td>Windows NT 3.1, Win32s 1.2</td>
<td>❌</td> <!-- Free -->
<td>❌</td> <!-- PTY -->
<td>❌</td> <!-- SSH -->
<td>❌</td> <!-- NTLM/Auth -->
<td>❌</td> <!-- TAPI -->
<td>✅*</td> <!-- GUI -->
<td>✅</td> <!-- Console -->
<td>No toolbar or some GUI dialogs, window resizing scales font doesn't
currently work well.</td>
</tr>
<tr>
<td>OpenWatcom 1.9</td>
<td>Windows NT 3.51,
Expand All @@ -218,7 +232,7 @@ Visual C++ 2015, Visual C++ 2003, and OpenWatcom 1.9.
<td>✅</td> <!-- TAPI -->
<td>✅</td> <!-- GUI -->
<td>✅</td> <!-- Console -->
<td></td> <!-- Notes -->
<td>To target NT 3.50, <tt>set CKT_NT31=yes</tt> before building</td>
</tr>
<tr>
<td>OpenWatcom 2.0</td>
Expand Down
78 changes: 69 additions & 9 deletions kermit/k95/cknwin.c
Expand Up @@ -31,7 +31,11 @@ char *cknwin = "Win32 GUI Support 8.0.029, 10 March 2004";

/* Visual C++ 6 fixes */
#ifndef DS_SHELLFONT
#ifndef CKT_NT31
#define DS_SHELLFONT (DS_SETFONT | DS_FIXEDSYS)
#else
#define DS_SHELLFONT DS_SETFONT
#endif /* CKT_NT31 */
#endif
#ifndef DWORD_PTR
typedef unsigned long DWORD_PTR, *PDWORD_PTR;
Expand Down Expand Up @@ -334,6 +338,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
}
#endif

#ifndef CKT_NT31
BOOL InitApplication(hinstance)
HINSTANCE hinstance;
{
Expand Down Expand Up @@ -371,6 +376,39 @@ HINSTANCE hinstance;

return RegisterClassEx(&wcx);
}
#else
/* Visual C++ 2.0 and earlier don't support WNDCLASSEX or its associated
* functions */
BOOL InitApplication(hinstance)
HINSTANCE hinstance;
{
WNDCLASS wc;

/*
* Fill in the window class structure with parameters
* that describe the main window.
*/

wc.style = CS_HREDRAW |
CS_VREDRAW; /* redraw if size changes */
wc.lpfnWndProc = MainWndProc; /* points to window proc. */
wc.cbClsExtra = 0; /* no extra class memory */
wc.cbWndExtra = 0; /* no extra window memory */
wc.hInstance = hinstance; /* handle of instance */
wc.hIcon = LoadIcon(NULL,
MAKEINTRESOURCE(1)); /* kermit 95 icon */
wc.hCursor = LoadCursor(NULL,
IDC_ARROW); /* predefined arrow */
wc.hbrBackground = GetStockObject(
WHITE_BRUSH); /* white background brush */
wc.lpszMenuName = "CkMainMenu"; /* name of menu resource */
wc.lpszClassName = "CkMainWClass"; /* name of window class */

/* Register the window class. */

return RegisterClass(&wc);
}
#endif /* CKT_NT31 */

BOOL
InitInstance(hinstance, nCmdShow)
Expand Down Expand Up @@ -610,7 +648,11 @@ StartDialer(void)
DialerSend(OPT_KERMIT_HWND2, (unsigned long)hwndGUI);
DialerSend(OPT_KERMIT_PID, GetCurrentProcessId());
}
#ifndef CKT_NT31
ShowWindowAsync(hwndDialer,SW_SHOWNORMAL);
#else
ShowWindow(hwndDialer,SW_SHOWNORMAL);
#endif
SetForegroundWindow(hwndDialer);
} else if (_hwndDialer = FindWindow(NULL, "Kermit-95 Dialer")) {
StartedFromDialer = 1;
Expand All @@ -621,7 +663,11 @@ StartDialer(void)
DialerSend(OPT_KERMIT_HWND2, (unsigned long)hwndGUI);
DialerSend(OPT_KERMIT_PID, GetCurrentProcessId());
}
#ifndef CKT_NT31
ShowWindowAsync(hwndDialer,SW_SHOWNORMAL);
#else
ShowWindow(hwndDialer,SW_SHOWNORMAL);
#endif
SetForegroundWindow(hwndDialer);
StartedFromDialer = 0;
} else {
Expand Down Expand Up @@ -771,9 +817,13 @@ SingleInputDialog( HINSTANCE hinst, HWND hwndOwner,
// Define a dialog box.

lpdt->style = WS_POPUP | WS_BORDER | WS_SYSMENU
| DS_MODALFRAME | WS_CAPTION | DS_CENTER
| DS_SETFOREGROUND | DS_3DLOOK
| DS_SHELLFONT | DS_NOFAILCREATE;
| DS_MODALFRAME | WS_CAPTION
| DS_SETFOREGROUND
| DS_SHELLFONT
#ifndef CKT_NT31
| DS_3DLOOK | DS_CENTER | DS_NOFAILCREATE
#endif
;
lpdt->cdit = numlines + 4; // number of controls
lpdt->x = 10;
lpdt->y = 10;
Expand Down Expand Up @@ -1005,7 +1055,11 @@ MultiInputDialogProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
}
/* fallthrough */
case IDCANCEL:
#ifndef CKT_NT31
ShowWindowAsync(hwndConsole,SW_SHOWNORMAL);
#else
ShowWindow(hwndConsole,SW_SHOWNORMAL);
#endif
SetForegroundWindow(hwndConsole);
EndDialog(hwndDlg, LOWORD(wParam));
return TRUE;
Expand Down Expand Up @@ -1045,9 +1099,12 @@ MultiInputDialog( HINSTANCE hinst, HWND hwndOwner,
// Define a dialog box.

lpdt->style = WS_POPUP | WS_BORDER | WS_SYSMENU
| DS_MODALFRAME | WS_CAPTION | DS_CENTER
| DS_SETFOREGROUND | DS_3DLOOK
| DS_SHELLFONT | DS_NOFAILCREATE;
| DS_MODALFRAME | WS_CAPTION
| DS_SETFOREGROUND | DS_SHELLFONT
#ifndef CKT_NT31
| DS_3DLOOK | DS_CENTER | DS_NOFAILCREATE
#endif
;
lpdt->cdit = numlines + (2 * tb_cnt) + 2; // number of controls
lpdt->x = 10;
lpdt->y = 10;
Expand Down Expand Up @@ -1307,9 +1364,12 @@ VideoPopupDialog( HINSTANCE hinst, HWND hwndOwner, videopopup * vp)
// Define a dialog box.

lpdt->style = WS_POPUP | WS_BORDER | WS_SYSMENU
| DS_MODALFRAME | WS_CAPTION | DS_CENTER
| DS_SETFOREGROUND | DS_3DLOOK
| DS_SETFONT | DS_NOFAILCREATE;
| DS_MODALFRAME | WS_CAPTION
| DS_SETFOREGROUND | DS_SETFONT
#ifndef CKT_NT31
| DS_3DLOOK | DS_CENTER | DS_NOFAILCREATE
#endif
;
lpdt->cdit = vp->height + 2; // number of controls
lpdt->x = 10;
lpdt->y = 10;
Expand Down
12 changes: 10 additions & 2 deletions kermit/k95/ckoco2.c
Expand Up @@ -5288,7 +5288,7 @@ static struct _font_list {

static int CALLBACK
EnumFontFamProc( ENUMLOGFONT *lpelfe, // logical-font data
NEWTEXTMETRICEX *lpntme, // physical-font data
NEWTEXTMETRIC *lpntme, // physical-font data
DWORD FontType, // type of font
LPARAM lParam // application-defined data
)
Expand Down Expand Up @@ -5325,7 +5325,7 @@ EnumFontFamProc( ENUMLOGFONT *lpelfe, // logical-font data
return(font_list->count);
}


#ifndef CKT_NT31
static int CALLBACK
EnumFontFamExProc( ENUMLOGFONTEX *lpelfe, // logical-font data
NEWTEXTMETRICEX *lpntme, // physical-font data
Expand Down Expand Up @@ -5364,6 +5364,7 @@ EnumFontFamExProc( ENUMLOGFONTEX *lpelfe, // logical-font data
font_list->name[font_list->count++] = strdup(name);
return(font_list->count);
}
#endif /* CKT_NT31 */

static int
EnumerateFonts()
Expand Down Expand Up @@ -5395,6 +5396,7 @@ EnumerateFonts()
lf.lfFaceName[0] = '\0';
lf.lfPitchAndFamily = 0;

#ifndef CKT_NT31
if ( nt351 )
rc = EnumFontFamilies( (HDC) hdc, NULL,
(FONTENUMPROC) EnumFontFamProc,
Expand All @@ -5403,6 +5405,12 @@ EnumerateFonts()
rc = EnumFontFamiliesEx( (HDC) hdc, (LPLOGFONT)&lf,
(FONTENUMPROC) EnumFontFamExProc,
0, 0);
#else
rc = EnumFontFamilies( (HDC) hdc, NULL,
(FONTENUMPROC) EnumFontFamProc,
0);
#endif

debug(F111,"EnumerateFonts()","EnumFontFamiliesEx()",rc);
DeleteDC(hdc);
}
Expand Down
2 changes: 1 addition & 1 deletion kermit/k95/ckoker.mak
Expand Up @@ -189,7 +189,7 @@ COMMON_CFLAGS = $(COMMON_CFLAGS) /EHs-c-

!endif

RCDEFINES=/dCOMPILER_$(CMP)
RCDEFINES=$(RC_FEATURE_DEFS) /dCOMPILER_$(CMP)

#---------- Compiler targets:
#
Expand Down
2 changes: 2 additions & 0 deletions kermit/k95/ckokey.c
Expand Up @@ -1592,6 +1592,7 @@ getKeycodeFromKeyRec( KEY_EVENT_RECORD * pkeyrec, WORD * buf, int chcount )
debug(F111,"win32keyrec","keyrec.uChar.AsciiChar",keyrec.uChar.AsciiChar);
debug(F111,"win32keyrec","keyrec.dwControlKeyState",keyrec.dwControlKeyState);

#ifndef CKT_NT31
if ( isWin95() ) {
/* This code should work but ActivateKeyboardLayout() appears to have no */
/* effect on Win95 Console programs. So instead we use a combination of */
Expand Down Expand Up @@ -1816,6 +1817,7 @@ getKeycodeFromKeyRec( KEY_EVENT_RECORD * pkeyrec, WORD * buf, int chcount )
}
}
} /* end of Win95 processing */
#endif /* CKT_NT31 */
#endif /* KUI */

if ( keyrec.bKeyDown &&
Expand Down
10 changes: 10 additions & 0 deletions kermit/k95/ckoreg.c
Expand Up @@ -718,9 +718,11 @@ Real_Win32ShellExecute( void* param )
case ERROR_BAD_FORMAT:
debug(F110,"Win32 ShellExecute","The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).",0);
break;
#ifdef SE_ERR_ACCESSDENIED
case SE_ERR_ACCESSDENIED:
debug(F110,"Win32 ShellExecute","The operating system denied access to the specified file.",0);
break;
#endif
case SE_ERR_ASSOCINCOMPLETE:
debug(F110,"Win32 ShellExecute","The filename association is incomplete or invalid.",0);
break;
Expand All @@ -733,21 +735,29 @@ Real_Win32ShellExecute( void* param )
case SE_ERR_DDETIMEOUT:
debug(F110,"Win32 ShellExecute","The DDE transaction could not be completed because the request timed out.",0);
break;
#ifdef SE_ERR_DLLNOTFOUND
case SE_ERR_DLLNOTFOUND:
debug(F110,"Win32 ShellExecute","The specified dynamic-link library was not found.",0);
break;
#endif
#ifdef SE_ERR_FNF
case SE_ERR_FNF:
debug(F110,"Win32 ShellExecute","The specified file was not found.",0);
break;
#endif
case SE_ERR_NOASSOC:
debug(F110,"Win32 ShellExecute","There is no application associated with the given filename extension.",0);
break;
#ifdef SE_ERR_OOM
case SE_ERR_OOM:
debug(F110,"Win32 ShellExecute","There was not enough memory to complete the operation.",0);
break;
#endif
#ifdef SE_ERR_PNF
case SE_ERR_PNF:
debug(F110,"Win32 ShellExecute","The specified path was not found.",0);
break;
#endif
case SE_ERR_SHARE:
debug(F110,"Win32 ShellExecute","A sharing violation occurred.",0);
break;
Expand Down

0 comments on commit 08ef5dd

Please sign in to comment.