2 * PROJECT: ReactOS API tests
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Tests for the RtlGetNtProductType API
5 * COPYRIGHT: Copyright 2020 Bișoc George <fraizeraust99 at gmail dot com>
14 ReturnNtProduct(PDWORD ProductNtType
)
19 DWORD Size
= sizeof(Data
);
21 Result
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
,
22 L
"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
26 if (Result
!= ERROR_SUCCESS
)
32 Result
= RegQueryValueExW(Key
,
38 if (Result
!= ERROR_SUCCESS
)
45 if (wcscmp(Data
, L
"WinNT") == 0)
47 *ProductNtType
= NtProductWinNt
;
52 if (wcscmp(Data
, L
"LanmanNT") == 0)
54 *ProductNtType
= NtProductLanManNt
;
59 if (wcscmp(Data
, L
"ServerNT") == 0)
61 *ProductNtType
= NtProductServer
;
71 START_TEST(RtlGetNtProductType
)
75 NT_PRODUCT_TYPE ProductType
= NtProductWinNt
;
78 * Wrap the call in SEH. This ensures the testcase won't crash but also
79 * it proves to us that RtlGetNtProductType() throws an exception if a NULL
80 * argument is being passed to caller as output.
83 RtlGetNtProductType(NULL
);
84 EndSeh(STATUS_ACCESS_VIOLATION
);
86 /* Query the product type normally from the Registry */
87 Ret
= ReturnNtProduct(&ProductNtType
);
90 ok(Ret
, "Failed to query the product type value!\n");
93 /* Now, get the product type from the NTDLL system call */
94 Ret
= RtlGetNtProductType(&ProductType
);
95 ok(Ret
== TRUE
, "Expected a valid product type value (and TRUE as returned success code) but got %u as status.\n", Ret
);
96 ok(ProductNtType
== ProductType
, "Expected the product type value to be the same but got %lu (original value pointed by RtlGetNtProductType() is %d).\n", ProductNtType
, ProductType
);