summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/import/src/MapiMimeTypes.h
blob: d87089355998f0c138566d0f702e6c0670d01c45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef MapiMimeTypes_h___
#define MapiMimeTypes_h___

#include <windows.h>

#define kMaxMimeTypeSize 256

class CMimeTypes {
 public:
  static uint8_t* GetMimeType(const nsString& theExt);

 protected:
  // Registry stuff
  static BOOL GetKey(HKEY root, LPCWSTR pName, PHKEY pKey);
  static BOOL GetValueBytes(HKEY rootKey, LPCWSTR pValName, LPBYTE* ppBytes);
  static void ReleaseValueBytes(LPBYTE pBytes);
  static BOOL GetMimeTypeFromReg(const nsString& ext, LPBYTE* ppBytes);

  static uint8_t m_mimeBuffer[kMaxMimeTypeSize];
};

#endif /* MapiMimeTypes_h__ */