ReactOS  0.4.14-dev-317-g96040ec
thread.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winuser.h"
#include "shlwapi.h"
#include "shlobj.h"
#include "wine/debug.h"
Include dependency graph for thread.c:

Go to the source code of this file.

Classes

struct  tagSHLWAPI_THREAD_INFO
 
struct  threadref
 

Macros

#define COBJMACROS
 
#define NO_SHLWAPI_REG
 
#define NO_SHLWAPI_PATH
 
#define NO_SHLWAPI_GDI
 
#define NO_SHLWAPI_STREAM
 
#define NO_SHLWAPI_USER
 

Typedefs

typedef struct tagSHLWAPI_THREAD_INFO SHLWAPI_THREAD_INFO
 
typedef struct tagSHLWAPI_THREAD_INFOLPSHLWAPI_THREAD_INFO
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
INT WINAPI SHStringFromGUIDA (REFGUID, LPSTR, INT)
 
LPSECURITY_ATTRIBUTES WINAPI CreateAllAccessSecurityAttributes (LPSECURITY_ATTRIBUTES lpAttr, PSECURITY_DESCRIPTOR lpSec, DWORD p3)
 
HRESULT WINAPI _SHGetInstanceExplorer (IUnknown **lppUnknown)
 
static threadrefimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI threadref_QueryInterface (IUnknown *iface, REFIID riid, LPVOID *ppvObj)
 
static ULONG WINAPI threadref_AddRef (IUnknown *iface)
 
static ULONG WINAPI threadref_Release (IUnknown *iface)
 
HRESULT WINAPI SHCreateThreadRef (LONG *lprefcount, IUnknown **lppUnknown)
 
HRESULT WINAPI SHGetThreadRef (IUnknown **lppUnknown)
 
HRESULT WINAPI SHSetThreadRef (IUnknown *lpUnknown)
 
HRESULT WINAPI SHReleaseThreadRef (void)
 
static DWORD WINAPI SHLWAPI_ThreadWrapper (PVOID pTi)
 
BOOL WINAPI SHCreateThread (LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback)
 
LONG WINAPI SHGlobalCounterGetValue (HANDLE hSem)
 
LONG WINAPI SHGlobalCounterIncrement (HANDLE hSem)
 
DWORD WINAPI SHGlobalCounterDecrement (HANDLE hSem)
 
HANDLE WINAPI SHGlobalCounterCreateNamedW (LPCWSTR lpszName, DWORD iInitial)
 
HANDLE WINAPI SHGlobalCounterCreateNamedA (LPCSTR lpszName, DWORD iInitial)
 
HANDLE WINAPI SHGlobalCounterCreate (REFGUID guid)
 

Variables

DWORD SHLWAPI_ThreadRef_index
 
static const IUnknownVtbl threadref_vt
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file thread.c.

◆ NO_SHLWAPI_GDI

#define NO_SHLWAPI_GDI

Definition at line 32 of file thread.c.

◆ NO_SHLWAPI_PATH

#define NO_SHLWAPI_PATH

Definition at line 31 of file thread.c.

◆ NO_SHLWAPI_REG

#define NO_SHLWAPI_REG

Definition at line 30 of file thread.c.

◆ NO_SHLWAPI_STREAM

#define NO_SHLWAPI_STREAM

Definition at line 33 of file thread.c.

◆ NO_SHLWAPI_USER

#define NO_SHLWAPI_USER

Definition at line 34 of file thread.c.

Typedef Documentation

◆ LPSHLWAPI_THREAD_INFO

◆ SHLWAPI_THREAD_INFO

Function Documentation

◆ _SHGetInstanceExplorer()

HRESULT WINAPI _SHGetInstanceExplorer ( IUnknown **  lppUnknown)

Definition at line 104 of file thread.c.

105 {
106  /* This function is used within SHLWAPI only to hold the IE reference
107  * for threads created with the CTF_PROCESS_REF flag set. */
108  return SHGetInstanceExplorer(lppUnknown);
109 }
HRESULT WINAPI SHGetInstanceExplorer(IUnknown **lpUnknown)
Definition: shellord.c:1110

Referenced by SHCreateThread().

◆ CreateAllAccessSecurityAttributes()

LPSECURITY_ATTRIBUTES WINAPI CreateAllAccessSecurityAttributes ( LPSECURITY_ATTRIBUTES  lpAttr,
PSECURITY_DESCRIPTOR  lpSec,
DWORD  p3 
)

Definition at line 63 of file thread.c.

