1313#include <ndk/mmfuncs.h>
1414#include <ndk/rtlfuncs.h>
1515
16+ #ifndef TEST_STATIC_CRT
17+
18+ static PFN_sntprintf p_sntprintf ;
19+
20+ static BOOL Init (void )
21+ {
22+ HMODULE hdll = LoadLibraryA (TEST_DLL_NAME );
23+ p_sntprintf = (PFN_sntprintf )GetProcAddress (hdll , str_sntprintf );
24+ ok (p_sntprintf != NULL , "Failed to load %s from %s\n" , str_sntprintf , TEST_DLL_NAME );
25+ return (p_sntprintf != NULL );
26+ }
27+
28+ #undef _sntprintf
29+ #define _sntprintf p_sntprintf
30+
31+ #endif // !TEST_STATIC_CRT
32+
1633/* winetest_platform is "windows" for us, so broken() doesn't do what it should :( */
1734#undef broken
1835#define broken (x ) 0
@@ -23,6 +40,14 @@ START_TEST(_sntprintf)
2340 size_t BufferSize = sizeof (Buffer ) / sizeof (Buffer [0 ]);
2441 int Result ;
2542
43+ #ifndef TEST_STATIC_CRT
44+ if (!Init ())
45+ {
46+ skip ("Skipping tests, because %s is not available\n" , str_sntprintf );
47+ return ;
48+ }
49+ #endif
50+
2651 StartSeh ()
2752 Result = _sntprintf (NULL , 0 , _T ("Hello" ));
2853#ifdef TEST_CRTDLL
@@ -35,7 +60,9 @@ START_TEST(_sntprintf)
3560 StartSeh ()
3661 Result = _sntprintf (NULL , 1 , _T ("Hello" ));
3762 ok_int (Result , (GetNTVersion () >= _WIN32_WINNT_VISTA ) ? -1 : 5 );
38- #if defined(_UNICODE ) || defined(TEST_CRTDLL )
63+ #if defined(TEST_CRTDLL )
64+ EndSeh (STATUS_ACCESS_VIOLATION );
65+ #elif defined(_UNICODE )
3966 EndSeh ((GetNTVersion () >= _WIN32_WINNT_VISTA ) ? 0 : STATUS_ACCESS_VIOLATION );
4067#else
4168 EndSeh (STATUS_SUCCESS );
0 commit comments