mmddk.h

来自「用于查询PC机上的USB端口是否有设备挂接上」· C头文件 代码 · 共 916 行 · 第 1/3 页

H
916
字号
/*==========================================================================;
 *
 *  mmddk.h -- Include file for Multimedia Device Development
 *
 *  Version 4.00
 *
 *  Copyright (C) 1992-1995 Microsoft Corporation.  All rights reserved.
 *
 *--------------------------------------------------------------------------;
 *  Note: You must include the WINDOWS.H and MMSYSTEM.H header files
 *        before including this file.
 *
 *  Define:         Prevent inclusion of:
 *  --------------  --------------------------------------------------------
 *  MMNOMIDIDEV     MIDI support
 *  MMNOWAVEDEV     Waveform support
 *  MMNOAUXDEV      Auxiliary output support
 *  MMNOMIXERDEV    Mixer support
 *  MMNOTIMERDEV    Timer support
 *  MMNOJOYDEV      Joystick support
 *  MMNOMCIDEV      MCI support
 *  MMNOTASKDEV     Task support
 *
 *==========================================================================;
 */

/*XLATOFF*/							/* ;Internal*/
#if 0								/* ;BeginInternal*/
/* Used to create the INC version of the struct */
/*XLATON*/
typedef struct OFFSEL {
	WORD	Off;
	WORD	Sel;
} OFFSEL;
typedef struct LOHI {
	WORD	Lo;
	WORD	Hi;
} LOHI;
/*XLATOFF*/
#endif								/* ;EndInternal*/


#ifndef _INC_MMDDK
#define _INC_MMDDK   /* #defined if mmddk.h has been included */

#ifndef RC_INVOKED
#pragma pack(1)         /* Assume byte packing throughout */
#endif

