ReactOS  0.4.13-dev-249-gcba1a2f
util.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "winerror.h"
#include "winternl.h"
#include "objbase.h"
#include "shlwapi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "mapival.h"
#include "xcmc.h"
#include "msi.h"
#include "util.h"
Include dependency graph for util.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Typedefs

typedef LPVOIDLPMAPIALLOCBUFFER
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (mapi)
 
SCODE WINAPI ScInitMapiUtil (ULONG ulReserved)
 
VOID WINAPI DeinitMapiUtil (void)
 
SCODE WINAPI MAPIAllocateBuffer (ULONG cbSize, LPVOID *lppBuffer)
 
SCODE WINAPI MAPIAllocateMore (ULONG cbSize, LPVOID lpOrig, LPVOID *lppBuffer)
 
ULONG WINAPI MAPIFreeBuffer (LPVOID lpBuffer)
 
HRESULT WINAPI WrapProgress (PVOID unk1, PVOID unk2, PVOID unk3, PVOID unk4, PVOID unk5)
 
HRESULT WINAPI HrDispatchNotifications (ULONG flags)
 
HRESULT WINAPI HrThisThreadAdviseSink (LPMAPIADVISESINK lpSink, LPMAPIADVISESINK *lppNewSink)
 
BOOL WINAPI FBinFromHex (LPWSTR lpszHex, LPBYTE lpOut)
 
void WINAPI HexFromBin (LPBYTE lpHex, int iCount, LPWSTR lpszOut)
 
VOID WINAPI SwapPlong (PULONG lpData, ULONG ulLen)
 
VOID WINAPI SwapPword (PUSHORT lpData, ULONG ulLen)
 
ULONG WINAPI MNLS_lstrlenW (LPCWSTR lpszStr)
 
INT WINAPI MNLS_lstrcmpW (LPCWSTR lpszLeft, LPCWSTR lpszRight)
 
ULONG WINAPI MNLS_lstrcpyW (LPWSTR lpszDest, LPCWSTR lpszSrc)
 
INT WINAPI MNLS_CompareStringW (DWORD dwCp, LPCWSTR lpszLeft, LPCWSTR lpszRight)
 
BOOL WINAPI FEqualNames (LPMAPINAMEID lpName1, LPMAPINAMEID lpName2)
 
BOOL WINAPI IsBadBoundedStringPtr (LPCSTR lpszStr, ULONG ulLen)
 
LONGLONG WINAPI MAPI32_FtAddFt (FILETIME ftLeft, FILETIME ftRight)
 
LONGLONG WINAPI MAPI32_FtSubFt (FILETIME ftLeft, FILETIME ftRight)
 
LONGLONG WINAPI MAPI32_FtMulDw (DWORD dwLeft, FILETIME ftRight)
 
LONGLONG WINAPI MAPI32_FtMulDwDw (DWORD dwLeft, DWORD dwRight)
 
LONGLONG WINAPI MAPI32_FtNegFt (FILETIME ft)
 
ULONG WINAPI UlAddRef (void *lpUnk)
 
ULONG WINAPI UlRelease (void *lpUnk)
 
UINT WINAPI UFromSz (LPCSTR lpszStr)
 
HRESULT WINAPI OpenStreamOnFile (LPALLOCATEBUFFER lpAlloc, LPFREEBUFFER lpFree, ULONG ulFlags, LPWSTR lpszPath, LPWSTR lpszPrefix, LPSTREAM *lppStream)
 
ULONG WINAPI UlFromSzHex (LPCWSTR lpszHex)
 
BOOL WINAPI FBadEntryList (LPENTRYLIST lpEntryList)
 
ULONG WINAPI CbOfEncoded (LPCSTR lpszEnc)
 
CMC_return_code WINAPI cmc_query_configuration (CMC_session_id session, CMC_enum item, CMC_buffer reference, CMC_extension *config_extensions)
 
BOOL WINAPI FGetComponentPath (LPCSTR component, LPCSTR qualifier, LPSTR dll_path, DWORD dll_path_length, BOOL install)
 
HRESULT WINAPI HrQueryAllRows (LPMAPITABLE lpTable, LPSPropTagArray lpPropTags, LPSRestriction lpRestriction, LPSSortOrderSet lpSortOrderSet, LONG crowsMax, LPSRowSet *lppRows)
 
HRESULT WINAPI WrapCompressedRTFStream (LPSTREAM compressed, ULONG flags, LPSTREAM *uncompressed)
 
static void load_mapi_provider (HKEY hkeyMail, LPCWSTR valueName, HMODULE *mapi_provider)
 
void load_mapi_providers (void)
 
void unload_mapi_providers (void)
 

Variables

static const BYTE digitsToHex []
 
MAPI_FUNCTIONS mapiFunctions
 
static HMODULE mapi_provider
 
static HMODULE mapi_ex_provider
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file util.c.

Typedef Documentation

◆ LPMAPIALLOCBUFFER

Definition at line 102 of file util.c.

Function Documentation

◆ CbOfEncoded()

ULONG WINAPI CbOfEncoded ( LPCSTR  lpszEnc)

Definition at line 824 of file util.c.

