ReactOS  0.4.15-dev-5500-g82cf6c2
general.c File Reference
#include "precomp.h"
#include <winnls.h>
#include <powrprof.h>
#include <buildno.h>
Include dependency graph for general.c:

Go to the source code of this file.

Classes

struct  _IMGINFO
 

Macros

#define ANIM_STEP   2
 
#define ANIM_TIME   50
 
#define ID_SYSUPTIME_UPDATE_TIMER   1
 

Typedefs

typedef struct _IMGINFO IMGINFO
 
typedef struct _IMGINFOPIMGINFO
 
typedef ULONGLONG(WINAPIPFGETTICKCOUNT64) (VOID)
 

Functions

VOID ShowLastWin32Error (HWND hWndOwner)
 
static VOID InitLogo (HWND hwndDlg)
 
LRESULT CALLBACK RosImageProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID SetRegTextData (HWND hwnd, HKEY hKey, LPTSTR Value, UINT uID)
 
static INT SetProcNameString (HWND hwnd, HKEY hKey, LPTSTR Value, UINT uID1, UINT uID2)
 
static VOID MakeFloatValueString (DOUBLE *dFloatValue, LPTSTR szOutput, LPTSTR szAppend)
 
static VOID SetProcSpeed (HWND hwnd, HKEY hKey, LPTSTR Value, UINT uID)
 
static VOID GetSystemInformation (HWND hwnd)
 
static VOID GetSystemVersion (HWND hwnd)
 
static ULONGLONG GetTickCountQPC (VOID)
 An equivalent of GetTickCount64, implemented using QueryPerformanceCounter. More...
 
static VOID GetSystemUptime (HWND hwndDlg)
 
static VOID InitSystemUptime (HWND hwndDlg)
 
INT_PTR CALLBACK GeneralPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

static PIMGINFO pImgInfo
 
static const BLENDFUNCTION BlendFunc = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA}
 
static HMODULE hKernel32Vista = NULL
 
static PFGETTICKCOUNT64 pGetTickCount64 = NULL
 
static WCHAR szUptimeFormat [64]
 

Macro Definition Documentation

◆ ANIM_STEP

#define ANIM_STEP   2

Definition at line 18 of file general.c.

◆ ANIM_TIME

#define ANIM_TIME   50

Definition at line 19 of file general.c.

◆ ID_SYSUPTIME_UPDATE_TIMER

#define ID_SYSUPTIME_UPDATE_TIMER   1

Definition at line 20 of file general.c.

Typedef Documentation

◆ IMGINFO

◆ PFGETTICKCOUNT64

typedef ULONGLONG(WINAPI * PFGETTICKCOUNT64) (VOID)

Definition at line 31 of file general.c.

◆ PIMGINFO

Function Documentation

◆ GeneralPageProc()

INT_PTR CALLBACK GeneralPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 688 of file general.c.

689 {
692 
693  switch (uMsg)
694  {
695  case WM_INITDIALOG:
696  {
698  if (pImgInfo == NULL)
699  {
700  EndDialog(hwndDlg, 0);
701  return FALSE;
702  }
703 
704  InitLogo(hwndDlg);
706  GetSystemInformation(hwndDlg);
707  GetSystemVersion(hwndDlg);
708  InitSystemUptime(hwndDlg);
709  break;
710  }
711 
712  case WM_DESTROY:
713  {
715 
716  if (hKernel32Vista)
717  {
719  }
720 
722  break;
723  }
724 
725  case WM_TIMER:
726  {
728  {
729  /* Update system uptime */
730  GetSystemUptime(hwndDlg);
731  }
732 
733  break;
734  }
735 
736  case WM_COMMAND:
737  {
738  if (LOWORD(wParam) == IDC_LICENCE)
739  {
741 
742  return TRUE;
743  }
744  break;
745  }
746 
747  case WM_DRAWITEM:
748  {
750 
751  if (lpDrawItem->CtlID == IDC_ROSIMG)
752  {
753  HDC hdcMem;
754  LONG left;
755 
756  /* Position image in centre of dialog */
757  left = (lpDrawItem->rcItem.right - pImgInfo->cxSource) / 2;
758 
759  hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
760  if (hdcMem != NULL)
761  {
763  BitBlt(lpDrawItem->hDC,
764  left,
765  lpDrawItem->rcItem.top,
766  lpDrawItem->rcItem.right - lpDrawItem->rcItem.left,
767  lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top,
768  hdcMem,
769  0,
770  0,
771  SRCCOPY);
772  DeleteDC(hdcMem);
773  }
774  }
775  return TRUE;
776  }
777 
778  case WM_NOTIFY:
779  {
780  NMHDR *nmhdr = (NMHDR *)lParam;
781 
782  if (nmhdr->idFrom == IDC_ROSHOMEPAGE_LINK && nmhdr->code == NM_CLICK)
783  {
784  PNMLINK nml = (PNMLINK)nmhdr;
785 
786  ShellExecuteW(hwndDlg, L"open", nml->item.szUrl, NULL, NULL, SW_SHOWNORMAL);
787  }
788  break;
789  }
790 
791  }
792 
793  return FALSE;
794 }
static VOID GetSystemUptime(HWND hwndDlg)
Definition: general.c:623
#define MAKEINTRESOURCE
Definition: winuser.h:591
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HINSTANCE hApplet
Definition: access.c:17
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
static VOID GetSystemInformation(HWND hwnd)
Definition: general.c:453
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define IDC_LICENCE
Definition: resource.h:79
static VOID GetSystemVersion(HWND hwnd)
Definition: general.c:573
UINT code
Definition: winuser.h:3149
#define DialogBox
Definition: winuser.h:5751
#define L(x)
Definition: ntvdm.h:50
#define IDC_ROSIMG
Definition: resource.h:80
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
UINT_PTR idFrom
Definition: winuser.h:3148
static HMODULE hKernel32Vista
Definition: general.c:35
INT_PTR CALLBACK LicenceDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: licence.c:68
struct tagNMLINK * PNMLINK
#define IDC_ROSHOMEPAGE_LINK
Definition: resource.h:81
WCHAR szUrl[L_MAX_URL_LENGTH]
Definition: commctrl.h:4757
#define WM_DESTROY
Definition: winuser.h:1599
#define FreeLibrary(x)
Definition: compat.h:748
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_TIMER
Definition: winuser.h:1732
GLint left
Definition: glext.h:7726
static VOID InitSystemUptime(HWND hwndDlg)
Definition: general.c:658
static PIMGINFO pImgInfo
Definition: general.c:33
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define WM_COMMAND
Definition: winuser.h:1730
#define NM_CLICK
Definition: commctrl.h:130
static VOID InitLogo(HWND hwndDlg)
Definition: general.c:65
#define GWLP_WNDPROC
Definition: treelist.c:66
INT cxSource
Definition: userinit.h:50
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define ID_SYSUPTIME_UPDATE_TIMER
Definition: general.c:20
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP hBitmap
Definition: userinit.h:49
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define IDD_LICENCE
Definition: resource.h:225
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
LRESULT CALLBACK RosImageProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: general.c:144
#define WM_DRAWITEM
Definition: winuser.h:1635
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2346
LONG bottom
Definition: windef.h:309
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:735
#define SRCCOPY
Definition: wingdi.h:333
HDC hdcMem
Definition: welcome.c:104
#define WM_NOTIFY
Definition: richedit.h:61
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49

