MAXPNAMELEN

Zebediah Figura (she/her) zfigura at codeweavers.com
Thu Jan 28 22:00:37 CST 2021


Hello Doug,

On 1/28/21 8:02 PM, Doug Kingston wrote:
> dlls/include/mmsystem.h:#define MAXPNAMELEN      32     /* max product
> name length (including NULL) */
> 
> I wanted to know what the reason was for bounding this string to only 32
> bytes (actually 31 + null).  We have a situation with identical devices
> and need to add some differentiating text to that string when multiple
> identical devices exist so that applications can choose the correct
> device.  
> 
> Our device product string is "USB PnP Sound Device" (20 chars).
> mmdevdrv.c:static WCHAR *construct_device_id() then prefixs with either
> "In: " (4 chars) or "Out: " (5 chars) and concatenates " - USB" (6 chars).
> 
>     In: USB PnP Sound Device - USB
>     Out: USB PnP Sound Device - USB
> 
> Total string length is 30 or 31 characters.  Any additional text added
> at the end will get truncated and a prefix will cause the existing
> string to be truncated.
> 

The limit here is imposed by Microsoft, and is necessary for ABI and API
compatibility.

Note however that it only applies to the old WinMM subsystem, and that
no such limit is enforced in WASAPI (aka mmdevapi) or DirectSound. I
don't know about XAudio, but I'd be surprised if it has such a limit
either. Of course, if you're dealing with MIDI devices, WinMM is (I
believe) the only extant API, and there's not really anything that can
be done in that case.

> -Doug-
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210128/465640e4/attachment.sig>


More information about the wine-devel mailing list