Ticket #10021: boost_interprocess_use_windows_h.patch
File boost_interprocess_use_windows_h.patch, 11.1 KB (added by , 8 years ago) |
---|
-
boost/boost/interprocess/detail/os_thread_functions.hpp
diff -r f8bde3457728 boost/boost/interprocess/detail/os_thread_functions.hpp
a b 193 193 { 194 194 winapi::interprocess_filetime CreationTime, ExitTime, KernelTime, UserTime; 195 195 196 get_process_times196 winapi::get_process_times 197 197 ( winapi::get_current_process(), &CreationTime, &ExitTime, &KernelTime, &UserTime); 198 198 199 199 typedef long double ldouble_t; -
boost/boost/interprocess/detail/win32_api.hpp
diff -r f8bde3457728 boost/boost/interprocess/detail/win32_api.hpp
a b 229 229 namespace interprocess { 230 230 namespace winapi { 231 231 232 #ifdef BOOST_USE_WINDOWS_H 233 typedef ::GUID GUID_BIPC; 234 #else 232 235 struct GUID_BIPC 233 236 { 234 237 unsigned long Data1; … … 236 239 unsigned short Data3; 237 240 unsigned char Data4[8]; 238 241 }; 242 #endif // #ifdef BOOST_USE_WINDOWS_H 239 243 240 244 const GUID_BIPC CLSID_WbemAdministrativeLocator = 241 245 { 0xcb8555cc, 0x9128, 0x11d1, {0xad, 0x9b, 0x00, 0xc0, 0x4f, 0xd8, 0xfd, 0xff}}; … … 251 255 } value; 252 256 }; 253 257 258 #ifdef BOOST_USE_WINDOWS_H 259 typedef ::IUnknown IUnknown_BIPC; 260 #else 254 261 struct IUnknown_BIPC 255 262 { 256 263 public: … … 261 268 virtual unsigned long __stdcall AddRef (void) = 0; 262 269 virtual unsigned long __stdcall Release(void) = 0; 263 270 }; 271 #endif // #ifdef BOOST_USE_WINDOWS_H 264 272 265 273 struct IWbemClassObject_BIPC : public IUnknown_BIPC 266 274 { … … 595 603 596 604 }; 597 605 606 #ifdef BOOST_USE_WINDOWS_H 607 608 typedef ::OVERLAPPED interprocess_overlapped; 609 typedef ::FILETIME interprocess_filetime; 610 typedef ::WIN32_FIND_DATA win32_find_data_t; 611 typedef ::SECURITY_ATTRIBUTES interprocess_security_attributes; 612 typedef ::SYSTEM_INFO system_info; 613 typedef ::ACL interprocess_acl; 614 typedef ::SECURITY_DESCRIPTOR interprocess_security_descriptor; 615 typedef ::BY_HANDLE_FILE_INFORMATION interprocess_by_handle_file_information; 616 617 #else 618 598 619 struct interprocess_overlapped 599 620 { 600 621 unsigned long *internal; … … 610 631 void *h_event; 611 632 }; 612 633 613 struct interprocess_semaphore_basic_information614 {615 unsigned int count; // current semaphore count616 unsigned int limit; // max semaphore count617 };618 619 struct interprocess_section_basic_information620 {621 void * base_address;622 unsigned long section_attributes;623 __int64 section_size;624 };625 626 634 struct interprocess_filetime 627 635 { 628 636 unsigned long dwLowDateTime; … … 669 677 unsigned short wProcessorRevision; 670 678 }; 671 679 672 struct interprocess_memory_basic_information673 {674 void * BaseAddress;675 void * AllocationBase;676 unsigned long AllocationProtect;677 unsigned long RegionSize;678 unsigned long State;679 unsigned long Protect;680 unsigned long Type;681 };682 683 680 struct interprocess_acl 684 681 { 685 682 unsigned char AclRevision; … … 700 697 interprocess_acl *Dacl; 701 698 } interprocess_security_descriptor; 702 699 700 struct interprocess_by_handle_file_information 701 { 702 unsigned long dwFileAttributes; 703 interprocess_filetime ftCreationTime; 704 interprocess_filetime ftLastAccessTime; 705 interprocess_filetime ftLastWriteTime; 706 unsigned long dwVolumeSerialNumber; 707 unsigned long nFileSizeHigh; 708 unsigned long nFileSizeLow; 709 unsigned long nNumberOfLinks; 710 unsigned long nFileIndexHigh; 711 unsigned long nFileIndexLow; 712 }; 713 714 #endif // #ifdef BOOST_USE_WINDOWS_H 715 716 struct interprocess_semaphore_basic_information 717 { 718 unsigned int count; // current semaphore count 719 unsigned int limit; // max semaphore count 720 }; 721 722 struct interprocess_section_basic_information 723 { 724 void * base_address; 725 unsigned long section_attributes; 726 __int64 section_size; 727 }; 728 729 struct interprocess_memory_basic_information 730 { 731 void * BaseAddress; 732 void * AllocationBase; 733 unsigned long AllocationProtect; 734 unsigned long RegionSize; 735 unsigned long State; 736 unsigned long Protect; 737 unsigned long Type; 738 }; 739 703 740 enum file_information_class_t { 704 741 file_directory_information = 1, 705 742 file_full_directory_information, … … 797 834 unsigned char Reserved1[SystemTimeOfDayInfoLength]; 798 835 }; 799 836 800 struct interprocess_by_handle_file_information801 {802 unsigned long dwFileAttributes;803 interprocess_filetime ftCreationTime;804 interprocess_filetime ftLastAccessTime;805 interprocess_filetime ftLastWriteTime;806 unsigned long dwVolumeSerialNumber;807 unsigned long nFileSizeHigh;808 unsigned long nFileSizeLow;809 unsigned long nNumberOfLinks;810 unsigned long nFileIndexHigh;811 unsigned long nFileIndexLow;812 };813 814 837 enum system_information_class { 815 838 system_basic_information = 0, 816 839 system_performance_information = 2, … … 875 898 // 876 899 }; 877 900 901 #ifdef BOOST_USE_WINDOWS_H 902 903 //Kernel32.dll 904 905 using ::GetCurrentProcessId; 906 using ::GetCurrentThreadId; 907 using ::GetProcessTimes; 908 using ::Sleep; 909 using ::GetTickCount; 910 using ::SwitchToThread; 911 using ::GetLastError; 912 using ::SetLastError; 913 using ::GetCurrentProcess; 914 using ::CloseHandle; 915 using ::DuplicateHandle; 916 using ::GetFileType; 917 using ::FindFirstFileA; 918 using ::FindNextFileA; 919 using ::FindClose; 920 //using ::GetSystemTimeAsFileTime 921 //using ::FileTimeToLocalFileTime 922 using ::CreateMutexA; 923 using ::OpenMutexA; 924 using ::WaitForSingleObject; 925 using ::ReleaseMutex; 926 using ::UnmapViewOfFile; 927 using ::CreateSemaphoreA; 928 using ::ReleaseSemaphore; 929 using ::OpenSemaphoreA; 930 using ::CreateFileMappingA; 931 using ::MapViewOfFileEx; 932 using ::OpenFileMappingA; 933 using ::CreateFileA; 934 using ::GetSystemInfo; 935 using ::FlushViewOfFile; 936 using ::VirtualUnlock; 937 using ::VirtualProtect; 938 using ::FlushFileBuffers; 939 using ::GetFileSizeEx; 940 using ::FormatMessageA; 941 using ::LocalFree; 942 using ::GetFileAttributesA; 943 using ::CreateDirectoryA; 944 using ::RemoveDirectoryA; 945 using ::GetTempPathA; 946 using ::CreateDirectory; 947 using ::SetFileValidData; 948 using ::SetEndOfFile; 949 using ::SetFilePointerEx; 950 using ::LockFile; 951 using ::UnlockFile; 952 using ::LockFileEx; 953 using ::UnlockFileEx; 954 using ::WriteFile; 955 using ::ReadFile; 956 using ::InitializeSecurityDescriptor; 957 using ::SetSecurityDescriptorDacl; 958 using ::LoadLibraryA; 959 using ::FreeLibrary; 960 using ::GetProcAddress; 961 using ::GetModuleHandleA; 962 using ::GetFileInformationByHandle; 963 964 //Advapi32.dll 965 using ::RegOpenKeyExA; 966 using ::RegQueryValueExA; 967 using ::RegCloseKey; 968 969 //Ole32.dll 970 using ::CoInitializeEx; 971 using ::CoInitializeSecurity; 972 using ::CoSetProxyBlanket; 973 using ::CoCreateInstance; 974 using ::CoUninitialize; 975 976 //OleAut32.dll 977 using ::VariantClear; 978 979 980 //EventLog access functions 981 982 static const unsigned long eventlog_sequential_read = 0x0001; 983 static const unsigned long eventlog_backwards_read = 0x0008; 984 985 using ::OpenEventLogA; 986 using ::CloseEventLog; 987 using ::ReadEventLogA; 988 989 #else 990 878 991 //Kernel32.dll 879 992 880 993 //Some windows API declarations … … 1001 1114 unsigned long *pnBytesRead, 1002 1115 unsigned long *pnMinNumberOfBytesNeeded 1003 1116 ); 1117 1118 #endif // #ifdef BOOST_USE_WINDOWS_H 1004 1119 1005 1120 1006 1121 //ntdll.dll … … 1212 1327 { return 0 != FlushFileBuffers(handle); } 1213 1328 1214 1329 inline bool get_file_size(void *handle, __int64 &size) 1330 #ifdef BOOST_USE_WINDOWS_H 1331 { return 0 != GetFileSizeEx(handle, reinterpret_cast<PLARGE_INTEGER>(&size)); } 1332 #else 1215 1333 { return 0 != GetFileSizeEx(handle, &size); } 1334 #endif 1216 1335 1217 1336 inline bool create_directory(const char *name) 1218 1337 { … … 1230 1349 { return 0 != SetEndOfFile(handle); } 1231 1350 1232 1351 inline bool set_file_pointer_ex(void *handle, __int64 distance, __int64 *new_file_pointer, unsigned long move_method) 1352 #ifdef BOOST_USE_WINDOWS_H 1353 { return 0 != SetFilePointerEx(handle, *reinterpret_cast<PLARGE_INTEGER>(&distance), reinterpret_cast<PLARGE_INTEGER>(new_file_pointer), move_method); } 1354 #else 1233 1355 { return 0 != SetFilePointerEx(handle, distance, new_file_pointer, move_method); } 1356 #endif 1234 1357 1235 1358 inline bool lock_file_ex(void *hnd, unsigned long flags, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped *overlapped) 1236 1359 { return 0 != LockFileEx(hnd, flags, reserved, size_low, size_high, overlapped); } … … 1267 1390 { return LoadLibraryA(name); } 1268 1391 1269 1392 inline bool free_library(void *module) 1393 #ifdef BOOST_USE_WINDOWS_H 1394 { return 0 != FreeLibrary(static_cast<HMODULE>(module)); } 1395 #else 1270 1396 { return 0 != FreeLibrary(module); } 1397 #endif // #ifdef BOOST_USE_WINDOWS_H 1271 1398 1272 1399 inline void *get_proc_address(void *module, const char *name) 1400 #ifdef BOOST_USE_WINDOWS_H 1401 { return reinterpret_cast<void*>(GetProcAddress(static_cast<HMODULE>(module), name)); } 1402 #else 1273 1403 { return GetProcAddress(module, name); } 1404 #endif // #ifdef BOOST_USE_WINDOWS_H 1274 1405 1275 1406 inline void *get_current_process() 1276 1407 { return GetCurrentProcess(); } … … 1279 1410 { return GetModuleHandleA(name); } 1280 1411 1281 1412 inline long reg_open_key_ex(void *hKey, const char *lpSubKey, unsigned long ulOptions, unsigned long samDesired, void **phkResult) 1413 #ifdef BOOST_USE_WINDOWS_H 1414 { return RegOpenKeyExA(static_cast<HKEY>(hKey), lpSubKey, ulOptions, samDesired, reinterpret_cast<PHKEY>(phkResult)); } 1415 #else 1282 1416 { return RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, phkResult); } 1417 #endif // #ifdef BOOST_USE_WINDOWS_H 1283 1418 1284 1419 inline long reg_query_value_ex(void *hKey, const char *lpValueName, unsigned long*lpReserved, unsigned long*lpType, unsigned char *lpData, unsigned long*lpcbData) 1420 #ifdef BOOST_USE_WINDOWS_H 1421 { return RegQueryValueExA(static_cast<HKEY>(hKey), lpValueName, lpReserved, lpType, lpData, lpcbData); } 1422 #else 1285 1423 { return RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData); } 1424 #endif // #ifdef BOOST_USE_WINDOWS_H 1286 1425 1287 1426 inline long reg_close_key(void *hKey) 1427 #ifdef BOOST_USE_WINDOWS_H 1428 { return RegCloseKey(static_cast<HKEY>(hKey)); } 1429 #else 1288 1430 { return RegCloseKey(hKey); } 1431 #endif // #ifdef BOOST_USE_WINDOWS_H 1289 1432 1290 1433 inline void initialize_object_attributes 1291 1434 ( object_attributes_t *pobject_attr, unicode_string_t *name … … 1957 2100 if ( 0 == pClassObject->Get( L"LastBootUpTime", 0, &vwchar, 0, 0 ) ){ 1958 2101 bRet = true; 1959 2102 strValue = vwchar.value.pbstrVal; 2103 #ifdef BOOST_USE_WINDOWS_H 2104 VariantClear(reinterpret_cast<VARIANT*>(&vwchar)); 2105 #else 1960 2106 VariantClear(&vwchar ); 2107 #endif // #ifdef BOOST_USE_WINDOWS_H 1961 2108 break; 1962 2109 } 1963 2110 } -
boost/boost/interprocess/mapped_region.hpp
diff -r f8bde3457728 boost/boost/interprocess/mapped_region.hpp
a b 374 374 inline std::size_t mapped_region::page_size_holder<dummy>::get_page_size() 375 375 { 376 376 winapi::system_info info; 377 get_system_info(&info);377 winapi::get_system_info(&info); 378 378 return std::size_t(info.dwAllocationGranularity); 379 379 } 380 380