#ifndef _WDSCLIENTAPI_H
#define _WDSCLIENTAPI_H

#if __POCC__ >= 500
#pragma once
#endif

/* WDS Client API definitions (Vista+) */

#define WDSCLIAPI WINAPI
#define WDSCLIAPIV WINAPIV  /* fix M$ bug */

#if defined(WIN32_DEFAULT_LIBS)
#pragma comment(lib, "wdsclientapi.lib")
#endif

#ifdef __cplusplus
extern "C"
{
#endif

#define WDS_CLI_TRANSFER_ASYNCHRONOUS  0x00000001

typedef struct tagWDS_CLI_CRED {
    PCWSTR pwszUserName,
    pwszDomain,
    pwszPassword;
} WDS_CLI_CRED , *PWDS_CLI_CRED, *LPWDS_CLI_CRED;

typedef VOID(WDSCLIAPI *PFN_WdsCliTraceFunction)(LPCWSTR, va_list);

enum {
    WdsCliFlagEnumFilterVersion = 0x0001
};

/*typedef*/ enum {
    WDS_LOG_TYPE_CLIENT_ERROR = 1,
    WDS_LOG_TYPE_CLIENT_STARTED,
    WDS_LOG_TYPE_CLIENT_FINISHED,
    WDS_LOG_TYPE_CLIENT_IMAGE_SELECTED,
    WDS_LOG_TYPE_CLIENT_APPLY_STARTED,
    WDS_LOG_TYPE_CLIENT_APPLY_FINISHED,
    WDS_LOG_TYPE_CLIENT_GENERIC_MESSAGE,
    WDS_LOG_TYPE_CLIENT_UNATTEND_MODE,
    WDS_LOG_TYPE_CLIENT_TRANSFER_START,
    WDS_LOG_TYPE_CLIENT_TRANSFER_END,
    WDS_LOG_TYPE_CLIENT_TRANSFER_DOWNGRADE,
    WDS_LOG_TYPE_CLIENT_DOMAINJOINERROR,
    WDS_LOG_TYPE_CLIENT_POST_ACTIONS_START,
    WDS_LOG_TYPE_CLIENT_POST_ACTIONS_END,
    WDS_LOG_TYPE_CLIENT_APPLY_STARTED_2,
    WDS_LOG_TYPE_CLIENT_APPLY_FINISHED_2,
    WDS_LOG_TYPE_CLIENT_DOMAINJOINERROR_2,
    WDS_LOG_TYPE_CLIENT_MAX_CODE
};

/*typedef*/ enum {
    WDS_LOG_LEVEL_DISABLED = 0,
    WDS_LOG_LEVEL_ERROR = 1,
    WDS_LOG_LEVEL_WARNING = 2,
    WDS_LOG_LEVEL_INFO = 3
};

typedef VOID(WDSCLIAPI *PFN_WdsCliCallback)(DWORD, WPARAM, LPARAM, PVOID);

/*typedef*/ enum {
    WDS_CLI_MSG_START = 0,
    WDS_CLI_MSG_COMPLETE,
    WDS_CLI_MSG_PROGRESS,
    WDS_CLI_MSG_TEXT,
};

HRESULT WDSCLIAPI WdsCliClose(HANDLE);
HRESULT WDSCLIAPI WdsCliRegisterTrace(PFN_WdsCliTraceFunction);
HRESULT WDSCLIAPI WdsCliFindFirstImage(HANDLE, PHANDLE);
HRESULT WDSCLIAPI WdsCliFindNextImage(HANDLE);
HRESULT WDSCLIAPI WdsCliGetEnumerationFlags(HANDLE, PDWORD);
HRESULT WDSCLIAPI WdsCliGetImageHandleFromFindHandle(HANDLE, PHANDLE);
HRESULT WDSCLIAPI WdsCliGetImageHandleFromTransferHandle(HANDLE, PHANDLE);
HRESULT WDSCLIAPI WdsCliCreateSession(PWSTR, PWDS_CLI_CRED, PHANDLE);
HRESULT WDSCLIAPI WdsCliAuthorizeSession(HANDLE, PWDS_CLI_CRED);
HRESULT WDSCLIAPI WdsCliInitializeLog(HANDLE, ULONG, PWSTR, PWSTR);
HRESULT WDSCLIAPIV WdsCliLog(HANDLE, ULONG, ULONG, ...);
HRESULT WDSCLIAPI WdsCliGetImageName(HANDLE, PWSTR *);
HRESULT WDSCLIAPI WdsCliGetImageDescription(HANDLE, PWSTR *);
HRESULT WDSCLIAPI WdsCliGetImageLanguage(HANDLE, PWSTR *);
HRESULT WDSCLIAPI WdsCliGetImageLanguages(HANDLE, PTSTR **, PDWORD);
HRESULT WDSCLIAPI WdsCliGetImageVersion(HANDLE, PWSTR *);
HRESULT WDSCLIAPI WdsCliGetImagePath(HANDLE, PWSTR *);
HRESULT WDSCLIAPI WdsCliGetImageIndex(HANDLE, PDWORD);
HRESULT WDSCLIAPI WdsCliGetImageArchitecture(HANDLE, PDWORD);
HRESULT WDSCLIAPI WdsCliGetImageLastModifiedTime(HANDLE, PSYSTEMTIME *);
HRESULT WDSCLIAPI WdsCliGetImageSize(HANDLE, PULONGLONG);
HRESULT WDSCLIAPI WdsCliGetImageHalName(HANDLE, PWSTR *);
HRESULT WDSCLIAPI WdsCliGetImageGroup(HANDLE, PWSTR *);
HRESULT WDSCLIAPI WdsCliGetImageNamespace(HANDLE, PWSTR *);
HRESULT WDSCLIAPI WdsCliGetTransferSize(HANDLE, PULONGLONG);
HRESULT WDSCLIAPI WdsCliTransferImage(HANDLE, PWSTR, DWORD, DWORD, PFN_WdsCliCallback, PVOID, PHANDLE);
HRESULT WDSCLIAPI WdsCliTransferFile(PCWSTR, PCWSTR, PCWSTR, PCWSTR, DWORD, DWORD, PFN_WdsCliCallback, PVOID, PHANDLE);
HRESULT WDSCLIAPI WdsCliCancelTransfer(HANDLE);
HRESULT WDSCLIAPI WdsCliWaitForTransfer(HANDLE);

#ifdef __cplusplus
}
#endif

#endif /* _WDSCLIENTAPI_H */
