ReactOS  0.4.15-dev-309-g7c8d563
mapi32_test.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static BOOL HaveDefaultMailClient (void)
 

Function Documentation

◆ HaveDefaultMailClient()

static BOOL HaveDefaultMailClient ( void  )
static

Definition at line 20 of file mapi32_test.h.

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
#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

Referenced by START_TEST().