usp10/tests: A spelling fix in an ok() message.
[wine.git] / dlls / xolehlp / xolehlp.c
blob4baf31f2604451e99fac2bf2d86e142f4f9f7746
1 /*
2 * Copyright 2011 Hans Leidekker for CodeWeavers
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.
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.
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
19 #include <stdarg.h>
20 #define COBJMACROS
21 #include "windef.h"
22 #include "winbase.h"
23 #include "transact.h"
24 #include "initguid.h"
25 #include "txdtc.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(xolehlp);
30 /* Resource manager start */
32 typedef struct {
33 IResourceManager IResourceManager_iface;
34 LONG ref;
35 } ResourceManager;
37 static inline ResourceManager *impl_from_IResourceManager(IResourceManager *iface)
39 return CONTAINING_RECORD(iface, ResourceManager, IResourceManager_iface);
42 static HRESULT WINAPI ResourceManager_QueryInterface(IResourceManager *iface, REFIID iid,
43 void **ppv)
45 ResourceManager *This = impl_from_IResourceManager(iface);
46 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
48 if (!ppv) return E_INVALIDARG;
50 if (IsEqualIID(&IID_IUnknown, iid) ||
51 IsEqualIID(&IID_IResourceManager, iid))
53 *ppv = &This->IResourceManager_iface;
55 else
57 FIXME("(%s): not implemented\n", debugstr_guid(iid));
58 *ppv = NULL;
59 return E_NOINTERFACE;
62 IUnknown_AddRef((IUnknown*)*ppv);
63 return S_OK;
66 static ULONG WINAPI ResourceManager_AddRef(IResourceManager *iface)
68 ResourceManager *This = impl_from_IResourceManager(iface);
69 ULONG ref = InterlockedIncrement(&This->ref);
71 TRACE("(%p) refcount=%u\n", iface, ref);
73 return ref;
76 static ULONG WINAPI ResourceManager_Release(IResourceManager *iface)
78 ResourceManager *This = impl_from_IResourceManager(iface);
79 ULONG ref = InterlockedDecrement(&This->ref);
81 TRACE("(%p) refcount=%u\n", iface, ref);
83 if (ref == 0)
85 HeapFree(GetProcessHeap(), 0, This);
88 return ref;
90 static HRESULT WINAPI ResourceManager_Enlist(IResourceManager *iface,
91 ITransaction *pTransaction,ITransactionResourceAsync *pRes,XACTUOW *pUOW,
92 LONG *pisoLevel,ITransactionEnlistmentAsync **ppEnlist)
94 FIXME("(%p, %p, %p, %p, %p, %p): stub\n", iface, pTransaction,pRes,pUOW,
95 pisoLevel,ppEnlist);
96 return E_NOTIMPL;
98 static HRESULT WINAPI ResourceManager_Reenlist(IResourceManager *iface,
99 byte *pPrepInfo,ULONG cbPrepInfo,DWORD lTimeout,XACTSTAT *pXactStat)
101 FIXME("(%p, %p, %u, %u, %p): stub\n", iface, pPrepInfo, cbPrepInfo, lTimeout, pXactStat);
102 return E_NOTIMPL;
104 static HRESULT WINAPI ResourceManager_ReenlistmentComplete(IResourceManager *iface)
106 FIXME("(%p): stub\n", iface);
107 return S_OK;
109 static HRESULT WINAPI ResourceManager_GetDistributedTransactionManager(IResourceManager *iface,
110 REFIID iid,void **ppvObject)
112 FIXME("(%p, %s, %p): stub\n", iface, debugstr_guid(iid), ppvObject);
113 return E_NOTIMPL;
116 static const IResourceManagerVtbl ResourceManager_Vtbl = {
117 ResourceManager_QueryInterface,
118 ResourceManager_AddRef,
119 ResourceManager_Release,
120 ResourceManager_Enlist,
121 ResourceManager_Reenlist,
122 ResourceManager_ReenlistmentComplete,
123 ResourceManager_GetDistributedTransactionManager
126 static HRESULT ResourceManager_Create(REFIID riid, void **ppv)
128 ResourceManager *This;
129 HRESULT ret;
131 if (!ppv) return E_INVALIDARG;
133 This = HeapAlloc(GetProcessHeap(), 0, sizeof(ResourceManager));
134 if (!This) return E_OUTOFMEMORY;
136 This->IResourceManager_iface.lpVtbl = &ResourceManager_Vtbl;
137 This->ref = 1;
139 ret = IResourceManager_QueryInterface(&This->IResourceManager_iface, riid, ppv);
140 IResourceManager_Release(&This->IResourceManager_iface);
142 return ret;
145 /* Resource manager end */
147 /* Transaction options start */
149 typedef struct {
150 ITransactionOptions ITransactionOptions_iface;
151 LONG ref;
152 XACTOPT opts;
153 } TransactionOptions;
155 static inline TransactionOptions *impl_from_ITransactionOptions(ITransactionOptions *iface)
157 return CONTAINING_RECORD(iface, TransactionOptions, ITransactionOptions_iface);
160 static HRESULT WINAPI TransactionOptions_QueryInterface(ITransactionOptions *iface, REFIID iid,
161 void **ppv)
163 TransactionOptions *This = impl_from_ITransactionOptions(iface);
164 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
166 if (!ppv) return E_INVALIDARG;
168 if (IsEqualIID(&IID_IUnknown, iid) ||
169 IsEqualIID(&IID_ITransactionOptions, iid))
171 *ppv = &This->ITransactionOptions_iface;
173 else
175 FIXME("(%s): not implemented\n", debugstr_guid(iid));
176 *ppv = NULL;
177 return E_NOINTERFACE;
180 IUnknown_AddRef((IUnknown*)*ppv);
181 return S_OK;
184 static ULONG WINAPI TransactionOptions_AddRef(ITransactionOptions *iface)
186 TransactionOptions *This = impl_from_ITransactionOptions(iface);
187 ULONG ref = InterlockedIncrement(&This->ref);
189 TRACE("(%p) refcount=%u\n", iface, ref);
191 return ref;
194 static ULONG WINAPI TransactionOptions_Release(ITransactionOptions *iface)
196 TransactionOptions *This = impl_from_ITransactionOptions(iface);
197 ULONG ref = InterlockedDecrement(&This->ref);
199 TRACE("(%p) refcount=%u\n", iface, ref);
201 if (ref == 0)
203 HeapFree(GetProcessHeap(), 0, This);
206 return ref;
208 static HRESULT WINAPI TransactionOptions_SetOptions(ITransactionOptions *iface,
209 XACTOPT *pOptions)
211 TransactionOptions *This = impl_from_ITransactionOptions(iface);
213 if (!pOptions) return E_INVALIDARG;
214 TRACE("(%p, %u, %s)\n", iface, pOptions->ulTimeout, debugstr_a(pOptions->szDescription));
215 This->opts = *pOptions;
216 return S_OK;
218 static HRESULT WINAPI TransactionOptions_GetOptions(ITransactionOptions *iface,
219 XACTOPT *pOptions)
221 TransactionOptions *This = impl_from_ITransactionOptions(iface);
223 TRACE("(%p, %p)\n", iface, pOptions);
224 if (!pOptions) return E_INVALIDARG;
225 *pOptions = This->opts;
226 return S_OK;
229 static const ITransactionOptionsVtbl TransactionOptions_Vtbl = {
230 TransactionOptions_QueryInterface,
231 TransactionOptions_AddRef,
232 TransactionOptions_Release,
233 TransactionOptions_SetOptions,
234 TransactionOptions_GetOptions
237 static HRESULT TransactionOptions_Create(ITransactionOptions **ppv)
239 TransactionOptions *This;
241 if (!ppv) return E_INVALIDARG;
243 This = HeapAlloc(GetProcessHeap(), 0, sizeof(TransactionOptions));
244 if (!This) return E_OUTOFMEMORY;
246 This->ITransactionOptions_iface.lpVtbl = &TransactionOptions_Vtbl;
247 This->ref = 1;
249 *ppv = &This->ITransactionOptions_iface;
251 return S_OK;
254 /* Transaction options end */
256 /* Transaction start */
258 typedef struct {
259 ITransaction ITransaction_iface;
260 LONG ref;
261 XACTTRANSINFO info;
262 } Transaction;
264 static inline Transaction *impl_from_ITransaction(ITransaction *iface)
266 return CONTAINING_RECORD(iface, Transaction, ITransaction_iface);
269 static HRESULT WINAPI Transaction_QueryInterface(ITransaction *iface, REFIID iid,
270 void **ppv)
272 Transaction *This = impl_from_ITransaction(iface);
273 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
275 if (!ppv) return E_INVALIDARG;
277 if (IsEqualIID(&IID_IUnknown, iid) ||
278 IsEqualIID(&IID_ITransaction, iid))
280 *ppv = &This->ITransaction_iface;
282 else
284 FIXME("(%s): not implemented\n", debugstr_guid(iid));
285 *ppv = NULL;
286 return E_NOINTERFACE;
289 IUnknown_AddRef((IUnknown*)*ppv);
290 return S_OK;
293 static ULONG WINAPI Transaction_AddRef(ITransaction *iface)
295 Transaction *This = impl_from_ITransaction(iface);
296 ULONG ref = InterlockedIncrement(&This->ref);
298 TRACE("(%p) refcount=%u\n", iface, ref);
300 return ref;
303 static ULONG WINAPI Transaction_Release(ITransaction *iface)
305 Transaction *This = impl_from_ITransaction(iface);
306 ULONG ref = InterlockedDecrement(&This->ref);
308 TRACE("(%p) refcount=%u\n", iface, ref);
310 if (ref == 0)
312 HeapFree(GetProcessHeap(), 0, This);
315 return ref;
317 static HRESULT WINAPI Transaction_Commit(ITransaction *iface,
318 BOOL fRetaining, DWORD grfTC, DWORD grfRM)
320 FIXME("(%p, %d, %08x, %08x): stub\n", iface, fRetaining, grfTC, grfRM);
321 return E_NOTIMPL;
323 static HRESULT WINAPI Transaction_Abort(ITransaction *iface,
324 BOID *pboidReason, BOOL fRetaining, BOOL fAsync)
326 FIXME("(%p, %p, %d, %d): stub\n", iface, pboidReason, fRetaining, fAsync);
327 return E_NOTIMPL;
329 static HRESULT WINAPI Transaction_GetTransactionInfo(ITransaction *iface,
330 XACTTRANSINFO *pinfo)
332 Transaction *This = impl_from_ITransaction(iface);
333 TRACE("(%p, %p)\n", iface, pinfo);
334 if (!pinfo) return E_INVALIDARG;
335 *pinfo = This->info;
336 return S_OK;
339 static const ITransactionVtbl Transaction_Vtbl = {
340 Transaction_QueryInterface,
341 Transaction_AddRef,
342 Transaction_Release,
343 Transaction_Commit,
344 Transaction_Abort,
345 Transaction_GetTransactionInfo
348 static HRESULT Transaction_Create(ISOLEVEL isoLevel, ULONG isoFlags,
349 ITransactionOptions *pOptions, ITransaction **ppv)
351 Transaction *This;
353 if (!ppv) return E_INVALIDARG;
355 This = HeapAlloc(GetProcessHeap(), 0, sizeof(Transaction));
356 if (!This) return E_OUTOFMEMORY;
357 ZeroMemory(&This->info, sizeof(This->info));
359 This->ITransaction_iface.lpVtbl = &Transaction_Vtbl;
360 This->ref = 1;
361 This->info.isoLevel = isoLevel;
362 This->info.isoFlags = isoFlags;
364 *ppv = &This->ITransaction_iface;
366 return S_OK;
369 /* Transaction end */
371 /* DTC Proxy Core Object start */
373 typedef struct {
374 ITransactionDispenser ITransactionDispenser_iface;
375 LONG ref;
376 IResourceManagerFactory2 IResourceManagerFactory2_iface;
377 ITransactionImportWhereabouts ITransactionImportWhereabouts_iface;
378 ITransactionImport ITransactionImport_iface;
379 } TransactionManager;
381 static inline TransactionManager *impl_from_ITransactionDispenser(ITransactionDispenser *iface)
383 return CONTAINING_RECORD(iface, TransactionManager, ITransactionDispenser_iface);
386 static HRESULT WINAPI TransactionDispenser_QueryInterface(ITransactionDispenser *iface, REFIID iid,
387 void **ppv)
389 TransactionManager *This = impl_from_ITransactionDispenser(iface);
390 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
392 if (!ppv) return E_INVALIDARG;
394 if (IsEqualIID(&IID_IUnknown, iid) ||
395 IsEqualIID(&IID_ITransactionDispenser, iid))
397 *ppv = &This->ITransactionDispenser_iface;
399 else if (IsEqualIID(&IID_IResourceManagerFactory, iid) ||
400 IsEqualIID(&IID_IResourceManagerFactory2, iid))
402 *ppv = &This->IResourceManagerFactory2_iface;
404 else if (IsEqualIID(&IID_ITransactionImportWhereabouts, iid))
406 *ppv = &This->ITransactionImportWhereabouts_iface;
408 else if (IsEqualIID(&IID_ITransactionImport, iid))
410 *ppv = &This->ITransactionImport_iface;
412 else
414 FIXME("(%s): not implemented\n", debugstr_guid(iid));
415 *ppv = NULL;
416 return E_NOINTERFACE;
419 IUnknown_AddRef((IUnknown*)*ppv);
420 return S_OK;
423 static ULONG WINAPI TransactionDispenser_AddRef(ITransactionDispenser *iface)
425 TransactionManager *This = impl_from_ITransactionDispenser(iface);
426 ULONG ref = InterlockedIncrement(&This->ref);
428 TRACE("(%p) refcount=%u\n", iface, ref);
430 return ref;
433 static ULONG WINAPI TransactionDispenser_Release(ITransactionDispenser *iface)
435 TransactionManager *This = impl_from_ITransactionDispenser(iface);
436 ULONG ref = InterlockedDecrement(&This->ref);
438 TRACE("(%p) refcount=%u\n", iface, ref);
440 if (ref == 0)
442 HeapFree(GetProcessHeap(), 0, This);
445 return ref;
448 static HRESULT WINAPI TransactionDispenser_GetOptionsObject(ITransactionDispenser *iface,
449 ITransactionOptions **ppOptions)
451 TRACE("(%p, %p)\n", iface, ppOptions);
453 if (!ppOptions) return E_INVALIDARG;
454 return TransactionOptions_Create(ppOptions);
456 static HRESULT WINAPI TransactionDispenser_BeginTransaction(ITransactionDispenser *iface,
457 IUnknown *punkOuter,
458 ISOLEVEL isoLevel,
459 ULONG isoFlags,
460 ITransactionOptions *pOptions,
461 ITransaction **ppTransaction)
463 FIXME("(%p, %p, %08x, %08x, %p, %p): semi-stub\n", iface, punkOuter,
464 isoLevel, isoFlags, pOptions, ppTransaction);
466 if (!ppTransaction) return E_INVALIDARG;
467 if (punkOuter) return CLASS_E_NOAGGREGATION;
468 return Transaction_Create(isoLevel, isoFlags, pOptions, ppTransaction);
470 static const ITransactionDispenserVtbl TransactionDispenser_Vtbl = {
471 TransactionDispenser_QueryInterface,
472 TransactionDispenser_AddRef,
473 TransactionDispenser_Release,
474 TransactionDispenser_GetOptionsObject,
475 TransactionDispenser_BeginTransaction
478 static inline TransactionManager *impl_from_IResourceManagerFactory2(IResourceManagerFactory2 *iface)
480 return CONTAINING_RECORD(iface, TransactionManager, IResourceManagerFactory2_iface);
483 static HRESULT WINAPI ResourceManagerFactory2_QueryInterface(IResourceManagerFactory2 *iface, REFIID iid,
484 void **ppv)
486 TransactionManager *This = impl_from_IResourceManagerFactory2(iface);
487 return TransactionDispenser_QueryInterface(&This->ITransactionDispenser_iface, iid, ppv);
490 static ULONG WINAPI ResourceManagerFactory2_AddRef(IResourceManagerFactory2 *iface)
492 TransactionManager *This = impl_from_IResourceManagerFactory2(iface);
493 return TransactionDispenser_AddRef(&This->ITransactionDispenser_iface);
496 static ULONG WINAPI ResourceManagerFactory2_Release(IResourceManagerFactory2 *iface)
498 TransactionManager *This = impl_from_IResourceManagerFactory2(iface);
499 return TransactionDispenser_Release(&This->ITransactionDispenser_iface);
501 static HRESULT WINAPI ResourceManagerFactory2_Create(IResourceManagerFactory2 *iface,
502 GUID *pguidRM, CHAR *pszRMName, IResourceManagerSink *pIResMgrSink, IResourceManager **ppResMgr)
504 FIXME("(%p, %s, %s, %p, %p): semi-stub\n", iface, debugstr_guid(pguidRM),
505 debugstr_a(pszRMName), pIResMgrSink, ppResMgr);
506 return ResourceManager_Create(&IID_IResourceManager, (void**)ppResMgr);
508 static HRESULT WINAPI ResourceManagerFactory2_CreateEx(IResourceManagerFactory2 *iface,
509 GUID *pguidRM, CHAR *pszRMName, IResourceManagerSink *pIResMgrSink, REFIID riidRequested, void **ppResMgr)
511 FIXME("(%p, %s, %s, %p, %s, %p): semi-stub\n", iface, debugstr_guid(pguidRM),
512 debugstr_a(pszRMName), pIResMgrSink, debugstr_guid(riidRequested), ppResMgr);
514 return ResourceManager_Create(riidRequested, ppResMgr);
516 static const IResourceManagerFactory2Vtbl ResourceManagerFactory2_Vtbl = {
517 ResourceManagerFactory2_QueryInterface,
518 ResourceManagerFactory2_AddRef,
519 ResourceManagerFactory2_Release,
520 ResourceManagerFactory2_Create,
521 ResourceManagerFactory2_CreateEx
524 static inline TransactionManager *impl_from_ITransactionImportWhereabouts(ITransactionImportWhereabouts *iface)
526 return CONTAINING_RECORD(iface, TransactionManager, ITransactionImportWhereabouts_iface);
529 static HRESULT WINAPI TransactionImportWhereabouts_QueryInterface(ITransactionImportWhereabouts *iface, REFIID iid,
530 void **ppv)
532 TransactionManager *This = impl_from_ITransactionImportWhereabouts(iface);
533 return TransactionDispenser_QueryInterface(&This->ITransactionDispenser_iface, iid, ppv);
536 static ULONG WINAPI TransactionImportWhereabouts_AddRef(ITransactionImportWhereabouts *iface)
538 TransactionManager *This = impl_from_ITransactionImportWhereabouts(iface);
539 return TransactionDispenser_AddRef(&This->ITransactionDispenser_iface);
542 static ULONG WINAPI TransactionImportWhereabouts_Release(ITransactionImportWhereabouts *iface)
544 TransactionManager *This = impl_from_ITransactionImportWhereabouts(iface);
545 return TransactionDispenser_Release(&This->ITransactionDispenser_iface);
547 static HRESULT WINAPI TransactionImportWhereabouts_GetWhereaboutsSize(ITransactionImportWhereabouts *iface,
548 ULONG *pcbWhereabouts)
550 FIXME("(%p, %p): stub returning fake value\n", iface, pcbWhereabouts);
552 if (!pcbWhereabouts) return E_INVALIDARG;
553 *pcbWhereabouts = 1;
554 return S_OK;
556 static HRESULT WINAPI TransactionImportWhereabouts_GetWhereabouts(ITransactionImportWhereabouts *iface,
557 ULONG cbWhereabouts, BYTE *rgbWhereabouts,ULONG *pcbUsed)
559 FIXME("(%p, %u, %p, %p): stub returning fake value\n", iface, cbWhereabouts, rgbWhereabouts, pcbUsed);
561 if (!rgbWhereabouts || !pcbUsed) return E_INVALIDARG;
562 *rgbWhereabouts = 0;
563 *pcbUsed = 1;
564 return S_OK;
566 static const ITransactionImportWhereaboutsVtbl TransactionImportWhereabouts_Vtbl = {
567 TransactionImportWhereabouts_QueryInterface,
568 TransactionImportWhereabouts_AddRef,
569 TransactionImportWhereabouts_Release,
570 TransactionImportWhereabouts_GetWhereaboutsSize,
571 TransactionImportWhereabouts_GetWhereabouts
574 static inline TransactionManager *impl_from_ITransactionImport(ITransactionImport *iface)
576 return CONTAINING_RECORD(iface, TransactionManager, ITransactionImport_iface);
579 static HRESULT WINAPI TransactionImport_QueryInterface(ITransactionImport *iface, REFIID iid,
580 void **ppv)
582 TransactionManager *This = impl_from_ITransactionImport(iface);
583 return TransactionDispenser_QueryInterface(&This->ITransactionDispenser_iface, iid, ppv);
586 static ULONG WINAPI TransactionImport_AddRef(ITransactionImport *iface)
588 TransactionManager *This = impl_from_ITransactionImport(iface);
589 return TransactionDispenser_AddRef(&This->ITransactionDispenser_iface);
592 static ULONG WINAPI TransactionImport_Release(ITransactionImport *iface)
594 TransactionManager *This = impl_from_ITransactionImport(iface);
595 return TransactionDispenser_Release(&This->ITransactionDispenser_iface);
597 static HRESULT WINAPI TransactionImport_Import(ITransactionImport *iface,
598 ULONG cbTransactionCookie, byte *rgbTransactionCookie, IID *piid, void **ppvTransaction)
600 FIXME("(%p, %u, %p, %s, %p): stub\n", iface, cbTransactionCookie, rgbTransactionCookie, debugstr_guid(piid), ppvTransaction);
602 if (!rgbTransactionCookie || !piid || !ppvTransaction) return E_INVALIDARG;
603 return E_NOTIMPL;
605 static const ITransactionImportVtbl TransactionImport_Vtbl = {
606 TransactionImport_QueryInterface,
607 TransactionImport_AddRef,
608 TransactionImport_Release,
609 TransactionImport_Import
612 static HRESULT TransactionManager_Create(REFIID riid, void **ppv)
614 TransactionManager *This;
615 HRESULT ret;
617 This = HeapAlloc(GetProcessHeap(), 0, sizeof(TransactionManager));
618 if (!This) return E_OUTOFMEMORY;
620 This->ITransactionDispenser_iface.lpVtbl = &TransactionDispenser_Vtbl;
621 This->IResourceManagerFactory2_iface.lpVtbl = &ResourceManagerFactory2_Vtbl;
622 This->ITransactionImportWhereabouts_iface.lpVtbl = &TransactionImportWhereabouts_Vtbl;
623 This->ITransactionImport_iface.lpVtbl = &TransactionImport_Vtbl;
624 This->ref = 1;
626 ret = ITransactionDispenser_QueryInterface(&This->ITransactionDispenser_iface, riid, ppv);
627 ITransactionDispenser_Release(&This->ITransactionDispenser_iface);
629 return ret;
631 /* DTC Proxy Core Object end */
633 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
635 TRACE("%p, %u, %p\n", hinst, reason, reserved);
637 switch (reason)
639 case DLL_WINE_PREATTACH:
640 return FALSE; /* prefer native version */
641 case DLL_PROCESS_ATTACH:
642 DisableThreadLibraryCalls( hinst );
643 break;
645 return TRUE;
648 static BOOL is_local_machineA( const CHAR *server )
650 static const CHAR dot[] = ".";
651 CHAR buffer[MAX_COMPUTERNAME_LENGTH + 1];
652 DWORD len = ARRAY_SIZE( buffer );
654 if (!server || !strcmp( server, dot )) return TRUE;
655 if (GetComputerNameA( buffer, &len ) && !lstrcmpiA( server, buffer )) return TRUE;
656 return FALSE;
658 static BOOL is_local_machineW( const WCHAR *server )
660 static const WCHAR dotW[] = {'.',0};
661 WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1];
662 DWORD len = ARRAY_SIZE( buffer );
664 if (!server || !wcscmp( server, dotW )) return TRUE;
665 if (GetComputerNameW( buffer, &len ) && !wcsicmp( server, buffer )) return TRUE;
666 return FALSE;
669 HRESULT CDECL DtcGetTransactionManager(char *host, char *tm_name, REFIID riid,
670 DWORD dwReserved1, WORD wcbReserved2, void *pvReserved2, void **ppv)
672 TRACE("(%s, %s, %s, %d, %d, %p, %p)\n", debugstr_a(host), debugstr_a(tm_name),
673 debugstr_guid(riid), dwReserved1, wcbReserved2, pvReserved2, ppv);
675 if (!is_local_machineA(host))
677 FIXME("remote computer not supported\n");
678 return E_NOTIMPL;
680 return TransactionManager_Create(riid, ppv);
683 HRESULT CDECL DtcGetTransactionManagerExA(CHAR *host, CHAR *tm_name, REFIID riid,
684 DWORD options, void *config, void **ppv)
686 TRACE("(%s, %s, %s, %d, %p, %p)\n", debugstr_a(host), debugstr_a(tm_name),
687 debugstr_guid(riid), options, config, ppv);
689 if (!is_local_machineA(host))
691 FIXME("remote computer not supported\n");
692 return E_NOTIMPL;
694 return TransactionManager_Create(riid, ppv);
697 HRESULT CDECL DtcGetTransactionManagerExW(WCHAR *host, WCHAR *tm_name, REFIID riid,
698 DWORD options, void *config, void **ppv)
700 TRACE("(%s, %s, %s, %d, %p, %p)\n", debugstr_w(host), debugstr_w(tm_name),
701 debugstr_guid(riid), options, config, ppv);
703 if (!is_local_machineW(host))
705 FIXME("remote computer not supported\n");
706 return E_NOTIMPL;
708 return TransactionManager_Create(riid, ppv);