crt: tests: update t_pow

This test has a few issues:

1. It calls `atoi`, but does not include stdlib.h.

2. typedef for `pow` is missing `__cdecl`; this would result in compilation
  error on i386 as all CRT functions have __cdecl calling convention.

3. `set_pow_msvcrt` does not check whether it was able to load `msvcrt.dll` and
  whether pointer returned by `GetProcAddress` is non-NULL; either could result
  in memory access violation. Also note that msvcrt.dll is not available on
  Windows NT 3.1 and Windows 95.

In order to fix these:

1. Include stdlib.h.

2. Add `__cdecl` to typedef for `pow`.

3. Instead of loading msvcrt.dll with `LoadLibrary`, call `GetModuleHandle` to
  obtain handle of CRT the test is linked against and check if it is non-NULL.
  If returned handle is non-NULL, check whether pointer returned by
  `GetProcAddress` is non-NULL as well.

4. Test CRT's `pow` only if we successfully obtained its address; otherwise
  simply skip this subtest.

Add t_pow to testcases/Makefile.am.

Signed-off-by: Kirill Makurin <maiddaisuki@outlook.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2 files changed