[PATCH] wineconsole: Set input stream buffer length per OS limit

Hugh McMaster hugh.mcmaster at outlook.com
Thu Mar 26 07:58:58 CDT 2015


----------------------------------------
On Thu, 26 Mar 2015 14:39:50 +0300, Nikolay Sivov wrote:
> On 26.03.2015 14:32, Hugh McMaster wrote:
>> ---
>> programs/wineconsole/wineconsole.c | 32 ++++++++++++++++++++++++++++++--
>> 1 file changed, 30 insertions(+), 2 deletions(-)
>>
>> diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c
>> index 3c2faf5..81300ed 100644
>> --- a/programs/wineconsole/wineconsole.c
>> +++ b/programs/wineconsole/wineconsole.c
>> @@ -797,6 +797,11 @@ static UINT WINECON_ParseOptions(const char* lpCmdLine, struct wc_init* wci)
>> return 0;
>> }
>>
>> +#define MAXSTRING_NON_NT 128
>> +#define MAXSTRING_NT351 260
>> +#define MAXSTRING_NT4_W2K 2048
>> +#define MAXSTRING_XP 8192
>> +
>
> Why do you need this mess?

To avoid magic numbers, unless you think that's unnecessary here.

The Windows command line (cmd or command.com) limits the maximum length of an input string. [1]

The limits are defined as that 'mess' above. :)

Windows 3.x, 95, 98, ME --> 128 characters
NT 3.51 --> 260 characters
NT 4, W2K --> 2048 characters
XP, Vista, 7, etc. --> 8192 characters

I was actually wondering if using a standard buffer[8192] would be better in this case, as it allocates enough memory for all of the above.

Somehow this functionality needs to be extended to cmd itself. Windows blocks input in cmd at the defines -1, e.g. 8191 characters in XP and above.

[1] http://support.microsoft.com/en-us/kb/830473
 		 	   		  


More information about the wine-devel mailing list