void ShowBitness(HWND hWnd) { TCHAR szFullTitle[100]; TCHAR szTitle[32]; GetWindowText(hWnd, szTitle, _countof(szTitle)); #if defined(_WIN64) // 64-bit applications can only run on 64-bit Windows, // so there is nothing special to check except the // _WIN64 symbol set by the compiler. StringCchPrintf(szFullTitle, _countof(szFullTitle), TEXT("64-bit %s"), szTitle); #else BOOL bIsWow64 = FALSE; if (!IsWow64Process(GetCurrentProcess(), &bIsWow64)) { chFAIL("Failed to get WOW64 state."); return; } if (bIsWow64) { StringCchPrintf(szFullTitle, _countof(szFullTitle), TEXT("32-bit %s on WOW64"), szTitle); } else { StringCchPrintf(szFullTitle, _countof(szFullTitle), TEXT("32-bit %s on 32-bit Windows"), szTitle); } #endif SetWindowText(hWnd, szFullTitle); }
BOOL Dlg_OnInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) { chSETDLGICONS(hWnd, IDI_AWE); // Create the 2 memory address windows chVERIFY(g_aw[0].Create(g_cbBufferSize)); chVERIFY(g_aw[1].Create(g_cbBufferSize)); // Create the 2 storage blocks if (!g_aws[0].Allocate(g_cbBufferSize)) { chFAIL("Failed to allocate RAM.\nMost likely reason: " "you are not granted the Lock Pages in Memory user right."); } chVERIFY(g_aws[1].Allocate(g_nChars * sizeof(TCHAR))); // Put some default text in the 1st storage block g_aws[0].MapStorage(g_aw[0]); _tcscpy_s((PTSTR) (PVOID) g_aw[0], g_cbBufferSize, TEXT("Text in Storage 0")); // Put some default text in the 2nd storage block g_aws[1].MapStorage(g_aw[0]); _tcscpy_s((PTSTR) (PVOID) g_aw[0], g_cbBufferSize, TEXT("Text in Storage 1")); // Populate the dialog box controls for (int n = 0; n <= 1; n++) { // Set the combo box for each address window int id = ((n == 0) ? IDC_WINDOW0STORAGE : IDC_WINDOW1STORAGE); HWND hWndCB = GetDlgItem(hWnd, id); ComboBox_AddString(hWndCB, TEXT("No storage")); ComboBox_AddString(hWndCB, TEXT("Storage 0")); ComboBox_AddString(hWndCB, TEXT("Storage 1")); // Window 0 shows Storage 0, Window 1 shows Storage 1 ComboBox_SetCurSel(hWndCB, n + 1); FORWARD_WM_COMMAND(hWnd, id, hWndCB, CBN_SELCHANGE, SendMessage); Edit_LimitText(GetDlgItem(hWnd, (n == 0) ? IDC_WINDOW0TEXT : IDC_WINDOW1TEXT), g_nChars); } return(TRUE); }