◆ GetSystemInformation()

static VOID GetSystemInformation ( HWND  hwnd)
static

Definition at line 453 of file general.c.

454 {
455  HKEY hKey;
456  TCHAR SysKey[] = _T("HARDWARE\\DESCRIPTION\\System");
457  TCHAR ProcKey[] = _T("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
458  MEMORYSTATUSEX MemStat;
459  TCHAR Buf[32];
460  WCHAR SMBiosName[96];
461  INT CurMachineLine = IDC_MACHINELINE1;
462 
463  /*
464  * Get hardware device name or motherboard name
465  * using information from raw SMBIOS data
466  */
467  if (GetSystemName(SMBiosName, _countof(SMBiosName)))
468  {
469  SetDlgItemText(hwnd, CurMachineLine, SMBiosName);
470  CurMachineLine++;
471  }
472  else
473  {
474  /* If SMBIOS is not available, use System Identifier */
476  {
477  SetRegTextData(hwnd, hKey, _T("Identifier"), CurMachineLine);
478  CurMachineLine++;
479  RegCloseKey(hKey);
480  }
481  }
482  /*
483  * Get Processor information
484  * although undocumented, this information is being pulled
485  * directly out of the registry instead of via setupapi as it
486  * contains all the info we need, and should remain static
487  */
489  {
490  INT PrevMachineLine;
491 
492  SetRegTextData(hwnd, hKey, _T("VendorIdentifier"), CurMachineLine);
493  CurMachineLine++;
494 
495  PrevMachineLine = CurMachineLine;
496  CurMachineLine += SetProcNameString(hwnd,
497  hKey,
498  _T("ProcessorNameString"),
499  CurMachineLine,
500  CurMachineLine + 1);
501 
502  if (CurMachineLine == PrevMachineLine)
503  {
504  /* TODO: Try obtaining CPU name from WMI (i.e. CIM_Processor) */
505 
506  /* Brand String is not available, use Identifier instead */
507  CurMachineLine += SetProcNameString(hwnd,
508  hKey,
509  _T("Identifier"),
510  CurMachineLine,
511  CurMachineLine + 1);
512  }
513 
514  SetProcSpeed(hwnd, hKey, _T("~MHz"), CurMachineLine);
515  CurMachineLine++;
516  RegCloseKey(hKey);
517  }
518 
519  /* Get total physical RAM */
520  MemStat.dwLength = sizeof(MemStat);
521 
522  if (GlobalMemoryStatusEx(&MemStat))
523  {
524  TCHAR szStr[32];
525  double dTotalPhys;
526 
527  if (MemStat.ullTotalPhys > 1024 * 1024 * 1024)
528  {
529  UINT i = 0;
530  static const UINT uStrId[] = { IDS_GIGABYTE, IDS_TERABYTE, IDS_PETABYTE};
531 
532  // We're dealing with GBs or more
533  MemStat.ullTotalPhys /= 1024 * 1024;
534 
535  if (MemStat.ullTotalPhys > 1024 * 1024)
536  {
537  // We're dealing with TBs or more
538  MemStat.ullTotalPhys /= 1024;
539  i++;
540 
541  if (MemStat.ullTotalPhys > 1024 * 1024)
542  {
543  // We're dealing with PBs or more
544  MemStat.ullTotalPhys /= 1024;
545  i++;
546 
547  dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
548  }
549  else
550  {
551  dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
552  }
553  }
554  else
555  {
556  dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
557  }
558 
559  LoadString(hApplet, uStrId[i], szStr, sizeof(szStr) / sizeof(TCHAR));
560  MakeFloatValueString(&dTotalPhys, Buf, szStr);
561  }
562  else
563  {
564  // We're dealing with MBs, don't show any decimals
565  LoadString(hApplet, IDS_MEGABYTE, szStr, sizeof(szStr) / sizeof(TCHAR));
566  wsprintf(Buf, _T("%u %s"), (UINT)MemStat.ullTotalPhys / 1024 / 1024, szStr);
567  }
568 
569  SetDlgItemText(hwnd, CurMachineLine, Buf);
570  }
571 }
#define IDS_GIGABYTE
Definition: resource.h:21
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
static VOID MakeFloatValueString(DOUBLE *dFloatValue, LPTSTR szOutput, LPTSTR szAppend)
Definition: general.c:397
#define IDS_MEGABYTE
Definition: resource.h:20
HINSTANCE hApplet
Definition: access.c:17
int32_t INT
Definition: typedefs.h:58
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
#define IDC_MACHINELINE1
Definition: resource.h:73
static INT SetProcNameString(HWND hwnd, HKEY hKey, LPTSTR Value, UINT uID1, UINT uID2)
Definition: general.c:333
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_TERABYTE
Definition: resource.h:22
#define _countof(array)
Definition: sndvol32.h:68
#define SetDlgItemText
Definition: winuser.h:5839
#define IDS_PETABYTE
Definition: resource.h:23
#define RegOpenKeyEx
Definition: winreg.h:520
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
FxAutoRegKey hKey
unsigned int UINT
Definition: ndis.h:50
BOOL GetSystemName(PWSTR pBuf, SIZE_T cchBuf)
Definition: smbios.c:490
BOOL NTAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)
Definition: heapmem.c:1272
static VOID SetRegTextData(HWND hwnd, HKEY hKey, LPTSTR Value, UINT uID)
Definition: general.c:313
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define wsprintf
Definition: winuser.h:5855
#define RegCloseKey(hKey)
Definition: registry.h:47
#define LoadString
Definition: winuser.h:5809
static VOID SetProcSpeed(HWND hwnd, HKEY hKey, LPTSTR Value, UINT uID)
Definition: general.c:415
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by GeneralPageProc().

