From 917910324f378d5bd491f78ee598494b4f1b60a8 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Fri, 23 Jun 2000 16:13:33 +0000
Subject: [PATCH] Cleaned up a few inter-dll dependencies.

---
 dlls/ole32/compobj.c      |  2 +-
 dlls/ole32/datacache.c    |  7 ++-
 dlls/ole32/ole2.c         | 20 ++++-----
 dlls/oleaut32/typelib.c   | 90 +++++++++++----------------------------
 dlls/olecli/olecli_main.c | 25 ++++-------
 dlls/shell32/classes.c    | 12 ++++--
 dlls/shell32/folders.c    |  7 ++-
 dlls/shell32/pidl.c       | 10 +++--
 dlls/shell32/shellole.c   |  7 ++-
 dlls/shell32/shellord.c   | 17 +++++---
 include/wine/obj_base.h   |  7 ---
 misc/lstr.c               | 15 +++----
 12 files changed, 88 insertions(+), 131 deletions(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 115f3a4d878..1ea9d139fad 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -763,7 +763,7 @@ HRESULT WINAPI CLSIDFromString(
  * RETURNS
  *	the string representation and OLESTATUS
  */
-HRESULT WINE_StringFromCLSID(
+static HRESULT WINE_StringFromCLSID(
 	const CLSID *id,	/* [in] GUID to be converted */
 	LPSTR idstr		/* [out] pointer to buffer to contain converted guid */
 ) {
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index 2c6f5411501..5e2853cae83 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -35,7 +35,6 @@
 #include "wingdi.h"
 #include "winuser.h"
 #include "winerror.h"
-#include "crtdll.h"
 #include "wine/obj_oleview.h"
 #include "wine/obj_cache.h"
 #include "wine/unicode.h"
@@ -683,9 +682,9 @@ static BOOL DataCache_IsPresentationStream(const STATSTG *elem)
 	&& (elem->cbSize.s.LowPart >= sizeof(PresentationDataHeader))
 	&& (strlenW(name) == 11)
 	&& (strncmpW(name, OlePres, 8) == 0)
-	&& CRTDLL_iswdigit(name[8])
-	&& CRTDLL_iswdigit(name[9])
-	&& CRTDLL_iswdigit(name[10]);
+	&& (name[8] >= '0') && (name[8] <= '9')
+	&& (name[9] >= '0') && (name[9] <= '9')
+	&& (name[10] >= '0') && (name[10] <= '9');
 }
 
 /************************************************************************
diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index b365741918b..815e01fbed1 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -393,7 +393,6 @@ HRESULT WINAPI OleRegGetUserType(
 	DWORD dwFormOfType,
 	LPOLESTR* pszUserType)
 {
-  char    xclsid[50];
   char    keyName[60];
   DWORD   dwKeyType;
   DWORD   cbData;
@@ -409,11 +408,10 @@ HRESULT WINAPI OleRegGetUserType(
   /*
    * Build the key name we're looking for
    */
-  WINE_StringFromCLSID((LPCLSID)clsid, xclsid);
-
-  strcpy(keyName, "CLSID\\");
-  strcat(keyName, xclsid);
-  strcat(keyName, "\\");
+  sprintf( keyName, "CLSID\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\",
+           clsid->Data1, clsid->Data2, clsid->Data3,
+           clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
+           clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
 
   TRACE("(%s, %ld, %p)\n", keyName, dwFormOfType, pszUserType);
 
@@ -602,7 +600,6 @@ HRESULT WINAPI OleRegGetMiscStatus(
   DWORD    dwAspect,
   DWORD*   pdwStatus)
 {
-  char    xclsid[50];
   char    keyName[60];
   HKEY    clsidKey;
   HKEY    miscStatusKey;
@@ -617,11 +614,10 @@ HRESULT WINAPI OleRegGetMiscStatus(
   /*
    * Build the key name we're looking for
    */
-  WINE_StringFromCLSID((LPCLSID)clsid, xclsid);
-
-  strcpy(keyName, "CLSID\\");
-  strcat(keyName, xclsid);
-  strcat(keyName, "\\");
+  sprintf( keyName, "CLSID\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\",
+           clsid->Data1, clsid->Data2, clsid->Data3,
+           clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
+           clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
 
   TRACE("(%s, %ld, %p)\n", keyName, dwAspect, pdwStatus);
 
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 94983a8aec1..2b5034bd690 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -73,10 +73,11 @@ QueryPathOfRegTypeLib16(
 	DWORD	plen;
 
 	if (HIWORD(guid)) {
-		WINE_StringFromCLSID(guid,xguid);
-		sprintf(typelibkey,"SOFTWARE\\Classes\\Typelib\\%s\\%d.%d\\%lx\\win16",
-			xguid,wMaj,wMin,lcid
-		);
+            sprintf( typelibkey, "SOFTWARE\\Classes\\Typelib\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\%d.%d\\%lx\\win16",
+                     guid->Data1, guid->Data2, guid->Data3,
+                     guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
+                     guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7],
+                     wMaj,wMin,lcid);
 	} else {
 		sprintf(xguid,"<guid 0x%08lx>",(DWORD)guid);
 		FIXME("(%s,%d,%d,0x%04lx,%p),can't handle non-string guids.\n",xguid,wMaj,wMin,(DWORD)lcid,path);
@@ -113,10 +114,11 @@ QueryPathOfRegTypeLib(
 
 
 	if (HIWORD(guid)) {
-		WINE_StringFromCLSID(guid,xguid);
-		sprintf(typelibkey,"SOFTWARE\\Classes\\Typelib\\%s\\%d.%d\\%lx\\win32",
-			xguid,wMaj,wMin,lcid
-		);
+            sprintf( typelibkey, "SOFTWARE\\Classes\\Typelib\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\%d.%d\\%lx\\win32",
+                     guid->Data1, guid->Data2, guid->Data3,
+                     guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
+                     guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7],
+                     wMaj,wMin,lcid);
 	} else {
 		sprintf(xguid,"<guid 0x%08lx>",(DWORD)guid);
 		FIXME("(%s,%d,%d,0x%04lx,%p),stub!\n",xguid,wMaj,wMin,(DWORD)lcid,path);
@@ -222,12 +224,8 @@ HRESULT WINAPI LoadRegTypeLib(
         res= LoadTypeLib(bstr, ppTLib);
         SysFreeString(bstr);
     }
-    if(TRACE_ON(typelib)){
-        char xriid[50];
-        WINE_StringFromCLSID((LPCLSID)rguid,xriid);
-        TRACE("(IID: %s) load %s (%p)\n",xriid,
-              SUCCEEDED(res)? "SUCCESS":"FAILED", *ppTLib);
-    }
+    TRACE("(IID: %s) load %s (%p)\n",debugstr_guid(rguid),
+          SUCCEEDED(res)? "SUCCESS":"FAILED", *ppTLib);
     return res;
 }	
 
@@ -270,9 +268,7 @@ HRESULT WINAPI UnRegisterTypeLib(
 	LCID lcid,	/* [in] locale id */
 	SYSKIND syskind)
 {   
-    char xriid[50];
-    WINE_StringFromCLSID((LPCLSID)libid,xriid);
-    TRACE("(IID: %s): stub\n",xriid);
+    TRACE("(IID: %s): stub\n",debugstr_guid(libid));
     return S_OK;	/* FIXME: pretend everything is OK */
 }
 
@@ -1260,11 +1256,7 @@ int TLB_ReadTypeLib(PCHAR file, ITypeLib **ppTypeLib)
 static HRESULT WINAPI ITypeLib_fnQueryInterface( LPTYPELIB This, REFIID riid,
     VOID **ppvObject)
 {
-    if(TRACE_ON(typelib)){
-        char xriid[50];
-        WINE_StringFromCLSID((LPCLSID)riid,xriid);
-        TRACE("(%p)->(IID: %s)\n",This,xriid);
-    }
+    TRACE("(%p)->(IID: %s)\n",This,debugstr_guid(riid));
     *ppvObject=NULL;
     if(IsEqualIID(riid, &IID_IUnknown) || 
             IsEqualIID(riid,&IID_ITypeLib)||
@@ -1362,13 +1354,9 @@ static HRESULT WINAPI ITypeLib_fnGetTypeInfoOfGuid( LPTYPELIB iface,
 				REFGUID guid, ITypeInfo **ppTInfo)
 {
     int i;
-	ICOM_THIS( TLBLibInfo, iface);
-	TLBTypeInfo **ppTLBTInfo=(TLBTypeInfo **)ppTInfo;
-    if(TRACE_ON(typelib)){
-        char xriid[50];
-        WINE_StringFromCLSID((LPCLSID)guid,xriid);
-        TRACE("(%p) guid %sx)\n",This,xriid);
-    }
+    ICOM_THIS( TLBLibInfo, iface);
+    TLBTypeInfo **ppTLBTInfo=(TLBTypeInfo **)ppTInfo;
+    TRACE("(%p) guid %sx)\n",This,debugstr_guid(guid));
     for(i=0,*ppTLBTInfo=This->pTypeInfo;*ppTLBTInfo && 
             !IsEqualIID(guid,&(*ppTLBTInfo)->TypeAttr.guid);i++)
         *ppTLBTInfo=(*ppTLBTInfo)->next;
@@ -1551,11 +1539,7 @@ static HRESULT WINAPI ITypeLib2_fnGetCustData( ITypeLib * iface, REFGUID guid,
     TLBCustData *pCData;
     for(pCData=This->pCustData; pCData; pCData = pCData->next)
         if( IsEqualIID(guid, &pCData->guid)) break;
-    if(TRACE_ON(typelib)){
-        char xriid[50];
-        WINE_StringFromCLSID((LPCLSID)guid,xriid);
-        TRACE("(%p) guid %s %s found!x)\n", This, xriid, pCData? "" : "NOT");
-    }
+    TRACE("(%p) guid %s %s found!x)\n", This, debugstr_guid(guid), pCData? "" : "NOT");
     if(pCData){
         VariantInit( pVarVal);
         VariantCopy( pVarVal, &pCData->data);
@@ -1654,12 +1638,8 @@ static HRESULT WINAPI ITypeLib2_fnGetAllCustData( ITypeLib * iface,
 static HRESULT WINAPI ITypeInfo_fnQueryInterface( LPTYPEINFO iface, REFIID riid,
     VOID **ppvObject)
 {
-	ICOM_THIS( TLBTypeInfo, iface);
-    if(TRACE_ON(typelib)){
-        char xriid[50];
-        WINE_StringFromCLSID((LPCLSID)riid,xriid);
-        TRACE("(%p)->(IID: %s)\n",This,xriid);
-    }
+    ICOM_THIS( TLBTypeInfo, iface);
+    TRACE("(%p)->(IID: %s)\n",This,debugstr_guid(riid));
     *ppvObject=NULL;
     if(IsEqualIID(riid, &IID_IUnknown) || 
             IsEqualIID(riid,&IID_ITypeInfo)||
@@ -2243,11 +2223,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetCustData( ITypeInfo * iface,
     TLBCustData *pCData;
     for(pCData=This->pCustData; pCData; pCData = pCData->next)
         if( IsEqualIID(guid, &pCData->guid)) break;
-    if(TRACE_ON(typelib)){
-        char xriid[50];
-        WINE_StringFromCLSID((LPCLSID)guid,xriid);
-        TRACE("(%p) guid %s %s found!x)\n", This, xriid, pCData? "" : "NOT");
-    }
+    TRACE("(%p) guid %s %s found!x)\n", This, debugstr_guid(guid), pCData? "" : "NOT");
     if(pCData){
         VariantInit( pVarVal);
         VariantCopy( pVarVal, &pCData->data);
@@ -2273,11 +2249,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncCustData( ITypeInfo * iface,
     if(pFDesc)
         for(pCData=pFDesc->pCustData; pCData; pCData = pCData->next)
             if( IsEqualIID(guid, &pCData->guid)) break;
-    if(TRACE_ON(typelib)){
-        char xriid[50];
-        WINE_StringFromCLSID((LPCLSID)guid,xriid);
-        TRACE("(%p) guid %s %s found!x)\n", This, xriid, pCData? "" : "NOT");
-    }
+    TRACE("(%p) guid %s %s found!x)\n", This, debugstr_guid(guid), pCData? "" : "NOT");
     if(pCData){
         VariantInit( pVarVal);
         VariantCopy( pVarVal, &pCData->data);
@@ -2304,11 +2276,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetParamCustData( ITypeInfo * iface,
         for(pCData=pFDesc->pParamDesc[indexParam].pCustData; pCData; 
                 pCData = pCData->next)
             if( IsEqualIID(guid, &pCData->guid)) break;
-    if(TRACE_ON(typelib)){
-        char xriid[50];
-        WINE_StringFromCLSID((LPCLSID)guid,xriid);
-        TRACE("(%p) guid %s %s found!x)\n", This, xriid, pCData? "" : "NOT");
-    }
+    TRACE("(%p) guid %s %s found!x)\n", This, debugstr_guid(guid), pCData? "" : "NOT");
     if(pCData){
         VariantInit( pVarVal);
         VariantCopy( pVarVal, &pCData->data);
@@ -2334,11 +2302,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetVarCustData( ITypeInfo * iface,
     if(pVDesc)
         for(pCData=pVDesc->pCustData; pCData; pCData = pCData->next)
             if( IsEqualIID(guid, &pCData->guid)) break;
-    if(TRACE_ON(typelib)){
-        char xriid[50];
-        WINE_StringFromCLSID((LPCLSID)guid,xriid);
-        TRACE("(%p) guid %s %s found!x)\n", This, xriid, pCData? "" : "NOT");
-    }
+    TRACE("(%p) guid %s %s found!x)\n", This, debugstr_guid(guid), pCData? "" : "NOT");
     if(pCData){
         VariantInit( pVarVal);
         VariantCopy( pVarVal, &pCData->data);
@@ -2364,11 +2328,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetImplTypeCustData( ITypeInfo * iface,
     if(pRDesc)
         for(pCData=pRDesc->pCustData; pCData; pCData = pCData->next)
             if( IsEqualIID(guid, &pCData->guid)) break;
-    if(TRACE_ON(typelib)){
-        char xriid[50];
-        WINE_StringFromCLSID((LPCLSID)guid,xriid);
-        TRACE("(%p) guid %s %s found!x)\n", This, xriid, pCData? "" : "NOT");
-    }
+    TRACE("(%p) guid %s %s found!x)\n", This, debugstr_guid(guid), pCData? "" : "NOT");
     if(pCData){
         VariantInit( pVarVal);
         VariantCopy( pVarVal, &pCData->data);
diff --git a/dlls/olecli/olecli_main.c b/dlls/olecli/olecli_main.c
index 485836911da..69768ceeaf2 100644
--- a/dlls/olecli/olecli_main.c
+++ b/dlls/olecli/olecli_main.c
@@ -9,8 +9,8 @@
 #include "windef.h"
 #include "wingdi.h"
 #include "wtypes.h"
+#include "ldt.h"
 #include "ole.h"
-#include "gdi.h"
 #include "debugtools.h"
 
 DEFAULT_DEBUG_CHANNEL(ole);
@@ -156,30 +156,21 @@ OLESTATUS WINAPI OleQueryCreateFromClip(LPCSTR name,OLEOPT_RENDER render,OLECLIP
 }
 
 /******************************************************************************
- *		OleIsDcMeta16	[OLECLI.60]
+ *		OleIsDcMeta	[OLECLI32.60]
  */
-BOOL16 WINAPI OleIsDcMeta16(HDC16 hdc)
+BOOL WINAPI OleIsDcMeta(HDC hdc)
 {
-	TRACE("(%04x)\n",hdc);
-	if (GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ) != 0) {
-	    GDI_HEAP_UNLOCK( hdc );
-	    return TRUE;
-	}
-	return FALSE;
+    TRACE("(%04x)\n",hdc);
+    return GetObjectType( hdc ) == OBJ_METADC;
 }
 
 
 /******************************************************************************
- *		OleIsDcMeta	[OLECLI32.60]
+ *		OleIsDcMeta16	[OLECLI.60]
  */
-BOOL WINAPI OleIsDcMeta(HDC hdc)
+BOOL16 WINAPI OleIsDcMeta16(HDC16 hdc)
 {
-        TRACE("(%04x)\n",hdc);
-	if (GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ) != 0) {
-	    GDI_HEAP_UNLOCK( hdc );
-	    return TRUE;
-	}
-	return FALSE;
+    return OleIsDcMeta( hdc );
 }
 
 
diff --git a/dlls/shell32/classes.c b/dlls/shell32/classes.c
index 82cd6006f7f..9390e91b893 100644
--- a/dlls/shell32/classes.c
+++ b/dlls/shell32/classes.c
@@ -117,8 +117,10 @@ BOOL HCR_GetClassName (REFIID riid, LPSTR szDest, DWORD len)
 	BOOL ret = FALSE;
 	DWORD buflen = len;
 
-	strcpy(xriid,"CLSID\\");
-	WINE_StringFromCLSID(riid,&xriid[strlen(xriid)]);
+        sprintf( xriid, "CLSID\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+                 riid->Data1, riid->Data2, riid->Data3,
+                 riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
+                 riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] );
 
 	TRACE("%s\n",xriid );
 
@@ -165,8 +167,10 @@ BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest)
 	DWORD	attributes;
 	DWORD	len = 4;
 
-	strcpy(xriid,"CLSID\\");
-	WINE_StringFromCLSID(riid,&xriid[strlen(xriid)]);
+        sprintf( xriid, "CLSID\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+                 riid->Data1, riid->Data2, riid->Data3,
+                 riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
+                 riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] );
 	TRACE("%s\n",xriid );
 
 	if (!szDest) return FALSE;
diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c
index 9464a6f9484..a29d1df6db4 100644
--- a/dlls/shell32/folders.c
+++ b/dlls/shell32/folders.c
@@ -5,6 +5,7 @@
  */
 
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 
 #include "wine/obj_base.h"
@@ -153,8 +154,10 @@ static HRESULT WINAPI IExtractIconA_fnGetIconLocation(
 	else if ( (riid = _ILGetGUIDPointer(pSimplePidl)) )
 	{ 
 	  char xriid[50];
-	  strcpy(xriid,"CLSID\\");
-	  WINE_StringFromCLSID((LPCLSID)riid,&xriid[strlen(xriid)]);
+          sprintf( xriid, "CLSID\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+                   riid->Data1, riid->Data2, riid->Data3,
+                   riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
+                   riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] );
 
 	  if (HCR_GetDefaultIcon(xriid, sTemp, MAX_PATH, &dwNr))
 	  {
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index 4e31ec1e60c..76a30a70abe 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -1209,9 +1209,13 @@ LPITEMIDLIST _ILCreateValue(WIN32_FIND_DATAA * stffile)
 
 LPITEMIDLIST _ILCreateSpecial(LPCSTR szGUID)
 {
-	IID	iid;
-	CLSIDFromString16(szGUID,&iid);
-	return _ILCreate(PT_MYCOMP, &iid, sizeof(IID));
+    IID iid;
+    WCHAR buffer[40];
+
+    if (!MultiByteToWideChar( CP_ACP, 0, szGUID, -1, buffer, sizeof(buffer)/sizeof(WCHAR) ))
+        return NULL;
+    CLSIDFromString( buffer, &iid );
+    return _ILCreate(PT_MYCOMP, &iid, sizeof(IID));
 }
 
 /**************************************************************************
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c
index e21b97ef758..6f489f2de20 100644
--- a/dlls/shell32/shellole.c
+++ b/dlls/shell32/shellole.c
@@ -122,8 +122,11 @@ HRESULT WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv
  */
 DWORD WINAPI SHCLSIDFromStringA (LPSTR clsid, CLSID *id)
 {
-	TRACE("(%p(%s) %p)\n", clsid, clsid, id);
-	return CLSIDFromString16(clsid, id); 
+    WCHAR buffer[40];
+    TRACE("(%p(%s) %p)\n", clsid, clsid, id);
+    if (!MultiByteToWideChar( CP_ACP, 0, clsid, -1, buffer, sizeof(buffer)/sizeof(WCHAR) ))
+        return CO_E_CLASSSTRING;
+    return CLSIDFromString( buffer, id );
 }
 DWORD WINAPI SHCLSIDFromStringW (LPWSTR clsid, CLSID *id)
 {
diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c
index 23ae8c9f062..ade28383c10 100644
--- a/dlls/shell32/shellord.c
+++ b/dlls/shell32/shellord.c
@@ -1013,10 +1013,13 @@ DWORD WINAPI SHLWAPI_23 (
 	LPSTR str,	/* [out] buffer */
 	INT cmax)	/* [in]  size of buffer */
 {
-	char xguid[80];
-	TRACE("(%s %p 0x%08x)stub\n", debugstr_guid(guid), str, cmax);
+	char xguid[40];
 
-	if (WINE_StringFromCLSID(guid,xguid)) return 0;
+        sprintf( xguid, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+                 guid->Data1, guid->Data2, guid->Data3,
+                 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
+                 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
+	TRACE("(%s %p 0x%08x)stub\n", xguid, str, cmax);
 	if (strlen(xguid)>=cmax) return 0;
 	strcpy(str,xguid);
 	return strlen(xguid) + 1;
@@ -1108,7 +1111,7 @@ LPWSTR WINAPI SHLWAPI_215 (
 	int len)
 {
 	WARN("(%s %p %u)\n",lpStrSrc,lpwStrDest,len);
-	return CRTDLL_wcsncpy(lpwStrDest, lpStrSrc, len);
+	return NTDLL_wcsncpy(lpwStrDest, lpStrSrc, len);
 }
 
 /*************************************************************************
@@ -1120,9 +1123,11 @@ LPWSTR WINAPI SHLWAPI_215 (
 HANDLE WINAPI SHLWAPI_222 (LPCLSID guid)
 {
 	char lpstrName[80];
-	strcpy( lpstrName,"shell.");
-	WINE_StringFromCLSID(guid, lpstrName + strlen(lpstrName));
 
+        sprintf( lpstrName, "shell.{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+                 guid->Data1, guid->Data2, guid->Data3,
+                 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
+                 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
 	FIXME("(%s) stub\n", lpstrName);
 	return CreateSemaphoreA(NULL,0, 0x7fffffff, lpstrName);
 }
diff --git a/include/wine/obj_base.h b/include/wine/obj_base.h
index 93fe788ae59..f42548fdb14 100644
--- a/include/wine/obj_base.h
+++ b/include/wine/obj_base.h
@@ -798,11 +798,4 @@ void WINAPI CoUninitialize(void);
 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
 HRESULT WINAPI DllCanUnloadNow(void);
 
-/*****************************************************************************
- * Internal WINE API
- */
-#ifdef __WINE__
-HRESULT WINE_StringFromCLSID(const CLSID *id, LPSTR);
-#endif
-
 #endif /* __WINE_WINE_OBJ_BASE_H */
diff --git a/misc/lstr.c b/misc/lstr.c
index d367ce07224..d5141d33c53 100644
--- a/misc/lstr.c
+++ b/misc/lstr.c
@@ -26,9 +26,9 @@
 #include "winbase.h"
 #include "wingdi.h"
 #include "winuser.h"
-#include "ntddk.h"
 #include "wine/winbase16.h"
 #include "wine/winuser16.h"
+#include "wine/unicode.h"
 #include "winnls.h"
 #include "task.h"
 #include "heap.h"
@@ -283,7 +283,6 @@ DWORD WINAPI CharLowerBuffA(LPSTR x,DWORD buflen)
 
 /***********************************************************************
  *           CharLowerBuffW   (USER32.27)
- * FIXME: handle current locale
  */
 DWORD WINAPI CharLowerBuffW(LPWSTR x,DWORD buflen)
 {
@@ -292,7 +291,7 @@ DWORD WINAPI CharLowerBuffW(LPWSTR x,DWORD buflen)
     if (!x) return 0; /* YES */
     while (*x && (buflen--))
     {
-        *x=NTDLL_towlower(*x);
+        *x=tolowerW(*x);
         x++;
         done++;
     }
@@ -310,12 +309,12 @@ LPWSTR WINAPI CharLowerW(LPWSTR x)
         LPWSTR s = x;
         while (*s)
         {
-            *s=NTDLL_towlower(*s);
+            *s = tolowerW(*s);
             s++;
         }
         return x;
     }
-    else return (LPWSTR)((UINT)NTDLL_towlower(LOWORD(x)));
+    else return (LPWSTR)((UINT)tolowerW(LOWORD(x)));
 }
 
 /***********************************************************************
@@ -366,7 +365,7 @@ DWORD WINAPI CharUpperBuffW(LPWSTR x,DWORD buflen)
     if (!x) return 0; /* YES */
     while (*x && (buflen--))
     {
-        *x=NTDLL_towupper(*x);
+        *x=toupperW(*x);
         x++;
         done++;
     }
@@ -384,12 +383,12 @@ LPWSTR WINAPI CharUpperW(LPWSTR x)
         LPWSTR s = x;
         while (*s)
         {
-            *s=NTDLL_towupper(*s);
+            *s = toupperW(*s);
             s++;
         }
         return x;
     }
-    else return (LPWSTR)((UINT)NTDLL_towupper(LOWORD(x)));
+    else return (LPWSTR)((UINT)toupperW(LOWORD(x)));
 }
 
 /***********************************************************************
-- 
GitLab