diff options
Diffstat (limited to 'CPP/Windows')
-rwxr-xr-x | CPP/Windows/COM.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/CommonDialog.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/Control/PropertyPage.cpp | 1 | ||||
-rwxr-xr-x | CPP/Windows/DLL.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/Error.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/FileDir.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/FileFind.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/FileIO.cpp | 2 | ||||
-rwxr-xr-x | CPP/Windows/FileIO.h | 4 | ||||
-rwxr-xr-x | CPP/Windows/FileName.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/FileSystem.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/Menu.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/Net.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/PropVariantConversions.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/Registry.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/ResourceString.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/Security.h | 1 | ||||
-rwxr-xr-x | CPP/Windows/Shell.h | 2 | ||||
-rwxr-xr-x | CPP/Windows/System.cpp | 64 | ||||
-rwxr-xr-x | CPP/Windows/System.h | 38 | ||||
-rwxr-xr-x | CPP/Windows/Thread.h | 1 | ||||
-rwxr-xr-x | CPP/Windows/Window.h | 2 |
22 files changed, 86 insertions, 55 deletions
diff --git a/CPP/Windows/COM.h b/CPP/Windows/COM.h index 80651406..2f99905a 100755 --- a/CPP/Windows/COM.h +++ b/CPP/Windows/COM.h @@ -3,7 +3,7 @@ #ifndef __WINDOWS_COM_H #define __WINDOWS_COM_H -#include "Common/String.h" +#include "Common/MyString.h" namespace NWindows { namespace NCOM { diff --git a/CPP/Windows/CommonDialog.h b/CPP/Windows/CommonDialog.h index d0149aba..250c64f7 100755 --- a/CPP/Windows/CommonDialog.h +++ b/CPP/Windows/CommonDialog.h @@ -5,7 +5,7 @@ #include <windows.h> -#include "Common/String.h" +#include "Common/MyString.h" #include "Windows/Defs.h" namespace NWindows{ diff --git a/CPP/Windows/Control/PropertyPage.cpp b/CPP/Windows/Control/PropertyPage.cpp index f8996be1..1fd99079 100755 --- a/CPP/Windows/Control/PropertyPage.cpp +++ b/CPP/Windows/Control/PropertyPage.cpp @@ -3,7 +3,6 @@ #include "StdAfx.h" #include "Windows/Control/PropertyPage.h" -#include "../../Common/Vector.h" #ifndef _UNICODE #include "../../Common/StringConvert.h" #endif diff --git a/CPP/Windows/DLL.h b/CPP/Windows/DLL.h index bad0dd6d..4c2ffa2b 100755 --- a/CPP/Windows/DLL.h +++ b/CPP/Windows/DLL.h @@ -3,7 +3,7 @@ #ifndef __WINDOWS_DLL_H #define __WINDOWS_DLL_H -#include "../Common/String.h" +#include "../Common/MyString.h" namespace NWindows { namespace NDLL { diff --git a/CPP/Windows/Error.h b/CPP/Windows/Error.h index 4d9a9fa6..05b5cd0e 100755 --- a/CPP/Windows/Error.h +++ b/CPP/Windows/Error.h @@ -3,7 +3,7 @@ #ifndef __WINDOWS_ERROR_H #define __WINDOWS_ERROR_H -#include "Common/String.h" +#include "Common/MyString.h" namespace NWindows { namespace NError { diff --git a/CPP/Windows/FileDir.h b/CPP/Windows/FileDir.h index 3ebf3e63..b6f81351 100755 --- a/CPP/Windows/FileDir.h +++ b/CPP/Windows/FileDir.h @@ -3,7 +3,7 @@ #ifndef __WINDOWS_FILEDIR_H #define __WINDOWS_FILEDIR_H -#include "../Common/String.h" +#include "../Common/MyString.h" #include "Defs.h" namespace NWindows { diff --git a/CPP/Windows/FileFind.h b/CPP/Windows/FileFind.h index 4d2439aa..87846fde 100755 --- a/CPP/Windows/FileFind.h +++ b/CPP/Windows/FileFind.h @@ -3,7 +3,7 @@ #ifndef __WINDOWS_FILEFIND_H #define __WINDOWS_FILEFIND_H -#include "../Common/String.h" +#include "../Common/MyString.h" #include "../Common/Types.h" #include "FileName.h" #include "Defs.h" diff --git a/CPP/Windows/FileIO.cpp b/CPP/Windows/FileIO.cpp index b5f7593c..adfbec3d 100755 --- a/CPP/Windows/FileIO.cpp +++ b/CPP/Windows/FileIO.cpp @@ -5,7 +5,7 @@ #include "FileIO.h" #include "Defs.h" #ifdef WIN_LONG_PATH -#include "../Common/String.h" +#include "../Common/MyString.h" #endif #ifndef _UNICODE #include "../Common/StringConvert.h" diff --git a/CPP/Windows/FileIO.h b/CPP/Windows/FileIO.h index 05c8bc16..a7ee8808 100755 --- a/CPP/Windows/FileIO.h +++ b/CPP/Windows/FileIO.h @@ -34,9 +34,9 @@ protected: public: CFileBase(): _handle(INVALID_HANDLE_VALUE){}; - virtual ~CFileBase(); + ~CFileBase(); - virtual bool Close(); + bool Close(); bool GetPosition(UInt64 &position) const; bool GetLength(UInt64 &length) const; diff --git a/CPP/Windows/FileName.h b/CPP/Windows/FileName.h index f8567652..5b912b2d 100755 --- a/CPP/Windows/FileName.h +++ b/CPP/Windows/FileName.h @@ -3,7 +3,7 @@ #ifndef __WINDOWS_FILENAME_H #define __WINDOWS_FILENAME_H -#include "../Common/String.h" +#include "../Common/MyString.h" namespace NWindows { namespace NFile { diff --git a/CPP/Windows/FileSystem.h b/CPP/Windows/FileSystem.h index 25488804..727497bb 100755 --- a/CPP/Windows/FileSystem.h +++ b/CPP/Windows/FileSystem.h @@ -3,7 +3,7 @@ #ifndef __WINDOWS_FILESYSTEM_H #define __WINDOWS_FILESYSTEM_H -#include "../Common/String.h" +#include "../Common/MyString.h" #include "../Common/Types.h" #ifndef _UNICODE diff --git a/CPP/Windows/Menu.h b/CPP/Windows/Menu.h index 11ba5537..9e0d375c 100755 --- a/CPP/Windows/Menu.h +++ b/CPP/Windows/Menu.h @@ -3,7 +3,7 @@ #ifndef __WINDOWS_MENU_H #define __WINDOWS_MENU_H -#include "Common/String.h" +#include "Common/MyString.h" #include "Windows/Defs.h" namespace NWindows { diff --git a/CPP/Windows/Net.h b/CPP/Windows/Net.h index ff501d70..1f0eae97 100755 --- a/CPP/Windows/Net.h +++ b/CPP/Windows/Net.h @@ -4,7 +4,7 @@ #define __WINDOWS_NET_H #include "Common/Buffer.h" -#include "Common/String.h" +#include "Common/MyString.h" namespace NWindows { namespace NNet { diff --git a/CPP/Windows/PropVariantConversions.h b/CPP/Windows/PropVariantConversions.h index a3f3ebbf..68ad9612 100755 --- a/CPP/Windows/PropVariantConversions.h +++ b/CPP/Windows/PropVariantConversions.h @@ -4,7 +4,7 @@ #define __PROPVARIANTCONVERSIONS_H #include "Common/Types.h" -#include "Common/String.h" +#include "Common/MyString.h" bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime = true, bool includeSeconds = true); UString ConvertFileTimeToString(const FILETIME &ft, bool includeTime = true, bool includeSeconds = true); diff --git a/CPP/Windows/Registry.h b/CPP/Windows/Registry.h index 435717bd..a590d8ea 100755 --- a/CPP/Windows/Registry.h +++ b/CPP/Windows/Registry.h @@ -4,7 +4,7 @@ #define __WINDOWS_REGISTRY_H #include "Common/Buffer.h" -#include "Common/String.h" +#include "Common/MyString.h" #include "Common/Types.h" namespace NWindows { diff --git a/CPP/Windows/ResourceString.h b/CPP/Windows/ResourceString.h index 1bfc88ab..ac9c5cd5 100755 --- a/CPP/Windows/ResourceString.h +++ b/CPP/Windows/ResourceString.h @@ -3,7 +3,7 @@ #ifndef __WINDOWS_RESOURCESTRING_H #define __WINDOWS_RESOURCESTRING_H -#include "Common/String.h" +#include "Common/MyString.h" namespace NWindows { diff --git a/CPP/Windows/Security.h b/CPP/Windows/Security.h index ded31b74..73422568 100755 --- a/CPP/Windows/Security.h +++ b/CPP/Windows/Security.h @@ -3,7 +3,6 @@ #ifndef __WINDOWS_SECURITY_H #define __WINDOWS_SECURITY_H -#include "Common/String.h" #include "Windows/Defs.h" #include <NTSecAPI.h> diff --git a/CPP/Windows/Shell.h b/CPP/Windows/Shell.h index 4770a454..743eb051 100755 --- a/CPP/Windows/Shell.h +++ b/CPP/Windows/Shell.h @@ -6,7 +6,7 @@ #include <windows.h> #include <shlobj.h> -#include "Common/String.h" +#include "Common/MyString.h" #include "Windows/Defs.h" diff --git a/CPP/Windows/System.cpp b/CPP/Windows/System.cpp new file mode 100755 index 00000000..8e4069c2 --- /dev/null +++ b/CPP/Windows/System.cpp @@ -0,0 +1,64 @@ +// Windows/System.cpp + +#include "StdAfx.h" + +#include "System.h" + +namespace NWindows { +namespace NSystem { + +UInt32 GetNumberOfProcessors() +{ + SYSTEM_INFO systemInfo; + GetSystemInfo(&systemInfo); + return (UInt32)systemInfo.dwNumberOfProcessors; +} + +#if !defined(_WIN64) && defined(__GNUC__) + +typedef struct _MY_MEMORYSTATUSEX { + DWORD dwLength; + DWORD dwMemoryLoad; + DWORDLONG ullTotalPhys; + DWORDLONG ullAvailPhys; + DWORDLONG ullTotalPageFile; + DWORDLONG ullAvailPageFile; + DWORDLONG ullTotalVirtual; + DWORDLONG ullAvailVirtual; + DWORDLONG ullAvailExtendedVirtual; +} MY_MEMORYSTATUSEX, *MY_LPMEMORYSTATUSEX; + +#else + +#define MY_MEMORYSTATUSEX MEMORYSTATUSEX +#define MY_LPMEMORYSTATUSEX LPMEMORYSTATUSEX + +#endif + +typedef BOOL (WINAPI *GlobalMemoryStatusExP)(MY_LPMEMORYSTATUSEX lpBuffer); + +UInt64 GetRamSize() +{ + MY_MEMORYSTATUSEX stat; + stat.dwLength = sizeof(stat); + #ifdef _WIN64 + if (!::GlobalMemoryStatusEx(&stat)) + return 0; + return stat.ullTotalPhys; + #else + GlobalMemoryStatusExP globalMemoryStatusEx = (GlobalMemoryStatusExP) + ::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")), + "GlobalMemoryStatusEx"); + if (globalMemoryStatusEx != 0) + if (globalMemoryStatusEx(&stat)) + return stat.ullTotalPhys; + { + MEMORYSTATUS stat; + stat.dwLength = sizeof(stat); + GlobalMemoryStatus(&stat); + return stat.dwTotalPhys; + } + #endif +} + +}} diff --git a/CPP/Windows/System.h b/CPP/Windows/System.h index a81aba98..e0067158 100755 --- a/CPP/Windows/System.h +++ b/CPP/Windows/System.h @@ -3,45 +3,13 @@ #ifndef __WINDOWS_SYSTEM_H #define __WINDOWS_SYSTEM_H -#include "..\Common\Types.h" +#include "../Common/Types.h" namespace NWindows { namespace NSystem { -inline UInt32 GetNumberOfProcessors() -{ - SYSTEM_INFO systemInfo; - GetSystemInfo(&systemInfo); - return (UInt32)systemInfo.dwNumberOfProcessors; -} - -#ifndef _WIN64 -typedef BOOL (WINAPI *GlobalMemoryStatusExP)(LPMEMORYSTATUSEX lpBuffer); -#endif - -inline UInt64 GetRamSize() -{ - MEMORYSTATUSEX stat; - stat.dwLength = sizeof(stat); - #ifdef _WIN64 - if (!::GlobalMemoryStatusEx(&stat)) - return 0; - return stat.ullTotalPhys; - #else - GlobalMemoryStatusExP globalMemoryStatusEx = (GlobalMemoryStatusExP) - ::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")), - "GlobalMemoryStatusEx"); - if (globalMemoryStatusEx != 0) - if (globalMemoryStatusEx(&stat)) - return stat.ullTotalPhys; - { - MEMORYSTATUS stat; - stat.dwLength = sizeof(stat); - GlobalMemoryStatus(&stat); - return stat.dwTotalPhys; - } - #endif -} +UInt32 GetNumberOfProcessors(); +UInt64 GetRamSize(); }} diff --git a/CPP/Windows/Thread.h b/CPP/Windows/Thread.h index 044ec9a3..7edc6827 100755 --- a/CPP/Windows/Thread.h +++ b/CPP/Windows/Thread.h @@ -20,6 +20,7 @@ class CThread public: CThread() { Thread_Construct(&thread); } ~CThread() { Close(); } + bool IsCreated() { return Thread_WasCreated(&thread) != 0; } HRes Close() { return Thread_Close(&thread); } HRes Create(THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter) { return Thread_Create(&thread, startAddress, parameter); } diff --git a/CPP/Windows/Window.h b/CPP/Windows/Window.h index 3df80191..c0e68229 100755 --- a/CPP/Windows/Window.h +++ b/CPP/Windows/Window.h @@ -4,7 +4,7 @@ #define __WINDOWS_WINDOW_H #include "Windows/Defs.h" -#include "Common/String.h" +#include "Common/MyString.h" namespace NWindows { |