| 1 |
doda |
6806 |
/* |
| 2 |
|
|
* Copyright (C) 1994-1998 T. Teranishi |
| 3 |
nmaya |
9048 |
* (C) 2004- TeraTerm Project |
| 4 |
doda |
6806 |
* All rights reserved. |
| 5 |
|
|
* |
| 6 |
doda |
6841 |
* Redistribution and use in source and binary forms, with or without |
| 7 |
|
|
* modification, are permitted provided that the following conditions |
| 8 |
|
|
* are met: |
| 9 |
doda |
6806 |
* |
| 10 |
doda |
6841 |
* 1. Redistributions of source code must retain the above copyright |
| 11 |
|
|
* notice, this list of conditions and the following disclaimer. |
| 12 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
|
|
* notice, this list of conditions and the following disclaimer in the |
| 14 |
|
|
* documentation and/or other materials provided with the distribution. |
| 15 |
|
|
* 3. The name of the author may not be used to endorse or promote products |
| 16 |
|
|
* derived from this software without specific prior written permission. |
| 17 |
doda |
6806 |
* |
| 18 |
doda |
6841 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR |
| 19 |
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 20 |
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 21 |
|
|
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 |
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 23 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 |
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 |
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 |
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 |
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 |
doda |
6806 |
*/ |
| 29 |
maya |
3227 |
|
| 30 |
|
|
/* TERATERM.EXE, TTTEK.DLL interface */ |
| 31 |
|
|
|
| 32 |
|
|
#include "teraterm.h" |
| 33 |
|
|
#include "tttypes.h" |
| 34 |
|
|
#include "tektypes.h" |
| 35 |
doda |
6792 |
#include "ttwinman.h" |
| 36 |
maya |
3227 |
|
| 37 |
|
|
#include "teklib.h" |
| 38 |
|
|
|
| 39 |
|
|
PTEKInit TEKInit; |
| 40 |
|
|
PTEKResizeWindow TEKResizeWindow; |
| 41 |
|
|
PTEKChangeCaret TEKChangeCaret; |
| 42 |
|
|
PTEKDestroyCaret TEKDestroyCaret; |
| 43 |
|
|
PTEKParse TEKParse; |
| 44 |
|
|
PTEKReportGIN TEKReportGIN; |
| 45 |
|
|
PTEKPaint TEKPaint; |
| 46 |
|
|
PTEKWMLButtonDown TEKWMLButtonDown; |
| 47 |
|
|
PTEKWMLButtonUp TEKWMLButtonUp; |
| 48 |
|
|
PTEKWMMouseMove TEKWMMouseMove; |
| 49 |
|
|
PTEKWMSize TEKWMSize; |
| 50 |
|
|
PTEKCMCopy TEKCMCopy; |
| 51 |
|
|
PTEKCMCopyScreen TEKCMCopyScreen; |
| 52 |
|
|
|
| 53 |
|
|
PTEKPrint TEKPrint; |
| 54 |
|
|
PTEKClearScreen TEKClearScreen; |
| 55 |
|
|
PTEKSetupFont TEKSetupFont; |
| 56 |
|
|
PTEKResetWin TEKResetWin; |
| 57 |
|
|
PTEKRestoreSetup TEKRestoreSetup; |
| 58 |
|
|
PTEKEnd TEKEnd; |
| 59 |
|
|
|
| 60 |
|
|
static HMODULE HTTTEK = NULL; |
| 61 |
|
|
|
| 62 |
|
|
#define IdTEKInit 1 |
| 63 |
|
|
#define IdTEKResizeWindow 2 |
| 64 |
|
|
#define IdTEKChangeCaret 3 |
| 65 |
|
|
#define IdTEKDestroyCaret 4 |
| 66 |
|
|
#define IdTEKParse 5 |
| 67 |
|
|
#define IdTEKReportGIN 6 |
| 68 |
|
|
#define IdTEKPaint 7 |
| 69 |
|
|
#define IdTEKWMLButtonDown 8 |
| 70 |
|
|
#define IdTEKWMLButtonUp 9 |
| 71 |
|
|
#define IdTEKWMMouseMove 10 |
| 72 |
|
|
#define IdTEKWMSize 11 |
| 73 |
|
|
#define IdTEKCMCopy 12 |
| 74 |
|
|
#define IdTEKCMCopyScreen 13 |
| 75 |
|
|
#define IdTEKPrint 14 |
| 76 |
|
|
#define IdTEKClearScreen 15 |
| 77 |
|
|
#define IdTEKSetupFont 16 |
| 78 |
|
|
#define IdTEKResetWin 17 |
| 79 |
|
|
#define IdTEKRestoreSetup 18 |
| 80 |
|
|
#define IdTEKEnd 19 |
| 81 |
|
|
|
| 82 |
|
|
BOOL LoadTTTEK() |
| 83 |
|
|
{ |
| 84 |
|
|
BOOL Err; |
| 85 |
|
|
|
| 86 |
|
|
if (HTTTEK != NULL) return TRUE; |
| 87 |
zmatsuo |
9335 |
HTTTEK = LoadHomeDLL(L"TTPTEK.DLL"); |
| 88 |
maya |
3227 |
if (HTTTEK == NULL) return FALSE; |
| 89 |
|
|
|
| 90 |
|
|
Err = FALSE; |
| 91 |
|
|
TEKInit = (PTEKInit)GetProcAddress(HTTTEK, |
| 92 |
|
|
MAKEINTRESOURCE(IdTEKInit)); |
| 93 |
|
|
if (TEKInit==NULL) Err = TRUE; |
| 94 |
doda |
6435 |
|
| 95 |
maya |
3227 |
TEKResizeWindow = (PTEKResizeWindow)GetProcAddress(HTTTEK, |
| 96 |
|
|
MAKEINTRESOURCE(IdTEKResizeWindow)); |
| 97 |
|
|
if (TEKResizeWindow==NULL) Err = TRUE; |
| 98 |
|
|
|
| 99 |
|
|
TEKChangeCaret = (PTEKChangeCaret)GetProcAddress(HTTTEK, |
| 100 |
|
|
MAKEINTRESOURCE(IdTEKChangeCaret)); |
| 101 |
|
|
if (TEKChangeCaret==NULL) Err = TRUE; |
| 102 |
|
|
|
| 103 |
|
|
TEKDestroyCaret = (PTEKDestroyCaret)GetProcAddress(HTTTEK, |
| 104 |
|
|
MAKEINTRESOURCE(IdTEKDestroyCaret)); |
| 105 |
|
|
if (TEKDestroyCaret==NULL) Err = TRUE; |
| 106 |
|
|
|
| 107 |
|
|
TEKParse = (PTEKParse)GetProcAddress(HTTTEK, |
| 108 |
|
|
MAKEINTRESOURCE(IdTEKParse)); |
| 109 |
|
|
if (TEKParse==NULL) Err = TRUE; |
| 110 |
|
|
|
| 111 |
|
|
TEKReportGIN = (PTEKReportGIN)GetProcAddress(HTTTEK, |
| 112 |
|
|
MAKEINTRESOURCE(IdTEKReportGIN)); |
| 113 |
|
|
if (TEKReportGIN==NULL) Err = TRUE; |
| 114 |
|
|
|
| 115 |
|
|
TEKPaint = (PTEKPaint)GetProcAddress(HTTTEK, |
| 116 |
|
|
MAKEINTRESOURCE(IdTEKPaint)); |
| 117 |
|
|
if (TEKPaint==NULL) Err = TRUE; |
| 118 |
|
|
|
| 119 |
|
|
TEKWMLButtonDown = (PTEKWMLButtonDown)GetProcAddress(HTTTEK, |
| 120 |
|
|
MAKEINTRESOURCE(IdTEKWMLButtonDown)); |
| 121 |
|
|
if (TEKWMLButtonDown==NULL) Err = TRUE; |
| 122 |
|
|
|
| 123 |
|
|
TEKWMLButtonUp = (PTEKWMLButtonUp)GetProcAddress(HTTTEK, |
| 124 |
|
|
MAKEINTRESOURCE(IdTEKWMLButtonUp)); |
| 125 |
|
|
if (TEKWMLButtonUp==NULL) Err = TRUE; |
| 126 |
|
|
|
| 127 |
|
|
TEKWMMouseMove = (PTEKWMMouseMove)GetProcAddress(HTTTEK, |
| 128 |
|
|
MAKEINTRESOURCE(IdTEKWMMouseMove)); |
| 129 |
|
|
if (TEKWMMouseMove==NULL) Err = TRUE; |
| 130 |
|
|
|
| 131 |
|
|
TEKWMSize = (PTEKWMSize)GetProcAddress(HTTTEK, |
| 132 |
|
|
MAKEINTRESOURCE(IdTEKWMSize)); |
| 133 |
|
|
if (TEKWMSize==NULL) Err = TRUE; |
| 134 |
|
|
|
| 135 |
|
|
TEKCMCopy = (PTEKCMCopy)GetProcAddress(HTTTEK, |
| 136 |
|
|
MAKEINTRESOURCE(IdTEKCMCopy)); |
| 137 |
|
|
if (TEKCMCopy==NULL) Err = TRUE; |
| 138 |
|
|
|
| 139 |
|
|
TEKCMCopyScreen = (PTEKCMCopyScreen)GetProcAddress(HTTTEK, |
| 140 |
|
|
MAKEINTRESOURCE(IdTEKCMCopyScreen)); |
| 141 |
|
|
if (TEKCMCopyScreen==NULL) Err = TRUE; |
| 142 |
|
|
|
| 143 |
|
|
TEKPrint = (PTEKPrint)GetProcAddress(HTTTEK, |
| 144 |
|
|
MAKEINTRESOURCE(IdTEKPrint)); |
| 145 |
|
|
if (TEKPrint==NULL) Err = TRUE; |
| 146 |
|
|
|
| 147 |
|
|
TEKClearScreen = (PTEKClearScreen)GetProcAddress(HTTTEK, |
| 148 |
|
|
MAKEINTRESOURCE(IdTEKClearScreen)); |
| 149 |
|
|
if (TEKClearScreen==NULL) Err = TRUE; |
| 150 |
|
|
|
| 151 |
|
|
TEKSetupFont = (PTEKSetupFont)GetProcAddress(HTTTEK, |
| 152 |
|
|
MAKEINTRESOURCE(IdTEKSetupFont)); |
| 153 |
|
|
if (TEKSetupFont==NULL) Err = TRUE; |
| 154 |
|
|
|
| 155 |
|
|
TEKResetWin = (PTEKResetWin)GetProcAddress(HTTTEK, |
| 156 |
|
|
MAKEINTRESOURCE(IdTEKResetWin)); |
| 157 |
|
|
if (TEKResetWin==NULL) Err = TRUE; |
| 158 |
|
|
|
| 159 |
|
|
TEKRestoreSetup = (PTEKRestoreSetup)GetProcAddress(HTTTEK, |
| 160 |
|
|
MAKEINTRESOURCE(IdTEKRestoreSetup)); |
| 161 |
|
|
if (TEKRestoreSetup==NULL) Err = TRUE; |
| 162 |
|
|
|
| 163 |
|
|
TEKEnd = (PTEKEnd)GetProcAddress(HTTTEK, |
| 164 |
|
|
MAKEINTRESOURCE(IdTEKEnd)); |
| 165 |
|
|
if (TEKEnd==NULL) Err = TRUE; |
| 166 |
|
|
|
| 167 |
|
|
if (Err) |
| 168 |
|
|
{ |
| 169 |
|
|
FreeLibrary(HTTTEK); |
| 170 |
|
|
HTTTEK = NULL; |
| 171 |
|
|
} |
| 172 |
|
|
return (! Err); |
| 173 |
|
|
} |
| 174 |
|
|
|
| 175 |
|
|
void FreeTTTEK() |
| 176 |
|
|
{ |
| 177 |
|
|
if (HTTTEK!=NULL) |
| 178 |
|
|
{ |
| 179 |
|
|
FreeLibrary(HTTTEK); |
| 180 |
|
|
HTTTEK = NULL; |
| 181 |
|
|
} |
| 182 |
|
|
} |