source: trunk/src/shell32/misc.cpp@ 1214

Last change on this file since 1214 was 1214, checked in by sandervl, 26 years ago

Moved new shell32 to current dir

File size: 13.8 KB
Line 
1/* $Id: misc.cpp,v 1.5 1999-10-09 11:13:19 sandervl Exp $ */
2
3/*
4 * Win32 SHELL32 for OS/2
5 * 1998/06/15 Patrick Haller (haller@zebra.fh-weingarten.de)
6 * Copyright 1997 Marcus Meissner
7 * Copyright 1988 Patrick Haller (adapted for win32os2)
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11
12
13/*****************************************************************************
14 * Includes *
15 *****************************************************************************/
16
17#include <odin.h>
18#include <wchar.h>
19#include <wcstr.h>
20
21#define ICOM_CINTERFACE 1
22
23//#include <os2win.h>
24#include <shellapi.h>
25#include <winnls.h>
26#include "shell32_main.h"
27#include <misc.h>
28//#include <string.h>
29//#include "winbase.h"
30#include <heapstring.h>
31
32/*****************************************************************************
33 * Types & Defines *
34 *****************************************************************************/
35
36
37/*****************************************************************************
38 * Name : HICON WIN32API ExtractAssociatedIconExA
39 * Purpose : Return icon for given file (either from file itself or from associated
40 * executable) and patch parameters if needed.
41 * Parameters: ???
42 * Variables :
43 * Result :
44 * Remark : SHELL.150
45 * Status : UNTESTED UNKNOWN STUB
46 *
47 * Author : Christoph Bratschi [Fri, 1999/08/6 20:00]
48 *****************************************************************************/
49
50HICON WIN32API ExtractAssociatedIconExA(HINSTANCE hInst,
51 LPSTR lpIconPath,
52 LPWORD lpiIcon)
53{
54 dprintf(("SHELL32: undoc ExtractAssociatedIconExA\n"));
55
56 return ExtractAssociatedIconA(hInst,lpIconPath,lpiIcon);
57}
58
59/*****************************************************************************
60 * Name : HICON WIN32API ExtractAssociatedIconW
61 * Purpose : Return icon for given file (either from file itself or from associated
62 * executable) and patch parameters if needed.
63 * Parameters:
64 * Variables :
65 * Result :
66 * Remark : SHELL.36
67 * Status : UNTESTED STUB
68 *
69 * Author : Patrick Haller [Sat, 1998/07/11 11:55]
70 *****************************************************************************/
71
72HICON WIN32API ExtractAssociatedIconW(HINSTANCE hInst,
73 LPWSTR lpIconPath,
74 LPWORD lpiIcon)
75{
76 LPSTR lpIconPathAscii = UnicodeToAsciiString(lpIconPath);
77 HICON hIcon;
78
79 dprintf(("SHELL32: ExtractAssociatedIconW(%08xh,%s,%08xh)\n",
80 hInst,
81 lpIconPathAscii,
82 lpiIcon));
83
84 hIcon = ExtractAssociatedIconA(hInst,
85 lpIconPathAscii,
86 lpiIcon);
87
88 FreeAsciiString(lpIconPathAscii);
89
90 return (hIcon);
91}
92
93/*****************************************************************************
94 * Name : HICON WIN32API ExtractAssociatedIconExW
95 * Purpose : Return icon for given file (either from file itself or from associated
96 * executable) and patch parameters if needed.
97 * Parameters: ???
98 * Variables :
99 * Result :
100 * Remark : SHELL.186
101 * Status : UNTESTED UNKNOWN STUB
102 *
103 * Author : Christoph Bratschi [Fri, 1999/08/6 20:00]
104 *****************************************************************************/
105
106HICON WIN32API ExtractAssociatedIconExW(HINSTANCE hInst,
107 LPWSTR lpIconPath,
108 LPWORD lpiIcon)
109{
110 dprintf(("SHELL32: undoc ExtractAssociatedIconExW\n"));
111
112 return ExtractAssociatedIconW(hInst,lpIconPath,lpiIcon);
113}
114
115
116/*****************************************************************************
117 * Name : OleStrToStrN
118 * Purpose :
119 * Parameters:
120 * Variables :
121 * Result :
122 * Remark : SHELL32.78
123 * Status : UNTESTED UNKNOWN STUB
124 *
125 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
126 *****************************************************************************/
127
128BOOL WIN32API OleStrToStrN (LPSTR lpMulti,
129 INT nMulti,
130 LPCWSTR lpWide,
131 INT nWide)
132{
133 dprintf(("SHELL32: OleStrToStrN(%08xh,%08xh,%08xh,%08xh)\n",
134 lpMulti,
135 nMulti,
136 lpWide,
137 nWide));
138
139 return WideCharToMultiByte (0,
140 0,
141 lpWide,
142 nWide,
143 lpMulti,
144 nMulti,
145 NULL,
146 NULL);
147}
148
149
150/*****************************************************************************
151 * Name : StrToOleStrN
152 * Purpose :
153 * Parameters:
154 * Variables :
155 * Result :
156 * Remark : SHELL32.79
157 * Status : UNTESTED UNKNOWN STUB
158 *
159 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
160 *****************************************************************************/
161
162BOOL WIN32API StrToOleStrN (LPWSTR lpWide,
163 INT nWide,
164 LPCSTR lpMulti,
165 INT nMulti)
166{
167 dprintf(("SHELL32: StrToOleStrN(%08xh,%08xh,%08xh,%08xh)\n",
168 lpWide,
169 nWide,
170 lpMulti,
171 nMulti));
172
173 return MultiByteToWideChar (0,
174 0,
175 lpMulti,
176 nMulti,
177 lpWide,
178 nWide);
179}
180
181
182/*****************************************************************************
183 * Name : StrRetToStrN
184 * Purpose : converts a STRRET to a normal string
185 * Parameters: the pidl is for STRRET OFFSET
186 * Variables :
187 * Result :
188 * Remark : SHELL32.96
189 * Status : UNTESTED UNKNOWN STUB
190 *
191 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
192 *****************************************************************************/
193
194HRESULT WIN32API StrRetToStrN (LPVOID dest,
195 DWORD len,
196 LPSTRRET src,
197 LPITEMIDLIST pidl)
198{
199 dprintf(("SHELL32: StrRetToStrN(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
200 dest,
201 len,
202 src,
203 pidl));
204
205 switch (src->uType)
206 {
207 case STRRET_WSTR:
208 WideCharToMultiByte(CP_ACP,
209 0,
210 src->u.pOleStr,
211 -1,
212 (LPSTR)dest,
213 len,
214 NULL,
215 NULL);
216 SHFree(src->u.pOleStr);
217 break;
218
219 case STRRET_CSTRA:
220 //if (VERSION_OsIsUnicode())
221 // lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
222 //else
223 strncpy((LPSTR)dest,
224 src->u.cStr,
225 len);
226 break;
227
228 case STRRET_OFFSETA:
229 if (pidl)
230 {
231 //if(VERSION_OsIsUnicode())
232 // lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
233 //else
234 strncpy((LPSTR)dest,
235 ((LPCSTR)&pidl->mkid)+src->u.uOffset,
236 len);
237 break;
238 }
239
240 default:
241 dprintf(("SHELL32: StrRetToStrN: unknown type!\n"));
242
243 if (len)
244 *(LPSTR)dest = '\0';
245
246 return(FALSE);
247 }
248 return(TRUE);
249}
250
251
252/*****************************************************************************
253 * Name : SHELL32_654
254 * Purpose :
255 * Parameters:
256 * Variables :
257 * Result :
258 * Remark : SHELL32.654
259 * Status : UNTESTED UNKNOWN STUB
260 *
261 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
262 *****************************************************************************/
263
264HRESULT WIN32API SHELL32_654 (DWORD x,
265 DWORD y)
266{
267 dprintf(("SHELL32: SHELL32_654(%08xh,%08xh) not implemented.\n",
268 x,
269 y));
270 return 0;
271}
272
273
274/*****************************************************************************
275 * Name : StrToOleStr
276 * Purpose :
277 * Parameters:
278 * Variables :
279 * Result :
280 * Remark : SHELL32.163
281 * Status : UNTESTED UNKNOWN STUB
282 *
283 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
284 *****************************************************************************/
285
286int WIN32API StrToOleStr (LPWSTR lpWideCharStr,
287 LPCSTR lpMultiByteString)
288{
289 dprintf(("SHELL32: StrToOleStr(%08xh,%08xh)\n",
290 lpWideCharStr,
291 lpMultiByteString));
292
293 return MultiByteToWideChar(0,
294 0,
295 lpMultiByteString,
296 -1,
297 lpWideCharStr,
298 MAX_PATH);
299}
300
301
302/*****************************************************************************
303 * Name : StrCpyNW
304 * Purpose :
305 * Parameters:
306 * Variables :
307 * Result :
308 * Remark : SHELL32.310 - used by winfile.exe
309 * Status : UNTESTED UNKNOWN STUB
310 *
311 * Author : Christoph Bratschi [Fri, 1999/08/6 19:00]
312 *****************************************************************************/
313
314LPWSTR WIN32API StrCpyNW(LPWSTR lpString1,LPWSTR lpString2,int iMaxLength)
315{
316 dprintf(("SHELL32: undoc StrCpyNW\n"));
317
318 return lstrcpynW(lpString1,lpString2,iMaxLength);
319}
320
321/*****************************************************************************
322 * Name : StrNCpyW
323 * Purpose :
324 * Parameters:
325 * Variables :
326 * Result :
327 * Remark : SHELL32.316 - used by winfile.exe
328 * Status : UNTESTED UNKNOWN STUB
329 *
330 * Author : Christoph Bratschi [Fri, 1999/08/6 19:00]
331 *****************************************************************************/
332
333LPWSTR WIN32API StrNCpyW(LPWSTR lpString1,LPWSTR lpString2)
334{
335 dprintf(("SHELL32: undoc StrNCpyW\n"));
336
337 return lstrcpyW(lpString1,lpString2);
338}
339
340
341/*****************************************************************************
342 * Name : InternalExtractIconListA
343 * Purpose :
344 * Parameters: ???
345 * Variables :
346 * Result :
347 * Remark : SHELL32.221 - used by progman.exe
348 * Status : UNTESTED UNKNOWN STUB
349 *
350 * Author : Christoph Bratschi [Fri, 1999/08/6 19:00]
351 *****************************************************************************/
352
353void WIN32API InternalExtractIconListA(VOID)
354{
355 dprintf(("SHELL32: undoc InternalExtractIconListA \n"));
356}
357
358/*****************************************************************************
359 * Name : InternalExtractIconListW
360 * Purpose :
361 * Parameters: ???
362 * Variables :
363 * Result :
364 * Remark : SHELL32.222 - used by progman.exe
365 * Status : UNTESTED UNKNOWN STUB
366 *
367 * Author : Christoph Bratschi [Fri, 1999/08/6 19:00]
368 *****************************************************************************/
369
370void WIN32API InternalExtractIconListW(VOID)
371{
372 dprintf(("SHELL32: undoc InternalExtractIconListW\n"));
373}
374
375/*****************************************************************************
376 * Name : ExtractIconResInfoA
377 * Purpose :
378 * Parameters: ???
379 * Variables :
380 * Result :
381 * Remark : SHELL32.192 - used by progman.exe
382 * Status : UNTESTED UNKNOWN STUB
383 *
384 * Author : Christoph Bratschi [Fri, 1999/08/6 19:00]
385 *****************************************************************************/
386
387void WIN32API ExtractIconResInfoA(VOID)
388{
389 dprintf(("SHELL32: undoc ExtractIconResInfoA\n"));
390}
391
392/*****************************************************************************
393 * Name : ExtractIconResInfoW
394 * Purpose :
395 * Parameters: ???
396 * Variables :
397 * Result :
398 * Remark : SHELL32.193 - used by progman.exe
399 * Status : UNTESTED UNKNOWN STUB
400 *
401 * Author : Christoph Bratschi [Fri, 1999/08/6 19:00]
402 *****************************************************************************/
403
404void WIN32API ExtractIconResInfoW(VOID)
405{
406 dprintf(("SHELL32: undoc ExtractIconResInfoW\n"));
407}
408
409/*************************************************************************
410 * FindEnvironmentString [SHELL.38]
411 *
412 * Returns a pointer into the DOS environment... Ugh.
413 */
414LPSTR SHELL_FindStringA(LPSTR lpEnv, LPCSTR entry)
415{ UINT16 l;
416
417 //TRACE_(shell)("\n");
418
419 l = strlen(entry);
420 for( ; *lpEnv ; lpEnv+=strlen(lpEnv)+1 )
421 { if( lstrncmpiA(lpEnv, entry, l) )
422 continue;
423 if( !*(lpEnv+l) )
424 return (lpEnv + l); /* empty entry */
425 else if ( *(lpEnv+l)== '=' )
426 return (lpEnv + l + 1);
427 }
428 return NULL;
429}
430
431
432/*****************************************************************************
433 * Name : CheckEscapesA
434 * Purpose :
435 * Parameters: ???
436 * Variables :
437 * Result :
438 * Remark : SHELL32.3 - used by progman.exe
439 * Status : UNTESTED UNKNOWN STUB
440 *
441 * Author : Christoph Bratschi [Fri, 1999/08/6 19:00]
442 *****************************************************************************/
443
444void WIN32API CheckEscapesA(DWORD x1,DWORD x2)
445{
446 dprintf(("SHELL32: undoc CheckEscapesA\n"));
447}
448
449/*****************************************************************************
450 * Name : CheckEscapesW
451 * Purpose :
452 * Parameters: ???
453 * Variables :
454 * Result :
455 * Remark : SHELL32.6 - used by progman.exe
456 * Status : UNTESTED UNKNOWN STUB
457 *
458 * Author : Christoph Bratschi [Fri, 1999/08/6 19:00]
459 *****************************************************************************/
460
461void WIN32API CheckEscapesW(DWORD x1,DWORD x2)
462{
463 dprintf(("SHELL32: undoc CheckEscapesW\n"));
464}
465
466/*****************************************************************************
467 * Name : DuplicateIcon
468 * Purpose :
469 * Parameters: ???
470 * Variables :
471 * Result :
472 * Remark : SHELL32.138 - used by progman.exe
473 * Status : UNTESTED UNKNOWN STUB
474 *
475 * Author : Christoph Bratschi [Fri, 1999/08/6 19:00]
476 *****************************************************************************/
477
478DWORD WIN32API DuplicateIcon(DWORD x1)
479{
480 dprintf(("SHELL32: undoc DuplicateIcon\n"));
481
482 return 0;
483}
Note: See TracBrowser for help on using the repository browser.