1 | #include <string.h>
|
---|
2 | #include <stdio.h>
|
---|
3 | #include <ctype.h>
|
---|
4 | #include <stdlib.h>
|
---|
5 |
|
---|
6 | #include "winnls.h"
|
---|
7 | #include "winerror.h"
|
---|
8 | #include "debugtools.h"
|
---|
9 | #include "heap.h"
|
---|
10 |
|
---|
11 | #include "shlobj.h"
|
---|
12 | #include "shlwapi.h"
|
---|
13 | #include "shellapi.h"
|
---|
14 | #include "shell32_main.h"
|
---|
15 | #include "wine/undocshell.h"
|
---|
16 | #include "wine/unicode.h"
|
---|
17 |
|
---|
18 | DEFAULT_DEBUG_CHANNEL(shell);
|
---|
19 |
|
---|
20 | /************************* STRRET functions ****************************/
|
---|
21 |
|
---|
22 | /*************************************************************************
|
---|
23 | * StrRetToStrN [SHELL32.96]
|
---|
24 | *
|
---|
25 | * converts a STRRET to a normal string
|
---|
26 | *
|
---|
27 | * NOTES
|
---|
28 | * the pidl is for STRRET OFFSET
|
---|
29 | */
|
---|
30 | HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
|
---|
31 | {
|
---|
32 | return StrRetToBufA( src, pidl, dest, len );
|
---|
33 | }
|
---|
34 |
|
---|
35 | HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
|
---|
36 | {
|
---|
37 | return StrRetToBufW( src, pidl, dest, len );
|
---|
38 | }
|
---|
39 |
|
---|
40 | HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
|
---|
41 | {
|
---|
42 | if(SHELL_OsIsUnicode())
|
---|
43 | return StrRetToStrNW (dest, len, src, pidl);
|
---|
44 | return StrRetToStrNA (dest, len, src, pidl);
|
---|
45 | }
|
---|
46 |
|
---|
47 | /************************* OLESTR functions ****************************/
|
---|
48 |
|
---|
49 | /************************************************************************
|
---|
50 | * StrToOleStr [SHELL32.163]
|
---|
51 | *
|
---|
52 | */
|
---|
53 | int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString)
|
---|
54 | {
|
---|
55 | TRACE("(%p, %p %s)\n",
|
---|
56 | lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString));
|
---|
57 |
|
---|
58 | return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);
|
---|
59 |
|
---|
60 | }
|
---|
61 | int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
|
---|
62 | {
|
---|
63 | TRACE("(%p, %p %s)\n",
|
---|
64 | lpWideCharStr, lpWString, debugstr_w(lpWString));
|
---|
65 |
|
---|
66 | strcpyW (lpWideCharStr, lpWString );
|
---|
67 | return strlenW(lpWideCharStr);
|
---|
68 | }
|
---|
69 |
|
---|
70 | BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString)
|
---|
71 | {
|
---|
72 | if (SHELL_OsIsUnicode())
|
---|
73 | return StrToOleStrW (lpWideCharStr, lpString);
|
---|
74 | return StrToOleStrA (lpWideCharStr, lpString);
|
---|
75 | }
|
---|
76 |
|
---|
77 | /*************************************************************************
|
---|
78 | * StrToOleStrN [SHELL32.79]
|
---|
79 | * lpMulti, nMulti, nWide [IN]
|
---|
80 | * lpWide [OUT]
|
---|
81 | */
|
---|
82 | BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr)
|
---|
83 | {
|
---|
84 | TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_an(lpStrA,nStr), nStr);
|
---|
85 | return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide);
|
---|
86 | }
|
---|
87 | BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr)
|
---|
88 | {
|
---|
89 | TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_wn(lpStrW, nStr), nStr);
|
---|
90 |
|
---|
91 | if (lstrcpynW (lpWide, lpStrW, nWide))
|
---|
92 | { return lstrlenW (lpWide);
|
---|
93 | }
|
---|
94 | return 0;
|
---|
95 | }
|
---|
96 |
|
---|
97 | BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr)
|
---|
98 | {
|
---|
99 | if (SHELL_OsIsUnicode())
|
---|
100 | return StrToOleStrNW (lpWide, nWide, lpStr, nStr);
|
---|
101 | return StrToOleStrNA (lpWide, nWide, lpStr, nStr);
|
---|
102 | }
|
---|
103 |
|
---|
104 | /*************************************************************************
|
---|
105 | * OleStrToStrN [SHELL32.78]
|
---|
106 | */
|
---|
107 | BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle)
|
---|
108 | {
|
---|
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);
|
---|
111 | }
|
---|
112 |
|
---|
113 | BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle)
|
---|
114 | {
|
---|
115 | TRACE("(%p, %x, %s, %x)\n", lpwStr, nwStr, debugstr_wn(lpOle,nOle), nOle);
|
---|
116 |
|
---|
117 | if (lstrcpynW ( lpwStr, lpOle, nwStr))
|
---|
118 | { return lstrlenW (lpwStr);
|
---|
119 | }
|
---|
120 | return 0;
|
---|
121 | }
|
---|
122 |
|
---|
123 | BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn)
|
---|
124 | {
|
---|
125 | if (SHELL_OsIsUnicode())
|
---|
126 | return OleStrToStrNW (lpOut, nOut, lpIn, nIn);
|
---|
127 | return OleStrToStrNA (lpOut, nOut, lpIn, nIn);
|
---|
128 | }
|
---|