⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mapiwin.h

📁 vc6.0完整版
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
 *  M A P I W I N . H
 *
 *  Definitions used by the MAPI Development Team to aid in
 *  developing single-source service providers that run on
 *  both WIN32 and WIN16 platforms.
 *  There are three sections.
 *
 *  The first section defines how to call something that
 *  is available by different methods in WIN16 vs. WIN32.
 *  As such, they are totally new mechanisms.
 *
 *  The second section establishes things that are available
 *  AS-IS in one environment but we have to define for the
 *  other environment.
 *
 *  The third section simply defines a few conventions
 *  (simplifications) for common operations.
 *
 *  Copyright 1986-1996 Microsoft Corporation. All Rights Reserved.
 */

/*
 *  Routines are included in the first section to manage per-instance
 *  global variables for DLLs. They assume that all of the DLL's
 *  per-instance global variables live in a single block of memory.
 *  Functions are provided to install and retrieve the correct block of
 *  memory for the current instance.
 *
 *  There are only two functions:
 *
 *      PvGetInstanceGlobals    Call this to get the address of the
 *                              per-instance globals structure.
 *      ScSetinstanceGlobals    Call this to install the
 *                              per-instance globals structure. It
 *                              may fail if the number of instances
 *                              exceeds a certain limit.
 *
 *  The caller is free to choose the name, size, and allocation
 *  method of the per-instance global variables structure.
 *
 *  The WIN32 implementation uses a pointer in the DLL's data
 *  segment. This assumes that the DLL gets a separate instance
 *  of the default data segment per calling process.
 *
 *  The WIN16 implementation uses a fixed array of pointers and a
 *  matching fixed array of keys unique to the calling process.
 */

/*
 *  The second section consists largely of Win32 file I/O functions
 *  that are not supported under Win16. These functions are
 *  implemented in mapiwin.c, using DOS calls. Most have limitations
 *  relative to their Win32 counterparts, which are spelled out in
 *  the comments to the source code.
 */

#ifndef __MAPIWIN_H__
#define __MAPIWIN_H__

#if defined (WIN32) && !defined (_WIN32)
#define _WIN32
#endif

#include "mapinls.h"

#ifdef __cplusplus
extern "C" {
#endif


/********************************/
/*  Our conventions for things  */
/*  we choose to do differently */
/*  on WIN16 vs. WIN32.         */
/********************************/

#ifdef  WIN16

#define MULDIV(x,y,z)               MulDiv32(x,y,z)
#define IsBadReadPtr(lp,cb)         FBadReadPtr(lp,cb)

#define cInstMax                    50
LPVOID FAR PASCAL   PvGetInstanceGlobals(void);
LONG FAR PASCAL     ScSetInstanceGlobals(LPVOID pv);
LONG FAR PASCAL     ScSetVerifyInstanceGlobals(LPVOID pv, DWORD dwPid);
LPVOID FAR PASCAL   PvGetVerifyInstanceGlobals(DWORD dwPid);
LPVOID FAR PASCAL   PvSlowGetInstanceGlobals(DWORD dwPid);
BOOL __export FAR PASCAL FCleanupInstanceGlobals(WORD, DWORD);

#elif defined(_MAC) /* !WIN16 */

#define MULDIV(x,y,z)               MulDiv(x,y,z)

LPVOID FAR PASCAL   PvGetInstanceGlobals(WORD wDataSet);
LONG FAR PASCAL     ScSetInstanceGlobals(LPVOID pv, WORD wDataSet);
LONG FAR PASCAL     ScSetVerifyInstanceGlobals(LPVOID pv, DWORD dwPid,
                        WORD wDataSet);
LPVOID FAR PASCAL   PvGetVerifyInstanceGlobals(DWORD dwPid, DWORD wDataSet);
LPVOID FAR PASCAL   PvSlowGetInstanceGlobals(DWORD dwPid, DWORD wDataSet);
BOOL FAR PASCAL     FCleanupInstanceGlobals(WORD, DWORD);

#else   /* !WIN16 */

#define MULDIV(x,y,z)               MulDiv(x,y,z)

extern LPVOID pinstX;
#define PvGetInstanceGlobals()                  pinstX
#define ScSetInstanceGlobals(_pv)               (pinstX = _pv, 0)
#define PvGetVerifyInstanceGlobals(_pid)        pinstX
#define ScSetVerifyInstanceGlobals(_pv,_pid)    (pinstX = _pv, 0)
#define PvSlowGetInstanceGlobals(_pid)          pinstX

#endif  /* WIN16 */

#if defined(_WIN32) && !defined(_MAC)
#define szMAPIDLLSuffix     "32"
#elif defined(WIN16) || defined(DOS)
#define szMAPIDLLSuffix     ""
#elif  defined(_MAC)
#define szMAPIDLLSuffix     "M"
#else
#error "Don't know the suffix for DLLs on this platform"
#endif

/********************************/
/*  Things missing from one     */
/*  system-provided environment */
/*  or the other.               */
/********************************/

#if !defined(_WIN32) 
#define ZeroMemory(pb,cb)           memset((pb),0,(cb))
#define FillMemory(pb,cb,b)         memset((pb),(b),(cb))
#define CopyMemory(pbDst,pbSrc,cb)  do                              \
                                    {                               \
                                        size_t _cb = (size_t)(cb);  \
                                        if (_cb)                    \
                                            memcpy(pbDst,pbSrc,_cb);\
                                    } while (FALSE)
#define MoveMemory(pbDst,pbSrc,cb)  memmove((pbDst),(pbSrc),(cb))

#define UNALIGNED

#endif

#if defined(WIN16) || defined(_MAC)

#ifndef _MAC
#include <error.h>              /*  for GetLastError() */
#endif

typedef int                 INT;
typedef unsigned long       ULONG;
typedef short               SHORT;
typedef unsigned short      USHORT;
typedef double              LONGLONG;
typedef double              DWORDLONG;
typedef unsigned char       UCHAR;
typedef unsigned char FAR*  PUCHAR;
typedef int                 BOOL;


#ifndef _MAC
typedef char                BOOLEAN;

#ifndef _FILETIME_
#define _FILETIME_
typedef struct tagFILETIME
{
    DWORD dwLowDateTime;
    DWORD dwHighDateTime;
} FILETIME;
#endif      /* _FILETIME */

typedef struct _SYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME, FAR *LPSYSTEMTIME;

typedef struct _TIME_ZONE_INFORMATION {
    LONG Bias;
    CHAR StandardName[ 32 ];        /* was WCHAR */
    SYSTEMTIME StandardDate;
    LONG StandardBias;
    CHAR DaylightName[ 32 ];        /* was WCHAR */
    SYSTEMTIME DaylightDate;
    LONG DaylightBias;
} TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION, FAR *LPTIME_ZONE_INFORMATION;


#if defined(DOS) || defined(WIN16)
/* Simulate effect of afx header */
#define __T(x)      x
#define _T(x)       __T(x)
#define TEXT        _T
#endif

#define APIENTRY        WINAPI

#define SetForegroundWindow         SetActiveWindow

#define wsprintfA                   wsprintf
#define GetWindowsDirectoryA        GetWindowsDirectory
#define GetSystemDirectoryA         GetSystemDirectory
#define GetPrivateProfileStringA    GetPrivateProfileString
#define GetPrivateProfileIntA       GetPrivateProfileInt
#define GetProfileStringA           GetProfileString
#define GetModuleFileNameA          GetModuleFileName
#define CharUpperBuffA              CharUpperBuff

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -