119 lines
3.1 KiB
C
119 lines
3.1 KiB
C
/**
|
|
* @file UplayOverlapped.h
|
|
* @brief The Uplay PC Overlapped API
|
|
*/
|
|
#ifndef UPLAY_OVERLAPPED_H
|
|
#define UPLAY_OVERLAPPED_H
|
|
|
|
#include "Uplay/UplayTypes.h"
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif
|
|
|
|
#ifndef UPLAY_API
|
|
#ifdef _WIN32
|
|
#if defined EXPORTING_DLL
|
|
#define UPLAY_API __declspec(dllexport)
|
|
#elif defined IMPORTING_DLL
|
|
#define UPLAY_API __declspec(dllimport)
|
|
#else
|
|
#define UPLAY_API
|
|
#endif
|
|
#endif // _Win32
|
|
|
|
#ifdef __APPLE__
|
|
#define UPLAY_API __attribute__((visibility("default")))
|
|
#define __cdecl
|
|
#endif // __APPLE__
|
|
#endif // UPLAY_API
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif // __cplusplus
|
|
|
|
/**
|
|
* @defgroup overlapped Overlapped
|
|
* @brief Overlapped function handling
|
|
*
|
|
* @{
|
|
*/
|
|
|
|
/************************************************************************************//**
|
|
* @enum UPLAY_OverlappedResult
|
|
* @brief Overlapped result values
|
|
*
|
|
* The meaning of the different values is determined by the function called. See the
|
|
* documentation for each function for details.
|
|
*/
|
|
enum UPLAY_OverlappedResult
|
|
{
|
|
UPLAY_OverlappedResult_Ok = 0,
|
|
UPLAY_OverlappedResult_InvalidArgument,
|
|
UPLAY_OverlappedResult_ConnectionError,
|
|
UPLAY_OverlappedResult_NotFound,
|
|
UPLAY_OverlappedResult_NotAPartyLeader,
|
|
UPLAY_OverlappedResult_PartyFull,
|
|
UPLAY_OverlappedResult_Failed,
|
|
UPLAY_OverlappedResult_AlreadyOpened,
|
|
UPLAY_OverlappedResult_SlotLocked,
|
|
UPLAY_OverlappedResult_OverwriteNotAllowed
|
|
};
|
|
|
|
#pragma pack(push, 8)
|
|
|
|
/************************************************************************************//**
|
|
* @struct UPLAY_Overlapped
|
|
* @brief Struct for information about overlapped functions
|
|
*
|
|
* Information can be retrieved from the overlapped struct by calling
|
|
* ::UPLAY_HasOverlappedOperationCompleted() and ::UPLAY_GetOverlappedOperationResult().
|
|
*/
|
|
typedef struct UPLAY_Overlapped_t
|
|
{
|
|
/** Internal data. Should not be accessed directly */
|
|
UPLAY_uint64 _internal[2];
|
|
} UPLAY_Overlapped;
|
|
|
|
#pragma pack(pop)
|
|
|
|
/************************************************************************************//**
|
|
* @fn UPLAY_uint8 UPLAY_HasOverlappedOperationCompleted(UPLAY_Overlapped*)
|
|
* @brief Check if a overlapped function has completed
|
|
*
|
|
* @param aOverlapped
|
|
* Overlapped struct
|
|
*
|
|
* @returns One of \c aOverlapped is valid and the operation has completed, zero otherwise.
|
|
*/
|
|
UPLAY_uint8
|
|
UPLAY_API UPLAY_HasOverlappedOperationCompleted(
|
|
UPLAY_Overlapped* aOverlapped);
|
|
|
|
/************************************************************************************//**
|
|
* @fn int UPLAY_GetOverlappedOperationResult(UPLAY_Overlapped*, UPLAY_uint32*)
|
|
* @brief Get the result of a completed overlapped function
|
|
*
|
|
* @param aOverlapped
|
|
* Overlapped struct
|
|
* @param aOutResult
|
|
* The result of the overlapped function. See enum ::UPLAY_OverlappedResult for valid values.
|
|
*
|
|
* @returns Non-zero on success.
|
|
*
|
|
* @note If the overlapped function has not been completed the
|
|
* call will fail.
|
|
*/
|
|
int
|
|
UPLAY_API UPLAY_GetOverlappedOperationResult(
|
|
UPLAY_Overlapped* aOverlapped,
|
|
UPLAY_uint32* aOutResult);
|
|
|
|
/** @} */
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif // __cplusplus
|
|
|
|
#endif // UPLAY_OVERLAPPED_H
|
|
|