⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hw_32.hpp

📁 《Delphi5企业级解决方案及应用剖析》参考程序 DELPHI 资料集
💻 HPP
字号:
//----------------------------------------------------------------------------
// HW_32.hpp - bcbdcc32 generated hdr (DO NOT EDIT) rev: 0
// From: HW_32.pas
//----------------------------------------------------------------------------
#ifndef HW_32HPP
#define HW_32HPP
//----------------------------------------------------------------------------
#include <Windows.hpp>
#include <Classes.hpp>
#include <SysUtils.hpp>
#include <System.hpp>
namespace Hw_32
{
//-- type declarations -------------------------------------------------------
typedef int __stdcall (*TOpenVxdHandle)(int Ev);

struct HW_32_1
{
	Word PortAddr;
	Byte PortData;
	bool fWrite;
} ;

typedef HW_32_1 PortRec[65535];

typedef PortRec *pPortRec;

struct HW_32_2
{
	Word PortAddr;
	Word PortData;
	bool fWrite;
} ;

typedef HW_32_2 PortWRec[65535];

typedef PortWRec *pPortWRec;

struct HW_32_3
{
	Word PortAddr;
	int PortData;
	bool fWrite;
} ;

typedef HW_32_3 PortLRec[65535];

typedef PortLRec *pPortLRec;

struct TLockedBuffer
{
	int Drv_IRQ_Counter;
	Word ScanCode;
	Word MAX_BUF_LPT;
	Word LPT_BASE_PORT;
	Word L_BUF_LPT;
	Word N_ADD_LPT;
	Word N_SEL_LPT;
	Word BUF_LPT[512];
} ;

typedef TLockedBuffer *PLockedBuffer;

typedef void __fastcall (__closure *TInterruptHandler)(System::TObject* Sender, long HwCounter, Byte 
	LPT_DataReg, Byte LPT_StatusReg, Byte Keyb_ScanCode);

typedef Word TLPTAddresses[3];

typedef TLPTAddresses *PLPTAddresses;

typedef int SC_HANDLE;

class __declspec(delphiclass) TVicHw32;
class __declspec(pascalimplementation) TVicHw32 : public Classes::TComponent
{
	typedef Classes::TComponent inherited;
	
private:
	char fDriverName[8];
	System::SmallString<8>  fSDriverName;
	char fPathToDriver[129];
	char fShortPathToDriver[13];
	int hDrv;
	int hDll;
	bool fWin95;
	bool fRegistry;
	bool fStarted;
	int schSCManager;
	bool fTerminated;
	int fInterface;
	int fBus;
	int fPhysLoPart;
	int fPhysHiPart;
	int fTypeMem;
	int fMemorySize;
	void *fMappedPointers[16];
	int fMappedSizes[16];
	int fMappedAddresses[16];
	Word fMappedAreas;
	void *fpLockedMemory;
	void *fMdl;
	int fLocEvent;
	int fDebugCode;
	bool fHardAccess;
	bool fOpenDrive;
	TInterruptHandler fOnHwInterrupt;
	bool fIsIRQSet;
	Byte fIRQNumber;
	bool fMasked;
	int fThreadId;
	int fThreadHandle;
	int hDrvEvent;
	TOpenVxdHandle OpenVxdHandle;
	TLPTAddresses *fLPTAddresses;
	Word fLPTBasePort;
	Byte fDataPorts[3];
	Byte fLPTNumber;
	Byte fLPTs;
	bool __fastcall InstallDriver(void);
	bool __fastcall StartDriver(void);
	bool __fastcall StopDriver(void);
	bool __fastcall RemoveDriver(void);
	void __fastcall CloseStopUnloadDriver(void);
	void __fastcall InstallStartLoadDriver(void);
	int __fastcall CtlCode(int Code);
	void __fastcall ClearFields(void);
	void __fastcall SetHardAccess(bool parm);
	void __fastcall SetLPTNumber(Byte nNewValue);
	void __fastcall SetIRQMasked(bool bNewValue);
	void __fastcall SetIRQNumber(Byte nNewValue);
	bool __fastcall GetLPTAckwl(void);
	bool __fastcall GetLPTBusy(void);
	bool __fastcall GetLPTPaperEnd(void);
	bool __fastcall GetLPTSlct(void);
	bool __fastcall GetLPTError(void);
	Byte __fastcall GetPortB(Word PortAddr);
	void __fastcall SetPortB(Word PortAddr, Byte nNewValue);
	Word __fastcall GetPortW(Word PortAddr);
	void __fastcall SetPortW(Word PortAddr, Word nNewValue);
	int __fastcall GetPortL(Word PortAddr);
	void __fastcall SetPortL(Word PortAddr, int nNewValue);
	bool __fastcall GetPin(Byte nPin);
	void __fastcall SetPin(Byte nPin, bool bNewValue);
	Byte __fastcall GetMemB(void * MappedAddr, int Offset);
	void __fastcall SetMemB(void * MappedAddr, int Offset, Byte nNewValue);
	Word __fastcall GetMemW(void * MappedAddr, int Offset);
	void __fastcall SetMemW(void * MappedAddr, int Offset, Word nNewValue);
	int __fastcall GetMemL(void * MappedAddr, int Offset);
	void __fastcall SetMemL(void * MappedAddr, int Offset, int nNewValue);
	
public:
	__fastcall virtual TVicHw32(Classes::TComponent* Owner);
	__fastcall virtual ~TVicHw32(void);
	void __fastcall CloseDriver(void);
	bool __fastcall OpenDriver(void);
	void * __fastcall MapPhysToLinear(int PhAddr, int PhSize);
	void __fastcall UnmapMemory(int PhAddr, int PhSize);
	bool __fastcall LPTPrintChar(char ch);
	void __fastcall LPTStrobe(void);
	void __fastcall LPTAutofd(bool Flag);
	void __fastcall LPTInit(void);
	void __fastcall LPTSlctIn(void);
	void __fastcall PortControl(pPortRec Ports, Word NumPorts);
	void __fastcall ReadPortFIFO(Word PortAddr, Word NumPorts, void *Buffer);
	void __fastcall WritePortFIFO(Word PortAddr, Word NumPorts, void *Buffer);
	void __fastcall ReadPortWFIFO(Word PortAddr, Word NumPorts, void *Buffer);
	void __fastcall WritePortWFIFO(Word PortAddr, Word NumPorts, void *Buffer);
	__property Byte Port[Word Index] = {read=GetPortB, write=SetPortB};
	__property Word PortW[Word Index] = {read=GetPortW, write=SetPortW};
	__property int PortL[Word Index] = {read=GetPortL, write=SetPortL};
	__property Byte Mem[void * Base][int Offset] = {read=GetMemB, write=SetMemB};
	__property Word MemW[void * Base][int Offset] = {read=GetMemW, write=SetMemW};
	__property int MemL[void * Base][int Offset] = {read=GetMemL, write=SetMemL};
	__property bool IRQMasked = {read=fMasked, write=SetIRQMasked, nodefault};
	__property bool LPTAckwl = {read=GetLPTAckwl, nodefault};
	__property bool LPTBusy = {read=GetLPTBusy, nodefault};
	__property bool LPTPaperEnd = {read=GetLPTPaperEnd, nodefault};
	__property bool LPTSlct = {read=GetLPTSlct, nodefault};
	__property bool LPTError = {read=GetLPTError, nodefault};
	__property Byte LPTNumPorts = {read=fLPTs, nodefault};
	__property Word LPTBasePort = {read=fLPTBasePort, nodefault};
	__property int DebugCode = {read=fDebugCode, nodefault};
	__property bool Pin[Byte Index] = {read=GetPin, write=SetPin};
	
__published:
	__property bool ActiveHW = {read=fOpenDrive, nodefault};
	__property TInterruptHandler OnHwInterrupt = {read=fOnHwInterrupt, write=fOnHwInterrupt};
	__property Byte LPTNumber = {read=fLPTNumber, write=SetLPTNumber, default=1};
	__property Byte IRQNumber = {read=fIRQNumber, write=SetIRQNumber, nodefault};
	__property bool HardAccess = {read=fHardAccess, write=SetHardAccess, default=1};
};

//-- var, const, procedure ---------------------------------------------------
#define MaxPins (Byte)(17)
#define MAX_RING_BUFFER (Word)(511)
#define MaxMappedAreas (Byte)(16)
#define _DRV_MAP_MEMORY (Byte)(2)
#define _DRV_UNMAP_MEMORY (Byte)(3)
#define _DRV_SET_POST_EVENT (Byte)(5)
#define _DRV_SET_INT_VEC (Byte)(6)
#define _DRV_MASK_INT_VEC (Byte)(7)
#define _DRV_UNMASK_INT_VEC (Byte)(8)
#define _DRV_STOP_INT_VEC (Byte)(9)
#define _DRV_PORT_CONTROL (Byte)(10)
#define _DRV_HARD_READ_PORT (Byte)(11)
#define _DRV_HARD_WRITE_PORT (Byte)(12)
#define _DRV_HARD_READ_PORTW (Byte)(13)
#define _DRV_HARD_WRITE_PORTW (Byte)(14)
#define _DRV_HARD_READ_PORTL (Byte)(15)
#define _DRV_HARD_WRITE_PORTL (Byte)(16)
#define _DRV_READ_FIFO (Byte)(18)
#define _DRV_WRITE_FIFO (Byte)(19)
#define _DRV_READ_FIFO_WORD (Byte)(20)
#define _DRV_WRITE_FIFO_WORD (Byte)(21)
#define _DRV_READ_FIFO_LONG (Byte)(22)
#define _DRV_WRITE_FIFO_LONG (Byte)(23)
#define _DRV_LOCK_MEMORY (Byte)(24)
#define _DRV_UNLOCK_MEMORY (Byte)(25)
#define _DRV_MAP_LPT_AREA (Byte)(26)
#define _DRV_UNMAP_LPT_AREA (Byte)(27)
#define _DRV_SOFT_ACCESS (Byte)(31)
#define _DRV_HARD_ACCESS (Byte)(32)
extern int schSCManager;
extern "C" int __stdcall OpenScManager(int N1, int N2, int A);
extern "C" DWord __stdcall CloseServiceHandle(int ScHandle);
extern "C" int __stdcall CreateService(int hSCManager, char * lpServiceName, char * lpDisplayName, int 
	dwDesiredAccess, int dwServiceType, int dwStartType, int dwErrorControl, char * lpBinaryPathName, char * 
	lpLoadOrderGroup, PDWORD lpdwTagId, char * lpDependencies, char * lpServiceStartName, char * lpPassword
	);
extern "C" int __stdcall OpenService(int hSCManager, char * lpServiceName, int dwDesiredAccess);
extern "C" DWord __stdcall StartService(int hService, int dwNumServiceArgs, char * lpServiceArgVectors
	);
extern "C" DWord __stdcall ControlService(int hService, int dwControl, void * lpServiceStatus);
extern "C" DWord __stdcall DeleteService(int hService);
extern Byte PinsPort[17];
extern bool Negative[17];
extern Byte MaskPins[17];
#define DEB_INST_OK (Byte)(1)
#define DEB_INST_ERR (Byte)(2)
#define DEB_START_OK (Byte)(4)
#define DEB_START_ERR (Byte)(8)
#define DEB_ENTRY (Byte)(16)
#define DEB_ENTRY_NOT_DEMO (Byte)(32)
#define DEB_NOT_STARTED (Byte)(64)
#define DEB_RESERVED (Byte)(128)
#define DEB_SC_OPEN (Word)(256)
#define DEB_SC_NOT_OPEN (Word)(512)
#define DEB_INSTALLED (Word)(1024)
#define DEB_NOT_INSTALLED (Word)(2048)
#define DEB_AFTER_INSTALL (Word)(4096)
#define DEB_AFTER_START (Word)(8192)
extern void __fastcall Register(void);
//-- template instantiations -------------------------------------------------
template class SmallString<8> ;

}	/* namespace Hw_32 */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Hw_32;
#endif
//-- end unit ----------------------------------------------------------------
#endif	// HW_32

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -