StubExternalApi.cpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Copyright (c) ChakraCore Project Contributors. All rights reserved.
  4. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  5. //-------------------------------------------------------------------------------------------------------
  6. #include "Common.h"
  7. #include "CommonInl.h" // TODO: Try to remove this later
  8. #include "Core/ConfigParser.h"
  9. bool ConfigParserAPI::FillConsoleTitle(__ecount(cchBufferSize) LPWSTR buffer, size_t cchBufferSize, _In_ LPWSTR moduleName)
  10. {
  11. swprintf_s(buffer, cchBufferSize, _u("Chakra GC: %lu - %s"), GetCurrentProcessId(), moduleName);
  12. return true;
  13. }
  14. void ConfigParserAPI::DisplayInitialOutput(_In_ LPWSTR moduleName)
  15. {
  16. Output::Print(_u("Chakra GC\n"));
  17. Output::Print(_u("INIT: PID : %d\n"), GetCurrentProcessId());
  18. Output::Print(_u("INIT: DLL Path : %s\n"), moduleName);
  19. }
  20. #if defined(ENABLE_JS_ETW) && !defined(ENABLE_JS_LTTNG)
  21. void EtwCallbackApi::OnSessionChange(ULONG /* controlCode */, PVOID /* callbackContext */)
  22. {
  23. // Does nothing
  24. }
  25. #endif
  26. // Include this file got get the default behavior for JsUtil::ExternalApi functions.
  27. void JsUtil::ExternalApi::RecoverUnusedMemory()
  28. {
  29. }
  30. bool JsUtil::ExternalApi::RaiseOutOfMemoryIfScriptActive()
  31. {
  32. return false;
  33. }
  34. bool JsUtil::ExternalApi::RaiseStackOverflowIfScriptActive(Js::ScriptContext * scriptContext, PVOID returnAddress)
  35. {
  36. return false;
  37. }
  38. ThreadContextId JsUtil::ExternalApi::GetCurrentThreadContextId()
  39. {
  40. return (ThreadContextId)::GetCurrentThreadId();
  41. }
  42. bool JsUtil::ExternalApi::RaiseOnIntOverflow()
  43. {
  44. return false;
  45. }
  46. LPCWSTR JsUtil::ExternalApi::GetFeatureKeyName()
  47. {
  48. return _u("Software\\Microsoft\\Internet Explorer\\ChakraRecycler");
  49. }
  50. #if DBG || defined(EXCEPTION_CHECK)
  51. BOOL JsUtil::ExternalApi::IsScriptActiveOnCurrentThreadContext()
  52. {
  53. return false;
  54. }
  55. #endif
  56. extern "C"
  57. {
  58. bool IsMessageBoxWPresent()
  59. {
  60. return true;
  61. }
  62. }
  63. bool GetDeviceFamilyInfo(
  64. _Out_opt_ ULONGLONG* /*pullUAPInfo*/,
  65. _Out_opt_ ULONG* /*pulDeviceFamily*/,
  66. _Out_opt_ ULONG* /*pulDeviceForm*/);
  67. void
  68. ChakraBinaryAutoSystemInfoInit(AutoSystemInfo * autoSystemInfo)
  69. {
  70. autoSystemInfo->shouldQCMoreFrequently = false;
  71. autoSystemInfo->supportsOnlyMultiThreadedCOM = false; //TODO: pick some other platform to the list
  72. autoSystemInfo->isLowMemoryDevice = false; //TODO: pick some other platform to the list
  73. }
  74. enum MemProtectHeapCollectFlags {};
  75. enum MemProtectHeapCreateFlags {};
  76. HRESULT MemProtectHeapCreate(void ** heapHandle, MemProtectHeapCreateFlags flags) { return E_NOTIMPL; };
  77. void * MemProtectHeapRootAlloc(void * heapHandle, size_t size) { return nullptr; };
  78. void * MemProtectHeapRootAllocLeaf(void * heapHandle, size_t size) { return nullptr; };
  79. HRESULT MemProtectHeapUnrootAndZero(void * heapHandle, void * memory) { return E_NOTIMPL; };
  80. HRESULT MemProtectHeapMemSize(void * heapHandle, void * memory, size_t * outSize) { return E_NOTIMPL; };
  81. HRESULT MemProtectHeapDestroy(void * heapHandle) { return E_NOTIMPL; };
  82. HRESULT MemProtectHeapCollect(void * heapHandle, MemProtectHeapCollectFlags flags) { return E_NOTIMPL; };
  83. HRESULT MemProtectHeapProtectCurrentThread(void * heapHandle, void(__stdcall* threadWake)(void* threadWakeArgument), void* threadWakeArgument) { return E_NOTIMPL; };
  84. HRESULT MemProtectHeapUnprotectCurrentThread(void * heapHandle) { return E_NOTIMPL; };
  85. HRESULT MemProtectHeapSynchronizeWithCollector(void * heapHandle) { return E_NOTIMPL; };
  86. #if DBG && defined(INTERNAL_MEM_PROTECT_HEAP_ALLOC)
  87. void MemProtectHeapSetDisableConcurrentThreadExitedCheck(void * heapHandle) {};
  88. #endif
  89. IMPLEMENT_STUB_IsLikelyRuntimeFalseReference()