[APPHELP][APPHELP_APITEST] Add SdbTagToString + test by Mislav Blažević CORE-10367
[reactos.git] / rostests / apitests / apphelp / apphelp.c
1 /*
2 * Copyright 2012 Detlef Riekenberg
3 * Copyright 2013 Mislav Bla\9eevic
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20
21 #include <ntstatus.h>
22 #define WIN32_NO_STATUS
23 #include <windows.h>
24 #include <shlwapi.h>
25 #include <winnt.h>
26 #ifdef __REACTOS__
27 #include <ntndk.h>
28 #else
29 #include <winternl.h>
30 #endif
31
32 #include <winerror.h>
33 #include <stdio.h>
34
35 #include "wine/test.h"
36
37
38 typedef WORD TAG;
39
40 #define TAG_TYPE_MASK 0xF000
41
42 #define TAG_TYPE_NULL 0x1000
43 #define TAG_TYPE_BYTE 0x2000
44 #define TAG_TYPE_WORD 0x3000
45 #define TAG_TYPE_DWORD 0x4000
46 #define TAG_TYPE_QWORD 0x5000
47 #define TAG_TYPE_STRINGREF 0x6000
48 #define TAG_TYPE_LIST 0x7000
49 #define TAG_TYPE_STRING 0x8000
50 #define TAG_TYPE_BINARY 0x9000
51
52
53 static HMODULE hdll;
54 static LPCWSTR (WINAPI *pSdbTagToString)(TAG);
55
56 static void test_SdbTagToString(void)
57 {
58 static const TAG invalid_values[] = {
59 1, TAG_TYPE_WORD, TAG_TYPE_MASK,
60 TAG_TYPE_DWORD | 0xFF,
61 TAG_TYPE_DWORD | (0x800 + 0xEE),
62 0x900, 0xFFFF, 0xDEAD, 0xBEEF
63 };
64 static const WCHAR invalid[] = {'I','n','v','a','l','i','d','T','a','g',0};
65 LPCWSTR ret;
66 WORD i;
67
68 for (i = 0; i < 9; ++i)
69 {
70 ret = pSdbTagToString(invalid_values[i]);
71 ok(lstrcmpW(ret, invalid) == 0, "unexpected string %s, should be %s\n",
72 wine_dbgstr_w(ret), wine_dbgstr_w(invalid));
73 }
74 }
75
76 START_TEST(apphelp)
77 {
78 hdll = LoadLibraryA("apphelp.dll");
79 pSdbTagToString = (void *) GetProcAddress(hdll, "SdbTagToString");
80 test_SdbTagToString();
81 }