<br>Hi, sorry for the late reply<br><br>I have met some problem when implementing wine_pcap_dump_open <br>My wine_pcap_dump_open code goes like this<br><br>--snip--<br><br>pcap_dumper_t* CDECL wine_pcap_dump_open(pcap_t *p, const char *fname)<br>{<br>    UNICODE_STRING nt_name, dospathW;<br>    ANSI_STRING fname_dos;<br>    ANSI_STRING fname_unix;<br>    int res;<br>    fname_unix.Buffer = NULL;<br>    RtlInitAnsiString(&fname_dos, fname);<br>    RtlInitAnsiString(&fname_unix, NULL);<br>    res = RtlAnsiStringToUnicodeString(&dospathW, &fname_dos, TRUE);<br>    res = RtlDosPathNameToNtPathName_U(dospathW.Buffer, &nt_name, NULL, NULL);<br>    if(!res)<br>    {<br>        printf("RtlDosPathNameToNtPathName_U failed\n");<br>        return NULL;<br>    }<br>    res  = wine_nt_to_unix_file_name(&nt_name, &fname_unix, FILE_OPEN_IF, FALSE);<br>    printf("#1 ERRCODE is %X\n", GetLastError());<br>    printf("VOID_DEBUG: Nt FileName is %s\n", wine_dbgstr_w(nt_name.Buffer));<br>    if(res != 0 && res != 0xC000000F)<br>    {<br>        SetLastError(0xB7);<br>        printf("wine_nt_to_unix_file_name failed\n");<br>        printf("#2 ERRCODE is %X\n", GetLastError());<br>        return NULL;<br>    }<br>    RtlFreeUnicodeString(&nt_name);<br>    printf("#3 ERRCODE is %X\n", GetLastError());<br>    RtlFreeAnsiString(&fname_dos);<br>    //HeapFree(GetProcessHeap(), 0, fname_dos.Buffer);<br>    printf("#4 ERRCODE is %X\n", GetLastError());<br>    //SetLastError(0xB7);<br>    return pcap_dump_open(p, fname_unix.Buffer);<br>}<br><br>--snip--<br><br>And I modify the test program source code , the source is attached in the attachment(test.c)<br><br>And I run the same test both on win32(XP) and wine , Below are my tests:<br><br>1. test.exe "AFileNameDoesNotExist" on wine it gets errorcode 0x57 on Windows it gets errorcode 0x00, Both get the correct dumpfile<br>2. test.exe "NameThatExists" on wine it gets errorcode 0x57, on windows it gets errorcode 0xB7, both overwrite the previous file and get the correct dumpfile<br><br>And I dig into the code found RtlFreeAnsiString calls two functions RtlFreeHeap and RtlZeroMemory both give the errorcode 0x57(ERROR_INVALID_PARAMETER) , I wonder why this happens<br>If it's a undefined behavior, can I use SetLastError(0) to Manually reset the error code? Thanks in advance<br>