StubExternalApi.cpp 3.9 KB

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