Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.

This commit is contained in:
Colin Finck 2017-10-03 07:45:34 +00:00
parent b94e2d8ca0
commit c2c66aff7d
24198 changed files with 0 additions and 37285 deletions

View file

@ -0,0 +1,13 @@
list(APPEND SOURCE
rtcapi.c
rtcuserapi.c
)
if(ARCH STREQUAL "i386")
list(APPEND ASM_SOURCE i386/_RTC_CheckEsp.S)
endif()
add_asm_files(runtmchk_asm ${ASM_SOURCE})
add_library(runtmchk ${SOURCE} ${runtmchk_asm})
add_dependencies(runtmchk asm)

View file

@ -0,0 +1,49 @@
/*
* PROJECT: MSVC runtime check support library
* LICENSE: BSD - See COPYING.ARM in the top level directory
* PURPOSE: Provides support functions for MSVC runtime checks
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#include <asm.inc>
.code
EXTERN __RTC_Failure:PROC
/*
This function is invoked like this:
mov esi, esp
// Do the actual function call
cmp esp, esi
call __RTC_CheckEsp
http://stackoverflow.com/questions/3914750/hows-rtc-checkesp-implemented
*/
PUBLIC __RTC_CheckEsp
__RTC_CheckEsp:
/* We check if the zero flag is set, and if it is, everything is fine
and we return to the caller */
je __RTC_CheckEsp_return
push ebp
mov ebp, esp
pusha
// void _RTC_Failure(void* retaddr, int errnum);
push 0 // errnum
push dword ptr [esp + 4] // retaddr
call __RTC_Failure
add esp, 8
popa
pop ebp
__RTC_CheckEsp_return:
ret
END

202
sdk/lib/runtmchk/rtcapi.c Normal file
View file

@ -0,0 +1,202 @@
/*
* PROJECT: MSVC runtime check support library
* LICENSE: BSD - See COPYING.ARM in the top level directory
* PURPOSE: Provides support functions for MSVC runtime checks
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#include <rtcapi.h>
#if defined(_M_IX86)
#pragma comment(linker, "/alternatename:__CRT_RTC_INITW=__CRT_RTC_INITW0")
#elif defined(_M_IA64) || defined(_M_AMD64) || defined(_M_ARM)
#pragma comment(linker, "/alternatename:_CRT_RTC_INITW=_CRT_RTC_INITW0")
#else
#error Unsupported platform
#endif
int
__cdecl
_RTC_DefaultErrorFuncW(
int errType,
const wchar_t *file,
int line,
const wchar_t *module,
const wchar_t *format,
...)
{
/* Simple fallback function */
__debugbreak();
return 0;
}
_RTC_error_fnW _RTC_pErrorFuncW = _RTC_DefaultErrorFuncW;
/*
Default CRT RTC init, if we don't link to CRT
*/
_RTC_error_fnW
__cdecl
_CRT_RTC_INITW0(
void *_Res0,
void **_Res1,
int _Res2,
int _Res3,
int _Res4)
{
return &_RTC_DefaultErrorFuncW;
}
void
__cdecl
_RTC_InitBase(void)
{
static char initialized = 0;
_RTC_error_fnW errorFunc;
if (!initialized)
{
errorFunc = _CRT_RTC_INITW(0, 0, 0, 1, 0);
_RTC_SetErrorFuncW(errorFunc);
initialized = 1;
}
}
void
__cdecl
_RTC_Shutdown(void)
{
__debugbreak();
}
void
__cdecl
_RTC_Initialize(void)
{
/* Usually this function would walk an array of function pointers and call
each of these, like done with global ctors, but since these are currently
only _RTC_InitBase, we simply call that function once. */
_RTC_InitBase();
}
void
__cdecl
_RTC_Failure(
void* retaddr,
int errnum)
{
_RTC_pErrorFuncW(errnum,
L"unknown file",
-1,
L"unknown module",
L"Invalid stack pointer value caught at %p, error %d\n",
retaddr,
errnum);
}
void
__cdecl
_RTC_UninitUse(
const char *_Varname)
{
_RTC_pErrorFuncW(_RTC_UNINIT_LOCAL_USE,
L"unknown file",
-1,
L"unknown module",
L"Use of uninitialized variable %S!\n",
_Varname);
}
void
__fastcall
_RTC_CheckStackVars(
void *_Esp,
_RTC_framedesc *_Fd)
{
int i, *guard1, *guard2;
/* Loop all variables in the descriptor */
for (i = 0; i < _Fd->varCount; i++)
{
/* Get the 2 guards below and above the variable */
guard1 = (int*)((char*)_Esp + _Fd->variables[i].addr - sizeof(*guard1));
guard2 = (int*)((char*)_Esp + _Fd->variables[i].addr +_Fd->variables[i].size);
/* Check if they contain the guard bytes */
if ((*guard1 != 0xCCCCCCCC) || (*guard2 != 0xCCCCCCCC))
{
_RTC_pErrorFuncW(_RTC_CORRUPT_STACK,
L"unknown file",
-1,
L"unknown module",
L"Stack corruption near '%s'\n",
_Fd->variables[i].name);
}
}
}
void
__fastcall
_RTC_CheckStackVars2(
void *_Esp,
_RTC_framedesc *_Fd,
_RTC_ALLOCA_NODE *_AllocaList)
{
_RTC_ALLOCA_NODE *current;
int *guard;
/* Process normal variables */
_RTC_CheckStackVars(_Esp, _Fd);
/* Process the alloca list */
for (current = _AllocaList; current != 0; current = current->next)
{
/* Get the upper guard */
guard = (int*)((char*)current + current->allocaSize - sizeof(*guard));
/* Check if all guard locations are still ok */
if ((current->guard1 != 0xCCCCCCCC) ||
(current->guard2[0] != 0xCCCCCCCC) ||
(current->guard2[1] != 0xCCCCCCCC) ||
(current->guard2[2] != 0xCCCCCCCC) ||
(*guard != 0xCCCCCCCC))
{
_RTC_pErrorFuncW(_RTC_CORRUPTED_ALLOCA,
L"unknown file",
-1,
L"unknown module",
L"Stack corruption in alloca frame\n");
}
}
}
void
__fastcall
_RTC_AllocaHelper(
_RTC_ALLOCA_NODE *_PAllocaBase,
size_t _CbSize,
_RTC_ALLOCA_NODE **_PAllocaInfoList)
{
unsigned long i;
/* Check if we got any allocation */
if ((_PAllocaBase != 0) &&
(_CbSize != 0) &&
(_PAllocaInfoList != 0))
{
/* Mark the whole range */
char *guard = (char*)_PAllocaBase;
for (i = 0; i < _CbSize; i++)
{
guard[i] = 0xCC;
}
/* Initialize the alloca base frame */
_PAllocaBase->allocaSize = _CbSize;
/* Insert this frame into the alloca list */
_PAllocaBase->next = *_PAllocaInfoList;
*_PAllocaInfoList = _PAllocaBase;
}
}

