Add some Str* prototypes to shlwapi.h.
[wine/testsucceed.git] / dlls / shell32 / shellstring.c
blobfac7cbea132701a01e8891024cfac19740764635
1 #include <string.h>
2 #include <stdio.h>
3 #include <ctype.h>
4 #include <stdlib.h>
6 #include "winnls.h"
7 #include "winerror.h"
8 #include "debugtools.h"
9 #include "heap.h"
11 #include "shlwapi.h"
12 #include "shellapi.h"
13 #include "shell32_main.h"
14 #include "wine/undocshell.h"
15 #include "wine/unicode.h"
17 DEFAULT_DEBUG_CHANNEL(shell);
19 /************************* STRRET functions ****************************/
21 /*************************************************************************
22 * StrRetToStrN [SHELL32.96]
24 * converts a STRRET to a normal string
26 * NOTES
27 * the pidl is for STRRET OFFSET
29 HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
31 return StrRetToBufA( src, pidl, dest, len );
34 HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
36 return StrRetToBufW( src, pidl, dest, len );
39 HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
41 if(SHELL_OsIsUnicode())
42 return StrRetToStrNW (dest, len, src, pidl);
43 return StrRetToStrNA (dest, len, src, pidl);
46 /************************* OLESTR functions ****************************/
48 /************************************************************************
49 * StrToOleStr [SHELL32.163]
52 int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString)
54 TRACE("(%p, %p %s)\n",
55 lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString));
57 return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);
60 int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
62 TRACE("(%p, %p %s)\n",
63 lpWideCharStr, lpWString, debugstr_w(lpWString));
65 strcpyW (lpWideCharStr, lpWString );
66 return strlenW(lpWideCharStr);
69 BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString)
71 if (SHELL_OsIsUnicode())
72 return StrToOleStrW (lpWideCharStr, lpString);
73 return StrToOleStrA (lpWideCharStr, lpString);
76 /*************************************************************************
77 * StrToOleStrN [SHELL32.79]
78 * lpMulti, nMulti, nWide [IN]
79 * lpWide [OUT]
81 BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr)
83 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_an(lpStrA,nStr), nStr);
84 return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide);
86 BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr)
88 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_wn(lpStrW, nStr), nStr);
90 if (lstrcpynW (lpWide, lpStrW, nWide))
91 { return lstrlenW (lpWide);
93 return 0;
96 BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr)
98 if (SHELL_OsIsUnicode())
99 return StrToOleStrNW (lpWide, nWide, lpStr, nStr);
100 return StrToOleStrNA (lpWide, nWide, lpStr, nStr);
103 /*************************************************************************
104 * OleStrToStrN [SHELL32.78]
106 BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle)
108 TRACE("(%p, %x, %s, %x)\n", lpStr, nStr, debugstr_wn(lpOle,nOle), nOle);
109 return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL);
112 BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle)
114 TRACE("(%p, %x, %s, %x)\n", lpwStr, nwStr, debugstr_wn(lpOle,nOle), nOle);
116 if (lstrcpynW ( lpwStr, lpOle, nwStr))
117 { return lstrlenW (lpwStr);
119 return 0;
122 BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn)
124 if (SHELL_OsIsUnicode())
125 return OleStrToStrNW (lpOut, nOut, lpIn, nIn);
126 return OleStrToStrNA (lpOut, nOut, lpIn, nIn);