IOReturn IOSCSITape::SetBlockSize(int size) { IOReturn status = kIOReturnError; SCSI_ModeSense_Default newMode; bcopy(&lastModeData, &newMode, sizeof(SCSI_ModeSense_Default)); newMode.header.MODE_DATA_LENGTH = 0; newMode.descriptor.BLOCK_LENGTH[0] = (size >> 16) & 0xFF; newMode.descriptor.BLOCK_LENGTH[1] = (size >> 8) & 0xFF; newMode.descriptor.BLOCK_LENGTH[2] = size & 0xFF; if ((status = SetDeviceDetails(&newMode)) == kIOReturnSuccess) GetDeviceDetails(); return status; }
static BOOL InitializeDialog(HWND hwndDlg, PDISPLAY_DEVICEW pDispDevice) { WCHAR szText[100]; WCHAR szFormat[30]; HKEY hKey; HWND hDlgCtrls[5]; DWORD dwMemory; DEVMODEW DevMode; IDirect3D9 * ppObj = NULL; D3DADAPTER_IDENTIFIER9 Identifier; HRESULT hResult; szText[0] = L'\0'; /* fix wine */ //ppObj = Direct3DCreate9(D3D_SDK_VERSION); if (ppObj) { hResult = IDirect3D9_GetAdapterIdentifier(ppObj, D3DADAPTER_DEFAULT , 2/*D3DENUM_WHQL_LEVEL*/, &Identifier); if (hResult == D3D_OK) { if (Identifier.WHQLLevel) { /* adapter is WHQL certified */ LoadStringW(hInst, IDS_OPTION_YES, szText, sizeof(szText)/sizeof(WCHAR)); } else { LoadStringW(hInst, IDS_OPTION_NO, szText, sizeof(szText)/sizeof(WCHAR)); } } IDirect3D9_Release(ppObj); } else { LoadStringW(hInst, IDS_DEVICE_STATUS_UNKNOWN, szText, sizeof(szText)/sizeof(WCHAR)); } szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0'; SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_LOGO, WM_SETTEXT, 0, (LPARAM)szText); if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, &pDispDevice->DeviceKey[18], 0, KEY_READ, &hKey) != ERROR_SUCCESS) return FALSE; if (GetRegValue(hKey, NULL, L"HardwareInformation.ChipType", REG_BINARY, szText, sizeof(szText))) { /* set chip type */ SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_CHIP, WM_SETTEXT, 0, (LPARAM)szText); } if (GetRegValue(hKey, NULL, L"HardwareInformation.DacType", REG_BINARY, szText, sizeof(szText))) { /* set DAC type */ SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_DAC, WM_SETTEXT, 0, (LPARAM)szText); } if (GetRegValue(hKey, NULL, L"HardwareInformation.MemorySize", REG_BINARY, (LPWSTR)&dwMemory, sizeof(dwMemory))) { /* set chip memory size */ if (dwMemory > (1048576)) { /* buggy ATI driver requires that */ dwMemory /= 1048576; } szFormat[0] = L'\0'; if (LoadStringW(hInst, IDS_FORMAT_ADAPTER_MEM, szFormat, sizeof(szFormat)/sizeof(WCHAR))) szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0'; wsprintfW(szText, szFormat, dwMemory); SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_MEM, WM_SETTEXT, 0, (LPARAM)szText); } /* retrieve current display mode */ DevMode.dmSize = sizeof(DEVMODEW); if (EnumDisplaySettingsW(pDispDevice->DeviceName, ENUM_CURRENT_SETTINGS, &DevMode)) { szFormat[0] = L'\0'; if (LoadStringW(hInst, IDS_FORMAT_ADAPTER_MODE, szFormat, sizeof(szFormat)/sizeof(WCHAR))) szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0'; wsprintfW(szText, szFormat, DevMode.dmPelsWidth, DevMode.dmPelsHeight, DevMode.dmBitsPerPel, DevMode.dmDisplayFrequency); SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_MODE, WM_SETTEXT, 0, (LPARAM)szText); } /* query attached monitor */ wcscpy(szText, pDispDevice->DeviceName); ZeroMemory(pDispDevice, sizeof(DISPLAY_DEVICEW)); pDispDevice->cb = sizeof(DISPLAY_DEVICEW); if (EnumDisplayDevicesW(szText, 0, pDispDevice, 0)) { /* set monitor name */ SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_MONITOR, WM_SETTEXT, 0, (LPARAM)pDispDevice->DeviceString); } hDlgCtrls[0] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_ID); hDlgCtrls[1] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_VENDOR); hDlgCtrls[2] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_DRIVER); hDlgCtrls[3] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_VERSION); hDlgCtrls[4] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_DATE); SetDeviceDetails(hDlgCtrls, &GUID_DEVCLASS_DISPLAY, NULL); return TRUE; }
BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCWSTR lpcstrDescription, LPCWSTR lpcstrModule, LPVOID lpContext) { PDXDIAG_CONTEXT pContext = (PDXDIAG_CONTEXT)lpContext; HWND * hDlgs; HWND hwndDlg; WCHAR szSound[20]; WCHAR szText[30]; IDirectSound8 *pObj; HRESULT hResult; DWORD dwCertified; if (!lpGuid) return TRUE; if (pContext->NumSoundAdapter) hDlgs = HeapReAlloc(GetProcessHeap(), 0, pContext->hSoundWnd, (pContext->NumSoundAdapter + 1) * sizeof(HWND)); else hDlgs = HeapAlloc(GetProcessHeap(), 0, (pContext->NumSoundAdapter + 1) * sizeof(HWND)); if (!hDlgs) return FALSE; pContext->hSoundWnd = hDlgs; hwndDlg = CreateDialogParamW(hInst, MAKEINTRESOURCEW(IDD_SOUND_DIALOG), pContext->hMainDialog, SoundPageWndProc, (LPARAM)pContext); if (!hwndDlg) return FALSE; hResult = DirectSoundCreate8(lpGuid, (LPDIRECTSOUND8*)&pObj, NULL); if (hResult == DS_OK) { szText[0] = L'\0'; if (IDirectSound8_VerifyCertification(pObj, &dwCertified) == DS_OK) { if (dwCertified == DS_CERTIFIED) LoadStringW(hInst, IDS_OPTION_YES, szText, sizeof(szText)/sizeof(WCHAR)); else if (dwCertified == DS_UNCERTIFIED) LoadStringW(hInst, IDS_OPTION_NO, szText, sizeof(szText)/sizeof(WCHAR)); } else { LoadStringW(hInst, IDS_OPTION_NO, szText, sizeof(szText)/sizeof(WCHAR)); } szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0'; SendDlgItemMessageW(hwndDlg, IDC_STATIC_DSOUND_LOGO, WM_SETTEXT, 0, (LPARAM)szText); IDirectSound8_Release(pObj); } /* set device name */ SendDlgItemMessageW(hwndDlg, IDC_STATIC_DSOUND_NAME, WM_SETTEXT, 0, (LPARAM)lpcstrDescription); /* set range for slider */ SendDlgItemMessageW(hwndDlg, IDC_SLIDER_DSOUND, TBM_SETRANGE, TRUE, MAKELONG(0, 3)); /* FIXME set correct position */ SendDlgItemMessageW(hwndDlg, IDC_SLIDER_DSOUND, TBM_SETSEL, FALSE, 0); /* set further device details */ SetDeviceDetails(hwndDlg, &GUID_DEVCLASS_MEDIA, lpcstrDescription); /* load sound resource string */ szSound[0] = L'\0'; LoadStringW(hInst, IDS_SOUND_DIALOG, szSound, sizeof(szSound)/sizeof(WCHAR)); szSound[(sizeof(szSound)/sizeof(WCHAR))-1] = L'\0'; /* output the device id */ wsprintfW (szText, L"%s %u", szSound, pContext->NumSoundAdapter + 1); /* insert it into general tab */ InsertTabCtrlItem(pContext->hTabCtrl, pContext->NumDisplayAdapter + pContext->NumSoundAdapter + 1, szText); /* store dialog window */ hDlgs[pContext->NumSoundAdapter] = hwndDlg; pContext->NumSoundAdapter++; return TRUE; }