◆ GetSystemUptime()

static VOID GetSystemUptime ( HWND  hwndDlg)
static

Definition at line 623 of file general.c.

624 {
625  HWND hUptimeLabel;
626  ULONGLONG cMilliseconds;
627  ULONG cSeconds;
628  WCHAR szBuf[64];
629 
630  hUptimeLabel = GetDlgItem(hwndDlg, IDC_UPTIME);
631  if (!hUptimeLabel)
632  {
633  return;
634  }
635 
636  if (pGetTickCount64)
637  {
638  cMilliseconds = pGetTickCount64();
639  }
640  else
641  {
642  cMilliseconds = GetTickCountQPC();
643  }
644 
645  cSeconds = cMilliseconds / 1000;
647  cSeconds / (60*60*24), // Days
648  (cSeconds / (60*60)) % 24, // Hours
649  (cSeconds / 60) % 60, // Minutes
650  cSeconds % 60); // Seconds
651 
652  SetWindowTextW(hUptimeLabel, szBuf);
653 
654  /* Set update timer (reset timeout if the timer exists) */
655  SetTimer(hwndDlg, ID_SYSUPTIME_UPDATE_TIMER, 1000 - (cMilliseconds % 1000), NULL);
656 }
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define IDC_UPTIME
Definition: resource.h:83
static PFGETTICKCOUNT64 pGetTickCount64
Definition: general.c:36
static WCHAR szUptimeFormat[64]
Definition: general.c:37
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint64_t ULONGLONG
Definition: typedefs.h:67
#define _countof(array)
Definition: sndvol32.h:68
#define ID_SYSUPTIME_UPDATE_TIMER
Definition: general.c:20
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
static ULONGLONG GetTickCountQPC(VOID)
An equivalent of GetTickCount64, implemented using QueryPerformanceCounter.
Definition: general.c:613

Referenced by GeneralPageProc(), and InitSystemUptime().

◆ GetSystemVersion()

static VOID GetSystemVersion ( HWND  hwnd)
static

Definition at line 573 of file general.c.

