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