SysInfo: Changes due to 74 bits warnings

git-svn-id: svn://ultimatepp.org/upp/trunk@6012 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2013-05-01 06:47:22 +00:00
parent 3e04cd2b6f
commit 997f899751
8 changed files with 145 additions and 136 deletions

View file

@ -779,7 +779,7 @@ bool GetMemoryInfo(
#if defined(PLATFORM_WIN32)
// Get the list of process identifiers.
bool GetProcessList(Array<long> &pid, Array<String> &pNames)
bool GetProcessList(Array<uint64> &pid, Array<String> &pNames)
{
PROCESSENTRY32 proc;
HANDLE hSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
@ -795,10 +795,11 @@ bool GetProcessList(Array<long> &pid, Array<String> &pNames)
CloseHandle(hSnap);
return true;
}
Array<long> GetProcessList()
Array<uint64> GetProcessList()
{
PROCESSENTRY32 proc;
Array<long> ret;
Array<uint64> ret;
HANDLE hSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnap == INVALID_HANDLE_VALUE)
return ret;
@ -811,13 +812,14 @@ Array<long> 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<int> *ret = (Array<int> *)lParam;
ret->Add((int)hWnd);
Array<uint64> *ret = (Array<uint64> *)lParam;
ret->Add(reinterpret_cast<uint64>(hWnd));
return TRUE;
}
void GetWindowsList(Array<long> &hWnd, Array<long> &processId, Array<String> &name, Array<String> &fileName, Array<String> &caption)
void GetWindowsList(Array<uint64> &hWnd, Array<uint64> &processId, Array<String> &name, Array<String> &fileName, Array<String> &caption)
{
HANDLE hProcess;
DWORD dwThreadId, dwProcessId;
@ -877,8 +879,8 @@ void GetWindowsList(Array<long> &hWnd, Array<long> &processId, Array<String> &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>(hWnd[i]), GWLP_HINSTANCE);
dwThreadId = GetWindowThreadProcessId(reinterpret_cast<HWND>(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<long> &hWnd, Array<long> &processId, Array<String> &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>(hWnd[i]))) {
int count = int(SendMessageW(reinterpret_cast<HWND>(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<long> &hWnd, Array<long> &processId, Array<String> &na
}
}
Array<long> GetWindowsList()
Array<uint64> GetWindowsList()
{
Array<long> ret;
Array<uint64> 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<long> &pid, Array<String> &pNames)
bool GetProcessList(Array<uint64> &pid, Array<String> &pNames)
{
FindFile ff;
if(ff.Search("/proc/*")) {
@ -1019,7 +1022,8 @@ bool GetProcessList(Array<long> &pid, Array<String> &pNames)
}
return true;
}
Array<long> GetProcessList()
Array<uint64> GetProcessList()
{
FindFile ff;
Array<long> pid;
@ -1038,12 +1042,14 @@ Array<long> 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<long> GetWindowsList()
return ret;
}
void GetWindowsList(Array<long> &hWnd, Array<long> &processId, Array<String> &nameL, Array<String> &fileName, Array<String> &caption)
void GetWindowsList(Array<uint64> &hWnd, Array<uint64> &processId, Array<String> &nameL, Array<String> &fileName, Array<String> &caption)
{
SetSysInfoX11ErrorHandler();
_XDisplay *dpy = XOpenDisplay (NULL);
@ -1155,7 +1161,7 @@ void GetWindowsList(Array<long> &hWnd, Array<long> &processId, Array<String> &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<long> &hWnd, Array<long> &processId, Array<String> &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<long> wid, pid;
Array<uint64> wid, pid;
Array<String> 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<long> wid, pid;
Array<uint64> wid, pid;
Array<String> 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<long> wId, pid;
Array<uint64> wId, pid;
Array<String> 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<long> wId, pid;
Array<uint64> wId, pid;
Array<String> 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<HWND>(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<HWND>(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<HWND>(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<HWND>(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<HWND>(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<HWND>(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) {

View file

@ -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<long> &wid, Upp::Array<long> &pid, Upp::Array<String> &name,
void GetWindowsList(Upp::Array<uint64> &wid, Upp::Array<uint64> &pid, Upp::Array<String> &name,
Upp::Array<String> &fileName, Upp::Array<String> &title);
Upp::Array<long> GetWindowsList();
Upp::Array<uint64> GetWindowsList();
/////////////////////////////////////////////////////////////////////
// Process list
bool GetProcessList(Upp::Array<long> &pid, Upp::Array<String> &pNames);
Upp::Array<long> GetProcessList();
String GetProcessName(long pid);
String GetProcessFileName(long processID);
bool GetProcessList(Upp::Array<uint64> &pid, Upp::Array<String> &pNames);
Upp::Array<uint64> 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

View file

@ -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")

View file

@ -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

View file

@ -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);

View file

@ -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 )

View file

@ -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<HWND>(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<HWND>(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>(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);
}

View file

@ -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])&]