Commit b19690bf authored by Rolf Kalbermatter's avatar Rolf Kalbermatter Committed by Alexandre Julliard

Implement SHLWAPI_269 and SHLWAPI_270.

Fix a 0 reference bug in SHLWAPI_436 and change its return value to what at least W2K does as well.
parent 5f4e4a50
...@@ -2705,45 +2705,78 @@ DWORD WINAPI SHLWAPI_431 (DWORD x) ...@@ -2705,45 +2705,78 @@ DWORD WINAPI SHLWAPI_431 (DWORD x)
} }
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.269]
*
* Convert an ASCII string CLSID into a CLSID.
*/
BOOL WINAPI SHLWAPI_269(LPCSTR idstr, CLSID *id)
{
WCHAR wClsid[40];
MultiByteToWideChar(CP_ACP, 0, idstr, -1, wClsid, sizeof(wClsid)/sizeof(WCHAR));
return SUCCEEDED(SHLWAPI_436(wClsid, id));
}
/*************************************************************************
* @ [SHLWAPI.270]
*
* Convert an Unicode string CLSID into a CLSID.
*/
BOOL WINAPI SHLWAPI_270(LPCWSTR idstr, CLSID *id)
{
return SUCCEEDED(SHLWAPI_436(idstr, id));
}
/*************************************************************************
* @ [SHLWAPI.436] * @ [SHLWAPI.436]
* *
* Convert an Unicode string CLSID into a CLSID.
*
* PARAMS
* idstr [I] string containing a CLSID in text form
* id [O] CLSID extracted from the string
*
* RETURNS
* S_OK on success or E_INVALIDARG on failure
*
* NOTES
* This is really CLSIDFromString which is exported by ole32.dll, * This is really CLSIDFromString which is exported by ole32.dll,
* however the native shlwapi.dll does *not* import ole32. Nor does * however the native shlwapi.dll does *not* import ole32. Nor does
* ole32.dll import this ordinal from shlwapi. Therefore we must conclude * ole32.dll import this ordinal from shlwapi. Therefore we must conclude
* that MS duplicated the code for CLSIDFromString. * that MS duplicated the code for CLSIDFromString, and yes they did, only
* * it returns an E_INVALIDARG error code on failure.
* This is a duplicate (with changes for UNICODE) of CLSIDFromString16 * This is a duplicate (with changes for UNICODE) of CLSIDFromString16
* in dlls/ole32/compobj.c * in dlls/ole32/compobj.c
*/ */
DWORD WINAPI SHLWAPI_436 (LPWSTR idstr, CLSID *id) HRESULT WINAPI SHLWAPI_436(LPCWSTR idstr, CLSID *id)
{ {
LPWSTR s = idstr; LPCWSTR s = idstr;
BYTE *p; BYTE *p;
INT i; INT i;
WCHAR table[256]; WCHAR table[256];
if (!s) { if (!s) {
memset(s, 0, sizeof(CLSID)); memset(id, 0, sizeof(CLSID));
return S_OK; return S_OK;
} }
else { /* validate the CLSID string */ else { /* validate the CLSID string */
if (strlenW(s) != 38) if (strlenW(s) != 38)
return CO_E_CLASSSTRING; return E_INVALIDARG;
if ((s[0]!=L'{') || (s[9]!=L'-') || (s[14]!=L'-') || (s[19]!=L'-') || (s[24]!=L'-') || (s[37]!=L'}')) if ((s[0]!=L'{') || (s[9]!=L'-') || (s[14]!=L'-') || (s[19]!=L'-') || (s[24]!=L'-') || (s[37]!=L'}'))
return CO_E_CLASSSTRING; return E_INVALIDARG;
for (i=1; i<37; i++) for (i=1; i<37; i++)
{ {
if ((i == 9)||(i == 14)||(i == 19)||(i == 24)) continue; if ((i == 9)||(i == 14)||(i == 19)||(i == 24))
if (!(((s[i] >= L'0') && (s[i] <= L'9')) || continue;
((s[i] >= L'a') && (s[i] <= L'f')) || if (!(((s[i] >= L'0') && (s[i] <= L'9')) ||
((s[i] >= L'A') && (s[i] <= L'F'))) ((s[i] >= L'a') && (s[i] <= L'f')) ||
) ((s[i] >= L'A') && (s[i] <= L'F')))
return CO_E_CLASSSTRING; )
} return E_INVALIDARG;
} }
}
TRACE("%s -> %p\n", debugstr_w(s), id); TRACE("%s -> %p\n", debugstr_w(s), id);
......
...@@ -43,6 +43,8 @@ typedef struct { ...@@ -43,6 +43,8 @@ typedef struct {
DWORD WINAPI SHLWAPI_2(LPCWSTR x, UNKNOWN_SHLWAPI_2 *y); DWORD WINAPI SHLWAPI_2(LPCWSTR x, UNKNOWN_SHLWAPI_2 *y);
HRESULT WINAPI SHLWAPI_436(LPCWSTR idstr, CLSID *id);
/* Macro to get function pointer for a module*/ /* Macro to get function pointer for a module*/
#define GET_FUNC(func, module, name, fail) \ #define GET_FUNC(func, module, name, fail) \
do { \ do { \
......
...@@ -266,8 +266,8 @@ ...@@ -266,8 +266,8 @@
266 stdcall @(long wstr ptr ptr) SHLWAPI_266 266 stdcall @(long wstr ptr ptr) SHLWAPI_266
267 stdcall @(long long long long) SHLWAPI_267 267 stdcall @(long long long long) SHLWAPI_267
268 stdcall @(long long) SHLWAPI_268 268 stdcall @(long long) SHLWAPI_268
269 stub @ 269 stdcall @(str ptr) SHLWAPI_269
270 stub @ 270 stdcall @(wstr ptr) SHLWAPI_270
271 stdcall @(wstr wstr wstr) SHLWAPI_271 271 stdcall @(wstr wstr wstr) SHLWAPI_271
272 stub @ 272 stub @
273 stub @ 273 stub @
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment