2 * USER string functions
4 * Copyright 1993 Yngvi Sigurjonsson (yngvi@hafro.is)
5 * Copyright 1996 Alexandre Julliard
6 * Copyright 1996 Marcus Meissner
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
35 #include "wine/exception.h"
38 /***********************************************************************
39 * CharNextExW (USER32.@)
41 LPWSTR WINAPI
CharNextExW( WORD codepage
, LPCWSTR ptr
, DWORD flags
)
43 /* doesn't make sense, there are no codepages for Unicode */
48 /***********************************************************************
49 * CharPrevExW (USER32.@)
51 LPSTR WINAPI
CharPrevExW( WORD codepage
, LPCWSTR start
, LPCWSTR ptr
, DWORD flags
)
53 /* doesn't make sense, there are no codepages for Unicode */
58 /***********************************************************************
59 * CharToOemA (USER32.@)
61 BOOL WINAPI
CharToOemA( LPCSTR s
, LPSTR d
)
63 if (!s
|| !d
) return FALSE
;
64 return CharToOemBuffA( s
, d
, strlen( s
) + 1 );
68 /***********************************************************************
69 * CharToOemBuffA (USER32.@)
71 BOOL WINAPI
CharToOemBuffA( LPCSTR s
, LPSTR d
, DWORD len
)
75 if (!s
|| !d
) return FALSE
;
77 bufW
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) );
80 MultiByteToWideChar( CP_ACP
, 0, s
, len
, bufW
, len
);
81 WideCharToMultiByte( CP_OEMCP
, 0, bufW
, len
, d
, len
, NULL
, NULL
);
82 HeapFree( GetProcessHeap(), 0, bufW
);
88 /***********************************************************************
89 * CharToOemBuffW (USER32.@)
91 BOOL WINAPI
CharToOemBuffW( LPCWSTR s
, LPSTR d
, DWORD len
)
93 if (!s
|| !d
) return FALSE
;
94 WideCharToMultiByte( CP_OEMCP
, 0, s
, len
, d
, len
, NULL
, NULL
);
99 /***********************************************************************
100 * CharToOemW (USER32.@)
102 BOOL WINAPI
CharToOemW( LPCWSTR s
, LPSTR d
)
104 if (!s
|| !d
) return FALSE
;
105 return CharToOemBuffW( s
, d
, lstrlenW( s
) + 1 );
109 /***********************************************************************
110 * OemToCharA (USER32.@)
112 BOOL WINAPI
OemToCharA( LPCSTR s
, LPSTR d
)
114 if (!s
|| !d
) return FALSE
;
115 return OemToCharBuffA( s
, d
, strlen( s
) + 1 );
119 /***********************************************************************
120 * OemToCharBuffA (USER32.@)
122 BOOL WINAPI
OemToCharBuffA( LPCSTR s
, LPSTR d
, DWORD len
)
126 if (!s
|| !d
) return FALSE
;
128 bufW
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) );
131 MultiByteToWideChar( CP_OEMCP
, 0, s
, len
, bufW
, len
);
132 WideCharToMultiByte( CP_ACP
, 0, bufW
, len
, d
, len
, NULL
, NULL
);
133 HeapFree( GetProcessHeap(), 0, bufW
);
139 /***********************************************************************
140 * OemToCharBuffW (USER32.@)
142 BOOL WINAPI
OemToCharBuffW( LPCSTR s
, LPWSTR d
, DWORD len
)
144 if (!s
|| !d
) return FALSE
;
145 MultiByteToWideChar( CP_OEMCP
, MB_PRECOMPOSED
| MB_USEGLYPHCHARS
, s
, len
, d
, len
);
150 /***********************************************************************
151 * OemToCharW (USER32.@)
153 BOOL WINAPI
OemToCharW( LPCSTR s
, LPWSTR d
)
155 if (!s
|| !d
) return FALSE
;
156 return OemToCharBuffW( s
, d
, strlen( s
) + 1 );