diff -r f8bde3457728 boost/boost/interprocess/detail/os_thread_functions.hpp --- a/boost/boost/interprocess/detail/os_thread_functions.hpp Thu May 08 09:43:34 2014 +0800 +++ b/boost/boost/interprocess/detail/os_thread_functions.hpp Thu May 08 17:40:06 2014 +0800 @@ -193,7 +193,7 @@ { winapi::interprocess_filetime CreationTime, ExitTime, KernelTime, UserTime; - get_process_times + winapi::get_process_times ( winapi::get_current_process(), &CreationTime, &ExitTime, &KernelTime, &UserTime); typedef long double ldouble_t; diff -r f8bde3457728 boost/boost/interprocess/detail/win32_api.hpp --- a/boost/boost/interprocess/detail/win32_api.hpp Thu May 08 09:43:34 2014 +0800 +++ b/boost/boost/interprocess/detail/win32_api.hpp Thu May 08 17:40:06 2014 +0800 @@ -229,6 +229,9 @@ namespace interprocess { namespace winapi { +#ifdef BOOST_USE_WINDOWS_H +typedef ::GUID GUID_BIPC; +#else struct GUID_BIPC { unsigned long Data1; @@ -236,6 +239,7 @@ unsigned short Data3; unsigned char Data4[8]; }; +#endif // #ifdef BOOST_USE_WINDOWS_H const GUID_BIPC CLSID_WbemAdministrativeLocator = { 0xcb8555cc, 0x9128, 0x11d1, {0xad, 0x9b, 0x00, 0xc0, 0x4f, 0xd8, 0xfd, 0xff}}; @@ -251,6 +255,9 @@ } value; }; +#ifdef BOOST_USE_WINDOWS_H +typedef ::IUnknown IUnknown_BIPC; +#else struct IUnknown_BIPC { public: @@ -261,6 +268,7 @@ virtual unsigned long __stdcall AddRef (void) = 0; virtual unsigned long __stdcall Release(void) = 0; }; +#endif // #ifdef BOOST_USE_WINDOWS_H struct IWbemClassObject_BIPC : public IUnknown_BIPC { @@ -595,6 +603,19 @@ }; +#ifdef BOOST_USE_WINDOWS_H + +typedef ::OVERLAPPED interprocess_overlapped; +typedef ::FILETIME interprocess_filetime; +typedef ::WIN32_FIND_DATA win32_find_data_t; +typedef ::SECURITY_ATTRIBUTES interprocess_security_attributes; +typedef ::SYSTEM_INFO system_info; +typedef ::ACL interprocess_acl; +typedef ::SECURITY_DESCRIPTOR interprocess_security_descriptor; +typedef ::BY_HANDLE_FILE_INFORMATION interprocess_by_handle_file_information; + +#else + struct interprocess_overlapped { unsigned long *internal; @@ -610,19 +631,6 @@ void *h_event; }; -struct interprocess_semaphore_basic_information -{ - unsigned int count; // current semaphore count - unsigned int limit; // max semaphore count -}; - -struct interprocess_section_basic_information -{ - void * base_address; - unsigned long section_attributes; - __int64 section_size; -}; - struct interprocess_filetime { unsigned long dwLowDateTime; @@ -669,17 +677,6 @@ unsigned short wProcessorRevision; }; -struct interprocess_memory_basic_information -{ - void * BaseAddress; - void * AllocationBase; - unsigned long AllocationProtect; - unsigned long RegionSize; - unsigned long State; - unsigned long Protect; - unsigned long Type; -}; - struct interprocess_acl { unsigned char AclRevision; @@ -700,6 +697,46 @@ interprocess_acl *Dacl; } interprocess_security_descriptor; +struct interprocess_by_handle_file_information +{ + unsigned long dwFileAttributes; + interprocess_filetime ftCreationTime; + interprocess_filetime ftLastAccessTime; + interprocess_filetime ftLastWriteTime; + unsigned long dwVolumeSerialNumber; + unsigned long nFileSizeHigh; + unsigned long nFileSizeLow; + unsigned long nNumberOfLinks; + unsigned long nFileIndexHigh; + unsigned long nFileIndexLow; +}; + +#endif // #ifdef BOOST_USE_WINDOWS_H + +struct interprocess_semaphore_basic_information +{ + unsigned int count; // current semaphore count + unsigned int limit; // max semaphore count +}; + +struct interprocess_section_basic_information +{ + void * base_address; + unsigned long section_attributes; + __int64 section_size; +}; + +struct interprocess_memory_basic_information +{ + void * BaseAddress; + void * AllocationBase; + unsigned long AllocationProtect; + unsigned long RegionSize; + unsigned long State; + unsigned long Protect; + unsigned long Type; +}; + enum file_information_class_t { file_directory_information = 1, file_full_directory_information, @@ -797,20 +834,6 @@ unsigned char Reserved1[SystemTimeOfDayInfoLength]; }; -struct interprocess_by_handle_file_information -{ - unsigned long dwFileAttributes; - interprocess_filetime ftCreationTime; - interprocess_filetime ftLastAccessTime; - interprocess_filetime ftLastWriteTime; - unsigned long dwVolumeSerialNumber; - unsigned long nFileSizeHigh; - unsigned long nFileSizeLow; - unsigned long nNumberOfLinks; - unsigned long nFileIndexHigh; - unsigned long nFileIndexLow; -}; - enum system_information_class { system_basic_information = 0, system_performance_information = 2, @@ -875,6 +898,96 @@ // }; +#ifdef BOOST_USE_WINDOWS_H + +//Kernel32.dll + +using ::GetCurrentProcessId; +using ::GetCurrentThreadId; +using ::GetProcessTimes; +using ::Sleep; +using ::GetTickCount; +using ::SwitchToThread; +using ::GetLastError; +using ::SetLastError; +using ::GetCurrentProcess; +using ::CloseHandle; +using ::DuplicateHandle; +using ::GetFileType; +using ::FindFirstFileA; +using ::FindNextFileA; +using ::FindClose; +//using ::GetSystemTimeAsFileTime +//using ::FileTimeToLocalFileTime +using ::CreateMutexA; +using ::OpenMutexA; +using ::WaitForSingleObject; +using ::ReleaseMutex; +using ::UnmapViewOfFile; +using ::CreateSemaphoreA; +using ::ReleaseSemaphore; +using ::OpenSemaphoreA; +using ::CreateFileMappingA; +using ::MapViewOfFileEx; +using ::OpenFileMappingA; +using ::CreateFileA; +using ::GetSystemInfo; +using ::FlushViewOfFile; +using ::VirtualUnlock; +using ::VirtualProtect; +using ::FlushFileBuffers; +using ::GetFileSizeEx; +using ::FormatMessageA; +using ::LocalFree; +using ::GetFileAttributesA; +using ::CreateDirectoryA; +using ::RemoveDirectoryA; +using ::GetTempPathA; +using ::CreateDirectory; +using ::SetFileValidData; +using ::SetEndOfFile; +using ::SetFilePointerEx; +using ::LockFile; +using ::UnlockFile; +using ::LockFileEx; +using ::UnlockFileEx; +using ::WriteFile; +using ::ReadFile; +using ::InitializeSecurityDescriptor; +using ::SetSecurityDescriptorDacl; +using ::LoadLibraryA; +using ::FreeLibrary; +using ::GetProcAddress; +using ::GetModuleHandleA; +using ::GetFileInformationByHandle; + +//Advapi32.dll +using ::RegOpenKeyExA; +using ::RegQueryValueExA; +using ::RegCloseKey; + +//Ole32.dll +using ::CoInitializeEx; +using ::CoInitializeSecurity; + using ::CoSetProxyBlanket; +using ::CoCreateInstance; +using ::CoUninitialize; + +//OleAut32.dll +using ::VariantClear; + + +//EventLog access functions + +static const unsigned long eventlog_sequential_read = 0x0001; +static const unsigned long eventlog_backwards_read = 0x0008; + +using ::OpenEventLogA; +using ::CloseEventLog; +using ::ReadEventLogA; + +#else + //Kernel32.dll //Some windows API declarations @@ -1001,6 +1114,8 @@ unsigned long *pnBytesRead, unsigned long *pnMinNumberOfBytesNeeded ); + +#endif // #ifdef BOOST_USE_WINDOWS_H //ntdll.dll @@ -1212,7 +1327,11 @@ { return 0 != FlushFileBuffers(handle); } inline bool get_file_size(void *handle, __int64 &size) +#ifdef BOOST_USE_WINDOWS_H +{ return 0 != GetFileSizeEx(handle, reinterpret_cast(&size)); } +#else { return 0 != GetFileSizeEx(handle, &size); } +#endif inline bool create_directory(const char *name) { @@ -1230,7 +1349,11 @@ { return 0 != SetEndOfFile(handle); } inline bool set_file_pointer_ex(void *handle, __int64 distance, __int64 *new_file_pointer, unsigned long move_method) +#ifdef BOOST_USE_WINDOWS_H +{ return 0 != SetFilePointerEx(handle, *reinterpret_cast(&distance), reinterpret_cast(new_file_pointer), move_method); } +#else { return 0 != SetFilePointerEx(handle, distance, new_file_pointer, move_method); } +#endif inline bool lock_file_ex(void *hnd, unsigned long flags, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped *overlapped) { return 0 != LockFileEx(hnd, flags, reserved, size_low, size_high, overlapped); } @@ -1267,10 +1390,18 @@ { return LoadLibraryA(name); } inline bool free_library(void *module) +#ifdef BOOST_USE_WINDOWS_H +{ return 0 != FreeLibrary(static_cast(module)); } +#else { return 0 != FreeLibrary(module); } +#endif // #ifdef BOOST_USE_WINDOWS_H inline void *get_proc_address(void *module, const char *name) +#ifdef BOOST_USE_WINDOWS_H +{ return reinterpret_cast(GetProcAddress(static_cast(module), name)); } +#else { return GetProcAddress(module, name); } +#endif // #ifdef BOOST_USE_WINDOWS_H inline void *get_current_process() { return GetCurrentProcess(); } @@ -1279,13 +1410,25 @@ { return GetModuleHandleA(name); } inline long reg_open_key_ex(void *hKey, const char *lpSubKey, unsigned long ulOptions, unsigned long samDesired, void **phkResult) +#ifdef BOOST_USE_WINDOWS_H +{ return RegOpenKeyExA(static_cast(hKey), lpSubKey, ulOptions, samDesired, reinterpret_cast(phkResult)); } +#else { return RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, phkResult); } +#endif // #ifdef BOOST_USE_WINDOWS_H inline long reg_query_value_ex(void *hKey, const char *lpValueName, unsigned long*lpReserved, unsigned long*lpType, unsigned char *lpData, unsigned long*lpcbData) +#ifdef BOOST_USE_WINDOWS_H +{ return RegQueryValueExA(static_cast(hKey), lpValueName, lpReserved, lpType, lpData, lpcbData); } +#else { return RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData); } +#endif // #ifdef BOOST_USE_WINDOWS_H inline long reg_close_key(void *hKey) +#ifdef BOOST_USE_WINDOWS_H +{ return RegCloseKey(static_cast(hKey)); } +#else { return RegCloseKey(hKey); } +#endif // #ifdef BOOST_USE_WINDOWS_H inline void initialize_object_attributes ( object_attributes_t *pobject_attr, unicode_string_t *name @@ -1957,7 +2100,11 @@ if ( 0 == pClassObject->Get( L"LastBootUpTime", 0, &vwchar, 0, 0 ) ){ bRet = true; strValue = vwchar.value.pbstrVal; +#ifdef BOOST_USE_WINDOWS_H + VariantClear(reinterpret_cast(&vwchar)); +#else VariantClear(&vwchar ); +#endif // #ifdef BOOST_USE_WINDOWS_H break; } } diff -r f8bde3457728 boost/boost/interprocess/mapped_region.hpp --- a/boost/boost/interprocess/mapped_region.hpp Thu May 08 09:43:34 2014 +0800 +++ b/boost/boost/interprocess/mapped_region.hpp Thu May 08 17:40:06 2014 +0800 @@ -374,7 +374,7 @@ inline std::size_t mapped_region::page_size_holder::get_page_size() { winapi::system_info info; - get_system_info(&info); + winapi::get_system_info(&info); return std::size_t(info.dwAllocationGranularity); }