mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
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.
This commit is contained in:
parent
5f4e4a5094
commit
b19690bf34
@ -2704,46 +2704,79 @@ DWORD WINAPI SHLWAPI_431 (DWORD x)
|
||||
return 0xabba1247;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* @ [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]
|
||||
*
|
||||
* 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,
|
||||
* however the native shlwapi.dll does *not* import ole32. Nor does
|
||||
* 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
|
||||
* in dlls/ole32/compobj.c
|
||||
*/
|
||||
DWORD WINAPI SHLWAPI_436 (LPWSTR idstr, CLSID *id)
|
||||
HRESULT WINAPI SHLWAPI_436(LPCWSTR idstr, CLSID *id)
|
||||
{
|
||||
LPWSTR s = idstr;
|
||||
BYTE *p;
|
||||
INT i;
|
||||
WCHAR table[256];
|
||||
LPCWSTR s = idstr;
|
||||
BYTE *p;
|
||||
INT i;
|
||||
WCHAR table[256];
|
||||
|
||||
if (!s) {
|
||||
memset(s, 0, sizeof(CLSID));
|
||||
return S_OK;
|
||||
}
|
||||
else { /* validate the CLSID string */
|
||||
if (!s) {
|
||||
memset(id, 0, sizeof(CLSID));
|
||||
return S_OK;
|
||||
}
|
||||
else { /* validate the CLSID string */
|
||||
|
||||
if (strlenW(s) != 38)
|
||||
return CO_E_CLASSSTRING;
|
||||
if (strlenW(s) != 38)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if ((s[0]!=L'{') || (s[9]!=L'-') || (s[14]!=L'-') || (s[19]!=L'-') || (s[24]!=L'-') || (s[37]!=L'}'))
|
||||
return CO_E_CLASSSTRING;
|
||||
if ((s[0]!=L'{') || (s[9]!=L'-') || (s[14]!=L'-') || (s[19]!=L'-') || (s[24]!=L'-') || (s[37]!=L'}'))
|
||||
return E_INVALIDARG;
|
||||
|
||||
for (i=1; i<37; i++)
|
||||
{
|
||||
if ((i == 9)||(i == 14)||(i == 19)||(i == 24)) continue;
|
||||
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')))
|
||||
)
|
||||
return CO_E_CLASSSTRING;
|
||||
}
|
||||
}
|
||||
for (i=1; i<37; i++)
|
||||
{
|
||||
if ((i == 9)||(i == 14)||(i == 19)||(i == 24))
|
||||
continue;
|
||||
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')))
|
||||
)
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("%s -> %p\n", debugstr_w(s), id);
|
||||
|
||||
|
@ -43,6 +43,8 @@ typedef struct {
|
||||
|
||||
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*/
|
||||
#define GET_FUNC(func, module, name, fail) \
|
||||
do { \
|
||||
|
@ -266,8 +266,8 @@
|
||||
266 stdcall @(long wstr ptr ptr) SHLWAPI_266
|
||||
267 stdcall @(long long long long) SHLWAPI_267
|
||||
268 stdcall @(long long) SHLWAPI_268
|
||||
269 stub @
|
||||
270 stub @
|
||||
269 stdcall @(str ptr) SHLWAPI_269
|
||||
270 stdcall @(wstr ptr) SHLWAPI_270
|
||||
271 stdcall @(wstr wstr wstr) SHLWAPI_271
|
||||
272 stub @
|
||||
273 stub @
|
||||
|
Loading…
Reference in New Issue
Block a user