Commit d2f6f568 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

ntdll: Remove superfluous pointer casts.

parent 6f8ce0e3
......@@ -198,7 +198,7 @@ NTSTATUS WINAPI RtlCreateAtomTable( ULONG size, RTL_ATOM_TABLE* table )
NTSTATUS WINAPI RtlDestroyAtomTable( RTL_ATOM_TABLE table )
{
if (!table) return STATUS_INVALID_PARAMETER;
return NtClose( (HANDLE)table );
return NtClose( table );
}
/******************************************************************
......@@ -385,7 +385,7 @@ NTSTATUS WINAPI NtQueryInformationAtom( RTL_ATOM atom, ATOM_INFORMATION_CLASS cl
case AtomBasicInformation:
{
ULONG name_len;
ATOM_BASIC_INFORMATION* abi = (ATOM_BASIC_INFORMATION*)ptr;
ATOM_BASIC_INFORMATION* abi = ptr;
if (size < sizeof(ATOM_BASIC_INFORMATION))
return STATUS_INVALID_PARAMETER;
......
......@@ -471,7 +471,7 @@ static NTSTATUS CDROM_SyncCache(int dev, int fd)
} else {
entry.starting_track = i;
}
memset((char *)&toc_buffer, 0, sizeof(toc_buffer));
memset(&toc_buffer, 0, sizeof(toc_buffer));
entry.address_format = CD_MSF_FORMAT;
entry.data_len = sizeof(toc_buffer);
entry.data = &toc_buffer;
......@@ -2211,7 +2211,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
CDROM_ClearCacheEntry(dev);
if (lpOutBuffer != NULL || nOutBufferSize != 0) status = STATUS_INVALID_PARAMETER;
else if (nInBufferSize < sizeof(PREVENT_MEDIA_REMOVAL)) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_ControlEjection(fd, (const PREVENT_MEDIA_REMOVAL*)lpInBuffer);
else status = CDROM_ControlEjection(fd, lpInBuffer);
break;
/* EPP case IOCTL_STORAGE_GET_MEDIA_TYPES: */
......@@ -2220,7 +2220,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
sz = sizeof(STORAGE_DEVICE_NUMBER);
if (lpInBuffer != NULL || nInBufferSize != 0) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sz) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_GetDeviceNumber(dev, (STORAGE_DEVICE_NUMBER*)lpOutBuffer);
else status = CDROM_GetDeviceNumber(dev, lpOutBuffer);
break;
case IOCTL_STORAGE_RESET_DEVICE:
......@@ -2235,14 +2235,14 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
sz = sizeof(CDROM_AUDIO_CONTROL);
if (lpInBuffer != NULL || nInBufferSize != 0) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sz) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_GetControl(dev, (CDROM_AUDIO_CONTROL*)lpOutBuffer);
else status = CDROM_GetControl(dev, lpOutBuffer);
break;
case IOCTL_CDROM_GET_DRIVE_GEOMETRY:
sz = sizeof(DISK_GEOMETRY);
if (lpInBuffer != NULL || nInBufferSize != 0) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sz) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_GetDriveGeometry(dev, fd, (DISK_GEOMETRY*)lpOutBuffer);
else status = CDROM_GetDriveGeometry(dev, fd, lpOutBuffer);
break;
case IOCTL_CDROM_DISK_TYPE:
......@@ -2250,7 +2250,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
/* CDROM_ClearCacheEntry(dev); */
if (lpInBuffer != NULL || nInBufferSize != 0) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sz) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_GetDiskData(dev, fd, (CDROM_DISK_DATA*)lpOutBuffer);
else status = CDROM_GetDiskData(dev, fd, lpOutBuffer);
break;
/* EPP case IOCTL_CDROM_GET_LAST_SESSION: */
......@@ -2260,15 +2260,14 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
if (lpInBuffer == NULL || nInBufferSize < sizeof(CDROM_SUB_Q_DATA_FORMAT))
status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sz) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_ReadQChannel(dev, fd, (const CDROM_SUB_Q_DATA_FORMAT*)lpInBuffer,
(SUB_Q_CHANNEL_DATA*)lpOutBuffer);
else status = CDROM_ReadQChannel(dev, fd, lpInBuffer, lpOutBuffer);
break;
case IOCTL_CDROM_READ_TOC:
sz = sizeof(CDROM_TOC);
if (lpInBuffer != NULL || nInBufferSize != 0) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sz) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_ReadTOC(dev, fd, (CDROM_TOC*)lpOutBuffer);
else status = CDROM_ReadTOC(dev, fd, lpOutBuffer);
break;
/* EPP case IOCTL_CDROM_READ_TOC_EX: */
......@@ -2283,7 +2282,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
sz = 0;
if (lpOutBuffer != NULL || nOutBufferSize != 0) status = STATUS_INVALID_PARAMETER;
else if (nInBufferSize < sizeof(CDROM_PLAY_AUDIO_MSF)) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_PlayAudioMSF(fd, (const CDROM_PLAY_AUDIO_MSF*)lpInBuffer);
else status = CDROM_PlayAudioMSF(fd, lpInBuffer);
break;
case IOCTL_CDROM_RESUME_AUDIO:
sz = 0;
......@@ -2295,7 +2294,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
sz = 0;
if (lpOutBuffer != NULL || nOutBufferSize != 0) status = STATUS_INVALID_PARAMETER;
else if (nInBufferSize < sizeof(CDROM_SEEK_AUDIO_MSF)) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_SeekAudioMSF(dev, fd, (const CDROM_SEEK_AUDIO_MSF*)lpInBuffer);
else status = CDROM_SeekAudioMSF(dev, fd, lpInBuffer);
break;
case IOCTL_CDROM_STOP_AUDIO:
sz = 0;
......@@ -2308,45 +2307,45 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
sz = sizeof(VOLUME_CONTROL);
if (lpInBuffer != NULL || nInBufferSize != 0) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sz) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_GetVolume(fd, (VOLUME_CONTROL*)lpOutBuffer);
else status = CDROM_GetVolume(fd, lpOutBuffer);
break;
case IOCTL_CDROM_SET_VOLUME:
sz = 0;
CDROM_ClearCacheEntry(dev);
if (lpInBuffer == NULL || nInBufferSize < sizeof(VOLUME_CONTROL) || lpOutBuffer != NULL)
status = STATUS_INVALID_PARAMETER;
else status = CDROM_SetVolume(fd, (const VOLUME_CONTROL*)lpInBuffer);
else status = CDROM_SetVolume(fd, lpInBuffer);
break;
case IOCTL_CDROM_RAW_READ:
sz = 0;
if (nInBufferSize < sizeof(RAW_READ_INFO)) status = STATUS_INVALID_PARAMETER;
else if (lpOutBuffer == NULL) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_RawRead(fd, (const RAW_READ_INFO*)lpInBuffer,
lpOutBuffer, nOutBufferSize, &sz);
else status = CDROM_RawRead(fd, lpInBuffer, lpOutBuffer,
nOutBufferSize, &sz);
break;
case IOCTL_SCSI_GET_ADDRESS:
sz = sizeof(SCSI_ADDRESS);
if (lpInBuffer != NULL || nInBufferSize != 0) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sz) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_GetAddress(fd, (SCSI_ADDRESS*)lpOutBuffer);
else status = CDROM_GetAddress(fd, lpOutBuffer);
break;
case IOCTL_SCSI_PASS_THROUGH_DIRECT:
sz = sizeof(SCSI_PASS_THROUGH_DIRECT);
if (lpOutBuffer == NULL) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sizeof(SCSI_PASS_THROUGH_DIRECT)) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_ScsiPassThroughDirect(fd, (PSCSI_PASS_THROUGH_DIRECT)lpOutBuffer);
else status = CDROM_ScsiPassThroughDirect(fd, lpOutBuffer);
break;
case IOCTL_SCSI_PASS_THROUGH:
sz = sizeof(SCSI_PASS_THROUGH);
if (lpOutBuffer == NULL) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sizeof(SCSI_PASS_THROUGH)) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_ScsiPassThrough(fd, (PSCSI_PASS_THROUGH)lpOutBuffer);
else status = CDROM_ScsiPassThrough(fd, lpOutBuffer);
break;
case IOCTL_SCSI_GET_CAPABILITIES:
sz = sizeof(IO_SCSI_CAPABILITIES);
if (lpOutBuffer == NULL) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sizeof(IO_SCSI_CAPABILITIES)) status = STATUS_BUFFER_TOO_SMALL;
else status = CDROM_ScsiGetCaps((PIO_SCSI_CAPABILITIES)lpOutBuffer);
else status = CDROM_ScsiGetCaps(lpOutBuffer);
break;
case IOCTL_DVD_START_SESSION:
sz = sizeof(DVD_SESSION_ID);
......@@ -2356,7 +2355,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
{
TRACE("before in 0x%08x out 0x%08x\n",(lpInBuffer)?*(PDVD_SESSION_ID)lpInBuffer:0,
*(PDVD_SESSION_ID)lpOutBuffer);
status = DVD_StartSession(fd, (PDVD_SESSION_ID)lpInBuffer, (PDVD_SESSION_ID)lpOutBuffer);
status = DVD_StartSession(fd, lpInBuffer, lpOutBuffer);
TRACE("before in 0x%08x out 0x%08x\n",(lpInBuffer)?*(PDVD_SESSION_ID)lpInBuffer:0,
*(PDVD_SESSION_ID)lpOutBuffer);
}
......@@ -2364,7 +2363,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
case IOCTL_DVD_END_SESSION:
sz = sizeof(DVD_SESSION_ID);
if ((lpInBuffer == NULL) || (nInBufferSize < sz))status = STATUS_INVALID_PARAMETER;
else status = DVD_EndSession(fd, (PDVD_SESSION_ID)lpInBuffer);
else status = DVD_EndSession(fd, lpInBuffer);
break;
case IOCTL_DVD_SEND_KEY:
sz = 0;
......@@ -2374,7 +2373,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
else
{
TRACE("doing DVD_SendKey\n");
status = DVD_SendKey(fd, (PDVD_COPY_PROTECT_KEY)lpInBuffer);
status = DVD_SendKey(fd, lpInBuffer);
}
break;
case IOCTL_DVD_READ_KEY:
......@@ -2386,7 +2385,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
{
TRACE("doing DVD_READ_KEY\n");
sz = ((PDVD_COPY_PROTECT_KEY)lpInBuffer)->KeyLength;
status = DVD_ReadKey(fd, (PDVD_COPY_PROTECT_KEY)lpInBuffer);
status = DVD_ReadKey(fd, lpInBuffer);
}
break;
case IOCTL_DVD_GET_REGION:
......@@ -2394,7 +2393,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
if (lpInBuffer != NULL || nInBufferSize != 0) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sz) status = STATUS_BUFFER_TOO_SMALL;
TRACE("doing DVD_Get_REGION\n");
status = DVD_GetRegion(fd, (PDVD_REGION)lpOutBuffer);
status = DVD_GetRegion(fd, lpOutBuffer);
break;
case IOCTL_DVD_READ_STRUCTURE:
sz = sizeof(DVD_LAYER_DESCRIPTOR);
......@@ -2403,13 +2402,13 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
else
{
TRACE("doing DVD_READ_STRUCTURE\n");
status = DVD_ReadStructure(fd, (PDVD_READ_STRUCTURE)lpInBuffer, (PDVD_LAYER_DESCRIPTOR)lpOutBuffer);
status = DVD_ReadStructure(fd, lpInBuffer, lpOutBuffer);
}
break;
case IOCTL_SCSI_GET_INQUIRY_DATA:
sz = INQ_REPLY_LEN;
status = GetInquiryData(fd, (PSCSI_ADAPTER_BUS_INFO)lpOutBuffer, nOutBufferSize);
status = GetInquiryData(fd, lpOutBuffer, nOutBufferSize);
break;
default:
......
......@@ -2324,7 +2324,7 @@ static NTSTATUS read_changes_apc( void *user, PIO_STATUS_BLOCK iosb, NTSTATUS st
{
PFILE_NOTIFY_INFORMATION pfni;
pfni = (PFILE_NOTIFY_INFORMATION) info->Buffer;
pfni = info->Buffer;
/* convert to an NT style path */
for (i=0; i<len; i++)
......
......@@ -1924,7 +1924,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
case FileCompletionInformation:
if (len >= sizeof(FILE_COMPLETION_INFORMATION))
{
FILE_COMPLETION_INFORMATION *info = (FILE_COMPLETION_INFORMATION *)ptr;
FILE_COMPLETION_INFORMATION *info = ptr;
SERVER_START_REQ( set_completion_info )
{
......
......@@ -207,8 +207,8 @@ RTL_HANDLE * WINAPI RtlAllocateHandle(RTL_HANDLE_TABLE * HandleTable, ULONG * Ha
if (!HandleTable->NextFree && RtlpAllocateSomeHandles(HandleTable) != STATUS_SUCCESS)
return NULL;
ret = (RTL_HANDLE *)HandleTable->NextFree;
ret = HandleTable->NextFree;
HandleTable->NextFree = ret->Next;
if (HandleIndex)
......@@ -241,7 +241,7 @@ BOOLEAN WINAPI RtlFreeHandle(RTL_HANDLE_TABLE * HandleTable, RTL_HANDLE * Handle
* effect of setting Handle->Next to the previously next free handle in
* the handle table */
memset(Handle, 0, HandleTable->HandleSize);
Handle->Next = (RTL_HANDLE *)HandleTable->NextFree;
Handle->Next = HandleTable->NextFree;
HandleTable->NextFree = Handle;
return TRUE;
}
......
......@@ -388,7 +388,7 @@ static void HEAP_DumpEntry( LPPROCESS_HEAP_ENTRY entry )
static HEAP *HEAP_GetPtr(
HANDLE heap /* [in] Handle to the heap */
) {
HEAP *heapPtr = (HEAP *)heap;
HEAP *heapPtr = heap;
if (!heapPtr || (heapPtr->magic != HEAP_MAGIC))
{
ERR("Invalid heap %p!\n", heap );
......@@ -442,7 +442,7 @@ static SUBHEAP *HEAP_FindSubHeap(
{
SUBHEAP *sub;
LIST_FOR_EACH_ENTRY( sub, &heap->subheap_list, SUBHEAP, entry )
if (((const char *)ptr >= (const char *)sub->base) &&
if ((ptr >= sub->base) &&
((const char *)ptr < (const char *)sub->base + sub->size - sizeof(ARENA_INUSE)))
return sub;
return NULL;
......@@ -517,7 +517,7 @@ static void HEAP_CreateFreeBlock( SUBHEAP *subheap, void *ptr, SIZE_T size )
/* Create a free arena */
mark_block_uninitialized( ptr, sizeof( ARENA_FREE ) );
pFree = (ARENA_FREE *)ptr;
pFree = ptr;
pFree->magic = ARENA_FREE_MAGIC;
/* If debugging, erase the freed block content */
......@@ -709,7 +709,7 @@ static ARENA_LARGE *find_large_block( HEAP *heap, const void *ptr )
ARENA_LARGE *arena;
LIST_FOR_EACH_ENTRY( arena, &heap->large_list, ARENA_LARGE, entry )
if (ptr == (const void *)(arena + 1)) return arena;
if (ptr == arena + 1) return arena;
return NULL;
}
......@@ -793,7 +793,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
{
/* If this is a secondary subheap, insert it into list */
subheap = (SUBHEAP *)address;
subheap = address;
subheap->base = address;
subheap->heap = heap;
subheap->size = totalSize;
......@@ -806,7 +806,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
{
/* If this is a primary subheap, initialize main heap */
heap = (HEAP *)address;
heap = address;
heap->flags = flags;
heap->magic = HEAP_MAGIC;
heap->grow_size = max( HEAP_DEF_SIZE, totalSize );
......@@ -946,7 +946,7 @@ static BOOL HEAP_IsValidArenaPtr( const HEAP *heap, const ARENA_FREE *ptr )
if ((const char *)ptr >= (const char *)subheap->base + subheap->headerSize) return TRUE;
if (subheap != &heap->subheap) return FALSE;
for (i = 0; i < HEAP_NB_FREE_LISTS; i++)
if (ptr == (const void *)&heap->freeList[i].arena) return TRUE;
if (ptr == &heap->freeList[i].arena) return TRUE;
return FALSE;
}
......@@ -1266,7 +1266,7 @@ HANDLE WINAPI RtlCreateHeap( ULONG flags, PVOID addr, SIZE_T totalSize, SIZE_T c
assert( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
}
return (HANDLE)subheap->heap;
return subheap->heap;
}
......@@ -1418,7 +1418,7 @@ PVOID WINAPI RtlAllocateHeap( HANDLE heap, ULONG flags, SIZE_T size )
if (!(flags & HEAP_NO_SERIALIZE)) RtlLeaveCriticalSection( &heapPtr->critSection );
TRACE("(%p,%08x,%08lx): returning %p\n", heap, flags, size, pInUse + 1 );
return (LPVOID)(pInUse + 1);
return pInUse + 1;
}
......
......@@ -1225,13 +1225,13 @@ NTSTATUS WINAPI LdrFindEntryForAddress(const void* addr, PLDR_MODULE* pmod)
for (entry = mark->Flink; entry != mark; entry = entry->Flink)
{
mod = CONTAINING_RECORD(entry, LDR_MODULE, InMemoryOrderModuleList);
if ((const void *)mod->BaseAddress <= addr &&
if (mod->BaseAddress <= addr &&
(const char *)addr < (char*)mod->BaseAddress + mod->SizeOfImage)
{
*pmod = mod;
return STATUS_SUCCESS;
}
if ((const void *)mod->BaseAddress > addr) break;
if (mod->BaseAddress > addr) break;
}
return STATUS_NO_MORE_ENTRIES;
}
......
......@@ -272,7 +272,7 @@ NTSTATUS WINAPI NtQueryInformationToken(
SERVER_START_REQ( get_token_user )
{
TOKEN_USER * tuser = tokeninfo;
PSID sid = (PSID) (tuser + 1);
PSID sid = tuser + 1;
DWORD sid_len = tokeninfolength < sizeof(TOKEN_USER) ? 0 : tokeninfolength - sizeof(TOKEN_USER);
req->handle = wine_server_obj_handle( token );
......@@ -383,7 +383,7 @@ NTSTATUS WINAPI NtQueryInformationToken(
if (tokeninfo)
{
TOKEN_OWNER *owner = tokeninfo;
PSID sid = (PSID) (owner + 1);
PSID sid = owner + 1;
SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
RtlInitializeSid(sid, &localSidAuthority, 1);
*(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
......@@ -780,7 +780,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
break;
case SystemProcessInformation:
{
SYSTEM_PROCESS_INFORMATION* spi = (SYSTEM_PROCESS_INFORMATION*)SystemInformation;
SYSTEM_PROCESS_INFORMATION* spi = SystemInformation;
SYSTEM_PROCESS_INFORMATION* last = NULL;
HANDLE hSnap = 0;
WCHAR procname[1024];
......@@ -1211,7 +1211,7 @@ NTSTATUS WINAPI NtPowerInformation(
InformationLevel,lpInputBuffer,nInputBufferSize,lpOutputBuffer,nOutputBufferSize);
switch(InformationLevel) {
case SystemPowerCapabilities: {
PSYSTEM_POWER_CAPABILITIES PowerCaps = (PSYSTEM_POWER_CAPABILITIES)lpOutputBuffer;
PSYSTEM_POWER_CAPABILITIES PowerCaps = lpOutputBuffer;
FIXME("semi-stub: SystemPowerCapabilities\n");
if (nOutputBufferSize < sizeof(SYSTEM_POWER_CAPABILITIES))
return STATUS_BUFFER_TOO_SMALL;
......
......@@ -65,7 +65,7 @@ NTSTATUS WINAPI NtQueryObject(IN HANDLE handle,
{
case ObjectBasicInformation:
{
POBJECT_BASIC_INFORMATION p = (POBJECT_BASIC_INFORMATION)ptr;
POBJECT_BASIC_INFORMATION p = ptr;
if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
......@@ -87,7 +87,7 @@ NTSTATUS WINAPI NtQueryObject(IN HANDLE handle,
break;
case ObjectDataInformation:
{
OBJECT_DATA_INFORMATION* p = (OBJECT_DATA_INFORMATION*)ptr;
OBJECT_DATA_INFORMATION* p = ptr;
if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
......@@ -133,7 +133,7 @@ NTSTATUS WINAPI NtSetInformationObject(IN HANDLE handle,
{
case ObjectDataInformation:
{
OBJECT_DATA_INFORMATION* p = (OBJECT_DATA_INFORMATION*)ptr;
OBJECT_DATA_INFORMATION* p = ptr;
if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
......
......@@ -910,8 +910,8 @@ static NTSTATUS RTL_ReportRegistryValue(PKEY_VALUE_FULL_INFORMATION pInfo,
if (pQuery->Flags & RTL_QUERY_REGISTRY_DIRECT)
{
str = (PUNICODE_STRING)pQuery->EntryContext;
str = pQuery->EntryContext;
switch(pInfo->Type)
{
case REG_EXPAND_SZ:
......@@ -953,7 +953,7 @@ static NTSTATUS RTL_ReportRegistryValue(PKEY_VALUE_FULL_INFORMATION pInfo,
break;
default:
bin = (LONG*)pQuery->EntryContext;
bin = pQuery->EntryContext;
if (pInfo->DataLength <= sizeof(ULONG))
memcpy(bin, ((CHAR*)pInfo) + pInfo->DataOffset,
pInfo->DataLength);
......
......@@ -117,7 +117,7 @@ static NTSTATUS add_access_ace(PACL pAcl, DWORD dwAceRevision, DWORD dwAceFlags,
/* skip past ACE->Mask */
pSidStart = pAccessMask + 1;
RtlCopySid(dwLengthSid, (PSID)pSidStart, pSid);
RtlCopySid(dwLengthSid, pSidStart, pSid);
pAcl->AclRevision = max(pAcl->AclRevision, dwAceRevision);
pAcl->AceCount++;
......@@ -451,8 +451,8 @@ NTSTATUS WINAPI RtlCreateSecurityDescriptor(
*/
NTSTATUS WINAPI RtlCopySecurityDescriptor(PSECURITY_DESCRIPTOR pSourceSD, PSECURITY_DESCRIPTOR pDestinationSD)
{
SECURITY_DESCRIPTOR *srcSD = (SECURITY_DESCRIPTOR *)pSourceSD;
SECURITY_DESCRIPTOR *destSD = (SECURITY_DESCRIPTOR *)pDestinationSD;
SECURITY_DESCRIPTOR *srcSD = pSourceSD;
SECURITY_DESCRIPTOR *destSD = pDestinationSD;
PSID Owner, Group;
PACL Dacl, Sacl;
BOOLEAN defaulted, present;
......@@ -1177,7 +1177,7 @@ NTSTATUS WINAPI RtlAddAce(
}
if ((BYTE *)targetace + acelen > (BYTE *)acl + acl->AclSize) /* too much aces */
return STATUS_INVALID_PARAMETER;
memcpy((LPBYTE)targetace,acestart,acelen);
memcpy(targetace,acestart,acelen);
acl->AceCount+=nrofaces;
return STATUS_SUCCESS;
}
......@@ -1369,7 +1369,7 @@ NTSTATUS WINAPI RtlGetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
for (;dwAceIndex;dwAceIndex--)
ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
*pAce = (LPVOID) ace;
*pAce = ace;
return STATUS_SUCCESS;
}
......@@ -1720,7 +1720,7 @@ NTSTATUS WINAPI RtlConvertSidToUnicodeString(
static const WCHAR formatW[] = {'-','%','u',0};
WCHAR buffer[2 + 10 + 10 + 10 * SID_MAX_SUB_AUTHORITIES];
WCHAR *p = buffer;
const SID *sid = (const SID *)pSid;
const SID *sid = pSid;
DWORD i, len;
*p++ = 'S';
......@@ -1765,7 +1765,7 @@ NTSTATUS WINAPI RtlQueryInformationAcl(
{
case AclRevisionInformation:
{
PACL_REVISION_INFORMATION paclrev = (PACL_REVISION_INFORMATION) pAclInformation;
PACL_REVISION_INFORMATION paclrev = pAclInformation;
if (nAclInformationLength < sizeof(ACL_REVISION_INFORMATION))
status = STATUS_INVALID_PARAMETER;
......@@ -1777,7 +1777,7 @@ NTSTATUS WINAPI RtlQueryInformationAcl(
case AclSizeInformation:
{
PACL_SIZE_INFORMATION paclsize = (PACL_SIZE_INFORMATION) pAclInformation;
PACL_SIZE_INFORMATION paclsize = pAclInformation;
if (nAclInformationLength < sizeof(ACL_SIZE_INFORMATION))
status = STATUS_INVALID_PARAMETER;
......
......@@ -946,7 +946,7 @@ static DWORD check_events(int fd, DWORD mask,
*/
static DWORD CALLBACK wait_for_event(LPVOID arg)
{
async_commio *commio = (async_commio*) arg;
async_commio *commio = arg;
int fd, needs_close;
if (!server_get_unix_fd( commio->hDevice, FILE_READ_DATA | FILE_WRITE_DATA, &fd, &needs_close, NULL, NULL ))
......@@ -1129,7 +1129,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
case IOCTL_SERIAL_GET_BAUD_RATE:
if (lpOutBuffer && nOutBufferSize == sizeof(SERIAL_BAUD_RATE))
{
if (!(status = get_baud_rate(fd, (SERIAL_BAUD_RATE*)lpOutBuffer)))
if (!(status = get_baud_rate(fd, lpOutBuffer)))
sz = sizeof(SERIAL_BAUD_RATE);
}
else
......@@ -1138,7 +1138,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
case IOCTL_SERIAL_GET_CHARS:
if (lpOutBuffer && nOutBufferSize == sizeof(SERIAL_CHARS))
{
if (!(status = get_special_chars(fd, (SERIAL_CHARS*)lpOutBuffer)))
if (!(status = get_special_chars(fd, lpOutBuffer)))
sz = sizeof(SERIAL_CHARS);
}
else
......@@ -1147,7 +1147,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
case IOCTL_SERIAL_GET_COMMSTATUS:
if (lpOutBuffer && nOutBufferSize == sizeof(SERIAL_STATUS))
{
if (!(status = get_status(fd, (SERIAL_STATUS*)lpOutBuffer)))
if (!(status = get_status(fd, lpOutBuffer)))
sz = sizeof(SERIAL_STATUS);
}
else status = STATUS_INVALID_PARAMETER;
......@@ -1155,7 +1155,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
case IOCTL_SERIAL_GET_HANDFLOW:
if (lpOutBuffer && nOutBufferSize == sizeof(SERIAL_HANDFLOW))
{
if (!(status = get_hand_flow(fd, (SERIAL_HANDFLOW*)lpOutBuffer)))
if (!(status = get_hand_flow(fd, lpOutBuffer)))
sz = sizeof(SERIAL_HANDFLOW);
}
else
......@@ -1164,7 +1164,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
case IOCTL_SERIAL_GET_LINE_CONTROL:
if (lpOutBuffer && nOutBufferSize == sizeof(SERIAL_LINE_CONTROL))
{
if (!(status = get_line_control(fd, (SERIAL_LINE_CONTROL*)lpOutBuffer)))
if (!(status = get_line_control(fd, lpOutBuffer)))
sz = sizeof(SERIAL_LINE_CONTROL);
}
else
......@@ -1173,7 +1173,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
case IOCTL_SERIAL_GET_MODEMSTATUS:
if (lpOutBuffer && nOutBufferSize == sizeof(DWORD))
{
if (!(status = get_modem_status(fd, (DWORD*)lpOutBuffer)))
if (!(status = get_modem_status(fd, lpOutBuffer)))
sz = sizeof(DWORD);
}
else status = STATUS_INVALID_PARAMETER;
......@@ -1181,7 +1181,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
case IOCTL_SERIAL_GET_TIMEOUTS:
if (lpOutBuffer && nOutBufferSize == sizeof(SERIAL_TIMEOUTS))
{
if (!(status = get_timeouts(hDevice, (SERIAL_TIMEOUTS*)lpOutBuffer)))
if (!(status = get_timeouts(hDevice, lpOutBuffer)))
sz = sizeof(SERIAL_TIMEOUTS);
}
else
......@@ -1190,7 +1190,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
case IOCTL_SERIAL_GET_WAIT_MASK:
if (lpOutBuffer && nOutBufferSize == sizeof(DWORD))
{
if (!(status = get_wait_mask(hDevice, (DWORD*)lpOutBuffer)))
if (!(status = get_wait_mask(hDevice, lpOutBuffer)))
sz = sizeof(DWORD);
}
else
......@@ -1213,7 +1213,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
break;
case IOCTL_SERIAL_SET_BAUD_RATE:
if (lpInBuffer && nInBufferSize == sizeof(SERIAL_BAUD_RATE))
status = set_baud_rate(fd, (const SERIAL_BAUD_RATE*)lpInBuffer);
status = set_baud_rate(fd, lpInBuffer);
else
status = STATUS_INVALID_PARAMETER;
break;
......@@ -1243,7 +1243,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
break;
case IOCTL_SERIAL_SET_CHARS:
if (lpInBuffer && nInBufferSize == sizeof(SERIAL_CHARS))
status = set_special_chars(fd, (const SERIAL_CHARS*)lpInBuffer);
status = set_special_chars(fd, lpInBuffer);
else
status = STATUS_INVALID_PARAMETER;
break;
......@@ -1256,19 +1256,19 @@ static inline NTSTATUS io_control(HANDLE hDevice,
break;
case IOCTL_SERIAL_SET_HANDFLOW:
if (lpInBuffer && nInBufferSize == sizeof(SERIAL_HANDFLOW))
status = set_handflow(fd, (const SERIAL_HANDFLOW*)lpInBuffer);
status = set_handflow(fd, lpInBuffer);
else
status = STATUS_INVALID_PARAMETER;
break;
case IOCTL_SERIAL_SET_LINE_CONTROL:
if (lpInBuffer && nInBufferSize == sizeof(SERIAL_LINE_CONTROL))
status = set_line_control(fd, (const SERIAL_LINE_CONTROL*)lpInBuffer);
status = set_line_control(fd, lpInBuffer);
else
status = STATUS_INVALID_PARAMETER;
break;
case IOCTL_SERIAL_SET_QUEUE_SIZE:
if (lpInBuffer && nInBufferSize == sizeof(SERIAL_QUEUE_SIZE))
status = set_queue_size(fd, (const SERIAL_QUEUE_SIZE*)lpInBuffer);
status = set_queue_size(fd, lpInBuffer);
else
status = STATUS_INVALID_PARAMETER;
break;
......@@ -1281,7 +1281,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
break;
case IOCTL_SERIAL_SET_TIMEOUTS:
if (lpInBuffer && nInBufferSize == sizeof(SERIAL_TIMEOUTS))
status = set_timeouts(hDevice, (const SERIAL_TIMEOUTS*)lpInBuffer);
status = set_timeouts(hDevice, lpInBuffer);
else
status = STATUS_INVALID_PARAMETER;
break;
......@@ -1301,7 +1301,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
case IOCTL_SERIAL_WAIT_ON_MASK:
if (lpOutBuffer && nOutBufferSize == sizeof(DWORD))
{
if (!(status = wait_on(hDevice, fd, hEvent, (DWORD*)lpOutBuffer)))
if (!(status = wait_on(hDevice, fd, hEvent, lpOutBuffer)))
sz = sizeof(DWORD);
}
else
......
......@@ -728,7 +728,7 @@ NTSTATUS WINAPI NtQueryTimer(
ULONG Length,
PULONG ReturnLength)
{
TIMER_BASIC_INFORMATION * basic_info = (TIMER_BASIC_INFORMATION *)TimerInformation;
TIMER_BASIC_INFORMATION * basic_info = TimerInformation;
NTSTATUS status;
LARGE_INTEGER now;
......@@ -1429,7 +1429,7 @@ NTSTATUS WINAPI NtQueryIoCompletion( HANDLE CompletionPort, IO_COMPLETION_INFORM
{
case IoCompletionBasicInformation:
{
ULONG *info = (ULONG *)CompletionInformation;
ULONG *info = CompletionInformation;
if (RequiredLength) *RequiredLength = sizeof(*info);
if (BufferLength != sizeof(*info))
......
......@@ -535,38 +535,38 @@ NTSTATUS TAPE_DeviceIoControl( HANDLE device, HANDLE event,
switch (io_control)
{
case IOCTL_TAPE_CREATE_PARTITION:
status = TAPE_CreatePartition( fd, (TAPE_CREATE_PARTITION *)in_buffer );
status = TAPE_CreatePartition( fd, in_buffer );
break;
case IOCTL_TAPE_ERASE:
status = TAPE_Erase( fd, (TAPE_ERASE *)in_buffer );
status = TAPE_Erase( fd, in_buffer );
break;
case IOCTL_TAPE_GET_DRIVE_PARAMS:
status = TAPE_GetDriveParams( fd, (TAPE_GET_DRIVE_PARAMETERS *)out_buffer );
status = TAPE_GetDriveParams( fd, out_buffer );
break;
case IOCTL_TAPE_GET_MEDIA_PARAMS:
status = TAPE_GetMediaParams( fd, (TAPE_GET_MEDIA_PARAMETERS *)out_buffer );
status = TAPE_GetMediaParams( fd, out_buffer );
break;
case IOCTL_TAPE_GET_POSITION:
status = TAPE_GetPosition( fd, ((TAPE_GET_POSITION *)in_buffer)->Type,
(TAPE_GET_POSITION *)out_buffer );
out_buffer );
break;
case IOCTL_TAPE_GET_STATUS:
status = FILE_GetNtStatus();
break;
case IOCTL_TAPE_PREPARE:
status = TAPE_Prepare( fd, (TAPE_PREPARE *)in_buffer );
status = TAPE_Prepare( fd, in_buffer );
break;
case IOCTL_TAPE_SET_DRIVE_PARAMS:
status = TAPE_SetDriveParams( fd, (TAPE_SET_DRIVE_PARAMETERS *)in_buffer );
status = TAPE_SetDriveParams( fd, in_buffer );
break;
case IOCTL_TAPE_SET_MEDIA_PARAMS:
status = TAPE_SetMediaParams( fd, (TAPE_SET_MEDIA_PARAMETERS *)in_buffer );
status = TAPE_SetMediaParams( fd, in_buffer );
break;
case IOCTL_TAPE_SET_POSITION:
status = TAPE_SetPosition( fd, (TAPE_SET_POSITION *)in_buffer );
status = TAPE_SetPosition( fd, in_buffer );
break;
case IOCTL_TAPE_WRITE_MARKS:
status = TAPE_WriteMarks( fd, (TAPE_WRITE_MARKS *)in_buffer );
status = TAPE_WriteMarks( fd, in_buffer );
break;
case IOCTL_TAPE_CHECK_VERIFY:
......
......@@ -108,7 +108,7 @@ static long get_pending_msgs(HANDLE h)
NTSTATUS res;
ULONG a, req;
res = pNtQueryIoCompletion( h, IoCompletionBasicInformation, (PVOID)&a, sizeof(a), &req );
res = pNtQueryIoCompletion( h, IoCompletionBasicInformation, &a, sizeof(a), &req );
ok( res == STATUS_SUCCESS, "NtQueryIoCompletion failed: %x\n", res );
if (res != STATUS_SUCCESS) return -1;
ok( req == sizeof(a), "Unexpected response size: %x\n", req );
......
......@@ -558,7 +558,7 @@ static void test_NtQueryValueKey(void)
status = pNtQueryValueKey(key, &ValName, KeyValuePartialInformation, NULL, 0, &len);
todo_wine ok(status == STATUS_BUFFER_TOO_SMALL, "NtQueryValueKey should have returned STATUS_BUFFER_TOO_SMALL instead of 0x%08x\n", status);
partial_info = HeapAlloc(GetProcessHeap(), 0, len+1);
memset((BYTE*)partial_info, 0xbd, len+1);
memset(partial_info, 0xbd, len+1);
status = pNtQueryValueKey(key, &ValName, KeyValuePartialInformation, partial_info, len, &len);
ok(status == STATUS_SUCCESS, "NtQueryValueKey should have returned STATUS_SUCCESS instead of 0x%08x\n", status);
ok(partial_info->TitleIndex == 0, "NtQueryValueKey returned wrong TitleIndex %d\n", partial_info->TitleIndex);
......
......@@ -191,7 +191,7 @@ static void test_RtlInitUnicodeStringEx(void)
UNICODE_STRING uni;
NTSTATUS result;
teststring2 = (WCHAR *) malloc((TESTSTRING2_LEN + 1) * sizeof(WCHAR));
teststring2 = malloc((TESTSTRING2_LEN + 1) * sizeof(WCHAR));
memset(teststring2, 'X', TESTSTRING2_LEN * sizeof(WCHAR));
teststring2[TESTSTRING2_LEN] = '\0';
......
......@@ -598,8 +598,8 @@ static BOOL VIRTUAL_SetProt( FILE_VIEW *view, /* [in] Pointer to view */
/* if setting stack guard pages, store the permissions first, as the guard may be
* triggered at any point after mprotect and change the permissions again */
if ((vprot & VPROT_GUARD) &&
((char *)base >= (char *)NtCurrentTeb()->DeallocationStack) &&
((char *)base < (char *)NtCurrentTeb()->Tib.StackBase))
(base >= NtCurrentTeb()->DeallocationStack) &&
(base < NtCurrentTeb()->Tib.StackBase))
{
memset( p, vprot, size >> page_shift );
mprotect( base, size, unix_prot );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment