ReactOS  0.4.13-dev-66-gc714b7f
clsid.c File Reference
#include <stdio.h>
#include "wine/test.h"
#include "winbase.h"
#include "winerror.h"
#include "winnls.h"
#include "winuser.h"
#include "initguid.h"
#include "shlguid.h"
#include "shobjidl.h"
#include "olectl.h"
Include dependency graph for clsid.c:

Go to the source code of this file.

Functions

 DEFINE_GUID (GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 
 DEFINE_OLEGUID (WINE_IID_IDelayedRelease, 0x000214EDL, 0, 0)
 
static BOOL (WINAPI *pSHLWAPI_269)(LPCSTR
 
static CLSID *static DWORD (WINAPI *pSHLWAPI_23)(REFGUID
 
 DEFINE_GUID (IID_Endianness, 0x01020304, 0x0506, 0x0708, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x0A)
 
static void test_ClassIDs (void)
 
static void test_CLSIDFromProgIDWrap (void)
 
 START_TEST (clsid)
 

Variables

static HMODULE hShlwapi = 0
 
static CLSID *static LPSTR
 
static CLSID *static INT = 0
 
static const GUIDTEST_guids []
 

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pSHLWAPI_269)
static

◆ DEFINE_GUID() [1/2]

DEFINE_GUID ( GUID_NULL  ,
,
,
,
,
,
,
,
,
,
,
 
)

◆ DEFINE_GUID() [2/2]

DEFINE_GUID ( IID_Endianness  ,
0x01020304  ,
0x0506  ,
0x0708  ,
0x09  ,
0x0A  ,
0x0B  ,
0x0C  ,
0x0D  ,
0x0E  ,
0x0F  ,
0x0A   
)

◆ DEFINE_OLEGUID()

DEFINE_OLEGUID ( WINE_IID_IDelayedRelease  ,
0x000214EDL  ,
,
 
)

◆ DWORD()

static CLSID* static DWORD ( WINAPI pSHLWAPI_23)
static

◆ START_TEST()

START_TEST ( clsid  )

Definition at line 185 of file clsid.c.

186 {
187  hShlwapi = GetModuleHandleA("shlwapi.dll");
188 
189  /* SHCreateStreamOnFileEx was introduced in shlwapi v6.0 */
190  if(!GetProcAddress(hShlwapi, "SHCreateStreamOnFileEx")){
191  win_skip("Too old shlwapi version\n");
192  return;
193  }
194 
195  pSHLWAPI_269 = (void*)GetProcAddress(hShlwapi, (LPSTR)269);
196  pSHLWAPI_23 = (void*)GetProcAddress(hShlwapi, (LPSTR)23);
197 
198  test_ClassIDs();
200 }
static void test_ClassIDs(void)
Definition: clsid.c:102
char * LPSTR
Definition: xmlstorage.h:182
static HMODULE hShlwapi
Definition: clsid.c:38
static void test_CLSIDFromProgIDWrap(void)
Definition: clsid.c:164
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define GetProcAddress(x, y)
Definition: compat.h:410
#define win_skip
Definition: test.h:141

◆ test_ClassIDs()

static void test_ClassIDs ( void  )
static

Definition at line 102 of file clsid.c.

103 {
104  const GUID **guids = TEST_guids;
105  char szBuff[256];
106  GUID guid;
107  DWORD dwLen;
108  BOOL bRet;
109  int i = 0;
110  BOOL is_vista = FALSE;
111 
112  if (!pSHLWAPI_269 || !pSHLWAPI_23)
113  return;
114 
115  while (*guids)
116  {
117  dwLen = pSHLWAPI_23(*guids, szBuff, 256);
118  if (!i && dwLen == S_OK) is_vista = TRUE; /* seems to return an HRESULT on vista */
119  ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for id %d\n", dwLen, i);
120 
121  bRet = pSHLWAPI_269(szBuff, &guid);
122  ok(bRet != FALSE, "created invalid string '%s'\n", szBuff);
123 
124  if (bRet)
125  ok(IsEqualGUID(*guids, &guid), "GUID created wrong %d\n", i);
126 
127  guids++;
128  i++;
129  }
130 
131  /* Test endianness */
132  dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 256);
133  ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for IID_Endianness\n", dwLen);
134 
135  ok(!strcmp(szBuff, "{01020304-0506-0708-090A-0B0C0D0E0F0A}"),
136  "Endianness Broken, got '%s'\n", szBuff);
137 
138  /* test lengths */
139  szBuff[0] = ':';
140  dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 0);
141  ok(dwLen == (is_vista ? E_FAIL : 0), "accepted bad length\n");
142  ok(szBuff[0] == ':', "wrote to buffer with no length\n");
143 
144  szBuff[0] = ':';
145  dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 38);
146  ok(dwLen == (is_vista ? E_FAIL : 0), "accepted bad length\n");
147  ok(szBuff[0] == ':', "wrote to buffer with no length\n");
148 
149  szBuff[0] = ':';
150  dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 39);
151  ok(dwLen == (is_vista ? S_OK : 39), "rejected ok length\n");
152  ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n");
153 
154  /* Test string */
155  strcpy(szBuff, "{xxx-");
156  bRet = pSHLWAPI_269(szBuff, &guid);
157  ok(bRet == FALSE, "accepted invalid string\n");
158 
159  dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 39);
160  ok(dwLen == (is_vista ? S_OK : 39), "rejected ok length\n");
161  ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n");
162 }
#define TRUE
Definition: types.h:120
#define E_FAIL
Definition: ddrawi.h:102
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
const GUID * guid
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
unsigned long DWORD
Definition: ntddk_ex.h:95
static const GUID * TEST_guids[]
Definition: clsid.c:43
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by START_TEST().