825 {
826  ULONG ulRet = 0;
827 
828  TRACE("(%s)\n", debugstr_a(lpszEnc));
829 
830  if (lpszEnc)
831  ulRet = (((strlen(lpszEnc) | 3) >> 2) + 1) * 3;
832  return ulRet;
833 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned int ULONG
Definition: retypes.h:1

◆ cmc_query_configuration()

CMC_return_code WINAPI cmc_query_configuration ( CMC_session_id  session,
CMC_enum  item,
CMC_buffer  reference,
CMC_extension config_extensions 
)

Definition at line 850 of file util.c.

855 {
856  FIXME("stub\n");
857  return CMC_E_NOT_SUPPORTED;
858 }
#define CMC_E_NOT_SUPPORTED
Definition: xcmc.h:67
#define FIXME(fmt,...)
Definition: debug.h:110

◆ DeinitMapiUtil()

VOID WINAPI DeinitMapiUtil ( void  )

Definition at line 94 of file util.c.

95 {
96  if (mapiFunctions.DeinitMapiUtil)
97  mapiFunctions.DeinitMapiUtil();
98  else
99  FIXME("()stub!\n");
100 }
#define FIXME(fmt,...)
Definition: debug.h:110
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50

◆ FBadEntryList()

BOOL WINAPI FBadEntryList ( LPENTRYLIST  lpEntryList)

Definition at line 797 of file util.c.

798 {
799  ULONG i;
800 
801  if (IsBadReadPtr(lpEntryList, sizeof(*lpEntryList)) ||
802  IsBadReadPtr(lpEntryList->lpbin,
803  lpEntryList->cValues * sizeof(*lpEntryList->lpbin)))
804  return TRUE;
805 
806  for (i = 0; i < lpEntryList->cValues; i++)
807  if(IsBadReadPtr(lpEntryList->lpbin[i].lpb, lpEntryList->lpbin[i].cb))
808  return TRUE;
809 
810  return FALSE;
811 }
#define TRUE
Definition: types.h:120
ULONG cValues
Definition: mapidefs.h:296
ULONG cb
Definition: mapidefs.h:289
SBinary * lpbin
Definition: mapidefs.h:297
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LPBYTE lpb
Definition: mapidefs.h:290
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:807
unsigned int ULONG
Definition: retypes.h:1

Referenced by FBadProp().

◆ FBinFromHex()

BOOL WINAPI FBinFromHex ( LPWSTR  lpszHex,
LPBYTE  lpOut 
)

Definition at line 299 of file util.c.

300 {
301  LPSTR lpStr = (LPSTR)lpszHex;
302 
303  TRACE("(%p,%p)\n", lpszHex, lpOut);
304 
305  while (*lpStr)
306  {
307  if (lpStr[0] < '0' || lpStr[0] > 'f' || digitsToHex[lpStr[0] - '0'] == 0xff ||
308  lpStr[1] < '0' || lpStr[1] > 'f' || digitsToHex[lpStr[1] - '0'] == 0xff)
309  return FALSE;
310 
311  *lpOut++ = (digitsToHex[lpStr[0] - '0'] << 4) | digitsToHex[lpStr[1] - '0'];
312  lpStr += 2;
313  }
314  return TRUE;
315 }
#define TRUE
Definition: types.h:120
char * LPSTR
Definition: xmlstorage.h:182
#define TRACE(s)
Definition: solgame.cpp:4
static const BYTE digitsToHex[]
Definition: util.c:44

◆ FEqualNames()

BOOL WINAPI FEqualNames ( LPMAPINAMEID  lpName1,
LPMAPINAMEID  lpName2 
)

Definition at line 487 of file util.c.

488 {
489  TRACE("(%p,%p)\n", lpName1, lpName2);
490 
491  if (!lpName1 || !lpName2 ||
492  !IsEqualGUID(lpName1->lpguid, lpName2->lpguid) ||
493  lpName1->ulKind != lpName2->ulKind)
494  return FALSE;
495 
496  if (lpName1->ulKind == MNID_STRING)
497  return !strcmpW(lpName1->Kind.lpwstrName, lpName2->Kind.lpwstrName);
498 
499  return lpName1->Kind.lID == lpName2->Kind.lID;
500 }
ULONG ulKind
Definition: mapidefs.h:643
LPGUID lpguid
Definition: mapidefs.h:642
#define TRACE(s)
Definition: solgame.cpp:4
LONG lID
Definition: mapidefs.h:646
LPWSTR lpwstrName
Definition: mapidefs.h:647
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
union _MAPINAMEID::@2899 Kind
#define MNID_STRING
Definition: mapidefs.h:638

◆ FGetComponentPath()

BOOL WINAPI FGetComponentPath ( LPCSTR  component,
LPCSTR  qualifier,
LPSTR  dll_path,
DWORD  dll_path_length,
BOOL  install 
)

Definition at line 881 of file util.c.

883 {
884  BOOL ret = FALSE;
885  HMODULE hmsi;
886 
887  TRACE("%s %s %p %u %d\n", component, qualifier, dll_path, dll_path_length, install);
888 
889  if (mapiFunctions.FGetComponentPath)
890  return mapiFunctions.FGetComponentPath(component, qualifier, dll_path, dll_path_length, install);
891 
892  dll_path[0] = 0;
893 
894  hmsi = LoadLibraryA("msi.dll");
895  if (hmsi)
896  {
897  UINT (WINAPI *pMsiProvideQualifiedComponentA)(LPCSTR, LPCSTR, DWORD, LPSTR, LPDWORD);
898 
899  pMsiProvideQualifiedComponentA = (void *)GetProcAddress(hmsi, "MsiProvideQualifiedComponentA");
900  if (pMsiProvideQualifiedComponentA)
901  {
902  static const char * const fmt[] = { "%d\\NT", "%d\\95", "%d" };
903  char lcid_ver[20];
904  UINT i;
905 
906  for (i = 0; i < ARRAY_SIZE(fmt); i++)
907  {
908  /* FIXME: what's the correct behaviour here? */
909  if (!qualifier || qualifier == lcid_ver)
910  {
911  sprintf(lcid_ver, fmt[i], GetUserDefaultUILanguage());
912  qualifier = lcid_ver;
913  }
914 
915  if (pMsiProvideQualifiedComponentA(component, qualifier,
917  dll_path, &dll_path_length) == ERROR_SUCCESS)
918  {
919  ret = TRUE;
920  break;
921  }
922 
923  if (qualifier != lcid_ver) break;
924  }
925  }
926  FreeLibrary(hmsi);
927  }
928  return ret;
929 }
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: lang.c:806
#define TRUE
Definition: types.h:120
static AsnOctetString UINT
Definition: util.c:31
#define ERROR_SUCCESS
Definition: deptool.c:10
int install
Definition: msacm.c:1353
char * LPSTR
Definition: xmlstorage.h:182
#define DWORD
Definition: nt_native.h:44
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:74
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:405
#define WINAPI
Definition: msvc.h:8
int ret
#define LPDWORD
Definition: nt_native.h:46
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50
#define ARRAY_SIZE(a)
Definition: main.h:24
unsigned int UINT
Definition: ndis.h:50
#define GetProcAddress(x, y)
Definition: compat.h:410
Definition: dsound.c:943

◆ HexFromBin()

void WINAPI HexFromBin ( LPBYTE  lpHex,
int  iCount,
LPWSTR  lpszOut 
)

Definition at line 337 of file util.c.

338 {
339  static const char hexDigits[] = { "0123456789ABCDEF" };
340  LPSTR lpStr = (LPSTR)lpszOut;
341 
342  TRACE("(%p,%d,%p)\n", lpHex, iCount, lpszOut);
343 
344  while (iCount-- > 0)
345  {
346  *lpStr++ = hexDigits[*lpHex >> 4];
347  *lpStr++ = hexDigits[*lpHex & 0xf];
348  lpHex++;
349  }
350  *lpStr = '\0';
351 }
char * LPSTR
Definition: xmlstorage.h:182
static const CHAR hexDigits[]
Definition: url.c:109
#define TRACE(s)
Definition: solgame.cpp:4

◆ HrDispatchNotifications()

HRESULT WINAPI HrDispatchNotifications ( ULONG  flags)

Definition at line 244 of file util.c.

245 {
246  FIXME("(%08x)\n", flags);
247  return S_OK;
248 }
#define FIXME(fmt,...)
Definition: debug.h:110
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:59

◆ HrQueryAllRows()

HRESULT WINAPI HrQueryAllRows ( LPMAPITABLE  lpTable,
LPSPropTagArray  lpPropTags,
LPSRestriction  lpRestriction,
LPSSortOrderSet  lpSortOrderSet,
LONG  crowsMax,
LPSRowSet lppRows 
)

Definition at line 934 of file util.c.

937 {
938  if (mapiFunctions.HrQueryAllRows)
939  return mapiFunctions.HrQueryAllRows(lpTable, lpPropTags, lpRestriction, lpSortOrderSet, crowsMax, lppRows);
940 
941  FIXME("(%p, %p, %p, %p, %d, %p): stub\n", lpTable, lpPropTags, lpRestriction, lpSortOrderSet, crowsMax, lppRows);
942  *lppRows = NULL;
943  return MAPI_E_CALL_FAILED;
944 }
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50
#define MAPI_E_CALL_FAILED
Definition: mapicode.h:43

◆ HrThisThreadAdviseSink()

HRESULT WINAPI HrThisThreadAdviseSink ( LPMAPIADVISESINK  lpSink,
LPMAPIADVISESINK lppNewSink 
)

Definition at line 263 of file util.c.

264 {
265  if (mapiFunctions.HrThisThreadAdviseSink)
266  return mapiFunctions.HrThisThreadAdviseSink(lpSink, lppNewSink);
267 
268  FIXME("(%p,%p)semi-stub\n", lpSink, lppNewSink);
269 
270  if (!lpSink || !lppNewSink)
271  return E_INVALIDARG;
272 
273  /* Don't wrap the sink for now, just copy it */
274  *lppNewSink = lpSink;
275  IMAPIAdviseSink_AddRef(lpSink);
276  return S_OK;
277 }
#define IMAPIAdviseSink_AddRef(p)
Definition: mapidefs.h:860
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50
#define S_OK
Definition: intsafe.h:59

◆ IsBadBoundedStringPtr()

BOOL WINAPI IsBadBoundedStringPtr ( LPCSTR  lpszStr,
ULONG  ulLen 
)

Definition at line 515 of file util.c.

516 {
517  if (!lpszStr || IsBadStringPtrA(lpszStr, -1) || strlen(lpszStr) >= ulLen)
518  return TRUE;
519  return FALSE;
520 }
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
BOOL NTAPI IsBadStringPtrA(IN LPCSTR lpsz, IN UINT_PTR ucchMax)
Definition: except.c:991

◆ load_mapi_provider()

static void load_mapi_provider ( HKEY  hkeyMail,
LPCWSTR  valueName,
HMODULE mapi_provider 
)
static

Definition at line 968 of file util.c.

969 {
970  static const WCHAR mapi32_dll[] = {'m','a','p','i','3','2','.','d','l','l',0 };
971 
972  DWORD dwType, dwLen = 0;
973  LPWSTR dllPath;
974 
975  /* Check if we have a value set for DLLPath */
976  if ((RegQueryValueExW(hkeyMail, valueName, NULL, &dwType, NULL, &dwLen) == ERROR_SUCCESS) &&
977  ((dwType == REG_SZ) || (dwType == REG_EXPAND_SZ)) && (dwLen > 0))
978  {
979  dllPath = HeapAlloc(GetProcessHeap(), 0, dwLen);
980 
981  if (dllPath)
982  {
983  RegQueryValueExW(hkeyMail, valueName, NULL, NULL, (LPBYTE)dllPath, &dwLen);
984 
985  /* Check that this value doesn't refer to mapi32.dll (eg, as Outlook does) */
986  if (lstrcmpiW(dllPath, mapi32_dll) != 0)
987  {
988  if (dwType == REG_EXPAND_SZ)
989  {
990  DWORD dwExpandLen;
991  LPWSTR dllPathExpanded;
992 
993  /* Expand the path if necessary */
994  dwExpandLen = ExpandEnvironmentStringsW(dllPath, NULL, 0);
995  dllPathExpanded = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * dwExpandLen + 1);
996 
997  if (dllPathExpanded)
998  {
999  ExpandEnvironmentStringsW(dllPath, dllPathExpanded, dwExpandLen + 1);
1000 
1001  HeapFree(GetProcessHeap(), 0, dllPath);
1002  dllPath = dllPathExpanded;
1003  }
1004  }
1005 
1006  /* Load the DLL */
1007  TRACE("loading %s\n", debugstr_w(dllPath));
1008  *mapi_provider = LoadLibraryW(dllPath);
1009  }
1010 
1011  HeapFree(GetProcessHeap(), 0, dllPath);
1012  }
1013  }
1014 }
#define ERROR_SUCCESS
Definition: deptool.c:10
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
unsigned char * LPBYTE
Definition: typedefs.h:52
#define debugstr_w
Definition: kernel32.h:32
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static HMODULE mapi_provider
Definition: util.c:958
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define REG_SZ
Definition: layer.c:22