574 {
575  HWND hRosVersion;
576  SIZE_T lenStr, lenVersion;
577  PCWSTR pwszVersion = L" " TEXT(KERNEL_VERSION_RC);
578  PWSTR pwszStr;
579 
580  lenVersion = wcslen(pwszVersion);
581  if (lenVersion == 0)
582  {
583  return;
584  }
585 
586  hRosVersion = GetDlgItem(hwnd, IDC_ROSVERSION);
587  if (!hRosVersion)
588  {
589  return;
590  }
591  lenStr = GetWindowTextLengthW(hRosVersion);
592  lenStr += lenVersion + 1;
593  pwszStr = HeapAlloc(GetProcessHeap(), 0, lenStr * sizeof(WCHAR));
594  if (!pwszStr)
595  {
596  return;
597  }
598  GetWindowText(hRosVersion, pwszStr, lenStr);
599 
600  StringCchCatW(pwszStr, lenStr, pwszVersion);
601  SetWindowText(hRosVersion, pwszStr);
602 
603  HeapFree(GetProcessHeap(), 0, pwszStr);
604 }
#define IDC_ROSVERSION
Definition: resource.h:82
const uint16_t * PCWSTR
Definition: typedefs.h:57
uint16_t * PWSTR
Definition: typedefs.h:56
#define GetWindowText
Definition: winuser.h:5788
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
#define L(x)
Definition: ntvdm.h:50
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetWindowTextLengthW(_In_ HWND)
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define TEXT(s)
Definition: k32.h:26
#define SetWindowText
Definition: winuser.h:5847
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by DECLARE_INTERFACE_(), and GeneralPageProc().

◆ GetTickCountQPC()

static ULONGLONG GetTickCountQPC ( VOID  )
static

An equivalent of GetTickCount64, implemented using QueryPerformanceCounter.

Returns
The number of milliseconds that have elapsed since the system was started.

Definition at line 613 of file general.c.

614 {
616 
619 
620  return (Counter.QuadPart * 1000) / Frequency.QuadPart;
621 }
BOOL WINAPI QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
Definition: perfcnt.c:45
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23
static LARGE_INTEGER Frequency
Definition: clock.c:41
static LARGE_INTEGER Counter
Definition: clock.c:43
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by GetSystemUptime().

◆ InitLogo()

static VOID InitLogo ( HWND  hwndDlg)
static

Definition at line 65 of file general.c.

