8 #include "debugtools.h"
14 #include "shell32_main.h"
15 #include "wine/undocshell.h"
16 #include "wine/unicode.h"
18 DEFAULT_DEBUG_CHANNEL(shell
);
20 /************************* STRRET functions ****************************/
22 /*************************************************************************
23 * StrRetToStrN [SHELL32.96]
25 * converts a STRRET to a normal string
28 * the pidl is for STRRET OFFSET
30 HRESULT WINAPI
StrRetToStrNA (LPVOID dest
, DWORD len
, LPSTRRET src
, const ITEMIDLIST
*pidl
)
32 return StrRetToBufA( src
, pidl
, dest
, len
);
35 HRESULT WINAPI
StrRetToStrNW (LPVOID dest
, DWORD len
, LPSTRRET src
, const ITEMIDLIST
*pidl
)
37 return StrRetToBufW( src
, pidl
, dest
, len
);
40 HRESULT WINAPI
StrRetToStrNAW (LPVOID dest
, DWORD len
, LPSTRRET src
, const ITEMIDLIST
*pidl
)
42 if(SHELL_OsIsUnicode())
43 return StrRetToStrNW (dest
, len
, src
, pidl
);
44 return StrRetToStrNA (dest
, len
, src
, pidl
);
47 /************************* OLESTR functions ****************************/
49 /************************************************************************
50 * StrToOleStr [SHELL32.163]
53 int WINAPI
StrToOleStrA (LPWSTR lpWideCharStr
, LPCSTR lpMultiByteString
)
55 TRACE("(%p, %p %s)\n",
56 lpWideCharStr
, lpMultiByteString
, debugstr_a(lpMultiByteString
));
58 return MultiByteToWideChar(0, 0, lpMultiByteString
, -1, lpWideCharStr
, MAX_PATH
);
61 int WINAPI
StrToOleStrW (LPWSTR lpWideCharStr
, LPCWSTR lpWString
)
63 TRACE("(%p, %p %s)\n",
64 lpWideCharStr
, lpWString
, debugstr_w(lpWString
));
66 strcpyW (lpWideCharStr
, lpWString
);
67 return strlenW(lpWideCharStr
);
70 BOOL WINAPI
StrToOleStrAW (LPWSTR lpWideCharStr
, LPCVOID lpString
)
72 if (SHELL_OsIsUnicode())
73 return StrToOleStrW (lpWideCharStr
, lpString
);
74 return StrToOleStrA (lpWideCharStr
, lpString
);
77 /*************************************************************************
78 * StrToOleStrN [SHELL32.79]
79 * lpMulti, nMulti, nWide [IN]
82 BOOL WINAPI
StrToOleStrNA (LPWSTR lpWide
, INT nWide
, LPCSTR lpStrA
, INT nStr
)
84 TRACE("(%p, %x, %s, %x)\n", lpWide
, nWide
, debugstr_an(lpStrA
,nStr
), nStr
);
85 return MultiByteToWideChar (0, 0, lpStrA
, nStr
, lpWide
, nWide
);
87 BOOL WINAPI
StrToOleStrNW (LPWSTR lpWide
, INT nWide
, LPCWSTR lpStrW
, INT nStr
)
89 TRACE("(%p, %x, %s, %x)\n", lpWide
, nWide
, debugstr_wn(lpStrW
, nStr
), nStr
);
91 if (lstrcpynW (lpWide
, lpStrW
, nWide
))
92 { return lstrlenW (lpWide
);
97 BOOL WINAPI
StrToOleStrNAW (LPWSTR lpWide
, INT nWide
, LPCVOID lpStr
, INT nStr
)
99 if (SHELL_OsIsUnicode())
100 return StrToOleStrNW (lpWide
, nWide
, lpStr
, nStr
);
101 return StrToOleStrNA (lpWide
, nWide
, lpStr
, nStr
);
104 /*************************************************************************
105 * OleStrToStrN [SHELL32.78]
107 BOOL WINAPI
OleStrToStrNA (LPSTR lpStr
, INT nStr
, LPCWSTR lpOle
, INT nOle
)
109 TRACE("(%p, %x, %s, %x)\n", lpStr
, nStr
, debugstr_wn(lpOle
,nOle
), nOle
);
110 return WideCharToMultiByte (0, 0, lpOle
, nOle
, lpStr
, nStr
, NULL
, NULL
);
113 BOOL WINAPI
OleStrToStrNW (LPWSTR lpwStr
, INT nwStr
, LPCWSTR lpOle
, INT nOle
)
115 TRACE("(%p, %x, %s, %x)\n", lpwStr
, nwStr
, debugstr_wn(lpOle
,nOle
), nOle
);
117 if (lstrcpynW ( lpwStr
, lpOle
, nwStr
))
118 { return lstrlenW (lpwStr
);
123 BOOL WINAPI
OleStrToStrNAW (LPVOID lpOut
, INT nOut
, LPCVOID lpIn
, INT nIn
)
125 if (SHELL_OsIsUnicode())
126 return OleStrToStrNW (lpOut
, nOut
, lpIn
, nIn
);
127 return OleStrToStrNA (lpOut
, nOut
, lpIn
, nIn
);