Referenced by load_mapi_providers().

◆ load_mapi_providers()

void load_mapi_providers ( void  )

Definition at line 1024 of file util.c.

1025 {
1026  static const WCHAR regkey_mail[] = {
1027  'S','o','f','t','w','a','r','e','\\','C','l','i','e','n','t','s','\\',
1028  'M','a','i','l',0 };
1029 
1030  static const WCHAR regkey_dllpath[] = {'D','L','L','P','a','t','h',0 };
1031  static const WCHAR regkey_dllpath_ex[] = {'D','L','L','P','a','t','h','E','x',0 };
1032  static const WCHAR regkey_backslash[] = { '\\', 0 };
1033 
1034  HKEY hkeyMail;
1035  DWORD dwType, dwLen = 0;
1036  LPWSTR appName = NULL, appKey = NULL;
1037 
1038  TRACE("()\n");
1039 
1040  /* Open the Mail key */
1041  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, regkey_mail, 0, KEY_READ, &hkeyMail) != ERROR_SUCCESS)
1042  return;
1043 
1044  /* Check if we have a default value set, and the length of it */
1045  if ((RegQueryValueExW(hkeyMail, NULL, NULL, &dwType, NULL, &dwLen) != ERROR_SUCCESS) ||
1046  !((dwType == REG_SZ) || (dwType == REG_EXPAND_SZ)) || (dwLen == 0))
1047  goto cleanUp;
1048 
1049  appName = HeapAlloc(GetProcessHeap(), 0, dwLen);
1050 
1051  if (!appName)
1052  goto cleanUp;
1053 
1054  /* Get the value, and get the path to the app key */
1055  RegQueryValueExW(hkeyMail, NULL, NULL, NULL, (LPBYTE)appName, &dwLen);
1056 
1057  TRACE("appName: %s\n", debugstr_w(appName));
1058 
1059  appKey = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * (lstrlenW(regkey_mail) +
1060  lstrlenW(regkey_backslash) + lstrlenW(appName) + 1));
1061 
1062  if (!appKey)
1063  goto cleanUp;
1064 
1065  lstrcpyW(appKey, regkey_mail);
1066  lstrcatW(appKey, regkey_backslash);
1067  lstrcatW(appKey, appName);
1068 
1069  RegCloseKey(hkeyMail);
1070 
1071  TRACE("appKey: %s\n", debugstr_w(appKey));
1072 
1073  /* Open the app's key */
1074  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, appKey, 0, KEY_READ, &hkeyMail) != ERROR_SUCCESS)
1075  goto cleanUp;
1076 
1077  /* Try to load the providers */
1078  load_mapi_provider(hkeyMail, regkey_dllpath, &mapi_provider);
1079  load_mapi_provider(hkeyMail, regkey_dllpath_ex, &mapi_ex_provider);
1080 
1081  /* Now try to load our function pointers */
1083 
1084  /* Simple MAPI functions */
1085  if (mapi_provider)
1086  {
1087  mapiFunctions.MAPIAddress = (void*) GetProcAddress(mapi_provider, "MAPIAddress");
1088  mapiFunctions.MAPIDeleteMail = (void*) GetProcAddress(mapi_provider, "MAPIDeleteMail");
1089  mapiFunctions.MAPIDetails = (void*) GetProcAddress(mapi_provider, "MAPIDetails");
1090  mapiFunctions.MAPIFindNext = (void*) GetProcAddress(mapi_provider, "MAPIFindNext");
1091  mapiFunctions.MAPILogoff = (void*) GetProcAddress(mapi_provider, "MAPILogoff");
1092  mapiFunctions.MAPILogon = (void*) GetProcAddress(mapi_provider, "MAPILogon");
1093  mapiFunctions.MAPIReadMail = (void*) GetProcAddress(mapi_provider, "MAPIReadMail");
1094  mapiFunctions.MAPIResolveName = (void*) GetProcAddress(mapi_provider, "MAPIResolveName");
1095  mapiFunctions.MAPISaveMail = (void*) GetProcAddress(mapi_provider, "MAPISaveMail");
1096  mapiFunctions.MAPISendDocuments = (void*) GetProcAddress(mapi_provider, "MAPISendDocuments");
1097  mapiFunctions.MAPISendMail = (void*) GetProcAddress(mapi_provider, "MAPISendMail");
1098  mapiFunctions.MAPISendMailW = (void*) GetProcAddress(mapi_provider, "MAPISendMailW");
1099  }
1100 
1101  /* Extended MAPI functions */
1102  if (mapi_ex_provider)
1103  {
1104  mapiFunctions.MAPIInitialize = (void*) GetProcAddress(mapi_ex_provider, "MAPIInitialize");
1105  mapiFunctions.MAPILogonEx = (void*) GetProcAddress(mapi_ex_provider, "MAPILogonEx");
1106  mapiFunctions.MAPIUninitialize = (void*) GetProcAddress(mapi_ex_provider, "MAPIUninitialize");
1107 
1108  mapiFunctions.DeinitMapiUtil = (void*) GetProcAddress(mapi_ex_provider, "DeinitMapiUtil@0");
1109  mapiFunctions.DllCanUnloadNow = (void*) GetProcAddress(mapi_ex_provider, "DllCanUnloadNow");
1110  mapiFunctions.DllGetClassObject = (void*) GetProcAddress(mapi_ex_provider, "DllGetClassObject");
1111  mapiFunctions.FGetComponentPath = (void*) GetProcAddress(mapi_ex_provider, "FGetComponentPath");
1112  mapiFunctions.HrThisThreadAdviseSink = (void*) GetProcAddress(mapi_ex_provider, "HrThisThreadAdviseSink@8");
1113  mapiFunctions.HrQueryAllRows = (void*) GetProcAddress(mapi_ex_provider, "HrQueryAllRows@24");
1114  mapiFunctions.MAPIAdminProfiles = (void*) GetProcAddress(mapi_ex_provider, "MAPIAdminProfiles");
1115  mapiFunctions.MAPIAllocateBuffer = (void*) GetProcAddress(mapi_ex_provider, "MAPIAllocateBuffer");
1116  mapiFunctions.MAPIAllocateMore = (void*) GetProcAddress(mapi_ex_provider, "MAPIAllocateMore");
1117  mapiFunctions.MAPIFreeBuffer = (void*) GetProcAddress(mapi_ex_provider, "MAPIFreeBuffer");
1118  mapiFunctions.MAPIGetDefaultMalloc = (void*) GetProcAddress(mapi_ex_provider, "MAPIGetDefaultMalloc@0");
1119  mapiFunctions.MAPIOpenLocalFormContainer = (void *) GetProcAddress(mapi_ex_provider, "MAPIOpenLocalFormContainer");
1120  mapiFunctions.OpenStreamOnFile = (void*) GetProcAddress(mapi_ex_provider, "OpenStreamOnFile@24");
1121  mapiFunctions.ScInitMapiUtil = (void*) GetProcAddress(mapi_ex_provider, "ScInitMapiUtil@4");
1122  mapiFunctions.WrapCompressedRTFStream = (void*) GetProcAddress(mapi_ex_provider, "WrapCompressedRTFStream@12");
1123  }
1124 
1125 cleanUp:
1126  RegCloseKey(hkeyMail);
1127  HeapFree(GetProcessHeap(), 0, appKey);
1129 }
LPMAPIDETAILS MAPIDetails
Definition: util.h:34
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
LPMAPIRESOLVENAME MAPIResolveName
Definition: util.h:41
LPMAPIADDRESS MAPIAddress
Definition: util.h:32
#define ZeroMemory
Definition: winbase.h:1635
#define lstrlenW
Definition: compat.h:407
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
LPMAPILOGONEX MAPILogonEx
Definition: util.h:39
unsigned char * LPBYTE
Definition: typedefs.h:52
#define debugstr_w
Definition: kernel32.h:32
static HMODULE mapi_ex_provider
Definition: util.c:959
LPMAPISENDDOCUMENTS MAPISendDocuments
Definition: util.h:45
smooth NULL
Definition: ftsmooth.c:416
LPMAPISENDMAIL MAPISendMail
Definition: util.h:43
LPMAPIREADMAIL MAPIReadMail
Definition: util.h:40
LPMAPIDELETEMAIL MAPIDeleteMail
Definition: util.h:33
LPMAPIUNINITIALIZE MAPIUninitialize
Definition: util.h:46
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
LPMAPISAVEMAIL MAPISaveMail
Definition: util.h:42
LPMAPIFINDNEXT MAPIFindNext
Definition: util.h:35
LPMAPILOGON MAPILogon
Definition: util.h:38
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50
static HMODULE mapi_provider
Definition: util.c:958
#define lstrcpyW
Definition: compat.h:406
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
LPMAPILOGOFF MAPILogoff
Definition: util.h:37
static void load_mapi_provider(HKEY hkeyMail, LPCWSTR valueName, HMODULE *mapi_provider)
Definition: util.c:968
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
const char * appName(const char *argv0)
Definition: loadlib.c:89
#define GetProcAddress(x, y)
Definition: compat.h:410
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
LPMAPIINITIALIZE MAPIInitialize
Definition: util.h:36
WCHAR * LPWSTR
Definition: xmlstorage.h:184
void cleanUp()
Definition: main.cpp:472
LPMAPISENDMAILW MAPISendMailW
Definition: util.h:44
#define HeapFree(x, y, z)
Definition: compat.h:394
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by DllMain().