66 {
67  BITMAP logoBitmap;
68  BITMAP maskBitmap;
70  HDC hDC, hDCLogo, hDCMask;
71  HBITMAP hMask = NULL, hLogo = NULL;
72  HBITMAP hAlphaLogo = NULL;
73  COLORREF *pBits;
74  INT line, column;
75 
76  hDC = GetDC(hwndDlg);
77  hDCLogo = CreateCompatibleDC(NULL);
78  hDCMask = CreateCompatibleDC(NULL);
79 
80  if (hDC == NULL || hDCLogo == NULL || hDCMask == NULL)
81  goto Cleanup;
82 
83  ZeroMemory(pImgInfo, sizeof(*pImgInfo));
84  ZeroMemory(&bmpi, sizeof(bmpi));
85 
88 
89  if (hLogo == NULL || hMask == NULL)
90  goto Cleanup;
91 
92  GetObject(hLogo, sizeof(logoBitmap), &logoBitmap);
93  GetObject(hMask, sizeof(maskBitmap), &maskBitmap);
94 
95  if (logoBitmap.bmHeight != maskBitmap.bmHeight || logoBitmap.bmWidth != maskBitmap.bmWidth)
96  goto Cleanup;
97 
98  bmpi.bmiHeader.biSize = sizeof(BITMAPINFO);
99  bmpi.bmiHeader.biWidth = logoBitmap.bmWidth;
100  bmpi.bmiHeader.biHeight = logoBitmap.bmHeight;
101  bmpi.bmiHeader.biPlanes = 1;
104  bmpi.bmiHeader.biSizeImage = 4 * logoBitmap.bmWidth * logoBitmap.bmHeight;
105 
106  /* Create a premultiplied bitmap */
107  hAlphaLogo = CreateDIBSection(hDC, &bmpi, DIB_RGB_COLORS, (PVOID*)&pBits, 0, 0);
108  if (!hAlphaLogo)
109  goto Cleanup;
110 
111  SelectObject(hDCLogo, hLogo);
112  SelectObject(hDCMask, hMask);
113 
114  for (line = logoBitmap.bmHeight - 1; line >= 0; line--)
115  {
116  for (column = 0; column < logoBitmap.bmWidth; column++)
117  {
118  COLORREF alpha = GetPixel(hDCMask, column, line) & 0xFF;
119  COLORREF Color = GetPixel(hDCLogo, column, line);
120  DWORD r, g, b;
121 
122  r = GetRValue(Color) * alpha / 255;
123  g = GetGValue(Color) * alpha / 255;
124  b = GetBValue(Color) * alpha / 255;
125 
126  *pBits++ = b | (g << 8) | (r << 16) | (alpha << 24);
127  }
128  }
129 
130  pImgInfo->hBitmap = hAlphaLogo;
131  pImgInfo->cxSource = logoBitmap.bmWidth;
132  pImgInfo->cySource = logoBitmap.bmHeight;
133  pImgInfo->iBits = logoBitmap.bmBitsPixel;
134  pImgInfo->iPlanes = logoBitmap.bmPlanes;
135 
136 Cleanup:
137  if (hMask != NULL) DeleteObject(hMask);
138  if (hLogo != NULL) DeleteObject(hLogo);
139  if (hDCMask != NULL) DeleteDC(hDCMask);
140  if (hDCLogo != NULL) DeleteDC(hDCLogo);
141  if (hDC != NULL) ReleaseDC(hwndDlg, hDC);
142 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
INT iBits
Definition: userinit.h:53
HDC WINAPI GetDC(_In_opt_ HWND)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define GetRValue(quad)
Definition: precomp.h:64
#define ZeroMemory
Definition: winbase.h:1670
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HINSTANCE hApplet
Definition: access.c:17
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
#define IDB_ROSBMP
Definition: resource.h:14
int32_t INT
Definition: typedefs.h:58
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD biCompression
Definition: amvideo.idl:35
Definition: parser.c:48
#define GetBValue(quad)
Definition: precomp.h:66
INT cySource
Definition: userinit.h:51
#define GetGValue(quad)
Definition: precomp.h:65
#define b
Definition: ke_i.h:79
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
DWORD COLORREF
Definition: windef.h:300
unsigned long DWORD
Definition: ntddk_ex.h:95
INT iPlanes
Definition: userinit.h:52
DWORD biSizeImage
Definition: amvideo.idl:36
#define GetObject
Definition: wingdi.h:4468
#define IDB_ROSMASK
Definition: resource.h:7
static PIMGINFO pImgInfo
Definition: general.c:33
IN PCTCH line
Definition: pager.h:36
static const WCHAR Cleanup[]
Definition: register.c:80
INT cxSource
Definition: userinit.h:50
static HDC hDC
Definition: 3dtext.c:33
BITMAPINFO bmpi
Definition: alphablend.c:68
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:199
Definition: bl.h:1330
HBITMAP hBitmap
Definition: userinit.h:49
#define NULL
Definition: types.h:112
#define IMAGE_BITMAP
Definition: winuser.h:211
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
static HBITMAP
Definition: button.c:44
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664
#define DIB_RGB_COLORS
Definition: wingdi.h:367
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081
#define BI_RGB
Definition: precomp.h:47
struct tagBITMAPINFO BITMAPINFO

Referenced by GeneralPageProc().

◆ InitSystemUptime()

static VOID InitSystemUptime ( HWND  hwndDlg)
static

Definition at line 658 of file general.c.

659 {
661 
662  /* Load time format string */
664  {
665  return;
666  }
667 
668  /* Load required DLLs */
669  hKernel32 = GetModuleHandleW(L"kernel32.dll");
670  if (hKernel32)
671  {
673  if (!pGetTickCount64)
674  {
675  hKernel32Vista = LoadLibraryW(L"kernel32_vista.dll");
676  if (hKernel32Vista)
677  {
679  }
680  }
681  }
682 
683  /* Show system uptime and set update timer */
684  GetSystemUptime(hwndDlg);
685 }
static VOID GetSystemUptime(HWND hwndDlg)
Definition: general.c:623
#define IDS_UPTIME_FORMAT
Definition: resource.h:65
HINSTANCE hApplet
Definition: access.c:17
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HANDLE hKernel32
Definition: locale.c:13
#define L(x)
Definition: ntvdm.h:50
static PFGETTICKCOUNT64 pGetTickCount64
Definition: general.c:36
static HMODULE hKernel32Vista
Definition: general.c:35
static WCHAR szUptimeFormat[64]
Definition: general.c:37
#define LoadLibraryW(x)
Definition: compat.h:747
#define _countof(array)
Definition: sndvol32.h:68
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define GetProcAddress(x, y)
Definition: compat.h:753
ULONGLONG(WINAPI * PFGETTICKCOUNT64)(VOID)
Definition: general.c:31

Referenced by GeneralPageProc().

◆ MakeFloatValueString()

static VOID MakeFloatValueString ( DOUBLE dFloatValue,
LPTSTR  szOutput,
LPTSTR  szAppend 
)
static

Definition at line 397 of file general.c.

398 {
399  TCHAR szDecimalSeparator[4];
400 
401  /* Get the decimal separator for the current locale */
402  if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szDecimalSeparator, sizeof(szDecimalSeparator) / sizeof(TCHAR)) > 0)
403  {
404  UCHAR uDecimals;
405  UINT uIntegral;
406 
407  /* Show the value with two decimals */
408  uIntegral = (UINT)*dFloatValue;
409  uDecimals = (UCHAR)((UINT)(*dFloatValue * 100) - uIntegral * 100);
410 
411  wsprintf(szOutput, _T("%u%s%02u %s"), uIntegral, szDecimalSeparator, uDecimals, szAppend);
412  }
413 }
#define LOCALE_USER_DEFAULT
#define GetLocaleInfo
Definition: winnls.h:1186
#define LOCALE_SDECIMAL
Definition: winnls.h:42
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned int UINT
Definition: ndis.h:50
#define wsprintf
Definition: winuser.h:5855

Referenced by GetSystemInformation(), and SetProcSpeed().

◆ RosImageProc()

LRESULT CALLBACK RosImageProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 144 of file general.c.

