CreateNamedPipe error values?

Dan Kegel dank at kegel.com
Wed Feb 12 02:35:00 CST 2003


I wrote a humble beginning of a conformance test for
named pipes, in hopes of preventing regressions like the one which
is currently breaking Installshield installs (or was last I checked).

Later it's going to verify that named pipes like
the ones Wine uses internally (e.g. in ole32/rpc.c) actually work,
For now I thought I'd just make sure we return the right
error code if you pass a bogus filename to CreateNamedPipe.
But, um, we don't return any error code; we happily succeed.

Can somebody who has Windows Server run this little test,
and tell me what it outputs?  You can build it as part
of the wine test suite, or standalone with the commands

call \vcvars32.bat
cl /D STANDALONE /D _X86_ /D _M_IX86 /D WIN32 /D _WINDOWS pipe.c

Thanks,
Dan

-- 
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045
-------------- next part --------------
0a1,61
> /*
>  * Unit tests for named pipe functions in Wine
>  *
>  * Copyright (c) 2002 Dan Kegel
>  *
>  * This library is free software; you can redistribute it and/or
>  * modify it under the terms of the GNU Lesser General Public
>  * License as published by the Free Software Foundation; either
>  * version 2.1 of the License, or (at your option) any later version.
>  *
>  * This library is distributed in the hope that it will be useful,
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>  * Lesser General Public License for more details.
>  *
>  * You should have received a copy of the GNU Lesser General Public
>  * License along with this library; if not, write to the Free Software
>  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
>  */
> 
> #include <stdlib.h>
> #include <stdio.h>
> #include <time.h>
> 
> #ifndef STANDALONE
> #include "wine/test.h"
> #else
> #include <assert.h>
> #define START_TEST(name) main(int argc, char **argv)
> #define ok(condition, msg) assert(condition)
> #endif
> 
> #include <windef.h>
> #include <winbase.h>
> #include <winerror.h>
> #include <wtypes.h>
> 
> void test_CreateNamedPipeA(void)
> {
>     HANDLE hnp;
>     char filename[MAX_PATH];
> 
> 	sprintf(filename, "not a named pipe name");
>     hnp = CreateNamedPipeA(filename, 
> 			PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE|PIPE_READMODE_BYTE|PIPE_WAIT, 
> 			/* nMaxInstances */ 1,
> 			/* nOutBufSize */ 1024,
> 			/* nInBufSize */ 1024,
> 			/* nDefaultWait */ 1000,
> 			/* lpSecurityAttrib */ NULL);
> 
> 	printf("h %p, err %ld\n", hnp, GetLastError());
>     ok(hnp == INVALID_HANDLE_VALUE && GetLastError() == ERROR_INVALID_NAME,
>         "CreateNamedPipe should fail if name doesn't start with \\\\.\\pipe");
> }
> 
> START_TEST(pipe)
> {
> 	test_CreateNamedPipeA();
> }
> 


More information about the wine-devel mailing list