◆ MAPI32_FtAddFt()

LONGLONG WINAPI MAPI32_FtAddFt ( FILETIME  ftLeft,
FILETIME  ftRight 
)

Definition at line 534 of file util.c.

535 {
536  LONGLONG *pl = (LONGLONG*)&ftLeft, *pr = (LONGLONG*)&ftRight;
537 
538  return *pl + *pr;
539 }
int64_t LONGLONG
Definition: typedefs.h:66

◆ MAPI32_FtMulDw()

LONGLONG WINAPI MAPI32_FtMulDw ( DWORD  dwLeft,
FILETIME  ftRight 
)

Definition at line 572 of file util.c.

573 {
574  LONGLONG *pr = (LONGLONG*)&ftRight;
575 
576  return (LONGLONG)dwLeft * (*pr);
577 }
int64_t LONGLONG
Definition: typedefs.h:66

◆ MAPI32_FtMulDwDw()

LONGLONG WINAPI MAPI32_FtMulDwDw ( DWORD  dwLeft,
DWORD  dwRight 
)

Definition at line 591 of file util.c.

592 {
593  return (LONGLONG)dwLeft * (LONGLONG)dwRight;
594 }
int64_t LONGLONG
Definition: typedefs.h:66

◆ MAPI32_FtNegFt()

