git-svn-id: svn://10.65.10.50/trunk@5855 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-01-07 10:17:26 +00:00
parent 59e1920c77
commit c4ac448443
71 changed files with 10381 additions and 0 deletions

106
servers/hardlock/connect.cpp Executable file
View File

@ -0,0 +1,106 @@
#include "StdAfx.h"
#include "connect.h"
#include "tracing.h"
///////////////////////////////////////////////////////////
// TPrassiConnection
TPrassiConnection::TPrassiConnection(TLanManager* lm, DWORD id)
: TConnection(lm, id), m_nFirm(0)
{
}
TPrassiConnection::~TPrassiConnection()
{
}
BOOL TPrassiConnection::Trace(int level, const char* str) const
{
if (TracingEnabled())
{
LPCSTR user;
try
{
user = User();
}
catch(...)
{
user = "";
}
CString trc;
trc.Format("%-8s %s", user, str);
return ::Trace(level, trc);
}
return FALSE;
}
struct TFunctionName
{
const char* name;
ConnectionFunction pFunc;
int level;
};
const int MAX_FUNC = 5;
static TFunctionName ftable[MAX_FUNC] =
{
{ "DongleHasModule", f_DongleHasModule, 1 },
{ "DongleModules", f_DongleModules, 1 },
{ "DongleNumber", f_DongleNumber, 1 },
{ "UserLogin", f_UserLogin, 0 },
{ "UserLogout", f_UserLogout, 0 },
};
BOOL TPrassiConnection::Request(const char* str)
{
CStringArray argv;
BOOL ok = ParseCommand(str, argv) > 0;
if (ok)
{
const CString cmd = argv[0];
int fmin = 0;
int fmax = MAX_FUNC-1;
ok = FALSE;
int cmp = 0;
while (fmin <= fmax)
{
const int fcur = (fmax + fmin) / 2;
const TFunctionName& fn = ftable[fcur];
cmp = cmd.CompareNoCase(fn.name);
if (cmp == 0)
{
Trace(fn.level, str);
const clock_t tempo = clock();
ok = fn.pFunc(*this, &argv);
if (TracingEnabled())
{
const double time = double(clock() - tempo) / CLOCKS_PER_SEC;
if (time > 0.05)
{
CString str;
str.Format("Time: %.2lf s", time);
Trace(fn.level, str);
}
}
break;
}
if (cmp < 0)
fmax = fcur-1;
else
fmin = fcur+1;
}
if (cmp)
{
CString strError = "ERROR: ";
strError += str;
Trace(-1, strError);
}
}
return ok;
}

47
servers/hardlock/connect.h Executable file
View File

@ -0,0 +1,47 @@
#ifndef __CONNECT_H__
#define __CONNECT_H__
#ifndef __NETUTILS_H__
#include "NetUtils.h"
#endif
/////////////////////////////////////////////////////////////////////////////
// PrassiConnection
class TPrassiConnection : public TConnection
{
CString m_strUser;
CString m_strApp;
int m_nFirm;
protected:
BOOL Trace(int level, const char* str) const;
public:
virtual BOOL Request(const char* cmd);
virtual BOOL Execute(const char* cmd) { return Request(cmd); }
public:
BOOL DoUserLogin(const CString& user, const CString& pwd, const CString& app);
BOOL DoUserLogout();
public:
int GetFirm() const { return m_nFirm; }
BOOL SetFirm(int nFirm);
const CString& User() const { return m_strUser; }
TPrassiConnection(TLanManager* lm, DWORD id);
virtual ~TPrassiConnection();
};
int f_DongleHasModule(TConnection& conn, void* pJolly);
int f_DongleModules (TConnection& conn, void* pJolly);
int f_DongleNumber (TConnection& conn, void* pJolly);
int f_UserLogin (TConnection& conn, void* pJolly);
int f_UserLogout (TConnection& conn, void* pJolly);
#endif

36
servers/hardlock/connectd.cpp Executable file
View File

@ -0,0 +1,36 @@
#include "StdAfx.h"
#include "connect.h"
#include "server.h"
int f_DongleHasModule(TConnection& conn, void* pJolly)
{
BOOL ok = FALSE;
CStringArray& argv = *(CStringArray*)pJolly;
const int argc = argv.GetSize();
if (argc > 0)
{
const int n = atoi(argv[0]) - 1;
const unsigned short* int_tab = GetServer().Authorizations();
if (int_tab)
ok = (int_tab[n / 16] >> (n % 16)) & 0x1;
}
return conn.ReturnBool(ok);
}
int f_DongleModules(TConnection& conn, void* pJolly)
{
const unsigned short* int_tab = GetServer().Authorizations();
if (int_tab)
{
BYTE* buff = GetServer().GetBuffer(8);
memcpy(buff, int_tab, 8);
}
return int_tab != NULL;
}
int f_DongleNumber(TConnection& conn, void* pJolly)
{
int serno = GetServer().SerialNumber();
return conn.ReturnInteger(serno);
}

74
servers/hardlock/connectu.cpp Executable file
View File

@ -0,0 +1,74 @@
#include "StdAfx.h"
#include "connect.h"
#include "server.h"
int CountUser(TConnection& conn, void* pJolly)
{
const CString& user = *(CString*)pJolly;
const TPrassiConnection& c = (TPrassiConnection&)conn;
return user.CompareNoCase(c.User()) == 0;
}
BOOL TPrassiConnection::DoUserLogin(const CString& user,
const CString& pwd,
const CString& app)
{
BOOL ok = GetServer().SerialNumber() != 0xFFFF;
if (ok)
{
m_strUser = "";
int total = Server().ForEachConnection(CountUser, (void *)&user);
if (app == "ba0100")
{
if (user == "******")
ok = !pwd.IsEmpty();
else
ok = total == 0 && !pwd.IsEmpty();
}
else
{
ok = total == 1;
}
if (ok)
{
m_strUser = user;
m_strApp = app;
}
}
return ReturnBool(ok);
}
///////////////////////////////////////////////////////////
// BOOL UserLogin(CString user, CString pwd, CString app)
//
// Esegue il login dell'utente user con password opzionale
int f_UserLogin(TConnection& conn, void* pJolly)
{
CStringArray& argv = *(CStringArray*)pJolly;
const int argc = argv.GetSize();
if (argc > 3)
{
TPrassiConnection& c = (TPrassiConnection&)conn;
return c.DoUserLogin(argv[1], argv[2], argv[3]);
}
return FALSE;
}
///////////////////////////////////////////////////////////
// BOOL UserLogout()
int f_UserLogout(TConnection& conn, void* pJolly)
{
return ((TPrassiConnection&)conn).DoUserLogout();
}
BOOL TPrassiConnection::DoUserLogout()
{
ReturnBool(TRUE);
return TRUE;
}

333
servers/hardlock/fastapi.h Executable file
View File

@ -0,0 +1,333 @@
/****************************************************************************/
/** **/
/** Hardlock **/
/** API-Structures and definitions **/
/** **/
/** This file contains some helpful defines to access a Hardlock using **/
/** the application programing interface (API) for Hardlock. **/
/** **/
/** ///FAST Software Security - Group Aladdin **/
/** **/
/** Revision history **/
/** ---------------- **/
/** (related to API version) **/
/** 3.18 -- Define HIGH_DLL changed to HLHIGH_DLL (Watcom 9.5 doesn't **/
/** like my define) **/
/** -- New function call API_GET_TASKID **/
/** -- HLXLOGIN no longer needed. **/
/** -- Add UNIX features (M_UNIX defined) **/
/** -- Add Windows NT feature (WINNT defined) **/
/** 3.19 -- ifdef for Symantec C included (DOS386) **/
/** 3.20 -- ifdef for WIN32s included **/
/** ifdef for Intel Codebuilder removed (compiler to buggy) **/
/** 3.22 -- ifdef for Zortech included **/
/** -- combined OS/2 and DOS include files **/
/** 3.23 -- PortFlags added to API structure. **/
/** 3.24 -- defined CALL_ for 16bit Watcom **/
/** 3.25 -- Different includes merged. **/
/** **/
/** (related to VCS version)
*** $Log: not supported by cvs2svn $
*** Revision 1.5 1996/08/12 16:23:43 henri
*** Added VCS log.
***
**/
/****************************************************************************/
#if !defined(_FASTAPI_H_)
#define _FASTAPI_H_
#ifdef M_UNIX
#define __386__
#pragma pack(1)
#endif
#ifdef LINUX
#define __386__
#pragma pack(1)
#endif
#ifdef __OS2__
#ifdef INTERNAL_16BITDLL
#define LOAD_DS
#else
#ifdef __WATCOMC__
#ifdef __386__ /* not the 16bit compiler */
#include <os2.h>
#endif
#else
#include <os2.h>
#endif
#endif
#ifdef OS_16
#define RET_ Word
#define FAR_ far pascal
#define DATAFAR_ far
#else
#define RET_ APIRET
#define FAR_
#define CALL_ APIENTRY
#define DATAFAR_
#endif
#pragma pack(2)
#endif
#ifdef __GNUC__
#define __386__
#define pascal
#endif
#ifdef __WIN32__
#define __386__
#endif
#ifdef WINNT
#ifndef __386__ /* Watcom doesnt like it */
#define __386__
#endif
#pragma pack(1)
#ifdef DLL
#define CALL_ __stdcall
#else
#define CALL_
#endif
#endif
#ifdef DOS386 /* Symantec C */
#define __386__
#pragma pack(2)
#endif
#ifdef __HIGHC__ /* Metaware High C */
#define __386__
#define _PACKED _Packed
#endif
#ifdef __ZTC__ /* Zortech C */
#define __386__
#endif
#ifdef SALFORD /* Salford C */
#define ALIGN_ 8
#endif
#ifdef __WATCOMC__
#ifndef __386__
#ifndef OS_16
#define CALL_ cdecl
#endif
#endif
#endif
#ifdef _CVI_ /* LabWindows/CVI */
#define RET_ Word
#define FAR_ far
#define CALL_ pascal
#define DATAFAR_ far
#endif
#ifdef __386__
#define DATAFAR_
#define FAR_
#endif
#ifdef HLHIGH_DLL
#define CALL_ pascal _export
#endif
#ifdef LOAD_DS
#define CALL_ _loadds
#endif
#ifndef CALL_
#define CALL_
#endif
#ifndef _PACKED
#define _PACKED
#endif
#ifndef DATAFAR_
#define DATAFAR_ far
#endif
#ifndef FAR_
#define FAR_ far
#endif
#ifndef RET_
#define RET_ Word
#endif
#ifndef ALIGN_
#define ALIGN_
#endif
/* -------------------------------- */
/* Definitions and API structures : */
/* -------------------------------- */
typedef unsigned char Byte;
typedef unsigned short Word;
typedef unsigned long Long;
typedef struct
{
Word Use_Key;
Byte Key[8];
} DES_MODE;
typedef struct
{
Word ModAd; /* Hardlock module address */
Word Reg; /* Memory register adress */
Word Value; /* Memory value */
Byte Reserved[4];
} EYE_MODE;
typedef struct
{
Word LT_Reserved;
Word Reg; /* Memory register adress */
Word Value; /* Memory value */
Word Password[2]; /* Access passwords */
} LT_MODE;
typedef union
{
DES_MODE Des;
EYE_MODE Eye;
LT_MODE Lt;
} HARDWARE;
typedef _PACKED struct ALIGN_ hl_api
{
Byte API_Version_ID[2]; /* Version */
Word API_Options[2]; /* API Optionflags */
Word ModID; /* Modul-ID (EYE = 0...) */
HARDWARE Module; /* Hardware type */
#ifdef __OS2__ /* Pointer to cipher data */
#ifdef OS_16
void far *Data;
#else
#ifdef __BORLANDC__
void FAR16PTR Data;
#else
void * _Seg16 Data;
#endif
#endif
#else
void DATAFAR_ *Data;
#endif
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 (HL-Server) */
Byte ID_Ref[8]; /* Referencestring */
Byte ID_Verify[8]; /* Encrypted ID_Ref */
Long Task_ID; /* Multitasking program ID */
Word MaxUsers; /* Maximum Logins (HL-Server) */
Long Timeout; /* Login Timeout in minutes */
Word ShortLife; /* (multiple use) */
Word Application; /* Application number */
Word Protocol; /* Protocol flags */
Word PM_Host; /* DOS Extender type */
Long OSspecific; /* ptr to OS specific data */
Word PortMask; /* Default local search (in) */
Word PortFlags; /* Default local search (out) */
Word EnvMask; /* Use env string search (in) */
Word EnvFlags; /* Use env string search (out) */
Byte Reserved[174]; /* Reserved area */
} HL_API, LT_API;
#ifdef M_UNIX
#pragma pack()
#endif
#ifdef __OS2__
#pragma pack()
#endif
/* ------------- */
/* Module-ID's : */
/* ------------- */
#define EYE_DONGLE 0 /* Hardlock E-Y-E */
#define DES_DONGLE 1 /* FAST DES */
#define LT_DONGLE 3 /* Hardlock LT */
/* --------------------- */
/* 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 */
#define API_GET_TASKID 32 /* Get TaskID from API */
#define API_LOGIN_INFO 34 /* Get API Login 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_ABORT 51 /* 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 */
/* --------------- */
/* EnvMask flags : */
/* --------------- */
#define IGNORE_ENVIRONMENT 0x8000 /* If set the environment is */
/* not scaned for HL_SEARCH */
/* ------------------ */
/* API PM_Host ID's : */
/* ------------------ */
#define API_XTD_DETECT 0
#define API_XTD_DPMI 1 /* QDPMI, Borland, Windows ... */
#define API_XTD_PHAR386 2
#define API_XTD_PHAR286 3
#define API_XTD_CODEBLDR 4 /* Intel Code Builder */
#define API_XTD_COBOLXM 5
/* ------------------ */
/* 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 HLS_FULL 6 /* HL-Server login table full */
#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 */
#define DOS_ALLOC_ERROR 12 /* Error on memory allocation */
#define CANNOT_OPEN_DRIVER 14 /* Can not open driver (NT,UNIX) */
#define INVALID_ENV 15 /* Invalid environment string */
#define DYNALINK_FAILED 16 /* Unable to get a function entry */
#define TOO_MANY_USERS 256 /* Login table full (remote) */
#define SELECT_DOWN 257 /* Printer not On-line */
#endif /*_FASTAPI_H_*/
/* eof */

98
servers/hardlock/frontdoc.cpp Executable file
View File

@ -0,0 +1,98 @@
// FrontEndDoc.cpp : implementation of the CFrontEndDoc class
//
#include "StdAfx.h"
#include "FrontDoc.h"
#include "FrontVw.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFrontEndDoc
IMPLEMENT_DYNCREATE(CFrontEndDoc, CDocument)
BEGIN_MESSAGE_MAP(CFrontEndDoc, CDocument)
//{{AFX_MSG_MAP(CFrontEndDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFrontEndDoc construction/destruction
CFrontEndDoc::CFrontEndDoc()
{
// TODO: add one-time construction code here
}
CFrontEndDoc::~CFrontEndDoc()
{
}
BOOL CFrontEndDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
SetTitle("PRASSI");
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CFrontEndDoc serialization
BOOL CFrontEndDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace)
{
BOOL ok = CDocument::DoSave(lpszPathName, bReplace);
SetTitle("PRASSI");
return ok;
}
void CFrontEndDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
POSITION pos = GetFirstViewPosition();
CFrontEndView* pView = (CFrontEndView*)GetNextView(pos);
CTreeCtrl& pTreeCtrl = pView->GetTreeCtrl();
CString strText;
for (HTREEITEM hItem = pTreeCtrl.GetRootItem();
hItem != NULL;
hItem = pTreeCtrl.GetNextItem(hItem, TVGN_NEXT))
{
strText = pTreeCtrl.GetItemText(hItem);
ar.Write((LPCSTR)strText, strText.GetLength());
ar << char(0x0A);
}
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CFrontEndDoc diagnostics
#ifdef _DEBUG
void CFrontEndDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CFrontEndDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFrontEndDoc commands

45
servers/hardlock/frontdoc.h Executable file
View File

@ -0,0 +1,45 @@
// FrontEndDoc.h : interface of the CFrontEndDoc class
//
/////////////////////////////////////////////////////////////////////////////
class CFrontEndDoc : public CDocument
{
protected: // create from serialization only
CFrontEndDoc();
DECLARE_DYNCREATE(CFrontEndDoc)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFrontEndDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CFrontEndDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
virtual BOOL DoSave(LPCTSTR lpszPathName, BOOL bReplace);
// Generated message map functions
protected:
//{{AFX_MSG(CFrontEndDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////

BIN
servers/hardlock/frontend.aps Executable file

Binary file not shown.

137
servers/hardlock/frontend.clw Executable file
View File

@ -0,0 +1,137 @@
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
LastClass=CStatusDlg
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "FrontEnd.h"
LastPage=0
ClassCount=6
Class1=CFrontEndApp
Class2=CFrontEndDoc
Class3=CFrontEndView
Class4=CMainFrame
ResourceCount=3
Resource1=IDD_STATUS
Class5=CAboutDlg
Resource2=IDD_ABOUTBOX
Class6=CStatusDlg
Resource3=IDR_MAINFRAME
[CLS:CFrontEndApp]
Type=0
HeaderFile=FrontEnd.h
ImplementationFile=FrontEnd.cpp
Filter=N
LastObject=ID_APP_EXIT
BaseClass=CWinApp
VirtualFilter=AC
[CLS:CFrontEndDoc]
Type=0
HeaderFile=FrontEndDoc.h
ImplementationFile=FrontEndDoc.cpp
Filter=N
[CLS:CFrontEndView]
Type=0
HeaderFile=frontvw.h
ImplementationFile=frontvw.cpp
BaseClass=CTreeView
LastObject=CFrontEndView
Filter=C
VirtualFilter=VWC
[CLS:CMainFrame]
Type=0
HeaderFile=MainFrm.h
ImplementationFile=MainFrm.cpp
Filter=T
BaseClass=CFrameWnd
VirtualFilter=fWC
LastObject=ID_NOTEPAD
[CLS:CAboutDlg]
Type=0
HeaderFile=FrontEnd.cpp
ImplementationFile=FrontEnd.cpp
Filter=D
BaseClass=CDialog
VirtualFilter=dWC
LastObject=IDC_GRID1
[DLG:IDD_ABOUTBOX]
Type=1
Class=CAboutDlg
ControlCount=6
Control1=IDC_STATIC,static,1342177283
Control2=IDC_STATIC,static,1342312576
Control3=IDC_DISK_SPACE,static,1342312448
Control4=IDOK,button,1342373889
Control5=IDC_STATIC,static,1342312448
Control6=IDC_PHYSICAL_MEM,static,1342312448
[MNU:IDR_MAINFRAME]
Type=1
Class=CMainFrame
Command1=ID_FILE_SAVE_AS
Command2=ID_APP_EXIT
Command3=ID_EDIT_CLEAR_ALL
Command4=ID_NOTEPAD
Command5=ID_VIEW_TRACE
Command6=ID_VIEW_STATUS
Command7=ID_VIEW_TOOLBAR
Command8=ID_VIEW_STATUS_BAR
Command9=ID_APP_ABOUT
CommandCount=9
[ACL:IDR_MAINFRAME]
Type=1
Class=CMainFrame
Command1=ID_FILE_NEW
Command2=ID_FILE_OPEN
Command3=ID_FILE_SAVE
Command4=ID_EDIT_UNDO
Command5=ID_EDIT_CUT
Command6=ID_EDIT_COPY
Command7=ID_EDIT_PASTE
Command8=ID_EDIT_UNDO
Command9=ID_EDIT_CUT
Command10=ID_EDIT_COPY
Command11=ID_EDIT_PASTE
Command12=ID_NEXT_PANE
Command13=ID_PREV_PANE
CommandCount=13
[TB:IDR_MAINFRAME]
Type=1
Command1=ID_FILE_SAVE_AS
Command2=ID_VIEW_TRACE
Command3=ID_EDIT_CLEAR_ALL
Command4=ID_VIEW_STATUS
Command5=ID_APP_EXIT
Command6=ID_APP_ABOUT
CommandCount=6
[DLG:IDD_STATUS]
Type=1
Class=CStatusDlg
ControlCount=3
Control1=IDOK,button,1342242817
Control2=IDC_STATIC,static,1342308352
Control3=IDC_USERS,edit,1350633600
[CLS:CStatusDlg]
Type=0
HeaderFile=StatDlg.h
ImplementationFile=StatDlg.cpp
BaseClass=CDialog
Filter=D
LastObject=CStatusDlg
VirtualFilter=dWC

202
servers/hardlock/frontend.cpp Executable file
View File

@ -0,0 +1,202 @@
// FrontEnd.cpp : Defines the class behaviors for the application.
//
#include "StdAfx.h"
#include "FrontEnd.h"
#include "MainFrm.h"
#include "FrontDoc.h"
#include "FrontVw.h"
#include "server.h"
#include <dos.h>
#include <direct.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFrontEndApp
BEGIN_MESSAGE_MAP(CFrontEndApp, CWinApp)
//{{AFX_MSG_MAP(CFrontEndApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_APP_EXIT, OnAppExit)
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFrontEndApp construction
CFrontEndApp::CFrontEndApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CFrontEndApp object
CFrontEndApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CFrontEndApp initialization
BOOL CFrontEndApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
LoadStdProfileSettings(0); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CFrontEndDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CFrontEndView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
StartServer();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
virtual BOOL OnInitDialog();
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CFrontEndApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CFrontEndApp commands
int CFrontEndApp::ExitInstance()
{
StopServer();
return CWinApp::ExitInstance();
}
void CFrontEndApp::OnAppExit()
{
BOOL bCanExit = !GetServer().HasConnections();
if (!bCanExit)
{
int nCode = AfxMessageBox("There are still active connections:\n"
"Do you really want to exit anyway?",
MB_YESNO | MB_ICONQUESTION);
if (nCode == IDYES)
bCanExit = TRUE;
}
if (bCanExit)
CWinApp::OnAppExit();
}
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CString strFreeDiskSpace;
CString strFreeMemory;
CString strFmt;
// Fill available memory
MEMORYSTATUS MemStat;
MemStat.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&MemStat);
strFmt.LoadString(CG_IDS_PHYSICAL_MEM);
strFreeMemory.Format(strFmt, MemStat.dwTotalPhys / 1024L);
SetDlgItemText(IDC_PHYSICAL_MEM, strFreeMemory);
// Fill disk free information
struct _diskfree_t diskfree;
int nDrive = _getdrive(); // use current default drive
if (_getdiskfree(nDrive, &diskfree) == 0)
{
strFmt.LoadString(CG_IDS_DISK_SPACE);
strFreeDiskSpace.Format(strFmt,
(DWORD)diskfree.avail_clusters *
(DWORD)diskfree.sectors_per_cluster *
(DWORD)diskfree.bytes_per_sector / (DWORD)1024L,
nDrive-1 + _T('A'));
}
else
strFreeDiskSpace.LoadString(CG_IDS_DISK_SPACE_UNAVAIL);
SetDlgItemText(IDC_DISK_SPACE, strFreeDiskSpace);
return TRUE;
}

38
servers/hardlock/frontend.h Executable file
View File

@ -0,0 +1,38 @@
// FrontEnd.h : main header file for the FRONTEND application
//
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CFrontEndApp:
// See FrontEnd.cpp for the implementation of this class
//
class CFrontEndApp : public CWinApp
{
public:
CFrontEndApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFrontEndApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CFrontEndApp)
afx_msg void OnAppAbout();
afx_msg void OnAppExit();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////

1032
servers/hardlock/frontend.mak Executable file

File diff suppressed because it is too large Load Diff

BIN
servers/hardlock/frontend.mdp Executable file

Binary file not shown.

401
servers/hardlock/frontend.rc Executable file
View File

