/* INCLUDES *****************************************************************/
#include <k32.h>
+#include <wine/debug.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(kernel32file);
-#define NDEBUG
//#define USING_PROPER_NPFS_WAIT_SEMANTICS
-#include <debug.h>
/* FUNCTIONS ****************************************************************/
* @implemented
*/
HANDLE
-STDCALL
+WINAPI
CreateNamedPipeW(LPCWSTR lpName,
DWORD dwOpenMode,
DWORD dwPipeMode,
return INVALID_HANDLE_VALUE;
}
- DPRINT("Pipe name: %wZ\n", &NamedPipeName);
- DPRINT("Pipe name: %S\n", NamedPipeName.Buffer);
+ TRACE("Pipe name: %wZ\n", &NamedPipeName);
+ TRACE("Pipe name: %S\n", NamedPipeName.Buffer);
/* Always case insensitive, check if we got extra attributes */
Attributes = OBJ_CASE_INSENSITIVE;
if (!NT_SUCCESS(Status))
{
/* Failed to create it */
- DPRINT1("NtCreateNamedPipe failed (Status %x)!\n", Status);
+ WARN("NtCreateNamedPipe failed (Status %x)!\n", Status);
SetLastErrorByStatus (Status);
return INVALID_HANDLE_VALUE;
}
UNICODE_STRING NameU;
/* Convert the name to Unicode */
- Basep8BitStringToLiveUnicodeString(&NameU, lpNamedPipeName);
+ Basep8BitStringToHeapUnicodeString(&NameU, lpNamedPipeName);
/* Call the Unicode API */
r = WaitNamedPipeW(NameU.Buffer, nTimeOut);
PFILE_PIPE_WAIT_FOR_BUFFER WaitPipeInfo;
/* Start by making a unicode string of the name */
- DPRINT("Sent path: %S\n", lpNamedPipeName);
+ TRACE("Sent path: %S\n", lpNamedPipeName);
RtlCreateUnicodeString(&NamedPipeName, lpNamedPipeName);
NameLength = NamedPipeName.Length / sizeof(WCHAR);
NewName.Length -= 9 * sizeof(WCHAR);
/* Initialize the Dos Devices name */
- DPRINT("NewName: %wZ\n", &NewName);
+ TRACE("NewName: %wZ\n", &NewName);
RtlInitUnicodeString(&DevicePath, L"\\DosDevices\\pipe\\");
}
else if (Type == RtlPathTypeRootLocalDevice)
else
{
/* The name is invalid */
- DPRINT1("Invalid name!\n");
+ WARN("Invalid name!\n");
SetLastErrorByStatus(STATUS_OBJECT_PATH_SYNTAX_BAD);
return FALSE;
}
}
else
{
- DPRINT1("Invalid path type\n");
+ WARN("Invalid path type\n");
SetLastErrorByStatus(STATUS_OBJECT_PATH_SYNTAX_BAD);
return FALSE;
}
}
/* Initialize the object attributes */
- DPRINT("Opening: %wZ\n", &DevicePath);
+ TRACE("Opening: %wZ\n", &DevicePath);
InitializeObjectAttributes(&ObjectAttributes,
&DevicePath,
OBJ_CASE_INSENSITIVE,
if (!NT_SUCCESS(Status))
{
/* Fail; couldn't open */
- DPRINT1("Status: %lx\n", Status);
+ WARN("Status: %lx\n", Status);
SetLastErrorByStatus(Status);
RtlFreeUnicodeString(&NamedPipeName);
RtlFreeHeap(RtlGetProcessHeap(), 0, WaitPipeInfo);
if (!NT_SUCCESS(Status))
{
/* Failure to wait on the pipe */
- DPRINT1("Status: %lx\n", Status);
+ WARN("Status: %lx\n", Status);
SetLastErrorByStatus (Status);
return FALSE;
}
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
+ RtlFreeUnicodeString(&NamedPipeName);
return FALSE;
}
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
+ RtlFreeUnicodeString(&NamedPipeName);
return FALSE;
}
+ RtlFreeUnicodeString(&NamedPipeName);
return TRUE;
}
#endif
LPSTR lpUserName,
DWORD nMaxUserNameSize)
{
- UNICODE_STRING UserNameW = {0};
+ UNICODE_STRING UserNameW = { 0, 0, NULL };
ANSI_STRING UserNameA;
BOOL Ret;
NTSTATUS Status;
/* Calculate the buffer space that we'll need and allocate it */
- BufferSize = nBufferSize + FIELD_OFFSET(FILE_PIPE_PEEK_BUFFER, Data[0]);
+ BufferSize = nBufferSize + sizeof(FILE_PIPE_PEEK_BUFFER);
Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, BufferSize);
if (Buffer == NULL)
{