145 {
146  static UINT timerid = 0, top = 0, offset;
147  static HBITMAP hCreditsBitmap;
148 
149  switch (uMsg)
150  {
151  case WM_LBUTTONDBLCLK:
152  if (wParam & (MK_CONTROL | MK_SHIFT))
153  {
154  if (timerid == 0)
155  {
156  HDC hDC;
157  HDC hCreditsDC = NULL, hLogoDC = NULL;
158  HFONT hFont = NULL;
159  NONCLIENTMETRICS ncm;
160  RECT rcCredits;
161  TCHAR szCredits[2048];
162  INT iDevsHeight;
163 
164  hDC = GetDC(NULL);
165  if (hDC == NULL)
166  goto Cleanup;
167 
168  top = 0;
169  offset = 0;
170 
171  hCreditsDC = CreateCompatibleDC(hDC);
172  hLogoDC = CreateCompatibleDC(hCreditsDC);
173 
174  if (hCreditsDC == NULL || hLogoDC == NULL)
175  goto Cleanup;
176 
177  SetRect(&rcCredits, 0, 0, 0, 0);
178 
179  ncm.cbSize = sizeof(NONCLIENTMETRICS);
180  SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0);
181 
182  hFont = CreateFontIndirect(&ncm.lfMessageFont);
183  if (!hFont)
184  goto Cleanup;
185  SelectObject(hCreditsDC, hFont);
186 
187  LoadString(hApplet, IDS_DEVS, szCredits, sizeof(szCredits) / sizeof(TCHAR));
188  DrawText(hCreditsDC, szCredits, -1, &rcCredits, DT_CALCRECT);
189 
190  iDevsHeight = rcCredits.bottom - rcCredits.top;
191 
192  hCreditsBitmap = CreateBitmap(pImgInfo->cxSource, (2 * pImgInfo->cySource) + iDevsHeight + 1, pImgInfo->iPlanes, pImgInfo->iBits, NULL);
193  if (!hCreditsBitmap)
194  goto Cleanup;
195 
196  SelectObject(hLogoDC, pImgInfo->hBitmap);
197  SelectObject(hCreditsDC, hCreditsBitmap);
198 
200 
201  SetRect(&rcCredits, 0, 0, pImgInfo->cxSource, (2 * pImgInfo->cySource) + iDevsHeight + 1);
202  FillRect(hCreditsDC, &rcCredits, GetSysColorBrush(COLOR_3DFACE));
203 
204  SetRect(&rcCredits, 0, offset, pImgInfo->cxSource, offset + iDevsHeight + 1);
205  SetBkMode(hCreditsDC, TRANSPARENT);
206 
207  OffsetRect(&rcCredits, 1, 1);
209  DrawText(hCreditsDC, szCredits, -1, &rcCredits, DT_CENTER);
210 
211  OffsetRect(&rcCredits, -1, -1);
213  DrawText(hCreditsDC, szCredits, -1, &rcCredits, DT_CENTER);
214 
215  offset += iDevsHeight;
216 
217  AlphaBlend(hCreditsDC, 0, 0, pImgInfo->cxSource, pImgInfo->cySource, hLogoDC, 0, 0, pImgInfo->cxSource, pImgInfo->cySource, BlendFunc);
219 
220  timerid = SetTimer(hwnd, 1, ANIM_TIME, NULL);
221 
222 Cleanup:
223  if (hFont != NULL) DeleteObject(hFont);
224  if (hLogoDC != NULL) DeleteDC(hLogoDC);
225  if (hCreditsDC != NULL) DeleteDC(hCreditsDC);
226  if (hDC != NULL) ReleaseDC(NULL, hDC);
227  }
228  }
229  break;
230  case WM_LBUTTONDOWN:
231  if (timerid)
232  {
233  RECT rcCredits;
234  HDC hDC = GetDC(hwnd);
235  if (hDC != NULL)
236  {
237  GetClientRect(hwnd, &rcCredits);
238  SetRect(&rcCredits, 0, 0, rcCredits.right, pImgInfo->cySource);
239  FillRect(hDC, &rcCredits, GetSysColorBrush(COLOR_3DFACE));
240  ReleaseDC(hwnd, hDC);
241  }
242  KillTimer(hwnd, timerid);
243  if (hCreditsBitmap != NULL)
244  DeleteObject(hCreditsBitmap);
245 
247  top = 0;
248  timerid = 0;
249  }
250  break;
251  case WM_TIMER:
252  top += ANIM_STEP;
253 
254  if (top > offset)
255  {
256  RECT rcCredits;
257  HDC hDC = GetDC(hwnd);
258  if (hDC != NULL)
259  {
260  GetClientRect(hwnd, &rcCredits);
261  SetRect(&rcCredits, 0, 0, rcCredits.right, pImgInfo->cySource);
262  FillRect(hDC, &rcCredits, GetSysColorBrush(COLOR_3DFACE));
263  ReleaseDC(hwnd, hDC);
264  }
265  KillTimer(hwnd, timerid);
266  if (hCreditsBitmap != NULL)
267  DeleteObject(hCreditsBitmap);
268 
269  top = 0;
270  timerid = 0;
271  }
272 
274  break;
275  case WM_PAINT:
276  {
277  PAINTSTRUCT PS;
278  HDC hdcMem, hdc;
279  LONG left;
280 
281  hdc = wParam != 0 ? (HDC)wParam : BeginPaint(hwnd, &PS);
282 
283  GetClientRect(hwnd, &PS.rcPaint);
284 
285  /* Position image in center of dialog */
286  left = (PS.rcPaint.right - pImgInfo->cxSource) / 2;
288 
289  if (hdcMem != NULL)
290  {
291  if(timerid != 0)
292  {
293  SelectObject(hdcMem, hCreditsBitmap);
294  BitBlt(hdc, left, PS.rcPaint.top, PS.rcPaint.right - PS.rcPaint.left, PS.rcPaint.top + pImgInfo->cySource, hdcMem, 0, top, SRCCOPY);
295  }
296  else
297  {
300  }
301 
302  DeleteDC(hdcMem);
303  }
304 
305  if (wParam == 0)
306  EndPaint(hwnd,&PS);
307  break;
308  }
309  }
310  return TRUE;
311 }
#define MK_SHIFT
Definition: winuser.h:2359
#define WM_LBUTTONDOWN
Definition: winuser.h:1766
INT iBits
Definition: userinit.h:53
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
#define SystemParametersInfo
Definition: winuser.h:5848
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HINSTANCE hApplet
Definition: access.c:17
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
HFONT hFont
Definition: main.c:53
#define DrawText
Definition: winuser.h:5761
#define IDS_DEVS
Definition: resource.h:230
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define COLOR_3DFACE
Definition: winuser.h:923
#define FALSE
Definition: types.h:117
#define DT_CALCRECT
Definition: winuser.h:526
long LONG
Definition: pedump.c:60
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define TRANSPARENT
Definition: wingdi.h:950
static const BLENDFUNCTION BlendFunc
Definition: general.c:34
INT cySource
Definition: userinit.h:51
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
char TCHAR
Definition: xmlstorage.h:189
#define ANIM_TIME
Definition: general.c:19
#define ANIM_STEP
Definition: general.c:18
GLintptr offset
Definition: glext.h:5920
#define COLOR_WINDOWTEXT
Definition: winuser.h:915
#define WM_TIMER
Definition: winuser.h:1732
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
INT iPlanes
Definition: userinit.h:52
GLint left
Definition: glext.h:7726
#define WM_PAINT
Definition: winuser.h:1610
static PIMGINFO pImgInfo
Definition: general.c:33
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
HDC hdc
Definition: main.c:9
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1768
static const WCHAR Cleanup[]
Definition: register.c:80
INT cxSource
Definition: userinit.h:50
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI DeleteDC(_In_ HDC)
#define COLOR_BTNSHADOW
Definition: winuser.h:924
HBITMAP hBitmap
Definition: userinit.h:49
#define CreateFontIndirect
Definition: wingdi.h:4444
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define MK_CONTROL
Definition: winuser.h:2360
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define AlphaBlend
Definition: misc.c:293
LONG bottom
Definition: windef.h:309
#define DT_CENTER
Definition: winuser.h:527
static HBITMAP
Definition: button.c:44
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define SRCCOPY
Definition: wingdi.h:333
#define LoadString
Definition: winuser.h:5809
HDC hdcMem
Definition: welcome.c:104
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by GeneralPageProc().

