From e611b132f9b8abe35b362e5870b74bce94a1e58e Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 16 May 2020 20:51:50 -0700 Subject: initial commit --- private/unimodem/inc/mcx16.h | 189 +++++++ private/unimodem/inc/mcxioctl.h | 65 +++ private/unimodem/inc/modem.h | 29 ++ private/unimodem/inc/modemp.h | 283 ++++++++++ private/unimodem/inc/rovcomm.h | 1087 +++++++++++++++++++++++++++++++++++++++ private/unimodem/inc/rovdbg.h | 56 ++ private/unimodem/inc/rovdi.h | 292 +++++++++++ private/unimodem/inc/rovmem.h | 297 +++++++++++ private/unimodem/inc/slot.h | 32 ++ private/unimodem/inc/tspnotif.h | 62 +++ 10 files changed, 2392 insertions(+) create mode 100644 private/unimodem/inc/mcx16.h create mode 100644 private/unimodem/inc/mcxioctl.h create mode 100644 private/unimodem/inc/modem.h create mode 100644 private/unimodem/inc/modemp.h create mode 100644 private/unimodem/inc/rovcomm.h create mode 100644 private/unimodem/inc/rovdbg.h create mode 100644 private/unimodem/inc/rovdi.h create mode 100644 private/unimodem/inc/rovmem.h create mode 100644 private/unimodem/inc/slot.h create mode 100644 private/unimodem/inc/tspnotif.h (limited to 'private/unimodem/inc') diff --git a/private/unimodem/inc/mcx16.h b/private/unimodem/inc/mcx16.h new file mode 100644 index 000000000..5c695f3b7 --- /dev/null +++ b/private/unimodem/inc/mcx16.h @@ -0,0 +1,189 @@ +//------------------------------------------------------------------------ +// These structures are the Win32 versions, defined in WINBASE.H and MCX.H, +// but we cannot include them because we are 16-bit. So here they are... +//------------------------------------------------------------------------ + +#ifndef _MCX16_H_ +#define _MCX16_H_ + +#pragma pack(4) // make this align every 32-bits + +// +// Serial provider type. +// + +#define SP_SERIALCOMM ((DWORD)0x00000001) + +// +// Provider SubTypes +// + +#define PST_UNSPECIFIED ((DWORD)0x00000000) +#define PST_RS232 ((DWORD)0x00000001) +#define PST_PARALLELPORT ((DWORD)0x00000002) +#define PST_RS422 ((DWORD)0x00000003) +#define PST_RS423 ((DWORD)0x00000004) +#define PST_RS449 ((DWORD)0x00000005) +#define PST_MODEM ((DWORD)0x00000006) +#define PST_FAX ((DWORD)0x00000021) +#define PST_SCANNER ((DWORD)0x00000022) +#define PST_NETWORK_BRIDGE ((DWORD)0x00000100) +#define PST_LAT ((DWORD)0x00000101) +#define PST_TCPIP_TELNET ((DWORD)0x00000102) +#define PST_X25 ((DWORD)0x00000103) + + +// +// Provider capabilities flags. +// + +#define PCF_DTRDSR ((DWORD)0x0001) +#define PCF_RTSCTS ((DWORD)0x0002) +#define PCF_RLSD ((DWORD)0x0004) +#define PCF_PARITY_CHECK ((DWORD)0x0008) +#define PCF_XONXOFF ((DWORD)0x0010) +#define PCF_SETXCHAR ((DWORD)0x0020) +#define PCF_TOTALTIMEOUTS ((DWORD)0x0040) +#define PCF_INTTIMEOUTS ((DWORD)0x0080) +#define PCF_SPECIALCHARS ((DWORD)0x0100) +#define PCF_16BITMODE ((DWORD)0x0200) + +// +// Comm provider settable parameters. +// + +#define SP_PARITY ((DWORD)0x0001) +#define SP_BAUD ((DWORD)0x0002) +#define SP_DATABITS ((DWORD)0x0004) +#define SP_STOPBITS ((DWORD)0x0008) +#define SP_HANDSHAKING ((DWORD)0x0010) +#define SP_PARITY_CHECK ((DWORD)0x0020) +#define SP_RLSD ((DWORD)0x0040) + +// +// Settable baud rates in the provider. +// + +#define BAUD_075 ((DWORD)0x00000001) +#define BAUD_110 ((DWORD)0x00000002) +#define BAUD_134_5 ((DWORD)0x00000004) +#define BAUD_150 ((DWORD)0x00000008) +#define BAUD_300 ((DWORD)0x00000010) +#define BAUD_600 ((DWORD)0x00000020) +#define BAUD_1200 ((DWORD)0x00000040) +#define BAUD_1800 ((DWORD)0x00000080) +#define BAUD_2400 ((DWORD)0x00000100) +#define BAUD_4800 ((DWORD)0x00000200) +#define BAUD_7200 ((DWORD)0x00000400) +#define BAUD_9600 ((DWORD)0x00000800) +#define BAUD_14400 ((DWORD)0x00001000) +#define BAUD_19200 ((DWORD)0x00002000) +#define BAUD_38400 ((DWORD)0x00004000) +#define BAUD_56K ((DWORD)0x00008000) +#define BAUD_128K ((DWORD)0x00010000) +#define BAUD_115200 ((DWORD)0x00020000) +#define BAUD_57600 ((DWORD)0x00040000) +#define BAUD_USER ((DWORD)0x10000000) + +// +// Settable Data Bits +// + +#define DATABITS_5 ((WORD)0x0001) +#define DATABITS_6 ((WORD)0x0002) +#define DATABITS_7 ((WORD)0x0004) +#define DATABITS_8 ((WORD)0x0008) +#define DATABITS_16 ((WORD)0x0010) +#define DATABITS_16X ((WORD)0x0020) + +// +// Settable Stop and Parity bits. +// + +#define STOPBITS_10 ((WORD)0x0001) +#define STOPBITS_15 ((WORD)0x0002) +#define STOPBITS_20 ((WORD)0x0004) +#define PARITY_NONE ((WORD)0x0100) +#define PARITY_ODD ((WORD)0x0200) +#define PARITY_EVEN ((WORD)0x0400) +#define PARITY_MARK ((WORD)0x0800) +#define PARITY_SPACE ((WORD)0x1000) + +// +// DTR Control Flow Values. +// +#define DTR_CONTROL_DISABLE 0x00 +#define DTR_CONTROL_ENABLE 0x01 +#define DTR_CONTROL_HANDSHAKE 0x02 + +// +// RTS Control Flow Values +// +#define RTS_CONTROL_DISABLE 0x00 +#define RTS_CONTROL_ENABLE 0x01 +#define RTS_CONTROL_HANDSHAKE 0x02 +#define RTS_CONTROL_TOGGLE 0x03 + +typedef struct _WIN32DCB { + DWORD DCBlength; /* sizeof(DCB) */ + DWORD BaudRate; /* Baudrate at which running */ + DWORD fBinary: 1; /* Binary Mode (skip EOF check) */ + DWORD fParity: 1; /* Enable parity checking */ + DWORD fOutxCtsFlow:1; /* CTS handshaking on output */ + DWORD fOutxDsrFlow:1; /* DSR handshaking on output */ + DWORD fDtrControl:2; /* DTR Flow control */ + DWORD fDsrSensitivity:1; /* DSR Sensitivity */ + DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */ + DWORD fOutX: 1; /* Enable output X-ON/X-OFF */ + DWORD fInX: 1; /* Enable input X-ON/X-OFF */ + DWORD fErrorChar: 1; /* Enable Err Replacement */ + DWORD fNull: 1; /* Enable Null stripping */ + DWORD fRtsControl:2; /* Rts Flow control */ + DWORD fAbortOnError:1; /* Abort all reads and writes on Error */ + DWORD fDummy2:17; /* Reserved */ + WORD wReserved; /* Not currently used */ + WORD XonLim; /* Transmit X-ON threshold */ + WORD XoffLim; /* Transmit X-OFF threshold */ + BYTE ByteSize; /* Number of bits/byte, 4-8 */ + BYTE Parity; /* 0-4=None,Odd,Even,Mark,Space */ + BYTE StopBits; /* 0,1,2 = 1, 1.5, 2 */ + char XonChar; /* Tx and Rx X-ON character */ + char XoffChar; /* Tx and Rx X-OFF character */ + char ErrorChar; /* Error replacement char */ + char EofChar; /* End of Input character */ + char EvtChar; /* Recieved Event character */ +} WIN32DCB, FAR *LPWIN32DCB; + +#define COMMCONFIG_VERSION_1 1 + +// +// Registry forms of the above structures. Should match the ones in +// unimodem\mcx\internal.h. +// + +// The portion of the MODEMDEVCAPS that is saved in the registry as Properties +typedef struct _RegDevCaps + { + DWORD dwDialOptions; // bitmap of supported values + DWORD dwCallSetupFailTimer; // maximum in seconds + DWORD dwInactivityTimeout; // maximum in the units specified in the InactivityScale value + DWORD dwSpeakerVolume; // bitmap of supported values + DWORD dwSpeakerMode; // bitmap of supported values + DWORD dwModemOptions; // bitmap of supported values + DWORD dwMaxDTERate; // maximum value in bit/s + DWORD dwMaxDCERate; // maximum value in bit/s + } REGDEVCAPS, FAR * LPREGDEVCAPS; + +// The portion of the MODEMDEVSETTINGS that is saved in the registry as Default +typedef struct _RegDevSettings + { + DWORD dwCallSetupFailTimer; // seconds + DWORD dwInactivityTimeout; // units specified in the InactivityScale value + DWORD dwSpeakerVolume; // level + DWORD dwSpeakerMode; // mode + DWORD dwPreferredModemOptions; // bitmap + } REGDEVSETTINGS, FAR * LPREGDEVSETTINGS; + +#pragma pack() + +#endif // _MCX16_H_ diff --git a/private/unimodem/inc/mcxioctl.h b/private/unimodem/inc/mcxioctl.h new file mode 100644 index 000000000..ce4a403bd --- /dev/null +++ b/private/unimodem/inc/mcxioctl.h @@ -0,0 +1,65 @@ +//**************************************************************************** +// +// File: mcxioctl.h +// Content: This file contains the declaration for Unimodem +// DeviceIOControl. +// +// Copyright (c) 1992-1995, Microsoft Corporation, all rights reserved +// +//**************************************************************************** + +#ifndef _MCXIOCTL_H_ +#define _MCXIOCTL_H_ + +// DeviceIOControl Input/Output structure +// +typedef struct tagMdmIn { + DWORD dwPendingID; + DWORD dwParam; + CHAR szAddress[1]; +} MDM_IN, *PMDM_IN; + +typedef struct tagMdmOut { + DWORD dwResult; +} MDM_OUT, *PMDM_OUT; + +// DeviceIOControl operations +// +#define IOCTL_UMDM_INIT 1 +#define IOCTL_UMDM_DIAL 2 +#define IOCTL_UMDM_START_MONITOR 3 +#define IOCTL_UMDM_STOP_MONITOR 4 +#define IOCTL_UMDM_START_MONITOR_DISCONNECT 5 +#define IOCTL_UMDM_STOP_MONITOR_DISCONNECT 6 +#define IOCTL_UMDM_ANSWER 7 +#define IOCTL_UMDM_HANGUP 8 +#define IOCTL_UMDM_PASSTHOUGH 9 +#define IOCTL_UMDM_GETLINKSPEED 10 + +// Monitor modes for IOCTL_UMDM_START_MONITOR +// +#define MONITOR_NON_CONTINUOUS 0 +#define MONITOR_CONTINUOUS 1 + +// Passthrough modes for IOCTL_UMDM_PASSTHROUGH +// +#define PASSTHROUGH_ON 1 +#define PASSTHROUGH_OFF 2 +#define PASSTHROUGH_OFF_BUT_CONNECTED 3 + +// DeviceIOControl operation result +// +#define MDM_SUCCESS 0 +#define MDM_CANCEL 1 +#define MDM_FAILURE 2 +#define MDM_HANGUP 3 +#define MDM_BUSY 4 +#define MDM_NOANSWER 5 +#define MDM_NOCARRIER 6 +#define MDM_NODIALTONE 7 + +// Invalid Pending operation ID +// +#define MDM_ID_NULL 0xFFFFFFFF + +#endif // _MCXIOCTL_H_ diff --git a/private/unimodem/inc/modem.h b/private/unimodem/inc/modem.h new file mode 100644 index 000000000..02c6be045 --- /dev/null +++ b/private/unimodem/inc/modem.h @@ -0,0 +1,29 @@ +//**************************************************************************** +// +// File: modem.h +// Content: This file contains the general modem-related declaration +// +// Copyright (c) 1992-1994, Microsoft Corporation, all rights reserved +// +// History: +// Thu 07-Jul-1994 21:16:59 -by- Viroon Touranachun [viroont] +// Created +//**************************************************************************** + +#ifndef _MODEM_H_ +#define _MODEM_H_ + +//**************************************************************************** +// Constant Definitions +//**************************************************************************** + +// DeviceType defines +// +#define DT_NULL_MODEM 0 +#define DT_EXTERNAL_MODEM 1 +#define DT_INTERNAL_MODEM 2 +#define DT_PCMCIA_MODEM 3 +#define DT_PARALLEL_PORT 4 +#define DT_PARALLEL_MODEM 5 + +#endif //_MODEM_H_ diff --git a/private/unimodem/inc/modemp.h b/private/unimodem/inc/modemp.h new file mode 100644 index 000000000..185c353b3 --- /dev/null +++ b/private/unimodem/inc/modemp.h @@ -0,0 +1,283 @@ +//--------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation 1993-1995 +// +// File: modemp.h +// +// This files contains the private modem structures and defines shared +// between Unimodem components. +// +//--------------------------------------------------------------------------- + +#ifndef __MODEMP_H__ +#define __MODEMP_H__ + +#ifndef WIN32 +//------------------------------------------------------------------------ +// These structures are the Win32 versions, defined in WINBASE.H and MCX.H, +// but we cannot include them because we are 16-bit. So here they are... +//------------------------------------------------------------------------ + +#pragma pack(4) // make this align every 32-bits + +// +// Serial provider type. +// + +#define SP_SERIALCOMM ((DWORD)0x00000001) + +// +// Provider SubTypes +// + +#define PST_UNSPECIFIED ((DWORD)0x00000000) +#define PST_RS232 ((DWORD)0x00000001) +#define PST_PARALLELPORT ((DWORD)0x00000002) +#define PST_RS422 ((DWORD)0x00000003) +#define PST_RS423 ((DWORD)0x00000004) +#define PST_RS449 ((DWORD)0x00000005) +#define PST_MODEM ((DWORD)0x00000006) +#define PST_FAX ((DWORD)0x00000021) +#define PST_SCANNER ((DWORD)0x00000022) +#define PST_NETWORK_BRIDGE ((DWORD)0x00000100) +#define PST_LAT ((DWORD)0x00000101) +#define PST_TCPIP_TELNET ((DWORD)0x00000102) +#define PST_X25 ((DWORD)0x00000103) + + +// +// Provider capabilities flags. +// + +#define PCF_DTRDSR ((DWORD)0x0001) +#define PCF_RTSCTS ((DWORD)0x0002) +#define PCF_RLSD ((DWORD)0x0004) +#define PCF_PARITY_CHECK ((DWORD)0x0008) +#define PCF_XONXOFF ((DWORD)0x0010) +#define PCF_SETXCHAR ((DWORD)0x0020) +#define PCF_TOTALTIMEOUTS ((DWORD)0x0040) +#define PCF_INTTIMEOUTS ((DWORD)0x0080) +#define PCF_SPECIALCHARS ((DWORD)0x0100) +#define PCF_16BITMODE ((DWORD)0x0200) + +// +// Comm provider settable parameters. +// + +#define SP_PARITY ((DWORD)0x0001) +#define SP_BAUD ((DWORD)0x0002) +#define SP_DATABITS ((DWORD)0x0004) +#define SP_STOPBITS ((DWORD)0x0008) +#define SP_HANDSHAKING ((DWORD)0x0010) +#define SP_PARITY_CHECK ((DWORD)0x0020) +#define SP_RLSD ((DWORD)0x0040) + +// +// Settable baud rates in the provider. +// + +#define BAUD_075 ((DWORD)0x00000001) +#define BAUD_110 ((DWORD)0x00000002) +#define BAUD_134_5 ((DWORD)0x00000004) +#define BAUD_150 ((DWORD)0x00000008) +#define BAUD_300 ((DWORD)0x00000010) +#define BAUD_600 ((DWORD)0x00000020) +#define BAUD_1200 ((DWORD)0x00000040) +#define BAUD_1800 ((DWORD)0x00000080) +#define BAUD_2400 ((DWORD)0x00000100) +#define BAUD_4800 ((DWORD)0x00000200) +#define BAUD_7200 ((DWORD)0x00000400) +#define BAUD_9600 ((DWORD)0x00000800) +#define BAUD_14400 ((DWORD)0x00001000) +#define BAUD_19200 ((DWORD)0x00002000) +#define BAUD_38400 ((DWORD)0x00004000) +#define BAUD_56K ((DWORD)0x00008000) +#define BAUD_128K ((DWORD)0x00010000) +#define BAUD_115200 ((DWORD)0x00020000) +#define BAUD_57600 ((DWORD)0x00040000) +#define BAUD_USER ((DWORD)0x10000000) + +// +// Settable Data Bits +// + +#define DATABITS_5 ((WORD)0x0001) +#define DATABITS_6 ((WORD)0x0002) +#define DATABITS_7 ((WORD)0x0004) +#define DATABITS_8 ((WORD)0x0008) +#define DATABITS_16 ((WORD)0x0010) +#define DATABITS_16X ((WORD)0x0020) + +// +// Settable Stop and Parity bits. +// + +#define STOPBITS_10 ((WORD)0x0001) +#define STOPBITS_15 ((WORD)0x0002) +#define STOPBITS_20 ((WORD)0x0004) +#define PARITY_NONE ((WORD)0x0100) +#define PARITY_ODD ((WORD)0x0200) +#define PARITY_EVEN ((WORD)0x0400) +#define PARITY_MARK ((WORD)0x0800) +#define PARITY_SPACE ((WORD)0x1000) + +// +// DTR Control Flow Values. +// +#define DTR_CONTROL_DISABLE 0x00 +#define DTR_CONTROL_ENABLE 0x01 +#define DTR_CONTROL_HANDSHAKE 0x02 + +// +// RTS Control Flow Values +// +#define RTS_CONTROL_DISABLE 0x00 +#define RTS_CONTROL_ENABLE 0x01 +#define RTS_CONTROL_HANDSHAKE 0x02 +#define RTS_CONTROL_TOGGLE 0x03 + +typedef struct _WIN32DCB { + DWORD DCBlength; /* sizeof(DCB) */ + DWORD BaudRate; /* Baudrate at which running */ + DWORD fBinary: 1; /* Binary Mode (skip EOF check) */ + DWORD fParity: 1; /* Enable parity checking */ + DWORD fOutxCtsFlow:1; /* CTS handshaking on output */ + DWORD fOutxDsrFlow:1; /* DSR handshaking on output */ + DWORD fDtrControl:2; /* DTR Flow control */ + DWORD fDsrSensitivity:1; /* DSR Sensitivity */ + DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */ + DWORD fOutX: 1; /* Enable output X-ON/X-OFF */ + DWORD fInX: 1; /* Enable input X-ON/X-OFF */ + DWORD fErrorChar: 1; /* Enable Err Replacement */ + DWORD fNull: 1; /* Enable Null stripping */ + DWORD fRtsControl:2; /* Rts Flow control */ + DWORD fAbortOnError:1; /* Abort all reads and writes on Error */ + DWORD fDummy2:17; /* Reserved */ + WORD wReserved; /* Not currently used */ + WORD XonLim; /* Transmit X-ON threshold */ + WORD XoffLim; /* Transmit X-OFF threshold */ + BYTE ByteSize; /* Number of bits/byte, 4-8 */ + BYTE Parity; /* 0-4=None,Odd,Even,Mark,Space */ + BYTE StopBits; /* 0,1,2 = 1, 1.5, 2 */ + char XonChar; /* Tx and Rx X-ON character */ + char XoffChar; /* Tx and Rx X-OFF character */ + char ErrorChar; /* Error replacement char */ + char EofChar; /* End of Input character */ + char EvtChar; /* Recieved Event character */ +} WIN32DCB, FAR *LPWIN32DCB; + +#pragma pack() + +#else // !WIN32 + +typedef DCB WIN32DCB; +typedef DCB * LPWIN32DCB; + +// Keep this until this is defined in the NT SDK copy of mcx.h +#ifndef MDM_V23_OVERRIDE +#define MDM_V23_OVERRIDE 0x00000400 +#endif + +#endif // !WIN32 + +#define COMMCONFIG_VERSION_1 1 + + +//------------------------------------------------------------------------ +//------------------------------------------------------------------------ + + +// +// Registry forms of the MODEMDEVCAPS and MODEMSETTINGS structures. +// These should match the ones in unimodem\mcx\internal.h. +// + +// The portion of the MODEMDEVCAPS that is saved in the registry +// as Properties +typedef struct _RegDevCaps + { + DWORD dwDialOptions; // bitmap of supported values + DWORD dwCallSetupFailTimer; // maximum in seconds + DWORD dwInactivityTimeout; // maximum in the units specified in the InactivityScale value + DWORD dwSpeakerVolume; // bitmap of supported values + DWORD dwSpeakerMode; // bitmap of supported values + DWORD dwModemOptions; // bitmap of supported values + DWORD dwMaxDTERate; // maximum value in bit/s + DWORD dwMaxDCERate; // maximum value in bit/s + } REGDEVCAPS, FAR * LPREGDEVCAPS; + +// The portion of the MODEMSETTINGS that is saved in the registry +// as Default +typedef struct _RegDevSettings + { + DWORD dwCallSetupFailTimer; // seconds + DWORD dwInactivityTimeout; // units specified in the InactivityScale value + DWORD dwSpeakerVolume; // level + DWORD dwSpeakerMode; // mode + DWORD dwPreferredModemOptions; // bitmap + } REGDEVSETTINGS, FAR * LPREGDEVSETTINGS; + + +// +// DeviceType defines +// + +#define DT_NULL_MODEM 0 +#define DT_EXTERNAL_MODEM 1 +#define DT_INTERNAL_MODEM 2 +#define DT_PCMCIA_MODEM 3 +#define DT_PARALLEL_PORT 4 +#define DT_PARALLEL_MODEM 5 + +//------------------------------------------------------------------------ +//------------------------------------------------------------------------ + +#ifdef UNICODE +#define drvCommConfigDialog drvCommConfigDialogW +#define drvGetDefaultCommConfig drvGetDefaultCommConfigW +#define drvSetDefaultCommConfig drvSetDefaultCommConfigW +#else +#define drvCommConfigDialog drvCommConfigDialogA +#define drvGetDefaultCommConfig drvGetDefaultCommConfigA +#define drvSetDefaultCommConfig drvSetDefaultCommConfigA +#endif + +DWORD +APIENTRY +drvCommConfigDialog( + IN LPCTSTR pszFriendlyName, + IN HWND hwndOwner, + IN OUT LPCOMMCONFIG pcc); + +DWORD +APIENTRY +drvGetDefaultCommConfig( + IN LPCTSTR pszFriendlyName, + IN LPCOMMCONFIG pcc, + IN OUT LPDWORD pdwSize); + +DWORD +APIENTRY +drvSetDefaultCommConfig( + IN LPTSTR pszFriendlyName, + IN LPCOMMCONFIG pcc, + IN DWORD dwSize); + + +//------------------------------------------------------------------------ +//------------------------------------------------------------------------ + +// These are the flags for MODEM_INSTALL_WIZARD +#define MIWF_DEFAULT 0x00000000 +#define MIWF_INSET_WIZARD 0x00000001 // hwndWizardDlg must be owner's + // wizard frame +#define MIWF_BACKDOOR 0x00000002 // enter wizard thru last page + +// The ExitButton field can be: +// +// PSBTN_BACK +// PSBTN_NEXT +// PSBTN_FINISH +// PSBTN_CANCEL + +#endif // __MODEMP_H__ diff --git a/private/unimodem/inc/rovcomm.h b/private/unimodem/inc/rovcomm.h new file mode 100644 index 000000000..b925e37bd --- /dev/null +++ b/private/unimodem/inc/rovcomm.h @@ -0,0 +1,1087 @@ +// +// Copyright (c) Microsoft Corporation 1993-1995 +// +// rovcomm.h +// +// Declares common and useful data structures, macros and functions. +// These items are broken down into the following sections. Defining +// the associated flags will inhibit definition of the indicated +// items. +// +// NORTL - run-time library functions +// NOBASICS - basic macros +// NOMEM - memory management, dynamic array functions +// NODA - dynamic array functions +// NOSHAREDHEAP - shared heap functions +// NOFILEINFO - FileInfo functions +// NOCOLORHELP - helper macros to derive COLOR_ values from state +// NODRAWTEXT - enhanced version of DrawText +// NODIALOGHELPER - dialog helper functions +// NOMESSAGESTRING - construct message string functions +// NOSTRING - string functions +// NOPATH - path whacking functions +// NODEBUGHELP - debug routines +// NOSYNC - synchronization (critical sections, etc.) +// NOPROFILE - profile (.ini) support functions +// NODI - setup API Device Installer wrappers +// +// Optional defines are: +// +// WANT_SHELL_SUPPORT - include SH* function support +// SZ_MODULEA - debug string prepended to debug spew +// SZ_MODULEW - (wide-char) debug string prepended to debug spew +// SHARED_DLL - DLL is in shared memory (may require +// per-instance data) +// SZ_DEBUGSECTION - .ini section name for debug options +// SZ_DEBUGINI - .ini name for debug options +// +// This is the "master" header. The associated files are: +// +// rovcomm.c +// rovpath.c +// rovmem.c, rovmem.h +// rovini.c +// +// If you want debug macros, be sure to include rovdbg.h in one (and +// only one) of your project source files. This contains the three function +// helpers. +// +// History: +// 04-26-95 ScottH Transferred from Briefcase code +// Added controlling defines +// + +#ifndef __ROVCOMM_H__ +#define __ROVCOMM_H__ + +#ifdef RC_INVOKED +// Turn off a bunch of stuff to ensure that RC files compile OK +#define NOMEM +#define NODA +#define NOSHAREDHEAP +#define NOFILEINFO +#define NOCOLORHELP +#define NODRAWTEXT +#define NODIALOGHELPER +#define NOMESSAGESTRING +#define NOSTRING +#define NOPATH +#define NODEBUGHELP +#define NOSYNC +#define NOPROFILE +#define NODI +#endif // RC_INVOKED + +#ifdef JUSTDEBUGSTUFF +#define NORTL +#define NOMEM +#define NODA +#define NOSHAREDHEAP +#define NOFILEINFO +#define NOCOLORHELP +#define NODRAWTEXT +#define NODIALOGHELPER +#define NOMESSAGESTRING +#define NOPROFILE +#define NOSTRING +#define NOPATH +#define NOSYNC +#define NODI +#endif // JUSTDEBUGSTUFF + +#ifdef _INC_OLE +#define WANT_OLE_SUPPORT +#endif + +// Check for any conflicting defines... + +#if !defined(WANT_SHELL_SUPPORT) && !defined(NOFILEINFO) +#pragma message("FileInfo routines need WANT_SHELL_SUPPORT. Not providing FileInfo routines.") +#define NOFILEINFO +#endif + +#if !defined(NOFILEINFO) && defined(NOMEM) +#pragma message("FileInfo routines need NOMEM undefined. Overriding.") +#undef NOMEM +#endif + +#if !defined(NOFILEINFO) && defined(NOMESSAGESTRING) +#pragma message("FileInfo routines need NOMESSAGESTRING undefined. Overriding.") +#undef NOMESSAGESTRING +#endif + +#if !defined(NOFILEINFO) && defined(NOSTRING) +#pragma message("FileInfo routines need NOSTRING undefined. Overriding.") +#undef NOSTRING +#endif + +#if !defined(NOMESSAGESTRING) && defined(NOMEM) +#pragma message("ConstructMessage routines need NOMEM undefined. Overriding.") +#undef NOMEM +#endif + +#if !defined(NOPATH) && defined(NOSTRING) +#pragma message("Path routines need NOSTRING undefined. Overriding.") +#undef NOSTRING +#endif + +#if !defined(NODA) && defined(NOMEM) +#pragma message("Dynamic Array routines need NOMEM undefined. Overriding.") +#undef NOMEM +#endif + +#if !defined(NOSHAREDHEAP) && defined(NOMEM) +#pragma message("Shared memory routines need NOMEM undefined. Overriding.") +#undef NOMEM +#endif + +#if !defined(NOPROFILE) && defined(NODEBUGHELP) +#pragma message("Debug profiling routines need NODEBUGHELP undefined. Overriding.") +#undef NODEBUGHELP +#endif + +#if !defined(NOPROFILE) && defined(NOSTRING) +#pragma message("Private profile needs NOSTRING undefined. Overriding.") +#undef NOSTRING +#endif + +#if DBG > 0 && !defined(DEBUG) +#define DEBUG +#endif +#if DBG > 0 && !defined(FULL_DEBUG) +#define FULL_DEBUG +#endif + + +// Other include files... + +#if !defined(NOFILEINFO) && !defined(_SHLOBJ_H_) +#include +#endif + +#if !defined(NODEBUGHELP) && !defined(_VA_LIST_DEFINED) +#include +#endif + +#if !defined(WINNT) +#define WIN95 +#else +#undef WIN95 +#endif + + +// +// Basics +// +#ifndef NOBASICS + +#define Unref(x) x + +#ifdef DEBUG +#define INLINE +#define DEBUG_CODE(x) x +#else +#define INLINE __inline +#define DEBUG_CODE(x) +#endif + +#ifdef UNICODE +#define SZ_MODULE SZ_MODULEW +#else +#define SZ_MODULE SZ_MODULEA +#endif // UNICODE + +#ifndef OPTIONAL +#define OPTIONAL +#endif +#ifndef IN +#define IN +#endif +#ifndef OUT +#define OUT +#endif + +// General flag macros +// +#define SetFlag(obj, f) do {obj |= (f);} while (0) +#define ToggleFlag(obj, f) do {obj ^= (f);} while (0) +#define ClearFlag(obj, f) do {obj &= ~(f);} while (0) +#define IsFlagSet(obj, f) (BOOL)(((obj) & (f)) == (f)) +#define IsFlagClear(obj, f) (BOOL)(((obj) & (f)) != (f)) + +#define InRange(id, idFirst, idLast) ((UINT)(id-idFirst) <= (UINT)(idLast-idFirst)) + +// Standard buffer lengths +// +#define MAX_BUF 260 +#define MAX_BUF_MSG 520 +#define MAX_BUF_MED 64 +#define MAX_BUF_SHORT 32 +#define MAX_BUF_REG 128 // Should be same as MAX_REG_KEY_LEN + +#define NULL_CHAR '\0' +#define ARRAYSIZE(rg) (sizeof(rg) / sizeof((rg)[0])) +#define ARRAY_ELEMENTS(rg) ARRAYSIZE(rg) +#define SIZECHARS(rg) ARRAYSIZE(rg) + +// Comparison return values +// +#define CMP_GREATER 1 +#define CMP_LESSER (-1) +#define CMP_EQUAL 0 + +// Count of characters to count of bytes +// +#define CbFromCchW(cch) ((cch)*sizeof(WCHAR)) +#define CbFromCchA(cch) ((cch)*sizeof(CHAR)) +#ifdef UNICODE +#define CbFromCch CbFromCchW +#else // UNICODE +#define CbFromCch CbFromCchA +#endif // UNICODE + +// 64-bit macros +// +#define HIDWORD(_qw) (DWORD)((_qw)>>32) +#define LODWORD(_qw) (DWORD)(_qw) + +// Calling declarations +// +#define PUBLIC FAR PASCAL +#define CPUBLIC FAR CDECL +#define PRIVATE NEAR PASCAL + +// Range of resource ID indexes are 0x000 - 0x7ff +#define IDS_BASE 0x1000 +#define IDS_ERR_BASE (IDS_BASE + 0x0000) +#define IDS_OOM_BASE (IDS_BASE + 0x0800) +#define IDS_MSG_BASE (IDS_BASE + 0x1000) +#define IDS_RANDO_BASE (IDS_BASE + 0x1800) +#define IDS_COMMON_BASE (IDS_BASE + 0x2000) + +// Resource string IDs for FileInfo +#define IDS_BYTES (IDS_COMMON_BASE + 0x000) +#define IDS_ORDERKB (IDS_COMMON_BASE + 0x001) +#define IDS_ORDERMB (IDS_COMMON_BASE + 0x002) +#define IDS_ORDERGB (IDS_COMMON_BASE + 0x003) +#define IDS_ORDERTB (IDS_COMMON_BASE + 0x004) +#define IDS_DATESIZELINE (IDS_COMMON_BASE + 0x005) + + +#ifndef DECLARE_STANDARD_TYPES +// For a type "FOO", define the standard derived types PFOO, CFOO, and PCFOO. +// +#define DECLARE_STANDARD_TYPES(type) typedef type FAR *P##type; \ + typedef const type C##type; \ + typedef const type FAR *PC##type; +#endif + +// Zero-initialize data-item +// +#define ZeroInitSize(pobj, cb) MyZeroMemory(pobj, cb) +#define ZeroInit(pobj) MyZeroMemory(pobj, sizeof(*(pobj))) + +// Copy chunk of memory +// +#define BltByte(pdest, psrc, cb) MyMoveMemory(pdest, psrc, cb) + +// Porting macros +// +#ifdef WIN32 + +#define ISVALIDHINSTANCE(hinst) ((BOOL)hinst) +#define LOCALOF(lp) (lp) +#define OFFSETOF(lp) (lp) +#define FIELDOFFSET(type, field) ((int)(&((type NEAR*)1)->field)-1) + +#define DATASEG_READONLY ".text" +#define DATASEG_PERINSTANCE ".instanc" +#define DATASEG_SHARED ".data" + +#else // WIN32 + +#define ISVALIDHINSTANCE(hinst) ((UINT)hinst >= (UINT)HINSTANCE_ERROR) +#define LOCALOF(lp) ((HLOCAL)OFFSETOF(lp)) + +#define DATASEG_READONLY "_TEXT" +#define DATASEG_PERINSTANCE +#define DATASEG_SHARED + +typedef LPCSTR LPCTSTR; +typedef LPSTR LPTSTR; +typedef char TCHAR; + +#endif // WIN32 + +#define LocalFreePtr(p) LocalFree((HLOCAL)OFFSETOF(p)) + +typedef UINT FAR *LPUINT; + +#endif // NOBASICS + + +// +// Run-time library replacements +// +#ifdef NORTL + +// (implemented privately) +LPWSTR +PUBLIC +lmemmoveW( + LPWSTR dst, + LPCWSTR src, + DWORD count); +LPSTR +PUBLIC +lmemmoveA( + LPSTR dst, + LPCSTR src, + DWORD count); +#ifdef UNICODE +#define lmemmove lmemmoveW +#else +#define lmemmove lmemmoveA +#endif // UNICODE + +LPWSTR +PUBLIC +lmemsetW( + LPWSTR dst, + WCHAR val, + DWORD count); +LPSTR +PUBLIC +lmemsetA( + LPSTR dst, + CHAR val, + DWORD count); +#ifdef UNICODE +#define lmemset lmemsetW +#else +#define lmemset lmemsetA +#endif // UNICODE + +#define MyZeroMemory(p, cb) lmemset((LPTSTR)(p), 0, cb) +#define MyMoveMemory(pdest, psrc, cb) lmemmove((LPTSTR)(pdest), (LPCTSTR)(psrc), cb) + +#else // NORTL + +#define MyZeroMemory ZeroMemory +#define MyMoveMemory MoveMemory + +#endif // NORTL + + +// +// Memory and dynamic array functions +// +#ifndef NOMEM +#include "rovmem.h" +#endif // NOMEM + + +// +// Message string helpers +// +#ifndef NOMESSAGESTRING + +#if !defined(WIN32) && !defined(LANG_NEUTRAL) +#define LANG_NEUTRAL 0x00 +#endif + +LPWSTR +PUBLIC +ConstructVMessageStringW( + HINSTANCE hinst, + LPCWSTR pwszMsg, + va_list FAR * ArgList); +LPSTR +PUBLIC +ConstructVMessageStringA( + HINSTANCE hinst, + LPCSTR pszMsg, + va_list FAR * ArgList); +#ifdef UNICODE +#define ConstructVMessageString ConstructVMessageStringW +#else // UNICODE +#define ConstructVMessageString ConstructVMessageStringA +#endif // UNICODE + +BOOL +CPUBLIC +ConstructMessageW( + LPWSTR FAR * ppwsz, + HINSTANCE hinst, + LPCWSTR pwszMsg, ...); +BOOL +CPUBLIC +ConstructMessageA( + LPSTR FAR * ppsz, + HINSTANCE hinst, + LPCSTR pszMsg, ...); +#ifdef UNICODE +#define ConstructMessage ConstructMessageW +#else // UNICODE +#define ConstructMessage ConstructMessageA +#endif // UNICODE + +#define SzFromIDSW(hinst, ids, pwszBuf, cchBuf) (LoadStringW(hinst, ids, pwszBuf, cchBuf), pwszBuf) +#define SzFromIDSA(hinst, ids, pszBuf, cchBuf) (LoadStringA(hinst, ids, pszBuf, cchBuf), pszBuf) + +#ifdef UNICODE +#define SzFromIDS SzFromIDSW +#else // UNICODE +#define SzFromIDS SzFromIDSA +#endif // UNICODE + +int +CPUBLIC +MsgBoxW( + HINSTANCE hinst, + HWND hwndOwner, + LPCWSTR pwszText, + LPCWSTR pwszCaption, + HICON hicon, + DWORD dwStyle, ...); +int +CPUBLIC +MsgBoxA( + HINSTANCE hinst, + HWND hwndOwner, + LPCSTR pszText, + LPCSTR pszCaption, + HICON hicon, + DWORD dwStyle, ...); +#ifdef UNICODE +#define MsgBox MsgBoxW +#else // UNICODE +#define MsgBox MsgBoxA +#endif // UNICODE + +// Additional MB_ flags +#define MB_WARNING (MB_OK | MB_ICONWARNING) +#define MB_INFO (MB_OK | MB_ICONINFORMATION) +#define MB_ERROR (MB_OK | MB_ICONERROR) +#define MB_QUESTION (MB_YESNO | MB_ICONQUESTION) + +#endif // NOMESSAGESTRING + + +// +// String functions +// +#ifndef NOSTRING + +BOOL +PUBLIC +AnsiToIntW( + LPCWSTR pszString, + int FAR * piRet); +BOOL +PUBLIC +AnsiToIntA( + LPCSTR pszString, + int FAR * piRet); +#ifdef UNICODE +#define AnsiToInt AnsiToIntW +#else +#define AnsiToInt AnsiToIntA +#endif // UNICODE + +LPWSTR +PUBLIC +AnsiChrW( + LPCWSTR psz, + WORD wMatch); +LPSTR +PUBLIC +AnsiChrA( + LPCSTR psz, + WORD wMatch); +#ifdef UNICODE +#define AnsiChr AnsiChrW +#else +#define AnsiChr AnsiChrA +#endif // UNICODE + +LPWSTR +PUBLIC +AnsiRChrW( + LPCWSTR psz, + WORD wMatch); +#ifdef UNICODE +#define AnsiRChr AnsiRChrW +#else +#define AnsiRChr +#endif // UNICODE + +#define IsSzEqual(sz1, sz2) (BOOL)(lstrcmpi(sz1, sz2) == 0) +#define IsSzEqualC(sz1, sz2) (BOOL)(lstrcmp(sz1, sz2) == 0) + +#ifdef WIN32 +#define lstrnicmp(sz1, sz2, cch) (CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, sz1, cch, sz2, cch) - 2) +#define lstrncmp(sz1, sz2, cch) (CompareString(LOCALE_USER_DEFAULT, 0, sz1, cch, sz2, cch) - 2) +#else +int PUBLIC lstrnicmp(LPCSTR psz1, LPCSTR psz2, UINT count); +int PUBLIC lstrncmp(LPCSTR psz1, LPCSTR psz2, UINT count); +#endif // WIN32 + +#define IsSzEqualN(sz1, sz2, cch) (BOOL)(0 == lstrnicmp(sz1, sz2, cch)) +#define IsSzEqualNC(sz1, sz2, cch) (BOOL)(0 == lstrncmp(sz1, sz2, cch)) + +#endif // NOSTRING + + +// +// FileInfo functions +// +#if !defined(NOFILEINFO) && defined(WIN95) + +// FileInfo struct that contains file time/size info +// +typedef struct _FileInfo + { + HICON hicon; + FILETIME ftMod; + DWORD dwSize; // size of the file + DWORD dwAttributes; // attributes + LPARAM lParam; + LPSTR pszDisplayName; // points to the display name + CHAR szPath[1]; + } FileInfo; + +#define FIGetSize(pfi) ((pfi)->dwSize) +#define FIGetPath(pfi) ((pfi)->szPath) +#define FIGetDisplayName(pfi) ((pfi)->pszDisplayName) +#define FIGetAttributes(pfi) ((pfi)->dwAttributes) +#define FIIsFolder(pfi) (IsFlagSet((pfi)->dwAttributes, SFGAO_FOLDER)) + +// Flags for FICreate +#define FIF_DEFAULT 0x0000 +#define FIF_ICON 0x0001 +#define FIF_DONTTOUCH 0x0002 +#define FIF_FOLDER 0x0004 + +HRESULT PUBLIC FICreate(LPCSTR pszPath, FileInfo ** ppfi, UINT uFlags); +BOOL PUBLIC FISetPath(FileInfo ** ppfi, LPCSTR pszPathNew, UINT uFlags); +BOOL PUBLIC FIGetInfoString(FileInfo * pfi, LPSTR pszBuf, int cchBuf); +void PUBLIC FIFree(FileInfo * pfi); + +void PUBLIC FileTimeToDateTimeString(LPFILETIME pft, LPSTR pszBuf, int cchBuf); + +#endif // NOFILEINFO + + +// +// Color-from-owner-draw-state macros +// +#ifndef NOCOLORHELP + +#define ColorText(nState) (((nState) & ODS_SELECTED) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT) +#define ColorBk(nState) (((nState) & ODS_SELECTED) ? COLOR_HIGHLIGHT : COLOR_WINDOW) +#define ColorMenuText(nState) (((nState) & ODS_SELECTED) ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT) +#define ColorMenuBk(nState) (((nState) & ODS_SELECTED) ? COLOR_HIGHLIGHT : COLOR_MENU) +#define GetImageDrawStyle(nState) (((nState) & ODS_SELECTED) ? ILD_SELECTED : ILD_NORMAL) + +#endif // NOCOLORHELP + + +// +// Dialog helper functions +// +#ifndef NODIALOGHELPER + +// Sets the dialog handle in the given data struct on first +// message that the dialog gets (WM_SETFONT). +// +#define SetDlgHandle(hwnd, msg, lp) if((msg)==WM_SETFONT) (lp)->hdlg=(hwnd); + +#define DoModal DialogBoxParam + +VOID +PUBLIC +SetRectFromExtentW( + HDC hdc, + LPRECT lprc, + LPCWSTR lpcwsz); +VOID +PUBLIC +SetRectFromExtentA( + HDC hdc, + LPRECT lprc, + LPCSTR lpcsz); +#ifdef UNICODE +#define SetRectFromExtent SetRectFromExtentW +#else +#define SetRectFromExtent SetRectFromExtentA +#endif // UNICODE + +#endif // NODIALOGHELPER + + +// +// Enhanced form of DrawText() +// +#ifndef NODRAWTEXT + +// Flags for MyDrawText() +#define MDT_DRAWTEXT 0x00000001 +#define MDT_ELLIPSES 0x00000002 +#define MDT_LINK 0x00000004 +#define MDT_SELECTED 0x00000008 +#define MDT_DESELECTED 0x00000010 +#define MDT_DEPRESSED 0x00000020 +#define MDT_EXTRAMARGIN 0x00000040 +#define MDT_TRANSPARENT 0x00000080 +#define MDT_LEFT 0x00000100 +#define MDT_RIGHT 0x00000200 +#define MDT_CENTER 0x00000400 +#define MDT_VCENTER 0x00000800 +#define MDT_CLIPPED 0x00001000 + +#ifndef CLR_DEFAULT // (usually defined in commctrl.h) +#define CLR_DEFAULT 0xFF000000L +#endif + +void +PUBLIC +MyDrawTextW( + HDC hdc, + LPCWSTR pwszText, + RECT FAR* prc, + UINT flags, + int cyChar, + int cxEllipses, + COLORREF clrText, + COLORREF clrTextBk); +void +PUBLIC +MyDrawTextA( + HDC hdc, + LPCSTR pszText, + RECT FAR* prc, + UINT flags, + int cyChar, + int cxEllipses, + COLORREF clrText, + COLORREF clrTextBk); +#ifdef UNICODE +#define MyDrawText MyDrawTextW +#else +#define MyDrawText MyDrawTextA +#endif // UNICODE + + +void PUBLIC GetCommonMetrics(WPARAM wParam); + +extern int g_cxLabelMargin; +extern int g_cxBorder; +extern int g_cyBorder; + +extern COLORREF g_clrHighlightText; +extern COLORREF g_clrHighlight; +extern COLORREF g_clrWindowText; +extern COLORREF g_clrWindow; + +extern HBRUSH g_hbrHighlight; +extern HBRUSH g_hbrWindow; + +#endif // NODRAWTEXT + +// +// Synchronization +// +#ifndef NOSYNC + +#if defined(WIN95) + +#define INIT_EXCLUSIVE() Common_InitExclusive(); +#define ENTER_EXCLUSIVE() Common_EnterExclusive(); +#define LEAVE_EXCLUSIVE() Common_LeaveExclusive(); +#define ASSERT_EXCLUSIVE() ASSERT(0 < g_cRefCommonCS) +#define ASSERT_NOT_EXCLUSIVE() ASSERT(0 == g_cRefCommonCS) + +extern UINT g_cRefCommonCS; + +void PUBLIC Common_InitExclusive(void); +void PUBLIC Common_EnterExclusive(void); +void PUBLIC Common_LeaveExclusive(void); + +#endif // WIN95 + +// Safe version of MsgWaitMultipleObjects() +// +DWORD PUBLIC MsgWaitObjectsSendMessage(DWORD cObjects, LPHANDLE phObjects, DWORD dwTimeout); + +#else // NOSYNC + +#if defined(WIN95) + +#define INIT_EXCLUSIVE() +#define ENTER_EXCLUSIVE() +#define LEAVE_EXCLUSIVE() +#define ASSERT_EXCLUSIVE() +#define ASSERT_NOT_EXCLUSIVE() + +#endif + +#endif // NOSYNC + + +// +// Path whacking functions +// +#if !defined(NOPATH) && defined(WIN95) + +BOOL PUBLIC WPPathIsRoot(LPCSTR pszPath); +BOOL PUBLIC WPPathIsUNC(LPCSTR pszPath); +LPSTR PUBLIC WPRemoveBackslash(LPSTR lpszPath); +LPSTR PUBLIC WPRemoveExt(LPCSTR pszPath, LPSTR pszBuf); +LPSTR PUBLIC WPFindNextComponentI(LPCSTR lpszPath); +void PUBLIC WPMakePresentable(LPSTR pszPath); +BOOL PUBLIC WPPathsTooLong(LPCSTR pszFolder, LPCSTR pszName); +void PUBLIC WPCanonicalize(LPCSTR pszPath, LPSTR pszBuf); +LPSTR PUBLIC WPFindFileName(LPCSTR pPath); +BOOL PUBLIC WPPathExists(LPCSTR pszPath); +LPCSTR PUBLIC WPFindEndOfRoot(LPCSTR pszPath); +BOOL PUBLIC WPPathIsPrefix(LPCSTR lpcszPath1, LPCSTR lpcszPath2); + +#ifdef WANT_SHELL_SUPPORT +LPSTR PUBLIC WPGetDisplayName(LPCSTR pszPath, LPSTR pszBuf); + +// Events for WPNotifyShell +typedef enum _notifyshellevent + { + NSE_CREATE = 0, + NSE_MKDIR, + NSE_UPDATEITEM, + NSE_UPDATEDIR + } NOTIFYSHELLEVENT; + +void PUBLIC WPNotifyShell(LPCSTR pszPath, NOTIFYSHELLEVENT nse, BOOL bDoNow); +#endif // WANT_SHELL_SUPPORT + +#endif // !defined(NOPATH) && defined(WIN95) + + +// +// Profile (.ini) support functions +// +// (Currently all profile functions are for DEBUG use only +#ifndef DEBUG +#define NOPROFILE +#endif +#ifndef NOPROFILE + +#ifndef SZ_DEBUGINI +#pragma message("SZ_DEBUGINI is not #defined. Assuming \"rover.ini\".") +#define SZ_DEBUGINI "rover.ini" +#endif +#ifndef SZ_DEBUGSECTION +#pragma message("SZ_DEBUGSECTION is not #defined. Assuming [Debug].") +#define SZ_DEBUGSECTION "Debug" +#endif + +BOOL PUBLIC RovComm_ProcessIniFile(void); + +#else // NOPROFILE + +#define RovComm_ProcessIniFile() 1 ? (BOOL)TRUE : (void)0 + +#endif // NOPROFILE + + +// +// Debug helper functions +// + + +// Break flags +#define BF_ONVALIDATE 0x00000001 +#define BF_ONOPEN 0x00000002 +#define BF_ONCLOSE 0x00000004 +#define BF_ONRUNONCE 0x00000008 +#define BF_ONTHREADATT 0x00000010 +#define BF_ONTHREADDET 0x00000020 +#define BF_ONPROCESSATT 0x00000040 +#define BF_ONPROCESSDET 0x00000080 +#define BF_ONAPIENTER 0x00000100 + +// Trace flags +#define TF_ALWAYS 0x00000000 +#define TF_WARNING 0x00000001 +#define TF_ERROR 0x00000002 +#define TF_GENERAL 0x00000004 // Standard messages +#define TF_FUNC 0x00000008 // Trace function calls +// (Upper 16 bits reserved for user) + +#if defined(NODEBUGHELP) || !defined(DEBUG) + +#define DEBUG_BREAK 1 ? (void)0 : (void) +#define ASSERT(f) +#define EVAL(f) (f) +#define ASSERT_MSG 1 ? (void)0 : (void) +#define DEBUG_MSG 1 ? (void)0 : (void) +#define TRACE_MSGA 1 ? (void)0 : (void) +#define TRACE_MSGW 1 ? (void)0 : (void) +#ifdef UNICODE +#define TRACE_MSG TRACE_MSGW +#else +#define TRACE_MSG TRACE_MSGA +#endif + +#define VERIFY_SZ(f, szFmt, x) (f) +#define VERIFY_SZ2(f, szFmt, x1, x2) (f) + +#define DBG_ENTER(fn) +#define DBG_ENTER_SZ(fn, sz) +#define DBG_ENTER_DTOBJ(fn, pdtobj, sz) +#define DBG_ENTER_RIID(fn, riid) +#define DBG_ENTER_UL(fn, ul) + +#define DBG_EXIT(fn) +#define DBG_EXIT_TYPE(fn, dw, pfnStrFromType) +#define DBG_EXIT_INT(fn, n) +#define DBG_EXIT_BOOL(fn, b) +#define DBG_EXIT_US(fn, us) +#define DBG_EXIT_UL(fn, ul) +#define DBG_EXIT_DWORD DBG_EXIT_UL +#define DBG_EXIT_PTR(fn, ptr) +#define DBG_EXIT_HRES(fn, hres) + +#else // defined(NODEBUGHELP) || !defined(DEBUG) + +extern DWORD g_dwDumpFlags; +extern DWORD g_dwBreakFlags; +extern DWORD g_dwTraceFlags; + +// Debugging macros +// +#ifndef SZ_MODULEA +#error SZ_MODULEA is not #defined +#endif +#if defined(UNICODE) && !defined(SZ_MODULEW) +#error SZ_MODULEW is not #defined +#endif + +#define DEBUG_CASE_STRING(x) case x: return #x + +#define DEBUG_STRING_MAPW(x) { x, TEXT(#x) } +#define DEBUG_STRING_MAPA(x) { x, #x } +#ifdef UNICODE +#define DEBUG_STRING_MAP DEBUG_STRING_MAPW +#else // UNICODE +#define DEBUG_STRING_MAP DEBUG_STRING_MAPA +#endif // UNICODE + +#define ASSERTSEG + +// Use this macro to declare message text that will be placed +// in the CODE segment (useful if DS is getting full) +// +// Ex: DEBUGTEXT(szMsg, "Invalid whatever: %d"); +// +#define DEBUGTEXT(sz, msg) \ + static const CHAR ASSERTSEG sz[] = msg; + +void PUBLIC CommonDebugBreak(DWORD flag); +void PUBLIC CommonAssertFailed(LPCSTR szFile, int line); + +void +CPUBLIC +CommonAssertMsgW( + BOOL f, + LPCWSTR pwszMsg, ...); +void +CPUBLIC +CommonAssertMsgA( + BOOL f, + LPCSTR pszMsg, ...); +#ifdef UNICODE +#define CommonAssertMsg CommonAssertMsgW +#else +#define CommonAssertMsg CommonAssertMsgA +#endif // UNICODE + +BOOL WINAPI +DisplayDebug( + DWORD flag + ); + + +void +CPUBLIC +CommonDebugMsgW( + DWORD mask, + LPCSTR pszMsg, ...); +void +CPUBLIC +CommonDebugMsgA( + DWORD mask, + LPCSTR pszMsg, ...); +#ifdef UNICODE +#define CommonDebugMsg CommonDebugMsgW +#else +#define CommonDebugMsg CommonDebugMsgA +#endif // UNICODE + +LPCWSTR +PUBLIC +Dbg_SafeStrW( + LPCWSTR pwsz); +LPCSTR +PUBLIC +Dbg_SafeStrA( + LPCSTR psz); +#ifdef UNICODE +#define Dbg_SafeStr Dbg_SafeStrW +#else +#define Dbg_SafeStr Dbg_SafeStrA +#endif // UNICODE + +#define DEBUG_BREAK CommonDebugBreak + +// ASSERT(f) -- Generate "assertion failed in line x of file.c" +// message if f is NOT true. +// +#define ASSERT(f) \ + { \ + DEBUGTEXT(szFile, __FILE__); \ + if (!(f)) \ + CommonAssertFailed(szFile, __LINE__); \ + } +#define EVAL ASSERT + +// ASSERT_MSG(f, msg, args...) -- Generate wsprintf-formatted +// messsage w/params if f is NOT true. +// +#define ASSERT_MSG CommonAssertMsg + +// TRACE_MSG(mask, msg, args...) - Generate wsprintf-formatted msg using +// specified debug mask. System debug mask +// governs whether message is output. +// +#define TRACE_MSGW CommonDebugMsgW +#define TRACE_MSGA CommonDebugMsgA +#define TRACE_MSG CommonDebugMsg + +// VERIFY_SZ(f, msg, arg) -- Generate wsprintf-formatted msg w/ 1 param +// if f is NOT true +// +#define VERIFY_SZ(f, szFmt, x) ASSERT_MSG(f, szFmt, x) + + +// VERIFY_SZ2(f, msg, arg1, arg2) -- Generate wsprintf-formatted msg w/ 2 +// param if f is NOT true +// +#define VERIFY_SZ2(f, szFmt, x1, x2) ASSERT_MSG(f, szFmt, x1, x2) + + + +// DBG_ENTER(fn) -- Generates a function entry debug spew for +// a function +// +#define DBG_ENTER(fn) \ + TRACE_MSG(TF_FUNC, " > " #fn "()") + + +// DBG_ENTER_SZ(fn, sz) -- Generates a function entry debug spew for +// a function that accepts a string as one of its +// parameters. +// +#define DBG_ENTER_SZ(fn, sz) \ + TRACE_MSG(TF_FUNC, " > " #fn "(..., \"%s\",...)", Dbg_SafeStr(sz)) + + +// DBG_ENTER_UL(fn, ul) -- Generates a function entry debug spew for +// a function that accepts a DWORD as one of its +// parameters. +// +#define DBG_ENTER_UL(fn, ul) \ + TRACE_MSG(TF_FUNC, " > " #fn "(..., %#08lx,...)", (ULONG)(ul)) + + +#ifdef WANT_OLE_SUPPORT +// DBG_ENTER_RIID(fn, riid) -- Generates a function entry debug spew for +// a function that accepts an riid as one of its +// parameters. +// +#define DBG_ENTER_RIID(fn, riid) \ + TRACE_MSG(TF_FUNC, " > " #fn "(..., %s,...)", Dbg_GetRiidName(riid)) +#endif + + +// DBG_EXIT(fn) -- Generates a function exit debug spew +// +#define DBG_EXIT(fn) \ + TRACE_MSG(TF_FUNC, " < " #fn "()") + +// DBG_EXIT_TYPE(fn, dw, pfnStrFromType) -- Generates a function exit debug +// spew for functions that return . +// +#define DBG_EXIT_TYPE(fn, dw, pfnStrFromType) \ + TRACE_MSG(TF_FUNC, " < " #fn "() with %s", (LPCTSTR)pfnStrFromType(dw)) + +// DBG_EXIT_INT(fn, us) -- Generates a function exit debug spew for +// functions that return an INT. +// +#define DBG_EXIT_INT(fn, n) \ + TRACE_MSG(TF_FUNC, " < " #fn "() with %d", (int)(n)) + +// DBG_EXIT_BOOL(fn, b) -- Generates a function exit debug spew for +// functions that return a boolean. +// +#define DBG_EXIT_BOOL(fn, b) \ + TRACE_MSG(TF_FUNC, " < " #fn "() with %s", (b) ? (LPTSTR)TEXT("TRUE") : (LPTSTR)TEXT("FALSE")) + +// DBG_EXIT_US(fn, us) -- Generates a function exit debug spew for +// functions that return a USHORT. +// +#define DBG_EXIT_US(fn, us) \ + TRACE_MSG(TF_FUNC, " < " #fn "() with %#x", (USHORT)(us)) + +// DBG_EXIT_UL(fn, ul) -- Generates a function exit debug spew for +// functions that return a ULONG. +// +#define DBG_EXIT_UL(fn, ul) \ + TRACE_MSG(TF_FUNC, " < " #fn "() with %#08lx", (ULONG)(ul)) +#define DBG_EXIT_DWORD DBG_EXIT_UL + +// DBG_EXIT_PTR(fn, pv) -- Generates a function exit debug spew for +// functions that return a pointer. +// +#define DBG_EXIT_PTR(fn, pv) \ + TRACE_MSG(TF_FUNC, " < " #fn "() with %#lx", (LPVOID)(pv)) + +// DBG_EXIT_HRES(fn, hres) -- Generates a function exit debug spew for +// functions that return an HRESULT. +// +#define DBG_EXIT_HRES(fn, hres) DBG_EXIT_TYPE(fn, hres, Dbg_GetScode) + +#endif // defined(NODEBUGHELP) || !defined(DEBUG) + + +// +// Standard functions +// + +BOOL PUBLIC RovComm_Init(HINSTANCE hinst); +BOOL PUBLIC RovComm_Terminate(HINSTANCE hinst); + + +// Admin related +BOOL PUBLIC IsAdminUser(void); + +// +// Device Installer wrappers and helper functions +// + +#ifndef NODI + +#include + +#endif // NODI + + +#endif // __ROVCOMM_H__ diff --git a/private/unimodem/inc/rovdbg.h b/private/unimodem/inc/rovdbg.h new file mode 100644 index 000000000..fdb1808f1 --- /dev/null +++ b/private/unimodem/inc/rovdbg.h @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation 1993-1995 +// +// rovdbg.h +// +// Provides debug macro code that is needed to allow the binary to +// link. +// +// This file should be included by only one source in your project. +// If you get multiple redefinitions of the supplied functions, then +// you are not doing something right. Sorry to be so blunt. +// +// These functions are not declared if NODEBUGHELP is defined. +// +// History: +// 09-21-95 ScottH Created +// + +#ifndef __ROVDBG_H__ +#define __ROVDBG_H__ + +#if !defined(__ROVCOMM_H__) +#error ROVCOMM.H must be included to use the common debug macros! +#endif + +#if !defined(NODEBUGHELP) && defined(DEBUG) + +#pragma data_seg(DATASEG_READONLY) + +#ifndef NOPROFILE + +WCHAR const FAR c_szRovIniFile[] = SZ_DEBUGINI; +WCHAR const FAR c_szRovIniSecDebugUI[] = SZ_DEBUGSECTION; + +#endif + +#ifdef WINNT + +// We don't use the TEXT() macro's here, because we want to define these as +// Unicode even when were in a non-unicode module. +WCHAR const FAR c_wszNewline[] = L"\r\n"; +WCHAR const FAR c_wszTrace[] = L"t " SZ_MODULEW L" "; +WCHAR const FAR c_wszAssertFailed[] = SZ_MODULEW L" Assertion failed in %s on line %d\r\n"; + +#endif // WINNT + +CHAR const FAR c_szNewline[] = "\r\n"; +CHAR const FAR c_szTrace[] = "t " SZ_MODULEA " "; +CHAR const FAR c_szAssertFailed[] = SZ_MODULEA " Assertion failed in %s on line %d\r\n"; + +#pragma data_seg() + + +#endif // !defined(NODEBUGHELP) && defined(DEBUG) + +#endif __ROVDBG_H__ diff --git a/private/unimodem/inc/rovdi.h b/private/unimodem/inc/rovdi.h new file mode 100644 index 000000000..66be0a0ed --- /dev/null +++ b/private/unimodem/inc/rovdi.h @@ -0,0 +1,292 @@ +// +// Copyright (c) Microsoft Corporation 1993-1996 +// +// rovdi.h +// +// History: +// 11-13-95 ScottH Separated from NT modem class installer +// + +#ifndef __ROVDI_H__ +#define __ROVDI_H__ + +#ifdef WINNT + +#include + +//------------------------------------------------------------------------ +//------------------------------------------------------------------------ + +// +// Enumerate ports +// +DECLARE_HANDLE32(HPORTDATA); + +typedef BOOL (WINAPI FAR * ENUMPORTPROC)(HPORTDATA hportdata, LPARAM lParam); + +DWORD +APIENTRY +EnumeratePorts( + IN ENUMPORTPROC pfnDevice, + IN LPARAM lParam); OPTIONAL + + +typedef struct tagPORTDATA_A + { + DWORD cbSize; + DWORD nSubclass; + CHAR szPort[MAX_BUF]; + CHAR szFriendly[MAX_BUF]; + } PORTDATA_A, FAR * LPPORTDATA_A; + +typedef struct tagPORTDATA_W + { + DWORD cbSize; + DWORD nSubclass; + WCHAR szPort[MAX_BUF]; + WCHAR szFriendly[MAX_BUF]; + } PORTDATA_W, FAR * LPPORTDATA_W; +#ifdef UNICODE +#define PORTDATA PORTDATA_W +#define LPPORTDATA LPPORTDATA_W +#else +#define PORTDATA PORTDATA_A +#define LPPORTDATA LPPORTDATA_A +#endif + +// Port subclass values +#define PORT_SUBCLASS_PARALLEL 0 +#define PORT_SUBCLASS_SERIAL 1 + + +BOOL +APIENTRY +PortData_GetPropertiesW( + IN HPORTDATA hportdata, + OUT LPPORTDATA_W pdataBuf); +BOOL +APIENTRY +PortData_GetPropertiesA( + IN HPORTDATA hportdata, + OUT LPPORTDATA_A pdataBuf); +#ifdef UNICODE +#define PortData_GetProperties PortData_GetPropertiesW +#else +#define PortData_GetProperties PortData_GetPropertiesA +#endif + + +// +// These set of routines map friendly names of ports to +// (non-friendly) port names, and vice-versa. +// + +DECLARE_HANDLE32(HPORTMAP); + +BOOL +APIENTRY +PortMap_Create( + OUT HPORTMAP FAR * phportmap); + +DWORD +APIENTRY +PortMap_GetCount( + IN HPORTMAP hportmap); + +BOOL +APIENTRY +PortMap_GetFriendlyW( + IN HPORTMAP hportmap, + IN LPCWSTR pwszPortName, + OUT LPWSTR pwszBuf, + IN DWORD cchBuf); +BOOL +APIENTRY +PortMap_GetFriendlyA( + IN HPORTMAP hportmap, + IN LPCSTR pszPortName, + OUT LPSTR pszBuf, + IN DWORD cchBuf); +#ifdef UNICODE +#define PortMap_GetFriendly PortMap_GetFriendlyW +#else +#define PortMap_GetFriendly PortMap_GetFriendlyA +#endif + + +BOOL +APIENTRY +PortMap_GetPortNameW( + IN HPORTMAP hportmap, + IN LPCWSTR pwszFriendly, + OUT LPWSTR pwszBuf, + IN DWORD cchBuf); +BOOL +APIENTRY +PortMap_GetPortNameA( + IN HPORTMAP hportmap, + IN LPCSTR pszFriendly, + OUT LPSTR pszBuf, + IN DWORD cchBuf); +#ifdef UNICODE +#define PortMap_GetPortName PortMap_GetPortNameW +#else +#define PortMap_GetPortName PortMap_GetPortNameA +#endif + +BOOL +APIENTRY +PortMap_Free( + IN HPORTMAP hportmap); + + +//----------------------------------------------------------------------------------- +// Wrappers to insulate us a little bit if we need it. We need it. +//----------------------------------------------------------------------------------- + +#define CplDiCreateDeviceInfoList SetupDiCreateDeviceInfoList +#define CplDiGetDeviceInfoListClass SetupDiGetDeviceInfoListClass +#define CplDiCreateDeviceInfo SetupDiCreateDeviceInfo +#define CplDiOpenDeviceInfo SetupDiOpenDeviceInfo +#define CplDiGetDeviceInstanceId SetupDiGetDeviceInstanceId +#define CplDiDeleteDeviceInfo SetupDiDeleteDeviceInfo +#define CplDiEnumDeviceInfo SetupDiEnumDeviceInfo +#define CplDiDestroyDeviceInfoList SetupDiDestroyDeviceInfoList +#define CplDiRegisterDeviceInfo SetupDiRegisterDeviceInfo +#define CplDiBuildDriverInfoList SetupDiBuildDriverInfoList +#define CplDiEnumDriverInfo SetupDiEnumDriverInfo +#define CplDiGetSelectedDriver SetupDiGetSelectedDriver +#define CplDiSetSelectedDriver SetupDiSetSelectedDriver +#define CplDiGetDriverInfoDetail SetupDiGetDriverInfoDetail +#define CplDiDestroyDriverInfoList SetupDiDestroyDriverInfoList +#define CplDiGetClassDevs SetupDiGetClassDevs +#define CplDiGetClassDescription SetupDiGetClassDescription +#define CplDiOpenClassRegKey SetupDiOpenClassRegKey +#define CplDiCreateDevRegKey SetupDiCreateDevRegKey +#define CplDiOpenDevRegKey SetupDiOpenDevRegKey +#define CplDiGetHwProfileList SetupDiGetHwProfileList +#define CplDiGetDeviceRegistryProperty SetupDiGetDeviceRegistryProperty +#define CplDiSetDeviceRegistryProperty SetupDiSetDeviceRegistryProperty +#define CplDiGetClassInstallParams SetupDiGetClassInstallParams +#define CplDiSetClassInstallParams SetupDiSetClassInstallParams +#define CplDiGetDeviceInstallParams SetupDiGetDeviceInstallParams +#define CplDiSetDeviceInstallParams SetupDiSetDeviceInstallParams +#define CplDiGetDriverInstallParams SetupDiGetDriverInstallParams +#define CplDiSetDriverInstallParams SetupDiSetDriverInstallParams +#define CplDiClassNameFromGuid SetupDiClassNameFromGuid +#define CplDiClassGuidsFromName SetupDiClassGuidsFromName +#define CplDiGetHwProfileFriendlyName SetupDiGetHwProfileFriendlyName +#define CplDiGetWizardPage SetupDiGetWizardPage +#define CplDiGetSelectedDevice SetupDiGetSelectedDevice +#define CplDiSetSelectedDevice SetupDiSetSelectedDevice +#define CplDiInstallDevice SetupDiInstallDevice +#define CplDiCallClassInstaller SetupDiCallClassInstaller +#define CplDiRemoveDevice SetupDiRemoveDevice +#define CplDiGetActualSectionToInstall SetupDiGetActualSectionToInstall + + +// Private modem properties structure +typedef struct tagMODEM_PRIV_PROP + { + DWORD cbSize; + DWORD dwMask; + TCHAR szFriendlyName[MAX_BUF_REG]; + DWORD nDeviceType; + TCHAR szPort[MAX_BUF_REG]; + } MODEM_PRIV_PROP, FAR * PMODEM_PRIV_PROP; + +// Mask bitfield for MODEM_PRIV_PROP +#define MPPM_FRIENDLY_NAME 0x00000001 +#define MPPM_DEVICE_TYPE 0x00000002 +#define MPPM_PORT 0x00000004 + +BOOL +PUBLIC +CplDiGetPrivateProperties( + IN HDEVINFO hdi, + IN PSP_DEVINFO_DATA pdevData, + OUT PMODEM_PRIV_PROP pmpp); + +// These ordinal values are bus types for CplDiGetBusType +#define BUS_TYPE_ROOT 1 +#define BUS_TYPE_PCMCIA 2 +#define BUS_TYPE_SERENUM 3 +#define BUS_TYPE_LPTENUM 4 +#define BUS_TYPE_OTHER 5 + +BOOL +PUBLIC +CplDiGetBusType( + IN HDEVINFO hdi, + IN PSP_DEVINFO_DATA pdevData, OPTIONAL + OUT LPDWORD pdwBusType); + + +// Functions to support common device Responses key: + +// Common key flags for OpenCommonResponseskey() and OpenCommonDriverKey(). +typedef enum +{ + CKFLAG_OPEN = 0x0001, + CKFLAG_CREATE = 0x0002 + +} CKFLAGS; + + +BOOL +PUBLIC +OpenCommonDriverKey( + IN HKEY hkeyDrv, OPTIONAL + IN PSP_DRVINFO_DATA pdrvData, OPTIONAL + IN REGSAM samAccess, + OUT PHKEY phkeyComDrv); + + +BOOL +PUBLIC +OpenCommonResponsesKey( + IN HKEY hkeyDrv, + IN CKFLAGS ckFlags, + IN REGSAM samAccess, + OUT PHKEY phkeyResp, + OUT LPDWORD lpdwExisted); + + +BOOL +PUBLIC +OpenResponsesKey( + IN HKEY hkeyDrv, + OUT PHKEY phkeyResp); + + +BOOL +PUBLIC +FindCommonDriverKeyName( + IN HKEY hkeyDrv, + IN DWORD cbKeyName, + OUT LPTSTR pszKeyName); + + +BOOL +PUBLIC +GetCommonDriverKeyName( + IN HKEY hkeyDrv, OPTIONAL + IN PSP_DRVINFO_DATA pdrvData, OPTIONAL + IN DWORD cbKeyName, + OUT LPTSTR pszKeyName); + + +BOOL +PUBLIC +DeleteCommonDriverKey( + IN HKEY hkeyDrv); + + +BOOL +PUBLIC +DeleteCommonDriverKeyByName( + IN LPTSTR pszKeyName); + +#endif // WINNT + +#endif __ROVDI_H__ diff --git a/private/unimodem/inc/rovmem.h b/private/unimodem/inc/rovmem.h new file mode 100644 index 000000000..26b429c8e --- /dev/null +++ b/private/unimodem/inc/rovmem.h @@ -0,0 +1,297 @@ +// +// Copyright (c) Microsoft Corporation 1993-1995 +// +// rovmem.h +// +// Memory management functions. +// +// History: +// 09-27-94 ScottH Partially taken from commctrl +// 04-29-95 ScottH Taken from briefcase and cleaned up +// + +// This file is included by + +#ifndef _ROVMEM_H_ +#define _ROVMEM_H_ + +// +// Memory routines +// + +// +// Non-shared memory allocation +// + +// void * GAlloc(DWORD cbBytes) +// Alloc a chunk of memory, quickly, with no 64k limit on size of +// individual objects or total object size. Initialize to zero. +// +#define GAlloc(cbBytes) GlobalAlloc(GPTR, cbBytes) + +// void * GReAlloc(void * pv, DWORD cbNewSize) +// Realloc one of above. If pv is NULL, then this function will do +// an alloc for you. Initializes new portion to zero. +// +#define GReAlloc(pv, cbNewSize) GlobalReAlloc(pv, cbNewSize, GMEM_MOVEABLE | GMEM_ZEROINIT) + +// void GFree(void *pv) +// Free pv if it is nonzero. Set pv to zero. +// +#define GFree(pv) do { (pv) ? GlobalFree(pv) : (void)0; pv = NULL; } while (0) + +// DWORD GGetSize(void *pv) +// Get the size of a block allocated by Alloc() +// +#define GGetSize(pv) GlobalSize(pv) + +// type * GAllocType(type); (macro) +// Alloc some memory the size of and return pointer to . +// +#define GAllocType(type) (type FAR *)GAlloc(sizeof(type)) + +// type * GAllocArray(type, int cNum); (macro) +// Alloc an array of data the size of . +// +#define GAllocArray(type, cNum) (type FAR *)GAlloc(sizeof(type) * (cNum)) + +// type * GReAllocArray(type, void * pb, int cNum); +// +#define GReAllocArray(type, pb, cNum) (type FAR *)GReAlloc(pb, sizeof(type) * (cNum)) + +// (Re)allocates *ppszBuf and copies psz into *ppszBuf +// +BOOL +PUBLIC +SetStringW( + LPWSTR FAR * ppwszBuf, + LPCWSTR pwsz); +BOOL +PUBLIC +SetStringA( + LPSTR FAR * ppszBuf, + LPCSTR psz); +#ifdef UNICODE +#define SetString SetStringW +#else // UNICODE +#define SetString SetStringA +#endif // UNICODE + + +// (Re)allocates *ppszBuf and concatenates psz onto *ppszBuf +// +BOOL +PUBLIC +CatStringW( + IN OUT LPWSTR FAR * ppszBuf, + IN LPCWSTR psz); +BOOL +PUBLIC +CatStringA( + IN OUT LPSTR FAR * ppszBuf, + IN LPCSTR psz); +#ifdef UNICODE +#define CatString CatStringW +#else // UNICODE +#define CatString CatStringA +#endif // UNICODE + + +BOOL +PUBLIC +CatMultiStringW( + IN OUT LPWSTR FAR * ppszBuf, + IN LPCWSTR psz); +BOOL +PUBLIC +CatMultiStringA( + IN OUT LPSTR FAR * ppszBuf, + IN LPCSTR psz); +#ifdef UNICODE +#define CatMultiString CatMultiStringW +#else // UNICODE +#define CatMultiString CatMultiStringA +#endif // UNICODE + + +// +// Shared memory allocation functions. +// +#if !defined(NOSHAREDHEAP) && defined(WIN95) + +// SharedTerminate() must be called before the app/dll is terminated. +// +void PUBLIC SharedTerminate(); + +// PVOID SharedAlloc(DWORD cb); +// Alloc a chunk of memory, quickly, with no 64k limit on size of +// individual objects or total object size. Initialize to zero. +// +PVOID PUBLIC SharedAlloc(DWORD cb); + +// PVOID SharedReAlloc(PVOID pv, DWORD cb); +// Realloc one of above. If pb is NULL, then this function will do +// an alloc for you. Initializes new portion to zero. +// +PVOID PUBLIC SharedReAlloc(PVOID pv, DWORD cb); + +// void SharedFree(PVOID pv); +// If pv is nonzero, free it. Sets pv to zero. +// +void PUBLIC _SharedFree(PVOID pv); +#define SharedFree(pv) do { (pv) ? _SharedFree(pv) : (void)0; pv = NULL; } while (0) + +// DWORD SharedGetSize(PVOID pv); +// Get the size of a block allocated by Alloc() +// +DWORD PUBLIC SharedGetSize(PVOID pv); + + +// type * SharedAllocType(type); (macro) +// Alloc some memory the size of and return pointer to . +// +#define SharedAllocType(type) (type FAR *)SharedAlloc(sizeof(type)) + +// type * SharedAllocArray(type, int cNum); (macro) +// Alloc an array of data the size of . +// +#define SharedAllocArray(type, cNum) (type FAR *)SharedAlloc(sizeof(type) * (cNum)) + +// type * SharedReAllocArray(type, void * pb, int cNum); +// +#define SharedReAllocArray(type, pb, cNum) (type FAR *)SharedReAlloc(pb, sizeof(type) * (cNum)) + +// (Re)allocates *ppszBuf and copies psz into *ppszBuf +// +BOOL PUBLIC SharedSetString(LPTSTR FAR * ppszBuf, LPCTSTR psz); + +#else // NOSHAREDHEAP + +#define SharedAlloc(cbBytes) GAlloc(cbBytes) +#define SharedReAlloc(pv, cb) GReAlloc(pv, cb) +#define SharedFree(pv) GFree(pv) +#define SharedGetSize(pv) GGetSize(pv) +#define SharedAllocType(type) (type FAR *)SharedAlloc(sizeof(type)) +#define SharedAllocArray(type, cNum) (type FAR *)SharedAlloc(sizeof(type) * (cNum)) +#define SharedReAllocArray(type, pb, cNum) (type FAR *)SharedReAlloc(pb, sizeof(type) * (cNum)) +#define SharedSetString(ppszBuf, psz) SetString(ppszBuf, psz) + +#endif // NOSHAREDHEAP + + +#ifndef NODA +// +// Internal functions +// + +#ifdef WIN32 +// +// These macros are used in our controls, that in 32 bits we simply call +// LocalAlloc as to have the memory associated with the process that created +// it and as such will be cleaned up if the process goes away. +// + +LPVOID PUBLIC MemAlloc(HANDLE hheap, DWORD cb); +LPVOID PUBLIC MemReAlloc(HANDLE hheap, LPVOID pb, DWORD cb); +BOOL PUBLIC MemFree(HANDLE hheap, LPVOID pb); +DWORD PUBLIC MemSize(HANDLE hheap, LPVOID pb); + +#else // WIN32 + +// In 16 bit code we need the Allocs to go from our heap code as we do not +// want to limit them to 64K of data. If we have some type of notification of +// 16 bit application termination, We may want to see if we can +// dedicate different heaps for different processes to cleanup... + +#define MemAlloc(hheap, cb) Alloc(cb) /* calls to verify heap exists */ +#define MemReAlloc(hheap, pb, cb) ReAlloc(pb, cb) +#define MemFree(hheap, pb) Free(pb) +#define MemSize(hheap, pb) GetSize((LPCVOID)pb) + +#endif // WIN32 + + +// +// Structure Array +// +#define SA_ERR (-1) +#define SA_APPEND 0x7fffffff + +typedef struct _SA FAR * HSA; + +HSA PUBLIC SACreate(int cbItem, int cItemGrow, HANDLE hheap, DWORD dwFlags); + +// Flags for SACreate +#define SAF_DEFAULT 0x0000 +#define SAF_SHARED 0x0001 +#define SAF_HEAP 0x0002 + +BOOL PUBLIC SADestroy(HSA hsa); +BOOL PUBLIC SAGetItem(HSA hsa, int i, LPVOID pitem); +LPVOID PUBLIC SAGetItemPtr(HSA hsa, int i); +BOOL PUBLIC SASetItem(HSA hsa, int i, LPVOID pitem); +int PUBLIC SAInsertItem(HSA hsa, int i, LPVOID pitem); +BOOL PUBLIC SADeleteItem(HSA hsa, int i); +BOOL PUBLIC SADeleteAllItems(HSA hsa); +#define SAGetCount(hsa) (*(int FAR*)(hsa)) + +// +// Pointer Array +// +#define PA_ERR (-1) +#define PA_APPEND 0x7fffffff + +typedef struct _PA FAR * HPA; + +HPA PUBLIC PACreate(int cItemGrow, HANDLE hheap, DWORD dwFlags); + +// Flags for PACreate +#define PAF_DEFAULT 0x0000 +#define PAF_SHARED 0x0001 +#define PAF_HEAP 0x0002 + +typedef void (CALLBACK *PFNPAFREE)(LPVOID pv, LPARAM lParam); + +BOOL PUBLIC PADestroyEx(HPA hpa, PFNPAFREE pfnFree, LPARAM lParam); +#define PADestroy(hpa) PADestroyEx(hpa, NULL, 0) + +HPA PUBLIC PAClone(HPA hpa, HPA hpaNew); +LPVOID PUBLIC PAGetPtr(HPA hpa, int i); +int PUBLIC PAGetPtrIndex(HPA hpa, LPVOID p); +BOOL PUBLIC PAGrow(HPA pdpa, int cp); +BOOL PUBLIC PASetPtr(HPA hpa, int i, LPVOID p); +int PUBLIC PAInsertPtr(HPA hpa, int i, LPVOID p); +LPVOID PUBLIC PADeletePtr(HPA hpa, int i); +BOOL PUBLIC PADeleteAllPtrsEx(HPA hpa, PFNPAFREE pfnFree, LPARAM lParam); +#define PADeleteAllPtrs(hpa) PADeleteAllPtrsEx(hpa, NULL, 0) +#define PAGetCount(hpa) (*(int FAR*)(hpa)) +#define PAGetPtrPtr(hpa) (*((LPVOID FAR* FAR*)((BYTE FAR*)(hpa) + sizeof(int)))) +#define PAFastGetPtr(hpa, i) (PAGetPtrPtr(hpa)[i]) + +typedef int (CALLBACK *PFNPACOMPARE)(LPVOID p1, LPVOID p2, LPARAM lParam); + +BOOL PUBLIC PASort(HPA hpa, PFNPACOMPARE pfnCompare, LPARAM lParam); + +// Search array. If PAS_SORTED, then array is assumed to be sorted +// according to pfnCompare, and binary search algorithm is used. +// Otherwise, linear search is used. +// +// Searching starts at iStart (0 to start search at beginning). +// +// PAS_INSERTBEFORE/AFTER govern what happens if an exact match is not +// found. If neither are specified, this function returns -1 if no exact +// match is found. Otherwise, the index of the item before or after the +// closest (including exact) match is returned. +// +// Search option flags +// +#define PAS_SORTED 0x0001 +#define PAS_INSERTBEFORE 0x0002 +#define PAS_INSERTAFTER 0x0004 + +int PUBLIC PASearch(HPA hpa, LPVOID pFind, int iStart, + PFNPACOMPARE pfnCompare, + LPARAM lParam, UINT options); +#endif // NODA + +#endif // _ROVMEM_H_ diff --git a/private/unimodem/inc/slot.h b/private/unimodem/inc/slot.h new file mode 100644 index 000000000..a8ea4fbe9 --- /dev/null +++ b/private/unimodem/inc/slot.h @@ -0,0 +1,32 @@ +//**************************************************************************** +// +// Module: UNIMDM +// File: SLOT.H +// +// Copyright (c) 1992-1996, Microsoft Corporation, all rights reserved +// +// Revision History +// +// +// 3/25/96 JosephJ Created +// +// +// Description: Interface to the unimodem TSP notification mechanism: +// The lower level (notifXXXX) APIs +// +//**************************************************************************** + +#define MAX_NOTIFICATION_NAME_SIZE 256 + + +typedef DWORD HNOTIFICATION; + +HNOTIFICATION notifCreate(BOOL fServer, LPCTSTR lptszName, DWORD dwMaxSize, + DWORD dwMaxPending); +void notifFree(HNOTIFICATION hn); + +HANDLE notifGetObj(HNOTIFICATION hn); +DWORD notifGetMaxSize(HNOTIFICATION hn); +BOOL notifReadMsg(HNOTIFICATION hn, LPBYTE lpb, DWORD dwcb, LPDWORD lpdwRead); +BOOL notifGetNextMsgSize(HNOTIFICATION hn, LPDWORD lpdwcb); +BOOL notifWriteMsg(HNOTIFICATION hn, LPBYTE lpb, DWORD dwcb); diff --git a/private/unimodem/inc/tspnotif.h b/private/unimodem/inc/tspnotif.h new file mode 100644 index 000000000..a8dec23c7 --- /dev/null +++ b/private/unimodem/inc/tspnotif.h @@ -0,0 +1,62 @@ +//**************************************************************************** +// +// Module: UNIMDM +// File: TSPNOTIF.H +// +// Copyright (c) 1992-1996, Microsoft Corporation, all rights reserved +// +// Revision History +// +// +// 3/25/96 JosephJ Created +// +// +// Description: Interface to the Unimodem TSP notification mechanism: +// the UnimodemNotifyTSP function, and related typedefs... +// UnimodemNotifyTSP is private export of the tsp. +// +//**************************************************************************** +#ifndef _TSPNOTIF_H_ + +#define _TSPNOTIF_H_ + +#define SLOTNAME_UNIMODEM_NOTIFY_TSP TEXT("UnimodemNotifyTSP") +#define dwNFRAME_SIG (0x8cb45651L) +#define MAX_NOTIFICATION_FRAME_SIZE 512 + + +//------------------- Types of notifications -------------------- + +#define TSPNOTIF_TYPE_CPL 0x1000 // Modem CPL Event Notification + +#define TSPNOTIF_TYPE_DEBUG 0x2000 // DEBUG Event Notification + +//------------------- Common flags ------------------------------ +#define fTSPNOTIF_FLAG_UNICODE (0x1L<<31) // If set, all embedded text is + // in UNICODE. + + +#define TSP_VALID_FRAME(_frame) ((_frame)->dwSig==dwNFRAME_SIG) +#define TSP_DEBUG_FRAME(_frame) ((_frame)->dwType==TSPNOTIF_TYPE_DEBUG) +#define TSP_CPL_FRAME(_frame) ((_frame)->dwType==TSPNOTIF_TYPE_CPL) + +// The basic frame used to send data to the TSP +typedef struct +{ + DWORD dwSig; // MUST be dwNFRAME_SIG + DWORD dwSize; // Entire size of this structure + DWORD dwType; // One of the TSPNOTIF_TYPE_ constants + DWORD dwFlags; // Zero or more fTSPNOTIF_FLAGS_ constants + BYTE rgb[]; // Type-dependant data +} NOTIFICATION_FRAME, *PNOTIFICATION_FRAME; + +// --------- CPL Notification Structure --------------------- +#define fTSPNOTIF_FLAG_CPL_REENUM 0x1 +#define fTSPNOTIF_FLAG_CPL_DEFAULT_COMMCONFIG_CHANGE 0x2 + + +// The top-level client-side api to send a notification to the TSP +// If it returns FALSE, GetLastError() will report the reason for failure. +BOOL WINAPI UnimodemNotifyTSP(PNOTIFICATION_FRAME pnf); + +#endif // _TSPNOTIF_H_ -- cgit v1.2.3