Commit e48bbc23 authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

setupapi: Remove unneeded casts.

parent e4ca5c56
......@@ -1116,7 +1116,7 @@ SetupDiCreateDeviceInfoListExA(const GUID *ClassGuid,
{
MachineNameW = MultiByteToUnicode(MachineName, CP_ACP);
if (MachineNameW == NULL)
return (HDEVINFO)INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
}
hDevInfo = SetupDiCreateDeviceInfoListExW(ClassGuid, hwndParent,
......@@ -1160,20 +1160,20 @@ SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid,
{
FIXME("remote support is not implemented\n");
SetLastError(ERROR_INVALID_MACHINENAME);
return (HDEVINFO)INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
}
if (Reserved != NULL)
{
SetLastError(ERROR_INVALID_PARAMETER);
return (HDEVINFO)INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
}
list = HeapAlloc(GetProcessHeap(), 0, size);
if (!list)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return (HDEVINFO)INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
}
list->magic = SETUP_DEVICE_INFO_SET_MAGIC;
......@@ -1243,7 +1243,7 @@ HKEY WINAPI SetupDiCreateDevRegKeyW(
TRACE("%p %p %d %d %d %p %s\n", DeviceInfoSet, DeviceInfoData, Scope,
HwProfile, KeyType, InfHandle, debugstr_w(InfSectionName));
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE)
{
SetLastError(ERROR_INVALID_HANDLE);
return INVALID_HANDLE_VALUE;
......@@ -1387,7 +1387,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
SetLastError(ERROR_INVALID_DEVINST_NAME);
return FALSE;
}
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
......@@ -1520,7 +1520,7 @@ BOOL WINAPI SetupDiRegisterDeviceInfo(
TRACE("%p %p %08x %p %p %p\n", DeviceInfoSet, DeviceInfoData, Flags,
CompareProc, CompareContext, DupDeviceInfoData);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
......@@ -1567,7 +1567,7 @@ BOOL WINAPI SetupDiEnumDeviceInfo(
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (devinfo && devinfo != (HDEVINFO)INVALID_HANDLE_VALUE)
if (devinfo && devinfo != INVALID_HANDLE_VALUE)
{
struct DeviceInfoSet *list = (struct DeviceInfoSet *)devinfo;
if (list->magic == SETUP_DEVICE_INFO_SET_MAGIC)
......@@ -1907,7 +1907,7 @@ HDEVINFO WINAPI SetupDiGetClassDevsA(
enumstrW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!enumstrW)
{
ret = (HDEVINFO)INVALID_HANDLE_VALUE;
ret = INVALID_HANDLE_VALUE;
goto end;
}
MultiByteToWideChar(CP_ACP, 0, enumstr, -1, enumstrW, len);
......@@ -1941,7 +1941,7 @@ HDEVINFO WINAPI SetupDiGetClassDevsExA(
enumstrW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!enumstrW)
{
ret = (HDEVINFO)INVALID_HANDLE_VALUE;
ret = INVALID_HANDLE_VALUE;
goto end;
}
MultiByteToWideChar(CP_ACP, 0, enumstr, -1, enumstrW, len);
......@@ -1953,7 +1953,7 @@ HDEVINFO WINAPI SetupDiGetClassDevsExA(
if (!machineW)
{
HeapFree(GetProcessHeap(), 0, enumstrW);
ret = (HDEVINFO)INVALID_HANDLE_VALUE;
ret = INVALID_HANDLE_VALUE;
goto end;
}
MultiByteToWideChar(CP_ACP, 0, machine, -1, machineW, len);
......@@ -2362,7 +2362,7 @@ BOOL WINAPI SetupDiGetDeviceInfoListDetailA(
TRACE("%p %p\n", DeviceInfoSet, DevInfoData);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
......@@ -2395,7 +2395,7 @@ BOOL WINAPI SetupDiGetDeviceInfoListDetailW(
TRACE("%p %p\n", DeviceInfoSet, DevInfoData);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
......@@ -2470,7 +2470,7 @@ BOOL WINAPI SetupDiCreateDeviceInterfaceW(
debugstr_guid(InterfaceClassGuid), debugstr_w(ReferenceString),
CreationFlags, DeviceInterfaceData);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
......@@ -2593,7 +2593,7 @@ HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyW(
TRACE("%p %p %d %08x %p %p\n", DeviceInfoSet, DeviceInterfaceData, Reserved,
samDesired, InfHandle, InfSectionName);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE ||
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE ||
set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
{
SetLastError(ERROR_INVALID_HANDLE);
......@@ -2666,7 +2666,7 @@ BOOL WINAPI SetupDiDeleteDeviceInterfaceRegKey(
TRACE("%p %p %d\n", DeviceInfoSet, DeviceInterfaceData, Reserved);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE ||
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE ||
set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
{
SetLastError(ERROR_INVALID_HANDLE);
......@@ -2738,7 +2738,7 @@ BOOL WINAPI SetupDiEnumDeviceInterfaces(
TRACE("%p, %p, %s, %d, %p\n", DeviceInfoSet, DeviceInfoData,
debugstr_guid(InterfaceClassGuid), MemberIndex, DeviceInterfaceData);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE ||
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE ||
set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
{
SetLastError(ERROR_INVALID_HANDLE);
......@@ -2828,7 +2828,7 @@ BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
BOOL ret = FALSE;
TRACE("%p\n", devinfo);
if (devinfo && devinfo != (HDEVINFO)INVALID_HANDLE_VALUE)
if (devinfo && devinfo != INVALID_HANDLE_VALUE)
{
struct DeviceInfoSet *list = (struct DeviceInfoSet *)devinfo;
......@@ -2872,7 +2872,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
DeviceInterfaceData, DeviceInterfaceDetailData,
DeviceInterfaceDetailDataSize, RequiredSize, DeviceInfoData);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE ||
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE ||
set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
{
SetLastError(ERROR_INVALID_HANDLE);
......@@ -2945,7 +2945,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
DeviceInterfaceData, DeviceInterfaceDetailData,
DeviceInterfaceDetailDataSize, RequiredSize, DeviceInfoData);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE ||
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE ||
set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
{
SetLastError(ERROR_INVALID_HANDLE);
......@@ -3676,7 +3676,7 @@ HKEY WINAPI SetupDiOpenDevRegKey(
TRACE("%p %p %d %d %d %x\n", DeviceInfoSet, DeviceInfoData,
Scope, HwProfile, KeyType, samDesired);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE)
{
SetLastError(ERROR_INVALID_HANDLE);
return INVALID_HANDLE_VALUE;
......@@ -3792,7 +3792,7 @@ BOOL WINAPI SetupDiDeleteDevRegKey(
TRACE("%p %p %d %d %d\n", DeviceInfoSet, DeviceInfoData, Scope, HwProfile,
KeyType);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
......
......@@ -104,7 +104,7 @@ static RETERR16 get_last_error(void)
RETERR16 WINAPI IpOpen16( LPCSTR filename, HINF16 *hinf16 )
{
HINF hinf = SetupOpenInfFileA( filename, NULL, INF_STYLE_WIN4, NULL );
if (hinf == (HINF)INVALID_HANDLE_VALUE) return get_last_error();
if (hinf == INVALID_HANDLE_VALUE) return get_last_error();
return alloc_hinf16( hinf, hinf16 );
}
......
......@@ -789,7 +789,7 @@ DWORD WINAPI RetreiveFileSecurity(LPCWSTR lpFileName,
DWORD dwSize = 0x100;
DWORD dwError;
SecDesc = (PSECURITY_DESCRIPTOR)MyMalloc(dwSize);
SecDesc = MyMalloc(dwSize);
if (SecDesc == NULL)
return ERROR_NOT_ENOUGH_MEMORY;
......@@ -808,7 +808,7 @@ DWORD WINAPI RetreiveFileSecurity(LPCWSTR lpFileName,
return dwError;
}
SecDesc = (PSECURITY_DESCRIPTOR)MyRealloc(SecDesc, dwSize);
SecDesc = MyRealloc(SecDesc, dwSize);
if (SecDesc == NULL)
return ERROR_NOT_ENOUGH_MEMORY;
......
......@@ -1082,7 +1082,7 @@ WCHAR *PARSER_get_dest_dir( INFCONTEXT *context )
HINF WINAPI SetupOpenInfFileA( PCSTR name, PCSTR class, DWORD style, UINT *error )
{
UNICODE_STRING nameW, classW;
HINF ret = (HINF)INVALID_HANDLE_VALUE;
HINF ret = INVALID_HANDLE_VALUE;
classW.Buffer = NULL;
if (class && !RtlCreateUnicodeStringFromAsciiz( &classW, class ))
......@@ -1112,11 +1112,11 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
if (strchrW( name, '\\' ) || strchrW( name, '/' ))
{
if (!(len = GetFullPathNameW( name, 0, NULL, NULL ))) return (HINF)INVALID_HANDLE_VALUE;
if (!(len = GetFullPathNameW( name, 0, NULL, NULL ))) return INVALID_HANDLE_VALUE;
if (!(path = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return (HINF)INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
}
GetFullPathNameW( name, len, path, NULL );
handle = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
......@@ -1130,7 +1130,7 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
if (!(path = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return (HINF)INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
}
GetWindowsDirectoryW( path, len );
p = path + strlenW(path);
......@@ -1153,7 +1153,7 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
if (!file)
{
HeapFree( GetProcessHeap(), 0, path );
return (HINF)INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
}
TRACE( "%s -> %p\n", debugstr_w(path), file );
file->filename = path;
......@@ -1171,7 +1171,7 @@ BOOL WINAPI SetupOpenAppendInfFileA( PCSTR name, HINF parent_hinf, UINT *error )
if (!name) return SetupOpenAppendInfFileW( NULL, parent_hinf, error );
child_hinf = SetupOpenInfFileA( name, NULL, INF_STYLE_WIN4, error );
if (child_hinf == (HINF)INVALID_HANDLE_VALUE) return FALSE;
if (child_hinf == INVALID_HANDLE_VALUE) return FALSE;
append_inf_file( parent_hinf, child_hinf );
TRACE( "%p: appended %s (%p)\n", parent_hinf, debugstr_a(name), child_hinf );
return TRUE;
......@@ -1196,14 +1196,14 @@ BOOL WINAPI SetupOpenAppendInfFileW( PCWSTR name, HINF parent_hinf, UINT *error
sizeof(filename)/sizeof(WCHAR), NULL ))
{
child_hinf = SetupOpenInfFileW( filename, NULL, INF_STYLE_WIN4, error );
if (child_hinf == (HINF)INVALID_HANDLE_VALUE) return FALSE;
if (child_hinf == INVALID_HANDLE_VALUE) return FALSE;
append_inf_file( parent_hinf, child_hinf );
TRACE( "%p: appended %s (%p)\n", parent_hinf, debugstr_w(filename), child_hinf );
}
return TRUE;
}
child_hinf = SetupOpenInfFileW( name, NULL, INF_STYLE_WIN4, error );
if (child_hinf == (HINF)INVALID_HANDLE_VALUE) return FALSE;
if (child_hinf == INVALID_HANDLE_VALUE) return FALSE;
append_inf_file( parent_hinf, child_hinf );
TRACE( "%p: appended %s (%p)\n", parent_hinf, debugstr_w(name), child_hinf );
return TRUE;
......
......@@ -426,7 +426,7 @@ HSPFILEQ WINAPI SetupOpenFileQueue(void)
struct file_queue *queue;
if (!(queue = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*queue))))
return (HSPFILEQ)INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
return queue;
}
......
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