From d8df789e1aab81eeca835f989bbd91423aa17b9d Mon Sep 17 00:00:00 2001 From: Ian Pickering Date: Wed, 10 May 2017 16:30:05 -0500 Subject: [PATCH 01/10] Add MCI commands --- lib/winmm/src/lib.rs | 9 +++++ src/winmm.rs | 88 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 src/winmm.rs diff --git a/lib/winmm/src/lib.rs b/lib/winmm/src/lib.rs index f61ff0088..044a86faf 100644 --- a/lib/winmm/src/lib.rs +++ b/lib/winmm/src/lib.rs @@ -122,4 +122,13 @@ extern "system" { pub fn midiInReset(hMidiIn: HMIDIIN) -> MMRESULT; pub fn midiInGetID(hmi: HMIDIIN, puDeviceID: LPUINT) -> MMRESULT; pub fn midiInMessage(deviceID: HMIDIIN, msg: UINT, dw1: DWORD_PTR, dw2: DWORD_PTR) -> MMRESULT; + pub fn mciExecute(pszCommand: LPCSTR) -> BOOL; + pub fn mciGetCreatorTask(IDDevice: MCIDEVICEID) -> MMRESULT; + pub fn mciGetDeviceID(lpszDevice: LPCTSTR) -> MCIDEVICEID; + pub fn mciGetDeviceIDFromElementID(dwElementID: DWORD, lpstrType: LPCTSTR) -> MCIDEVICEID; + pub fn mciGetErrorString(fdwError: DWORD, lpszErrorText: LPTSTR, cchErrorText: UINT) -> BOOL; + pub fn mciGetYieldProc(IDDevice: MCIDEVICEID, lpdwYieldData: LPDWORD) -> YIELDPROC; + pub fn mciSendCommand(IDDevice: MCIDEVICEID, uMsg: UINT, fdwCommand: DWORD_PTR, dwParam: DWORD_PTR) -> MCIERROR; + pub fn mciSendString(lpszCommand: LPCTSTR, lpszReturnString: LPTSTR, cchReturn: UINT, hwndCallback: HANDLE) -> MCIERROR; + pub fn mciSetYieldProc(IDDevice: MCIDEVICEID, yp: YIELDPROC, dwYieldData: DWORD) -> UINT; } diff --git a/src/winmm.rs b/src/winmm.rs new file mode 100644 index 000000000..be769c7ef --- /dev/null +++ b/src/winmm.rs @@ -0,0 +1,88 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module contains definitions for use with WinMM. + +pub type MCIDEVICEID = ::UINT; +pub type MCIERROR = ::DWORD; +pub type YIELDPROC = ::DWORD; + +pub const MCIERR_NO_ERROR: DWORD = 0; +pub const MCIERR_UNRECOGNIZED_KEYWORD: DWORD = 259; +pub const MCIERR_UNRECOGNIZED_COMMAND: DWORD = 261; +pub const MCIERR_HARDWARE: DWORD = 262; +pub const MCIERR_INVALID_DEVICE_NAME: DWORD = 263; +pub const MCIERR_OUT_OF_MEMORY: DWORD = 264; +pub const MCIERR_DEVICE_OPEN: DWORD = 265; +pub const MCIERR_CANNOT_LOAD_DRIVER: DWORD = 266; +pub const MCIERR_MISSING_COMMAND_STRING: DWORD = 267; +pub const MCIERR_PARAM_OVERFLOW: DWORD = 268; +pub const MCIERR_MISSING_STRING_ARGUMENT: DWORD = 269; +pub const MCIERR_BAD_INTEGER: DWORD = 270; +pub const MCIERR_PARSER_INTERNAL: DWORD = 271; +pub const MCIERR_DRIVER_INTERNAL: DWORD = 272; +pub const MCIERR_MISSING_PARAMETER: DWORD = 273; +pub const MCIERR_UNSUPPORTED_FUNCTION: DWORD = 274; +pub const MCIERR_FILE_NOT_FOUND: DWORD = 275; +pub const MCIERR_DEVICE_NOT_READY: DWORD = 276; +pub const MCIERR_INTERNAL: DWORD = 277; +pub const MCIERR_DRIVER: DWORD = 278; +pub const MCIERR_CANNOT_USE_ALL: DWORD = 279; +pub const MCIERR_MULTIPLE: DWORD = 280; +pub const MCIERR_EXTENSION_NOT_FOUND: DWORD = 281; +pub const MCIERR_OUTOFRANGE: DWORD = 282; +pub const MCIERR_FLAGS_NOT_COMPATIBLE: DWORD = 284; +pub const MCIERR_FILE_NOT_SAVED: DWORD = 286; +pub const MCIERR_DEVICE_TYPE_REQUIRED: DWORD = 287; +pub const MCIERR_DEVICE_LOCKED: DWORD = 288; +pub const MCIERR_DUPLICATE_ALIAS: DWORD = 289; +pub const MCIERR_BAD_CONSTANT: DWORD = 290; +pub const MCIERR_MUST_USE_SHAREABLE: DWORD = 291; +pub const MCIERR_MISSING_DEVICE_NAME: DWORD = 292; +pub const MCIERR_BAD_TIME_FORMAT: DWORD = 293; +pub const MCIERR_NO_CLOSING_QUOTE: DWORD = 294; +pub const MCIERR_DUPLICATE_FLAGS: DWORD = 295; +pub const MCIERR_INVALID_FILE: DWORD = 296; +pub const MCIERR_NULL_PARAMETER_BLOCK: DWORD = 297; +pub const MCIERR_UNNAMED_RESOURCE: DWORD = 298; +pub const MCIERR_NEW_REQUIRES_ALIAS: DWORD = 299; +pub const MCIERR_NOTIFY_ON_AUTO_OPEN: DWORD = 300; +pub const MCIERR_NO_ELEMENT_ALLOWED: DWORD = 301; +pub const MCIERR_NONAPPLICABLE_FUNCTION: DWORD = 302; +pub const MCIERR_ILLEGAL_FOR_AUTO_OPEN: DWORD = 303; +pub const MCIERR_FILENAME_REQUIRED: DWORD = 304; +pub const MCIERR_EXTRA_CHARACTERS: DWORD = 305; +pub const MCIERR_DEVICE_NOT_INSTALLED: DWORD = 306; +pub const MCIERR_GET_CD: DWORD = 307; +pub const MCIERR_SET_CD: DWORD = 308; +pub const MCIERR_SET_DRIVE: DWORD = 309; +pub const MCIERR_DEVICE_LENGTH: DWORD = 310; +pub const MCIERR_DEVICE_ORD_LENGTH: DWORD = 311; +pub const MCIERR_NO_INTEGER: DWORD = 312; +pub const MCIERR_WAVE_OUTPUTSINUSE: DWORD = 320; +pub const MCIERR_WAVE_SETOUTPUTINUSE: DWORD = 321; +pub const MCIERR_WAVE_INPUTSINUSE: DWORD = 322; +pub const MCIERR_WAVE_SETINPUTINUSE: DWORD = 323; +pub const MCIERR_WAVE_OUTPUTUNSPECIFIED: DWORD = 324; +pub const MCIERR_WAVE_INPUTUNSPECIFIED: DWORD = 325; +pub const MCIERR_WAVE_OUTPUTSUNSUITABLE: DWORD = 326; +pub const MCIERR_WAVE_SETOUTPUTUNSUITABLE: DWORD = 327; +pub const MCIERR_WAVE_INPUTSUNSUITABLE: DWORD = 328; +pub const MCIERR_WAVE_SETINPUTUNSUITABLE: DWORD = 329; +pub const MCIERR_SEQ_DIV_INCOMPATIBLE: DWORD = 336; +pub const MCIERR_SEQ_PORT_INUSE: DWORD = 337; +pub const MCIERR_SEQ_PORT_NONEXISTENT: DWORD = 338; +pub const MCIERR_SEQ_PORT_MAPNODEVICE: DWORD = 339; +pub const MCIERR_SEQ_PORT_MISCERROR: DWORD = 340; +pub const MCIERR_SEQ_TIMER: DWORD = 341; +pub const MCIERR_SEQ_PORTUNSPECIFIED: DWORD = 342; +pub const MCIERR_SEQ_NOMIDIPRESENT: DWORD = 343; +pub const MCIERR_NO_WINDOW: DWORD = 346; +pub const MCIERR_CREATEWINDOW: DWORD = 347; +pub const MCIERR_FILE_READ: DWORD = 348; +pub const MCIERR_FILE_WRITE: DWORD = 349; +pub const MCIERR_NO_IDENTITY: DWORD = 350; +pub const MCIERR_CUSTOM_DRIVER_BASE: DWORD = 512; From 2705bd071eded91873a8a51edfc65f529c4a90fd Mon Sep 17 00:00:00 2001 From: Ian Pickering Date: Wed, 10 May 2017 17:50:07 -0500 Subject: [PATCH 02/10] Put winmm bindings in undepreciated place --- Cargo.toml | 1 + build.rs | 3 +- src/um/mmsystem.rs | 485 ++++++++++++++++++++++++++++++++++++++++++++- src/winmm.rs | 88 -------- 4 files changed, 485 insertions(+), 92 deletions(-) delete mode 100644 src/winmm.rs diff --git a/Cargo.toml b/Cargo.toml index d3fca6760..95808b471 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -166,6 +166,7 @@ wingdi = [] wininet = [] winineti = [] winioctl = [] +winmm = [] winnt = [] winreg = [] winscard = [] diff --git a/build.rs b/build.rs index b6291fa08..bf46457d4 100644 --- a/build.rs +++ b/build.rs @@ -115,7 +115,7 @@ const DATA: &'static [(&'static str, &'static [&'static str], &'static [&'static ("minschannel", &["guiddef", "minwindef", "wincrypt", "winnt"], &[]), ("minwinbase", &["basetsd", "minwindef", "ntstatus", "winnt"], &[]), ("mmdeviceapi", &["guiddef", "minwindef", "propidl", "propsys", "unknwnbase", "winnt", "wtypes"], &[]), - ("mmsystem", &["basetsd", "minwindef", "mmreg", "winnt"], &[]), + ("mmsystem", &["basetsd", "imm", "minwindef", "mmreg", "ntdef", "winnt"], &[]), ("mscat", &["guiddef", "minwindef", "mssip", "wincrypt", "winnt"], &[]), ("mssip", &["guiddef", "minwindef", "mscat", "wincrypt", "winnt"], &[]), ("ncrypt", &["basetsd", "sspi"], &["ncrypt"]), @@ -152,6 +152,7 @@ const DATA: &'static [(&'static str, &'static [&'static str], &'static [&'static ("wininet", &["basetsd", "minwinbase", "minwindef", "ntdef", "windef", "winineti", "winnt"], &["wininet"]), ("winineti", &["minwindef"], &[]), ("winioctl", &["devpropdef", "minwindef", "winnt"], &[]), + ("winmm", &["basetsd", "minwindef", "winnt"], &["winmm"]), ("winnt", &["basetsd", "excpt", "guiddef", "minwindef"], &[]), ("winreg", &["basetsd", "minwinbase", "minwindef", "winnt"], &["advapi32"]), ("winscard", &["basetsd", "guiddef", "minwindef", "windef", "winnt"], &[]), diff --git a/src/um/mmsystem.rs b/src/um/mmsystem.rs index 07cbb4eb1..5ed8dd63e 100644 --- a/src/um/mmsystem.rs +++ b/src/um/mmsystem.rs @@ -5,10 +5,12 @@ // All files in the project carrying such notice may not be copied, modified, or distributed // except according to those terms. //! MM procedure declarations, constant definitions and macros -use shared::basetsd::DWORD_PTR; -use shared::minwindef::{BYTE, DWORD, UINT, WORD}; +use shared::basetsd::{DWORD_PTR, UINT_PTR}; +use shared::minwindef::{BOOL, BYTE, DWORD, LPBYTE, LPDWORD, LPWORD, UINT, WORD}; use shared::mmreg::WAVEFORMATEX; -use um::winnt::{LPSTR, WCHAR}; +use shared::ntdef::{LPCTSTR, LPTSTR}; +use um::imm::LPUINT; +use um::winnt::{LPCSTR, LPCWSTR, LPSTR, LPWSTR, PVOID, WCHAR}; //109 (Win 7 SDK) pub type MMVERSION = UINT; pub type MMRESULT = UINT; @@ -265,3 +267,480 @@ DECLARE_HANDLE!(HMIDISTRM, HMIDISTRM__); DECLARE_HANDLE!(HMIDI, HMIDI__); pub type LPHMIDISTRM = *mut HMIDISTRM; pub type LPHMIDI = *mut HMIDI; + +pub type MCIDEVICEID = UINT; +pub type MCIERROR = DWORD; +pub type YIELDPROC = DWORD; + +pub const MCIERR_NO_ERROR: DWORD = 0; +pub const MCIERR_UNRECOGNIZED_KEYWORD: DWORD = 259; +pub const MCIERR_UNRECOGNIZED_COMMAND: DWORD = 261; +pub const MCIERR_HARDWARE: DWORD = 262; +pub const MCIERR_INVALID_DEVICE_NAME: DWORD = 263; +pub const MCIERR_OUT_OF_MEMORY: DWORD = 264; +pub const MCIERR_DEVICE_OPEN: DWORD = 265; +pub const MCIERR_CANNOT_LOAD_DRIVER: DWORD = 266; +pub const MCIERR_MISSING_COMMAND_STRING: DWORD = 267; +pub const MCIERR_PARAM_OVERFLOW: DWORD = 268; +pub const MCIERR_MISSING_STRING_ARGUMENT: DWORD = 269; +pub const MCIERR_BAD_INTEGER: DWORD = 270; +pub const MCIERR_PARSER_INTERNAL: DWORD = 271; +pub const MCIERR_DRIVER_INTERNAL: DWORD = 272; +pub const MCIERR_MISSING_PARAMETER: DWORD = 273; +pub const MCIERR_UNSUPPORTED_FUNCTION: DWORD = 274; +pub const MCIERR_FILE_NOT_FOUND: DWORD = 275; +pub const MCIERR_DEVICE_NOT_READY: DWORD = 276; +pub const MCIERR_INTERNAL: DWORD = 277; +pub const MCIERR_DRIVER: DWORD = 278; +pub const MCIERR_CANNOT_USE_ALL: DWORD = 279; +pub const MCIERR_MULTIPLE: DWORD = 280; +pub const MCIERR_EXTENSION_NOT_FOUND: DWORD = 281; +pub const MCIERR_OUTOFRANGE: DWORD = 282; +pub const MCIERR_FLAGS_NOT_COMPATIBLE: DWORD = 284; +pub const MCIERR_FILE_NOT_SAVED: DWORD = 286; +pub const MCIERR_DEVICE_TYPE_REQUIRED: DWORD = 287; +pub const MCIERR_DEVICE_LOCKED: DWORD = 288; +pub const MCIERR_DUPLICATE_ALIAS: DWORD = 289; +pub const MCIERR_BAD_CONSTANT: DWORD = 290; +pub const MCIERR_MUST_USE_SHAREABLE: DWORD = 291; +pub const MCIERR_MISSING_DEVICE_NAME: DWORD = 292; +pub const MCIERR_BAD_TIME_FORMAT: DWORD = 293; +pub const MCIERR_NO_CLOSING_QUOTE: DWORD = 294; +pub const MCIERR_DUPLICATE_FLAGS: DWORD = 295; +pub const MCIERR_INVALID_FILE: DWORD = 296; +pub const MCIERR_NULL_PARAMETER_BLOCK: DWORD = 297; +pub const MCIERR_UNNAMED_RESOURCE: DWORD = 298; +pub const MCIERR_NEW_REQUIRES_ALIAS: DWORD = 299; +pub const MCIERR_NOTIFY_ON_AUTO_OPEN: DWORD = 300; +pub const MCIERR_NO_ELEMENT_ALLOWED: DWORD = 301; +pub const MCIERR_NONAPPLICABLE_FUNCTION: DWORD = 302; +pub const MCIERR_ILLEGAL_FOR_AUTO_OPEN: DWORD = 303; +pub const MCIERR_FILENAME_REQUIRED: DWORD = 304; +pub const MCIERR_EXTRA_CHARACTERS: DWORD = 305; +pub const MCIERR_DEVICE_NOT_INSTALLED: DWORD = 306; +pub const MCIERR_GET_CD: DWORD = 307; +pub const MCIERR_SET_CD: DWORD = 308; +pub const MCIERR_SET_DRIVE: DWORD = 309; +pub const MCIERR_DEVICE_LENGTH: DWORD = 310; +pub const MCIERR_DEVICE_ORD_LENGTH: DWORD = 311; +pub const MCIERR_NO_INTEGER: DWORD = 312; +pub const MCIERR_WAVE_OUTPUTSINUSE: DWORD = 320; +pub const MCIERR_WAVE_SETOUTPUTINUSE: DWORD = 321; +pub const MCIERR_WAVE_INPUTSINUSE: DWORD = 322; +pub const MCIERR_WAVE_SETINPUTINUSE: DWORD = 323; +pub const MCIERR_WAVE_OUTPUTUNSPECIFIED: DWORD = 324; +pub const MCIERR_WAVE_INPUTUNSPECIFIED: DWORD = 325; +pub const MCIERR_WAVE_OUTPUTSUNSUITABLE: DWORD = 326; +pub const MCIERR_WAVE_SETOUTPUTUNSUITABLE: DWORD = 327; +pub const MCIERR_WAVE_INPUTSUNSUITABLE: DWORD = 328; +pub const MCIERR_WAVE_SETINPUTUNSUITABLE: DWORD = 329; +pub const MCIERR_SEQ_DIV_INCOMPATIBLE: DWORD = 336; +pub const MCIERR_SEQ_PORT_INUSE: DWORD = 337; +pub const MCIERR_SEQ_PORT_NONEXISTENT: DWORD = 338; +pub const MCIERR_SEQ_PORT_MAPNODEVICE: DWORD = 339; +pub const MCIERR_SEQ_PORT_MISCERROR: DWORD = 340; +pub const MCIERR_SEQ_TIMER: DWORD = 341; +pub const MCIERR_SEQ_PORTUNSPECIFIED: DWORD = 342; +pub const MCIERR_SEQ_NOMIDIPRESENT: DWORD = 343; +pub const MCIERR_NO_WINDOW: DWORD = 346; +pub const MCIERR_CREATEWINDOW: DWORD = 347; +pub const MCIERR_FILE_READ: DWORD = 348; +pub const MCIERR_FILE_WRITE: DWORD = 349; +pub const MCIERR_NO_IDENTITY: DWORD = 350; +pub const MCIERR_CUSTOM_DRIVER_BASE: DWORD = 512; + +extern "system" { + pub fn PlaySoundA( + pszSound: LPCSTR, + hmod: HMODULE, + fdwSound: DWORD + ) -> BOOL; + pub fn PlaySoundW( + pszSound: LPCWSTR, + hmod: HMODULE, + fdwSound: DWORD + ) -> BOOL; + pub fn sndPlaySoundA( + pszSound: LPCSTR, + fuSound: UINT + ) -> BOOL; + pub fn sndPlaySoundW( + pszSound: LPCWSTR, + fuSound: UINT + ) -> BOOL; + pub fn timeBeginPeriod( + uPeriod: UINT + ) -> MMRESULT; + pub fn timeEndPeriod( + uPeriod: UINT + ) -> MMRESULT; + pub fn timeGetDevCaps( + ptc: LPTIMECAPS, + cbtc: UINT + ) -> MMRESULT; + pub fn timeGetTime( + ) -> DWORD; + pub fn waveInAddBuffer( + hwi: HWAVEIN, + pwh: LPWAVEHDR, + cbwh: UINT + ) -> MMRESULT; + pub fn waveInClose( + hwi: HWAVEIN + ) -> MMRESULT; + // pub fn waveInGetDevCapsA(); + pub fn waveInGetDevCapsW( + uDeviceID: UINT_PTR, + pwic: LPWAVEINCAPSW, + cbwic: UINT + ) -> MMRESULT; + // pub fn waveInGetErrorTextA(); + pub fn waveInGetErrorTextW( + mmrError: MMRESULT, + pszText: LPWSTR, + cchText: UINT + ) -> MMRESULT; + // pub fn waveInGetID(); + pub fn waveInGetNumDevs( + ) -> UINT; + pub fn waveInGetPosition( + hwi: HWAVEIN, + pmmt: LPMMTIME, + cbmmt: UINT + ) -> MMRESULT; + pub fn waveInMessage( + hwi: HWAVEIN, + uMsg: UINT, + dw1: DWORD_PTR, + dw2: DWORD_PTR + ) -> MMRESULT; + pub fn waveInOpen( + phwi: LPHWAVEIN, + uDeviceID: UINT, + pwfx: LPCWAVEFORMATEX, + dwCallback: DWORD_PTR, + dwInstance: DWORD_PTR, + fdwOpen: DWORD, + ) -> MMRESULT; + pub fn waveInPrepareHeader( + hwi: HWAVEIN, + pwh: LPWAVEHDR, + cbwh: UINT + ) -> MMRESULT; + pub fn waveInReset( + hwi: HWAVEIN + ) -> MMRESULT; + pub fn waveInStart( + hwi: HWAVEIN + ) -> MMRESULT; + pub fn waveInStop( + hwi: HWAVEIN + ) -> MMRESULT; + pub fn waveInUnprepareHeader( + hwi: HWAVEIN, + pwh: LPWAVEHDR, + cbwh: UINT + ) -> MMRESULT; + pub fn waveOutBreakLoop( + hwo: HWAVEOUT + ) -> MMRESULT; + pub fn waveOutClose( + hwo: HWAVEOUT + ) -> MMRESULT; + // pub fn waveOutGetDevCapsA(); + pub fn waveOutGetDevCapsW( + uDeviceID: UINT_PTR, + pwoc: LPWAVEOUTCAPSW, + cbwoc: UINT + ) -> MMRESULT; + // pub fn waveOutGetErrorTextA(); + pub fn waveOutGetErrorTextW( + mmrError: MMRESULT, + pszText: LPWSTR, + cchText: UINT + ) -> MMRESULT; + // pub fn waveOutGetID(); + pub fn waveOutGetNumDevs( + ) -> UINT; + pub fn waveOutGetPitch( + hwo: HWAVEOUT, + pdwPitch: LPDWORD + ) -> MMRESULT; + pub fn waveOutGetPlaybackRate( + hwo: HWAVEOUT, + pdwRate: LPDWORD + ) -> MMRESULT; + pub fn waveOutGetPosition( + hwo: HWAVEOUT, + pmmt: LPMMTIME, + cbmmt: UINT + ) -> MMRESULT; + pub fn waveOutGetVolume( + hwo: HWAVEOUT, + pdwVolume: LPDWORD + ) -> MMRESULT; + pub fn waveOutMessage( + hwo: HWAVEOUT, + uMsg: UINT, + dw1: DWORD_PTR, + dw2: DWORD_PTR + ) -> MMRESULT; + pub fn waveOutOpen( + phwo: LPHWAVEOUT, + uDeviceID: UINT, + pwfx: LPCWAVEFORMATEX, + dwCallback: DWORD_PTR, + dwInstance: DWORD_PTR, + fdwOpen: DWORD, + ) -> MMRESULT; + pub fn waveOutPause( + hwo: HWAVEOUT + ) -> MMRESULT; + pub fn waveOutPrepareHeader( + hwo: HWAVEOUT, + pwh: LPWAVEHDR, + cbwh: UINT + ) -> MMRESULT; + pub fn waveOutReset( + hwo: HWAVEOUT + ) -> MMRESULT; + pub fn waveOutRestart( + hwo: HWAVEOUT + ) -> MMRESULT; + pub fn waveOutSetPitch( + hwo: HWAVEOUT, + dwPitch: DWORD + ) -> MMRESULT; + pub fn waveOutSetPlaybackRate( + hwo: HWAVEOUT, + dwRate: DWORD + ) -> MMRESULT; + pub fn waveOutSetVolume( + hwo: HWAVEOUT, + dwVolume: DWORD + ) -> MMRESULT; + pub fn waveOutUnprepareHeader( + hwo: HWAVEOUT, + pwh: LPWAVEHDR, + cbwh: UINT + ) -> MMRESULT; + pub fn waveOutWrite( + hwo: HWAVEOUT, + pwh: LPWAVEHDR, + cbwh: UINT + ) -> MMRESULT; + pub fn midiStreamOpen( + lphStream: LPHMIDISTRM, + puDeviceID: LPUINT, + cMidi: DWORD, + dwCallback: DWORD_PTR, + dwInstance: DWORD_PTR, + fdwOpen: DWORD + ) -> MMRESULT; + pub fn midiStreamClose( + hStream: HMIDISTRM + ) -> MMRESULT; + pub fn midiStreamProperty( + hm: HMIDISTRM, + lppropdata: LPBYTE, + dwProperty: DWORD + ) -> MMRESULT; + pub fn midiStreamPosition( + hms: HMIDISTRM, + pmmt: LPMMTIME, + cbmmt: UINT + ) -> MMRESULT; + pub fn midiStreamOut( + hMidiStream: HMIDISTRM, + lpMidiHdr: LPMIDIHDR, + cbMidiHdr: UINT + ) -> MMRESULT; + pub fn midiStreamPause( + hms: HMIDISTRM + ) -> MMRESULT; + pub fn midiStreamRestart( + hms: HMIDISTRM + ) -> MMRESULT; + pub fn midiStreamStop( + hms: HMIDISTRM + ) -> MMRESULT; + pub fn midiConnect( + hMidi: HMIDI, + hmo: HMIDIOUT, + pReserved: PVOID + ) -> MMRESULT; + pub fn midiDisconnect( + hMidi: HMIDI, + hmo: HMIDIOUT, + pReserved: PVOID + ) -> MMRESULT; + pub fn midiOutGetNumDevs( + ) -> UINT; + pub fn midiOutGetDevCapsW( + uDeviceID: UINT_PTR, + lpMidiOutCaps: LPMIDIOUTCAPSW, + cbMidiOutCaps: UINT + ) -> MMRESULT; + pub fn midiOutGetVolume( + hmo: HMIDIOUT, + lpdwVolume: PDWORD + ) -> MMRESULT; + pub fn midiOutSetVolume( + hmo: HMIDIOUT, + dwVolume: DWORD + ) -> MMRESULT; + pub fn midiOutGetErrorTextW( + mmrError: MMRESULT, + lpText: LPWSTR, + cchText: UINT + ) -> MMRESULT; + pub fn midiOutOpen( + lphmo: LPHMIDIOUT, + uDeviceID: UINT, + dwCallback: DWORD_PTR, + dwCallbackInstance: DWORD_PTR, + dwFlags: DWORD + ) -> MMRESULT; + pub fn midiOutClose( + hmo: HMIDIOUT + ) -> MMRESULT; + pub fn midiOutPrepareHeader( + hmo: HMIDIOUT, + lpMidiOutHdr: LPMIDIHDR, + cbMidiOutHdr: UINT + ) -> MMRESULT; + pub fn midiOutUnprepareHeader( + hmo: HMIDIOUT, + lpMidiOutHdr: LPMIDIHDR, + cbMidiOutHdr: UINT + ) -> MMRESULT; + pub fn midiOutShortMsg( + hmo: HMIDIOUT, + dwMsg: DWORD + ) -> MMRESULT; + pub fn midiOutLongMsg( + hmo: HMIDIOUT, + lpMidiOutHdr: LPMIDIHDR, + cbMidiOutHdr: UINT + ) -> MMRESULT; + pub fn midiOutReset( + hmo: HMIDIOUT + ) -> MMRESULT; + pub fn midiOutCachePatches( + hmo: HMIDIOUT, + wBank: UINT, + lpPatchArray: LPWORD, + wFlags: UINT + ) -> MMRESULT; + pub fn midiOutCacheDrumPatches( + hmo: HMIDIOUT, + wPatch: UINT, + lpKeyArray: LPWORD, + wFlags: UINT + ) -> MMRESULT; + pub fn midiOutGetID( + hmo: HMIDIOUT, + puDeviceID: LPUINT + ) -> MMRESULT; + pub fn midiOutMessage( + deviceID: HMIDIOUT, + msg: UINT, + dw1: DWORD_PTR, + dw2: DWORD_PTR + ) -> MMRESULT; + pub fn midiInGetNumDevs( + ) -> UINT; + pub fn midiInGetDevCapsW( + uDeviceID: UINT_PTR, + lpMidiInCaps: LPMIDIINCAPSW, + cbMidiInCaps: UINT + ) -> MMRESULT; + pub fn midiInGetErrorTextW( + wError: MMRESULT, + lpText: LPWSTR, + cchText: UINT + ) -> MMRESULT; + pub fn midiInOpen( + lphMidiIn: LPHMIDIIN, + uDeviceID: UINT, + dwCallback: DWORD_PTR, + dwCallbackInstance: DWORD_PTR, + dwFlags: DWORD + ) -> MMRESULT; + pub fn midiInClose( + hMidiIn: HMIDIIN + ) -> MMRESULT; + pub fn midiInPrepareHeader( + hMidiIn: HMIDIIN, + lpMidiInHdr: LPMIDIHDR, + cbMidiInHdr: UINT + ) -> MMRESULT; + pub fn midiInUnprepareHeader( + hMidiIn: HMIDIIN, + lpMidiInHdr: LPMIDIHDR, + cbMidiInHdr: UINT + ) -> MMRESULT; + pub fn midiInAddBuffer( + hMidiIn: HMIDIIN, + lpMidiInHdr: LPMIDIHDR, + cbMidiInHdr: UINT + ) -> MMRESULT; + pub fn midiInStart( + hMidiIn: HMIDIIN + ) -> MMRESULT; + pub fn midiInStop( + hMidiIn: HMIDIIN + ) -> MMRESULT; + pub fn midiInReset( + hMidiIn: HMIDIIN + ) -> MMRESULT; + pub fn midiInGetID( + hmi: HMIDIIN, + puDeviceID: LPUINT + ) -> MMRESULT; + pub fn midiInMessage( + deviceID: HMIDIIN, + msg: UINT, + dw1: DWORD_PTR, + dw2: DWORD_PTR + ) -> MMRESULT; + pub fn mciExecute( + pszCommand: LPCSTR + ) -> BOOL; + pub fn mciGetCreatorTask( + IDDevice: MCIDEVICEID + ) -> MMRESULT; + pub fn mciGetDeviceID( + lpszDevice: LPCTSTR + ) -> MCIDEVICEID; + pub fn mciGetDeviceIDFromElementID( + dwElementID: DWORD, + lpstrType: LPCTSTR + ) -> MCIDEVICEID; + pub fn mciGetErrorString( + fdwError: DWORD, + lpszErrorText: LPTSTR, + cchErrorText: UINT + ) -> BOOL; + pub fn mciGetYieldProc( + IDDevice: MCIDEVICEID, + lpdwYieldData: LPDWORD + ) -> YIELDPROC; + pub fn mciSendCommand( + IDDevice: MCIDEVICEID, + uMsg: UINT, + fdwCommand: DWORD_PTR, + dwParam: DWORD_PTR + ) -> MCIERROR; + pub fn mciSendString( + lpszCommand: LPCTSTR, + lpszReturnString: LPTSTR, + cchReturn: UINT, + hwndCallback: HANDLE + ) -> MCIERROR; + pub fn mciSetYieldProc( + IDDevice: MCIDEVICEID, + yp: YIELDPROC, + dwYieldData: DWORD + ) -> UINT; +} diff --git a/src/winmm.rs b/src/winmm.rs deleted file mode 100644 index be769c7ef..000000000 --- a/src/winmm.rs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright © 2015-2017 winapi-rs developers -// Licensed under the Apache License, Version 2.0 -// or the MIT license -// , at your option. -// All files in the project carrying such notice may not be copied, modified, or distributed -// except according to those terms. -//! This module contains definitions for use with WinMM. - -pub type MCIDEVICEID = ::UINT; -pub type MCIERROR = ::DWORD; -pub type YIELDPROC = ::DWORD; - -pub const MCIERR_NO_ERROR: DWORD = 0; -pub const MCIERR_UNRECOGNIZED_KEYWORD: DWORD = 259; -pub const MCIERR_UNRECOGNIZED_COMMAND: DWORD = 261; -pub const MCIERR_HARDWARE: DWORD = 262; -pub const MCIERR_INVALID_DEVICE_NAME: DWORD = 263; -pub const MCIERR_OUT_OF_MEMORY: DWORD = 264; -pub const MCIERR_DEVICE_OPEN: DWORD = 265; -pub const MCIERR_CANNOT_LOAD_DRIVER: DWORD = 266; -pub const MCIERR_MISSING_COMMAND_STRING: DWORD = 267; -pub const MCIERR_PARAM_OVERFLOW: DWORD = 268; -pub const MCIERR_MISSING_STRING_ARGUMENT: DWORD = 269; -pub const MCIERR_BAD_INTEGER: DWORD = 270; -pub const MCIERR_PARSER_INTERNAL: DWORD = 271; -pub const MCIERR_DRIVER_INTERNAL: DWORD = 272; -pub const MCIERR_MISSING_PARAMETER: DWORD = 273; -pub const MCIERR_UNSUPPORTED_FUNCTION: DWORD = 274; -pub const MCIERR_FILE_NOT_FOUND: DWORD = 275; -pub const MCIERR_DEVICE_NOT_READY: DWORD = 276; -pub const MCIERR_INTERNAL: DWORD = 277; -pub const MCIERR_DRIVER: DWORD = 278; -pub const MCIERR_CANNOT_USE_ALL: DWORD = 279; -pub const MCIERR_MULTIPLE: DWORD = 280; -pub const MCIERR_EXTENSION_NOT_FOUND: DWORD = 281; -pub const MCIERR_OUTOFRANGE: DWORD = 282; -pub const MCIERR_FLAGS_NOT_COMPATIBLE: DWORD = 284; -pub const MCIERR_FILE_NOT_SAVED: DWORD = 286; -pub const MCIERR_DEVICE_TYPE_REQUIRED: DWORD = 287; -pub const MCIERR_DEVICE_LOCKED: DWORD = 288; -pub const MCIERR_DUPLICATE_ALIAS: DWORD = 289; -pub const MCIERR_BAD_CONSTANT: DWORD = 290; -pub const MCIERR_MUST_USE_SHAREABLE: DWORD = 291; -pub const MCIERR_MISSING_DEVICE_NAME: DWORD = 292; -pub const MCIERR_BAD_TIME_FORMAT: DWORD = 293; -pub const MCIERR_NO_CLOSING_QUOTE: DWORD = 294; -pub const MCIERR_DUPLICATE_FLAGS: DWORD = 295; -pub const MCIERR_INVALID_FILE: DWORD = 296; -pub const MCIERR_NULL_PARAMETER_BLOCK: DWORD = 297; -pub const MCIERR_UNNAMED_RESOURCE: DWORD = 298; -pub const MCIERR_NEW_REQUIRES_ALIAS: DWORD = 299; -pub const MCIERR_NOTIFY_ON_AUTO_OPEN: DWORD = 300; -pub const MCIERR_NO_ELEMENT_ALLOWED: DWORD = 301; -pub const MCIERR_NONAPPLICABLE_FUNCTION: DWORD = 302; -pub const MCIERR_ILLEGAL_FOR_AUTO_OPEN: DWORD = 303; -pub const MCIERR_FILENAME_REQUIRED: DWORD = 304; -pub const MCIERR_EXTRA_CHARACTERS: DWORD = 305; -pub const MCIERR_DEVICE_NOT_INSTALLED: DWORD = 306; -pub const MCIERR_GET_CD: DWORD = 307; -pub const MCIERR_SET_CD: DWORD = 308; -pub const MCIERR_SET_DRIVE: DWORD = 309; -pub const MCIERR_DEVICE_LENGTH: DWORD = 310; -pub const MCIERR_DEVICE_ORD_LENGTH: DWORD = 311; -pub const MCIERR_NO_INTEGER: DWORD = 312; -pub const MCIERR_WAVE_OUTPUTSINUSE: DWORD = 320; -pub const MCIERR_WAVE_SETOUTPUTINUSE: DWORD = 321; -pub const MCIERR_WAVE_INPUTSINUSE: DWORD = 322; -pub const MCIERR_WAVE_SETINPUTINUSE: DWORD = 323; -pub const MCIERR_WAVE_OUTPUTUNSPECIFIED: DWORD = 324; -pub const MCIERR_WAVE_INPUTUNSPECIFIED: DWORD = 325; -pub const MCIERR_WAVE_OUTPUTSUNSUITABLE: DWORD = 326; -pub const MCIERR_WAVE_SETOUTPUTUNSUITABLE: DWORD = 327; -pub const MCIERR_WAVE_INPUTSUNSUITABLE: DWORD = 328; -pub const MCIERR_WAVE_SETINPUTUNSUITABLE: DWORD = 329; -pub const MCIERR_SEQ_DIV_INCOMPATIBLE: DWORD = 336; -pub const MCIERR_SEQ_PORT_INUSE: DWORD = 337; -pub const MCIERR_SEQ_PORT_NONEXISTENT: DWORD = 338; -pub const MCIERR_SEQ_PORT_MAPNODEVICE: DWORD = 339; -pub const MCIERR_SEQ_PORT_MISCERROR: DWORD = 340; -pub const MCIERR_SEQ_TIMER: DWORD = 341; -pub const MCIERR_SEQ_PORTUNSPECIFIED: DWORD = 342; -pub const MCIERR_SEQ_NOMIDIPRESENT: DWORD = 343; -pub const MCIERR_NO_WINDOW: DWORD = 346; -pub const MCIERR_CREATEWINDOW: DWORD = 347; -pub const MCIERR_FILE_READ: DWORD = 348; -pub const MCIERR_FILE_WRITE: DWORD = 349; -pub const MCIERR_NO_IDENTITY: DWORD = 350; -pub const MCIERR_CUSTOM_DRIVER_BASE: DWORD = 512; From 9071e2f51a02b7dbcbd1e5dbf234b2e4d3532109 Mon Sep 17 00:00:00 2001 From: Ian Pickering Date: Wed, 10 May 2017 17:57:00 -0500 Subject: [PATCH 03/10] Add HMODULE --- src/um/mmsystem.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/um/mmsystem.rs b/src/um/mmsystem.rs index 5ed8dd63e..2c387d7e7 100644 --- a/src/um/mmsystem.rs +++ b/src/um/mmsystem.rs @@ -6,7 +6,7 @@ // except according to those terms. //! MM procedure declarations, constant definitions and macros use shared::basetsd::{DWORD_PTR, UINT_PTR}; -use shared::minwindef::{BOOL, BYTE, DWORD, LPBYTE, LPDWORD, LPWORD, UINT, WORD}; +use shared::minwindef::{BOOL, BYTE, DWORD, HMODULE, LPBYTE, LPDWORD, LPWORD, UINT, WORD}; use shared::mmreg::WAVEFORMATEX; use shared::ntdef::{LPCTSTR, LPTSTR}; use um::imm::LPUINT; From 94bed04b2627882175b5a1ada0cb966fc50bba4b Mon Sep 17 00:00:00 2001 From: Ian Pickering Date: Wed, 10 May 2017 18:00:38 -0500 Subject: [PATCH 04/10] Add other imports --- src/um/mmsystem.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/um/mmsystem.rs b/src/um/mmsystem.rs index 2c387d7e7..b16137a82 100644 --- a/src/um/mmsystem.rs +++ b/src/um/mmsystem.rs @@ -6,11 +6,11 @@ // except according to those terms. //! MM procedure declarations, constant definitions and macros use shared::basetsd::{DWORD_PTR, UINT_PTR}; -use shared::minwindef::{BOOL, BYTE, DWORD, HMODULE, LPBYTE, LPDWORD, LPWORD, UINT, WORD}; +use shared::minwindef::{BOOL, BYTE, DWORD, HMODULE, LPBYTE, LPDWORD, LPWORD, PDWORD, UINT, WORD}; use shared::mmreg::WAVEFORMATEX; use shared::ntdef::{LPCTSTR, LPTSTR}; use um::imm::LPUINT; -use um::winnt::{LPCSTR, LPCWSTR, LPSTR, LPWSTR, PVOID, WCHAR}; +use um::winnt::{HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PVOID, WCHAR}; //109 (Win 7 SDK) pub type MMVERSION = UINT; pub type MMRESULT = UINT; From a4a6af5516b774653351f15789aa580333c0f875 Mon Sep 17 00:00:00 2001 From: Ian Pickering Date: Wed, 10 May 2017 18:41:52 -0500 Subject: [PATCH 05/10] Add ansi and unicode methods --- src/um/mmsystem.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/um/mmsystem.rs b/src/um/mmsystem.rs index b16137a82..1f1ba73b2 100644 --- a/src/um/mmsystem.rs +++ b/src/um/mmsystem.rs @@ -738,6 +738,18 @@ extern "system" { cchReturn: UINT, hwndCallback: HANDLE ) -> MCIERROR; + pub fn mciSendStringA( + lpszCommand: LPCSTR, + lpszReturnString: LPTSTR, + cchReturn: UINT, + hwndCallback: HANDLE + ) -> MCIERROR; + pub fn mciSendStringW( + lpszCommand: LPCWSTR, + lpszReturnString: LPTSTR, + cchReturn: UINT, + hwndCallback: HANDLE + ) -> MCIERROR; pub fn mciSetYieldProc( IDDevice: MCIDEVICEID, yp: YIELDPROC, From 073deac2518c9036daa8d6bec28c01742d6d7126 Mon Sep 17 00:00:00 2001 From: Ian Pickering Date: Wed, 10 May 2017 18:56:36 -0500 Subject: [PATCH 06/10] add winmm library --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index bf46457d4..5dfcffcc7 100644 --- a/build.rs +++ b/build.rs @@ -115,7 +115,7 @@ const DATA: &'static [(&'static str, &'static [&'static str], &'static [&'static ("minschannel", &["guiddef", "minwindef", "wincrypt", "winnt"], &[]), ("minwinbase", &["basetsd", "minwindef", "ntstatus", "winnt"], &[]), ("mmdeviceapi", &["guiddef", "minwindef", "propidl", "propsys", "unknwnbase", "winnt", "wtypes"], &[]), - ("mmsystem", &["basetsd", "imm", "minwindef", "mmreg", "ntdef", "winnt"], &[]), + ("mmsystem", &["basetsd", "imm", "minwindef", "mmreg", "ntdef", "winnt"], &["winmm"]), ("mscat", &["guiddef", "minwindef", "mssip", "wincrypt", "winnt"], &[]), ("mssip", &["guiddef", "minwindef", "mscat", "wincrypt", "winnt"], &[]), ("ncrypt", &["basetsd", "sspi"], &["ncrypt"]), From dfb61e3be69ae7c8d7c767365d666117246997f2 Mon Sep 17 00:00:00 2001 From: Ian Pickering Date: Wed, 10 May 2017 19:21:08 -0500 Subject: [PATCH 07/10] Don't use TCHAR --- src/um/mmsystem.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/um/mmsystem.rs b/src/um/mmsystem.rs index 1f1ba73b2..a2c61e842 100644 --- a/src/um/mmsystem.rs +++ b/src/um/mmsystem.rs @@ -8,7 +8,7 @@ use shared::basetsd::{DWORD_PTR, UINT_PTR}; use shared::minwindef::{BOOL, BYTE, DWORD, HMODULE, LPBYTE, LPDWORD, LPWORD, PDWORD, UINT, WORD}; use shared::mmreg::WAVEFORMATEX; -use shared::ntdef::{LPCTSTR, LPTSTR}; +use shared::ntdef::LPCTSTR; use um::imm::LPUINT; use um::winnt::{HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PVOID, WCHAR}; //109 (Win 7 SDK) @@ -717,9 +717,14 @@ extern "system" { dwElementID: DWORD, lpstrType: LPCTSTR ) -> MCIDEVICEID; - pub fn mciGetErrorString( + pub fn mciGetErrorStringA( fdwError: DWORD, - lpszErrorText: LPTSTR, + lpszErrorText: LPSTR, + cchErrorText: UINT + ) -> BOOL; + pub fn mciGetErrorStringW( + fdwError: DWORD, + lpszErrorText: LPWSTR, cchErrorText: UINT ) -> BOOL; pub fn mciGetYieldProc( @@ -732,21 +737,15 @@ extern "system" { fdwCommand: DWORD_PTR, dwParam: DWORD_PTR ) -> MCIERROR; - pub fn mciSendString( - lpszCommand: LPCTSTR, - lpszReturnString: LPTSTR, - cchReturn: UINT, - hwndCallback: HANDLE - ) -> MCIERROR; pub fn mciSendStringA( lpszCommand: LPCSTR, - lpszReturnString: LPTSTR, + lpszReturnString: LPSTR, cchReturn: UINT, hwndCallback: HANDLE ) -> MCIERROR; pub fn mciSendStringW( lpszCommand: LPCWSTR, - lpszReturnString: LPTSTR, + lpszReturnString: LPWSTR, cchReturn: UINT, hwndCallback: HANDLE ) -> MCIERROR; From 13dfbb410343c30bcac2d23811707fd5bfc7b83c Mon Sep 17 00:00:00 2001 From: Ruin0x11 Date: Sun, 28 Mar 2021 17:42:38 -0700 Subject: [PATCH 08/10] Update MCI to use W instead of T strings --- src/um/mmeapi.rs | 14 +++++++------- src/um/mmsystem.rs | 5 ++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/um/mmeapi.rs b/src/um/mmeapi.rs index ae9653a18..786bad293 100644 --- a/src/um/mmeapi.rs +++ b/src/um/mmeapi.rs @@ -4,14 +4,14 @@ // All files in the project carrying such notice may not be copied, modified, or distributed // except according to those terms. use shared::basetsd::{DWORD_PTR, UINT_PTR}; -use shared::minwindef::{DWORD, LPBYTE, LPDWORD, LPWORD, PDWORD, UINT}; +use shared::minwindef::{DWORD, LPBYTE, LPDWORD, LPWORD, PDWORD, UINT, BOOL}; use um::imm::LPUINT; use um::mmsystem::{ HMIDI, HMIDIIN, HMIDIOUT, HMIDISTRM, HWAVEIN, HWAVEOUT, LPCWAVEFORMATEX, LPHMIDIIN, LPHMIDIOUT, LPHMIDISTRM, LPHWAVEIN, LPHWAVEOUT, LPMIDIHDR, LPMIDIINCAPSW, LPMIDIOUTCAPSW, LPMMTIME, - LPWAVEHDR, LPWAVEINCAPSW, LPWAVEOUTCAPSW, MMRESULT + LPWAVEHDR, LPWAVEINCAPSW, LPWAVEOUTCAPSW, MMRESULT, YIELDPROC, MCIDEVICEID, MCIERROR }; -use um::winnt::{LPWSTR, PVOID}; +use um::winnt::{LPWSTR, PVOID, HANDLE, LPCSTR, LPCWSTR}; extern "system" { pub fn waveOutGetNumDevs() -> UINT; // pub fn waveOutGetDevCapsA(); @@ -335,11 +335,11 @@ extern "system" { ) -> MMRESULT; pub fn mciExecute(pszCommand: LPCSTR) -> BOOL; pub fn mciGetCreatorTask(IDDevice: MCIDEVICEID) -> MMRESULT; - pub fn mciGetDeviceID(lpszDevice: LPCTSTR) -> MCIDEVICEID; - pub fn mciGetDeviceIDFromElementID(dwElementID: DWORD, lpstrType: LPCTSTR) -> MCIDEVICEID; - pub fn mciGetErrorString(fdwError: DWORD, lpszErrorText: LPTSTR, cchErrorText: UINT) -> BOOL; + pub fn mciGetDeviceID(lpszDevice: LPCWSTR) -> MCIDEVICEID; + pub fn mciGetDeviceIDFromElementID(dwElementID: DWORD, lpstrType: LPCWSTR) -> MCIDEVICEID; + pub fn mciGetErrorString(fdwError: DWORD, lpszErrorText: LPWSTR, cchErrorText: UINT) -> BOOL; pub fn mciGetYieldProc(IDDevice: MCIDEVICEID, lpdwYieldData: LPDWORD) -> YIELDPROC; pub fn mciSendCommand(IDDevice: MCIDEVICEID, uMsg: UINT, fdwCommand: DWORD_PTR, dwParam: DWORD_PTR) -> MCIERROR; - pub fn mciSendString(lpszCommand: LPCTSTR, lpszReturnString: LPTSTR, cchReturn: UINT, hwndCallback: HANDLE) -> MCIERROR; + pub fn mciSendString(lpszCommand: LPCWSTR, lpszReturnString: LPWSTR, cchReturn: UINT, hwndCallback: HANDLE) -> MCIERROR; pub fn mciSetYieldProc(IDDevice: MCIDEVICEID, yp: YIELDPROC, dwYieldData: DWORD) -> UINT; } diff --git a/src/um/mmsystem.rs b/src/um/mmsystem.rs index e69160d2f..fba51c3ad 100644 --- a/src/um/mmsystem.rs +++ b/src/um/mmsystem.rs @@ -7,7 +7,6 @@ use shared::basetsd::{DWORD_PTR, UINT_PTR}; use shared::minwindef::{BOOL, BYTE, DWORD, HMODULE, LPBYTE, LPDWORD, LPWORD, PDWORD, UINT, WORD}; use shared::mmreg::WAVEFORMATEX; -use shared::ntdef::LPCTSTR; use um::imm::LPUINT; use um::winnt::{HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PVOID, WCHAR}; //109 (Win 7 SDK) @@ -710,11 +709,11 @@ extern "system" { IDDevice: MCIDEVICEID ) -> MMRESULT; pub fn mciGetDeviceID( - lpszDevice: LPCTSTR + lpszDevice: LPCWSTR ) -> MCIDEVICEID; pub fn mciGetDeviceIDFromElementID( dwElementID: DWORD, - lpstrType: LPCTSTR + lpstrType: LPCWSTR ) -> MCIDEVICEID; pub fn mciGetErrorStringA( fdwError: DWORD, From 9abe3e022340549859f502b08b31db1af81962a4 Mon Sep 17 00:00:00 2001 From: Ruin0x11 Date: Sun, 28 Mar 2021 17:49:30 -0700 Subject: [PATCH 09/10] Fix mmsystem dependency on imm --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index e901b184d..ed1e0b3bf 100644 --- a/build.rs +++ b/build.rs @@ -252,7 +252,7 @@ const DATA: &'static [(&'static str, &'static [&'static str], &'static [&'static ("minwinbase", &["basetsd", "minwindef", "ntstatus", "winnt"], &[]), ("mmdeviceapi", &["guiddef", "minwindef", "propidl", "propsys", "unknwnbase", "winnt", "wtypes"], &["mmdevapi"]), ("mmeapi", &["basetsd", "imm", "minwindef", "mmsystem", "winnt"], &["winmm"]), - ("mmsystem", &["basetsd", "minwindef", "mmreg", "winnt"], &[]), + ("mmsystem", &["basetsd", "imm", "minwindef", "mmreg", "winnt"], &[]), ("msaatext", &[], &[]), ("mscat", &["guiddef", "minwindef", "mssip", "wincrypt", "winnt"], &[]), ("mschapp", &["basetsd", "minwindef", "winnt"], &["advapi32"]), From b22497a106d4edb244badf936a1696882c5ee16b Mon Sep 17 00:00:00 2001 From: Ruin0x11 Date: Sun, 28 Mar 2021 20:07:51 -0700 Subject: [PATCH 10/10] Fix formatting --- Cargo.toml | 2 +- src/um/mmeapi.rs | 54 +++++++++++++++++++++++++++++++++++++----------- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ab74e1fc1..091292784 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -391,9 +391,9 @@ winhttp = [] wininet = [] winineti = [] winioctl = [] +winmm = [] winnetwk = [] winnls = [] -winmm = [] winnt = [] winreg = [] winsafer = [] diff --git a/src/um/mmeapi.rs b/src/um/mmeapi.rs index 786bad293..3ea77fbf9 100644 --- a/src/um/mmeapi.rs +++ b/src/um/mmeapi.rs @@ -4,14 +4,14 @@ // All files in the project carrying such notice may not be copied, modified, or distributed // except according to those terms. use shared::basetsd::{DWORD_PTR, UINT_PTR}; -use shared::minwindef::{DWORD, LPBYTE, LPDWORD, LPWORD, PDWORD, UINT, BOOL}; +use shared::minwindef::{BOOL, DWORD, LPBYTE, LPDWORD, LPWORD, PDWORD, UINT}; use um::imm::LPUINT; use um::mmsystem::{ HMIDI, HMIDIIN, HMIDIOUT, HMIDISTRM, HWAVEIN, HWAVEOUT, LPCWAVEFORMATEX, LPHMIDIIN, LPHMIDIOUT, LPHMIDISTRM, LPHWAVEIN, LPHWAVEOUT, LPMIDIHDR, LPMIDIINCAPSW, LPMIDIOUTCAPSW, LPMMTIME, - LPWAVEHDR, LPWAVEINCAPSW, LPWAVEOUTCAPSW, MMRESULT, YIELDPROC, MCIDEVICEID, MCIERROR + LPWAVEHDR, LPWAVEINCAPSW, LPWAVEOUTCAPSW, MCIDEVICEID, MCIERROR, MMRESULT, YIELDPROC, }; -use um::winnt::{LPWSTR, PVOID, HANDLE, LPCSTR, LPCWSTR}; +use um::winnt::{HANDLE, LPCSTR, LPCWSTR, LPWSTR, PVOID}; extern "system" { pub fn waveOutGetNumDevs() -> UINT; // pub fn waveOutGetDevCapsA(); @@ -333,13 +333,43 @@ extern "system" { dw1: DWORD_PTR, dw2: DWORD_PTR, ) -> MMRESULT; - pub fn mciExecute(pszCommand: LPCSTR) -> BOOL; - pub fn mciGetCreatorTask(IDDevice: MCIDEVICEID) -> MMRESULT; - pub fn mciGetDeviceID(lpszDevice: LPCWSTR) -> MCIDEVICEID; - pub fn mciGetDeviceIDFromElementID(dwElementID: DWORD, lpstrType: LPCWSTR) -> MCIDEVICEID; - pub fn mciGetErrorString(fdwError: DWORD, lpszErrorText: LPWSTR, cchErrorText: UINT) -> BOOL; - pub fn mciGetYieldProc(IDDevice: MCIDEVICEID, lpdwYieldData: LPDWORD) -> YIELDPROC; - pub fn mciSendCommand(IDDevice: MCIDEVICEID, uMsg: UINT, fdwCommand: DWORD_PTR, dwParam: DWORD_PTR) -> MCIERROR; - pub fn mciSendString(lpszCommand: LPCWSTR, lpszReturnString: LPWSTR, cchReturn: UINT, hwndCallback: HANDLE) -> MCIERROR; - pub fn mciSetYieldProc(IDDevice: MCIDEVICEID, yp: YIELDPROC, dwYieldData: DWORD) -> UINT; + pub fn mciExecute( + pszCommand: LPCSTR + ) -> BOOL; + pub fn mciGetCreatorTask( + IDDevice: MCIDEVICEID + ) -> MMRESULT; + pub fn mciGetDeviceID( + lpszDevice: LPCWSTR + ) -> MCIDEVICEID; + pub fn mciGetDeviceIDFromElementID( + dwElementID: DWORD, + lpstrType: LPCWSTR + ) -> MCIDEVICEID; + pub fn mciGetErrorString( + fdwError: DWORD, + lpszErrorText: LPWSTR, + cchErrorText: UINT + ) -> BOOL; + pub fn mciGetYieldProc( + IDDevice: MCIDEVICEID, + lpdwYieldData: LPDWORD + ) -> YIELDPROC; + pub fn mciSendCommand( + IDDevice: MCIDEVICEID, + uMsg: UINT, + fdwCommand: DWORD_PTR, + dwParam: DWORD_PTR + ) -> MCIERROR; + pub fn mciSendString( + lpszCommand: LPCWSTR, + lpszReturnString: LPWSTR, + cchReturn: UINT, + hwndCallback: HANDLE + ) -> MCIERROR; + pub fn mciSetYieldProc( + IDDevice: MCIDEVICEID, + yp: YIELDPROC, + dwYieldData: DWORD + ) -> UINT; }