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
16
typedef
struct
17
{
18
DWORD
Value
;
19
PCSTR
Name
;
20
}
ISOS_ENTRY
;
21
22
typedef
BOOL
(
WINAPI
*
PFNISOS
)(
DWORD
);
23
24
START_TEST
(
IsOS
)
25
{
26
HMODULE
hShlwapi
;
27
PFNISOS
pIsOS;
28
size_t
i
;
29
30
#define ISOS_ENTRY_LEVEL(level) { level, #level }
31
const
ISOS_ENTRY
FALSE_OS_Levels[] =
32
{
33
ISOS_ENTRY_LEVEL
(
OS_WIN32SORGREATER
),
34
ISOS_ENTRY_LEVEL
(
OS_WIN95ORGREATER
),
35
ISOS_ENTRY_LEVEL
(
OS_WIN98ORGREATER
),
36
ISOS_ENTRY_LEVEL
(
OS_MEORGREATER
),
37
ISOS_ENTRY_LEVEL
(
OS_WIN95_GOLD
),
38
ISOS_ENTRY_LEVEL
(
OS_WIN98_GOLD
),
39
};
40
41
const
ISOS_ENTRY
TRUE_OS_Levels[] =
42
{
43
ISOS_ENTRY_LEVEL
(
OS_NT
),
44
ISOS_ENTRY_LEVEL
(
OS_NT4ORGREATER
),
45
ISOS_ENTRY_LEVEL
(
OS_WIN2000ORGREATER
),
46
ISOS_ENTRY_LEVEL
(
OS_XPORGREATER
),
47
ISOS_ENTRY_LEVEL
(
OS_FASTUSERSWITCHING
),
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
}
PFNISOS
BOOL(WINAPI * PFNISOS)(DWORD)
Definition:
IsOS.c:22
OS_WIN32SORGREATER
#define OS_WIN32SORGREATER
Definition:
IsOS.c:13
ISOS_ENTRY_LEVEL
#define ISOS_ENTRY_LEVEL(level)
apitest.h
ok
#define ok(value,...)
Definition:
atltest.h:57
skip
#define skip(...)
Definition:
atltest.h:64
START_TEST
#define START_TEST(x)
Definition:
atltest.h:75
hShlwapi
static HMODULE hShlwapi
Definition:
clsid.c:38
Name
LPWSTR Name
Definition:
desk.c:124
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
GetProcAddress
#define GetProcAddress(x, y)
Definition:
compat.h:753
GetModuleHandleW
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition:
loader.c:838
IsOS
BOOL WINAPI IsOS(DWORD feature)
Definition:
main.c:2392
L
#define L(x)
Definition:
resources.c:13
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
i
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
void
Definition:
nsiface.idl:2307
BOOL
#define BOOL
Definition:
nt_native.h:43
DWORD
#define DWORD
Definition:
nt_native.h:44
OS_WIN98_GOLD
#define OS_WIN98_GOLD
Definition:
shlwapi.h:232
OS_WIN95ORGREATER
#define OS_WIN95ORGREATER
Definition:
shlwapi.h:228
OS_WIN95_GOLD
#define OS_WIN95_GOLD
Definition:
shlwapi.h:242
OS_WIN98ORGREATER
#define OS_WIN98ORGREATER
Definition:
shlwapi.h:231
OS_NT
#define OS_NT
Definition:
shlwapi.h:227
OS_MEORGREATER
#define OS_MEORGREATER
Definition:
shlwapi.h:243
OS_XPORGREATER
#define OS_XPORGREATER
Definition:
shlwapi.h:244
OS_WIN2000ORGREATER
#define OS_WIN2000ORGREATER
Definition:
shlwapi.h:233
OS_NT4ORGREATER
#define OS_NT4ORGREATER
Definition:
shlwapi.h:229
OS_FASTUSERSWITCHING
#define OS_FASTUSERSWITCHING
Definition:
shlwapi.h:252
_countof
#define _countof(array)
Definition:
sndvol32.h:70
ISOS_ENTRY
Definition:
IsOS.c:17
ISOS_ENTRY::Name
PCSTR Name
Definition:
IsOS.c:19
ISOS_ENTRY::Value
DWORD Value
Definition:
IsOS.c:18
LPCSTR
const char * LPCSTR
Definition:
typedefs.h:52
PCSTR
const char * PCSTR
Definition:
typedefs.h:52
versionhelpers.h
IsWindowsVistaOrGreater
VERSIONHELPERAPI IsWindowsVistaOrGreater()
Definition:
versionhelpers.h:70
Value
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition:
wdfregistry.h:413
WINAPI
#define WINAPI
Definition:
msvc.h:6
modules
rostests
apitests
shlwapi
IsOS.c
Generated on Sun Jul 12 2026 06:10:33 for ReactOS by
1.9.6