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