LONGLONG WINAPI MAPI32_FtNegFt ( FILETIME  ft)

Definition at line 607 of file util.c.

608 {
609  LONGLONG *p = (LONGLONG*)&ft;
610 
611  return - *p;
612 }
int64_t LONGLONG
Definition: typedefs.h:66
GLfloat GLfloat p
Definition: glext.h:8902

◆ MAPI32_FtSubFt()

LONGLONG WINAPI MAPI32_FtSubFt ( FILETIME  ftLeft,
FILETIME  ftRight 
)

Definition at line 553 of file util.c.

554 {
555  LONGLONG *pl = (LONGLONG*)&ftLeft, *pr = (LONGLONG*)&ftRight;
556 
557  return *pr - *pl;
558 }
int64_t LONGLONG
Definition: typedefs.h:66

◆ MAPIAllocateBuffer()

SCODE WINAPI MAPIAllocateBuffer ( ULONG  cbSize,
LPVOID lppBuffer 
)

Definition at line 126 of file util.c.

127 {
128  LPMAPIALLOCBUFFER lpBuff;
129 
130  TRACE("(%d,%p)\n", cbSize, lppBuffer);
131 
132  if (mapiFunctions.MAPIAllocateBuffer)
133  return mapiFunctions.MAPIAllocateBuffer(cbSize, lppBuffer);
134 
135  if (!lppBuffer)
136  return E_INVALIDARG;
137 
138  lpBuff = HeapAlloc(GetProcessHeap(), 0, cbSize + sizeof(*lpBuff));
139  if (!lpBuff)
141 
142  TRACE("initial allocation:%p, returning %p\n", lpBuff, lpBuff + 1);
143  *lpBuff++ = NULL;
144  *lppBuffer = lpBuff;
145  return S_OK;
146 }
#define MAPI_E_NOT_ENOUGH_MEMORY
Definition: mapicode.h:74
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50
#define S_OK
Definition: intsafe.h:59

