| 1 | /* | 
|---|
| 2 | * Copyright 2020 Nikolay Sivov for CodeWeavers | 
|---|
| 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 St, Fifth Floor, Boston, MA 02110-1301, USA | 
|---|
| 17 | */ | 
|---|
| 18 |  | 
|---|
| 19 | import "unknwn.idl"; | 
|---|
| 20 |  | 
|---|
| 21 | typedef enum | 
|---|
| 22 | { | 
|---|
| 23 | RTWQ_STANDARD_WORKQUEUE = 0, | 
|---|
| 24 | RTWQ_WINDOW_WORKQUEUE = 1, | 
|---|
| 25 | RTWQ_MULTITHREADED_WORKQUEUE = 2, | 
|---|
| 26 | } RTWQ_WORKQUEUE_TYPE; | 
|---|
| 27 |  | 
|---|
| 28 | typedef unsigned __int64 RTWQWORKITEM_KEY; | 
|---|
| 29 |  | 
|---|
| 30 | [ | 
|---|
| 31 | object, | 
|---|
| 32 | uuid(ac6b7889-0740-4d51-8619-905994a55cc6), | 
|---|
| 33 | local | 
|---|
| 34 | ] | 
|---|
| 35 | interface IRtwqAsyncResult : IUnknown | 
|---|
| 36 | { | 
|---|
| 37 | HRESULT GetState([out] IUnknown **state); | 
|---|
| 38 | HRESULT GetStatus(); | 
|---|
| 39 | HRESULT SetStatus([in] HRESULT status); | 
|---|
| 40 | HRESULT GetObject([out] IUnknown **object); | 
|---|
| 41 | IUnknown *GetStateNoAddRef(); | 
|---|
| 42 | } | 
|---|
| 43 |  | 
|---|
| 44 | [ | 
|---|
| 45 | object, | 
|---|
| 46 | uuid(a27003cf-2354-4f2a-8d6a-ab7cff15437e), | 
|---|
| 47 | local | 
|---|
| 48 | ] | 
|---|
| 49 | interface IRtwqAsyncCallback : IUnknown | 
|---|
| 50 | { | 
|---|
| 51 | HRESULT GetParameters([out] DWORD *flags, [out] DWORD *queue); | 
|---|
| 52 | HRESULT Invoke([in] IRtwqAsyncResult *result); | 
|---|
| 53 | } | 
|---|
| 54 |  | 
|---|
| 55 | [ | 
|---|
| 56 | object, | 
|---|
| 57 | uuid(63d9255a-7ff1-4b61-8faf-ed6460dacf2b), | 
|---|
| 58 | local | 
|---|
| 59 | ] | 
|---|
| 60 | interface IRtwqPlatformEvents : IUnknown | 
|---|
| 61 | { | 
|---|
| 62 | HRESULT InitializationComplete(void); | 
|---|
| 63 | HRESULT ShutdownStart(void); | 
|---|
| 64 | HRESULT ShutdownComplete(void); | 
|---|
| 65 | } | 
|---|
| 66 |  | 
|---|
| 67 | cpp_quote("#define RTWQ_E_ERROR(x)            ((HRESULT)(0xc00d0000L+x))") | 
|---|
| 68 | cpp_quote("#define RTWQ_E_BUFFERTOOSMALL      RTWQ_E_ERROR(14001)") | 
|---|
| 69 | cpp_quote("#define RTWQ_E_NOT_INITIALIZED     RTWQ_E_ERROR(14006)") | 
|---|
| 70 | cpp_quote("#define RTWQ_E_UNEXPECTED          RTWQ_E_ERROR(14011)") | 
|---|
| 71 | cpp_quote("#define RTWQ_E_NOT_FOUND           RTWQ_E_ERROR(14037)") | 
|---|
| 72 | cpp_quote("#define RTWQ_E_OPERATION_CANCELLED RTWQ_E_ERROR(14061)") | 
|---|
| 73 | cpp_quote("#define RTWQ_E_INVALID_WORKQUEUE   RTWQ_E_ERROR(14079)") | 
|---|
| 74 | cpp_quote("#define RTWQ_E_SHUTDOWN            RTWQ_E_ERROR(16005)") | 
|---|
| 75 |  | 
|---|
| 76 | cpp_quote("#ifdef __WINESRC__") | 
|---|
| 77 | cpp_quote("typedef struct tagRTWQASYNCRESULT") | 
|---|
| 78 | cpp_quote("{") | 
|---|
| 79 | cpp_quote("    IRtwqAsyncResult AsyncResult;") | 
|---|
| 80 | cpp_quote("#else") | 
|---|
| 81 | cpp_quote("typedef struct tagRTWQASYNCRESULT : public IRtwqAsyncResult {") | 
|---|
| 82 | cpp_quote("#endif") | 
|---|
| 83 | cpp_quote("    OVERLAPPED overlapped;") | 
|---|
| 84 | cpp_quote("    IRtwqAsyncCallback *pCallback;") | 
|---|
| 85 | cpp_quote("    HRESULT hrStatusResult;") | 
|---|
| 86 | cpp_quote("    DWORD dwBytesTransferred;") | 
|---|
| 87 | cpp_quote("    HANDLE hEvent;") | 
|---|
| 88 | cpp_quote("} RTWQASYNCRESULT;") | 
|---|
| 89 |  | 
|---|
| 90 | cpp_quote("typedef void (WINAPI *RTWQPERIODICCALLBACK)(IUnknown *context);") | 
|---|
| 91 |  | 
|---|
| 92 | cpp_quote("HRESULT WINAPI RtwqAddPeriodicCallback(RTWQPERIODICCALLBACK callback, IUnknown *context, DWORD *key);") | 
|---|
| 93 | cpp_quote("HRESULT WINAPI RtwqAllocateSerialWorkQueue(DWORD target_queue, DWORD *queue);") | 
|---|
| 94 | cpp_quote("HRESULT WINAPI RtwqAllocateWorkQueue(RTWQ_WORKQUEUE_TYPE queue_type, DWORD *queue);") | 
|---|
| 95 | cpp_quote("HRESULT WINAPI RtwqBeginRegisterWorkQueueWithMMCSS(DWORD queue, const WCHAR *mmcss_class, DWORD taskid, LONG priority, IRtwqAsyncCallback *callback, IUnknown *state);") | 
|---|
| 96 | cpp_quote("HRESULT WINAPI RtwqBeginUnregisterWorkQueueWithMMCSS(DWORD queue, IRtwqAsyncCallback *callback, IUnknown *state);") | 
|---|
| 97 | cpp_quote("HRESULT WINAPI RtwqCancelDeadline(HANDLE request);") | 
|---|
| 98 | cpp_quote("HRESULT WINAPI RtwqCancelWorkItem(RTWQWORKITEM_KEY key);") | 
|---|
| 99 | cpp_quote("HRESULT WINAPI RtwqCreateAsyncResult(IUnknown *object, IRtwqAsyncCallback *callback, IUnknown *state, IRtwqAsyncResult **result);") | 
|---|
| 100 | cpp_quote("HRESULT WINAPI RtwqEndRegisterWorkQueueWithMMCSS(IRtwqAsyncResult *result, DWORD *taskid);") | 
|---|
| 101 | cpp_quote("HRESULT WINAPI RtwqGetWorkQueueMMCSSClass(DWORD queue, WCHAR *mmcss_class, DWORD *length);") | 
|---|
| 102 | cpp_quote("HRESULT WINAPI RtwqGetWorkQueueMMCSSPriority(DWORD queue, LONG *priority);") | 
|---|
| 103 | cpp_quote("HRESULT WINAPI RtwqGetWorkQueueMMCSSTaskId(DWORD queue, DWORD *taskid);") | 
|---|
| 104 | cpp_quote("HRESULT WINAPI RtwqInvokeCallback(IRtwqAsyncResult *result);") | 
|---|
| 105 | cpp_quote("HRESULT WINAPI RtwqJoinWorkQueue(DWORD queue, HANDLE hFile, HANDLE *cookie);") | 
|---|
| 106 | cpp_quote("HRESULT WINAPI RtwqLockPlatform(void);") | 
|---|
| 107 | cpp_quote("HRESULT WINAPI RtwqLockSharedWorkQueue(const WCHAR *usageclass, LONG priority, DWORD *taskid, DWORD *queue);") | 
|---|
| 108 | cpp_quote("HRESULT WINAPI RtwqLockWorkQueue(DWORD queue);") | 
|---|
| 109 | cpp_quote("HRESULT WINAPI RtwqPutWaitingWorkItem(HANDLE event, LONG priority, IRtwqAsyncResult *result, RTWQWORKITEM_KEY *key);") | 
|---|
| 110 | cpp_quote("HRESULT WINAPI RtwqPutWorkItem(DWORD queue, LONG priority, IRtwqAsyncResult *result);") | 
|---|
| 111 | cpp_quote("HRESULT WINAPI RtwqRegisterPlatformEvents(IRtwqPlatformEvents *events);") | 
|---|
| 112 | cpp_quote("HRESULT WINAPI RtwqRegisterPlatformWithMMCSS(const WCHAR *mmcss_class, DWORD *taskid, LONG priority);") | 
|---|
| 113 | cpp_quote("HRESULT WINAPI RtwqRemovePeriodicCallback(DWORD key);") | 
|---|
| 114 | cpp_quote("HRESULT WINAPI RtwqScheduleWorkItem(IRtwqAsyncResult *result, INT64 timeout, RTWQWORKITEM_KEY *key);") | 
|---|
| 115 | cpp_quote("HRESULT WINAPI RtwqSetDeadline(DWORD queue_id, LONGLONG deadline, HANDLE *request);") | 
|---|
| 116 | cpp_quote("HRESULT WINAPI RtwqSetDeadline2(DWORD queue_id, LONGLONG deadline, LONGLONG predeadline, HANDLE *request);") | 
|---|
| 117 | cpp_quote("HRESULT WINAPI RtwqSetLongRunning(DWORD queue_id, WINBOOL enable);") | 
|---|
| 118 | cpp_quote("HRESULT WINAPI RtwqShutdown(void);") | 
|---|
| 119 | cpp_quote("HRESULT WINAPI RtwqStartup(void);") | 
|---|
| 120 | cpp_quote("HRESULT WINAPI RtwqUnjoinWorkQueue(DWORD queue, HANDLE cookie);") | 
|---|
| 121 | cpp_quote("HRESULT WINAPI RtwqUnlockPlatform(void);") | 
|---|
| 122 | cpp_quote("HRESULT WINAPI RtwqUnlockWorkQueue(DWORD queue);") | 
|---|
| 123 | cpp_quote("HRESULT WINAPI RtwqUnregisterPlatformEvents(IRtwqPlatformEvents *events);") | 
|---|
| 124 | cpp_quote("HRESULT WINAPI RtwqUnregisterPlatformFromMMCSS(void);") | 
|---|