ReactOS  0.4.15-dev-341-g17c5fb8
mapi32_test.h
Go to the documentation of this file.
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with this library; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15  */
16 
17 /*
18  * Return FALSE if no default mail client is installed.
19  */
21 {
22  HKEY Key;
23  DWORD Type, Size;
24  BYTE Buffer[64];
25  BOOL HasHKCUKey;
26 
27  /* We check the default value of both HKCU\Software\Clients\Mail and
28  * HKLM\Software\Clients\Mail, if one of them is present there is a default
29  * mail client. If neither of these keys is present, we might be running
30  * on an old Windows version (W95, NT4) and we assume a default mail client
31  * might be available. Only if one of the keys is present, but there is
32  * no default value do we assume there is no default client. */
33  if (RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Clients\\Mail", 0, KEY_QUERY_VALUE, &Key) == ERROR_SUCCESS)
34  {
35  Size = sizeof(Buffer);
36  /* Any return value besides ERROR_FILE_NOT_FOUND (including success,
37  ERROR_MORE_DATA) indicates the value is present */
39  {
41  return TRUE;
42  }
44  HasHKCUKey = TRUE;
45  }
46  else
47  HasHKCUKey = FALSE;
48 
49  if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Clients\\Mail", 0, KEY_QUERY_VALUE, &Key) == ERROR_SUCCESS)
50  {
51  Size = sizeof(Buffer);
53  {
55  return TRUE;
56  }
58  return FALSE;
59  }
60 
61  return ! HasHKCUKey;
62 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
#define TRUE
Definition: types.h:120
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG Key
Definition: fatprocs.h:2697
Type
Definition: Type.h:6
#define ERROR_SUCCESS
Definition: deptool.c:10
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
unsigned char BYTE
Definition: xxhash.c:193
static BOOL HaveDefaultMailClient(void)
Definition: mapi32_test.h:20
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12