Referenced by MAPIAllocateMore().

◆ MAPIAllocateMore()

SCODE WINAPI MAPIAllocateMore ( ULONG  cbSize,
LPVOID  lpOrig,
LPVOID lppBuffer 
)

Definition at line 169 of file util.c.

170 {
171  LPMAPIALLOCBUFFER lpBuff = lpOrig;
172 
173  TRACE("(%d,%p,%p)\n", cbSize, lpOrig, lppBuffer);
174 
175  if (mapiFunctions.MAPIAllocateMore)
176  return mapiFunctions.MAPIAllocateMore(cbSize, lpOrig, lppBuffer);
177 
178  if (!lppBuffer || !lpBuff || !--lpBuff)
179  return E_INVALIDARG;
180 
181  /* Find the last allocation in the chain */
182  while (*lpBuff)
183  {
184  TRACE("linked:%p->%p\n", lpBuff, *lpBuff);
185  lpBuff = *lpBuff;
186  }
187 
188  if (SUCCEEDED(MAPIAllocateBuffer(cbSize, lppBuffer)))
189  {
190  *lpBuff = ((LPMAPIALLOCBUFFER)*lppBuffer) - 1;
191  TRACE("linking %p->%p\n", lpBuff, *lpBuff);
192  }
193  return *lppBuffer ? S_OK : MAPI_E_NOT_ENOUGH_MEMORY;
194 }
#define MAPI_E_NOT_ENOUGH_MEMORY
Definition: mapicode.h:74
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
SCODE WINAPI MAPIAllocateBuffer(ULONG cbSize, LPVOID *lppBuffer)
Definition: util.c:126
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50
#define S_OK
Definition: intsafe.h:59
LPVOID * LPMAPIALLOCBUFFER
Definition: util.c:102
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MAPIFreeBuffer()

ULONG WINAPI MAPIFreeBuffer ( LPVOID  lpBuffer)

Definition at line 208 of file util.c.

209 {
210  LPMAPIALLOCBUFFER lpBuff = lpBuffer;
211 
212  TRACE("(%p)\n", lpBuffer);
213 
214  if (mapiFunctions.MAPIFreeBuffer)
215  return mapiFunctions.MAPIFreeBuffer(lpBuffer);
216 
217  if (lpBuff && --lpBuff)
218  {
219  while (lpBuff)
220  {
221  LPVOID lpFree = lpBuff;
222 
223  lpBuff = *lpBuff;
224 
225  TRACE("linked:%p->%p, freeing %p\n", lpFree, lpBuff, lpFree);
226  HeapFree(GetProcessHeap(), 0, lpFree);
227  }
228  }
229  return S_OK;
230 }
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50
#define S_OK
Definition: intsafe.h:59
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ MNLS_CompareStringW()

INT WINAPI MNLS_CompareStringW ( DWORD  dwCp,
LPCWSTR  lpszLeft,
LPCWSTR  lpszRight 
)

