diff --git a/bazaar/SysInfo/SysInfo.cpp b/bazaar/SysInfo/SysInfo.cpp index cc4a5ceed..f6c0d06bc 100644 --- a/bazaar/SysInfo/SysInfo.cpp +++ b/bazaar/SysInfo/SysInfo.cpp @@ -779,7 +779,7 @@ bool GetMemoryInfo( #if defined(PLATFORM_WIN32) // Get the list of process identifiers. -bool GetProcessList(Array &pid, Array &pNames) +bool GetProcessList(Array &pid, Array &pNames) { PROCESSENTRY32 proc; HANDLE hSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); @@ -795,10 +795,11 @@ bool GetProcessList(Array &pid, Array &pNames) CloseHandle(hSnap); return true; } -Array GetProcessList() + +Array GetProcessList() { PROCESSENTRY32 proc; - Array ret; + Array ret; HANDLE hSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hSnap == INVALID_HANDLE_VALUE) return ret; @@ -811,13 +812,14 @@ Array GetProcessList() CloseHandle(hSnap); return ret; } -String GetProcessName(long processID) + +String GetProcessName(uint64 processID) { WCHAR szProcessName[MAX_PATH]; String ret; // Get a handle to the process. - HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); + HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, DWORD(processID)); // Get the process name. if (hProcess != NULL) { @@ -834,13 +836,13 @@ String GetProcessName(long processID) return ret; } -String GetProcessFileName(long processID) +String GetProcessFileName(uint64 processID) { WCHAR szProcessName[MAX_PATH]; String ret; // Get a handle to the process. - HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); + HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, DWORD(processID)); // Get the process name. if (hProcess != NULL) { @@ -863,12 +865,12 @@ BOOL CALLBACK EnumGetWindowsList(HWND hWnd, LPARAM lParam) return TRUE; // Not a window if (GetParent(hWnd) != 0) return TRUE; // Child window - Array *ret = (Array *)lParam; - ret->Add((int)hWnd); + Array *ret = (Array *)lParam; + ret->Add(reinterpret_cast(hWnd)); return TRUE; } -void GetWindowsList(Array &hWnd, Array &processId, Array &name, Array &fileName, Array &caption) +void GetWindowsList(Array &hWnd, Array &processId, Array &name, Array &fileName, Array &caption) { HANDLE hProcess; DWORD dwThreadId, dwProcessId; @@ -877,8 +879,8 @@ void GetWindowsList(Array &hWnd, Array &processId, Array &na EnumWindows(EnumGetWindowsList, (LPARAM)&hWnd); for (int i = 0; i < hWnd.GetCount(); ++i) { - hInstance = (HINSTANCE)GetWindowLongPtr((HWND)hWnd[i], GWLP_HINSTANCE); - dwThreadId = GetWindowThreadProcessId((HWND)hWnd[i], &dwProcessId); + hInstance = (HINSTANCE)GetWindowLongPtr(reinterpret_cast(hWnd[i]), GWLP_HINSTANCE); + dwThreadId = GetWindowThreadProcessId(reinterpret_cast(hWnd[i]), &dwProcessId); processId.Add(dwProcessId); hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwProcessId); if (GetModuleFileNameExW(hProcess, hInstance, str, sizeof(str)/sizeof(WCHAR))) @@ -890,8 +892,8 @@ void GetWindowsList(Array &hWnd, Array &processId, Array &na else name.Add(t_("Unknown process")); CloseHandle(hProcess); - if (IsWindowVisible((HWND)hWnd[i])) { - int count = int(SendMessageW((HWND)hWnd[i], WM_GETTEXT, sizeof(str)/sizeof(WCHAR), (LPARAM)str)); + if (IsWindowVisible(reinterpret_cast(hWnd[i]))) { + int count = int(SendMessageW(reinterpret_cast(hWnd[i]), WM_GETTEXT, sizeof(str)/sizeof(WCHAR), (LPARAM)str)); str[count] = '\0'; caption.Add(WString(str).ToString()); } else @@ -899,9 +901,9 @@ void GetWindowsList(Array &hWnd, Array &processId, Array &na } } -Array GetWindowsList() +Array GetWindowsList() { - Array ret; + Array ret; EnumWindows(EnumGetWindowsList, (LPARAM)&ret); return ret; } @@ -917,10 +919,10 @@ BOOL CALLBACK TerminateAppEnum(HWND hwnd, LPARAM lParam) // pid Process ID of the process to shut down. // timeout Wait time in milliseconds before shutting down the process. -bool ProcessTerminate(long processId, int timeout) +bool ProcessTerminate(uint64 processId, int timeout) { // If we can't open the process with PROCESS_TERMINATE rights, then we give up immediately. - HANDLE hProc = ::OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, processId); + HANDLE hProc = ::OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, DWORD(processId)); if(hProc == NULL) return false ; // TerminateAppEnum() posts WM_CLOSE to all windows whose PID matches your process's. @@ -938,10 +940,10 @@ bool ProcessTerminate(long processId, int timeout) return ret; } -int GetProcessPriority(long pid) +int GetProcessPriority(uint64 pid) { int priority; - HANDLE hProc = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); + HANDLE hProc = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, DWORD(pid)); if(hProc == NULL) return -1; priority = ::GetPriorityClass(hProc); @@ -965,9 +967,9 @@ int GetProcessPriority(long pid) return priority; } -bool SetProcessPriority(long pid, int priority) +bool SetProcessPriority(uint64 pid, int priority) { - HANDLE hProc = ::OpenProcess(PROCESS_SET_INFORMATION , FALSE, pid); + HANDLE hProc = ::OpenProcess(PROCESS_SET_INFORMATION , FALSE, DWORD(pid)); if(hProc == NULL) return false; if (priority == 10) @@ -998,7 +1000,8 @@ bool IsInteger(String s) } return true; } -bool GetProcessList(Array &pid, Array &pNames) + +bool GetProcessList(Array &pid, Array &pNames) { FindFile ff; if(ff.Search("/proc/*")) { @@ -1019,7 +1022,8 @@ bool GetProcessList(Array &pid, Array &pNames) } return true; } -Array GetProcessList() + +Array GetProcessList() { FindFile ff; Array pid; @@ -1038,12 +1042,14 @@ Array GetProcessList() } return pid; } -String GetProcessName(long pid) + +String GetProcessName(uint64 pid) { return GetFileName(GetProcessFileName(pid)); } + // ls -l /proc/%d/fd gets also the files opened by the process -String GetProcessFileName(long pid) +String GetProcessFileName(uint64 pid) { String ret = ""; String exe = Format("/proc/%s/exe", FormatLong(pid)); @@ -1097,7 +1103,7 @@ Array GetWindowsList() return ret; } -void GetWindowsList(Array &hWnd, Array &processId, Array &nameL, Array &fileName, Array &caption) +void GetWindowsList(Array &hWnd, Array &processId, Array &nameL, Array &fileName, Array &caption) { SetSysInfoX11ErrorHandler(); _XDisplay *dpy = XOpenDisplay (NULL); @@ -1155,7 +1161,7 @@ void GetWindowsList(Array &hWnd, Array &processId, Array &na // Name and class XClassHint ch; ch.res_name = ch.res_class = NULL; - Status status = XGetClassHint (dpy, hWnd[i], &ch); + Status status = XGetClassHint(dpy, hWnd[i], &ch); if (status != BadWindow) { if (ch.res_name) nameL.Add(ch.res_name); @@ -1173,7 +1179,7 @@ void GetWindowsList(Array &hWnd, Array &processId, Array &na return; } -bool WindowKill(long wid) +bool WindowKill(uint64 wid) { if (wid == 0) return false; @@ -1191,7 +1197,7 @@ bool WindowKill(long wid) } // Also possible to stop or cont -bool ProcessTerminate(long pid, int timeout) +bool ProcessTerminate(uint64 pid, int timeout) { if (!ProcessExists(pid)) return false; @@ -1212,13 +1218,13 @@ bool ProcessTerminate(long pid, int timeout) return WindowKill(wid); } -int GetProcessPriority(long pid) +int GetProcessPriority(uint64 pid) { int priority = getpriority(PRIO_PROCESS, pid); return 10 - (priority + 20)/4; // Rescale -20/20 to 10/0 } -bool SetProcessPriority(long pid, int priority) +bool SetProcessPriority(uint64 pid, int priority) { priority = 20 - 4*priority; if (0 == setpriority(PRIO_PROCESS, pid, priority)) @@ -1228,9 +1234,9 @@ bool SetProcessPriority(long pid, int priority) } #endif -long GetWindowIdFromCaption(String windowCaption, bool exactMatch) +uint64 GetWindowIdFromCaption(String windowCaption, bool exactMatch) { - Array wid, pid; + Array wid, pid; Array name, fileName, caption; GetWindowsList(wid, pid, name, fileName, caption); for (int i = 0; i < wid.GetCount(); ++i) { @@ -1242,12 +1248,12 @@ long GetWindowIdFromCaption(String windowCaption, bool exactMatch) return wid[i]; } } - return -1; + return INT64_MAX; } -long GetProcessIdFromWindowCaption(String windowCaption, bool exactMatch) +uint64 GetProcessIdFromWindowCaption(String windowCaption, bool exactMatch) { - Array wid, pid; + Array wid, pid; Array name, fileName, caption; GetWindowsList(wid, pid, name, fileName, caption); for (int i = 0; i < wid.GetCount(); ++i) { @@ -1262,9 +1268,9 @@ long GetProcessIdFromWindowCaption(String windowCaption, bool exactMatch) return -1; } -long GetProcessIdFromWindowId(long _wId) +uint64 GetProcessIdFromWindowId(uint64 _wId) { - Array wId, pid; + Array wId, pid; Array name, fileName, caption; GetWindowsList(wId, pid, name, fileName, caption); for (int i = 0; i < pid.GetCount(); ++i) { @@ -1274,9 +1280,9 @@ long GetProcessIdFromWindowId(long _wId) return 0; } -long GetWindowIdFromProcessId(long _pid) +uint64 GetWindowIdFromProcessId(uint64 _pid) { - Array wId, pid; + Array wId, pid; Array name, fileName, caption; GetWindowsList(wId, pid, name, fileName, caption); for (int i = 0; i < pid.GetCount(); ++i) { @@ -1286,15 +1292,15 @@ long GetWindowIdFromProcessId(long _pid) return 0; } -bool ProcessExists(long pid) +bool ProcessExists(uint64 pid) { - return DirectoryExists(Format("/proc/%s", FormatLong(pid))); + return DirectoryExists(Format("/proc/%s", Sprintf("%ld", pid))); } ///////////////////////////////////////////////////////////////////// // Others -long GetProcessId() {return getpid();} +uint64 GetProcessId() {return getpid();} ///////////////////////////////////////////////////////////////////// // Drives list @@ -1422,7 +1428,9 @@ bool GetDriveInformation(String drive, String &type, String &volume, /*uint64 &s #if defined(PLATFORM_WIN32) || defined (PLATFORM_WIN64) -#define SHTDN_REASON_MINOR_OTHER 0 +#ifndef SHTDN_REASON_MINOR_OTHER + #define SHTDN_REASON_MINOR_OTHER 0 +#endif bool Shutdown(String action) { action = ToLower(action); @@ -1513,7 +1521,9 @@ bool Shutdown(String action) #endif -void _GetCompilerInfo(String &name, int &version, String &mode) { +void GetCompilerInfo(String &name, int &version, Upp::Time &time, String &mode, int &bits) { + time = ScanTime("mdy", String(__DATE__) + " " + __TIME__); + name = ""; version = 0; #if defined(PLATFORM_WIN32) || defined (PLATFORM_WIN64) @@ -1543,16 +1553,15 @@ void _GetCompilerInfo(String &name, int &version, String &mode) { #else mode = "release"; #endif -} - -void GetCompilerInfo(String &name, int &version, String &time, String &mode) { - time = String(__DATE__) + " " + __TIME__; - _GetCompilerInfo(name, version, mode); -} - -void GetCompilerInfo(String &name, int &version, Upp::Time &time, String &mode) { - time = ScanTime("mdy", String(__DATE__) + " " + __TIME__); - _GetCompilerInfo(name, version, mode); + #if defined(_MSC_VER) && defined(_WIN64) + bits = 64; + #elif defined(__MINGW64__) + bits = 64; + #elif defined(__LP64__) + bits = 64; + #else + bits = 32; + #endif } @@ -1586,13 +1595,13 @@ bool TakeWindowPlacement(HWND hwnd, RECT &rcNormalPosition, POINT &ptMinPosition return ret; } -bool Window_GetRect(long windowId, long &left, long &top, long &right, long &bottom) +bool Window_GetRect(uint64 windowId, long &left, long &top, long &right, long &bottom) { RECT rcNormalPosition; POINT ptMinPosition, ptMaxPosition; long showcmd; - TakeWindowPlacement((HWND)windowId, rcNormalPosition, ptMinPosition, ptMaxPosition, showcmd); + TakeWindowPlacement(reinterpret_cast(windowId), rcNormalPosition, ptMinPosition, ptMaxPosition, showcmd); left = rcNormalPosition.left; top = rcNormalPosition.top; @@ -1602,42 +1611,42 @@ bool Window_GetRect(long windowId, long &left, long &top, long &right, long &bot return true; } -bool Window_SetRect(long windowId, long left, long top, long right, long bottom) +bool Window_SetRect(uint64 windowId, long left, long top, long right, long bottom) { RECT rcNormalPosition; POINT ptMinPosition, ptMaxPosition; long showcmd; - if (!TakeWindowPlacement((HWND)windowId, rcNormalPosition, ptMinPosition, ptMaxPosition, showcmd)) + if (!TakeWindowPlacement(reinterpret_cast(windowId), rcNormalPosition, ptMinPosition, ptMaxPosition, showcmd)) return false; rcNormalPosition.left = left; rcNormalPosition.top = top; rcNormalPosition.right = right; rcNormalPosition.bottom = bottom; - return PutWindowPlacement((HWND)windowId, rcNormalPosition, ptMinPosition, ptMaxPosition, showcmd, 0); + return PutWindowPlacement(reinterpret_cast(windowId), rcNormalPosition, ptMinPosition, ptMaxPosition, showcmd, 0); } -void Window_Bottom(long windowId) +void Window_Bottom(uint64 windowId) { - SetWindowPos((HWND)windowId, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE || SWP_NOSIZE || SWP_SHOWWINDOW); + SetWindowPos(reinterpret_cast(windowId), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE || SWP_NOSIZE || SWP_SHOWWINDOW); } -void Window_Top(long windowId) +void Window_Top(uint64 windowId) { - SetWindowPos((HWND)windowId, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE || SWP_NOSIZE || SWP_SHOWWINDOW); + SetWindowPos(reinterpret_cast(windowId), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE || SWP_NOSIZE || SWP_SHOWWINDOW); } -void Window_TopMost(long windowId) +void Window_TopMost(uint64 windowId) { - SetWindowPos((HWND)windowId, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE || SWP_NOSIZE || SWP_SHOWWINDOW); + SetWindowPos(reinterpret_cast(windowId), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE || SWP_NOSIZE || SWP_SHOWWINDOW); } #endif #ifdef PLATFORM_POSIX -bool Window_GetRect(long windowId, long &left, long &top, long &right, long &bottom) +bool Window_GetRect(uint64 windowId, long &left, long &top, long &right, long &bottom) { SetSysInfoX11ErrorHandler(); _XDisplay *dpy = XOpenDisplay (NULL); @@ -1661,7 +1670,7 @@ bool Window_GetRect(long windowId, long &left, long &top, long &right, long &bot return ret; } -bool Window_SetRect(long windowId, long left, long top, long right, long bottom) +bool Window_SetRect(uint64 windowId, long left, long top, long right, long bottom) { SetSysInfoX11ErrorHandler(); _XDisplay *dpy = XOpenDisplay (NULL); @@ -1791,7 +1800,8 @@ void SystemOverview::Load() { GetBiosInfo(biosVersion, biosReleaseDate, biosSerial); computerName = GetComputerName(); GetOsInfo(kernel, kerVersion, kerArchitecture, distro, distVersion, desktop, deskVersion); - GetCompilerInfo(compilerName, compilerVersion, compilerTime, compilerMode); + int compilerBits; + GetCompilerInfo(compilerName, compilerVersion, compilerTime, compilerMode, compilerBits); } void SystemOverview::Copy(const SystemOverview& src) { diff --git a/bazaar/SysInfo/SysInfo.h b/bazaar/SysInfo/SysInfo.h index 198ebd88e..edc6f5a00 100644 --- a/bazaar/SysInfo/SysInfo.h +++ b/bazaar/SysInfo/SysInfo.h @@ -52,30 +52,30 @@ bool GetMemoryInfo(int &memoryLoad, uint64 &totalPhys, uint64 &freePhys, uint64 // name: Window name // fileName: Window process program file name // title: Window title (caption) -void GetWindowsList(Upp::Array &wid, Upp::Array &pid, Upp::Array &name, +void GetWindowsList(Upp::Array &wid, Upp::Array &pid, Upp::Array &name, Upp::Array &fileName, Upp::Array &title); -Upp::Array GetWindowsList(); +Upp::Array GetWindowsList(); ///////////////////////////////////////////////////////////////////// // Process list -bool GetProcessList(Upp::Array &pid, Upp::Array &pNames); -Upp::Array GetProcessList(); -String GetProcessName(long pid); -String GetProcessFileName(long processID); +bool GetProcessList(Upp::Array &pid, Upp::Array &pNames); +Upp::Array GetProcessList(); +String GetProcessName(uint64 pid); +String GetProcessFileName(uint64 processID); -long GetProcessIdFromWindowCaption(String windowCaption, bool exactMatch = false); +uint64 GetProcessIdFromWindowCaption(String windowCaption, bool exactMatch = false); -long GetWindowIdFromCaption(String windowCaption, bool exactMatch = false); +uint64 GetWindowIdFromCaption(String windowCaption, bool exactMatch = false); -long GetProcessIdFromWindowId(long wid); -long GetWindowIdFromProcessId(long pid); +uint64 GetProcessIdFromWindowId(uint64 wid); +uint64 GetWindowIdFromProcessId(uint64 pid); -bool ProcessTerminate(long pid, int timeout = 500); +bool ProcessTerminate(uint64 pid, int timeout = 500); -int GetProcessPriority(long pid); -bool SetProcessPriority(long pid, int priority); +int GetProcessPriority(uint64 pid); +bool SetProcessPriority(uint64 pid, int priority); -bool ProcessExists(long pid); +bool ProcessExists(uint64 pid); ///////////////////////////////////////////////////////////////////// // Os Info @@ -89,12 +89,11 @@ bool GetDriveInformation(String drive, String &type, String &volume, /*uint64 &s ///////////////////////////////////////////////////////////////////// // Others -long GetProcessId(); +uint64 GetProcessId(); bool Shutdown(String action); -void GetCompilerInfo(String &name, int &version, Upp::Time &time, String &mode); -void GetCompilerInfo(String &name, int &version, String &time, String &mode); +void GetCompilerInfo(String &name, int &version, Upp::Time &time, String &mode, int &bits); bool GetBatteryStatus(bool &discharging, int &percentage, int &remainingMin); bool GetBatteryInfo(bool &present/*, int &designCapacity, int &lastFullCapacity, String &vendor, String &type, String &model, String &serial*/); @@ -104,15 +103,15 @@ bool CloseCDTray(String drive); ///////////////////////////////////////////////////////////////////// // Key and mouse keys -bool Window_GetRect(long windowId, long &left, long &top, long &right, long &bottom); -bool Window_SetRect(long windowId, long left, long top, long right, long bottom); -void Window_Bottom(long windowId); -void Window_Top(long windowId); -void Window_TopMost(long windowId); +bool Window_GetRect(uint64 windowId, long &left, long &top, long &right, long &bottom); +bool Window_SetRect(uint64 windowId, long left, long top, long right, long bottom); +void Window_Bottom(uint64 windowId); +void Window_Top(uint64 windowId); +void Window_TopMost(uint64 windowId); bool Mouse_GetPos(long &x, long &y); -bool Mouse_SetPos(long x, long y, long windowId); +bool Mouse_SetPos(long x, long y, uint64 windowId); void Mouse_LeftClick(); void Mouse_LeftDown(); @@ -129,11 +128,11 @@ void Mouse_RightDblClick(); void Keyb_SendKeys(String text, long finalDelay = 100, long delayBetweenKeys = 50); -bool Window_SaveCapture(long windowId, String fileName, int left = -1, int top = -1, int width = -1, int height = -1); +bool Window_SaveCapture(uint64 windowId, String fileName, int left = -1, int top = -1, int width = -1, int height = -1); bool Snap_Desktop(String fileName); bool Snap_DesktopRectangle(String fileName, int left, int top, int width, int height); -bool Snap_Window(String fileName, long handle); +bool Snap_Window(String fileName, uint64 handle); bool GetKeyLockStatus(bool &caps, bool &num, bool &scroll); bool SetKeyLockStatus(bool caps, bool num, bool scroll); @@ -142,7 +141,7 @@ bool SetKeyLockStatus(bool caps, bool num, bool scroll); bool Record_Desktop(String fileName, int duration, double secsFrame = 1, bool viewMouse = true); bool Record_DesktopRectangle(String fileName, int duration, int left, int top, int width, int height, double secsFrame = 1, bool viewMouse = true); -bool Record_Window(String fileName, int duration, long handle, double secsFrame = 1, bool viewMouse = true); +bool Record_Window(String fileName, int duration, uint64 handle, double secsFrame = 1, bool viewMouse = true); #endif diff --git a/bazaar/SysInfo/SysInfo.t b/bazaar/SysInfo/SysInfo.t index e8469cfe1..531cc8018 100644 --- a/bazaar/SysInfo/SysInfo.t +++ b/bazaar/SysInfo/SysInfo.t @@ -4,7 +4,7 @@ // SysInfo.cpp T_("Unknown process") -caES("Procés desconegut") +caES("Proc\351s desconegut") esES("Proceso desconocido") euES("Ezezaguna prozesua") frFR("Processus inconnu") @@ -19,7 +19,7 @@ frFR("Impossible de changer bitmap de bureau") // screengrab.cpp T_("Unknown grab mode") -caES("Mode de gravació desconegut") +caES("Mode de gravaci\363 desconegut") esES("Modo de grabaci\303\263n desconocido") euES("Grabaketa mode ezezaguna") -frFR("Mode déplacement inconnu") +frFR("Mode d\351placement inconnu") diff --git a/bazaar/SysInfo/cpuspeed.cpp b/bazaar/SysInfo/cpuspeed.cpp index fa4e466f8..d68ab2a21 100644 --- a/bazaar/SysInfo/cpuspeed.cpp +++ b/bazaar/SysInfo/cpuspeed.cpp @@ -3,13 +3,20 @@ NAMESPACE_UPP #if defined(PLATFORM_WIN32) || defined (PLATFORM_WIN64) -int64 start, end; +uint64 start, end; unsigned long nCtr, nFreq, nCtrStop; #if defined(__MINGW32__) -UINT64 __rdtsc() { - asm(".byte 0x0F"); - asm(".byte 0x31"); +uint64 __rdtsc() { + #if defined(__MINGW64__) // It does not work for now + unsigned int lo, hi; + __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); + return uint64(lo) | (uint64(hi) << 32); + #else + unsigned int lo, hi; + __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); + return uint64(lo) | (uint64(hi) << 32); + #endif } #endif @@ -18,14 +25,14 @@ int GetCpuSpeed() if(!QueryPerformanceFrequency((LARGE_INTEGER *) &nFreq)) return 0; QueryPerformanceCounter((LARGE_INTEGER *) &nCtrStop); - nCtrStop += nFreq/10000; + nCtrStop += nFreq; start = __rdtsc(); do QueryPerformanceCounter((LARGE_INTEGER *) &nCtr); while (nCtr < nCtrStop); end = __rdtsc(); - return int((end-start)/100); + return int((end - start)/1000000); } #endif diff --git a/bazaar/SysInfo/mousekey.cpp b/bazaar/SysInfo/mousekey.cpp index b9c08cabb..fa924120f 100644 --- a/bazaar/SysInfo/mousekey.cpp +++ b/bazaar/SysInfo/mousekey.cpp @@ -48,7 +48,7 @@ void Mouse_RightUp() } -bool Mouse_SetPos(long xMove, long yMove, long windowId) +bool Mouse_SetPos(long xMove, long yMove, uint64 windowId) { long left, top, right, bottom; @@ -274,7 +274,7 @@ bool Mouse_GetPos(long &x, long &y) return ret; } -bool Mouse_SetPos(long x, long y, long windowId) +bool Mouse_SetPos(long x, long y, uint64 windowId) { SetSysInfoX11ErrorHandler(); _XDisplay *dpy = XOpenDisplay (NULL); diff --git a/bazaar/SysInfo/os.cpp b/bazaar/SysInfo/os.cpp index 518f63185..c274f8fd2 100644 --- a/bazaar/SysInfo/os.cpp +++ b/bazaar/SysInfo/os.cpp @@ -130,13 +130,13 @@ bool GetOsInfo(String &kernel, String &kerVersion, String &kerArchitecture, Stri kernel.Cat(" Server 2003"); // Test for the server type. if (osvi.wProductType != VER_NT_WORKSTATION ) { - if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64 ) { + if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 ) { if(osvi.wSuiteMask & VER_SUITE_DATACENTER ) distro = "Datacenter Edition for Itanium-based Systems"; else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) distro = "Enterprise Edition for Itanium-based Systems"; } - } else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) { + } else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ) { if(osvi.wSuiteMask & VER_SUITE_DATACENTER ) distro = "Datacenter x64 Edition"; else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) diff --git a/bazaar/SysInfo/screengrab.cpp b/bazaar/SysInfo/screengrab.cpp index 3e80b06aa..8635892ff 100644 --- a/bazaar/SysInfo/screengrab.cpp +++ b/bazaar/SysInfo/screengrab.cpp @@ -10,16 +10,17 @@ NAMESPACE_UPP #define labs(x) abs(x) #endif -bool Window_SaveCapture(long windowId, String fileName, int left, int top, int width, int height) +bool Window_SaveCapture(uint64 windowId, String fileName, int left, int top, int width, int height) { - if (windowId == 0) - windowId = (long)GetDesktopWindow(); + HWND windowIdH = reinterpret_cast(windowId); + if (windowIdH == 0) + windowIdH = GetDesktopWindow(); if (GetFileExt(fileName) != ".bmp") fileName += ".bmp"; RECT rc; - GetWindowRect ((HWND)windowId, &rc); + GetWindowRect (windowIdH, &rc); if (left == -1) left = rc.left; @@ -90,7 +91,7 @@ private: bool viewMouse; bool opened; int grabMode; - int hwnd; + uint64 hwnd; int left; int top; int width; @@ -109,7 +110,7 @@ public: ~ScreenGrab(); bool IniGrabDesktop(); - bool IniGrabWindow(long handle); + bool IniGrabWindow(uint64 handle); bool IniGrabDesktopRectangle(int left, int top, int width, int height); bool Grab(unsigned duration); bool GrabSnapshot(); @@ -136,7 +137,8 @@ bool Record_DesktopRectangle(String fileName, int duration, int left, int top, i grab.Close(); return true; } -bool Record_Window(String fileName, int duration, long handle, double secsFrame, bool viewMouse) + +bool Record_Window(String fileName, int duration, uint64 handle, double secsFrame, bool viewMouse) { ScreenGrab grab(fileName, secsFrame, viewMouse); if (!grab.IniGrabWindow(handle)) @@ -223,7 +225,7 @@ HICON ScreenGrab::GetCursorHandle() GetCursorPos(&lpPos); lHandle = WindowFromPoint(lpPos); lThreadID = GetWindowThreadProcessId(lHandle, 0); - lCurrentThreadID = GetWindowThreadProcessId((HWND)GetWindowIdFromProcessId(GetProcessId()), 0); + lCurrentThreadID = GetWindowThreadProcessId(reinterpret_cast(GetWindowIdFromProcessId(GetProcessId())), 0); HICON ret; if (lThreadID != lCurrentThreadID) { if (AttachThreadInput(lCurrentThreadID, lThreadID, true)) { @@ -296,7 +298,7 @@ bool ScreenGrab::ScreenshotMemory() lPosY = lpRect.top; break; case GRAB_MODE_WINDOW: - lHandle = (HWND)hwnd; + lHandle = reinterpret_cast(hwnd); GetWindowRect(lHandle, &lpRect); lWidth = lpRect.right - lpRect.left; lHeight = lpRect.bottom - lpRect.top; @@ -364,7 +366,7 @@ bool ScreenGrab::IniGrabDesktop() return true; } -bool ScreenGrab::IniGrabWindow(long handle) +bool ScreenGrab::IniGrabWindow(uint64 handle) { opened = true; grabMode = GRAB_MODE_WINDOW; @@ -423,7 +425,7 @@ bool ScreenGrab::GrabSnapshot() #ifdef PLATFORM_POSIX -bool Window_SaveCapture(long windowId, String fileName, int left, int top, int width, int height) +bool Window_SaveCapture(uint64 windowId, String fileName, int left, int top, int width, int height) { if (GetFileExt(fileName) != ".xwd") fileName += ".xwd"; @@ -450,7 +452,7 @@ bool Snap_DesktopRectangle(String fileName, int left, int top, int width, int he return Window_SaveCapture(0, fileName, left, top, width, height); } -bool Snap_Window(String fileName, long handle) +bool Snap_Window(String fileName, uint64 handle) { return Window_SaveCapture(handle, fileName); } diff --git a/bazaar/SysInfo/src.tpp/SysInfo$en-us.tpp b/bazaar/SysInfo/src.tpp/SysInfo$en-us.tpp index e21820263..13f0eb739 100644 --- a/bazaar/SysInfo/src.tpp/SysInfo$en-us.tpp +++ b/bazaar/SysInfo/src.tpp/SysInfo$en-us.tpp @@ -181,23 +181,14 @@ ool]_[* GetDriveInformation]([_^String^ String]_[*@3 drive], [_^String^ String]_ [s2; Returns false if drive is not mounted or it is not accessible&] [s3; &] [s4; &] -[s5;:GetCompilerInfo`(String`&`,int`&`,Time`&`,String`&`):%- [@(0.0.255) void]_[* GetComp -ilerInfo]([_^String^ String]_`&[*@3 name], [@(0.0.255) int]_`&[*@3 version], -[_^Time^ Time]_`&[*@3 time], [_^String^ String]_`&[*@3 mode])&] +[s5;:GetCompilerInfo`(String`&`,int`&`,Time`&`,String`&`,int`&`):%- [@(0.0.255) void]_[* G +etCompilerInfo]([_^String^ String]_`&[*@3 name], [@(0.0.255) int]_`&[*@3 version], +[_^Time^ Time]_`&[*@3 time], [_^String^ String]_`&[*@3 mode], [_^String^ int]_`&[*@3 bits])&] [s2; Returns compiling information, like compiler [%-*@3 name, ]compiler -[%-*@3 version], program compilation [%-*@3 time]. and compiling -[%-*@3 mode].&] +[%-*@3 version], program compilation [%-*@3 time], compiling [%-*@3 mode] +and [%-*@3 bits].&] [s3; &] -[s4;%- &] -[s5;:GetCompilerInfo`(String`&`,int`&`,String`&`,String`&`):%- [@(0.0.255) void]_[* GetCo -mpilerInfo]([_^String^ String]_`&[*@3 name], [@(0.0.255) int]_`&[*@3 version], -[_^String^ String]_`&[*@3 time], [_^String^ String]_`&[*@3 mode])&] -[s2; Returns compiling information, like compiler [%-*@3 name, ]compiler -[%-*@3 version], program compilation [%-*@3 time]. and compiling -[%-*@3 mode].&] -[s6; This function is deprecated&] -[s3; &] -[s4;%- &] +[s4; &] [s5;:GetBatteryStatus`(bool`&`,int`&`,int`&`):%- [@(0.0.255) bool]_[* GetBatteryStatus]([@(0.0.255) b ool]_`&[*@3 discharging], [@(0.0.255) int]_`&[*@3 percentage], [@(0.0.255) int]_`&[*@3 rema iningMin])&]