mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[DRIVERS] Replace obsolete RtlConvert*ToLargeInteger calls with inline equivalents (#8721)
RtlConvertUlongToLargeInteger and RtlConvertLongToLargeInteger are obsolete NT routines that assign a 32-bit integer to LARGE_INTEGER.QuadPart. Replace all driver/DLL usages with inline .QuadPart assignments or standard C/C++ casts. This removes unnecessary function calls. CORE-19438
This commit is contained in:
@@ -768,7 +768,7 @@ WSPCloseSocket(IN SOCKET Handle,
|
||||
{
|
||||
if (LingerWait <= 0)
|
||||
{
|
||||
DisconnectInfo.Timeout = RtlConvertLongToLargeInteger(0);
|
||||
DisconnectInfo.Timeout.QuadPart = 0LL;
|
||||
DisconnectInfo.DisconnectType = LingerWait < 0 ? AFD_DISCONNECT_SEND : AFD_DISCONNECT_ABORT;
|
||||
|
||||
if (((DisconnectInfo.DisconnectType & AFD_DISCONNECT_SEND) && (!Socket->SharedData->SendShutdown)) ||
|
||||
@@ -2326,7 +2326,7 @@ WSPShutdown(SOCKET Handle,
|
||||
break;
|
||||
}
|
||||
|
||||
DisconnectInfo.Timeout = RtlConvertLongToLargeInteger(-1000000);
|
||||
DisconnectInfo.Timeout.QuadPart = -1000000LL;
|
||||
|
||||
/* Send IOCTL */
|
||||
Status = NtDeviceIoControlFile((HANDLE)Handle,
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#define MAX(value1, value2) \
|
||||
((value1 > value2)? value1 : value2)
|
||||
|
||||
#define RTL_CONSTANT_LARGE_INTEGER(quad_part) {{(quad_part), (quad_part) >> 32}}
|
||||
|
||||
#define ExInterlockedRemoveEntryList(_List,_Lock) \
|
||||
{ KIRQL OldIrql; \
|
||||
KeAcquireSpinLock(_Lock, &OldIrql); \
|
||||
|
||||
@@ -1039,16 +1039,15 @@ NdisMRegisterIoPortRange(
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called - InitialPort 0x%x, NumberOfPorts 0x%x\n", InitialPort, NumberOfPorts));
|
||||
|
||||
memset(&PortAddress, 0, sizeof(PortAddress));
|
||||
|
||||
/*
|
||||
* FIXME: NDIS 5+ completely ignores the InitialPort parameter, but
|
||||
* we don't have a way to get the I/O base address yet (see
|
||||
* NDIS_MINIPORT_BLOCK->AllocatedResources and
|
||||
* NDIS_MINIPORT_BLOCK->AllocatedResourcesTranslated).
|
||||
*/
|
||||
PortAddress.QuadPart = 0ULL;
|
||||
if(InitialPort)
|
||||
PortAddress = RtlConvertUlongToLargeInteger(InitialPort);
|
||||
PortAddress.QuadPart = (ULONGLONG)InitialPort;
|
||||
else
|
||||
ASSERT(FALSE);
|
||||
|
||||
@@ -1104,7 +1103,7 @@ NdisMDeregisterIoPortRange(IN NDIS_HANDLE MiniportAdapterHandle,
|
||||
*/
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportAdapterHandle;
|
||||
PHYSICAL_ADDRESS PortAddress = RtlConvertUlongToLargeInteger(InitialPort);
|
||||
PHYSICAL_ADDRESS PortAddress = RTL_CONSTANT_LARGE_INTEGER((ULONGLONG)InitialPort);
|
||||
PHYSICAL_ADDRESS TranslatedAddress;
|
||||
ULONG AddressSpace = 1;
|
||||
|
||||
|
||||
@@ -77,10 +77,11 @@ NdisAllocateMemory(
|
||||
if (MemoryFlags & NDIS_MEMORY_CONTIGUOUS)
|
||||
{
|
||||
/* Allocate contiguous memory (possibly noncached) */
|
||||
const PHYSICAL_ADDRESS ZeroAddress = RTL_CONSTANT_LARGE_INTEGER(0LL);
|
||||
*VirtualAddress = MmAllocateContiguousMemorySpecifyCache(Length,
|
||||
RtlConvertUlongToLargeInteger(0),
|
||||
ZeroAddress,
|
||||
HighestAcceptableAddress,
|
||||
RtlConvertUlongToLargeInteger(0),
|
||||
ZeroAddress,
|
||||
(MemoryFlags & NDIS_MEMORY_NONCACHED) ? MmNonCached : MmCached);
|
||||
}
|
||||
else if (MemoryFlags & NDIS_MEMORY_NONCACHED)
|
||||
|
||||
@@ -47,7 +47,7 @@ CPortWaveRTStreamInit::AllocatePagesForMdl(
|
||||
IN PHYSICAL_ADDRESS HighAddress,
|
||||
IN SIZE_T TotalBytes)
|
||||
{
|
||||
return MmAllocatePagesForMdl(RtlConvertUlongToLargeInteger(0), HighAddress, RtlConvertUlongToLargeInteger(0), TotalBytes);
|
||||
return MmAllocatePagesForMdl(PHYSICAL_ADDRESS{0LL}, HighAddress, PHYSICAL_ADDRESS{0LL}, TotalBytes);
|
||||
}
|
||||
|
||||
PMDL
|
||||
@@ -61,7 +61,7 @@ CPortWaveRTStreamInit::AllocateContiguousPagesForMdl(
|
||||
PVOID Buffer;
|
||||
PHYSICAL_ADDRESS Address;
|
||||
|
||||
Buffer = MmAllocateContiguousMemorySpecifyCache(TotalBytes, LowAddress, HighAddress, RtlConvertUlongToLargeInteger(0), MmNonCached);
|
||||
Buffer = MmAllocateContiguousMemorySpecifyCache(TotalBytes, LowAddress, HighAddress, PHYSICAL_ADDRESS{0LL}, MmNonCached);
|
||||
if (!Buffer)
|
||||
{
|
||||
DPRINT("MmAllocateContiguousMemorySpecifyCache failed\n");
|
||||
@@ -72,7 +72,7 @@ CPortWaveRTStreamInit::AllocateContiguousPagesForMdl(
|
||||
|
||||
MmFreeContiguousMemorySpecifyCache(Buffer, TotalBytes, MmNonCached);
|
||||
|
||||
Mdl = MmAllocatePagesForMdl(Address, HighAddress, RtlConvertUlongToLargeInteger(0), TotalBytes);
|
||||
Mdl = MmAllocatePagesForMdl(Address, HighAddress, PHYSICAL_ADDRESS{0LL}, TotalBytes);
|
||||
if (!Mdl)
|
||||
{
|
||||
DPRINT("MmAllocatePagesForMdl failed\n");
|
||||
@@ -141,7 +141,7 @@ CPortWaveRTStreamInit::GetPhysicalPageAddress(
|
||||
if (Pages <= Index)
|
||||
{
|
||||
DPRINT("OutOfBounds: Pages %u Index %u\n", Pages, Index);
|
||||
return RtlConvertUlongToLargeInteger(0);
|
||||
return PHYSICAL_ADDRESS{0LL};
|
||||
}
|
||||
|
||||
Buffer = (PUCHAR)MmGetSystemAddressForMdlSafe(MemoryDescriptorList, LowPagePriority) + (Index * PAGE_SIZE);
|
||||
|
||||
@@ -130,7 +130,7 @@ HalpGetResourceSortValue(IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor,
|
||||
|
||||
/* Interrupt goes by level */
|
||||
*Scale = 0;
|
||||
*Value = RtlConvertUlongToLargeInteger(Descriptor->u.Interrupt.Level);
|
||||
Value->QuadPart = (LONGLONG)Descriptor->u.Interrupt.Level;
|
||||
break;
|
||||
|
||||
case CmResourceTypePort:
|
||||
@@ -151,7 +151,7 @@ HalpGetResourceSortValue(IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor,
|
||||
|
||||
/* Anything else */
|
||||
*Scale = 4;
|
||||
*Value = RtlConvertUlongToLargeInteger(0);
|
||||
Value->QuadPart = 0LL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user