Definition at line 465 of file util.c.

466 {
467  INT ret;
468 
469  TRACE("0x%08x,%s,%s\n", dwCp, debugstr_w(lpszLeft), debugstr_w(lpszRight));
470  ret = MNLS_lstrcmpW(lpszLeft, lpszRight);
472 }
#define CSTR_GREATER_THAN
Definition: winnls.h:454
INT WINAPI MNLS_lstrcmpW(LPCWSTR lpszLeft, LPCWSTR lpszRight)
Definition: util.c:423
int32_t INT
Definition: typedefs.h:56
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define CSTR_EQUAL
Definition: winnls.h:453
#define CSTR_LESS_THAN
Definition: winnls.h:452

◆ MNLS_lstrcmpW()

INT WINAPI MNLS_lstrcmpW ( LPCWSTR  lpszLeft,
LPCWSTR  lpszRight 
)

Definition at line 423 of file util.c.

424 {
425  TRACE("(%s,%s)\n", debugstr_w(lpszLeft), debugstr_w(lpszRight));
426  return strcmpW(lpszLeft, lpszRight);
427 }
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229

Referenced by MNLS_CompareStringW().

◆ MNLS_lstrcpyW()

ULONG WINAPI MNLS_lstrcpyW ( LPWSTR  lpszDest,
LPCWSTR  lpszSrc 
)

Definition at line 441 of file util.c.