◆ test_CLSIDFromProgIDWrap()

static void test_CLSIDFromProgIDWrap ( void  )
static

Definition at line 164 of file clsid.c.

165 {
166  HRESULT (WINAPI *pCLSIDFromProgIDWrap)(LPCOLESTR,LPCLSID);
167  CLSID clsid = IID_NULL;
168  HRESULT hres;
169 
170  static const WCHAR wszStdPicture[] = {'S','t','d','P','i','c','t','u','r','e',0};
171 
172  pCLSIDFromProgIDWrap = (void*)GetProcAddress(hShlwapi,(char*)435);
173 
174  hres = pCLSIDFromProgIDWrap(wszStdPicture, &clsid);
175  ok(hres == S_OK, "CLSIDFromProgIDWrap failed: %08x\n", hres);
176  ok(IsEqualGUID(&CLSID_StdPicture, &clsid), "wrong clsid\n");
177 
178  hres = pCLSIDFromProgIDWrap(NULL, &clsid);
179  ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres);
180 
181  hres = pCLSIDFromProgIDWrap(wszStdPicture, NULL);
182  ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres);
183 }
#define HRESULT
Definition: msvc.h:9
GUID * LPCLSID
Definition: guiddef.h:88
static HMODULE hShlwapi
Definition: clsid.c:38
#define ok(value,...)
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define WINAPI
Definition: msvc.h:8
REFCLSID clsid
Definition: msctf.c:84
#define IID_NULL
Definition: guiddef.h:93
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define GetProcAddress(x, y)
Definition: compat.h:410
const GUID CLSID_StdPicture

Referenced by START_TEST().

Variable Documentation

◆ hShlwapi

HMODULE hShlwapi = 0
static

Definition at line 38 of file clsid.c.

Referenced by START_TEST(), and test_CLSIDFromProgIDWrap().

◆ INT

CLSID* static INT = 0

Definition at line 40 of file clsid.c.

◆ LPSTR

CLSID* static LPSTR

Definition at line 40 of file clsid.c.

◆ TEST_guids

const GUID* TEST_guids[]
static

Definition at line 43 of file clsid.c.

Referenced by test_ClassIDs().