@ -0,0 +1,401 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italian (Italy) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
#ifdef _WIN32
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 16, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif\r\n"
"#include ""res\\FrontEnd.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""l.ita\\afxres.rc"" // Standard components\r\n"
"#endif\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_LOGTYPE ICON DISCARDABLE "res\\Log.ico"
IDR_MAINFRAME ICON DISCARDABLE "res\\Prassi.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
BEGIN
BUTTON ID_FILE_SAVE_AS
SEPARATOR
BUTTON ID_VIEW_TRACE
BUTTON ID_EDIT_CLEAR_ALL
BUTTON ID_VIEW_STATUS
SEPARATOR
BUTTON ID_APP_EXIT
BUTTON ID_APP_ABOUT
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Salva con nome...", ID_FILE_SAVE_AS
MENUITEM SEPARATOR
MENUITEM "&Esci", ID_APP_EXIT
END
POPUP "&Modifica"
BEGIN
MENUITEM "&Cancella tutto", ID_EDIT_CLEAR_ALL
MENUITEM "Notepad", ID_NOTEPAD
END
POPUP "&Visualizza"
BEGIN
MENUITEM "&Trace", ID_VIEW_TRACE
MENUITEM "Stato del sistema...", ID_VIEW_STATUS
MENUITEM SEPARATOR
MENUITEM "Barra degli st&rumenti", ID_VIEW_TOOLBAR
MENUITEM "Barra di st&ato", ID_VIEW_STATUS_BAR
END
POPUP "&?"
BEGIN
MENUITEM "Infor&mazioni su FrontEnd...", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
"N", ID_FILE_NEW, VIRTKEY, CONTROL
"A", ID_FILE_OPEN, VIRTKEY, CONTROL
"S", ID_FILE_SAVE, VIRTKEY, CONTROL
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL
"X", ID_EDIT_CUT, VIRTKEY, CONTROL
"C", ID_EDIT_COPY, VIRTKEY, CONTROL
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT
VK_F6, ID_NEXT_PANE, VIRTKEY
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 70
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Server PRASSI"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,7,7,21,20
LTEXT "Server Versione 1.0",IDC_STATIC,49,7,119,10,SS_NOPREFIX |
SS_SUNKEN
LTEXT "Disk space",IDC_DISK_SPACE,49,54,119,9,SS_SUNKEN
DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP
LTEXT "Copyright © 1997",IDC_STATIC,49,23,119,9,SS_SUNKEN
LTEXT "Physical memory",IDC_PHYSICAL_MEM,49,38,119,9,SS_SUNKEN
END
IDD_STATUS DIALOGEX 0, 0, 186, 69
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Stato del sistema"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,68,48,50,14
LTEXT "Numero di utenti",IDC_STATIC,7,7,111,8
EDITTEXT IDC_USERS,136,7,43,12,ES_AUTOHSCROLL | ES_READONLY,
WS_EX_RIGHT
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "FRONTEND Applicazione MFC\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "FRONTEND\0"
VALUE "LegalCopyright", "Copyright © 1997\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "FRONTEND.EXE\0"
VALUE "ProductName", "FRONTEND Applicazione\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 210
TOPMARGIN, 7
BOTTOMMARGIN, 63
END
IDD_STATUS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 62
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "FrontEnd\n\nLog\nLog Files (*.log)\n.LOG\nLog\nLog File"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
AFX_IDS_APP_TITLE "FrontEnd"
AFX_IDS_IDLEMESSAGE "Pronto"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_INDICATOR_EXT "EST"
ID_INDICATOR_CAPS "MA"
ID_INDICATOR_NUM "NUM"
ID_INDICATOR_SCRL "BS"
ID_INDICATOR_OVR "SSC"
ID_INDICATOR_REC "REG"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_NEW "Crea un nuovo documento\nNuovo"
ID_FILE_OPEN "Apre un documento esistente\nApri"
ID_FILE_CLOSE "Chiude il documento attivo\nChiudi"
ID_FILE_SAVE "Salva il documento attivo\nSalva"
ID_FILE_SAVE_AS "Salva il documento attivo con un nuovo nome\nSalva con nome"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_APP_ABOUT "Visualizza le informazioni sul programma, il numero di versione e le informazioni di copyright\nInformazioni su..."
ID_APP_EXIT "Esce dall'applicazione\nEsci"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_MRU_FILE1 "Apre questo documento"
ID_FILE_MRU_FILE2 "Apre questo documento"
ID_FILE_MRU_FILE3 "Apre questo documento"
ID_FILE_MRU_FILE4 "Apre questo documento"
ID_FILE_MRU_FILE5 "Apre questo documento"
ID_FILE_MRU_FILE6 "Apre questo documento"
ID_FILE_MRU_FILE7 "Apre questo documento"
ID_FILE_MRU_FILE8 "Apre questo documento"
ID_FILE_MRU_FILE9 "Apre questo documento"
ID_FILE_MRU_FILE10 "Apre questo documento"
ID_FILE_MRU_FILE11 "Apre questo documento"
ID_FILE_MRU_FILE12 "Apre questo documento"
ID_FILE_MRU_FILE13 "Apre questo documento"
ID_FILE_MRU_FILE14 "Apre questo documento"
ID_FILE_MRU_FILE15 "Apre questo documento"
ID_FILE_MRU_FILE16 "Apre questo documento"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_NEXT_PANE "Passa al riquadro della finestra successivo\nRiquadro successivo"
ID_PREV_PANE "Ritorna al riquadro della finestra precedente\nRiquadro precedente"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_WINDOW_SPLIT "Divide la finestra attiva in riquadri\nDividi"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_CLEAR "Cancella la selezione\nCancella"
ID_EDIT_CLEAR_ALL "Cancella tutto\nCancella tutto"
ID_EDIT_COPY "Copia la selezione e la pone negli Appunti\nCopia"
ID_EDIT_CUT "Taglia la selezione e la pone negli Appunti\nTaglia"
ID_EDIT_FIND "Trova il testo specificato\nTrova"
ID_EDIT_PASTE "Inserisce il contenuto degli Appunti\nIncolla"
ID_EDIT_REPEAT "Ripete l'ultima azione\nRipeti"
ID_EDIT_REPLACE "Sostituisce il testo specifico con un testo differente\nSostituisci"
ID_EDIT_SELECT_ALL "Seleziona l'intero documento\nSeleziona tutto"
ID_EDIT_UNDO "Annulla l'ultima azione\nAnnulla"
ID_EDIT_REDO "Ripristina l'azione precedentemente annullata\nRipristina"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_VIEW_TOOLBAR "Mostra o nasconde la barra degli strumenti\nMostra/nascondi barra degli strumenti"
ID_VIEW_STATUS_BAR "Mostra o nasconde la barra di stato\nMostra/nascondi barra di stato"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCSIZE "Modifica le dimensioni della finestra"
AFX_IDS_SCMOVE "Modifica la posizione della finestra"
AFX_IDS_SCMINIMIZE "Riduce la finestra ad icona"
AFX_IDS_SCMAXIMIZE "Allarga la finestra a tutto schermo"
AFX_IDS_SCNEXTWINDOW "Passa alla finestra successiva del documento "
AFX_IDS_SCPREVWINDOW "Passa alla precedente finestra del documento"
AFX_IDS_SCCLOSE "Chiude la finestra attiva e chiede di salvare i documenti"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCRESTORE "Ripristina la finestra alle dimensioni normali"
AFX_IDS_SCTASKLIST "Attiva l'Elenco dei task"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_VIEW_TRACE "Logging degli eventi"
ID_VIEW_STATUS "Mostra lo stato del sistema\nStato del sistema..."
END
STRINGTABLE DISCARDABLE
BEGIN
CG_IDS_PHYSICAL_MEM "%lu KB"
CG_IDS_DISK_SPACE "%lu KB Free on %c:"
CG_IDS_DISK_SPACE_UNAVAIL "Unavailable"
END
#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
#ifdef _WIN32
LANGUAGE 16, 1
#pragma code_page(1252)
#endif
#include "res\FrontEnd.rc2" // non-Microsoft Visual C++ edited resources
#include "l.ita\afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

14
servers/hardlock/frontend.reg Executable file
View File

@ -0,0 +1,14 @@
REGEDIT
; This .REG file may be used by your SETUP program.
; If a SETUP program is not available, the entries below will be
; registered in your InitInstance automatically with a call to
; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll.
HKEY_CLASSES_ROOT\.LOG = Log
HKEY_CLASSES_ROOT\Log\shell\open\command = FRONTEND.EXE %1
HKEY_CLASSES_ROOT\Log\shell\open\ddeexec = [open("%1")]
HKEY_CLASSES_ROOT\Log\shell\open\ddeexec\application = FRONTEND
; note: the application is optional
; (it defaults to the app name in "command")
HKEY_CLASSES_ROOT\Log = Log File

131
servers/hardlock/frontvw.cpp Executable file
View File

