Steven has repeatedly asked for credit, and I quote:
" Please add the appropriate copyright headers to the source file stating the original author when implementing code based on third party sources."
Is there a reason for not doing it this time?
Secondly, why are things being implemented in stubs?
Thirdly, it's worth checking implementations before moving out of stubs. Just because Wine does something, doesn't mean it's correct for us. DnsHostnameToComputerName should call RtlDnsHostNameToComputerName.
I stopped checking the rest of the code as soon as I read that, in case someone assumes I looked at everything.
Fourthly, I'm willing to bet this email gets ignored too.
Please take a little more time over commits.
Ged.
-----Original Message----- From: ros-diffs-bounces@reactos.org [mailto:ros-diffs-bounces@reactos.org] On Behalf Of dchapyshev@svn.reactos.org Sent: 17 November 2008 11:54 To: ros-diffs@reactos.org Subject: [ros-diffs] [dchapyshev] 37396: - Implement BindIoCompletionCallback, ReadFileScatter, WriteFileGather (based on Wine) - Move DnsHostnameToComputerNameA/W to computername.c
Author: dchapyshev Date: Mon Nov 17 05:53:59 2008 New Revision: 37396
URL: http://svn.reactos.org/svn/reactos?rev=37396&view=rev Log: - Implement BindIoCompletionCallback, ReadFileScatter, WriteFileGather (based on Wine) - Move DnsHostnameToComputerNameA/W to computername.c
Modified: trunk/reactos/dll/win32/kernel32/misc/computername.c trunk/reactos/dll/win32/kernel32/misc/stubs.c
Modified: trunk/reactos/dll/win32/kernel32/misc/computername.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/com... ============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/computername.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/computername.c [iso-8859-1] Mon Nov 17 05:53:59 2008 @@ -461,4 +461,73 @@ } }
+ +/* + * @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 */
Modified: trunk/reactos/dll/win32/kernel32/misc/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/stu... ============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] Mon Nov 17 05:53:59 2008 @@ -342,18 +342,29 @@ }
/* - * @unimplemented - */ -BOOL -STDCALL -BindIoCompletionCallback ( - HANDLE FileHandle, - LPOVERLAPPED_COMPLETION_ROUTINE Function, - ULONG Flags - ) -{ - STUB; - return 0; + * @implemented + */ +BOOL +STDCALL +BindIoCompletionCallback(HANDLE FileHandle, + LPOVERLAPPED_COMPLETION_ROUTINE Function, + ULONG Flags) +{ + NTSTATUS Status = 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 @@ }
/* - * @unimplemented - */ -BOOL -STDCALL -ReadFileScatter( - HANDLE hFile, - FILE_SEGMENT_ELEMENT aSegmentArray[], - DWORD nNumberOfBytesToRead, - LPDWORD lpReserved, - LPOVERLAPPED lpOverlapped - ) -{ - STUB; - return 0; + * @implemented + */ +BOOL +STDCALL +ReadFileScatter(HANDLE hFile, + FILE_SEGMENT_ELEMENT aSegmentArray[], + DWORD nNumberOfBytesToRead, + LPDWORD lpReserved, + LPOVERLAPPED lpOverlapped) +{ + PIO_STATUS_BLOCK pIOStatus; + 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 @@ }
/* - * @unimplemented - */ -BOOL -STDCALL -WriteFileGather( - HANDLE hFile, - FILE_SEGMENT_ELEMENT aSegmentArray[], - DWORD nNumberOfBytesToWrite, - LPDWORD lpReserved, - LPOVERLAPPED lpOverlapped - ) -{ - STUB; - return 0; + * @implemented + */ +BOOL +STDCALL +WriteFileGather(HANDLE hFile, + FILE_SEGMENT_ELEMENT aSegmentArray[], + DWORD nNumberOfBytesToWrite, + LPDWORD lpReserved, + LPOVERLAPPED lpOverlapped) +{ + PIO_STATUS_BLOCK IOStatus; + 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; }
/* @@ -705,39 +766,6 @@ { STUB; 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; }
/* @@ -919,21 +947,6 @@ /* * @unimplemented */ -BOOL -STDCALL -DnsHostnameToComputerNameA ( - LPCSTR Hostname, - LPSTR ComputerName, - LPDWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ HANDLE STDCALL FindFirstVolumeMountPointA( @@ -947,23 +960,22 @@ }
/* - * @unimplemented - */ -BOOL -STDCALL -FindNextVolumeA( - HANDLE handle, - LPSTR volume, - DWORD len - ) -{ - WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + * @implemented + */ +BOOL +STDCALL +FindNextVolumeA(HANDLE handle, + LPSTR volume, + DWORD len) +{ + WCHAR *buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); BOOL ret;
if ((ret = FindNextVolumeW( handle, buffer, len ))) { if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL )) ret = FALSE; } + HeapFree( GetProcessHeap(), 0, buffer ); return ret; }