◆ SetProcNameString()

static INT SetProcNameString ( HWND  hwnd,
HKEY  hKey,
LPTSTR  Value,
UINT  uID1,
UINT  uID2 
)
static

Definition at line 333 of file general.c.

334 {
335  LPTSTR lpBuf = NULL;
336  DWORD BufSize = 0;
337  DWORD Type;
338  INT Ret = 0;
339  TCHAR szBuf[31];
340  TCHAR* szLastSpace;
341  INT LastSpace = 0;
342 
344  {
345  lpBuf = HeapAlloc(GetProcessHeap(), 0, BufSize);
346 
347  if (!lpBuf)
348  return 0;
349 
351  {
352  if (BufSize > ((30 + 1) * sizeof(TCHAR)))
353  {
354  /* Wrap the Processor Name String like XP does: *
355  * - Take the first 30 characters and look for the last space. *
356  * Then wrap the string after this space. *
357  * - If no space is found, wrap the string after character 30. *
358  * *
359  * For example the Processor Name String of a Pentium 4 is right-aligned. *
360  * With this wrapping the first line looks centered. */
361 
362  _tcsncpy(szBuf, lpBuf, 30);
363  szBuf[30] = 0;
364  szLastSpace = _tcsrchr(szBuf, ' ');
365 
366  if (szLastSpace == 0)
367  {
368  LastSpace = 30;
369  }
370  else
371  {
372  LastSpace = (szLastSpace - szBuf);
373  szBuf[LastSpace] = 0;
374  }
375 
376  _tcsncpy(szBuf, lpBuf, LastSpace);
377 
378  SetDlgItemText(hwnd, uID1, szBuf);
379  SetDlgItemText(hwnd, uID2, lpBuf+LastSpace+1);
380 
381  /* Return the number of used lines */
382  Ret = 2;
383  }
384  else
385  {
386  SetDlgItemText(hwnd, uID1, lpBuf);
387  Ret = 1;
388  }
389  }
390 
391  HeapFree(GetProcessHeap(), 0, lpBuf);
392  }
393 
394  return Ret;
395 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
_TCHAR * _tcsncpy(_TCHAR *dst, const _TCHAR *src, size_t n)
Definition: tcsncpy.h:9
int32_t INT
Definition: typedefs.h:58
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define BufSize
Definition: FsRtlTunnel.c:28
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
char TCHAR
Definition: xmlstorage.h:189
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Type
Definition: Type.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetDlgItemText
Definition: winuser.h:5839
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
_TCHAR * _tcsrchr(const _TCHAR *s, _XINT c)
Definition: tcsrchr.h:4
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
BYTE * PBYTE
Definition: pedump.c:66
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by GetSystemInformation().

◆ SetProcSpeed()

static VOID SetProcSpeed ( HWND  hwnd,
HKEY  hKey,
LPTSTR  Value,
UINT  uID 
)
static

Definition at line 415 of file general.c.

416 {
417  TCHAR szBuf[64], szHz[16];
418  DWORD BufSize = sizeof(DWORD);
419  DWORD Type = REG_SZ;
421 
422  ZeroMemory(&ppi, sizeof(ppi));
423 
425  NULL,
426  0,
427  (PVOID)&ppi,
428  sizeof(ppi)) == STATUS_SUCCESS &&
429  ppi.CurrentMhz != 0) || RegQueryValueEx(hKey, Value, NULL, &Type, (PBYTE)&ppi.CurrentMhz, &BufSize) == ERROR_SUCCESS)
430  {
431  if (ppi.CurrentMhz < 1000)
432  {
433  if (!LoadString(hApplet, IDS_MEGAHERTZ, szHz, _countof(szHz)))
434  {
435  return;
436  }
437  StringCchPrintf(szBuf, _countof(szBuf), _T("%lu %s"), ppi.CurrentMhz, szHz);
438  }
439  else
440  {
441  double flt = ppi.CurrentMhz / 1000.0;
442  if (!LoadString(hApplet, IDS_GIGAHERTZ, szHz, _countof(szHz)))
443  {
444  return;
445  }
446  MakeFloatValueString(&flt, szBuf, szHz);
447  }
448 
449  SetDlgItemText(hwnd, uID, szBuf);
450  }
451 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDS_MEGAHERTZ
Definition: resource.h:62
static VOID MakeFloatValueString(DOUBLE *dFloatValue, LPTSTR szOutput, LPTSTR szAppend)
Definition: general.c:397
#define ZeroMemory
Definition: winbase.h:1670
HINSTANCE hApplet
Definition: access.c:17
#define DWORD
Definition: nt_native.h:44
#define StringCchPrintf
Definition: strsafe.h:517
NTSTATUS WINAPI CallNtPowerInformation(POWER_INFORMATION_LEVEL InformationLevel, PVOID lpInputBuffer, ULONG nInputBufferSize, PVOID lpOutputBuffer, ULONG nOutputBufferSize)
Definition: powrprof.c:59
#define BufSize
Definition: FsRtlTunnel.c:28
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define _countof(array)
Definition: sndvol32.h:68
Type
Definition: Type.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetDlgItemText
Definition: winuser.h:5839
#define IDS_GIGAHERTZ
Definition: resource.h:63
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
BYTE * PBYTE
Definition: pedump.c:66
#define LoadString
Definition: winuser.h:5809
#define REG_SZ
Definition: layer.c:22

