Author: sginsberg
Date: Tue Sep 15 13:15:28 2015
New Revision: 69242
URL:
http://svn.reactos.org/svn/reactos?rev=69242&view=rev
Log:
Fix a load of assumptions about default calling convention, a lot more remain.
Modified:
trunk/reactos/base/services/svchost/svchost.c
trunk/reactos/base/system/smss/smss.c
trunk/reactos/boot/freeldr/fdebug/fdebug.c
trunk/reactos/include/crt/string.h
trunk/reactos/include/crt/time.h
trunk/reactos/include/psdk/winddi.h
trunk/reactos/lib/3rdparty/freetype/include/config/ftconfig.h
trunk/reactos/lib/sdk/crt/include/internal/mingw-w64/internal.h
trunk/reactos/lib/sdk/crt/startup/atonexit.c
trunk/reactos/lib/sdk/crt/startup/charmax.c
trunk/reactos/lib/sdk/crt/startup/crt0_w.c
trunk/reactos/lib/sdk/crt/startup/crt_handler.c
trunk/reactos/lib/sdk/crt/startup/crtdll.c
trunk/reactos/lib/sdk/crt/startup/crtexe.c
trunk/reactos/lib/sdk/crt/string/tcslen.h
trunk/reactos/lib/sdk/crt/string/tcsnlen.h
trunk/reactos/win32ss/gdi/gdi32/wine/rosglue.c
trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c
trunk/reactos/win32ss/pch.h
Modified: trunk/reactos/base/services/svchost/svchost.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/svchost/svch…
==============================================================================
--- trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -1243,6 +1243,7 @@
}
VOID
+__cdecl
wmainCRTStartup (
VOID
)
Modified: trunk/reactos/base/system/smss/smss.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/smss.c?re…
==============================================================================
--- trunk/reactos/base/system/smss/smss.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/smss/smss.c [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -445,6 +445,7 @@
}
NTSTATUS
+__cdecl
_main(IN INT argc,
IN PCHAR argv[],
IN PCHAR envp[],
Modified: trunk/reactos/boot/freeldr/fdebug/fdebug.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/fdebug/fdebug…
==============================================================================
--- trunk/reactos/boot/freeldr/fdebug/fdebug.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/fdebug/fdebug.c [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -37,7 +37,7 @@
LRESULT CALLBACK CaptureDialogProc(HWND, UINT, WPARAM, LPARAM);
VOID EnableFileMenuItemByID(UINT Id, BOOL Enable);
VOID CheckLocalEchoMenuItem(BOOL Checked);
-VOID Rs232Thread(VOID* Parameter);
+VOID __cdecl Rs232Thread(VOID* Parameter);
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
@@ -437,7 +437,7 @@
CheckMenuItem(hFileMenu, IDM_FILE_LOCALECHO, MF_BYCOMMAND|(Checked ? MF_CHECKED :
MF_UNCHECKED));
}
-VOID Rs232Thread(VOID* Parameter)
+VOID __cdecl Rs232Thread(VOID* Parameter)
{
BYTE Byte;
TCHAR String[MAX_PATH];
Modified: trunk/reactos/include/crt/string.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/string.h?rev=6…
==============================================================================
--- trunk/reactos/include/crt/string.h [iso-8859-1] (original)
+++ trunk/reactos/include/crt/string.h [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -672,6 +672,7 @@
_CRTIMP
wchar_t*
+ __cdecl
wcsncat(
wchar_t *_Dest,
const wchar_t *_Source,
Modified: trunk/reactos/include/crt/time.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/time.h?rev=692…
==============================================================================
--- trunk/reactos/include/crt/time.h [iso-8859-1] (original)
+++ trunk/reactos/include/crt/time.h [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -388,10 +388,10 @@
#ifdef _USE_32BIT_TIME_T
/* Do it like this to be compatible to msvcrt.dll on 32 bit windows XP and before */
__CRT_INLINE wchar_t *__cdecl _wctime32(const time_t *_Time) { return _wctime(_Time); }
-__CRT_INLINE errno_t _wctime32_s(wchar_t *_Buffer, size_t _SizeInWords,const __time32_t
*_Time) { return _wctime32_s(_Buffer, _SizeInWords, _Time); }
+__CRT_INLINE errno_t __cdecl _wctime32_s(wchar_t *_Buffer, size_t _SizeInWords,const
__time32_t *_Time) { return _wctime32_s(_Buffer, _SizeInWords, _Time); }
#else
__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); }
-__CRT_INLINE errno_t _wctime_s(wchar_t *_Buffer, size_t _SizeInWords,const time_t *_Time)
{ return _wctime64_s(_Buffer, _SizeInWords, _Time); }
+__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer, size_t _SizeInWords,const
time_t *_Time) { return _wctime64_s(_Buffer, _SizeInWords, _Time); }
#endif
#endif
Modified: trunk/reactos/include/psdk/winddi.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winddi.h?rev=…
==============================================================================
--- trunk/reactos/include/psdk/winddi.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/winddi.h [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -2450,7 +2450,7 @@
_In_ DWORD cjPrinterData);
#endif /* !USERMODE_DRIVER */
-typedef int (CDECL *SORTCOMP)(const void *pv1, const void *pv2);
+typedef int (__cdecl /*CDECL*/ *SORTCOMP)(const void *pv1, const void *pv2);
ENGAPI
VOID
Modified: trunk/reactos/lib/3rdparty/freetype/include/config/ftconfig.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/freetype/incl…
==============================================================================
--- trunk/reactos/lib/3rdparty/freetype/include/config/ftconfig.h [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/freetype/include/config/ftconfig.h [iso-8859-1] Tue Sep 15
13:15:28 2015
@@ -387,9 +387,9 @@
#ifndef FT_EXPORT
#ifdef __cplusplus
-#define FT_EXPORT( x ) extern "C" x
-#else
-#define FT_EXPORT( x ) extern x
+#define FT_EXPORT( x ) extern "C" x __cdecl
+#else
+#define FT_EXPORT( x ) extern x __cdecl
#endif
#endif /* !FT_EXPORT */
@@ -398,9 +398,9 @@
#ifndef FT_EXPORT_DEF
#ifdef __cplusplus
-#define FT_EXPORT_DEF( x ) extern "C" x
-#else
-#define FT_EXPORT_DEF( x ) extern x
+#define FT_EXPORT_DEF( x ) extern "C" x __cdecl
+#else
+#define FT_EXPORT_DEF( x ) extern x __cdecl
#endif
#endif /* !FT_EXPORT_DEF */
Modified: trunk/reactos/lib/sdk/crt/include/internal/mingw-w64/internal.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/include/intern…
==============================================================================
--- trunk/reactos/lib/sdk/crt/include/internal/mingw-w64/internal.h [iso-8859-1]
(original)
+++ trunk/reactos/lib/sdk/crt/include/internal/mingw-w64/internal.h [iso-8859-1] Tue Sep
15 13:15:28 2015
@@ -21,7 +21,7 @@
#ifdef __REACTOS__
#include "malloc.h"
struct _exception;
-__declspec(dllimport) void __setusermatherr(int (__cdecl *)(struct _exception *));
+__declspec(dllimport) void __cdecl __setusermatherr(int (__cdecl *)(struct _exception
*));
#define __mingw_fprintf fprintf
#define __mingw_vfprintf vfprintf
#endif
Modified: trunk/reactos/lib/sdk/crt/startup/atonexit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/startup/atonex…
==============================================================================
--- trunk/reactos/lib/sdk/crt/startup/atonexit.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/startup/atonexit.c [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -24,7 +24,7 @@
_PVFV *__onexitbegin;
_PVFV *__onexitend;
-extern _CRTIMP _onexit_t __dllonexit (_onexit_t, _PVFV**, _PVFV**);
+extern _CRTIMP _onexit_t __cdecl __dllonexit (_onexit_t, _PVFV**, _PVFV**);
extern _onexit_t (__cdecl * __MINGW_IMP_SYMBOL(_onexit)) (_onexit_t func);
/* Choose a different name to prevent name conflicts. The CRT one works fine. */
Modified: trunk/reactos/lib/sdk/crt/startup/charmax.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/startup/charma…
==============================================================================
--- trunk/reactos/lib/sdk/crt/startup/charmax.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/startup/charmax.c [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -7,13 +7,13 @@
#include <sect_attribs.h>
#include <internal.h>
-__declspec(dllimport) int __lconv_init (void);
+__declspec(dllimport) int __cdecl __lconv_init (void);
int mingw_initcharmax = 0;
int _charmax = 255;
-static int my_lconv_init(void)
+static int __cdecl my_lconv_init(void)
{
return __lconv_init();
}
Modified: trunk/reactos/lib/sdk/crt/startup/crt0_w.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/startup/crt0_w…
==============================================================================
--- trunk/reactos/lib/sdk/crt/startup/crt0_w.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/startup/crt0_w.c [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -14,10 +14,10 @@
extern LPWSTR __mingw_winmain_lpCmdLine;
extern DWORD __mingw_winmain_nShowCmd;
-int wmain (int, wchar_t **, wchar_t **);
+int __cdecl wmain (int, wchar_t **, wchar_t **);
/*ARGSUSED*/
-int wmain (int __UNUSED_PARAM(flags),
+int __cdecl wmain (int __UNUSED_PARAM(flags),
wchar_t ** __UNUSED_PARAM(cmdline),
wchar_t ** __UNUSED_PARAM(inst))
{
Modified: trunk/reactos/lib/sdk/crt/startup/crt_handler.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/startup/crt_ha…
==============================================================================
--- trunk/reactos/lib/sdk/crt/startup/crt_handler.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/startup/crt_handler.c [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -40,7 +40,7 @@
PBYTE _GetPEImageBase (void);
int __mingw_init_ehandler (void);
-extern void _fpreset (void);
+extern void __cdecl _fpreset (void);
#if defined(_WIN64) && !defined(_MSC_VER)
EXCEPTION_DISPOSITION __mingw_SEH_error_handler(struct _EXCEPTION_RECORD *, void *,
struct _CONTEXT *, void *);
@@ -90,7 +90,7 @@
return 1;
}
-extern void _fpreset (void);
+extern void __cdecl _fpreset (void);
EXCEPTION_DISPOSITION
__mingw_SEH_error_handler (struct _EXCEPTION_RECORD* ExceptionRecord,
Modified: trunk/reactos/lib/sdk/crt/startup/crtdll.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/startup/crtdll…
==============================================================================
--- trunk/reactos/lib/sdk/crt/startup/crtdll.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/startup/crtdll.c [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -54,11 +54,12 @@
extern WINBOOL WINAPI DllEntryPoint (HANDLE, DWORD, LPVOID);
-static int pre_c_init (void);
+static int __cdecl pre_c_init (void);
_CRTALLOC(".CRT$XIAA") _PIFV pcinit = pre_c_init;
static int
+__cdecl
pre_c_init (void)
{
_PVFV *onexitbegin;
Modified: trunk/reactos/lib/sdk/crt/startup/crtexe.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/startup/crtexe…
==============================================================================
--- trunk/reactos/lib/sdk/crt/startup/crtexe.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/startup/crtexe.c [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -39,7 +39,7 @@
/* This symbol is defined by ld. */
extern IMAGE_DOS_HEADER __ImageBase;
-extern void _fpreset (void);
+extern void __cdecl _fpreset (void);
#define SPACECHAR _T(' ')
#define DQUOTECHAR _T('\"')
@@ -147,11 +147,11 @@
#endif
}
-static int __tmainCRTStartup (void);
-
-int WinMainCRTStartup (void);
-
-int WinMainCRTStartup (void)
+static int __cdecl __tmainCRTStartup (void);
+
+int __cdecl WinMainCRTStartup (void);
+
+int __cdecl WinMainCRTStartup (void)
{
int ret = 255;
#ifdef __SEH__
@@ -173,13 +173,13 @@
return ret;
}
-int mainCRTStartup (void);
+int __cdecl mainCRTStartup (void);
#ifdef _WIN64
int __mingw_init_ehandler (void);
#endif
-int mainCRTStartup (void)
+int __cdecl mainCRTStartup (void)
{
int ret = 255;
#ifdef __SEH__
@@ -202,7 +202,8 @@
}
static
-__declspec(noinline) int
+__declspec(noinline)
+int __cdecl
__tmainCRTStartup (void)
{
_TCHAR *lpszCommandLine = NULL;
@@ -410,7 +411,7 @@
#else
#define __UNUSED_PARAM_1 __UNUSED_PARAM
#endif
-static void
+static void __cdecl
__mingw_invalidParameterHandler (const wchar_t * __UNUSED_PARAM_1(expression),
const wchar_t * __UNUSED_PARAM_1(function),
const wchar_t * __UNUSED_PARAM_1(file),
Modified: trunk/reactos/lib/sdk/crt/string/tcslen.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/tcslen.…
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/tcslen.h [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/string/tcslen.h [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -6,7 +6,7 @@
#pragma function(_tcslen)
#endif /* _MSC_VER */
-size_t _tcslen(const _TCHAR * str)
+size_t __cdecl _tcslen(const _TCHAR * str)
{
const _TCHAR * s;
Modified: trunk/reactos/lib/sdk/crt/string/tcsnlen.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/tcsnlen…
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/tcsnlen.h [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/string/tcsnlen.h [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -2,7 +2,7 @@
#include <stddef.h>
#include <tchar.h>
-size_t _tcsnlen(const _TCHAR * str, size_t count)
+size_t __cdecl _tcsnlen(const _TCHAR * str, size_t count)
{
const _TCHAR * s;
Modified: trunk/reactos/win32ss/gdi/gdi32/wine/rosglue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/wine/ros…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/wine/rosglue.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/wine/rosglue.c [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -511,6 +511,7 @@
}
void
+__cdecl
_assert (
const char *exp,
const char *file,
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -641,7 +641,7 @@
return(STATUS_VARIABLE_NOT_FOUND);
}
-static int
+static int __cdecl
DbgCompareChannels(const void * a, const void * b)
{
return wcscmp((WCHAR*)a, ((DBG_CHANNEL*)b)->Name);
Modified: trunk/reactos/win32ss/pch.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/pch.h?rev=69242&am…
==============================================================================
--- trunk/reactos/win32ss/pch.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/pch.h [iso-8859-1] Tue Sep 15 13:15:28 2015
@@ -42,6 +42,10 @@
#define _USE_MATH_DEFINES
#include <math.h>
#include <intrin.h>
+
+// Needed because windef.h messes up CDECL for whatever
+#undef CDECL
+#define CDECL __cdecl
/* Avoid type casting, by defining RECT to RECTL */
#define RECT RECTL