diff --git a/support/dll/al100.dll b/support/dll/al100.dll new file mode 100755 index 000000000..b2c385e53 Binary files /dev/null and b/support/dll/al100.dll differ diff --git a/support/dll/cb5.dll b/support/dll/cb5.dll new file mode 100755 index 000000000..d7ade2756 Binary files /dev/null and b/support/dll/cb5.dll differ diff --git a/support/dll/devprn.dll b/support/dll/devprn.dll new file mode 100755 index 000000000..ba02bdfc8 Binary files /dev/null and b/support/dll/devprn.dll differ diff --git a/support/dll/dllgfm.dll b/support/dll/dllgfm.dll new file mode 100755 index 000000000..e020c7177 Binary files /dev/null and b/support/dll/dllgfm.dll differ diff --git a/support/dll/hardlock.vxd b/support/dll/hardlock.vxd new file mode 100755 index 000000000..da4ff712a Binary files /dev/null and b/support/dll/hardlock.vxd differ diff --git a/support/dll/prochook.dll b/support/dll/prochook.dll new file mode 100755 index 000000000..b41d820d9 Binary files /dev/null and b/support/dll/prochook.dll differ diff --git a/support/dll/raw.drv b/support/dll/raw.drv new file mode 100755 index 000000000..8787a32d3 Binary files /dev/null and b/support/dll/raw.drv differ diff --git a/support/dll/readme b/support/dll/readme new file mode 100755 index 000000000..f7754b01f --- /dev/null +++ b/support/dll/readme @@ -0,0 +1,22 @@ +Posizionamento e descrizione di DRV, DLL e VXD +---------------------------------------------- + +I seguenti files vanno installati nel direttorio PRASSI: + +AL100.DLL Libreria per compressione/decompressione/archiviazione +CB5.DLL Libreria per accesso ai files in formato FoxPRO +DEVPRN.DLL Libreria per eseguire la stampa di una singola riga senza form-feed (Windows 3.1 e Windows95) +DLLGFM.DLL Libreria per accesso alle funzioni matematiche Green-Leaf +PROCHOOK.DLL Libreria per eseguire piu' istanze di una stessa applicazione a 16-bit (Windows 3.1 e Windows95) +RAW.DRV Driver per l'accesso "grezzo" ai device di stampa (usata da DEVPRN.DLL) +WINSOCK.DLL Libreria per accesso alle funzioni di rete (Win sockets: Windows 3.1 e Windows95) +XWMBA403.DLL Libreria per accesso alle funzioni XVT +XWMHN403.DLL Libreria per accesso alle funzioni XVT +XWMTE403.DLL Libreria per accesso alle funzioni XVT + +I seguenti files vanno installati nel direttorio WINDOWS\SYSTEM: + +HARDLOCK.VXD Device Driver per accedere alla chiave di protezione (Windows 3.1 e Windows95) + Nota: i programmi PRASSI sotto Windows 3.1 non necessitano di HARDLOCK.VXD + ma tutti quelli che fanno uso di HARDLOCK.FLL (Nota Integrativa) SI'. + diff --git a/support/dll/winsock.dll b/support/dll/winsock.dll new file mode 100755 index 000000000..4bbc5c07b Binary files /dev/null and b/support/dll/winsock.dll differ diff --git a/support/dll/xwmba403.dll b/support/dll/xwmba403.dll new file mode 100755 index 000000000..caaad88ba Binary files /dev/null and b/support/dll/xwmba403.dll differ diff --git a/support/dll/xwmhn403.dll b/support/dll/xwmhn403.dll new file mode 100755 index 000000000..0e946440f Binary files /dev/null and b/support/dll/xwmhn403.dll differ diff --git a/support/dll/xwmte403.dll b/support/dll/xwmte403.dll new file mode 100755 index 000000000..4f000dfd9 Binary files /dev/null and b/support/dll/xwmte403.dll differ diff --git a/support/esterni/dummy.ldb b/support/esterni/dummy.ldb new file mode 100755 index 000000000..75cf849b7 Binary files /dev/null and b/support/esterni/dummy.ldb differ diff --git a/support/esterni/dummy.mdb b/support/esterni/dummy.mdb new file mode 100755 index 000000000..8526fa701 Binary files /dev/null and b/support/esterni/dummy.mdb differ diff --git a/support/esterni/msaes110.dll b/support/esterni/msaes110.dll new file mode 100755 index 000000000..557655c43 Binary files /dev/null and b/support/esterni/msaes110.dll differ diff --git a/support/esterni/msajt112.dll b/support/esterni/msajt112.dll new file mode 100755 index 000000000..97cb66ec3 Binary files /dev/null and b/support/esterni/msajt112.dll differ diff --git a/support/esterni/msajt200.dll b/support/esterni/msajt200.dll new file mode 100755 index 000000000..d384c852c Binary files /dev/null and b/support/esterni/msajt200.dll differ diff --git a/support/esterni/readme b/support/esterni/readme new file mode 100755 index 000000000..823cf5abc --- /dev/null +++ b/support/esterni/readme @@ -0,0 +1,42 @@ +Posizionamento e descrizione dei files in installazione +------------------------------------------------------- +I seguenti files vanno installati nel direttorio PRASSI + +CB0000.EXE +TRRICE.EXE +VCOPIA.EXE +DUMMY.LDB +DUMMY.MDB +MSAES110.DLL +MSAJT112.DLL +MSAJT200.DLL +VBDB300.DLL +VBRUN300.DLL +XBS200.DLL + +Inoltre per ogni file exe qui presente, va creato nel direttorio +WINDOWS, il rispettivo file INI. Pertanto avremo: + +CB0000.INI +TRRICE.INI +VCOPIA.INI + +Il contenuto di questi 3 file e' lo stesso per tutti e 3: + +[Installable ISAMs] +FoxPro 2.0=<<>>xbs200.dll +FoxPro 2.5=<<>>xbs200.dll +dBASE III=<<>>xbs200.dll +dBASE IV=<<>>xbs200.dll + +[dBase ISAM] +Deleted=On + +[Paradox ISAM] +ParadoxNetStyle=3.x + + +Il parametro <<>> va sostituito con +il path corretto in installazione. La creazione di questi +files va effettuata SEMPRE, anche in aggiunta posto di lavoro. + diff --git a/support/esterni/vbdb300.dll b/support/esterni/vbdb300.dll new file mode 100755 index 000000000..644a385b5 Binary files /dev/null and b/support/esterni/vbdb300.dll differ diff --git a/support/esterni/vbrun300.dll b/support/esterni/vbrun300.dll new file mode 100755 index 000000000..81d20c61d Binary files /dev/null and b/support/esterni/vbrun300.dll differ diff --git a/support/esterni/xbs200.dll b/support/esterni/xbs200.dll new file mode 100755 index 000000000..74e5ed008 Binary files /dev/null and b/support/esterni/xbs200.dll differ diff --git a/support/faxman/class1.dat b/support/faxman/class1.dat new file mode 100755 index 000000000..914f73381 Binary files /dev/null and b/support/faxman/class1.dat differ diff --git a/support/faxman/class2.dat b/support/faxman/class2.dat new file mode 100755 index 000000000..d032f1e3d Binary files /dev/null and b/support/faxman/class2.dat differ diff --git a/support/faxman/class20.dat b/support/faxman/class20.dat new file mode 100755 index 000000000..3c9fd719a Binary files /dev/null and b/support/faxman/class20.dat differ diff --git a/support/faxman/cover1.pg b/support/faxman/cover1.pg new file mode 100755 index 000000000..fa75d8aad Binary files /dev/null and b/support/faxman/cover1.pg differ diff --git a/support/faxman/cover2.pg b/support/faxman/cover2.pg new file mode 100755 index 000000000..3ef2fdb5b Binary files /dev/null and b/support/faxman/cover2.pg differ diff --git a/support/faxman/faxdll.dll b/support/faxman/faxdll.dll new file mode 100755 index 000000000..3835fd39a Binary files /dev/null and b/support/faxman/faxdll.dll differ diff --git a/support/faxman/faxman.fmf b/support/faxman/faxman.fmf new file mode 100755 index 000000000..eafff94ef Binary files /dev/null and b/support/faxman/faxman.fmf differ diff --git a/support/faxman/fmfaxdrv.drv b/support/faxman/fmfaxdrv.drv new file mode 100755 index 000000000..ab199338e Binary files /dev/null and b/support/faxman/fmfaxdrv.drv differ diff --git a/support/faxman/im10bmp.dil b/support/faxman/im10bmp.dil new file mode 100755 index 000000000..4b5de6b75 Binary files /dev/null and b/support/faxman/im10bmp.dil differ diff --git a/support/faxman/im10fax.dil b/support/faxman/im10fax.dil new file mode 100755 index 000000000..783413130 Binary files /dev/null and b/support/faxman/im10fax.dil differ diff --git a/support/faxman/im10pcx.dil b/support/faxman/im10pcx.dil new file mode 100755 index 000000000..30c78e01b Binary files /dev/null and b/support/faxman/im10pcx.dil differ diff --git a/support/faxman/im10tif.dil b/support/faxman/im10tif.dil new file mode 100755 index 000000000..88d243920 Binary files /dev/null and b/support/faxman/im10tif.dil differ diff --git a/support/faxman/im10xfax.del b/support/faxman/im10xfax.del new file mode 100755 index 000000000..d1de58055 Binary files /dev/null and b/support/faxman/im10xfax.del differ diff --git a/support/faxman/readme b/support/faxman/readme new file mode 100755 index 000000000..a89d06b79 --- /dev/null +++ b/support/faxman/readme @@ -0,0 +1,48 @@ +Posizionamento e descrizione per installazione di FAXMAN +-------------------------------------------------------- + +Aggiunte da fare al file WIN.INI per installare il +programma di gestione fax: + +[ports] +EASYFAX= + +[FaxMan,EASYFAX] +Application=<<<>>>bafax.exe + +[Printer Ports] +FaxMan=fmfaxdrv,EASYFAX,5,5 + +[devices] +FaxMan=fmfaxdrv,EASYFAX + +Nota: BAFAX.EXE e' un programma sviluppato internamente, che si occupa + dello spooling e della gestione dei documenti da inviare a FAXMAN.EXE. + I suoi sorgenti sono in BA + + +I seguenti files vanno installati nel direttorio PRASSI + +FAXMAN.EXE +FAXMAN.FMF +COVER1.PG +COVER2.PG +FAXDLL.DLL +IM10XFAX.DEL +IM10FAX.DIL +IM10TIF.DIL +IM10BMP.DIL +IM10PCX.DIL +CLASS2.DAT +CLASS20.DAT +CLASS1.DAT + + +I seguenti files vanno installati in WINDOWS\SYSTEM + +FMFAXDRV.DRV + + +La directory di faxman (c:\prassi) deve essere nel path. + + diff --git a/support/interni/aga.fll b/support/interni/aga.fll new file mode 100755 index 000000000..a00a9f1ff Binary files /dev/null and b/support/interni/aga.fll differ diff --git a/support/interni/aga16.dll b/support/interni/aga16.dll new file mode 100755 index 000000000..bf236129f Binary files /dev/null and b/support/interni/aga16.dll differ diff --git a/support/interni/aga32.dll b/support/interni/aga32.dll new file mode 100755 index 000000000..79f87d7da Binary files /dev/null and b/support/interni/aga32.dll differ diff --git a/support/interni/agaexec.dll b/support/interni/agaexec.dll new file mode 100755 index 000000000..9c7823ff8 Binary files /dev/null and b/support/interni/agaexec.dll differ diff --git a/support/interni/agalight.fll b/support/interni/agalight.fll new file mode 100755 index 000000000..9e9c5b9a8 Binary files /dev/null and b/support/interni/agalight.fll differ diff --git a/support/interni/dumb.dll b/support/interni/dumb.dll new file mode 100755 index 000000000..4eeb74aaa Binary files /dev/null and b/support/interni/dumb.dll differ diff --git a/support/interni/dumb.fll b/support/interni/dumb.fll new file mode 100755 index 000000000..5b9e2c49f Binary files /dev/null and b/support/interni/dumb.fll differ diff --git a/support/interni/dumbvb.dll b/support/interni/dumbvb.dll new file mode 100755 index 000000000..dd0d3923f Binary files /dev/null and b/support/interni/dumbvb.dll differ diff --git a/support/interni/hardlock.dll b/support/interni/hardlock.dll new file mode 100755 index 000000000..0480a8fc3 Binary files /dev/null and b/support/interni/hardlock.dll differ diff --git a/support/interni/hardlock.fll b/support/interni/hardlock.fll new file mode 100755 index 000000000..a2a78d0a5 Binary files /dev/null and b/support/interni/hardlock.fll differ diff --git a/support/interni/readme b/support/interni/readme new file mode 100755 index 000000000..a280060b3 --- /dev/null +++ b/support/interni/readme @@ -0,0 +1,55 @@ +Descrizione dei files +--------------------- +I seguenti files sono files di supporto per applicaazioni esterne +realizzate in Visual Basic, FoxPro, Visual FoxPro e altri. +Vanno installati nel direttorio PRASSI. + + Libreria Descrizione Usata da... + + aga.fll Libreria FoxPro (16 bit) per leggere files Vecchie applicazioni + dichiarazioni; Automaz.Ufficio + + aga16.dll Libreria Thunking per win32s (va con aga32.dll) + per eseguire lo spawn sincrono dei programmi Applicazioni SESA, MIVA + + aga32.dll Libreria 32bit con aga_exec() esportata + per piattaforme solo 32 bit (win95 winnt) Applicazioni SESA, MIVA + + agaexec.dll Libreria 16 bit aga_exec() esportata Cespiti PRASSI + + agalight.fll Libreria FoxPro con aga_exec() esportata Dichiarazioni Automaz.Ufficio, + GICI PRASSI + + hardlock.dll Libreria per leggere autorizzazioni chiave Programmi VisualBasic: VCOPIA.EXE, + (vecchio metodo tramite GetAut()) TRRICE.EXE, CB0000.EXE + + hardlock.fll Libreria FoxPro per legegre autorizzazioni Tutte le applicazioni FoxPro/VisualFoxPro + chiave (vecchio metodo tramite GetAut()) tranne quelle PROCOM. + + dumb.dll Libreria per leggere autorizzazioni moduli Nessuno + memorizzati sulla chiave (nuovo metodo con + crittografazione e un poco di scramble) + + dumb.fll Libreria FoxPro per leggere autorizzazione Applicazioni PROCOM + moduli memorizzati sulla chiave (nuovo + metodo con crittografazione) + + dumbvb.dll Liberia Visual Basic per leggere autorizzaz- Applicazioni PROCOM + zioni moduli (nuovo metodo con crittografazione) + + dump16.exe Applicazione MFC 16-bit ODBC per leggere i Cespiti PRASSI tramite CE0.EXE + dati ditta per collegamento CESPITI SESA + + dump32.exe Applicazione MFC 32-bit ODBC per leggere i Cespiti PRASSI tramite CE0.EXE + dati ditta per collegamanto CESPITI SESA + +I sorgenti per tutte le DLL/FLL sono nel direttorio SRC qui presente: + il direttorio AGA contiene i sorgenti per DLL/FLL che iniziano con AGA + il direttorio DUMB contiene i sorgenti per DLL/FLL che iniziano con DUMB o HARDLOCK. +I sorgenti per dump16.exe dump32.exe sono nel modulo CE. +dump16.exe viene compilato con Visual C++ 1.5, dump32.exe deve venire compilato +con Visual C++ 5.0; per creare un progetto basta entrare nel wizard ed +aggiungere i files settare la versione di RELEASE e lanciare la compilazione. +Analogamente per AGA32.DLL: entrare nel wizard, settare il progetto di RELEASE +per una DLL a 32 bits, settare le macro: /DDLL /DLIGHT. La macro /DWIN32 e' +settata automaticamente. diff --git a/support/interni/src/aga/aga.cpp b/support/interni/src/aga/aga.cpp new file mode 100755 index 000000000..58f5f51be --- /dev/null +++ b/support/interni/src/aga/aga.cpp @@ -0,0 +1,1094 @@ +#include + +#ifdef WIN32 +#define W32SUT_32 // Required for universal thunking under Win32s +#endif + +#include +#ifndef WIN32 + #include +#else + #include "w32sut.h" // Required for universal thunking under Win32s + #define SYNCHSPAWN 1 +#endif + +#define DLL_OR_LIGHT (LIGHT || DLL) + +#ifndef DLL_OR_LIGHT +#include +#include +#include +#else +#include +#include +#include +#ifndef WIN32 +#include +#endif +#endif + +#ifndef DLL +#include "../foxlck/pro_ext.h" +#endif + +#ifdef DLL_OR_LIGHT + +static char cprefix[81]=""; +static char __ptprf[81]=""; + +#ifdef DLL +static char __prfpth[81]=""; +static char __user[17]=""; +static char __tmpdir[256]=""; +#endif + +#ifdef WIN32 +#define EXPORT32 +#define EXPORT16 + +HWND HWin; + +typedef BOOL (WINAPI * PUTREGISTER) ( HANDLE hModule, + LPCSTR lpsz16BitDLL, + LPCSTR lpszInitName, + LPCSTR lpszProcName, + UT32PROC* ppfn32Thunk, + FARPROC pfnUT32CallBack, + LPVOID lpBuff + ); + +typedef VOID (WINAPI * PUTUNREGISTER) (HANDLE hModule); +//typedef DWORD (APIENTRY * PUT32CBPROC) (LPVOID lpBuff, DWORD dwUserDefined, LPVOID *lpTranslationList); + +UT32PROC pfnUTProc = NULL; +PUTREGISTER pUTRegister = NULL; +PUTUNREGISTER pUTUnRegister = NULL; +FARPROC pfnUT32CBProc = NULL; +int cProcessesAttached = 0; +BOOL fWin32s = FALSE; +HANDLE hKernel32 = 0; +#else +#define EXPORT16 far pascal _export +#define EXPORT32 +#endif + +#ifndef DLL +static bool get_fox(const char* var, char* val) +{ + *val = '\0'; + + const NTI nti = _NameTableIndex((char*)var); + if (nti >= 0) + { + Locator loc; + if (_FindVar(nti, -1, &loc)) // Find memory variable + { + Value value; + _Load(&loc, &value); + if (value.ev_type == 'C') + { + const char* p = (const char*)_HandToPtr(value.ev_handle); + if (*p > ' ') + strcpy(val, p); + } + } + } + + return *val != '\0'; +} +#endif + +//#ifndef WIN32 +static char _tmp[256]; + +static char* prefname() +{ +#ifndef DLL + if (!get_fox("PREFPATH", _tmp)) + strcpy(_tmp, "prefix.txt"); + + return _tmp; +#else + return __prfpth; +#endif +} + +static const char* username() +{ +#ifndef DLL + if (!get_fox("USER", _tmp)) + strcpy(_tmp, "PRASSI"); + return _tmp; +#else + return __user; +#endif +} + +static const char* tempdir() +{ + char user[16]; + strncpy(user, username(), 16); +#ifndef DLL + if (!get_fox("TEMPDIR", _tmp)) + strcpy(_tmp, "\\tmp"); +#else + if (__tmpdir[0] == '\0') + strcpy(_tmp,"\\tmp"); + else + strcpy(_tmp,__tmpdir); +#endif + if (access(_tmp,0)!=0) + mkdir(_tmp); + + strcat(_tmp, "\\"); strcat(_tmp, user); + if (access(_tmp,0)!=0) + mkdir(_tmp); + + return _tmp; +} + + +static char *CGetPref() + +{ + const char* p = prefname(); + FILE *f = fopen(p, "r"); + + if (f == NULL) + { + strcpy(cprefix, ""); + } + else + { + if (fgets(cprefix, 42, f) != NULL) + { + const int len = strlen(cprefix)-1; + if (len >= 0 && cprefix[len] <= ' ') cprefix[len] = '\0'; + } + else + *cprefix = '\0'; + fclose(f); + } + { + const char* p = "pathpref.ini"; + FILE* f = fopen(p, "r"); + if (f != NULL) + { + if (fgets(__ptprf, 42, f) != NULL) + { + const int len = strlen(__ptprf)-1; + if (len >= 0 && __ptprf[len] <= ' ') + { + __ptprf[len] = '\0'; + if (len > 0) strcat(__ptprf, "/"); + } + } + else + *__ptprf = '\0'; + fclose(f); + } + } + if (*__ptprf) + { + char ws[200]; + sprintf(ws, "%s%s", __ptprf, cprefix); + strcpy(cprefix, ws); + } + return(cprefix); +} +//#endif // WIN32 + +#else +extern const char* tempdir(); +#endif + +#ifdef DBG +#ifdef DLL +#define BREAK __asm \ +{ \ + int 3h \ +} +#else +#define BREAK _BreakPoint() +#endif +#else +#define BREAK +#endif + +#ifndef DLL_OR_LIGHT +const int MAXFILE = 128; +TLocalisamfile FAR* file[MAXFILE]; +TLocalisamfile FAR* use = NULL; +bool exact = FALSE; +bool old_tab = TRUE; +#endif + +#ifndef DLL +/////////////////////////////////////////////////////////// +// Foxpro utility functions +/////////////////////////////////////////////////////////// + +static Value* pop_value(ParamBlk FAR *parm = NULL) +{ + static ParamBlk FAR* block = NULL; + static int curr = 0; + + if (parm != NULL) + { + block = parm; + curr = 0; + } + +#ifdef DBG + if (block == NULL) + { + //fatal_box("Blocco parametri nullo"); + return NULL; + } +#endif + + return &(block->p[curr++].val); +} + + +static long pop_int(ParamBlk FAR *pb = NULL) +{ + Value* val = pop_value(pb); + long num = 0; + if (val && val->ev_type == 'I') + num = val->ev_long; + return num; +} + +static long pop_bool(ParamBlk FAR *pb = NULL) +{ + Value* val = pop_value(pb); + bool on = FALSE; + if (val && val->ev_type == 'L') + on = val->ev_length != 0; + return on; +} + +static char FAR* pop_str(ParamBlk FAR *pb = NULL) +{ + Value* val = pop_value(pb); + char FAR* str = ""; + if (val && val->ev_type == 'C') + str = (char*)_HandToPtr(val->ev_handle); + return str; +} + +#ifndef LIGHT +static TLocalisamfile* pop_file(ParamBlk FAR *pb) +{ + int logicnum = (int)pop_int(pb); + + TLocalisamfile* f = NULL; + if (logicnum > 0 && logicnum < MAXFILE) + f = file[logicnum]; + else + f = use; + + if (f == NULL) + fatal_box("Il file %d non e' aperto", logicnum); + return f; +} +#endif + +static int ret_bool(unsigned char b) +{ + _RetLogical(b); + return b; +} + + +static int ret_int(long l) +{ + _RetInt(l, 10); + return (int)l; +} +#endif + +static int ret_err(int err) +{ + if (err > 0) err += 5000; +#ifdef DLL + return err; +#else + return ret_int(err); +#endif +} + + +#ifndef DLL +static int ret_str(const char* s) +{ + _RetChar((char FAR*)s); + return *s; +} +#endif + +extern "C" { + +/////////////////////////////////////////////////////////// +// Setup functions +/////////////////////////////////////////////////////////// + +int FAR Aga_init() +{ + BREAK; +#ifndef DLL_OR_LIGHT + for (int i = 0; i < MAXFILE; i++) file[i] = NULL; + init_global_vars(); +#endif +#ifndef WIN32 + CGetPref(); +#endif + return TRUE; +} + +int FAR Aga_exit() +{ +#ifndef DLL_OR_LIGHT + for (int i = 0; i < MAXFILE; i++) if (file[i] != NULL) + { + delete file[i]; + file[i] = NULL; + } + free_global_vars(); +#endif + return TRUE; +} + +/////////////////////////////////////////////////////////// +// Utility Functions +/////////////////////////////////////////////////////////// +#ifdef DLL +EXPORT32 int EXPORT16 Aga_setvar(const char* p, const char* u, const char* t) +{ + strcpy(__prfpth,p); + strcpy(__user,u); + strcpy(__tmpdir,t); + CGetPref(); + return TRUE; +} +#endif + +#ifdef DLL +EXPORT32 int EXPORT16 Aga_wakeup() +#else +int FAR Aga_wakeup(ParamBlk FAR *pb) +#endif +{ + const UINT WM_WAKEUP = RegisterWindowMessage("WAKEUP"); + SendMessage(HWND_BROADCAST, WM_WAKEUP, 0, 0); +#ifdef DLL + return TRUE; +#else + return ret_bool(TRUE); +#endif +} + +#ifdef DLL +#ifdef WIN32 +static DWORD SynchSpawn (LPCSTR lpszCmdLine, UINT nCmdShow) +{ + DWORD Args[2]; + PVOID Translist[2]; + + Args[0] = (DWORD) lpszCmdLine; + Args[1] = (DWORD) nCmdShow; + + Translist[0] = &Args[0]; + Translist[1] = NULL; + return ( (* pfnUTProc) ( Args, SYNCHSPAWN, Translist) ); +} +#endif +#endif + + +#ifdef DLL +EXPORT32 int EXPORT16 Aga_exec(const char* p) +#else +int FAR Aga_exec(ParamBlk FAR *pb) +#endif +{ +#ifndef WIN32 + const word WM_WAKEUP = RegisterWindowMessage("WAKEUP"); + +#ifndef DLL + const char* p = pop_str(pb); +#endif + const HINSTANCE inst = WinExec(p, SW_SHOW); + const BOOL ok = inst >= 32; + + if (ok) + { + HTASK child = NULL; + TASKENTRY te; te.dwSize = sizeof(TASKENTRY); + for (bool ok = TaskFirst(&te); ok && child == NULL; ok = TaskNext(&te)) + if (te.hInst == inst) + { + child = te.hTask; + break; + } + + BOOL again = TRUE; + MSG msg; + + for (byte i = 0; again; i++) + {/* Esegue la TaskFindHandle ogni 256 cicli */ + if (i == 0 && ok && TaskFindHandle(&te, child) == FALSE) + break; + while (PeekMessage(&msg, NULL, 0,0, PM_REMOVE) && again) + { + if (msg.message == WM_QUIT || + (msg.message == WM_WAKEUP && msg.wParam == child)) + again=FALSE; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + } +#ifdef DLL + return ok; +#else + return ret_bool(ok); +#endif +#else + DWORD dwVersion,dwWindowsMajorVersion,dwWindowsMinorVersion; + BOOL is_win32s=FALSE; + dwVersion = GetVersion(); + + dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); + dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); + + + if ( ! (dwVersion < 0x80000000) && (dwWindowsMajorVersion < 4)) // That's Win32s, my dear! + is_win32s = TRUE; + STARTUPINFO StartupInfo= {0}; + PROCESS_INFORMATION ProcessInfo; + + if (is_win32s) // Oh, Sky's God! That's Win32s! + SynchSpawn(p,SW_SHOWNORMAL); + else // This is Windows NT or Windows95. + { + StartupInfo.cb = sizeof(STARTUPINFO); + if (CreateProcess(NULL,(char*)p,NULL,NULL,FALSE,0,NULL,NULL,&StartupInfo,&ProcessInfo)) + { + DWORD result; + MSG msg; + WaitForInputIdle(ProcessInfo.hProcess,INFINITE); + for (BYTE i = 0; ; i++) + { + if (i==0) + { + GetExitCodeProcess(ProcessInfo.hProcess,&result); + if (result != STILL_ACTIVE) break; + } + GetMessage(&msg, (HWND)NULL, 0, 0); + } + } + else + return FALSE; + } + return TRUE; +#endif // WIN32 +} + +/////////////////////////////////////////////////////////// +// ISAM Funtions +/////////////////////////////////////////////////////////// + +#ifdef DLL +EXPORT32 const char * EXPORT16 Aga_workdir() +#else +int FAR Aga_workdir(ParamBlk FAR *pb) +#endif +{ + char park[81]; + const int len = strlen(cprefix); + int j=0; + for (int i=0; i0 && park[j-1]=='\\') continue; + park[j++] = c; + } + if (park[j-1]=='\\') j--; + park[j]='\0'; + strcpy(cprefix,park); +#ifdef DLL + return cprefix; +#else + return ret_str(cprefix); +#endif +} + +#ifndef DLL_OR_LIGHT +int FAR Aga_open(ParamBlk FAR *pb) +{ + const int logicnum = (int)pop_int(pb); + + if (logicnum < 0 || logicnum >= MAXFILE) + return ret_err(81); + + if (file[logicnum] != NULL) + return ret_err(222); + + TLocalisamfile* f = new TLocalisamfile(logicnum); + if (f == NULL) + return ret_err(81); + + file[logicnum] = f; + return ret_err(0); +} + +int FAR Aga_opentmp(ParamBlk FAR *pb) +{ + const int logicnum = (int)pop_int(pb); + const int create = (int)pop_int(); + + if (logicnum < 0 || logicnum >= MAXFILE) + return ret_err(81); + + if (use != NULL) + return ret_err(222); + + // Apre tracciati record! + if (file[logicnum] == NULL) + { + TLocalisamfile* f = new TLocalisamfile(logicnum); + if (f == NULL) + return ret_err(81); + file[logicnum] = f; + } + + TString256 t; + t << "%" << tempdir() << "\\tmp" << logicnum; + use = new TIsamtempfile(logicnum, t, create); + if (use == NULL) + return ret_err(81); + + return ret_err(0); +} + + +int FAR Aga_close(ParamBlk FAR *pb) +{ + const int logicnum = (int)pop_int(pb); + + TLocalisamfile* f = NULL; + if (logicnum > 0) + { + f = file[logicnum]; + file[logicnum] = NULL; + } + else + { + f = use; + use = NULL; + } + + if (f == NULL) + return ret_err(220); + + delete f; + return ret_err(NOERR); +} + + +int FAR Aga_key(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + + const int key = (int)pop_int(); + if (key < 1) return ret_err(211); + + f->setkey(key); + return ret_err(NOERR); +} + +int FAR Aga_zero(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + f->curr().zero(); + return ret_err(NOERR); +} + +static void put(TLocalisamfile* f, const TString& name, const char* value) +{ + int err = NOERR; + + if (old_tab && name == "CODTAB") + { + char cod[4]; + strncpy(cod, value, 3); cod[3] = '\0'; + f->curr().put("COD", cod); + f->curr().put("CODTAB", value+3); + } + else + f->curr().put(name, value); +} + +static int get(const TLocalisamfile* f, const TString& name) +{ + static char value[80]; + if (old_tab && name == "CODTAB") + { + strcpy(value, f->curr().get_str("COD")); + strcat(value, f->curr().get_str(name)); + return ret_str(value); + } + + return ret_str(f->curr().get_str(name)); +} + +int FAR Aga_set(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + + const TString16 name(pop_str()); + const TString256 value(pop_str()); + put(f, name, value); + return ret_err(NOERR); +} + +int FAR Aga_get(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_str(""); + + const TString16 name(pop_str()); + return get(f, name); +} + +int FAR Aga_exact(ParamBlk FAR *pb) +{ + exact = (bool)pop_bool(pb); + return TRUE; +} + +int FAR Aga_setopt(ParamBlk FAR *pb) +{ + const TFixed_string opt(pop_str(pb)); + const long val = pop_int(); + + bool ok = FALSE; + if (opt == "OLDTAB") { old_tab = (bool)val; ok = TRUE; } else + if (opt == "EXACT") { exact = (bool)val; ok = TRUE; } + return ret_bool(ok); +} + +int FAR Aga_getopt(ParamBlk FAR *pb) +{ + const TFixed_string opt(pop_str(pb)); + long val = 0L; + if (opt == "OLDTAB") { val = old_tab; } else + if (opt == "EXACT") { val = exact; } + + return ret_int(val); +} + + +int FAR Aga_read(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + return ret_err(f->read(exact ? _isequal : _isgteq)); +} + +int FAR Aga_next(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + return ret_err(f->next()); +} + +int FAR Aga_prev(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + return ret_err(f->prev()); +} + +int FAR Aga_write(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + return ret_err(f->write()); +} + +int FAR Aga_rewrite(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + return ret_err(f->rewrite()); +} + +int FAR Aga_first(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + return ret_err(f->first()); +} + +int FAR Aga_last(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + return ret_err(f->last()); +} + + +int FAR Aga_eof(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_bool(TRUE); + return ret_bool(f->eof()); +} + +int FAR Aga_bof(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_bool(FALSE); + return ret_bool(f->bof()); +} + +int FAR Aga_status(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + return ret_err(f->status()); +} + +int FAR Aga_lock(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + return ret_err(f->reread(_lock)); +} + +int FAR Aga_unlock(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + return ret_err(f->reread(_unlock)); +} + +int FAR Aga_recno(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_int(-1); + return ret_int(f->recno()); +} + +int FAR Aga_goto(ParamBlk FAR *pb) +{ + TLocalisamfile* f = pop_file(pb); + if (f == NULL) return ret_err(220); + const long n = pop_int(); + return ret_err(f->readat(n, _nolock)); +} + +/////////////////////////////////////////////////////////// +// Clipper like funtions +/////////////////////////////////////////////////////////// + +int FAR Fox_select(ParamBlk FAR *pb) +{ + const int logicnum = (int)pop_int(pb); + + if (logicnum < 0 || logicnum >= MAXFILE) + return ret_err(81); + + if (use) delete use; + use = new TLocalisamfile(logicnum); + return ret_bool(use != NULL); +} + +int FAR Fox_unselect(ParamBlk FAR *pb) +{ + if (use) + { + delete use; + use = NULL; + return ret_bool(TRUE); + } + return ret_bool(FALSE); +} + +int FAR Fox_key(ParamBlk FAR *pb) +{ + if (use == NULL) fatal_box("Nessun file selezionato"); + int key = (int)pop_int(pb); + + if (key > 0) use->setkey(key); + else fatal_box("Numero di chiave errato: %d", key); + + return ret_bool(TRUE); +} + +int FAR Fox_reset(ParamBlk FAR *pb) +{ + if (use == NULL) fatal_box("Nessun file selezionato"); + use->curr().zero(); + return ret_bool(TRUE); +} + + +int FAR Fox_set(ParamBlk FAR *pb) +{ + if (use == NULL) fatal_box("Nessun file selezionato"); + const TString16 name(pop_str(pb)); + const TString80 value(pop_str()); + put(use, name, value); + return ret_bool(TRUE); +} + +int FAR Fox_get(ParamBlk FAR *pb) +{ + if (use == NULL) fatal_box("Nessun file selezionato"); + const TFixed_string name(pop_str(pb)); + return get(use, name); +} + + +int FAR Fox_show(ParamBlk FAR *pb) +{ + if (use == NULL) fatal_box("Nessun file selezionato"); + TRectype& r = use->curr(); + + const char* name; + for (int i = 0; (name = r.fieldname(i)) != NULL; i++) + { + _PutStr((char*)(const char*)r.get_str(name)); + _PutChr('\t'); + } + + return TRUE; +} + + +int FAR Fox_struct(ParamBlk FAR *pb) +{ + if (use == NULL) fatal_box("Nessun file selezionato"); + TRectype& r = use->curr(); + + const char* name = ""; + const char* type = ""; + char s[80]; + + for (int i = 0; (name = r.fieldname(i)) != NULL; i++) + { + switch(r.type(name)) + { + case _nullfld: type = "NULL"; break; + case _alfafld: type = "CHAR"; break; + case _datefld: type = "DATE"; break; + default : type = "REAL"; break; + } + sprintf(s, "%16s %4s %3d\n", name, type, r.length(name)); + _PutStr(s); + } + + return TRUE; +} + + +int FAR Fox_find(ParamBlk FAR *pb) +{ + if (use == NULL) fatal_box("Nessun file selezionato"); + return ret_bool(use->read(_isgteq) == NOERR); +} + +int FAR Fox_skip(ParamBlk FAR *pb) +{ + if (use == NULL) fatal_box("Nessun file selezionato"); + int skip = (int)pop_int(pb); + + if (skip > 0) + { + for (int i = 0; i < skip; i++) use->next(); + return ret_bool(!use->eof()); + } else + if (skip < 0) + { + for (int i = 0; i > skip; i--) use->prev(); + return ret_bool(!use->bof()); + } + + return ret_bool(TRUE); +} + + +int FAR Fox_store(ParamBlk FAR *pb) +{ + if (use == NULL) fatal_box("Nessun file selezionato"); + return ret_bool(use->write() == NOERR); +} + +int FAR Fox_eof(ParamBlk FAR *pb) +{ + if (use == NULL) fatal_box("Nessun file selezionato"); + return ret_bool(use->eof()); +} + +int FAR Fox_bof(ParamBlk FAR *pb) +{ + if (use == NULL) fatal_box("Nessun file selezionato"); + return ret_bool(use->bof()); +} +#endif +/////////////////////////////////////////////////////////// +// Foxpro export tables +/////////////////////////////////////////////////////////// + +#ifndef DLL +FoxInfo AgaFoxInfo[] = +{ +#ifndef LIGHT + { "A_BOF", (FPFI)Aga_bof, 1, "I" }, + { "A_CLOSE", (FPFI)Aga_close, 1, "I" }, + { "A_EOF", (FPFI)Aga_eof, 1, "I" }, + { "A_EXACT", (FPFI)Aga_exact, 1, "L" }, +#endif + { "A_EXEC", (FPFI)Aga_exec, 1, "C" }, + { "A_EXIT", (FPFI)Aga_exit, CALLONUNLOAD, "" }, +#ifndef LIGHT + { "A_GET", (FPFI)Aga_get, 2, "I,C" }, + { "A_GOTO", (FPFI)Aga_goto, 2, "I,I" }, + { "A_STATUS", (FPFI)Aga_status, 1, "I" }, + { "A_FIRST", (FPFI)Aga_first, 1, "I" }, + { "A_LAST", (FPFI)Aga_last, 1, "I" }, + { "A_KEY", (FPFI)Aga_key, 2, "I,I" }, +#endif + { "A_INIT", (FPFI)Aga_init, CALLONLOAD, "" }, +#ifndef LIGHT + { "A_NEXT", (FPFI)Aga_next, 1, "I" }, + { "A_SETOPT", (FPFI)Aga_setopt, 2, "C,I" }, + { "A_GETOPT", (FPFI)Aga_getopt, 1, "C" }, + { "A_OPEN", (FPFI)Aga_open, 1, "I" }, + { "A_OPENTMP", (FPFI)Aga_opentmp, 2, "I,I" }, + { "A_PREV", (FPFI)Aga_prev, 1, "I" }, + { "A_READ", (FPFI)Aga_read, 1, "I" }, + { "A_SET", (FPFI)Aga_set, 3, "I,C,C" }, +#endif + { "A_WAKEUP", (FPFI)Aga_wakeup, 0, "" }, + { "A_WORKDIR", (FPFI)Aga_workdir, 0, "" }, +#ifndef LIGHT + { "A_WRITE", (FPFI)Aga_write, 1, "I" }, + { "A_RECNO", (FPFI)Aga_recno, 1, "I" }, + { "A_REWRITE", (FPFI)Aga_rewrite, 1, "I" }, + { "A_ZERO", (FPFI)Aga_zero, 1, "I" }, + { "A_LOCK", (FPFI)Aga_lock, 1, "I" }, + { "A_UNLOCK", (FPFI)Aga_unlock, 1, "I" }, + { "F_BOF", (FPFI)Fox_bof, 0, "" }, + { "F_EOF", (FPFI)Fox_eof, 0, "" }, + { "F_FIND", (FPFI)Fox_find, 0, "" }, + { "F_GET", (FPFI)Fox_get, 1, "C" }, + { "F_KEY", (FPFI)Fox_key, 1, "I" }, + { "F_RESET", (FPFI)Fox_reset, 0, "" }, + { "F_SELECT", (FPFI)Fox_select, 1, "I" }, + { "F_UNSELECT",(FPFI)Fox_unselect,0, "" }, + { "F_SET", (FPFI)Fox_set, 2, "C,C" }, + { "F_SHOW", (FPFI)Fox_show, 0, "" }, + { "F_SKIP", (FPFI)Fox_skip, 1, "I" }, + { "F_STORE", (FPFI)Fox_store, 0, "" }, + { "F_STRUCT", (FPFI)Fox_struct, 0, "" }, +#endif +}; + +FoxTable _FoxTable = +{ + (FoxTable FAR *)0, + sizeof(AgaFoxInfo)/sizeof(FoxInfo), + AgaFoxInfo +}; +#endif + +} // extern "C" + +#ifdef WIN32 +BOOL APIENTRY DllMain(HANDLE hInst, DWORD fdwReason, LPVOID lpReserved) +{ + DWORD dwVersion,dwWindowsMajorVersion,dwWindowsMinorVersion; + if (fdwReason == DLL_PROCESS_ATTACH) + { + Aga_init(); + if (cProcessesAttached++) // Don't do initilization any more + return TRUE; + + dwVersion = GetVersion(); + + dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); + dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); + + + if ( ! (dwVersion < 0x80000000) && (dwWindowsMajorVersion < 4)) // That's Win32s, my dear! + fWin32s = TRUE; + if (!fWin32s) // Esegue le pazzie che seguono (per il thunking) solo se siamo in Win32s + return (TRUE); +#ifdef DBG + MessageBox(GetFocus(),"Loading thunking to AGA32(1)","AGA32", MB_OK | MB_ICONINFORMATION); +#endif + hKernel32 = LoadLibrary("Kernel32.Dll"); + pUTRegister = (PUTREGISTER) GetProcAddress(hKernel32, "UTRegister"); +#ifdef DBG + MessageBox(GetFocus(),"Loading thunking to AGA32(2)","AGA32", MB_OK | MB_ICONINFORMATION); +#endif + if (!pUTRegister) + return (FALSE); + pUTUnRegister = (PUTUNREGISTER) GetProcAddress(hKernel32,"UTUnRegister"); +#ifdef DBG + MessageBox(GetFocus(),"Loading thunking to AGA32(3)","AGA32", MB_OK | MB_ICONINFORMATION); +#endif + if (!pUTUnRegister) + return (FALSE); + +#ifdef DBG + MessageBox(GetFocus(),"Loading thunking to AGA32(4)","AGA32", MB_OK | MB_ICONINFORMATION); +#endif + return (*pUTRegister) (hInst, // AGA32.DLL module handle + "AGA16.DLL", // 16 bit thunk dll + "UTInit", // Init routine + "UTProc", // 16 bit dispatch routine + &pfnUTProc, // Receives thunk address + pfnUT32CBProc, // Call-back function + NULL); // no shared memory + + } + else + if (fdwReason == DLL_PROCESS_DETACH) + { + Aga_exit(); + if ((0 == --cProcessesAttached) && fWin32s) // is Win32s ? + { + (*pUTUnRegister) (hInst); // if so, free the library loaded + FreeLibrary(hKernel32); + } + } + return (TRUE); +} + +#endif + +#ifdef DLL +#ifndef WIN32 +int CALLBACK LibMain (HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine) +{ + return Aga_init(); +} + +int CALLBACK WEP (int nExitType) +{ + if (nExitType == WEP_FREE_DLL) + Aga_exit(); + return 1; +} +#endif +#endif diff --git a/support/interni/src/aga/aga16.c b/support/interni/src/aga/aga16.c new file mode 100755 index 000000000..f0118c40c --- /dev/null +++ b/support/interni/src/aga/aga16.c @@ -0,0 +1,96 @@ +/* Aga16.dll. 16 bit side of the thunk for aga32.dll */ + +#ifndef APYENTRY +#define APYENTRY +#endif + +#define W32SUT_16 + +#include +#include +#include +#include + +#include "w32sut.h" + +#define SYNCHSPAWN 1 + +UT16CBPROC glpfnUT16CallBack; + +int FAR PASCAL LibMain (HANDLE hLibInst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine) +{ + return (1); +} + +DWORD FAR PASCAL UTInit (UT16CBPROC lpfnUT16CallBack, LPVOID lpBuf) +{ + glpfnUT16CallBack = lpfnUT16CallBack; + return (1); +} + +DWORD FAR PASCAL UTProc (LPVOID lpBuf, DWORD dwFunc) +{ + switch (dwFunc) + { + case SYNCHSPAWN: + { + WORD WM_WAKEUP = RegisterWindowMessage("WAKEUP"); + UINT nCmdShow; + LPCSTR lpszCmdLine; + HINSTANCE inst; + HTASK child = NULL; + TASKENTRY te; + BOOL ok; + BOOL again = TRUE; + BYTE i; + MSG msg; + + lpszCmdLine = (LPSTR) ((LPDWORD)lpBuf)[0]; + nCmdShow = (UINT) ((LPDWORD)lpBuf)[1]; + + + inst = WinExec(lpszCmdLine, nCmdShow); + + te.dwSize = sizeof(TASKENTRY); + for (ok = TaskFirst(&te); ok && child == NULL; ok = TaskNext(&te)) + if (te.hInst == inst) + { + child = te.hTask; + break; + } + + for (i = 0; again; i++) + {/* Esegue la TaskFindHandle ogni 256 cicli */ + if (i == 0 && ok && TaskFindHandle(&te, child) == FALSE) + break; + + /* Questo (utilizzato in agalight.dll) metodo non funziona in Win32s. + + GetMessage(&msg, (HWND)NULL, 0, 0); + TranslateMessage(&msg); + if (msg.message == WM_WAKEUP && msg.wParam == child) + break; + + */ + + while (PeekMessage(&msg, NULL, 0,0, PM_REMOVE) && again) + { + if (msg.message == WM_QUIT || + (msg.message == WM_WAKEUP && msg.wParam == child)) + again=FALSE; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + return inst >= 32; + } + } + return ((DWORD) -1L); +} + +int FAR PASCAL _WEP(int bSystemExit) +{ + return (1); +} + + diff --git a/support/interni/src/aga/aga16.def b/support/interni/src/aga/aga16.def new file mode 100755 index 000000000..9f6d99af9 --- /dev/null +++ b/support/interni/src/aga/aga16.def @@ -0,0 +1,9 @@ +LIBRARY AGA16 +EXETYPE WINDOWS +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE SINGLE +HEAPSIZE 1024 +EXPORTS + +UTInit @1 +UTProc @2 \ No newline at end of file diff --git a/support/interni/src/aga/aga16.lrf b/support/interni/src/aga/aga16.lrf new file mode 100755 index 000000000..f43633f00 --- /dev/null +++ b/support/interni/src/aga/aga16.lrf @@ -0,0 +1,9 @@ +aga16 +..\..\aga16.dll +nul +w32sut16+ +toolhelp+ +libw+ +/NOD:llibce ldllcew +aga16.def + diff --git a/support/interni/src/aga/agadll.txt b/support/interni/src/aga/agadll.txt new file mode 100755 index 000000000..a412e750c --- /dev/null +++ b/support/interni/src/aga/agadll.txt @@ -0,0 +1,135 @@ +INFORMAZIONI SULL'UTILIZZO DELLE DLL PER CHIAMARE PROGRAMMI ESTERNI +=================================================================== + +Le DLL utilizzabili sono 2: + +AGAEXEC.DLL (Analoga alla AGALIGHT.FLL) +AGA32.DLL : questa DLL necessita di un secondo componente: AGA16.DLL (vedi sotto la spiegazione) + + + +AGALIGHT.DLL viene utilizzata per programmi a 16 bit +AGA32.DLL viene utilizzata per programmi a 32 bit su piattaforme a 32 bit (Win95 WinNT) +AGA16.DLL viene utilizzata per programmi a 32 bit su piattaforme con Win32s (Windows 3.11 + Win32s) + +AGA32.DLL e AGA16.DLL vanno SEMPRE in coppia in quanto inerenti a programmi a 32 bit. + +Quindi per programmi a 16 bit si utilizza AGAEXEC.DLL, mentre per programmi a 32 +si utilizza AGA32.DLL, la quale a sua volta si accorgera' automaticamente di quale +tipo di piattaforma si tratti, collegandosi ad AGA16.DLL nel caso vi siano chiamate a funzione +Aga_exec(). Il motivo per il quale e' stata realizzata la versione per Win32s e' che le funzioni del +Kernel di Windows a 32 bit utilizzate in AGA32.DLL non hanno un corretto funzionamento in Win32s. +Pertanto e' stato necessario un thunking a 16 bit. + +FUNZIONI ESPORTATE +------------------ + +int Aga_setvar(const char* p, const char* u, const char* t) +const char* Aga_workdir() +int Aga_wakeup() +int Aga_exec(const char* p) + + + + +******************************************************* +Aga_setvar(const char* p, const char* u, const char* t) +******************************************************* + +Serve per inizializzare alcune variabili interne alla DLL. +Le stringhe da passare sono, in ordine, le seguenti: + +p : contenuto della variabile d'ambiente PREFPATH +u : nome dell'utente con il quale viene chiamato il programma PRASSI +t : contenuto della variabile d'ambiente TMP o TEMP se non esiste la precedente + +La sua chiamata e' obbligatoria se si intende utilizzare anche AGA_WORKDIR(), +solitamente la si applica all'inizio del programma. Se si utilizzano solo +Aga_wakeup() o Aga_exec() non e' necessario il suo utilizzo. + +Esempio. +... + strcpy(a,""); + strcpy(a,getenv("PREFPATH")); + if (!strlen(a)) + strcpy(a,"PREFIX.TXT"); + strcpy(b,"PRASSI"); + strcpy(c,"c:\\tmp"); + Aga_setvar(a,b,c); +... + + + + +************************** +const char* Aga_workdir() +************************** + +Serve a ritornare il prefisso dati corrente dei programmi PRASSI, composto +tramite i contenuti di PATHPREF.INI e il file identificato dal contenuto della +variabile d'ambiente PREFPATH. + +Esempio: + +Il file PATHPREF.INI presente sotto il direttorio programmi PRASSI contiene f:\dati +La variabile PREFPATH vale c:\prassi\prefix.txt +Il file C:\PRASSI\PREFIX.TXT identificato da PREFPATH contiene 00001a come ditta corrente. +Il risultato della chiamata a AGA_WORKDIR sara' + +f:\dati\00001a + + + + +**************** +int Aga_wakeup() +**************** + +Serve per togliere dall'attesa il programma chiamante. La chiamata +va effettuata prima dell'uscita del programma. Questa funzione +viene utilizzata all'interno del programma chiamato; e' tipico +l'utilizzo in coppia con la Aga_exec(), che permette di eseguire un +programma figlio e di attendere la fine della sua esecuzione. +Tutti i programmi PRASSI effettuano le stesse istruzioni della Aga_wakeup() +prima della fine, in modo che eventuali programmi chiamanti possano poi +ripristinare il loro stato. + +Esempio: + + Programma padre Programma figlio + + START + | + Istruzione 1 + | + Aga_exec()---------------> INIZIO + | + Istruzione 1 + | + Aga_wakeup() + | + Istruzione 2 <------------- FINE + | + FINE + + + + +*************************** +int Aga_exec(const char* p) +*************************** + +Serve per eseguire un programma figlio ed attendere la sua fine (effettua +una WinExec() sincrona). +Il parametro p contiene il pathname completo del programma da eseguire. + + +Esempio: + +Aga_exec("ba1.exe /uPRASSI"); + + + + + + diff --git a/support/interni/src/aga/agaexec.def b/support/interni/src/aga/agaexec.def new file mode 100755 index 000000000..9da8bb503 --- /dev/null +++ b/support/interni/src/aga/agaexec.def @@ -0,0 +1,12 @@ +LIBRARY AGAEXEC +EXETYPE WINDOWS 3.0 +CODE PRELOAD MOVABLE SHARED +DATA SHARED PRELOAD + + +EXPORTS + +AGA_SETVAR @1 +AGA_EXEC @2 +AGA_WAKEUP @3 +AGA_WORKDIR @4 diff --git a/support/interni/src/aga/agaexec.lrf b/support/interni/src/aga/agaexec.lrf new file mode 100755 index 000000000..b5ef615fe --- /dev/null +++ b/support/interni/src/aga/agaexec.lrf @@ -0,0 +1,8 @@ +agaexec +..\..\agaexec.dll +nul +libw+ +toolhelp+ +/NOD:llibce ldllcew +agaexec.def + diff --git a/support/interni/src/aga/agafll.def b/support/interni/src/aga/agafll.def new file mode 100755 index 000000000..63a4cd8ec --- /dev/null +++ b/support/interni/src/aga/agafll.def @@ -0,0 +1,7 @@ +LIBRARY AGAFLL +EXETYPE WINDOWS 3.0 +CODE PRELOAD MOVABLE SHARED +DATA SHARED PRELOAD + +INCLUDE CB5IMP.DEF + diff --git a/support/interni/src/aga/agafll.doc b/support/interni/src/aga/agafll.doc new file mode 100755 index 000000000..a7584f109 Binary files /dev/null and b/support/interni/src/aga/agafll.doc differ diff --git a/support/interni/src/aga/agafll.lrf b/support/interni/src/aga/agafll.lrf new file mode 100755 index 000000000..f380bd183 --- /dev/null +++ b/support/interni/src/aga/agafll.lrf @@ -0,0 +1,12 @@ +agafll+ccustio+cfiles+codeb+csort+ +getaut+hlprot+ioresult+upstring+tmpfname+ +array+checks+files+date+isam+object+ +prefix+scanner+stdtypes+strings+utility+ +..\foxlck\libentry +..\..\aga.fll +nul +..\foxlck\proapiml+ +libw+ +/NOD:llibce ldllcew +agafll.def + diff --git a/support/interni/src/aga/agalight.def b/support/interni/src/aga/agalight.def new file mode 100755 index 000000000..cea40bf51 --- /dev/null +++ b/support/interni/src/aga/agalight.def @@ -0,0 +1,7 @@ +LIBRARY AGALIGHT +EXETYPE WINDOWS 3.0 +CODE PRELOAD MOVABLE SHARED +DATA SHARED PRELOAD + + + diff --git a/support/interni/src/aga/agalight.lrf b/support/interni/src/aga/agalight.lrf new file mode 100755 index 000000000..538e00517 --- /dev/null +++ b/support/interni/src/aga/agalight.lrf @@ -0,0 +1,10 @@ +agalight+ +..\foxlck\libentry.obj +..\..\agalight.fll +nul +..\foxlck\proapiml+ +toolhelp+ +libw+ +/NOD:llibce ldllcew +agalight.def + diff --git a/support/interni/src/aga/cb5imp.def b/support/interni/src/aga/cb5imp.def new file mode 100755 index 000000000..d317acb6d --- /dev/null +++ b/support/interni/src/aga/cb5imp.def @@ -0,0 +1,462 @@ + +IMPORTS + C4ATOD = CB5.1 + C4ATOI = CB5.2 + C4ATOL = CB5.3 + C4DESCEND = CB5.4 + C4DESCEND_DATE = CB5.5 + C4DESCEND_NUM = CB5.6 + C4DESCEND_STR = CB5.7 + C4ENCODE = CB5.8 + CODE4ALLOC = CB5.9 + + D4ALIAS = CB5.10 + D4ALIAS_SET = CB5.11 + D4APPEND = CB5.12 + D4APPEND_BLANK = CB5.13 + D4APPEND_DATA = CB5.14 + D4APPEND_START = CB5.15 + D4BLANK = CB5.16 + D4BOF = CB5.17 + D4BOTTOM = CB5.18 + D4CHANGED = CB5.19 + D4CHECK = CB5.20 + D4CLOSE = CB5.21 + D4CLOSE_ALL = CB5.22 + D4CREATE = CB5.23 + D4DATA = CB5.24 + D4DELETE = CB5.25 + D4DELETED = CB5.26 + D4EOF = CB5.27 + D4FIELD = CB5.28 + D4FIELD_INFO = CB5.29 + D4FIELD_J = CB5.30 + D4FIELD_NUMBER = CB5.31 + D4FLUSH = CB5.32 + D4FLUSH_DATA = CB5.33 + D4FLUSH_FILES = CB5.34 + D4FREE_BLOCKS = CB5.35 + D4GO = CB5.36 + D4GO_DATA = CB5.37 + D4GO_EOF = CB5.38 + D4INDEX = CB5.39 + D4INIT = CB5.40 + D4INIT_UNDO = CB5.41 + D4LOCK = CB5.42 + D4LOCK_ALL = CB5.43 + D4LOCK_APPEND = CB5.44 + D4LOCK_FILE = CB5.45 + D4LOCK_GROUP = CB5.46 + D4LOCK_INDEX = CB5.47 + D4LOCK_TEST = CB5.48 + D4LOCK_TEST_APPEND = CB5.49 + D4LOCK_TEST_FILE = CB5.50 + D4LOCK_TEST_INDEX = CB5.51 + D4MEMO_COMPRESS = CB5.52 + D4NUM_FIELDS = CB5.53 + D4OPEN = CB5.54 + D4OPT_START = CB5.55 + D4OPT_SUSPEND = CB5.56 + D4OPTIMIZE = CB5.57 + D4OPTIMIZE_WRITE = CB5.58 + D4PACK = CB5.59 + D4PACK_DATA = CB5.60 + D4POSITION = CB5.61 + D4POSITION_SET = CB5.62 + D4READ = CB5.63 + D4READ_OLD = CB5.64 + D4RECALL = CB5.65 + D4RECCOUNT = CB5.66 + D4RECNO = CB5.67 + D4RECORD = CB5.68 + D4RECORD_POSITION = CB5.69 + D4RECORD_WIDTH = CB5.70 + D4REFRESH = CB5.71 + D4REFRESH_RECORD = CB5.72 + D4REINDEX = CB5.73 + D4SEEK = CB5.74 + D4SEEK_DOUBLE = CB5.75 + D4SKIP = CB5.76 + D4TAG = CB5.77 + D4TAG_DEFAULT = CB5.78 + D4TAG_NEXT = CB5.79 + D4TAG_PREV = CB5.80 + D4TAG_SELECT = CB5.81 + D4TAG_SELECTED = CB5.82 + D4TOP = CB5.83 + D4UNLOCK = CB5.84 + D4UNLOCK_FILES = CB5.85 + D4VALIDATE_MEMO_IDS = CB5.86 + D4WRITE = CB5.87 + D4WRITE_DATA = CB5.88 + D4WRITE_KEYS = CB5.89 + D4ZAP = CB5.90 + D4ZAP_DATA = CB5.91 + + DATE4ASSIGN = CB5.92 + DATE4CDOW = CB5.93 + DATE4CMONTH = CB5.94 + DATE4DAY = CB5.95 + DATE4DOW = CB5.96 + DATE4FORMAT = CB5.97 + DATE4FORMAT_MDX = CB5.98 + DATE4INIT = CB5.99 + DATE4LONG = CB5.100 + DATE4MONTH = CB5.101 + DATE4TIME_NOW = CB5.102 + DATE4TODAY = CB5.103 + DATE4YEAR = CB5.104 + + E4 = CB5.105 + E4CODE = CB5.106 + E4DESCRIBE = CB5.107 + E4EXIT = CB5.108 + E4EXIT_TEST = CB5.109 + E4HOOK = CB5.110 + E4SET = CB5.111 + E4SEVERE = CB5.112 + E4TEXT = CB5.113 + + EXPR4CALC_CREATE = CB5.114 + EXPR4DOUBLE = CB5.115 + EXPR4FREE = CB5.116 + EXPR4KEY = CB5.117 + EXPR4KEY_LEN = CB5.118 + EXPR4LEN = CB5.119 + EXPR4PARSE = CB5.120 + EXPR4SOURCE = CB5.121 + EXPR4TRUE = CB5.122 + EXPR4TYPE = CB5.123 + EXPR4VARY = CB5.124 + + F4ASSIGN = CB5.125 + F4ASSIGN_CHAR = CB5.126 + F4ASSIGN_DOUBLE = CB5.127 + F4ASSIGN_FIELD = CB5.128 + F4ASSIGN_INT = CB5.129 + F4ASSIGN_LONG = CB5.130 + F4ASSIGN_N = CB5.131 + F4ASSIGN_PTR = CB5.132 + F4BLANK = CB5.133 + F4CHAR = CB5.134 + F4DATA = CB5.135 + F4DECIMALS = CB5.136 + F4DOUBLE = CB5.137 + F4INT = CB5.138 + F4LEN = CB5.139 + F4LONG = CB5.140 + F4MEMO_ASSIGN = CB5.150 + F4MEMO_ASSIGN_N = CB5.151 + F4MEMO_FREE = CB5.152 + F4MEMO_LEN = CB5.153 + F4MEMO_NCPY = CB5.154 + F4MEMO_PTR = CB5.155 + F4MEMO_STR = CB5.156 + F4NAME = CB5.157 + F4NCPY = CB5.158 + F4PTR = CB5.159 + F4STR = CB5.160 + F4TRUE = CB5.161 + F4TYPE = CB5.162 + + FILE4CLOSE = CB5.163 + FILE4CREATE = CB5.164 + FILE4FLUSH = CB5.165 + FILE4LEN = CB5.166 + FILE4LEN_SET = CB5.167 + FILE4LOCK = CB5.168 + FILE4LOCK_HOOK = CB5.169 + FILE4OPEN = CB5.170 + FILE4OPTIMIZE = CB5.171 + FILE4OPTIMIZE_WRITE = CB5.172 + FILE4READ = CB5.173 + FILE4READ_ALL = CB5.174 + FILE4READ_ERROR = CB5.175 + FILE4REFRESH = CB5.176 + FILE4REPLACE = CB5.177 + FILE4TEMP = CB5.178 + FILE4UNLOCK = CB5.179 + FILE4WRITE = CB5.180 + FILE4SEQ_READ = CB5.181 + FILE4SEQ_READ_ALL = CB5.182 + FILE4SEQ_READ_INIT = CB5.183 + FILE4SEQ_WRITE = CB5.184 + FILE4SEQ_WRITE_FLUSH = CB5.185 + FILE4SEQ_WRITE_INIT = CB5.186 + FILE4SEQ_WRITE_REPEAT = CB5.187 + + I4CLOSE = CB5.188 + I4CREATE = CB5.189 + I4LOCK = CB5.190 + I4OPEN = CB5.191 + I4REINDEX = CB5.192 + I4TAG = CB5.193 + I4TAG_INFO = CB5.194 + I4UNLOCK = CB5.195 + + L4ADD = CB5.196 + L4ADD_AFTER = CB5.197 + L4ADD_BEFORE = CB5.198 + L4FIRST = CB5.199 + L4LAST = CB5.200 + L4NEXT = CB5.201 + L4POP = CB5.202 + L4PREV = CB5.203 + L4REMOVE = CB5.204 + + MEM4ALLOC = CB5.205 + MEM4CREATE = CB5.206 + MEM4FREE = CB5.207 + MEM4RELEASE = CB5.208 + MEM4RESET = CB5.209 + + RELATE4BOTTOM = CB5.210 + RELATE4CHANGED = CB5.211 + RELATE4CREATE_SLAVE = CB5.212 + RELATE4DO = CB5.213 + RELATE4DO_ONE = CB5.214 + RELATE4ERROR_ACTION = CB5.215 + RELATE4FREE = CB5.216 + RELATE4INIT = CB5.217 + RELATE4LOCK = CB5.218 + RELATE4MATCH_LEN = CB5.219 + RELATE4NEXT = CB5.220 + RELATE4QUERY_SET = CB5.221 + RELATE4SKIP = CB5.222 + RELATE4SKIP_ENABLE = CB5.223 + RELATE4SORT_SET = CB5.224 + RELATE4TOP = CB5.225 + RELATE4TYPE = CB5.226 + RELATE4UNLOCK = CB5.227 + + SORT4FREE = CB5.229 + SORT4GET = CB5.230 + SORT4GET_INIT = CB5.231 + SORT4INIT = CB5.232 + SORT4PUT = CB5.233 + + T4ADD = CB5.234 + T4ADD_CALC = CB5.235 + T4BOTTOM = CB5.236 + T4DOWN = CB5.237 + T4DUMP = CB5.238 + T4EOF = CB5.239 + T4FLUSH = CB5.240 + T4FREE_ALL = CB5.241 + T4GO = CB5.242 + T4KEY = CB5.243 + T4OPEN = CB5.244 + T4POSITION = CB5.245 + T4POSITION_SET = CB5.246 + T4RECNO = CB5.247 + T4REMOVE = CB5.248 + T4REMOVE_CALC = CB5.249 + T4SEEK = CB5.250 + T4SKIP = CB5.251 + T4TOP = CB5.252 + T4UP = CB5.253 + T4UP_TO_ROOT = CB5.254 + + U4ALLOC = CB5.255 + U4ALLOC_AGAIN = CB5.256 + U4ALLOC_ER = CB5.257 + U4ALLOC_FREE = CB5.258 + U4FREE = CB5.259 + U4NAME_CHAR = CB5.260 + U4NAME_EXT = CB5.261 + U4NAME_PIECE = CB5.262 + U4NCPY = CB5.263 + U4YYMMDD = CB5.264 + + EXPR4CALC_LOOKUP = CB5.265 + C4TRIM_N = CB5.266 + EXPR4FUNCTIONS = CB5.267 + C4DTOA45 = CB5.268 + EXPR4CALC_DELETE = CB5.269 + E4LOOKUP = CB5.270 + C4UPPER = CB5.271 + EXPR4CALC_NAME_CHANGE = CB5.272 + EXPR4CALC_MODIFY = CB5.273 + RELATE4FREE_RELATE = CB5.274 + EXPR4CALC_MASSAGE = CB5.275 + D4UPDATE_HEADER = CB5.276 + U4SWITCH = CB5.277 + DATE4FORMAT_MDX2 = CB5.278 + EXPR4DOUBLE2 = CB5.279 + D4POSITION2 = CB5.280 + F4DOUBLE2 = CB5.281 + T4POSITION2 = CB5.282 + F4MEMO_SET_LEN = CB5.283 + C4LTOA45 = CB5.284 + I4ADD_TAG = CB5.285 + EXPR4CALC_RESET = CB5.286 + T4IS_DESCENDING = CB5.287 + I4IS_PRODUCTION = CB5.288 + T4UNIQUE = CB5.289 + D4SEEK_N = CB5.290 + C4DLL_INST = CB5.291 + C4ATOD2 = CB5.292 + F4MEMO_CHECK = CB5.293 + D4UNLOCK_APPEND = CB5.294 + D4UNLOCK_DATA = CB5.295 + D4UNLOCK_FILE = CB5.296 + D4UNLOCK_RECORDS = CB5.297 + C4LOWER = CB5.298 + I4CHECK = CB5.299 + U4REMOVE = CB5.300 + + AREA4CREATE = CB5.301 + AREA4FREE = CB5.302 + AREA4NUMOBJECTS = CB5.303 + AREA4OBJFIRST = CB5.304 + AREA4OBJLAST = CB5.305 + AREA4OBJNEXT = CB5.306 + AREA4OBJPREV = CB5.307 + AREA4PAGEBREAK = CB5.308 + GROUP4CREATE = CB5.309 + GROUP4FOOTERFIRST = CB5.310 + GROUP4FOOTERNEXT = CB5.311 + GROUP4FOOTERPREV = CB5.312 + GROUP4FREE = CB5.313 + GROUP4HEADERFIRST = CB5.314 + GROUP4HEADERNEXT = CB5.315 + GROUP4HEADERPREV = CB5.316 + GROUP4NUMFOOTERS = CB5.317 + GROUP4NUMHEADERS = CB5.318 + GROUP4REPEATHEADER = CB5.319 + GROUP4RESETEXPRSET = CB5.320 + GROUP4RESETPAGE = CB5.321 + GROUP4RESETPAGENUM = CB5.322 + GROUP4SWAPFOOTER = CB5.323 + GROUP4SWAPHEADER = CB5.324 + OBJ4BITMAPSTATICCREATE = CB5.325 + OBJ4BITMAPSTATICFREE = CB5.326 + OBJ4BITMAPFILECREATE = CB5.327 + OBJ4BITMAPFILEFREE = CB5.328 + OBJ4BITMAPFIELDCREATE = CB5.329 + OBJ4BITMAPFIELDFREE = CB5.330 + OBJ4BRACKETS = CB5.331 + OBJ4CALCCREATE = CB5.332 + OBJ4CALCFREE = CB5.333 + OBJ4DATEFORMAT = CB5.334 + OBJ4DECIMALS = CB5.335 + OBJ4DELETE = CB5.336 + OBJ4DISPLAYONCE = CB5.337 + OBJ4DISPLAYZERO = CB5.338 + OBJ4EXPRCREATE = CB5.339 + OBJ4EXPRFREE = CB5.340 + OBJ4FIELDCREATE = CB5.341 + OBJ4FIELDFREE = CB5.342 + OBJ4FRAMECORNERS = CB5.343 + OBJ4FRAMECREATE = CB5.344 + OBJ4FRAMEFILL = CB5.345 + OBJ4FRAMEFREE = CB5.346 + OBJ4JUSTIFY = CB5.347 + OBJ4LEADINGZERO = CB5.348 + OBJ4LINECREATE = CB5.349 + OBJ4LINEFREE = CB5.350 + OBJ4LINEWIDTH = CB5.351 + OBJ4LOOKAHEAD = CB5.352 + OBJ4NUMERICTYPE = CB5.353 + OBJ4STYLE = CB5.354 + OBJ4TEXTCREATE = CB5.355 + OBJ4TEXTFREE = CB5.356 + OBJ4TOTALCREATE = CB5.357 + OBJ4TOTALFREE = CB5.358 + RELATE4RETRIEVE = CB5.359 + RELATE4SAVE = CB5.360 + REPORT4CAPTION = CB5.361 + REPORT4CURRENCY = CB5.362 + REPORT4DATEFORMAT = CB5.363 + REPORT4DECIMAL = CB5.364 + REPORT4DO = CB5.365 + REPORT4FREE = CB5.366 + REPORT4GENERATEPAGE = CB5.367 + REPORT4GROUPFIRST = CB5.368 + REPORT4GROUPLAST = CB5.369 + REPORT4GROUPLOOKUP = CB5.370 + REPORT4GROUPNEXT = CB5.371 + REPORT4GROUPPREV = CB5.372 + REPORT4GROUPHARDRESETS = CB5.373 + REPORT4INIT = CB5.374 + REPORT4MARGINS = CB5.375 + REPORT4NUMGROUPS = CB5.376 + REPORT4NUMSTYLES = CB5.377 + REPORT4OUTPUT = CB5.378 + REPORT4PAGEFREE = CB5.379 + REPORT4PAGEHEADERFOOTER = CB5.380 + REPORT4PAGEINIT = CB5.381 + REPORT4PAGEMARGINSGET = CB5.382 + REPORT4PAGEOBJFIRST = CB5.383 + REPORT4PAGEOBJNEXT = CB5.384 + REPORT4PAGESIZE = CB5.385 + REPORT4PAGESIZEGET = CB5.386 + REPORT4PARENT = CB5.387 + REPORT4PRINTERSELECT = CB5.388 + REPORT4PRINTERDC = CB5.389 + REPORT4QUERYSET = CB5.390 + REPORT4RETRIEVE = CB5.391 + REPORT4SAVE = CB5.392 + REPORT4SEPARATOR = CB5.393 + REPORT4SORTSET = CB5.394 + REPORT4STYLEFIRST = CB5.395 + REPORT4STYLELAST = CB5.396 + REPORT4STYLENEXT = CB5.397 + REPORT4STYLESELECT = CB5.398 + REPORT4STYLESELECTED = CB5.399 + REPORT4STYLESHEETLOAD = CB5.400 + REPORT4STYLESHEETSAVE = CB5.401 + REPORT4TITLEPAGE = CB5.402 + REPORT4TITLESUMMARY = CB5.403 + REPORT4TOSCREEN = CB5.404 + STYLE4COLOR = CB5.405 + STYLE4CREATE = CB5.406 + STYLE4DELETE = CB5.407 + STYLE4FREE = CB5.408 + STYLE4INDEX = CB5.409 + STYLE4LOOKUP = CB5.410 + TOTAL4CREATE = CB5.411 + TOTAL4FREE = CB5.412 + REPORT4DATADO = CB5.413 + TOTAL4ADDCONDITION = CB5.414 + REPORT4DATAFILESET = CB5.415 + REPORT4DATAGROUP = CB5.416 + OBJ4DATAFIELDSET = CB5.417 + WRITEDIB = CB5.418 + GETDIB = CB5.419 + PALETTESIZE = CB5.420 + FINDDIBBITS = CB5.421 + REPORT4INDEX_TYPE = CB5.422 + AREA4ADD_OBJECT = CB5.423 + OBJ4REMOVE = CB5.424 + GROUP4POSITIONSET = CB5.425 + REPORT4GET_PRINTERIC = CB5.426 + TOTAL4LOOKUP = CB5.427 + AREA4SORT_OBJ_TREE = CB5.428 + RELATE4LOOKUP_DATA = CB5.429 + REPORT4RETRIEVE2 = CB5.430 + RELATE4SAVE2 = CB5.431 + RELATE4RETRIEVE2 = CB5.432 + U4DELAY_SEC = CB5.433 + + T4BLOCK = CB5.451 + T4CHECK = CB5.452 + + CTRL4ADDCODE = CB5.500 + CTRL4CODELISTINIT = CB5.501 + CTRL4FREECTRLNODE = CB5.502 + CTRL4FREECODELIST = CB5.503 + CTRL4GETCTRLCODE = CB5.504 + CTRL4INITVBX = CB5.505 + CTRL4INITVBXUNDO = CB5.506 + + + X4BOTTOM = CB5.600 + X4INIT_WORK = CB5.601 + X4FILTER_TEST = CB5.602 + X4GO = CB5.603 + X4SEEK = CB5.604 + X4SEEK_DOUBLE = CB5.605 + X4SKIP = CB5.606 + X4TOP = CB5.607 + I4CHANGED = CB5.608 diff --git a/support/interni/src/aga/makefile b/support/interni/src/aga/makefile new file mode 100755 index 000000000..d93687d2a --- /dev/null +++ b/support/interni/src/aga/makefile @@ -0,0 +1,142 @@ +# +# Comando per avere le versioni di DEBUG: +# nmake DBG=D +# +# +# Per compilare aga.fll scommentare tutte le dipendenze di aga.fll + +# +# Compiler setup +# +CC = cl +CFLAGS = /nologo /c /ALw # large memory model; SS != DS; DS not loaded at fn entry +CFLAGS = $(CFLAGS) /GD # fn entry code optimized for Windows DLLs +CFLAGS = $(CFLAGS) /G2 # +CFLAGS = $(CFLAGS) /O # optimizations (optional) +CFLAGS = $(CFLAGS) /W3 # set warning level as desired +CFLAGS = $(CFLAGS) /Zp2 # pack 2 bytes +! if "$(DBG)" == "D" +CFLAGS = $(CFLAGS) /DDBG +CFLAGS = $(CFLAGS) /Zi +! endif + +# +# Link setup +# +LINKER = link +LFLAGS = /ONERROR:NOEXE/NOFARCALL/NOE +! if "$(DBG)" == "D" +LFLAGS = $(LFLAGS) /CO +! endif + +SUPP=$(SROOT)/support/interni +ICPP=$(SROOT)/include + +DLL=\ + $(SUPP)/agaexec.dll $(SUPP)/aga16.dll + +FLL=\ + $(SUPP)/agalight.fll +# $(SUPP)/agalight.fll $(SUPP)/aga.fll + +CLEAN=dummy + +.PRECIOUS: $(DLL) $(FLL) + +main: $(FLL) $(DLL) $(CLEAN) + +dummy: agalight.obj + del *.obj + +#ccustio.obj: $(ICPP)\ccustio.c +# $(CC) $(CFLAGS) /I$(ICPP) /Foccustio.obj /DDOS /DFOXPRO $(ICPP)/ccustio.c + +#cfiles.obj: $(ICPP)\cfiles.c +# $(CC) $(CFLAGS) /I$(ICPP) /Focfiles.obj /DDOS /DFOXPRO $(ICPP)/cfiles.c + +#codeb.obj: $(ICPP)\codeb.c +# $(CC) $(CFLAGS) /I$(ICPP) /Focodeb.obj /DDOS /DFOXPRO $(ICPP)/codeb.c + +#csort.obj: $(ICPP)\csort.c +# $(CC) $(CFLAGS) /I$(ICPP) /Focsort.obj /DDOS /DFOXPRO $(ICPP)/csort.c + +#getaut.obj: $(ICPP)\getaut.c +# $(CC) $(CFLAGS) /I$(ICPP) /Fogetaut.obj /DDOS /DFOXPRO $(ICPP)/getaut.c + +#hlprot.obj: $(ICPP)\hlprot.c +# $(CC) $(CFLAGS) /I$(ICPP) /Fohlprot.obj /DDOS /DFOXPRO $(ICPP)/hlprot.c + +#ioresult.obj: $(ICPP)\ioresult.c +# $(CC) $(CFLAGS) /I$(ICPP) /Foioresult.obj /DDOS /DFOXPRO $(ICPP)/ioresult.c + +#upstring.obj: $(ICPP)\upstring.c +# $(CC) $(CFLAGS) /I$(ICPP) /Foupstring.obj /DDOS /DFOXPRO $(ICPP)/upstring.c + +#tmpfname.obj: $(ICPP)\tmpfname.c +# $(CC) $(CFLAGS) /I$(ICPP) /Fotmpfname.obj /DDOS /DFOXPRO $(ICPP)/tmpfname.c + +#agafll.obj: aga.c +# $(CC) $(CFLAGS) /I$(ICPP) /Foagafll.obj /DFOXPRO aga.c + +#array.obj: $(ICPP)/array.cpp +# $(CC) $(CFLAGS) /I$(ICPP) /Foarray.obj /DFOXPRO $(ICPP)/array.cpp + +#checks.obj: $(ICPP)/checks.cpp +# $(CC) $(CFLAGS) /I$(ICPP) /Fochecks.obj /DFOXPRO $(ICPP)/checks.cpp + +#files.obj: $(ICPP)/files.cpp +# $(CC) $(CFLAGS) /I$(ICPP) /Fofiles.obj /DFOXPRO $(ICPP)/files.cpp + +#date.obj: $(ICPP)/date.cpp +# $(CC) $(CFLAGS) /I$(ICPP) /Fodate.obj /DFOXPRO $(ICPP)/date.cpp + +#isam.obj: $(ICPP)/isam.cpp +# $(CC) $(CFLAGS) /I$(ICPP) /Foisam.obj /DFOXPRO $(ICPP)/isam.cpp + +#object.obj: $(ICPP)/object.cpp +# $(CC) $(CFLAGS) /I$(ICPP) /Foobject.obj /DFOXPRO $(ICPP)/object.cpp + +#prefix.obj: $(ICPP)/prefix.cpp +# $(CC) $(CFLAGS) /I$(ICPP) /Foprefix.obj /DFOXPRO $(ICPP)/prefix.cpp + +#scanner.obj: $(ICPP)/scanner.cpp +# $(CC) $(CFLAGS) /I$(ICPP) /Foscanner.obj /DFOXPRO $(ICPP)/scanner.cpp + +#stdtypes.obj: stdtypes.cpp +# $(CC) $(CFLAGS) /I$(ICPP) /Fostdtypes.obj /DFOXPRO stdtypes.cpp + +#strings.obj: $(ICPP)/strings.cpp +# $(CC) $(CFLAGS) /I$(ICPP) /Fostrings.obj /DFOXPRO $(ICPP)/strings.cpp + +#utility.obj: $(ICPP)/utility.cpp +# $(CC) $(CFLAGS) /I$(ICPP) /Foutility.obj /DFOXPRO $(ICPP)/utility.cpp + +#XOBJS=\ +# ccustio.obj cfiles.obj codeb.obj csort.obj getaut.obj hlprot.obj \ +# ioresult.obj upstring.obj tmpfname.obj \ +# array.obj checks.obj files.obj date.obj isam.obj object.obj \ +# prefix.obj scanner.obj stdtypes.obj strings.obj utility.obj + +#$(SUPP)aga.fll: agafll.obj $(XOBJS) +# $(LINKER) $(LFLAGS) @agafll.lrf + +agalight.obj: aga.cpp + $(CC) $(CFLAGS) /Foagalight.obj /DLIGHT aga.cpp + +agaexec.obj: aga.cpp + $(CC) $(CFLAGS) /I$(ICPP) /Foagaexec.obj /DLIGHT /DDLL aga.cpp + +aga16.obj: aga16.c + $(CC) $(CFLAGS) /Foaga16.obj aga16.c + +$(SUPP)/agalight.fll: agalight.obj + $(LINKER) $(LFLAGS) @agalight.lrf + +$(SUPP)/agaexec.dll: agaexec.obj + $(LINKER) $(LFLAGS) @agaexec.lrf + +$(SUPP)/aga16.dll: aga16.obj + $(LINKER) $(LFLAGS) @aga16.lrf + + + diff --git a/support/interni/src/aga/stdtypes.cpp b/support/interni/src/aga/stdtypes.cpp new file mode 100755 index 000000000..459c9e5ef --- /dev/null +++ b/support/interni/src/aga/stdtypes.cpp @@ -0,0 +1,125 @@ +#define __STDTYPES_CPP + +#include +#include + +#include +#include +#include +#include + +short CHARY,CHARX; + +void init_global_vars() +{ + prefix_init(); + CGetPref(); + prefix().set(""); + + FileDes d; + CGetFile(LF_DIR, &d, _nolock, NORDIR); + long maxfdir = d.EOX; + prefix().set("DEF"); + + CGetFile(LF_DIR, &d, _nolock, NORDIR); + if (d.EOD > maxfdir) maxfdir = d.EOD; + + openf = new isfdptr[maxfdir]; + openrec = new TRectype*[maxfdir]; + + for (long i = 0; i < maxfdir; i++) + { + openf[i] = NULL; + openrec[i] = NULL; + } + DB_init(); +} + +void free_global_vars() +{ + delete openrec; + delete openf; + prefix_destroy(); + DB_exit(); +} + + +#include + +void* operator new(size_t size) +{ + MHANDLE hnd = _AllocHand(size+2); + if (hnd == 0) fatal_box("Out of memory handles"); + _HLock(hnd); + MHANDLE * phnd = (MHANDLE *) _HandToPtr(hnd); + *phnd = hnd; + return (void*) (phnd+1); +} + +void operator delete(void* ptr) +{ + if (ptr == NULL) fatal_box("Can't delete NULL handle"); + MHANDLE * phnd = ((MHANDLE *) ptr) - 1; + _HUnLock(*phnd); + _FreeHand(*phnd); +} + +static bool get_fox(const char* var, char* val) +{ + *val = '\0'; + + const NTI nti = _NameTableIndex((char*)var); + if (nti >= 0) + { + Locator loc; + if (_FindVar(nti, -1, &loc)) // Find memory variable + { + Value value; + _Load(&loc, &value); + if (value.ev_type == 'C') + { + const char* p = (const char*)_HandToPtr(value.ev_handle); + if (*p > ' ') + strcpy(val, p); + } + } + } + + return *val != '\0'; +} + +static char _tmp[256]; + +char* prefname() +{ + if (!get_fox("PREFPATH", _tmp)) + strcpy(_tmp, "prefix.txt"); + + return _tmp; +} + +const char* username() +{ + if (!get_fox("USER", _tmp)) + strcpy(_tmp, "PRASSI"); + return _tmp; +} + +const char* tempdir() +{ + char user[16]; + strncpy(user, username(), 16); + + if (!get_fox("TEMPDIR", _tmp)) + strcpy(_tmp, "\\tmp"); + if (!fexist(_tmp)) + make_dir(_tmp); + + strcat(_tmp, "\\"); strcat(_tmp, user); + if (!fexist(_tmp)) + make_dir(_tmp); + + return _tmp; +} + + diff --git a/support/interni/src/aga/w32sut.h b/support/interni/src/aga/w32sut.h new file mode 100755 index 000000000..cd7ecd496 --- /dev/null +++ b/support/interni/src/aga/w32sut.h @@ -0,0 +1,68 @@ +/*** +*w32sut.h - +* +* Copyright (c) 1987-1992, Microsoft Corporation. All rights reserved. +* +*Purpose: +* This file declares the constants, structures, and functions +* used for accessing and using the Universal Thunk mechanism. +* +* This file should be compiled either with constants W32SUT_16 or +* W32SUT_32 defined. +* +****/ + +/* Check that one of the 2 constants is defined */ +#ifdef W32SUT_16 +#ifdef W32SUT_32 +#error W32SUT_16 and W32SUT_32 cannot be defined simultaneously +#endif +#endif + +#ifndef W32SUT_16 +#ifndef W32SUT_32 +#error Either W32SUT_16 or W32SUT_32 should be defined +#endif +#endif + + +/**** Prototypes for 32 bit DLL ***********/ +#ifdef W32SUT_32 + +typedef DWORD ( WINAPI * UT32PROC)( LPVOID lpBuff, + DWORD dwUserDefined, + LPVOID *lpTranslationList + ); + +BOOL WINAPI UTRegister( HANDLE hModule, + LPCSTR lpsz16BitDLL, + LPCSTR lpszInitName, + LPCSTR lpszProcName, + UT32PROC * ppfn32Thunk, + FARPROC pfnUT32Callback, + LPVOID lpBuff + ); + + +VOID WINAPI UTUnRegister(HANDLE hModule); + +#endif + + +/**** Prototypes for 16 bit DLL ***********/ +#ifdef W32SUT_16 + +typedef DWORD (FAR PASCAL * UT16CBPROC)( LPVOID lpBuff, + DWORD dwUserDefined, + LPVOID FAR *lpTranslationList + ); + + +LPVOID WINAPI UTLinearToSelectorOffset(LPBYTE lpByte); +LPVOID WINAPI UTSelectorOffsetToLinear(LPBYTE lpByte); + +#endif + + + + diff --git a/support/interni/src/aga/w32sut16.lib b/support/interni/src/aga/w32sut16.lib new file mode 100755 index 000000000..6e08de731 Binary files /dev/null and b/support/interni/src/aga/w32sut16.lib differ diff --git a/support/interni/src/aga/w32sut32.lib b/support/interni/src/aga/w32sut32.lib new file mode 100755 index 000000000..368075209 Binary files /dev/null and b/support/interni/src/aga/w32sut32.lib differ diff --git a/support/interni/src/dumb/dumb.c b/support/interni/src/dumb/dumb.c new file mode 100755 index 000000000..e646bf470 --- /dev/null +++ b/support/interni/src/dumb/dumb.c @@ -0,0 +1,301 @@ +#ifdef DUMBFLL +#include "../foxlck/pro_ext.h" +#else +#include + +/* Visual Basic interface with OLE 2 */ +#ifdef DUMBDLLVB +#include +#include +#include +#include +#endif + +#endif + +#include + +#ifdef _MSC_VER +#define _BreakPoint() __asm \ +{ \ + int 3h \ +} +#endif + +#include "hlapi_c.h" + +#define MODULE 26952 +#define REFKEY "CAMPOKEY" +#define VERKEY "ìpÙˆ¬cê<" + +unsigned int getser(); +int CGetAut(int); + +#ifdef DUMBFLL +int FAR Fox_HL_LOGIN() +#else +int far pascal _export hl_login() +#endif +{ + int status; +#ifdef DBG + _BreakPoint(); +#endif + status = HL_LOGIN(MODULE, DONT_CARE, REFKEY, VERKEY); + getser(); +#ifdef DUMBFLL + _RetInt(status,10); +#endif + return status; +} + +#ifdef DUMBFLL +int FAR Fox_HL_LOGOUT() +#else +int far pascal _export hl_logout() +#endif +{ + HL_LOGOUT(); + return 0; +} + +#ifdef DUMBFLL +static void load_string(char * str_to_load, ParamBlk far * param) +{ + Value val; + Locator loc; + int i; + + loc = param->p[0].loc; + loc.l_subs = _ALen(param->p[0].loc.l_NTI, AL_ELEMENTS); + for (i = 0; i < 16; i++) + { + loc.l_sub1 = i+1; + _Load(&loc,&val); + if (val.ev_type == 'N') + str_to_load[i] = (char) (long)val.ev_real; + } + str_to_load[16] = '\0'; +} + + +static void store_string(char * str_to_store, ParamBlk far * param) +{ + Value val; + Locator loc; + int i; + + loc = param->p[0].loc; + loc.l_subs = _ALen(param->p[0].loc.l_NTI, AL_ELEMENTS); + + for (i = 0; i < 16 ; i++) + { + loc.l_sub1 = i+1; + _Load(&loc,&val); + if (val.ev_type == 'N') + { + val.ev_long = (unsigned char)str_to_store[i]; + val.ev_real = (double) val.ev_long; + _Store(&loc,&val); + } + } +} +#endif + +#ifdef DUMBDLLVB +static void load_string(char * str_to_load, SAFEARRAY FAR** sa) +{ + long lLb, lUlb,l; + int i; + unsigned char element; + + if (*sa == NULL) + return ; + + if ((*sa)->cDims != 1) + return ; + + if (FAILED(SafeArrayGetLBound(*sa, 1, &lLb)) || + FAILED(SafeArrayGetUBound(*sa, 1, &lUlb))) + return ; + + for (l = lLb, i = 0; l <= lUlb && i < 18; l++, i++) + if (FAILED(SafeArrayGetElement(*sa, &l, &element))) + return; + else + str_to_load[i] = element; +} + + +static void store_string(char * str_to_store, SAFEARRAY FAR** sa) +{ + long lLb, lUlb,l; + int i; + unsigned char element; + + if (*sa == NULL) + return ; + + if ((*sa)->cDims != 1) + return ; + + if (FAILED(SafeArrayGetLBound(*sa, 1, &lLb)) || + FAILED(SafeArrayGetUBound(*sa, 1, &lUlb))) + return ; + + for (l = lLb, i = 0; l <= lUlb && i < 18; l++, i++) + if (FAILED(SafeArrayPutElement(*sa, &l, &str_to_store[i]))) + return; +} +#endif + +#ifdef DUMBFLL +int FAR Fox_HL_CODE(ParamBlk far *param) +#else +#ifdef DUMBDLLVB +int far pascal _export hl_code(SAFEARRAY FAR** sa) +#else +int far pascal _export hl_code(char * kk) +#endif +#endif +{ + char data [18]; + +#ifdef DUMBFLL + load_string(data, param); +#else +#ifdef DUMBDLLVB + load_string(data, sa); +#else + strncpy(data,kk,18); +#endif +#endif + HL_CODE(EYECAST data,2); +#ifdef DUMBFLL + store_string(data, param); +#else +#ifdef DUMBDLLVB + store_string(data, sa); +#else + strncpy(kk,data,18); +#endif +#endif +} + + +#ifdef DUMBFLL +int FAR Fox_GETSER() +#else +int far pascal _export hl_getser() +#endif +{ + int r; + r = getser(); +#ifdef DUMBFLL + _RetInt(r, 10); +#endif + return r; +} + + +#ifdef DUMBFLL +int FAR Fox_GETSTR(ParamBlk FAR *parm) +#else +#ifdef DUMBDLLVB +int far pascal _export hl_getstr(SAFEARRAY FAR ** sa) +#else +int far pascal _export hl_getstr(char * kk) +#endif +#endif +{ + char chiave[18]; + char tmp_str[18]; + char chiave_segreta[8]; + int i; + int j; + int module; + int ok ; + +#ifdef DUMBFLL + load_string(chiave, parm); +#else +#ifdef DUMBDLLVB + load_string(chiave, sa); +#else + strncpy(chiave,kk,18); +#endif +#endif + HL_CODE(EYECAST chiave, 2); + + strcpy(chiave_segreta,"P39S41"); + module = 0; + ok = 0; + for (i = 0; i<9;i++) + if (i>5) + chiave[i] = chiave[i] - chiave[i-6]; + else + chiave[i] = chiave[i] - chiave_segreta[i]; + strncpy(tmp_str,chiave+6,3); + tmp_str[3] = '\0'; + module = atoi(tmp_str); + ok = CGetAut(module); + strcpy(tmp_str,chiave); + for (i = 0, j=5;i<6; i++, j--) + chiave[i] = tmp_str[j]; + chiave[6] = '0';chiave[7] = '0'; + chiave[8] = ok ? '1': '0'; + for (i=8;i>=0;i--) + if (i>5) + chiave[i] = chiave[i] + chiave[i-6]; + else + chiave[i] = chiave[i] + chiave_segreta[i]; + for (i=9;i<16;i++) chiave[i] = ' '; + chiave[16] = '\0'; + HL_CODE(EYECAST chiave,2); +#ifdef DUMBFLL + store_string(chiave, parm); +#else +#ifdef DUMBDLLVB + store_string(chiave, sa); +#else + strncpy(kk,chiave,18); +#endif +#endif + return 0; +} + +#ifdef DUMBFLL + +FoxInfo DumbFoxInfo[] = +{ + { "HL_LOGIN", (FPFI)Fox_HL_LOGIN, CALLONLOAD, "" }, + { "HL_LOGOUT", (FPFI)Fox_HL_LOGOUT, CALLONUNLOAD, "" }, + { "HL_CODE", (FPFI)Fox_HL_CODE, 1, "R" }, + { "HL_GETSER", (FPFI)Fox_GETSER, 0, "" }, + { "HL_GETSTR", (FPFI)Fox_GETSTR, 1, "R" } +}; + +FoxTable _FoxTable = +{ + (FoxTable FAR *)0, + sizeof(DumbFoxInfo)/sizeof(FoxInfo), + DumbFoxInfo +}; + + +#else + +int CALLBACK LibMain (HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine) +{ + int rt = hl_login(); + return rt == STATUS_OK; +} + +int CALLBACK WEP (int nExitType) +{ + if (nExitType == WEP_FREE_DLL) + hl_logout(); + return 1; +} +#endif + diff --git a/support/interni/src/dumb/dumbdll.def b/support/interni/src/dumb/dumbdll.def new file mode 100755 index 000000000..bc5505f68 --- /dev/null +++ b/support/interni/src/dumb/dumbdll.def @@ -0,0 +1,16 @@ +LIBRARY DUMBDLL +DESCRIPTION 'DUMB DLL' +EXETYPE WINDOWS +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD FIXED SINGLE + +HEAPSIZE 4096 + +EXPORTS + +HL_LOGIN @1 +HL_LOGOUT @2 +HL_CODE @3 +HL_GETSER @4 +HL_GETSTR @5 + diff --git a/support/interni/src/dumb/dumbdll.lrf b/support/interni/src/dumb/dumbdll.lrf new file mode 100755 index 000000000..55baf2a43 --- /dev/null +++ b/support/interni/src/dumb/dumbdll.lrf @@ -0,0 +1,8 @@ +dumbdll+getaut +..\..\dumb.dll +nul +libw+ +/NOD:llibce ldllcew+ +hlapi_cd +dumbdll.def + diff --git a/support/interni/src/dumb/dumbfll.def b/support/interni/src/dumb/dumbfll.def new file mode 100755 index 000000000..3508b3fc5 --- /dev/null +++ b/support/interni/src/dumb/dumbfll.def @@ -0,0 +1,6 @@ +LIBRARY DUMBFLL +EXETYPE WINDOWS 3.0 +CODE PRELOAD MOVABLE SHARED +DATA SHARED PRELOAD + + diff --git a/support/interni/src/dumb/dumbfll.lrf b/support/interni/src/dumb/dumbfll.lrf new file mode 100755 index 000000000..ac6621e94 --- /dev/null +++ b/support/interni/src/dumb/dumbfll.lrf @@ -0,0 +1,9 @@ +dumbfll+getaut+..\foxlck\libentry +..\..\dumb.fll +nul +..\foxlck\proapiml+ +libw+ +/NOD:llibce ldllcew+ +hlapi_cd +dumbfll.def + diff --git a/support/interni/src/dumb/dumbvb.def b/support/interni/src/dumb/dumbvb.def new file mode 100755 index 000000000..693e2f5e5 --- /dev/null +++ b/support/interni/src/dumb/dumbvb.def @@ -0,0 +1,16 @@ +LIBRARY DUMBVB +DESCRIPTION 'DUMBVB DLL' +EXETYPE WINDOWS +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD FIXED SINGLE + +HEAPSIZE 4096 + +EXPORTS + +HL_LOGIN @1 +HL_LOGOUT @2 +HL_CODE @3 +HL_GETSER @4 +HL_GETSTR @5 + diff --git a/support/interni/src/dumb/dumbvb.lrf b/support/interni/src/dumb/dumbvb.lrf new file mode 100755 index 000000000..256f03252 --- /dev/null +++ b/support/interni/src/dumb/dumbvb.lrf @@ -0,0 +1,8 @@ +dumbvb+getaut +..\..\dumbvb.dll +nul +libw+ +/NOD:llibce ldllcew+ +ole2disp+hlapi_cd +dumbvb.def + diff --git a/support/interni/src/dumb/esempi/dumb.bas b/support/interni/src/dumb/esempi/dumb.bas new file mode 100755 index 000000000..bd66eb72c --- /dev/null +++ b/support/interni/src/dumb/esempi/dumb.bas @@ -0,0 +1,96 @@ +Attribute VB_Name = "Modulo1" +Private Declare Function hl_getstr Lib "dumbvb.dll" (ByRef b() As Byte) As Integer +Private Declare Function hl_code Lib "dumbvb.dll" (ByRef b() As Byte) As Integer +Function GetAut(Modulo As Integer) As Boolean + + Dim risultato(18) As Byte + Dim tmp_res(18) As Byte + Dim chiave(18) As Byte + Dim terzo_carattere As Byte + Dim ultimo_carattere As Byte + Dim stringa_segreta As String + Dim stringa_tmp As String + + stringa_segreta = "P39S41" + ' Genera un numero casuale di 6 cifre... + ' Questo e' solo un esempio, ma in realta + ' Andrebbe generato un numero veramente casuale... + ' La Randomize e' chiamata una sola volta al + ' caricamento della form + + stringa_tmp = Format(Modulo, "000") + For i = 0 To 14 + If (i < 6) Then + chiave(i) = Asc(Mid(stringa_segreta, i + 1, 1)) ' I primi 6 chars sono la stringa segreta + ElseIf (i < 12) Then + chiave(i) = Int((10 * Rnd)) ' Questo e' il numero casuale generato +' chiave(i) = 9 + Else + chiave(i) = Asc(Mid(stringa_tmp, i - 11, 1)) ' Questo e' il numero del modulo (zerofilled) + End If + Next i + + + ' Codifica la stringa chiave tramite la stringa casuale + ' Esegue la somma algebrica dei valori ASCII dei singoli caratteri + For i = 0 To 17 + If i > 8 Then + risultato(i) = Asc(" ") ' I caratteri in eccesso diventano blanks + Else + risultato(i) = chiave(i) + chiave(i + 6) + End If + Next i + + ' Chiama la funzione hl_code(), che effettua una ulteriore crittografazione + copia_array tmp_res, risultato + hl_code risultato + If compara_array(risultato, tmp_res) Then + GetAut = False ' Se le stringhe sono uguali significa che la chiave non c'e' o che qualcuno sta + Exit Function ' cercando di sproteggere il programma + End If + + ' Ora passiamo la stringa criptata alla DLL per farci restituire l'autorizzazione + copia_array tmp_res, risultato + hl_getstr risultato + + ' Chiama la funzione hl_code(), che effettua la crittografazione al contrario + copia_array tmp_res, risultato + hl_code risultato + If compara_array(risultato, tmp_res) Then + GetAut = False ' Se le stringhe sono uguali significa che la chiave non c'e' o che qualcuno sta + Exit Function ' cercando di sproteggere il programma + End If + + ' Adesso possiamo estrarre l'autorizzazione + ' Ricodifichiamo seguendo il procedimento inverso: + ' Sottraiamo i valori ASCII dal risultato carattere per carattere + ' In realta' l'autorizzazione e' codificata nel terzo carattere della stringa + terzo_carattere = risultato(2) - Asc(Mid(stringa_segreta, 3, 1)) + ultimo_carattere = Chr(risultato(8) - terzo_carattere) + + If ultimo_carattere = "1" Then + GetAut = True + Else + GetAut = False + End If + +End Function + +Public Function compara_array(b1() As Byte, b2() As Byte) As Boolean +' confronta gli elementi di b1 e b2 e ritorna True se gli elementi sono tutti +' uguali. Sono significativi solo i primi 16 bytes +compara_array = True +For i = 0 To 15 + If b1(i) <> b2(i) Then + compara_array = False + Exit For + End If +Next i +End Function +Sub copia_array(b1() As Byte, b2() As Byte) +' copia gli elementi di b2 in b1 +For i = 0 To 15 + b1(i) = b2(i) +Next i +End Sub + diff --git a/support/interni/src/dumb/esempi/dumb.frm b/support/interni/src/dumb/esempi/dumb.frm new file mode 100755 index 000000000..7bc1ac2db --- /dev/null +++ b/support/interni/src/dumb/esempi/dumb.frm @@ -0,0 +1,94 @@ +VERSION 4.00 +Begin VB.Form Form1 + BorderStyle = 1 'Fixed Single + Caption = "DUMB Test" + ClientHeight = 2040 + ClientLeft = 1140 + ClientTop = 1512 + ClientWidth = 3708 + Height = 2460 + Left = 1092 + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 2040 + ScaleWidth = 3708 + Top = 1140 + Width = 3804 + Begin VB.CommandButton Command2 + Caption = "Esci" + Height = 375 + Left = 2160 + TabIndex = 4 + Top = 1440 + Width = 1335 + End + Begin VB.CheckBox Check1 + Enabled = 0 'False + Height = 252 + Left = 1920 + TabIndex = 3 + Top = 600 + Width = 252 + End + Begin VB.TextBox Text1 + Height = 288 + Left = 840 + TabIndex = 1 + Top = 600 + Width = 372 + End + Begin VB.CommandButton Command1 + Caption = "Test" + Height = 375 + Left = 120 + TabIndex = 0 + Top = 1440 + Width = 1335 + End + Begin VB.Label Label2 + Caption = "Autorizzazione" + Height = 252 + Left = 2280 + TabIndex = 5 + Top = 600 + Width = 1092 + End + Begin VB.Label Label1 + Caption = "Modulo" + Height = 255 + Left = 120 + TabIndex = 2 + Top = 600 + Width = 615 + End +End +Attribute VB_Name = "Form1" +Attribute VB_Creatable = False +Attribute VB_Exposed = False + +Private Sub Command1_Click() + ' Prende il modulo inserito e chiama la funzione + ' GetAut(), settando il checkbox se il modulo + ' e' abilitato o meno + If (GetAut(Val(Text1.Text))) Then + Check1.Value = Checked + Else + Check1.Value = Unchecked + End If +End Sub + + +Private Sub Command2_Click() +End +End Sub + + +Private Sub Form_Load() + ' Questo e' solo un esempio, ma in realta + ' Andrebbe generato un numero veramente casuale... + Randomize Timer + +End Sub + + diff --git a/support/interni/src/dumb/esempi/dumb.vbp b/support/interni/src/dumb/esempi/dumb.vbp new file mode 100755 index 000000000..203fa9b04 --- /dev/null +++ b/support/interni/src/dumb/esempi/dumb.vbp @@ -0,0 +1,22 @@ +Form=DUMB.FRM +Module=Modulo1; DUMB.BAS +Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.0#0; COMDLG16.OCX +Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.0#0; TABCTL16.OCX +Object={FAEEE763-117E-101B-8933-08002B2F4F5A}#1.0#0; DBLIST16.OCX +Object={00028C01-0000-0000-0000-000000000046}#1.0#0; DBGRID16.OCX +Reference=*\G{BEF6E001-A874-101A-8BBA-00AA00300CAB}#1.0#0#C:\WINDOWS\SYSTEM\OC25.DLL#Standard OLE Types +Reference=*\G{00025E01-0000-0000-C000-000000000046}#2.5#0#C:\WINDOWS\SYSTEM\DAO2516.DLL#Microsoft DAO 2.5 Object Library +ProjWinSize=127,687,233,129 +ProjWinShow=2 +IconForm="Form1" +ExeName="DUMB.EXE" +Name="Proget1" +HelpContextID="0" +StartMode=0 +VersionCompatible="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Aga Informatica" diff --git a/support/interni/src/dumb/esempi/es_dllvb.txt b/support/interni/src/dumb/esempi/es_dllvb.txt new file mode 100755 index 000000000..9525ae991 --- /dev/null +++ b/support/interni/src/dumb/esempi/es_dllvb.txt @@ -0,0 +1,178 @@ +================================= +4: Passaggio e restituzione di stringhe +================================= + +Le stringhe a lunghezza variabile vengono mantenute all'interno di Visual Basic +come BSTR. Nei file di intestazione OLE, i BSTR vengono definiti come +OLECHAR FAR *. Un OLECHAR corrisponde ad un carattere UNICODE +nell'OLE a 32 bit e ad un carattere ANSI nell'OLE a 16 bit. Un BSTR può +contenere valori NULL, in quanto nel BSTR viene mantenuto, tra gli altri, +un'attributo che specifica la lunghezza della variabile. I BSTR contengono +un valore NULL come valore terminale e possono pertanto essere trattati +come LPSTR. L'attributo relativo alla lunghezza viene attualmente +memorizzato nella posizione che precede immediatamente la stringa. +Questa caratteristica, tuttavia, potrebbe essere modificata in futuro +in modo da consentire di accedere alla lunghezza della stringa +utilizzando le API OLE. + +Il passaggio di una stringa da Visual Basic ad una DLL può essere +eseguito in due modi. È possibile passare la stringa "per valore" +(ByVal) o "per riferimento". Se si passa una stringa ByVal, +Visual Basic passa un puntatore che fa riferimento all'inizio dei dati +della stringa, ovvero passa un BSTR. Quando una stringa viene passata +per riferimento, Visual Basic passa un puntatore al puntatore +che fa riferimento ai dati della stringa, ovvero passa un BSTR *. + +La seguente tabella indica quali attributi vengono passati da Visual Basic +ad una DLL durante il passaggio di una stringa. + +Versione Per valore Per riferimento +------------------------------------ +3.0 LPSTR HLSTR +4.0 BSTR BSTR * + +In Visual Basic 3.0, era possibile utilizzare le routine API di Visual Basic +per accedere ad un HLSTR e modificarlo. In Visual Basic 4.0, è necessario +utilizzare le API OLE per accedere ad un BSTR. Nella seguente tabella +vengono riportate le API per la gestione delle stringhe in Visual Basic +3.0 e gli equilvalenti OLE. + + +API di Visual Basic API OLE +-------------------------------------------------------- +VBCreateHlstr SysAllocString/SysAllocStringLen +VBCreateTempHlstr SysAllocString/SysAllocStringLen +VBDerefHlstr* N/A +VBDerefHlstrLen* N/A +VBDerefZeroTermHlstr N/A +VBDestroyHlstr SysFreeString +VBGetHlstrLen SysStringLen +VBResizeHlstr SysReAllocStringLen +VBSetHlstr SysReAllocString + +NOTA: Il BTSR è un puntatore che fa riferimento alla stringa, +pertanto non è necessario eliminare i riferimenti contenuti in tale puntatore. + + +Esempio per le versioni a 16\32 bit +----------------- + +La prima funzione considerata in questo esempio accetta una stringa +Visual Basic per riferimento e restituisce una copia a lettere maiuscole +di tale stringa. La seconda funzione accetta una stringa Visual Basic per +valore e restituisce, analogamente, una copia a lettere maiuscole di tale +stringa. Queste funzioni sono dunque simili alla funzione UCase di +Visual Basic. In entrambi i casi, la funzione della DLL modifica la stringa +passata, che viene quindi restituita a VB. Ciò accade inoltre quando la +stringa di VB viene passata "ByVal", in quanto alla funzione DLL viene +passato un BSTR che corrisponde ad un char far *. Sarà pertanto possibile +accedere direttamente al buffer della memoria a cui punta il BTSR. + + +#include +#include + +#ifdef _WIN32 + #define CCONV _stdcall + #define NOMANGLE +#else + #define CCONV FAR PASCAL _export + #define NOMANGLE EXTERN_C + #include + #include + #include + #include + #include +#endif + +NOMANGLE BSTR CCONV UpperCaseByRef(BSTR *pbstrOriginal) +{ + BSTR bstrUpperCase; + int i; + int cbOriginalLen; + LPSTR strSrcByRef, strDst; + + #if !defined(_WIN32) + cbOriginalLen = SysStringLen(*pbstrOriginal); + #else + cbOriginalLen = SysStringByteLen(*pbstrOriginal); + #endif + + bstrUpperCase = SysAllocStringLen(NULL, cbOriginalLen); + + strSrcByRef = (LPSTR)*pbstrOriginal; + strDst = (LPSTR)bstrUpperCase; + + for(i=0; i<=cbOriginalLen; i++) + *strDst++ = toupper(*strSrcByRef++); + + SysReAllocString (pbstrOriginal, (BSTR)"Arrivederci"); + + return bstrUpperCase; +} + +NOMANGLE BSTR CCONV UpperCaseByVal(BSTR bstrOriginal) +{ + BSTR bstrUpperCase; + int i; + int cbOriginalLen; + LPSTR strSrcByVal, strDst; + + #if !defined(_WIN32) + cbOriginalLen = SysStringLen(bstrOriginal); + #else + cbOriginalLen = SysStringByteLen(bstrOriginal); + #endif + + bstrUpperCase = SysAllocStringLen(NULL, cbOriginalLen); + + strSrcByVal = (LPSTR)bstrOriginal; + strDst = (LPSTR)bstrUpperCase; + + for(i=0; i<=cbOriginalLen; i++) + *strDst++ = toupper(*strSrcByVal++); + + SysReAllocString (&bstrOriginal, (BSTR)"Arrivederci"); + + return bstrUpperCase; +} + + +Il seguente codice Visual Basic richiama le due funzioni UpperCase illustrate +in precedenza: + + +#If Win32 Then + + Private Declare Function UpperCaseByRef Lib "vb4dll32.dll" (Str _ + As String) As String + Private Declare Function UpperCaseByVal Lib "vb4dll32.dll" _ + (ByVal Str As String) As String + +#Else + + Private Declare Function UpperCaseByRef Lib "vb4dll16.dll" (Str _ + As String) As String + Private Declare Function UpperCaseByVal Lib "vb4dll16.dll" _ + (ByVal Str As String) As String + +#End If + + +Private Sub StringTest () + + Dim Str As String, NewStr As String + + Str = "Salve gente!" + MsgBox "In VB, Prima: " & Str + NewStr = UpperCaseByRef(Str) + MsgBox "In VB, Dopo: " & Str + MsgBox "In VB, StrMaiuscola: " & NewStr + + Str = "Salve gente!" + MsgBox "In VB, Prima: " & Str + NewStr = UpperCaseByVal(Str) + MsgBox "In VB, Dopo: " & Str + MsgBox "In VB, StrMaiuscola: " & NewStr + +End Sub diff --git a/support/interni/src/dumb/esempi/prassi.prg b/support/interni/src/dumb/esempi/prassi.prg new file mode 100755 index 000000000..40ba62139 --- /dev/null +++ b/support/interni/src/dumb/esempi/prassi.prg @@ -0,0 +1,83 @@ +* programma principale +* includere dumb.fll all'inizio del programma +* per effettuare automaticamente le operazioni +* di HL_LOGIN sulla chiave + +SET LIBR TO DUMB.FLL + + + ? HL_GETAUT(41) + ? HL_GETAUT(42) + ? HL_GETAUT(45) + ? HL_GETAUT(5) + ? HL_GETAUT(11) + ? HL_GETAUT(18) + ? HL_GETAUT(21) + +************ Funzione HL_GETAUT +************ prende in input il numero del modulo +************ di cui si vuole sapere l'abilitazione +************ restituisce: +************ 0 se non abilitato +************ 1 se abilitato +FUNCTION HL_GETAUT + PARAMETER MODULO + + DIMENSION RISULTATO(18) + DIMENSION TMP_RES(18) + OLD_DECIMALS = INT(VAL(SYS(2001,'DECIMALS'))) + SET DECIMALS TO 6 + STORE 0 TO ABILITAZIONE + STORE "P39S41" TO STRINGA_SEGRETA + ** Cripta la chiave di ricerca casualmente + CASUALE = STR(INT(RAND(-1) * 1000000),6,0) + CASUALE = CASUALE + TRANSFORM(MODULO,"@L 999") + CHIAVE = STRINGA_SEGRETA + LEFT(CASUALE,3) + + FOR I = 1 TO 16 + IF I > 9 THEN + RISULTATO (I) = 32 && PAD a 16 bytes + ELSE + RISULTATO(I) = ASC(SUBSTR(CHIAVE,I,1)) + ASC(SUBSTR(CASUALE,I,1)) + ENDIF + ENDFOR + + ** Controlla che la chiave codificata non sia uguale + =ACOPY(RISULTATO,TMP_RES) + =HL_CODE(@RISULTATO) + STORE .T. TO UGUALI + FOR I = 1 TO 16 + IF RISULTATO(I) <> TMP_RES(I) THEN + UGUALI = .F. + ENDIF + ENDFOR + IF UGUALI THEN + SET DECIMALS TO OLD_DECIMALS + RETURN 0 + ENDIF + + ** Passa alla FLL la stringa da analizzare + =HL_GETSTR(@RISULTATO) + + ** Ora analizza la stringa ritornata, prima la ricodifica + =ACOPY(RISULTATO,TMP_RES) + =HL_CODE(@RISULTATO) + STORE .T. TO UGUALI + FOR I = 1 TO 16 + IF RISULTATO(I) <> TMP_RES(I) THEN + UGUALI = .F. + ENDIF + ENDFOR + IF UGUALI THEN + SET DECIMALS TO OLD_DECIMALS + RETURN 0 + ENDIF + + ** Infine estrae... l'autorizzazione + TERZO_CARATTERE = CHR(RISULTATO(3) - ASC(SUBSTR(STRINGA_SEGRETA,3,1))) + ULTIMO_CARATTERE = CHR(RISULTATO(9) - ASC(TERZO_CARATTERE)) + + ABILITAZIONE = INT(VAL(ULTIMO_CARATTERE)) + + SET DECIMALS TO OLD_DECIMALS + RETURN ABILITAZIONE diff --git a/support/interni/src/dumb/esempi/procom.c b/support/interni/src/dumb/esempi/procom.c new file mode 100755 index 000000000..f923c68ae --- /dev/null +++ b/support/interni/src/dumb/esempi/procom.c @@ -0,0 +1,89 @@ +#include +#include + +/* +Funzione HL_GETAUT +prende in input il numero del modulo +di cui si vuole sapere l'abilitazione +restituisce: +0 se non abilitato +1 se abilitato +*/ +int hl_getaut(int modulo) +{ + char risultato[18]; + char tmp_res[18] + char stringa_segreta[18] + char casuale[36] + char chiave[18] + int abilitazione = 0,i; + + strcpy(stringa_segreta,"P39S41"); + /* Generare un numero casuale di 6 cifre... */ + srand( (unsigned)time( NULL ) ); + sprintf(casuale,"%d%d%d%d%d%d", rand(),rand(),rand(),rand(),rand(),rand() ); + casuale[6] = '\0'; /* Tronca a 6 la stringa casuale */ + /* Gli ultimi 3 caratteri della stringa sara' il modulo zerofilled (ex: 21 -> 021, 7 -> 007 ecc */ + sprintf(casuale,"%s%03d",casuale,modulo); + /* Compone la chiave: stringa_segreta + i primi 3 caratteri della stringa casuale */ + strcpy(chiave,stringa_segreta); + strcat(chiave,casuale); + chiave[9] = '\0'; + + /* Codifica la stringa chiave tramite la stringa casuale */ + /* Esegue la somma algebrica dei valori ASCII dei singoli caratteri */ + for (i=0; i < 16; i++) + { + if (i>8) + risultato[i] = ' '; /* I caratteri in eccesso diventano blanks */ + else + risultato[i] = chiave[i] + casuale[i]; + } + + /* Chiama la funzione hl_code(), che effettua una ulteriore crittografazione */ + strcpy(tmp_res,risultato); + hl_code(risultato); + if (strcmp(risultato,tmp_res) == 0) + return 0; /* Se le stringhe sono uguali significa che la chiave non c'e' o che qualcuno sta + cercando di sproteggere il programma */ + + /* Ora passiamo la stringa criptata alla DLL per farci restituire l'autorizzazione */ + hl_getstr(risultato); + + /* Chiama la funzione hl_code(), che effettua la crittografazione al contrario */ + strcpy(tmp_res,risultato); + hl_code(risultato); + if (strcmp(risultato,tmp_res) == 0) + return 0; /* Se le stringhe sono uguali significa che la chiave non c'e' o che qualcuno sta + cercando di sproteggere il programma */ + + /* Adesso possiamo estrarre l'autorizzazione */ + /* Ricodifichiamo seguendo il procedimento inverso: */ + /* Sottraiamo i valori ASCII dal risultato carattere per carattere */ + terzo_carattere = risultato[2] - stringa_segreta[2]; + ultimo_carattere = risultato[8] - terzo_carattere; + + abilitazione = ultimo_carattere; + + return abilitazione; +} + +int PASCAL WinMain(HINSTANCE cur, HINSTANCE prev, LPSTR cmd, int i) +{ + char m[128]; + +/* Visualizza l'autorizzazione per il Modulo 21 */ + wsprintf(m,"Module %d: %d",21,hl_getaut(21)); + MessageBox(NULL,m,"API",MB_OK); + +/* Visualizza l'autorizzazione per il Modulo 33 */ + wsprintf(m,"Module %d: %d",33,hl_getaut(33)); + MessageBox(NULL,m,"API",MB_OK); + +/* Visualizza l'autorizzazione per il Modulo 7 */ + wsprintf(m,"Module %d: %d",7,hl_getaut(7)); + MessageBox(NULL,m,"API",MB_OK); + + return (1); +} + diff --git a/support/interni/src/dumb/esempi/procom.prg b/support/interni/src/dumb/esempi/procom.prg new file mode 100755 index 000000000..40ba62139 --- /dev/null +++ b/support/interni/src/dumb/esempi/procom.prg @@ -0,0 +1,83 @@ +* programma principale +* includere dumb.fll all'inizio del programma +* per effettuare automaticamente le operazioni +* di HL_LOGIN sulla chiave + +SET LIBR TO DUMB.FLL + + + ? HL_GETAUT(41) + ? HL_GETAUT(42) + ? HL_GETAUT(45) + ? HL_GETAUT(5) + ? HL_GETAUT(11) + ? HL_GETAUT(18) + ? HL_GETAUT(21) + +************ Funzione HL_GETAUT +************ prende in input il numero del modulo +************ di cui si vuole sapere l'abilitazione +************ restituisce: +************ 0 se non abilitato +************ 1 se abilitato +FUNCTION HL_GETAUT + PARAMETER MODULO + + DIMENSION RISULTATO(18) + DIMENSION TMP_RES(18) + OLD_DECIMALS = INT(VAL(SYS(2001,'DECIMALS'))) + SET DECIMALS TO 6 + STORE 0 TO ABILITAZIONE + STORE "P39S41" TO STRINGA_SEGRETA + ** Cripta la chiave di ricerca casualmente + CASUALE = STR(INT(RAND(-1) * 1000000),6,0) + CASUALE = CASUALE + TRANSFORM(MODULO,"@L 999") + CHIAVE = STRINGA_SEGRETA + LEFT(CASUALE,3) + + FOR I = 1 TO 16 + IF I > 9 THEN + RISULTATO (I) = 32 && PAD a 16 bytes + ELSE + RISULTATO(I) = ASC(SUBSTR(CHIAVE,I,1)) + ASC(SUBSTR(CASUALE,I,1)) + ENDIF + ENDFOR + + ** Controlla che la chiave codificata non sia uguale + =ACOPY(RISULTATO,TMP_RES) + =HL_CODE(@RISULTATO) + STORE .T. TO UGUALI + FOR I = 1 TO 16 + IF RISULTATO(I) <> TMP_RES(I) THEN + UGUALI = .F. + ENDIF + ENDFOR + IF UGUALI THEN + SET DECIMALS TO OLD_DECIMALS + RETURN 0 + ENDIF + + ** Passa alla FLL la stringa da analizzare + =HL_GETSTR(@RISULTATO) + + ** Ora analizza la stringa ritornata, prima la ricodifica + =ACOPY(RISULTATO,TMP_RES) + =HL_CODE(@RISULTATO) + STORE .T. TO UGUALI + FOR I = 1 TO 16 + IF RISULTATO(I) <> TMP_RES(I) THEN + UGUALI = .F. + ENDIF + ENDFOR + IF UGUALI THEN + SET DECIMALS TO OLD_DECIMALS + RETURN 0 + ENDIF + + ** Infine estrae... l'autorizzazione + TERZO_CARATTERE = CHR(RISULTATO(3) - ASC(SUBSTR(STRINGA_SEGRETA,3,1))) + ULTIMO_CARATTERE = CHR(RISULTATO(9) - ASC(TERZO_CARATTERE)) + + ABILITAZIONE = INT(VAL(ULTIMO_CARATTERE)) + + SET DECIMALS TO OLD_DECIMALS + RETURN ABILITAZIONE diff --git a/support/interni/src/dumb/getaut.c b/support/interni/src/dumb/getaut.c new file mode 100755 index 000000000..16b3a1a30 --- /dev/null +++ b/support/interni/src/dumb/getaut.c @@ -0,0 +1,64 @@ +#include "hlapi_c.h" + +#define BOOLEAN int +#define FALSE 0 +#define TRUE 1 +#define HLBLOCK 1 +#define CBITTEST(w,p) (((w) & (0x0001 << (p))) != 0) + +Word _int_tab0[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0x0000}; +Word SerNo = -1; + +/* +Restituisce il numero di serie della chiave +*/ + +Word getser() + +{ + Word Val[4]; + BOOLEAN ok; + int i; + + SerNo = -1; + if (HL_AVAIL() == STATUS_OK) + { + SerNo = 0; + HL_READ(0, &Val[0]); + HL_READ(1, &Val[1]); + HL_READ(2, &Val[2]); + HL_READ(3, &Val[3]); + HL_CODE(EYECAST &Val[0], HLBLOCK); + if (Val[0] == 0xFAE8) + { + SerNo = Val[1]; + return(Val[1]); + } + } + return (0); +} + +/* +Restituisce l'autorizzazione ad utilizzare un modulo +*/ + +BOOLEAN CGetAut(af) +int af; /* numero del modulo */ +{ + int i; + BOOLEAN ok; + + if (!af) return(!af); + if (af > 48) return(FALSE); + if (!SerNo) return(!getser()); + HL_READ(48, &_int_tab0[0]); + HL_READ(49, &_int_tab0[1]); + HL_READ(50, &_int_tab0[2]); + HL_READ(51, &_int_tab0[3]); + HL_CODE(EYECAST &_int_tab0[0], HLBLOCK); + for (i = 0; i < 4; i++) _int_tab0[i] ^= SerNo; + if (_int_tab0[3]) return(FALSE); + af--; + return(CBITTEST(_int_tab0[af / 16], af % 16)); +} + diff --git a/support/interni/src/dumb/harddll.def b/support/interni/src/dumb/harddll.def new file mode 100755 index 000000000..402875933 --- /dev/null +++ b/support/interni/src/dumb/harddll.def @@ -0,0 +1,16 @@ +LIBRARY HARDDLL +DESCRIPTION 'Hardlock DLL' +EXETYPE WINDOWS +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD FIXED SINGLE + +HEAPSIZE 4096 + +EXPORTS + +H_LOGIN @1 +H_LOGOUT @2 +H_GETAUT @3 +H_GETSER @4 + + diff --git a/support/interni/src/dumb/harddll.lrf b/support/interni/src/dumb/harddll.lrf new file mode 100755 index 000000000..c6eea9075 --- /dev/null +++ b/support/interni/src/dumb/harddll.lrf @@ -0,0 +1,8 @@ +harddll+getaut +..\..\hardlock.dll +nul +libw+ +/NOD:llibce ldllcew+ +hlapi_cd +harddll.def + diff --git a/support/interni/src/dumb/hardfll.def b/support/interni/src/dumb/hardfll.def new file mode 100755 index 000000000..4b59953ed --- /dev/null +++ b/support/interni/src/dumb/hardfll.def @@ -0,0 +1,6 @@ +LIBRARY HARDFLL +EXETYPE WINDOWS 3.0 +CODE PRELOAD MOVABLE SHARED +DATA SHARED PRELOAD + + diff --git a/support/interni/src/dumb/hardfll.lrf b/support/interni/src/dumb/hardfll.lrf new file mode 100755 index 000000000..ad91b3038 --- /dev/null +++ b/support/interni/src/dumb/hardfll.lrf @@ -0,0 +1,9 @@ +hardfll+getaut+..\foxlck\libentry +..\..\hardlock.fll +nul +..\foxlck\proapiml+ +libw+ +/NOD:llibce ldllcew+ +hlapi_cd +hardfll.def + diff --git a/support/interni/src/dumb/hardlock.c b/support/interni/src/dumb/hardlock.c new file mode 100755 index 000000000..b064dfd5b --- /dev/null +++ b/support/interni/src/dumb/hardlock.c @@ -0,0 +1,137 @@ +#ifdef FLL +#include "../foxlck/pro_ext.h" +#else +#include +#ifdef _MSC_VER +#define _BreakPoint() __asm \ +{ \ + int 3h \ +} +#endif +#endif + +#include "hlapi_c.h" + +#define MODULE 26952 +#define REFKEY "CAMPOKEY" +#define VERKEY "ìpÙˆ¬cê<" + +unsigned int getser(); +int CGetAut(int); + +#ifdef FLL +int FAR Fox_HL_LOGIN() +{ +#ifdef DBG + _BreakPoint(); +#endif + /* Questa riga e' solo temporanea! 11.3.1996, per ovviare a problemi sul alcuni PC */ + /* con la parallela non compatibile */ + HL_LOGIN(MODULE, DONT_CARE, REFKEY, VERKEY); + getser(); + return 1; +} + +int FAR Fox_HL_LOGOUT() +{ + /* Questa riga e' solo temporanea! 11.3.1996, per ovviare a problemi sul alcuni PC */ + /* con la parallela non compatibile */ + HL_LOGOUT(); + return 1; +} + + +long getlong(ParamBlk FAR *parm, int pos) +{ + long val = 0; + + if (pos < parm->pCount && parm->p[pos].val.ev_type == 'I') + val = parm->p[pos].val.ev_long; + + return val; +} + + +int FAR Fox_getser() +{ + int r; + /* Questa riga e' solo temporanea! 11.3.1996, per ovviare a problemi sul alcuni PC */ + /* con la parallela non compatibile */ + /*r = 1;*/ + r = getser(); + _RetInt(r, 10); + return r; +} + + +int FAR Fox_CGetAut(ParamBlk FAR *parm) +{ + int module = getlong(parm, 0); + int ok; + /* Questa riga e' solo temporanea! 11.3.1996, per ovviare a problemi sul alcuni PC */ + /* con la parallela non compatibile */ + /*if (module == 21 || module == 22) ok = 1;*/ + ok = CGetAut(module); + _RetLogical(ok); + return ok; +} + + +FoxInfo hardlockFoxInfo[] = +{ + { "HL_LOGIN", (FPFI)Fox_HL_LOGIN, CALLONLOAD, "" }, + { "HL_LOGOUT", (FPFI)Fox_HL_LOGOUT, CALLONUNLOAD, "" }, + { "HL_GETSER", (FPFI)Fox_getser, 0, "" }, + { "HL_GETAUT", (FPFI)Fox_CGetAut, 1, "I" } +}; + +FoxTable _FoxTable = +{ + (FoxTable FAR *)0, + sizeof(hardlockFoxInfo)/sizeof(FoxInfo), + hardlockFoxInfo +}; + +#else +int far pascal _export h_login() +{ +#ifdef DBG + _BreakPoint(); +#endif + + return HL_LOGIN(MODULE, DONT_CARE, REFKEY, VERKEY); +} + +int far pascal _export h_logout() +{ + HL_LOGOUT(); + return 0; +} + +int far pascal _export h_getser() +{ + int a ; + a = getser(); + return a; +} + + +int far pascal _export h_getaut(int module) +{ + int ok = CGetAut(module); + return ok; +} + +int CALLBACK LibMain (HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine) +{ + int rt = h_login(); + return rt == STATUS_OK; +} + +int CALLBACK WEP (int nExitType) +{ + if (nExitType == WEP_FREE_DLL) + h_logout(); + return 1; +} +#endif diff --git a/support/interni/src/dumb/hlapi_c.h b/support/interni/src/dumb/hlapi_c.h new file mode 100755 index 000000000..69cd0c72f --- /dev/null +++ b/support/interni/src/dumb/hlapi_c.h @@ -0,0 +1,172 @@ +#ifndef __HLAPI_H +#define __HLAPI_H + +/****************************************************************************/ +/** **/ +/** Hardlock E-Y-E **/ +/** API-Structures and definitions **/ +/** **/ +/** This file contains some helpful defines to access a Hardlock using **/ +/** the application programing interface (API) for Hardlock E-Y-E. **/ +/** **/ +/** (c) 1992 by ///FAST Electronic **/ +/** **/ +/** **/ +/** Authors : Thomas Schr”ter **/ +/** Henri Volk **/ +/** Version : 3.0 **/ +/** Date : 01-Sep-1992 **/ +/** **/ +/****************************************************************************/ + +#define EYECAST (char huge *) + +/* -------------------------------- */ +/* Definitions and API structures : */ +/* -------------------------------- */ +typedef unsigned char Byte; +typedef signed short Word; +typedef unsigned long Long; + +typedef struct + { + Word Use_Key; + Byte Key[8]; + } + DES_MODE; + +typedef struct + { + Word ModAd; /* Moduleaddress EYE */ + Word Register; /* Memory register adress */ + Word Value; /* Memory value */ + Byte Reserved[4]; + } + EYE_MODE; + +typedef union + { + DES_MODE Des; + EYE_MODE Eye; + } + HARDWARE; + +typedef struct hl_api + { + Byte API_Version_ID[2]; /* Version */ + Word API_Options[2]; /* API Optionflags */ + Word ModID; /* Modul-ID (EYE = 0...) */ + HARDWARE Module; /* Hardware type */ + void far *Data; /* Pointer to cipher data */ + Word Bcnt; /* Number of blocks */ + Word Function; /* Function number */ + Word Status; /* Actual status */ + Word Remote; /* Remote or local?? */ + Word Port; /* Port address if local */ + Word Speed; /* Speed of port if local */ + Word NetUsers; /* Current Logins (HLSERVER) */ + Byte ID_Ref[8]; /* Referencestring */ + Byte ID_Verify[8]; /* Encrypted ID_Ref */ + Long Task_ID; /* Multitasking program ID */ + Byte Reserved[200]; /* Reserved area */ + } + HL_API; + +/* ------------- */ +/* Module-ID's : */ +/* ------------- */ +#define EYE_DONGLE 0 /* Hardlock E-Y-E */ +#define DES_DONGLE 1 /* FAST DES */ + +/* --------------------- */ +/* API function calls : */ +/* --------------------- */ +#define API_INIT 0 /* Init API structure */ +#define API_DOWN 1 /* Free API structure */ +#define API_FORCE_DOWN 31 /* Force deinintialization */ +#define API_MULTI_SHELL_ON 2 /* MTS is enabled */ +#define API_MULTI_SHELL_OFF 3 /* MTS is disabled */ +#define API_MULTI_ON 4 /* Enable MTS */ +#define API_MULTI_OFF 5 /* Disable MTS */ +#define API_AVAIL 6 /* Dongle available? */ +#define API_LOGIN 7 /* Login dongle server */ +#define API_LOGOUT 8 /* Logout dongle server */ +#define API_INFO 9 /* Get API informations */ + +/* --------------------------- */ +/* Data and memory functions : */ +/* --------------------------- */ +#define API_KEYE 11 /* Use KEYE for encryption */ +#define API_READ 20 /* Read one word of dongle EEPROM */ +#define API_WRITE 21 /* Write one word of dongle EEPROM */ +#define API_READ_BLOCK 23 /* Read EEPROM in one block */ +#define API_WRITE_BLOCK 24 /* Write EEPROM in one block */ +#define API_GET_ID_KEY 30 /* Encrypt ID_Ref to ID_Verify */ +#define API_ABORT 53 /* Critical Error Abort */ + +/* -------------------- */ +/* Dongle access mode : */ +/* -------------------- */ +#define LOCAL_DEVICE 1 /* Query local HL only */ +#define NET_DEVICE 2 /* Query remote HL only */ +#define DONT_CARE 3 /* Query local or remote HL */ + +/* ------------------ */ +/* API Status Codes : */ +/* ------------------ */ +#define STATUS_OK 0 /* API call was succesfull */ +#define NOT_INIT 1 /* DONGLE not initialized */ +#define ALREADY_INIT 2 /* Already initialized */ +#define UNKNOWN_DONGLE 3 /* Device not supported */ +#define UNKNOWN_FUNCTION 4 /* Function not supported */ +#define NO_DONGLE 7 /* No device available */ +#define NETWORK_ERROR 8 /* A network error occured */ +#define NO_ACCESS 9 /* No device available */ +#define INVALID_PARAM 10 /* A wrong parameter occured */ +#define VERSION_MISMATCH 11 /* HL-Server not API version */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* --------------------- */ +/* Function prototypes : */ +/* --------------------- */ +static int CALL_API (HL_API far *as); +Word far HL_LOGIN (Word ModAd, Word Access, char * RefKey, char * VerKey); +Word far HL_LOGOUT (void); +Word far HL_AVAIL (void); +Word far HL_PORTINF (void); +Word far HL_ACCINF (void); +Word far HL_USERINF (void); +Word far HL_MAXUSER (void); +Word far HL_MEMINF (void); +Word far HL_CODE (void far *Data, Word Count); +Word far HL_WRITE (Word Register, Word Value); +Word far HL_READ (Word Register, int far *Value); +char far * HL_GET_ID (char * id_ref); +Word far HL_READBL (char * Eeprom); +Word far HL_WRITEBL (char * Eeprom); +Word far HL_ABORT (void); +Word far HL_VERSION (void); + +/****************************************************************************/ +/****************************************************************************/ +/* The following functions map the old Hardlock Calls on the new API. These */ +/* functions are defined only for compatibility reasons. */ +/* !!! Don't mix old and new functions. Don't use if it is not necessary.!!!*/ +/****************************************************************************/ +/****************************************************************************/ +void far HL_ON (int Port, Word ModAd); +void far HL_OFF (int Port); +int far K_EYE (int Port, char huge *Inp, int BlkCnt); +void far HL_WR (int Port, int Register, Word Val); +Word far HL_RD (int Port, int Register); +void far INT_ON (void); +void far INT_OFF (void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/support/interni/src/dumb/hlapi_cd.lib b/support/interni/src/dumb/hlapi_cd.lib new file mode 100755 index 000000000..3dc1c181b Binary files /dev/null and b/support/interni/src/dumb/hlapi_cd.lib differ diff --git a/support/interni/src/dumb/makefile b/support/interni/src/dumb/makefile new file mode 100755 index 000000000..3fbf383e0 --- /dev/null +++ b/support/interni/src/dumb/makefile @@ -0,0 +1,82 @@ +# +# Comand per avere le versioni di DEBUG: +# nmake DBG=D +# +# + +# +# Compiler setup +# +CC = cl +CFLAGS = /nologo /c /ALw # large memory model; SS != DS; DS not loaded at fn entry +CFLAGS = $(CFLAGS) /DWINVER=0x0300 +CFLAGS = $(CFLAGS) /FPc # calls floating point emulator library +CFLAGS = $(CFLAGS) /GD # fn entry code optimized for Windows DLLs +CFLAGS = $(CFLAGS) /Gs # suppress stack checking (see GP p. 483) +CFLAGS = $(CFLAGS) /Oegs # optimizations (optional) +CFLAGS = $(CFLAGS) /W2 # set warning level as desired +! if "$(DBG)" == "D" +CFLAGS = $(CFLAGS) /DDBG +CFLAGS = $(CFLAGS) /Zi +! endif + +# +# Link setup +# +LINKER = link +LFLAGS = /ONERROR:NOEXE/NOFARCALL/NOE +! if "$(DBG)" == "D" +LFLAGS = $(LFLAGS) /CO +! endif + +SUPP=$(SROOT)/support/interni + +DLL=\ + $(SUPP)/hardlock.dll $(SUPP)/dumb.dll $(SUPP)/dumbvb.dll + +FLL=\ + $(SUPP)/hardlock.fll $(SUPP)/dumb.fll + +CLEAN=dummy + +.PRECIOUS: $(DLL) $(FLL) + +main: $(DLL) $(FLL) $(CLEAN) + +dummy: getaut.obj + del *.obj + +getaut.obj: getaut.c + $(CC) $(CFLAGS) getaut.c + +dumbdll.obj: dumb.c + $(CC) $(CFLAGS) /Fodumbdll.obj /DDUMBDLL dumb.c + +dumbvb.obj: dumb.c + $(CC) $(CFLAGS) /Fodumbvb.obj /DDUMBDLLVB dumb.c + +dumbfll.obj: dumb.c + $(CC) $(CFLAGS) /Fodumbfll.obj /DDUMBFLL dumb.c + +harddll.obj: hardlock.c + $(CC) $(CFLAGS) /Foharddll.obj /DDLL hardlock.c + +hardfll.obj: hardlock.c + $(CC) $(CFLAGS) /Fohardfll.obj /DFLL hardlock.c + +$(SUPP)/hardlock.dll: harddll.obj getaut.obj + $(LINKER) $(LFLAGS) @harddll.lrf + +$(SUPP)/dumb.dll: dumbdll.obj getaut.obj + $(LINKER) $(LFLAGS) @dumbdll.lrf + +$(SUPP)/dumbvb.dll: dumbvb.obj getaut.obj + $(LINKER) $(LFLAGS) @dumbvb.lrf + +$(SUPP)/hardlock.fll: hardfll.obj getaut.obj + $(LINKER) $(LFLAGS) @hardfll.lrf + +$(SUPP)/dumb.fll: dumbfll.obj getaut.obj + $(LINKER) $(LFLAGS) @dumbfll.lrf + + diff --git a/support/interni/src/dumb/readme b/support/interni/src/dumb/readme new file mode 100755 index 000000000..4ff7cfa8b --- /dev/null +++ b/support/interni/src/dumb/readme @@ -0,0 +1,51 @@ +Istruzioni per l'uso della libreria HARDLOCK.FLL + +La libreria HARDLOCK.FLL per Foxpro per Windows fornisce il supporto per +l'uso delle chiavi di protezione HARDLOCK-EYE. + +Le funzioni contenute nella libreria sono quattro: + +HL_LOGIN Chiamata automaticamente da SET LIBRARY +HL_LOGOUT Chiamata automaticamente da RELEASE LIBRARY +HL_GETSER Ritorna il numero di serie della chiave +HL_GETAUT Controlla l'autorizzazione di un modulo + +Per utilizzare le suddette funzioni basta inserire la seguente linea di +codice all'inizio del programma Foxpro: +SET LIBRARY TO HARDLOCK.FLL + +Alla fine bisogna invece inserire la riga: +RELEASE LIBRARY HARDLOCK.FLL + +*** HL_GETSER *** +Questa funzione ritorna un valore intero: +-1 Chiave non presente + 0 Chiave speciale per sviluppatori solamente +>0 Numero di serie della chiave + +Esempio: +? HL_GETSER() + +*** HL_GETAUT *** +Questa funzione ritorna un valore booleano e richiede un argomento di tipo +intero corrispondente al numero del modulo di cui si vuole verificare la +autorizzazione. + +N.B. Il numero del modulo della NOTA INTEGRATIVA e' 21. + +Esempio: +? HL_GETAUT(21) + + +SEARCHING +================================== + +Le chiamate di funzione sono rimaste invariate. +Per i personal PS/2 con architettura Microchannel +e' necessario settare questa variabile d'ambiente: + +SET HL_SEARCH=378i,278i,3BCi,IPX,NETBIOS + +Naturalmente e' necessario caricare anche la nuova +versione di HARDLOCK.FLL. + diff --git a/support/interni/src/foxlck/api_mc.lib b/support/interni/src/foxlck/api_mc.lib new file mode 100755 index 000000000..76780e64e Binary files /dev/null and b/support/interni/src/foxlck/api_mc.lib differ diff --git a/support/interni/src/foxlck/api_ml.lib b/support/interni/src/foxlck/api_ml.lib new file mode 100755 index 000000000..847ad5b27 Binary files /dev/null and b/support/interni/src/foxlck/api_ml.lib differ diff --git a/support/interni/src/foxlck/api_mm.lib b/support/interni/src/foxlck/api_mm.lib new file mode 100755 index 000000000..90c1377ed Binary files /dev/null and b/support/interni/src/foxlck/api_mm.lib differ diff --git a/support/interni/src/foxlck/api_ms.lib b/support/interni/src/foxlck/api_ms.lib new file mode 100755 index 000000000..722631b61 Binary files /dev/null and b/support/interni/src/foxlck/api_ms.lib differ diff --git a/support/interni/src/foxlck/dosc7.mak b/support/interni/src/foxlck/dosc7.mak new file mode 100755 index 000000000..0b0a13732 --- /dev/null +++ b/support/interni/src/foxlck/dosc7.mak @@ -0,0 +1,58 @@ +# +# Sample MS C/C++ 7 makefile for building a DOS API from a single C +# module. Also works with Microsoft's Visual C++. Usage: +# +# >nmake PLBNAME= MODEL= /F dosc7.mak +# +# The following two lines must be edited to reflect the directory +# structure of your machine. +# +C7DIR = c:\windev # where Microsoft C7 is installed +FOXDIR = c:\foxlck # location of FoxPro API + +CC = cl +# +# Uppercase MODEL because cl options are case sensitive +# +!IF "$(MODEL)" == "s" +MM = S +!ELSE IF "$(MODEL)" == "m" +MM = M +!ELSE IF "$(MODEL)" == "l" +MM = L +!ELSE IF "$(MODEL)" == "" # default to large if memory model not spec'd +MM = L +!ELSE +MM = $(MODEL) +!ENDIF + +CFLAGS = /A$(MM)w /Zp /GW /I$(FOXDIR) /I$(C7DIR)\include /Fs$(PLBNAME).lst + +LINKER = $(C7DIR)\bin\link +# LFLAGS = /ONERROR:NOEXE /NOF +LFLAGS = /ONERROR:NOEXE /NOE /NONULLS + +OBJS = $(FOXDIR)\api_m$(MM).obj $(PLBNAME).obj +LIBS = $(FOXDIR)\api_m$(MM).lib +MAPFILE = NUL +DEPENDS = $(PLBNAME).obj + +all: $(PLBNAME).plb + +$(PLBNAME).obj : $(PLBNAME).C $(FOXDIR)\pro_ext.h + set PATH=$(C7DIR)\bin;%PATH% + @$(CC) /c $(CFLAGS) /Fo$(PLBNAME).obj $(PLBNAME).C + +$(PLBNAME).plb : $(DEPENDS) + set PATH=$(C7DIR)\bin;%PATH% + set LIB=$(C7DIR)\lib + echo > NUL @<<$(PLBNAME).lrf + $(OBJS: = +^ + ) + $@ + $(MAPFILE) + $(LIBS: = +^ + ) + $(LFLAGS) +<< + $(LINKER) @$(PLBNAME).lrf diff --git a/support/interni/src/foxlck/pro_ext.h b/support/interni/src/foxlck/pro_ext.h new file mode 100755 index 000000000..1b8eea0ae --- /dev/null +++ b/support/interni/src/foxlck/pro_ext.h @@ -0,0 +1,1051 @@ +/* + +----------------------------------------------------------------------+ + | pro_ext.h | + +----------------------------------------------------------------------+ + + + ================ =========== + == === == == + == = == == + == == == + == === ===== ===== == == === ==== === + ===== == == == == ========= == == == == == + == == == == == == === == == + == == == === == == == == + == == == == == == == == == + == == == == == == == == == + ======= === ===== ==== ====== ====== === + + +--------------------------------------------------------------------------+ + | FoxPro -- Relational Database System | + +--------------------------------------------------------------------------+ + | | + | Copyright (c) 1989-1993 Microsoft Corporation as an unpublished | + | licensed proprietary work. All rights reserved. | + | | + | This software contains valuable trade secrets and proprietary | + | information, and is protected by federal copyright laws, the | + | violation of which can result in civil damages and criminal pro- | + | secution. Access to these source materials is granted only by | + | explicit written permission from Microsoft. | + | | + +--------------------------------------------------------------------------+ +*/ + +#ifdef __cplusplus + +extern "C" { /* Assume C declarations for C++ */ + +#endif /* __cplusplus */ + +#pragma pack(1) // Assume byte structure packing + +#ifndef PRO_EXT_INCLUDED + +#define PRO_EXT_INCLUDED + +/* Semi-portable way to deal with 'far' pointers */ +#ifndef FAR +#define FAR __far +#endif + +#ifndef GLOBAL_INCLUDED +typedef unsigned MHANDLE; /* A memory handle. */ +typedef int NTI; /* A name table index. */ +typedef unsigned long Ticks; /* A timer tick count. */ +#define TRUE 1 +#define FALSE 0 +#define YES 1 +#define NO 0 +typedef char TEXT; +#endif + +#if defined(I80386) +#if I80386 && !WINAPI16 +#ifdef GLOBAL_INCLUDED +#define MHANDLE unsigned short +#endif +#endif +#endif + +#if __WATCOMC__ +#ifndef __386__ +#pragma aux default parm routine [ax bx cx dx] modify [es]; +#endif +#endif + +typedef unsigned long WHandle; /* A Window Handle */ +typedef long MENUID; /* A Menu id. */ +typedef long MenuId; /* A Menu id. */ +typedef long ITEMID; /* An item id. */ +typedef long ItemId; /* An item id. */ + +typedef int FCHAN; /* A file I/O channel. */ +#define SCHEMEWIDTH 11 +typedef char Scheme[SCHEMEWIDTH];/* A FoxPro color scheme */ + + +#ifdef GLOBAL_INCLUDED + +#define WHANDLE WHandle + +#else + +typedef WHandle WHANDLE; /* Users can use WHANDLE */ + +#endif + +#ifndef FOXWIND_INCLUDED + +/* _WOpen() flag values. */ + +#define WCURSOR (1<<1) /* Enable the cursor */ +#define ZOOM (1<<2) /* Permit the window to be zoomed */ +#define ADJ (1<<3) /* Allow Window Size to be Adjusted */ +#define CLOSE (1<<4) /* Permit Closing of System Window */ +#define MOVE (1<<5) /* Allow the window to be moved */ +#define HSCROLLBAR (1<<6) /* Show Horizontal Scrollbars */ +#define VSCROLLBAR (1<<7) /* Show Vertical Scrollbars */ +#define AUTOSCROLL (1<<8) /* Window should Auto scroll */ +#define WEVENT (1<<10) /* Participates in activate/deact events */ +#define SHADOW (1<<11) /* Window will produce a shadow */ +#define WMODAL (1<<12) /* Window is a modal window */ +#define WMINIMIZE (1<<13) /* Window can be minimized */ + +#endif + +#ifndef FOXEVENT_INCLUDED + +/* _FindWindow() return values. */ +#define inBorder 0 /* In the window border region */ +#define inHelp 1 /* In the Help region */ +#define inContent 2 /* In the content/text region */ +#define inDrag 3 /* In the Drag/Title bar region */ +#define inGrow 4 /* In the grow/resize region */ +#define inGoAway 5 /* In the goAway/close region */ +#define inZoom 6 /* In the zoom region */ +#define inVUpArrow 7 /* In the vertical up arrow region */ +#define inVDownArrow 8 /* In the vertical down arrow region */ +#define inVPageUp 9 /* In the vertical page up region */ +#define inVPageDown 10 /* In the vertical page down region */ +#define inVThumb 11 /* In the vertical thumb region */ +#define inHUpArrow 12 /* In the horizontal up arrow region */ +#define inHDownArrow 13 /* In the horizontal down arrow region */ +#define inHPageUp 14 /* In the horizontal page up region */ +#define inHPageDown 15 /* In the horizontal page down region */ +#define inHThumb 16 /* In the horizontal thumb region */ +#define inMenuBar 17 /* In the menu bar */ + +/* EventRec.what values */ + +#define nullEvent 0 /* Null */ +#define mouseDownEvent 1 /* Mouse down */ +#define keyDownEvent 2 /* Key down */ +#define activateEvent 3 /* Activate window */ +#define deactivateEvent 4 /* Deactivate window */ +#define updateEvent 5 /* Redraw window */ +#define menuHitEvent 6 /* Menu Hit */ +#define menuUpdateEvent 7 /* Menu Update required */ +#define closeEvent 8 /* Close window */ +#define hideEvent 9 /* Hide window */ +#define showEvent 10 /* Show window */ +#define hotkeyEvent 11 /* An ON KEY LABEL was pressed */ +#define sizeEvent 12 /* Size window event */ +#if defined(__WINDOWS__) || defined(_WINDLL) +#define rMouseDownEvent 13 /* Right mouse down event */ +#define zoomEvent 999 /* Not supported in Windows */ +#else +#define zoomEvent 13 /* Zoom window event */ +#endif + +/* EventRec.modifiers defines */ + +#define charCodeMask 0x0fff /* Character code mask */ +#define shiftCodeMask 0xf000 /* Shift key mask */ + +#define shiftKey 0x1000 /* Either shift key 1 - down */ +#define ctrlKey 0x2000 /* Control key 1 - down */ +#define altKey 0x4000 /* Alternate key 1 - down */ +#define literalKey 0x8000 /* This key is interpreted literally */ + +/* EventRec.mbState code defines */ + +#define leftButton (1<<0) /* Left button status 1 - down */ +#define rightButton (1<<1) /* Right button status 1 - down */ +#define centerButton (1<<2) /* Center button status 1 - down */ + +/* EventRec.mcState code defines */ + +#define posChange (1<<0) /* Position change 1 - change */ +#define leftPressed (1<<1) /* Left button pressed 1 - pressed */ +#define leftReleased (1<<2) /* Left button released 1 - released */ +#define rightPressed (1<<3) /* Right button pressed 1 - pressed */ +#define rightReleased (1<<4) /* Right button released 1 - released */ +#define centerPressed (1<<5) /* Center button pressed 1 - pressed */ +#define centerReleased (1<<6) /* Center button released 1 - released */ + +#endif + +/* Flag values for _InKey() */ +#define SHOWCURSOR (1<<0) +#define HIDECURSOR (1<<1) +#define MOUSEACTIVE (1<<2) + +/* Flag values for the _ALen() function */ + +enum { + AL_ELEMENTS, + AL_SUBSCRIPT1, + AL_SUBSCRIPT2 +}; + +/* FPFI is a 32 bit pointer to a function returning an int */ +typedef int (FAR *FPFI)(); + +typedef struct { + short h; + short v; +} Point; + +typedef struct { + short top; + short left; + short bottom; + short right; +} Rect; + +#ifndef FOXMENU_INCLUDED + +/*- Menu structure type entry definitions used by _NewMenu() */ + +#define MPOPUP 1 /* Menu is a POPUP type menu */ +#define MPAD 2 /* Menu is a PAD type menu */ +#define MBAR 3 /* Menu is a BAR type menu */ + +#endif + +/* These are the API identifiers for the System Menu Constants. */ + +enum { + _LASTITEM = -2, _FIRSTITEM, + + _SYSMENU, + _SYSMSYSTEM, _SYSMFILE, _SYSMEDIT, _SYSMDATA, _SYSMRECORD, _SYSMPROG, + _SYSMWINDOW, + + _SYSTEM, + _SYSTEMABOUT, _SYSTEMHELP, _SYSTEMMACRO, _SYSTEMSEP100, _SYSTEMFILER, + _SYSTEMCALC, _SYSTEMDIARY, _SYSTEMSPECIAL, _SYSTEMASCII, + _SYSTEMCAPTURE, _SYSTEMPUZZLE, + + _FILE, + _FILENEW, _FILEOPEN, _FILECLOSE, _FILECLOSEALL, _FILESEP100, _FILESAVE, + _FILESAVEAS, _FILEREVERT, _FILESEP200, _FILESETUP, _FILEPRINT, _FILESEP300, + _FILEQUIT, + + _EDIT, + _EDITUNDO, _EDITREDO, _EDITSEP100, _EDITCUT, _EDITCOPY, _EDITPASTE, + _EDITCLEAR, _EDITSEP200, _EDITSELECTALL, _EDITSEP300, _EDITGOTO, + _EDITFIND, _EDITFINDAGAIN, _EDITREPLACE, _EDITREPLACEALL, + _EDITSEP400, _EDITPREF, + + _DATA, + _DATASETUP, _DATABROWSE, _DATASEP100, _DATAAPPEND, _DATACOPY, _DATASORT, + _DATATOTAL, _DATASEP200, _DATAAVERAGE, _DATACOUNT, _DATASUM, _DATACALCULATE, + _DATAREPORT, _DATALABEL, _DATASEP300, _DATAPACK, _DATAREINDEX, + + _RECORD, + _RECORDAPPEND, _RECORDCHANGE, _RECORDSEP100, _RECORDGOTO, _RECORDLOCATE, + _RECORDCONTINUE, _RECORDSEEK, _RECORDSEP200, _RECORDREPLACE, _RECORDDELETE, + _RECORDRECALL, + + _PROG, + _PROGDO, _PROGSEP100, _PROGCANCEL, _PROGRESUME, _PROGSEP200, + _PROGCOMPILE, _PROGGENERATE, _PROGDOCUMENT, _PROGGRAPH, + + _WINDOW, + _WINDOWHIDE, _WINDOWHIDEALL, _WINDOWSHOWALL, _WINDOWCLEAR, _WINDOWSEP100, + _WINDOWMOVE, _WINDOWSIZE, _WINDOWZOOM, _WINDOWMINMAX, _WINDOWROTATE, + _WINDOWCOLOR, _WINDOWSEP200, _WINDOWCOMMAND, _WINDOWDEBUG, _WINDOWTRACE, + _WINDOWVIEW, + + _REPORT, _LABEL, _BROWSE, _MACRO, _DIARY, _DAFILER, _SCREEN, + _MBLDR, _PROJECT, _RQBE, + + _SYSTEMSEP200, _SYSTEMHELPSRCH,_SYSTEMHELPHOWTO, _EDITPASTELINK, _EDITLINK, + _EDITINSERTOBJ, _EDITCVTSTATIC, _EDITSEP500, _PROGSEP300, + + _TEXT, _EDITOBJECT, _PROGBEAUT +}; + + +/* Now anyone can simulate a breakpoint with BreakPoint() */ +#ifdef __WATCOMC__ +#pragma aux _BreakPoint = 0xcc; /* INT 3 */ +void _BreakPoint(void); +#endif + + +#ifdef _MSC_VER +#define _BreakPoint() __asm \ + { \ + int 3h \ +} +#endif + +/* Alternate values for parmCount to modify how FoxPro treats the function */ +#define INTERNAL -1 /* Not callable from FoxPro */ +#define CALLONLOAD -2 /* Call when library is loaded */ +#define CALLONUNLOAD -3 /* Call when library is unloaded */ + +/* The FoxInfo structure contains the descriptions of the functions + contained in the library. +*/ + +typedef struct { + char FAR * funcName; /* Function name (all caps) */ + FPFI function; /* Actual function address */ + short parmCount; /* # parameters specified or a flag value */ + char FAR * parmTypes; /* Parameter list description */ +} FoxInfo; + +typedef struct _FoxTable { + struct _FoxTable FAR *nextLibrary; /* Linked list of libraries */ + short infoCount; /* # of functions in this library */ + FoxInfo FAR *infoPtr; /* Function list */ +} FoxTable; + +/* An expression's value */ +typedef struct { + char ev_type; + char ev_padding; + short ev_width; + unsigned short ev_length; + long ev_long; + double ev_real; + MHANDLE ev_handle; +} Value; + +/* A reference to a database or memory variable */ +typedef struct { + char l_type; + short l_where, /* Database number or -1 for memory */ + l_NTI, /* Variable name table offset */ + l_offset, /* Index into database */ + l_subs, /* # subscripts specified 0 <= x <= 2 */ + l_sub1, l_sub2; /* subscript integral values */ +} Locator; + +/* A parameter to a library function. */ +typedef union { + Value val; + Locator loc; /* An 'R' in l_type means the Locator */ + /* part of this union is in use. */ +} Parameter; + +/* A paramter list to a library function. */ +typedef struct { + short int pCount; /* Number of Parameters PASSED. */ + Parameter p[1]; /* pCount Parameters. */ +} ParamBlk; + +#ifndef _INC_WINDOWS +#ifndef _WINDEF_ +typedef unsigned short HWND; +#endif +#else +extern HANDLE Inst; +#endif + +typedef long EDPOS; /* Editor text offset */ +typedef long EDLINE; /* Editor line number */ +#define MAXFILENAME 130 /* longest pathname */ +#define MAXFONTNAME 64 /* Max length of a font name */ + +#ifndef EDITOR_INCLUDED +#define EDCOMMAND 0 +#define EDPROGRAM 1 +#define EDFILE 2 +#define EDMEMO 3 +#define EDQUERY 6 +#define EDSCREEN 7 +#define EDMENU 8 + +#define RO_BYFILE (0x01) /* readOnly bits */ +#define RO_BYUSER (0x02) +#define RO_BYRECORD (0x04) + +#endif + +/* An editor's enivronment. */ +typedef struct{ + char filename[MAXFILENAME]; + EDPOS length; /* #bytes in text */ + unsigned short lenLimit; /* Max allowable length. 0 = infinite. */ + unsigned short dirty, /* Has the file been changed? */ + autoIndent, /* Auto indent? */ + backup, /* Make backup files? */ + addLineFeeds, /* add line feeds when saving? */ + autoCompile, /* Shall we auto compile this thing? */ + addCtrlZ, /* add end of file ctrl-z? */ + savePrefs, /* save edit preferences? */ + dragAndDrop, /* Allow drag-and-drop */ + readOnly, /* RO_BYFILE, RO_BYUSER, RO_BYRECORD */ + status, /* display status bar? */ + lockPrefs, /* Can update the preferences ? */ + insertMode; + short wrap; /* if <0, new line at Return only */ + + EDPOS selStart; /* Selection start */ + EDPOS selEnd; /* Selection end */ + EDPOS selAnchor; /* Selection anchor point */ + short justMode; /* Justification */ + short tabWidth; /* TAB size in spaces */ + + char fontName[MAXFONTNAME]; + short fontSize; + short fontStyle; + short kind; /* Kind of editor session */ +} EDENV; + + +/* Event record definitions */ +typedef struct +{ unsigned short what; /* Event code */ + Ticks when; /* Ticks since startup */ + Point where; /* Mouse location */ + unsigned long message; /* Key/window */ + unsigned long misc; /* Event dependant misc info */ + unsigned long misc2; /* Event dependant misc info */ + unsigned char mbState; /* Mouse buttons state */ + unsigned char mcState; /* Mouse cond activate state */ + unsigned short modifiers; +} EventRec; + +/* Flags for the _DBStatus function */ +#define DB_BOF 1 /* BOF() */ +#define DB_EOF 2 /* EOF() */ +#define DB_RLOCKED 4 /* Current record is RLOCKed */ +#define DB_FLOCKED 8 /* Database is FLOCKed */ +#define DB_EXCLUSIVE 16 /* Database is open EXCLUSIVEly */ +#define DB_READONLY 32 /* Database is READONLY */ + +/* Flag values for _DBLock() */ +#define DBL_RECORD 0 +#define DBL_FILE 1 + +/* Flag values for the _NewVar function */ +#define NV_PUBLIC 0 +#define NV_PRIVATE 1 + +/* Mode flag values for the __FIO function */ +#define FIO_FGETS 0 +#define FIO_FREAD 1 +#define FIO_FPUTS 2 +#define FIO_FWRITE 3 + +/* Mode flag values for the _FOpen function */ +#define FO_READONLY 0 +#define FO_WRITEONLY 1 +#define FO_READWRITE 2 + +/* Mode flag values for the _FCreate function */ +#define FC_NORMAL 0 +#define FC_READONLY 1 +#define FC_HIDDEN 2 +#define FC_SYSTEM 4 +#define FC_TEMPORARY 128 + +/* Mode flag values for the _FSeek function */ +#define FS_FROMBOF 0 /* From beginning of file */ +#define FS_RELATIVE 1 /* From current position */ +#define FS_FROMEOF 2 /* From end of file */ + +/* Mode flag values for the __WStat function */ +#define WS_TOP 0 +#define WS_BOTTOM 1 +#define WS_LEFT 2 +#define WS_RIGHT 3 +#define WS_HEIGHT 4 +#define WS_WIDTH 5 +#define WS_SETPORT 7 + +/* Mode flag values for the __WControl function */ +#define WC_CLEAR 0 +#define WC_CLOSE 1 +#define WC_HIDE 2 +#define WC_SHOW 3 +#define WC_SELECT 4 +#define WC_SENDBEHIND 5 + +/* Mode flag values for the __WAdjust function */ +#define WA_MOVE 0 +#define WA_SIZE 1 +#define WA_POSCURSOR 2 + +/* Mode flag value for the __WPort function */ +#define WP_ONTOP 0 +#define WP_OUTPUT 1 + +/* Mode flag value for the _WZoom function */ +#define WZ_MAXIMIZED 0 +#define WZ_NORMAL 1 +#define WZ_MINIMIZED 2 + +/* Border strings for typical window borders. */ +#define WO_DOUBLEBOX "\x0cd\x0cd\x0ba\x0ba\x0c9\x0bb\x0c8\x0bc\x0cd\x0cd\x0ba\x0ba\x0c9\x0bb\x0c8\x0bc" +#define WO_SINGLEBOX "\x0c4\x0c4\x0b3\x0b3\x0da\x0bf\x0c0\x0d9\x0c4\x0c4\x0b3\x0b3\x0da\x0bf\x0c0\x0d9" +#define WO_PANELBORDER "\x0db\x0db\x0db\x0db\x0db\x0db\x0db\x0db\x0db\x0db\x0db\x0db\x0db\x0db\x0db\x0db" +#define WO_SYSTEMBORDER "\x020\x020\x020\x020\x0fe\x0f0\x020\x0f9\x020\x020\x020\x020\x020\x020\x020\x020" + +#ifndef FOXWIND_INCLUDED + +/* Border string offsets. */ +#define selectBorder 0 +#define deselectBorder 8 + +#define topEdge 0 +#define bottomEdge 1 +#define leftEdge 2 +#define rightEdge 3 +#define topLeftCorner 4 +#define topRightCorner 5 +#define bottomLeftCorner 6 +#define bottomRightCorner 7 +#define maxBorderLen 17 /* Border string length (maximum) */ +#endif + + +#ifndef COLORS_INCLUDED + +#define BLACK_ON 0x00 /* Foreground color attributes */ +#define BLUE_ON 0x01 +#define GREEN_ON 0x02 +#define CYAN_ON 0x03 +#define RED_ON 0x04 +#define MAGENTA_ON 0x05 +#define BROWN_ON 0x06 +#define WHITE_ON 0x07 + +#define BLACK (BLACK_ON << 4) /* Background color attributes. */ +#define BLUE (BLUE_ON << 4) +#define GREEN (GREEN_ON << 4) +#define CYAN (CYAN_ON << 4) +#define RED (RED_ON << 4) +#define MAGENTA (MAGENTA_ON << 4) +#define BROWN (BROWN_ON << 4) +#define WHITE (WHITE_ON << 4) + +#define BRIGHT 0x08 /* Intensify foreground color */ +#define BLINK 0x80 /* Blink this */ + + +/* The following values are used in the WA_ISSHADOW column of the + schemes to indicate whether the window casts a shadow. */ + +#define CASTSSHADOW (BRIGHT | BLACK_ON | BLACK) +#define CASTSNOSHADOW (BRIGHT | WHITE_ON | WHITE | BLINK) + + +/* Color scheme numbers for use by _WOpen and others */ + +enum +{ + USER_SCHEME, + USERMENU_SCHEME, + MBAR_SCHEME, + POPUP_SCHEME, + DIALOG_SCHEME, + MODAL_POPUP_SCHEME, + ALERT_SCHEME, + WINDOW_SCHEME, + NONMODAL_POPUP_SCHEME, + BROWSE_SCHEME, + REPORT_SCHEME, + ALERT_POPUP_SCHEME +}; + +/* Color index numbers used by _WSetAttr() and _WAttr() */ + +enum +{ + WA_PENCOLOR = -1, /* CURRENT PEN COLOR */ + + WA_NORMAL, /* normal text */ + WA_ENHANCED, /* enhanced text */ + WA_BORDER, /* window border */ + WA_FOREMOST, /* title when foremost */ + WA_TITLE, /* title otherwise */ + WA_SELECTED, /* selected text */ + WA_HOTKEY, /* control hotkeys */ + WA_SHADOW, /* color of shadows that fall on this window. */ + WA_ENABLED, /* enabled control */ + WA_DISABLED, /* disabled control */ + WA_ISSHADOW /* window casts a shad */ +}; + + +#endif + + +/* Prototypes for the API Functions */ + +/* Streaming output routines */ +void _PutChr(int character); +void _PutStr(char FAR *string); +void _PutValue(Value FAR *val); + +/* Memory management functions */ +MHANDLE _AllocHand(unsigned int hsize); +void _FreeHand(MHANDLE hand); +void FAR *_HandToPtr(MHANDLE hand); +unsigned _GetHandSize(MHANDLE hand); +int _SetHandSize(MHANDLE hand, unsigned int size); +void _HLock(MHANDLE hand); +void _HUnLock(MHANDLE hand); +unsigned int _StackAvail(void); +int _MemAvail(unsigned int); +#ifdef __WATCOMC__ +void FAR *__Alloca(unsigned int size); +void FAR *_Alloca(unsigned int size); +#pragma aux __Alloca = 0x29 0xc4 /* sub sp, ax */\ + 0x89 0xe0 /* mov ax, sp */\ + 0x8c 0xd2 /* mov dx, ss */\ + parm caller [ax] value[ax dx] modify [sp]; +#define _Alloca(size) ((_StackAvail()>(unsigned)size) ? __Alloca(((size)+1)&0xfffe): 0) +#endif + +/* String handling functions */ +int _StrLen(char FAR *string); +void _StrCpy(char FAR *dest, char FAR *src); +int _StrCmp(char FAR *string1, char FAR *string2); + +/* Memory management functions */ +#ifdef _MSC_VER +void FAR * __fastcall _Alloca(unsigned int amount); + +void __far * __far __cdecl _fmemmove(void __far *, const void __far *, unsigned int); +void __far * __far __cdecl _fmemset(void __far *, int, unsigned int); +int __far __cdecl _fmemcmp(const void __far *, const void __far *, unsigned int); + +#define _MemCmp(dest, src, length) _fmemcmp(dest, src, length) +#define _MemMove(dest, src, length) _fmemmove(dest, src, length) +#define _MemFill(ptr, c, length) _fmemset(ptr, c, length) +#endif + + +#if __WATCOMC__ +#pragma aux _MemFill parm [es di] [ax] [cx] modify [ax]; +#pragma aux _MemCmp parm [es di] [dx si] [ax] modify nomemory [ax si di]; +void _MemMove(void FAR *dest, void FAR *src, unsigned int length); +void _MemFill(void FAR *ptr, int character, unsigned int length); +int _MemCmp(void FAR *ptr, void FAR *ptr2, unsigned int length); +#endif + +/* Functions to set the return value of a library functiion */ +void _RetVal(Value FAR *val); +void _RetChar(char FAR *string); +void _RetInt(long ival, int width); +void _RetFloat(double flt, int width, int dec); +void _RetDateStr(char FAR *string); +void _RetLogical(int); + +/* Database Input/Output functions */ +long _DBRecNo(int workarea); +long _DBRecCount(int workarea); +int _DBStatus(int workarea); +int _DBRead(int workarea, long record); +int _DBWrite(int workarea); +int _DBAppend(int workarea, int carryflag); +long _DBRewind(int workarea); +long _DBSkip(int workarea, long distance); +long _DBUnwind(int workarea); +int _DBReplace(Locator FAR *fld, Value FAR *val); +long _DBSeek(Value FAR *val); +int _DBLock(int workarea, int what); +void _DBUnLock(int workarea); +int _DBAppendRecords(int workarea, unsigned short nrecs, char FAR *buffer); + +/* Memo Field Input/Output functions */ +FCHAN _MemoChan(int workarea); +long _AllocMemo(Locator FAR *fld, long size); +long _FindMemo(Locator FAR *fld); +long _MemoSize(Locator FAR *fld); + +/* Memory variable manipulation functions */ +NTI _NewVar(char FAR *name, Locator FAR *loc, int flag); +int _Release(NTI nti); +int _Store(Locator FAR *loc, Value FAR *val); +int _Load(Locator FAR *loc, Value FAR *val); +long _ALen(NTI nti, int mode); +int _FindVar(NTI nti, int where, Locator FAR *loc); +NTI _NameTableIndex(char FAR *name); + +/* File Input/Output */ + +FCHAN __FOpen(char FAR *filename, int mode, int create); + +#define _FOpen(filename, mode) __FOpen(filename, mode, NO) +#define _FCreate(filename, mode) __FOpen(filename, mode, YES) + +int __FFlush(FCHAN chan, int close); + +#define _FFlush(chan) __FFlush(chan, NO) +#define _FClose(chan) __FFlush(chan, YES) + +int __FStat(FCHAN chan, int error); + +#define _FEOF(chan) __FStat(chan, NO) +#define _FError() __FStat(0, YES) + +unsigned int __FIO(FCHAN chan, char FAR *buffer, unsigned int maxlen, int mode); + +#define _FGets(chan, buffer, maxlen) __FIO(chan, buffer, maxlen, FIO_FGETS) +#define _FRead(chan, buffer, maxlen) __FIO(chan, buffer, maxlen, FIO_FREAD) +#define _FPuts(chan, buffer) __FIO(chan, buffer, 0, FIO_FPUTS) +#define _FWrite(chan, buffer, maxlen) __FIO(chan, buffer, maxlen, FIO_FWRITE) + +long _FSeek(FCHAN chan, long position, int mode); +int _FCHSize(FCHAN chan, long length); +int _FCopy(FCHAN dchan, long dpos, FCHAN schan, long spos, long len); + +#if defined(__WINDOWS__) || defined(_WINDLL) + +/* User Interface routines */ + +#define PIXELMODE 0 +#define CHARMODE 1 + +unsigned __ActivateHandler(FPFI handler, short charmode); + +#define _ActivateHandler(handler) __ActivateHandler(handler, CHARMODE) +#define _ActivateHandlerP(handler) __ActivateHandler(handler, PIXELMODE) + +void _DeActivateHandler(unsigned); +unsigned __ActivateIdle(FPFI handler, short charmode); + +#define _ActivateIdle(handler) __ActivateIdle(handler, CHARMODE) +#define _ActivateIdleP(handler) __ActivateIdle(handler, PIXELMODE) + +void _DeActivateIdle(unsigned); + +int __GetNextEvent(EventRec FAR *event, short charmode); + +#define _GetNextEvent(event) __GetNextEventP(event, CHARMODE) +#define _GetNextEventP(event) __GetNextEventP(event, PIXELMODE) + +void __DefaultProcess(EventRec FAR *event, short charmode); + +#define _DefaultProcess(event) __DefaultProcess(event, CHARMODE) +#define _DefaultProcessP(event) __DefaultProcess(event, PIXELMODE) + +#define _MousePos(pt) __MousePos(pt, CHARMODE) +#define _MousePosP(pt) __MousePos(pt, PIXELMODE) + +int __MousePos(void FAR *pt, int); + +/* Windowing routines. */ +int __FindWindow(WHANDLE FAR *wh, Point pt, int charmode); +void __GlobalToLocal(void FAR *pt, WHANDLE wh, int); +WHANDLE __WOpen(int top, int left, int bottom, int right, int flag, int + scheme_num, Scheme FAR *scheme, char FAR *bord, int pixelmode); + +#define _WOpenP(top, left, bottom, right, flag, scheme_num, scheme, bord) __WOpen(top, left, bottom, right, flag, scheme_num, scheme, bord, PIXELMODE) +#define _WOpen(top, left, bottom, right, flag, scheme_num, scheme, bord) __WOpen(top, left, bottom, right, flag, scheme_num, scheme, bord, CHARMODE) + +#define _GlobalToLocal(pt, wh) __GlobalToLocal(pt, wh, CHARMODE) +#define _GlobalToLocalP(pt, wh) __GlobalToLocal(pt, wh, PIXELMODE) + +#define _FindWindow(wh, pt) __FindWindow(wh, pt, CHARMODE) +#define _FindWindowP(wh, pt) __FindWindow(wh, pt, PIXELMODE) + + +#define _WTop(wh) ((unsigned)__WStat(wh, WS_TOP, CHARMODE)) +#define _WBottom(wh) ((unsigned)__WStat(wh, WS_BOTTOM, CHARMODE)) +#define _WLeft(wh) ((unsigned)__WStat(wh, WS_LEFT, CHARMODE)) +#define _WRight(wh) ((unsigned)__WStat(wh, WS_RIGHT, CHARMODE)) +#define _WHeight(wh) ((unsigned)__WStat(wh, WS_HEIGHT, CHARMODE)) +#define _WWidth(wh) ((unsigned)__WStat(wh, WS_WIDTH, CHARMODE)) +#define _WSetPort(wh) ((WHANDLE)__WStat(wh, WS_SETPORT, CHARMODE)) + +#define _WTopP(wh) ((unsigned)__WStat(wh, WS_TOP, PIXELMODE)) +#define _WBottomP(wh) ((unsigned)__WStat(wh, WS_BOTTOM, PIXELMODE)) +#define _WLeftP(wh) ((unsigned)__WStat(wh, WS_LEFT, PIXELMODE)) +#define _WRightP(wh) ((unsigned)__WStat(wh, WS_RIGHT, PIXELMODE)) +#define _WHeightP(wh) ((unsigned)__WStat(wh, WS_HEIGHT, PIXELMODE)) +#define _WWidthP(wh) ((unsigned)__WStat(wh, WS_WIDTH, PIXELMODE)) + +unsigned long __WStat(WHANDLE wh, int mode, int pixelmode); + +#define _WMove(wh, pt) __WAdjust(wh, pt, WA_MOVE, CHARMODE) +#define _WSize(wh, pt) __WAdjust(wh, pt, WA_SIZE, CHARMODE) +#define _WPosCursor(wh, pt) __WAdjust(wh, pt, WA_POSCURSOR, CHARMODE) +#define _WMoveP(wh, pt) __WAdjust(wh, pt, WA_MOVE, PIXELMODE) +#define _WSizeP(wh, pt) __WAdjust(wh, pt, WA_SIZE, PIXELMODE) +#define _WPosCursorP(wh, pt) __WAdjust(wh, pt, WA_POSCURSOR, PIXELMODE) + +void __WAdjust(WHANDLE wh, Point pt, int mode, int charmode); + +void __WScroll(WHANDLE wh, Rect r, int dv, int dh, int charmode); + +#define _WScroll(wh, r, dv, dh) __WScroll(wh, r, dv, dh, CHARMODE) +#define _WScrollP(wh, r, dv, dh) __WScroll(wh, r, dv, dh, PIXELMODE) +#define _WClearRect(wh, r) __WScroll(wh, r, 0, 0, CHARMODE); +#define _WClearRectP(wh, r) __WScroll(wh, r, 0, 0, PIXELMODE); + +#define _WGetCursor(wh) __WGetCursor(wh, CHARMODE) +#define _WGetCursorP(wh) __WGetCursor(wh, PIXELMODE) + +Point __WGetCursor(WHANDLE wh, int); + +void __SetMenuPoint(MenuId menuid, Point loc, int charmode); + +#define _SetMenuPoint(menuid, loc) __SetMenuPoint(menuid, loc, CHARMODE) +#define _SetMenuPointP(menuid, loc) __SetMenuPoint(menuid, loc, PIXELMODE) + + +#else // __WINDOWS__ || _WINDLL + +/* User Interface routines */ +unsigned _ActivateHandler(FPFI handler); +void _DeActivateHandler(unsigned); +unsigned _ActivateIdle(FPFI handler); +void _DeActivateIdle(unsigned); +int _GetNextEvent(EventRec FAR *event); +void _DefaultProcess(EventRec FAR *event); +int _MousePos(Point FAR *pt); + +/* Windowing routines. */ +int _FindWindow(WHandle FAR *wh, Point pt); +void _GlobalToLocal(Point FAR *pt, WHandle wh); +WHandle _WOpen(int top, int left, int bottom, int right, int flag, int + scheme_num, Scheme FAR *scheme, char FAR *bord); + +#define _WTop(wh) ((unsigned)__WStat(wh, WS_TOP)) +#define _WBottom(wh) ((unsigned)__WStat(wh, WS_BOTTOM)) +#define _WLeft(wh) ((unsigned)__WStat(wh, WS_LEFT)) +#define _WRight(wh) ((unsigned)__WStat(wh, WS_RIGHT)) +#define _WHeight(wh) ((unsigned)__WStat(wh, WS_HEIGHT)) +#define _WWidth(wh) ((unsigned)__WStat(wh, WS_WIDTH)) +#define _WSetPort(wh) ((WHandle)__WStat(wh, WS_SETPORT)) + +unsigned long __WStat(WHandle wh, int mode); + +#define _WMove(wh, pt) __WAdjust(wh, pt, WA_MOVE) +#define _WSize(wh, pt) __WAdjust(wh, pt, WA_SIZE) +#define _WPosCursor(wh, pt) __WAdjust(wh, pt, WA_POSCURSOR) + +void __WAdjust(WHandle wh, Point pt, int mode); + +void _WScroll(WHandle wh, Rect r, int dv, int dh); +#define _WClearRect(wh, r) _WScroll(wh, r, 0, 0); + +Point _WGetCursor(WHandle wh); +void _SetMenuPoint(MenuId menuid, Point loc); + +#endif // __WINDOWS__ || _WINDLL + + +int _InKey(int timeout, int flag); +void _RefreshDisplay(void); +void _RefreshVideo(void); + +#define _WClear(wh) __WControl(wh, WC_CLEAR) +#define _WClose(wh) __WControl(wh, WC_CLOSE) +#define _WHide(wh) __WControl(wh, WC_HIDE) +#define _WShow(wh) __WControl(wh, WC_SHOW) +#define _WSelect(wh) __WControl(wh, WC_SELECT) +#define _WSendBehind(w) __WControl(w, WC_SENDBEHIND) + +void __WControl(WHANDLE wh, int mode); + +#define _WOnTop() __WPort(WP_ONTOP) +#define _WGetPort() __WPort(WP_OUTPUT) + +WHandle __WPort(int mode); + +void _WZoom(WHANDLE wh, int newstate); + +void __WSetTitle(WHANDLE wh, char FAR *text, int mode); + +#define WT_SETFOOTER 0 +#define WT_SETTITLE 1 +#define WT_GETFOOTER 2 +#define WT_GETTITLE 3 + +#define _WSetFooter(wh, footer) __WSetTitle(wh, footer, WT_SETFOOTER) +#define _WSetTitle(wh, title) __WSetTitle(wh, title, WT_SETTITLE) +#define _WFooter(wh, footer) __WSetTitle(wh, footer, WT_GETFOOTER) +#define _WTitle(wh, title) __WSetTitle(wh, title, WT_GETTITLE) + +int _WAttr(WHANDLE wh, int color); +void _WSetAttr(WHANDLE wh, int color, int attr); +void _WPutChr(WHANDLE wh, int character); +void _WPutStr(WHANDLE wh, char FAR *str); + +/* Functions to execute FoxPro statements and evaluate FoxPro expressions */ + +int _Execute(char FAR *stmt); +int _Evaluate(Value FAR *val, char FAR *expr); + +/* Menuing functions. */ + +long __MenuStat(long x, int mode); + +#define _MenuId(literal) __MenuStat(literal, 0) +#define _GetNewItemId(menuid) __MenuStat(menuid, 1) +#define _CountItems(menuid) __MenuStat(menuid, 2) +#define _GetNewMenuId() __MenuStat(0, 3) + +int _MenuInteract(MenuId FAR *menuid, ItemId FAR *itemid); + +void __MenuAction(MenuId menuid, int mode); + +#define _ActivateMenu(menuid) __MenuAction(menuid, 0) +#define _DeActivateMenu(menuid) __MenuAction(menuid, 1) +#define _DisposeMenu(menuid) __MenuAction(menuid, 2) + +int _NewMenu(int mtype, MenuId menuid); +void _SetMenuColor(MenuId menuid, int scheme); +ItemId _GetItemId(MenuId menuid, long index); +int _NewItem(MenuId menuid, ItemId itemid, ItemId beforeid, char FAR *prompt); +void _DisposeItem(MenuId menuid, ItemId itemid); + + +void _SetItemSubMenu(MenuId menuid, ItemId itemid, MenuId submenuid); +void _SetItemColor(MenuId menuid, ItemId itemid, int scheme); +void _GetItemText(MenuId menuid, ItemId itemid, char FAR *text); +void _SetItemText(MenuId menuid, ItemId itemid, char FAR *text); +int _GetItemCmdKey(MenuId menuid, ItemId itemid, char FAR *text); +void _SetItemCmdKey(MenuId menuid, ItemId itemid, int key, char FAR *text); +void _OnSelection(MenuId menuid, ItemId itemid, FPFI routine); + +/* FoxPro Dialogs */ +int _Dialog(int scheme, char FAR *text, char FAR *button1, + char FAR *button2, char FAR *button3, int def, int esc); + + +/* Error Handling */ +void _Error(int code); +void _UserError(char FAR *message); +int _ErrorInfo(int code, char FAR *message); + + +#define ED_SAVENOASK 0 +#define ED_SAVEASK 1 +#define ED_SAVEAS 2 + +/* Mode flags for the editor functions */ + +/* Mode flag values for the __EdPos function */ +#define ED_SETPOS 0 +#define ED_GETLINEPOS 1 +#define ED_GETLINENUM 2 +#define ED_GETPOS 3 + +/* Mode flag values for the __EdScroll function */ +#define ED_SCROLLTOPOS 0 +#define ED_SCROLLTOSEL 1 + +/* Mode flag values for the __EdManip function */ +#define ED_SENDKEY 0 +#define ED_DELETE 1 +#define ED_INDENT 2 + +/* Mode flag values for the __EdClipBrd function */ +#define ED_COPY 0 +#define ED_CUT 1 +#define ED_PASTE 2 +#define ED_UNDO 3 +#define ED_REDO 4 + +/* Mode flag values for the __EdEnv function */ +#define ED_SETENV 0 +#define ED_GETENV 1 + +/* Mode flag values for the __EdRevert function */ +#define ED_REVERT 0 +#define ED_SAVE 1 + +/* Mode flag values for the __WFindTitle function */ +#define WFINDTITLE 0 +#define WMAINWINDOW 1 + + +/* Editor Functions */ +WHandle _EdOpenFile(char FAR *filename, int mode); +int _EdCloseFile(WHandle wh, int opt); +void __EdRevert(WHandle wh, int mode); + +#define _EdRevert(wh) __EdRevert(wh, ED_REVERT) +#define _EdSave(wh) __EdRevert(wh, ED_SAVE) + +#define _EdSetPos(wh, pos) ((long)__EdPos(wh, (EDPOS) pos, ED_SETPOS)) +#define _EdGetLinePos(wh, line) ((EDPOS)__EdPos(wh, (EDLINE) line, ED_GETLINEPOS)) +#define _EdGetLineNum(wh, pos) ((EDLINE)__EdPos(wh, (EDPOS) pos, ED_GETLINENUM)) +#define _EdGetPos(wh) ((EDLINE)__EdPos(wh, 0, ED_GETPOS)) + +long __EdPos(WHandle wh, long pos, int mode); +int _EdPosInView(WHandle wh, EDPOS pos); + +#define _EdScrollToPos(wh, pos, flag) (__EdScroll(wh, pos, flag, ED_SCROLLTOPOS)) +#define _EdScrollToSel(wh, flag) (__EdScroll(wh, 0, flag, ED_SCROLLTOSEL)) + +void __EdScroll(WHandle wh, EDPOS pos, int flags, int mode); + +#define _EdSendKey(wh, key) __EdManip(wh, key, ED_SENDKEY) +#define _EdDelete(wh) __EdManip(wh, 0, ED_DELETE) +#define _EdIndent(wh, tabs) __EdManip(wh, tabs, ED_INDENT) + +void __EdManip(WHandle wh, int n, int mode); + +EDPOS _EdSkipLines(WHandle wh, EDPOS pos, int n); +void _EdInsert(WHandle wh, char FAR *str, unsigned long len); +TEXT _EdGetChar(WHandle wh, EDPOS pos); +void _EdGetStr(WHandle wh, EDPOS pos1, EDPOS pos2, TEXT FAR *str); + +#define _EdCopy(wh) __EdClipBrd(wh, ED_COPY) +#define _EdCut(wh) __EdClipBrd(wh, ED_CUT) +#define _EdPaste(wh) __EdClipBrd(wh, ED_PASTE) +#define _EdUndo(wh) __EdClipBrd(wh, ED_UNDO) +#define _EdRedo(wh) __EdClipBrd(wh, ED_REDO) + +void __EdClipBrd(WHandle wh, int mode); +void _EdSelect(WHandle wh, EDPOS pos1, EDPOS pos2); +void _EdUndoOn(WHandle wh, int flag); +void _EdActive(WHandle wh, int flag); +int _EdLastError(WHandle wh); + +#define _EdSetEnv(wh, env) __EdEnv(wh, env, ED_SETENV) +#define _EdGetEnv(wh, env) __EdEnv(wh, env, ED_GETENV) + +#define _WFindTitle(title) __WFindTitle(title, WFINDTITLE) +#define _WMainWindow() __WFindTitle(0, WMAINWINDOW) + +int __EdEnv(WHandle, EDENV FAR *, int); +HWND _WhToHwnd(WHandle); +WHandle __WFindTitle(char FAR *, int); + + +#if defined(I80386) +#if I80386 +#undef MHANDLE +#endif +#endif + +#ifdef GLOBAL_INCLUDED +#undef WHANDLE +#endif + + +#if defined(_MSC_VER) && (_MSC_VER < 800) +#define MK_FP(__s,__o) ((void __far*)(((unsigned long)(__s)<<16)|(unsigned)(__o))) +#endif + +#endif + +#pragma pack() // Restore structure packing + +#ifdef __cplusplus +} /* End of extern "C" { */ +#endif /* __cplusplus */ diff --git a/support/interni/src/foxlck/proapiml.lib b/support/interni/src/foxlck/proapiml.lib new file mode 100755 index 000000000..da85cefbb Binary files /dev/null and b/support/interni/src/foxlck/proapiml.lib differ diff --git a/support/interni/src/foxlck/readme.txt b/support/interni/src/foxlck/readme.txt new file mode 100755 index 000000000..498ac14ef --- /dev/null +++ b/support/interni/src/foxlck/readme.txt @@ -0,0 +1,320 @@ + README.TXT +********************************************************** + Microsoft(R) FoxPro(R) Version 2.5 + Library Construction Kit for Windows(TM)and MS-DOS(R) + + (C)1993 Microsoft Corporation. All Rights Reserved. + + This file contains additions and corrections to the + FoxPro Library Construction Kit Developer's Guide. + +********************************************************** +======== +CONTENTS +======== + +Part Description +---- ----------- + +1 Additions to Documentation Since Printing +2 Corrections to Documentation Since Printing + +---------------------------------------------------------- +================================================= +Part 1: Additions to Documentation Since Printing +================================================= + +The EXAMPLES directory contains a FoxPro database with all +the example code that is used in the manual. Simply +search for the function with example code you wish to +copy and then extract the code from the memo field. You +are free to use this code in your own applications. + +----------------------------------------------------------- + +The following function has been added: + +WHANDLE _WMainWindow( ) + +Description: +_WMainWindow( ) returns the WHANDLE of the main FoxPro +window in FoxPro for Windows or of the FoxPro desktop +in FoxPro for MS-DOS. + +Example: +The following example writes a message to the main FoxPro +window in FoxPro for Windows or to the FoxPro desktop in +FoxPro for MS-DOS. + +FoxPro Code: + + SET LIBRARY TO WMAIN + = EXWMAIN() + +C Code: + + #include + + void FAR example(ParamBlk FAR *parm) + { + WHANDLE wh = _WMainWindow(); + _WPutStr(wh, "\nThis is the main FoxPro window or desktop."); + } + + FoxInfo myFoxInfo[] = { + {"EXWMAIN", example, 0, ""}, + }; + + FoxTable _FoxTable = { + (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo + }; + +---------------------------------------------------------- +=================================================== +Part 2: Corrections to Documentation Since Printing +=================================================== + +Page 2: In the Reverse.C example: + +The comment "/* Check to see if we can allocate the memory +needed. */" is missing the end comment marker */. + +The three-line comment "Since this routine doesn't call +any functions that cause memory reorganization . . . +prior to de-referencing them (_HandToPtr)" is missing the +single line comment marker // in the second and third +lines. + +This statement: + + for (i = 0; i << parm->p[0].val.ev_length; i++) + *(out_string--) = *(in_string++); + +should be: + + for (i = 0; i < parm->p[0].val.ev_length; i++) + *(out_string--) = *(in_string++); + +Change the "<<" in the original example to "<". + +---------------------------------------------------------- +Page 5: The Value Structure Fields table should include +the General FoxPro data type. The applicable fields and +their values are listed below: + +val.ev_type = 'G' +val.ev_width = FCHAN +val.ev_long = length of general field +val.ev_real = offset of general field + +---------------------------------------------------------- +Page 6: The data type FPFI, a FAR pointer to a function +returning Int, is mistakenly listed as "FPDI". + +---------------------------------------------------------- + +Page 7: In addition to the Point, Rect and EventRec data +structures, PointP and RectP should be included. PointP +and RectP are identical to Point and Rect except that +Point and Rect coordinates are in rows and columns while +PointP and RectP coordinates are in pixels. + +---------------------------------------------------------- +Page 12: The example + + if (parm->p[0].val.ev_type='C' + x=parm->p[0].val.ev_length + +should be: + + if (parm->p[0].val.ev_type=='C') + x=parm->p[0].val.ev_length; + +Use an expression ==, a closed parenthesis at the end of +the first line, and a semicolon at the end of the second +line. + +---------------------------------------------------------- + +Page 22: When compiling a .PLB library in Microsoft C7 or +Visual C/C++, you need to use the following command line: + +CL /O /ALw /Zp /GW + +When linking a .PLB library in Microsoft C7 or C8, you +need to use the /NOE and /NONULLS switches. + +Leaving out /NOE can cause redefinition errors. Leaving +out /NONULLS will cause FoxPro not to recognize the .PLB +as a valid library. + +---------------------------------------------------------- + +Page 25: The section heading for the makefile on this page +is incorrect. It should say "Microsoft C/C++ Makefile for +MS-DOS" instead of "WATCOM C Makefile for MS-DOS." + +---------------------------------------------------------- + +Page 26: The makefile on this page should have the +following section heading: "WATCOM C Makefile for MS-DOS." + +---------------------------------------------------------- + +Page 39: The example doesn't work as intended in all +cases. To have it work, you need to change the following +line: + + (( char FAR *) _HandToPtr(p1.ev_handle))[p1.ev_length] = '\0'; + +to: + + (( char FAR *) _HandToPtr(p0.ev_handle))[p0.ev_length - 1] = '\0'; + (( char FAR *) _HandToPtr(p1.ev_handle))[p1.ev_length - 1] = '\0'; + +---------------------------------------------------------- + +Page 85: The following information applies to the +_DBSeek( ) function: The struct Value passed to _DBSeek( ) +(via a pointer) must be of ev_type == 'N' when seeking a +numeric field even if that field has 0 decimal digits. +If the struct Value has an ev_type of 'I', _DBSeek( )will +return the internal error number -302, "Data type +mismatch." + +---------------------------------------------------------- + +Page 109: The struct EDENV documented with _EdGetEnv( ) isn't +correct. The actual structure from PRO_EXT.H appears +as follows: + +NOTE: (R) indicates that this member is read-only and + can't be set using _EdSetEnv( ). + + (B) indicates that these members takes on one of + two Boolean values: 1 = true or 0 = false. + + +typedef struct +{ + char filename[MAXFILENAME]; // (R) + EDPOS length; // # of bytes in text. (R) + unsigned short lenLimit; // Max allowable length. 0 = infinite. + + unsigned short dirty, // Has the file been changed? (R, B) + autoIndent, // Auto indent? (B) + backup, // Make backup files? (B) + addLineFeeds, // Add line feeds when saving? (B) + autoCompile, // Shall we auto compile this thing? (B) + addCtrlZ, // Add end of file ctrl-z? (B) + savePrefs, // Save edit preferences? (B) + dragAndDrop, // Allow drag-and-drop. (B) + readOnly, // 0 = not r/o, 1 = file is r/o, + // 2 = file is r/w, opened r/o, + // 3 = file is r/o, opened r/o. (R) + status, // Display status bar? (B) + lockPrefs, // Can update the preferences ? (B) + insertMode; // (B) + + short wrap; // If < 0, new line at Return only. + EDPOS selStart; // Selection start. (R) + EDPOS selEnd; // Selection end. (R) + EDPOS selAnchor; // Selection anchor point. (R) + short justMode; // Justification (0 = left, 1 = right, 2 = center). + short tabWidth; // TAB size in spaces. + + char fontName[MAXFONTNAME]; + short fontSize; + short fontStyle; // 0 = plain, 1 = bold, 2 = italic, 3 = bold italic. + short kind; // Kind of editor session; EDCOMMAND, EDPROGRAM, etc. + // defined in pro_ext.h. (R) +} EDENV; + + +---------------------------------------------------------- + +Page 122: The syntax for _EdOpenFile() is missing the +"mode" argument. It should read: + + _EdOpenFile(TEXT *filename, int mode) + + TEXT *filename; /* File to open. */ + int mode; /* Mode option. */ + +The following Mode options are available: +FO_READONLY, FO_WRITEONLY, FO_READWRITE. + +---------------------------------------------------------- + +Page 315: zoomEvent is a FoxPro for MS-DOS event. You +can't trap for this event in FoxPro for Windows. + +---------------------------------------------------------- + +In an EventHandler in the FoxPro for Windows Library +Construction Kit, if you make a call to FoxPro which +generates another event, the original event record may be +changed. This won't happen in the FoxPro for MS-DOS +Library Construction Kit. The following example +illustrates this: + +#include + +int g_eventid = 0; // Our event handler. + +FAR EventHandler(WHandle theWindow, EventRec FAR *ev) +{ + Point pt; + switch (ev->what) // Determine the event type. + { + case keyDownEvent: + if (theWindow == _WMainWindow()) + return NO; + else + { + pt.h = 35; + pt.v = 10; + + // This causes the event handler to be re-entered. + _WSize(theWindow, pt); + } + _PutStr("\nDone with the keyDownEvent"); + break; + + case sizeEvent: + _PutStr("\nSize Event received."); + break; + + default: + return NO; + } + return NO; +} + +FAR EventExit() +{ + _DeActivateHandler(g_eventid); // Get rid of our event handler. +} + + +FAR Quotes(ParamBlk FAR *parm) +{ + // Set up our event handler. + g_eventid = _ActivateHandler(EventHandler); +} + + +FoxInfo myFoxInfo[] = { + {"QUOTES", Quotes, 0, ""}, + {"EVENTEXIT", EventExit, CALLONUNLOAD, ""} +}; + +FoxTable _FoxTable = { + (FoxTable FAR *)0, sizeof(myFoxInfo) / sizeof(FoxInfo), myFoxInfo +}; + +---------------------------------------------------------- + + ================= + End of README.TXT + ================= \ No newline at end of file diff --git a/support/interni/src/foxlck/winc7.mak b/support/interni/src/foxlck/winc7.mak new file mode 100755 index 000000000..1253eb6fc --- /dev/null +++ b/support/interni/src/foxlck/winc7.mak @@ -0,0 +1,75 @@ +# +# Sample MS C/C++ 7 makefile for building an FLL from a single C +# module. Also works with Microsoft Visual C++. Usage: +# +# >nmake FLLNAME= /F winc7.mak +# +# For further information on building DLLs and the contents of +# this make file consult the MS C/C++ 7 E&T and Guide to +# Programming (Ch. 20 DLLs) manuals. +# +# The following two lines must be edited to reflect the directory +# structure of your machine. +# +C7DIR = c:\c700 # where Microsoft C7 is installed +FOXDIR = c;\foxlck # location of FoxPro API libraries and PRO_EXT.H + +LIBENTRY = $(C7DIR)\lib\libentry.obj +# +# Compile setup +# +CC = cl +CFLAGS = /c /ALw # large memory model; SS != DS; DS not loaded at fn entry +CFLAGS = $(CFLAGS) /DWINVER=0x0300 +CFLAGS = $(CFLAGS) /FPc # calls floating point emulator library +CFLAGS = $(CFLAGS) /GD # fn entry code optimized for Windows DLLs +CFLAGS = $(CFLAGS) /Gs # suppress stack checking (see GP p. 483) +CFLAGS = $(CFLAGS) /I$(FOXDIR) +CFLAGS = $(CFLAGS) /I$(C7DIR)\include +CFLAGS = $(CFLAGS) /Oegs # optimizations (optional) +CFLAGS = $(CFLAGS) /W2 # set warning level as desired +# +# Link setup +# +MAPFILE = NUL + +LINKER = $(C7DIR)\bin\link +LFLAGS = /ONERROR:NOEXE # do not write EXE on error +LFLAGS = $(LFLAGS) /NOF # no far call optimization + +OBJS = $(FLLNAME).obj $(LIBENTRY) + +LIBS = $(FOXDIR)\proAPImL.LIB +LIBS = $(LIBS) LIBW.LIB +LIBS = $(LIBS) /NOD:LLIBCE LDLLCEW # use DLL library + +DEF_FILE = c7.DEF +FILES = $(OBJS) $(DEF_FILE) # link depends + +# +# The pieces come together +# +all: $(FLLNAME).fll + +$(FLLNAME).obj : $(FLLNAME).C $(FOXDIR)\pro_ext.h + set PATH=$(C7DIR)\bin;%PATH% + @$(CC) @<<$(FLLNAME).rsp + $(CFLAGS) /Fo$(FLLNAME).obj $(FLLNAME).C +<< + +$(FLLNAME).fll : $(FILES) + set PATH=$(C7DIR)\bin;%PATH% + set LIB=$(C7DIR)\lib +# +# Write linker arguments to response file +# + echo > NUL @<<$(FLLNAME).lrf + $(OBJS: = +^ + ) + $@ + $(MAPFILE) + $(LIBS: = +^ + ) + $(DEF_FILE) $(LFLAGS); +<< + $(LINKER) @$(FLLNAME).lrf