Author: tfaber
Date: Sun Mar 5 11:24:31 2017
New Revision: 74077
URL: http://svn.reactos.org/svn/reactos?rev=74077&view=rev
Log:
[FREELDR]
- "ReactOS Medium" isn't a trademark or anything, no need to capitalize it
Modified:
trunk/reactos/boot/freeldr/bootsect/isoboot.S
Modified: trunk/reactos/boot/freeldr/bootsect/isoboot.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/bootsect/isob…
==============================================================================
--- trunk/reactos/boot/freeldr/bootsect/isoboot.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/bootsect/isoboot.S [iso-8859-1] Sun Mar 5 11:24:31 2017
@@ -141,7 +141,7 @@
.read_mbr:
// Read the first sector (MBR) from the first hard disk (drive 80h) to 7C00h.
// If we then decide to boot from HDD, we already have it at the right place.
- // In case of an error (indicated by the Carry Flag), just boot SETUPLDR from our ReactOS Medium.
+ // In case of an error (indicated by the Carry Flag), just boot SETUPLDR from our ReactOS medium.
mov ax, HEX(0201)
mov dx, HEX(0080)
mov cx, HEX(0001)
@@ -150,13 +150,13 @@
jc .boot_setupldr
// Verify the signature of the read MBR.
- // If it's invalid, there is probably no OS installed and we just boot SETUPLDR from our ReactOS Medium.
+ // If it's invalid, there is probably no OS installed and we just boot SETUPLDR from our ReactOS medium.
mov ax, word ptr ds:[HEX(7C00)+510]
cmp ax, HEX(AA55)
jne .boot_setupldr
#ifdef WAIT_FOR_KEY
- // We could either boot from the ReactOS Medium or from hard disk. Let the user decide!
+ // We could either boot from the ReactOS medium or from hard disk. Let the user decide!
// Display the 'Press key' message.
call crlf_early
mov si, offset presskey_msg
@@ -172,7 +172,7 @@
add eax, 19
.poll_again:
- // Check for a keypress, boot SETUPLDR from our ReactOS Medium if a key was pressed.
+ // Check for a keypress, boot SETUPLDR from our ReactOS medium if a key was pressed.
call pollchar_and_empty
jnz .boot_setupldr
@@ -1071,7 +1071,7 @@
/* INITIALIZED VARIABLES *****************************************************/
presskey_msg:
- .ascii "Press any key to boot from the ReactOS Medium", NUL
+ .ascii "Press any key to boot from the ReactOS medium", NUL
dot_msg:
.ascii ".", NUL
isoboot_str:
Author: hbelusca
Date: Sun Mar 5 00:40:22 2017
New Revision: 74068
URL: http://svn.reactos.org/svn/reactos?rev=74068&view=rev
Log:
[WS2_32]
- Fix pointers verification in WSALookupServiceNextW and WSALookupServiceNextA;
- In WSALookupServiceNextA: Perform extra checks to see whether we failed the first local buffer allocation, and if so, retrieve the needed size by calling a first time WSALookupServiceNextW, then reallocate the temp buffer and redo a WSALookupServiceNextW call (if it still fails, then we bail out).
CID 513448.
Modified:
trunk/reactos/dll/win32/ws2_32/src/rnr.c
Modified: trunk/reactos/dll/win32/ws2_32/src/rnr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/rnr.c…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/rnr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/rnr.c [iso-8859-1] Sun Mar 5 00:40:22 2017
@@ -403,9 +403,12 @@
return SOCKET_ERROR;
}
- /* Verify pointers */
+ /*
+ * Verify pointers. Note that the size of the buffer
+ * pointed by lpqsResults is given by *lpdwBufferLength.
+ */
if (IsBadReadPtr(lpdwBufferLength, sizeof(*lpdwBufferLength)) ||
- IsBadWritePtr(lpqsResults, sizeof(*lpqsResults)))
+ IsBadWritePtr(lpqsResults, *lpdwBufferLength))
{
/* It is invalid; fail */
SetLastError(WSAEFAULT);
@@ -449,9 +452,12 @@
DPRINT("WSALookupServiceNextA: %lx\n", hLookup);
- /* Verify pointers */
+ /*
+ * Verify pointers. Note that the size of the buffer
+ * pointed by lpqsResults is given by *lpdwBufferLength.
+ */
if (IsBadReadPtr(lpdwBufferLength, sizeof(*lpdwBufferLength)) ||
- IsBadWritePtr(lpqsResults, sizeof(*lpqsResults)))
+ IsBadWritePtr(lpqsResults, *lpdwBufferLength))
{
/* It is invalid; fail */
SetLastError(WSAEFAULT);
@@ -465,13 +471,24 @@
{
/* Allocate the buffer we'll use */
UnicodeQuerySet = HeapAlloc(WsSockHeap, 0, UnicodeQuerySetSize);
- if (!UnicodeQuerySet) UnicodeQuerySetSize = 0;
+ if (!UnicodeQuerySet)
+ {
+ /*
+ * We failed, possibly because the specified size was too large?
+ * Retrieve the needed buffer size with the WSALookupServiceNextW
+ * call and retry again a second time.
+ */
+ UnicodeQuerySetSize = 0;
+ }
}
else
{
- /* His buffer is too small */
+ /*
+ * The buffer is too small. Retrieve the needed buffer size with
+ * the WSALookupServiceNextW call and return it to the caller.
+ */
+ UnicodeQuerySet = NULL;
UnicodeQuerySetSize = 0;
- UnicodeQuerySet = NULL;
}
/* Call the Unicode Function */
@@ -479,13 +496,39 @@
dwControlFlags,
&UnicodeQuerySetSize,
UnicodeQuerySet);
+
+ /*
+ * Check whether we actually just retrieved the needed buffer size
+ * because our previous local allocation did fail. If so, allocate
+ * a new buffer and retry again.
+ */
+ if ( (!UnicodeQuerySet) && (*lpdwBufferLength >= sizeof(WSAQUERYSETW)) &&
+ (ErrorCode == SOCKET_ERROR) && (GetLastError() == WSAEFAULT) )
+ {
+ /* Allocate the buffer we'll use */
+ UnicodeQuerySet = HeapAlloc(WsSockHeap, 0, UnicodeQuerySetSize);
+ if (UnicodeQuerySet)
+ {
+ /* Call the Unicode Function */
+ ErrorCode = WSALookupServiceNextW(hLookup,
+ dwControlFlags,
+ &UnicodeQuerySetSize,
+ UnicodeQuerySet);
+ }
+ /*
+ * Otherwise the allocation failed and we
+ * fall back into the error checks below.
+ */
+ }
+
if (ErrorCode == ERROR_SUCCESS)
{
- /* Not convert to ANSI */
+ /* Now convert back to ANSI */
ErrorCode = MapUnicodeQuerySetToAnsi(UnicodeQuerySet,
lpdwBufferLength,
lpqsResults);
- if (ErrorCode != ERROR_SUCCESS) SetLastError(ErrorCode);
+ if (ErrorCode != ERROR_SUCCESS)
+ SetLastError(ErrorCode);
}
else
{
@@ -499,10 +542,11 @@
}
/* If we had a local buffer, free it */
- if (UnicodeQuerySet) HeapFree(WsSockHeap, 0, UnicodeQuerySet);
+ if (UnicodeQuerySet)
+ HeapFree(WsSockHeap, 0, UnicodeQuerySet);
/* Return to caller */
- return ErrorCode == ERROR_SUCCESS ? ErrorCode : SOCKET_ERROR;
+ return (ErrorCode == ERROR_SUCCESS) ? ErrorCode : SOCKET_ERROR;
}
/*