67 {
68  /* This function is used within SHLWAPI only to create security attributes
69  * for shell semaphores. */
70 
71  TRACE("(%p,%p,%08x)\n", lpAttr, lpSec, p3);
72 
73  if (!(GetVersion() & 0x80000000)) /* NT */
74  {
75  if (!lpSec || !lpAttr)
76  return NULL;
77 
78  if (InitializeSecurityDescriptor(lpSec, 1))
79  {
81  {
82  lpAttr->nLength = sizeof(SECURITY_ATTRIBUTES);
83  lpAttr->lpSecurityDescriptor = lpSec;
84  lpAttr->bInheritHandle = FALSE;
85  return lpAttr;
86  }
87  }
88  }
89  return NULL;
90 }
#define TRUE
Definition: types.h:120
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
Definition: security.c:808
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LPVOID lpSecurityDescriptor
Definition: compat.h:181
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
Definition: sec.c:262
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES

Referenced by SHGlobalCounterCreateNamedW().

◆ impl_from_IUnknown()

static threadref* impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 129 of file thread.c.

130 {
131  return CONTAINING_RECORD(iface, threadref, IUnknown_iface);
132 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by threadref_AddRef(), threadref_QueryInterface(), and threadref_Release().

◆ SHCreateThread()

BOOL WINAPI SHCreateThread ( LPTHREAD_START_ROUTINE  pfnThreadProc,
VOID pData,
DWORD  dwFlags,
LPTHREAD_START_ROUTINE  pfnCallback 
)

Definition at line 356 of file thread.c.

358 {
360  BOOL bCalled = FALSE;
361 
362  TRACE("(%p,%p,0x%X,%p)\n", pfnThreadProc, pData, dwFlags, pfnCallback);
363 
364  /* Set up data to pass to the new thread (On our stack) */
365  ti.pfnThreadProc = pfnThreadProc;
366  ti.pfnCallback = pfnCallback;
367  ti.pData = pData;
368  ti.bInitCom = (dwFlags & CTF_COINIT) != 0;
370 
371  /* Hold references to the current thread and IE process, if desired */
372  if(dwFlags & CTF_THREAD_REF)
374  else
375  ti.refThread = NULL;
376 
379  else
380  ti.refIE = NULL;
381 
382  /* Create the thread */
383  if(ti.hEvent)
384  {
385  DWORD dwRetVal;
386  HANDLE hThread;
387 
388  hThread = CreateThread(NULL, 0, SHLWAPI_ThreadWrapper, &ti, 0, &dwRetVal);
389 
390  if(hThread)
391  {
392  /* Wait for the thread to signal us to continue */
395  bCalled = TRUE;
396  }
397  CloseHandle(ti.hEvent);
398  }
399 
400  if (!bCalled)
401  {
402  if (!ti.pfnCallback && dwFlags & CTF_INSIST)
403  {
404  /* Couldn't call, call synchronously */
405  pfnThreadProc(pData);
406  bCalled = TRUE;
407  }
408  else
409  {
410  /* Free references, since thread hasn't run to do so */
411  if(ti.refThread)
412  IUnknown_Release(ti.refThread);
413 
414  if(ti.refIE)
415  IUnknown_Release(ti.refIE);
416  }
417  }
418  return bCalled;
419 }
static DWORD WINAPI SHLWAPI_ThreadWrapper(PVOID pTi)
Definition: thread.c:290
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
HRESULT WINAPI _SHGetInstanceExplorer(IUnknown **lppUnknown)
Definition: thread.c:104
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define CTF_COINIT
Definition: shlwapi.h:1936
unsigned int BOOL
Definition: ntddk_ex.h:94
LPTHREAD_START_ROUTINE pfnThreadProc
Definition: thread.c:114
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetThreadRef(IUnknown **lppUnknown)
Definition: thread.c:228
#define CTF_PROCESS_REF
Definition: shlwapi.h:1935
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CTF_INSIST
Definition: shlwapi.h:1933
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPTHREAD_START_ROUTINE pfnCallback
Definition: thread.c:115
HANDLE hThread
Definition: wizard.c:27
#define CTF_THREAD_REF
Definition: shlwapi.h:1934
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define INFINITE
Definition: serial.h:102
IUnknown * refIE
Definition: thread.c:120
IUnknown * refThread
Definition: thread.c:119

Referenced by CRecyclerDropTarget::_DoDeleteAsync(), CFSDropTarget::Drop(), CFileDefExt::InitFileAttr(), and CFindFolder::StartSearch().

◆ SHCreateThreadRef()

HRESULT WINAPI SHCreateThreadRef ( LONG lprefcount,
IUnknown **  lppUnknown 
)

Definition at line 198 of file thread.c.

199 {
200  threadref * This;
201  TRACE("(%p, %p)\n", lprefcount, lppUnknown);
202 
203  if (!lprefcount || !lppUnknown)
204  return E_INVALIDARG;
205 
206  This = HeapAlloc(GetProcessHeap(), 0, sizeof(threadref));
207  This->IUnknown_iface.lpVtbl = &threadref_vt;
208  This->ref = lprefcount;
209 
210  *lprefcount = 1;
211  *lppUnknown = &This->IUnknown_iface;
212  TRACE("=> returning S_OK with %p\n", This);
213  return S_OK;
214 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define S_OK
Definition: intsafe.h:59
static const IUnknownVtbl threadref_vt
Definition: thread.c:178

Referenced by SHCreateFromDesktop().

◆ SHGetThreadRef()

HRESULT WINAPI SHGetThreadRef ( IUnknown **  lppUnknown)

Definition at line 228 of file thread.c.

229 {
230  TRACE("(%p)\n", lppUnknown);
231 
233  return E_NOINTERFACE;
234 
235  *lppUnknown = TlsGetValue(SHLWAPI_ThreadRef_index);
236  if (!*lppUnknown)
237  return E_NOINTERFACE;
238 
239  /* Add a reference. Caller will Release() us when finished */
240  IUnknown_AddRef(*lppUnknown);
241  return S_OK;
242 }
DWORD SHLWAPI_ThreadRef_index
Definition: shlwapi_main.c:34
#define E_NOINTERFACE
Definition: winerror.h:2364
#define TRACE(s)
Definition: solgame.cpp:4
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:530
#define S_OK
Definition: intsafe.h:59
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228

Referenced by SHCreateThread().

◆ SHGlobalCounterCreate()

HANDLE WINAPI SHGlobalCounterCreate ( REFGUID  guid)

Definition at line 551 of file thread.c.

552 {
553  char szName[40];
554 
555  TRACE("(%s)\n", debugstr_guid(guid));
556 
557  /* Create a named semaphore using the GUID string */
558  SHStringFromGUIDA(guid, szName, sizeof(szName) - 1);
560 }
INT WINAPI SHStringFromGUIDA(REFGUID, LPSTR, INT)
Definition: shimtest.c:51
HANDLE WINAPI SHGlobalCounterCreateNamedA(LPCSTR lpszName, DWORD iInitial)
Definition: thread.c:526
const GUID * guid
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static const WCHAR szName[]
Definition: msipriv.h:1194

◆ SHGlobalCounterCreateNamedA()

HANDLE WINAPI SHGlobalCounterCreateNamedA ( LPCSTR  lpszName,
DWORD  iInitial 
)

Definition at line 526 of file thread.c.

527 {
528  WCHAR szBuff[MAX_PATH];
529 
530  TRACE("(%s,%d)\n", debugstr_a(lpszName), iInitial);
531 
532  if (lpszName)
533  MultiByteToWideChar(CP_ACP, 0, lpszName, -1, szBuff, MAX_PATH);
534  return SHGlobalCounterCreateNamedW(lpszName ? szBuff : NULL, iInitial);
535 }
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:26
HANDLE WINAPI SHGlobalCounterCreateNamedW(LPCWSTR lpszName, DWORD iInitial)
Definition: thread.c:489
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by SHGlobalCounterCreate().

◆ SHGlobalCounterCreateNamedW()

HANDLE WINAPI SHGlobalCounterCreateNamedW ( LPCWSTR  lpszName,
DWORD  iInitial 
)

Definition at line 489 of file thread.c.

490 {
491  static const WCHAR szPrefix[] = { 's', 'h', 'e', 'l', 'l', '.', '\0' };
492  const int iPrefixLen = 6;
493  WCHAR szBuff[MAX_PATH];
494  const int iBuffLen = sizeof(szBuff)/sizeof(WCHAR);
496  SECURITY_ATTRIBUTES sAttr, *pSecAttr;
497  HANDLE hRet;
498 
499  TRACE("(%s,%d)\n", debugstr_w(lpszName), iInitial);
500 
501  /* Create Semaphore name */
502  memcpy(szBuff, szPrefix, (iPrefixLen + 1) * sizeof(WCHAR));
503  if (lpszName)
504  StrCpyNW(szBuff + iPrefixLen, lpszName, iBuffLen - iPrefixLen);
505 
506  /* Initialise security attributes */
507  pSecAttr = CreateAllAccessSecurityAttributes(&sAttr, &sd, 0);
508 
509  if (!(hRet = CreateSemaphoreW(pSecAttr , iInitial, MAXLONG, szBuff)))
511  return hRet;
512 }
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:444
#define MAXLONG
Definition: umtypes.h:116
LPWSTR WINAPI StrCpyNW(LPWSTR dst, LPCWSTR src, int count)
Definition: string.c:536
LPSECURITY_ATTRIBUTES WINAPI CreateAllAccessSecurityAttributes(LPSECURITY_ATTRIBUTES lpAttr, PSECURITY_DESCRIPTOR lpSec, DWORD p3)
Definition: thread.c:63
#define SEMAPHORE_MODIFY_STATE
Definition: winbase.h:161
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static const WCHAR sd[]
Definition: suminfo.c:287
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define SYNCHRONIZE
Definition: nt_native.h:61
HANDLE WINAPI DECLSPEC_HOTPATCH OpenSemaphoreW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
Definition: synch.c:529

Referenced by SHGlobalCounterCreateNamedA().

◆ SHGlobalCounterDecrement()

DWORD WINAPI SHGlobalCounterDecrement ( HANDLE  hSem)

Definition at line 473 of file thread.c.

474 {
475  DWORD dwOldCount = 0;
476 
477  TRACE("(%p)\n", hSem);
478 
479  dwOldCount = SHGlobalCounterGetValue(hSem);
480  WaitForSingleObject(hSem, 0);
481  return dwOldCount - 1;
482 }
LONG WINAPI SHGlobalCounterGetValue(HANDLE hSem)
Definition: thread.c:432
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95

◆ SHGlobalCounterGetValue()

LONG WINAPI SHGlobalCounterGetValue ( HANDLE  hSem)

Definition at line 432 of file thread.c.

433 {
434  LONG dwOldCount = 0;
435 
436  TRACE("(%p)\n", hSem);
437  ReleaseSemaphore(hSem, 1, &dwOldCount); /* +1 */
438  WaitForSingleObject(hSem, 0); /* -1 */
439  return dwOldCount;
440 }
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:542

Referenced by SHGlobalCounterDecrement().

◆ SHGlobalCounterIncrement()

LONG WINAPI SHGlobalCounterIncrement ( HANDLE  hSem)

Definition at line 453 of file thread.c.

454 {
455  LONG dwOldCount = 0;
456 
457  TRACE("(%p)\n", hSem);
458  ReleaseSemaphore(hSem, 1, &dwOldCount);
459  return dwOldCount + 1;
460 }
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:542

◆ SHLWAPI_ThreadWrapper()

static DWORD WINAPI SHLWAPI_ThreadWrapper ( PVOID  pTi)
static

Definition at line 290 of file thread.c.

291 {
293  HRESULT hCom = E_FAIL;
294  DWORD dwRet;
295 
296  TRACE("(%p)\n", pTi);
297 
298  /* We are now executing in the context of the newly created thread.
299  * So we copy the data passed to us (it is on the stack of the function
300  * that called us, which is waiting for us to signal an event before
301  * returning). */
302  memcpy(&ti, pTi, sizeof(SHLWAPI_THREAD_INFO));
303 
304  /* Initialise COM for the thread, if desired */
305  if (ti.bInitCom)
306  {
308 
309  if (FAILED(hCom))
311  }
312 
313  /* Execute the callback function before returning */
314  if (ti.pfnCallback)
315  ti.pfnCallback(ti.pData);
316 
317  /* Signal the thread that created us; it can return now */
318  SetEvent(ti.hEvent);
319 
320  /* Execute the callers start code */
321  dwRet = ti.pfnThreadProc(ti.pData);
322 
323  /* Release references to the caller and IE process, if held */
324  if (ti.refThread)
325  IUnknown_Release(ti.refThread);
326 
327  if (ti.refIE)
328  IUnknown_Release(ti.refIE);
329 
330  if (SUCCEEDED(hCom))
331  CoUninitialize();
332 
333  /* Return the users thread return value */
334  return dwRet;
335 }
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define E_FAIL
Definition: ddrawi.h:102
LPTHREAD_START_ROUTINE pfnThreadProc
Definition: thread.c:114
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
LPTHREAD_START_ROUTINE pfnCallback
Definition: thread.c:115
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
IUnknown * refIE
Definition: thread.c:120
#define SUCCEEDED(hr)
Definition: intsafe.h:57
IUnknown * refThread
Definition: thread.c:119

Referenced by SHCreateThread().

◆ SHReleaseThreadRef()

HRESULT WINAPI SHReleaseThreadRef ( void  )

Definition at line 279 of file thread.c.

280 {
281  FIXME("() - stub!\n");
282  return S_OK;
283 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ SHSetThreadRef()

HRESULT WINAPI SHSetThreadRef ( IUnknown lpUnknown)

Definition at line 256 of file thread.c.

257 {
258  TRACE("(%p)\n", lpUnknown);
259 
261  return E_NOINTERFACE;
262 
264  return S_OK;
265 }
DWORD SHLWAPI_ThreadRef_index
Definition: shlwapi_main.c:34
#define E_NOINTERFACE
Definition: winerror.h:2364
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1264
#define TRACE(s)
Definition: solgame.cpp:4
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:530
#define S_OK
Definition: intsafe.h:59

◆ SHStringFromGUIDA()

INT WINAPI SHStringFromGUIDA ( REFGUID  ,
LPSTR  ,
INT   
)

Definition at line 51 of file shimtest.c.

52 {
53  CHAR Buffer[100] = {0};
54 
55  if (CALL_SHIM(1, tSHStringFromGUIDA)(guid, Buffer, sizeof(Buffer)-1))
56  {
57  SHIM_INFO("Original function returned: '%s'\n", Buffer);
58  }
59  else
60  {
61  SHIM_INFO("Original function failed\n");
62  Buffer[0] = '\0';
63  }
64 
65  StringCchCopyA(lpszDest, cchMax, "ShimTest:");
67  return 0;
68 }
char CHAR
Definition: xmlstorage.h:175
const GUID * guid
STRSAFEAPI StringCchCatA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:320
WCHAR lpszDest[260]
Definition: bufpool.h:45
INT(WINAPI * tSHStringFromGUIDA)(REFGUID guid, LPSTR lpszDest, INT cchMax)
Definition: shimtest.c:50
UINT cchMax
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:145

Referenced by SHGlobalCounterCreate().

◆ threadref_AddRef()

static ULONG WINAPI threadref_AddRef ( IUnknown iface)
static

Definition at line 155 of file thread.c.

156 {
157  threadref * This = impl_from_IUnknown(iface);
158 
159  TRACE("(%p)\n", This);
160  return InterlockedIncrement(This->ref);
161 }
static threadref * impl_from_IUnknown(IUnknown *iface)
Definition: thread.c:129
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53

◆ threadref_QueryInterface()

static HRESULT WINAPI threadref_QueryInterface ( IUnknown iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 134 of file thread.c.

135 {
136  threadref * This = impl_from_IUnknown(iface);
137 
138  TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppvObj);
139 
140  if (ppvObj == NULL)
141  return E_POINTER;
142 
143  if (IsEqualGUID(&IID_IUnknown, riid)) {
144  TRACE("(%p)->(IID_IUnknown %p)\n", This, ppvObj);
145  *ppvObj = This;
146  IUnknown_AddRef((IUnknown*)*ppvObj);
147  return S_OK;
148  }
149 
150  *ppvObj = NULL;
151  FIXME("(%p, %s, %p) interface not supported\n", This, debugstr_guid(riid), ppvObj);
152  return E_NOINTERFACE;
153 }
static threadref * impl_from_IUnknown(IUnknown *iface)
Definition: thread.c:129
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define E_POINTER
Definition: winerror.h:2365

◆ threadref_Release()

static ULONG WINAPI threadref_Release ( IUnknown iface)
static

Definition at line 163 of file thread.c.

164 {
165  LONG refcount;
166  threadref * This = impl_from_IUnknown(iface);
167 
168  TRACE("(%p)\n", This);
169 
170  refcount = InterlockedDecrement(This->ref);
171  if (!refcount)
173 
174  return refcount;
175 }
static threadref * impl_from_IUnknown(IUnknown *iface)
Definition: thread.c:129
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ SHLWAPI_ThreadRef_index

DWORD SHLWAPI_ThreadRef_index

Definition at line 34 of file shlwapi_main.c.

Referenced by DllMain(), SHGetThreadRef(), and SHSetThreadRef().

◆ threadref_vt

const IUnknownVtbl threadref_vt
static
Initial value:
=
{
}
static HRESULT WINAPI threadref_QueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppvObj)
Definition: thread.c:134
static ULONG WINAPI threadref_Release(IUnknown *iface)
Definition: thread.c:163
static ULONG WINAPI threadref_AddRef(IUnknown *iface)
Definition: thread.c:155

Definition at line 178 of file thread.c.

Referenced by SHCreateThreadRef().