mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 11:31:40 +00:00
[NTOS][NDK][RTL] A bunch of 'wrong size' fixes
This commit is contained in:
parent
4d35d59fb9
commit
d6792047f3
8 changed files with 21 additions and 16 deletions
|
@ -316,7 +316,7 @@ LdrLoadDll(IN PWSTR SearchPath OPTIONAL,
|
||||||
UNICODE_STRING DllString1, DllString2;
|
UNICODE_STRING DllString1, DllString2;
|
||||||
BOOLEAN RedirectedDll = FALSE;
|
BOOLEAN RedirectedDll = FALSE;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Cookie;
|
ULONG_PTR Cookie;
|
||||||
PUNICODE_STRING OldTldDll;
|
PUNICODE_STRING OldTldDll;
|
||||||
PTEB Teb = NtCurrentTeb();
|
PTEB Teb = NtCurrentTeb();
|
||||||
|
|
||||||
|
@ -1117,7 +1117,7 @@ LdrEnumerateLoadedModules(IN BOOLEAN ReservedFlag,
|
||||||
PLIST_ENTRY ListHead, ListEntry;
|
PLIST_ENTRY ListHead, ListEntry;
|
||||||
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Cookie;
|
ULONG_PTR Cookie;
|
||||||
BOOLEAN Stop = FALSE;
|
BOOLEAN Stop = FALSE;
|
||||||
|
|
||||||
/* Check parameters */
|
/* Check parameters */
|
||||||
|
@ -1232,7 +1232,7 @@ LdrAddRefDll(IN ULONG Flags,
|
||||||
{
|
{
|
||||||
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
ULONG Cookie;
|
ULONG_PTR Cookie;
|
||||||
BOOLEAN Locked = FALSE;
|
BOOLEAN Locked = FALSE;
|
||||||
|
|
||||||
/* Check for invalid flags */
|
/* Check for invalid flags */
|
||||||
|
|
|
@ -610,7 +610,7 @@ GetModuleFileNameW(HINSTANCE hModule,
|
||||||
PLIST_ENTRY ModuleListHead, Entry;
|
PLIST_ENTRY ModuleListHead, Entry;
|
||||||
PLDR_DATA_TABLE_ENTRY Module;
|
PLDR_DATA_TABLE_ENTRY Module;
|
||||||
ULONG Length = 0;
|
ULONG Length = 0;
|
||||||
ULONG Cookie;
|
ULONG_PTR Cookie;
|
||||||
PPEB Peb;
|
PPEB Peb;
|
||||||
|
|
||||||
hModule = BasepMapModuleHandle(hModule, FALSE);
|
hModule = BasepMapModuleHandle(hModule, FALSE);
|
||||||
|
@ -721,7 +721,7 @@ BOOLEAN
|
||||||
WINAPI
|
WINAPI
|
||||||
BasepGetModuleHandleExW(BOOLEAN NoLock, DWORD dwPublicFlags, LPCWSTR lpwModuleName, HMODULE *phModule)
|
BasepGetModuleHandleExW(BOOLEAN NoLock, DWORD dwPublicFlags, LPCWSTR lpwModuleName, HMODULE *phModule)
|
||||||
{
|
{
|
||||||
DWORD Cookie;
|
ULONG_PTR Cookie;
|
||||||
NTSTATUS Status = STATUS_SUCCESS, Status2;
|
NTSTATUS Status = STATUS_SUCCESS, Status2;
|
||||||
HANDLE hModule = NULL;
|
HANDLE hModule = NULL;
|
||||||
UNICODE_STRING ModuleNameU;
|
UNICODE_STRING ModuleNameU;
|
||||||
|
|
|
@ -115,7 +115,7 @@ FsRtlWorkerThread(IN PVOID StartContext)
|
||||||
KIRQL Irql;
|
KIRQL Irql;
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry;
|
||||||
PWORK_QUEUE_ITEM WorkItem;
|
PWORK_QUEUE_ITEM WorkItem;
|
||||||
ULONG QueueId = (ULONG)StartContext;
|
ULONG_PTR QueueId = (ULONG_PTR)StartContext;
|
||||||
|
|
||||||
/* Set our priority according to the queue we're dealing with */
|
/* Set our priority according to the queue we're dealing with */
|
||||||
KeSetPriorityThread(&PsGetCurrentThread()->Tcb, LOW_REALTIME_PRIORITY + QueueId);
|
KeSetPriorityThread(&PsGetCurrentThread()->Tcb, LOW_REALTIME_PRIORITY + QueueId);
|
||||||
|
@ -149,7 +149,7 @@ NTAPI
|
||||||
INIT_FUNCTION
|
INIT_FUNCTION
|
||||||
FsRtlInitializeWorkerThread(VOID)
|
FsRtlInitializeWorkerThread(VOID)
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG_PTR i;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE ThreadHandle;
|
HANDLE ThreadHandle;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
|
|
@ -425,7 +425,7 @@ IoReportTargetDeviceChange(IN PDEVICE_OBJECT PhysicalDeviceObject,
|
||||||
/* Check for valid PDO */
|
/* Check for valid PDO */
|
||||||
if (!IopIsValidPhysicalDeviceObject(PhysicalDeviceObject))
|
if (!IopIsValidPhysicalDeviceObject(PhysicalDeviceObject))
|
||||||
{
|
{
|
||||||
KeBugCheckEx(PNP_DETECTED_FATAL_ERROR, 0x2, (ULONG)PhysicalDeviceObject, 0, 0);
|
KeBugCheckEx(PNP_DETECTED_FATAL_ERROR, 0x2, (ULONG_PTR)PhysicalDeviceObject, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FileObject must be null. PnP will fill in it */
|
/* FileObject must be null. PnP will fill in it */
|
||||||
|
@ -476,7 +476,7 @@ IoReportTargetDeviceChangeAsynchronous(IN PDEVICE_OBJECT PhysicalDeviceObject,
|
||||||
/* Check for valid PDO */
|
/* Check for valid PDO */
|
||||||
if (!IopIsValidPhysicalDeviceObject(PhysicalDeviceObject))
|
if (!IopIsValidPhysicalDeviceObject(PhysicalDeviceObject))
|
||||||
{
|
{
|
||||||
KeBugCheckEx(PNP_DETECTED_FATAL_ERROR, 0x2, (ULONG)PhysicalDeviceObject, 0, 0);
|
KeBugCheckEx(PNP_DETECTED_FATAL_ERROR, 0x2, (ULONG_PTR)PhysicalDeviceObject, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FileObject must be null. PnP will fill in it */
|
/* FileObject must be null. PnP will fill in it */
|
||||||
|
|
|
@ -1416,8 +1416,8 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
"Parent: %p Attributes: %p\n", ParentProcess, ObjectAttributes);
|
"Parent: %p Attributes: %p\n", ParentProcess, ObjectAttributes);
|
||||||
|
|
||||||
/* Set new-style flags */
|
/* Set new-style flags */
|
||||||
if ((ULONG)SectionHandle & 1) Flags |= PROCESS_CREATE_FLAGS_BREAKAWAY;
|
if ((ULONG_PTR)SectionHandle & 1) Flags |= PROCESS_CREATE_FLAGS_BREAKAWAY;
|
||||||
if ((ULONG)DebugPort & 1) Flags |= PROCESS_CREATE_FLAGS_NO_DEBUG_INHERIT;
|
if ((ULONG_PTR)DebugPort & 1) Flags |= PROCESS_CREATE_FLAGS_NO_DEBUG_INHERIT;
|
||||||
if (InheritObjectTable) Flags |= PROCESS_CREATE_FLAGS_INHERIT_HANDLES;
|
if (InheritObjectTable) Flags |= PROCESS_CREATE_FLAGS_INHERIT_HANDLES;
|
||||||
|
|
||||||
/* Call the new API */
|
/* Call the new API */
|
||||||
|
|
|
@ -109,7 +109,7 @@ NTAPI
|
||||||
LdrLockLoaderLock(
|
LdrLockLoaderLock(
|
||||||
_In_ ULONG Flags,
|
_In_ ULONG Flags,
|
||||||
_Out_opt_ PULONG Disposition,
|
_Out_opt_ PULONG Disposition,
|
||||||
_Out_opt_ PULONG Cookie
|
_Out_opt_ PULONG_PTR Cookie
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
|
@ -205,6 +205,7 @@ RtlReadOutOfProcessMemoryStream(
|
||||||
ULONG CopyLength;
|
ULONG CopyLength;
|
||||||
PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
|
PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
|
||||||
SIZE_T Available = (PUCHAR)Stream->End - (PUCHAR)Stream->Current;
|
SIZE_T Available = (PUCHAR)Stream->End - (PUCHAR)Stream->Current;
|
||||||
|
SIZE_T LocalBytesRead = 0;
|
||||||
|
|
||||||
if (BytesRead)
|
if (BytesRead)
|
||||||
*BytesRead = 0;
|
*BytesRead = 0;
|
||||||
|
@ -218,10 +219,14 @@ RtlReadOutOfProcessMemoryStream(
|
||||||
Stream->Current,
|
Stream->Current,
|
||||||
Buffer,
|
Buffer,
|
||||||
CopyLength,
|
CopyLength,
|
||||||
BytesRead);
|
&LocalBytesRead);
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
Stream->Current = (PUCHAR)Stream->Current + *BytesRead;
|
{
|
||||||
|
Stream->Current = (PUCHAR)Stream->Current + LocalBytesRead;
|
||||||
|
if (BytesRead)
|
||||||
|
*BytesRead = (ULONG)LocalBytesRead;
|
||||||
|
}
|
||||||
|
|
||||||
return HRESULT_FROM_WIN32(RtlNtStatusToDosError(Status));
|
return HRESULT_FROM_WIN32(RtlNtStatusToDosError(Status));
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,10 @@ extern VOID FASTCALL CHECK_PAGED_CODE_RTL(char *file, int line);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ROUND_DOWN(n, align) \
|
#define ROUND_DOWN(n, align) \
|
||||||
(((ULONG)(n)) & ~((align) - 1l))
|
(((ULONG_PTR)(n)) & ~((align) - 1l))
|
||||||
|
|
||||||
#define ROUND_UP(n, align) \
|
#define ROUND_UP(n, align) \
|
||||||
ROUND_DOWN(((ULONG)(n)) + (align) - 1, (align))
|
ROUND_DOWN(((ULONG_PTR)(n)) + (align) - 1, (align))
|
||||||
|
|
||||||
#define RVA(m, b) ((PVOID)((ULONG_PTR)(b) + (ULONG_PTR)(m)))
|
#define RVA(m, b) ((PVOID)((ULONG_PTR)(b) + (ULONG_PTR)(m)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue