1 /* 2 * Microsoft COM initialization routines 3 * Copyright (c) 1999-2011 Ross Bencina, Phil Burk 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining 6 * a copy of this software and associated documentation files 7 * (the "Software"), to deal in the Software without restriction, 8 * including without limitation the rights to use, copy, modify, merge, 9 * publish, distribute, sublicense, and/or sell copies of the Software, 10 * and to permit persons to whom the Software is furnished to do so, 11 * subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be 14 * included in all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 21 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 */ 24 25 /* 26 * The text above constitutes the entire PortAudio license; however, 27 * the PortAudio community also makes the following non-binding requests: 28 * 29 * Any person wishing to distribute modifications to the Software is 30 * requested to send the modifications to the original developer so that 31 * they can be incorporated into the canonical version. It is also 32 * requested that these non-binding requests be included along with the 33 * license above. 34 */ 35 36 /** @file 37 @ingroup win_src 38 39 @brief Microsoft COM initialization routines. 40 */ 41 42 #ifndef PA_WIN_COINITIALIZE_H 43 #define PA_WIN_COINITIALIZE_H 44 45 #ifdef __cplusplus 46 extern "C" 47 { 48 #endif /* __cplusplus */ 49 50 51 /** 52 @brief Data type used to hold the result of an attempt to initialize COM 53 using PaWinUtil_CoInitialize. Must be retained between a call to 54 PaWinUtil_CoInitialize and a matching call to PaWinUtil_CoUninitialize. 55 */ 56 typedef struct PaWinUtilComInitializationResult{ 57 int state; 58 int initializingThreadId; 59 } PaWinUtilComInitializationResult; 60 61 62 /** 63 @brief Initialize Microsoft COM subsystem on the current thread. 64 65 @param hostApiType the host API type id of the caller. Used for error reporting. 66 67 @param comInitializationResult An output parameter. The value pointed to by 68 this parameter stores information required by PaWinUtil_CoUninitialize 69 to correctly uninitialize COM. The value should be retained and later 70 passed to PaWinUtil_CoUninitialize. 71 72 If PaWinUtil_CoInitialize returns paNoError, the caller must later call 73 PaWinUtil_CoUninitialize once. 74 */ 75 PaError PaWinUtil_CoInitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult ); 76 77 78 /** 79 @brief Uninitialize the Microsoft COM subsystem on the current thread using 80 the result of a previous call to PaWinUtil_CoInitialize. Must be called on the same 81 thread as PaWinUtil_CoInitialize. 82 83 @param hostApiType the host API type id of the caller. Used for error reporting. 84 85 @param comInitializationResult An input parameter. A pointer to a value previously 86 initialized by a call to PaWinUtil_CoInitialize. 87 */ 88 void PaWinUtil_CoUninitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult ); 89 90 91 #ifdef __cplusplus 92 } 93 #endif /* __cplusplus */ 94 #endif /* PA_WIN_COINITIALIZE_H */ 95