Fix segmentation fault caused by incorrect referencing of client audio
[wine] / dlls / shell32 / shell.c
1 /*
2  *                              Shell Library Functions
3  *
4  * Copyright 1998 Marcus Meissner
5  * Copyright 2000 Juergen Schmied
6  * Copyright 2002 Eric Pouech
7  *
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.
12  *
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.
17  *
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #include "config.h"
24 #include "wine/port.h"
25
26 #include <stdarg.h>
27 #include <stdlib.h>
28 #include <string.h>
29 #ifdef HAVE_UNISTD_H
30 # include <unistd.h>
31 #endif
32 #include <ctype.h>
33
34 #include "windef.h"
35 #include "winbase.h"
36 #include "winerror.h"
37 #include "winreg.h"
38 #include "wownt32.h"
39 #include "dlgs.h"
40 #include "shellapi.h"
41 #include "winuser.h"
42 #include "wingdi.h"
43 #include "shlobj.h"
44 #include "shlwapi.h"
45 #include "ddeml.h"
46
47 #include "wine/winbase16.h"
48 #include "wine/winuser16.h"
49 #include "shell32_main.h"
50
51 #include "wine/debug.h"
52
53 WINE_DEFAULT_DEBUG_CHANNEL(shell);
54 WINE_DECLARE_DEBUG_CHANNEL(exec);
55
56
57 typedef struct {     /* structure for dropped files */
58  WORD     wSize;
59  POINT16  ptMousePos;
60  BOOL16   fInNonClientArea;
61  /* memory block with filenames follows */
62 } DROPFILESTRUCT16, *LPDROPFILESTRUCT16;
63
64 static const char*      lpstrMsgWndCreated = "OTHERWINDOWCREATED";
65 static const char*      lpstrMsgWndDestroyed = "OTHERWINDOWDESTROYED";
66 static const char*      lpstrMsgShellActivate = "ACTIVATESHELLWINDOW";
67
68 static HWND     SHELL_hWnd = 0;
69 static HHOOK    SHELL_hHook = 0;
70 static UINT     uMsgWndCreated = 0;
71 static UINT     uMsgWndDestroyed = 0;
72 static UINT     uMsgShellActivate = 0;
73 HINSTANCE16     SHELL_hInstance = 0;
74 HINSTANCE SHELL_hInstance32;
75 static int SHELL_Attach = 0;
76
77 /***********************************************************************
78  * DllEntryPoint [SHELL.101]
79  *
80  * Initialization code for shell.dll. Automatically loads the
81  * 32-bit shell32.dll to allow thunking up to 32-bit code.
82  *
83  * RETURNS
84  *  Success: TRUE. Initialization completed successfully.
85  *  Failure: FALSE.
86  */
87 BOOL WINAPI SHELL_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst,
88                                 WORD ds, WORD HeapSize, DWORD res1, WORD res2)
89 {
90     TRACE("(%08lx, %04x, %04x, %04x, %08lx, %04x)\n",
91           Reason, hInst, ds, HeapSize, res1, res2);
92
93     switch(Reason)
94     {
95     case DLL_PROCESS_ATTACH:
96         if (SHELL_Attach++) break;
97         SHELL_hInstance = hInst;
98         if(!SHELL_hInstance32)
99         {
100             if(!(SHELL_hInstance32 = LoadLibraryA("shell32.dll")))
101             {
102                 ERR("Could not load sibling shell32.dll\n");
103                 return FALSE;
104             }
105         }
106         break;
107
108     case DLL_PROCESS_DETACH:
109         if(!--SHELL_Attach)
110         {
111             SHELL_hInstance = 0;
112             if(SHELL_hInstance32)
113                 FreeLibrary(SHELL_hInstance32);
114         }
115         break;
116     }
117     return TRUE;
118 }
119
120 /*************************************************************************
121  *                              DragAcceptFiles         [SHELL.9]
122  */
123 void WINAPI DragAcceptFiles16(HWND16 hWnd, BOOL16 b)
124 {
125   DragAcceptFiles(HWND_32(hWnd), b);
126 }
127
128 /*************************************************************************
129  *                              DragQueryFile           [SHELL.11]
130  */
131 UINT16 WINAPI DragQueryFile16(
132         HDROP16 hDrop,
133         WORD wFile,
134         LPSTR lpszFile,
135         WORD wLength)
136 {
137         LPSTR lpDrop;
138         UINT i = 0;
139         LPDROPFILESTRUCT16 lpDropFileStruct = (LPDROPFILESTRUCT16) GlobalLock16(hDrop);
140
141         TRACE("(%04x, %x, %p, %u)\n", hDrop,wFile,lpszFile,wLength);
142
143         if(!lpDropFileStruct) goto end;
144
145         lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->wSize;
146
147         while (i++ < wFile)
148         {
149           while (*lpDrop++); /* skip filename */
150           if (!*lpDrop)
151           {
152             i = (wFile == 0xFFFF) ? i : 0;
153             goto end;
154           }
155         }
156
157         i = strlen(lpDrop);
158         i++;
159         if (!lpszFile ) goto end;   /* needed buffer size */
160         i = (wLength > i) ? i : wLength;
161         lstrcpynA (lpszFile,  lpDrop,  i);
162 end:
163         GlobalUnlock16(hDrop);
164         return i;
165 }
166
167 /*************************************************************************
168  *                              DragFinish              [SHELL.12]
169  */
170 void WINAPI DragFinish16(HDROP16 h)
171 {
172     TRACE("\n");
173     GlobalFree16((HGLOBAL16)h);
174 }
175
176
177 /*************************************************************************
178  *                              DragQueryPoint          [SHELL.13]
179  */
180 BOOL16 WINAPI DragQueryPoint16(HDROP16 hDrop, POINT16 *p)
181 {
182   LPDROPFILESTRUCT16 lpDropFileStruct;
183   BOOL16           bRet;
184   TRACE("\n");
185   lpDropFileStruct = (LPDROPFILESTRUCT16) GlobalLock16(hDrop);
186
187   memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT16));
188   bRet = lpDropFileStruct->fInNonClientArea;
189
190   GlobalUnlock16(hDrop);
191   return bRet;
192 }
193
194 /*************************************************************************
195  *             FindExecutable   (SHELL.21)
196  */
197 HINSTANCE16 WINAPI FindExecutable16( LPCSTR lpFile, LPCSTR lpDirectory,
198                                      LPSTR lpResult )
199 { return HINSTANCE_16(FindExecutableA( lpFile, lpDirectory, lpResult ));
200 }
201
202 /*************************************************************************
203  *             AboutDlgProc   (SHELL.33)
204  */
205 BOOL16 WINAPI AboutDlgProc16( HWND16 hWnd, UINT16 msg, WPARAM16 wParam,
206                                LPARAM lParam )
207 { return (BOOL16)AboutDlgProc( HWND_32(hWnd), msg, wParam, lParam );
208 }
209
210
211 /*************************************************************************
212  *             ShellAbout   (SHELL.22)
213  */
214 BOOL16 WINAPI ShellAbout16( HWND16 hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
215                             HICON16 hIcon )
216 { return ShellAboutA( HWND_32(hWnd), szApp, szOtherStuff, HICON_32(hIcon) );
217 }
218
219 /*************************************************************************
220  *                      InternalExtractIcon             [SHELL.39]
221  *
222  * This abortion is called directly by Progman
223  */
224 HGLOBAL16 WINAPI InternalExtractIcon16(HINSTANCE16 hInstance,
225                                      LPCSTR lpszExeFileName, UINT16 nIconIndex, WORD n )
226 {
227     HGLOBAL16 hRet = 0;
228     HICON16 *RetPtr = NULL;
229     OFSTRUCT ofs;
230
231         TRACE("(%04x,file %s,start %d,extract %d\n",
232                        hInstance, lpszExeFileName, nIconIndex, n);
233
234         if (!n)
235           return 0;
236
237         hRet = GlobalAlloc16(GMEM_FIXED | GMEM_ZEROINIT, sizeof(*RetPtr) * n);
238         RetPtr = (HICON16*)GlobalLock16(hRet);
239
240         if (nIconIndex == (UINT16)-1)  /* get number of icons */
241         {
242           RetPtr[0] = PrivateExtractIconsA(ofs.szPathName, 0, 0, 0, NULL, NULL, 0, LR_DEFAULTCOLOR);
243         }
244         else
245         {
246           UINT ret;
247           HICON *icons;
248
249           icons = HeapAlloc(GetProcessHeap(), 0, n * sizeof(*icons));
250           ret = PrivateExtractIconsA(ofs.szPathName, nIconIndex,
251                                      GetSystemMetrics(SM_CXICON),
252                                      GetSystemMetrics(SM_CYICON),
253                                      icons, NULL, n, LR_DEFAULTCOLOR);
254           if ((ret != 0xffffffff) && ret)
255           {
256             int i;
257             for (i = 0; i < n; i++) RetPtr[i] = HICON_16(icons[i]);
258           }
259           else
260           {
261             GlobalFree16(hRet);
262             hRet = 0;
263           }
264           HeapFree(GetProcessHeap(), 0, icons);
265         }
266         return hRet;
267 }
268
269 /*************************************************************************
270  *             ExtractIcon   (SHELL.34)
271  */
272 HICON16 WINAPI ExtractIcon16( HINSTANCE16 hInstance, LPCSTR lpszExeFileName,
273         UINT16 nIconIndex )
274 {   TRACE("\n");
275     return HICON_16(ExtractIconA(HINSTANCE_32(hInstance), lpszExeFileName, nIconIndex));
276 }
277
278 /*************************************************************************
279  *             ExtractIconEx   (SHELL.40)
280  */
281 HICON16 WINAPI ExtractIconEx16(
282         LPCSTR lpszFile, INT16 nIconIndex, HICON16 *phiconLarge,
283         HICON16 *phiconSmall, UINT16 nIcons
284 ) {
285     HICON       *ilarge,*ismall;
286     UINT16      ret;
287     int         i;
288
289     if (phiconLarge)
290         ilarge = HeapAlloc(GetProcessHeap(),0,nIcons*sizeof(HICON));
291     else
292         ilarge = NULL;
293     if (phiconSmall)
294         ismall = HeapAlloc(GetProcessHeap(),0,nIcons*sizeof(HICON));
295     else
296         ismall = NULL;
297     ret = HICON_16(ExtractIconExA(lpszFile,nIconIndex,ilarge,ismall,nIcons));
298     if (ilarge) {
299         for (i=0;i<nIcons;i++)
300             phiconLarge[i]=HICON_16(ilarge[i]);
301         HeapFree(GetProcessHeap(),0,ilarge);
302     }
303     if (ismall) {
304         for (i=0;i<nIcons;i++)
305             phiconSmall[i]=HICON_16(ismall[i]);
306         HeapFree(GetProcessHeap(),0,ismall);
307     }
308     return ret;
309 }
310
311 /*************************************************************************
312  *                              ExtractAssociatedIcon   [SHELL.36]
313  *
314  * Return icon for given file (either from file itself or from associated
315  * executable) and patch parameters if needed.
316  */
317 HICON16 WINAPI ExtractAssociatedIcon16(HINSTANCE16 hInst, LPSTR lpIconPath, LPWORD lpiIcon)
318 {
319     return HICON_16(ExtractAssociatedIconA(HINSTANCE_32(hInst), lpIconPath,
320                     lpiIcon));
321 }
322
323 /*************************************************************************
324  *                              FindEnvironmentString   [SHELL.38]
325  *
326  * Returns a pointer into the DOS environment... Ugh.
327  */
328 static LPSTR SHELL_FindString(LPSTR lpEnv, LPCSTR entry)
329 { UINT16 l;
330
331   TRACE("\n");
332
333   l = strlen(entry);
334   for( ; *lpEnv ; lpEnv+=strlen(lpEnv)+1 )
335   { if( strncasecmp(lpEnv, entry, l) )
336       continue;
337         if( !*(lpEnv+l) )
338             return (lpEnv + l);                 /* empty entry */
339         else if ( *(lpEnv+l)== '=' )
340             return (lpEnv + l + 1);
341     }
342     return NULL;
343 }
344
345 /**********************************************************************/
346
347 SEGPTR WINAPI FindEnvironmentString16(LPSTR str)
348 { SEGPTR  spEnv;
349   LPSTR lpEnv,lpString;
350   TRACE("\n");
351
352   spEnv = GetDOSEnvironment16();
353
354   lpEnv = MapSL(spEnv);
355   lpString = (spEnv)?SHELL_FindString(lpEnv, str):NULL;
356
357     if( lpString )              /*  offset should be small enough */
358         return spEnv + (lpString - lpEnv);
359     return (SEGPTR)NULL;
360 }
361
362 /*************************************************************************
363  *                              DoEnvironmentSubst      [SHELL.37]
364  *
365  * Replace %KEYWORD% in the str with the value of variable KEYWORD
366  * from "DOS" environment. If it is not found the %KEYWORD% is left
367  * intact. If the buffer is too small, str is not modified.
368  *
369  * str         [I] '\0' terminated string with %keyword%.
370  *             [O] '\0' terminated string with %keyword% substituted.
371  * length      [I] size of str.
372  *
373  * Return
374  *     str length in the LOWORD and 1 in HIWORD if subst was successful.
375  */
376 DWORD WINAPI DoEnvironmentSubst16(LPSTR str,WORD length)
377 {
378   LPSTR   lpEnv = MapSL(GetDOSEnvironment16());
379   LPSTR   lpstr = str;
380   LPSTR   lpend;
381   LPSTR   lpBuffer = HeapAlloc( GetProcessHeap(), 0, length);
382   WORD    bufCnt = 0;
383   WORD    envKeyLen;
384   LPSTR   lpKey;
385   WORD    retStatus = 0;
386   WORD    retLength = length;
387
388   CharToOemA(str,str);
389
390   TRACE("accept %s\n", str);
391
392   while( *lpstr && bufCnt <= length - 1 ) {
393      if ( *lpstr != '%' ) {
394         lpBuffer[bufCnt++] = *lpstr++;
395         continue;
396      }
397
398      for( lpend = lpstr + 1; *lpend && *lpend != '%'; lpend++) /**/;
399
400      envKeyLen = lpend - lpstr - 1;
401      if( *lpend != '%' || envKeyLen == 0)
402         goto err; /* "%\0" or "%%" found; back off and whine */
403
404      *lpend = '\0';
405      lpKey = SHELL_FindString(lpEnv, lpstr+1);
406      *lpend = '%';
407      if( lpKey ) {
408          int l = strlen(lpKey);
409
410          if( bufCnt + l > length - 1 )
411                 goto err;
412
413         memcpy(lpBuffer + bufCnt, lpKey, l);
414         bufCnt += l;
415      } else { /* Keyword not found; Leave the %KEYWORD% intact */
416         if( bufCnt + envKeyLen + 2 > length - 1 )
417             goto err;
418
419          memcpy(lpBuffer + bufCnt, lpstr, envKeyLen + 2);
420         bufCnt += envKeyLen + 2;
421      }
422
423      lpstr = lpend + 1;
424   }
425
426   if (!*lpstr && bufCnt <= length - 1) {
427       memcpy(str,lpBuffer, bufCnt);
428       str[bufCnt] = '\0';
429       retLength = bufCnt + 1;
430       retStatus = 1;
431   }
432
433   err:
434   if (!retStatus)
435       WARN("-- Env subst aborted - string too short or invalid input\n");
436   TRACE("-- return %s\n", str);
437
438   OemToCharA(str,str);
439   HeapFree( GetProcessHeap(), 0, lpBuffer);
440
441   return (DWORD)MAKELONG(retLength, retStatus);
442 }
443
444 /*************************************************************************
445  *                              SHELL_HookProc
446  *
447  * 32-bit version of the system-wide WH_SHELL hook.
448  */
449 static LRESULT WINAPI SHELL_HookProc(INT code, WPARAM wParam, LPARAM lParam)
450 {
451     TRACE("%i, %x, %08lx\n", code, wParam, lParam );
452
453     if (SHELL_hWnd)
454     {
455         switch( code )
456         {
457         case HSHELL_WINDOWCREATED:
458             PostMessageA( SHELL_hWnd, uMsgWndCreated, wParam, 0 );
459             break;
460         case HSHELL_WINDOWDESTROYED:
461             PostMessageA( SHELL_hWnd, uMsgWndDestroyed, wParam, 0 );
462             break;
463         case HSHELL_ACTIVATESHELLWINDOW:
464             PostMessageA( SHELL_hWnd, uMsgShellActivate, wParam, 0 );
465             break;
466         }
467     }
468     return CallNextHookEx( SHELL_hHook, code, wParam, lParam );
469 }
470
471 /*************************************************************************
472  *                              ShellHookProc           [SHELL.103]
473  * System-wide WH_SHELL hook.
474  */
475 LRESULT WINAPI ShellHookProc16(INT16 code, WPARAM16 wParam, LPARAM lParam)
476 {
477     return SHELL_HookProc( code, wParam, lParam );
478 }
479
480 /*************************************************************************
481  *                              RegisterShellHook       [SHELL.102]
482  */
483 BOOL WINAPI RegisterShellHook16(HWND16 hWnd, UINT16 uAction)
484 {
485     TRACE("%04x [%u]\n", hWnd, uAction );
486
487     switch( uAction )
488     {
489     case 2:  /* register hWnd as a shell window */
490         if( !SHELL_hHook )
491         {
492             SHELL_hHook = SetWindowsHookExA( WH_SHELL, SHELL_HookProc,
493                                              GetModuleHandleA("shell32.dll"), 0 );
494             if ( SHELL_hHook )
495             {
496                 uMsgWndCreated = RegisterWindowMessageA( lpstrMsgWndCreated );
497                 uMsgWndDestroyed = RegisterWindowMessageA( lpstrMsgWndDestroyed );
498                 uMsgShellActivate = RegisterWindowMessageA( lpstrMsgShellActivate );
499             }
500             else
501                 WARN("-- unable to install ShellHookProc()!\n");
502         }
503
504         if ( SHELL_hHook )
505             return ((SHELL_hWnd = HWND_32(hWnd)) != 0);
506         break;
507
508     default:
509         WARN("-- unknown code %i\n", uAction );
510         SHELL_hWnd = 0; /* just in case */
511     }
512     return FALSE;
513 }
514
515
516 /***********************************************************************
517  *           DriveType   (SHELL.262)
518  */
519 UINT16 WINAPI DriveType16( UINT16 drive )
520 {
521     UINT ret;
522     char path[] = "A:\\";
523     path[0] += drive;
524     ret = GetDriveTypeA(path);
525     switch(ret)  /* some values are not supported in Win16 */
526     {
527     case DRIVE_CDROM:
528         ret = DRIVE_REMOTE;
529         break;
530     case DRIVE_NO_ROOT_DIR:
531         ret = DRIVE_UNKNOWN;
532         break;
533     }
534     return ret;
535 }
536
537
538 /* 0 and 1 are valid rootkeys in win16 shell.dll and are used by
539  * some programs. Do not remove those cases. -MM
540  */
541 static inline void fix_win16_hkey( HKEY *hkey )
542 {
543     if (*hkey == 0 || *hkey == (HKEY)1) *hkey = HKEY_CLASSES_ROOT;
544 }
545
546 /******************************************************************************
547  *           RegOpenKey   [SHELL.1]
548  */
549 DWORD WINAPI RegOpenKey16( HKEY hkey, LPCSTR name, PHKEY retkey )
550 {
551     fix_win16_hkey( &hkey );
552     return RegOpenKeyA( hkey, name, retkey );
553 }
554
555 /******************************************************************************
556  *           RegCreateKey   [SHELL.2]
557  */
558 DWORD WINAPI RegCreateKey16( HKEY hkey, LPCSTR name, PHKEY retkey )
559 {
560     fix_win16_hkey( &hkey );
561     return RegCreateKeyA( hkey, name, retkey );
562 }
563
564 /******************************************************************************
565  *           RegCloseKey   [SHELL.3]
566  */
567 DWORD WINAPI RegCloseKey16( HKEY hkey )
568 {
569     fix_win16_hkey( &hkey );
570     return RegCloseKey( hkey );
571 }
572
573 /******************************************************************************
574  *           RegDeleteKey   [SHELL.4]
575  */
576 DWORD WINAPI RegDeleteKey16( HKEY hkey, LPCSTR name )
577 {
578     fix_win16_hkey( &hkey );
579     return RegDeleteKeyA( hkey, name );
580 }
581
582 /******************************************************************************
583  *           RegSetValue   [SHELL.5]
584  */
585 DWORD WINAPI RegSetValue16( HKEY hkey, LPCSTR name, DWORD type, LPCSTR data, DWORD count )
586 {
587     fix_win16_hkey( &hkey );
588     return RegSetValueA( hkey, name, type, data, count );
589 }
590
591 /******************************************************************************
592  *           RegQueryValue   [SHELL.6]
593  *
594  * NOTES
595  *    Is this HACK still applicable?
596  *
597  * HACK
598  *    The 16bit RegQueryValue doesn't handle selectorblocks anyway, so we just
599  *    mask out the high 16 bit.  This (not so much incidently) hopefully fixes
600  *    Aldus FH4)
601  */
602 DWORD WINAPI RegQueryValue16( HKEY hkey, LPCSTR name, LPSTR data, LPDWORD count
603 )
604 {
605     fix_win16_hkey( &hkey );
606     if (count) *count &= 0xffff;
607     return RegQueryValueA( hkey, name, data, count );
608 }
609
610 /******************************************************************************
611  *           RegEnumKey   [SHELL.7]
612  */
613 DWORD WINAPI RegEnumKey16( HKEY hkey, DWORD index, LPSTR name, DWORD name_len )
614 {
615     fix_win16_hkey( &hkey );
616     return RegEnumKeyA( hkey, index, name, name_len );
617 }
618
619 /*************************************************************************
620  *           SHELL_Execute16 [Internal]
621  */
622 static UINT SHELL_Execute16(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
623                             LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out)
624 {
625     UINT ret;
626     char sCmd[MAX_PATH];
627     WideCharToMultiByte(CP_ACP, 0, lpCmd, -1, sCmd, MAX_PATH, NULL, NULL);
628     ret = WinExec16(sCmd, (UINT16)psei->nShow);
629     psei_out->hInstApp = HINSTANCE_32(ret);
630     return ret;
631 }
632
633 /*************************************************************************
634  *                              ShellExecute            [SHELL.20]
635  */
636 HINSTANCE16 WINAPI ShellExecute16( HWND16 hWnd, LPCSTR lpOperation,
637                                    LPCSTR lpFile, LPCSTR lpParameters,
638                                    LPCSTR lpDirectory, INT16 iShowCmd )
639 {
640     SHELLEXECUTEINFOW seiW;
641     WCHAR *wVerb = NULL, *wFile = NULL, *wParameters = NULL, *wDirectory = NULL;
642     HANDLE hProcess = 0;
643
644     seiW.lpVerb = lpOperation ? __SHCloneStrAtoW(&wVerb, lpOperation) : NULL;
645     seiW.lpFile = lpFile ? __SHCloneStrAtoW(&wFile, lpFile) : NULL;
646     seiW.lpParameters = lpParameters ? __SHCloneStrAtoW(&wParameters, lpParameters) : NULL;
647     seiW.lpDirectory = lpDirectory ? __SHCloneStrAtoW(&wDirectory, lpDirectory) : NULL;
648
649     seiW.cbSize = sizeof(seiW);
650     seiW.fMask = 0;
651     seiW.hwnd = HWND_32(hWnd);
652     seiW.nShow = iShowCmd;
653     seiW.lpIDList = 0;
654     seiW.lpClass = 0;
655     seiW.hkeyClass = 0;
656     seiW.dwHotKey = 0;
657     seiW.hProcess = hProcess;
658
659     ShellExecuteExW32 (&seiW, SHELL_Execute16);
660
661     if (wVerb) SHFree(wVerb);
662     if (wFile) SHFree(wFile);
663     if (wParameters) SHFree(wParameters);
664     if (wDirectory) SHFree(wDirectory);
665
666     return HINSTANCE_16(seiW.hInstApp);
667 }