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