#ifdef __cplusplus
extern "C" {            /* Assume C declarations for C++ */
#endif  /* __cplusplus */

/***************************************************************************

                       Helper functions for drivers

***************************************************************************/

#ifdef _WIN32

#ifndef NODRIVERS
#define DRV_LOAD                0x0001
#define DRV_ENABLE              0x0002
#define DRV_OPEN                0x0003
#define DRV_CLOSE               0x0004
#define DRV_DISABLE             0x0005
#define DRV_FREE                0x0006
#define DRV_CONFIGURE           0x0007
#define DRV_QUERYCONFIGURE      0x0008
#define DRV_INSTALL             0x0009
#define DRV_REMOVE              0x000A

#define DRV_RESERVED            0x0800
#define DRV_USER                0x4000

#define DRIVERS_SECTION  TEXT("DRIVERS32")     // Section name for installed drivers
#define MCI_SECTION      TEXT("MCI32")         // Section name for installed MCI drivers

#ifndef _WIN32_VXD
WINMMAPI LRESULT   WINAPI DefDriverProc(DWORD dwDriverIdentifier, HDRVR hdrvr, UINT uMsg, LPARAM lParam1, LPARAM lParam2);
#endif
#endif /* !NODRIVERS */

#endif /* ifdef _WIN32 */

#if (WINVER < 0x0400)
#define DCB_NOSWITCH   0x0008           /* obsolete switch */
#endif
/*XLATON*/							/* ;Internal*/
#define DCB_TYPEMASK   0x0007           /* callback type mask */
#define DCB_NULL       0x0000           /* unknown callback type */

/* flags for wFlags parameter of DriverCallback() */
#define DCB_WINDOW     0x0001           /* dwCallback is a HWND */
#define DCB_TASK       0x0002           /* dwCallback is a HTASK */
#define DCB_FUNCTION   0x0003           /* dwCallback is a FARPROC */
#define DCB_THUNK      0x0004           /* dwCallback is a 16->32 thunk */ /* ;Internal */
#define DCB_EVENT      0x0005           /* dwCallback is an EVENT */
#define DCB_EVENT16    0x0006           /* dwCallback is an EVENT under Win16 */ /* ;Internal */

/*XLATOFF*/							/* ;Internal*/
#ifndef _WIN32_VXD
WINMMAPI BOOL WINAPI DriverCallback(DWORD dwCallback, UINT uFlags,
    HANDLE hDevice, UINT uMessage, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
#endif

#if (WINVER < 0x0400)
void WINAPI StackEnter(void);
void WINAPI StackLeave(void);
#endif

/* generic prototype for audio device driver entry-point functions */
/* midMessage(), modMessage(), widMessage(), wodMessage(), auxMessage() */
#ifndef _WIN32_VXD
typedef DWORD (CALLBACK SOUNDDEVMSGPROC)(UINT uDeviceID, UINT uMessage,
    DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
typedef SOUNDDEVMSGPROC FAR *LPSOUNDDEVMSGPROC;
#endif

/* 
 * Message sent by mmsystem to media specific entry points when it first
 * initializes the drivers, and when they are closed.
 */

/*XLATON*/							/* ;Internal*/
#define DRVM_INIT               0x64
#define DRVM_EXIT		0x65
/*XLATOFF*/							/* ;Internal*/

#if (WINVER >= 0x0400)

#define	DRVM_DISABLE		0x66
#define	DRVM_ENABLE		0x67

// messages that have IOCTL format
//    dw1 = NULL or handle
//    dw2 = NULL or ptr to DRVM_IOCTL_DATA
//    return is MMRESULT
//
#define DRVM_IOCTL                0x100
#define DRVM_ADD_THRU             (DRVM_IOCTL+1)
#define DRVM_REMOVE_THRU          (DRVM_IOCTL+2)
#define DRVM_IOCTL_LAST           (DRVM_IOCTL+5)

typedef struct {
    DWORD  dwSize; // size of this structure (inclusive)
    DWORD  dwCmd;  // IOCTL command code, 0x80000000 and above reserved for system
    } DRVM_IOCTL_DATA, FAR * LPDRVM_IOCTL_DATA;

// command code ranges for dwCmd field of DRVM_IOCTL message
// codes from 0 to 0x7FFFFFFF are user defined
// codes from 0x80000000 to 0xFFFFFFFF are reserved for future
// definition by microsoft
//
#define DRVM_IOCTL_CMD_USER   0x00000000L
#define DRVM_IOCTL_CMD_SYSTEM 0x80000000L
//

// message base for driver specific messages.
// 
/*XLATON*/							/* ;Internal*/
#define DRVM_MAPPER             0x2000
#define DRVM_USER               0x4000
/*XLATOFF*/							/* ;Internal*/
#define DRVM_MAPPER_STATUS              (DRVM_MAPPER+0)
#define	DRVM_MAPPER_RECONFIGURE	        (DRVM_MAPPER+1)
#define	DRVM_MAPPER_QUERYDEST	        (DRVM_MAPPER+20)        /* ;Internal*/
#define DRVM_MAPPER_PREFERRED_GET       (DRVM_MAPPER+21)
#define DRVM_MAPPER_PREFERRED_SET       (DRVM_MAPPER+22)        /* ;Internal */
#define DRVM_MAPPER_CONSOLEVOICECOM_GET (DRVM_MAPPER+23)
#define DRVM_MAPPER_CONSOLEVOICECOM_SET (DRVM_MAPPER+24)        /* ;Internal */

#ifndef _WIN32
#define DRV_QUERYDRVENTRY    (DRV_RESERVED + 1)
#define DRV_QUERYDEVNODE     (DRV_RESERVED + 2)
#define DRV_QUERYNAME        (DRV_RESERVED + 3)
#define DRV_QUERYDRIVERIDS   (DRV_RESERVED + 4)
#define DRV_QUERYMAPPABLE    (DRV_RESERVED + 5)
#else								/* ;Internal*/
#define DRV_QUERYDRVENTRY    (DRV_RESERVED + 1)			/* ;Internal*/
#define DRV_QUERYDEVNODE     (DRV_RESERVED + 2)			/* ;Internal*/
#define DRV_QUERYNAME        (DRV_RESERVED + 3)			/* ;Internal*/
#define DRV_QUERYDRIVERIDS   (DRV_RESERVED + 4)			/* ;Internal*/
#define DRV_QUERYMAPPABLE    (DRV_RESERVED + 5)			/* ;Internal*/
#endif

//
// DRVM_MAPPER_PREFERRED_GET flags
//
#define DRVM_MAPPER_PREFERRED_FLAGS_PREFERREDONLY   0x00000001

#define	DRV_F_ADD	0x00000000
#define	DRV_F_REMOVE	0x00000001
#define	DRV_F_CHANGE	0x00000002
#define DRV_F_PROP_INSTR 0x00000004
#define DRV_F_NEWDEFAULTS 0x00000008
#define DRV_F_PARAM_IS_DEVNODE 0x10000000
#endif

/* PnP version of media device caps */
typedef struct {
    DWORD	cbSize;
    LPVOID	pCaps;
} MDEVICECAPSEX;

/*XLATON*/							/* ;Internal*/
#ifndef MMNOWAVEDEV
/****************************************************************************
 
                       Waveform device driver support
 
****************************************************************************/

/* maximum number of wave device drivers loaded */
#define MAXWAVEDRIVERS          10
/*XLATOFF*/							/* ;Internal*/

#if 0								/* ;BeginInternal*/
/* Used to create the INC version of the struct */
/*XLATON*/
typedef struct WAVEOPENDESC {
	WORD	wod_hWave;
	DWORD	wod_lpFormat;
	DWORD	wod_dwCallback;
	DWORD	wod_dwInstance;
	WORD	wod_uMappedDeviceID;
	DWORD	wod_dnDevNode;
} WAVEOPENDESC;
/*XLATOFF*/
#endif								/* ;EndInternal*/

/* waveform input and output device open information structure */
typedef struct waveopendesc_tag {
    HWAVE          hWave;             /* handle */
    const WAVEFORMATEX FAR* lpFormat; /* format of wave data */
    DWORD          dwCallback;        /* callback */
    DWORD          dwInstance;        /* app's private instance information */
    UINT           uMappedDeviceID;   /* device to map to if WAVE_MAPPED set */
    DWORD          dnDevNode;         /* if device is PnP */
} WAVEOPENDESC;
typedef WAVEOPENDESC FAR *LPWAVEOPENDESC;

/*XLATON*/							/* ;Internal*/
#define WODM_USER               DRVM_USER
#define WIDM_USER               DRVM_USER
#define WODM_MAPPER             DRVM_MAPPER
#define WIDM_MAPPER             DRVM_MAPPER

#define WODM_INIT               DRVM_INIT
#define WIDM_INIT               DRVM_INIT

/* messages sent to wodMessage() entry-point function */
#define WODM_GETNUMDEVS         3
#define WODM_GETDEVCAPS         4
#define WODM_OPEN               5
#define WODM_CLOSE              6
#define WODM_PREPARE            7
#define WODM_UNPREPARE          8
#define WODM_WRITE              9
#define WODM_PAUSE              10
#define WODM_RESTART            11
#define WODM_RESET              12 
#define WODM_GETPOS             13
#define WODM_GETPITCH           14
#define WODM_SETPITCH           15
#define WODM_GETVOLUME          16
#define WODM_SETVOLUME          17
#define WODM_GETPLAYBACKRATE    18
#define WODM_SETPLAYBACKRATE    19
#define WODM_BREAKLOOP          20
#define WODM_PREFERRED          21
/*XLATOFF*/							/* ;Internal*/
#if (WINVER >= 0x0400)
#define WODM_MAPPER_STATUS              (DRVM_MAPPER_STATUS + 0)
#define WAVEOUT_MAPPER_STATUS_DEVICE    0
#define WAVEOUT_MAPPER_STATUS_MAPPED    1
#define WAVEOUT_MAPPER_STATUS_FORMAT    2
#endif

/*XLATON*/							/* ;Internal*/
/* messages sent to widMessage() entry-point function */
#define WIDM_GETNUMDEVS         50
#define WIDM_GETDEVCAPS         51
#define WIDM_OPEN               52
#define WIDM_CLOSE              53
#define WIDM_PREPARE            54
#define WIDM_UNPREPARE          55
#define WIDM_ADDBUFFER          56
#define WIDM_START              57
#define WIDM_STOP               58
#define WIDM_RESET              59
#define WIDM_GETPOS             60
#define WIDM_PREFERRED          61
/*XLATOFF*/							/* ;Internal*/
#if (WINVER >= 0x0400)
#define WIDM_MAPPER_STATUS              (DRVM_MAPPER_STATUS + 0)
#define WAVEIN_MAPPER_STATUS_DEVICE     0
#define WAVEIN_MAPPER_STATUS_MAPPED     1
#define WAVEIN_MAPPER_STATUS_FORMAT     2
#endif
/*XLATON*/							/* ;Internal*/
#endif  /*ifndef MMNOWAVEDEV */


#ifndef MMNOMIDIDEV

⌨️ 快捷键说明

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