' ' ' ###################### Max Reason ' ##### kernel32 ##### copyright 1988-2000 ' ###################### Windows XBasic declaration file for Windows "kernel32" ' ' subject to LGPL license - see COPYING_LIB ' ' maxreason@maxreason.com ' ' for Windows XBasic ' ' ' VERSION "0.0070" ' 2000/09/01 ' ' ' ########################### ' ##### declare types ##### ' ########################### ' TYPE DCB XLONG .DCBlength XLONG .BaudRate XLONG .fModes SSHORT .wReserved SSHORT .XonLim SSHORT .XoffLim SBYTE .ByteSize SBYTE .Parity SBYTE .StopBits UBYTE .XonChar UBYTE .XoffChar UBYTE .ErrorChar UBYTE .EofChar UBYTE .EvtChar END TYPE ' TYPE FILETIME XLONG .low XLONG .high END TYPE ' TYPE SYSTEMTIME USHORT .year USHORT .month USHORT .weekDay USHORT .day USHORT .hour USHORT .minute USHORT .second USHORT .msec END TYPE ' TYPE OSVERSIONINFO XLONG .dwOSVersionInfoSize XLONG .dwMajorVersion XLONG .dwMinorVersion XLONG .dwBuildNumber XLONG .dwPlatformId STRING*128 .szCSDVersion END TYPE TYPE COMMPROP USHORT .wPacketLength USHORT .wPacketVersion ULONG .dwServiceMask ULONG .dwReserved1 ULONG .dwMaxTxQueue ULONG .dwMaxRxQueue ULONG .dwMaxBaud ULONG .dwProvSubTYPE ULONG .dwProvCapabilities ULONG .dwSettableParams ULONG .dwSettableBaud USHORT .wSettableData USHORT .wSettableStopParity ULONG .dwCurrentTxQueue ULONG .dwCurrentRxQueue ULONG .dwProvSpec1 ULONG .dwProvSpec2 USHORT .wcProvChar[1] END TYPE TYPE COMSTAT ULONG .fCtsHold ULONG .fDsrHold ULONG .fRlsdHold ULONG .fXoffHold ULONG .fXoffSent ULONG .fEof ULONG .fTxim ULONG .fReserved ULONG .cbInQue ULONG .cbOutQue END TYPE TYPE DCB ULONG .DCBlength ULONG .BaudRate ULONG .fBinary ULONG .fParity ULONG .fOutxCtsFlow ULONG .fOutxDsrFlow ULONG .fDtrControl ULONG .fDsrSensitivity ULONG .fTXContinueOnXoff ULONG .fOutX ULONG .fInX ULONG .fErrorChar ULONG .fNull ULONG .fRtsControl ULONG .fAbortOnError ULONG .fDummy2 USHORT .wReserved USHORT .XonLim USHORT .XoffLim UBYTE .Size UBYTE .Parity UBYTE .StopBits UBYTE .XonChar UBYTE .XoffChar UBYTE .ErrorChar UBYTE .EofChar UBYTE .EvtChar END TYPE TYPE COMMTIMEOUTS ULONG .ReadIntervalTimeout ULONG .ReadTotalTimeoutMultiplier ULONG .ReadTotalTimeoutConstant ULONG .WriteTotalTimeoutMultiplier ULONG .WriteTotalTimeoutConstant END TYPE TYPE OVERLAPPED ULONG .Internal ULONG .InternalHigh ULONG .offset ULONG .OffsetHigh ULONG .hEvent END TYPE TYPE COMMCONFIG ULONG .dwSize USHORT .wVersion USHORT .wReserved DCB .dcbx ULONG .dwProviderSubTYPE ULONG .dwProviderOffset ULONG .dwProviderSize UBYTE .wcProviderData END TYPE ' ' ' ############################### ' ##### declare functions ##### ' ############################### ' EXTERNAL FUNCTION Kernel32 () EXTERNAL FUNCTION Beep (hertz, msec) EXTERNAL FUNCTION CloseHandle (handle) EXTERNAL FUNCTION CopyFileA (sourceNameAddr, destNameAddr, failIfExists) EXTERNAL FUNCTION CreateDirectoryA (dirNameAddr, security) EXTERNAL FUNCTION CreateFileA (addrFilename, mode, azero, bzero, attr, type, czero) EXTERNAL FUNCTION CreateProcessA (addrImageName, addrCommandLine, azero, bzero, czero, create, dzero, ezero, addrStartupInfo, addrProcessInfo) EXTERNAL FUNCTION DeleteFileA (fileNameAddr) EXTERNAL FUNCTION ExitProcess (exitCode) EXTERNAL FUNCTION FileTimeToSystemTime (addrSystemTime, addrFileTime) EXTERNAL FUNCTION FindClose (findHandle) EXTERNAL FUNCTION FindFirstFileA (fileNameAddr, bufferAddr) EXTERNAL FUNCTION FindNextFileA (findHandle, bufferAddr) EXTERNAL FUNCTION FreeConsole () EXTERNAL FUNCTION FreeEnvironmentStrings (addrStrings) EXTERNAL FUNCTION FreeLibrary (hinst) EXTERNAL FUNCTION GetCommandLineA () EXTERNAL FUNCTION GetCommState (handleDevice, addrControlBlock) EXTERNAL FUNCTION GetCurrentDirectoryA (bufferSize, dirNameAddr) EXTERNAL FUNCTION GetCurrentProcess () EXTERNAL FUNCTION GetCurrentThread () EXTERNAL FUNCTION GetDiskFreeSpaceA (lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberofClusters) EXTERNAL FUNCTION GetDriveTypeA (driveNameAddr) EXTERNAL FUNCTION GetEnvironmentStrings () EXTERNAL FUNCTION GetEnvironmentVariableA (addrName, addrValue, maxBytes) EXTERNAL FUNCTION GetExitCodeProcess (hProcess, addrStatus) EXTERNAL FUNCTION GetFileAttributesA (fileNameAddr) EXTERNAL FUNCTION GetFileSize (fileHandle, highAddr) EXTERNAL FUNCTION GetFileTime (fileHandle, addrCreate, addrAccess, addrModify) EXTERNAL FUNCTION GetFileType (fileHandle) EXTERNAL FUNCTION GetFullPathNameA (fileNameAddr, fileNameSize, pathNameAddr, pathNameSize) EXTERNAL FUNCTION GetLastError () EXTERNAL FUNCTION GetLocalTime (addrSystemTime) EXTERNAL FUNCTION GetLogicalDrives () EXTERNAL FUNCTION GetLogicalDriveStringsA (bufferSize, bufferAddr) EXTERNAL FUNCTION GetPrivateProfileStringA (sectionAddr, keyAddr, defaultAddr, bufferAddr, bufferBytes, filenameAddr) EXTERNAL FUNCTION GetProcAddress (hinst, funcNameAddr) EXTERNAL FUNCTION GetProfileStringA (appNameAddr, keyNameAddr, defaultAddr, printerAddr, nSize) EXTERNAL FUNCTION GetModuleFileNameA (handle, addrFileName, maxBytes) EXTERNAL FUNCTION GetModuleHandleA (nameAddr) EXTERNAL FUNCTION GetStdHandle (stdDevice) EXTERNAL FUNCTION GetSystemDirectoryA (pathAddr, pathSize) EXTERNAL FUNCTION GetSystemInfo (infoAddr) EXTERNAL FUNCTION GetSystemTime (addrSystemTime) EXTERNAL FUNCTION GetTickCount () EXTERNAL FUNCTION GetVersion () EXTERNAL FUNCTION GetVersionExA (addrOSVERSIONINFO) EXTERNAL FUNCTION GetWindowsDirectoryA (pathAddr, pathSize) EXTERNAL FUNCTION GlobalAlloc (memType, byteSize) EXTERNAL FUNCTION GlobalLock (handle) EXTERNAL FUNCTION GlobalSize (handle) EXTERNAL FUNCTION GlobalUnlock (handle) EXTERNAL FUNCTION LoadLibraryA (fileNameAddr) EXTERNAL FUNCTION LoadResource (resourceModuleHandle, resourceHandle) EXTERNAL FUNCTION lstrcpyA (lpString1Addr, lpString2Addr) EXTERNAL FUNCTION lstrlenA (lpStringAddr) EXTERNAL FUNCTION LockFile (hFile, offsetLow, offsetHigh, lengthLow, lengthHigh) EXTERNAL FUNCTION MoveFileA (oldFileAddr, newFileAddr) EXTERNAL FUNCTION MulDiv (number, numerator, denominator) EXTERNAL FUNCTION OpenProcess (access, inherit, process) EXTERNAL FUNCTION RaiseException (exception, flags, argCount, argArray) EXTERNAL FUNCTION ReadFile (fileHandle, addrBuffer, readBytes, addrBytesRead, addrOverlapStruc) EXTERNAL FUNCTION RemoveDirectoryA (dirNameAddr) EXTERNAL FUNCTION RtlMoveMemory (destAddr, sourceAddr, length) EXTERNAL FUNCTION SetCommState (handleDevice, addrControlBlock) EXTERNAL FUNCTION SetCurrentDirectoryA (dirNameAddr) EXTERNAL FUNCTION SetEnvironmentVariableA (addrName, addrValue) EXTERNAL FUNCTION SetFileAttributesA (fileNameAddr, attributes) EXTERNAL FUNCTION SetFilePointer (fileHandle, moveBytes, addrMoveByteHigh, moveMethod) EXTERNAL FUNCTION SetFileTime (fileHandle, addrCreate, addrAccess, addrModify) EXTERNAL FUNCTION SetLastError (error) EXTERNAL FUNCTION SetLocalTime (addrSystemTime) EXTERNAL FUNCTION SetPriorityClass (hProcess, priority) EXTERNAL FUNCTION SetThreadPriority (hThread, priority) EXTERNAL FUNCTION SetSystemTime (addrSystemTime) EXTERNAL FUNCTION Sleep (milliseconds) EXTERNAL FUNCTION SystemTimeToFileTime (addrSystemTime, addrFileTime) EXTERNAL FUNCTION UnlockFile (hFile, offsetLow, offsetHigh, lengthLow, lengthHigh) EXTERNAL FUNCTION VirtualAlloc (addr, size, type, protect) EXTERNAL FUNCTION VirtualFree (addr, size, type) EXTERNAL FUNCTION VirtualProtect (addr, size, newProtect, oldProtectBuffer) EXTERNAL FUNCTION WriteFile (fileHandle, addrBuffer, writeBytes, addrBytesWritten, addrOverlapStruc) EXTERNAL FUNCTION WritePrivateProfileStringA (sectionAddr, keyAddr, addStringAddr, filenameAddr) EXTERNAL FUNCTION BuildCommDCBA (lpDef, lpDCB) EXTERNAL FUNCTION BuildCommDCBAndTimeoutsA (lpDef, lpCommTimeouts) EXTERNAL FUNCTION ClearCommBreak (nCid) EXTERNAL FUNCTION ClearCommError (hFile, lpErrors,lpStat) EXTERNAL FUNCTION CommConfigDialogA (lpszName, hWnd,lpCC) EXTERNAL FUNCTION EscapeCommFunction (nCid, nFunc) EXTERNAL FUNCTION GetCommConfig (hCommDev, lpCC, lpdwSize) EXTERNAL FUNCTION GetCommMask (hFile, lpEvtMask) EXTERNAL FUNCTION GetCommModemStatus (hFile, lpModemStat) EXTERNAL FUNCTION GetCommProperties (hFile, lpCommProp) EXTERNAL FUNCTION GetCommState (nCid, lpDCB) EXTERNAL FUNCTION GetCommTimeouts (hFile, lpCommTimeouts) EXTERNAL FUNCTION GetDefaultCommConfigA (lpszName, lpCC,lpdwSize) EXTERNAL FUNCTION PurgeComm (hFile, dwFlags) EXTERNAL FUNCTION SetCommBreak (nCid) EXTERNAL FUNCTION SetCommMask (hFile, dwEvtMask) EXTERNAL FUNCTION SetCommState (hCommDev, lpDCB) EXTERNAL FUNCTION SetCommTimeouts (hFile, lpCommTimeouts) EXTERNAL FUNCTION SetupComm (hFile, dwInQueue, dwOutQueue) EXTERNAL FUNCTION TransmitCommChar (nCid, cChar) EXTERNAL FUNCTION WaitCommEvent (hFile, lpEvtMask,lpOverlapped) EXTERNAL FUNCTION FlushFileBuffers (hFile) ' ' ' ############################################ ' ##### declare/define Win32 constants ##### ' ############################################ ' $$VER_PLATFORM_WIN32s = 0 $$VER_PLATFORM_WIN32_WINDOWS = 1 $$VER_PLATFORM_WIN32_NT = 2 ' The functions with the letter "A" on the end of the ' like BuildCommDCBA are correct. These are alias nam ' should be used whenever they differ from the functi ' case, BuildCommDCB. ' You will also need the following TYPE structures, C ' OVERLAPPED, DCB, and COMMTIMEOUTS. They need to be ' beginning of kernel32.dec before the function decla ' guarantee that these are correct or will work since ' to test any of this... ' And finally, you need the comm related constants th ' some of the functions. They should be copied at the ' kernel32.dec after the function declarations. I hav ' see if any of these constants are already listed in ' therefore could be duplicates. 'Constants ' Serial provider type. $$SP_SERIALCOMM = 0x1& ' Provider SubTYPEs $$PST_UNSPECIFIED = 0x0& $$PST_RS232 = 0x1& $$PST_PARALLELPORT = 0x2& $$PST_RS422 = 0x3& $$PST_RS423 = 0x4& $$PST_RS449 = 0x5& $$PST_FAX = 0x21& $$PST_SCANNER = 0x22& $$PST_NETWORK_BRIDGE = 0x100& $$PST_LAT = 0x101& $$PST_TCPIP_TELNET = 0x102& $$PST_X25 = 0x103& ' Provider capabilities flags. $$PCF_DTRDSR = 0x1& $$PCF_RTSCTS = 0x2& $$PCF_RLSD = 0x4& $$PCF_PARITY_CHECK = 0x8& $$PCF_XONXOFF = 0x10& $$PCF_SETXCHAR = 0x20& $$PCF_TOTALTIMEOUTS = 0x40& $$PCF_INTTIMEOUTS = 0x80& $$PCF_SPECIALCHARS = 0x100& $$PCF_16BITMODE = 0x200& ' Comm provider settable parameters. $$SP_PARITY = 0x1& $$SP_BAUD = 0x2& $$SP_DATABITS = 0x4& $$SP_STOPBITS = 0x8& $$SP_HANDSHAKING = 0x10& $$SP_PARITY_CHECK = 0x20& $$SP_RLSD = 0x40& ' Settable baud rates in the provider. $$BAUD_075 = 0x1& $$BAUD_110 = 0x2& $$BAUD_134_5 = 0x4& $$BAUD_150 = 0x8& $$BAUD_300 = 0x10& $$BAUD_600 = 0x20& $$BAUD_1200 = 0x40& $$BAUD_1800 = 0x80& $$BAUD_2400 = 0x100& $$BAUD_4800 = 0x200& $$BAUD_7200 = 0x400& $$BAUD_9600 = 0x800& $$BAUD_14400 = 0x1000& $$BAUD_19200 = 0x2000& $$BAUD_38400 = 0x4000& $$BAUD_56K = 0x8000& $$BAUD_128K = 0x10000 $$BAUD_115200 = 0x20000 $$BAUD_57600 = 0x40000 $$BAUD_USER = 0x10000000 ' Settable Data Bits $$DATABITS_5 = 0x1& $$DATABITS_6 = 0x2& $$DATABITS_7 = 0x4& $$DATABITS_8 = 0x8& $$DATABITS_16 = 0x10& $$DATABITS_16X = 0x20& ' Settable Stop and Parity bits. $$STOPBITS_10 = 0x1& $$STOPBITS_15 = 0x2& $$STOPBITS_20 = 0x4& $$PARITY_NONE = 0x100& $$PARITY_ODD = 0x200& $$PARITY_EVEN = 0x400& $$PARITY_MARK = 0x800& $$PARITY_SPACE = 0x1000& ' DTR Control Flow Values. $$DTR_CONTROL_DISABLE = 0x0 $$DTR_CONTROL_ENABLE = 0x1 $$DTR_CONTROL_HANDSHAKE = 0x2 ' RTS Control Flow Values $$RTS_CONTROL_DISABLE = 0x0 $$RTS_CONTROL_ENABLE = 0x1 $$RTS_CONTROL_HANDSHAKE = 0x2 $$RTS_CONTROL_TOGGLE = 0x3 ' Events $$EV_RXCHAR = 0x1 ' Any Character received $$EV_RXFLAG = 0x2 ' Received certain charact $$EV_TXEMPTY = 0x4 ' Transmitt Queue Empty $$EV_CTS = 0x8 ' CTS changed state $$EV_DSR = 0x10 ' DSR changed state $$EV_RLSD = 0x20 ' RLSD changed state $$EV_BREAK = 0x40 ' BREAK received $$EV_ERR = 0x80 ' Line status error occurre $$EV_RING = 0x100 ' Ring signal detected $$EV_PERR = 0x200 ' Printer error occured $$EV_RX80FULL = 0x400 ' Receive buffer is 80 p $$EV_EVENT1 = 0x800 ' Provider specific event $$EV_EVENT2 = 0x1000 ' Provider specific even ' Escape Functions $$SETXOFF = 1 ' Simulate XOFF received $$SETXON = 2 ' Simulate XON received $$SETRTS = 3 ' Set RTS high $$CLRRTS = 4 ' Set RTS low $$SETDTR = 5 ' Set DTR high $$CLRDTR = 6 ' Set DTR low $$RESETDEV = 7 ' Reset device if possible $$SETBREAK = 8 'Set the device break line $$CLRBREAK = 9 ' Clear the device break line ' PURGE function flags. $$PURGE_TXABORT = 0x1 ' Kill the pending/current comm port. $$PURGE_RXABORT = 0x2 ' Kill the pending/current port. $$PURGE_TXCLEAR = 0x4 ' Kill the transmit queue i $$PURGE_RXCLEAR = 0x8 ' Kill the typeahead buffer ' Modem Status Flags $$MS_CTS_ON = 0x10& $$MS_DSR_ON = 0x20& $$MS_RING_ON = 0x40& $$MS_RLSD_ON = 0x80& $$GENERIC_READ = 0x80000000 $$GENERIC_WRITE = 0x40000000 $$CREATE_NEW = 1 $$CREATE_ALWAYS = 2 $$OPEN_EXISTING = 3 $$OPEN_ALWAYS = 4 $$TRUNCATE_EXISTING = 5 $$FILE_SHARE_READ = 1 $$FILE_SHARE_WRITE = 2 $$CE_BREAK = 0x10& $$CE_CTSTO = 0x20& $$CE_DNS = 0x800& $$CE_DSRTO = 0x40&