[PATCH 1/2] wpcap: Implement pcap_dump_open and pcap_dump

Jianqiu Zhang zhangjianqiu_133 at yeah.net
Wed Feb 10 22:44:21 CST 2016


Hi, Slackner

Thanks for your so detailed reply and suggestions

I am working on error handling part of the code and I am a bit confused
I looked up RtlAnsiStringToUnicodeString function , and found it would return
3 different ERROR STATUS,  given below: 
--snip--

 * RETURNS
 *  Success: STATUS_SUCCESS. uni contains the converted string
 *  Failure: STATUS_BUFFER_OVERFLOW, if doalloc is FALSE and ansi is too small.
 *           STATUS_NO_MEMORY, if doalloc is TRUE and the allocation fails.
 *           STATUS_INVALID_PARAMETER_2, if the unicode string would be larger than 65535.
 *

--snip--

For what error code will STATUS_INVALID_PARAMETER_2 Give , I can test by manually set the filename to a very long string, but I cannot test What ERROR code will be given
when STATUS_NO_MEMORY returned in Windows, I try to allocate the memory until no more memory can be allocated with while(malloc(1)); but I get the same error code as STATUS_INVALID_PARAMETER_2 give

And what's more, I found something maybe interesting ,or strange

* On wine When the filename length is 65536 , the RtlAnsiStringToUnicodeString will pass successfully
  and it will fail on RtlDosPathNameToNtPathName_U when the filename length is a bit shorter or equal 65535, it will fail on RtlAnsiStringToUnicodeString , why a longer string can pass the RtlAnsiStringToUnicodeString function, What I guess is overflow, but I haven't dig into it yet

* And another strange thing is On windows DumpFile_Test fail when the filename_length is longer than 218 chars(218 works well), On wine no errors happen until the filename length is longer than 255 (255 works well)

If no NTSTATUS ERRORCODE return and RtlDosPahNameToNtPathName_U return TRUE, I cannot set the errorcode , so when the filename length is between 218 to 255 , the pcap_dump_open will behave differently on win and wine, Should I use strlen to compare the string length of filename and set a errorcode when the filename length is longer than 218?



And By the way , I haven't correct my Memory leak problem, I will correct when send my patch :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20160211/63f73778/attachment.html>


More information about the wine-devel mailing list