442 {
443  ULONG len;
444 
445  TRACE("(%p,%s)\n", lpszDest, debugstr_w(lpszSrc));
446  len = (strlenW(lpszSrc) + 1) * sizeof(WCHAR);
447  memcpy(lpszDest, lpszSrc, len);
448  return len;
449 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define debugstr_w
Definition: kernel32.h:32
WCHAR lpszDest[260]
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
unsigned int ULONG
Definition: retypes.h:1

◆ MNLS_lstrlenW()

ULONG WINAPI MNLS_lstrlenW ( LPCWSTR  lpszStr)

Definition at line 404 of file util.c.

405 {
406  TRACE("(%s)\n", debugstr_w(lpszStr));
407  return strlenW(lpszStr);
408 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4

◆ OpenStreamOnFile()

HRESULT WINAPI OpenStreamOnFile ( LPALLOCATEBUFFER  lpAlloc,
LPFREEBUFFER  lpFree,
ULONG  ulFlags,
LPWSTR  lpszPath,
LPWSTR  lpszPrefix,
LPSTREAM lppStream 
)

Definition at line 713 of file util.c.

716 {
717  WCHAR szBuff[MAX_PATH];
718  DWORD dwMode = STGM_READWRITE, dwAttributes = 0;
719  HRESULT hRet;
720 
721  TRACE("(%p,%p,0x%08x,%s,%s,%p)\n", lpAlloc, lpFree, ulFlags,
722  debugstr_a((LPSTR)lpszPath), debugstr_a((LPSTR)lpszPrefix), lppStream);
723 
724  if (mapiFunctions.OpenStreamOnFile)
725  return mapiFunctions.OpenStreamOnFile(lpAlloc, lpFree, ulFlags, lpszPath, lpszPrefix, lppStream);
726 
727  if (lppStream)
728  *lppStream = NULL;
729 
730  if (ulFlags & SOF_UNIQUEFILENAME)
731  {
732  FIXME("Should generate a temporary name\n");
733  return E_INVALIDARG;
734  }
735 
736  if (!lpszPath || !lppStream)
737  return E_INVALIDARG;
738 
739  /* FIXME: Should probably munge mode and attributes, and should handle
740  * Unicode arguments (I assume MAPI_UNICODE is set in ulFlags if
741  * we are being passed Unicode strings; MSDN doesn't say).
742  * This implementation is just enough for Outlook97 to start.
743  */
744  MultiByteToWideChar(CP_ACP, 0, (LPSTR)lpszPath, -1, szBuff, MAX_PATH);
745  hRet = SHCreateStreamOnFileEx(szBuff, dwMode, dwAttributes, TRUE,
746  NULL, lppStream);
747  return hRet;
748 }
#define TRUE
Definition: types.h:120
#define CP_ACP
Definition: compat.h:99
char * LPSTR
Definition: xmlstorage.h:182
DWORD dwAttributes
Definition: vdmdbg.h:34
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI SHCreateStreamOnFileEx(LPCWSTR lpszPath, DWORD dwMode, DWORD dwAttributes, BOOL bCreate, IStream *lpTemplate, IStream **lppStream)
Definition: istream.c:401
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50
#define STGM_READWRITE
Definition: objbase.h:918
#define MultiByteToWideChar
Definition: compat.h:100
#define SOF_UNIQUEFILENAME
Definition: mapiutil.h:32

◆ ScInitMapiUtil()

SCODE WINAPI ScInitMapiUtil ( ULONG  ulReserved)

Definition at line 68 of file util.c.

69 {
70  if (mapiFunctions.ScInitMapiUtil)
71  return mapiFunctions.ScInitMapiUtil(ulReserved);
72 
73  FIXME("(0x%08x)stub!\n", ulReserved);
74  if (ulReserved)
76  return S_OK;
77 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define MAPI_E_INVALID_PARAMETER
Definition: mapicode.h:62
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_ RECTL _In_ ULONG _In_ ULONG ulReserved
Definition: winddi.h:4190
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50
#define S_OK
Definition: intsafe.h:59

◆ SwapPlong()

VOID WINAPI SwapPlong ( PULONG  lpData,
ULONG  ulLen 
)

Definition at line 365 of file util.c.

366 {
367  ULONG i;
368 
369  for (i = 0; i < ulLen; i++)
370  lpData[i] = RtlUlongByteSwap(lpData[i]);
371 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define RtlUlongByteSwap(_x)
Definition: compat.h:465
unsigned int ULONG
Definition: retypes.h:1

◆ SwapPword()

VOID WINAPI SwapPword ( PUSHORT  lpData,
ULONG  ulLen 
)

Definition at line 385 of file util.c.

386 {
387  ULONG i;
388 
389  for (i = 0; i < ulLen; i++)
390  lpData[i] = RtlUshortByteSwap(lpData[i]);
391 }
#define RtlUshortByteSwap(_x)
Definition: rtlfuncs.h:3199
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int ULONG
Definition: retypes.h:1

◆ UFromSz()

UINT WINAPI UFromSz ( LPCSTR  lpszStr)

Definition at line 678 of file util.c.

679 {
680  ULONG ulRet = 0;
681 
682  TRACE("(%s)\n", debugstr_a(lpszStr));
683 
684  if (lpszStr)
685  {
686  while (*lpszStr >= '0' && *lpszStr <= '9')
687  {
688  ulRet = ulRet * 10 + (*lpszStr - '0');
689  lpszStr++;
690  }
691  }
692  return ulRet;
693 }
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned int ULONG
Definition: retypes.h:1

◆ UlAddRef()

ULONG WINAPI UlAddRef ( void lpUnk)

Definition at line 628 of file util.c.

629 {
630  TRACE("(%p)\n", lpUnk);
631 
632  if (!lpUnk)
633  return 0UL;
634  return IUnknown_AddRef((LPUNKNOWN)lpUnk);
635 }
static LPUNKNOWN
Definition: ndr_ole.c:49
#define TRACE(s)
Definition: solgame.cpp:4
#define UL
Definition: tui.h:70

◆ UlFromSzHex()

ULONG WINAPI UlFromSzHex ( LPCWSTR  lpszHex)

Definition at line 766 of file util.c.

767 {
768  LPCSTR lpStr = (LPCSTR)lpszHex;
769  ULONG ulRet = 0;
770 
771  TRACE("(%s)\n", debugstr_a(lpStr));
772 
773  while (*lpStr)
774  {
775  if (lpStr[0] < '0' || lpStr[0] > 'f' || digitsToHex[lpStr[0] - '0'] == 0xff ||
776  lpStr[1] < '0' || lpStr[1] > 'f' || digitsToHex[lpStr[1] - '0'] == 0xff)
777  break;
778 
779  ulRet = ulRet * 16 + ((digitsToHex[lpStr[0] - '0'] << 4) | digitsToHex[lpStr[1] - '0']);
780  lpStr += 2;
781  }
782  return ulRet;
783 }
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
static const BYTE digitsToHex[]
Definition: util.c:44
unsigned int ULONG
Definition: retypes.h:1

◆ UlRelease()

ULONG WINAPI UlRelease ( void lpUnk)

Definition at line 653 of file util.c.

654 {
655  TRACE("(%p)\n", lpUnk);
656 
657  if (!lpUnk)
658  return 0UL;
659  return IUnknown_Release((LPUNKNOWN)lpUnk);
660 }
static LPUNKNOWN
Definition: ndr_ole.c:49
#define TRACE(s)
Definition: solgame.cpp:4
#define UL
Definition: tui.h:70

◆ unload_mapi_providers()

void unload_mapi_providers ( void  )

Definition at line 1136 of file util.c.

1137 {
1138  TRACE("()\n");
1139 
1142 }
static HMODULE mapi_ex_provider
Definition: util.c:959
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:405
static HMODULE mapi_provider
Definition: util.c:958

Referenced by DllMain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( mapi  )

◆ WrapCompressedRTFStream()

HRESULT WINAPI WrapCompressedRTFStream ( LPSTREAM  compressed,
ULONG  flags,
LPSTREAM uncompressed 
)

Definition at line 949 of file util.c.

950 {
951  if (mapiFunctions.WrapCompressedRTFStream)
952  return mapiFunctions.WrapCompressedRTFStream(compressed, flags, uncompressed);
953 
954  FIXME("(%p, 0x%08x, %p): stub\n", compressed, flags, uncompressed);
955  return MAPI_E_NO_SUPPORT;
956 }
static const BYTE uncompressed[]
Definition: misc.c:392
#define MAPI_E_NO_SUPPORT
Definition: mapicode.h:71
#define FIXME(fmt,...)
Definition: debug.h:110
GLbitfield flags
Definition: glext.h:7161
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50

◆ WrapProgress()

HRESULT WINAPI WrapProgress ( PVOID  unk1,
PVOID  unk2,
PVOID  unk3,
PVOID  unk4,
PVOID  unk5 
)

Definition at line 235 of file util.c.

236 {
237  /* Native does not implement this function */
238  return MAPI_E_NO_SUPPORT;
239 }
#define MAPI_E_NO_SUPPORT
Definition: mapicode.h:71

Variable Documentation

◆ digitsToHex

const BYTE digitsToHex[]
static
Initial value:
= {
0,1,2,3,4,5,6,7,8,9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,10,11,12,13,14,15,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,10,11,12,13,
14,15 }

Definition at line 44 of file util.c.

Referenced by FBinFromHex(), and UlFromSzHex().

◆ mapi_ex_provider

HMODULE mapi_ex_provider
static

Definition at line 959 of file util.c.

Referenced by load_mapi_providers(), and unload_mapi_providers().

◆ mapi_provider

HMODULE mapi_provider
static

Definition at line 958 of file util.c.

Referenced by load_mapi_provider(), load_mapi_providers(), and unload_mapi_providers().

◆ mapiFunctions