@ -0,0 +1,131 @@
// FrontEndView.cpp : implementation of the CFrontEndView class
//
#include "StdAfx.h"
#include "FrontEnd.h"
#include "FrontDoc.h"
#include "FrontVw.h"
#include "Server.h"
#include "StatDlg.h"
#include "Tracing.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFrontEndView
IMPLEMENT_DYNCREATE(CFrontEndView, CTreeView)
BEGIN_MESSAGE_MAP(CFrontEndView, CTreeView)
//{{AFX_MSG_MAP(CFrontEndView)
ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_AS, OnUpdateFileSaveAs)
ON_COMMAND(ID_EDIT_CLEAR_ALL, OnEditClearAll)
ON_UPDATE_COMMAND_UI(ID_EDIT_CLEAR_ALL, OnUpdateEditClearAll)
ON_COMMAND(ID_VIEW_TRACE, OnViewTrace)
ON_UPDATE_COMMAND_UI(ID_VIEW_TRACE, OnUpdateViewTrace)
ON_COMMAND(ID_VIEW_STATUS, OnViewStatus)
ON_UPDATE_COMMAND_UI(ID_VIEW_STATUS, OnUpdateViewStatus)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFrontEndView construction/destruction
CFrontEndView::CFrontEndView()
{
// TODO: add construction code here
}
CFrontEndView::~CFrontEndView()
{
}
BOOL CFrontEndView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CTreeView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CFrontEndView drawing
void CFrontEndView::OnDraw(CDC* pDC)
{
CFrontEndDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CFrontEndView diagnostics
#ifdef _DEBUG
void CFrontEndView::AssertValid() const
{
CTreeView::AssertValid();
}
void CFrontEndView::Dump(CDumpContext& dc) const
{
CTreeView::Dump(dc);
}
CFrontEndDoc* CFrontEndView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFrontEndDoc)));
return (CFrontEndDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFrontEndView message handlers
void CFrontEndView::OnUpdateFileSaveAs(CCmdUI* pCmdUI)
{
CTreeCtrl& pTreeCtrl = GetTreeCtrl();
pCmdUI->Enable(pTreeCtrl.GetCount() > 0);
}
void CFrontEndView::OnEditClearAll()
{
CWaitCursor HourGlass;
CTreeCtrl& pTreeCtrl = GetTreeCtrl();
pTreeCtrl.DeleteAllItems();
Invalidate();
}
void CFrontEndView::OnUpdateEditClearAll(CCmdUI* pCmdUI)
{
pCmdUI->Enable(!TracingEnabled());
}
void CFrontEndView::OnViewTrace()
{
EnableTracing(!TracingEnabled());
}
void CFrontEndView::OnUpdateViewTrace(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(TracingEnabled());
}
void CFrontEndView::OnViewStatus()
{
CStatusDlg dlg(this);
dlg.m_nUsers = GetServer().Connections();
dlg.DoModal();
}
void CFrontEndView::OnUpdateViewStatus(CCmdUI* pCmdUI)
{
pCmdUI->Enable();
}

55
servers/hardlock/frontvw.h Executable file
View File

@ -0,0 +1,55 @@
// FrontEndView.h : interface of the CFrontEndView class
//
/////////////////////////////////////////////////////////////////////////////
class CFrontEndView : public CTreeView
{
protected: // create from serialization only
CFrontEndView();
DECLARE_DYNCREATE(CFrontEndView)
// Attributes
public:
CFrontEndDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFrontEndView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CFrontEndView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CFrontEndView)
afx_msg void OnUpdateFileSaveAs(CCmdUI* pCmdUI);
afx_msg void OnEditClearAll();
afx_msg void OnUpdateEditClearAll(CCmdUI* pCmdUI);
afx_msg void OnViewTrace();
afx_msg void OnUpdateViewTrace(CCmdUI* pCmdUI);
afx_msg void OnViewStatus();
afx_msg void OnUpdateViewStatus(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in FrontEndView.cpp
inline CFrontEndDoc* CFrontEndView::GetDocument()
{ return (CFrontEndDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////

691
servers/hardlock/hlapi_c.cpp Executable file
View File

@ -0,0 +1,691 @@
/****************************************************************************/
/** **/
/** Hardlock API-Calls **/
/** **/
/** This program is just an example for some functions to access the **/
/** application programing interface (API) for Hardlock. Feel free to **/
/** define your own functions. **/
/** **/
/** ///FAST Software Security - Group Aladdin **/
/** **/
/** Computer: IBM PC or compatible **/
/** OS : MS-PC/DOS 2.0 or higher and MS Windows 3.x **/
/** Language: C **/
/** **/
/** Revision history **/
/** ---------------- **/
/** (related to API version) **/
/** 3.18 -- Get the TaskID from API function. **/
/** -- HL_MEMINF strategy changed **/
/** -- New function: HL_HLSVERS: return HL-Server version **/
/** 3.19 -- ifdef for Symantec C included (DOS386) **/
/** -- CENTRY-DLL_USE combination (for Windows NT/32s) by Chris **/
/** 3.22 -- Search order added to HL_LOGIN, call to function (33). **/
/** 3.23 -- Search order removed, handeled internal by LowAPI. **/
/** -- HL_LOGOUT, HL_LOGIN optimized (call API_LOGIN and API_LOGOUT **/
/** only for remote access). **/
/** -- Environment search string not yet supported for FlashTek. **/
/** Must be compiled with /dNO_ENVCHK **/
/** -- release **/
/** 3.24 -- API_Function defined **/
/** 3.25 -- Bugfix for HL-Server licenced to one user. **/
/** -- No further checks on HL_LOGIN on specific errors. **/
/** **/
/** (related to VCS version)
*** $Log: not supported by cvs2svn $
*** Revision 1.5 1996/10/02 20:34:09 HENRI
*** Added GETSTRUC define because of wrong pointer init by old Power Fortran linker.
***
*** Revision 1.4 1996/09/18 11:52:14 henri
*** Support for multi API strutures.
***
*** Revision 1.3 1996/08/08 14:47:01 henri
*** Added VCS log.
***
**/
/****************************************************************************/
#include "StdAfx.h"
#ifdef _MSC_VER
#pragma warning (disable:4103) /* no #pragma pack warnings */
#endif
#define GETSTRUC if (!api_struc) api_struc = &hl_struc
#include "hlapi_c.h"
static HL_API hl_struc = {{0}}; /* Hardlock API structure */
static HL_API DATAFAR_ *api_struc=0; /* Pointer to API structure */
static Word CALL_API (HL_API DATAFAR_ *api_struc);
#ifdef __cplusplus
extern "C" {
#endif
#ifdef M_UNIX
#define CENTRY
#endif
#ifdef LINUX
#define CENTRY
#endif
#ifdef WINNT
#define CENTRY
#ifdef __WATCOMC__
#pragma aux cdecl "_*" parm caller [] value struct routine [eax] modify [eax ebx ecx edx]
#pragma aux (cdecl) API_HL_CSTACK;
#endif
#endif
#ifdef SALFORD
#include <dbos\lib.h>
#define CENTRY
#endif
#ifdef CENTRY
#ifdef DLL_USE
#ifdef WINNT
extern Word __stdcall _API_DLL(HL_API DATAFAR_ *api_struc);
#define API_Function _API_DLL
#endif
#else
#ifdef WINNT
extern Word FAR_ __cdecl API_HL_CSTACK(HL_API DATAFAR_ *api_struc);
#else
extern Word FAR_ API_HL_CSTACK(HL_API DATAFAR_ *api_struc);
#endif
#define API_Function API_HL_CSTACK
#endif
#else
#ifdef DLL_USE
extern Word FAR_ pascal _API_DLL(HL_API DATAFAR_ *api_struc);
#define API_Function _API_DLL
#else
#ifdef __HIGHC__
extern Word _API_HL_CSTACK(HL_API DATAFAR_ *api_struc);
#define API_Function _API_HL_CSTACK
#else
extern Word FAR_ pascal _API_HL_STACK(HL_API DATAFAR_ *api_struc);
#define API_Function _API_HL_STACK
#endif
#endif
#endif
#ifdef __cplusplus
}
#endif
/****************************************************************************/
static Word CALL_API(HL_API DATAFAR_ *api_struc)
/****************************************************************************/
{
Word result;
/* ----------------- */
/* We call the API : */
/* ----------------- */
#ifdef SALFORD
set_io_permission(1);
#endif
result = API_Function(api_struc);
#ifdef SALFORD
set_io_permission(0);
#endif
return result;
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_SELECT(HL_API DATAFAR_ *hl_ptr)
/****************************************************************************/
{
if (!hl_ptr)
api_struc = &hl_struc;
else
api_struc = hl_ptr;
return (STATUS_OK);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_LOGOUT(void)
/****************************************************************************/
{
GETSTRUC;
if (api_struc->Remote == NET_DEVICE)
{
api_struc->Function = API_LOGOUT;
CALL_API(api_struc);
}
api_struc->Function = API_DOWN;
CALL_API(api_struc);
if (api_struc->Status)
{
api_struc->Function = API_FORCE_DOWN;
CALL_API(api_struc);
}
api_struc->Task_ID = 0;
return (api_struc->Status);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_PORTINF(void)
/****************************************************************************/
{
GETSTRUC;
api_struc->Function = API_AVAIL;
CALL_API(api_struc);
if (api_struc->Status) return (0xffff);
return (api_struc->Port);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_USERINF(void)
/****************************************************************************/
{
GETSTRUC;
api_struc->Function = API_INFO;
api_struc->Application = 0;
CALL_API(api_struc);
if (api_struc->Status) return (0xffff);
return (api_struc->NetUsers);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_MAXUSER(void)
/****************************************************************************/
{
GETSTRUC;
api_struc->Function = API_INFO;
CALL_API(api_struc);
if (api_struc->Status) return (0xffff);
return (api_struc->MaxUsers);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_ACCINF(void)
/****************************************************************************/
{
GETSTRUC;
api_struc->Function = API_AVAIL;
CALL_API(api_struc);
if (api_struc->Status) return (0xffff);
return (api_struc->Remote);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_VERSION(void)
/****************************************************************************/
{
GETSTRUC;
api_struc->Function = API_AVAIL;
CALL_API(api_struc);
if (api_struc->Status) return (0xffff);
return ((api_struc->API_Version_ID[0] * 100) + api_struc->API_Version_ID[1]);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_HLSVERS(void)
/****************************************************************************/
{
Word result;
GETSTRUC;
if (api_struc->Remote == NET_DEVICE)
{
api_struc->Function = API_AVAIL;
result = CALL_API(api_struc);
if (result == STATUS_OK)
return (api_struc->ShortLife);
}
return 0;
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_AVAIL(void)
/****************************************************************************/
{
GETSTRUC;
api_struc->Function = API_AVAIL;
CALL_API(api_struc);
if ((api_struc->Status == NO_DONGLE) && (api_struc->ShortLife == 1) && (api_struc->Remote == LOCAL_DEVICE))
return(SELECT_DOWN);
return (api_struc->Status);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_CODE(void DATAFAR_ *Data, Word Cnt)
/****************************************************************************/
{
GETSTRUC;
api_struc->Data = Data;
api_struc->Bcnt = Cnt;
api_struc->Function = API_KEYE;
CALL_API(api_struc);
api_struc->Bcnt = 0;
return (api_struc->Status);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_LOGIN(Word ModAd, Word Access, Byte DATAFAR_ * RefKey, Byte DATAFAR_ * VerKey)
/****************************************************************************/
{
Word result;
Long OldTimerID;
Word OldRemote, OldPort;
short i;
GETSTRUC;
OldRemote = api_struc->Remote;
OldTimerID = api_struc->Task_ID;
OldPort = api_struc->Port;
api_struc->ModID = EYE_DONGLE;
api_struc->Remote = Access;
api_struc->Module.Eye.ModAd = ModAd;
/* --------------------- */
/* Get TaskID from API : */
/* --------------------- */
#ifndef DOS386
if (api_struc->Task_ID == 0)
{
api_struc->Function = API_GET_TASKID;
CALL_API(api_struc);
}
#endif
api_struc->Protocol = 0;
api_struc->Port = 0;
api_struc->Timeout = 0;
api_struc->PM_Host = API_XTD_DETECT;
/* -------------------------------------------- */
/* We generated a verify key with TESTAPI.EXE : */
/* -------------------------------------------- */
for (i = 0; i < 8; i++)
{
api_struc->ID_Ref[i] = RefKey[i];
api_struc->ID_Verify[i] = VerKey[i];
}
/* ------------------------- */
/* Don't check for HL_SEARCH */
/* ------------------------- */
#ifdef NO_ENVCHK
api_struc->EnvMask |= IGNORE_ENVIRONMENT;
#endif
/* --------------------------------------------- */
/* Call the INIT (search for Hardlock) function :*/
/* --------------------------------------------- */
api_struc->Function = API_INIT;
result = CALL_API(api_struc);
if (result == ALREADY_INIT)
{
api_struc->Remote = OldRemote;
api_struc->Task_ID = OldTimerID;
api_struc->Port = OldPort;
return result;
}
/* ----------------------------- */
/* No further checks necessary : */
/* ----------------------------- */
if ((result == INVALID_ENV) || (result == CANNOT_OPEN_DRIVER))
return (result);
/* ----------------------------- */
/* Check, if HL-Server is full : */
/* ----------------------------- */
if (result != STATUS_OK)
{
if ((Access & NET_DEVICE) == NET_DEVICE)
{
api_struc->Function = API_LOGIN_INFO;
if (CALL_API(api_struc) == HLS_FULL)
result = TOO_MANY_USERS;
}
return (result);
}
/* ------------------------------------------ */
/* Login to HL-Server if Hardlock is remote : */
/* ------------------------------------------ */
if (api_struc->Remote == NET_DEVICE)
{
api_struc->Function = API_LOGIN;
result = CALL_API(api_struc);
if(result)
{
api_struc->Function = API_DOWN;
CALL_API(api_struc);
}
}
return result;
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_READ(Word Reg, Word DATAFAR_ *Value)
/****************************************************************************/
{
GETSTRUC;
if(Reg <= 63)
{
api_struc->Module.Eye.Reg = Reg;
api_struc->Function = API_READ;
CALL_API(api_struc);
if(api_struc->Status) return (api_struc->Status);
*Value = api_struc->Module.Eye.Value;
return (STATUS_OK);
}
return (INVALID_PARAM);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_READBL(Byte DATAFAR_ * Eeprom)
/****************************************************************************/
{
GETSTRUC;
api_struc->Bcnt = 16;
api_struc->Data = Eeprom;
api_struc->Function = API_READ_BLOCK;
CALL_API(api_struc);
api_struc->Bcnt = 0;
return (api_struc->Status);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_WRITEBL(Byte DATAFAR_ * Eeprom)
/****************************************************************************/
{
GETSTRUC;
api_struc->Bcnt = 4;
api_struc->Data = Eeprom;
api_struc->Function = API_WRITE_BLOCK;
CALL_API(api_struc);
api_struc->Bcnt = 0;
return (api_struc->Status);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_ABORT(void)
/****************************************************************************/
{
GETSTRUC;
api_struc->Function = API_LOGOUT;
CALL_API(api_struc);
api_struc->Function = API_ABORT;
CALL_API(api_struc);
return (api_struc->Status);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_WRITE(Word Reg, Word Value)
/****************************************************************************/
{
GETSTRUC;
if(Reg >= 48 && Reg <= 63)
{
api_struc->Module.Eye.Reg = Reg;
api_struc->Module.Eye.Value = Value;
api_struc->Function = API_WRITE;
CALL_API(api_struc);
return (api_struc->Status);
}
return (INVALID_PARAM);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_MEMINF(void)
/****************************************************************************/
{
Word newvalue, oldvalue;
Word TestMem = 0;
Byte Memory[128];
int i;
/* -------------------------- */
/* Read memory in one block : */
/* -------------------------- */
GETSTRUC;
api_struc->Bcnt = 16;
api_struc->Data = Memory;
api_struc->Function = API_READ_BLOCK;
CALL_API(api_struc);
api_struc->Bcnt = 0;
if (api_struc->Status != STATUS_OK)
return (NO_ACCESS);
/* -------------------------------------- */
/* Check, if every value is zero or one : */
/* -------------------------------------- */
for (i = 0; i < 128; i++)
TestMem |= Memory[i];
if (TestMem != 0)
{
for (i = 0; i < 128; i++)
{
if (Memory[i] != 0xff)
return (STATUS_OK);
}
}
/* ---------------------- */
/* Save memory contents : */
/* ---------------------- */
api_struc->Module.Eye.Reg = 48;
api_struc->Function = API_READ;
CALL_API(api_struc);
if(api_struc->Status) return (NO_ACCESS);
oldvalue = api_struc->Module.Eye.Value;
/* ---------------------------------------------------------------- */
/* XOR of the read value to exclude random returns from interface : */
/* ---------------------------------------------------------------- */
newvalue = oldvalue ^ 0x0d0e;
/* ------------------------ */
/* Write new memory value : */
/* ------------------------ */
api_struc->Module.Eye.Value = newvalue;
api_struc->Function = API_WRITE;
CALL_API(api_struc);
if(api_struc->Status)
{
api_struc->Module.Eye.Value = oldvalue;
api_struc->Function = API_WRITE;
CALL_API(api_struc);
return(NO_ACCESS);
}
/* ------------------------- */
/* Read and compare memory : */
/* ------------------------- */
api_struc->Function = API_READ;
CALL_API(api_struc);
if(api_struc->Status)
{
api_struc->Module.Eye.Value = oldvalue;
api_struc->Function = API_WRITE;
CALL_API(api_struc);
return(NO_ACCESS);
}
if (api_struc->Module.Eye.Value != newvalue)
{
api_struc->Module.Eye.Value = oldvalue;
api_struc->Function = API_WRITE;
CALL_API(api_struc);
return(NO_ACCESS);
}
/* ------------------ */
/* Write old memory : */
/* ------------------ */
api_struc->Module.Eye.Value = oldvalue;
api_struc->Function = API_WRITE;
CALL_API(api_struc);
if(api_struc->Status)
{
api_struc->Module.Eye.Value = oldvalue;
api_struc->Function = API_WRITE;
CALL_API(api_struc);
return(NO_ACCESS);
}
return (STATUS_OK);
}
/****************************************************************************/
/****************************************************************************/
/* 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_ CALL_ INT_ON (void)
/****************************************************************************/
{return;}
/****************************************************************************/
void FAR_ CALL_ INT_OFF (void)
/****************************************************************************/
{return;}
/****************************************************************************/
void FAR_ CALL_ HL_ON (Word Port, Word ModAd)
/****************************************************************************/
{
GETSTRUC;
api_struc->ModID = EYE_DONGLE;
api_struc->Remote = LOCAL_DEVICE;
api_struc->Module.Eye.ModAd = ModAd;
api_struc->Port = Port;
api_struc->Function = API_INIT;
CALL_API(api_struc);
if(api_struc->Status) return;
api_struc->Function = API_LOGIN;
CALL_API(api_struc);
if(api_struc->Status)
{
api_struc->Function = API_DOWN;
CALL_API(api_struc);
}
return;
}
/****************************************************************************/
void FAR_ CALL_ HL_OFF (Word Port)
/****************************************************************************/
{
GETSTRUC;
api_struc->Port = Port;
api_struc->Function = API_LOGOUT;
CALL_API(api_struc);
api_struc->Function = API_DOWN;
CALL_API(api_struc);
if (api_struc->Status)
{
api_struc->Function = API_FORCE_DOWN;
CALL_API(api_struc);
}
return;
}
/****************************************************************************/
Word FAR_ CALL_ K_EYE (Word Port, char DATAFAR_ *Inp, Word BlkCnt)
/****************************************************************************/
{
GETSTRUC;
api_struc->Port = Port;
api_struc->Data = Inp;
api_struc->Bcnt = BlkCnt;
api_struc->Function = API_KEYE;
CALL_API(api_struc);
api_struc->Bcnt = 0;
if (api_struc->Status)
return (0);
return (1);
}
/****************************************************************************/
void FAR_ CALL_ HL_WR (Word Port, Word Reg, Word Val)
/****************************************************************************/
{
GETSTRUC;
if(Reg >= 48 && Reg <= 63)
{
api_struc->Port = Port;
api_struc->Module.Eye.Reg = Reg;
api_struc->Module.Eye.Value = Val;
api_struc->Function = API_WRITE;
CALL_API(api_struc);
}
return;
}
/****************************************************************************/
Word FAR_ CALL_ HL_RD (Word Port, Word Reg)
/****************************************************************************/
{
GETSTRUC;
if(Reg <= 63)
{
api_struc->Port = Port;
api_struc->Module.Eye.Reg = Reg;
api_struc->Function = API_READ;
CALL_API(api_struc);
if (api_struc->Status == STATUS_OK)
return (api_struc->Module.Eye.Value);
}
return (0);
}
/****************************************************************************/
RET_ FAR_ CALL_ HL_CALC (Word i1, Word i2, Word i3, Word i4)
/****************************************************************************/
{
unsigned short Shift1, Shift2;
GETSTRUC;
api_struc->Function = 16; /* Function: query Hardlock in compatible mode */
Shift1 = i1 | (i2 << 8);
Shift2 = i3 | (i4 << 8);
api_struc->Timeout = (Long) Shift1 | (Long) (Shift2 * 0x10000L);
CALL_API(api_struc);
if(api_struc->Status)
return 0;
else
return api_struc->ShortLife;
}

47
servers/hardlock/hlapi_c.h Executable file
View File

@ -0,0 +1,47 @@
#include "fastapi.h"
/* --------------------- */
/* Function prototypes : */
/* --------------------- */
#ifdef __cplusplus
extern "C" {
#endif
RET_ FAR_ CALL_ HL_LOGIN (Word ModAd, Word Access, Byte DATAFAR_ *RefKey, Byte DATAFAR_ *VerKey);
RET_ FAR_ CALL_ HL_LOGOUT (void);
RET_ FAR_ CALL_ HL_AVAIL (void);
RET_ FAR_ CALL_ HL_PORTINF (void);
RET_ FAR_ CALL_ HL_ACCINF (void);
RET_ FAR_ CALL_ HL_USERINF (void);
RET_ FAR_ CALL_ HL_MAXUSER (void);
RET_ FAR_ CALL_ HL_MEMINF (void);
RET_ FAR_ CALL_ HL_CODE (void DATAFAR_ *Data, Word Count);
RET_ FAR_ CALL_ HL_WRITE (Word Reg, Word Value);
RET_ FAR_ CALL_ HL_READ (Word Reg, Word DATAFAR_ *Value);
RET_ FAR_ CALL_ HL_READBL (Byte DATAFAR_ *Eeprom);
RET_ FAR_ CALL_ HL_WRITEBL (Byte DATAFAR_ *Eeprom);
RET_ FAR_ CALL_ HL_ABORT (void);
RET_ FAR_ CALL_ HL_VERSION (void);
RET_ FAR_ CALL_ HL_HLSVERS (void);
RET_ FAR_ CALL_ HL_SELECT (HL_API DATAFAR_ *hl_ptr);
#ifndef __OS2__
/****************************************************************************/
/* 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_ CALL_ HL_ON (Word Port, Word ModAd);
void FAR_ CALL_ HL_OFF (Word Port);
Word FAR_ CALL_ K_EYE (Word Port, char DATAFAR_ *Inp, Word BlkCnt);
void FAR_ CALL_ HL_WR (Word Port, Word Reg, Word Val);
Word FAR_ CALL_ HL_RD (Word Port, Word Reg);
void FAR_ CALL_ INT_ON (void);
void FAR_ CALL_ INT_OFF (void);
#endif
RET_ FAR_ CALL_ HL_CALC (Word i1, Word i2, Word i3, Word i4);
#ifdef __cplusplus
};
#endif
/* eof */

98
servers/hardlock/iserrors.h Executable file
View File

@ -0,0 +1,98 @@
#ifndef __RECTYPES_H
#define __RECTYPES_H
#define NOERR 0
#define FIELDERR -1
typedef long TRecnotype;
// @doc EXTERNAL
// @enum TFilelock | Comandi per l'apertura dei file
enum TFilelock {
_excllock = 0x100, // @emem Apertura in modo esclusivo
_autolock = 0x200, // @emem Apertura del file in modo auto
_manulock = 0x400}; // @emem Apertura del file in modo manuale
// @doc EXTERNAL
// @enum TReclock | Comandi per la gestione dei lock su record
enum TReclock {
_unlock = 0x1000, // @emem Sblocca il record
_nolock = 0x2000, // @emem Nessuna operazione di lock
_lock = 0x4000, // @emem Blocca il record
_testandlock = (int)0x8000} ; // @emem Blocca il record se possibile, altrimenti ritorna errore
// @doc EXTERNAL
// @enum TDirtype | Comandi per la gestione di <c TDir>
enum TDirtype {
_nordir, // @emem Riferimento operazioni col prefix corrente
_comdir } ; // @emem Riferimento operazioni al direttorio comune
// @doc EXTERNAL
// @enum TDirop | Comandi per la gestione di <c TDir>
enum TDirop {
_nordirop, // @emem Riferimento per operazioni normali
_sysdirop }; // @emem Riferimento per operazioni di sistema
// @doc EXTERNAL
// @enum TFieldtypes | Elenco tipi di campi
enum TFieldtypes {
_nullfld, // @emem Campo non definito
_alfafld, // @emem Campo di tipo alfanumerico
_intfld, // @emem Campo di tipo intero
_longfld, // @emem Campo di tipo intero lungo
_realfld, // @emem Campo di tipo reale (vedi <c real>)
_datefld, // @emem Campo di tipo data (vedi <c TDate>)
_wordfld, // @emem Campo di tipo intero senza segno
_charfld, // @emem Campo di tipo carattere
_boolfld , // @emem Campo di tipo booleano
_intzerofld, // @emem Campo di tipo intero zero filled
_longzerofld, // @emem Campo di tipo intero lungo zero filled
_memofld} ; // @emem Campo di tipo memo
// @doc EXTERNAL
// @enum TIsamop | Comandi per eseguire operazioni di lettura sul file
enum TIsamop {
_isfirst = 0x0, // @emem Legge il primo record del file
_islast = 0x1, // @emem Legge l'ultimo record del file
_isnext= 0x2, // @emem Legge il prossimo record del file
_isprev = 0x4, // @emem Legge il precedente record del file
_iscurr = 0x8, // @emem Legge il record corrente del file (rilettura)
_isequal = 0x10, // @emem Legge il record con chiave uguale a quella specificata
_isgreat = 0x20, // @emem Legge il record con chiave maggiore di quella specificata
_isgteq = 0x40, // @emem Legge il record con chiave maggiore o uguale di quella specificata
_isnextn = 0x100, // @emem Legge i prossimi n record
_isprevn = 0x200} ; // @emem Legge i precedenti n record
// @doc EXTERNAL
// @enum TIsamerr | Elenco codici di errore
enum TIsamerr {
_iseof = 201, // @emem End of file
_isbof = 202, // @emem Begin of file
_isfileovf = 203, // @emem Overflow del file
_iskeynotfound = 204, // @emem Chiave non trovata
_isemptyfile = 205, // @emem File vuoto
_isdupkey = 206, // @emem Chiave duplicata
_isnocurkey = 207, // @emem Non esiste la chiave corrente
_iskeyrangeerr = 211, // @emem Valore errato della chiave
_iskeyerr = 212, // @emem Errore generico della chiave
_iskeylenerr = 214, // @emem Lunghezza della chiave errata
_ispatherr = 216, // @emem File indice non coerente
_ispathfull = 217, // @emem UNUSED
_isnrecerr = 218, // @emem Errore sul numero dei record
_isfilefull = 219, // @emem File o disco pieno
_isnotopen = 220, // @emem File non aperto
_isnotcurr = 221, // @emem Non esiste il record corrente
_isalropen = 222, // @emem File gia' aperto
_isdeadlock = 223, // @emem Condizione di deadlock
_isreinsert = 224, // @emem Chiave duplicata su indici diversi da 1
_islocked = 225} ; // @emem Record bloccato
#endif // __RECTYPES_H

124
servers/hardlock/mainfrm.cpp Executable file
View File

@ -0,0 +1,124 @@
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "FrontEnd.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_UPDATE_COMMAND_UI(ID_NOTEPAD, OnUpdateNotepad)
ON_COMMAND(ID_NOTEPAD, OnNotepad)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFrameWnd::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnUpdateNotepad(CCmdUI* pCmdUI)
{
pCmdUI->Enable(TRUE);
}
extern "C"
{
_declspec(dllimport) int Aga_exec(const char* p);
}
void CMainFrame::OnNotepad()
{
Aga_exec("notepad");
}

45
servers/hardlock/mainfrm.h Executable file
View File

@ -0,0 +1,45 @@
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnUpdateNotepad(CCmdUI* pCmdUI);
afx_msg void OnNotepad();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////

5
servers/hardlock/prawin.ini Executable file
View File

@ -0,0 +1,5 @@
[ODBC]
User = ODBC
Pwd = ODBC
Database = c:\prassi\dati
Connect = FoxPro 2.5

104
servers/hardlock/readme.txt Executable file
View File

@ -0,0 +1,104 @@
========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : FrontEnd
========================================================================
AppWizard has created this FrontEnd application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
This file contains a summary of what you will find in each of the files that
make up your FrontEnd application.
FrontEnd.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CFrontEndApp application class.
FrontEnd.cpp
This is the main application source file that contains the application
class CFrontEndApp.
FrontEnd.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Developer Studio.
res\FrontEnd.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file FrontEnd.rc.
res\FrontEnd.rc2
This file contains resources that are not edited by Microsoft
Developer Studio. You should place all resources not
editable by the resource editor in this file.
FrontEnd.reg
This is an example .REG file that shows you the kind of registration
settings the framework will set for you. You can use this as a .REG
file to go along with your application or just delete it and rely
on the default RegisterShellFileTypes registration.
FrontEnd.clw
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
/////////////////////////////////////////////////////////////////////////////
For the main frame window:
MainFrm.h, MainFrm.cpp
These files contain the frame class CMainFrame, which is derived from
CFrameWnd and controls all SDI frame features.
res\Toolbar.bmp
This bitmap file is used to create tiled images for the toolbar.
The initial toolbar and status bar are constructed in the
CMainFrame class. Edit this toolbar bitmap along with the
array in MainFrm.cpp to add more toolbar buttons.
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one document type and one view:
FrontEndDoc.h, FrontEndDoc.cpp - the document
These files contain your CFrontEndDoc class. Edit these files to
add your special document data and to implement file saving and loading
(via CFrontEndDoc::Serialize).
FrontEndView.h, FrontEndView.cpp - the view of the document
These files contain your CFrontEndView class.
CFrontEndView objects are used to view CFrontEndDoc objects.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named FrontEnd.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Developer Studio reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
If your application uses MFC in a shared DLL, and your application is
in a language other than the operating system's current language, you
will need to copy the corresponding localized resources MFC40XXX.DLL
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
For example, MFC40DEU.DLL contains resources translated to German.) If you
don't do this, some of the UI elements of your application will remain in the
language of the operating system.
/////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,13 @@
//
// FRONTEND.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

31
servers/hardlock/resource.h Executable file
View File

@ -0,0 +1,31 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by FrontEnd.rc
//
#define IDD_ABOUTBOX 100
#define CG_IDS_PHYSICAL_MEM 102
#define CG_IDS_DISK_SPACE 103
#define CG_IDS_DISK_SPACE_UNAVAIL 104
#define IDR_MAINFRAME 128
#define IDR_LOGTYPE 129
#define IDD_FILEDIALOG 131
#define IDD_STATUS 132
#define IDC_PHYSICAL_MEM 1005
#define IDC_DISK_SPACE 1006
#define IDC_USERS 1008
#define stc32 0x045f
#define ID_BUTTON32772 32772
#define ID_VIEW_TRACE 32773
#define ID_NOTEPAD 32775
#define ID_VIEW_STATUS 32776
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 133
#define _APS_NEXT_COMMAND_VALUE 32778
#define _APS_NEXT_CONTROL_VALUE 1009
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif

216
servers/hardlock/server.cpp Executable file
View File

@ -0,0 +1,216 @@
#include "StdAfx.h"
#include "hlapi_c.h"
#define EYECAST (Word DATAFAR_ *)
#include "connect.h"
#include "server.h"
#include "tracing.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// @doc INTERNAL
// @rdesc Ritorna il valore corrispondente alla chiave appartenente
// ad una sezione del file di configurazione
static CString GetIniString(LPCSTR sec, // @parm Sezione
LPCSTR key, // @parm Chiave
LPCSTR def) // @parm Valore di default
{
// Nome del file .ini
static CString m_strIniFile;
// Lunghezza massima di un nome di directory
// o di un valore del file .ini
const DWORD dwSize = _MAX_DIR + 1;
// Costruisce il nome del file .ini se necessario
if (m_strIniFile.IsEmpty())
{
GetCurrentDirectory(dwSize, m_strIniFile.GetBuffer(dwSize));
m_strIniFile.ReleaseBuffer();
m_strIniFile += "\\prawin.ini";
}
// Legge il valore della chiave nella sezione specificata
CString tmp;
char* buf = tmp.GetBuffer(dwSize);
GetPrivateProfileString(sec, key, def, buf, dwSize, m_strIniFile);
tmp.ReleaseBuffer();
return tmp;
}
#define HLBLOCK 1
unsigned short THardlockServer::GetSer()
{
_SerNo = 0xFFFF;
if (HL_AVAIL() == STATUS_OK)
{
Word Val[4] = { 0, 0, 0, 0 };
HL_READ(0, EYECAST &Val[0]);
HL_READ(1, EYECAST &Val[1]);
HL_READ(2, EYECAST &Val[2]);
HL_READ(3, EYECAST &Val[3]);
HL_CODE(EYECAST Val, HLBLOCK);
if (Val[0] == 0xFAE8)
_SerNo = Val[1];
else
_SerNo = 0;
}
Trace(0, "Hardlock serial number is %s: %d",
(_SerNo == 0xFFFF) ? "Bad" : "OK", (int)_SerNo);
return _SerNo;
}
unsigned short THardlockServer::GetUsers()
{
_Users = 0;
if (_SerNo == 0)
_Users = 1;
else
{
if (_SerNo != 0xFFFF)
{
Word Val[4] = { 0, 0, 0, 0 };
HL_READ(60, EYECAST &Val[0]);
HL_READ(61, EYECAST &Val[1]);
HL_READ(62, EYECAST &Val[2]);
HL_READ(63, EYECAST &Val[3]);
HL_CODE(Val, HLBLOCK);
_Users = Val[1];
}
}
Trace(0, "Maximum number of users is %d", (int)_Users);
return _Users;
}
BOOL THardlockServer::GetAut()
{
if (_SerNo == 0xFFFF)
return FALSE;
if (_SerNo == 0)
return TRUE;
HL_READ(48, EYECAST &_int_tab[0]);
HL_READ(49, EYECAST &_int_tab[1]);
HL_READ(50, EYECAST &_int_tab[2]);
HL_READ(51, EYECAST &_int_tab[3]);
HL_CODE(_int_tab, HLBLOCK);
for (int i = 0; i < 4; i++)
_int_tab[i] ^= _SerNo;
if (_int_tab[3])
return(FALSE);
return TRUE;
}
BOOL THardlockServer::Login() const
{
const char* const REFKEY = "CAMPOKEY";
const char* const VERKEY = "ìpÙˆ¬cê<";
unsigned char ref[9]; strcpy((char*)ref, REFKEY);
unsigned char ver[9]; strcpy((char*)ver, VERKEY);
const int status = HL_LOGIN(26952, LOCAL_DEVICE, ref, ver);
Trace(0, "Hardlock login %s: %d",
status == STATUS_OK ? "OK" : "Failed", status);
return status == STATUS_OK;
}
void THardlockServer::Logout() const
{
HL_LOGOUT();
}
BOOL THardlockServer::OnConnect(const CString& topic)
{
BOOL ok = Connections() <= MaxUsers();
if (!ok)
Trace(0, "Refusing Topic %s", (const char*)topic);
return ok;
}
TConnection* THardlockServer::OnCreateConnection(DWORD id)
{
TConnection* c = NULL;
if (Connections() <= MaxUsers())
{
Trace(0, "Connecting %lu", id);
c = new TPrassiConnection(this, id);
}
else
Trace(0, "Refusing Connection %lu", id);
return c;
}
BOOL THardlockServer::OnRemoveConnection(DWORD id)
{
Trace(0, "Disconnecting %lu", id);
return BASE_SERVER::OnRemoveConnection(id);
}
THardlockServer::THardlockServer()
: BASE_SERVER("HARDLOCK")
{
_SerNo = 0xFFFF;
_int_tab[0] = 0xFFFF;
_int_tab[1] = 0xFFFF;
_int_tab[2] = 0xFFFF;
_int_tab[3] = 0x0000;
Login();
GetSer();
GetUsers();
}
THardlockServer::~THardlockServer()
{
Logout();
}
///////////////////////////////////////////////////////////
// Start/Stop server
static THardlockServer* pDDE = NULL;
BOOL StopServer()
{
BOOL ok = pDDE != NULL;
if (ok)
{
delete pDDE;
pDDE = NULL;
}
return ok;
}
THardlockServer& GetServer()
{
ASSERT(pDDE);
return *pDDE;
}
BOOL StartServer()
{
BOOL ok = pDDE == NULL;
if (ok)
pDDE = new THardlockServer;
return ok;
}

54
servers/hardlock/server.h Executable file
View File

@ -0,0 +1,54 @@
#ifndef __SERVER_H__
#define __SERVER_H__
/*
#ifndef __NETDDE_H__
#include "netdde.h"
#define BASE_SERVER TDDEServer
#endif
*/
#ifndef __NETSOCK_H__
#include "NetSock.h"
#define BASE_SERVER TSocketServer
#endif
/////////////////////////////////////////////////////////////////////////////
// THardlockServer
class THardlockServer : public BASE_SERVER
{
enum { MAX_MODULES = 48 };
unsigned short _SerNo, _Users, _int_tab[4];
protected:
virtual BOOL OnConnect(const CString& topic);
virtual TConnection* OnCreateConnection(DWORD id);
virtual BOOL OnRemoveConnection(DWORD id);
BOOL Login() const;
void Logout() const;
unsigned short GetSer();
unsigned short GetUsers();
BOOL GetAut();
public:
unsigned short SerialNumber() const
{ return _SerNo; }
const unsigned short* Authorizations()
{ return GetAut() ? _int_tab : NULL; }
unsigned short MaxUsers() const
{ return _Users; }
THardlockServer();
virtual ~THardlockServer();
};
BOOL StartServer();
THardlockServer& GetServer();
BOOL StopServer();
#endif

114
servers/hardlock/sqlfile.h Executable file
View File

@ -0,0 +1,114 @@
#ifndef __SQLFILE_H__
#define __SQLFILE_H__
class TSqlRecord : public CObject
{
CMap<SHORT,SHORT,CString,CString&> m_Fields;
public:
CString Get(SHORT index) const;
void Clear();
int Set(SHORT nIndex, const char* val, DWORD dwSize = 0);
void SetRecord(CdbRecordset& dbRecordset);
BOOL IsEmpty() const { return m_Fields.GetCount() == 0; }
TSqlRecord();
virtual ~TSqlRecord();
};
class TSqlFile : public CObject
{
int m_nFirm;
int m_nLogicNumber;
CString m_strWhere;
DWORD m_dwConnection;
int m_nKey;
COleVariant m_oleVariant;
BOOL m_bExists;
DWORD m_dwSnapHandle;
int m_nItems;
int m_nStatus;
TSqlRecord m_sqlRecord;
CMapStringToPtr m_Locks;
BOOL m_bExclusiveLock;
protected:
int TestOpen() const;
BOOL Requery();
CdbTableDef GetTableDef() const;
CdbRecordset& GetDynaset() const;
CdbRecordset& GetSnapshot();
void CloseSnapshot();
const char* VariantToString(const COleVariant& oleVariant) const;
const char* GetField(CdbRecordset& dbRecordset, const char* strName);
CString BuildKey(CdbRecordset& dbRecordset, int nKey);
CString BuildKey(const TSqlRecord& sqlRecord, int nKey);
int Read(CdbRecordset& dbSnapshot, const char* sKey, int flags);
int Lock(CdbRecordset& dbSnapshot);
int Unlock(LPCSTR sKey);
int Unlock(CdbRecordset& dbDynaset);
void UnlockAll();
int HandleLock(CdbRecordset& dbRecordset, int nLock);
public:
int LogicNumber() const { return m_nLogicNumber; }
BOOL IsOpen() const;
int Open();
int Close();
int First(int nLock);
int Prev(int nLock);
int Next(int nLock);
int Last(int nLock);
int Move(long pos, int nLock);
int Skip(long pos, int nLock);
long GetPosition();
int Read(const char* sKey, int flags);
int Remove(const char* sKey);
int Rewrite(const char* sKey);
int Write();
int ExclusiveLock();
int ExclusiveUnlock();
const char* GetField(const char* strName);
CString GetFieldInfo(int index) const;
int GetRecordCount();
int SetKey(int key);
int GetKey() const;
CString GetKeyExpr(int key) const;
int ClearFields();
int SetField(int index, const char* value);
int SetField(const char* name, const char* value);
BOOL Exists() const
{ return m_bExists; }
BOOL SetFirm(int nFirm);
TSqlFile(int nFirm, int nLogicNumber,
LPCSTR sWhere, DWORD dwConnection);
virtual ~TSqlFile();
};
#endif

43
servers/hardlock/statdlg.cpp Executable file
View File

@ -0,0 +1,43 @@
// StatDlg.cpp : implementation file
//
#include "stdafx.h"
#include "FrontEnd.h"
#include "StatDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStatusDlg dialog
CStatusDlg::CStatusDlg(CWnd* pParent /*=NULL*/)
: CDialog(CStatusDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CStatusDlg)
m_nUsers = 0;
//}}AFX_DATA_INIT
}
void CStatusDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStatusDlg)
DDX_Text(pDX, IDC_USERS, m_nUsers);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStatusDlg, CDialog)
//{{AFX_MSG_MAP(CStatusDlg)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStatusDlg message handlers

35
servers/hardlock/statdlg.h Executable file
View File

@ -0,0 +1,35 @@
// StatDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CStatusDlg dialog
class CStatusDlg : public CDialog
{
// Construction
public:
CStatusDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CStatusDlg)
enum { IDD = IDD_STATUS };
UINT m_nUsers;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CStatusDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CStatusDlg)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

6
servers/hardlock/stdafx.cpp Executable file
View File

@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// FrontEnd.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

43
servers/hardlock/tracing.cpp Executable file
View File

@ -0,0 +1,43 @@
#include "StdAfx.h"
#include "Tracing.h"
static int _trace_level = -1;
void SetTracingLevel(int l)
{
_trace_level = l;
}
void EnableTracing(BOOL on)
{
SetTracingLevel(on ? 0xFFFF : -1);
}
BOOL TracingEnabled()
{
return _trace_level >= 0;
}
BOOL Trace(int level, const char* fmt, ...)
{
if (level > _trace_level)
return FALSE;
CFrameWnd* pFrame = (CFrameWnd*)AfxGetMainWnd();
ASSERT(pFrame);
CTreeView* pTreeView = (CTreeView*)pFrame->GetActiveView();
ASSERT(pTreeView);
CTreeCtrl& pTreeCtrl = pTreeView->GetTreeCtrl();
char msg[256];
va_list argptr;
va_start(argptr,fmt);
vsprintf(msg,fmt,argptr);
va_end(argptr);
HTREEITEM hItem = pTreeCtrl.InsertItem(msg, 0, 0);
BOOL ok = hItem != NULL;
return ok;
}

10
servers/hardlock/tracing.h Executable file
View File

@ -0,0 +1,10 @@
#ifndef __TRACING_H__
#define __TRACING_H__
void SetTracingLevel(int l);
void EnableTracing(BOOL on);
BOOL TracingEnabled();
BOOL Trace(int l, const char* fmt, ...);
#endif

134
servers/odbc/connect.cpp Executable file
View File

@ -0,0 +1,134 @@
#include "StdAfx.h"
#include "connect.h"
#include "tracing.h"
///////////////////////////////////////////////////////////
// TPrassiConnection
TPrassiConnection::TPrassiConnection(TLanManager* lm, DWORD id)
: TConnection(lm, id), m_nFirm(0)
{
}
TPrassiConnection::~TPrassiConnection()
{
for (POSITION pos = m_sqlFiles.GetStartPosition(); pos; )
{
long nHandle;
TSqlFile* pFile;
m_sqlFiles.GetNextAssoc(pos, nHandle, pFile);
delete pFile;
}
m_sqlFiles.RemoveAll();
}
BOOL TPrassiConnection::Trace(int level, const char* str) const
{
if (level <= 0 || TracingEnabled())
{
LPCSTR user = User();
CString trc;
trc.Format("%-8s %s", user, str);
return ::Trace(level, trc);
}
return FALSE;
}
struct TFunctionName
{
const char* name;
ConnectionFunction pFunc;
int level;
};
const int MAX_FUNC = 33;
static TFunctionName ftable[MAX_FUNC] =
{
{ "DongleHasModule", f_DongleHasModule, 2 },
{ "DongleModules", f_DongleModules, 2 },
{ "DongleNumber", f_DongleNumber, 2 },
{ "FileClearFields", f_FileClearFields, 2 },
{ "FileClose", f_FileClose, 1 },
{ "FileFirst", f_FileFirst, 1 },
{ "FileGetField", f_FileGetField, 1 },
{ "FileGetFieldInfo", f_FileGetFieldInfo, 2 },
{ "FileGetItems", f_FileGetItems, 1 },
{ "FileGetKey", f_FileGetKey, 1 },
{ "FileGetKeyExpr", f_FileGetKeyExpr, 2 },
{ "FileGetPosition", f_FileGetPosition, 1 },
{ "FileLast", f_FileLast, 1 },
{ "FileLock", f_FileLock, 1 },
{ "FileMove", f_FileMove, 1 },
{ "FileNext", f_FileNext, 1 },
{ "FileOpen", f_FileOpen, 1 },
{ "FileOpenTable", f_FileOpenTable, 1 },
{ "FilePrev", f_FilePrev, 1 },
{ "FileRead", f_FileRead, 1 },
{ "FileRemove", f_FileRemove, 1 },
{ "FileRewrite", f_FileRewrite, 1 },
{ "FileSetField", f_FileSetField, 1 },
{ "FileSetKey", f_FileSetKey, 1 },
{ "FileSkip", f_FileSkip, 1 },
{ "FileUnlock", f_FileUnlock, 1 },
{ "FileWrite", f_FileWrite, 1 },
{ "FirmGet", f_FirmGet, 2 },
{ "FirmSet", f_FirmSet, 1 },
{ "FirmTest", f_FirmTest, 2 },
{ "FtpGetFile", f_FtpGetFile, 2 },
{ "UserLogin", f_UserLogin, 0 },
{ "UserLogout", f_UserLogout, 0 },
};
BOOL TPrassiConnection::Request(const char* str)
{
CStringArray argv;
BOOL ok = ParseCommand(str, argv) > 0;
if (ok)
{
const CString cmd = argv[0];
int fmin = 0;
int fmax = MAX_FUNC-1;
ok = FALSE;
int cmp = 0;
while (fmin <= fmax)
{
const int fcur = (fmax + fmin) / 2;
const TFunctionName& fn = ftable[fcur];
cmp = cmd.CompareNoCase(fn.name);
if (cmp == 0)
{
Trace(fn.level, str);
const clock_t tempo = clock();
ok = fn.pFunc(*this, &argv);
if (TracingEnabled())
{
const double time = double(clock() - tempo) / CLOCKS_PER_SEC;
if (time > 0.05)
{
CString str;
str.Format("Time: %.2lf s", time);
Trace(fn.level, str);
}
}
break;
}
if (cmp < 0)
fmax = fcur-1;
else
fmin = fcur+1;
}
if (cmp)
{
CString strError = "ERROR: ";
strError += str;
Trace(-1, strError);
}
}
return ok;
}

88
servers/odbc/connect.h Executable file
View File

@ -0,0 +1,88 @@
#ifndef __CONNECT_H__
#define __CONNECT_H__
#ifndef __NETUTILS_H__
#include "NetUtils.h"
#endif
#ifndef __SQLFILE_H__
#include "sqlfile.h"
#endif
/////////////////////////////////////////////////////////////////////////////
// PrassiConnection
class TPrassiConnection : public TConnection
{
CString m_strUser;
CString m_strApp;
int m_nFirm;
CMap<long, long, TSqlFile*, TSqlFile*> m_sqlFiles;
protected:
BOOL Trace(int level, const char* str) const;
public:
virtual BOOL Request(const char* cmd);
virtual BOOL Execute(const char* cmd) { return Request(cmd); }
long OpenFile(int nLogicNum, LPCSTR sWhere);
TSqlFile* GetFile(long nHandle);
BOOL CloseFile(long nHandle);
public:
BOOL DoUserLogin(const CString& user, const CString& pwd, const CString& app);
BOOL DoUserLogout();
public:
int GetFirm() const { return m_nFirm; }
BOOL SetFirm(int nFirm);
const CString& User() const { return m_strUser; }
TPrassiConnection(TLanManager* lm, DWORD id);
virtual ~TPrassiConnection();
};
int f_DongleHasModule (TConnection& conn, void* pJolly);
int f_DongleModules (TConnection& conn, void* pJolly);
int f_DongleNumber (TConnection& conn, void* pJolly);
int f_FileClearFields (TConnection& conn, void* pJolly);
int f_FileClose (TConnection& conn, void* pJolly);
int f_FileFirst (TConnection& conn, void* pJolly);
int f_FileGetField (TConnection& conn, void* pJolly);
int f_FileGetFieldInfo (TConnection& conn, void* pJolly);
int f_FileGetItems (TConnection& conn, void* pJolly);
int f_FileGetKey (TConnection& conn, void* pJolly);
int f_FileGetKeyExpr (TConnection& conn, void* pJolly);
int f_FileGetPosition (TConnection& conn, void* pJolly);
int f_FileLast (TConnection& conn, void* pJolly);
int f_FileLock (TConnection& conn, void* pJolly);
int f_FileMove (TConnection& conn, void* pJolly);
int f_FileNext (TConnection& conn, void* pJolly);
int f_FileOpen (TConnection& conn, void* pJolly);
int f_FileOpenTable (TConnection& conn, void* pJolly);
int f_FilePrev (TConnection& conn, void* pJolly);
int f_FileRead (TConnection& conn, void* pJolly);
int f_FileRemove (TConnection& conn, void* pJolly);
int f_FileRewrite (TConnection& conn, void* pJolly);
int f_FileSetField (TConnection& conn, void* pJolly);
int f_FileSetKey (TConnection& conn, void* pJolly);
int f_FileSkip (TConnection& conn, void* pJolly);
int f_FileUnlock (TConnection& conn, void* pJolly);
int f_FileWrite (TConnection& conn, void* pJolly);
int f_FirmGet (TConnection& conn, void* pJolly);
int f_FirmSet (TConnection& conn, void* pJolly);
int f_FirmTest (TConnection& conn, void* pJolly);
int f_FtpGetFile (TConnection& conn, void* pJolly);
int f_UserLogin (TConnection& conn, void* pJolly);
int f_UserLogout (TConnection& conn, void* pJolly);
#endif

41
servers/odbc/connectd.cpp Executable file
View File

@ -0,0 +1,41 @@
#include "StdAfx.h"
#include "connect.h"
#include "server.h"
int f_DongleHasModule(TConnection& conn, void* pJolly)
{
BOOL ok = FALSE;
CStringArray& argv = *(CStringArray*)pJolly;
const int argc = argv.GetSize();
if (argc > 0)
{
const int n = atoi(argv[0]) - 1;
if (n >= 0)
{
const WORD* int_tab = GetServer().DongleAuthorizations();
if (int_tab)
ok = (int_tab[n / 16] >> (n % 16)) & 0x1;
}
else
ok = TRUE;
}
return conn.ReturnBool(ok);
}
int f_DongleModules(TConnection& conn, void* pJolly)
{
const WORD* int_tab = GetServer().DongleAuthorizations();
if (int_tab)
{
BYTE* buff = GetServer().GetBuffer(8);
memcpy(buff, int_tab, 8);
}
return int_tab != NULL;
}
int f_DongleNumber(TConnection& conn, void* pJolly)
{
int serno = GetServer().DongleSerialNumber();
return conn.ReturnInteger(serno);
}

572
servers/odbc/connectf.cpp Executable file
View File

@ -0,0 +1,572 @@
#include "StdAfx.h"
#include "connect.h"
#include "server.h"
#include "sqlfile.h"
long TPrassiConnection::OpenFile(int nLogicNum, LPCSTR sWhere)
{
TSqlFile* pSqlFile;
long nHandle = nLogicNum*1000;
for ( ; m_sqlFiles.Lookup(nHandle, pSqlFile); nHandle++);
pSqlFile = new TSqlFile(m_nFirm, nLogicNum, sWhere, Id());
if (pSqlFile->Open() == 0)
m_sqlFiles.SetAt(nHandle, pSqlFile);
else
{
delete pSqlFile;
nHandle = 0;
}
return nHandle;
}
TSqlFile* TPrassiConnection::GetFile(long nHandle)
{
TSqlFile* pSqlFile = NULL;
m_sqlFiles.Lookup(nHandle, pSqlFile);
if (pSqlFile == NULL && nHandle < 1000)
{
int nLogicNum = nHandle;
pSqlFile = new TSqlFile(m_nFirm, nLogicNum, NULL, Id());
if (pSqlFile->Exists())
m_sqlFiles.SetAt(nLogicNum, pSqlFile);
else
{
delete pSqlFile;
pSqlFile = NULL;
}
}
return pSqlFile;
}
BOOL TPrassiConnection::CloseFile(long nHandle)
{
TSqlFile* pSqlFile = GetFile(nHandle);
if (pSqlFile)
{
delete pSqlFile;
m_sqlFiles.RemoveKey(nHandle);
}
return pSqlFile != NULL;
}
BOOL TPrassiConnection::SetFirm(int nFirm)
{
BOOL bOk = m_nFirm == nFirm;
if (!bOk)
{
TPrassiServer& s = GetServer();
bOk = s.TestFirm(nFirm);
if (bOk)
{
long nHandle;
TSqlFile* pSqlFile;
for (POSITION pos = m_sqlFiles.GetStartPosition(); pos; )
{
m_sqlFiles.GetNextAssoc(pos, nHandle, pSqlFile);
pSqlFile->SetFirm(nFirm);
}
}
}
return bOk;
}
///////////////////////////////////////////////////////////
// Jolly2File
static TSqlFile* Jolly2File(TConnection& conn, void *pJolly)
{
TSqlFile* pFile = NULL;
const CStringArray& argv = *(CStringArray*)pJolly;
if (argv.GetSize() > 1)
{
TPrassiConnection& c = (TPrassiConnection&)conn;
const long n = atol(argv[1]);
pFile = c.GetFile(n);
}
return pFile;
}
static TSqlFile* Jolly2FileInt(TConnection& conn, void *pJolly, int& num)
{
TSqlFile* pFile = NULL;
const CStringArray& argv = *(CStringArray*)pJolly;
if (argv.GetSize() > 2)
{
pFile = Jolly2File(conn, pJolly);
num = atoi(argv[2]);
}
return pFile;
}
static TSqlFile* Jolly2FileIntInt(TConnection& conn, void *pJolly, int& num, int& flag)
{
TSqlFile* pFile = NULL;
const CStringArray& argv = *(CStringArray*)pJolly;
if (argv.GetSize() > 3)
{
pFile = Jolly2File(conn, pJolly);
num = atoi(argv[2]);
flag = atoi(argv[3]);
}
return pFile;
}
static TSqlFile* Jolly2FileString(TConnection& conn, void *pJolly, CString& str)
{
TSqlFile* pFile = NULL;
const CStringArray& argv = *(CStringArray*)pJolly;
if (argv.GetSize() > 2)
{
pFile = Jolly2File(conn, pJolly);
str = argv[2];
}
return pFile;
}
static TSqlFile* Jolly2FileStringInt(TConnection& conn, void *pJolly, CString& str, int& num)
{
TSqlFile* pFile = NULL;
const CStringArray& argv = *(CStringArray*)pJolly;
if (argv.GetSize() > 3)
{
pFile = Jolly2File(conn, pJolly);
str = argv[2];
num = atoi(argv[3]);
}
return pFile;
}
static TSqlFile* Jolly2FileStringString(TConnection& conn, void *pJolly, CString& str, CString& val)
{
TSqlFile* pFile = NULL;
const CStringArray& argv = *(CStringArray*)pJolly;
if (argv.GetSize() > 3)
{
pFile = Jolly2File(conn, pJolly);
str = argv[2];
val = argv[3];
}
return pFile;
}
static int Jolly2Int(void *pJolly)
{
const CStringArray& argv = *(CStringArray*)pJolly;
int n = 0;
if (argv.GetSize() > 1)
n = atoi(argv[1]);
return n;
}
static CString Jolly2String(void *pJolly)
{
const CStringArray& argv = *(CStringArray*)pJolly;
CString str;
if (argv.GetSize() > 1)
str = argv[1];
return str;
}
///////////////////////////////////////////////////////////
// int FileClearFields(int nHandle)
BOOL f_FileClearFields(TConnection& conn, void* pJolly)
{
TSqlFile* pFile = Jolly2File(conn, pJolly);
if (pFile)
return conn.ReturnInteger(pFile->ClearFields());
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileClose(int nHandle)
BOOL f_FileClose(TConnection& conn, void* pJolly)
{
const CStringArray& argv = *(CStringArray*)pJolly;
if (argv.GetSize() > 1)
{
TPrassiConnection& c = (TPrassiConnection&)conn;
long nHandle = atol(argv[1]);
TSqlFile* pFile = c.GetFile(nHandle);
if (pFile)
{
int err = pFile->Close();
if (err == 0)
c.CloseFile(nHandle);
return conn.ReturnInteger(err);
}
}
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileFirst(int nHandle)
int f_FileFirst(TConnection& conn, void* pJolly)
{
int nLocks;
TSqlFile* pFile = Jolly2FileInt(conn, pJolly, nLocks);
if (pFile)
return conn.ReturnInteger(pFile->First(nLocks));
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileGetField(int nHandle, CString strName)
BOOL f_FileGetField(TConnection& conn, void* pJolly)
{
CString strName;
TSqlFile* pFile = Jolly2FileString(conn, pJolly, strName);
if (pFile)
{
const char* str = pFile->GetField(strName);
if (str)
return conn.ReturnString(str);
}
return FALSE;
}
///////////////////////////////////////////////////////////
// CString FileGetFieldInfo(int nLogicNum, int nIndex)
BOOL f_FileGetFieldInfo(TConnection& conn, void* pJolly)
{
int nIndex;
TSqlFile* pFile = Jolly2FileInt(conn, pJolly, nIndex);
if (pFile)
{
CString strInfo = pFile->GetFieldInfo(nIndex);
return conn.ReturnString(strInfo);
}
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileGetItems(long nHandle)
BOOL f_FileGetItems(TConnection& conn, void* pJolly)
{
TSqlFile* pFile = Jolly2File(conn, pJolly);
if (pFile)
{
int items = pFile->GetRecordCount();
if (items >= 0)
return conn.ReturnInteger(items);
}
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileGetKey(int nHandle)
BOOL f_FileGetKey(TConnection& conn, void* pJolly)
{
TSqlFile* pFile = Jolly2File(conn, pJolly);
if (pFile)
{
int key = pFile->GetKey();
if (key > 0)
return conn.ReturnInteger(key);
}
return FALSE;
}
///////////////////////////////////////////////////////////
// CString FileGetKeyExpr(int nLogicNum)
BOOL f_FileGetKeyExpr(TConnection& conn, void* pJolly)
{
int key;
TSqlFile* pFile = Jolly2FileInt(conn, pJolly, key);
if (pFile)
return conn.ReturnString(pFile->GetKeyExpr(key));
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileGetPosition(int nHandle)
BOOL f_FileGetPosition(TConnection& conn, void* pJolly)
{
TSqlFile* pFile = Jolly2File(conn, pJolly);
if (pFile)
return conn.ReturnInteger(pFile->GetPosition());
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileLast(int nHandle, int nLock)
BOOL f_FileLast(TConnection& conn, void* pJolly)
{
int nLocks;
TSqlFile* pFile = Jolly2FileInt(conn, pJolly, nLocks);
if (pFile)
return conn.ReturnInteger(pFile->Last(nLocks));
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileLock(int nHandle)
BOOL f_FileLock(TConnection& conn, void* pJolly)
{
TSqlFile* pFile = Jolly2File(conn, pJolly);
if (pFile)
return conn.ReturnInteger(pFile->ExclusiveLock());
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileMove(int nHandle, int pos)
BOOL f_FileMove(TConnection& conn, void* pJolly)
{
int nPos, nLocks;
TSqlFile* pFile = Jolly2FileIntInt(conn, pJolly, nPos, nLocks);
if (pFile)
return conn.ReturnInteger(pFile->Move(nPos, nLocks));
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileNext(int nHandle)
BOOL f_FileNext(TConnection& conn, void* pJolly)
{
int nLocks;
TSqlFile* pFile = Jolly2FileInt(conn, pJolly, nLocks);
if (pFile)
return conn.ReturnInteger(pFile->Next(nLocks));
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileOpen(int nLogicNum)
BOOL f_FileOpen(TConnection& conn, void* pJolly)
{
const CStringArray& argv = *(CStringArray*)pJolly;
if (argv.GetSize() > 1)
{
TPrassiConnection& c = (TPrassiConnection&)conn;
int nLogicNum = atoi(argv[1]);
LPCSTR sWhere = NULL;
if (argv.GetSize() > 2)
sWhere = argv[2];
long nHandle = c.OpenFile(nLogicNum, sWhere);
if (nHandle)
return c.ReturnInteger(nHandle);
}
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileOpenTable(const char* str)
BOOL f_FileOpenTable(TConnection& conn, void* pJolly)
{
const CStringArray& argv = *(CStringArray*)pJolly;
if (argv.GetSize() > 1)
{
TPrassiConnection& c = (TPrassiConnection&)conn;
const char* tab = argv[1];
int nLogicNum = 5;
if (!isalnum(*tab))
{
nLogicNum--;
tab++;
}
CString strWhere;
strWhere.Format("COD='%s'", tab);
if (argv.GetSize() > 2)
{
strWhere += " AND ";
strWhere += argv[2];
}
long nHandle = c.OpenFile(nLogicNum, strWhere);
if (nHandle)
return c.ReturnInteger(nHandle);
}
return FALSE;
}
///////////////////////////////////////////////////////////
// int FilePrev(int nHandle)
BOOL f_FilePrev(TConnection& conn, void* pJolly)
{
int nLocks;
TSqlFile* pFile = Jolly2FileInt(conn, pJolly, nLocks);
if (pFile)
return conn.ReturnInteger(pFile->Prev(nLocks));
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileRead(int nHandle, CString where, int flags)
BOOL f_FileRead(TConnection& conn, void* pJolly)
{
CString fields;
int flags;
TSqlFile* pFile = Jolly2FileStringInt(conn, pJolly, fields, flags);
if (pFile)
return conn.ReturnInteger(pFile->Read(fields, flags));
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileRemove(int nHandle, CString key)
BOOL f_FileRemove(TConnection& conn, void* pJolly)
{
CString key;
TSqlFile* pFile = Jolly2FileString(conn, pJolly, key);
if (pFile)
return conn.ReturnInteger(pFile->Remove(key));
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileRewrite(int nHandle, CString key)
BOOL f_FileRewrite(TConnection& conn, void* pJolly)
{
CString key;
TSqlFile* pFile = Jolly2FileString(conn, pJolly, key);
if (pFile)
return conn.ReturnInteger(pFile->Rewrite(key));
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileSetField(int nHandle, int field, CString value)
// int FileSetField(int nHandle, CString field, CString value)
BOOL f_FileSetField(TConnection& conn, void* pJolly)
{
CString strField;
CString strValue;
TSqlFile* pFile = Jolly2FileStringString(conn, pJolly,
strField, strValue);
if (pFile)
{
const int nIndex = atoi(strField);
int err;
if (nIndex > 0)
err = pFile->SetField(nIndex, strValue);
else
err = pFile->SetField(strField, strValue);
return conn.ReturnInteger(err);
}
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileSetKey(int nHandle, int key)
BOOL f_FileSetKey(TConnection& conn, void* pJolly)
{
int key;
TSqlFile* pFile = Jolly2FileInt(conn, pJolly, key);
if (pFile)
{
int nErr = pFile->SetKey(key);
return conn.ReturnInteger(nErr);
}
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileSkip(int nHandle, int pos)
BOOL f_FileSkip(TConnection& conn, void* pJolly)
{
int nPos, nLocks;
TSqlFile* pFile = Jolly2FileIntInt(conn, pJolly, nPos, nLocks);
if (pFile)
return conn.ReturnInteger(pFile->Skip(nPos, nLocks));
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileUnlock(int nHandle)
BOOL f_FileUnlock(TConnection& conn, void* pJolly)
{
TSqlFile* pFile = Jolly2File(conn, pJolly);
if (pFile)
return conn.ReturnInteger(pFile->ExclusiveUnlock());
return FALSE;
}
///////////////////////////////////////////////////////////
// int FileWrite(int nHandle)
BOOL f_FileWrite(TConnection& conn, void* pJolly)
{
TSqlFile* pFile = Jolly2File(conn, pJolly);
if (pFile)
return conn.ReturnInteger(pFile->Write());
return FALSE;
}
///////////////////////////////////////////////////////////
// int FirmGet()
BOOL f_FirmGet(TConnection& conn, void* pJolly)
{
TPrassiConnection& c = (TPrassiConnection&)conn;
return c.ReturnInteger(c.GetFirm());
}
///////////////////////////////////////////////////////////
// int FirmSet()
BOOL f_FirmSet(TConnection& conn, void* pJolly)
{
int nFirm = Jolly2Int(pJolly);
TPrassiConnection& c = (TPrassiConnection&)conn;
return c.ReturnBool(c.SetFirm(nFirm));
}
///////////////////////////////////////////////////////////
// int FirmTest()
BOOL f_FirmTest(TConnection& conn, void* pJolly)
{
int nFirm = Jolly2Int(pJolly);
TPrassiServer& s = GetServer();
return conn.ReturnBool(s.TestFirm(nFirm));
}
///////////////////////////////////////////////////////////
// void* FtpGetFile(CString)
BOOL f_FtpGetFile(TConnection& conn, void* pJolly)
{
CString filename;
filename = Jolly2String(pJolly);
FILE* f = fopen(filename, "rb");
if (f != NULL)
{
fseek(f, 0, SEEK_END);
DWORD dwSize = ftell(f);
BYTE* pData = conn.Server().GetBuffer(dwSize);
fseek(f, 0, SEEK_SET);
size_t r = fread(pData, dwSize, 1, f);
fclose(f);
}
return f != NULL;
}

4
servers/odbc/connectg.cpp Executable file
View File

@ -0,0 +1,4 @@
#include "StdAfx.h"
#include "connect.h"

67
servers/odbc/connectu.cpp Executable file
View File

@ -0,0 +1,67 @@
#include "StdAfx.h"
#include "connect.h"
int CountUser(TConnection& conn, void* pJolly)
{
const CString& user = *(CString*)pJolly;
const TPrassiConnection& c = (TPrassiConnection&)conn;
return user.CompareNoCase(c.User()) == 0;
}
BOOL TPrassiConnection::DoUserLogin(const CString& user,
const CString& pwd,
const CString& app)
{
BOOL ok = FALSE;
m_strUser = "";
int total = Server().ForEachConnection(CountUser, (void *)&user);
if (app == "ba0100")
{
ok = total == 0 && !pwd.IsEmpty();
}
else
{
ok = TRUE;
}
if (ok)
{
m_strUser = user;
m_strApp = app;
}
return ReturnBool(ok);
}
///////////////////////////////////////////////////////////
// BOOL UserLogin(CString user, CString pwd, CString app)
//
// Esegue il login dell'utente user con password opzionale
int f_UserLogin(TConnection& conn, void* pJolly)
{
CStringArray& argv = *(CStringArray*)pJolly;
const int argc = argv.GetSize();
if (argc > 3)
{
TPrassiConnection& c = (TPrassiConnection&)conn;
return c.DoUserLogin(argv[1], argv[2], argv[3]);
}
return FALSE;
}
///////////////////////////////////////////////////////////
// BOOL UserLogout()
int f_UserLogout(TConnection& conn, void* pJolly)
{
return ((TPrassiConnection&)conn).DoUserLogout();
}
BOOL TPrassiConnection::DoUserLogout()
{
ReturnBool(TRUE);
return TRUE;
}

333
servers/odbc/fastapi.h Executable file
View File

@ -0,0 +1,333 @@
/****************************************************************************/
/** **/
/** Hardlock **/
/** API-Structures and definitions **/
/** **/
/** This file contains some helpful defines to access a Hardlock using **/
/** the application programing interface (API) for Hardlock. **/
/** **/
/** ///FAST Software Security - Group Aladdin **/
/** **/
/** Revision history **/
/** ---------------- **/
/** (related to API version) **/
/** 3.18 -- Define HIGH_DLL changed to HLHIGH_DLL (Watcom 9.5 doesn't **/
/** like my define) **/
/** -- New function call API_GET_TASKID **/
/** -- HLXLOGIN no longer needed. **/
/** -- Add UNIX features (M_UNIX defined) **/
/** -- Add Windows NT feature (WINNT defined) **/
/** 3.19 -- ifdef for Symantec C included (DOS386) **/
/** 3.20 -- ifdef for WIN32s included **/
/** ifdef for Intel Codebuilder removed (compiler to buggy) **/
/** 3.22 -- ifdef for Zortech included **/
/** -- combined OS/2 and DOS include files **/
/** 3.23 -- PortFlags added to API structure. **/
/** 3.24 -- defined CALL_ for 16bit Watcom **/
/** 3.25 -- Different includes merged. **/
/** **/
/** (related to VCS version)
*** $Log: not supported by cvs2svn $
*** Revision 1.5 1996/08/12 16:23:43 henri
*** Added VCS log.
***
**/
/****************************************************************************/
#if !defined(_FASTAPI_H_)
#define _FASTAPI_H_
#ifdef M_UNIX
#define __386__
#pragma pack(1)
#endif
#ifdef LINUX
#define __386__
#pragma pack(1)
#endif
#ifdef __OS2__
#ifdef INTERNAL_16BITDLL
#define LOAD_DS
#else
#ifdef __WATCOMC__
#ifdef __386__ /* not the 16bit compiler */
#include <os2.h>
#endif
#else
#include <os2.h>
#endif
#endif
#ifdef OS_16
#define RET_ Word
#define FAR_ far pascal
#define DATAFAR_ far
#else
#define RET_ APIRET
#define FAR_
#define CALL_ APIENTRY
#define DATAFAR_
#endif
#pragma pack(2)
#endif
#ifdef __GNUC__
#define __386__
#define pascal
#endif
#ifdef __WIN32__
#define __386__
#endif
#ifdef WINNT
#ifndef __386__ /* Watcom doesnt like it */
#define __386__
#endif
#pragma pack(1)
#ifdef DLL
#define CALL_ __stdcall
#else
#define CALL_
#endif
#endif
#ifdef DOS386 /* Symantec C */
#define __386__
#pragma pack(2)
#endif
#ifdef __HIGHC__ /* Metaware High C */
#define __386__
#define _PACKED _Packed
#endif
#ifdef __ZTC__ /* Zortech C */
#define __386__
#endif
#ifdef SALFORD /* Salford C */
#define ALIGN_ 8
#endif
#ifdef __WATCOMC__
#ifndef __386__
#ifndef OS_16
#define CALL_ cdecl
#endif
#endif
#endif
#ifdef _CVI_ /* LabWindows/CVI */
#define RET_ Word
#define FAR_ far
#define CALL_ pascal
#define DATAFAR_ far
#endif
#ifdef __386__
#define DATAFAR_
#define FAR_
#endif
#ifdef HLHIGH_DLL
#define CALL_ pascal _export
#endif
#ifdef LOAD_DS
#define CALL_ _loadds
#endif
#ifndef CALL_
#define CALL_
#endif
#ifndef _PACKED
#define _PACKED
#endif
#ifndef DATAFAR_
#define DATAFAR_ far
#endif
#ifndef FAR_
#define FAR_ far
#endif
#ifndef RET_
#define RET_ Word
#endif
#ifndef ALIGN_
#define ALIGN_
#endif
/* -------------------------------- */
/* Definitions and API structures : */
/* -------------------------------- */
typedef unsigned char Byte;
typedef unsigned short Word;
typedef unsigned long Long;
typedef struct
{
Word Use_Key;
Byte Key[8];
} DES_MODE;
typedef struct
{
Word ModAd; /* Hardlock module address */
Word Reg; /* Memory register adress */
Word Value; /* Memory value */
Byte Reserved[4];
} EYE_MODE;
typedef struct
{
Word LT_Reserved;
Word Reg; /* Memory register adress */
Word Value; /* Memory value */
Word Password[2]; /* Access passwords */
} LT_MODE;
typedef union
{
DES_MODE Des;
EYE_MODE Eye;
LT_MODE Lt;
} HARDWARE;
typedef _PACKED struct ALIGN_ hl_api
{
Byte API_Version_ID[2]; /* Version */
Word API_Options[2]; /* API Optionflags */
Word ModID; /* Modul-ID (EYE = 0...) */
HARDWARE Module; /* Hardware type */
#ifdef __OS2__ /* Pointer to cipher data */
#ifdef OS_16
void far *Data;
#else
#ifdef __BORLANDC__
void FAR16PTR Data;
#else
void * _Seg16 Data;
#endif
#endif
#else
void DATAFAR_ *Data;
#endif
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 (HL-Server) */
Byte ID_Ref[8]; /* Referencestring */
Byte ID_Verify[8]; /* Encrypted ID_Ref */
Long Task_ID; /* Multitasking program ID */
Word MaxUsers; /* Maximum Logins (HL-Server) */
Long Timeout; /* Login Timeout in minutes */
Word ShortLife; /* (multiple use) */
Word Application; /* Application number */
Word Protocol; /* Protocol flags */
Word PM_Host; /* DOS Extender type */
Long OSspecific; /* ptr to OS specific data */
Word PortMask; /* Default local search (in) */
Word PortFlags; /* Default local search (out) */
Word EnvMask; /* Use env string search (in) */
Word EnvFlags; /* Use env string search (out) */
Byte Reserved[174]; /* Reserved area */
} HL_API, LT_API;
#ifdef M_UNIX
#pragma pack()
#endif
#ifdef __OS2__
#pragma pack()
#endif
/* ------------- */
/* Module-ID's : */
/* ------------- */
#define EYE_DONGLE 0 /* Hardlock E-Y-E */
#define DES_DONGLE 1 /* FAST DES */
#define LT_DONGLE 3 /* Hardlock LT */
/* --------------------- */
/* 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 */
#define API_GET_TASKID 32 /* Get TaskID from API */
#define API_LOGIN_INFO 34 /* Get API Login 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_ABORT 51 /* 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 */
/* --------------- */
/* EnvMask flags : */
/* --------------- */
#define IGNORE_ENVIRONMENT 0x8000 /* If set the environment is */
/* not scaned for HL_SEARCH */
/* ------------------ */
/* API PM_Host ID's : */
/* ------------------ */
#define API_XTD_DETECT 0
#define API_XTD_DPMI 1 /* QDPMI, Borland, Windows ... */
#define API_XTD_PHAR386 2
#define API_XTD_PHAR286 3
#define API_XTD_CODEBLDR 4 /* Intel Code Builder */
#define API_XTD_COBOLXM 5
/* ------------------ */
/* 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 HLS_FULL 6 /* HL-Server login table full */
#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 */
#define DOS_ALLOC_ERROR 12 /* Error on memory allocation */
#define CANNOT_OPEN_DRIVER 14 /* Can not open driver (NT,UNIX) */
#define INVALID_ENV 15 /* Invalid environment string */
#define DYNALINK_FAILED 16 /* Unable to get a function entry */
#define TOO_MANY_USERS 256 /* Login table full (remote) */
#define SELECT_DOWN 257 /* Printer not On-line */
#endif /*_FASTAPI_H_*/
/* eof */

98
servers/odbc/frontdoc.cpp Executable file
View File

@ -0,0 +1,98 @@
// FrontEndDoc.cpp : implementation of the CFrontEndDoc class
//
#include "StdAfx.h"
#include "FrontDoc.h"
#include "FrontVw.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFrontEndDoc
IMPLEMENT_DYNCREATE(CFrontEndDoc, CDocument)
BEGIN_MESSAGE_MAP(CFrontEndDoc, CDocument)
//{{AFX_MSG_MAP(CFrontEndDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFrontEndDoc construction/destruction
CFrontEndDoc::CFrontEndDoc()
{
// TODO: add one-time construction code here
}
CFrontEndDoc::~CFrontEndDoc()
{
}
BOOL CFrontEndDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
SetTitle("PRASSI");
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CFrontEndDoc serialization
BOOL CFrontEndDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace)
{
BOOL ok = CDocument::DoSave(lpszPathName, bReplace);
SetTitle("PRASSI");
return ok;
}
void CFrontEndDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
POSITION pos = GetFirstViewPosition();
CFrontEndView* pView = (CFrontEndView*)GetNextView(pos);
CTreeCtrl& pTreeCtrl = pView->GetTreeCtrl();
CString strText;
for (HTREEITEM hItem = pTreeCtrl.GetRootItem();
hItem != NULL;
hItem = pTreeCtrl.GetNextItem(hItem, TVGN_NEXT))
{
strText = pTreeCtrl.GetItemText(hItem);
ar.Write((LPCSTR)strText, strText.GetLength());
ar << char(0x0A);
}
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CFrontEndDoc diagnostics
#ifdef _DEBUG
void CFrontEndDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CFrontEndDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFrontEndDoc commands

45
servers/odbc/frontdoc.h Executable file
View File

@ -0,0 +1,45 @@
// FrontEndDoc.h : interface of the CFrontEndDoc class
//
/////////////////////////////////////////////////////////////////////////////
class CFrontEndDoc : public CDocument
{
protected: // create from serialization only
CFrontEndDoc();
DECLARE_DYNCREATE(CFrontEndDoc)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFrontEndDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CFrontEndDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
virtual BOOL DoSave(LPCTSTR lpszPathName, BOOL bReplace);
// Generated message map functions
protected:
//{{AFX_MSG(CFrontEndDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////

BIN
servers/odbc/frontend.aps Executable file

Binary file not shown.

115
servers/odbc/frontend.clw Executable file
View File

@ -0,0 +1,115 @@
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
LastClass=CAboutDlg
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "FrontEnd.h"
LastPage=0
ClassCount=5
Class1=CFrontEndApp
Class2=CFrontEndDoc
Class3=CFrontEndView
Class4=CMainFrame
ResourceCount=2
Resource1=IDR_MAINFRAME
Class5=CAboutDlg
Resource2=IDD_ABOUTBOX
[CLS:CFrontEndApp]
Type=0
HeaderFile=FrontEnd.h
ImplementationFile=FrontEnd.cpp
Filter=N
LastObject=ID_APP_EXIT
BaseClass=CWinApp
VirtualFilter=AC
[CLS:CFrontEndDoc]
Type=0
HeaderFile=FrontEndDoc.h
ImplementationFile=FrontEndDoc.cpp
Filter=N
[CLS:CFrontEndView]
Type=0
HeaderFile=frontvw.h
ImplementationFile=frontvw.cpp
BaseClass=CTreeView
LastObject=CFrontEndView
Filter=C
VirtualFilter=VWC
[CLS:CMainFrame]
Type=0
HeaderFile=MainFrm.h
ImplementationFile=MainFrm.cpp
Filter=T
BaseClass=CFrameWnd
VirtualFilter=fWC
LastObject=CMainFrame
[CLS:CAboutDlg]
Type=0
HeaderFile=FrontEnd.cpp
ImplementationFile=FrontEnd.cpp
Filter=D
BaseClass=CDialog
VirtualFilter=dWC
LastObject=IDC_GRID1
[DLG:IDD_ABOUTBOX]
Type=1
Class=CAboutDlg
ControlCount=6
Control1=IDC_STATIC,static,1342177283
Control2=IDC_STATIC,static,1342312576
Control3=IDC_DISK_SPACE,static,1342312448
Control4=IDOK,button,1342373889
Control5=IDC_STATIC,static,1342312448
Control6=IDC_PHYSICAL_MEM,static,1342312448
[MNU:IDR_MAINFRAME]
Type=1
Class=CMainFrame
Command1=ID_FILE_SAVE_AS
Command2=ID_APP_EXIT
Command3=ID_EDIT_CLEAR_ALL
Command4=ID_VIEW_TRACE
Command5=ID_VIEW_TOOLBAR
Command6=ID_VIEW_STATUS_BAR
Command7=ID_APP_ABOUT
CommandCount=7
[ACL:IDR_MAINFRAME]
Type=1
Class=CMainFrame
Command1=ID_FILE_NEW
Command2=ID_FILE_OPEN
Command3=ID_FILE_SAVE
Command4=ID_EDIT_UNDO
Command5=ID_EDIT_CUT
Command6=ID_EDIT_COPY
Command7=ID_EDIT_PASTE
Command8=ID_EDIT_UNDO
Command9=ID_EDIT_CUT
Command10=ID_EDIT_COPY
Command11=ID_EDIT_PASTE
Command12=ID_NEXT_PANE
Command13=ID_PREV_PANE
CommandCount=13
[TB:IDR_MAINFRAME]
Type=1
Command1=ID_FILE_SAVE_AS
Command2=ID_VIEW_TRACE
Command3=ID_EDIT_CLEAR_ALL
Command4=ID_APP_EXIT
Command5=ID_APP_ABOUT
CommandCount=5

201
servers/odbc/frontend.cpp Executable file
View File

@ -0,0 +1,201 @@
// FrontEnd.cpp : Defines the class behaviors for the application.
//
#include "StdAfx.h"
#include "FrontEnd.h"
#include "MainFrm.h"
#include "FrontDoc.h"
#include "FrontVw.h"
#include "server.h"
#include <dos.h>
#include <direct.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFrontEndApp
BEGIN_MESSAGE_MAP(CFrontEndApp, CWinApp)
//{{AFX_MSG_MAP(CFrontEndApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_APP_EXIT, OnAppExit)
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFrontEndApp construction
CFrontEndApp::CFrontEndApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CFrontEndApp object
CFrontEndApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CFrontEndApp initialization
BOOL CFrontEndApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
LoadStdProfileSettings(0); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CFrontEndDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CFrontEndView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
BOOL ok = StartServer();
return ok;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
virtual BOOL OnInitDialog();
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CFrontEndApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CFrontEndApp commands
int CFrontEndApp::ExitInstance()
{
StopServer();
return CWinApp::ExitInstance();
}
void CFrontEndApp::OnAppExit()
{
BOOL bCanExit = !GetServer().HasConnections();
if (!bCanExit)
{
int nCode = AfxMessageBox("There are still active connections:\n"
"Do you really want to exit anyway?",
MB_YESNO | MB_ICONQUESTION);
if (nCode == IDYES)
bCanExit = TRUE;
}
if (bCanExit)
CWinApp::OnAppExit();
}
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CString strFreeDiskSpace;
CString strFreeMemory;
CString strFmt;
// Fill available memory
MEMORYSTATUS MemStat;
MemStat.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&MemStat);
strFmt.LoadString(CG_IDS_PHYSICAL_MEM);
strFreeMemory.Format(strFmt, MemStat.dwTotalPhys / 1024L);
SetDlgItemText(IDC_PHYSICAL_MEM, strFreeMemory);
// Fill disk free information
struct _diskfree_t diskfree;
int nDrive = _getdrive(); // use current default drive
if (_getdiskfree(nDrive, &diskfree) == 0)
{
strFmt.LoadString(CG_IDS_DISK_SPACE);
strFreeDiskSpace.Format(strFmt,
(DWORD)diskfree.avail_clusters *
(DWORD)diskfree.sectors_per_cluster *
(DWORD)diskfree.bytes_per_sector / (DWORD)1024L,
nDrive-1 + _T('A'));
}
else
strFreeDiskSpace.LoadString(CG_IDS_DISK_SPACE_UNAVAIL);
SetDlgItemText(IDC_DISK_SPACE, strFreeDiskSpace);
return TRUE;
}

38
servers/odbc/frontend.h Executable file
View File

@ -0,0 +1,38 @@
// FrontEnd.h : main header file for the FRONTEND application
//
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CFrontEndApp:
// See FrontEnd.cpp for the implementation of this class
//
class CFrontEndApp : public CWinApp
{
public:
CFrontEndApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFrontEndApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CFrontEndApp)
afx_msg void OnAppAbout();
afx_msg void OnAppExit();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////

965
servers/odbc/frontend.mak Executable file
View File

@ -0,0 +1,965 @@
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
!IF "$(CFG)" == ""
CFG=FrontEnd - Win32 Debug
!MESSAGE No configuration specified. Defaulting to FrontEnd - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "FrontEnd - Win32 Release" && "$(CFG)" !=\
"FrontEnd - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "FrontEnd.mak" CFG="FrontEnd - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "FrontEnd - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "FrontEnd - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
################################################################################
# Begin Project
# PROP Target_Last_Scanned "FrontEnd - Win32 Debug"
CPP=cl.exe
RSC=rc.exe
MTL=mktyplib.exe
!IF "$(CFG)" == "FrontEnd - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
OUTDIR=.\Release
INTDIR=.\Release
ALL : "$(OUTDIR)\FrontEnd.exe" "$(OUTDIR)\FrontEnd.bsc"
CLEAN :
-@erase ".\Release\FrontEnd.bsc"
-@erase ".\Release\Netdde.sbr"
-@erase ".\Release\FrontEnd.pch"
-@erase ".\Release\NetSock.sbr"
-@erase ".\Release\Connectg.sbr"
-@erase ".\Release\StdAfx.sbr"
-@erase ".\Release\Connectf.sbr"
-@erase ".\Release\Server.sbr"
-@erase ".\Release\MainFrm.sbr"
-@erase ".\Release\Netutils.sbr"
-@erase ".\Release\Sqlfile.sbr"
-@erase ".\Release\Tracing.sbr"
-@erase ".\Release\Frontvw.sbr"
-@erase ".\Release\Connectd.sbr"
-@erase ".\Release\FrontEnd.sbr"
-@erase ".\Release\Connectu.sbr"
-@erase ".\Release\Frontdoc.sbr"
-@erase ".\Release\Connect.sbr"
-@erase ".\Release\FrontEnd.exe"
-@erase ".\Release\Connectu.obj"
-@erase ".\Release\Frontdoc.obj"
-@erase ".\Release\Connect.obj"
-@erase ".\Release\Netdde.obj"
-@erase ".\Release\NetSock.obj"
-@erase ".\Release\Connectg.obj"
-@erase ".\Release\StdAfx.obj"
-@erase ".\Release\Connectf.obj"
-@erase ".\Release\Server.obj"
-@erase ".\Release\MainFrm.obj"
-@erase ".\Release\Netutils.obj"
-@erase ".\Release\Sqlfile.obj"
-@erase ".\Release\Tracing.obj"
-@erase ".\Release\Frontvw.obj"
-@erase ".\Release\Connectd.obj"
-@erase ".\Release\FrontEnd.obj"
-@erase ".\Release\FrontEnd.res"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "c:\u\guy\p.tre\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /c
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "c:\u\guy\p.tre\include" /D "WIN32" /D\
"NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"$(INTDIR)/"\
/Fp"$(INTDIR)/FrontEnd.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/" /c
CPP_OBJS=.\Release/
CPP_SBRS=.\Release/
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
MTL_PROJ=/nologo /D "NDEBUG" /win32
# ADD BASE RSC /l 0x410 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x410 /d "NDEBUG" /d "_AFXDLL"
RSC_PROJ=/l 0x410 /fo"$(INTDIR)/FrontEnd.res" /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/FrontEnd.bsc"
BSC32_SBRS= \
"$(INTDIR)/Netdde.sbr" \
"$(INTDIR)/NetSock.sbr" \
"$(INTDIR)/Connectg.sbr" \
"$(INTDIR)/StdAfx.sbr" \
"$(INTDIR)/Connectf.sbr" \
"$(INTDIR)/Server.sbr" \
"$(INTDIR)/MainFrm.sbr" \
"$(INTDIR)/Netutils.sbr" \
"$(INTDIR)/Sqlfile.sbr" \
"$(INTDIR)/Tracing.sbr" \
"$(INTDIR)/Frontvw.sbr" \
"$(INTDIR)/Connectd.sbr" \
"$(INTDIR)/FrontEnd.sbr" \
"$(INTDIR)/Connectu.sbr" \
"$(INTDIR)/Frontdoc.sbr" \
"$(INTDIR)/Connect.sbr"
"$(OUTDIR)\FrontEnd.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
$(BSC32) @<<
$(BSC32_FLAGS) $(BSC32_SBRS)
<<
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 dbdao3.lib /nologo /subsystem:windows /machine:I386
LINK32_FLAGS=dbdao3.lib /nologo /subsystem:windows /incremental:no\
/pdb:"$(OUTDIR)/FrontEnd.pdb" /machine:I386 /out:"$(OUTDIR)/FrontEnd.exe"
LINK32_OBJS= \
"$(INTDIR)/Connectu.obj" \
"$(INTDIR)/Frontdoc.obj" \
"$(INTDIR)/Connect.obj" \
"$(INTDIR)/Netdde.obj" \
"$(INTDIR)/NetSock.obj" \
"$(INTDIR)/Connectg.obj" \
"$(INTDIR)/StdAfx.obj" \
"$(INTDIR)/Connectf.obj" \
"$(INTDIR)/Server.obj" \
"$(INTDIR)/MainFrm.obj" \
".\Api_3nlm.obj" \
"$(INTDIR)/Netutils.obj" \
"$(INTDIR)/Sqlfile.obj" \
"$(INTDIR)/Tracing.obj" \
"$(INTDIR)/Frontvw.obj" \
".\Hlapi_c.obj" \
".\Nt_call.obj" \
"$(INTDIR)/Connectd.obj" \
"$(INTDIR)/FrontEnd.obj" \
"$(INTDIR)/FrontEnd.res"
"$(OUTDIR)\FrontEnd.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "FrontEnd - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
OUTDIR=.\Debug
INTDIR=.\Debug
ALL : "$(OUTDIR)\FrontEnd.exe" "$(OUTDIR)\FrontEnd.bsc"
CLEAN :
-@erase ".\Debug\vc40.pdb"
-@erase ".\Debug\FrontEnd.pch"
-@erase ".\Debug\vc40.idb"
-@erase ".\Debug\FrontEnd.bsc"
-@erase ".\Debug\Connectd.sbr"
-@erase ".\Debug\Server.sbr"
-@erase ".\Debug\Connectu.sbr"
-@erase ".\Debug\Frontdoc.sbr"
-@erase ".\Debug\Connect.sbr"
-@erase ".\Debug\Connectg.sbr"
-@erase ".\Debug\Connectf.sbr"
-@erase ".\Debug\FrontEnd.sbr"
-@erase ".\Debug\MainFrm.sbr"
-@erase ".\Debug\Netutils.sbr"
-@erase ".\Debug\Sqlfile.sbr"
-@erase ".\Debug\Tracing.sbr"
-@erase ".\Debug\Netdde.sbr"
-@erase ".\Debug\Frontvw.sbr"
-@erase ".\Debug\StdAfx.sbr"
-@erase ".\Debug\NetSock.sbr"
-@erase ".\Debug\FrontEnd.exe"
-@erase ".\Debug\Netdde.obj"
-@erase ".\Debug\Frontvw.obj"
-@erase ".\Debug\StdAfx.obj"
-@erase ".\Debug\NetSock.obj"
-@erase ".\Debug\Connectd.obj"
-@erase ".\Debug\Server.obj"
-@erase ".\Debug\Connectu.obj"
-@erase ".\Debug\Frontdoc.obj"
-@erase ".\Debug\Connect.obj"
-@erase ".\Debug\Connectg.obj"
-@erase ".\Debug\Connectf.obj"
-@erase ".\Debug\FrontEnd.obj"
-@erase ".\Debug\MainFrm.obj"
-@erase ".\Debug\Netutils.obj"
-@erase ".\Debug\Sqlfile.obj"
-@erase ".\Debug\Tracing.obj"
-@erase ".\Debug\FrontEnd.res"
-@erase ".\Debug\FrontEnd.ilk"
-@erase ".\Debug\FrontEnd.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "c:\u\guy\p.tre\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /c
CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "c:\u\guy\p.tre\include" /D\
"WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"$(INTDIR)/"\
/Fp"$(INTDIR)/FrontEnd.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
CPP_OBJS=.\Debug/
CPP_SBRS=.\Debug/
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
MTL_PROJ=/nologo /D "_DEBUG" /win32
# ADD BASE RSC /l 0x410 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x410 /d "_DEBUG" /d "_AFXDLL"
RSC_PROJ=/l 0x410 /fo"$(INTDIR)/FrontEnd.res" /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/FrontEnd.bsc"
BSC32_SBRS= \
"$(INTDIR)/Connectd.sbr" \
"$(INTDIR)/Server.sbr" \
"$(INTDIR)/Connectu.sbr" \
"$(INTDIR)/Frontdoc.sbr" \
"$(INTDIR)/Connect.sbr" \
"$(INTDIR)/Connectg.sbr" \
"$(INTDIR)/Connectf.sbr" \
"$(INTDIR)/FrontEnd.sbr" \
"$(INTDIR)/MainFrm.sbr" \
"$(INTDIR)/Netutils.sbr" \
"$(INTDIR)/Sqlfile.sbr" \
"$(INTDIR)/Tracing.sbr" \
"$(INTDIR)/Netdde.sbr" \
"$(INTDIR)/Frontvw.sbr" \
"$(INTDIR)/StdAfx.sbr" \
"$(INTDIR)/NetSock.sbr"
"$(OUTDIR)\FrontEnd.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
$(BSC32) @<<
$(BSC32_FLAGS) $(BSC32_SBRS)
<<
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 dbdao3d.lib /nologo /subsystem:windows /debug /machine:I386
LINK32_FLAGS=dbdao3d.lib /nologo /subsystem:windows /incremental:yes\
/pdb:"$(OUTDIR)/FrontEnd.pdb" /debug /machine:I386\
/out:"$(OUTDIR)/FrontEnd.exe"
LINK32_OBJS= \
"$(INTDIR)/Netdde.obj" \
"$(INTDIR)/Frontvw.obj" \
"$(INTDIR)/StdAfx.obj" \
"$(INTDIR)/NetSock.obj" \
"$(INTDIR)/Connectd.obj" \
"$(INTDIR)/Server.obj" \
"$(INTDIR)/Connectu.obj" \
"$(INTDIR)/Frontdoc.obj" \
"$(INTDIR)/Connect.obj" \
".\Api_3nlm.obj" \
"$(INTDIR)/Connectg.obj" \
".\Hlapi_c.obj" \
"$(INTDIR)/Connectf.obj" \
"$(INTDIR)/FrontEnd.obj" \
"$(INTDIR)/MainFrm.obj" \
"$(INTDIR)/Netutils.obj" \
".\Nt_call.obj" \
"$(INTDIR)/Sqlfile.obj" \
"$(INTDIR)/Tracing.obj" \
"$(INTDIR)/FrontEnd.res"
"$(OUTDIR)\FrontEnd.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
################################################################################
# Begin Target
# Name "FrontEnd - Win32 Release"
# Name "FrontEnd - Win32 Debug"
!IF "$(CFG)" == "FrontEnd - Win32 Release"
!ELSEIF "$(CFG)" == "FrontEnd - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\ReadMe.txt
!IF "$(CFG)" == "FrontEnd - Win32 Release"
!ELSEIF "$(CFG)" == "FrontEnd - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\FrontEnd.cpp
DEP_CPP_FRONT=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\FrontEnd.h"\
".\MainFrm.h"\
".\Frontdoc.h"\
".\frontvw.h"\
".\Server.h"\
"c:\u\guy\p.tre\include\NetSock.h"\
"c:\u\guy\p.tre\include\NetUtils.h"\
{$(INCLUDE)}"\assoc.h"\
{$(INCLUDE)}"\strings.h"\
{$(INCLUDE)}"\array.h"\
{$(INCLUDE)}"\regexp.h"\
{$(INCLUDE)}"\object.h"\
{$(INCLUDE)}"\classes.h"\
"c:\u\guy\p.tre\include\stdtypes.h"\
{$(INCLUDE)}"\checks.h"\
{$(INCLUDE)}"\Xvt_env.h"\
".\..\..\xvt.450\w16_x86\include\xvt_plat.h"\
{$(INCLUDE)}"\sys\Types.h"\
{$(INCLUDE)}"\sys\Stat.h"\
"$(INTDIR)\FrontEnd.obj" : $(SOURCE) $(DEP_CPP_FRONT) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\FrontEnd.sbr" : $(SOURCE) $(DEP_CPP_FRONT) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\StdAfx.cpp
DEP_CPP_STDAF=\
"c:\u\guy\p.tre\include\stdafx.h"\
!IF "$(CFG)" == "FrontEnd - Win32 Release"
# ADD CPP /Yc"stdafx.h"
BuildCmds= \
$(CPP) /nologo /MD /W3 /GX /O2 /I "c:\u\guy\p.tre\include" /D "WIN32" /D\
"NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"$(INTDIR)/"\
/Fp"$(INTDIR)/FrontEnd.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c $(SOURCE) \
"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
"$(INTDIR)\StdAfx.sbr" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
"$(INTDIR)\FrontEnd.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
!ELSEIF "$(CFG)" == "FrontEnd - Win32 Debug"
# ADD CPP /Yc"stdafx.h"
BuildCmds= \
$(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /I "c:\u\guy\p.tre\include" /D "WIN32"\
/D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"$(INTDIR)/"\
/Fp"$(INTDIR)/FrontEnd.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c\
$(SOURCE) \
"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
"$(INTDIR)\StdAfx.sbr" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
"$(INTDIR)\FrontEnd.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\MainFrm.cpp
!IF "$(CFG)" == "FrontEnd - Win32 Release"
DEP_CPP_MAINF=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\FrontEnd.h"\
".\MainFrm.h"\
NODEP_CPP_MAINF=\
".\m_ofn"\
"$(INTDIR)\MainFrm.obj" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\MainFrm.sbr" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
!ELSEIF "$(CFG)" == "FrontEnd - Win32 Debug"
DEP_CPP_MAINF=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\FrontEnd.h"\
".\MainFrm.h"\
"$(INTDIR)\MainFrm.obj" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\MainFrm.sbr" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\FrontEnd.rc
DEP_RSC_FRONTE=\
".\res\Log.ico"\
".\res\Prassi.ico"\
".\res\Toolbar.bmp"\
".\res\FrontEnd.rc2"\
"$(INTDIR)\FrontEnd.res" : $(SOURCE) $(DEP_RSC_FRONTE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Tracing.cpp
DEP_CPP_TRACI=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\Tracing.h"\
"$(INTDIR)\Tracing.obj" : $(SOURCE) $(DEP_CPP_TRACI) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\Tracing.sbr" : $(SOURCE) $(DEP_CPP_TRACI) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Connectf.cpp
DEP_CPP_CONNE=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\Connect.h"\
".\Server.h"\
".\Sqlfile.h"\
"c:\u\guy\p.tre\include\NetUtils.h"\
{$(INCLUDE)}"\assoc.h"\
{$(INCLUDE)}"\strings.h"\
{$(INCLUDE)}"\array.h"\
{$(INCLUDE)}"\regexp.h"\
{$(INCLUDE)}"\object.h"\
{$(INCLUDE)}"\classes.h"\
"c:\u\guy\p.tre\include\stdtypes.h"\
{$(INCLUDE)}"\checks.h"\
{$(INCLUDE)}"\Xvt_env.h"\
".\..\..\xvt.450\w16_x86\include\xvt_plat.h"\
{$(INCLUDE)}"\sys\Types.h"\
{$(INCLUDE)}"\sys\Stat.h"\
"c:\u\guy\p.tre\include\NetSock.h"\
"$(INTDIR)\Connectf.obj" : $(SOURCE) $(DEP_CPP_CONNE) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\Connectf.sbr" : $(SOURCE) $(DEP_CPP_CONNE) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Connectg.cpp
DEP_CPP_CONNEC=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\Connect.h"\
"c:\u\guy\p.tre\include\NetUtils.h"\
".\Sqlfile.h"\
{$(INCLUDE)}"\assoc.h"\
{$(INCLUDE)}"\strings.h"\
{$(INCLUDE)}"\array.h"\
{$(INCLUDE)}"\regexp.h"\
{$(INCLUDE)}"\object.h"\
{$(INCLUDE)}"\classes.h"\
"c:\u\guy\p.tre\include\stdtypes.h"\
{$(INCLUDE)}"\checks.h"\
{$(INCLUDE)}"\Xvt_env.h"\
".\..\..\xvt.450\w16_x86\include\xvt_plat.h"\
{$(INCLUDE)}"\sys\Types.h"\
{$(INCLUDE)}"\sys\Stat.h"\
"$(INTDIR)\Connectg.obj" : $(SOURCE) $(DEP_CPP_CONNEC) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\Connectg.sbr" : $(SOURCE) $(DEP_CPP_CONNEC) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Connectu.cpp
DEP_CPP_CONNECT=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\Connect.h"\
"c:\u\guy\p.tre\include\NetUtils.h"\
".\Sqlfile.h"\
{$(INCLUDE)}"\assoc.h"\
{$(INCLUDE)}"\strings.h"\
{$(INCLUDE)}"\array.h"\
{$(INCLUDE)}"\regexp.h"\
{$(INCLUDE)}"\object.h"\
{$(INCLUDE)}"\classes.h"\
"c:\u\guy\p.tre\include\stdtypes.h"\
{$(INCLUDE)}"\checks.h"\
{$(INCLUDE)}"\Xvt_env.h"\
".\..\..\xvt.450\w16_x86\include\xvt_plat.h"\
{$(INCLUDE)}"\sys\Types.h"\
{$(INCLUDE)}"\sys\Stat.h"\
"$(INTDIR)\Connectu.obj" : $(SOURCE) $(DEP_CPP_CONNECT) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\Connectu.sbr" : $(SOURCE) $(DEP_CPP_CONNECT) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Frontdoc.cpp
DEP_CPP_FRONTD=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\Frontdoc.h"\
".\frontvw.h"\
"$(INTDIR)\Frontdoc.obj" : $(SOURCE) $(DEP_CPP_FRONTD) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\Frontdoc.sbr" : $(SOURCE) $(DEP_CPP_FRONTD) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Frontvw.cpp
DEP_CPP_FRONTV=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\FrontEnd.h"\
".\Frontdoc.h"\
".\frontvw.h"\
".\Tracing.h"\
"$(INTDIR)\Frontvw.obj" : $(SOURCE) $(DEP_CPP_FRONTV) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\Frontvw.sbr" : $(SOURCE) $(DEP_CPP_FRONTV) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Server.cpp
DEP_CPP_SERVE=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\Iserrors.h"\
".\Connect.h"\
".\Server.h"\
".\Tracing.h"\
".\Hlapi_c.h"\
"c:\u\guy\p.tre\include\NetUtils.h"\
".\Sqlfile.h"\
{$(INCLUDE)}"\assoc.h"\
{$(INCLUDE)}"\strings.h"\
{$(INCLUDE)}"\array.h"\
{$(INCLUDE)}"\regexp.h"\
{$(INCLUDE)}"\object.h"\
{$(INCLUDE)}"\classes.h"\
"c:\u\guy\p.tre\include\stdtypes.h"\
{$(INCLUDE)}"\checks.h"\
{$(INCLUDE)}"\Xvt_env.h"\
".\..\..\xvt.450\w16_x86\include\xvt_plat.h"\
{$(INCLUDE)}"\sys\Types.h"\
{$(INCLUDE)}"\sys\Stat.h"\
"c:\u\guy\p.tre\include\NetSock.h"\
".\Fastapi.h"\
"$(INTDIR)\Server.obj" : $(SOURCE) $(DEP_CPP_SERVE) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\Server.sbr" : $(SOURCE) $(DEP_CPP_SERVE) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Sqlfile.cpp
DEP_CPP_SQLFI=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\Sqlfile.h"\
".\Server.h"\
".\Tracing.h"\
".\Iserrors.h"\
"c:\u\guy\p.tre\include\NetSock.h"\
"c:\u\guy\p.tre\include\NetUtils.h"\
{$(INCLUDE)}"\assoc.h"\
{$(INCLUDE)}"\strings.h"\
{$(INCLUDE)}"\array.h"\
{$(INCLUDE)}"\regexp.h"\
{$(INCLUDE)}"\object.h"\
{$(INCLUDE)}"\classes.h"\
"c:\u\guy\p.tre\include\stdtypes.h"\
{$(INCLUDE)}"\checks.h"\
{$(INCLUDE)}"\Xvt_env.h"\
".\..\..\xvt.450\w16_x86\include\xvt_plat.h"\
{$(INCLUDE)}"\sys\Types.h"\
{$(INCLUDE)}"\sys\Stat.h"\
"$(INTDIR)\Sqlfile.obj" : $(SOURCE) $(DEP_CPP_SQLFI) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\Sqlfile.sbr" : $(SOURCE) $(DEP_CPP_SQLFI) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Connect.cpp
DEP_CPP_CONNECT_=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\Connect.h"\
".\Tracing.h"\
"c:\u\guy\p.tre\include\NetUtils.h"\
".\Sqlfile.h"\
{$(INCLUDE)}"\assoc.h"\
{$(INCLUDE)}"\strings.h"\
{$(INCLUDE)}"\array.h"\
{$(INCLUDE)}"\regexp.h"\
{$(INCLUDE)}"\object.h"\
{$(INCLUDE)}"\classes.h"\
"c:\u\guy\p.tre\include\stdtypes.h"\
{$(INCLUDE)}"\checks.h"\
{$(INCLUDE)}"\Xvt_env.h"\
".\..\..\xvt.450\w16_x86\include\xvt_plat.h"\
{$(INCLUDE)}"\sys\Types.h"\
{$(INCLUDE)}"\sys\Stat.h"\
"$(INTDIR)\Connect.obj" : $(SOURCE) $(DEP_CPP_CONNECT_) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\Connect.sbr" : $(SOURCE) $(DEP_CPP_CONNECT_) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=\U\Guy\P.tre\Include\Netutils.cpp
DEP_CPP_NETUT=\
"c:\u\guy\p.tre\include\stdafx.h"\
"c:\u\guy\p.tre\include\NetUtils.h"\
{$(INCLUDE)}"\assoc.h"\
{$(INCLUDE)}"\strings.h"\
{$(INCLUDE)}"\array.h"\
{$(INCLUDE)}"\regexp.h"\
{$(INCLUDE)}"\object.h"\
{$(INCLUDE)}"\classes.h"\
"c:\u\guy\p.tre\include\stdtypes.h"\
{$(INCLUDE)}"\checks.h"\
{$(INCLUDE)}"\Xvt_env.h"\
".\..\..\xvt.450\w16_x86\include\xvt_plat.h"\
{$(INCLUDE)}"\sys\Types.h"\
{$(INCLUDE)}"\sys\Stat.h"\
BuildCmds= \
$(CPP) $(CPP_PROJ) $(SOURCE) \
"$(INTDIR)\Netutils.obj" : $(SOURCE) $(DEP_CPP_NETUT) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
$(BuildCmds)
"$(INTDIR)\Netutils.sbr" : $(SOURCE) $(DEP_CPP_NETUT) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
$(BuildCmds)
# End Source File
################################################################################
# Begin Source File
SOURCE=\U\Guy\P.tre\Include\Netdde.cpp
DEP_CPP_NETDD=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\..\..\U\Guy\P.tre\Include\Netdde.h"\
"c:\u\guy\p.tre\include\NetUtils.h"\
{$(INCLUDE)}"\assoc.h"\
{$(INCLUDE)}"\strings.h"\
{$(INCLUDE)}"\array.h"\
{$(INCLUDE)}"\regexp.h"\
{$(INCLUDE)}"\object.h"\
{$(INCLUDE)}"\classes.h"\
"c:\u\guy\p.tre\include\stdtypes.h"\
{$(INCLUDE)}"\checks.h"\
{$(INCLUDE)}"\Xvt_env.h"\
".\..\..\xvt.450\w16_x86\include\xvt_plat.h"\
{$(INCLUDE)}"\sys\Types.h"\
{$(INCLUDE)}"\sys\Stat.h"\
BuildCmds= \
$(CPP) $(CPP_PROJ) $(SOURCE) \
"$(INTDIR)\Netdde.obj" : $(SOURCE) $(DEP_CPP_NETDD) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
$(BuildCmds)
"$(INTDIR)\Netdde.sbr" : $(SOURCE) $(DEP_CPP_NETDD) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
$(BuildCmds)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Connectd.cpp
DEP_CPP_CONNECTD=\
"c:\u\guy\p.tre\include\stdafx.h"\
".\Connect.h"\
".\Server.h"\
"c:\u\guy\p.tre\include\NetUtils.h"\
".\Sqlfile.h"\
{$(INCLUDE)}"\assoc.h"\
{$(INCLUDE)}"\strings.h"\
{$(INCLUDE)}"\array.h"\
{$(INCLUDE)}"\regexp.h"\
{$(INCLUDE)}"\object.h"\
{$(INCLUDE)}"\classes.h"\
"c:\u\guy\p.tre\include\stdtypes.h"\
{$(INCLUDE)}"\checks.h"\
{$(INCLUDE)}"\Xvt_env.h"\
".\..\..\xvt.450\w16_x86\include\xvt_plat.h"\
{$(INCLUDE)}"\sys\Types.h"\
{$(INCLUDE)}"\sys\Stat.h"\
"c:\u\guy\p.tre\include\NetSock.h"\
"$(INTDIR)\Connectd.obj" : $(SOURCE) $(DEP_CPP_CONNECTD) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
"$(INTDIR)\Connectd.sbr" : $(SOURCE) $(DEP_CPP_CONNECTD) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=\U\Guy\P.tre\Include\NetSock.cpp
DEP_CPP_NETSO=\
"c:\u\guy\p.tre\include\stdafx.h"\
"c:\u\guy\p.tre\include\NetSock.h"\
".\..\..\U\Guy\P.tre\Include\skstream.h"\
"c:\u\guy\p.tre\include\NetUtils.h"\
{$(INCLUDE)}"\assoc.h"\
{$(INCLUDE)}"\strings.h"\
{$(INCLUDE)}"\array.h"\
{$(INCLUDE)}"\regexp.h"\
{$(INCLUDE)}"\object.h"\
{$(INCLUDE)}"\classes.h"\
"c:\u\guy\p.tre\include\stdtypes.h"\
{$(INCLUDE)}"\checks.h"\
{$(INCLUDE)}"\Xvt_env.h"\
".\..\..\xvt.450\w16_x86\include\xvt_plat.h"\
{$(INCLUDE)}"\sys\Types.h"\
{$(INCLUDE)}"\sys\Stat.h"\
BuildCmds= \
$(CPP) $(CPP_PROJ) $(SOURCE) \
"$(INTDIR)\NetSock.obj" : $(SOURCE) $(DEP_CPP_NETSO) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
$(BuildCmds)
"$(INTDIR)\NetSock.sbr" : $(SOURCE) $(DEP_CPP_NETSO) "$(INTDIR)"\
"$(INTDIR)\FrontEnd.pch"
$(BuildCmds)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Api_3nlm.obj
!IF "$(CFG)" == "FrontEnd - Win32 Release"
!ELSEIF "$(CFG)" == "FrontEnd - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Nt_call.obj
!IF "$(CFG)" == "FrontEnd - Win32 Release"
!ELSEIF "$(CFG)" == "FrontEnd - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Hlapi_c.obj
!IF "$(CFG)" == "FrontEnd - Win32 Release"
!ELSEIF "$(CFG)" == "FrontEnd - Win32 Debug"
!ENDIF
# End Source File
# End Target
# End Project
################################################################################
################################################################################
# Section FrontEnd : {F4392540-0CFE-101B-B22E-00AA0037B2FC}
# 2:5:Class:CGridCtrl
# 2:10:HeaderFile:gridctrl.h
# 2:8:ImplFile:gridctrl.cpp
# End Section
################################################################################
################################################################################
# Section FrontEnd : {A8C3B720-0B5A-101B-B22E-00AA0037B2FC}
# 0:8:Font.cpp:C:\Server\FrontEnd\Font.cpp
# 0:9:Picture.h:C:\Server\FrontEnd\Picture.h
# 0:12:GridCtrl.cpp:C:\Server\FrontEnd\GridCtrl.cpp
# 0:6:Font.h:C:\Server\FrontEnd\Font.h
# 0:10:GridCtrl.h:C:\Server\FrontEnd\GridCtrl.h
# 0:11:Picture.cpp:C:\Server\FrontEnd\Picture.cpp
# 2:21:DefaultSinkHeaderFile:gridctrl.h
# 2:16:DefaultSinkClass:CGridCtrl
# End Section
################################################################################
################################################################################
# Section FrontEnd : {454047B3-B0C9-11D0-B123-008048830FC9}
# 1:17:CG_IDS_DISK_SPACE:103
# 1:19:CG_IDS_PHYSICAL_MEM:102
# 1:25:CG_IDS_DISK_SPACE_UNAVAIL:104
# 2:10:SysInfoKey:1234
# End Section
################################################################################
################################################################################
# Section FrontEnd : {BEF6E003-A874-101A-8BBA-00AA00300CAB}
# 2:5:Class:COleFont
# 2:10:HeaderFile:font.h
# 2:8:ImplFile:font.cpp
# End Section
################################################################################
################################################################################
# Section OLE Controls
# {A8C3B720-0B5A-101B-B22E-00AA0037B2FC}
# End Section
################################################################################
################################################################################
# Section FrontEnd : {7BF80981-BF32-101A-8BBB-00AA00300CAB}
# 2:5:Class:CPicture
# 2:10:HeaderFile:picture.h
# 2:8:ImplFile:picture.cpp
# End Section
################################################################################

BIN
servers/odbc/frontend.mdp Executable file

Binary file not shown.

378
servers/odbc/frontend.rc Executable file
View File

@ -0,0 +1,378 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italian (Italy) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
#ifdef _WIN32
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 16, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif\r\n"
"#include ""res\\FrontEnd.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""l.ita\\afxres.rc"" // Standard components\r\n"
"#endif\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_LOGTYPE ICON DISCARDABLE "res\\Log.ico"
IDR_MAINFRAME ICON DISCARDABLE "res\\Prassi.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
BEGIN
BUTTON ID_FILE_SAVE_AS
SEPARATOR
BUTTON ID_VIEW_TRACE
BUTTON ID_EDIT_CLEAR_ALL
SEPARATOR
BUTTON ID_APP_EXIT
BUTTON ID_APP_ABOUT
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Salva con nome...", ID_FILE_SAVE_AS
MENUITEM SEPARATOR
MENUITEM "&Esci", ID_APP_EXIT
END
POPUP "&Modifica"
BEGIN
MENUITEM "&Cancella tutto", ID_EDIT_CLEAR_ALL
END
POPUP "&Visualizza"
BEGIN
MENUITEM "&Trace", ID_VIEW_TRACE
MENUITEM SEPARATOR
MENUITEM "Barra degli st&rumenti", ID_VIEW_TOOLBAR
MENUITEM "Barra di st&ato", ID_VIEW_STATUS_BAR
END
POPUP "&?"
BEGIN
MENUITEM "Infor&mazioni su FrontEnd...", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
"N", ID_FILE_NEW, VIRTKEY, CONTROL
"A", ID_FILE_OPEN, VIRTKEY, CONTROL
"S", ID_FILE_SAVE, VIRTKEY, CONTROL
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL
"X", ID_EDIT_CUT, VIRTKEY, CONTROL
"C", ID_EDIT_COPY, VIRTKEY, CONTROL
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT
VK_F6, ID_NEXT_PANE, VIRTKEY
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 70
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Server PRASSI"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,7,7,21,20
LTEXT "Server Versione 1.0",IDC_STATIC,49,7,119,10,SS_NOPREFIX |
SS_SUNKEN
LTEXT "Disk space",IDC_DISK_SPACE,49,54,119,9,SS_SUNKEN
DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP
LTEXT "Copyright © 1997",IDC_STATIC,49,23,119,9,SS_SUNKEN
LTEXT "Physical memory",IDC_PHYSICAL_MEM,49,38,119,9,SS_SUNKEN
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "FRONTEND Applicazione MFC\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "FRONTEND\0"
VALUE "LegalCopyright", "Copyright © 1997\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "FRONTEND.EXE\0"
VALUE "ProductName", "FRONTEND Applicazione\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 210
TOPMARGIN, 7
BOTTOMMARGIN, 63
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "FrontEnd\n\nLog\nLog Files (*.log)\n.LOG\nLog\nLog File"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
AFX_IDS_APP_TITLE "FrontEnd"
AFX_IDS_IDLEMESSAGE "Pronto"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_INDICATOR_EXT "EST"
ID_INDICATOR_CAPS "MA"
ID_INDICATOR_NUM "NUM"
ID_INDICATOR_SCRL "BS"
ID_INDICATOR_OVR "SSC"
ID_INDICATOR_REC "REG"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_NEW "Crea un nuovo documento\nNuovo"
ID_FILE_OPEN "Apre un documento esistente\nApri"
ID_FILE_CLOSE "Chiude il documento attivo\nChiudi"
ID_FILE_SAVE "Salva il documento attivo\nSalva"
ID_FILE_SAVE_AS "Salva il documento attivo con un nuovo nome\nSalva con nome"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_APP_ABOUT "Visualizza le informazioni sul programma, il numero di versione e le informazioni di copyright\nInformazioni su..."
ID_APP_EXIT "Esce dall'applicazione\nEsci"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_MRU_FILE1 "Apre questo documento"
ID_FILE_MRU_FILE2 "Apre questo documento"
ID_FILE_MRU_FILE3 "Apre questo documento"
ID_FILE_MRU_FILE4 "Apre questo documento"
ID_FILE_MRU_FILE5 "Apre questo documento"
ID_FILE_MRU_FILE6 "Apre questo documento"
ID_FILE_MRU_FILE7 "Apre questo documento"
ID_FILE_MRU_FILE8 "Apre questo documento"
ID_FILE_MRU_FILE9 "Apre questo documento"
ID_FILE_MRU_FILE10 "Apre questo documento"
ID_FILE_MRU_FILE11 "Apre questo documento"
ID_FILE_MRU_FILE12 "Apre questo documento"
ID_FILE_MRU_FILE13 "Apre questo documento"
ID_FILE_MRU_FILE14 "Apre questo documento"
ID_FILE_MRU_FILE15 "Apre questo documento"
ID_FILE_MRU_FILE16 "Apre questo documento"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_NEXT_PANE "Passa al riquadro della finestra successivo\nRiquadro successivo"
ID_PREV_PANE "Ritorna al riquadro della finestra precedente\nRiquadro precedente"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_WINDOW_SPLIT "Divide la finestra attiva in riquadri\nDividi"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_CLEAR "Cancella la selezione\nCancella"
ID_EDIT_CLEAR_ALL "Cancella tutto\nCancella tutto"
ID_EDIT_COPY "Copia la selezione e la pone negli Appunti\nCopia"
ID_EDIT_CUT "Taglia la selezione e la pone negli Appunti\nTaglia"
ID_EDIT_FIND "Trova il testo specificato\nTrova"
ID_EDIT_PASTE "Inserisce il contenuto degli Appunti\nIncolla"
ID_EDIT_REPEAT "Ripete l'ultima azione\nRipeti"
ID_EDIT_REPLACE "Sostituisce il testo specifico con un testo differente\nSostituisci"
ID_EDIT_SELECT_ALL "Seleziona l'intero documento\nSeleziona tutto"
ID_EDIT_UNDO "Annulla l'ultima azione\nAnnulla"
ID_EDIT_REDO "Ripristina l'azione precedentemente annullata\nRipristina"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_VIEW_TOOLBAR "Mostra o nasconde la barra degli strumenti\nMostra/nascondi barra degli strumenti"
ID_VIEW_STATUS_BAR "Mostra o nasconde la barra di stato\nMostra/nascondi barra di stato"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCSIZE "Modifica le dimensioni della finestra"
AFX_IDS_SCMOVE "Modifica la posizione della finestra"
AFX_IDS_SCMINIMIZE "Riduce la finestra ad icona"
AFX_IDS_SCMAXIMIZE "Allarga la finestra a tutto schermo"
AFX_IDS_SCNEXTWINDOW "Passa alla finestra successiva del documento "
AFX_IDS_SCPREVWINDOW "Passa alla precedente finestra del documento"
AFX_IDS_SCCLOSE "Chiude la finestra attiva e chiede di salvare i documenti"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCRESTORE "Ripristina la finestra alle dimensioni normali"
AFX_IDS_SCTASKLIST "Attiva l'Elenco dei task"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_VIEW_TRACE "Logging degli eventi"
END
STRINGTABLE DISCARDABLE
BEGIN
CG_IDS_PHYSICAL_MEM "%lu KB"
CG_IDS_DISK_SPACE "%lu KB Free on %c:"
CG_IDS_DISK_SPACE_UNAVAIL "Unavailable"
END
#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
#ifdef _WIN32
LANGUAGE 16, 1
#pragma code_page(1252)
#endif
#include "res\FrontEnd.rc2" // non-Microsoft Visual C++ edited resources
#include "l.ita\afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

14
servers/odbc/frontend.reg Executable file
View File

@ -0,0 +1,14 @@
REGEDIT
; This .REG file may be used by your SETUP program.
; If a SETUP program is not available, the entries below will be
; registered in your InitInstance automatically with a call to
; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll.
HKEY_CLASSES_ROOT\.LOG = Log
HKEY_CLASSES_ROOT\Log\shell\open\command = FRONTEND.EXE %1
HKEY_CLASSES_ROOT\Log\shell\open\ddeexec = [open("%1")]
HKEY_CLASSES_ROOT\Log\shell\open\ddeexec\application = FRONTEND
; note: the application is optional
; (it defaults to the app name in "command")
HKEY_CLASSES_ROOT\Log = Log File

115
servers/odbc/frontvw.cpp Executable file
View File

@ -0,0 +1,115 @@
// FrontEndView.cpp : implementation of the CFrontEndView class
//
#include "StdAfx.h"
#include "FrontEnd.h"
#include "FrontDoc.h"
#include "FrontVw.h"
#include "Tracing.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFrontEndView
IMPLEMENT_DYNCREATE(CFrontEndView, CTreeView)
BEGIN_MESSAGE_MAP(CFrontEndView, CTreeView)
//{{AFX_MSG_MAP(CFrontEndView)
ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_AS, OnUpdateFileSaveAs)
ON_COMMAND(ID_EDIT_CLEAR_ALL, OnEditClearAll)
ON_UPDATE_COMMAND_UI(ID_EDIT_CLEAR_ALL, OnUpdateEditClearAll)
ON_COMMAND(ID_VIEW_TRACE, OnViewTrace)
ON_UPDATE_COMMAND_UI(ID_VIEW_TRACE, OnUpdateViewTrace)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFrontEndView construction/destruction
CFrontEndView::CFrontEndView()
{
// TODO: add construction code here
}
CFrontEndView::~CFrontEndView()
{
}
BOOL CFrontEndView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CTreeView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CFrontEndView drawing
void CFrontEndView::OnDraw(CDC* pDC)
{
CFrontEndDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CFrontEndView diagnostics
#ifdef _DEBUG
void CFrontEndView::AssertValid() const
{
CTreeView::AssertValid();
}
void CFrontEndView::Dump(CDumpContext& dc) const
{
CTreeView::Dump(dc);
}
CFrontEndDoc* CFrontEndView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFrontEndDoc)));
return (CFrontEndDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFrontEndView message handlers
void CFrontEndView::OnUpdateFileSaveAs(CCmdUI* pCmdUI)
{
CTreeCtrl& pTreeCtrl = GetTreeCtrl();
pCmdUI->Enable(pTreeCtrl.GetCount() > 0);
}
void CFrontEndView::OnEditClearAll()
{
CWaitCursor HourGlass;
CTreeCtrl& pTreeCtrl = GetTreeCtrl();
pTreeCtrl.DeleteAllItems();
Invalidate();
}
void CFrontEndView::OnUpdateEditClearAll(CCmdUI* pCmdUI)
{
pCmdUI->Enable(!TracingEnabled());
}
void CFrontEndView::OnViewTrace()
{
EnableTracing(!TracingEnabled());
}
void CFrontEndView::OnUpdateViewTrace(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(TracingEnabled());
}

53
servers/odbc/frontvw.h Executable file
View File

@ -0,0 +1,53 @@
// FrontEndView.h : interface of the CFrontEndView class
//
/////////////////////////////////////////////////////////////////////////////
class CFrontEndView : public CTreeView
{
protected: // create from serialization only
CFrontEndView();
DECLARE_DYNCREATE(CFrontEndView)
// Attributes
public:
CFrontEndDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFrontEndView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CFrontEndView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CFrontEndView)
afx_msg void OnUpdateFileSaveAs(CCmdUI* pCmdUI);
afx_msg void OnEditClearAll();
afx_msg void OnUpdateEditClearAll(CCmdUI* pCmdUI);
afx_msg void OnViewTrace();
afx_msg void OnUpdateViewTrace(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in FrontEndView.cpp
inline CFrontEndDoc* CFrontEndView::GetDocument()
{ return (CFrontEndDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////

47
servers/odbc/hlapi_c.h Executable file
View File

@ -0,0 +1,47 @@
#include "fastapi.h"
/* --------------------- */
/* Function prototypes : */
/* --------------------- */
#ifdef __cplusplus
extern "C" {
#endif
RET_ FAR_ CALL_ HL_LOGIN (Word ModAd, Word Access, Byte DATAFAR_ *RefKey, Byte DATAFAR_ *VerKey);
RET_ FAR_ CALL_ HL_LOGOUT (void);
RET_ FAR_ CALL_ HL_AVAIL (void);
RET_ FAR_ CALL_ HL_PORTINF (void);
RET_ FAR_ CALL_ HL_ACCINF (void);
RET_ FAR_ CALL_ HL_USERINF (void);
RET_ FAR_ CALL_ HL_MAXUSER (void);
RET_ FAR_ CALL_ HL_MEMINF (void);
RET_ FAR_ CALL_ HL_CODE (void DATAFAR_ *Data, Word Count);
RET_ FAR_ CALL_ HL_WRITE (Word Reg, Word Value);
RET_ FAR_ CALL_ HL_READ (Word Reg, Word DATAFAR_ *Value);
RET_ FAR_ CALL_ HL_READBL (Byte DATAFAR_ *Eeprom);
RET_ FAR_ CALL_ HL_WRITEBL (Byte DATAFAR_ *Eeprom);
RET_ FAR_ CALL_ HL_ABORT (void);
RET_ FAR_ CALL_ HL_VERSION (void);
RET_ FAR_ CALL_ HL_HLSVERS (void);
RET_ FAR_ CALL_ HL_SELECT (HL_API DATAFAR_ *hl_ptr);
#ifndef __OS2__
/****************************************************************************/
/* 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_ CALL_ HL_ON (Word Port, Word ModAd);
void FAR_ CALL_ HL_OFF (Word Port);
Word FAR_ CALL_ K_EYE (Word Port, char DATAFAR_ *Inp, Word BlkCnt);
void FAR_ CALL_ HL_WR (Word Port, Word Reg, Word Val);
Word FAR_ CALL_ HL_RD (Word Port, Word Reg);
void FAR_ CALL_ INT_ON (void);
void FAR_ CALL_ INT_OFF (void);
#endif
RET_ FAR_ CALL_ HL_CALC (Word i1, Word i2, Word i3, Word i4);
#ifdef __cplusplus
};
#endif
/* eof */

98
servers/odbc/iserrors.h Executable file
View File

@ -0,0 +1,98 @@
#ifndef __RECTYPES_H
#define __RECTYPES_H
#define NOERR 0
#define FIELDERR -1
typedef long TRecnotype;
// @doc EXTERNAL
// @enum TFilelock | Comandi per l'apertura dei file
enum TFilelock {
_excllock = 0x100, // @emem Apertura in modo esclusivo
_autolock = 0x200, // @emem Apertura del file in modo auto
_manulock = 0x400}; // @emem Apertura del file in modo manuale
// @doc EXTERNAL
// @enum TReclock | Comandi per la gestione dei lock su record
enum TReclock {
_unlock = 0x1000, // @emem Sblocca il record
_nolock = 0x2000, // @emem Nessuna operazione di lock
_lock = 0x4000, // @emem Blocca il record
_testandlock = (int)0x8000} ; // @emem Blocca il record se possibile, altrimenti ritorna errore
// @doc EXTERNAL
// @enum TDirtype | Comandi per la gestione di <c TDir>
enum TDirtype {
_nordir, // @emem Riferimento operazioni col prefix corrente
_comdir } ; // @emem Riferimento operazioni al direttorio comune
// @doc EXTERNAL
// @enum TDirop | Comandi per la gestione di <c TDir>
enum TDirop {
_nordirop, // @emem Riferimento per operazioni normali
_sysdirop }; // @emem Riferimento per operazioni di sistema
// @doc EXTERNAL
// @enum TFieldtypes | Elenco tipi di campi
enum TFieldtypes {
_nullfld, // @emem Campo non definito
_alfafld, // @emem Campo di tipo alfanumerico
_intfld, // @emem Campo di tipo intero
_longfld, // @emem Campo di tipo intero lungo
_realfld, // @emem Campo di tipo reale (vedi <c real>)
_datefld, // @emem Campo di tipo data (vedi <c TDate>)
_wordfld, // @emem Campo di tipo intero senza segno
_charfld, // @emem Campo di tipo carattere
_boolfld , // @emem Campo di tipo booleano
_intzerofld, // @emem Campo di tipo intero zero filled
_longzerofld, // @emem Campo di tipo intero lungo zero filled
_memofld} ; // @emem Campo di tipo memo
// @doc EXTERNAL
// @enum TIsamop | Comandi per eseguire operazioni di lettura sul file
enum TIsamop {
_isfirst = 0x0, // @emem Legge il primo record del file
_islast = 0x1, // @emem Legge l'ultimo record del file
_isnext= 0x2, // @emem Legge il prossimo record del file
_isprev = 0x4, // @emem Legge il precedente record del file
_iscurr = 0x8, // @emem Legge il record corrente del file (rilettura)
_isequal = 0x10, // @emem Legge il record con chiave uguale a quella specificata
_isgreat = 0x20, // @emem Legge il record con chiave maggiore di quella specificata
_isgteq = 0x40, // @emem Legge il record con chiave maggiore o uguale di quella specificata
_isnextn = 0x100, // @emem Legge i prossimi n record
_isprevn = 0x200} ; // @emem Legge i precedenti n record
// @doc EXTERNAL
// @enum TIsamerr | Elenco codici di errore
enum TIsamerr {
_iseof = 201, // @emem End of file
_isbof = 202, // @emem Begin of file
_isfileovf = 203, // @emem Overflow del file
_iskeynotfound = 204, // @emem Chiave non trovata
_isemptyfile = 205, // @emem File vuoto
_isdupkey = 206, // @emem Chiave duplicata
_isnocurkey = 207, // @emem Non esiste la chiave corrente
_iskeyrangeerr = 211, // @emem Valore errato della chiave
_iskeyerr = 212, // @emem Errore generico della chiave
_iskeylenerr = 214, // @emem Lunghezza della chiave errata
_ispatherr = 216, // @emem File indice non coerente
_ispathfull = 217, // @emem UNUSED
_isnrecerr = 218, // @emem Errore sul numero dei record
_isfilefull = 219, // @emem File o disco pieno
_isnotopen = 220, // @emem File non aperto
_isnotcurr = 221, // @emem Non esiste il record corrente
_isalropen = 222, // @emem File gia' aperto
_isdeadlock = 223, // @emem Condizione di deadlock
_isreinsert = 224, // @emem Chiave duplicata su indici diversi da 1
_islocked = 225} ; // @emem Record bloccato
#endif // __RECTYPES_H

106
servers/odbc/mainfrm.cpp Executable file
View File

@ -0,0 +1,106 @@
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "FrontEnd.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFrameWnd::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

43
servers/odbc/mainfrm.h Executable file
View File

@ -0,0 +1,43 @@
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////

5
servers/odbc/prawin.ini Executable file
View File

@ -0,0 +1,5 @@
[ODBC]
User = ODBC
Pwd = ODBC
Database = c:\prassi\dati
Connect = FoxPro 2.5

104
servers/odbc/readme.txt Executable file
View File

@ -0,0 +1,104 @@
========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : FrontEnd
========================================================================
AppWizard has created this FrontEnd application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
This file contains a summary of what you will find in each of the files that
make up your FrontEnd application.
FrontEnd.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CFrontEndApp application class.
FrontEnd.cpp
This is the main application source file that contains the application
class CFrontEndApp.
FrontEnd.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Developer Studio.
res\FrontEnd.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file FrontEnd.rc.
res\FrontEnd.rc2
This file contains resources that are not edited by Microsoft
Developer Studio. You should place all resources not
editable by the resource editor in this file.
FrontEnd.reg
This is an example .REG file that shows you the kind of registration
settings the framework will set for you. You can use this as a .REG
file to go along with your application or just delete it and rely
on the default RegisterShellFileTypes registration.
FrontEnd.clw
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
/////////////////////////////////////////////////////////////////////////////
For the main frame window:
MainFrm.h, MainFrm.cpp
These files contain the frame class CMainFrame, which is derived from
CFrameWnd and controls all SDI frame features.
res\Toolbar.bmp
This bitmap file is used to create tiled images for the toolbar.
The initial toolbar and status bar are constructed in the
CMainFrame class. Edit this toolbar bitmap along with the
array in MainFrm.cpp to add more toolbar buttons.
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one document type and one view:
FrontEndDoc.h, FrontEndDoc.cpp - the document
These files contain your CFrontEndDoc class. Edit these files to
add your special document data and to implement file saving and loading
(via CFrontEndDoc::Serialize).
FrontEndView.h, FrontEndView.cpp - the view of the document
These files contain your CFrontEndView class.
CFrontEndView objects are used to view CFrontEndDoc objects.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named FrontEnd.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Developer Studio reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
If your application uses MFC in a shared DLL, and your application is
in a language other than the operating system's current language, you
will need to copy the corresponding localized resources MFC40XXX.DLL
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
For example, MFC40DEU.DLL contains resources translated to German.) If you
don't do this, some of the UI elements of your application will remain in the
language of the operating system.
/////////////////////////////////////////////////////////////////////////////

13
servers/odbc/res/frontend.rc2 Executable file
View File

@ -0,0 +1,13 @@
//
// FRONTEND.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

BIN
servers/odbc/res/log.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
servers/odbc/res/prassi.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

BIN
servers/odbc/res/toolbar.bmp Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

27
servers/odbc/resource.h Executable file
View File

@ -0,0 +1,27 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by FrontEnd.rc
//
#define IDD_ABOUTBOX 100
#define CG_IDS_PHYSICAL_MEM 102
#define CG_IDS_DISK_SPACE 103
#define CG_IDS_DISK_SPACE_UNAVAIL 104
#define IDR_MAINFRAME 128
#define IDR_LOGTYPE 129
#define IDD_FILEDIALOG 131
#define IDC_PHYSICAL_MEM 1005
#define IDC_DISK_SPACE 1006
#define stc32 0x045f
#define ID_BUTTON32772 32772
#define ID_VIEW_TRACE 32773
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 132
#define _APS_NEXT_COMMAND_VALUE 32775
#define _APS_NEXT_CONTROL_VALUE 1007
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif

1180
servers/odbc/server.cpp Executable file

File diff suppressed because it is too large Load Diff

74
servers/odbc/server.h Executable file
View File

@ -0,0 +1,74 @@
#ifndef __SERVER_H__
#define __SERVER_H__
/*
#ifndef __NETDDE_H__
#include "netdde.h"
#define BASE_SERVER TDDEServer
#endif
*/
#ifndef __NETSOCK_H__
#include "NetSock.h"
#define BASE_SERVER TSocketServer
#endif
/////////////////////////////////////////////////////////////////////////////
// TPrassiServer
// Preferisco metterla nel .cpp
class TDataSources;
class TTableDefPool;
class TSnapshotPool;
class TPrassiServer : public BASE_SERVER
{
enum { DONGLE_WORDS = 4 };
static WORD m_DongleNumber;
static WORD m_DongleModules[DONGLE_WORDS];
TDataSources* m_pDataSources;
TTableDefPool* m_pTables;
TSnapshotPool* m_pSnapshots;
protected: // TNet_Server
virtual TConnection* OnCreateConnection(DWORD id);
virtual BOOL OnRemoveConnection(DWORD id);
public:
BOOL TestFirm(int nFirm) const;
BOOL OpenTableDef(int nFirm, int nLogicNum);
CdbTableDef GetTableDef(int nFirm, int nLogicNum);
CdbRecordset& GetDynaset(int nFirm, int nLogicNum);
void CloseTableDef(int nFirm, int nLogicNum);
DWORD OpenSnapshot(int nFirm, int nLogicNum, LPCSTR sWhere, LPCSTR sOrder);
CdbRecordset& GetSnapshot(DWORD nHandle);
BOOL UpdateSnapshot(DWORD nHandle, int nFirm, int nLogicNum);
void CloseSnapshot(DWORD nHandle);
int Lock(int nFirm, int nLogicNumber, LPCSTR sKey, DWORD locker);
int Unlock(int nFirm, int nLogicNumber, LPCSTR sKey, DWORD locker);
int ExclusiveLock(int nFirm, int nLogicNumber, DWORD dwLocker);
int ExclusiveUnlock(int nFirm, int nLogicNumber, DWORD dwLocker);
WORD DongleSerialNumber() const { return m_DongleNumber; }
const WORD* DongleAuthorizations() const { return m_DongleModules; }
static WORD DongleLogin();
static void DongleLogout();
virtual BOOL IsOk() const;
TPrassiServer();
virtual ~TPrassiServer();
};
BOOL StartServer();
TPrassiServer& GetServer();
BOOL StopServer();
#endif

822
servers/odbc/sqlfile.cpp Executable file
View File

@ -0,0 +1,822 @@
#include "StdAfx.h"
#include "sqlfile.h"
#include "server.h"
#include "tracing.h"
#include "errno.h"
#include "iserrors.h"
BOOL TSqlFile::IsOpen() const
{
return m_nKey > 0;
}
int TSqlFile::TestOpen() const
{
int err = IsOpen() ? NOERR : _isnotopen;
return err;
}
CdbTableDef TSqlFile::GetTableDef() const
{
TPrassiServer& s = GetServer();
return s.GetTableDef(m_nFirm, m_nLogicNumber);
}
CdbRecordset& TSqlFile::GetSnapshot()
{
TPrassiServer& s = GetServer();
if (m_dwSnapHandle == 0)
{
char sKey[4]; itoa(m_nKey, sKey, 10);
const char* sWhere;
if (m_strWhere.IsEmpty())
sWhere = NULL;
else
sWhere = m_strWhere;
m_dwSnapHandle = s.OpenSnapshot(m_nFirm, m_nLogicNumber,
sWhere, sKey);
m_nItems = -1;
}
return s.GetSnapshot(m_dwSnapHandle);
}
BOOL TSqlFile::Requery()
{
BOOL bOk = IsOpen();
if (bOk && m_dwSnapHandle)
{
TPrassiServer& s = GetServer();
BOOL bUpdated = s.UpdateSnapshot(m_dwSnapHandle, m_nFirm, m_nLogicNumber);
if (bUpdated)
m_nItems = -1;
}
return bOk;
}
CdbRecordset& TSqlFile::GetDynaset() const
{
TPrassiServer& s = GetServer();
return s.GetDynaset(m_nFirm, m_nLogicNumber);
}
int TSqlFile::Open()
{
int err = NOERR;
if (!IsOpen())
{
if (m_bExists)
{
m_nKey = 1;
m_nStatus = _isbof;
}
else
err = ENOENT;
}
else
err = _isalropen;
return err;
}
void TSqlFile::CloseSnapshot()
{
if (m_dwSnapHandle)
{
TPrassiServer& s = GetServer();
s.CloseSnapshot(m_dwSnapHandle);
m_dwSnapHandle = 0;
m_nStatus = _isbof;
}
}
int TSqlFile::Close()
{
int err = TestOpen();
if (err == NOERR)
{
UnlockAll();
CloseSnapshot();
m_nKey = 0;
m_nStatus = _isnotopen;
}
return err;
}
BOOL TSqlFile::SetFirm(int nFirm)
{
BOOL bOk = TRUE;
if (m_nFirm != nFirm)
{
TPrassiServer& s = GetServer();
bOk = s.OpenTableDef(nFirm, m_nLogicNumber);
if (bOk)
{
CloseSnapshot();
s.CloseTableDef(m_nFirm, m_nLogicNumber);
m_nFirm = nFirm;
}
}
return bOk;
}
int TSqlFile::First(int nLock)
{
if (Requery())
{
CdbRecordset& dbSnapshot = GetSnapshot();
try
{
dbSnapshot.MoveFirst();
m_nStatus = NOERR;
}
catch(...)
{
CloseSnapshot();
m_nStatus = _iseof;
m_nItems = 0;
}
if (m_nStatus == NOERR && nLock)
m_nStatus = HandleLock(dbSnapshot, nLock);
}
return m_nStatus;
}
const char* TSqlFile::VariantToString(const COleVariant& oleVariant) const
{
static char strBuffer[32];
switch(oleVariant.vt)
{
case VT_NULL:
return "";
case VT_INT:
case VT_I1:
case VT_I2:
case VT_I4:
case VT_I8:
sprintf(strBuffer, "%d", m_oleVariant.lVal);
return strBuffer;
case VT_UINT:
case VT_UI1:
case VT_UI2:
case VT_UI4:
case VT_UI8:
sprintf(strBuffer, "%u", m_oleVariant.lVal);
return strBuffer;
case VT_R4:
case VT_R8:
sprintf(strBuffer, "%lg", m_oleVariant.dblVal);
return strBuffer;
case VT_BSTR:
return (const char*)m_oleVariant.pbVal;
default:
break;
}
return NULL;
}
const char* TSqlFile::GetField(CdbRecordset& dbRecordset,
const char* strName)
{
const char* val;
try
{
m_oleVariant = dbRecordset.GetField(strName);
val = VariantToString(m_oleVariant);
}
catch(...)
{
val = NULL;
}
return val;
}
const char* TSqlFile::GetField(const char* strName)
{
const char* val = NULL;
if (IsOpen())
{
CdbRecordset& dbSnapshot = GetSnapshot();
val = GetField(dbSnapshot, strName);
}
return val;
}
CString TSqlFile::GetFieldInfo(int pos) const
{
CString strInfo;
try
{
CdbTableDef dbTable = GetTableDef();
if (pos >= 0 && pos < dbTable.Fields.GetCount())
{
char buffer[32];
CdbField dbField = dbTable[pos];
strInfo = dbField.GetName();
TFieldtypes tType;
switch (dbField.GetType())
{
case dbBoolean : tType = _boolfld; break;
case dbByte : tType = _charfld; break;
case dbInteger : tType = _intfld; break;
case dbLong : tType = _longfld; break;
case dbCurrency :
case dbSingle :
case dbDouble : tType = _realfld; break;
case dbDate : tType = _datefld; break;
case dbText : tType = _alfafld; break;
case dbMemo : tType = _memofld; break;
default : tType = _nullfld; break;
}
strInfo += ",";
strInfo += '0' + tType;
itoa(dbField.GetSize(), buffer, 10);
strInfo += ",";
strInfo += buffer;
strInfo += ",0"; // decimali
}
}
catch(...)
{
strInfo = "";
}
return strInfo;
}
int TSqlFile::GetKey() const
{
return m_nKey;
}
CString TSqlFile::GetKeyExpr(int key) const
{
CString strExpr;
CdbTableDef dbTable = GetTableDef();
if (key > 0 && key <= dbTable.Indexes.GetCount())
{
CdbIndex dbIndex = dbTable.Indexes[key-1];
CdbFields& idxFields = dbIndex.Fields;
for (int f = 0; f < idxFields.GetCount(); f++)
{
if (f) strExpr += "+";
strExpr += idxFields[f].GetName();
}
}
return strExpr;
}
int TSqlFile::GetRecordCount()
{
int items = -1;
if (IsOpen())
{
CdbTableDef dbTable = GetTableDef();
items = dbTable.GetRecordCount();
}
return items;
}
int TSqlFile::Last(int nLock)
{
if (Requery())
{
CdbRecordset& dbSnapshot = GetSnapshot();
try
{
dbSnapshot.MoveLast();
m_nStatus = NOERR;
m_nItems = dbSnapshot.GetAbsolutePosition()+1;
}
catch(...)
{
m_nStatus = _isbof;
m_nItems = 0;
}
if (m_nStatus == NOERR && nLock)
m_nStatus = HandleLock(dbSnapshot, nLock);
}
return m_nStatus;
}
int TSqlFile::Move(long pos, int nLock)
{
if (TestOpen() == NOERR)
{
if (pos == 0)
{
Requery();
m_nStatus = _isbof;
}
CdbRecordset& dbSnapshot = GetSnapshot();
try
{
if (m_nStatus == NOERR)
{
long cur = dbSnapshot.GetAbsolutePosition();
dbSnapshot.Move(pos-cur);
}
else
{
dbSnapshot.MoveFirst();
if (pos > 0)
dbSnapshot.Move(pos);
}
m_nStatus = dbSnapshot.GetEOF() ? _iseof : NOERR;
if (m_nStatus == NOERR && nLock)
m_nStatus = HandleLock(dbSnapshot, nLock);
}
catch(...)
{
m_nStatus = pos >= 0 ? _iseof : _isbof;
}
}
return m_nStatus;
}
int TSqlFile::Next(int nLock)
{
if (IsOpen())
{
CdbRecordset& dbSnapshot = GetSnapshot();
try
{
dbSnapshot.MoveNext();
if (dbSnapshot.GetEOF())
m_nStatus = _iseof;
else
m_nStatus = NOERR;
if (m_nStatus == NOERR && nLock)
m_nStatus = HandleLock(dbSnapshot, nLock);
}
catch(...)
{
m_nStatus = _iseof;
}
}
return m_nStatus;
}
long TSqlFile::GetPosition()
{
long pos = -1;
if (m_nStatus == NOERR )
pos = GetSnapshot().GetAbsolutePosition();
return pos;
}
int TSqlFile::Prev(int nLock)
{
if (IsOpen())
{
CdbRecordset& dbSnapshot = GetSnapshot();
try
{
dbSnapshot.MovePrevious();
if (dbSnapshot.GetBOF())
m_nStatus = _isbof;
else
m_nStatus = NOERR;
if (m_nStatus == NOERR && nLock)
m_nStatus = HandleLock(dbSnapshot, nLock);
}
catch(...)
{
m_nStatus = _isbof;
}
}
return m_nStatus;
}
int TSqlFile::Skip(long pos, int nLock)
{
if (IsOpen())
{
CdbRecordset& dbSnapshot = GetSnapshot();
try
{
dbSnapshot.Move(pos);
if (pos >= 0)
m_nStatus = dbSnapshot.GetEOF() ? _iseof : NOERR;
else
m_nStatus = dbSnapshot.GetBOF() ? _isbof : NOERR;
if (m_nStatus == NOERR && nLock)
m_nStatus = HandleLock(dbSnapshot, nLock);
}
catch(...)
{
m_nStatus = pos >= 0 ? _iseof : _isbof;
}
}
return m_nStatus;
}
CString TSqlFile::BuildKey(CdbRecordset& dbRecordset, int nKey)
{
CdbTableDef dbTable = GetTableDef();
CdbIndex dbIndex = dbTable.Indexes[nKey-1];
CdbFields& idxFields = dbIndex.Fields;
CString sKey, sName, sValue, sFormatted;
for (int f = 0; f < idxFields.GetCount(); f++)
{
sName = idxFields[f].GetName();
sValue = GetField(dbRecordset, sName);
const int nSize = dbRecordset[sName].GetSize();
if (sValue.GetLength() < nSize)
{
SHORT int nType = dbRecordset[sName].GetType();
if (nType == dbText)
sFormatted.Format("%-*s", nSize, (const char*)sValue);
else
sFormatted.Format("%*s", nSize, (const char*)sValue);
sKey += sFormatted;
}
else
sKey += sValue;
}
return sKey;
}
CString TSqlFile::BuildKey(const TSqlRecord& sqlRecord, int nKey)
{
CdbTableDef dbTable = GetTableDef();
CdbIndex dbIndex = dbTable.Indexes[nKey-1];
CdbFields& idxFields = dbIndex.Fields;
CString sKey, sName, sValue, sFormatted;
for (int f = 0; f < idxFields.GetCount(); f++)
{
SHORT index = idxFields[f].GetOrdinalPosition();
sValue = sqlRecord.Get(index);
const int nSize = dbTable[index].GetSize();
if (sValue.GetLength() < nSize)
{
SHORT int nType = dbTable[index].GetType();
if (nType == dbText)
sFormatted.Format("%-*s", nSize, (const char*)sValue);
else
sFormatted.Format("%*s", nSize, (const char*)sValue);
sKey += sFormatted;
}
else
sKey += sValue;
}
return sKey;
}
int TSqlFile::Read(CdbRecordset& dbSet, const char* sKey, int flags)
{
int err = NOERR;
if (m_nItems < 0)
{
try
{
dbSet.MoveLast();
m_nItems = dbSet.GetAbsolutePosition()+1;
}
catch(...)
{
m_nItems = 0;
return _isemptyfile;
}
}
const int nLast = m_nItems-1;
int min = 0;
int max = nLast;
int cur = dbSet.GetAbsolutePosition();
CString sCurkey;
int nCompare = +1;
while (min <= max)
{
const int next = (min+max)/2;
try
{
dbSet.Move(next-cur);
cur = next;
}
catch(...)
{
cur = nLast;
break;
}
sCurkey = BuildKey(dbSet, m_nKey);
nCompare = strcmp(sCurkey, sKey);
if (nCompare == 0)
break;
if (nCompare < 0)
min = cur+1;
else
max = cur-1;
}
switch (flags & 0xFF)
{
case _isgteq:
while (nCompare < 0 && cur < nLast)
{
dbSet.MoveNext(); cur++;
sCurkey = BuildKey(dbSet, m_nKey);
nCompare = strcmp(sCurkey, sKey);
}
err = nCompare >= 0 ? NOERR : _iseof;
break;
case _isgreat:
while (nCompare <= 0 && cur < nLast)
{
dbSet.MoveNext(); cur++;
sCurkey = BuildKey(dbSet, m_nKey);
nCompare = strcmp(sCurkey, sKey);
}
err = nCompare > 0 ? NOERR : _iseof;
break;
default:
err = nCompare == 0 ? NOERR : _iskeynotfound;
break;
}
if (err == NOERR)
err = HandleLock(dbSet, flags);
return err;
}
int TSqlFile::Read(const char* sKey, int flags)
{
if (IsOpen())
m_nStatus = Read(GetSnapshot(), sKey, flags);
return m_nStatus;
}
int TSqlFile::SetField(int index, const char* value)
{
return m_sqlRecord.Set((SHORT)index, value);
}
int TSqlFile::SetField(const char* name, const char* value)
{
int err;
try
{
CdbTableDef dbTable = GetTableDef();
SHORT nIndex = dbTable[name].GetOrdinalPosition();
err = m_sqlRecord.Set(nIndex, value);
}
catch(...)
{
err = _iskeyerr;
}
return err;
}
int TSqlFile::SetKey(int nKey)
{
int err = TestOpen();
if (err == NOERR)
{
if (nKey != m_nKey)
{
CdbTableDef dbTable = GetTableDef();
if (nKey > 0 && nKey <= dbTable.Indexes.GetCount())
{
m_nKey = nKey;
CloseSnapshot();
}
else
err = _iskeyrangeerr;
}
}
return err;
}
int TSqlFile::Remove(const char* sKey)
{
CdbRecordset& dbDynaset = GetDynaset();
int err = Read(dbDynaset, sKey, _isequal | _testandlock);
if (err == NOERR)
{
Unlock(sKey);
dbDynaset.Delete();
}
return err;
}
int TSqlFile::Rewrite(const char* sKey)
{
CdbRecordset& dbDynaset = GetDynaset();
int err = Read(dbDynaset, sKey, _isequal | _testandlock);
if (err == NOERR)
{
m_sqlRecord.SetRecord(dbDynaset);
Unlock(sKey);
}
return err;
}
int TSqlFile::Write()
{
CdbRecordset& dbDynaset = GetDynaset();
int err = NOERR;
try
{
dbDynaset.AddNew();
m_sqlRecord.SetRecord(dbDynaset);
dbDynaset.Update();
}
catch(...)
{
err = _isreinsert;
}
return err;
}
int TSqlFile::Lock(CdbRecordset& dbSnapshot)
{
CString strKey;
strKey = BuildKey(dbSnapshot, 1);
TPrassiServer& s = GetServer();
int err = s.Lock(m_nFirm, m_nLogicNumber,
strKey, m_dwConnection);
if (err == NOERR)
m_Locks.SetAt(strKey, NULL);
return err;
}
int TSqlFile::Unlock(LPCSTR sKey)
{
void* dummy;
if (m_Locks.Lookup(sKey, dummy))
{
TPrassiServer& s = GetServer();
s.Unlock(m_nFirm, m_nLogicNumber,
sKey, m_dwConnection);
m_Locks.RemoveKey(sKey);
}
return NOERR;
}
int TSqlFile::Unlock(CdbRecordset& dynaset)
{
CString strKey;
strKey = BuildKey(dynaset, 1);
return Unlock(strKey);
}
void TSqlFile::UnlockAll()
{
CString strKey;
void* dummy;
for (POSITION pos = m_Locks.GetStartPosition(); pos; )
{
m_Locks.GetNextAssoc(pos, strKey, dummy);
Unlock(strKey);
}
if (m_bExclusiveLock)
ExclusiveUnlock();
}
int TSqlFile::ClearFields()
{
int err = TestOpen();
if (err == NOERR)
m_sqlRecord.Clear();
return err;
}
int TSqlFile::HandleLock(CdbRecordset& dbRecordset, int nLock)
{
int err = NOERR;
if ((nLock & _lock) || (nLock & _testandlock))
err = Lock(dbRecordset);
else
{
if (nLock & _unlock)
err = Unlock(dbRecordset);
}
return err;
}
int TSqlFile::ExclusiveLock()
{
TPrassiServer& s = GetServer();
int err = s.ExclusiveLock(m_nFirm, m_nLogicNumber, m_dwConnection);
if (err == NOERR)
m_bExclusiveLock = TRUE;
return err;
}
int TSqlFile::ExclusiveUnlock()
{
TPrassiServer& s = GetServer();
int err = s.ExclusiveUnlock(m_nFirm, m_nLogicNumber, m_dwConnection);
if (err == NOERR)
m_bExclusiveLock = FALSE;
return err;
}
TSqlFile::TSqlFile(int nFirm, int nLogicNumber,
LPCSTR sWhere, DWORD dwConnection)
: m_nLogicNumber(nLogicNumber),
m_nFirm(nFirm),
m_strWhere(sWhere),
m_dwConnection(dwConnection),
m_nKey(0), m_dwSnapHandle(0),
m_nStatus(_isnotopen),
m_nItems(-1)
{
TPrassiServer& s = GetServer();
m_bExists = s.OpenTableDef(nFirm, nLogicNumber);
}
TSqlFile::~TSqlFile()
{
if (m_bExists)
{
Close();
TPrassiServer& s = GetServer();
s.CloseTableDef(m_nFirm, m_nLogicNumber);
}
}
///////////////////////////////////////////////////////////
// TSqlRecord
void TSqlRecord::Clear()
{
m_Fields.RemoveAll();
}
int TSqlRecord::Set(SHORT nIndex, const char* val, DWORD dwSize)
{
CString& strValue = m_Fields[nIndex];
if (dwSize)
{
LPTSTR buffer = strValue.GetBufferSetLength(dwSize);
memcpy(buffer, val, dwSize);
strValue.ReleaseBuffer();
}
else
strValue = val;
return NOERR;
}
CString TSqlRecord::Get(SHORT nIndex) const
{
CString strValue;
m_Fields.Lookup(nIndex, strValue);
return strValue;
}
void TSqlRecord::SetRecord(CdbRecordset& dbRecordset)
{
CdbFields& dbFields = dbRecordset.Fields;
for (SHORT nIndex = dbFields.GetCount()-1; nIndex >= 0; nIndex--)
{
CString strValue;
if (m_Fields.Lookup(nIndex, strValue))
{
if (dbFields[nIndex].GetType() == dbLongBinary)
{
// TODO: Come si scrive un campo binario?
ASSERT(0);
}
else
{
COleVariant oleVariant;
dbRecordset.SetField(nIndex, &oleVariant);
}
}
}
}
TSqlRecord::TSqlRecord()
{
}
TSqlRecord::~TSqlRecord()
{
Clear();
}

114
servers/odbc/sqlfile.h Executable file
View File

@ -0,0 +1,114 @@
#ifndef __SQLFILE_H__
#define __SQLFILE_H__
class TSqlRecord : public CObject
{
CMap<SHORT,SHORT,CString,CString&> m_Fields;
public:
CString Get(SHORT index) const;
void Clear();
int Set(SHORT nIndex, const char* val, DWORD dwSize = 0);
void SetRecord(CdbRecordset& dbRecordset);
BOOL IsEmpty() const { return m_Fields.GetCount() == 0; }
TSqlRecord();
virtual ~TSqlRecord();
};
class TSqlFile : public CObject
{
int m_nFirm;
int m_nLogicNumber;
CString m_strWhere;
DWORD m_dwConnection;
int m_nKey;
COleVariant m_oleVariant;
BOOL m_bExists;
DWORD m_dwSnapHandle;
int m_nItems;
int m_nStatus;
TSqlRecord m_sqlRecord;
CMapStringToPtr m_Locks;
BOOL m_bExclusiveLock;
protected:
int TestOpen() const;
BOOL Requery();
CdbTableDef GetTableDef() const;
CdbRecordset& GetDynaset() const;
CdbRecordset& GetSnapshot();
void CloseSnapshot();
const char* VariantToString(const COleVariant& oleVariant) const;
const char* GetField(CdbRecordset& dbRecordset, const char* strName);
CString BuildKey(CdbRecordset& dbRecordset, int nKey);
CString BuildKey(const TSqlRecord& sqlRecord, int nKey);
int Read(CdbRecordset& dbSnapshot, const char* sKey, int flags);
int Lock(CdbRecordset& dbSnapshot);
int Unlock(LPCSTR sKey);
int Unlock(CdbRecordset& dbDynaset);
void UnlockAll();
int HandleLock(CdbRecordset& dbRecordset, int nLock);
public:
int LogicNumber() const { return m_nLogicNumber; }
BOOL IsOpen() const;
int Open();
int Close();
int First(int nLock);
int Prev(int nLock);
int Next(int nLock);
int Last(int nLock);
int Move(long pos, int nLock);
int Skip(long pos, int nLock);
long GetPosition();
int Read(const char* sKey, int flags);
int Remove(const char* sKey);
int Rewrite(const char* sKey);
int Write();
int ExclusiveLock();
int ExclusiveUnlock();
const char* GetField(const char* strName);
CString GetFieldInfo(int index) const;
int GetRecordCount();
int SetKey(int key);
int GetKey() const;
CString GetKeyExpr(int key) const;
int ClearFields();
int SetField(int index, const char* value);
int SetField(const char* name, const char* value);
BOOL Exists() const
{ return m_bExists; }
BOOL SetFirm(int nFirm);
TSqlFile(int nFirm, int nLogicNumber,
LPCSTR sWhere, DWORD dwConnection);
virtual ~TSqlFile();
};
#endif

6
servers/odbc/stdafx.cpp Executable file
View File

@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// FrontEnd.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

43
servers/odbc/tracing.cpp Executable file
View File

@ -0,0 +1,43 @@
#include "StdAfx.h"
#include "Tracing.h"
static int _trace_level = 0;
void SetTracingLevel(int l)
{
_trace_level = l;
}
void EnableTracing(BOOL on)
{
SetTracingLevel(on ? 0xFFFF : 0);
}
BOOL TracingEnabled()
{
return _trace_level > 0;
}
BOOL Trace(int level, const char* fmt, ...)
{
if (level > _trace_level)
return FALSE;
CFrameWnd* pFrame = (CFrameWnd*)AfxGetMainWnd();
ASSERT(pFrame);
CTreeView* pTreeView = (CTreeView*)pFrame->GetActiveView();
ASSERT(pTreeView);
CTreeCtrl& pTreeCtrl = pTreeView->GetTreeCtrl();
char msg[256];
va_list argptr;
va_start(argptr,fmt);
vsprintf(msg,fmt,argptr);
va_end(argptr);
HTREEITEM hItem = pTreeCtrl.InsertItem(msg, 0, 0);
BOOL ok = hItem != NULL;
return ok;
}

10
servers/odbc/tracing.h Executable file
View File

@ -0,0 +1,10 @@
#ifndef __TRACING_H__
#define __TRACING_H__
void SetTracingLevel(int l);
void EnableTracing(BOOL on);
BOOL TracingEnabled();
BOOL Trace(int l, const char* fmt, ...);
#endif