Fix indentation in SetupDiCreateDeviceInfoListExW

Fix 2 architecture extension constants

svn path=/trunk/; revision=22446
This commit is contained in:
Hervé Poussineau 2006-06-21 07:52:19 +00:00
parent 9bea18dd04
commit d5e40a314e

View file

@ -156,96 +156,95 @@ SetupDiCreateDeviceInfoListExW(
IN PCWSTR MachineName OPTIONAL, IN PCWSTR MachineName OPTIONAL,
IN PVOID Reserved) IN PVOID Reserved)
{ {
struct DeviceInfoSet *list; struct DeviceInfoSet *list;
LPWSTR UNCServerName = NULL; LPWSTR UNCServerName = NULL;
DWORD size; DWORD size;
DWORD rc; DWORD rc;
//CONFIGRET cr; //CONFIGRET cr;
HDEVINFO ret = (HDEVINFO)INVALID_HANDLE_VALUE;; HDEVINFO ret = (HDEVINFO)INVALID_HANDLE_VALUE;;
TRACE("%s %p %s %p\n", debugstr_guid(ClassGuid), hwndParent, TRACE("%s %p %s %p\n", debugstr_guid(ClassGuid), hwndParent,
debugstr_w(MachineName), Reserved); debugstr_w(MachineName), Reserved);
size = FIELD_OFFSET(struct DeviceInfoSet, szData); size = FIELD_OFFSET(struct DeviceInfoSet, szData);
if (MachineName) if (MachineName)
size += (strlenW(MachineName) + 3) * sizeof(WCHAR); size += (strlenW(MachineName) + 3) * sizeof(WCHAR);
list = HeapAlloc(GetProcessHeap(), 0, size); list = HeapAlloc(GetProcessHeap(), 0, size);
if (!list) if (!list)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto cleanup;
}
memset(list, 0, sizeof(struct DeviceInfoSet));
list->magic = SETUP_DEV_INFO_SET_MAGIC;
memcpy(
&list->ClassGuid,
ClassGuid ? ClassGuid : &GUID_NULL,
sizeof(list->ClassGuid));
list->InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
list->InstallParams.Flags |= DI_CLASSINSTALLPARAMS;
list->InstallParams.hwndParent = hwndParent;
if (MachineName)
{
rc = RegConnectRegistryW(MachineName, HKEY_LOCAL_MACHINE, &list->HKLM);
if (rc != ERROR_SUCCESS)
{ {
SetLastError(rc); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto cleanup; goto cleanup;
}
UNCServerName = HeapAlloc(GetProcessHeap(), 0, (strlenW(MachineName) + 3) * sizeof(WCHAR));
if (!UNCServerName)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto cleanup;
} }
memset(list, 0, sizeof(struct DeviceInfoSet));
strcpyW(UNCServerName + 2, MachineName); list->magic = SETUP_DEV_INFO_SET_MAGIC;
list->szData[0] = list->szData[1] = '\\'; memcpy(
strcpyW(list->szData + 2, MachineName); &list->ClassGuid,
list->MachineName = list->szData; ClassGuid ? ClassGuid : &GUID_NULL,
} sizeof(list->ClassGuid));
else list->InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
{ list->InstallParams.Flags |= DI_CLASSINSTALLPARAMS;
DWORD Size = MAX_PATH; list->InstallParams.hwndParent = hwndParent;
list->HKLM = HKEY_LOCAL_MACHINE; if (MachineName)
UNCServerName = HeapAlloc(GetProcessHeap(), 0, (MAX_PATH + 2) * sizeof(WCHAR));
if (!UNCServerName)
{ {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); rc = RegConnectRegistryW(MachineName, HKEY_LOCAL_MACHINE, &list->HKLM);
goto cleanup; if (rc != ERROR_SUCCESS)
{
SetLastError(rc);
goto cleanup;
}
UNCServerName = HeapAlloc(GetProcessHeap(), 0, (strlenW(MachineName) + 3) * sizeof(WCHAR));
if (!UNCServerName)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto cleanup;
}
strcpyW(UNCServerName + 2, MachineName);
list->szData[0] = list->szData[1] = '\\';
strcpyW(list->szData + 2, MachineName);
list->MachineName = list->szData;
} }
if (!GetComputerNameW(UNCServerName + 2, &Size)) else
goto cleanup; {
list->MachineName = NULL; DWORD Size = MAX_PATH;
} list->HKLM = HKEY_LOCAL_MACHINE;
UNCServerName = HeapAlloc(GetProcessHeap(), 0, (MAX_PATH + 2) * sizeof(WCHAR));
if (!UNCServerName)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto cleanup;
}
if (!GetComputerNameW(UNCServerName + 2, &Size))
goto cleanup;
list->MachineName = NULL;
}
#if 0 #if 0
UNCServerName[0] = UNCServerName[1] = '\\'; UNCServerName[0] = UNCServerName[1] = '\\';
cr = CM_Connect_MachineW(UNCServerName, &list->hMachine); cr = CM_Connect_MachineW(UNCServerName, &list->hMachine);
if (cr != CR_SUCCESS) if (cr != CR_SUCCESS)
{ {
SetLastError(GetErrorCodeFromCrCode(cr)); SetLastError(GetErrorCodeFromCrCode(cr));
goto cleanup; goto cleanup;
} }
#endif #endif
InitializeListHead(&list->DriverListHead); InitializeListHead(&list->DriverListHead);
InitializeListHead(&list->ListHead); InitializeListHead(&list->ListHead);
ret = (HDEVINFO)list; ret = (HDEVINFO)list;
cleanup: cleanup:
if (ret == INVALID_HANDLE_VALUE) if (ret == INVALID_HANDLE_VALUE)
{
if (list)
{ {
if (list->HKLM != NULL && list->HKLM != HKEY_LOCAL_MACHINE) if (list)
RegCloseKey(list->HKLM); {
if (list->HKLM != NULL && list->HKLM != HKEY_LOCAL_MACHINE)
RegCloseKey(list->HKLM);
HeapFree(GetProcessHeap(), 0, list);
}
} }
HeapFree(GetProcessHeap(), 0, list);
}
if (UNCServerName)
HeapFree(GetProcessHeap(), 0, UNCServerName); HeapFree(GetProcessHeap(), 0, UNCServerName);
return ret; return ret;
} }
/*********************************************************************** /***********************************************************************
@ -415,8 +414,8 @@ CheckSectionValid(
static const WCHAR ExtensionArchitectureNone[] = {0}; static const WCHAR ExtensionArchitectureNone[] = {0};
static const WCHAR ExtensionArchitecturealpha[] = {'a','l','p','h','a',0}; static const WCHAR ExtensionArchitecturealpha[] = {'a','l','p','h','a',0};
static const WCHAR ExtensionArchitectureamd64[] = {'a','m','d','6','4',0}; static const WCHAR ExtensionArchitectureamd64[] = {'A','M','D','6','4',0};
static const WCHAR ExtensionArchitectureia64[] = {'i','a','6','4',0}; static const WCHAR ExtensionArchitectureia64[] = {'I','A','6','4',0};
static const WCHAR ExtensionArchitecturemips[] = {'m','i','p','s',0}; static const WCHAR ExtensionArchitecturemips[] = {'m','i','p','s',0};
static const WCHAR ExtensionArchitectureppc[] = {'p','p','c',0}; static const WCHAR ExtensionArchitectureppc[] = {'p','p','c',0};
static const WCHAR ExtensionArchitecturex86[] = {'x','8','6',0}; static const WCHAR ExtensionArchitecturex86[] = {'x','8','6',0};