| 1 | /*
|
|---|
| 2 | *
|
|---|
| 3 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 4 | *
|
|---|
| 5 | */
|
|---|
| 6 | /*
|
|---|
| 7 | * Win32 OLE stubs for OS/2
|
|---|
| 8 | *
|
|---|
| 9 | * 1998/06/12
|
|---|
| 10 | *
|
|---|
| 11 | * Copyright 1998 Sander van Leeuwen
|
|---|
| 12 | */
|
|---|
| 13 |
|
|---|
| 14 | #include "ole32.h"
|
|---|
| 15 |
|
|---|
| 16 | // ----------------------------------------------------------------------
|
|---|
| 17 | // Local Variables
|
|---|
| 18 | // ----------------------------------------------------------------------
|
|---|
| 19 | static int s_COMLockCount = 0;
|
|---|
| 20 |
|
|---|
| 21 | // ----------------------------------------------------------------------
|
|---|
| 22 | // CoInitialize()
|
|---|
| 23 | // ----------------------------------------------------------------------
|
|---|
| 24 | HRESULT WIN32API CoInitialize(LPVOID lpReserved)
|
|---|
| 25 | {
|
|---|
| 26 | dprintf(("OLE32.CoInitialize\n"));
|
|---|
| 27 |
|
|---|
| 28 | return CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED);
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | // ----------------------------------------------------------------------
|
|---|
| 32 | // CoInitializeEx()
|
|---|
| 33 | // ----------------------------------------------------------------------
|
|---|
| 34 | HRESULT WIN32API CoInitializeEx(
|
|---|
| 35 | LPVOID lpReserved, // [in] pointer to win32 malloc interface
|
|---|
| 36 | DWORD dwCoInit) // [in] A value from COINIT specifies the thread
|
|---|
| 37 | {
|
|---|
| 38 | HRESULT hr = S_FALSE;
|
|---|
| 39 |
|
|---|
| 40 | dprintf(("OLE32.CoInitializeEx(%p, %lx)\n", lpReserved, dwCoInit));
|
|---|
| 41 |
|
|---|
| 42 | if (lpReserved != NULL)
|
|---|
| 43 | {
|
|---|
| 44 | dprintf(("Warning: Bad parameter %p, must be an old Windows Application", lpReserved));
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | /*
|
|---|
| 48 | * Check for unsupported features.
|
|---|
| 49 | */
|
|---|
| 50 | if (dwCoInit != COINIT_APARTMENTTHREADED)
|
|---|
| 51 | {
|
|---|
| 52 | dprintf(("Warning: Unsupported flag %lx", dwCoInit));
|
|---|
| 53 | /* Hope for the best and continue anyway */
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | /*
|
|---|
| 57 | * Check the lock count.
|
|---|
| 58 | * If this is the first time going through the initialize
|
|---|
| 59 | * process, we have to initialize the libraries.
|
|---|
| 60 | */
|
|---|
| 61 | if (s_COMLockCount == 0)
|
|---|
| 62 | {
|
|---|
| 63 | /*
|
|---|
| 64 | * Initialize the various COM libraries and data structures.
|
|---|
| 65 | */
|
|---|
| 66 | dprintf(("OLE32.CoInitializeEx - Initializing COM libraries"));
|
|---|
| 67 |
|
|---|
| 68 | // RunningObjectTableImpl_Initialize();
|
|---|
| 69 |
|
|---|
| 70 | hr = S_OK;
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | /*
|
|---|
| 74 | * Crank-up that lock count.
|
|---|
| 75 | */
|
|---|
| 76 | s_COMLockCount++;
|
|---|
| 77 |
|
|---|
| 78 | return hr;
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|