View file

@ -0,0 +1,91 @@
/*
* PROJECT: MSVC runtime check support library
* LICENSE: BSD - See COPYING.ARM in the top level directory
* PURPOSE: Provides support functions for MSVC runtime checks
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#include <rtcapi.h>
extern _RTC_error_fnW _RTC_pErrorFuncW;
int
__cdecl
_RTC_DefaultErrorFuncW(
int errType,
const wchar_t *file,
int line,
const wchar_t *module,
const wchar_t *format,
...);
static
char*
_RTC_ErrorDescription[] =
{
"The stack pointer was wrong after returning from a function call.", /* _RTC_CHKSTK */
"Data was lost when a type was converted to a smaller type.", /* _RTC_CVRT_LOSS_INFO */
"The stack near a local variable was corrupted.", /* _RTC_CORRUPT_STACK */
"An uninitialized local variable was used.", /* _RTC_UNINIT_LOCAL_USE */
"The stack around an alloca was corrupted.", /* _RTC_CORRUPTED_ALLOCA */
};
int
__cdecl
_RTC_NumErrors(void)
{
/* Not supported yet */
__debugbreak();
return 0;
}
const char *
__cdecl
_RTC_GetErrDesc(
_RTC_ErrorNumber _Errnum)
{
if (_Errnum < (sizeof(_RTC_ErrorDescription) / sizeof(_RTC_ErrorDescription[0])))
{
return _RTC_ErrorDescription[_Errnum];
}
return "Invalid/Unknown error.";
}
int
__cdecl
_RTC_SetErrorType(
_RTC_ErrorNumber _Errnum,
int _ErrType)
{
/* Not supported yet */
__debugbreak();
return 0;
}
_RTC_error_fn
__cdecl
_RTC_SetErrorFunc(
_RTC_error_fn new_fn)
{
/* Not supported yet */
__debugbreak();
return 0;
}
_RTC_error_fnW
__cdecl
_RTC_SetErrorFuncW(_RTC_error_fnW new_fn)
{
_RTC_error_fnW old_fn;
/* Get the current error func */
old_fn = _RTC_pErrorFuncW;
/* Set the new function or reset when 0 was passed */
_RTC_pErrorFuncW = new_fn ? new_fn : _RTC_DefaultErrorFuncW;
/* Return the old error func, or 0, if none was set */
return old_fn != _RTC_DefaultErrorFuncW ? old_fn : 0;
}