Implement GetWavePosition API for both Legacy and MMixer modes.
[WDMAUD.DRV]
- Fix wrong I/O control code passed to DeviceIoControl for Legacy mode. Use IOCTL_GETPOS instead of IOCTL_OPEN_WDMAUD, to use the correct routine.
- Implement WdmAudGetWavePosition for MMixer mode, as it was completely unimplemented there. Call an appropiate MMixer routine and return back resulting wave position.
[WDMAUD]
- Implement WdmAudGetPostion routine, which is used by Legacy mode, and call the same MMixer routine from it too.
- Handle it in IOCTL_GETPOS I/O control request of dispatch routine.
[MMIXER]
- Implement MMixerGetWavePosition internal routine, which is called by both Legacy and MMixer modes, and does the actual work of retrieving playback position.
- Call an apporpriate KSPROPERTY_AUDIO_POSITION property from it, and return in the output resulting KSAUDIO_POSITION.PlayOffset member, which contains the current playback position offset, to be returned to the caller.
This fixes a failure retreiving the current audio playback position snd subsequent playing the audio data by several 3rd-party applications which are using this API (for example, some Gecko based browsers by @roytam1: Basilisk (Serpent) 52.9.0 IA-32 build, NewMoon 28.10.7 IA-32 build and KMeleon 76.5.3 Goanna engine).
CORE-19542
[MMIXER] Implement hadling WAVE_FORMAT_EXTENSIBLE audio format
Fix opening audio device error when trying to open it with WAVE_FORMAT_EXTENSIBLE format tag set in wFormatTag member of WAVEFORMATEX:
- Pass additional data size from WAVEFORMATEX.cbSize to pin data format.
- Append it to the whole size of pin data format (KSDATAFORMAT.FormatSize).
- Set additional fields in WAVEFORMATEXTENSIBLE structure (data format, BPS and channel mask) when WAVE_FORMAT_EXTENSIBLE is used. They are used by our inbuilt Intel AC97 miniport driver at least. It simply fails when these members are not set.
- Fix pin connect allocation size by appending an additional data size from WAVEFORMATEX.cbSize to KSPIN_CONNECT + KSDATAFORMAT + WAVEFORMATEX. This allows to proerly initialize additional extensible data and avoids kernel memory leakage when using extensible audio format.
- Remove format tag check which allowed WAVE_FORMAT_PCM to be opened correctly. So now all possible audio formats can be opened properly at least (although it does not mean they may work correctly).
This fixes the audio playback for all apps those are supporting extensible audio data and use it by default (e. g. AIMP 5.30, QMMP 0.12.17, all Chrome/Chromium-based browsers, GameDev Tycoon Demo game etc.).
CORE-10907, CORE-14783
* [KS] Allow passing additional extensible audio data when extensible audio format is used
- Append additional data size from WAVEFORMATEX.cbSize to pin connect size passed to KsCreatePin. If the tag is WAVE_FORMAT_PCM, then this member should always be zero. So in that case, no any additional data is passed to creation request, and the passed data size is correct for PCM too (KSDATAFORMAT + WAVEFORMATEX).
This fixes audio playback in several apps those are supporting extensibble audio and use it by default (e. g. AIMP 5.30, QMMP 0.12.17, all Chrome/Chromium based browsers, GameDev Tycoon Demo game etc.).
CORE-10907, CORE-14783.
* [WDMAUD.DRV] Pass the correct additional data size to I/O control request
Store a correct size of additional data in WAVEFORMATEX.cbSize when performing open of audio device, when WAVE_FORMAT_EXTENSIBLE audio format is used.
It allows to properly open audio device with Legacy APIs enabled too.
This fixes audio playback in several apps those are using extensible audio data (e. g. AIMP 5.30, QMMP 0.12.17, all Chrome/Chromium based browsers, GameDevTycoon Demo game etc.).
CORE-10907, CORE-14783
CORE-17256
- Implement support for complex input buffers.
This will enable the IDE driver with some hack
to execute the _STM (channel timing settings) control method.
- Fix a memory leak.
- Fix returned status code.
- Correctly calculate the output buffer size.
- Improve buffer validation.
- Implement support for async control requests.
- Implement local reference conversion.
- Implement support for subpackage argument conversion.
- Place some code into INIT section.
Serial number on some USB devices might exceed the number of 100 characters
(e.g. 120 characters on "SanDisk Ultra 3.2Gen1" pendrive) and cause buffer
overflow, resulting in usbstor.sys crash.
- Use pool allocation for instance ID generation.
Fixes stack overflow on USB storage devices with large serial number.
- Print the LUN number as a hexadecimal, not as a character.
- Verify the serial number descriptor before using it.
- Increase the max descriptor size for serial number to
MAXIMUM_USB_STRING_LENGTH. This fixes serial number string truncation.
Based on suggestions by disean and ThFabba.
CORE-17625
* [SDK][VIRTIO][NETKVM] Make VirtIO a separate library
This is to avoid code duplication when more VirtIO drivers are brought in. This will also be used on development of a VirtIO XDDM GPU Driver.
* [VIRTIO] Sync with upstream
- Update TCP cached information only after updating adapter information
(so that TCPUpdateInterfaceIPInformation/TCPUpdateInterfaceLinkStatus
gets new status)
- Call netif_set_link_up/netif_set_link_down in TCPUpdateInterfaceLinkStatus
This fixes a lwIP requirement:
2007-07-13 Jared Grubb (integrated by Frédéric Bernon)
* [...] Be carefull for port maintainers to add the NETIF_FLAG_LINK_UP
flag (like in ethernetif.c) if you want to be sure to be compatible with
future changes...
* [TCPIP] Rename lwip library to lwipcore
* [TCPIP] Remove ReactOS-specific code from LWIP library
* [TCPIP] Synchronize LWIP code to 1.4.1
Update to LWIP 1.4.1 should have been done by bd3b0e8ef4
However, I was unable to find the exact revision used in this commit.
So, do the following
- take code from STABLE-1_4_1 commit on https://git.savannah.gnu.org/git/lwip.git
- cherry-pick LWIP 32aa9a41e2013e5ee6eee09317a848647e37badf (CORE-8978)
- cherry-pick LWIP c0b534e5318baf870e2152c70d4d11a3a86181f3
- add a ReactOS-specific change in src/api/tcpip.c (missing include)
- add ReactOS specific file CMakeLists.txt
NOTE: Changes are mostly in unit test files (not used) and CHANGELOG file.
CORE-7140
Fix `warning C4267: '=': conversion from 'size_t' to 'USHORT', possible loss of data`
by explicitly casting to USHORT.
This is OK as the line immediately before NULL-terminates the buffer within boundary.
Addendum to commit 096a69471 (r6279).
- The return value got lost when refactoring the setup function
- The check against 0xFFFFFFFF was meant to reject an empty EEPROM image
- Add missing PAGED_CODE(); macros
CORE-8724
Revert "[PSDK][AFD][VGADDI] Further build and MS PSDK compatibility fixes."
This reverts commit 99efc2ae50.
Revert "[PSDK] Sync winresrc.h with wine-8.20"
This reverts commit 3e83562aa7.
Revert "[OSK][PROGMAN] Fix resource file build."
This reverts commit 84e4ad0a82.
Revert "[PSDK] Use the new .rh files in winresrc.h"
This reverts commit f6fb7c48c9.
- windows.h:
* should define _WINDOWS_ and _INC_WINDOWS instead of _WINDOWS_H
* include winresrc.h if RC_INVOKED and not NOWINRES (Wine also agrees
with that)
* also, some .h included from there should _not_ be included if their
respective NO*** flags are defined.
- batclass.h: Use correct _WINDOWS_ guard.
- winsnmp.h:
* should define _INC_WINSNMP instead of _WINSNMP_H
* use _INC_WINDOWS instead of _WINDOWS_H
- afd.h, vgaddi.h: Use the correct guards.
- winnt.rh: Define the (SUB)LANG_* exactly as they are in the winnt.h,
otherwise we get macro redefinition compile errors.
NOTE: Ideally these .rh files should be auto-generated from their
corresponding .h files.
- afxres.h: Do not include the whole windows.h, but instead, only
the winres.h file, and only if RC_INVOKED is defined.
NOTE: Both afxres.h and winres.h do not really belong to the PSDK,
but belong instead to MFC. The reason why we have them here is twofold:
1. Wine used to have also winres.h (from where we got ours). This is
because the .rc resource files of some non-MFC modules were generated
with Visual Studio, which always includes afxres.h for these, and the
solution was to use a slightly less MFC-specific header: winres.h
(Wine commit cb08c82244673f26842e7a0766de90f091b5a493).
However, this winres.h has been since removed from Wine tree
(Wine commit 197f4059ab2af5f13f9c56faa26e3b4af902f869).
2. Few of our modules either use afxres.h or winres.h in their resource
files, and we still want to be able to compile them.
and move debug.h after all includes. Addendum to 60b0afc3a (PR #5818)
dsound_new: Addendum to 5974fe1 (r45584).
hdaudbus: Addendum to cf7fc81 (r68311).
bdasup: Addendum to 40c15ec (r46632).
kmixer: Addendum to 3e489bf (r42143).
mmixer: Addendum to c42d9f2 (r44872).
stream: Addendum to 4a0debf (r41662).
Serge plans a follow up that will remove all other remaining YDEBUG in the source tree.
The ones covered here he considered to be the most trivial ones.
These adapters were common in DEC Alpha boxes and they are really rare
nowadays. The 21140 chip is emulated in Connectix / Microsoft Virtual PC
and Hyper-V Gen 1 VM.
This is an experimental driver, not yet tested on real hardware.
CORE-8724
- Initialize the rest of IRP data which is not initialized by IoBuildSynchronousFsdRequest.
- Setup an IO_STACK_LOCATION structure for the IRP before calling the driver's read/write routine.
- Do this for both KsReadFile and KsWriteFile functions in our Kernel Streaming driver (ks.sys).
This fixes several problems when calling these functions from outside, so now they are working correctly, as expected.
Discovered during my audio investigations.
CORE-19232
Properly set output buffer length in IO Stack Location of the current IRP, since it is passed to KsProbeStreamIrp when calling KsStreamIo, so it fails if the length isn't set properly.
Don't set an input buffer length and the buffer itself, since it isn't passed anywhere, so setting it makes no sense. Moreover, MSDN says that for IOCTL_KS_READ/WRITE_STREAM, only output buffer (and its length) is needed to be set, but not an input one. So it indeed is more correct.
It fixes buffer overflow in KsProbeStreamIrp when attempting to perform the streaming via KsStreamIo. I discovered this bug during my audio refactoring from PR #4660.
Can be observed on the buildbots:
2023-09-17T14:19:34.2051345Z [10663/14808] Building CXX object drivers\wdm\audio\drivers\CMIDriver\cmicontrol\CMakeFiles\cmicontrol.dir\main.cpp.obj
2023-09-17T14:19:34.2052611Z D:\a\reactos\reactos\src\drivers\wdm\audio\drivers\CMIDriver\cmicontrol\main.cpp(818): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
transport calls to LibTCPConnect that suffer certain early failures
like parameter errors or early route lookup failures return without
initializing the pcb.
In order to avoid later BSOD's this change clears the
ConnectionRequest bucket in those cases.