|
| 1 | +// PawnIOLib - Library and tooling source to be used with PawnIO. |
| 2 | +// Copyright (C) 2023 namazso <admin@namazso.eu> |
| 3 | +// |
| 4 | +// This library is free software; you can redistribute it and/or |
| 5 | +// modify it under the terms of the GNU Lesser General Public |
| 6 | +// License as published by the Free Software Foundation; either |
| 7 | +// version 2.1 of the License, or (at your option) any later version. |
| 8 | +// |
| 9 | +// This library is distributed in the hope that it will be useful, |
| 10 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | +// Lesser General Public License for more details. |
| 13 | +// |
| 14 | +// You should have received a copy of the GNU Lesser General Public |
| 15 | +// License along with this library; if not, write to the Free Software |
| 16 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | + |
| 18 | +#ifndef PAWNIOLIB_LIBRARY_H |
| 19 | +#define PAWNIOLIB_LIBRARY_H |
| 20 | + |
| 21 | +#ifdef PawnIOLib_EXPORTS |
| 22 | +#define PAWNIO_EXPORT __declspec(dllexport) |
| 23 | +#else |
| 24 | +#define PAWNIO_EXPORT __declspec(dllimport) |
| 25 | +#endif |
| 26 | + |
| 27 | +#define PAWNIOAPI EXTERN_C PAWNIO_EXPORT HRESULT STDAPICALLTYPE |
| 28 | + |
| 29 | +/// Get PawnIOLib version. |
| 30 | +/// |
| 31 | +/// @p version A pointer to a ULONG which receives the version. |
| 32 | +/// @return A HRESULT. |
| 33 | +PAWNIOAPI pawnio_version(PULONG version); |
| 34 | + |
| 35 | +/// Open a PawnIO executor. |
| 36 | +/// |
| 37 | +/// @p handle A handle to the executor, or NULL. |
| 38 | +/// @return A HRESULT. |
| 39 | +PAWNIOAPI pawnio_open(PHANDLE handle); |
| 40 | + |
| 41 | +/// Load a PawnIO blob. |
| 42 | +/// |
| 43 | +/// @p handle Handle from @c pawnio_open. |
| 44 | +/// @p blob Blob to load. |
| 45 | +/// @p size Size of blob. |
| 46 | +/// @return A HRESULT. |
| 47 | +PAWNIOAPI pawnio_load(HANDLE handle, const UCHAR* blob, SIZE_T size); |
| 48 | + |
| 49 | +/// Executes a function from the loaded blob. |
| 50 | +/// |
| 51 | +/// @p handle Handle from @c pawnio_open. |
| 52 | +/// @p name Function name to execute. |
| 53 | +/// @p in Input buffer. |
| 54 | +/// @p in_size Input buffer count. |
| 55 | +/// @p out Output buffer. |
| 56 | +/// @p out_size Output buffer count. |
| 57 | +/// @p return_size Entries written in out_size. |
| 58 | +/// @return A HRESULT. |
| 59 | +PAWNIOAPI pawnio_execute( |
| 60 | + HANDLE handle, |
| 61 | + PCSTR name, |
| 62 | + const ULONG64* in, |
| 63 | + SIZE_T in_size, |
| 64 | + PULONG64 out, |
| 65 | + SIZE_T out_size, |
| 66 | + PSIZE_T return_size |
| 67 | +); |
| 68 | + |
| 69 | +/// Close a PawnIO executor. |
| 70 | +/// |
| 71 | +/// @p handle Handle from @c pawnio_open. |
| 72 | +/// @return A HRESULT. |
| 73 | +PAWNIOAPI pawnio_close(HANDLE handle); |
| 74 | + |
| 75 | +#endif //PAWNIOLIB_LIBRARY_H |
0 commit comments