- Implement BindIoCompletionCallback, ReadFileScatter, WriteFileGather (based on Wine)

- Move DnsHostnameToComputerNameA/W to computername.c

svn path=/trunk/; revision=37396
This commit is contained in:
Dmitry Chapyshev 2008-11-17 11:53:59 +00:00
parent 33d335d8e1
commit 375eea5424
2 changed files with 164 additions and 83 deletions

View file

@ -461,4 +461,73 @@ SetComputerNameExW (
} }
} }
/*
* @implemented
*/
BOOL
STDCALL
DnsHostnameToComputerNameA(LPCSTR Hostname,
LPSTR ComputerName,
LPDWORD nSize)
{
DWORD len;
DPRINT("(%s, %p, %p)\n", Hostname, ComputerName, nSize);
if (!Hostname || !nSize)
return FALSE;
len = lstrlenA(Hostname);
if (len > MAX_COMPUTERNAME_LENGTH)
len = MAX_COMPUTERNAME_LENGTH;
if (*nSize < len)
{
*nSize = len;
return FALSE;
}
if (!ComputerName) return FALSE;
memcpy( ComputerName, Hostname, len );
ComputerName[len + 1] = 0;
return TRUE;
}
/*
* @implemented
*/
BOOL
STDCALL
DnsHostnameToComputerNameW (
LPCWSTR hostname,
LPWSTR computername,
LPDWORD size
)
{
DWORD len;
DPRINT("(%s, %p, %p): stub\n", hostname, computername, size);
if (!hostname || !size) return FALSE;
len = lstrlenW(hostname);
if (len > MAX_COMPUTERNAME_LENGTH)
len = MAX_COMPUTERNAME_LENGTH;
if (*size < len)
{
*size = len;
return FALSE;
}
if (!computername) return FALSE;
memcpy( computername, hostname, len * sizeof(WCHAR) );
computername[len + 1] = 0;
return TRUE;
}
/* EOF */ /* EOF */

View file

@ -342,18 +342,29 @@ AllocateUserPhysicalPages(
} }
/* /*
* @unimplemented * @implemented
*/ */
BOOL BOOL
STDCALL STDCALL
BindIoCompletionCallback ( BindIoCompletionCallback(HANDLE FileHandle,
HANDLE FileHandle, LPOVERLAPPED_COMPLETION_ROUTINE Function,
LPOVERLAPPED_COMPLETION_ROUTINE Function, ULONG Flags)
ULONG Flags
)
{ {
STUB; NTSTATUS Status = 0;
return 0;
DPRINT("(%p, %p, %d)\n", FileHandle, Function, Flags);
Status = RtlSetIoCompletionCallback(FileHandle,
(PRTL_OVERLAPPED_COMPLETION_ROUTINE) Function,
Flags);
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
return TRUE;
} }
/* /*
@ -562,20 +573,45 @@ MapUserPhysicalPagesScatter(
} }
/* /*
* @unimplemented * @implemented
*/ */
BOOL BOOL
STDCALL STDCALL
ReadFileScatter( ReadFileScatter(HANDLE hFile,
HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[],
FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToRead,
DWORD nNumberOfBytesToRead, LPDWORD lpReserved,
LPDWORD lpReserved, LPOVERLAPPED lpOverlapped)
LPOVERLAPPED lpOverlapped
)
{ {
STUB; PIO_STATUS_BLOCK pIOStatus;
return 0; LARGE_INTEGER Offset;
NTSTATUS Status;
DPRINT("(%p %p %u %p)\n", hFile, aSegmentArray, nNumberOfBytesToRead, lpOverlapped);
Offset.LowPart = lpOverlapped->Offset;
Offset.HighPart = lpOverlapped->OffsetHigh;
pIOStatus = (PIO_STATUS_BLOCK) lpOverlapped;
pIOStatus->Status = STATUS_PENDING;
pIOStatus->Information = 0;
Status = NtReadFileScatter(hFile,
NULL,
NULL,
NULL,
pIOStatus,
aSegmentArray,
nNumberOfBytesToRead,
&Offset,
NULL);
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
return TRUE;
} }
/* /*
@ -678,20 +714,45 @@ SetThreadExecutionState(
} }
/* /*
* @unimplemented * @implemented
*/ */
BOOL BOOL
STDCALL STDCALL
WriteFileGather( WriteFileGather(HANDLE hFile,
HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[],
FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToWrite,
DWORD nNumberOfBytesToWrite, LPDWORD lpReserved,
LPDWORD lpReserved, LPOVERLAPPED lpOverlapped)
LPOVERLAPPED lpOverlapped
)
{ {
STUB; PIO_STATUS_BLOCK IOStatus;
return 0; LARGE_INTEGER Offset;
NTSTATUS Status;
DPRINT("%p %p %u %p\n", hFile, aSegmentArray, nNumberOfBytesToWrite, lpOverlapped);
Offset.LowPart = lpOverlapped->Offset;
Offset.HighPart = lpOverlapped->OffsetHigh;
IOStatus = (PIO_STATUS_BLOCK) lpOverlapped;
IOStatus->Status = STATUS_PENDING;
IOStatus->Information = 0;
Status = NtWriteFileGather(hFile,
NULL,
NULL,
NULL,
IOStatus,
aSegmentArray,
nNumberOfBytesToWrite,
&Offset,
NULL);
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
return TRUE;
} }
/* /*
@ -707,39 +768,6 @@ DeleteVolumeMountPointW(
return 0; return 0;
} }
/*
* @unimplemented
*/
BOOL
STDCALL
DnsHostnameToComputerNameW (
LPCWSTR hostname,
LPWSTR computername,
LPDWORD size
)
{
DWORD len;
DPRINT("(%s, %p, %p): stub\n", hostname, computername, size);
if (!hostname || !size) return FALSE;
len = lstrlenW(hostname);
if (len > MAX_COMPUTERNAME_LENGTH)
len = MAX_COMPUTERNAME_LENGTH;
if (*size < len)
{
*size = len;
return FALSE;
}
if (!computername) return FALSE;
memcpy( computername, hostname, len * sizeof(WCHAR) );
computername[len + 1] = 0;
return TRUE;
}
/* /*
* @unimplemented * @unimplemented
*/ */
@ -916,21 +944,6 @@ DeleteVolumeMountPointA(
return 0; return 0;
} }
/*
* @unimplemented
*/
BOOL
STDCALL
DnsHostnameToComputerNameA (
LPCSTR Hostname,
LPSTR ComputerName,
LPDWORD nSize
)
{
STUB;
return 0;
}
/* /*
* @unimplemented * @unimplemented
*/ */
@ -947,23 +960,22 @@ FindFirstVolumeMountPointA(
} }
/* /*
* @unimplemented * @implemented
*/ */
BOOL BOOL
STDCALL STDCALL
FindNextVolumeA( FindNextVolumeA(HANDLE handle,
HANDLE handle, LPSTR volume,
LPSTR volume, DWORD len)
DWORD len
)
{ {
WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); WCHAR *buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
BOOL ret; BOOL ret;
if ((ret = FindNextVolumeW( handle, buffer, len ))) if ((ret = FindNextVolumeW( handle, buffer, len )))
{ {
if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL )) ret = FALSE; if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL )) ret = FALSE;
} }
HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
return ret; return ret;
} }