Referenced by GetSystemInformation().

◆ SetRegTextData()

static VOID SetRegTextData ( HWND  hwnd,
HKEY  hKey,
LPTSTR  Value,
UINT  uID 
)
static

Definition at line 313 of file general.c.

314 {
315  LPTSTR lpBuf = NULL;
316  DWORD BufSize = 0;
317  DWORD Type;
318 
320  {
321  lpBuf = HeapAlloc(GetProcessHeap(), 0, BufSize);
322 
323  if (!lpBuf)
324  return;
325 
327  SetDlgItemText(hwnd, uID, lpBuf);
328 
329  HeapFree(GetProcessHeap(), 0, lpBuf);
330  }
331 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define BufSize
Definition: FsRtlTunnel.c:28
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Type
Definition: Type.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetDlgItemText
Definition: winuser.h:5839
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
BYTE * PBYTE
Definition: pedump.c:66
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by GetSystemInformation().

◆ ShowLastWin32Error()

VOID ShowLastWin32Error ( HWND  hWndOwner)

Definition at line 39 of file general.c.

40 {
41  LPTSTR lpMsg;
42  DWORD LastError;
43 
44  LastError = GetLastError();
45  if (LastError == ERROR_SUCCESS)
46  return;
47 
51  NULL,
52  LastError,
54  (LPTSTR)&lpMsg,
55  0, NULL))
56  {
57  return;
58  }
59 
60  MessageBox(hWndOwner, lpMsg, NULL, MB_OK | MB_ICONERROR);
61  LocalFree(lpMsg);
62 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:423
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FormatMessage
Definition: winbase.h:3666
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5812
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:420
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50

Variable Documentation

◆ BlendFunc

◆ hKernel32Vista

HMODULE hKernel32Vista = NULL
static

Definition at line 35 of file general.c.

Referenced by GeneralPageProc(), and InitSystemUptime().

◆ pGetTickCount64

PFGETTICKCOUNT64 pGetTickCount64 = NULL
static

Definition at line 36 of file general.c.

Referenced by GetSeconds(), GetSystemUptime(), and InitSystemUptime().

◆ pImgInfo

PIMGINFO pImgInfo
static

Definition at line 33 of file general.c.

Referenced by GeneralPageProc(), InitLogo(), and RosImageProc().

◆ szUptimeFormat

WCHAR szUptimeFormat[64]
static

Definition at line 37 of file general.c.

Referenced by GetSystemUptime(), and InitSystemUptime().