Example #1
0
BOOL Dlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) {

   chSETDLGICONS(hwnd, IDI_COUNTER);

   SetDlgItemInt(hwnd, IDC_COUNT, 0, FALSE);
   return(TRUE);
}
Example #2
0
BOOL Dlg_OnInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) {
   
   chSETDLGICONS(hWnd, IDI_VMALLOC);

   // Initialize the dialog box by disabling all the nonsetup controls.
   EnableWindow(GetDlgItem(hWnd, IDC_INDEXTEXT),      FALSE);
   EnableWindow(GetDlgItem(hWnd, IDC_INDEX),          FALSE);
   EnableWindow(GetDlgItem(hWnd, IDC_USE),            FALSE);
   EnableWindow(GetDlgItem(hWnd, IDC_CLEAR),          FALSE);
   EnableWindow(GetDlgItem(hWnd, IDC_GARBAGECOLLECT), FALSE);

   // Get the coordinates of the memory map display.
   GetWindowRect(GetDlgItem(hWnd, IDC_MEMMAP), &g_rcMemMap);
   MapWindowPoints(NULL, hWnd, (LPPOINT) &g_rcMemMap, 2);

   // Destroy the window that identifies the location of the memory map
   DestroyWindow(GetDlgItem(hWnd, IDC_MEMMAP));
   
   // Put the page size in the dialog box just for the user's information.
   TCHAR szBuf[10];
   StringCchPrintf(szBuf, _countof(szBuf), TEXT("%d KB"), g_uPageSize / 1024);
   SetDlgItemText(hWnd, IDC_PAGESIZE, szBuf);

   // Initialize the edit control.
   SetDlgItemInt(hWnd, IDC_INDEX, 0, FALSE);
   
   return(TRUE);
}
Example #3
0
BOOL Dlg_OnInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) {

   chSETDLGICONS(hWnd, IDI_QUEUE);

   g_hWnd = hWnd; // Used by client/server threads to show status

   // Prepare the SRWLock to be used
   InitializeSRWLock(&g_srwLock);

   // Prepare the condition variables to be used
   InitializeConditionVariable(&g_cvReadyToConsume);
   InitializeConditionVariable(&g_cvReadyToProduce);

   // Will be set to TRUE in order to end threads
   g_fShutdown = FALSE;

   // Create the writer threads
   DWORD dwThreadID;
   for (int x = 0; x < 4; x++)
      g_hThreads[g_nNumThreads++] = 
         chBEGINTHREADEX(NULL, 0, WriterThread, (PVOID) (INT_PTR) x, 
            0, &dwThreadID);

   // Create the reader threads
   for (int x = 0; x < 2; x++)
      g_hThreads[g_nNumThreads++] = 
         chBEGINTHREADEX(NULL, 0, ReaderThread, (PVOID) (INT_PTR) x, 
            0, &dwThreadID);

   return(TRUE);
}
Example #4
0
BOOL Dlg_OnInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) {

    chSETDLGICONS(hWnd, IDI_LASTMSGBOXINFO);
    SetDlgItemText(hWnd, IDC_INFO,
                   TEXT("Waiting for a Message Box to be dismissed"));
    return(TRUE);
}
Example #5
0
BOOL Dlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) 
{
   chSETDLGICONS(hwnd, IDI_JOBLAB);

   // Save our window handle so that the completion port thread can access it
   g_hwnd = hwnd; 
   
   HWND hwndPriorityClass = GetDlgItem(hwnd, IDC_PRIORITYCLASS);
   ComboBox_AddString(hwndPriorityClass, TEXT("No limit"));
   ComboBox_AddString(hwndPriorityClass, TEXT("Idle"));
   ComboBox_AddString(hwndPriorityClass, TEXT("Below normal"));
   ComboBox_AddString(hwndPriorityClass, TEXT("Normal"));
   ComboBox_AddString(hwndPriorityClass, TEXT("Above normal"));
   ComboBox_AddString(hwndPriorityClass, TEXT("High"));
   ComboBox_AddString(hwndPriorityClass, TEXT("Realtime"));
   ComboBox_SetCurSel(hwndPriorityClass, 0); // Default to "No Limit"

   HWND hwndSchedulingClass = GetDlgItem(hwnd, IDC_SCHEDULINGCLASS);
   ComboBox_AddString(hwndSchedulingClass, TEXT("No limit"));
   for (int n = 0; n <= 9; n++) {
      TCHAR szSchedulingClass[2];
      StringCchPrintf(szSchedulingClass, _countof(szSchedulingClass), 
         TEXT("%u"), n);
      ComboBox_AddString(hwndSchedulingClass, szSchedulingClass);
   }
   ComboBox_SetCurSel(hwndSchedulingClass, 0); // Default to "No Limit"
   SetTimer(hwnd, 1, 10000, NULL);             // 10 second accounting update
   return(TRUE);
}
Example #6
0
BOOL Dlg_OnInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) {

   chSETDLGICONS(hWnd, IDI_FILEREV);

   // Initialize the dialog box by disabling the Reverse button
   EnableWindow(GetDlgItem(hWnd, IDC_REVERSE), FALSE);
   return(TRUE);
}
Example #7
0
BOOL Dlg_OnInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) {

   chSETDLGICONS(hWnd, IDI_APPINST);

   // Force the static control to be initialized correctly.
   PostMessage(HWND_BROADCAST, g_uMsgAppInstCountUpdate, 0, 0);
   return(TRUE);
}
BOOL Dlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) 
{
   chSETDLGICONS(hwnd, IDI_SINGLETON);
   /* Keep track of the main dialog window handle */
   g_hDlg = hwnd;
   /* Check whether another instance is already running */
   CheckInstances();
   return(TRUE);
}
Example #9
0
BOOL Dlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) {

   chSETDLGICONS(hwnd, IDI_VMSTAT);

   // Set a timer so that the information updates periodically.
   SetTimer(hwnd, IDT_UPDATE, 1 * 1000, NULL);

   // Force a timer message for the initial update.
   FORWARD_WM_TIMER(hwnd, IDT_UPDATE, SendMessage);
   return(TRUE);
}
Example #10
0
BOOL Dlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) {

   chSETDLGICONS(hwnd, IDI_WFMETEXT);

   // Initialize the controls in the dialog box
   SetDlgItemInt(hwnd,  IDC_NUMOBJS, 4, FALSE);
   SetDlgItemInt(hwnd,  IDC_TIMEOUT, 30000, FALSE);
   SetDlgItemText(hwnd, IDC_EXPRESSION, 
      _T("1 2 | 2 3 4 | 1 4"));

   // Set the multi-column listbox's column size
   ListBox_SetColumnWidth(GetDlgItem(hwnd, IDC_OBJLIST), 
      LOWORD(GetDialogBaseUnits()) * 4);

   return(TRUE);  // Accept default focus window.
}
Example #11
0
BOOL Dlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) {

   chSETDLGICONS(hwnd, IDI_LOCKCOP);

   // Keep track of the main dialog window handle
   g_hDlg = hwnd;

   // Have the results window use a fixed-pitch font
   SetWindowFont(GetDlgItem(hwnd, IDC_EDIT_DETAILS), 
      GetStockFont(ANSI_FIXED_FONT), FALSE);

   // Fill up the process combo-box
   OnRefreshProcesses();
   
   return(TRUE);
}
Example #12
0
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);
}
Example #13
0
BOOL Dlg_OnInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
{

    chSETDLGICONS(hWnd, IDI_SYSINFO);

    SYSTEM_INFO sinf;
    GetSystemInfo(&sinf);

    ShowCPUInfo(hWnd, sinf.wProcessorArchitecture,
                sinf.wProcessorLevel, sinf.wProcessorRevision);

    TCHAR szBuf[50];
    SetDlgItemText(hWnd, IDC_PAGESIZE,
                   BigNumToString(sinf.dwPageSize, szBuf, _countof(szBuf)));

    StringCchPrintf(szBuf, _countof(szBuf), TEXT("%p"),
                    sinf.lpMinimumApplicationAddress);
    SetDlgItemText(hWnd, IDC_MINAPPADDR, szBuf);

    StringCchPrintf(szBuf, _countof(szBuf), TEXT("%p"),
                    sinf.lpMaximumApplicationAddress);
    SetDlgItemText(hWnd, IDC_MAXAPPADDR, szBuf);

    StringCchPrintf(szBuf, _countof(szBuf), TEXT("0x%016I64X"),
                    (__int64) sinf.dwActiveProcessorMask);
    SetDlgItemText(hWnd, IDC_ACTIVEPROCMASK, szBuf);

    SetDlgItemText(hWnd, IDC_NUMOFPROCS,
                   BigNumToString(sinf.dwNumberOfProcessors, szBuf, _countof(szBuf)));

    SetDlgItemText(hWnd, IDC_ALLOCGRAN,
                   BigNumToString(sinf.dwAllocationGranularity, szBuf, _countof(szBuf)));

    ShowBitness(hWnd);

    return(TRUE);
}
BOOL Dlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) 
{   
   chSETDLGICONS(hwnd, IDI_PROCESSINFO);

   /* Is set to TRUE if the Administrator privileges 
    * are available; either because running elevated
    * or simply because UAC has been disabled.
	*/
   BOOL bCanReadSystemProcesses = FALSE;

   /* Show if we are running with filtered token or not */
   if (GetProcessElevation(&s_elevationType, &s_bIsAdmin)) 
   {
      /* prefix title with elevation */
      TCHAR szTitle[64];

      switch(s_elevationType) 
	  {
         /* Default user or UAC is disabled */
         case TokenElevationTypeDefault:  
            if (IsUserAnAdmin()) 
			{
               _tcscpy_s(
				   szTitle, 
				   _countof(szTitle), 
                   TEXT("Default Administrator: ")); 
               bCanReadSystemProcesses = true;
            } 
			else 
			{
               _tcscpy_s(
				   szTitle, 
				   _countof(szTitle), 
                   TEXT("Default: ")); 
            }
         break;
         /* Process has been successfully elevated */
         case TokenElevationTypeFull:
            if (IsUserAnAdmin()) 
			{
               _tcscpy_s(
				   szTitle, 
				   _countof(szTitle), 
                   TEXT("Elevated Administrator: ")); 
               bCanReadSystemProcesses = true;
            } 
			else 
			{
               _tcscpy_s(
				   szTitle, 
				   _countof(szTitle), 
                   TEXT("Elevated: ")); 
            }
         break;
         /* Process is running with limited privileges */
         case TokenElevationTypeLimited:
            if (s_bIsAdmin) 
			{
               _tcscpy_s(
				   szTitle, 
				   _countof(szTitle), 
                   TEXT("Filtered Administrator: ")); 
            } 
			else 
			{
               _tcscpy_s(
				   szTitle, 
				   _countof(szTitle), 
                   TEXT("Filtered: ")); 
            }
         break;
      }

      /* Update the dialog title based on the elevation level */
      GetWindowText(
		  hwnd, 
		  _tcschr(szTitle, TEXT('\0')), 
         _countof(szTitle) - _tcslen(szTitle));
      SetWindowText(hwnd, szTitle);

      /* Add the "shield" icon if needed to allow the user
       * to restart the application with elevated privileges
	   */
      if (!bCanReadSystemProcesses) 
	  {
         Button_SetElevationRequiredState(
            GetDlgItem(hwnd, IDC_BTN_SYSTEM_PROCESSES), 
               !bCanReadSystemProcesses);
      } 
	  else 
	  {
         /* No need to show the button... */
         ShowWindow(GetDlgItem(hwnd, IDC_BTN_SYSTEM_PROCESSES), SW_HIDE);
         
         /* ... and the combo-box can take the whole width of the dialog box */
         MoveWindow(GetDlgItem(hwnd, IDC_BTN_SYSTEM_PROCESSES), 
            0, 0, 0, 0, FALSE);
      }
   }
   
   /* Hide the module-helper listbox. */
   ShowWindow(GetDlgItem(hwnd, IDC_MODULEHELP), SW_HIDE);

   /* Have the results window use a fixed-pitch font */
   SetWindowFont(
	   GetDlgItem(hwnd, IDC_RESULTS), 
       GetStockFont(ANSI_FIXED_FONT), 
	   FALSE);

   /* By default, show the running processes */
   Dlg_PopulateProcessList(hwnd);

   return(TRUE);
}
Example #15
0
BOOL Dlg_OnInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
{

    chSETDLGICONS(hWnd, IDI_INJLIB);
    return(TRUE);
}