ReactOS 0.4.17-dev-470-gf9e3448
IsOS.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Tests for IsOS
5 * COPYRIGHT: Copyright 2026 Mohammad Amin Mollazadeh <madamin@pm.me>
6 */
7
8#include <apitest.h>
9#include <shlwapi.h>
10#include <versionhelpers.h>
11
12#ifndef OS_WIN32SORGREATER
13#define OS_WIN32SORGREATER 0x00
14#endif
15
16typedef struct
17{
21
23
25{
27 PFNISOS pIsOS;
28 size_t i;
29
30#define ISOS_ENTRY_LEVEL(level) { level, #level }
31 const ISOS_ENTRY FALSE_OS_Levels[] =
32 {
39 };
40
41 const ISOS_ENTRY TRUE_OS_Levels[] =
42 {
48 };
49#undef ISOS_ENTRY_LEVEL
50
51 hShlwapi = GetModuleHandleW(L"shlwapi.dll");
52 if (!hShlwapi)
53 {
54 skip(FALSE, "shlwapi.dll is not available\n");
55 return;
56 }
57
58 pIsOS = (PFNISOS)GetProcAddress(hShlwapi, "IsOS");
59 if (!pIsOS && !IsWindowsVistaOrGreater())
60 pIsOS = (PFNISOS)GetProcAddress(hShlwapi, (LPCSTR)437);
61 if (!pIsOS)
62 {
63 skip(FALSE, "IsOS is not available\n");
64 return;
65 }
66
67 for (i = 0; i < _countof(FALSE_OS_Levels); i++)
68 {
69 ok(pIsOS(FALSE_OS_Levels[i].Value) == FALSE, "Expected IsOS(%s) to return FALSE, got TRUE\n", FALSE_OS_Levels[i].Name);
70 }
71
72 for (i = 0; i < _countof(TRUE_OS_Levels); i++)
73 {
74 ok(pIsOS(TRUE_OS_Levels[i].Value) == TRUE, "Expected IsOS(%s) to return TRUE, got FALSE\n", TRUE_OS_Levels[i].Name);
75 }
76}
BOOL(WINAPI * PFNISOS)(DWORD)
Definition: IsOS.c:22
#define OS_WIN32SORGREATER
Definition: IsOS.c:13
#define ISOS_ENTRY_LEVEL(level)
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
static HMODULE hShlwapi
Definition: clsid.c:38
LPWSTR Name
Definition: desk.c:124
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
BOOL WINAPI IsOS(DWORD feature)
Definition: main.c:2392
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
#define OS_WIN98_GOLD
Definition: shlwapi.h:232
#define OS_WIN95ORGREATER
Definition: shlwapi.h:228
#define OS_WIN95_GOLD
Definition: shlwapi.h:242
#define OS_WIN98ORGREATER
Definition: shlwapi.h:231
#define OS_NT
Definition: shlwapi.h:227
#define OS_MEORGREATER
Definition: shlwapi.h:243
#define OS_XPORGREATER
Definition: shlwapi.h:244
#define OS_WIN2000ORGREATER
Definition: shlwapi.h:233
#define OS_NT4ORGREATER
Definition: shlwapi.h:229
#define OS_FASTUSERSWITCHING
Definition: shlwapi.h:252
#define _countof(array)
Definition: sndvol32.h:70
Definition: IsOS.c:17
PCSTR Name
Definition: IsOS.c:19
DWORD Value
Definition: IsOS.c:18
const char * LPCSTR
Definition: typedefs.h:52
const char * PCSTR
Definition: typedefs.h:52
VERSIONHELPERAPI IsWindowsVistaOrGreater()
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
#define WINAPI
Definition: msvc.h:6