#ifndef _WINFAX_H
#define _WINFAX_H

/* Windows FAX API definitions */

#include <tapi.h>

#define WINFAXAPI  DECLSPEC_IMPORT

#ifdef __cplusplus
extern "C" {
#endif

#define FAXLOG_LEVEL_NONE  0
#define FAXLOG_LEVEL_MIN  1
#define FAXLOG_LEVEL_MED  2
#define FAXLOG_LEVEL_MAX  3

#define FAXLOG_CATEGORY_INIT  1
#define FAXLOG_CATEGORY_OUTBOUND  2
#define FAXLOG_CATEGORY_INBOUND  3
#define FAXLOG_CATEGORY_UNKNOWN  4

#define JC_UNKNOWN  0
#define JC_DELETE  1
#define JC_PAUSE  2
#define JC_RESUME  3
#define JC_RESTART  JC_RESUME

#define JT_UNKNOWN  0
#define JT_SEND  1
#define JT_RECEIVE  2
#define JT_ROUTING  3
#define JT_FAIL_RECEIVE 4

#define JS_PENDING  0x00000000
#define JS_INPROGRESS  0x00000001
#define JS_DELETING  0x00000002
#define JS_FAILED  0x00000004
#define JS_PAUSED  0x00000008
#define JS_NOLINE  0x00000010
#define JS_RETRYING  0x00000020
#define JS_RETRIES_EXCEEDED 0x00000040

#define FPS_DIALING  0x20000001
#define FPS_SENDING  0x20000002
#define FPS_RECEIVING  0x20000004
#define FPS_COMPLETED  0x20000008
#define FPS_HANDLED  0x20000010
#define FPS_UNAVAILABLE  0x20000020
#define FPS_BUSY  0x20000040
#define FPS_NO_ANSWER  0x20000080
#define FPS_BAD_ADDRESS  0x20000100
#define FPS_NO_DIAL_TONE  0x20000200
#define FPS_DISCONNECTED  0x20000400
#define FPS_FATAL_ERROR  0x20000800
#define FPS_NOT_FAX_CALL  0x20001000
#define FPS_CALL_DELAYED  0x20002000
#define FPS_CALL_BLACKLISTED  0x20004000
#define FPS_INITIALIZING  0x20008000
#define FPS_OFFLINE  0x20010000
#define FPS_RINGING  0x20020000
#define FPS_AVAILABLE  0x20100000
#define FPS_ABORTING  0x20200000
#define FPS_ROUTING  0x20400000
#define FPS_ANSWERED  0x20800000

#define FPF_RECEIVE 0x00000001
#define FPF_SEND  0x00000002
#define FPF_VIRTUAL 0x00000004

#define JSA_NOW  0
#define JSA_SPECIFIC_TIME  1
#define JSA_DISCOUNT_PERIOD 2

#define DRT_NONE  0
#define DRT_EMAIL  1
#define DRT_INBOX  2

#define FEI_DIALING  0x00000001
#define FEI_SENDING  0x00000002
#define FEI_RECEIVING  0x00000003
#define FEI_COMPLETED  0x00000004
#define FEI_BUSY  0x00000005
#define FEI_NO_ANSWER  0x00000006
#define FEI_BAD_ADDRESS  0x00000007
#define FEI_NO_DIAL_TONE  0x00000008
#define FEI_DISCONNECTED  0x00000009
#define FEI_FATAL_ERROR  0x0000000a
#define FEI_NOT_FAX_CALL  0x0000000b
#define FEI_CALL_DELAYED  0x0000000c
#define FEI_CALL_BLACKLISTED  0x0000000d
#define FEI_RINGING  0x0000000e
#define FEI_ABORTING  0x0000000f
#define FEI_ROUTING  0x00000010
#define FEI_MODEM_POWERED_ON  0x00000011
#define FEI_MODEM_POWERED_OFF  0x00000012
#define FEI_IDLE  0x00000013
#define FEI_FAXSVC_ENDED  0x00000014
#define FEI_ANSWERED  0x00000015
#define FEI_JOB_QUEUED  0x00000016
#define FEI_DELETED  0x00000017
#define FEI_INITIALIZING  0x00000018
#define FEI_LINE_UNAVAILABLE  0x00000019
#define FEI_HANDLED  0x0000001a
#define FEI_FAXSVC_STARTED  0x0000001b
#define FEI_NEVENTS  FEI_FAXSVC_STARTED

#define FAX_JOB_SUBMIT  0x0001
#define FAX_JOB_QUERY  0x0002
#define FAX_CONFIG_QUERY  0x0004
#define FAX_CONFIG_SET  0x0008
#define FAX_PORT_QUERY  0x0010
#define FAX_PORT_SET  0x0020
#define FAX_JOB_MANAGE  0x0040

#define FAX_READ  (STANDARD_RIGHTS_READ|FAX_JOB_QUERY|FAX_CONFIG_QUERY|FAX_PORT_QUERY)
#define FAX_WRITE  (STANDARD_RIGHTS_WRITE|FAX_JOB_SUBMIT)
#define FAX_ALL_ACCESS  (STANDARD_RIGHTS_ALL|FAX_JOB_SUBMIT|FAX_JOB_QUERY|FAX_CONFIG_QUERY|FAX_CONFIG_SET|FAX_PORT_QUERY|FAX_PORT_SET|FAX_JOB_MANAGE)

#define PORT_OPEN_QUERY  0x00000001
#define PORT_OPEN_MODIFY  0x00000002

typedef struct _FAX_LOG_CATEGORYA {
    LPCSTR Name;
    DWORD Category;
    DWORD Level;
} FAX_LOG_CATEGORYA, *PFAX_LOG_CATEGORYA;

typedef struct _FAX_LOG_CATEGORYW {
    LPCWSTR Name;
    DWORD Category;
    DWORD Level;
} FAX_LOG_CATEGORYW, *PFAX_LOG_CATEGORYW;

typedef struct _FAX_TIME {
    WORD Hour;
    WORD Minute;
} FAX_TIME, *PFAX_TIME;

typedef struct _FAX_CONFIGURATIONA {
    DWORD SizeOfStruct;
    DWORD Retries;
    DWORD RetryDelay;
    DWORD DirtyDays;
    BOOL Branding;
    BOOL UseDeviceTsid;
    BOOL ServerCp;
    BOOL PauseServerQueue;
    FAX_TIME StartCheapTime;
    FAX_TIME StopCheapTime;
    BOOL ArchiveOutgoingFaxes;
    LPCSTR ArchiveDirectory;
    LPCSTR InboundProfile;
} FAX_CONFIGURATIONA, *PFAX_CONFIGURATIONA;

typedef struct _FAX_CONFIGURATIONW {
    DWORD SizeOfStruct;
    DWORD Retries;
    DWORD RetryDelay;
    DWORD DirtyDays;
    BOOL Branding;
    BOOL UseDeviceTsid;
    BOOL ServerCp;
    BOOL PauseServerQueue;
    FAX_TIME StartCheapTime;
    FAX_TIME StopCheapTime;
    BOOL ArchiveOutgoingFaxes;
    LPCWSTR ArchiveDirectory;
    LPCWSTR InboundProfile;
} FAX_CONFIGURATIONW, *PFAX_CONFIGURATIONW;

typedef struct _FAX_DEVICE_STATUSA {
    DWORD SizeOfStruct;
    LPCSTR CallerId;
    LPCSTR Csid;
    DWORD CurrentPage;
    DWORD DeviceId;
    LPCSTR DeviceName;
    LPCSTR DocumentName;
    DWORD JobType;
    LPCSTR PhoneNumber;
    LPCSTR RoutingString;
    LPCSTR SenderName;
    LPCSTR RecipientName;
    DWORD Size;
    FILETIME StartTime;
    DWORD Status;
    LPCSTR StatusString;
    FILETIME SubmittedTime;
    DWORD TotalPages;
    LPCSTR Tsid;
    LPCSTR UserName;
} FAX_DEVICE_STATUSA, *PFAX_DEVICE_STATUSA;

typedef struct _FAX_DEVICE_STATUSW {
    DWORD SizeOfStruct;
    LPCWSTR CallerId;
    LPCWSTR Csid;
    DWORD CurrentPage;
    DWORD DeviceId;
    LPCWSTR DeviceName;
    LPCWSTR DocumentName;
    DWORD JobType;
    LPCWSTR PhoneNumber;
    LPCWSTR RoutingString;
    LPCWSTR SenderName;
    LPCWSTR RecipientName;
    DWORD Size;
    FILETIME StartTime;
    DWORD Status;
    LPCWSTR StatusString;
    FILETIME SubmittedTime;
    DWORD TotalPages;
    LPCWSTR Tsid;
    LPCWSTR UserName;
} FAX_DEVICE_STATUSW, *PFAX_DEVICE_STATUSW;

typedef struct _FAX_JOB_ENTRYA {
    DWORD SizeOfStruct;
    DWORD JobId;
    LPCSTR UserName;
    DWORD JobType;
    DWORD QueueStatus;
    DWORD Status;
    DWORD Size;
    DWORD PageCount;
    LPCSTR RecipientNumber;
    LPCSTR RecipientName;
    LPCSTR Tsid;
    LPCSTR SenderName;
    LPCSTR SenderCompany;
    LPCSTR SenderDept;
    LPCSTR BillingCode;
    DWORD ScheduleAction;
    SYSTEMTIME ScheduleTime;
    DWORD DeliveryReportType;
    LPCSTR DeliveryReportAddress;
    LPCSTR DocumentName;
} FAX_JOB_ENTRYA, *PFAX_JOB_ENTRYA;

typedef struct _FAX_JOB_ENTRYW {
    DWORD SizeOfStruct;
    DWORD JobId;
    LPCWSTR UserName;
    DWORD JobType;
    DWORD QueueStatus;
    DWORD Status;
    DWORD Size;
    DWORD PageCount;
    LPCWSTR RecipientNumber;
    LPCWSTR RecipientName;
    LPCWSTR Tsid;
    LPCWSTR SenderName;
    LPCWSTR SenderCompany;
    LPCWSTR SenderDept;
    LPCWSTR BillingCode;
    DWORD ScheduleAction;
    SYSTEMTIME ScheduleTime;
    DWORD DeliveryReportType;
    LPCWSTR DeliveryReportAddress;
    LPCWSTR DocumentName;
} FAX_JOB_ENTRYW, *PFAX_JOB_ENTRYW;

typedef struct _FAX_PORT_INFOA {
    DWORD SizeOfStruct;
    DWORD DeviceId;
    DWORD State;
    DWORD Flags;
    DWORD Rings;
    DWORD Priority;
    LPCSTR DeviceName;
    LPCSTR Tsid;
    LPCSTR Csid;
} FAX_PORT_INFOA, *PFAX_PORT_INFOA;

typedef struct _FAX_PORT_INFOW {
    DWORD SizeOfStruct;
    DWORD DeviceId;
    DWORD State;
    DWORD Flags;
    DWORD Rings;
    DWORD Priority;
    LPCWSTR DeviceName;
    LPCWSTR Tsid;
    LPCWSTR Csid;
} FAX_PORT_INFOW, *PFAX_PORT_INFOW;

typedef struct _FAX_ROUTING_METHODA {
    DWORD SizeOfStruct;
    DWORD DeviceId;
    BOOL Enabled;
    LPCSTR DeviceName;
    LPCSTR Guid;
    LPCSTR FriendlyName;
    LPCSTR FunctionName;
    LPCSTR ExtensionImageName;
    LPCSTR ExtensionFriendlyName;
} FAX_ROUTING_METHODA, *PFAX_ROUTING_METHODA;

typedef struct _FAX_ROUTING_METHODW {
    DWORD SizeOfStruct;
    DWORD DeviceId;
    BOOL Enabled;
    LPCWSTR DeviceName;
    LPCWSTR Guid;
    LPCWSTR FriendlyName;
    LPCWSTR FunctionName;
    LPCWSTR ExtensionImageName;
    LPCWSTR ExtensionFriendlyName;
} FAX_ROUTING_METHODW, *PFAX_ROUTING_METHODW;

typedef struct _FAX_GLOBAL_ROUTING_INFOA {
    DWORD SizeOfStruct;
    DWORD Priority;
    LPCSTR Guid;
    LPCSTR FriendlyName;
    LPCSTR FunctionName;
    LPCSTR ExtensionImageName;
    LPCSTR ExtensionFriendlyName;
} FAX_GLOBAL_ROUTING_INFOA, *PFAX_GLOBAL_ROUTING_INFOA;

typedef struct _FAX_GLOBAL_ROUTING_INFOW {
    DWORD SizeOfStruct;
    DWORD Priority;
    LPCWSTR Guid;
    LPCWSTR FriendlyName;
    LPCWSTR FunctionName;
    LPCWSTR ExtensionImageName;
    LPCWSTR ExtensionFriendlyName;
} FAX_GLOBAL_ROUTING_INFOW, *PFAX_GLOBAL_ROUTING_INFOW;

typedef struct _FAX_COVERPAGE_INFOA {
    DWORD SizeOfStruct;
    LPCSTR CoverPageName;
    BOOL UseServerCoverPage;
    LPCSTR RecName;
    LPCSTR RecFaxNumber;
    LPCSTR RecCompany;
    LPCSTR RecStreetAddress;
    LPCSTR RecCity;
    LPCSTR RecState;
    LPCSTR RecZip;
    LPCSTR RecCountry;
    LPCSTR RecTitle;
    LPCSTR RecDepartment;
    LPCSTR RecOfficeLocation;
    LPCSTR RecHomePhone;
    LPCSTR RecOfficePhone;
    LPCSTR SdrName;
    LPCSTR SdrFaxNumber;
    LPCSTR SdrCompany;
    LPCSTR SdrAddress;
    LPCSTR SdrTitle;
    LPCSTR SdrDepartment;
    LPCSTR SdrOfficeLocation;
    LPCSTR SdrHomePhone;
    LPCSTR SdrOfficePhone;
    LPCSTR Note;
    LPCSTR Subject;
    SYSTEMTIME TimeSent;
    DWORD PageCount;
} FAX_COVERPAGE_INFOA, *PFAX_COVERPAGE_INFOA;

typedef struct _FAX_COVERPAGE_INFOW {
    DWORD SizeOfStruct;
    LPCWSTR CoverPageName;
    BOOL UseServerCoverPage;
    LPCWSTR RecName;
    LPCWSTR RecFaxNumber;
    LPCWSTR RecCompany;
    LPCWSTR RecStreetAddress;
    LPCWSTR RecCity;
    LPCWSTR RecState;
    LPCWSTR RecZip;
    LPCWSTR RecCountry;
    LPCWSTR RecTitle;
    LPCWSTR RecDepartment;
    LPCWSTR RecOfficeLocation;
    LPCWSTR RecHomePhone;
    LPCWSTR RecOfficePhone;
    LPCWSTR SdrName;
    LPCWSTR SdrFaxNumber;
    LPCWSTR SdrCompany;
    LPCWSTR SdrAddress;
    LPCWSTR SdrTitle;
    LPCWSTR SdrDepartment;
    LPCWSTR SdrOfficeLocation;
    LPCWSTR SdrHomePhone;
    LPCWSTR SdrOfficePhone;
    LPCWSTR Note;
    LPCWSTR Subject;
    SYSTEMTIME TimeSent;
    DWORD PageCount;
} FAX_COVERPAGE_INFOW, *PFAX_COVERPAGE_INFOW;

typedef struct _FAX_JOB_PARAMA {
    DWORD SizeOfStruct;
    LPCSTR RecipientNumber;
    LPCSTR RecipientName;
    LPCSTR Tsid;
    LPCSTR SenderName;
    LPCSTR SenderCompany;
    LPCSTR SenderDept;
    LPCSTR BillingCode;
    DWORD ScheduleAction;
    SYSTEMTIME ScheduleTime;
    DWORD DeliveryReportType;
    LPCSTR DeliveryReportAddress;
    LPCSTR DocumentName;
    HCALL CallHandle;
    DWORD_PTR Reserved[3];
} FAX_JOB_PARAMA, *PFAX_JOB_PARAMA;

typedef struct _FAX_JOB_PARAMW {
    DWORD SizeOfStruct;
    LPCWSTR RecipientNumber;
    LPCWSTR RecipientName;
    LPCWSTR Tsid;
    LPCWSTR SenderName;
    LPCWSTR SenderCompany;
    LPCWSTR SenderDept;
    LPCWSTR BillingCode;
    DWORD ScheduleAction;
    SYSTEMTIME ScheduleTime;
    DWORD DeliveryReportType;
    LPCWSTR DeliveryReportAddress;
    LPCWSTR DocumentName;
    HCALL CallHandle;
    DWORD_PTR Reserved[3];
} FAX_JOB_PARAMW, *PFAX_JOB_PARAMW;

typedef struct _FAX_EVENTA {
    DWORD SizeOfStruct;
    FILETIME TimeStamp;
    DWORD DeviceId;
    DWORD EventId;
    DWORD JobId;
} FAX_EVENTA, *PFAX_EVENTA;

typedef struct _FAX_EVENTW {
    DWORD SizeOfStruct;
    FILETIME TimeStamp;
    DWORD DeviceId;
    DWORD EventId;
    DWORD JobId;
} FAX_EVENTW, *PFAX_EVENTW;

typedef struct _FAX_PRINT_INFOA {
    DWORD SizeOfStruct;
    LPCSTR DocName;
    LPCSTR RecipientName;
    LPCSTR RecipientNumber;
    LPCSTR SenderName;
    LPCSTR SenderCompany;
    LPCSTR SenderDept;
    LPCSTR SenderBillingCode;
    LPCSTR DrProfileName;
    LPCSTR DrEmailAddress;
    LPCSTR OutputFileName;
} FAX_PRINT_INFOA, *PFAX_PRINT_INFOA;

typedef struct _FAX_PRINT_INFOW {
    DWORD SizeOfStruct;
    LPCWSTR DocName;
    LPCWSTR RecipientName;
    LPCWSTR RecipientNumber;
    LPCWSTR SenderName;
    LPCWSTR SenderCompany;
    LPCWSTR SenderDept;
    LPCWSTR SenderBillingCode;
    LPCWSTR DrProfileName;
    LPCWSTR DrEmailAddress;
    LPCWSTR OutputFileName;
} FAX_PRINT_INFOW, *PFAX_PRINT_INFOW;

typedef struct _FAX_CONTEXT_INFOA {
    DWORD SizeOfStruct;
    HDC hDC;
    CHAR ServerName[MAX_COMPUTERNAME_LENGTH+1];
} FAX_CONTEXT_INFOA, *PFAX_CONTEXT_INFOA;

typedef struct _FAX_CONTEXT_INFOW {
    DWORD SizeOfStruct;
    HDC hDC;
    WCHAR ServerName[MAX_COMPUTERNAME_LENGTH+1];
} FAX_CONTEXT_INFOW, *PFAX_CONTEXT_INFOW;

typedef BOOL (WINAPI *PFAXCONNECTFAXSERVERA)(LPCSTR,LPHANDLE);
typedef BOOL (WINAPI *PFAXCONNECTFAXSERVERW)(LPCWSTR,LPHANDLE);
typedef BOOL (WINAPI *PFAXCLOSE)(HANDLE);
typedef BOOL (WINAPI *PFAXACCESSCHECK)(HANDLE,DWORD);
typedef BOOL (WINAPI *PFAXOPENPORT)(HANDLE,DWORD,DWORD,LPHANDLE);
typedef BOOL (WINAPI *PFAXCOMPLETEJOBPARAMSA)(PFAX_JOB_PARAMA*,PFAX_COVERPAGE_INFOA*);
typedef BOOL (WINAPI *PFAXCOMPLETEJOBPARAMSW)(PFAX_JOB_PARAMW*,PFAX_COVERPAGE_INFOW*);
typedef BOOL (WINAPI *PFAXSENDDOCUMENTA)(HANDLE,LPCSTR,PFAX_JOB_PARAMA,const FAX_COVERPAGE_INFOA*,LPDWORD);
typedef BOOL (WINAPI *PFAXSENDDOCUMENTW)(HANDLE,LPCWSTR,PFAX_JOB_PARAMW,const FAX_COVERPAGE_INFOW*,LPDWORD);
typedef BOOL (CALLBACK *PFAX_RECIPIENT_CALLBACKA)(HANDLE,DWORD,LPVOID,PFAX_JOB_PARAMA,PFAX_COVERPAGE_INFOA);
typedef BOOL (CALLBACK *PFAX_RECIPIENT_CALLBACKW)(HANDLE,DWORD,LPVOID,PFAX_JOB_PARAMW,PFAX_COVERPAGE_INFOW);
typedef BOOL (WINAPI *PFAXSENDDOCUMENTFORBROADCASTA)(HANDLE,LPCSTR,LPDWORD,PFAX_RECIPIENT_CALLBACKA,LPVOID);
typedef BOOL (WINAPI *PFAXSENDDOCUMENTFORBROADCASTW)(HANDLE,LPCWSTR,LPDWORD,PFAX_RECIPIENT_CALLBACKW,LPVOID);
typedef BOOL (WINAPI *PFAXENUMJOBSA)(HANDLE,PFAX_JOB_ENTRYA*,LPDWORD);
typedef BOOL (WINAPI *PFAXENUMJOBSW)(HANDLE,PFAX_JOB_ENTRYW*,LPDWORD);
typedef BOOL (WINAPI *PFAXGETJOBA)(HANDLE,DWORD,PFAX_JOB_ENTRYA*);
typedef BOOL (WINAPI *PFAXGETJOBW)(HANDLE,DWORD,PFAX_JOB_ENTRYW*);
typedef BOOL (WINAPI *PFAXSETJOBA)(HANDLE,DWORD,DWORD,const FAX_JOB_ENTRYA*);
typedef BOOL (WINAPI *PFAXSETJOBW)(HANDLE,DWORD,DWORD,const FAX_JOB_ENTRYW*);
typedef BOOL (WINAPI *PFAXGETPAGEDATA)(HANDLE,DWORD,LPBYTE*,LPDWORD,LPDWORD,LPDWORD);
typedef BOOL (WINAPI *PFAXGETDEVICESTATUSA)(HANDLE,PFAX_DEVICE_STATUSA*);
typedef BOOL (WINAPI *PFAXGETDEVICESTATUSW)(HANDLE,PFAX_DEVICE_STATUSW*);
typedef BOOL (WINAPI *PFAXABORT)(HANDLE,DWORD);
typedef BOOL (WINAPI *PFAXGETCONFIGURATIONA)(HANDLE,PFAX_CONFIGURATIONA*);
typedef BOOL (WINAPI *PFAXGETCONFIGURATIONW)(HANDLE,PFAX_CONFIGURATIONW*);
typedef BOOL (WINAPI *PFAXSETCONFIGURATIONA)(HANDLE,const FAX_CONFIGURATIONA*);
typedef BOOL (WINAPI *PFAXSETCONFIGURATIONW)(HANDLE,const FAX_CONFIGURATIONW*);
typedef BOOL (WINAPI *PFAXGETLOGGINGCATEGORIESA)(HANDLE,PFAX_LOG_CATEGORYA*,LPDWORD);
typedef BOOL (WINAPI *PFAXGETLOGGINGCATEGORIESW)(HANDLE,PFAX_LOG_CATEGORYW*,LPDWORD);
typedef BOOL (WINAPI *PFAXSETLOGGINGCATEGORIESA)(HANDLE,const FAX_LOG_CATEGORYA*,DWORD);
typedef BOOL (WINAPI *PFAXSETLOGGINGCATEGORIESW)(HANDLE,const FAX_LOG_CATEGORYW*,DWORD);
typedef BOOL (WINAPI *PFAXENUMPORTSA)(HANDLE,PFAX_PORT_INFOA*,LPDWORD);
typedef BOOL (WINAPI *PFAXENUMPORTSW)(HANDLE,PFAX_PORT_INFOW*,LPDWORD);
typedef BOOL (WINAPI *PFAXGETPORTA)(HANDLE,PFAX_PORT_INFOA*);
typedef BOOL (WINAPI *PFAXGETPORTW)(HANDLE,PFAX_PORT_INFOW*);
typedef BOOL (WINAPI *PFAXSETPORTA)(HANDLE,const FAX_PORT_INFOA*);
typedef BOOL (WINAPI *PFAXSETPORTW)(HANDLE,const FAX_PORT_INFOW*);
typedef BOOL (WINAPI *PFAXENUMROUTINGMETHODSA)(HANDLE,PFAX_ROUTING_METHODA*,LPDWORD);
typedef BOOL (WINAPI *PFAXENUMROUTINGMETHODSW)(HANDLE,PFAX_ROUTING_METHODW*,LPDWORD);
typedef BOOL (WINAPI *PFAXENABLEROUTINGMETHODA)(HANDLE,LPCSTR,BOOL);
typedef BOOL (WINAPI *PFAXENABLEROUTINGMETHODW)(HANDLE,LPCWSTR,BOOL);
typedef BOOL (WINAPI *PFAXENUMGLOBALROUTINGINFOA)(HANDLE,PFAX_GLOBAL_ROUTING_INFOA*,LPDWORD);
typedef BOOL (WINAPI *PFAXENUMGLOBALROUTINGINFOW)(HANDLE,PFAX_GLOBAL_ROUTING_INFOW*,LPDWORD);
typedef BOOL (WINAPI *PFAXSETGLOBALROUTINGINFOA)(HANDLE,const FAX_GLOBAL_ROUTING_INFOA*);
typedef BOOL (WINAPI *PFAXSETGLOBALROUTINGINFOW)(HANDLE,const FAX_GLOBAL_ROUTING_INFOW*);
typedef BOOL (WINAPI *PFAXGETROUTINGINFOA)(HANDLE,LPCSTR,LPBYTE*,LPDWORD);
typedef BOOL (WINAPI *PFAXGETROUTINGINFOW)(HANDLE,LPCWSTR,LPBYTE*,LPDWORD);
typedef BOOL (WINAPI *PFAXSETROUTINGINFOA)(HANDLE,LPCSTR,const BYTE*,DWORD);
typedef BOOL (WINAPI *PFAXSETROUTINGINFOW)(HANDLE,LPCWSTR,const BYTE*,DWORD);
typedef BOOL (WINAPI *PFAXINITIALIZEEVENTQUEUE)(HANDLE,HANDLE,ULONG_PTR,HWND,UINT);
typedef VOID (WINAPI *PFAXFREEBUFFER)(LPVOID);
typedef BOOL (WINAPI *PFAXSTARTPRINTJOBA)(LPCSTR,const FAX_PRINT_INFOA*,LPDWORD,PFAX_CONTEXT_INFOA);
typedef BOOL (WINAPI *PFAXSTARTPRINTJOBW)(LPCWSTR,const FAX_PRINT_INFOW*,LPDWORD,PFAX_CONTEXT_INFOW);
typedef BOOL (WINAPI *PFAXPRINTCOVERPAGEA)(const FAX_CONTEXT_INFOA*,const FAX_COVERPAGE_INFOA*);
typedef BOOL (WINAPI *PFAXPRINTCOVERPAGEW)(const FAX_CONTEXT_INFOW*,const FAX_COVERPAGE_INFOW*);
typedef BOOL (WINAPI *PFAXREGISTERSERVICEPROVIDERW)(LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
typedef BOOL (CALLBACK *PFAX_ROUTING_INSTALLATION_CALLBACKW)(HANDLE,LPVOID,LPWSTR,LPWSTR,LPWSTR,LPWSTR);
typedef BOOL (WINAPI *PFAXREGISTERROUTINGEXTENSIONW)(HANDLE,LPCWSTR,LPCWSTR,LPCWSTR,PFAX_ROUTING_INSTALLATION_CALLBACKW,LPVOID);

WINFAXAPI BOOL WINAPI FaxConnectFaxServerA(LPCSTR,LPHANDLE);
WINFAXAPI BOOL WINAPI FaxConnectFaxServerW(LPCWSTR,LPHANDLE);
WINFAXAPI BOOL WINAPI FaxClose(HANDLE);
WINFAXAPI BOOL WINAPI FaxAccessCheck(HANDLE,DWORD);
WINFAXAPI BOOL WINAPI FaxOpenPort(HANDLE,DWORD,DWORD,LPHANDLE);
WINFAXAPI BOOL WINAPI FaxCompleteJobParamsA(PFAX_JOB_PARAMA*,PFAX_COVERPAGE_INFOA*);
WINFAXAPI BOOL WINAPI FaxCompleteJobParamsW(PFAX_JOB_PARAMW*,PFAX_COVERPAGE_INFOW*);
WINFAXAPI BOOL WINAPI FaxSendDocumentA(HANDLE,LPCSTR,PFAX_JOB_PARAMA,const FAX_COVERPAGE_INFOA*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxSendDocumentW(HANDLE,LPCWSTR,PFAX_JOB_PARAMW,const FAX_COVERPAGE_INFOW*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxSendDocumentForBroadcastA(HANDLE,LPCSTR,LPDWORD,PFAX_RECIPIENT_CALLBACKA,LPVOID);
WINFAXAPI BOOL WINAPI FaxSendDocumentForBroadcastW(HANDLE,LPCWSTR,LPDWORD,PFAX_RECIPIENT_CALLBACKW,LPVOID);
WINFAXAPI BOOL WINAPI FaxEnumJobsA(HANDLE,PFAX_JOB_ENTRYA*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxEnumJobsW(HANDLE,PFAX_JOB_ENTRYW*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxGetJobA(HANDLE,DWORD,PFAX_JOB_ENTRYA*);
WINFAXAPI BOOL WINAPI FaxGetJobW(HANDLE,DWORD,PFAX_JOB_ENTRYW*);
WINFAXAPI BOOL WINAPI FaxSetJobA(HANDLE,DWORD,DWORD,const FAX_JOB_ENTRYA*);
WINFAXAPI BOOL WINAPI FaxSetJobW(HANDLE,DWORD,DWORD,const FAX_JOB_ENTRYW*);
WINFAXAPI BOOL WINAPI FaxGetPageData(HANDLE,DWORD,LPBYTE*,LPDWORD,LPDWORD,LPDWORD);
WINFAXAPI BOOL WINAPI FaxGetDeviceStatusA(HANDLE,PFAX_DEVICE_STATUSA*);
WINFAXAPI BOOL WINAPI FaxGetDeviceStatusW(HANDLE,PFAX_DEVICE_STATUSW*);
WINFAXAPI BOOL WINAPI FaxAbort(HANDLE,DWORD);
WINFAXAPI BOOL WINAPI FaxGetConfigurationA(HANDLE,PFAX_CONFIGURATIONA*);
WINFAXAPI BOOL WINAPI FaxGetConfigurationW(HANDLE,PFAX_CONFIGURATIONW*);
WINFAXAPI BOOL WINAPI FaxSetConfigurationA(HANDLE,const FAX_CONFIGURATIONA*);
WINFAXAPI BOOL WINAPI FaxSetConfigurationW(HANDLE,const FAX_CONFIGURATIONW*);
WINFAXAPI BOOL WINAPI FaxGetLoggingCategoriesA(HANDLE,PFAX_LOG_CATEGORYA*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxGetLoggingCategoriesW(HANDLE,PFAX_LOG_CATEGORYW*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxSetLoggingCategoriesA(HANDLE,const FAX_LOG_CATEGORYA*,DWORD);
WINFAXAPI BOOL WINAPI FaxSetLoggingCategoriesW(HANDLE,const FAX_LOG_CATEGORYW*,DWORD);
WINFAXAPI BOOL WINAPI FaxEnumPortsA(HANDLE,PFAX_PORT_INFOA*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxEnumPortsW(HANDLE,PFAX_PORT_INFOW*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxGetPortA(HANDLE,PFAX_PORT_INFOA*);
WINFAXAPI BOOL WINAPI FaxGetPortW(HANDLE,PFAX_PORT_INFOW*);
WINFAXAPI BOOL WINAPI FaxSetPortA(HANDLE,const FAX_PORT_INFOA*);
WINFAXAPI BOOL WINAPI FaxSetPortW(HANDLE,const FAX_PORT_INFOW*);
WINFAXAPI BOOL WINAPI FaxEnumRoutingMethodsA(HANDLE,PFAX_ROUTING_METHODA*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxEnumRoutingMethodsW(HANDLE,PFAX_ROUTING_METHODW*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxEnableRoutingMethodA(HANDLE,LPCSTR,BOOL);
WINFAXAPI BOOL WINAPI FaxEnableRoutingMethodW(HANDLE,LPCWSTR,BOOL);
WINFAXAPI BOOL WINAPI FaxEnumGlobalRoutingInfoA(HANDLE,PFAX_GLOBAL_ROUTING_INFOA*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxEnumGlobalRoutingInfoW(HANDLE,PFAX_GLOBAL_ROUTING_INFOW*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxSetGlobalRoutingInfoA(HANDLE,const FAX_GLOBAL_ROUTING_INFOA*);
WINFAXAPI BOOL WINAPI FaxSetGlobalRoutingInfoW(HANDLE,const FAX_GLOBAL_ROUTING_INFOW*);
WINFAXAPI BOOL WINAPI FaxGetRoutingInfoA(HANDLE,LPCSTR,LPBYTE*,LPDWORD);
WINFAXAPI BOOL WINAPI FaxGetRoutingInfoW(HANDLE,LPCWSTR,LPBYTE*, LPDWORD);
WINFAXAPI BOOL WINAPI FaxSetRoutingInfoA(HANDLE,LPCSTR,const BYTE*,DWORD);
WINFAXAPI BOOL WINAPI FaxSetRoutingInfoW(HANDLE,LPCWSTR,const BYTE*,DWORD);
WINFAXAPI BOOL WINAPI FaxInitializeEventQueue(HANDLE,HANDLE,ULONG_PTR,HWND,UINT);
WINFAXAPI VOID WINAPI FaxFreeBuffer(LPVOID);
WINFAXAPI BOOL WINAPI FaxStartPrintJobA(LPCSTR,const FAX_PRINT_INFOA*,LPDWORD,PFAX_CONTEXT_INFOA);
WINFAXAPI BOOL WINAPI FaxStartPrintJobW(LPCWSTR,const FAX_PRINT_INFOW*,LPDWORD,PFAX_CONTEXT_INFOW);
WINFAXAPI BOOL WINAPI FaxPrintCoverPageA(const FAX_CONTEXT_INFOA*,const FAX_COVERPAGE_INFOA*);
WINFAXAPI BOOL WINAPI FaxPrintCoverPageW(const FAX_CONTEXT_INFOW*,const FAX_COVERPAGE_INFOW*);
WINFAXAPI BOOL WINAPI FaxRegisterServiceProviderW(LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
WINFAXAPI BOOL WINAPI FaxRegisterRoutingExtensionW(HANDLE,LPCWSTR,LPCWSTR,LPCWSTR,PFAX_ROUTING_INSTALLATION_CALLBACKW,LPVOID);

#ifdef UNICODE
typedef FAX_LOG_CATEGORYW FAX_LOG_CATEGORY;
typedef PFAX_LOG_CATEGORYW PFAX_LOG_CATEGORY;
typedef FAX_CONFIGURATIONW FAX_CONFIGURATION;
typedef PFAX_CONFIGURATIONW PFAX_CONFIGURATION;
typedef FAX_DEVICE_STATUSW FAX_DEVICE_STATUS;
typedef PFAX_DEVICE_STATUSW PFAX_DEVICE_STATUS;
typedef FAX_JOB_ENTRYW FAX_JOB_ENTRY;
typedef PFAX_JOB_ENTRYW PFAX_JOB_ENTRY;
typedef FAX_PORT_INFOW FAX_PORT_INFO;
typedef PFAX_PORT_INFOW PFAX_PORT_INFO;
typedef FAX_ROUTING_METHODW FAX_ROUTING_METHOD;
typedef PFAX_ROUTING_METHODW PFAX_ROUTING_METHOD;
typedef FAX_GLOBAL_ROUTING_INFOW FAX_GLOBAL_ROUTING_INFO;
typedef PFAX_GLOBAL_ROUTING_INFOW PFAX_GLOBAL_ROUTING_INFO;
typedef FAX_COVERPAGE_INFOW FAX_COVERPAGE_INFO;
typedef PFAX_COVERPAGE_INFOW PFAX_COVERPAGE_INFO;
typedef FAX_JOB_PARAMW FAX_JOB_PARAM;
typedef PFAX_JOB_PARAMW PFAX_JOB_PARAM;
typedef FAX_EVENTW FAX_EVENT;
typedef PFAX_EVENTW PFAX_EVENT;
typedef FAX_PRINT_INFOW FAX_PRINT_INFO;
typedef PFAX_PRINT_INFOW PFAX_PRINT_INFO;
typedef FAX_CONTEXT_INFOW FAX_CONTEXT_INFO;
typedef PFAX_CONTEXT_INFOW PFAX_CONTEXT_INFO;
#define PFAXCONNECTFAXSERVER PFAXCONNECTFAXSERVERW
#define PFAXCOMPLETEJOBPARAMS PFAXCOMPLETEJOBPARAMSW
#define PFAXSENDDOCUMENT PFAXSENDDOCUMENTW
#define PFAX_RECIPIENT_CALLBACK PFAX_RECIPIENT_CALLBACKW
#define PFAXSENDDOCUMENTFORBROADCAST PFAXSENDDOCUMENTFORBROADCASTW
#define PFAXENUMJOBS PFAXENUMJOBSW
#define PFAXGETJOB PFAXGETJOBW
#define PFAXSETJOB PFAXSETJOBW
#define PFAXGETDEVICESTATUS PFAXGETDEVICESTATUSW
#define PFAXGETCONFIGURATION PFAXGETCONFIGURATIONW
#define PFAXSETCONFIGURATION PFAXSETCONFIGURATIONW
#define PFAXGETLOGGINGCATEGORIES PFAXGETLOGGINGCATEGORIESW
#define PFAXSETLOGGINGCATEGORIES PFAXSETLOGGINGCATEGORIESW
#define PFAXENUMPORTS PFAXENUMPORTSW
#define PFAXGETPORT PFAXGETPORTW
#define PFAXSETPORT PFAXSETPORTW
#define PFAXENUMROUTINGMETHODS PFAXENUMROUTINGMETHODSW
#define PFAXENABLEROUTINGMETHOD PFAXENABLEROUTINGMETHODW
#define PFAXENUMGLOBALROUTINGINFO PFAXENUMGLOBALROUTINGINFOW
#define PFAXSETGLOBALROUTINGINFO PFAXSETGLOBALROUTINGINFOW
#define PFAXGETROUTINGINFO PFAXGETROUTINGINFOW
#define PFAXSETROUTINGINFO PFAXSETROUTINGINFOW
#define PFAXSTARTPRINTJOB PFAXSTARTPRINTJOBW
#define PFAXPRINTCOVERPAGE PFAXPRINTCOVERPAGEW
#define FaxConnectFaxServer FaxConnectFaxServerW
#define FaxCompleteJobParams FaxCompleteJobParamsW
#define FaxSendDocument FaxSendDocumentW
#define FaxSendDocumentForBroadcast FaxSendDocumentForBroadcastW
#define FaxEnumJobs FaxEnumJobsW
#define FaxGetJob FaxGetJobW
#define FaxSetJob FaxSetJobW
#define FaxGetDeviceStatus FaxGetDeviceStatusW
#define FaxGetConfiguration FaxGetConfigurationW
#define FaxSetConfiguration FaxSetConfigurationW
#define FaxGetLoggingCategories FaxGetLoggingCategoriesW
#define FaxSetLoggingCategories FaxSetLoggingCategoriesW
#define FaxEnumPorts FaxEnumPortsW
#define FaxGetPort FaxGetPortW
#define FaxSetPort FaxSetPortW
#define FaxEnumRoutingMethods FaxEnumRoutingMethodsW
#define FaxEnableRoutingMethod FaxEnableRoutingMethodW
#define FaxEnumGlobalRoutingInfo FaxEnumGlobalRoutingInfoW
#define FaxSetGlobalRoutingInfo FaxSetGlobalRoutingInfoW
#define FaxGetRoutingInfo FaxGetRoutingInfoW
#define FaxSetRoutingInfo FaxSetRoutingInfoW
#define FaxStartPrintJob FaxStartPrintJobW
#define FaxPrintCoverPage FaxPrintCoverPageW
#else
typedef FAX_LOG_CATEGORYA FAX_LOG_CATEGORY;
typedef PFAX_LOG_CATEGORYA PFAX_LOG_CATEGORY;
typedef FAX_CONFIGURATIONA FAX_CONFIGURATION;
typedef PFAX_CONFIGURATIONA PFAX_CONFIGURATION;
typedef FAX_DEVICE_STATUSA FAX_DEVICE_STATUS;
typedef PFAX_DEVICE_STATUSA PFAX_DEVICE_STATUS;
typedef FAX_JOB_ENTRYA FAX_JOB_ENTRY;
typedef PFAX_JOB_ENTRYA PFAX_JOB_ENTRY;
typedef FAX_PORT_INFOA FAX_PORT_INFO;
typedef PFAX_PORT_INFOA PFAX_PORT_INFO;
typedef FAX_ROUTING_METHODA FAX_ROUTING_METHOD;
typedef PFAX_ROUTING_METHODA PFAX_ROUTING_METHOD;
typedef FAX_GLOBAL_ROUTING_INFOA FAX_GLOBAL_ROUTING_INFO;
typedef PFAX_GLOBAL_ROUTING_INFOA PFAX_GLOBAL_ROUTING_INFO;
typedef FAX_COVERPAGE_INFOA FAX_COVERPAGE_INFO;
typedef PFAX_COVERPAGE_INFOA PFAX_COVERPAGE_INFO;
typedef FAX_JOB_PARAMA FAX_JOB_PARAM;
typedef PFAX_JOB_PARAMA PFAX_JOB_PARAM;
typedef FAX_EVENTA FAX_EVENT;
typedef PFAX_EVENTA PFAX_EVENT;
typedef FAX_PRINT_INFOA FAX_PRINT_INFO;
typedef PFAX_PRINT_INFOA PFAX_PRINT_INFO;
typedef FAX_CONTEXT_INFOA FAX_CONTEXT_INFO;
typedef PFAX_CONTEXT_INFOA PFAX_CONTEXT_INFO;
#define PFAXCONNECTFAXSERVER PFAXCONNECTFAXSERVERA
#define PFAXCOMPLETEJOBPARAMS PFAXCOMPLETEJOBPARAMSA
#define PFAXSENDDOCUMENT PFAXSENDDOCUMENTA
#define PFAX_RECIPIENT_CALLBACK PFAX_RECIPIENT_CALLBACKA
#define PFAXSENDDOCUMENTFORBROADCAST PFAXSENDDOCUMENTFORBROADCASTA
#define PFAXENUMJOBS PFAXENUMJOBSA
#define PFAXGETJOB PFAXGETJOBA
#define PFAXSETJOB PFAXSETJOBA
#define PFAXGETDEVICESTATUS PFAXGETDEVICESTATUSA
#define PFAXGETCONFIGURATION PFAXGETCONFIGURATIONA
#define PFAXSETCONFIGURATION PFAXSETCONFIGURATIONA
#define PFAXGETLOGGINGCATEGORIES PFAXGETLOGGINGCATEGORIESA
#define PFAXSETLOGGINGCATEGORIES PFAXSETLOGGINGCATEGORIESA
#define PFAXENUMPORTS PFAXENUMPORTSA
#define PFAXGETPORT PFAXGETPORTA
#define PFAXSETPORT PFAXSETPORTA
#define PFAXENUMROUTINGMETHODS PFAXENUMROUTINGMETHODSA
#define PFAXENABLEROUTINGMETHOD PFAXENABLEROUTINGMETHODA
#define PFAXENUMGLOBALROUTINGINFO PFAXENUMGLOBALROUTINGINFOA
#define PFAXSETGLOBALROUTINGINFO PFAXSETGLOBALROUTINGINFOA
#define PFAXGETROUTINGINFO PFAXGETROUTINGINFOA
#define PFAXSETROUTINGINFO PFAXSETROUTINGINFOA
#define PFAXSTARTPRINTJOB PFAXSTARTPRINTJOBA
#define PFAXPRINTCOVERPAGE PFAXPRINTCOVERPAGEA
#define FaxConnectFaxServer FaxConnectFaxServerA
#define FaxCompleteJobParams FaxCompleteJobParamsA
#define FaxSendDocument FaxSendDocumentA
#define FaxSendDocumentForBroadcast FaxSendDocumentForBroadcastA
#define FaxEnumJobs FaxEnumJobsA
#define FaxGetJob FaxGetJobA
#define FaxSetJob FaxSetJobA
#define FaxGetDeviceStatus FaxGetDeviceStatusA
#define FaxGetConfiguration FaxGetConfigurationA
#define FaxSetConfiguration FaxSetConfigurationA
#define FaxGetLoggingCategories FaxGetLoggingCategoriesA
#define FaxSetLoggingCategories FaxSetLoggingCategoriesA
#define FaxEnumPorts FaxEnumPortsA
#define FaxGetPort FaxGetPortA
#define FaxSetPort FaxSetPortA
#define FaxEnumRoutingMethods FaxEnumRoutingMethodsA
#define FaxEnableRoutingMethod FaxEnableRoutingMethodA
#define FaxEnumGlobalRoutingInfo FaxEnumGlobalRoutingInfoA
#define FaxSetGlobalRoutingInfo FaxSetGlobalRoutingInfoA
#define FaxGetRoutingInfo FaxGetRoutingInfoA
#define FaxSetRoutingInfo FaxSetRoutingInfoA
#define FaxStartPrintJob FaxStartPrintJobA
#define FaxPrintCoverPage FaxPrintCoverPageA
#endif /* UNICODE */

#define PFAXREGISTERSERVICEPROVIDER PFAXREGISTERSERVICEPROVIDERW
#define PFAXREGISTERROUTINGEXTENSION PFAXREGISTERROUTINGEXTENSIONW
#define PFAX_ROUTING_INSTALLATION_CALLBACK PFAX_ROUTING_INSTALLATION_CALLBACKW
#define FaxRegisterServiceProvider FaxRegisterServiceProviderW
#define FaxRegisterRoutingExtension FaxRegisterRoutingExtensionW

#ifdef __cplusplus
}
#endif

#endif /* _WINFAX_H */
