Changeset View
Changeset View
Standalone View
Standalone View
lib/sanitizer_common/sanitizer_win.cc
Show All 16 Lines | |||||
#define WIN32_LEAN_AND_MEAN | #define WIN32_LEAN_AND_MEAN | ||||
#define NOGDI | #define NOGDI | ||||
#include <windows.h> | #include <windows.h> | ||||
#include <io.h> | #include <io.h> | ||||
#include <psapi.h> | #include <psapi.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
// #define needed to link in RtlGenRandom(), a.k.a. SystemFunction036. See the | |||||
// "Community Additions" comment on MSDN here: | |||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx | |||||
#define SystemFunction036 NTAPI SystemFunction036 | |||||
#include <NTSecAPI.h> | |||||
#undef SystemFunction036 | |||||
#include "sanitizer_common.h" | #include "sanitizer_common.h" | ||||
#include "sanitizer_dbghelp.h" | #include "sanitizer_dbghelp.h" | ||||
#include "sanitizer_file.h" | #include "sanitizer_file.h" | ||||
#include "sanitizer_libc.h" | #include "sanitizer_libc.h" | ||||
#include "sanitizer_mutex.h" | #include "sanitizer_mutex.h" | ||||
#include "sanitizer_placement_new.h" | #include "sanitizer_placement_new.h" | ||||
#include "sanitizer_stacktrace.h" | #include "sanitizer_stacktrace.h" | ||||
#include "sanitizer_symbolizer.h" | #include "sanitizer_symbolizer.h" | ||||
▲ Show 20 Lines • Show All 1,074 Lines • ▼ Show 20 Lines | |||||
// FIXME implement on this platform. | // FIXME implement on this platform. | ||||
void GetMemoryProfile(fill_profile_f cb, uptr *stats, uptr stats_size) { } | void GetMemoryProfile(fill_profile_f cb, uptr *stats, uptr stats_size) { } | ||||
void CheckNoDeepBind(const char *filename, int flag) { | void CheckNoDeepBind(const char *filename, int flag) { | ||||
// Do nothing. | // Do nothing. | ||||
} | } | ||||
// FIXME: implement on this platform. | # pragma comment(lib, "advapi32.lib") | ||||
bool GetRandom(void *buffer, uptr length, bool blocking) { | bool GetRandom(void *buffer, uptr length, bool blocking) { | ||||
UNIMPLEMENTED(); | if (!buffer || !length || length > 256) | ||||
return false; | |||||
return RtlGenRandom(buffer, length) != FALSE; | |||||
} | } | ||||
u32 GetNumberOfCPUs() { | u32 GetNumberOfCPUs() { | ||||
SYSTEM_INFO sysinfo = {0}; | SYSTEM_INFO sysinfo = {0}; | ||||
GetNativeSystemInfo(&sysinfo); | GetNativeSystemInfo(&sysinfo); | ||||
return sysinfo.dwNumberOfProcessors; | return sysinfo.dwNumberOfProcessors; | ||||
} | } | ||||
} // namespace __sanitizer | } // namespace __sanitizer | ||||
#endif // _WIN32 | #endif // _WIN32 |