Ticket #11480: win32_api.hpp.patch
File win32_api.hpp.patch, 2.3 KB (added by , 6 years ago) |
---|
-
win32_api.hpp
26 26 #include <cstring> 27 27 #include <cstdlib> 28 28 #include <cstdio> 29 #include <ctime> 29 30 30 31 #include <boost/assert.hpp> 31 32 #include <string> … … 851 852 , interprocess_filetime *lpUserTime ); 852 853 extern "C" __declspec(dllimport) void __stdcall Sleep(unsigned long); 853 854 extern "C" __declspec(dllimport) unsigned long __stdcall GetTickCount(void); 855 extern "C" __declspec(dllimport) unsigned long long __stdcall GetTickCount64(void); 854 856 extern "C" __declspec(dllimport) int __stdcall SwitchToThread(); 855 857 extern "C" __declspec(dllimport) unsigned long __stdcall GetLastError(); 856 858 extern "C" __declspec(dllimport) void __stdcall SetLastError(unsigned long); … … 2208 2210 unsigned long dwBytesToRead = 0; 2209 2211 unsigned long dwBytesRead = 0; 2210 2212 unsigned long dwMinimumBytesToRead = 0; 2213 char stamp_str[sizeof(unsigned long long) * 3 + 1]; 2211 2214 2212 2215 // The source name (provider) must exist as a subkey of Application. 2213 2216 void *hEventLog = OpenEventLogA(0, source_name); … … 2239 2242 dwBytesToRead = dwMinimumBytesToRead; 2240 2243 heap_deleter.realloc_mem(dwMinimumBytesToRead); 2241 2244 if (!heap_deleter.get()){ 2242 return false;2245 break; 2243 2246 } 2244 2247 } 2245 2248 else{ //Not found or EOF 2246 return false;2249 break; 2247 2250 } 2248 2251 } 2249 2252 else … … 2251 2254 interprocess_eventlogrecord *pTypedRecord; 2252 2255 // Print the contents of each record in the buffer. 2253 2256 if(find_record_in_buffer(heap_deleter.get(), dwBytesRead, provider_name, event_id, pTypedRecord)){ 2254 char stamp_str[sizeof(unsigned long)*3+1];2255 2257 std::sprintf(&stamp_str[0], "%u", ((unsigned int)pTypedRecord->TimeGenerated)); 2256 2258 stamp = stamp_str; 2257 break;2259 return true; 2258 2260 } 2259 2261 } 2260 2262 } 2261 2263 } 2262 2264 } 2265 2266 std::sprintf(&stamp_str[0], "%llu", std::time(nullptr) - GetTickCount64() / 1000); // Seconds since 1-1-1970 2267 stamp = stamp_str; 2263 2268 return true; 2264 2269 } 2265 2270