1 | //Note: Odin changes marked by #ifdef __WIN32OS2__!
|
---|
2 | #ifdef __WIN32OS2__
|
---|
3 | #include <odin.h>
|
---|
4 | #include <odinwrap.h>
|
---|
5 | #include <os2sel.h>
|
---|
6 |
|
---|
7 | #include <string.h>
|
---|
8 | #include <wctype.h>
|
---|
9 | #include <wcstr.h>
|
---|
10 | #define HAVE_WCTYPE_H
|
---|
11 | #include <win\shlwapi.h>
|
---|
12 |
|
---|
13 | #include <heapstring.h>
|
---|
14 | #include <winnls.h>
|
---|
15 | #endif
|
---|
16 | #include <ctype.h>
|
---|
17 | #include <stdlib.h>
|
---|
18 | #include <stdio.h>
|
---|
19 | #include <string.h>
|
---|
20 |
|
---|
21 | #include "winerror.h"
|
---|
22 | #include "windef.h"
|
---|
23 | #include "winbase.h"
|
---|
24 | #include "wingdi.h"
|
---|
25 | #include "winuser.h"
|
---|
26 | #include "shlwapi.h"
|
---|
27 | #include "shlobj.h"
|
---|
28 | #include "wine/unicode.h"
|
---|
29 | #include "debugtools.h"
|
---|
30 |
|
---|
31 | #ifdef __WIN32OS2__
|
---|
32 | #undef FIXME
|
---|
33 | #ifdef DEBUG
|
---|
34 | #define FIXME WriteLog("FIXME %s", __FUNCTION__); WriteLog
|
---|
35 | #else
|
---|
36 | #define FIXME 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
|
---|
37 | #endif
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | DEFAULT_DEBUG_CHANNEL(shell);
|
---|
41 |
|
---|
42 | /*************************************************************************
|
---|
43 | * StrChrA [SHLWAPI]
|
---|
44 | */
|
---|
45 | LPSTR WINAPI StrChrA (LPCSTR str, WORD c)
|
---|
46 | {
|
---|
47 | TRACE("%s %i\n", str,c);
|
---|
48 | return strchr(str, c);
|
---|
49 | }
|
---|
50 |
|
---|
51 | /*************************************************************************
|
---|
52 | * StrChrW [SHLWAPI]
|
---|
53 | *
|
---|
54 | */
|
---|
55 | LPWSTR WINAPI StrChrW (LPCWSTR str, WCHAR x )
|
---|
56 | {
|
---|
57 | TRACE("%s 0x%04x\n",debugstr_w(str),x);
|
---|
58 | return strchrW(str, x);
|
---|
59 | }
|
---|
60 | #ifndef __WIN32OS2__
|
---|
61 | /*************************************************************************
|
---|
62 | * StrCmpIW [SHLWAPI]
|
---|
63 | */
|
---|
64 | int WINAPI StrCmpIW ( LPCWSTR wstr1, LPCWSTR wstr2 )
|
---|
65 | {
|
---|
66 | TRACE("%s %s\n", debugstr_w(wstr1),debugstr_w(wstr2));
|
---|
67 | return strcmpiW( wstr1, wstr2 );
|
---|
68 | }
|
---|
69 | #endif
|
---|
70 |
|
---|
71 | /*************************************************************************
|
---|
72 | * StrCmpNA [SHLWAPI]
|
---|
73 | */
|
---|
74 | INT WINAPI StrCmpNA ( LPCSTR str1, LPCSTR str2, INT len)
|
---|
75 | {
|
---|
76 | TRACE("%s %s %i stub\n", str1,str2,len);
|
---|
77 | return strncmp(str1, str2, len);
|
---|
78 | }
|
---|
79 |
|
---|
80 | /*************************************************************************
|
---|
81 | * StrCmpNW [SHLWAPI]
|
---|
82 | */
|
---|
83 | INT WINAPI StrCmpNW ( LPCWSTR wstr1, LPCWSTR wstr2, INT len)
|
---|
84 | {
|
---|
85 | TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
|
---|
86 | return strncmpW(wstr1, wstr2, len);
|
---|
87 | }
|
---|
88 |
|
---|
89 | /*************************************************************************
|
---|
90 | * StrCmpNIA [SHLWAPI]
|
---|
91 | */
|
---|
92 | int WINAPI StrCmpNIA ( LPCSTR str1, LPCSTR str2, int len)
|
---|
93 | {
|
---|
94 | TRACE("%s %s %i stub\n", str1,str2,len);
|
---|
95 | return strncasecmp(str1, str2, len);
|
---|
96 | }
|
---|
97 |
|
---|
98 | /*************************************************************************
|
---|
99 | * StrCmpNIW [SHLWAPI]
|
---|
100 | */
|
---|
101 | int WINAPI StrCmpNIW ( LPCWSTR wstr1, LPCWSTR wstr2, int len)
|
---|
102 | {
|
---|
103 | TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
|
---|
104 | return strncmpiW(wstr1, wstr2, len);
|
---|
105 | }
|
---|
106 |
|
---|
107 | /*************************************************************************
|
---|
108 | * StrCmpW [SHLWAPI]
|
---|
109 | */
|
---|
110 | int WINAPI StrCmpW ( LPCWSTR wstr1, LPCWSTR wstr2 )
|
---|
111 | {
|
---|
112 | TRACE("%s %s\n", debugstr_w(wstr1),debugstr_w(wstr2));
|
---|
113 | return strcmpW( wstr1, wstr2 );
|
---|
114 | }
|
---|
115 |
|
---|
116 | /*************************************************************************
|
---|
117 | * StrCatW [SHLWAPI]
|
---|
118 | */
|
---|
119 | LPWSTR WINAPI StrCatW( LPWSTR wstr1, LPCWSTR wstr2 )
|
---|
120 | {
|
---|
121 | return strcatW( wstr1, wstr2 );
|
---|
122 | }
|
---|
123 |
|
---|
124 |
|
---|
125 | /*************************************************************************
|
---|
126 | * StrCpyW [SHLWAPI]
|
---|
127 | */
|
---|
128 | LPWSTR WINAPI StrCpyW( LPWSTR wstr1, LPCWSTR wstr2 )
|
---|
129 | {
|
---|
130 | return strcpyW( wstr1, wstr2 );
|
---|
131 | }
|
---|
132 |
|
---|
133 |
|
---|
134 | /*************************************************************************
|
---|
135 | * StrCpyNW [SHLWAPI]
|
---|
136 | */
|
---|
137 | LPWSTR WINAPI StrCpyNW( LPWSTR wstr1, LPCWSTR wstr2, int n )
|
---|
138 | {
|
---|
139 | return lstrcpynW( wstr1, wstr2, n );
|
---|
140 | }
|
---|
141 |
|
---|
142 |
|
---|
143 | /*************************************************************************
|
---|
144 | * StrStrA [SHLWAPI]
|
---|
145 | */
|
---|
146 | LPSTR WINAPI StrStrA(LPCSTR lpFirst, LPCSTR lpSrch)
|
---|
147 | {
|
---|
148 | while (*lpFirst)
|
---|
149 | {
|
---|
150 | LPCSTR p1 = lpFirst, p2 = lpSrch;
|
---|
151 | while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
|
---|
152 | if (!*p2) return (LPSTR)lpFirst;
|
---|
153 | lpFirst++;
|
---|
154 | }
|
---|
155 | return NULL;
|
---|
156 | }
|
---|
157 |
|
---|
158 | /*************************************************************************
|
---|
159 | * StrStrW [SHLWAPI]
|
---|
160 | */
|
---|
161 | LPWSTR WINAPI StrStrW(LPCWSTR lpFirst, LPCWSTR lpSrch)
|
---|
162 | {
|
---|
163 | while (*lpFirst)
|
---|
164 | {
|
---|
165 | LPCWSTR p1 = lpFirst, p2 = lpSrch;
|
---|
166 | while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
|
---|
167 | if (!*p2) return (LPWSTR)lpFirst;
|
---|
168 | lpFirst++;
|
---|
169 | }
|
---|
170 | return NULL;
|
---|
171 | }
|
---|
172 |
|
---|
173 | /*************************************************************************
|
---|
174 | * StrStrIA [SHLWAPI]
|
---|
175 | */
|
---|
176 | LPSTR WINAPI StrStrIA(LPCSTR lpFirst, LPCSTR lpSrch)
|
---|
177 | {
|
---|
178 | while (*lpFirst)
|
---|
179 | {
|
---|
180 | LPCSTR p1 = lpFirst, p2 = lpSrch;
|
---|
181 | while (*p1 && *p2 && toupper(*p1) == toupper(*p2)) { p1++; p2++; }
|
---|
182 | if (!*p2) return (LPSTR)lpFirst;
|
---|
183 | lpFirst++;
|
---|
184 | }
|
---|
185 | return NULL;
|
---|
186 | }
|
---|
187 |
|
---|
188 | /*************************************************************************
|
---|
189 | * StrStrIW [SHLWAPI]
|
---|
190 | */
|
---|
191 | LPWSTR WINAPI StrStrIW(LPCWSTR lpFirst, LPCWSTR lpSrch)
|
---|
192 | {
|
---|
193 | while (*lpFirst)
|
---|
194 | {
|
---|
195 | LPCWSTR p1 = lpFirst, p2 = lpSrch;
|
---|
196 | while (*p1 && *p2 && toupperW(*p1) == toupperW(*p2)) { p1++; p2++; }
|
---|
197 | if (!*p2) return (LPWSTR)lpFirst;
|
---|
198 | lpFirst++;
|
---|
199 | }
|
---|
200 | return NULL;
|
---|
201 | }
|
---|
202 |
|
---|
203 | /*************************************************************************
|
---|
204 | * StrToIntA [SHLWAPI]
|
---|
205 | */
|
---|
206 | int WINAPI StrToIntA(LPCSTR lpSrc)
|
---|
207 | {
|
---|
208 | TRACE("%s\n", lpSrc);
|
---|
209 | return atol(lpSrc);
|
---|
210 | }
|
---|
211 |
|
---|
212 | /*************************************************************************
|
---|
213 | * StrToIntW [SHLWAPI]
|
---|
214 | */
|
---|
215 | int WINAPI StrToIntW(LPCWSTR lpSrc)
|
---|
216 | {
|
---|
217 | char buffer[32];
|
---|
218 |
|
---|
219 | TRACE("%s\n", debugstr_w(lpSrc));
|
---|
220 | WideCharToMultiByte( CP_ACP, 0, lpSrc, -1, buffer, sizeof(buffer), NULL, NULL );
|
---|
221 | buffer[sizeof(buffer)-1] = 0;
|
---|
222 | return atol(buffer);
|
---|
223 | }
|
---|
224 |
|
---|
225 | /*************************************************************************
|
---|
226 | * StrToIntExA [SHLWAPI]
|
---|
227 | */
|
---|
228 | BOOL WINAPI StrToIntExA( LPCSTR pszString, DWORD dwFlags, LPINT piRet)
|
---|
229 | {
|
---|
230 | TRACE("%s %ld stub !\n", debugstr_a(pszString), dwFlags);
|
---|
231 | piRet = (LPINT) StrToIntA(pszString);
|
---|
232 | return TRUE;
|
---|
233 | }
|
---|
234 |
|
---|
235 | /*************************************************************************
|
---|
236 | * StrToIntExW [SHLWAPI]
|
---|
237 | */
|
---|
238 | BOOL WINAPI StrToIntExW( LPCWSTR pszString, DWORD dwFlags, LPINT piRet)
|
---|
239 | {
|
---|
240 | TRACE("%s %ld stub !\n", debugstr_w(pszString), dwFlags);
|
---|
241 | piRet = (LPINT) StrToIntW(pszString);
|
---|
242 | return TRUE;
|
---|
243 | }
|
---|
244 |
|
---|
245 | /*************************************************************************
|
---|
246 | * StrDupA [SHLWAPI]
|
---|
247 | */
|
---|
248 | LPSTR WINAPI StrDupA (LPCSTR lpSrc)
|
---|
249 | {
|
---|
250 | int len = strlen(lpSrc);
|
---|
251 | LPSTR lpDest = (LPSTR) LocalAlloc(LMEM_FIXED, len+1);
|
---|
252 |
|
---|
253 | TRACE("%s\n", lpSrc);
|
---|
254 |
|
---|
255 | if (lpDest) strcpy(lpDest, lpSrc);
|
---|
256 | return lpDest;
|
---|
257 | }
|
---|
258 |
|
---|
259 | /*************************************************************************
|
---|
260 | * StrDupW [SHLWAPI]
|
---|
261 | */
|
---|
262 | LPWSTR WINAPI StrDupW (LPCWSTR lpSrc)
|
---|
263 | {
|
---|
264 | int len = strlenW(lpSrc);
|
---|
265 | LPWSTR lpDest = (LPWSTR) LocalAlloc(LMEM_FIXED, sizeof(WCHAR) * (len+1));
|
---|
266 |
|
---|
267 | TRACE("%s\n", debugstr_w(lpSrc));
|
---|
268 |
|
---|
269 | if (lpDest) strcpyW(lpDest, lpSrc);
|
---|
270 | return lpDest;
|
---|
271 | }
|
---|
272 |
|
---|
273 | /*************************************************************************
|
---|
274 | * StrCSpnA [SHLWAPI]
|
---|
275 | */
|
---|
276 | int WINAPI StrCSpnA (LPCSTR lpStr, LPCSTR lpSet)
|
---|
277 | {
|
---|
278 | int i,j, pos = strlen(lpStr);
|
---|
279 |
|
---|
280 | TRACE("(%p %s %p %s)\n",
|
---|
281 | lpStr, debugstr_a(lpStr), lpSet, debugstr_a(lpSet));
|
---|
282 |
|
---|
283 | for (i=0; i < strlen(lpSet) ; i++ )
|
---|
284 | {
|
---|
285 | for (j = 0; j < pos;j++)
|
---|
286 | {
|
---|
287 | if (lpStr[j] == lpSet[i])
|
---|
288 | {
|
---|
289 | pos = j;
|
---|
290 | }
|
---|
291 | }
|
---|
292 | }
|
---|
293 | TRACE("-- %u\n", pos);
|
---|
294 | return pos;
|
---|
295 | }
|
---|
296 |
|
---|
297 | /*************************************************************************
|
---|
298 | * StrCSpnW [SHLWAPI]
|
---|
299 | */
|
---|
300 | int WINAPI StrCSpnW (LPCWSTR lpStr, LPCWSTR lpSet)
|
---|
301 | {
|
---|
302 | int i,j, pos = strlenW(lpStr);
|
---|
303 |
|
---|
304 | TRACE("(%p %s %p %s)\n",
|
---|
305 | lpStr, debugstr_w(lpStr), lpSet, debugstr_w(lpSet));
|
---|
306 |
|
---|
307 | for (i=0; i < strlenW(lpSet) ; i++ )
|
---|
308 | {
|
---|
309 | for (j = 0; j < pos;j++)
|
---|
310 | {
|
---|
311 | if (lpStr[j] == lpSet[i])
|
---|
312 | {
|
---|
313 | pos = j;
|
---|
314 | }
|
---|
315 | }
|
---|
316 | }
|
---|
317 | TRACE("-- %u\n", pos);
|
---|
318 | return pos;
|
---|
319 | }
|
---|
320 |
|
---|
321 | /**************************************************************************
|
---|
322 | * StrRChrA [SHLWAPI.@]
|
---|
323 | *
|
---|
324 | */
|
---|
325 | LPSTR WINAPI StrRChrA( LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch )
|
---|
326 | {
|
---|
327 | LPCSTR lpGotIt = NULL;
|
---|
328 | BOOL dbcs = IsDBCSLeadByte( LOBYTE(wMatch) );
|
---|
329 |
|
---|
330 | TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
|
---|
331 |
|
---|
332 | if (!lpEnd) lpEnd = lpStart + strlen(lpStart);
|
---|
333 |
|
---|
334 | for(; lpStart < lpEnd; lpStart = CharNextA(lpStart))
|
---|
335 | {
|
---|
336 | if (*lpStart != LOBYTE(wMatch)) continue;
|
---|
337 | if (dbcs && lpStart[1] != HIBYTE(wMatch)) continue;
|
---|
338 | lpGotIt = lpStart;
|
---|
339 | }
|
---|
340 | return (LPSTR)lpGotIt;
|
---|
341 | }
|
---|
342 |
|
---|
343 |
|
---|
344 | /**************************************************************************
|
---|
345 | * StrRChrW [SHLWAPI.@]
|
---|
346 | *
|
---|
347 | */
|
---|
348 | LPWSTR WINAPI StrRChrW( LPCWSTR lpStart, LPCWSTR lpEnd, WORD wMatch)
|
---|
349 | {
|
---|
350 | LPCWSTR lpGotIt = NULL;
|
---|
351 |
|
---|
352 | TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
|
---|
353 | if (!lpEnd) lpEnd = lpStart + strlenW(lpStart);
|
---|
354 |
|
---|
355 | for(; lpStart < lpEnd; lpStart = CharNextW(lpStart))
|
---|
356 | if (*lpStart == wMatch) lpGotIt = lpStart;
|
---|
357 |
|
---|
358 | return (LPWSTR)lpGotIt;
|
---|
359 | }
|
---|
360 |
|
---|
361 |
|
---|
362 | /*************************************************************************
|
---|
363 | * StrCatBuffA [SHLWAPI]
|
---|
364 | *
|
---|
365 | * Appends back onto front, stopping when front is size-1 characters long.
|
---|
366 | * Returns front.
|
---|
367 | *
|
---|
368 | */
|
---|
369 | LPSTR WINAPI StrCatBuffA(LPSTR front, LPCSTR back, INT size)
|
---|
370 | {
|
---|
371 | LPSTR dst = front + strlen(front);
|
---|
372 | LPCSTR src = back, end = front + size - 1;
|
---|
373 |
|
---|
374 | while(dst < end && *src)
|
---|
375 | *dst++ = *src++;
|
---|
376 | *dst = '\0';
|
---|
377 | return front;
|
---|
378 | }
|
---|
379 |
|
---|
380 | /*************************************************************************
|
---|
381 | * StrCatBuffW [SHLWAPI]
|
---|
382 | *
|
---|
383 | * Appends back onto front, stopping when front is size-1 characters long.
|
---|
384 | * Returns front.
|
---|
385 | *
|
---|
386 | */
|
---|
387 | LPWSTR WINAPI StrCatBuffW(LPWSTR front, LPCWSTR back, INT size)
|
---|
388 | {
|
---|
389 | LPWSTR dst = front + strlenW(front);
|
---|
390 | LPCWSTR src = back, end = front + size - 1;
|
---|
391 |
|
---|
392 | while(dst < end && *src)
|
---|
393 | *dst++ = *src++;
|
---|
394 | *dst = '\0';
|
---|
395 | return front;
|
---|
396 | }
|
---|
397 |
|
---|
398 | /*************************************************************************
|
---|
399 | * StrRetToBufA [SHLWAPI.@]
|
---|
400 | *
|
---|
401 | * converts a STRRET to a normal string
|
---|
402 | *
|
---|
403 | * NOTES
|
---|
404 | * the pidl is for STRRET OFFSET
|
---|
405 | */
|
---|
406 | HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, DWORD len)
|
---|
407 | {
|
---|
408 | TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
|
---|
409 |
|
---|
410 | switch (src->uType)
|
---|
411 | {
|
---|
412 | case STRRET_WSTR:
|
---|
413 | WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
|
---|
414 | /* SHFree(src->u.pOleStr); FIXME: is this right? */
|
---|
415 | break;
|
---|
416 |
|
---|
417 | case STRRET_CSTRA:
|
---|
418 | lstrcpynA((LPSTR)dest, src->u.cStr, len);
|
---|
419 | break;
|
---|
420 |
|
---|
421 | case STRRET_OFFSETA:
|
---|
422 | lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
|
---|
423 | break;
|
---|
424 |
|
---|
425 | default:
|
---|
426 | FIXME("unknown type!\n");
|
---|
427 | if (len)
|
---|
428 | {
|
---|
429 | *(LPSTR)dest = '\0';
|
---|
430 | }
|
---|
431 | return(FALSE);
|
---|
432 | }
|
---|
433 | return S_OK;
|
---|
434 | }
|
---|
435 |
|
---|
436 | /*************************************************************************
|
---|
437 | * StrRetToBufW [SHLWAPI.@]
|
---|
438 | *
|
---|
439 | * converts a STRRET to a normal string
|
---|
440 | *
|
---|
441 | * NOTES
|
---|
442 | * the pidl is for STRRET OFFSET
|
---|
443 | */
|
---|
444 | HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, DWORD len)
|
---|
445 | {
|
---|
446 | TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
|
---|
447 |
|
---|
448 | switch (src->uType)
|
---|
449 | {
|
---|
450 | case STRRET_WSTR:
|
---|
451 | lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
|
---|
452 | /* SHFree(src->u.pOleStr); FIXME: is this right? */
|
---|
453 | break;
|
---|
454 |
|
---|
455 | case STRRET_CSTRA:
|
---|
456 | if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len)
|
---|
457 | dest[len-1] = 0;
|
---|
458 | break;
|
---|
459 |
|
---|
460 | case STRRET_OFFSETA:
|
---|
461 | if (pidl)
|
---|
462 | {
|
---|
463 | if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1,
|
---|
464 | dest, len ) && len)
|
---|
465 | dest[len-1] = 0;
|
---|
466 | }
|
---|
467 | break;
|
---|
468 |
|
---|
469 | default:
|
---|
470 | FIXME("unknown type!\n");
|
---|
471 | if (len)
|
---|
472 | { *(LPSTR)dest = '\0';
|
---|
473 | }
|
---|
474 | return(FALSE);
|
---|
475 | }
|
---|
476 | return S_OK;
|
---|
477 | }
|
---|
478 |
|
---|
479 | /*************************************************************************
|
---|
480 | * StrFormatByteSizeA [SHLWAPI]
|
---|
481 | */
|
---|
482 | LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf )
|
---|
483 | { char buf[64];
|
---|
484 | TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
|
---|
485 | if ( dw<1024L )
|
---|
486 | { sprintf (buf,"%ld bytes", dw);
|
---|
487 | }
|
---|
488 | else if ( dw<1048576L)
|
---|
489 | { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
|
---|
490 | }
|
---|
491 | else if ( dw < 1073741824L)
|
---|
492 | { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
|
---|
493 | }
|
---|
494 | else
|
---|
495 | { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
|
---|
496 | }
|
---|
497 | lstrcpynA (pszBuf, buf, cchBuf);
|
---|
498 | return pszBuf;
|
---|
499 | }
|
---|
500 |
|
---|
501 | /*************************************************************************
|
---|
502 | * StrFormatByteSizeW [SHLWAPI]
|
---|
503 | */
|
---|
504 | LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf )
|
---|
505 | {
|
---|
506 | char buf[64];
|
---|
507 | StrFormatByteSizeA( dw, buf, sizeof(buf) );
|
---|
508 | if (!MultiByteToWideChar( CP_ACP, 0, buf, -1, pszBuf, cchBuf ) && cchBuf)
|
---|
509 | pszBuf[cchBuf-1] = 0;
|
---|
510 | return pszBuf;
|
---|
511 | }
|
---|
512 |
|
---|
513 | /*************************************************************************
|
---|
514 | * StrNCatA [SHLWAPI]
|
---|
515 | */
|
---|
516 | LPSTR WINAPI StrNCatA(LPSTR front, LPCSTR back, INT cchMax)
|
---|
517 | {
|
---|
518 | TRACE("%s %s %i stub\n", debugstr_a(front),debugstr_a(back),cchMax);
|
---|
519 | return (front);
|
---|
520 | }
|
---|
521 |
|
---|
522 | /*************************************************************************
|
---|
523 | * StrNCatW [SHLWAPI]
|
---|
524 | */
|
---|
525 | LPWSTR WINAPI StrNCatW(LPWSTR front, LPCWSTR back, INT cchMax)
|
---|
526 | {
|
---|
527 | TRACE("%s %s %i stub\n", debugstr_w(front),debugstr_w(back),cchMax);
|
---|
528 | return (front);
|
---|
529 | }
|
---|
530 |
|
---|
531 | /*************************************************************************
|
---|
532 | * StrTrimA [SHLWAPI.@]
|
---|
533 | */
|
---|
534 | BOOL WINAPI StrTrimA(LPSTR pszSource, LPCSTR pszTrimChars)
|
---|
535 | {
|
---|
536 | BOOL trimmed = FALSE;
|
---|
537 | LPSTR pSrc;
|
---|
538 | LPCSTR pTrim;
|
---|
539 |
|
---|
540 | TRACE("('%s', '%s');\n", pszSource, pszTrimChars);
|
---|
541 | for (pTrim = pszTrimChars; *pTrim; pTrim++)
|
---|
542 | {
|
---|
543 | for (pSrc = pszSource; *pSrc; pSrc++)
|
---|
544 | if (*pSrc == *pTrim)
|
---|
545 | {
|
---|
546 | /* match -> remove this char.
|
---|
547 | * strlen(pSrc) equiv. to the correct strlen(pSrc+1)+1 */
|
---|
548 | memmove(pSrc, pSrc+1, strlen(pSrc));
|
---|
549 | trimmed = TRUE;
|
---|
550 | }
|
---|
551 | }
|
---|
552 | TRACE("<- '%s'\n", pszSource);
|
---|
553 | return trimmed;
|
---|
554 | }
|
---|
555 |
|
---|
556 | /*************************************************************************
|
---|
557 | * wnsprintfA [SHLWAPI]
|
---|
558 | */
|
---|
559 | int WINAPIV wnsprintfA(LPSTR lpOut, int cchLimitIn, LPCSTR lpFmt, ...)
|
---|
560 | {
|
---|
561 | va_list valist;
|
---|
562 | INT res;
|
---|
563 |
|
---|
564 | va_start( valist, lpFmt );
|
---|
565 | res = wvsnprintfA( lpOut, cchLimitIn, lpFmt, valist );
|
---|
566 | va_end( valist );
|
---|
567 | return res;
|
---|
568 | }
|
---|
569 |
|
---|
570 | /*************************************************************************
|
---|
571 | * wnsprintfW [SHLWAPI]
|
---|
572 | */
|
---|
573 | int WINAPIV wnsprintfW(LPWSTR lpOut, int cchLimitIn, LPCWSTR lpFmt, ...)
|
---|
574 | {
|
---|
575 | va_list valist;
|
---|
576 | INT res;
|
---|
577 |
|
---|
578 | va_start( valist, lpFmt );
|
---|
579 | res = wvsnprintfW( lpOut, cchLimitIn, lpFmt, valist );
|
---|
580 | va_end( valist );
|
---|
581 | return res;
|
---|
582 | }
|
---|